summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libstruct.tex
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-04-03 20:13:55 (GMT)
committerFred Drake <fdrake@acm.org>2000-04-03 20:13:55 (GMT)
commit38e5d27caee56b6958e0034e342abb48e6100390 (patch)
tree6a0c853da853123dd2e628e8ec187517250c2530 /Doc/lib/libstruct.tex
parent659ebfa79e891fc5e2480cd66c157970df57c451 (diff)
downloadcpython-38e5d27caee56b6958e0034e342abb48e6100390.zip
cpython-38e5d27caee56b6958e0034e342abb48e6100390.tar.gz
cpython-38e5d27caee56b6958e0034e342abb48e6100390.tar.bz2
Merged changes from the 1.5.2p2 release.
(Very rough.)
Diffstat (limited to 'Doc/lib/libstruct.tex')
-rw-r--r--Doc/lib/libstruct.tex46
1 files changed, 29 insertions, 17 deletions
diff --git a/Doc/lib/libstruct.tex b/Doc/lib/libstruct.tex
index eef84a4..434b433 100644
--- a/Doc/lib/libstruct.tex
+++ b/Doc/lib/libstruct.tex
@@ -45,23 +45,35 @@ The module defines the following exception and functions:
Format characters have the following meaning; the conversion between
C and Python values should be obvious given their types:
-\begin{tableiii}{c|l|l}{samp}{Format}{C Type}{Python}
- \lineiii{x}{pad byte}{no value}
- \lineiii{c}{\ctype{char}}{string of length 1}
- \lineiii{b}{\ctype{signed char}}{integer}
- \lineiii{B}{\ctype{unsigned char}}{integer}
- \lineiii{h}{\ctype{short}}{integer}
- \lineiii{H}{\ctype{unsigned short}}{integer}
- \lineiii{i}{\ctype{int}}{integer}
- \lineiii{I}{\ctype{unsigned int}}{integer}
- \lineiii{l}{\ctype{long}}{integer}
- \lineiii{L}{\ctype{unsigned long}}{integer}
- \lineiii{f}{\ctype{float}}{float}
- \lineiii{d}{\ctype{double}}{float}
- \lineiii{s}{\ctype{char[]}}{string}
- \lineiii{p}{\ctype{char[]}}{string}
- \lineiii{P}{\ctype{void *}}{integer}
-\end{tableiii}
+\begin{tableiv}{c|l|l|c}{samp}{Format}{C Type}{Python}{Notes}
+ \lineiv{x}{pad byte}{no value}{}
+ \lineiv{c}{\ctype{char}}{string of length 1}{}
+ \lineiv{b}{\ctype{signed char}}{integer}{}
+ \lineiv{B}{\ctype{unsigned char}}{integer}{}
+ \lineiv{h}{\ctype{short}}{integer}{}
+ \lineiv{H}{\ctype{unsigned short}}{integer}{}
+ \lineiv{i}{\ctype{int}}{integer}{}
+ \lineiv{I}{\ctype{unsigned int}}{long}{(1)}
+ \lineiv{l}{\ctype{long}}{integer}{}
+ \lineiv{L}{\ctype{unsigned long}}{long}{}
+ \lineiv{f}{\ctype{float}}{float}{}
+ \lineiv{d}{\ctype{double}}{float}{}
+ \lineiv{s}{\ctype{char[]}}{string}{}
+ \lineiv{p}{\ctype{char[]}}{string}{}
+ \lineiv{P}{\ctype{void *}}{integer}{}
+\end{tableiv}
+
+\noindent
+Notes:
+
+\begin{description}
+\item[(1)]
+ The \character{I} conversion code will convert to a Python long if
+ the C \ctype{int} is the same size as a C \ctype{long}, which is
+ typical on most modern systems. If a C \ctype{int} is smaller than
+ a C \ctype{long}, an Python integer will be created instead.
+\end{description}
+
A format character may be preceded by an integral repeat count;
e.g.\ the format string \code{'4h'} means exactly the same as