Commit graph

867 commits

Author SHA1 Message Date
Andrew McCallum
18a8b28a16 (mframe_do_call): When getting the instance method, just use
object->class_pointer, not object_get_class(), because
object_get_class() of a class will return the argument, not the
metaclass---we want the metaclass.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1337 72102866-910b-0410-8b05-ffd578937521
1996-04-09 23:55:42 +00:00
Andrew McCallum
c2b688a5ea ([TcpInPort +newForReceivingFromPortNumber:]): Bind the socket with
INADDR_ANY, (not the host's address), so that others can connect using
any of the host's interfaces, including localhost.  Add the host's
address to _LISTENING_ADDRESS after the bind().


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1336 72102866-910b-0410-8b05-ffd578937521
1996-04-09 03:02:20 +00:00
Andrew McCallum
6d43bc6533 ([NSDictionary -allKeysForObject:]): Ask SELF for objectForKey:, not K.
(Reported by Robert Quillen <rquillen@csugrad.cs.vt.edu>).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1335 72102866-910b-0410-8b05-ffd578937521
1996-04-08 17:19:16 +00:00
Andrew McCallum
2f7ae60a2d (ABS): Remove macro.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1333 72102866-910b-0410-8b05-ffd578937521
1996-04-01 02:52:12 +00:00
Andrew McCallum
bdc87d4dba ([MappedCollector -nextObjectAndKey:withEnumState:]): Add comment.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1331 72102866-910b-0410-8b05-ffd578937521
1996-04-01 02:50:55 +00:00
Andrew McCallum
8de44d50d1 ([MappedCollector -newEnumState]): New method.
([MappedCollector -freeEnumState:]): New method.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1329 72102866-910b-0410-8b05-ffd578937521
1996-04-01 02:41:44 +00:00
Andrew McCallum
438776d6f3 (ABS): Remove macro; now defined in objects/stdobjects.h.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1328 72102866-910b-0410-8b05-ffd578937521
1996-03-31 23:15:12 +00:00
Andrew McCallum
2c66e11f59 Declare new function names.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1327 72102866-910b-0410-8b05-ffd578937521
1996-03-31 22:46:59 +00:00
Andrew McCallum
738fe577c4 Add #ifndef/#endif wrapper around header file.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1326 72102866-910b-0410-8b05-ffd578937521
1996-03-31 22:46:44 +00:00
Andrew McCallum
0f3872167e (behavior_class_add_class): Function renamed from class_add_behavior.
Add more explanation to NSCAssert().
(class_add_behavior): New function, calling above function.
(behavior_class_add_category): New function.
(behavior_class_add_methods): Function renamed from
class_add_methods_if_not_there.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1325 72102866-910b-0410-8b05-ffd578937521
1996-03-31 22:46:14 +00:00
Andrew McCallum
c8954cfab5 ([NSGArray +initialize]): Add the NSArrayNonCore behavior, so we can,
once and for all, avoid the need for those odd [super ...] calls, and
can remove many methods.
([NSGArray -initWithObjects:count:]): Method removed.
([NSGArray -indexOfObject:]): Method removed.
([NSGArray -objectAtIndex:]): Method removed.
([NSGMutableArray +initialize]): Add the NSMutableArrayNonCore
behavior, as above.
([NSGMutableArray -replaceObjectAtIndex:withObject:]): Method removed.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1324 72102866-910b-0410-8b05-ffd578937521
1996-03-31 22:34:27 +00:00
Andrew McCallum
379fe835f5 Divide methods between NSArray and NSArrayNonCore classes. Add
NSArrayNonCore behavior to NSArray.
Divide methods between NSMutableArray and NSMutableArrayNonCore
classes.  Add NSArrayNonCore behavior to NSArray.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1323 72102866-910b-0410-8b05-ffd578937521
1996-03-31 22:23:37 +00:00
Andrew McCallum
b8f0b79536 Include <objects/stdobjects.h>.
(class_add_behavior): Use NSCAssert() to make sure that we don't try
to increase the instance size of a class that has been subclassed;
(hopeless ivar layout confusion would result).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1319 72102866-910b-0410-8b05-ffd578937521
1996-03-31 21:54:02 +00:00
Andrew McCallum
e6fee2e397 (GNU_CFILES): Removed behavior.c.
(GNU_MFILES): Added behavior.m.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1318 72102866-910b-0410-8b05-ffd578937521
1996-03-31 21:43:41 +00:00
Andrew McCallum
227b53dda4 *** empty log message ***
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1317 72102866-910b-0410-8b05-ffd578937521
1996-03-31 21:41:02 +00:00
Andrew McCallum
82eb5732bd ([NSArray -lastObject]): Don't assert count; just return nil if it's
empty.
([NSMutableArray -removeLastObject]): Don't assert count; raise
NSRangeError if it's empty.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1314 72102866-910b-0410-8b05-ffd578937521
1996-03-30 23:00:27 +00:00
Andrew McCallum
54acc69932 Make NSAutoreleasePools co-exist with exceptions, safely and without
leaks.  Also improve efficiency by using a linked list of arrays
instead of realloc when more space is needed, and by using a cache of
pools that helps avoid the allocation/deallocation of pools.
(push_pool_to_cache): New function.
(pop_pool_from_cache): New function.
([NSAutoreleasePool +initialize]): New method.
([NSAutoreleasePool +allocWithZone:]): New method.
([NSAutoreleasePool -init]): Method overhauled to initialize new ivar
for handling exceptions, _child; also use pool cache.
(total_autoreleased_objects_count): New static variable.
(BEGINNING_POOL_SIZE): Macro renamed from DEFAULT_SIZE.
(autorelease_pool_cache, autorelease_pool_cache_size,
autorelease_pool_cache_count): New static variables.
([NSAutoreleasePool -_setChildPool:]): New method, handling stack and
dealing with exceptions.
([NSAutoreleasePool -addObject:]): Deal with linked list of arrays.
([NSAutoreleasePool -dealloc]): Deal with exceptions by releasing
child pools.  Place self into the pool cache instead of deallocating.
([NSAutoreleasePool +resetTotalAutoreleasedObjects]): New method.
([NSAutoreleasePool +totalAutoreleasedObjects]): New method.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1311 72102866-910b-0410-8b05-ffd578937521
1996-03-30 22:39:48 +00:00
Andrew McCallum
f03cc597e1 Fix typo.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1310 72102866-910b-0410-8b05-ffd578937521
1996-03-30 22:22:20 +00:00
Andrew McCallum
deb6958fe6 Change return types of "grow factor" methods from unsigned to int.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1309 72102866-910b-0410-8b05-ffd578937521
1996-03-30 22:21:48 +00:00
Andrew McCallum
44a604d900 ([IndexedCollection -removeObject:]): Use unsigned for index, not int.
([IndexedCollection -replaceObject:withObject:]): Likewise.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1308 72102866-910b-0410-8b05-ffd578937521
1996-03-30 22:21:11 +00:00
Andrew McCallum
97e6ad9b21 (NO_INDEX): Change from UINT_MAX to NSNotFound, so that Array and
NSArray can coexist.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1305 72102866-910b-0410-8b05-ffd578937521
1996-03-30 22:07:46 +00:00
Andrew McCallum
0a4dd31b8a ([NSArray -isEqualToArray:]): Fix typo; reverse test before returning no.
([NSArray -arrayByAddingObject:]): New function, from Scott
Christley.
([NSArray -arrayByAddingObjectsFromArray:]): Likewise.
([NSArray -subarrayWithRange:]): Implemented by Scott Christely.
([NSMutableArray -removeObjectIdenticalTo:]): Don't fail if the object
is not present.
([NSMutableArray -removeObject:]): Likewise.
([NSMutableArray -removeAllObjects]): Implemented by Scott Christley.
([NSMutableArray -setArray:]): New function, from Scott Christley.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1304 72102866-910b-0410-8b05-ffd578937521
1996-03-30 19:14:43 +00:00
Andrew McCallum
433dd8ef66 ([IndexedCollection -removeObject:]): Now removes *all* instances of
ANOBJECT, not just one.
([IndexedCollection -replaceObject:withObject:]): Now replaces *all*
instances of OLDOBJECT, not just one.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1303 72102866-910b-0410-8b05-ffd578937521
1996-03-30 19:04:35 +00:00
Andrew McCallum
5054040415 (ABS): New macro, defined if not already defined.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1302 72102866-910b-0410-8b05-ffd578937521
1996-03-30 16:01:43 +00:00
Andrew McCallum
3eb99042d6 Fix typos in method types.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1301 72102866-910b-0410-8b05-ffd578937521
1996-03-30 15:58:28 +00:00
Andrew McCallum
c721e0da0e (Array _grow_factor): Change type of ivar from unsigned to int.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1300 72102866-910b-0410-8b05-ffd578937521
1996-03-30 15:06:46 +00:00
Andrew McCallum
b9fabc2237 ([Array +defaultGrowFactor]): Return type changed to int.
([Array -growFactor]): Likewise.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1299 72102866-910b-0410-8b05-ffd578937521
1996-03-30 15:06:20 +00:00
Andrew McCallum
7867d0a082 Add new semantic to ivar _grow_factor: if it is less than 0, the array
grows by -_grow_factor, but never shrinks.
(incrementCount): Use the ABS() of _grow_factor.
(decrementCount): Only shrink the array if _grow_factor is > 0.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1298 72102866-910b-0410-8b05-ffd578937521
1996-03-30 15:05:15 +00:00
Andrew McCallum
ff190a3a03 Declare new method names, and comment.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1293 72102866-910b-0410-8b05-ffd578937521
1996-03-30 01:33:05 +00:00
Andrew McCallum
78380df445 Overhauled for memory management changes to fix leaks, various other
fixes.
(MFRAME_STRUCTURES_PASSED_BY_REFERENCE): Renamed from
CONNECTION_STRUCTURES_PASSED_BY_REFERENCE.
(mframe_dissect_call): Function renamed from dissect_method_call.
Remove some redundant if()-else clauses.  Clarify case in which
OUT_PARAMETERS is true.  Use switch statement instead of if-else's.
(mframe_do_call): Function renamed from make_method_call.  Get the
local selector type from the target's Method, not from the selector
type; this will more reliably give the correct type string.  Don't
bother to set OBJECT twice.  Remove some redundant if()-else clauses.
Use NSParameterAssert, not assert, so we can catch problems, (and not
crash the D.O. server).  Change the way memory management for decoded
arguments is handled to remove memory leaks; use new scheme for
DECODER functions that are responsonsible for making sure allocated
memory is eventually freed.  Use alloca() to allocate space for _C_PTR
values, struct's and arrays.  Overhaul the way floats and doubles are
extracted from the RETFRAME; use functions with __builtin_return,
instead of fishing around the RETFRAME.  Use switch statement intead
of if-else's.  Separate cases for char's and short's.  Change some
local variable names for clarity.
(mframe_build_return): Function renamed from dissect_method_return.
Remove some redundant if()-else clauses.  Use NSParameterAssert, not
assert.  Change the way memory management for decoded arguments is
handled to remove memory leaks; use new scheme for DECODER functions
that are responsonsible for making sure allocated memory is eventually
freed.  Use alloca() to allocate space for _C_PTR values, struct's and
arrays.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1292 72102866-910b-0410-8b05-ffd578937521
1996-03-30 01:29:07 +00:00
Andrew McCallum
89c6fa64ca ([BinaryCStream -encodeValueOfCType:at:withName:]): Encode the
exponent as a short, not an int.
([BinaryCStream -decodeValueOfCType:at:withName:]): Likewise, decoding.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1291 72102866-910b-0410-8b05-ffd578937521
1996-03-30 00:50:30 +00:00
Andrew McCallum
a4627672a3 ([Connection -forwardForProxy:selector:argFrame:]): Use new mframe
interface.  In the nested function DECODER, autorelease any char*'s
that we decode, as required by the new memory reference scheme.
([Connection -_service_forwardForProxy:]): Likewise, for both.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1290 72102866-910b-0410-8b05-ffd578937521
1996-03-29 17:55:15 +00:00
Andrew McCallum
5e439ccd99 ([BinaryCStream -encodeValueOfCType:at:withName:]): [_C_CHARPTR]:
Don't autorelease the malloc'ed pointer here; thus the behavior is
analogous to decoding an object: it gives you a reference, it is the
callers responsibility to free it.
([BinaryCStream -decodeValueOfCType:at:withName:]): [_C_DBL]: Fix
typo.  Use mantissa1, not mantissa2 twice.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1289 72102866-910b-0410-8b05-ffd578937521
1996-03-29 17:53:05 +00:00
Andrew McCallum
fca9bcfe2f ([ConstantCollection -_collectionReleaseContents]): Use alloca()
instead of malloc() and free().


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1288 72102866-910b-0410-8b05-ffd578937521
1996-03-29 17:51:07 +00:00
Andrew McCallum
06183fce8e Include <math.h>
(FLOAT_FACTOR): New macro.
(WRITE_SIGNED_TYPE): Take new first argument, the pointer for the
data.
(READ_SIGNED_TYPE): Likewise.
(WRITE_UNSIGNED_TYPE): Likewise.
(READ_UNSIGNED_TYPE): Likewise.
([BinaryCStream -encodeValueOfCType:at:withName:]): [_C_FLT]: Use new
scheme, based on frexp() to turn a float into a series of ints.
[_C_DBL]: Likewise.
([BinaryCStream -decodeValueOfCType:at:withName:]): [_C_FLT]: Likewise
to match.
[_C_DBL]: Likewise.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1286 72102866-910b-0410-8b05-ffd578937521
1996-03-29 15:51:13 +00:00
Andrew McCallum
c110e65ee5 (debug_run_loop): Changed from 1 to 0; turn off debugging messages.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1285 72102866-910b-0410-8b05-ffd578937521
1996-03-29 14:47:38 +00:00
Andrew McCallum
15f0c95e86 ([MallocAddress +autoreleaseMallocAddress:]): Fix typo in method name.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1284 72102866-910b-0410-8b05-ffd578937521
1996-03-29 04:01:33 +00:00
Andrew McCallum
07a8527760 Fix typo.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1283 72102866-910b-0410-8b05-ffd578937521
1996-03-29 03:59:34 +00:00
Andrew McCallum
976194d214 ([MallocAddress +initialize]): Use
NSNonRetainedObjectMapValueCallBacks, not NSObjectMapValueCallBacks,
because otherwise the object will never get dealloc'ed.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1282 72102866-910b-0410-8b05-ffd578937521
1996-03-27 02:14:47 +00:00
Andrew McCallum
ae95bc9c58 In all methods, use NSParameterAssert() instead of assert(), so that
it raises an NSException, and doesn't abort().
([Connection -forwardForProxy:selector:argFrame:]): Decode the flag
that indicates whether the return packet hold an exception or the
return values.  If it holds an exception, decode it and raise it.
([Connection -_service_forwardForProxy:]): Surround the processing of
the method request packet with NS_DURING...NS_ENDHANDLER.  If an
exception is raised, catch it, encode in in a specially flagged
packet, and send the packet back to the client.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1278 72102866-910b-0410-8b05-ffd578937521
1996-03-26 22:34:40 +00:00
Andrew McCallum
5f00258b41 ([BinaryCStream -decodeValueOfCType:at:withName:]): [_C_CHARPTR]:
Autorelease the malloc'ed char pointer.  Before memory was leaking.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1277 72102866-910b-0410-8b05-ffd578937521
1996-03-26 22:28:48 +00:00
Andrew McCallum
647f080875 Fix typos.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1276 72102866-910b-0410-8b05-ffd578937521
1996-03-26 20:59:42 +00:00
Andrew McCallum
9b7e65f4e0 Use NSException instead of sending -error: in all methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1275 72102866-910b-0410-8b05-ffd578937521
1996-03-26 20:52:26 +00:00
Andrew McCallum
7f329b4714 ([OrderedCollection -putObject:atIndex:]): Return type changed from id
to void.  Use NSException, not error:.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1274 72102866-910b-0410-8b05-ffd578937521
1996-03-26 20:52:17 +00:00
Andrew McCallum
5aae0eafb3 Use NSException instead of sending -error: in all methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1273 72102866-910b-0410-8b05-ffd578937521
1996-03-26 19:35:47 +00:00
Andrew McCallum
9536fdc257 ([BinaryCStream -encodeValueOfCType:at:withName:]): Use NSException
instead of sending -error:.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1272 72102866-910b-0410-8b05-ffd578937521
1996-03-26 19:23:09 +00:00
Andrew McCallum
095ebaaa4c (string_buf_ptr): Init local variable.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1271 72102866-910b-0410-8b05-ffd578937521
1996-03-26 00:29:07 +00:00
Andrew McCallum
f744067833 ([NSBundle +setSystemLanguages:]): Comment out unused variables.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1270 72102866-910b-0410-8b05-ffd578937521
1996-03-26 00:28:39 +00:00
Andrew McCallum
60bd74fd01 ([NSMutableData -resetBytesInRange:]): Cast to avoid warning.
([NSMutableData -initWithLength:]): Likewise.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1269 72102866-910b-0410-8b05-ffd578937521
1996-03-26 00:28:20 +00:00
Andrew McCallum
ea1e49af1b ([NSValueDecoder -initValue:withObjCType:]): Return self.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1268 72102866-910b-0410-8b05-ffd578937521
1996-03-26 00:27:44 +00:00