[Python-checkins] CVS: python/dist/src/Doc/lib libstruct.tex,1.26,1.27

Tim Peters tim_one@users.sourceforge.net
Sun, 10 Jun 2001 16:40:21 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv6496/python/dist/src/Doc/lib

Modified Files:
	libstruct.tex 
Log Message:
Initial support for 'q' and 'Q' struct format codes:  for now, only in
native mode, and only when config #defines HAVE_LONG_LONG.  Standard mode
will eventually treat them as 8-byte ints across all platforms, but that
likely requires a new set of routines in longobject.c first (while
sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely
on x-platform to hold 8 bytes of int, so we'll have to roll our own;
I'm thinking of a simple pair of conversion functions, Python long
to/from sized vector of unsigned bytes; that may be useful for GMP
conversions too; std q/Q would call them with size fixed at 8).

test_struct.py:  In addition to adding some native-mode 'q' and 'Q' tests,
got rid of unused code, and repaired a non-portable assumption about
native sizeof(short) (it isn't 2 on some Cray boxes).

libstruct.tex:  In addition to adding a bit of 'q'/'Q' docs (more needed
later), removed an erroneous footnote about 'I' behavior.


Index: libstruct.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstruct.tex,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** libstruct.tex	2001/01/24 17:19:07	1.26
--- libstruct.tex	2001/06/10 23:40:19	1.27
***************
*** 54,60 ****
    \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}{}
--- 54,62 ----
    \lineiv{H}{\ctype{unsigned short}}{integer}{}
    \lineiv{i}{\ctype{int}}{integer}{}
!   \lineiv{I}{\ctype{unsigned int}}{long}{}
    \lineiv{l}{\ctype{long}}{integer}{}
    \lineiv{L}{\ctype{unsigned long}}{long}{}
+   \lineiv{q}{\ctype{long long}}{long}{(1)}
+   \lineiv{Q}{\ctype{unsigned long long}}{long}{(1)}
    \lineiv{f}{\ctype{float}}{float}{}
    \lineiv{d}{\ctype{double}}{float}{}
***************
*** 69,76 ****
  \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}
  
--- 71,77 ----
  \begin{description}
  \item[(1)]
!   The \character{q} and \character{Q} conversion codes are available in
!   native mode only if the platform C compiler supports C \ctype{long long},
!   or, on Windows, \ctype{__int64}.
  \end{description}