From 5503dfbb4a527e702bbebc317d27e595d450ce2d Mon Sep 17 00:00:00 2001 From: Andrew McCallum Date: Mon, 22 Jan 1996 23:22:11 +0000 Subject: [PATCH] Initial revision git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@750 72102866-910b-0410-8b05-ffd578937521 --- .cvsignore | 8 + BULLETIN | 138 + ChangeLog | 3196 +++++++++++++++++++++++ Headers/gnustep/base/.cvsignore | 1 + Headers/gnustep/base/AutoreleasePool.h | 53 + Headers/gnustep/base/AutoreleaseStack.h | 122 + Headers/gnustep/base/SmallInt.h | 39 + Makefile.local | 3 + README.ULTRIX | 52 + README.first | 26 + Source/MachPort.m | 189 ++ Source/Makefile.local | 0 Source/MethodSignature.m | 135 + Source/NSLog.m | 42 + Source/ProtocolEnforcer.m | 43 + Source/ReleasePool.m | 76 + Source/Ring.m | 5 + Source/SunRpcPort.m | 97 + Source/Thread.m | 15 + Source/Tree.m | 476 ++++ Source/TreeNode.m | 97 + Source/gnu4next.m | 441 ++++ Source/gnu4nextrt.m | 469 ++++ Source/o_vprintf.c | 585 +++++ Source/objects/.cvsignore | 1 + Source/objects/AutoreleasePool.h | 53 + Source/objects/AutoreleaseStack.h | 122 + Source/objects/SmallInt.h | 39 + Source/vfscanf.c | 599 +++++ 29 files changed, 7122 insertions(+) create mode 100644 .cvsignore create mode 100644 BULLETIN create mode 100644 ChangeLog create mode 100644 Headers/gnustep/base/.cvsignore create mode 100644 Headers/gnustep/base/AutoreleasePool.h create mode 100644 Headers/gnustep/base/AutoreleaseStack.h create mode 100644 Headers/gnustep/base/SmallInt.h create mode 100644 Makefile.local create mode 100644 README.ULTRIX create mode 100644 README.first create mode 100644 Source/MachPort.m create mode 100644 Source/Makefile.local create mode 100644 Source/MethodSignature.m create mode 100644 Source/NSLog.m create mode 100644 Source/ProtocolEnforcer.m create mode 100644 Source/ReleasePool.m create mode 100644 Source/Ring.m create mode 100644 Source/SunRpcPort.m create mode 100644 Source/Thread.m create mode 100644 Source/Tree.m create mode 100644 Source/TreeNode.m create mode 100644 Source/gnu4next.m create mode 100644 Source/gnu4nextrt.m create mode 100644 Source/o_vprintf.c create mode 100644 Source/objects/.cvsignore create mode 100644 Source/objects/AutoreleasePool.h create mode 100644 Source/objects/AutoreleaseStack.h create mode 100644 Source/objects/SmallInt.h create mode 100644 Source/vfscanf.c diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 000000000..68568caa2 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,8 @@ +=* + +COPYING COPYING.LIB INSTALL NEWS README TAGS TODO + +Makefile configure +config.cache config.guess config.log config.status + +.date .name .patch* .snap* diff --git a/BULLETIN b/BULLETIN new file mode 100644 index 000000000..eda41ea9a --- /dev/null +++ b/BULLETIN @@ -0,0 +1,138 @@ +* GNU Objective C Class Library + +The GNU Objective C Class Library (libobjects) is a library of +general-purpose, non-graphical Objective C objects written by +R. Andrew McCallum and designed in the Smalltalk tradition. It +includes collection objects for maintaining groups of objects and C +types, byte streams for I/O to various destinations, coders for +formating objects and C types to byte streams, ports for network +packet transmission, remote object messaging support, pseudo-random +number generators, and time handling facilities. + + +* GNU Objective C Class Library + +The GNU Objective C Class Library (libobjects) is a library of +general-purpose, non-graphical Objective C objects designed in the +Smalltalk tradition. It includes collection objects for maintaining +groups of objects and C types, byte streams for I/O to various +destinations, coders for formating objects and C types to byte +streams, ports for network packet transmission, remote object +messaging support, pseudo-random number generators, and time handling +facilities. It is being written by R. Andrew McCallum. + + +* GNU Objective C Class Library (libobjects) + +R. Andrew McCallum is writing the GNU Objective C Class Library, a +library of general-purpose, non-graphical Objective C objects designed +in the Smalltalk tradition. It includes collection objects for +maintaining groups of objects and C types, byte streams for I/O to +various destinations, coders for formating objects and C types to byte +streams, ports for network packet transmission, remote object +messaging support, pseudo-random number generators, and time handling +facilities. It is being written by R. Andrew McCallum. + + +* GNU Objective C Class Library + +The GNU Objective C Class Library (@code{libobjects}) is a library of +general-purpose, non-graphical Objective C objects written by +R. Andrew McCallum. It includes collection objects for maintaining +groups of objects and C types, streams for I/O to various +destinations, coders for formating objects and C types to streams, +ports for network packet transmission, distributed objects (remote +object messaging), pseudo-random number generators, and time handling +facilities. Contact @samp{mccallum@gnu.ai.mit.edu}. + + + +* GNU Objective C Class Library + +The GNU Objective C Class Library (libobjects) is a library of +general-purpose, non-graphical Objective C objects written by +R. Andrew McCallum. What `libg++' is to GNU's C++, `libobjects' is to +GNU's Objective C. + +The library features collection objects for maintaining groups of +objects and C types, byte streams for I/O to various destinations, +coders for formating objects and C types to byte streams, ports for +network packet transmission, remote object messaging support, +pseudo-random number generators, and time handling facilities. + +The heirarchy of collection objects are similar in spirit to +Smalltalk's collections. A deep inheritance heirarchy provides good +uniformity of access to members across different collection classes. +All collections can hold simple C types such as int's and floats, as +well as Objects. The collection classes include simple collections +(Set, Bag), collections with contents accessible by unordered keys +(Dictionary, MappedCollector), collections with ordered contents +(Array, LinkedList, BinaryTree, RBTree, SplayTree). There is also a +DelegatePool object that can forward messages it receives to an +arbitrary number of Delegates. + +Stream objects provide a consistent interface for reading and writing +bytes. `StdioStream' objects work with files, file descriptors, FILE +pointers and pipes to/from executables. `MemoryStream' objects work +with memory buffers. There are methods for writing arbitrary n-length +buffers, newline-terminated lines, and printf-style formated strings. + +Coders provide a formatted way of writing to Streams. After a coder +is initialized with a stream, the coder can encode/decode Objective C +objects and C types in an architecture-independent way. The currently +available concrete coder classes are `BinaryCoder', for reading and +writing a compact stream of illegible bytes, and `TextCoder', for +reading and writing human-readable text (which you can also process +with `perl', `awk', or whatever scripting language you like). + +Coders and streams can be mixed and matched so that programmers can +choose the destination and the format separately. + + + + +The current version is 0.1, the low number indicating that the library +is still in flux. Future version will include String objects and +before allocation/dealocation conventions. + + + +see ~rms/gnuorg/status + + + + +Here is the simple description: + +* GNU Objective C Class Library + +The GNU Objective C Class Library (@code{libobjects}) is a library of +general-purpose, non-graphical Objective C objects written by +R. Andrew McCallum. It includes collection objects for maintaining +groups of objects and C types, streams for I/O to various +destinations, coders for formating objects and C types to streams, +ports for network packet transmission, distributed objects (remote +object messaging), pseudo-random number generators, and time handling +facilities. It is known to work on i386, m68k, SPARC, MIPS, and +RS6000. Contact the author at @samp{mccallum@gnu.ai.mit.edu}. + + +(GNU's Flashes) + +* New Library (on the Languages Tape?) + +The GNU Objective C Class Library (@code{libobjects}) has been added. +See ``GNU Software'' and ``Forthcoming GNUs'' for more information. + + +(Forthcoming GNUs) + +* GNU Objective C Class Library + +Future versions will have String objects that are integrated into the +Collection object hierarchy, a better allocation/deallocation +mechanism, improved features for distributed objects (including a +back-end that uses Mach ports instead of sockets), more extensive +random number generator facilities, and ports to more machines. +Volunteers are needed for additional projects; contact +@code{mccallum@gnu.ai.mit.edu}. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 000000000..7b0f5af0f --- /dev/null +++ b/ChangeLog @@ -0,0 +1,3196 @@ +Mon Jan 22 11:08:55 1996 Andrew McCallum + + * Version (OBJECTS_SUBMINOR_VERSION): libobjects version 0.1.19. + +Sat Jan 20 14:27:57 1996 Andrew McCallum + + * doc/install.texi: Mention GNU/Linux and the need for -lieee. + + * aclocal.m4: Don't have the initializer-loading test program + print anything. + (OBJC_SYS_DYNAMIC_FLAGS): Use '' not "" to quote $(CC). + +Fri Jan 19 12:40:49 1996 Adam Fedor + + * src/NSBundle.m (objc_executable_location): New + function. ([NSBundle +mainBundle]): Get path from NSProcessInfo. + + * src/NSProcessInfo.m: Remove NSArgv + definition. (_gnu_process_args): Remove NSArgv code. + + * src/objc-load.c: Remove NSArgv + declaration. (objc_executable_location): Removed + function. (objc_initialize_loading): Make path const char*. + * src/Foundation/objc-load.h: Remove objc_executable_location + function declaration. + + * src/objc/HashTable.h: Include stdobjects.h header for + LibObjectsMain definition. + +Fri Jan 19 10:43:32 1996 Andrew McCallum + + * Version (OBJECTS_SUBMINOR_VERSION): libobjects version 0.1.18. + + * configure.in (OBJS_INSTALL): Fix typo NeXT_OBJS -> NEXTSTEP_OBJS + in when running under NeXTSTEP, but not using NeXT runtime. + (Reported by Satoshi Adachi .) + + * src/NSString.m ([NSString -initWithCString:length:]): Handle + case of NULL cString. + ([NSString -initWithCString:]): Likewise. + (Reported by Adam Fedor .) + + * src/find_exec.c (objc_find_executable): Make NSBundle work even + when CWD isn't in PATH. (Fix provided by Matthias Klose + .) + + * src/Makefile.in (libobjects.so.$OBJECTS_VERSION)): Re-add the + -Wl,-soname,libobjects.so.$(OBJECTS_MAJOR_VERSION) argument. + Create a soft link named libobjects.so. + (install): Install a soft link named libobjects.so. + (Fixes sent by Jeremy Bettis .) + + * Makefile.in: Remove -$(MAKEFLAGS) as argument to recursive calls + of $(MAKE); this happens automatically. (Reported by Niels Mvller + .) + +Tue Jan 16 19:33:49 1996 Andrew McCallum + + * Version (OBJECTS_SUBMINOR_VERSION): libobjects version 0.1.17. + +Tue Jan 16 13:57:51 1996 Adam Fedor + + * aclocal.m4 (OBJC_SYS_AUTOLOAD): Define CON_AUTOLOAD if + /usr/include/elf.h exists. Use yes/no rather than 1/0. + + * src/objc-load.c: Update copyright. + (objc_load_module): Use CON_AUTOLOAD instead of SYS_AUTOLOAD. + +Tue Jan 16 12:24:59 1996 Andrew McCallum + + * src/Makefile.in (HEADERS_INSTALL): Remove objects/config.h. + (install): Look for libobjects.so file, not just for configure + variable. Remove unwanted `;'. Install objects/config.h from + build directory. (Fixes provided by Matthias Klose + ). + +Mon Jan 15 17:07:38 1996 Andrew McCallum + + * Version (OBJECTS_SUBMINOR_VERSION): libobjects version 0.1.16. + (OBJECTS_GCC_VERSION): Updated from 2.7.0 to 2.7.2. + (OBJECTS_FTP_MACHINE): Changed to prep. + (OBJECTS_FTP_DIRECTORY): Changed to pub/gnu. + + * NSCharacterSets/Makefile.in (install): Prefix data files with + $(srcdir). + (Makefile): New target. + + * src/Makefile.in ($(NSVALUE_MFILES)): Use sed instead of expr to + extract number. + ($(NSNUMBER_MFILES)): Likewise. + + * checks/Makefile.in (all): Remove target `bundles' for now; + linking them doesn't always work. If people want to test bundles, + they can type `make bundles'. + + * examples/Makefile.in (ALL_CPPFLAGS): -I../src, not -I. + (Makefile): Prefix dependancy with $(srcdir). + * checks/Makefile.in (ALL_CPPFLAGS): -I../src, not -I. + (Makefile): Prefix dependancy with $(srcdir). + + * Makefile.in (dist): Add -9 to gzip args. + (snapshot): Likewise. + + * doc/install.texi: Remove --enable-shared from first example of + installation commands; many people were just copying these + commands, ignorant of whether or not their system supported + dynamically-linked shared libraries. + + * checks/Makefile.in: Remove test09; it doesn't work, but it + doesn't matter. + (SRCS): Remove test09.m. + (test09): Remove target. + + * aclocal.m4: Test whether loading of contructor functions works + by actually compiling and running a program, not by looking for + /usr/include/elf.h. + +Tue Jan 16 00:31:19 1996 Gregor Hoffleit + + * src/NSDate.m ([NSDate -description]): replace strftime() with + sprintf() equivalent for NEXTSTEP. + +Mon Jan 15 15:11:18 1996 Adam Fedor + + * aclocal.m4 (OBJC_SYS_DYNAMIC_LINKER): Expand macro correctly in + dld/defs.h check. + +Fri Jan 12 11:38:58 1996 Andrew McCallum + + * examples/Makefile.in (LIBS): Added -lm. + + * src/NSProcessInfo.m ([NSProcessInfo -globallyUniqueString]): + Don't use the %@ printf format directive, since it isn't + implemented yet; use %s and -cString instead. (Reported by + Gregor Hoffleit .) + + * aclocal.m4 (OBJC_SYS_AUTOLOAD): Don't define SYS_AUTOLOAD #ifdef + mips, gcc doesn't support it, even though elf.h exists. (Perhaps + this should be "sgi" instead of "mips"?) + * src/NSProcessInfo.m: Don't test !(sgi), since SYS_AUTOLOAD is + fixed. + + * src/find_exec.c (objc_find_executable): #ifdef NeXT, use getwd() + instead of getcwd(). + (Reported by Gregor Hoffleit .) + + * src/NSDate.m ([NSDate -description]): Don't use strftime #ifdef + NeXT. (Reported by Gregor Hoffleit + .) + + * src/Makefile.in (objects/stdobjects.h): prepend + objects/stdobjects.h.in with $(srcdir). + + * checks/Makefile.in ($(DYNAMIC_OFILES)): Use $(srcdir). + ($(BUNDLE_NAMEJ)): Likewise. + (Reported by Matthias Klose .) + + * src/Makefile.in (NXStringTable_scan.o): Removed target; let + pattern rule take care of it. + ($(NSVALUE_MFILES)): Use $@ instead of $* in expr argument. + ($(NSNUMBER_MFILES)): Likewise. + (Reported by .) + + * src/NSMethodSignature.m ([NSMethodSignature + +signatureWithObjCTypes:]): Fix typo: change objc_size_of_type to + objc_sizeof_type. (Reported by Gregor Hoffleit + .) + + * src/Makefile.in (libobjects.so.$(OBJECTS_VERSION)): Removed + "-Wl,-soname,libobjects.so.$(OBJECTS_VERSION)"; gcc does this + automatically. (Reported by Matthias Klose + .) + + * src/NSProcessInfo.m: Include for MAXHOSTNAMELEN. + (Reported by Matthias Klose .) + + * src/Makefile.in (ALL_INCLUDE_FLAGS): Add -I. for + objects/config.h. (Reported by Matthias Klose + ) + * checks/Makefile.in (ALL_CPPFLAGS): Likewise. + * examples/Makefile.in (ALL_CPPFLAGS): Likewise. + +Wed Jan 10 10:51:26 1996 Andrew McCallum + + * src/NSProcessInfo.m: Remove #if NeXT and alternate #include's. + * src/Foundation/NSProcessInfo.h: Likewise. + (These caused problems reported by John Boller .) + + * src/Invocation.m ([MethodInvocation -initWithSelector:arguments:]): + New method, not implemented. + +Tue Jan 9 14:07:36 1996 Andrew McCallum + + * src/Storage.m ([Storage -insertElement:at:]): Increment + numElements. (Reported by Revuz Dominique ). + + * Makefile.in (RCS_FILES): Remove out-of-date MACHINES and CREDITS + files. + +Mon Jan 8 11:05:52 1996 Andrew McCallum + + * Version (OBJECTS_SUBMINOR_VERSION): Version 0.1.15. + + * src/NSProcessInfo.m (_GNU_MAX_HOST_NAMELEN): Macro removed; + using MAXHOSTNAMELEN from instead. All users + changed. + (_gnu_process_args): Malloc and fill NSArgv; assignment of char** + from *char[] isn't right. + + * src/NSGCString.m ([NSGCString -emptyCopy]): Use [super + emptyCopy], not [super allocCopy]. + + * src/String.m ([String -emptyCopy]): Method removed; super class + implementation is fine. + ([String -initWithCString:range:]): Use -subclassResponsibility:, not + -notImplemented:. + ([String -empty]): Likewise. + + * configure.in: Remove double-quotes in help string of + --enable-shared handling. + +Sun Jan 7 16:05:04 1996 Andrew McCallum + + * src/Makefile.in: Changed rules for compiling concrete NSValue + and NSNumber classes; the old version no longer worked with shared + library compilation, and didn't use the common pattern rule for + making the object file. + (NSNUMBER_CLUSTER, NSVALUE_CLUSTER): Variables removed. + (NSVALUE_MFILES): New variable, replacing NSVALUE_OFILES. + (NSNUMBER_MFILES): New variable, replacing NSNUMBER_OFILES. + (GNUSTEP_OBJS): Use new vars. + +Fri Jan 5 17:01:35 1996 Andrew McCallum + + Clean up shared library building. Building from another + directory now works. + * configure.in: Add $srcdir where necessary. + (LIBOBJECTS_A_OR_SO): Variable removed. + (LIBOBJECTS_SO): Defined according to --enabled-shared flag. + * src/Makefile.in: (Makeconf): Include it after system + configuration section, and from $(srcdir). + (SHAREDLIB_CFLAGS, SHAREDLIB_ARFLAGS, USING_SHAREDLIB_CFLAGS, + USING_SHAREDLIB_ARFLAGS): Variables removed. + (ALL_CFLAGS, ALL_OBJCFLAGS): Don't use removed vars. + (%_pic.o: %.m): New pattern rule. + (%_pic.o: %.c): New pattern rule. + (all): Always build libobjects.a, optionally build .so version. + (libobjects.so): Use -shared. Link to ..$(OBJECTS_MAJOR_VERSION). + (install): Always install libobjects, optionally install .so version. + Install the headers from the $(srcdir). + (NSVALUE_OFILES, NSNUMBER_OFILES, NXStringTable_scan.c, + dynamic-load.h): Use $(srcdir) properly for these targets. + * checks/Makefile.in: Executables now depend on libobjects.a, not + @LIBOBJECTS_A_OR_SO@. + (LIBS): Don't look in $(srcdir) for library. + (copy-dist): Don't use $(srcdir). + (Makefile): Likewise. + * examples/Makefile.in: Executables now depend on libobjects.a, + not @LIBOBJECTS_A_OR_SO@. + (LIBS): Don't look in $(srcdir) for library. + (OBJECTS_NEXT_INCLUDES): Don't look in non-existant next-includes dir. + (copy-dist): Don't use $(srcdir). + (Makefile): Likewise. + * doc/Makefile.in (TEXT_FILES): New variable. + (info): Use it. + (MAKEINFO_FLAGS): New variable. Use it in TEXT_FILES targets. + (DIST_FILES): Remove version.texi. + (clean): rm version.texi and $(TEXT_FILES). + + * src/NSProcessInfo.m (_gnu_process_args): Use "char **argv" + instead of "char *argv[]". Remove cast in assignment of NSArgv. + +Thu Jan 4 23:12:11 1996 Andrew McCallum + + * src/Set.m ([Set -removeElement:ifAbsentCall:]): Fix typo; method + renamed from -removeElement:ifAbsent:. (Reported by Albert Mietus + .) + +Wed Dec 20 11:30:37 1995 Adam Fedor + + * src/NSGeometry.m (NSMouseInRect): Handle flipped y-axis. + + * src/Foundation/NSException.h: Include NSString interface. + +Fri Nov 24 15:09:22 1995 Andrew McCallum + + * src/NSArray.m ([NSMutableArray -addObject:]): Use + -subclassResponsibility:, not -notImplemented:. + ([NSMutableArray -replaceObjectAtIndex:withObject:]): Likewise. + ([NSMutableArray -insertObject:atIndex:]): Likewise. + ([NSMutableArray -removeObjectAtIndex:]): Likewise. + ([NSMutableArray -removeAllObjects]): Likewise. + +Sun Nov 19 15:29:41 1995 Andrew McCallum + + * src/NSString.m ([NSString +allocWithZone:]): New method. + ([NSString +stringWithCString:byteString]): Use it. + ([NSString +stringWithCString:length:]): Likewise. + ([NSString +stringWithFormat:]): Likewise. + ([NSString +stringWithFormat:arguments:]): Likewise. + ([NSMutableString +allocWithZone:]): New method. + ([NSMutableString +stringWithCapacity:]): Use it. + ([NSMutableString +stringWithCString:length:]): Likewise. + +Tue Nov 14 11:39:41 1995 Andrew McCallum + + Some improvement to shared lib support, but since I can't test it, + I still don't know if it works. + + * src/Makefile.in (CFLAGS): Added -O. + (SHAREDLIB_CFLAGS,SHAREDLIB_ARFLAGS): Set values here, not in + configure.in. + (USING_SHAREDLIB_CFLAGS,USING_SHAREDLIB_ARFLAGS): New vars, set by + configure. + (ALL_CFLAGS, ALL_OBJCFLAGS): Use them. + (libobjects.so.$(OBJECTS_VERSION): New target, replacing + libobjects.so. Use version numbers. + (install): Try to do the right thing with shared/non-shared libs. + * configure.in: Update shared library variable names. + + * checks/Makefile.in: Use configure var, not libobjects.a. + Include ../Version. + + * examples/Makefile.in: Use configure var, not non-existant + Makefile var. Include ../Version. + +Mon Nov 6 12:24:16 1995 Andrew McCallum + + Shared library support; I'm not sure it works, though. + + * configure.in: Look for --enabled-shared. + (LIBOBJECTS_A_OR_SO, SHAREDLIB_CFLAGS, SHAREDLIB_ARFLAGS): New + substitutions. + * src/Makefile.in (SHAREDLIB_CFLAGS): New variable. + (ALL_CFLAGS): Use it. + (ALL_OBJCFLAGS): Likewise. + (SHAREDLIB_ARFLAGS): New variable. + (libobjects.so): Use it; new target. + (all): Depend on configure variable. + (install): Changes to install shared library. + * examples/Makefile.in: Look for LIBOBJECTS_A_OR_SO, not + libobjects.a. + + * src/NSProcessInfo.m (NSArgv): New global. + (_gnu_process_args): Set it. + + * NSMethodSignature.m: New file; not finished, though. + * src/Makefile.in (GNUSTEP_MFILES): Added NSMethodSignature.m. + + * src/Foundation/NSMethodSignature.h (NSArgumentInfo): Declared. + ([NSMethodSignature -argumentInfoAtIndex:]): Uncommented. + + * doc/install.texi: Warn them that compiling in a different + directory than the source will not currently work. + +Fri Nov 3 11:12:11 1995 Andrew McCallum + + * src/NSDictionary.m ([NSDictionary +dictionary]): Use +alloc, not + _concreteClass. This makes [NSMutableDictionary +dictionary] and + friends do the right thing. + ([NSDictionary +dictionaryWithObjects:forKeys:count:]): Likewise. + ([NSMutableDictionary +dictionaryWithCapacity:]): Likewise. + (Problem reported by Kim Shrier .) + + * src/NSSet.m ([NSSet +set]): Use +alloc, not _concreteClass. + This makes [NSMutableSet +set] and friends do the right thing. + ([NSSet +setWithObjects:count:]): Likewise. + ([NSSet +setWithArray:]): Likewise. + ([NSSet +setWithObject:]): Likewise. + ([NSSet +setWithObjects:]): Likewise. + ([NSMutableSet +setWithCapacity:]): Likewise. + + * src/NSArray.m ([NSArray +array]): Use +alloc, not + _concreteClass. This makes [NSMutableArray +array] and friends do + the right thing. + ([NSArray +arrayWithObjects:]): Likewise. + ([NSMutableArray +arrayWithCapacity:]): Likewise. + ([NSArray +arrayWithObject:]): Likewise; and fix condition on + exception. + + * src/NSProcessInfo.m ([NSProcessInfo -hostName]): Remove + unnecessary inefficiency: use stack to hold temporary string, not + malloc/free; just return the string, not a copy. Conform to GNU + coding standards in use of braces. + ([NSProcessInfo -processName]): Likewise. Just return the string, not + a copy. + ([NSProcessInfo -environment]): Likewise. + ([NSProcessInfo -arguments]): Likewise. + (_gnu_arguments, _gnu_environment): Make them constant classes, not + mutable. + (_gnu_process_args): Alloc _gnu_processName NSString, don't get an + autoreleased string and then retain it. Initialize _gnu_arguments + as a constant NSArray, not NSMutableArray. Initialize + _gnu_environment as a constant NSDictionary, not + NSMutableDictionary. Conform to the GNU coding standards in use + of braces. + + * src/Foundation/NSDictionary.h ([NSDictionary + -initWithObjects:forKeys:]): Declare method. + + This is called dissertation-procrastination. + +Sun Oct 29 19:41:16 1995 Andrew McCallum + + * checks/nsset.m: New file. + * checks/Makefile.in (SRCS): Added nsset.m. + (nsset): New target. + + * src/NSGArray.m ([NSGArray -objectAtIndex:]): Fix condition on + exception. + + * src/objects/NSSet.h: Moved method declarations from NSMutableSet + to NSSet. + + * NSCountedSet.m, NSGCountedSet.m: New files. + * src/objects/NSSet.h: Added NSCountedSet interface. + * src/Foundation/NSSet.h: Likewise. + * src/Foundation/NSGSet.h: Added NSGCountedSet interface. + * src/NSGSet.m: Implemented many methods. + * src/Makefile.in (GNUSTEP_MFILES): Added NSCountedSet.m and + NSGCountedSet.m. + + * src/NSArray.m ([NSArray -objectEnumerator]): Autorelease it. + ([NSArray -reverseObjectEnumerator]): Likewise. + + * src/NSGDictionary.m ([NSGDictionary -keyEnumerator]): + Autorelease it. + ([NSGDictionary -objectEnumerator]): Likewise. + +Wed Oct 25 20:37:15 1995 Andrew McCallum + + * src/NSSet.m, src/Foundation/NSSet.h: New files. + * src/NSGSet.m, src/Foundation/NSGSet.h: New files. + * src/Makefile.in (GNU_HEADERS): Added objects/NSSet.h. + (GNUSTEP_MFILES): Added NSGSet.m and NSSet.m. + (GNUSTEP_HEADERS): Added Foundation/NSGSet.h and Foundation/NSSet.h. + + * src/Foundation/NSDictionary.h: Include objects/stdobjects.h, not + objects/Dictionary.h. + * src/Foundation/NSGDictionary.h: Include objects/Dictionary.h. + + * src/collhash.c (coll_hash_next): Set STATE to 0 before returning + when the list is exhausted. This interacts with [Dictionary + -freeEnumState:] and [Set -freeEnumState]. This will all be + cleaned up when we start using Albin Jones' tables. (This bug + found by Allan Clearwaters.) + + * src/NSGDictionary.m ([NSGDictionaryKeyEnumerator + -initWithDictionary:]): Retain dictionary after it is initialized. + + * src/NSString.m ([NSString -cString]): Use + -subclassResponsibility: instead of -notImplemented: + ([NSString -cStringLength]): Likewise. + +Sun Oct 22 13:53:39 1995 Andrew McCallum + + Start adding proper NSException's; not done yet. + * src/NSGArray.m ([NSGArray -initWithObjects:count:]): Raise + exception for nil objects. + ([NSGArray -objectAtIndex:]): Raise exception when index too high. + * src/NSArray.m ([NSArray +arrayWithObject:]): Raise + exception on nil argument. + +Wed Oct 18 09:48:24 1995 Adam Fedor + + * NSBundle.REAMDE: Rewrote documentation. + + * examples/Makefile.example.in: New file. + * examples/configure.example.in: Likewise. + * examples/Makefile.in: Add new files to RCS_FILES. + + * src/Foundation/NSGCString.h: New _free_contents ivar. + * src/Foundation/String.h: Likewise. + * src/CString.m ([CString -initWithCString:range:]): Set + _free_contents to YES. ([CString -initWithCoder:]): Likewise. + ([CString -dealloc]): Free contents if needed. + * src/MutableCString.m ([MutableCString -initWithCapacity:]): Set + _free_contents to YES. ([MutableCString -initWithCoder:]): + Likewise. ([MutableCString -dealloc]): Free contents if needed. + * src/NSGCString ([NSGCString + -initWithCStringNoCopy:length:freeWhenDone:]): set _free_contents. + ([NSGCString -initWithCoder:]): Set _free_contents to YES; + ([NSGCString -dealloc]): Free contents if needed. + ([NSGMutableCString -initWithCapacity:]): Set _free_contents to + YES. ([NSGMutableCString -initWithCoder:]): Likewise. + + * src/NSString.m ([NSString -initWithCString:length:]): Set free + string. ([NSString -compare:options:]): Range should be + maximum of both strings. + + * src/NSGArray.m ([NSGArray -replaceObjectAtIndex:withObject:]): + Implement. + + * src/NSGeometry.m (NSMouseInRect): Point should not touch sides. + +Sat Oct 14 14:16:04 1995 Andrew McCallum + + Remove remnants of "stack of dictionaries"; we only need one. + * src/objects/Coder.h (Coder): Renamed ivars from + root_object_tables to root_object_table, from + forward_object_tables to forward_object_table; changed classes + from Stack (of Dictionary's) to Dictionary. + * src/Coder.m ([Coder -doInitOnStream:isDecoding:]): Use new ivar + names. + ([Coder -_coderPushRootObjectTable]): Use new ivar names and don't use + Stack. + ([Coder -_coderPopRootObjectTable]): Likewise. + ([Coder -_coderTopRootObjectTable]): Likewise. + ([Coder -_coderPushForwardObjectTable]): Likewise. + ([Coder -_coderPopForwardObjectTable]): Likewise. + ([Coder -_coderTopForwardObjectTable]): Likewise. + ([Coder -_coderForwardObjectsAtReference:]): Don't access ivar + directly. + ([Coder -_coderPutForwardObjects:atReference:]): Likewise. + ([Coder -finishDecodingInterconnectedObjects]): Use new ivar name. + ([Coder -dealloc]): Likewise. + +Mon Oct 9 10:33:13 1995 Andrew McCallum + + * src/IndexedCollection.m ([IndexedCollection + -shallowCopyInReverseAs:]): Return newColl, not self. + ([IndexedCollection -withElementsInReverseCall:]): Set flag to YES. + ([IndexedCollection -safeWithElementsInReverseCall:]): Likewise. + Reported by MURATA, Shuuichirou . + + * doc/readme.texi (The Class Heirarchy): Fixes from Aleksey + Sudakov . + +Thu Oct 5 11:31:44 1995 Adam Fedor + + * src/objc-malloc.c (objc_malloc): Declare res before any + statements. + (__objc_valloc): Likewise. + (__objc_realloc): Likewise. + (__objc_calloc): Likewise. + +Sat Sep 30 18:00:22 1995 Andrew McCallum + + * src/objc-malloc.c (CHECK_ZERO_SIZE): New macro; for making sure + we don't pass 0 to malloc and its friends. (Needed on DEC Alpha; + problem reported by Adam Fedor.) + (__objc_malloc): Use it. + (__objc_valloc): Likewise. + (__objc_realloc): Likewise. + (__objc_calloc): Likewise. + +Wed Sep 27 18:45:46 1995 Andrew McCallum + + * Makefile.in (DIST_FILES): Removed DISCUSSION. + + * src/IndexedCollection.m ([IndexedCollection + -getNextElement:withEnumState:]): if isEmpty, return NO. + + * src/NSObject.m ([NSObject +initialize]): Set default + autorelease_class to NSAutoreleasePool. + + * src/NSProcessInfo.m: Don't try to use __attribute__ ((section + ..)) #if (sgi). It doesn't seem to be supported. This probably + means that aclocal.m4 needs to be fixed so that it doesn't define + SYS_AUTOLOAD in this case. No time now. Adam? + + * src/Collection.m: Avoid cache_flush when releasing contents. + (send_release): Remove function. + ([Collection -_releaseContents]): New method. + ([Collection -dealloc]): Use it. + ([Collection -empty]): Likewise. + ([Collection -_safeWithElementsCallNoRetain:]): Use + -getNextElement:withEnumState instead of -withElementsCall: to + avoid cache_flush. + +Thu Sep 21 11:07:38 1995 Adam Fedor + + * src/NSArray.m ([NSArray -indexOfObjectIdenticalTo: + -indexOfObject: -containsObject: -removeObjectIdenticalTo: + -removeObject:]): Use NSNotFound for non-existant objects. + + * src/NSBundle.m ([NSBundle -initWithPath:]): Check if bundle + for path already exists. + + * src/NSGArray.m ([NSGArray -indexOfObject:]): Force message to + go to super rather than behavior class. + + * src/NSGCString.m ([NSGCString -emptyCopy]): start with + allocCopy. + + * NSGData.m ([NSGData -copyWithZone: -mutableCopyWithZone:], + [NSGMutableData -copyWithZone:]): New methods. + +Tue Sep 12 18:33:25 1995 Andrew McCallum + + * Makefile.in (RCS_FILES): Add file aclocal.m4. + +Tue Sep 12 15:30:27 1995 Adam Fedor + + This should make dynamic loading work under Solaris. + + * aclocal.m4: New file. + + * configure.in: Remove dynamic linking checks. Use + OBJC_SYS_DYNAMIC_FLAGS macro from aclocal.m4. + + * src/NSBundle.m: Make sure index is defined. + + * src/NSProcessInfo.m: Check ifdef SYS_AUTOLOAD as well as __ELF__ + * src/objc-load.c: Likewise. + * src/objects/LibobjectsMain.h: Likewise. + +Sun Sep 10 18:17:56 1995 Andrew McCallum + + * src/TextCoder.m ([TextCoder + -decodeValueOfSimpleType:at:withName:]): Assert the data pointer. + + * src/Coder.m ([Coder -doInitOnStream:isDecoding:]): Temporarily + change in_progress_table from a Set to an Array. I need to fix + some problems with Set. + ([Coder -startEncodingInterconnectedObjects]): Deal with + interconnected_stack_height. + ([Coder -finishEncodingInterconnectedObjects]): Likewise. + ([Coder -startDecodingInterconnectedObjects]): Likewise. + ([Coder -finishDecodingInterconnectedObjects]): Likewise. + ([Coder -encodeRootObject:withName:]): Fix bug, whereby we weren't + giving what decodeObjectAt:withName: expected. + ([Coder -encodeArrayOfType:at:count:withName:]): Don't encode the + array count. + ([Coder -decodeArrayOfType:at:count:withName:]): Don't expect the + array count. Change type on 3rd argument. + * src/objects/Coder.h (interconnected_stack_height): New ivar for + Coder. + + * src/objects/Coding.h ([Coding + -decodeArrayOfType:at:count:withName:]): Change the 3rd argument + type; pass the count directly, not as a pointer. The encoding and + decoding of array's no longer records the array count; if + necessary, you must do that yourself ahead of time. + +Fri Sep 8 18:30:54 1995 Andrew McCallum + + * src/objects/Coder.h (in_progress_table): New ivar in Coder. + * src/Coder.m ([Coder -doInitOnStream:isDecoding:]): Init + in_progress_table. + ([Coder -dealloc]): Release in_progress_table. + ([Coder -_encodeObject:withName:isBycopy:isForwardReference:]): + If the object is in progress, treat it like a forward reference. + Add the object to the in_progess_table before really encoding the + object; remove it when done. (NOTE, this isn't an excuse not to + set up "encoding interconnected objects" mode; you still must do + this first.) + +Wed Sep 6 09:30:15 1995 Andrew McCallum + + * Makefile.in (snapshot): Remove the snapshot name so we don't get + nested snapshots on failure. + +Wed Aug 30 09:33:07 1995 Adam Fedor + + * src/NSCTemplateValue.m ([NSCTemplateValue -encodeWithCoder:]): + Code type as a char_ptr. ([NSCTemplateValue -initWithCoder:]): + Leave decoding to NSValueDecoder class. + * src/NSConcreteNumber.m: Likewise. + * src/NSConcreteValue.m: Likewise. + + * src/NSNumber.m: Clarify error message for abstract methods + with "subclassResponsibility". + + * src/NSValue.m: New NSValueDecoder class. Clarify error + message for abstract methods. + + * /src/TextCoder.m ([TextCoder encodeValueOfSimpleType:at:withName:]): + Write reals using "%g". + ([TextCoder decodeValueOfSimpleType:at:withName:]): Decode + double as "%lf". + +Mon Aug 28 16:27:03 1995 Andrew McCallum + + * src/Collection.m ([Collection -empty]): Check if already empty. + This avoids a previous malloc(0). + +Sat Aug 26 13:56:40 CDT 1995 Jeremy Bettis + + * src/NSProcessInfo.m: Added Linux/ELF support. Linux calls the + __libc_subinit functions before the global constructors, therefore + the subinit functions must be just vanilla C. + +Sat Aug 26 12:36:37 1995 Andrew McCallum + + * Makefile.in (snapshot): Put README.first in the snapshot + distribution. + * README.first: New file. + +Thu Aug 24 12:32:54 1995 Andrew McCallum + + * src/Makefile.in (GNUSTEP_MFILES): Added NSObjCRuntime.m. + * src/NSObjCRuntime.m: New file. + (NSStringFromSelector, NSSelectorFromString, NSClassFromString, + NSStringFromClass): New functions. + + * src/NSObject.m: Include + ([NSObject -description]): Implemented. + ([NSObject +description]): Implemented. + + * src/Makefile.in (FILE_AUTHORS): Added Peter Burka. + + * volunteers: No longer a soft link to the http file; now it is a + text file giving the http address and explaining task coordination. + + * Makefile.in (snap): New target. + (snapshot): New target. + (dist): Use new target snap. + +Wed Aug 23 10:39:21 1995 Andrew McCallum + + * src/NSTimeZone.m ([NSTimeZone -encodeWithCoder:]): Avoid warning + by removing type from argument. + ([NSTimeZone -initWithCoder:]): Likewise. + + * Makefile.in (DIST_FILES): Add file README.foundation. + + * src/String.m: Fix bug by which [NSString mutableCopy] returned a + String, not NSString. + ([String -copyWithZone:]): Renamed from -copy. + ([String -mutableCopyWithZone:]): Renamed from -mutableCopy. + + * src/behavior.c: Added comment about superclass methods being + overriden. + + * Makeconf (install, uninstall): New targets. + + * src/NSAutoreleasePool.m ([NSAutoreleasePool -dealloc]): Removed + question comment. + +Thu Aug 17 17:41:05 1995 Adam Fedor + + * src/NSData.m ([NSData +allocWithZone:]): New method. + ([NSMutableData +allocWithZone:]): Likewise. + ([NSData +data, +dataWithBytes:length:, + +dataWithBytesNoCopy:length:, +dataWithContentsOfFile:, + +dataWithContentsOfMappedFile:]): Allocate using designated + allocator. ([NSMutableData +dataWithCapacity:, + +dataWithLength:]): Likewise. + +Wed Aug 17 19:54:17 1995 Peter Burka + + * src/NSZone.c: malloc.h isn't included on NeXTStep + * src/Foundation/NSZone.h: use NeXT's zones only if we're using + their runtime, too + + * src/Foundation/NSDate.h (NSTimeZone, NSTimeZoneDetail): + interfaces declared + + * src/Makefile.in (GNUSTEP_MFILES): Added NSTimeZone.m. + * src/NSTimeZone.m: New file. + * src/NSTimeZone.m: (NSTimeZone, NSConcreteTimeZone, + NSTimeZoneDetail, NSConcreteTimeZoneDetail): implementations + defined + * src/Foundation/NSDate.h: Added declaration of NSTimeZone. + +Wed Aug 16 11:58:24 1995 Andrew McCallum + + * Version (OBJECTS_SUBMINOR_VERSION): Version 0.1.14. + + * checks/Makefile.in (nsprocessinfo): New target. + + * src/objects/LibobjectsMain.h: Comment out args to LibobjectsMain + so we don't get errors from people's "int main ()". + + * admin/Makefile.in (ADMIN_FILES): Added tasks. + (tasks): New target. + * doc/Makefile.in (copy-dist): Remove linking of 'tasks' to admin. + + * src/NSProcessInfo.m (_GNU_MISSING_MAIN_FUNCTION_CALL): Added + Tuparev's email address. + + * admin/Makefile.in (copy-dist): Use cp instead of ln. (Some of + these files are symbolic links themselves, and tar gets confused). + + * src/Makefile.in (FILE_AUTHORS): Added "Georg Tuparev". + + * Makefile.in (DIST_FILES): Remove GNUStep-volunteers. It's now + in admin/volunteers. + + * checks/nsprocessinfo.m: Fix typo in includes. + (main): Fix warnings in while test. + Add newlines to end of printf's. + + * src/NSProcessInfo.m: Fix indentation. + + * src/NSProcessInfo.m: Use ELF _libc_subinit for initialization + instead of LibobjectsMain. + * src/objects/LibobjectsMain.h: Only redefine main if we don't + have __ELF__. + + * src/objects/stdobjects.h.in: Include + + * src/Makefile.in (GNUSTEP_MFILES): Added NSProcessInfo.m. + (GNUSTEP_HEADERS): Added Foundation/NSProcessInfo.h and + LibobjectsMain.h. + * checks/Makefile.in (SRCS): Added nsprocessinfo.m. + + * src/NSProcessInfo.m, src/Foundation/NSProcessInfo.h, + src/objects/LibobjectsMain.h, checks/nsprocessinfo.m: New files + from Georg Tuparev + +Wed Aug 9 11:27:42 1995 Andrew McCallum + + * src/NSString.m: Replaced "notImplemented" with + "subclassResponsibilty" where appropriate. + + * admin/Makefile.in (RCS_FILES): Renamed Makefile to Makefile.in. + (Makefile, ../config.status): New targets. + + * admin/Makefile.in: Renamed from Makefile. + (srcdir, VPATH): new vars. + * configure.in (AC_OUTPUT): Added admin/Makefile. + + * src/NSString.m: Rename NSCString to NSGCString. + ([NXConstantString -release]): Fix return type and return. + ([NSString +_setConcreteClass:]): New method. + ([NSString +_setConcreteCClass:]): New method. + ([NSString +_setMutableConcreteClass:]): New method. + ([NSString +_setMutableConcreteCClass:]): New method. + ([NSString +_concreteClass]): New method. + ([NSString +_concreteCClass]): New method. + ([NSString +_mutableConcreteClass]): New method. + ([NSString +_mutableConcreteCClass]): New method. + ([NSString +initialize]): Initialize new statics that hold concrete + classes. + ([NSString +stringWithCString:byteString]): Use concrete class method. + ([NSString +stringWithCString:length:]): Likewise. + ([NSString +stringWithFormat:]): Likewise. + ([NSString +stringWithFormat:arguments:]): Likewise. + ([NSString -mutableCopyWithZone:]): Likewise. + ([NSMutableString +stringWithCapacity:]): Likewise. + ([NSMutableString +stringWithCString:length:]): Likewise. + + * src/Makefile.in: Rename NSCString to NSGCString. + * src/Foundation/NSString.h: Likewise. + * src/Foundation/NSGCString.h: Likewise. + * src/NSGCString.m, src/Foundation/NSGCString.h: Likewise. + * src/NSGCString.m: Likewise. + + * admin/Makefile: New file. + * Makefile.in (SUBDIRS): Added admin. + + * doc/Makefile.in (TOP_DOC_FILES): Remove TODO. + (DIST_FILES): Add TODO. + (copy-dist): Link TODO to ../snap/admin/tasks. + +Tue Aug 8 11:32:13 1995 Andrew McCallum + + * src/NSDate.m ([NSDate -copyWithZone:]): New method. + ([NSDate -descriptionWithCalendarFormat:timeZone:]): Uncommented. + ([NSDate -dateWithCalendarFormat:timeZone:]): Uncommented. + + * src/NSAutoreleasePool.m ([NSAutoreleasePool -dealloc]): Use + object_get_class() instead of ->isa. + + * src/Makefile.in (GNUSTEP_HEADERS): Added Foundation/NSDate.h. + (GNUSTEP_MFILES): Added NSDate.m. + +Fri Aug 4 13:39:05 1995 Adam Fedor + + * src/NSAutoreleasePool.m ([NSAutoreleasePool -addObject:]): + Remove double_release checking. Increment released_count after + setting released array. + ([NSAutoreleasePool -dealloc]): Catch release errors. + ([NSAutoreleasePool -enableDoubleReleaseCheck:]): Removed method. + + * src/NSObject.m ([NSObject -autorelease], [NSObject -release]): + Add double_release checking. + ([NSObject +enableDoubleReleaseCheck:]): New method. + + * src/Foundation/NSAutoreleasePool.h: Remove + +enableDoubleReleaseCheck:, add +autoreleaseCountForObject:. + + * src/Foundation/NSObject.h: Add +enableDoubleReleaseCheck:. + + * src/Foundation/objc-load.h: Include objc-api file. + +Fri Aug 4 11:08:05 1995 Andrew McCallum + + * src/MemoryStream.m (debug_memory_stream): Turn debugging off by + default. + + * src/Makefile.in (install): Remove README links before relinking. + + * src/mframe.m (make_method_call) [__mips__]: Add 4 to offset for + float retframe. Yipes, this may be needed for other architectures + too. + + * src/Makefile.in (GNUSTEP_HEADERS): Removed Foundation/NSUser.h. + (GNUSTEP_CFILES): Removed NSUser.c. + +Thu Aug 3 15:48:21 1995 Andrew McCallum + + * src/mframe.m (make_method_call): Added comment about looking + into a problem with returning floats. I need to get back to this + later. + +Mon Jul 31 10:44:22 1995 Adam Fedor + + * configure.in: Check for HP version of dld library. Add new + DYNAMIC_LDFLAGS if hpux version found. + + * checks/Makefile.in (DYNAMIC_LDFLAGS): New macro. (nsbundle): Use + macro in linking. + + * src/hpux-load.h (__objc_dynamic_link): Specify linking flags to + shl_load. (__objc_dynamic_find_symbol): Check for return error + from shl_findsym. + +Fri Jul 28 12:38:22 1995 Adam Fedor + + * configure.in: Added DYNAMIC_CFLAGS and extra test for hpux. + + * checks/Makefile.in (DYNAMIC_BUNDLER_LINKER, DYNAMIC_CFLAGS, + BUNDLE_NAME, DYNAMIC_MFILES, DYNAMIC_HFILES, DYNAMIC_OFILES, + nsbundle, bundles): New macros and targets. + + * checks/LoadMe.[hm], checks/SecondClass.[hm], + checks/MyCategory.[hm], checks/nsbundle.m: New files. + + * src/NSBundle.m (bundle_object_name, bundle_resource_path, + [NSBundle +mainBundle], [NSBundle +setSystemLanguages:]): Remove + dependency on NSString for calculating paths. + +Wed Aug 2 12:04:51 1995 Andrew McCallum + + * NSBundle.README: Remove reference to gcc-dynamic.patch. + +Fri Jul 14 17:11:20 1995 Adam Fedor + + * src/MallocAddress.m ([MallocAddress -dealloc]): Check for object in + dictionary before removing. + + * src/NSArchiver.m: Include NSData header. + + * src/NSAutoreleasePool.m ([NSAutoreleasePool + +autoreleaseCountForObject:]): Initialize count to 0. + + * src/NSGData.m ([NSGMutableData -setLength:]): Reset eofPosition + to size. + +Wed Aug 2 11:21:55 1995 Andrew McCallum + + * src/NSString.m ([NXConstantString -dealloc]): New method. + ([NXConstantString -cString]): New method. + ([NXConstantString -retain]): New method. + ([NXConstantString -release]): New method. + ([NXConstantString -autorelease]): New method. + ([NXConstantString -copyWithZone:]): New method. + (From Jeremy Bettis). + + * src/NSDate.m ([NSDate -isEqual:]): Fix typo. (From Jeremy + Bettis). + +Wed Jul 12 10:22:48 1995 Adam Fedor + + * NSString.m (componentsSeparatedByString:, substringFromRange:, + rangeOfCharacterFromSet:, rangeOfCharacterFromSet:options:, + rangeOfCharacterFromSet:options:range:, rangeOfString:, + rangeOfString:options:, caseInsensitiveCompare:, hasPrefix:, + hasSuffix:, lastPathComponent, pathExtension, + stringByAppendingPathComponent:, stringByAppendingPathExtension:, + stringByDeletingLastPathComponent, stringByDeletingPathExtension): + Implemented methods. + + * Foundation/NSException.h (_NSAssertArgs, _NSCAssertArgs): Made + ',' a separate token to work with ## macro. + + * Foundation/NSRange.h: Added NSMakeRange declaration. + +Fri Jun 30 16:02:12 1995 Adam Fedor + + * NSData.m ([NSData +allocWithZone:]): New method. + (_initWithBytesNoCopy:length): New (designated initializer) method. + (initWithBytesNoCopy:length:): Make subclass responsibility. + (init): Call new designated initializer. ([NSMutableData + +allocWithZone:]) New Method. (dataWithCapacity:, dataWithLength:): + Allocate using designated allocator. (initWithBytesNoCopy:length:): + Make subclass responsibility. + + * NSGData.m (_initWithBytesNoCopy:length:): Make designated + initializer. (initWithBytesNoCopy:length:) Call designated initializer. + +Wed Aug 2 10:35:31 1995 Andrew McCallum + + * src/Makefile.in (FILE_AUTHORS): Added "Martin Michlmayr". + + * NSUser.c, Foundation/NSUser.h: New files from Martin Michlmayr + . + * src/Makefile.in (GNUSTEP_HEADERS): Added Foundation/NSUser.h. + (GNUSTEP_MFILES): Added NSUser.c. + +Thu Jul 6 10:11:11 1995 Adam Fedor + + * src/MemoryStream.m ([MemoryStream -writeBytes:length]): Realloc + buffer to at least minimum required length. + + * src/NSCString.m ([NSCString -cString]): Malloc extra byte for + '\0' terminator. + + * src/NSGArray.m ([NSGArray -initWithObjects:count:]): Set + _capacity to minimum of 1. + ([NSGMutableArray -initWithCapacity:]): Likewise. + +Wed Jul 5 17:19:21 1995 Andrew McCallum + + Released version 0.1.13. + + * src/NSString.m ([NSString -getCharacters:range:]): Decrement, + not increment in loop. (Reported by Harmut + ). + +Mon Jul 3 18:10:50 1995 Andrew McCallum + + * src/NSMethodSignature.m ([NSMethodSignature -dealloc]): Free + returnTypes. + + * src/NSUnarchiver.m: Allow easy user-modification of concrete class. + ([NSUnarchiver +_setConcreteClass:]): New method. + ([NSUnarchiver +_concreteClass]): New method. + ([NSUnarchiver +initialize]): New method. + + * src/NSArchiver.m: Allow easy user-modification of concrete + class. Removed references to NSGData. + ([NSArchiver +_setConcreteClass:]): New method. + ([NSArchiver +_concreteClass]): New method. + ([NSArchiver +initialize]): New method. + + * src/NSData.m: Allow easy user-modification of concrete class. + ([NSData +_setConcreteClass:]): New method. + ([NSData +_setMutableConcreteClass:]): New method. + ([NSData +_concreteClass]): New method. + ([NSData +_mutableConcreteClass]): New method. + ([NSData +initialize]): New method. + +Sat Jul 1 14:32:52 1995 Andrew McCallum + + * src/objects/README: Capitalize Foundation. + + * src/NSArray.m: Moved NSArrayEnumerator interface and + implementation from separate files to here. + * src/Makefile.in (GNUSTEP_MFILES): Remove NSArrayEnumerator.m. + (GNUSTEP_HEADERS): Remove Foundation/NSArrayEnumerator.h. + + * src/Foundation/NSZone.h: Update copyright. + * src/Foundation/NSValue.h: Likewise. + * src/Foundation/NSGeometry.h: Likewise. + * src/Foundation/NSException.h: Likewise. + * src/Foundation/NSUnarchiver.h: Likewise. + * src/Foundation/NSTimer.h: Likewise. + * src/Foundation/NSString.h: Likewise. + * src/Foundation/NSSerialization.h: Likewise. + * src/Foundation/NSRange.h: Likewise. + * src/Foundation/NSObject.h: Likewise. + * src/Foundation/NSObjCRuntime.h: Likewise. + * src/Foundation/NSMethodSignature.h: Likewise. + * src/Foundation/NSInvocation.h: Likewise. + * src/Foundation/NSDictionary.h: Likewise. + * src/Foundation/NSData.h: Likewise. + * src/Foundation/NSCoder.h: Likewise. + * src/Foundation/NSCharacterSet.h: Likewise. + * src/Foundation/NSBundle.h: Likewise. + * src/Foundation/NSBitmapCharSet.h: Likewise. + * src/Foundation/NSAutoreleasePool.h: Likewise. + * src/Foundation/NSArray.h: Likewise. + * src/Foundation/NSArchiver.h: Likewise. + * src/Foundation/NSDate.h: Likewise. + * src/NSDate.m: Likewise. + +Fri Jun 30 16:42:10 1995 Andrew McCallum + + * src/Foundation/NSRange.h (NSLocationInRange): Added + __attribute__ ((unused)). + (NSMaxRange): Likewise. + +Fri Jun 30 13:19:24 1995 Adam Fedor + + * Makefile.in (install): Fixed directory typo. + + * NSCharacterSets/Makefile.in (INSTALL, INSTALL_PROGRAM, + INSTALL_DATA): New variables. + (install): Depend on installdirs. + +Fri Jun 30 09:45:14 1995 Andrew McCallum + + * (install-sh, mkinstalldirs): Change file permissions to group + and all can read and execute. (Reported by Paul Kunz.) + + * Version (OBJECTS_SUBMINOR_VERSION): Version 0.1.13. + + * doc/news.texi (Noteworthy changes since version 0.1.12): New + section. + + The "concrete class" configuration idea was proposed by Albin + Jones , 10 Jun 1995. + + * src/NSDictionary.m: Allow easy user-modification of concrete class. + ([NSDictionary +_setConcreteClass:]): New method. + ([NSDictionary +_setMutableConcreteClass:]): New method. + ([NSDictionary +_concreteClass]): New method. + ([NSDictionary +_mutableConcreteClass]): New method. + ([NSDictionary +initialize]): New method. + (NSDictionary_concrete_class, NSMutableDictionary_concrete_class): New + static variables. + ([NSDictionary -copyWithZone:]): Make a deep copy to conform to spec; + it was a shallow copy. + + * src/NSArray.m: Allow easy user-modification of concrete class. + ([NSArray +_setConcreteClass:]): New method. + ([NSArray +_setMutableConcreteClass:]): New method. + ([NSArray +_concreteClass]): New method. + ([NSArray +_mutableConcreteClass]): New method. + ([NSArray +initialize]): New method. + (NSArray_concrete_class): New static variable. + (NSMutableArray_concrete_class): New static variable. + ([NSArray +arrayWithObject:]): Don't use addObject:. + ([NSArray -copyWithZone:]): Make a deep copy to conform to spec; it + was a shallow copy. + +Wed Jun 28 18:31:36 1995 Andrew McCallum + + * Makefile.in (rcs-list-locked): Fix typo. + + Released Version 0.1.12. + + * Makefile.in (DIST_FILES): Remove gcc patch files. + * doc/install.texi: Remove instructions for gcc patches. + + * examples/Makefile.in (ALL_CPPFLAGS): Look in ../src for includes. + + * examples/second-server.m: Use release instead of free. + * examples/textcoding.m: Likewise. + * examples/stdio-stream.m: Likewise. + + * src/objects/Dictionary.h ([Dictionary + initWithType:keyType:capacity]): Declare it. + ([Dictionary initWithType:capacity]): Likewise. + + * Makefile.in (RCS_FILES): Added Makeconf. + + * checks/Makefile.in (DIST_FILES): Added RCS_FILES. + + * src/Time.m: Include Sequent support. (Thanks to Matt Nelson + ). + * src/objects/Time.h: Likewise. + + * checks/test09.m: Add _SEQUENT_ to lrand48 conditional. + * checks/test04.m: Likewise. + * checks/test01.m: Likewise. + + * checks/client.m (main): Use -invalidate, not -release. + * examples/first-client.m (main): Likewise. + * examples/second-client.m (main): Likewise. + + * src/Connection.m ([Connection + +newForInPort:outPort:ancestorConnection:]): Add comment. I need + to fix retain/release for Connection. + + * checks/Makefile.in: Put src in all dependencies on libobjects.a. + (OBJECTS_NEXT_INCLUDES): Look in src directory. + (LIBS): Likewise. + (ALL_CPPFLAGS): Likewise. + + * checks/test08.m: Use libobjects' Coder instead of GNU + TypedStream. Comment out BinaryTree testing. + + * src/BinaryTree.m ([BinaryTree -_initCollectionWithCoder:]): + Disabled with -notImplemented. I need to fix decoding of this + class. + + * src/LinkedList.m: Added comment. I need to fix decoding of this + class. + + * src/Collection.m ([Collection -_safeWithElementsCallNoRetain:]): + Use malloc not alloca. + + * src/Dictionary.m ([Dictionary -putElement:atKey:]): Release + previous element. (Thanks to Paul Burchard ). + + * src/NSObject.m (NSDecrementExtraRefCountWasZero): Return correct + value. (Thanks to Paul Burchard ). + + * src/Makefile.in (CFLAGS): Remove -Wall. + + * doc/announce.texi: Use machines.texi. + * doc/advertisement.texi: Likewise. + + * doc/machines.texi: New file. + * doc/Makefile.in (TEXI_FILES): Added machines.texi. + (info): Removed libobjects.texi and objective-c.texi. + (objective-c): Print apology about makeinfo. + +Sun Jun 25 18:08:26 1995 Andrew McCallum + + * src/Makefile.in (objects/stdobjects.h): Depend on ../Version, + not Makefile.in. + (AUTHORS): Fix echo'ing of newlines. + + * Version (OBJECTS_SUBMINOR_VERSION): Version 0.1.12. + (OBJECTS_GCC_VERSION): Upped from 2.6.3 to 2.7.0. + +Tue Jun 20 12:06:36 1995 Andrew McCallum + + * Makefile.in (rcs-list-locked): Print subdir names. + + * checks/Makefile.in: Include $(srcdir)/../Makeconf. + (RCS_FILES): New variable. + (install, uninstall): New targets. + (copy-dist): Converted to new scheme. + * examples/Makefile.in: Likewise. + + * doc/Makefile.in: Change the way top-level dir info files are + handled. + (TOP_FILES): Variable removed. + (.SUFFIXES): Removed. + (prefix, infodir): New variables. + (copy-dist): Converted to new scheme. + + * doc/news.texi (Noteworthy changes since version 0.1.10): New + section. + + * src/NSGArchiver.m ([NSGArchiver -initForWritingWithMutableData:]): + New method. + + * src/Makefile.in (prefix, exec_prefix, libdir, includedir): New + variables. + + * Makefile.in: Convert to new scheme with subdirs. Many variable + and targets moved to subdir Makefiles. + (maintainer-clean, %-subdirs): New targets. + + * configure.in (AC_OUTPUT): Added NSCharacterSets/Makefile. + + * NSCharacterSets/Makefile.in (prefix, datadir, charsetdir, + INSTALL_FILES): New variables. + (installdirs, install, uninstall): New targets. + +Fri May 26 11:17:54 1995 Adam Fedor + + * src/objc-load.c (objc_load_module): Don't execute ctor_list on + __ELF__ systems. + +Fri May 19 11:22:42 1995 Andrew McCallum + + * doc/Makefile.in (copy-dist): Renamed from "dist". + * examples/Makefile.in (copy-dist): Renamed from "dist". + * checks/Makefile.in (copy-dist): Renamed from "dist". + + * configure.in (AC_OUTPUT): Prepend "src/" to "objects/config.h". + + * configure.in (AC_OUTPUT): Added src/Makefile. Changed + INSTALL_HEADERS to HEADERS_INSTALL. Changed INSTALL_OBJS to + OBJS_INSTALL. + +Thu May 11 16:09:36 1995 Andrew McCallum + + * Makefile.in (datadir): According to new standards, use "share" + instead of "lib". + +Mon May 8 16:39:42 1995 Andrew McCallum + + * Makefile.in (dist): Rename "share" to "NSCharacterSets". + (datadir): New variable. + (charsetdir): New variable. + (install): Install files from NSCharacterSets directory. + (installdirs): Make $(datadir) and $(charsetdir). + * NSCharacterSets: Directory renamed from "share". + +Fri May 5 10:46:37 1995 Andrew McCallum + + * doc/Makefile.in (TOP_FILES): New variable. + (dist): Copy TOP_FILES. + (version.texi): Remove $(MAKEFLAGS). + + * Makefile.in (OBJECTS_SUBMINOR_VERSION): Version 0.1.11. + (dist): mkdir src and config. Copy share and contents. + + * configure.in: Use config/ directory prefix where needed. + + * config: New subdirectory. + * config.*: Files moved there. + + * src/NSException.m (encodeWithCoder:, initWithCoder:): Remove + class names from arg type to avoid bogus warnings about protocol + conformance. + + * Makefile.in: Use doc/ and src/ directories. Many changes. + * src: New subdirectory. Move source files there. + + * configure.in: Look for src/Collection.m, not Collection. + + * configure.in: Create doc/Makefile. + * doc: New subdirectory. + * doc/Makefile.in: New file. + + * checks/nsdictionary.m: New file. + * checks/Makefile.in (SRCS): Added nsdictionary.m. + + * Foundation/NSDictionary.h: Uncomment -keyEnumerator and + -objectEnumerator. + * NSDictionary.m [NSDictionary] (+allocWithZone, +dictionary, + +dictionaryWithObjects:forKeys:count:, -initWithObjects:forKeys:, + +dictionaryWithObjects:forKeys:, -initWithObjects,forKeys:count:, + -init, -initWithDictionary, -count, -objectForKey, -keyEnumerator, + -isEqual:, -isEqualToDictionary, -descriptionWithIndent, -allKeys, + -allValues, allKeysForObject:, -objectEnumerator, -copyWithZone, + -mutableCopyWithZone): Implemented. + [NSMutableDictionary] (+allocWithZone:, +dictionaryWithCapacity:, + -initWithCapacity:, -initWithObjects:forKeys:count:, + -setObject:forKey:, -removeObjectForKey:, removeAllObjects, + -removeObjectsForKeys:, addEntriesFromDictionary:): Implemented. + (NSGDictionaryKeyEnumerator, NSGDictionaryObjectEnumerator): New + classes. + * NSGDictionary.m, Foundation/NSGDictionary.h, + objects/NSDictionary.h: New files. + * Makefile.in (GNU_HEADERS): Added NSDictionary.h. + (GNUSTEP_MFILES): Added NSGDictionary.m. + (GNUSTEP_HEADERS): Added NSGDictionary.h. + + * objects/NSArray.h: Fix #ifndef macro name; NSArray, not NSString! + + * NSString.m (-compare:options:range:): Simple implementation; not + complete. + + * NSArray.m (NSArray +allocWithZone:): Implemented. + (NSMutableArray +allocWithZone:): Implemented. + + * NSGArray.m (-initWithObjects:count:): Retain objects. + +Thu May 4 11:51:04 1995 Adam Fedor + + * NSBitmapCharSet.m, Foundation/NSBitmapCharSet.h: Replaced NSData + instance variable with char array and rewrote methods to reflect + this. + + * NSCharacterSet.m (characterSetWithCharactersInString:): Create + mutable data object for bitmap. (characterSetWithRange:): Added + error checking. (deepen): removed. (copyWithZone:, + mutableCopyWithZone:): More efficient implementation. + (characterSetWithBitmapRepresentation:): Override implementation + from super. + +Wed May 3 15:05:17 1995 Adam Fedor + + * Makefile.in (GNUSTEP_MFILES, GNUSTEP_HEADERS): Added + NSBitmapCharSet. + + * NSCTemplateValue.m, NSConcreteNumber: Added #line macro so gdb + knows which file source came from. + + * NSBitmapCharSet.m, Foundation/NSBitmapCharSet.h: New files. + + * NSCharacterSet.m (all methods): Implemented. + + * NSDictionary.m, Foundation/NSDictionary.h (keyEnumerator, + objectEnumerator): Uncommented but left unimplemeneted. + + * NSNumber.m (valueClassWithObjCType:): Added break's to avoid + falling through case statements. + + * Foundation/NSException.h (_NSAssertArgs, _NSCAssertArgs): Made + ',' a separate token to work with ## macro. + +Wed Apr 26 10:15:51 1995 Adam Fedor + + * Makefile.in (GNUSTEP_MFILES, GNUSTEP_HEADERS): Added + NSCharacterSet. + + * NSCharacterSet.m, Foundation/NSCharacterSet.h: New files. + + * NSString.m (componentsSeparatedByString:, substringFromRange:, + rangeOfCharacterFromSet:, rangeOfCharacterFromSet:options:, + rangeOfCharacterFromSet:options:range:, rangeOfString:, + rangeOfString:options:, caseInsensitiveCompare:, hasPrefix:, + hasSuffix:, lastPathComponent, pathExtension, + stringByAppendingPathComponent:, stringByAppendingPathExtension:, + stringByDeletingLastPathComponent, stringByDeletingPathExtension): + Implemented methods. + + * Foundation/NSRange.h: Added NSMakeRange declaration. + +Wed Apr 26 15:01:07 1995 Andrew McCallum + + * install.texi: Fixed typo in patch instructions. Too many "..". + (Reported by Daniel L. Green .) + +Thu Apr 20 20:11:23 1995 Andrew McCallum + + * NSData.m: Include + + * NSData.m (dataWithBytesNoCopy:length:): Send alloc to NSGData + class, not self. + +Sun Apr 16 02:41:39 1995 Albin L. Jones + + * NSData.m([NSData -getBytes:range:], + [NSData -subdataWithRange:]): Coded these, including the range + checking bits. The proper exception is raised. + + * NSData.m([NSData -dataWithContentsOfFile:], + [NSData -dataWithContentsOfMappedFile:], + [NSData -initWithContentsOfFile:], + [NSData -initWithContentsOfMappedFile:], + [NSData -writeToFile:atomically:]): Filled + these out, made them do what they were suppossed to. + + * NSData.m: Added many comments. Maybe I shouldn't have. + +Thu Apr 20 11:26:45 1995 Adam Fedor + + * NSCTemplateValue.m, NSConcreteNumber.m, NSConcreteValue.m, + NSException.m, NSNumber.m, NSValue.m (encodeWithCoder:, + initWithCoder:): Include call to super since NSObject now + implements these methods. + +Mon Apr 17 16:37:06 1995 Andrew McCallum + + * Makefile.in (OBJECTS_SUBMINOR_VERSION): Version 0.1.10. + + * examples/second-client.h: Make AppellationObject inherit from + NSObject, not Object. + + * examples/second-server.h: Include NSObject.h from Foundation, + not objc. + + * NSData.m (replaceBytesInRange:withBytes:): Get pointer with + -mutableBytes, not -bytes. + + * Makefile.in (FILE_AUTHORS): Added Jeremy Bettis. + + * Makefile.in: Change "foundation" to "Foundation". + + * Foundation: Directory renamed from "foundation". + + * Connection.m, NSArchiver.m, NSArray.m, NSArrayEnumerator.m, + NSAssertionHandler.m, NSAutoreleasePool.m, NSBundle.m, + NSCString.m, NSCTemplateValue.m, NSCoder.m, NSConcreteNumber.m, + NSConcreteValue.m, NSData.m, NSDate.m, NSDictionary.m, + NSEnumerator.m, NSException.m, NSGArchiver.m, NSGArray.m, + NSGCoder.m, NSGData.m, NSGUnarchiver.m, NSGeometry.m, NSNumber.m, + NSObject.m, NSRange.m, NSString.m, NSUnarchiver.m, NSValue.m, + NSZone.c, objc-load.c: Include from , not + . + * objects/Collection.h, objects/NSCoder.h, objects/String.h, + objects/stdobjects.h.in: Likewise. + * foundation/NSArchiver.h, foundation/NSArray.h, + foundation/NSArrayEnumerator.h, foundation/NSAutoreleasePool.h, + foundation/NSBundle.h, foundation/NSCString.h, + foundation/NSCoder.h, foundation/NSConcreteNumber.h, + foundation/NSConcreteValue.h, foundation/NSData.h, + foundation/NSDate.h, foundation/NSException.h, + foundation/NSGArchiver.h, foundation/NSGArray.h, + foundation/NSGCoder.h, foundation/NSGData.h, + foundation/NSGUnarchiver.h, foundation/NSMethodSignature.h, + foundation/NSObject.h, foundation/NSRange.h, + foundation/NSString.h, foundation/NSUnarchiver.h, + foundation/NSUtilities.h, foundation/NSValue.h: Likewise. + * examples/first-server.h: Likewise. + * checks/nsarchiving.m, checks/nsarray.m, checks/string.m, + checks/values.m: Likewise. + + * objects/NSCoder.h: Fix typo: We're declaring methods of NSCoder, + not NSConcreteCoder. + + * foundation/NSData.h: Insert the interface for NSMutableData. + + * NSData.m: Insert the implementation of NSMutableData. + + * foundation/NSGData.h: Don't include + . The interface can now be found in + + +Sat Apr 15 14:12:57 1995 Andrew McCallum + + * Makefile.in (OBJECTS_SUBMINOR_VERSION): Version 0.1.9. + + * checks/Makefile.in (SRCS): Comment out nsarchiving.m. It's + not done yet. + + * Makefile.in (GNUStep-volunteers): New target to deal with "ln" + and disparate filesystem problems. + (DIST-FILES): Use the local GNUStep-volunteers file, not the remote + volunteers-gnustep file. + (dist): Switch back to "ln", not "ln -s". + + * Stream.m (-initWithMode:, -streamMode): Methods removed. + (-isWritable): New method. + (-initWithCoder): Renamed from +newWithCoder.m. + * objects/Stream.h: Method removed and put into Streaming + protocol. Included from objects/Streaming.h. + (mode): Instance variable removed. + (STREAM_READONLY, STREAM_WRITEONLY, STREAM_READWRITE): enum removed. + * objects/Streaming.h: New file. + * Makefile.in (GNU_HEADERS): Added objects/Streaming.h. + + * objects/StdioStream.h (mode): New instance variable, to replace + one removed from Stream class. + * StdioStream.m (-isWriteable): New method. + (-initWithCoder): Renamed and rewritten from +newWithCoder. + (-isAtEof): Renamed from -streamEof. + (-initWithFilePointer:fmode:): Use new mode ivar. + + * objects/MemoryStream.h: New protocol . Make + MemoryStream class conform to it. + * MemoryStream.m (-setStreamBufferCapacity:): Renamed from + -setStreamBufferSize. + (-streamBufferCapacity): Renamed from -streamBufferSize. + (-isWriteable): New method. + (-streamBufferPrefix): Renamed from -streamPrefix. + + * NSArchiver.m, foundation/NSArchiver.m, NSGArchiver.m, + NSUnarchiver.m, foundation/NSUnarchiver.h, + foundation/NSGArchiver.h, NSGData.m, foundation/NSGData.h: New + files. + * Makefile.in (GNUSTEP_MFILES): Added NSArchiver.m, NSGArchiver.m, + NSGData.m, NSGUnarchiver.m, NSUnarchiver.m. + (GNUSTEP_HEADERS): Added foundation/NSArchiver.h, + foundation/NSGArchiver.h, foundation/NSGData.h, + foundation/NSGUnarchiver.h, foundation/NSUnarchiver.h. + + * checks/nsarchiving.m: New file. + * checks/Makefile.in (SRCS): Added nsarchiving.m. + + * Makefile.in (GNU_HEADERS): Added objects/NSCoder.h. + + The GNU-interoperating concrete subclasses of NS classes have the + prefix NSG. If people want to write other concrete subclasses + (some of which could be more lowlevel-compatible with NeXT's + classes, such as in the low-level format used by NSConcreteCoder), + they can do so, and use NeXT's classnames, or their own. + * NSGArray.m, foundation/NSGArray.h: Renamed from NSConcreteArray. + * NSGCoder.m, foundation/NSGCoder.h: Renamed form NSGNUCoder. + * Makefile.in: Renamed appropriate files for NSG prefix. + * NSCoder.m: Change names from "Concrete"-style to "G"-style. + * NSGCoder.m: Likewise. + * foundation/NSGArray.h: Likewise. + * NSArray.m: Likewise. + * NSGArray.m: Likewise. + +Fri Apr 14 10:59:41 1995 Andrew McCallum + + * NSAutoreleasePool.m (+enableRelease:, +enableDoubleReleaseCheck:, + +setPoolCountThreshhold:): New methods. + * foundation/NSAutoreleasePool.h: Declare new methods. + + * Makefile.in (GNUSTEP_MFILES): Removed NSDate.m; it causes a bunch + of compilation errors. + (GNUSTEP_OTHER_SRCFILES): Added NSDate.m. + +Thu Apr 13 11:03:13 1995 Andrew McCallum + + * NSDate.m: Compare against [NSDate class], not NSDate. + + * NSDate.m: Fixed indentation. Added some calls to + -notImplemented:. + + * NSDate.m, foundation/NSDate.h: New files from Jeremy Bettis + . + * Makefile.in (GNUSTEP_HEADERS): Added foundation/NSDate.h. + (GNUSTEP_MFILES): Added NSDate.m. + + * readme.texi: Updated for changes since addition of string + classes and retain/release. + + * NSData.m (-getBytes:range:): Implemented. + (-isEqual:): New method. + + * Now using new ObjC Emacs mode from cc-mode.el (to be included + with emacs 19.29), with (c-set-style "GNU"). This will change the + way multi-line methods are indented: I used to indent with three + spaces, now colons are lined up. All contributors should use the + same style. Note that (c-set-style "GNU") has different + c-basic-offset than the default. + +Wed Apr 12 11:15:57 1995 Andrew McCallum + + * BinaryTree.m (removeElement:): Fix bug whereby the deleted + node's parent still had the deleted node as a right child. + (Reported by Stephen Peters ). + + * Collection.m (write:, read:): Put back these old-style archiving + methods. (Reported by Stephen Peters ). + +Sun Apr 9 20:34:32 1995 Andrew McCallum + + * NSAssertionHandler.m: Fix copyright date and indentation. + +Sun Apr 9 16:43:03 1995 Adam Fedor (fedor@boulder.colorado.edu) + + * Makefile.in (GNUSTEP_MFILES): Added NSAssertionHandler.m. + + * NSAssertionHandler.m: New file. + + * foundaton/NSException.h: Added NSAssert macros and + NSAssertionHandler interface. + +Sun Apr 9 13:55:28 1995 Andrew McCallum + + * MallocAddress.m (objectForAddress:): Return nil if address is + not maintained by a MallocAddress object. (Used to simply die.) + +Sat Apr 8 13:04:08 1995 Andrew McCallum + + * Makefile.in (GNUSTEP_MFILES): Added NSGNUCoder.m. + (GNUSTEP_HEADERS): Added foundation/NSGNUCoder.h. + (GNUSTEP_OTHER_SRCFILES): Added files NSArchiver.m, + foundation/NSArchiver.h. + * NSGNUCoder.m, foundation/NSGNUCoder.h, NSArchiver, + foundation/NSArchiver.h: New files. + + * Makefile.in: Rearranged source variables to put + GNU/NEXTSTEP/GNUStep files close together. + (GNUSTEP_OTHER_SRCFILES): Added NSData.m, foundation/NSData.h. + * NSData.m, foundation/NSData.h: New files. + + * Array.m, BinaryTree.m, BinaryTreeNode.m, CString.m, + CircularArray.m, Collection.m, Connection.m, DelegatePool.m, + Dictionary.m, EltNodeCollector.m, GapArray.m, LinkedList.m, + LinkedListNode.m, MappedCollector.m, MemoryStream.m, + MutableCString.m, NSCString.m, NSCoder.m, NSObject.m, NSString.m, + Port.m, RBTreeNode.m, RNGAdditiveCongruential.m, RNGBerkeley.m, + Random.m, Set.m, Stream.m, TextCoder.m, Time.m: Convert to new + Coder scheme. Use -initWithCoder instead of +newWithCoder where + appropriate. Remove arguments typed (Coder*). Replace + +_newCollectionWithCoder with -_initCollectionWithCoder. + + * objects/Coding.h (CommonCoding, Encoding, Decoding): New + protocols. + (SelfCoding): New category of NSObject, interface only, no + implementation. This takes the place of the Coding Protocol. + (Coding): Protocol removed. + + * objects/IndexedCollecting.h: Use ConstantIndexedCollecting + protocol where appropriate. + * objects/Collecting.h: Use ConstantCollecting protocol where + appropriate. + + * objects/KeyedCollection.h: Move protocol conformance to category + to avoid bogus gcc complaints. + * objects/IndexedCollection.h: Likewise. + + * Coder.m (-decodeObjectAt:withName:): Create the instance and + send -initWithCoder if the object doesn't respond to + +newWithCoder. Convert to new protocol and method type scheme. + + * Proxy.m (RemoteSelfCoding): Renamed category from RemoteCoding. + * objects/Proxy.h: Likewise. + * objects/Connection.h (ConnectedSelfCoding): Renamed protocol + from ConnectedCoding. + + * objects/Collection.h: Removed Coding protocol. It's already + provided by NSObject. + * objects/BinaryTreeNode.h: Likewise. + * objects/Port.h: Likewise. + * objects/LinkedListNode.h: Likewise. + + * objects/IndexedCollecting.h (ConstantIndexedCollecting): New + protocol extracted from IndexedCollecting. + * objects/KeyedCollecting.h (ConstantKeyedCollecting): New + protocol extracted from KeyedCollecting. + * objects/Collecting.h (ConstantCollecting): New protocol + extracted from Collecting. + +Fri Apr 7 16:36:08 1995 Andrew McCallum + + * checks/nsarray.m (main): Fix serious bug by including `nil' at + end of contents list. Test forward and reverse enumerator + objects. + + * NSArray.m (-objectEnumerator, -reverseObjectEnumerator): + Implemented methods. + * Makefile.in (GNUSTEP_MFILES): Added NSArrayEnumerator.m, + NSEnumerator.m. + (GNUSTEP_HEADERS): Added foundation/NSArrayEnumerator.h. + * NSEnumerator.m, NSArrayEnumerator.m, + foundation/NSArrayEnumerator.h: New files. + + * Connection.m (-dealloc): Remove dealloc of remote_proxies + contents. + + * NSArray.m (-componentsJoinedByString:): Implemented method. + + * NSCString.m (initWithCapacity:): Make sure that capacity is + greater than zero. + + * Makefile.in (DIST_FILES): Added volunteers-gnustep. + +Fri Apr 7 15:41:46 1995 Mark Lakata (lakata@nsdssp.lbl.gov) + + * foundation/NSZone.h: Fixed clash with linux unistd.h. + +Thu Apr 6 14:47:09 1995 Andrew McCallum + + * Makefile.in (FILE_AUTHORS): New variable. + (AUTHORS): New target. + (DIST_FILES): Added AUTHORS. + + * Makefile.in (DIST_FILES): Add objective-c.texi objective-c.info. + (RCS_FILES): Add objective-c.texi. + (objective-c.info): New target. + (info): Add objective-c.info. + + * Array.m (-_encodeCollectionWithCoder:): Fix typo. Fix super call. + (+_newCollectionWithCoder:): Fix super call. + (Reported by allan-europa@mct.co.uk (Allan Clearwaters)). + +Wed Apr 5 11:22:30 1995 Andrew McCallum + + * Makefile.in (OBJECTS_SUBMINOR_VERSION): Version 0.1.8. + + * Makefile.in (NEXTSTEP_DERIVED_CFILES): New variable. + (NEXTSTEP_CFILES): NXStringTable_scan.c moved to above. + (NEXTSTEP_OBJS): Use NEXTSTEP_DERIVED_CFILES. + (DIST_FILES): Add NEXTSTEP_DERIVED_CFILES. + (objects/stdobjects.h): Target overhauled. + (libobjects.a): Add dependancy on objects/stdobjects.h. + (GNU_HEADERS): Remove objects/config.h, objects/stdobjects.h. + (INSTALL_HEADERS): Add objects/config.h, objects/stdobjects.h. + (NEXTSTEP_HEADERS): Removed README. + (GNUSTEP_HEADERS): Likewise. + (RCS_FILES): New variable. + (rcs-list-locked): New target. + (dynamic-load.h): Depend on config.status, for less re-making. + (version.texi): Depend on Makefile.in, not Makefile. + (realclean): Add objects/stdobjects.h objects/config.h. + + * objects/stdobjects.h.in: New file. + + * Makefile.in (GNUSTEP_OTHER_SRCFILES): Added NSConcreteNumber.m, + NSCTemplateValue.m. + + * objects/DelegatePool.h (_last_message_had_receivers): New + instance variable. + * DelegatePool.m (-delegatePoolLastMessageHadReceivers): New method. + (-forward::, init): Set new ivar. + + * objects/behavior.h (CALL_METHOD_IN_CLASS): Fix typo. + + * NSArray.m (allocWithZone): Removed method. + (arrayWithObjects:, initWithObjects:, initWithArray:, count, + indexOfObjectIdenticalTo:, indexOfObject:, isEqualToArray:, + makeObjectsPerform:, makeObjectsPerform:withObject:, lastObject, + firstObjectCommonWithArray:, arrayWithCapacity:, addObject:, + replaceObjectAtIndex:, removeLastObject, insertObject:atIndex:, + removeObjectAtIndex:, removeObjectIdenticalTo:, removeObject:, + removeAllObjects, addObjectsFromArray:, + removeObjectsFromIndices:numIndices:, removeObjectsInArray:, + copyWithZone:, mutableCopyWithZone:): Newly implemented or + overhauled. + + * behavior.c (class_add_methods_if_not_there): Only put method + implementation in dtable if the dtable is already installed, + otherwise, just add it to the class's methods list and let + __objc_install_dispatch_table_for_class put it in. Also, change + arguments. All callers updated. + (check_class_methods): New function. + + * NSString.m (+initialize): Use static "done". + * NSCString.m: Likewise. + + * checks/test01.m (main): "release" collections intead of + "emtpy"ing them. + + * NSDeallocateObject.m (NSDeallocateObject): Set + anObject->class_pointer to 0xdeadface, to help catch message-sends + to deallocated objects. + + * Collection.m (_safeWithElementsCallNoRetain:): New method. + (dealloc, empty): Use it. + (send_release): New function. + (Problem reported by allan-europa@mct.co.uk (Allan Clearwaters)). + + * Time.m (CLK_TCK): Use _CS_CLK_TCK instead of 3. + +Tue Apr 4 18:48:59 1995 Andrew McCallum + + * NSObject.m (+retain, +retainCount, +release, +autorelease): New + methods. + + * checks/Makefile.in (SRCS): Added nsarray.m. + + * foundation/NSArray.h: Inherit from NSObject, not Array. + + * NSConcreteArray.m, foundation/NSConcreteArray.h, + foundation/NSUtilities.h, objects/NSArray.h: New files. + * Makefile.in (GNUSTEP_MFILES): Added NSConcreteArray.m. + (GNUSTEP_HEADERS): Added foundation/NSConcreteArray.h, + foundation/NSUtilities.h. + (GNU_HEADERS): Added objects/NSArray.h. + + * objects/behavior.h: Added warning in comments. + (CALL_METHOD_IN_CLASS): New macro. + + * objects/String.h: Add Protocol to String + Protocol. + +Tue Apr 4 10:56:02 1995 Andrew McCallum + + * NSDictionary.m: Fix indentation. + * NSCoder.m: Likewise. + + * NSArray.m: Fixed indentation. + (arrayWithObject, arrayWithObjects, initWithArray, initWithObjects, + initWithObjects:count:, indexOfObjectIdenticalTo:, + firstObjectCommonWithArray, isEqualToArray, + sortedArrayUsingFunction, sortedArrayUsingSelector): Implemented. + + * Time.m (#ifndef CLK_TCK): Define it using sysconf() if not + already defined. (CLK_TCK wasn't defined on Solbourne S4000 + running OS/MP 4.1B. Reported by Pekka Yrjola .) + +Mon Apr 3 19:02:37 1995 Andrew McCallum + + * NSString.m (initialize): No need to add IndexedCollection + behavior to NSString, we already added String, and String inherits + from IndexedCollection. + + * Makefile.in (dynamic-load.h): New target, replacing the + "one-step" target, which got invoked too often. + + * Makefile.in (GNUSTEP_HEADERS): Add foundation/NSArray.h, + foundation/NSCoder.h, foundation/NSDictionary.h. + +Mon Apr 3 16:36:36 1995 Adam Fedor (fedor@boulder.colorado.edu) + + Placeholder non-implementations from Fedor until McCallum does + real implementations (that will be aided by and coexist with GNU + versions). + + * NSArray.m, NSCoder.m, NSDictionary.m, foundation/NSArray.h, + foundation/NSCoder.h, foundation/NSDictionary.h: new files. + +Mon Apr 3 15:58:35 1995 Adam Fedor (fedor@boulder.colorado.edu) + + * configure.in: check for dynamic linking libraries to figure out + which *-load.h file to include in objc-load.c. + + * Makefile.in (one-time): new target. + +Mon Apr 3 14:55:47 1995 Adam Fedor (fedor@boulder.colorado.edu) + + * Makefile.in (GNUSTEP_MFILES, GNUSTEP_CFILES, GNUSTEP_HEADERS): + Added files from corresponding FEDOR_ lists, removed FEDOR_ lists. + (DIST_FILES): added gcc-dynamic.patch, NSBundle.README and + GNUSTEP_OTHER_SRCFILES. (NSVALUE_OFILES, NSNUMBER_OFILES): removed + multiple target declarations. + + * NSBundle.m (_bundle_load_callback): Changed Class* to Class. + + * find_exec.c: new file. + + * checks/Makefile (LIBS): added math library. (SRCS): Added values.m. + +Mon Apr 3 11:17:18 1995 Adam Fedor (fedor@boulder.colorado.edu) + + * Makefile.in: New class cluster targets NSVALUE_OFILES and + NSNUMBER_OFILES. + + * NSBundle.README, NCSTemplateValue.m, + NSConcreteNumber.m, NSConcreteValue.m: new files. + + * NSBundle.m: Use @"" constructs, change Class to a pointer. + + * NSException.m (encodeWithCoder:, initWithCoder:): take out calls + to super until NSCoder gets implemented. + + * NSGeometry.m: Change includes to look in foundation subdir. + + * NSNumber.m, NSValue.m: Rewrote as class cluster. + + * NSRange.m (NSUnionRange): fixed typo - point should be range. + (NSMaxRange, NSLocationInRange): Moved to header file. + (NSStringFromRange): use @"" construct. + + * String.m (contentType) : new method. + + * checks/values.m: new file. + + * dld-load.h, null-load.h, simple-load.h, hpux-load.h: new files. + * foundation/NSArray.h, foundation/NSConcreteNumber.h, + foundation/NSConcreteValue.h, foundation/objc-load.h: new files. + * gcc-dynamic.patch: likewise. + + * foundation/NSValue.h: Added methods valueClassWithObjCType: and + initValue:withObjCType: for class clusters. + + * objc-load.c: new file. + +Mon Apr 3 10:43:11 1995 Andrew McCallum + + * String.m (initWithType:): Fix previous attempt at avoiding + infinite loop. (Reported by Jeremy Bettis ) + +Sun Apr 2 20:05:04 1995 Andrew McCallum + + * Makefile.in (OBJECTS_SUBMINOR_VERSION): Version 0.1.7. + + * checks/string.m: Test mutable strings and "strings as + collections of char's". + + * Connection.m, MutableString.m, NSString.m, Port.m, SocketPort.m, + String.m, objects/Connection.h, objects/Invocation.h, + objects/Port.h, objects/SocketPort.h, objects/ValueHolding.h, + objects/stdobjects.h: Use (id ) instead of (String*). + + * objects/String.h: Use (id ) instead of (String*) Have + String protocol include NSString protcol. + + * foundation/NSString.h: Define NSString and NSMutableString as + protocols. Make the classes conform to them. + + * NSCString.m: Have increment and decrement functions take int + arguments instead of unsigned because I was getting (0 >= -234) == 1. + + * NSString.m: Added implementations. + + * foundation/NSString.h: Uncomment method declarations. Now + subclass of NSObject, not String. + (stringWithFormat:arguments:): Added method. + (NSMutableString): Added declaration for class. + (NXConstantString): Moved declaration for class to here from + objects/String.h. Now subclass of NSCString, not ConstantString. + + * NSObject.m (perform:with:with:): New method added to (NEXTSTEP) + category. + + * NSException.m: Fix #include's. Fix @"" strings. + + * ConstantString.m: #if'ed out NXConstantString implementation. + Moved to NSString.m + * objects/String.h (NXConstantString): Declaration #if'ed out. + Moved to foundation/NSString.h. + + * MallocAddress.m, objects/MallocAddress.h, NSCString.m, + foundation/NSCString.m: New files. + + * Makefile.in (GNU_MFILES): Added MallocAddress.m. + (GNU_HEADERS): Added objects/MallocAddress.h, objects/NSString.h. + (GNUSTEP_MFILES): Added NSCString.m. + (GNUSTEP_HEADERS): Added foundation/NSCString.h. + (objects/stdobjects.h): Fixed typo. + +Sat Apr 1 16:09:04 1995 Andrew McCallum + + * String.m (initWithType:): Avoid infinite loop by calling + designated initializer instead of init. (Reported by + Jeremy Bettis ) + +Sat Apr 1 12:19:13 1995 Andrew McCallum + + * Makefile.in (OBJECTS_SUBMINOR_VERSION): Version 0.1.6. + + * NSObject.m (+superclass): New method. + + * behavior.c (behavior_debug): Fix typo in variable name use. + + * NSObject.m (+conformsToProtocol:): For now, send conformsTo: to + Protocol object. + + * objects/stdobjects.h (OBJECTS_MAJOR_VERSION, + OBJECTS_MINOR_VERSION, OBJECTS_SUBMINOR_VERSION): New #define's. + * Makefile.in (OBJECTS_MAJOR_VERSION, + OBJECTS_MINOR_VERSION, OBJECTS_SUBMINOR_VERSION): New variables. + (OBJECTS_VERSION): define in terms of above. + (objects/stdobjects): Set values for OBJECTS_MAJOR_VERSION, + OBJECTS_MINOR_VERSION, OBJECTS_SUBMINOR_VERSION. + +Fri Mar 31 09:10:50 1995 Adam Fedor + + * NXStringTable.m (readFromFile:): Return the return value from + readFromSteam so that errors get passed along. + + * NXStringTable_scan.l (main): Restart the parser for each new + file. This fix works correctly with flex, but is a bad hack and + still doesn't work right with lex. + +Fri Mar 31 10:28:52 1995 Andrew McCallum + + * configure.in: Added check for times(). + * Time.m (HAVE_TIMES): Use this instead of test for solaris and + hpux. + + * configure.in: Added check for valloc(). + * objc-malloc.c (HAVE_VALLOC): if not defined, #define valloc + malloc. (Reported by Mike Perik for HPUX). + +Tue Mar 28 12:37:22 1995 Andrew McCallum + + * gcc-string.patch: New version from Pieter Schoenmakers + that should fix patching problems. From + ftp://ftp.es.ele.tue.nl/pub/tiggr/gcc-2.6.3-statics.patch. + +Mon Mar 27 09:35:30 1995 Andrew McCallum + + * NSObject.m (+conformsToProtocol:): Renamed from + -conformsToProtocol. + (-conformsToProtocol:): New method. + (-conformsTo:): New method. + + * Time.m (__hpux): Add this to #if for using times(). (Reported + by Jan Springer .) + +Fri Mar 24 12:33:27 1995 Mark Lakata (lakata@nsdssp.lbl.gov) + + * NSZone.c : added #define WORDSIZE sizeof(double) + (NSZoneMalloc): returns machine word aligned pointers. Actually, + the word size is assumed to be equal to or smaller than + sizeof(double). + +Fri Mar 24 10:04:54 1995 Andrew McCallum + + * Makefile.in (GNU_HEADERS): Added new file behavior.h. + (GNU_CFILES): Added new file behavior.c. + * behavior.c, objects/behavior.h: New files. + + * NSObject.m (retain): Call NSIncrementExtraRefCount(), not + NSShouldRetainWithZone(). (Of course!) (Reported by Adam Fedor + ) + + * Invocation.m (invoke): Fix typo. (Reported by hjl@nynexst.com + (H.J. Lu).) + +Wed Mar 22 16:37:06 1995 Andrew McCallum + + * Makefile.in (OBJECTS_VERSION): Version 0.1.5. + (OBJECTS_FTP_DIRECTORY): Fixed for alpha.gnu. + Added many GNUSTEP files. + + * checks/test06.m: Inherit from NSObject, not Object. + * checks/test13.m: Likewise. + * checks/server.h: Likewise. + * checks/server.m: Likewise. + * examples/first-server.h: Likewise. + * foundation/NSInvocation.h: Likewise. + * examples/second-server.h: Likewise. + + * checks/client.m: Inherit from NSObject, not Object. Don't free + connection object, release it. + + * IndexedCollection.m: Cast aCollectionClass to (id) so we can + send NSObject protocol messages that aren't in Collecting. + + * Stack.m (initialize): Return void. + + * examples/port-client.m: Use @"" constant strings. + * examples/second-server.m: Likewise. + * examples/first-client.m: Likewise. + * examples/first-server.m: Likewise. + * examples/second-client.m: Likewise. + + * checks/test03.m (main): Added some #if 0'ed out new tests. + + * objects/CollectionPrivate.h (DeallocationHelpers): New category + containing _empty and _collectionDeallocate. + + * BinaryCoder.m (encodeValueOfSimpleType:at:withName:): Use + #ifndef __CHAR_UNSIGNED__ to prevent compiler warning. + + * Magnitude.m (compare:): Implemented. + + * foundation/NSAutoreleasePool.h: Comment fixes. + * foundation/NSBundle.h: Likewise. + * foundation/NSException.h: Likewise. + * foundation/NSGeometry.h: Likewise. + * foundation/NSRange.h: Likewise. + * foundation/NSValue.h: Likewise. + * NSZone.c: Include objects/objc-malloc. Likewise. + * objects/String.h: Additional comments. + * Invocation.m: Add header comment. + + * foundation/NSArray.h (arrayWithObjects): Add missing s. + + * NSBundle.m: Don't include NSObjectPrivate.h. + + * SocketPort.m: Include objects/String.h. + + * foundation/NSMethodSignature.h (argumentInfoAtIndex:): Comment + out for now. + + * Set.m (_collectionDealloc): Fix super call. + * Dictionary.m (_collectionDealloc): Likewise. + * Array.m (_collectionDealloc): Likewise. + + * RetainingNotifier.m (autorelease): Implemented. + + * Collection.m (shallowCopyAs:, emptyCopyAs:, copyAs:): Change arg + type to (Class). + (dealloc, empty): Don't use safe version of makeObjectsPerform:. + (_empty, _collectionDealloc): Move to a category. + + * objects/Collecting.h (shallowCopyAs:, emptyCopyAs:, copyAs:): + Change arg type to (Class). + * KeyedCollection.m: Likewise. + + * foundation/NSObject.h (compare:, autoreleaseClass, + setAutoreleaseClass, read:, write:): Declare new category methods. + + * NSObject.m (class): Fix return value. + (encodeWithCoder:) #ifdef out for now, until we fix compatibility with + GNU Coder. + (perform:with:): New method in NEXTSTEP category. + + * objects/Coder.h (isProxy): Method removed from + NSObject(CoderAdditions). + + * Proxy.m (zone): New method. + (isProxy): Remove method from NSObject category. + Don't include objects/AutoreleasePool.h. + + * Coder.m (encodeSelector:withName:): Use sel_get_any_uid() to get + sel type if we can't get it the normal way. + (newWithCoder:): Use NSAllocateObject. + (isProxy): Removed from NSObject category. + + * objects/Collecting.h (releaseObjects, release): Methods removed. + +Sat Mar 18 10:38:06 1995 Andrew McCallum + + * NSObject.m (zone): Implemented. + + * Makefile.in (GNUSTEP_MFILES): New files NSAllocateObject.m, + NSBundle.m, NSCopyObject.m, NSDeallocateObject.m, NSException.m, + NSGeometry.m, NSNumber.m. + (GNUSTEP_HEADERS): New files foundation/NSBundle.h, + foundation/NSException.h, foundation/NSGeometry.h, + foundation/NSNumber.h. + + * NSZone.c: Base on objc_malloc and friends, not malloc. Reformat + header comment. + + * NSAllocateObject.m, NSDeallocateObject.m, NSCopyObject.m: New + files. + * NSObject.m (NSAllocateObject, NSDeallocateObject, NSCopyObject): + These functions moved to separate files. + + * objc-malloc.c (objc_valloc): New function pointer. + (__objc_valloc): New function. + * objects/objc-malloc.h (objc_valloc): New function declared. + (OBJC_VALLOC): New macro. + + * Proxy.m (dealloc): Call NSDeallocateObject(). + + * KeyedCollection.m (dealloc): Deleted. + + * Dictionary.m (_collectionDealloc): Renamed from dealloc. + * Set.m (_collectionDealloc): Likewise. + * Array.m (_collectionDealloc): Likewise. + + * Connection.m: Removed Object(Retaining) category. + + * Set.m (_empty): Renamed from emtpy. + * LinkedList.m (_empty): Likewise. + * GapArray.m (_empty): Likewise. + * EltNodeCollector.m (_empty): Likewise. + * Dictionary.m (_empty): Likewise. + * CircularArray.m (_empty): Likewise. + * BinaryTree.m (_empty): Likewise. + * Bag.m (_empty): Likewise. + * Array.m (_empty): Likewise. + +Fri Mar 17 11:09:29 1995 Andrew McCallum + + * Coder.m (dealloc): Remove unneccesary releaseObjects. + * EltNodeCollector.m (dealloc): Likewise. + + * Collection.m: Rename method "empty" to "_empty". Rename + "releaseObjects" to "empty". + + * Set.m: Do retain/release/autorelease of contents as appropriate. + * BinaryTree.m: Likewise. + * CircularArray.m: Likewise. + * SplayTree.m: Likewise. + * RBTree.m: Likewise. + * LinkedList.m: Likewise. + * Heap.m: Likewise. + * GapArray.m: Likewise. + * Dictionary.m: Likewise. + + * Proxy.m (autorelease): Ask NSObject for autoreleaseClass. + +Wed Mar 15 17:56:57 1995 Andrew McCallum + + * Array.m: Do retain/release/autorelease of contents as appropriate. + * Bag.m: Likewise. + + * Makefile.in (DIST_FILES): Added gcc-class.patch and + gcc-string.patch. + (OBJECTS_GCC_VERSION): Changed from version 2.6.1 to 2.6.3. + +Tue Mar 14 11:50:23 1995 Andrew McCallum + + * objects/CollectionPrivate.h (RETAIN_ELT, RELEASE_ELT, + AUTORELEASE_ELT): New macros. + +Sun Mar 12 11:37:10 1995 Andrew McCallum + + * objects/stdobjects.h: Declare @class String; + + * objects/Collecting.h (alloc, respondsToSelector:, + conformsToProtocol:) removed. + + * objects/Connection.h: Use String* instead of char*. + * objects/SocketPort.h: Likewise. + * objects/Port.h: Likewise. + * Connection.m: Likewise. + * SocketPort.m: Likewise. + * Port.m: Likewise. + * checks/client.m, checks/server.m: Likewise. + + * objects/IndexedCollecting.h (IndexRange): changed to + location/length from start/end. + * IndexedCollection.m: Use location/length instead of start/end. + + * *.[hm]: Use `release' and `dealloc' instead of `free'. + * *.[hm] (initialize): return void. + + * objects/Collecting.h: Use `release' and `dealloc' instead of `free'. + (write:, read:): Removed. + (respondsToSelector:, conformsToProtocol:) Renamed from old Object + method names to NSObject method names. + + * NSZone.c: New file, renamed from zone.c. Include + foundation/NSZone, not foundation/zone.h. + + * Makefile.in (GNU_MFILES): Remove AutoreleasePool.m, + AutoreleaseStack.m, ObjectRetaining.m. + (GNU_HEADERS): Remove AutoreleasePool.h, AutoreleaseStack.h, + ObjectRetaining.h + + * checks/Makefile.in (string): New test program. + + * objects/Coder.h: Changed superclass from Object to NSObject. + * objects/Collection.h: Likewise. + * objects/Stream.h: Likewise. + * objects/RNGAdditiveCongruential.h: + * objects/RNGBerkeley.h: Likewise + * objects/Random.h: Likewise. + * objects/Magnitude.h: Likewise. + * objects/RetainingNotifier.h: Likewise. + * objects/BinaryTreeNode.h: Likewise. + * objects/LinkedListNode.h: Likewise. + * objects/Lock.h: Likewise. + + * objects/stdobjects.h: Include foundation/NSObject.h instead of + objc/Object.h. + +Sat Mar 11 16:39:18 1995 Andrew McCallum + + * Makefile.in (NEXTSTEP_MFILES): Renamed from NeXT_MFILES. + (NEXTSTEP_CFILES): Renamed from NeXT_CFILES. + (NEXTSTEP_OTHER_SRCFILES): Renamed from NeXT_OTHER_SRCFILES. + (GNUSTEP_MFILES, GNUSTEP_CFILES, GNUSTEP_HEADERS, GNUSTEP_OBJS): New + variables. + (GNU_MFILES): Added CString.m, ConstantString.m, MutableCString.m, + MutableString.m, String.m. + (GNU_HEADERS): Added String.h. + (GNUSTEP_HEADERS): Added NSAutoreleasePool.h, NSObjCRuntime.h, + NSString.h. + (DIST_FILES): Added GNUSTEP files. + * configure.in: Renamed variables from NeXT... to NEXTSTEP. Added + GNUSTEP variables. + + * objects/ValueHolding.h (ValueSetting): Methods now return `void' + instead of `self'. + + * foundation/NSZone.h: Renamed from foundation/zone.h. + +Thu Mar 9 15:05:45 1995 Andrew McCallum + + * zone.c, foundation/zone.h: New files from Mark Lakata. + * Makefile.in (GNUSTEP_HEADERS): Added foundation/NSZone.h. + +Wed Mar 8 17:35:01 1995 Andrew McCallum + + * Coder.m: `CLASS' #define no longer necessary, using `Class'. + * Proxy.m: Likewise. + * Connection.m: Likewise. + + * objects/stdobjects.h (CLASS): #define removed. + + * objects/Proxy.h (class): use "Class" instead of "Class*" to + match new runtime. + + * Makefile.in (GNUSTEP_HEADERS): New variable. + (DIST_FILES): Added GNUSTEP_HEADERS. + * configure.in: Likewise. + + * configure.in: Renamed NeXT_HEADERS to NEXTSTEP_HEADERS. + * Makefile.in: Likewise. + + * Makefile.in (NeXT_HEADERS): Move from objects/next-includes up + to top. + (OBJECTS_NEXT_INCLUDES): Look directly in top level directory. + (dist, mostlyclean, installdirs): Likewise. + +Sat Feb 11 16:20:49 1995 Andrew McCallum + + * Makefile.in (OBJECTS_VERSION): Version 0.1.4. + +Wed Feb 1 15:26:11 1995 Andrew McCallum + + * checks/test01.m: Use lrand48() instead of random() if + defined(__hpux). + * checks/test09.m: Likewise. + * checks/test04.m: Likewise. + (Patch from Timothy Mooney ) + +Thu Jan 26 12:52:33 1995 Andrew McCallum + + * objc-gnu2next.m: Convert Class* to Class. + * Proxy.m: Likewise. + * Coder.m: Likewise. + +Fri Jan 13 12:57:50 1995 Andrew McCallum + + * Makefile.in (OBJECTS_VERSION): Version 0.1.3. + + * ConnectedCoder.m (newDecodingWithConnection:timeout:): On + timeout use objc_free to free the buffer. + + * checks/client.m (main): Only release remote_peer_obj if it + really is a remote object. + + * examples/second-client.m (main): Only free appellation string if + it's from a remote object. + +Mon Jan 9 12:14:03 1995 Andrew McCallum + + * RetainingNotifier.m (autorelease): New (unimplemented) method. + (Reported by Peter Kristensen ). + +Fri Jan 6 17:57:08 1995 Andrew McCallum + + * Makefile.in (DIST_FILES): Added file MACHINES. + +Tue Dec 13 11:53:54 1994 Andrew McCallum + + * Makefile.in (OBJECTS_VERSION): Version 0.1.2. + + * Coder.m (Object (CoderAdditions)): Removed methods retainCount, + dealloc, release, retain. + * objects/Coder.h (Object (CoderAdditions)): Likewise. + +Mon Dec 12 14:13:58 1994 Andrew McCallum + + * Makefile.in (dvi): Now points at libobjects.dvi. + (libobjects.dvi): New target, disabled until texinfo.tex is fixed. + +Fri Dec 9 20:00:56 1994 Andrew McCallum + + * Makefile.in (ANNOUNCE): depends on news.texi. + + * Makefile.in (version.texi): Output FTP vars only if non-empty. + + * Makefile.in (OBJECTS_FTP_MACHINE,OBJECTS_FTP_DIRECTORY): New vars. + (version.texi): set OBJECTS_FTP_MACHINE and OBJECTS_FTP_DIRECTORY. + + * Makefile.in (OBJECTS_VERSION): Bumped to 0.1.1. + +Wed Dec 7 12:59:32 1994 Andrew McCallum + + * SocketPort.m: Include #if _AIX. (Reported by + Todd B. Templeton .) + +Sun Nov 20 19:19:13 1994 Andrew McCallum (mccallum@mustang.cs.rochester.edu) + + * Connection.m (connectionForward,connectionPerformAndDismissCoder): + Removed old #if'ed-out versions. + +Mon Nov 14 10:58:46 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * objects/objc-gnu2next.h: (sel_get_uid): Fix typo. + (class_is_class, class_is_meta_class, object_is_class, + object_is_instance, object_is_meta_class): New functions. + The above from a patch by Matthias Klose + +Sun Nov 13 14:29:37 1994 Andrew McCallum (mccallum@moose.cs.rochester.edu) + + * Makefile.in (diff): Fix tar call. Add proper arguments to diff. + +Thu Nov 10 16:51:48 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * news.texi (Noteworthy changes since version @samp{0.1.0}): New + section. + + * Makefile.in (TAGS): Use DIST_FILES, not non-existant SRCS. + +Wed Nov 9 18:34:53 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * configure.in: Remove duplicate NeXT_runtime=0. + +Tue Nov 8 10:44:30 1994 Andrew McCallum (mccallum@moose.cs.rochester.edu) + + * libobjects.texi (Organization): Updated inheritance tree. + * checks/test12.m (main): Free "rng", not "r" twice. + * TextCoder.m (encodeName): Do right thing for NULL name. + (Above three reported by Stephen Peters ) + + * Proxy.m (autorelease): New method. + + * Time.m: Patch for Solaris 2.4. Use times() instead of + getrusage(). (Patch from Stephen Peters ) + + * Makefile.in (GNU_MFILES,GNU_HEADERS): Added AutoreleasePool, + AutoreleaseStack and ObjectRetaining. + + * AutoreleasePool.m: Removed retain_count stuff. Now setting + autorelease_class. + + * ObjectRetaining.m: Removed stack release code. + (autorelease_class): New variable. + + * objects/Retaining.h (autorelease): New method. + Added comments. + + * objects/objc-gnu2next.h: Moved Object(GNUExtentions) category + from stdobject.h to here. + + * Makefile.in (DIST_FILES): Added README.ULTRIX. + + * Makefile.in (install,installdirs,includedir): Make NEXT_HEADERS + install to proper place: objects/next-include/. + +Fri Nov 4 01:32:27 1994 Andrew McCallum (mccallum@moose.cs.rochester.edu) + + * Makefile.in (diff): New target. + + * Makefile.in (ADVERTISEMENT): New target. + + * Version 0.1.0 released. + +Thu Nov 3 19:20:28 1994 Andrew McCallum (mccallum@mustang.cs.rochester.edu) + + * Connection.[hm] (connectionForward:::): Added object argument. + Use selectorTypeForProxy: if defined (NeXT_runtime). + * Proxy.m (forward::): Added object argument to connectionForward. + (selectorTypeForProxy:): Add an Object Category with this method. + + * Coder.m (decodeName:): Terminate char* with 0. + + * collhash.c: Use objc_malloc and friends instead of + __objc_xmalloc and friends. + + * StdioStream.m (writeBytes:length:): Use fwrite, not write. + (readBytes:length:): Use fread, not read. + +Wed Nov 2 20:59:36 1994 Andrew McCallum (mccallum@leopard.cs.rochester.edu) + + * configure.in: Updated for Autoconf 2.0 + * Makefile.in (DIST_FILES): Changed install.sh to install-sh. + (distclean): Added config.log, config.cache. + (prefix, exec_prefix): Updated for Autoconf 2.0 + +Fri Oct 28 18:20:28 1994 Andrew McCallum (mccallum@mustang.cs.rochester.edu) + + * *.[hm]: Change many "NeXT_cc" to "NeXT_runtime" + * Proxy.[hm]: Add and use _method_types ivar if NeXT_runtime. + * objects/objc-gnu2next.h: Many addtional functions #define'd. + * objc-gnu2next.m: New file. + * Makefile.in (GNU_MFILES): Added objc-gnu2next.m. + + * BinaryCoder.m (encode,decodeValueOfSimpleType:...): Added code + to write to stream directly (i.e. it does its own architecture + independent coding). This replaces previous messy code that + interfaced with the internals of GNU TypedStream's. + * Makefile.in (GNU_MFILES,GNU_HFILES): Removed bcoder-stream.[hm]. + +Thu Oct 27 17:39:49 1994 Andrew McCallum (mccallum@mustang.cs.rochester.edu) + + * SocketPort.m (sendPacket:toPort:timeout:, + newRemoteWithNumber:onHost:): Added casts to (char*) to prevent + warnings on systems that don't have "const" on args to + gethostbyname() and sendto(). + + * ConnectedCoder.h: New #define's METHODTYPE_REQUEST, + METHODTYPE_REPLY. + * Connection.m (_typeForSelector:remoteTarget:): New method. + (_handleMethodTypeRequest:): New method. + (doReceivedRequestsWithTimeout:): Watch for METHODTYPE_* msgs. + (newReceivedReplyRmcWithSequenceNumber:): Likewise. + * Proxy.m (selectorTypeForProxy:): New method. + * Proxy.h (_method_types): New instance variable. + + * mframe.[hm], mtypes.[hm]: New files. + * Makefile.in (GNU_MFILES): Added mframe.m + (GNU_HFILES): Added mframe.h. + (GNU_CFILES): mtypes.c. + (GNU_OTHER_SRCFILES): Added mtypes.h. + * Connection.m (connectionForward,connectionPerformAndDismissCoder): + Use functions in mframe.m instead of previous DO-specific method + frame code. + +Mon Oct 24 18:41:35 1994 Andrew McCallum (mccallum@leopard.cs.rochester.edu) + + * configure.in: Added AC_HEADER_CHECK for sys/rusage.h and + ucbinclude/sys/resource.h needed in Time.m on various SYSV + systems. + + * *.[hm]: Changed method name encodeType: to encodeValueOfType:. + Likewise for decodeType and SimpleType method names. + + Makefile.in (GNU_OTHER_SRCFILES): Removed bzero.c. + (DIST_FILES): Added README.BZERO. + configure.in: Removed bzero stuff. + +Thu Oct 20 13:10:50 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * IndexedCollection.m (putElement:atKey:): New method, needed for + KeyedCollecting protocol. (reported by Niels Mvller + ) + +Wed Oct 19 19:35:32 1994 Andrew McCallum (mccallum@zebra.cs.rochester.edu) + + * configure.in: Look for libraries "socket" and "nsl", needed for + the distributed objects check/example programs on Solaris machine. + + * checks/test01.m,test04.m,test09.m: Use lrand48 instead of random + if on Solaris machine. + +Tue Oct 18 10:27:29 1994 Andrew McCallum (mccallum@graphite.cs.rochester.edu) + + * Set.[hm] (*WithCollection:): Renamed from *With:. + + * *.[hm]: Changed method name "initCapacity" to + "initWithCapacity". Changed method names "...Encoding:" to + "...(With)Type:" to match Coder method names. + +Fri Oct 7 17:08:57 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * DelegatePool.[hm], Makefile.in: Renamed "DelegateList" to + "DelegatePool" to avoid false association with List object. + +Thu Sep 22 10:06:19 1994 Andrew McCallum (mccallum@llama.cs.rochester.edu) + + * configure.in: Check for bzero, and include bzero.o in the + library if not. (This works around a bug in libobjc.) + * Makefile.in (GNU_OBJS): Added @BZERO@. + (GNU_OTHER_SRCFILES): Added bzero.c. + + * *.m: Added methods for Coding where necessary; a few just send + -notImplemented: for now. + +Tue Sep 20 20:11:57 1994 Andrew McCallum (mccallum@llama.cs.rochester.edu) + + * objects/ValueHolding.h: Divided ValueHolding protocol into + ValueGetting and ValueSetting. + + * GCC-BUGS, CREDITS: new files. + * Makefile.in (DIST_FILES): Added GCC-BUGS, CREDITS. + +Mon Sep 19 14:42:26 1994 Andrew McCallum (mccallum@llama.cs.rochester.edu) + + * LinkedList.m (successorOfElement,predecessorOfElement): return + nil when there is no such element because arg was first or last in + list; previously it raised an error. + +Mon Sep 12 18:54:47 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * HashTable.[hm]: Changed GNUHashState to NXHashState. + +Tue Sep 6 21:11:38 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * LinkedList.m, LinkedListNode.m EltNode-m: Added methods for + Coding. + +Sat Aug 20 18:34:38 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * examples/*: Added example files: Makefile.in, dictionary.m, + port-server.m, port-client.m, first-server.[hm], first-client.m, + second-server.[hm], second-client.[hm], textcoding.m + +Fri Aug 19 18:39:06 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Collection.m, Set.m: Added new methods for Coding. + + * Makefile.in: Include new files in the distribution. Add new + classes: Stream, StdioStream, MemoryStream, Coder, TextCoder, + BinaryCoder, Port, SocketPort, Connection, Proxy, ConnectedCoder, + Lock, RetainingNotifier. New protocols: Coding, Retaining, + Locking. New text files: announce.texi, ANNOUNCE, readme.texi, + README. + +Thu Aug 11 12:30:20 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * checks/Makefile.in (CC): Changed from gcc to @CC@. + + * CircularArray.m (insertElement:atIndex:): Swapped order of + incrementCount and CIRCULAR_TO_BASIC. (Test case crash reported + by Matthias Klose .) + +Wed Aug 10 12:30:45 1994 Andrew McCallum (mccallum@raccoon.cs.rochester.edu) + + * Makefile.in: Defined GNU_MFILES, NeXT_MFILES, GNU_CFILES, + NeXT_CFILES, GNU_HEADERS, NeXT_HEADERS, GNU_OTHER_SRCFILES, + NeXT_OTHER_SRCFILES. Removed *OFILES. Renamed DISTFILES to + DIST_FILES. + +Tue Aug 9 15:21:43 1994 Andrew McCallum (mccallum@mink.cs.rochester.edu) + + * Changed name to libobjects. All files changed accordingly. + + * Makefile.in (DISTFILES): Added install.sh. + +Mon Aug 8 13:15:46 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Makefile.in (GOBJC_HDRS): Removed gobjc/ReferenceCounting.h. + Will be replaced by Retaining protocol. + +Sun Aug 7 17:13:08 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * config.nextcc.h: Created. + * configure.in: Update to use config.nextcc.h, define NeXT_cc + instead of NXcc. + Flipped the logic on NeXT32plus. (Reported by Matthias Klose + ) + + * Time.[hm]: Hack to make it work with Solaris rusage. + +Fri Jul 22 11:41:32 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Makefile.in (dist): Makefile.depend and Makefile.local forced to + be empty files by touch. + +Sat Jul 16 13:18:10 1994 R. Andrew McCallum (mccallum@ngoma) + + * configure.in: Define NXcc if using NeXT's cc. Sources + #ifdef'ing (NeXT) don't distinguish between NeXT cc and gcc on a + NeXT. + *.[hm]: Change #ifdef (NeXT) to #ifdef (NXcc) + + * Makefile.in: include Makefile.local. + * zone.c, gobjc/next-includes/zone.h: New files. + +Wed Jul 6 16:23:16 1994 Andrew McCallum (mccallum@swan.cs.rochester.edu) + + Changed name to from libcoll to libgobjc: + * All files: Changed name to "GNU Objective-C Class Library" in all + header comments. + * gobjc: Renamed coll to gobjc. + * gobjc/stdgobjc.h: Renamed from coll/collstd.h. Removed some + declarations that were already in gobjc/objc-malloc.h. + * gobjc/next-includes/objc: Created + * gobjc/next-includes/objc/ + {List.h,HashTable.h,Storage.h,NXStringTable.h}: Moved from gobjc. + * Makefile.in: Names changed from libcoll to libgobjc. + * gobjc/next-include/objc/*.h: Look in objc instead of coll. + + * gobjc/next-include/objc/List.h: Changed GNU_ to NX_. + +Tue Jul 5 15:51:58 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Storage.m (_makeRoomForAnotherIfNecessary): Added self-> to find + ivar in assert() call. Reported by ratlifc@ctron.com (Christian + A. Ratliff). + +Tue Jun 7 16:21:57 1994 Andrew McCallum (mccallum@raccoon.cs.rochester.edu) + + * List.m (incrementCount): Compare numElements and maxElements by + >= instead of ==. (Reported by Paul Kunz.) + +Fri Jun 3 13:26:42 1994 Andrew McCallum (mccallum@zebra.cs.rochester.edu) + + * LinkedList.m (successorOfElement:,predecessorOfElement:): Added. + * (removeElementAtIndex:): Return old element. + (Both reported by nisse@lysator.liu.se) + +Tue May 24 10:13:38 1994 Andrew McCallum (mccallum@brain.cs.rochester.edu) + + * coll/objc-gnu2next.h (objc_read_types): Removed ## from + NXWriteTypes() and NXReadTypes(). -cpp-traditional doesn't like + it, and 'args' should never be emtpy anyway. (Reported by Stefan + Reich ) + + * checks/Makefile.in (LIBS): Removed -lobjc, added LIBOBJC, made + it conditional on NeXT cc test from configure.in. + + * configure.in: Added LIBOBJC substitution. + + * collstd.m: Added missing semicolon to coll_NeXT_cc_version line. + + * Storage.m (_makeRoomForAnotherIfNecessary): Added assert() + checking for non-zero maxElements. + + * Makefile.in (install): Changed HDRS to INSTALLHDRS. (Reported + by Matthias Klose ) + +Mon May 9 18:30:05 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Storage.m (initCount:elementSize:description): Make sure + maxElements >= 1. (Reported by Paul Kunz.) + + These from Kresten Thorup: + * collstd.[hm] (#if NeXT): Added @interface/@end. Added + -shouldNotImplement:. + * configure.in, collstd.m: Changed NX_COMPILER_RELEASE to + NX_CURRENT_COMPILER_RELEASE. + +Sun May 8 19:40:40 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * configure.in: Added check for nested function support. + * config.nested.c: Created. + + * Makefile.in: Removed "-include Makefile.depend". Removed + "-include Makefile.local". + + * List.m (removeObjectAt:): Now returns old object. (Reported by + Paul Kunz.) + +Fri May 6 11:11:17 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * collstd.[hm]: Defined coll_NeXT_cc_version. + * checks/test11.m: Modified from NXStringTable test code provided + by + * checks/Makefile.in: Added test11.m, NXStringTable.example. + * Makefile.in: Added support for NXStringTable_scan.lex + * eltfuncs.m (elt_get_encoding): Fixed bug by adding char_ptr_u. + (__init_comp_func_hashtable(): Passing elt_{hash,compare}... to + coll_hash_new. + +Thu May 5 09:47:08 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Makefile.in, configure.in: Automatically check if using NeXT's + compiler. If so, add -cpp-traditional, don't compile or install + NeXT compatibility classes. If not, compile and install NeXT + compatibility classes. MAKEDEFINES now includes $(INCLUDEFLAGS). + + * StringTable*: Changed name to NXStringTable*. + + * collstd.[hm]: #ifdef NeXT -compare:. Added. + + * eltfuncs.m: Changed to use coll/collhash.[hc] instead of + objc/hash.[hc]. Added (void*) casts to __objcx[mc]alloc. + +Tue May 3 14:09:03 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Makefile.in: Removed Makefile.depend target. + +Tue Apr 19 17:55:45 1994 Andrew McCallum (mccallum@zebra.cs.rochester.edu) + + * Storage.m (initCount:elementSize:description, setNumSlots): + Clear the allocated memory. Patch contributed by Adam Fedor + + + * List.m (addObject:): Now calls insertObject:at:, as does NeXT's. + (removeLastObject): Now calls removeObjectAt:, as does NeXT's. + + The following are minor changes to enable compilation with + NeXTSTEP 3.3 cc. Thanks to Kresten Krab Thorup. + + * Collection.m (allocCopy): #ifdef NeXT object_copy takes 2 args. + * DelegateList.m (+initialize): Added. + * eltfuncs.m: Define _C_ATOM. Fix hash function types. #ifdef + NeXT add definitions for assert, objc_fatal, __objc_xmalloc, + __objc_xcalloc. + +Sat Feb 26 11:39:26 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * DelegateList.[hm] (delegateListCollection): Changed name from + delegateListList. Changed because what's returned is not a List. + (delegateListAddObjectIfAbsent:) Created. + +Fri Jan 21 13:29:48 1994 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Collection.m (safeWithElementsCall:, + safeWithElementsCall:whileTrue:): Removed extra -addContentsOf:. + (Reported by Allan Clearwaters ) + +Fri Dec 17 14:45:30 1993 Andrew McCallum (mccallum@raccoon.cs.rochester.edu) + + * List.m (insertObject:at:): Fixed bug that occured when trying to + insert at index zero on an empty list. (Reported by Paul Kunz) + +Tue Nov 16 18:40:12 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Collecting.h, Collection.m, *.m: Renamed -includesSameContents: + to -contentsEqual:. "Equal" reminds the programmer that "isEqual" + is called on content objects. I think "Same" is used by Brad + Cox's code to mean something different from "isEqual". Later we + could add "contentsSame:" if it proves useful. Don't use + "includes" because programmers might think that we are talking + about a subset operation here---no this method tests for complete + membership equality. + IndexedCollecting.h, IndexedCollection.m: Renamed + -includesSameContentsInOrder: to -contentsEqualInOrder:. + + Collection.m (isEqual:): Removed. Now we just let Object take + care of equality testing. If you want to test equality of + contents, use -hasEqualContents:. + +Thu Nov 11 17:01:37 1993 Andrew McCallum (mccallum@llama.cs.rochester.edu) + + * coll/KeyedCollecting.h, KeyedCollection.m: Changed + -insertObject:atKey: to putObject:atKey:. In KeyedCollection + "insert" doesn't really insert. If there already an object at + that key, it replaces. But we can't use replace because there + might not be an object at that key yet. "Insert" was a bad name + because the method replaces an element if there already is one at + that key. "Put" is different from "replace" because "put" can + place elements at keys that don't already have elements associated + with them. This naming scheme also has the advantage that we can + later use "insertObject:atKey: for a collection that allows + multiple elements at a single key. + + * Makefile.in, coll/collstd.h, collstd.m: Moved version + information from version.c to collstd files. + (version.c): Removed. + + * Time.m: (indexOf...Name, nameOf...Index): Implemented. + +Wed Nov 10 13:36:06 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Collection.m: (-includesSameContents:): Added a check for same + comparisonFunction. + (-compare:): Implemented. + + * IndexedCollection.m (-indexOfFirstIn:, -indexOfFirstNotIn:): + Implemented. + + * readme.texi, news.texi: Created. Changed Makefile to support + these. + + * checks, checks/Makefile.in: Renamed tests directory to checks. + Created autoconf Makefile.in for checks directory. + +Wed Nov 3 10:27:52 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * coll/Collecting.h: (newEnumState, freeEnumState:) Added. Now + we can avoid memory leaks. Later we can built an Iterator class + on top of these methods if we like. + *.m: Make use of new enum state methods. + + * IndexedCollection.m (indexOfFirstDifference:) Implemented. + +Tue Nov 2 13:40:34 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * RBTree.m (removeElement:,_RBTreeDeleteFixup): Added. RBTree + should now be operational. + + * BinaryTree.m, RBTree (nilNode): Added. Now using this sentinal + to make a few operations more efficient. + +Mon Nov 1 15:07:48 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * *.m: Made sure all function pointers are dereferenced when + called. + + * SplayTree.m (-splayNode:, -sortAddElement:byCalling:, + -insertElement:after:, -insertElement:before:, + -insertElement:atIndex:, -removeElement:, + -_doSplayOperationOnNode:): Added. SplayTree should now be + operational. + + * eltfuncs.m (elt_fprintf_elt): Now passing "l" when fprintf'ing + ... long elements. + + * coll/CollectionPrivate.h (RETURN_BY_CALLING_EXCEPTION_FUNCTION): + No longer uses __builtin_apply and __builtin_return unnecessarily. + +Sun Oct 31 12:34:55 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * BinaryTree.m (-leftRotateAroundNode:, -rightRotateAroundNode:): + Fixed bug occurring when rotation child is nil. + (rootNode): Added. + + * Collection.m, KeyedCollection.m, IndexedCollection.m + (-...Object:...): Added CHECK_CONTAINS_OBJECTS_ERROR; + +Fri Oct 29 14:22:41 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * KeyedCollection.m, Collection.m: Removed use of LAMBDA(). + +Thu Oct 28 15:44:23 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * coll/Time.h: Removed from @interface line. + +Tue Oct 26 8:32:48 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Released version 931026. + +Mon Oct 25 12:41:28 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * coll/*Collecting.h: Removed shallowCopy... methods with weird + options. These can be done easily and more flexibly with + enumerations. + + * coll/*Collecting.h, *Colletion.m: Removed definition and use of + COLL_NO_ELEMENT, COLL_NO_OBJECT, COLL_NO_KEY, COLL_NO_INDEX. + Added ...ifAbsentCall: methods to replace this functionality. + + * coll/Collecting.h, Collection.m: ...AllOccurrences... methods + now return self. + +Thu Oct 21 17:41:49 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * libcoll.texi: Created. + +Tue Oct 19 10:25:34 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * coll/Collecting.h: Changed method name -freeContents to + -freeObjects. Both names are pretty clear, and the later has the + advantage of compatibility with NeXT. + + * coll/Collecting.h: Changed method name -containsObjects to + -contentsAreObjects. The previous name could be interpretted as + testing whether or not the collection was empty; in fact this + method just tests whether or not the collection was initialized to + hold objects (i.e. initEncoding:@encode(id)). + + * coll/collstd.h: Added #define's for defining nested functions + in the argument position: LAMBDA, LAMBDA_VOID_PERFORM, + LAMBDA_ID_PERFORM, LAMBDA_BOOL_PERFORM. + + * coll/Collecting.h, KeyedCollecting.h, IndexedCollecting.h: + Removed many methods for various combinations of perform:, + perform:with:, perform:in, perform:in:with:. All these can now be + replaced with ...ByCalling: methods now that we can easily define + nested functions with the LAMBDA macro's. These methods really + ballooned the size of the protocols, and they still didn't provide + all the potentially useful conbinations. This new scheme is far + more flexible. I left the -makeObjectsPerform: and + -makeObjectsPerform:with: for compatibility with NeXT. + +Mon Oct 18 15:18:01 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * eltfuncs.m: Fixed overflow bug in compare functions. + +Fri Oct 8 11:47:56 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * List.m (replaceObjectAt:): Now returns oldObject. + (makeObjectsPerform:with:): Now uses perform:with:. + Removed -sortUsingMethod:inObject:. + + * coll/SortedArray.h: removed. + +Thu Sep 30 10:52:14 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * List.m (makeObjectsPerform:, makeObjectsPerform:with:): Removed + dependence on _makeObjects...:reverseOrder:. Using #if instead. + + * Bag.m (removeElement:occurrences:): Added. Bag will now cause + error if you try to remove an element that's not there, or not + there enough times. + +Tue Sep 28 11:49:42 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * List.m, Storage.m: Now use objc_malloc/OBJC_MALLOC and friends + instead of malloc and friends. + + * Makefile.in, configure.in: Created. Now libcoll works with + autoconf. Also made some changes to *.m to take advantage of + autoconf. + + * collstd.m: Changed definition of free(). (thanks to + krab@iesd.auc.dk) + +Mon Sep 27 09:59:25 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Bag.m (-uniqueCount): Added. + + * HashTable.m (-initKeyDesc:valueDesc:capacity:) Increased + portability for {long, unsigned} ints. + + * IndexedCollecting.h, IndexedCollection.m: Added + -safe...InReverse methods. + + * List.m (copy): Added. In order to force -shallowCopy for + compatibility with NeXT. + + * collhash.[hc] (coll_hash_empty): Added. + + * Collecting.h, Collection.m: (-safe...) Added these enumerators + for doing enumerations while changing the contents of the + collection. + + * Collecting.h, Collection.m: (-initWithContentsOf:) Added. This + allows for certain efficiencies, like init'ing an Array with the + needed capacity from the start. + +Sat Sep 25 12:20:18 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Collection.m, KeyedCollection, IndexedCollection.m: Extracted + message -comparisonFunction from inside loops to improve + efficiency. + + * Collecting.h, Collection.m: Removed the -shallowCopySelect..., + etc methods and replaced them with -withElementsTrueBy..., etc + methods. These shallowCopy methods make lots of sense in + SmallTalk where garbage collection makes enumeration on + temporary collections useful for iteration, but in ObjC I think + methods with a little more flexibility would be more helpful. I + also wanted to add more options to those {select,reject,collect} + methods: 1) the option of deep or shallow copies, 2) the option of + changing the class of the new copy. But if done in the old + framework this would have exploded the number of methods. The new + framework allows all the old functionality, plus the new options, + plus the option to do something useful without creating a new + collection. + +Tue Sep 21 11:52:46 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * *.m: Added -emptyCopy based on -allocCopy. Subclasses override + to take care of instance vars that must change. + + * Collecting.h, Collection.m: Changed -addCount:... to + -addObjectsCount:... and -addElementsCount:... + +Mon Sep 20 17:05:10 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * *.[hm]: Added code for archiving: -write:, writeInit:, + writeContents:, -read:, readInit:, readContents:. I'm not sure + this division of labor is the best. I'm open to suggestions for + different implementations. + + * *.[hm]: Changed all instances of the word "description" to + "encoding". Objective-C already uses @encode() for these things. + We shouldn't introduce new vocabulary for refering to the same + thing. + + * *.[hm]: Removed methods that allowed specification of + comparison function independent of encoding. This will allow us + to archive the comparison function by archiving the encoding. + Most people will be able to get custom comparisons by overriding + -compare:. If you really, really need some new weird comparisons + for non-objects, you can still subclass the collection and + override -comparisonFunction. If people think that we will want + to want custom comparisons of non-objects *very often*, then we + come up with another scheme that still allows meaningful archiving + of comparison functions. + +Sun Sep 19 19:30:02 1993 Andrew McCallum (mccallum@swan.cs.rochester.edu) + + * coll/eltfuncs.[hm]: Created. Moved functions for manipulating + elt's from CollectionPrivate.h to eltfuncs.h. This makes elt a + little more separate from libcoll, so others can use it too. I + changed the prefix on the names accordingly from coll_ to elt_. + Also, added function for getting encoding from comparison + function. Also, declared all elt_compare_ and elt_hash_ functions + extern. + +Thu Sep 9 09:49:29 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * LinkedListEltNode.[hm], BinaryTreeEltNode.[hm], + RBTreeEltNode.[hm]: Created these files and moved EltNode code + into them. This cleanly separates the basic LinkedList code from + the EltNodeCollector stuff (and similarly for BinaryTree and + RBTree). The EltNode stuff strikes me as being a little messy; + with this separation we can easily replace it later with something + cleaner (if we can think of something cleaner). + + * elt.h, *.m: Changed elt union names from *_t to *_u, following + suggestion of Burchard: *_t should be reserved for type names. + +Tue Aug 31 11:40:29 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Storage.[hm], List.[hm]: Removed many extra features that + aren't in the NeXT implementations. Our goal for these NeXT-based + objects should be compatibility, not kitchen-sink features. Let + people add features in Categories if they need them. + + * Storage.[hm]: Fixed return type for -removeLastElement to match + NeXT. Unfortunately this conflicts with the IndexedCollecting + declaration (NeXT's returns self, IndexedCollecting returns the + removed element). I really think methods that remove elemements + should return that element. We're just going to have to live with + this conflict. + + * Storage.[hm]: Changed declaration of instance var 'dataPtr' + from void** to void*, to match NeXT. + + * IndexedCollecting.h, IndexedCollection.m: Added -sortContents; + +Thu Aug 26 17:47:59 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * List.m: Changed default order of -makeObjectsPerform... and + fixed comment to match NeXTSTEP reality. + +Wed Jul 10 14:38:23 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * BinaryTree.m, RBTree.m, EltNodeCollector.[hm]: Created. + +Wed Jun 2 11:48:08 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * IndexedCollecting.h: Added + - successorOfObject: anObject; + - predecessorOfObject: anObject; + - (elt) successorOfElement: (elt)anElement; + - (elt) predecessorOfElement: (elt)anElement; + + * BinaryTree.h, RBTree.h: Created. + +Mon May 31 13:33:42 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Time.[hm]: Threw a Time object I wrote a while ago into the + .tar file. Maybe someone will find it useful. + + * IndexedCollecting.h, IndexedCollection.m: Added methods: + - (unsigned) indexOfFirstDifference: (id )aColl; + - (unsigned) indexOfFirstIn: (id )aColl; + - (unsigned) indexOfFirstNotIn: (id )aColl; + They fit well with desired functionality for Strings, but may also + be generally useful. + + * Created preliminary String class. It's very preliminary; I just + want to see how it will fit with IndexedCollecting. + + * Overhauled instance variables in heirarchy. Removed all + instance variables from abstract superclasses. This makes + subclassing an abstract superclass a bit more of a pain, but it + helps keep memory requirements down, especially for String, + LinkList and all IndexedCollections. + +Sat May 29 11:27:01 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * IndexedCollection.m: Made cast of void* to unsigned more + portable. + +Fri May 28 17:00:14 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * IndexedCollecting.h, IndexedCollection.m: Added + -insertContentsOf:atIndex: modified from Kresten Krab Thorup. + + * Collecting.h, Collection.m: Added {Object,Element} to inject, + detect, max and min methods. + +Wed May 26 12:20:21 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Overhauled error generation. Changed #define's so error + generation is easier to change again later, if necessary. Error + methods now have forwarding capability. See CollectionPrivate.h, + Collection.m, IndexedCollectionPrivate.h, IndexedCollection.m. + + * *.m: Fixed many small bugs found with -Wall. + + * Created Heap object. + + * Collection.m: Fixed -includesSameContents. + + * Collecting.h, Collection.m: Added -isSubsetOf: as written by + Kresten Krab Thorup. Removed -includesSubsetOf:. + +Tue May 25 14:14:33 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Removed ComparedCollecting protocol. Its only purpose was to + allow the user to manage a comparison function---this was silly, + though, because there already was a comparison function inherited + from Collection! No need to have two of them. Now that there is + a general interface for user-specified comparison functions, we + don't need the ComparedCollecting methods. This is a big help + because we no longer have the problem of trying to combine a + ComparedCollection class and Array class with some ugly multiple + inheritance issues. One disadvantage, however, is that it is + slightly more complicated to specify a comparator that is a + selector. + + * Overhauled comparison and hash functions. More changes than I + want to describe in detail here... 1) Created temporary versions + of hash.[hc] that do what I want, hopefully Kresten's new versions + of hash.[hc] will do something like this. Created collhash.[hc]. + 2) Added -init... methods that allow the users to specify their own + comparison and hash functions instead of accepting the defaults. + +Mon May 24 10:46:21 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Collecting.h, Collection.m: Removed -initWith:,... and + -initDescription:with:,... methods. I don't want to add ..with: + version of all -init... methods. People can use addCount,... + instead. + + * Created IdListLink.[hm]. Changed -linkClass in ListedList.m to + return [IdListLink class] if LinkedList contains objects. + + * Collecting.h, elt.h: Moved definition of elt union to + + + * List.m: -isEqual: now checks [List count] at beginning. + + * List.m: -empty no longer realloc()'s. (for compatibility with + NeXT.) + + * List.[hm]: Added + - makeObjectsPerform:(SEL)aSel reverseOrder:(BOOL)flag; + - makeObjectsPerform:(SEL)aSel with:anObject reverseOrder:(BOOL)flag; + and changed -makeObjectsPerform: and -makeObjectsPerform:with: to + call them. This gives the option of compatibility with + pre-NeXTSTEP 3.0 List's. + +Sat May 22 13:53:25 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * Collection.m, Collecting.h: Changed type of initialArg from + void* to elt in inject.. methods. + +Fri May 21 18:52:03 1993 Andrew McCallum (mccallum@vein.cs.rochester.edu) + + * First alpha release announced on gnu-objc@prep.ai.mit.edu + diff --git a/Headers/gnustep/base/.cvsignore b/Headers/gnustep/base/.cvsignore new file mode 100644 index 000000000..9c705bd2e --- /dev/null +++ b/Headers/gnustep/base/.cvsignore @@ -0,0 +1 @@ +stdobjects.h diff --git a/Headers/gnustep/base/AutoreleasePool.h b/Headers/gnustep/base/AutoreleasePool.h new file mode 100644 index 000000000..b1d78d0b5 --- /dev/null +++ b/Headers/gnustep/base/AutoreleasePool.h @@ -0,0 +1,53 @@ +/* Interface for relase pools for delayed disposal + Copyright (C) 1994 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Date: May 1993 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __AutoreleasePool_m_OBJECTS_INCLUDE +#define __AutoreleasePool_m_OBJECTS_INCLUDE + +#include +#include + +@interface AutoreleasePool : Object +{ + AutoreleasePool *parent; + unsigned released_count; + unsigned released_size; + id *released; +} + ++ currentPool; ++ (void) autoreleaseObject: anObj; +- (void) autoreleaseObject: anObj; + +- init; + +@end + +@interface Object (Retaining) +@end + +void objc_retain_object (id anObj); +void objc_release_object (id anObj); +unsigned objc_retain_count (id anObj); + +#endif /* __AutoreleasePool_m_OBJECTS_INCLUDE */ diff --git a/Headers/gnustep/base/AutoreleaseStack.h b/Headers/gnustep/base/AutoreleaseStack.h new file mode 100644 index 000000000..db5aae229 --- /dev/null +++ b/Headers/gnustep/base/AutoreleaseStack.h @@ -0,0 +1,122 @@ +/* Interface to release stack for delayed disposal + Copyright (C) 1994 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Date: May 1993 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __AutoreleaseStack_m_OBJECTS_INCLUDE +#define __AutoreleaseStack_m_OBJECTS_INCLUDE + +#include +#include + +@interface AutoreleaseStack : Object +{ +} + ++ (void) autoreleaseObject: anObj; +- (void) autoreleaseObject: anObj; + +- init; + +@end + +void objc_release_stack_objects(); + +/* + Use of this autorelease class gives -autorelease the following semantics: + + - autorelease; + + Use this message when the sender is done with this object, but the + sender doesn't want the object to be deallocated immediately + because the function that sends this message will use this object + as its return value. The object will be queued to receive the + actual "release" message only after the caller's caller returns. + (Well, not "queued", "stacked" actually.) + + Due to this delayed release, the function that receives the object + as a return value will have the opportunity to retain the object + before the "release" instigated by the "autorelease" actually + takes place. + + IMPORTANT PROGRAMMING CONVENTION: Since a autoreleased object may + be freed in the caller's caller's frame, a function must be careful + when returning an object that has been been autoreleased to it + (i.e. returning the object to the autorelease caller's caller's + caller). Since you cannot always know which objects returned to + the current function have been autoreleased by their returners, + you must use the following rule to insure safety for these + situations: + + When returning an object that has been allocated, copied or + retained by the returner, return the object as usual. If + returning an object that has been received in this function by + another function, always retain and autorelease the object + before returning it. (Unless, of course, the returner still + needs to keep a reference to the object, in which case the final + autorelease should be omitted.) + + The autorelease mechanism works as follows: The implementation of + the "autorelease" method pushes the receiver and the caller's + caller's frame address onto an internally maintained stack. But, + before pushing the reciever, the implementation checks the entries + already on the stack, popping elements off the stack until the + recorded frame address is less than the caller's caller's frame + address. Each object popped off the stack is sent a "release" + message. The stack capacity grows automatically if necessary. + + This mechanism ensures that not too many autoreleased objects can + be stacked before we check to see what objects can be released + (i.e. no objects). It also ensures that objects which have been + autoreleased are released as soon as we autorelease any other + object in a lower stack frame. + + The only way to build up an unnecessarily large collection of + autoreleased objects is by calling functions that autorelease an + object, and by repeatedly calling those functions from functions + with equal or increasingly higher frame addresses. + + Any time that you suspect that you may be creating an unnecessarily + large number of autoreleased objects in a function, (e.g. the + function contains a loop that creates many autoreleased objects + that the function doesn't need), you can always release all the + releasable autoreleased objects for this frame by calling + objc_release_stack_objects(). Be warned that calling this function + will release all objects that have been autoreleased to this + function; if you still need to use some of them, you will have to + retain them beforehand, and release or autorelease them + afterwards. + + If desired, you can also use objc_release_stack_objects() at the + top of an event loop, a guaranteed "catch-all" coding practise + similar to the creation and destruction of AutoreleasePool objects + in the event loop. + + As an alternative to calling objc_release_stack_objects() you can + also use the same scheme for forcing autorelease's as used for + AutoreleasePool's: s = [[AutoreleaseStack alloc] init], ... code + that autoreleases a bunch of objects to the same stack level ..., + [s release]. It has the same effect. + +*/ + + +#endif /* __AutoreleaseStack_m_OBJECTS_INCLUDE */ diff --git a/Headers/gnustep/base/SmallInt.h b/Headers/gnustep/base/SmallInt.h new file mode 100644 index 000000000..d092af468 --- /dev/null +++ b/Headers/gnustep/base/SmallInt.h @@ -0,0 +1,39 @@ +/* Interface for Objective-C efficient small integers + Copyright (C) 1993,1994 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Created: Sep 1995 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __SmallInt_h_INCLUDE_GNU +#define __SmallInt_h_INCLUDE_GNU + +#include + +#define IS_SMALLINT(OBJ) (((void*)OBJ) & 0x1) +#define ID2INT(OBJ) ((IS_SMALLINT(OBJ)) ? (((int)OBJ) >> 1):[OBJ intValue]) +#define INT2ID(I) ((id)((I << 1) & 0x1)) + +@interface SmallInt : NSObject + +- + +@end + +#endif /* __SmallInt_h_INCLUDE_GNU */ diff --git a/Makefile.local b/Makefile.local new file mode 100644 index 000000000..6f27cbc55 --- /dev/null +++ b/Makefile.local @@ -0,0 +1,3 @@ +install-lib: libobjects.a + $(INSTALL_DATA) libobjects.a $(libdir)/libobjects.a + $(RANLIB) $(libdir)/libobjects.a diff --git a/README.ULTRIX b/README.ULTRIX new file mode 100644 index 000000000..1d6dd45bb --- /dev/null +++ b/README.ULTRIX @@ -0,0 +1,52 @@ +To: mccallum@cs.rochester.edu +Subject: Re: Connection, Proxy Classes +In-reply-to: Your message of "Fri, 04 Nov 1994 15:22:27 CDT." + <199411042022.PAA13085@slate.cs.rochester.edu> +Date: Tue, 08 Nov 1994 12:44:07 +1100 +From: Masahiro Takatsuka + +Hello Andrew, + +I got libobjects and installed on DEC(Ultrix). + +A problem was that when I tried to compile checks/server.m, I +got a error from "as0". After delete -g switch for compiling +server.m, I successfully compiled it. + +I'd like to say "Thank you" for your work!!! + +Regards, +Masa +============================================================================ +Masahiro Takatsuka (MASA) +e-mail: Masahiro.Takatsuka@eng.monash.edu.au(non-NeXTmail) +---------------------------------------------------------------------------- +Intelligent Robotics Research Center :OzNeXT :xxxxxx +Eng. Building 36, Room No. G04 :NeXus :92-00226 +Department of Electrical & :CompuServe :71661,1331 +Computer Systems Engineering :Nifty-serve :MGG1331 +Monash University : +Wellington Rd., Clayton :Tel.+61-3-905-5705 +Victoria 3168, AUSTRALIA :Fax.+61-3-905-3454 +============================================================================ + +Date: Mon, 9 Jan 1995 14:03:21 -0700 (MST) +From: Adam Fedor +Subject: Re: libobjects porting volunteers needed +To: mccallum@cs.rochester.edu +In-Reply-To: <199501092051.PAA06062@slate.cs.rochester.edu> +Message-Id: +Mime-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII + +On Mon, 9 Jan 1995 mccallum@cs.rochester.edu wrote: + +> +> Did you look at README.ULTRIX in 0.1.2? +> + +Yes. I also forgot to say that deleting the -g switch didn't help me, +but deleting the -O switch did. Without this, I get the error: + +as0: Internal: server.m, line 1: scNil to scNil + diff --git a/README.first b/README.first new file mode 100644 index 000000000..6e1a6ba24 --- /dev/null +++ b/README.first @@ -0,0 +1,26 @@ +This is a snapshot distribution of libobjects. + +It is a totally untested "snapshot" of the source tree made on the +date indicated by the filename. + +This release is not intended for casual users of libobjects---it is +meant for libobjects developers. + +IMPORTANT: + +This means that naive users should *not* send me email complaining +that something in this snapshot doesn't work. Preferred responses +to problems with this snapshot are: + +1) Fix the problem yourself and email me a patch. (See the message + about the preferred format for patches in admin/HOWTO-patches.) + +2) Find the problem and email a detailed description to the author of + the relevant file. + +3) Don't use this snapshot; switch to the officially released version + of libobjects at ftp://prep.ai.mit.edu/pub/gnu. + + + Andrew McCallum + mccallum@gnu.ai.mit.edu diff --git a/Source/MachPort.m b/Source/MachPort.m new file mode 100644 index 000000000..f55a65c1c --- /dev/null +++ b/Source/MachPort.m @@ -0,0 +1,189 @@ +/* Implementation of Machport-based port object for use with Connection + Copyright (C) 1994 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Date: September 1994 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +#include +#include + +static Dictionary *portDictionary; +static Lock *portDictionaryGate; + +@implementation MachPort + ++ initialize +{ + portDictionaryGate = [Lock new]; + assert(sizeof(int) == sizeof(port_t)); + portDictionary = [[Dictionary alloc] + initWithType:@encode(id) + keyType:@encode(int)]; + return self; +} + +/* This not tested */ +static int +worry (any_t arg) +{ + kern_return_t r; + notification_t m; + m.notify_header.msg_size = sizeof(notification_t); + m.notify_header.msg_local_port = task_notify(); + for (;;) + { + r = msg_receive((msg_header_t*)&m, MSG_OPTION_NONE, 0); + switch (r) + { + case RCV_SUCCESS: + fprintf(stderr, "notification id %d\n", (int)m.notify_header.msg_id); + break; + case RCV_TIMED_OUT: + fprintf(stderr, "notification msg_receive timed out\n"); + exit(-1); + default: + mach_error("notification", r); + exit(-1); + } + switch (m.notify_header.msg_id) + { + case NOTIFY_PORT_DELETED: + [[MachPort newFromMachPort:m.notify_port] invalidate]; + break; + case NOTIFY_MSG_ACCEPTED: + break; + case NOTIFY_PORT_DESTROYED: + [[MachPort newFromMachPort:m.notify_port] invalidate]; + break; + default: + mach_error("notification", r); + exit(-1); + } + /* Where do we free the object? */ + } + return 0; +} + +/* This not tested */ ++ worryAboutPortInvalidation +{ + MachPort *worryPort = [MachPort new]; + task_set_special_port(task_self(), TASK_NOTIFY_PORT, [worryPort machPort]); + cthread_detach(cthread_fork((any_t)worry, (any_t)0)); + return self; +} + +/* designated initializer */ ++ newFromMachPort: (port_t)p dealloc: (BOOL)f +{ + MachPort *aPort; + [portDictionaryGate lock]; + if ((aPort = [portDictionary elementAtKey:(int)p])) + { + [portDictionaryGate unlock]; + [aPort addReference]; + return aPort; + } + aPort = [[self alloc] init]; + aPort->machPort = p; + aPort->deallocate = f; + [portDictionary addElement:aPort atKey:(int)p]; + [portDictionaryGate unlock]; + return aPort; +} + ++ newFromMachPort: (port_t)p +{ + return [self newFromMachPort:p dealloc:NO]; +} + ++ new +{ + kern_return_t error; + port_t p; + + if ((error=port_allocate(task_self(), &p)) != KERN_SUCCESS) { + mach_error("port_allocate failed", error); + exit(1); + } + return [self newFromMachPort:p]; +} + +- encodeUsing: aPortal +{ + [aPortal encodeData:&deallocate ofType:@encode(BOOL)]; + [aPortal encodeMachPort:machPort]; + return self; +} + +- decodeUsing: aPortal +{ + BOOL f; + port_t mp; + MachPort *p; + + [aPortal decodeData:&f ofType:@encode(BOOL)]; + [aPortal decodeMachPort:&mp]; + /* Is this right? Can we return a different object than 'self' */ + p = [MachPort newFromMachPort:mp dealloc:f]; + [self release]; + return p; +} + +- (unsigned) hash +{ + /* What should this be? */ + return (unsigned)self; +} + +- (void) dealloc +{ + if (refcount-1 == 0) + { + [portDictionaryGate lock]; + [portDictionaryGate removeElementAtKey:(int)machPort]; + [portDictionaryGate unlock]; + if (deallocate) + { + kern_return_t error; + error = port_deallocate(task_self(), machPort); + if (error != KERN_SUCCESS) { + mach_error("port_deallocate failed", error); + exit(1); + } + } + } + [super dealloc]; + return self; +} + +- (port_t) machPort +{ + return machPort; +} + +@end + diff --git a/Source/Makefile.local b/Source/Makefile.local new file mode 100644 index 000000000..e69de29bb diff --git a/Source/MethodSignature.m b/Source/MethodSignature.m new file mode 100644 index 000000000..8015f8392 --- /dev/null +++ b/Source/MethodSignature.m @@ -0,0 +1,135 @@ +#include + +static int +types_get_size_of_arguments(const char *types) +{ + const char* type = objc_skip_typespec (types); + return atoi (type); +} + +static int +types_get_number_of_arguments (const char *types) +{ + int i = 0; + const char* type = types; + while (*type) + { + type = objc_skip_argspec (type); + i += 1; + } + return i - 1; +} + + +@implementation MethodSignature + ++ fromDescription:(struct objc_method_description *)omd + fromZone:(NXZone *)aZone +{ + MethodSignature *newMs = [[MethodSignature alloc] init]; + newMs->sig = *omd; + newMs->selName = (char*)sel_get_name(omd->name); + newMs->nargs = types_get_number_of_arguments(omd->types); + newMs->sizeofParams = types_get_size_of_arguments(omd->types); + return newMs; +} + +- encodeMethodParams:(arglist_t)argFrame onto:(id )portal +{ + char *datum; + const char *type; + unsigned flags; + + for (type = sig.types; + (datum = method_get_next_argument(argFrame, &type));) + { + flags = objc_get_type_qualifiers(type); + type = objc_skip_type_qualifiers(type); + [portal encodeData:datum ofType:type]; + } + return self; +} + +- (arglist_t) decodeMethodParamsFrom: (id )portal +{ + arglist_t argFrame = 0; //(marg_list) malloc(sizeofParams); + char *datum; + const char *type; + unsigned flags; + + for (type = sig.types; + (datum = method_get_next_argument(argFrame, &type));) + { + flags = objc_get_type_qualifiers(type); + type = objc_skip_type_qualifiers(type); + [portal decodeData:datum ofType:type]; + } + return argFrame; +} + +#define ENCODE_RET(RETVAL,TYPE) \ +do { \ + TYPE __r (void* __rf) {__builtin_return(__rf);} \ + TYPE __tmp = __r(RETVAL); \ + [portal encodeData:&__tmp ofType:sig.types]; \ +} while(0); + +/* Note: NeXT's direct passing of the ret value instead of a + pointer to the ret value means we can't return doubles. + I'm improving on this by passing a pointer what's + returns from __builtin_apply() */ +- encodeMethodRet: retframe + withargs:(void *)argFrame + onto:(id )portal +{ + /* NOTE: we don't yet handle changing values passed by reference */ + switch (*sig.types) + { + case _C_CHR: + case _C_UCHR: + ENCODE_RET(retframe, char); + break; + case _C_SHT: + case _C_USHT: + ENCODE_RET(retframe, short); + break; + case _C_INT: + case _C_UINT: + ENCODE_RET(retframe, int); + break; + case _C_LNG: + case _C_ULNG: + ENCODE_RET(retframe, int); + break; + case _C_FLT: + ENCODE_RET(retframe, float); + break; + case _C_DBL: + ENCODE_RET(retframe, double); + break; + default: + [self error:"Can't handle type %s", sig.types]; + } + return self; +} + +/* In my version this actually returns the void* to be given to + __builtin_return. I'm not sure what NeXT's version does */ + +- decodeMethodRetFrom:(id )portal + withargs:(void *)aVoidPtr +{ +//#warning this should be sizeof return + void *datum = malloc(32); /* this should be sizeof return */ + [portal decodeData:datum ofType:sig.types]; + return datum; +} + +- (BOOL) isOneway +{ + return NO; +} + +@end + + diff --git a/Source/NSLog.m b/Source/NSLog.m new file mode 100644 index 000000000..4b6135854 --- /dev/null +++ b/Source/NSLog.m @@ -0,0 +1,42 @@ +/* Implementation of NSLog() error loging functions for GNUStep + Copyright (C) 1995 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Created: Nov 1995 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +`void NSLog(NSString *format,...' + ) Writes to stderr an error message of the form: + + ª \i time processName processID format\i0 º. The format argument + to `NSLog()' is a format string in the style of the standard C + function `printf()', followed by an arbitrary number of arguments + that match conversion specifications (such as %s or %d) in the + format string. (You can pass an object in the list of arguments by + specifying % in the format stringÐthis conversion specification + gets replaced by the string that the object's description method + returns.) + +void +NSLogv(NSString* format, va_list args) +{ + fprintf(stderr, "", ); + vfprintf(stderr, [[NSString stringWithFormat:format + arguments:args] cString]); +} diff --git a/Source/ProtocolEnforcer.m b/Source/ProtocolEnforcer.m new file mode 100644 index 000000000..8de6ad4f4 --- /dev/null +++ b/Source/ProtocolEnforcer.m @@ -0,0 +1,43 @@ + +@interface ProtocolEnforcer +{ + id target; + Protocol *protocol; +} + +- initWithProtocol: aProtocol target: anObj; + +- (BOOL) conformsTo: aProtocol; +- forward: (SEL)sel :(arglist_t)frame; + +@end + +@implementation ProtocolEnforcer + +- initWithProtocol: aProtocol target: anObj +{ + [super init]; + protocol = aProtocol; + target = anObj; + return self; +} + +- (BOOL) conformsTo: aProtocol +{ + if (aProtocol == protocol) + return YES; + else + return NO; +} + +- (retval_t) forward: (SEL)sel :(arglist_t)frame +{ + if ([protocol descriptionForInstanceMethod:sel]) + return [target performv:sel :frame]; + else +#warning Fix this + return + [self error:"We should punish the remote connection not the local one"]; +} + +@end diff --git a/Source/ReleasePool.m b/Source/ReleasePool.m new file mode 100644 index 000000000..295c24263 --- /dev/null +++ b/Source/ReleasePool.m @@ -0,0 +1,76 @@ + +static unsigned released_capacity = 0; +static unsigned released_index = 0; +static id *released_objects = NULL; +static void **released_stack_pointers = NULL; + +#define DEFAULT_SIZE 64 + +static void *s1, *s2; +static void unsigned stack_release_offset; +static void init_stack_release() +{ + s1 = get_stack(); + [Object _stackReleaseTest]; + stack_release_offset = s2 - s1; + released_capacity = DEFAULT_SIZE; + OBJC_MALLOC(released_objects, id, released_capacity); + OBJC_MALLOC(released_stack_pointers, void*, released_capacity); +} + +static void* +get_stack() +{ + int i; + return &i; +} + +static inline void +grow_released_arrays() +{ + if (index == released_capacity) + { + released_capacity *= 2; + OBJC_REALLOC(released_objects, id, released_capacity); + OBJC_REALLOC(released_stack_pointers, void*, released_capacity); + } +} + +@implementation Object (Releasing) + ++ _stackReleaseTest +{ + s2 = get_stack(); +} + +- stackRelease +/* - releaseLater */ +{ + static init_done = 0; + + /* Initialize if we haven't done it yet */ + if (!init_done) + { + init_stack_release(); + init_done = 1; + } + + /* Do the pending releases of other objects */ + /* xxx This assumes stack grows up */ + while ((released_stack_pointers[released_index] + > (get_stack() - stack_release_offset)) + && released_index) + { + [released_objects[released_index] release]; + released_index--; + } + + /* Queue this object for later release */ + released_index++; + grow_released_arrays(); + released_objects[released_index] = self; + + return self; +} + +@end diff --git a/Source/Ring.m b/Source/Ring.m new file mode 100644 index 000000000..ecaccaa68 --- /dev/null +++ b/Source/Ring.m @@ -0,0 +1,5 @@ +/* Ring.m - a fixed-length circular array */ + +@implementation Ring + +@end diff --git a/Source/SunRpcPort.m b/Source/SunRpcPort.m new file mode 100644 index 000000000..514cdd093 --- /dev/null +++ b/Source/SunRpcPort.m @@ -0,0 +1,97 @@ +#include +#include + +@interface SunRpcPort : Port +{ +} + +@end + +@implementation SunRpcPort + ++ newRegisteredPortWithName: (const char *)n +{ + SunRpcPort *newPort; + unsigned long prognum, versnum, procnum; + char *(*procname)(); + xdrproc_t *(*procname)(); + + + if (registerrpc(prognum, versnum, procnum, procname, inproc, outproc)) + [self error:"registerrpc failed"]; + return newPort; +} + ++ newPortFromRegisterWithName: (const char *)n onHost: (const char *)host +{ + [self notImplemented:_cmd]; + return nil; +} + ++ newPort +{ + [self notImplemented:_cmd]; + return nil; +} + +/* These sending and receiving interfaces will change */ + +- (int) sendPacket: (const char *)b length: (int)l + toPort: (Port*) remote + timeout: (int) milliseconds +{ + [self notImplemented:_cmd]; + return 0; +} + +- (int) sendPacket: (const char *)b length: (int)l + toPort: (Port*) remote +{ + return [self sendPacket:b length:l toPort:remote timeout:-1]; +} + +- (int) receivePacket: (char*)b length: (int)l + fromPort: (Port**) remote + timeout: (int) milliseconds +{ + [self notImplemented:_cmd]; + return 0; +} + +- (int) receivePacket: (char*)b length: (int)l + fromPort: (Port**) remote +{ + return [self receivePacket:b length:l fromPort:remote timeout:-1]; +} + +- (BOOL) canReceive +{ + [self notImplemented:_cmd]; + return NO; +} + +- (BOOL) isEqual: anotherPort +{ + [self notImplemented:_cmd]; + return NO; +} + +- (unsigned) hash +{ + [self notImplemented:_cmd]; + return 0; +} + +- (void) encodeWithCoder: (Coder*)anEncoder +{ + [self notImplemented:_cmd]; +} + ++ newWithCoder: (Coder*)aDecoder; +{ + [self notImplemented:_cmd]; + return 0; +} + +@end + diff --git a/Source/Thread.m b/Source/Thread.m new file mode 100644 index 000000000..959a6cac8 --- /dev/null +++ b/Source/Thread.m @@ -0,0 +1,15 @@ + +#if defined(NeXT) + +#elif defined(MACH) + +#elif defined(sun) && defined(svr4) + +@implementation Thread +@end +@implementation Lock +@end + +#else +#error Threads not available for this system. +#endif diff --git a/Source/Tree.m b/Source/Tree.m new file mode 100644 index 000000000..780c30c8b --- /dev/null +++ b/Source/Tree.m @@ -0,0 +1,476 @@ +/* Implementation for Objective-C Tree collection object + Copyright (C) 1993,1994, 1995 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Date: May 1993 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include + +/* sentinal */ +static id nilTreeNode; + +@implementation Tree + ++ initialize +{ + if (self == [Tree class]) + { + [self setVersion:0]; /* beta release */ + nilTreeNode = [[TreeNode alloc] init]; + } + return self; +} + +/* This is the designated initializer of this class */ +- init +{ + [super initWithType:@encode(id)]; + _count = 0; + _contents_root = [self nilNode]; + return self; +} + +/* Archiving must mimic the above designated initializer */ + +- _newCollectionWithCoder: aCoder +{ + [super _initCollectionWithCoder:aCoder]; + _count = 0; + _contents_root = [self nilNode]; + return self; +} + +- (void) _encodeContentsWithCoder: (Coder*)aCoder +{ + [aCoder startEncodingInterconnectedObjects]; + [super _encodeContentsWithCoder:aCoder]; + [aCoder finishEncodingInterconnectedObjects]; +} + +- (void) _decodeContentsWithCoder: (Coder*)aCoder +{ + [aCoder startDecodingInterconnectedObjects]; + [super _decodeContentsWithCoder:aCoder]; + [aCoder finishDecodingInterconnectedObjects]; +} + +/* Empty copy must empty an allocCopy'ed version of self */ +- emptyCopy +{ + Tree *copy = [super emptyCopy]; + copy->_count = 0; + copy->_contents_root = [self nilNode]; + return copy; +} + +/* This must work without sending any messages to content objects */ +- _empty +{ + _count = 0; + _contents_root = [self nilNode]; + return self; +} + +/* Override the designated initializer for our superclass IndexedCollection + to make sure we have object contents */ +- initWithType: (const char *)contentEncoding +{ + if (!ENCODING_IS_OBJECT(contentEncoding)) + [self error:"Tree contents must be objects."]; + return [self init]; +} + +- nilNode +{ + return nilTreeNode; +} + +- rootNode +{ + return _contents_root; +} + +- leftmostNodeFromNode: aNode +{ + id left; + + if (aNode && aNode != [self nilNode]) + { + while ([[aNode children] count] && + (left = [[aNode children] firstObject]) != [self nilNode]) + aNode = left; + } + return aNode; +} + +- rightmostNodeFromNode: aNode +{ + id right; + + if (aNode && aNode != [self nilNode]) + while ([[aNode children] count] && + (right = [[aNode children] lastObject]) != [self nilNode]) + { + aNode = right; + } + return aNode; +} + +- (elt) firstElement +{ + return [self leftmostNodeFromNode:_contents_root]; +} + +- (elt) lastElement +{ + return [self rightmostNodeFromNode:_contents_root]; +} + +/* This is correct only is the tree is sorted. How to deal with this? */ +- (elt) maxElement +{ + return [self rightmostNodeFromNode:_contents_root]; +} + +/* This is correct only is the tree is sorted. How to deal with this? */ +- (elt) minElement +{ + return [self leftmostNodeFromNode:_contents_root]; +} + +// returns [self nilNode] is there is no successor; +- (elt) successorOfElement: (elt)anElement +{ + id tmp; + + // here tmp is the right node; + if ((tmp = [anElement.id_u rightNode]) != [self nilNode]) + return [self leftmostNodeFromNode:tmp]; + // here tmp is the parent; + tmp = [anElement.id_u parentNode]; + while (tmp != [self nilNode] + [[tmp children] count] && + && anElement.id_u == [[tmp children] lastObject]) + { + anElement.id_u = tmp; + tmp = [tmp parentNode]; + } + return tmp; +} + +// I should make sure that [_contents_root parentNode] == [self nilNode]; +// Perhaps I should make [_contents_root parentNode] == TreeObj ??; + +// returns [self nilNode] is there is no predecessor; +- (elt) predecessorElement: (elt)anElement +{ + id tmp; + + // here tmp is the left node; + if ((tmp = [anElement.id_u leftNode]) != [self nilNode]) + return [self rightmostNodeFromNode:tmp]; + // here tmp is the parent; + tmp = [anElement.id_u parentNode]; + while (tmp != [self nilNode] + [[tmp children] count] && + && anElement.id_u == [[tmp children] firstObject]) + { + anElement.id_u = tmp; + tmp = [tmp parentNode]; + } + return tmp; +} + +/* This relies on [_contents_root parentNode] == [self nilNode] */ +- rootFromNode: aNode +{ + id parentNode; + while ((parentNode = [aNode parentNode]) != [self nilNode]) + aNode = parentNode; + return aNode; +} + +/* This relies on [_contents_root parentNode] == [self nilNode] */ +- (unsigned) depthOfNode: aNode +{ + unsigned count = 0; + + if (aNode == nil || aNode == [self nilNode]) + [self error:"in %s, Can't find depth of nil node", sel_get_name(_cmd)]; + do + { + aNode = [aNode parentNode]; + count++; + } + while (aNode != [self nilNode]); + return count; +} + +#if 0 +- (unsigned) heightOfNode: aNode +{ + unsigned leftHeight, rightHeight; + id tmpNode; + + if (aNode == nil || aNode == [self nilNode]) + { + [self error:"in %s, Can't find height of nil node", sel_get_name(_cmd)]; + return 0; + } + else + { + leftHeight = ((tmpNode = [aNode leftNode]) + ? + (1 + [self heightOfNode:tmpNode]) + : + 0); + rightHeight = ((tmpNode = [aNode rightNode]) + ? + (1 + [self heightOfNode:tmpNode]) + : + 0); + return MAX(leftHeight, rightHeight); + } +} + +- (unsigned) nodeCountUnderNode: aNode +{ + unsigned count = 0; + if ([aNode leftNode] != [self nilNode]) + count += 1 + [self nodeCountUnderNode:[aNode leftNode]]; + if ([aNode rightNode] != [self nilNode]) + count += 1 + [self nodeCountUnderNode:[aNode rightNode]]; + return count; +} +#endif + +- (elt) elementAtIndex: (unsigned)index +{ + elt ret; + + CHECK_INDEX_RANGE_ERROR(index, _count); + ret = [self firstElement]; + // Not very efficient; Should be rewritten; + while (index--) + ret = [self successorOfElement:ret]; + return ret; +} + +#if 0 +- sortAddElement: (elt)newElement byCalling: (int(*)(elt,elt))aFunc +{ + id theParent, tmpChild; + + [newElement.id_u setLeftNode:[self nilNode]]; + [newElement.id_u setRightNode:[self nilNode]]; + theParent = [self nilNode]; + tmpChild = _contents_root; + while (tmpChild != [self nilNode]) + { + theParent = tmpChild; + if ((*aFunc)(newElement,theParent) < 0) + tmpChild = [tmpChild leftNode]; + else + tmpChild = [tmpChild rightNode]; + } + [newElement.id_u setParentNode:theParent]; + if (theParent == [self nilNode]) + _contents_root = newElement.id_u; + else + { + if (COMPARE_ELEMENTS(newElement, theParent) < 0) + [theParent setLeftNode:newElement.id_u]; + else + [theParent setRightNode:newElement.id_u]; + } + _count++; + return self; +} +#endif + +- addElement: (elt)newElement +{ + // By default add to root node. Is this what we want?; + if (_contents_root) + [[_contents_root children] addObject:newElement.id_u]; + else + _contents_root = newElement.id_u; + _count++; + return self; +} + +#if 0 +// NOTE: This gives you the power to put elements in unsorted order; +- insertElement: (elt)newElement before: (elt)oldElement +{ + id tmp; + + #ifdef SAFE_Tree + if ([self rootFromNode:oldElement.id_u] != _contents_root) + [self error:"in %s, oldElement not in tree!!", sel_get_name(_cmd)]; + #endif + + [newElement.id_u setRightNode:[self nilNode]]; + [newElement.id_u setLeftNode:[self nilNode]]; + if ((tmp = [oldElement.id_u leftNode]) != [self nilNode]) + { + [(tmp = [self rightmostNodeFromNode:tmp]) setRightNode:newElement.id_u]; + [newElement.id_u setParentNode:tmp]; + } + else if (newElement.id_u != [self nilNode]) + { + [oldElement.id_u setLeftNode:newElement.id_u]; + [newElement.id_u setParentNode:oldElement.id_u]; + } + else + { + _contents_root = newElement.id_u; + [newElement.id_u setParentNode:[self nilNode]]; + } + _count++; + return self; +} + +// NOTE: This gives you the power to put elements in unsorted order; +- insertElement: (elt)newElement after: (elt)oldElement +{ + id tmp; + + #ifdef SAFE_Tree + if ([self rootFromNode:oldElement.id_u] != _contents_root) + [self error:"in %s, !!!!!!!!", sel_get_name(_cmd)]; + #endif + + [newElement.id_u setRightNode:[self nilNode]]; + [newElement.id_u setLeftNode:[self nilNode]]; + if ((tmp = [oldElement.id_u rightNode]) != [self nilNode]) + { + [(tmp = [self leftmostNodeFromNode:tmp]) setLeftNode:newElement.id_u]; + [newElement.id_u setParentNode:tmp]; + } + else if (newElement.id_u != [self nilNode]) + { + [oldElement.id_u setRightNode:newElement.id_u]; + [newElement.id_u setParentNode:oldElement.id_u]; + } + else + { + _contents_root = newElement.id_u; + [newElement.id_u setParentNode:[self nilNode]]; + } + _count++; + return self; +} + +// NOTE: This gives you the power to put elements in unsorted order; +- insertElement: (elt)newElement atIndex: (unsigned)index +{ + CHECK_INDEX_RANGE_ERROR(index, _count+1); + if (index == _count) + [self appendElement:newElement]; + else + [self insertElement:newElement before:[self elementAtIndex:index]]; + return self; +} + +// NOTE: This gives you the power to put elements in unsorted order; +- appendElement: (elt)newElement +{ + if (_count == 0) + { + _contents_root = newElement.id_u; + _count = 1; + [newElement.id_u setLeftNode:[self nilNode]]; + [newElement.id_u setRightNode:[self nilNode]]; + [newElement.id_u setParentNode:[self nilNode]]; + } + else + [self insertElement:newElement after:[self lastElement]]; + return self; +} +#endif + +- (elt) removeElement: (elt)oldElement +{ + id parent = [oldElement.id_u parentNode]; + [parent removeObject:oldElement.id_u]; + [parent addContentsOf:[oldElement.id_u children]]; + _count--; + return oldElement; +} + +- withElementsCall: (void(*)(elt))aFunc whileTrue: (BOOL*)flag +{ + void traverse(id aNode) + { + if (!(*flag) || aNode == [self nilNode] || !aNode) + return; + (*aFunc)(aNode); + [[aNode children] withObjectsCall:traverse]; + } + traverse(_contents_root); + return self; +} + +- withElementsInReverseCall: (void(*)(elt))aFunc whileTrue: (BOOL*)flag +{ + void traverse(id aNode) + { + if (*flag || aNode == [self nilNode] || !aNode) + return; + [[aNode children] withObjectsCall:traverse]; + (*aFunc)(aNode); + } + traverse(_contents_root); + return self; +} + +- (BOOL) getNextElement:(elt *)anElementPtr withEnumState: (void**)enumState +{ + if (!(*enumState)) + *enumState = [self leftmostNodeFromNode:_contents_root]; + else + *enumState = [self successorOfElement:*enumState].id_u; + *anElementPtr = *enumState; + if (*enumState) + return YES; + return NO; +} + +- (BOOL) getPrevElement:(elt *)anElementPtr withEnumState: (void**)enumState +{ + if (!(*enumState)) + *enumState = [self rightmostNodeFromNode:_contents_root]; + else + *enumState = [self predecessorElement:*enumState].id_u; + *anElementPtr = *enumState; + if (*enumState) + return YES; + return NO; +} + +- (unsigned) count +{ + return _count; +} + +@end diff --git a/Source/TreeNode.m b/Source/TreeNode.m new file mode 100644 index 000000000..88feaee75 --- /dev/null +++ b/Source/TreeNode.m @@ -0,0 +1,97 @@ +/* Implementation for Objective-C TreeNode object + Copyright (C) 1993,1994, 1995 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Date: May 1993 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include + +@implementation TreeNode + ++ initialize +{ + if (self == [TreeNode class]) + [self setVersion:0]; /* beta release */ + return self; +} + ++ defaultChildrenCollectionClass +{ + return [Array class]; +} + +- initWithChildren: (id )kids +{ + [super init]; + _parent = [self nilNode]; + _children = kids; + return self; +} + +- init +{ + [self initWithChildren:[[[self defaultChildrenCollectionClass] alloc] init]]; + return self; +} + +- (void) encodeWithCoder: aCoder +{ + [super encodeWithCoder:aCoder]; + [aCoder encodeObjectReference:_parent withName:"Parent Tree Node"]; + [aCoder encodeObject:_children withName:"Children of Tree Node"]; +} + +- initWithCoder: aCoder +{ + [self initWithCoder:aCoder]; + [aCoder decodeObjectAt:&_parent withName:NULL]; + [aCoder decodeObjectAt:&_children withName:NULL]; + return n; +} + +- children +{ + return _children; +} + +- parentNode +{ + return _parent; +} + +- (void) setChildren: (id )kids +{ + /* xxx + [kids retain]; + [_children release]; + */ + _children = kids; + return self; +} + +- (void) setParentNode: aNode +{ + _parent = aNode; + return self; +} + +@end + diff --git a/Source/gnu4next.m b/Source/gnu4next.m new file mode 100644 index 000000000..0f5bde20a --- /dev/null +++ b/Source/gnu4next.m @@ -0,0 +1,441 @@ +/* Method encoding types for Objective C. + Copyright (C) 1993,1994 Free Software Foundation, Inc. + + Author: Kresten Krab Thorup + Modified by: Andrew McCallum + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "objects/next2gnu.h" +#include +#include + +/* Deal with strrchr: */ +#if STDC_HEADERS || HAVE_STRING_H +#include +/* An ANSI string.h and pre-ANSI memory.h might conflict. */ +#if !STDC_HEADERS && HAVE_MEMORY_H +#include +#endif /* not STDC_HEADERS and HAVE_MEMORY_H */ +#define index strchr +#define rindex strrchr +#define bcopy(s, d, n) memcpy ((d), (s), (n)) +#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) +#define bzero(s, n) memset ((s), 0, (n)) +#else /* not STDC_HEADERS and not HAVE_STRING_H */ +#include +/* memory.h and strings.h conflict on some systems. */ +#endif /* not STDC_HEADERS and not HAVE_STRING_H */ + +#define MAX(X, Y) \ + ({ typeof(X) __x = (X), __y = (Y); \ + (__x > __y ? __x : __y); }) + +#define MIN(X, Y) \ + ({ typeof(X) __x = (X), __y = (Y); \ + (__x < __y ? __x : __y); }) + +#define ROUND(V, A) \ + ({ typeof(V) __v=(V); typeof(A) __a=(A); \ + __a*((__v+__a-1)/__a); }) + + +static inline int +atoi (const char* str) +{ + int res = 0; + + while (isdigit (*str)) + res *= 10, res += (*str++ - '0'); + + return res; +} + +#if NeXT_runtime +/* + return the size of an object specified by type +*/ + +int +objc_sizeof_type(const char* type) +{ + switch(*type) { + case _C_ID: + return sizeof(id); + break; + + case _C_CLASS: + return sizeof(Class); + break; + + case _C_SEL: + return sizeof(SEL); + break; + + case _C_CHR: + return sizeof(char); + break; + + case _C_UCHR: + return sizeof(unsigned char); + break; + + case _C_SHT: + return sizeof(short); + break; + + case _C_USHT: + return sizeof(unsigned short); + break; + + case _C_INT: + return sizeof(int); + break; + + case _C_UINT: + return sizeof(unsigned int); + break; + + case _C_LNG: + return sizeof(long); + break; + + case _C_ULNG: + return sizeof(unsigned long); + break; + + case _C_FLT: + return sizeof(float); + break; + + case _C_DBL: + return sizeof(double); + break; + + case _C_PTR: + case _C_ATOM: + case _C_CHARPTR: + return sizeof(char*); + break; + + case _C_ARY_B: + { + int len = atoi(type+1); + while (isdigit(*++type)); + return len*objc_aligned_size (type); + } + break; + + case _C_STRUCT_B: + { + int acc_size = 0; + int align; + while (*type != _C_STRUCT_E && *type++ != '='); /* skip "=" */ + while (*type != _C_STRUCT_E) + { + align = objc_alignof_type (type); /* padd to alignment */ + acc_size = ROUND (acc_size, align); + acc_size += objc_sizeof_type (type); /* add component size */ + type = objc_skip_typespec (type); /* skip component */ + } + return acc_size; + } + + case _C_UNION_B: + { + int max_size = 0; + while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; + while (*type != _C_UNION_E) + { + max_size = MAX (max_size, objc_sizeof_type (type)); + type = objc_skip_typespec (type); + } + return max_size; + } + + default: + abort(); + } +} + + +/* + Return the alignment of an object specified by type +*/ + +int +objc_alignof_type(const char* type) +{ + switch(*type) { + case _C_ID: + return __alignof__(id); + break; + + case _C_CLASS: + return __alignof__(Class); + break; + + case _C_SEL: + return __alignof__(SEL); + break; + + case _C_CHR: + return __alignof__(char); + break; + + case _C_UCHR: + return __alignof__(unsigned char); + break; + + case _C_SHT: + return __alignof__(short); + break; + + case _C_USHT: + return __alignof__(unsigned short); + break; + + case _C_INT: + return __alignof__(int); + break; + + case _C_UINT: + return __alignof__(unsigned int); + break; + + case _C_LNG: + return __alignof__(long); + break; + + case _C_ULNG: + return __alignof__(unsigned long); + break; + + case _C_FLT: + return __alignof__(float); + break; + + case _C_DBL: + return __alignof__(double); + break; + + case _C_ATOM: + case _C_CHARPTR: + return __alignof__(char*); + break; + + case _C_ARY_B: + while (isdigit(*++type)) /* do nothing */; + return objc_alignof_type (type); + + case _C_STRUCT_B: + { + struct { int x; double y; } fooalign; + while(*type != _C_STRUCT_E && *type++ != '=') /* do nothing */; + if (*type != _C_STRUCT_E) + return MAX (objc_alignof_type (type), __alignof__ (fooalign)); + else + return __alignof__ (fooalign); + } + + case _C_UNION_B: + { + int maxalign = 0; + while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; + while (*type != _C_UNION_E) + { + maxalign = MAX (maxalign, objc_alignof_type (type)); + type = objc_skip_typespec (type); + } + return maxalign; + } + + default: + abort(); + } +} + +/* + The aligned size if the size rounded up to the nearest alignment. +*/ + +int +objc_aligned_size (const char* type) +{ + int size = objc_sizeof_type (type); + int align = objc_alignof_type (type); + return ROUND (size, align); +} + +/* + The size rounded up to the nearest integral of the wordsize, taken + to be the size of a void*. +*/ + +int +objc_promoted_size (const char* type) +{ + int size = objc_sizeof_type (type); + int wordsize = sizeof (void*); + + return ROUND (size, wordsize); +} + +/* + Skip type qualifiers. These may eventually precede typespecs + occuring in method prototype encodings. +*/ + +inline const char* +objc_skip_type_qualifiers (const char* type) +{ + while (*type == _C_CONST + || *type == _C_IN + || *type == _C_INOUT + || *type == _C_OUT + || *type == _C_BYCOPY + || *type == _C_ONEWAY) + { + type += 1; + } + return type; +} + + +/* + Skip one typespec element. If the typespec is prepended by type + qualifiers, these are skipped as well. +*/ + +const char* +objc_skip_typespec (const char* type) +{ + type = objc_skip_type_qualifiers (type); + + switch (*type) { + + case _C_ID: + /* An id may be annotated by the actual type if it is known + with the @"ClassName" syntax */ + + if (*++type != '"') + return type; + else + { + while (*++type != '"') /* do nothing */; + return type + 1; + } + + /* The following are one character type codes */ + case _C_CLASS: + case _C_SEL: + case _C_CHR: + case _C_UCHR: + case _C_CHARPTR: + case _C_ATOM: + case _C_SHT: + case _C_USHT: + case _C_INT: + case _C_UINT: + case _C_LNG: + case _C_ULNG: + case _C_FLT: + case _C_DBL: + case _C_VOID: + return ++type; + break; + + case _C_ARY_B: + /* skip digits, typespec and closing ']' */ + + while(isdigit(*++type)); + type = objc_skip_typespec(type); + if (*type == _C_ARY_E) + return ++type; + else + abort(); + + case _C_STRUCT_B: + /* skip name, and elements until closing '}' */ + + while (*type != _C_STRUCT_E && *type++ != '='); + while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); } + return ++type; + + case _C_UNION_B: + /* skip name, and elements until closing ')' */ + + while (*type != _C_UNION_E && *type++ != '='); + while (*type != _C_UNION_E) { type = objc_skip_typespec (type); } + return ++type; + + case _C_PTR: + /* Just skip the following typespec */ + + return objc_skip_typespec (++type); + + default: + abort(); + } +} + +/* + Skip an offset as part of a method encoding. This is prepended by a + '+' if the argument is passed in registers. +*/ +inline const char* +objc_skip_offset (const char* type) +{ + if (*type == '+') type++; + while(isdigit(*++type)); + return type; +} + +/* + Skip an argument specification of a method encoding. +*/ +const char* +objc_skip_argspec (const char* type) +{ + type = objc_skip_typespec (type); + type = objc_skip_offset (type); + return type; +} + +unsigned +objc_get_type_qualifiers (const char* type) +{ + unsigned res = 0; + BOOL flag = YES; + + while (flag) + switch (*type++) + { + case _C_CONST: res |= _F_CONST; break; + case _C_IN: res |= _F_IN; break; + case _C_INOUT: res |= _F_INOUT; break; + case _C_OUT: res |= _F_OUT; break; + case _C_BYCOPY: res |= _F_BYCOPY; break; + case _C_ONEWAY: res |= _F_ONEWAY; break; + default: flag = NO; + } + + return res; +} + +#endif /* NeXT_runtime */ diff --git a/Source/gnu4nextrt.m b/Source/gnu4nextrt.m new file mode 100644 index 000000000..dfd88a537 --- /dev/null +++ b/Source/gnu4nextrt.m @@ -0,0 +1,469 @@ +/* Some functionality in the GNU runtime that's not in the NeXT runtime + Copyright (C) 1993,1994 Free Software Foundation, Inc. + + Author: Kresten Krab Thorup + Modified by: Andrew McCallum + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#if ! NeXT_runtime +#error This file only needed if using NeXT runtime +#endif /* ! NeXT_runtime */ + +#include "objects/gnu4next.h" +#include +#include + +/* Deal with strrchr: */ +#if STDC_HEADERS || HAVE_STRING_H +#include +/* An ANSI string.h and pre-ANSI memory.h might conflict. */ +#if !STDC_HEADERS && HAVE_MEMORY_H +#include +#endif /* not STDC_HEADERS and HAVE_MEMORY_H */ +#define index strchr +#define rindex strrchr +#define bcopy(s, d, n) memcpy ((d), (s), (n)) +#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) +#define bzero(s, n) memset ((s), 0, (n)) +#else /* not STDC_HEADERS and not HAVE_STRING_H */ +#include +/* memory.h and strings.h conflict on some systems. */ +#endif /* not STDC_HEADERS and not HAVE_STRING_H */ + +#define MAX(X, Y) \ + ({ typeof(X) __x = (X), __y = (Y); \ + (__x > __y ? __x : __y); }) + +#define MIN(X, Y) \ + ({ typeof(X) __x = (X), __y = (Y); \ + (__x < __y ? __x : __y); }) + +#define ROUND(V, A) \ + ({ typeof(V) __v=(V); typeof(A) __a=(A); \ + __a*((__v+__a-1)/__a); }) + + +static inline int +atoi (const char* str) +{ + int res = 0; + + while (isdigit (*str)) + res *= 10, res += (*str++ - '0'); + + return res; +} + +/* + return the size of an object specified by type +*/ + +int +objc_sizeof_type(const char* type) +{ + switch(*type) { + case _C_ID: + return sizeof(id); + break; + + case _C_CLASS: + return sizeof(Class); + break; + + case _C_SEL: + return sizeof(SEL); + break; + + case _C_CHR: + return sizeof(char); + break; + + case _C_UCHR: + return sizeof(unsigned char); + break; + + case _C_SHT: + return sizeof(short); + break; + + case _C_USHT: + return sizeof(unsigned short); + break; + + case _C_INT: + return sizeof(int); + break; + + case _C_UINT: + return sizeof(unsigned int); + break; + + case _C_LNG: + return sizeof(long); + break; + + case _C_ULNG: + return sizeof(unsigned long); + break; + + case _C_FLT: + return sizeof(float); + break; + + case _C_DBL: + return sizeof(double); + break; + + case _C_PTR: + case _C_ATOM: + case _C_CHARPTR: + return sizeof(char*); + break; + + case _C_ARY_B: + { + int len = atoi(type+1); + while (isdigit(*++type)); + return len*objc_aligned_size (type); + } + break; + + case _C_STRUCT_B: + { + int acc_size = 0; + int align; + while (*type != _C_STRUCT_E && *type++ != '='); /* skip "=" */ + while (*type != _C_STRUCT_E) + { + align = objc_alignof_type (type); /* padd to alignment */ + acc_size = ROUND (acc_size, align); + acc_size += objc_sizeof_type (type); /* add component size */ + type = objc_skip_typespec (type); /* skip component */ + } + return acc_size; + } + + case _C_UNION_B: + { + int max_size = 0; + while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; + while (*type != _C_UNION_E) + { + max_size = MAX (max_size, objc_sizeof_type (type)); + type = objc_skip_typespec (type); + } + return max_size; + } + + default: + abort(); + } +} + + +/* + Return the alignment of an object specified by type +*/ + +int +objc_alignof_type(const char* type) +{ + switch(*type) { + case _C_ID: + return __alignof__(id); + break; + + case _C_CLASS: + return __alignof__(Class); + break; + + case _C_SEL: + return __alignof__(SEL); + break; + + case _C_CHR: + return __alignof__(char); + break; + + case _C_UCHR: + return __alignof__(unsigned char); + break; + + case _C_SHT: + return __alignof__(short); + break; + + case _C_USHT: + return __alignof__(unsigned short); + break; + + case _C_INT: + return __alignof__(int); + break; + + case _C_UINT: + return __alignof__(unsigned int); + break; + + case _C_LNG: + return __alignof__(long); + break; + + case _C_ULNG: + return __alignof__(unsigned long); + break; + + case _C_FLT: + return __alignof__(float); + break; + + case _C_DBL: + return __alignof__(double); + break; + + case _C_ATOM: + case _C_CHARPTR: + return __alignof__(char*); + break; + + case _C_ARY_B: + while (isdigit(*++type)) /* do nothing */; + return objc_alignof_type (type); + + case _C_STRUCT_B: + { + struct { int x; double y; } fooalign; + while(*type != _C_STRUCT_E && *type++ != '=') /* do nothing */; + if (*type != _C_STRUCT_E) + return MAX (objc_alignof_type (type), __alignof__ (fooalign)); + else + return __alignof__ (fooalign); + } + + case _C_UNION_B: + { + int maxalign = 0; + while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; + while (*type != _C_UNION_E) + { + maxalign = MAX (maxalign, objc_alignof_type (type)); + type = objc_skip_typespec (type); + } + return maxalign; + } + + default: + abort(); + } +} + +/* + The aligned size if the size rounded up to the nearest alignment. +*/ + +int +objc_aligned_size (const char* type) +{ + int size = objc_sizeof_type (type); + int align = objc_alignof_type (type); + return ROUND (size, align); +} + +/* + The size rounded up to the nearest integral of the wordsize, taken + to be the size of a void*. +*/ + +int +objc_promoted_size (const char* type) +{ + int size = objc_sizeof_type (type); + int wordsize = sizeof (void*); + + return ROUND (size, wordsize); +} + +/* + Skip type qualifiers. These may eventually precede typespecs + occuring in method prototype encodings. +*/ + +inline const char* +objc_skip_type_qualifiers (const char* type) +{ + while (*type == _C_CONST + || *type == _C_IN + || *type == _C_INOUT + || *type == _C_OUT + || *type == _C_BYCOPY + || *type == _C_ONEWAY) + { + type += 1; + } + return type; +} + + +/* + Skip one typespec element. If the typespec is prepended by type + qualifiers, these are skipped as well. +*/ + +const char* +objc_skip_typespec (const char* type) +{ + type = objc_skip_type_qualifiers (type); + + switch (*type) { + + case _C_ID: + /* An id may be annotated by the actual type if it is known + with the @"ClassName" syntax */ + + if (*++type != '"') + return type; + else + { + while (*++type != '"') /* do nothing */; + return type + 1; + } + + /* The following are one character type codes */ + case _C_CLASS: + case _C_SEL: + case _C_CHR: + case _C_UCHR: + case _C_CHARPTR: + case _C_ATOM: + case _C_SHT: + case _C_USHT: + case _C_INT: + case _C_UINT: + case _C_LNG: + case _C_ULNG: + case _C_FLT: + case _C_DBL: + case _C_VOID: + return ++type; + break; + + case _C_ARY_B: + /* skip digits, typespec and closing ']' */ + + while(isdigit(*++type)); + type = objc_skip_typespec(type); + if (*type == _C_ARY_E) + return ++type; + else + abort(); + + case _C_STRUCT_B: + /* skip name, and elements until closing '}' */ + + while (*type != _C_STRUCT_E && *type++ != '='); + while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); } + return ++type; + + case _C_UNION_B: + /* skip name, and elements until closing ')' */ + + while (*type != _C_UNION_E && *type++ != '='); + while (*type != _C_UNION_E) { type = objc_skip_typespec (type); } + return ++type; + + case _C_PTR: + /* Just skip the following typespec */ + + return objc_skip_typespec (++type); + + default: + abort(); + } +} + +/* + Skip an offset as part of a method encoding. This is prepended by a + '+' if the argument is passed in registers. +*/ +inline const char* +objc_skip_offset (const char* type) +{ + if (*type == '+') type++; + while(isdigit(*++type)); + return type; +} + +/* + Skip an argument specification of a method encoding. +*/ +const char* +objc_skip_argspec (const char* type) +{ + type = objc_skip_typespec (type); + type = objc_skip_offset (type); + return type; +} + +unsigned +objc_get_type_qualifiers (const char* type) +{ + unsigned res = 0; + BOOL flag = YES; + + while (flag) + switch (*type++) + { + case _C_CONST: res |= _F_CONST; break; + case _C_IN: res |= _F_IN; break; + case _C_INOUT: res |= _F_INOUT; break; + case _C_OUT: res |= _F_OUT; break; + case _C_BYCOPY: res |= _F_BYCOPY; break; + case _C_ONEWAY: res |= _F_ONEWAY; break; + default: flag = NO; + } + + return res; +} + +/* Returns YES iff t1 and t2 have same method types, but we ignore + the argframe layout */ +BOOL +sel_types_match (const char* t1, const char* t2) +{ + if (!t1 || !t2) + return NO; + while (*t1 && *t2) + { + if (*t1 == '+') t1++; + if (*t2 == '+') t2++; + while (isdigit(*t1)) t1++; + while (isdigit(*t2)) t2++; + /* xxx Remove these next two lines when qualifiers are put in + all selectors, not just Protocol selectors. */ + t1 = objc_skip_type_qualifiers(t1); + t2 = objc_skip_type_qualifiers(t2); + if (!*t1 && !*t2) + return YES; + if (*t1 != *t2) + return NO; + t1++; + t2++; + } + return NO; +} diff --git a/Source/o_vprintf.c b/Source/o_vprintf.c new file mode 100644 index 000000000..fffba0b00 --- /dev/null +++ b/Source/o_vprintf.c @@ -0,0 +1,585 @@ +/* Implementation of objects_vprintf for GNU Objective C Class Library + + Reworked by: R. Andrew McCallum + Date: July 1994 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* Reworked from glibc by Andrew McCallum: + Use function pointer argument to put next character. + + This is a solution for MemoryStream. It's not ideal. + It is a temporary fix. + On GNU systems we could just use GNU stdio stream functions, but + on non-GNU systems, using this is easier than installing glibc. */ + +/* #include */ +/* #include */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* #include */ +#include +#include "_itoa.h" + + +/* If it's an unbuffered stream that we provided + temporary buffering for, remove that buffering. */ +#define RETURN(x) \ + do \ + { \ + done = (x); \ + goto do_return; \ + } while (0) + +#define outchar(x) \ + do \ + { \ + char outc = (x); \ + if ((*write_func)(stream, &outc, 1) == EOF) \ + RETURN(-1); \ + else \ + ++done; \ + } while (0) + +/* Cast the next arg, of type ARGTYPE, into CASTTYPE, and put it in VAR. */ +#define castarg(var, argtype, casttype) \ + var = (casttype) va_arg(args, argtype) +/* Get the next arg, of type TYPE, and put it in VAR. */ +#define nextarg(var, type) castarg(var, type, type) + +#ifdef __GNUC__ +#define HAVE_LONGLONG +#define LONGLONG long long +#else +#define LONGLONG long +#endif + + +int +objects_vprintf(void *stream, + int (*write_func)(void*, char*, int len), + const char *format, va_list args) +{ + /* Pointer into the format string. */ + register const char *f; + + /* Number of characters written. */ + register size_t done = 0; + + /* Reset multibyte characters to their initial state. */ + (void) mblen((char *) NULL, 0); + + f = format; + while (*f != '\0') + { + /* Type modifiers. */ + char is_short, is_long, is_long_double; +#ifdef HAVE_LONGLONG + /* We use the `L' modifier for `long long int'. */ +#define is_longlong is_long_double +#else +#define is_longlong 0 +#endif + /* Format spec modifiers. */ + char space, showsign, left, alt; + + /* Padding character: ' ' or '0'. */ + char pad; + /* Width of a field. */ + register int width; + /* Precision of a field. */ + int prec; + + /* Decimal integer is negative. */ + char is_neg; + + /* Current character of the format. */ + char fc; + + /* Base of a number to be written. */ + int base; + /* Integral values to be written. */ + unsigned LONGLONG int num; + LONGLONG int signed_num; + + /* String to be written. */ + const char *str; + char unknown_error[256]; /* Buffer sometimes used by %m. */ + + if (!isascii(*f)) + { + /* Non-ASCII, may be a multibyte. */ + int len = mblen(f, strlen(f)); + if (len > 0) + { + while (len-- > 0) + outchar(*f++); + continue; + } + } + + if (*f != '%') + { + /* This isn't a format spec, so write + everything out until the next one. */ + const char *next = strchr(f + 1, '%'); + if (next == NULL) + next = strchr(f + 1, '\0'); + if (next - f > 20) + { + size_t written = (*write_func)(stream, (void*)f, next - f); + done += written; + if (written != next - f) + break; + f += written; + } + else + while (f < next) + outchar(*f++); + continue; + } + + ++f; + + /* Check for "%%". Note that although the ANSI standard lists + '%' as a conversion specifier, it says "The complete format + specification shall be `%%'," so we can avoid all the width + and precision processing. */ + if (*f == '%') + { + ++f; + outchar('%'); + continue; + } + + /* Check for spec modifiers. */ + space = showsign = left = alt = 0; + pad = ' '; + while (*f == ' ' || *f == '+' || *f == '-' || *f == '#' || *f == '0') + switch (*f++) + { + case ' ': + /* Output a space in place of a sign, when there is no sign. */ + space = 1; + break; + case '+': + /* Always output + or - for numbers. */ + showsign = 1; + break; + case '-': + /* Left-justify things. */ + left = 1; + break; + case '#': + /* Use the "alternate form": + Hex has 0x or 0X, FP always has a decimal point. */ + alt = 1; + break; + case '0': + /* Pad with 0s. */ + pad = '0'; + break; + } + if (left) + pad = ' '; + + /* Get the field width. */ + width = 0; + if (*f == '*') + { + /* The field width is given in an argument. + A negative field width indicates left justification. */ + nextarg(width, int); + if (width < 0) + { + width = - width; + left = 1; + } + ++f; + } + else + while (isdigit(*f)) + { + width *= 10; + width += *f++ - '0'; + } + + /* Get the precision. */ + /* -1 means none given; 0 means explicit 0. */ + prec = -1; + if (*f == '.') + { + ++f; + if (*f == '*') + { + /* The precision is given in an argument. */ + nextarg(prec, int); + /* Avoid idiocy. */ + if (prec < 0) + prec = -1; + ++f; + } + else if (isdigit(*f)) + { + prec = 0; + while (*f != '\0' && isdigit(*f)) + { + prec *= 10; + prec += *f++ - '0'; + } + } + } + + /* Check for type modifiers. */ + is_short = is_long = is_long_double = 0; + while (*f == 'h' || *f == 'l' || *f == 'L') + switch (*f++) + { + case 'h': + /* int's are short int's. */ + is_short = 1; + break; + case 'l': +#ifdef HAVE_LONGLONG + if (is_long) + /* A double `l' is equivalent to an `L'. */ + is_longlong = 1; + else +#endif + /* int's are long int's. */ + is_long = 1; + break; + case 'L': + /* double's are long double's, and int's are long long int's. */ + is_long_double = 1; + break; + + case 'Z': + /* int's are size_t's. */ +#ifdef HAVE_LONGLONG + assert (sizeof(size_t) <= sizeof(unsigned long long int)); + is_longlong = sizeof(size_t) > sizeof(unsigned long int); +#endif + is_long = sizeof(size_t) > sizeof(unsigned int); + break; + } + + /* Format specification. */ + fc = *f++; + if (1) + switch (fc) + { + case 'i': + case 'd': + /* Decimal integer. */ + base = 10; + if (is_longlong) + nextarg(signed_num, LONGLONG int); + else if (is_long) + nextarg(signed_num, long int); + else if (!is_short) + castarg(signed_num, int, long int); + else + castarg(signed_num, int, short int); + + is_neg = signed_num < 0; + num = is_neg ? (- signed_num) : signed_num; + goto number; + + case 'u': + /* Decimal unsigned integer. */ + base = 10; + goto unsigned_number; + + case 'o': + /* Octal unsigned integer. */ + base = 8; + goto unsigned_number; + + case 'X': + /* Hexadecimal unsigned integer. */ + case 'x': + /* Hex with lower-case digits. */ + + base = 16; + + unsigned_number: + /* Unsigned number of base BASE. */ + + if (is_longlong) + castarg(num, LONGLONG int, unsigned LONGLONG int); + else if (is_long) + castarg(num, long int, unsigned long int); + else if (!is_short) + castarg(num, int, unsigned int); + else + castarg(num, int, unsigned short int); + + /* ANSI only specifies the `+' and + ` ' flags for signed conversions. */ + is_neg = showsign = space = 0; + + number: + /* Number of base BASE. */ + { + char work[BUFSIZ]; + char *const workend = &work[sizeof(work) - 1]; + register char *w; + + /* Supply a default precision if none was given. */ + if (prec == -1) + prec = 1; + + /* Put the number in WORK. */ + w = _itoa (num, workend + 1, base, fc == 'X') - 1; + width -= workend - w; + prec -= workend - w; + + if (alt && base == 8 && prec <= 0) + { + *w-- = '0'; + --width; + } + + if (prec > 0) + { + width -= prec; + while (prec-- > 0) + *w-- = '0'; + } + + if (alt && base == 16) + width -= 2; + + if (is_neg || showsign || space) + --width; + + if (!left && pad == ' ') + while (width-- > 0) + outchar(' '); + + if (is_neg) + outchar('-'); + else if (showsign) + outchar('+'); + else if (space) + outchar(' '); + + if (alt && base == 16) + { + outchar ('0'); + outchar (fc); + } + + if (!left && pad == '0') + while (width-- > 0) + outchar('0'); + + /* Write the number. */ + while (++w <= workend) + outchar(*w); + + if (left) + while (width-- > 0) + outchar(' '); + } + break; + + case 'e': + case 'E': + case 'f': + case 'g': + case 'G': + { + /* Floating-point number. */ + extern printf_function __printf_fp; + function = __printf_fp; + goto use_function; + } + + case 'c': + /* Character. */ + nextarg(num, int); + if (!left) + while (--width > 0) + outchar(' '); + outchar((unsigned char) num); + if (left) + while (--width > 0) + outchar(' '); + break; + + case 's': + { + static CONST char null[] = "(null)"; + size_t len; + + nextarg(str, CONST char *); + + string: + + if (str == NULL) + /* Write "(null)" if there's space. */ + if (prec == -1 || prec >= (int) sizeof(null) - 1) + { + str = null; + len = sizeof(null) - 1; + } + else + { + str = ""; + len = 0; + } + else + len = strlen(str); + + if (prec != -1 && (size_t) prec < len) + len = prec; + width -= len; + + if (!left) + while (width-- > 0) + outchar(' '); + if (len < 20) + while (len-- > 0) + outchar(*str++); + else + if ((*write_func)(stream, str, len) != len) + RETURN(-1); + else + done += len; + if (left) + while (width-- > 0) + outchar(' '); + } + break; + + case 'p': + /* Generic pointer. */ + { + CONST PTR ptr; + nextarg(ptr, const void*); + if (ptr != NULL) + { + /* If the pointer is not NULL, write it as a %#x spec. */ + base = 16; + fc = 'x'; + alt = 1; + num = (unsigned LONGLONG int) (unsigned long int) ptr; + is_neg = 0; + goto number; + } + else + { + /* Write "(nil)" for a nil pointer. */ + static const char nil[] = "(nil)"; + register const char *p; + + width -= sizeof (nil) - 1; + if (!left) + while (width-- > 0) + outchar (' '); + for (p = nil; *p != '\0'; ++p) + outchar (*p); + if (left) + while (width-- > 0) + outchar (' '); + } + } + break; + + case 'n': + /* Answer the count of characters written. */ + if (is_longlong) + { + LONGLONG int *p; + nextarg(p, LONGLONG int *); + *p = done; + } + else if (is_long) + { + long int *p; + nextarg(p, long int *); + *p = done; + } + else if (!is_short) + { + int *p; + nextarg(p, int *); + *p = done; + } + else + { + short int *p; + nextarg(p, short int *); + *p = done; + } + break; + + case 'm': +#ifndef HAVE_GNU_LD +#define _sys_errlist sys_errlist +#define _sys_nerr sys_nerr +#endif + + if (errno < 0 || errno > _sys_nerr) + { + sprintf (unknown_error, "Unknown error %d", errno); + str = unknown_error; + } + else + str = _sys_errlist[errno]; + goto string; + + default: + /* Unrecognized format specifier. */ + sprintf (unknown_error, "Unknown format specifier %c", fc); + str = unknown_error; + goto string; + } + } + + do_return:; + return done; +} + diff --git a/Source/objects/.cvsignore b/Source/objects/.cvsignore new file mode 100644 index 000000000..9c705bd2e --- /dev/null +++ b/Source/objects/.cvsignore @@ -0,0 +1 @@ +stdobjects.h diff --git a/Source/objects/AutoreleasePool.h b/Source/objects/AutoreleasePool.h new file mode 100644 index 000000000..b1d78d0b5 --- /dev/null +++ b/Source/objects/AutoreleasePool.h @@ -0,0 +1,53 @@ +/* Interface for relase pools for delayed disposal + Copyright (C) 1994 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Date: May 1993 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __AutoreleasePool_m_OBJECTS_INCLUDE +#define __AutoreleasePool_m_OBJECTS_INCLUDE + +#include +#include + +@interface AutoreleasePool : Object +{ + AutoreleasePool *parent; + unsigned released_count; + unsigned released_size; + id *released; +} + ++ currentPool; ++ (void) autoreleaseObject: anObj; +- (void) autoreleaseObject: anObj; + +- init; + +@end + +@interface Object (Retaining) +@end + +void objc_retain_object (id anObj); +void objc_release_object (id anObj); +unsigned objc_retain_count (id anObj); + +#endif /* __AutoreleasePool_m_OBJECTS_INCLUDE */ diff --git a/Source/objects/AutoreleaseStack.h b/Source/objects/AutoreleaseStack.h new file mode 100644 index 000000000..db5aae229 --- /dev/null +++ b/Source/objects/AutoreleaseStack.h @@ -0,0 +1,122 @@ +/* Interface to release stack for delayed disposal + Copyright (C) 1994 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Date: May 1993 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __AutoreleaseStack_m_OBJECTS_INCLUDE +#define __AutoreleaseStack_m_OBJECTS_INCLUDE + +#include +#include + +@interface AutoreleaseStack : Object +{ +} + ++ (void) autoreleaseObject: anObj; +- (void) autoreleaseObject: anObj; + +- init; + +@end + +void objc_release_stack_objects(); + +/* + Use of this autorelease class gives -autorelease the following semantics: + + - autorelease; + + Use this message when the sender is done with this object, but the + sender doesn't want the object to be deallocated immediately + because the function that sends this message will use this object + as its return value. The object will be queued to receive the + actual "release" message only after the caller's caller returns. + (Well, not "queued", "stacked" actually.) + + Due to this delayed release, the function that receives the object + as a return value will have the opportunity to retain the object + before the "release" instigated by the "autorelease" actually + takes place. + + IMPORTANT PROGRAMMING CONVENTION: Since a autoreleased object may + be freed in the caller's caller's frame, a function must be careful + when returning an object that has been been autoreleased to it + (i.e. returning the object to the autorelease caller's caller's + caller). Since you cannot always know which objects returned to + the current function have been autoreleased by their returners, + you must use the following rule to insure safety for these + situations: + + When returning an object that has been allocated, copied or + retained by the returner, return the object as usual. If + returning an object that has been received in this function by + another function, always retain and autorelease the object + before returning it. (Unless, of course, the returner still + needs to keep a reference to the object, in which case the final + autorelease should be omitted.) + + The autorelease mechanism works as follows: The implementation of + the "autorelease" method pushes the receiver and the caller's + caller's frame address onto an internally maintained stack. But, + before pushing the reciever, the implementation checks the entries + already on the stack, popping elements off the stack until the + recorded frame address is less than the caller's caller's frame + address. Each object popped off the stack is sent a "release" + message. The stack capacity grows automatically if necessary. + + This mechanism ensures that not too many autoreleased objects can + be stacked before we check to see what objects can be released + (i.e. no objects). It also ensures that objects which have been + autoreleased are released as soon as we autorelease any other + object in a lower stack frame. + + The only way to build up an unnecessarily large collection of + autoreleased objects is by calling functions that autorelease an + object, and by repeatedly calling those functions from functions + with equal or increasingly higher frame addresses. + + Any time that you suspect that you may be creating an unnecessarily + large number of autoreleased objects in a function, (e.g. the + function contains a loop that creates many autoreleased objects + that the function doesn't need), you can always release all the + releasable autoreleased objects for this frame by calling + objc_release_stack_objects(). Be warned that calling this function + will release all objects that have been autoreleased to this + function; if you still need to use some of them, you will have to + retain them beforehand, and release or autorelease them + afterwards. + + If desired, you can also use objc_release_stack_objects() at the + top of an event loop, a guaranteed "catch-all" coding practise + similar to the creation and destruction of AutoreleasePool objects + in the event loop. + + As an alternative to calling objc_release_stack_objects() you can + also use the same scheme for forcing autorelease's as used for + AutoreleasePool's: s = [[AutoreleaseStack alloc] init], ... code + that autoreleases a bunch of objects to the same stack level ..., + [s release]. It has the same effect. + +*/ + + +#endif /* __AutoreleaseStack_m_OBJECTS_INCLUDE */ diff --git a/Source/objects/SmallInt.h b/Source/objects/SmallInt.h new file mode 100644 index 000000000..d092af468 --- /dev/null +++ b/Source/objects/SmallInt.h @@ -0,0 +1,39 @@ +/* Interface for Objective-C efficient small integers + Copyright (C) 1993,1994 Free Software Foundation, Inc. + + Written by: R. Andrew McCallum + Created: Sep 1995 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __SmallInt_h_INCLUDE_GNU +#define __SmallInt_h_INCLUDE_GNU + +#include + +#define IS_SMALLINT(OBJ) (((void*)OBJ) & 0x1) +#define ID2INT(OBJ) ((IS_SMALLINT(OBJ)) ? (((int)OBJ) >> 1):[OBJ intValue]) +#define INT2ID(I) ((id)((I << 1) & 0x1)) + +@interface SmallInt : NSObject + +- + +@end + +#endif /* __SmallInt_h_INCLUDE_GNU */ diff --git a/Source/vfscanf.c b/Source/vfscanf.c new file mode 100644 index 000000000..f47389e4f --- /dev/null +++ b/Source/vfscanf.c @@ -0,0 +1,599 @@ +/* Implementation of vfscanf for GNU Objective C Class Library + + Reworked by: R. Andrew McCallum + Date: May 1993 + + This file is part of the GNU Objective C Class Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* Reworked from glibc by Andrew McCallum: + Fixed bug by adding "*f == 'a'" to type modifier checking. + Declared extern strtod. */ + +/* #include */ +#include +#include +#include +#include +#include +#include +#include + +extern double strtod(const char *str, char **ptr); + +#ifdef __GNUC__ +#define HAVE_LONGLONG +#define LONGLONG long long +#define CONST const +#define LONG_DOUBLE long double +#else +#define LONGLONG long +#define CONST +#endif + + +#define inchar() ((c = getc(s)) == EOF ? EOF : (++read_in, c)) +#define conv_error() return ((c == EOF || ungetc(c, s)), done) +#define input_error() return (done == 0 ? EOF : done) +#define memory_error() return ((errno = ENOMEM), EOF) + + +/* Read formatted input from S according to the format string + FORMAT, using the argument list in ARG. + Return the number of assignments made, or -1 for an input error. */ +int +objects_vfscanf (FILE *s, const char *format, va_list argptr) +{ + va_list arg = (va_list) argptr; + + register CONST char *f = format; + register char fc; /* Current character of the format. */ + register size_t done = 0; /* Assignments done. */ + register size_t read_in = 0; /* Chars read in. */ + register int c; /* Last char read. */ + register int do_assign; /* Whether to do an assignment. */ + register int width; /* Maximum field width. */ + + /* Type modifiers. */ + char is_short, is_long, is_long_double; +#ifdef HAVE_LONGLONG + /* We use the `L' modifier for `long long int'. */ +#define is_longlong is_long_double +#else +#define is_longlong 0 +#endif + int malloc_string; /* Args are char ** to be filled in. */ + /* Status for reading F-P nums. */ + char got_dot, got_e; + /* If a [...] is a [^...]. */ + char not_in; + /* Base for integral numbers. */ + int base; + /* Signedness for integral numbers. */ + int number_signed; + /* Integral holding variables. */ + long int num; + unsigned long int unum; + /* Floating-point holding variable. */ + LONG_DOUBLE fp_num; + /* Character-buffer pointer. */ + register char *str, **strptr; + size_t strsize; + /* Workspace. */ + char work[200]; + char *w; /* Pointer into WORK. */ + wchar_t decimal; /* Decimal point character. */ + +#if 0 + if (!__validfp(s) || !s->__mode.__read || format == NULL) + { + errno = EINVAL; + return EOF; + } +#endif + + /* Figure out the decimal point character. */ +#if 0 + if (mbtowc(&decimal, _numeric_info->decimal_point, + strlen(_numeric_info->decimal_point)) <= 0) + decimal = (wchar_t) *_numeric_info->decimal_point; +#else + decimal = '.'; +#endif + + c = inchar(); + + /* Run through the format string. */ + while (*f != '\0') + { + if (!isascii(*f)) + { + /* Non-ASCII, may be a multibyte. */ + int len = mblen(f, strlen(f)); + if (len > 0) + { + while (len-- > 0) + if (c == EOF) + input_error(); + else if (c == *f++) + (void) inchar(); + else + conv_error(); + continue; + } + } + + fc = *f++; + if (fc != '%') + { + /* Characters other than format specs must just match. */ + if (c == EOF) + input_error(); + if (isspace(fc)) + { + /* Whitespace characters match any amount of whitespace. */ + while (isspace (c)) + inchar (); + continue; + } + else if (c == fc) + (void) inchar(); + else + conv_error(); + continue; + } + + /* Check for the assignment-suppressant. */ + if (*f == '*') + { + do_assign = 0; + ++f; + } + else + do_assign = 1; + + /* Find the maximum field width. */ + width = 0; + while (isdigit(*f)) + { + width *= 10; + width += *f++ - '0'; + } + if (width == 0) + width = -1; + + /* Check for type modifiers. */ + is_short = is_long = is_long_double = malloc_string = 0; + while (*f == 'h' || *f == 'l' || *f == 'L' || *f == 'a') + switch (*f++) + { + case 'h': + /* int's are short int's. */ + is_short = 1; + break; + case 'l': + if (is_long) + /* A double `l' is equivalent to an `L'. */ + is_longlong = 1; + else + /* int's are long int's. */ + is_long = 1; + break; + case 'L': + /* double's are long double's, and int's are long long int's. */ + is_long_double = 1; + break; + case 'a': + /* String conversions (%s, %[) take a `char **' + arg and fill it in with a malloc'd pointer. */ + malloc_string = 1; + break; + } + + /* End of the format string? */ + if (*f == '\0') + conv_error(); + + /* Find the conversion specifier. */ + w = work; + fc = *f++; + if (fc != '[' && fc != 'c' && fc != 'n') + /* Eat whitespace. */ + while (isspace(c)) + (void) inchar(); + switch (fc) + { + case '%': /* Must match a literal '%'. */ + if (c != fc) + conv_error(); + break; + + case 'n': /* Answer number of assignments done. */ + if (do_assign) + *va_arg(arg, int *) = read_in; + break; + + case 'c': /* Match characters. */ + if (do_assign) + { + str = va_arg (arg, char *); + if (str == NULL) + conv_error (); + } + + if (c == EOF) + input_error(); + + if (width == -1) + width = 1; + + if (do_assign) + { + do + *str++ = c; + while (inchar() != EOF && --width > 0); + } + else + while (inchar() != EOF && width > 0) + --width; + + if (do_assign) + ++done; + + break; + + case 's': /* Read a string. */ +#define STRING_ARG \ + if (do_assign) \ + { \ + if (malloc_string) \ + { \ + /* The string is to be stored in a malloc'd buffer. */ \ + strptr = va_arg (arg, char **); \ + if (strptr == NULL) \ + conv_error (); \ + /* Allocate an initial buffer. */ \ + strsize = 100; \ + *strptr = str = malloc (strsize); \ + } \ + else \ + str = va_arg (arg, char *); \ + if (str == NULL) \ + conv_error (); \ + } + STRING_ARG; + + if (c == EOF) + input_error (); + + do + { + if (isspace (c)) + break; +#define STRING_ADD_CHAR(c) \ + if (do_assign) \ + { \ + *str++ = c; \ + if (malloc_string && str == *strptr + strsize) \ + { \ + /* Enlarge the buffer. */ \ + str = realloc (*strptr, strsize * 2); \ + if (str == NULL) \ + { \ + /* Can't allocate that much. Last-ditch effort. */\ + str = realloc (*strptr, strsize + 1); \ + if (str == NULL) \ + { \ + /* We lose. Oh well. \ + Terminate the string and stop converting, \ + so at least we don't swallow any input. */ \ + (*strptr)[strsize] = '\0'; \ + ++done; \ + conv_error (); \ + } \ + else \ + { \ + *strptr = str; \ + str += strsize; \ + ++strsize; \ + } \ + } \ + else \ + { \ + *strptr = str; \ + str += strsize; \ + strsize *= 2; \ + } \ + } \ + } + STRING_ADD_CHAR (c); + } while (inchar () != EOF && (width <= 0 || --width > 0)); + + if (do_assign) + { + *str = '\0'; + ++done; + } + break; + + case 'x': /* Hexadecimal integer. */ + case 'X': /* Ditto. */ + base = 16; + number_signed = 0; + goto number; + + case 'o': /* Octal integer. */ + base = 8; + number_signed = 0; + goto number; + + case 'u': /* Unsigned decimal integer. */ + base = 10; + number_signed = 0; + goto number; + + case 'd': /* Signed decimal integer. */ + base = 10; + number_signed = 1; + goto number; + + case 'i': /* Generic number. */ + base = 0; + number_signed = 1; + + number: + if (c == EOF) + input_error(); + + /* Check for a sign. */ + if (c == '-' || c == '+') + { + *w++ = c; + if (width > 0) + --width; + (void) inchar(); + } + + /* Look for a leading indication of base. */ + if (c == '0') + { + if (width > 0) + --width; + *w++ = '0'; + + (void) inchar(); + + if (tolower(c) == 'x') + { + if (base == 0) + base = 16; + if (base == 16) + { + if (width > 0) + --width; + (void) inchar(); + } + } + else if (base == 0) + base = 8; + } + + if (base == 0) + base = 10; + + /* Read the number into WORK. */ + do + { + if (base == 16 ? !isxdigit(c) : + (!isdigit(c) || c - '0' >= base)) + break; + *w++ = c; + if (width > 0) + --width; + } while (inchar() != EOF && width != 0); + + if (w == work || + (w - work == 1 && (work[0] == '+' || work[0] == '-'))) + /* There was on number. */ + conv_error(); + + /* Convert the number. */ + *w = '\0'; + if (number_signed) + num = strtol (work, &w, base); + else +#if HAVE_STRTOUL + unum = strtoul (work, &w, base); +#else + unum = strtol (work, &w, base); +#endif + if (w == work) + conv_error (); + + if (do_assign) + { + if (! number_signed) + { + if (is_longlong) + *va_arg (arg, unsigned LONGLONG int *) = unum; + else if (is_long) + *va_arg (arg, unsigned long int *) = unum; + else if (is_short) + *va_arg (arg, unsigned short int *) + = (unsigned short int) unum; + else + *va_arg(arg, unsigned int *) = (unsigned int) unum; + } + else + { + if (is_longlong) + *va_arg(arg, LONGLONG int *) = num; + else if (is_long) + *va_arg(arg, long int *) = num; + else if (is_short) + *va_arg(arg, short int *) = (short int) num; + else + *va_arg(arg, int *) = (int) num; + } + ++done; + } + break; + + case 'e': /* Floating-point numbers. */ + case 'E': + case 'f': + case 'g': + case 'G': + if (c == EOF) + input_error(); + + /* Check for a sign. */ + if (c == '-' || c == '+') + { + *w++ = c; + if (inchar() == EOF) + /* EOF is only an input error before we read any chars. */ + conv_error(); + if (width > 0) + --width; + } + + got_dot = got_e = 0; + do + { + if (isdigit(c)) + *w++ = c; + else if (got_e && w[-1] == 'e' && (c == '-' || c == '+')) + *w++ = c; + else if (!got_e && tolower(c) == 'e') + { + *w++ = 'e'; + got_e = got_dot = 1; + } + else if (c == decimal && !got_dot) + { + *w++ = c; + got_dot = 1; + } + else + break; + if (width > 0) + --width; + } while (inchar() != EOF && width != 0); + + if (w == work) + conv_error(); + if (w[-1] == '-' || w[-1] == '+' || w[-1] == 'e') + conv_error(); + +#ifndef MIB_HACKS + /* Convert the number. */ + *w = '\0'; + fp_num = strtod(work, &w); + if (w == work) + conv_error(); + + if (do_assign) + { + if (is_long_double) + *va_arg(arg, LONG_DOUBLE *) = fp_num; + else if (is_long) + *va_arg(arg, double *) = (double) fp_num; + else + *va_arg(arg, float *) = (float) fp_num; + ++done; + } + break; +#endif /* MIB_HACKS */ + + case '[': /* Character class. */ + STRING_ARG; + + if (c == EOF) + input_error(); + + if (*f == '^') + { + ++f; + not_in = 1; + } + else + not_in = 0; + + while ((fc = *f++) != '\0' && fc != ']') + { + if (fc == '-' && *f != '\0' && *f != ']' && + w > work && w[-1] <= *f) + /* Add all characters from the one before the '-' + up to (but not including) the next format char. */ + for (fc = w[-1] + 1; fc < *f; ++fc) + *w++ = fc; + else + /* Add the character to the list. */ + *w++ = fc; + } + if (fc == '\0') + conv_error(); + + *w = '\0'; + unum = read_in; + do + { + if ((strchr (work, c) == NULL) != not_in) + break; + STRING_ADD_CHAR (c); + if (width > 0) + --width; + } while (inchar () != EOF && width != 0); + if (read_in == unum) + conv_error (); + + if (do_assign) + { + *str = '\0'; + ++done; + } + break; + + case 'p': /* Generic pointer. */ + base = 16; + /* A PTR must be the same size as a `long int'. */ + is_long = 1; + goto number; + } + } + + conv_error(); +}