
|
Modification History
This page summarizes the changes in the source code from C Interfaces
and Implementations in reverse chronological order. For more information
about this book, see the World-Wide Web page at
http://www.cs.princeton.edu/software/cii/.
1.1 Tue Nov 5 14:30:12 PST 1997
In the list below, notations like [p. 442] refer to the pages on which the
corrections appear; see the errata for the first and
second printings.
src/array.c:
- Corrected
Array_resize so that it correctly resizes empty
arrays and handles a new size of 0 [p. 168].
- Corrected
Array_copy(a, len) so that it correctly copies the
elements of a when Array_length(a) == len [p. 169].
src/arena.c:
- Corrected if statement condition in
Arena_alloc to avoid
undefined behavior [p. 94].
- If
MAXALIGN is defined, it gives the platform's maximum
alignment in bytes and is used instead of sizeof (union align).
MAXALIGN is needed only when the maximum alignment is not equal to
sizeof (union align).
include/except.h, src/except.c:
- When compiling under Windows 95 or NT (i.e.,
WIN32 is
defined), declared Except_stack to be thread local storage.
src/mem.c:
- Corrected definition of
NALLOC so that allocated blocks are
properly aligned [p. 84].
src/memchk.c:
- If
MAXALIGN is defined, it gives the maximum alignment; see
src/arena.c above.
src/{thread.c,swtch.s}:
- Added Linux support. In
src/thread.c, corrected assertion to
catch Thread_join(Thread_self()) [p. 442].
src/thread-nt.c:
- Implementation of the Thread interface for Windows NT that uses NT native
threads.
1.0 Sat Aug 24 12:33:17 EDT 1996
In addition to the changes itemized below, the following global changes were
made.
- Replaced uses of
Mem_calloc that initialized pointers with
explicit assignments, because null pointers may be nonzero.
- Revised functions passed to other functions, like
qsort and
Thread_new, so that they match the prototypes of the corresponding
formal parameters, which avoids the implicit assumption that all object pointer
types have the same size and representation.
- Revised uses of the
Mem and Atom functions and
macros to conform to the revised interfaces (see below).
- Revised sample applications so they exit when a file argument cannot be
opened, after using
strerror to printing a more detailed
diagnostic.
{wf,xref}/*.[ch]:
- Changed
first(char c) and rest(char c) to
first(int c) and rest(int c).
src/arena.[ch]:
- Changed the type of the
nbytes and count
arguments to Arena_alloc and Arena_calloc from
int to long.
src/assert.h:
- Added missing
#undef assert.
- Moved the declaration of
Assert_Failed to except.h
so that assert.h is plug-compatible with an ANSI/ISO assert.h.
src/atom.[ch]:
- Changed the return type of
Atom_new, Atom_string,
and Atom_int from char * to const char *.
src/except.h:
- Added declaration for
Assert_Failed.
- Declared
Except_flag volatile.
src/list.h:
- Reversed the order of the
first and rest
fields.
src/mem.[ch]:
- Changed the type of the
nbytes and count
arguments to Mem_alloc, Mem_calloc, and Mem_resize
from int to long.
- Changed
Mem_free and Mem_resize to accept
pointers to the blocks to be deallocated or resized instead of pointers to those
pointers; the arguments to these functions now mimic the arguments for malloc
and realloc.
- Changed
FREE(ptr): it frees the block pointed to by ptr
and clears ptr; it evaluates ptr more than once.
- Changed
RESIZE(ptr, nbytes): it resizes the block pointed to
by ptr and reaims ptr at the resized block; it
evaluates ptr more than once.
src/mp.c:
- Fixed overflow tests in
MP_fromint, MP_addi,
MP_subi, MP_muli, MP_divi, and MP_modi,
which were incorrect on platforms where sizeof (long) exceeds
sizeof (int).
- Fixed
MP_mul and MP_mulu, which scribbled
beyond the end of z, their result arguments.
- Added missing assertion on the value of
base to MP_tostr.
09b3 Thu May 30 01:13:26 EDT 1996
This beta release is the last one before release 1.0, which will coincide
with the publication of C Interfaces and Implementations in August
1996.
There are too many bug fixes to list individually here, so the following
summary describes only the interface changes and the new examples.
cref/*.c:
- A version of
xref that uses Text and Ring.
iref/*.c:
- A version of
xref that uses Text, Array,
and MP.
idents/*.c:
- A version of
ids that uses Str and Seq.
kref/*.c:
- A version of
xref that uses Str and Seq.
words/*.c:
- A version of
ids that uses Text and Ring.
src/bit.h:
- Renamed
Bit_length to Bit_count, Bit_size
to Bit_length, Bit_member to Bit_get,
and removed
Bit_remove.
- Removed
Bit_remove.
- Changed
Bit_put to Bit_put(set, n, bit), which
now sets bit n in set to bit and
returns the previous value of bit n.
src/except.h:
- Added enumeration identifiers for the values assigned to
Except_flag.
src/ring.h:
- Changed
Ring_put(ring, i, x) so it returns the previous value
of
ring[i] instead of x.
src/seq.h:
- Changed
Seq_put(seq, i, x) so it returns the previous value
of
seq[i] instead of x.
src/set.h:
- Renamed
Set_cvt to Set_fmt.
src/str.h:
- Renamed
Str_cvt to Str_fmt.
src/table.h:
- Changed
Table_put(table, key, value) so it returns the
previous value associated with key instead of value,
or null if table doesn't hold key.
src/text.h:
- Changed the
str field in Text_T to const
char *str.
- Renamed
Text_cvt to Text_fmt.
src/xp.h:
- Changed the return type of
XP_add, XP_sub,
XP_sum, XP_diff, XP_product, XP_quotient,
and XP_neg, and XP_fromstr to int,
and changed the type of the last argument (carry, borrow,
or y) to these functions to int.
- Changed the return type of
XP_fromstr to int.
- Changed the prototype of
XP_mul to int XP_mul(T z, int
n, T x, int m, T y) so n and m precede the
T values to which they apply.
- Changed the prototype of
XP_div to int XP_div(int n, T
q, T x, int m, T y, T r, T tmp) so n and m
precede the T values to which they apply .
- Changed the type of the last argument (
fill) to XP_lshift
and XP_lshift to int.
09b2 Sat Feb 3 11:20:30 PST 1996
`const' qualifiers have been added to some of the arguments in
many of the interfaces. The source files have been stamped with an RCS-like
revision numbers. C++ keywords are no longer used as variables.
calc/calc.c:
- Changed the negation operator
_ to ~.
mpcalc/mpcalc.c:
- Changed the negation and complement operators,
_ and ~,
to ~ and !.
src/atom.h:
Atom_new now accepts zero-length strings.
src/atom.c:
- Changed
Atom_new to accept len=0.
src/bit.h:
- Removed
Bit_cmp.
- Added
Bit_eq, Bit_leq, and Bit_lt.
src/bit.c:
- Changed internal representation to avoid the `struct hack,' removed
Bit_cmp,
and added implementations for Bit_eq, Bit_leq, and
Bit_lt.
src/except.h:
- Removed
RETURN_VOID and changed the definition of RETURN
so that it subsumes RETURN_VOID.
src/ring.c:
- Fixed
Ring_rotate so that Ring_rotate(r, 0)
when
r is empty works.
src/set.h:
- The
cmp(x,y) function passed to Set_new must
now return an integer <0, =0, or >0 if x<y,
x=y, or x>y.
src/str.c:
- Fixed incorrect arguments to
va_start in Str_catv.
src/swtch.s:
- Added support for the DEC Alpha.
src/table.h:
- The
cmp(x,y) function passed to Table_new must
now return an integer <0, =0, or >0 if x<y,
x=y, or x>y.
src/table.c:
- Fixed incorrect comparison in
Table_remove that caused
entries not to be removed.
src/thread.h:
- Added
Thread_Failed; Thread_new raises Thread_Failed
when it cannot create a thread, instead of Mem_Failed.
src/thread.c:
- Fixed incorrect arguments to
memset in Thread_new,
and changed Thread_new to raise Thread_Failed.
- Added support for the DEC Alpha to
Thread_new.
09b1 Mon Oct 30 00:26:58 EST 1995
Initial beta release.
Back to the CII home page.
David Hanson /
|