Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c0aa45fc
Commit
c0aa45fc
authored
Jun 11, 2007
by
Walter Dörwald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document PyUnicode_FromFormat().
parent
d7fb7644
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
Doc/api/concrete.tex
Doc/api/concrete.tex
+49
-0
No files found.
Doc/api/concrete.tex
View file @
c0aa45fc
...
...
@@ -1006,6 +1006,55 @@ use these APIs:
when
\var
{
u
}
is
\NULL
{}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
FromFormat
}{
const char *format, ...
}
Take a C
\cfunction
{
printf()
}
-style
\var
{
format
}
string and a
variable number of arguments, calculate the size of the resulting
Python unicode string and return a string with the values formatted into
it. The variable arguments must be C types and must correspond
exactly to the format characters in the
\var
{
format
}
string. The
following format characters are allowed:
% The descriptions for %zd and %zu are wrong, but the truth is complicated
% because not all compilers support the %z width modifier -- we fake it
% when necessary via interpolating PY_FORMAT_SIZE_T.
% %u, %lu, %zu should have "new in Python 2.5" blurbs.
\begin{tableiii}
{
l|l|l
}{
member
}{
Format Characters
}{
Type
}{
Comment
}
\lineiii
{
\%\%
}{
\emph
{
n/a
}}{
The literal
\%
character.
}
\lineiii
{
\%
c
}{
int
}{
A single character, represented as an C int.
}
\lineiii
{
\%
d
}{
int
}{
Exactly equivalent to
\code
{
printf("
\%
d")
}
.
}
\lineiii
{
\%
u
}{
unsigned int
}{
Exactly equivalent to
\code
{
printf("
\%
u")
}
.
}
\lineiii
{
\%
ld
}{
long
}{
Exactly equivalent to
\code
{
printf("
\%
ld")
}
.
}
\lineiii
{
\%
lu
}{
unsigned long
}{
Exactly equivalent to
\code
{
printf("
\%
lu")
}
.
}
\lineiii
{
\%
zd
}{
Py
_
ssize
_
t
}{
Exactly equivalent to
\code
{
printf("
\%
zd")
}
.
}
\lineiii
{
\%
zu
}{
size
_
t
}{
Exactly equivalent to
\code
{
printf("
\%
zu")
}
.
}
\lineiii
{
\%
i
}{
int
}{
Exactly equivalent to
\code
{
printf("
\%
i")
}
.
}
\lineiii
{
\%
x
}{
int
}{
Exactly equivalent to
\code
{
printf("
\%
x")
}
.
}
\lineiii
{
\%
s
}{
char*
}{
A null-terminated C character array.
}
\lineiii
{
\%
p
}{
void*
}{
The hex representation of a C pointer.
Mostly equivalent to
\code
{
printf("
\%
p")
}
except that it is
guaranteed to start with the literal
\code
{
0x
}
regardless of
what the platform's
\code
{
printf
}
yields.
}
\lineiii
{
\%
U
}{
PyObject*
}{
A unicode object.
}
\lineiii
{
\%
V
}{
PyObject*, char *
}{
A unicode object (which may be
\NULL
{}
)
and a null-terminated C character array as a second parameter (which
will be used, if the first parameter is
\NULL
{}
).
}
\lineiii
{
\%
S
}{
PyObject*
}{
The result of calling
\function
{
PyObject
_
Unicode()
}
.
}
\lineiii
{
\%
R
}{
PyObject*
}{
The result of calling
\function
{
PyObject
_
Repr()
}
.
}
\end{tableiii}
An unrecognized format character causes all the rest of the format
string to be copied as-is to the result string, and any extra
arguments discarded.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyUnicode
_
FromFormatV
}{
const char *format,
va
_
list vargs
}
Identical to
\function
{
PyUnicode
_
FromFormat()
}
except that it takes
exactly two arguments.
\end{cfuncdesc}
\begin{cfuncdesc}
{
Py
_
UNICODE*
}{
PyUnicode
_
AsUnicode
}{
PyObject *unicode
}
Return a read-only pointer to the Unicode object's internal
\ctype
{
Py
_
UNICODE
}
buffer,
\NULL
{}
if
\var
{
unicode
}
is not a Unicode
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment