Fred Drake [Fri, 10 Jan 1997 15:13:12 +0000 (15:13 +0000)]
(Tkinter.py): Add support for Frame(w, class_="classname") as an alternative
to Frame(w, cnf={"class": "classname"}). I think this is the only
widget other than Toplevel that needs to be concerned about setting
the widget's class (-class must be the first option on the Tcl
widget creation command).
Barry Warsaw [Tue, 7 Jan 1997 21:05:29 +0000 (21:05 +0000)]
Test of the sunaudiodev module -- it simply plays a sound if it can
find one and doesn't output any data that can be verified. If it
can't find a sound file by looking in the standard Solaris locations
(which we can extend later), it raises an ImportError.
Barry Warsaw [Mon, 6 Jan 1997 22:48:32 +0000 (22:48 +0000)]
New strop_joinfields implementation, highly optimized for Lists. All
other sequences use the Sequence protocol from the abstract API. The
algorithm has changed so that only one pass through the sequences are
made.
Rewrote translate() as follows:
- 'delete' is a C++ keyword; use 'del_table' instead
- apply Py_CHARMASK() to del_table[i] before using it as an index
*** this fixes a bug that was just reported on the list ***
- if the translation didn't make any changes, INCREF and return
the original string
- when del_table is empty or omitted, don't copy the translation
table to a table of ints (should be a bit faster)
Rewrote maketrans() to avoid copying the table (2-3% faster).
- When dragging the mouse in either listbox, the *first* entry
clicked on is selected rather than the last (but the last one is
highlighted).
This is done by changing the bindtags so that our binding is executed
after the default binding (which sets the 'active' index to the last
item selected), and using 'active' instead of 'anchor' as the index to
ask for.
Roger E. Masse [Fri, 3 Jan 1997 23:00:13 +0000 (23:00 +0000)]
This is a very inobstrusive test for the existance of the SGI cd module
and all it's attributes. More comprehensive examples can be found in
Demo/cd and require that you have a CD and a CD ROM drive
Barry Warsaw [Fri, 3 Jan 1997 22:45:34 +0000 (22:45 +0000)]
Several changes:
- split_whitespace(): slightly better memory ref handling when errors
occur.
- strop_joinfields(): First argument can now be any sequence-protocol
conformant object.
- strop_find(), strop_rfind(): Use PyArg_ParseTuple for optional
arguments
- strop_lower(), strop_upper(): Factor logic into a common function
do_casechange().
- strop_atoi(), strop_atol(): Use PyArg_ParseTuple.
- strop_maketrans(): arguments used to be optional, although the
documentation doesn't reflect this. Make the source conform to the
docs. Arguments are required, but two empty strings will return the
identity translation table.
- General pass fixing up formatting, and checking for return values.
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.
Use the new struct module's ability to pack and unpack standardized
data formats. The _xdr module is no longer used, since struct
supports the required IEEE floats and doubles.
(I have one doubt about not using _xdr. The struct module doesn't
handle Inf, NaN and gradual underflow correctly. If the _xdr module
does these things better, it may still have a (small) competitive
advantage. On the other hand, since not all platforms support IEEE
floating point, it's not clear that it would be a good idea to ever
transfer Inf or NaNs. Gradual underflow can be fixed in the struct
module.
Fred Drake [Tue, 31 Dec 1996 20:50:51 +0000 (20:50 +0000)]
(formatter.py): Add a flush() method to the writer interface. This really
needs to be a standard part of the interface, so we'll have it in
for the next release.
Guido van Rossum [Tue, 31 Dec 1996 05:57:34 +0000 (05:57 +0000)]
Rewrote _{read,write}_{short,long} to use the newly revamped struct
module. (Small problem: struct.pack() won't deal with the Python long
ints returned by struct.unpack() for the 'L' format. Worked around
that for now.)
Guido van Rossum [Tue, 31 Dec 1996 01:41:25 +0000 (01:41 +0000)]
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 '>'.