Commit graph

742 commits

Author SHA1 Message Date
Guido van Rossum
6c87ecaff1 Changed the ``add/sub_offset'' hacks for dealing with C's unsigned
int/long types, and use the new PyLong_FromUnsignedLong() and
PyLong_AsUnsignedLong() interfaces instead.

Semantic change: the 'I' format will now always return a long int.
1997-01-03 19:08:16 +00:00
Roger E. Masse
5b0eba3ced Reindented. 1997-01-03 18:51:01 +00:00
Barry Warsaw
752300bbdf Check of return values and proper error handling. 1997-01-03 17:18:10 +00:00
Guido van Rossum
b9d338cbfb Fill pad bytes with zeros (fixing a bug dating from the very first version!). 1997-01-03 15:40:33 +00:00
Barry Warsaw
b9a781e177 Scratch the ears of gcc -Wall. 1997-01-03 00:26:28 +00:00
Barry Warsaw
929711765e Several changes:
- Conform to standard Python C coding styles.

- All static symbols were renamed and shorted.

- Eyeballed all return values and memory references.

- Fixed a bug in signal.pause() so that exceptions raised in signal
  handlers are now properly caught after pause() returns.

- Removed SIGCPU and SIGFSZ.  We surmise that these were typos for the
  previously missing SIGXCPU and SIGXFSZ.
1997-01-03 00:14:25 +00:00
Guido van Rossum
4ccc531f34 Ok, ok, I've fixed gradual underflow on packing too.
Still don't know what to do with Inf/NaN, so I raise an exception on
pack(), and something random decided by ldexp() will happen on
unpack().
1997-01-02 23:23:20 +00:00
Guido van Rossum
07ef655222 Oops -- unpack float/double didn't do the right thing if e==0. 1997-01-02 22:31:07 +00:00
Guido van Rossum
74679b455f Support float and double in non-native formats.
These use the ANSI/IEEE standard, which is also used by XDR;
so the _xdr module may become obsolete.
1997-01-02 22:21:36 +00:00
Barry Warsaw
9e3fceb5b3 rotorobj_setkey(): A single string argument is now required (i.e. no
long optional with nearly-no-op missing).
1997-01-02 20:36:36 +00:00
Guido van Rossum
60c50614e1 Added better handling of unsigned longs -- a Python long returned by
unpack('L', ...) is now acceptable to pack('L', ...).
1996-12-31 16:29:52 +00:00
Guido van Rossum
3aa27fd315 Fix the first bugs... treatment of 0 count was wrong, and memchr()
should be memset().
1996-12-31 02:10:45 +00:00
Guido van Rossum
f7e6b4b388 Pretty much rewritten to fulfull several long-standing wishes:
-- The whole implementation is now more table-driven.

-- Unsigned integers.  Format characters 'B', 'H', 'I' and 'L'
mean unsigned byte, short, int and long.  For 'I' and 'L', the return
value is a Python long integer if a Python plain integer can't
represent the required range (note: this is dependent on the size of
the relevant C types only, not of the sign of the actual value).

-- A new format character 's' packs/unpacks a string.  When given a
count prefix, this is the size of the string, not a repeat count like
for the other format characters; e.g. '10s' means a single 10-byte
string, while '10c' means 10 characters.  For packing, the string is
truncated or padded with null bytes as appropriate to make it fit.
For unpacking, the resulting string always has exactly the specified
number of bytes.  As a special case, '0s' means a single, empty
string (while '0c' means 0 characters).

-- Various byte order options.  The first character of the format
string determines the byte order, size and alignment, as follows:

First character		Byte order		size and alignment

	'@'		native			native
	'='		native			standard
	'<'		little-endian		standard
	'>'		big-endian		standard
	'!'		network (= big-endian)	standard

If the first character is not one of these, '@' is assumed.

Native byte order is big-endian or little-endian, depending on the
host system (e.g. Motorola and Sun are big-endian; Intel and DEC are
little-endian).

Native size and alignment are determined using the C compiler's sizeof
expression.  This is always combined with native byte order.

Standard size and alignment are as follows: no alignment is required
for any type (so you have to use pad bytes); short is 2 bytes; int and
long are 4 bytes.  In this mode, there is no support for float and
double.

Note the difference between '@' and '=': both use native byte order,
but the size and alignment of the latter is standardized.

The form '!' is available for those poor souls who can't remember
whether network byte order is big-endian or little-endian.

There is no way to indicate non-native byte order (i.e. force
byte-swapping); use the appropriate choice of '<' or '>'.
1996-12-31 01:41:25 +00:00
Roger E. Masse
fbd1d74286 Renamed.
However: "cgensupport.h" is still present... otherwise I get
	maaaany type errors... not sure if this needs more attention.
1996-12-24 19:39:23 +00:00
Barry Warsaw
aeb207c6b6 Reworked to check for memory problems (one potential found),
non-checked error return values, and where appropriate,
PyArg_ParseTuple() style argument parsing.

I also changed some function names and converted all malloc/free calls
to PyMem_NEW/PyMem_DEL.

Some stylistic changes and formatting standardization.
1996-12-23 23:36:24 +00:00
Roger E. Masse
7f33e403a4 Renamed. 1996-12-20 21:56:08 +00:00
Barry Warsaw
c357325663 Several changes. Test program to follow.
- Where optional arguments were being used, converted to
  PyArg_ParseTuple() style instead of nested PyArg_Parse() style.

- Check for and handle many potential error conditions that were never
  being tested.

- internal reg_* functions renamed to regobj_* (makes it easier to
  figure out which are global regex functions and which are for regex
  objects).

- reg_group (now regobj_group) was quite extensively reworked.  it no
  longer recurses to do its job (by factoring core functionality into
  a separate function that knows about string and integer indexes).

- some minor formatting fixes.

- regex_set_syntax() now invalidates the cache.  Without this change
  (in the example below), the second search would produce different
  output depending on whether the first search were performed or not
  (since performing the first search would cache the compiled object
  with RE_SYNTAX_EMACS, causing the second test to unexpectedly fail).

  regex.search('(a+)|(b+)', 'cdb')
  prev = regex.set_syntax(RE_SYNTAX_AWK)
  regex.search('(a+)|(b+)', 'cdb')
1996-12-20 21:56:07 +00:00
Roger E. Masse
a141f8a31a Renamed. 1996-12-20 20:50:39 +00:00
Barry Warsaw
4a34209468 1. Export open(2) flag constants for every defined constant
2. Reworked error checking in initposix() and initnt().
1996-12-19 23:50:02 +00:00
Barry Warsaw
bab218e420 Minor formatting changes. 1996-12-19 22:22:32 +00:00
Barry Warsaw
43d68b8fb0 Minor formatting changes. 1996-12-19 22:10:44 +00:00
Guido van Rossum
25405c786b Added the new getprotobyname() call to the module overview at the top. 1996-12-19 16:42:52 +00:00
Guido van Rossum
3901d85277 Added getprotobyname() interface. 1996-12-19 16:35:04 +00:00
Roger E. Masse
20c6381856 Removed references to getdoublearg and get2doublearg rename macros and
substituted the appropriate PyArg_Parse calls.  Retested.  All appears well.
1996-12-18 21:59:01 +00:00
Roger E. Masse
ec0b4af3d4 Eradicated all references to getintarg and getstrarg and substituded the
proper functions as defined in rename2.h.  Thanks Barry!
1996-12-18 20:07:39 +00:00
Roger E. Masse
cfe3b61c02 Opps, left out two defines needed for argument parsing. 1996-12-18 19:56:48 +00:00
Barry Warsaw
19f61ae196 Tabification changes only; the module was already newly named. 1996-12-18 19:50:00 +00:00
Roger E. Masse
b2b44e5b8a Renamed. 1996-12-18 19:37:32 +00:00
Guido van Rossum
2e6313930e Added Jeremy's resource module. 1996-12-18 18:37:27 +00:00
Guido van Rossum
4a4880966b Correct *another* mistake (initmath() always fell through to fatal error).
Watch it, Barry! :-)
1996-12-18 14:14:33 +00:00
Guido van Rossum
4c4cbf397b Correct 1-char typo / syntax error. 1996-12-18 14:12:22 +00:00
Guido van Rossum
c88c9cb23f Corrected two errors introduced by the renaming (and the subsequent
style corrections, I presume), found by Jack.  Added warning that this
has not been tested (Jack could only compile and link it).
1996-12-17 20:43:55 +00:00
Roger E. Masse
b15bef85a7 Renamed in a grand-ee-ous way! 1996-12-17 19:55:33 +00:00
Roger E. Masse
4ca4b07516 Opps, left in a /*#include "modsupport.h"*/ 1996-12-17 17:46:28 +00:00
Roger E. Masse
919213a098 Grandly renamed. 1996-12-17 17:42:22 +00:00
Guido van Rossum
4004e21484 Another fix for Split() -- don't refuse {"} but turn it into ".
This is needed because if a configure option has " as its value,
it will be rendered as {"}; after stripping one level of quoting it's
just ", on which splitlist will barf.
1996-12-17 01:25:36 +00:00
Guido van Rossum
0f868375ff Check errors returned by recursive call to Split(). 1996-12-17 01:02:18 +00:00
Barry Warsaw
fc93f75da7 Better error checking in initmath(). 1996-12-17 00:47:03 +00:00
Barry Warsaw
d0c1042ff2 Renamed. 1996-12-17 00:05:22 +00:00
Barry Warsaw
10f124c951 Updated to standard Python C coding style, and fixed a few error
checking nits.
1996-12-17 00:01:40 +00:00
Barry Warsaw
14ed5fb1ec initsignal(): Added SIGXCPU and SIGXFSZ. Left in the definitions for
SIGCPU and SIGFSZ but we're (Jeremy and I) are actually unsure whether
these were typos or if there are systems that use these alternate
names.  We've checked Solaris, SunOS, and IRIX; they contain only the
SIGX* names.
1996-12-16 20:24:22 +00:00
Barry Warsaw
529fcfe31f list2set(): correct return value (an int, not a PyObject*). 1996-12-16 18:15:34 +00:00
Roger E. Masse
81a6fe9b98 Removed a #inlclude <errno.h> since it's implied with "Python.h" 1996-12-13 23:29:09 +00:00
Barry Warsaw
24c4b3d4e8 list2set(): PyList_GetItem could fail. 1996-12-13 23:22:42 +00:00
Roger E. Masse
0e12032748 Renamed. 1996-12-13 20:33:44 +00:00
Guido van Rossum
4e7f62229e Get rid of it -- use bsddb! 1996-12-13 16:24:06 +00:00
Roger E. Masse
bd4b961a0d Opps, fixed a couple of newly introduced wrapping problems. 1996-12-13 15:59:22 +00:00
Roger E. Masse
e7ee8c3753 Reindented via GvR recomendation ala Bwarsaw cppy-style.el 1996-12-13 15:55:22 +00:00
Guido van Rossum
fbcfd52a9a Added the example "thin ice" from the extensions manual. 1996-12-13 02:57:25 +00:00
Barry Warsaw
f630f6b93d Renamed, and scrutinized for missed potential error conditions.
Alas, I don't have an Indigo, so I could not even compile this.
1996-12-13 01:24:29 +00:00