Correct test for class

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11966 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-01-03 17:03:55 +00:00
parent 96c6ef4888
commit c0eb12fa7d
10 changed files with 12 additions and 746 deletions

197
AUTHORS
View file

@ -1,197 +0,0 @@
For the legal record, here is a list of who wrote what:
Andrew Kachites McCallum:
include/preface.h.in
Archiver.m
Array.m
Bag.m
BinaryCStream.m
BinaryTree.m
BinaryTreeNode.m
CircularArray.m
Collection.m
ConnectedCoder.m
Coder.m
CStream.m
Decoder.m
DelegatePool.m
Dictionary.m
Encoder.m
Heap.m
IndexedCollection.m
Invocation.m
KeyedCollection.m
LinkedList.m
LinkedListNode.m
MachPort.m
MappedCollector.m
MemoryStream.m
NotificationDispatcher.m
OrderedCollection.m
Port.m
Queue.m
RawCStream.m
RBTree.m
RBTreeNode.m
Set.m
SplayTree.m
Stack.m
StdioStream.m
Stream.m
TcpPort.m
TextCStream.m
UdpPort.m
behavior.m
preface.m
mframe.m
NSArray.m
NSAutoreleasePool.m
NSCoder.m
NSCopyObject.m
NSCountedSet.m
NSData.m
NSDictionary.m
NSEnumerator.m
NSGArchiver.m
NSGArray.m
NSGCString.m
NSGSet.m
NSGString.m
NSMethodSignature.m
NSNotification.m
NSNotificationCenter.m
NSObjCRuntime.m
NSObject.m
NSPage.m
NSPortCoder.m
NSSet.m
NSString.m
NSThread.m
NSTimer.m
NSUser.m
Kresten Krab Thorup:
GapArray.m
objc-gnu2next.m
Adam Fedor:
ostream.m
NSAssertionHandler.m
NSBitmapCharSet.m
NSBundle.m
NSCharacterSet.m
NSConcreteValue.m
NSException.m
NSGeometry.m
NSLog.m
NSNumber.m
NSValue.m
objc-load.c
NSConcreteNumber.m
NSCTemplateValue.m
Mark Lakata:
Jeremy Bettis:
NSDate.m
Georg Tuparev:
NSProcessInfo.m
NSUserDefaults.m
Peter Burka:
Albin L. Jones:
o_array.m
o_array_bas.m
o_array_cbs.m
o_cbs.m
o_cbs_char_p.m
o_cbs_id.m
o_cbs_int.m
o_cbs_int_p.m
o_cbs_void_p.m
o_hash.m
o_hash_bas.m
o_hash_cbs.m
o_list.m
o_list_bas.m
o_list_cbs.m
o_map.m
o_map_bas.m
o_map_cbs.m
numbers.c
o_x_bas.m.in
o_x_cbs.m.in
include/o_x_bas.h.in
include/o_x_cbs.h.in
NSCallBacks.m
NSHashTable.m
NSMapTable.m
NSCallBacks.h
Scott Christley:
GNUmakefile
Makefile.preamble
Makefile.postamble
win32-entry.m
win32-def.top
libgnustep-base.def
NSCalendarDate.m
NSDate.m
NSLock.m
NSThread.m
externs.m
Luke Howard:
NSHost.m
Yoo C. Chung:
NSTimeZone.m
NSZone.m
Richard Frith-Macdonald:
UnixFileHandle.m
NSData.m
NSDateFormatter.m
NSDebug.m
NSDistantObject.m
NSDistributedLock.m
NSDistributedNotificationCenter.m
NSFileHandle.m
NSFormatter.m
NSGDictionary.m
NSPipe.m
NSPort.m
NSPortNameServer.m
NSProxy.m
NSTask.m
NSUndoManager.m
Stevo Crvenkovski:
GetDefEncoding.m
Unicode.m
NSGSequence.m
NSGString.m
Mike Kienenberger:
NSProtocolChecker.m
Manuel Guesdon:
NSURL.m
NSURLHandle.m

View file

@ -1,51 +0,0 @@
#
# admin makefile for the GNUstep Base Library
# Copyright (C) 1995 Free Software Foundation, Inc.
#
# Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
#
# This file is part of the GNUstep Base 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
# Install into the system root by default
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
GNUSTEP_MAKEFILES = $(GNUSTEP_SYSTEM_ROOT)/Makefiles
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../base.make
include $(GNUSTEP_MAKEFILES)/common.make
include ../Version
include ../config.mak
ADMIN_FILES = \
HOWTO-patches \
example.patch \
volunteers \
tasks
RCS_FILES = GNUmakefile Makefile.postamble
DIST_FILES = $(RCS_FILES) $(ADMIN_FILES)
-include Makefile.preamble
-include GNUmakefile.local
# We don't actually build anything in this directory so
# just include the common makefile rules
include $(GNUSTEP_MAKEFILES)/rules.make
-include Makefile.postamble

View file

@ -1,36 +0,0 @@
Directions for creating a GNUstep Base Library patch
---------------------------------------------------------------
0. Have somewhere an old, pristine version of the gstep-base
directory. We'll assume this directory is called "gstep-base-old".
1. Have somewhere a new, changed version of the gnustep-base directory.
We'll assume this directory is called "gstep-base", and that it has
the same parent directory as "gstep-base-old"
2. cd to the common parent directory of your two gstep-base directories.
3. Create the patch with
diff -r -N -u gstep-base-old gstep-base >my.patch"
The `-u' requests a `unified-diff' style patch. If your version of
diff doesn't support this, pass `-c2' instead of `-u'.
4. Add a GNU-style ChangeLog entry to the top of the patch. You can
do this from within emacs using M-x add-change-log-entry.
5. If you want to include a short note of explanation to me
personally, put it at the top, above the ChangeLog entry.
6. Mail the file to mccallum@gnu.ai.mit.edu.
---------------------------------------------------------------
For a beautiful example from Adam Fedor, see the file example.patch.
If you send me multiple patches to the same file between releases of
gstep-base, please diff against a version that has your previous patches.
[I just threw these directions together. If you have constructive
suggestions for improving these directions, please send them to me.
gnustep-maintainers@gnu.org]

View file

@ -1,85 +0,0 @@
#
# Makefile.postamble
#
# Copyright (C) 1997 Free Software Foundation, Inc.
#
# Author: Scott Christley <scottc@net-community.com>
#
# This file is part of the GNUstep Base 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.
#
# If you are interested in a warranty or support for this source code,
# contact Scott Christley at scottc@net-community.com
#
# You should have received a copy of the GNU Library General Public
# License along with this library; see the file COPYING.LIB.
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Makefile.postamble
#
# Project specific makefile rules
#
# Uncomment the targets you want.
# The double colons (::) are important, do not make them single colons
# otherwise the normal makefile rules will not be performed.
#
# Things to do before compiling
# before-all::
# Things to do after compiling
# after-all::
# Things to do before installing
# before-install::
# Things to do after installing
# after-install::
# Things to do before uninstalling
# before-uninstall::
# Things to do after uninstalling
# after-uninstall::
# Things to do before cleaning
# before-clean::
# Things to do after cleaning
# after-clean::
# Things to do before distcleaning
# before-distclean::
# Things to do after distcleaning
# after-distclean::
# Things to do before checking
# before-check::
# Things to do after checking
# after-check::
tasks: ../doc/todo.texi
rm -f tasks
(cd ../doc; $(MAKE) -$(MAKEFLAGS) $(MAKEDEFINES) TODO)
cp ../doc/TODO ./tasks
regenerate:
copy-dist: $(DIST_FILES)
mkdir ../snap/admin
for f in $(DIST_FILES); do \
cp $$f ../snap/admin ; \
done

View file

@ -1,275 +0,0 @@
I took the liberty of moving the double_release checking to NSObject from
NSAutoreleasePool, and also improving it a little. This really helped me
find a bug in my own program (one that even NeXT Foundation didn't catch).
Fri Aug 4 13:39:05 1995 Adam Fedor <fedor@mode.colorado.edu>
* 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.h ([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.
diff -c libobjects/src/NSAutoreleasePool.m:1.2 libobjects/src/NSAutoreleasePool.
m:1.3
*** libobjects/src/NSAutoreleasePool.m:1.2 Fri Aug 4 13:57:13 1995
--- libobjects/src/NSAutoreleasePool.m Fri Aug 4 13:57:13 1995
***************
*** 44,53 ****
`release' message. Memory use grows, and grows, and... */
static BOOL autorelease_enabled = YES;
- /* When this is `YES', every call to addObject, checks to make sure
- isn't being set up to release itself too many times. */
- static BOOL double_release_check_enabled = NO;
-
/* When the released_count gets over this value, we call error:.
In the future, I may change this to raise an exception or call
a function instead. */
--- 44,49 ----
***************
*** 109,132 ****
if (!autorelease_enabled)
return;
- if (double_release_check_enabled)
- {
- unsigned release_count = [[self class] autoreleaseCountForObject:anObj];
- unsigned retain_count = [anObj retainCount];
- if (release_count > retain_count + 1)
- [self error:"Autorelease would release object too many times."];
- }
-
if (released_count >= pool_count_warning_threshhold)
[self error:"AutoreleasePool count threshhold exceeded."];
- released_count++;
if (released_count == released_size)
{
released_size *= 2;
OBJC_REALLOC(released, id, released_size);
}
released[released_count] = anObj;
}
- init
--- 105,120 ----
if (!autorelease_enabled)
return;
if (released_count >= pool_count_warning_threshhold)
[self error:"AutoreleasePool count threshhold exceeded."];
if (released_count == released_size)
{
released_size *= 2;
OBJC_REALLOC(released, id, released_size);
}
released[released_count] = anObj;
+ released_count++;
}
- init
***************
*** 154,166 ****
{
int i;
if (parent)
current_pool = parent;
else
current_pool = [[NSAutoreleasePool alloc] init];
- for (i = 0; i < released_count; i++)
- [released[i] release];
- OBJC_FREE(released);
NSDeallocateObject(self);
}
--- 142,165 ----
{
int i;
+ /* Make debugging easier by checking to see if we already dealloced the
+ object before trying to release it. Also, take the object out of the
+ released list just before releasing it, so if we are doing
+ "double_release_check"ing, then autoreleaseCountForObject: won't find the
+ object we are currently releasing. */
+ for (i = 0; i < released_count; i++)
+ {
+ id anObject = released[i];
+ if (anObject->isa == (void*) 0xdeadface)
+ [self error:"Autoreleasing deallocated object. Debug after setting [NSOb
ject enableDoubleReleaseCheck:YES] to check for release errors."];
+ released[i]=0;
+ [anObject release];
+ }
+ OBJC_FREE(released);
if (parent)
current_pool = parent;
else
current_pool = [[NSAutoreleasePool alloc] init];
NSDeallocateObject(self);
}
***************
*** 173,183 ****
+ (void) enableRelease: (BOOL)enable
{
autorelease_enabled = enable;
- }
-
- + (void) enableDoubleReleaseCheck: (BOOL)enable
- {
- double_release_check_enabled = enable;
}
+ (void) setPoolCountThreshhold: (unsigned)c
--- 172,177 ----
diff -c libobjects/src/NSObject.m:1.1.1.2 libobjects/src/NSObject.m:1.2
*** libobjects/src/NSObject.m:1.1.1.2 Fri Aug 4 13:57:14 1995
--- libobjects/src/NSObject.m Fri Aug 4 13:57:14 1995
***************
*** 49,54 ****
--- 49,58 ----
/* The Class responsible for handling autorelease's */
static id autorelease_class = nil;
+ /* When this is `YES', every call to release/autorelease, checks to make sure
+ isn't being set up to release itself too many times. */
+ static BOOL double_release_check_enabled = NO;
+
BOOL NSShouldRetainWithZone(NSObject *anObject, NSZone *requestedZone)
{
if (!requestedZone || [anObject zone] == requestedZone)
***************
*** 282,287 ****
--- 286,300 ----
- autorelease
{
+ if (double_release_check_enabled)
+ {
+ unsigned release_count;
+ unsigned retain_count = [self retainCount];
+ release_count = [autorelease_class autoreleaseCountForObject:self];
+ if (release_count > retain_count)
+ [self error:"Autorelease would release object too many times."];
+ }
+
[autorelease_class addObject:self];
return self;
}
***************
*** 352,357 ****
--- 365,379 ----
- (oneway void) release
{
+ if (double_release_check_enabled)
+ {
+ unsigned release_count;
+ unsigned retain_count = [self retainCount];
+ release_count = [autorelease_class autoreleaseCountForObject:self];
+ if (release_count > retain_count)
+ [self error:"Release would release object too many times."];
+ }
+
if (NSDecrementExtraRefCountWasZero(self))
[self dealloc];
return;
***************
*** 543,548 ****
--- 565,575 ----
+ (Class) autoreleaseClass
{
return autorelease_class;
+ }
+
+ + (void) enableDoubleReleaseCheck: (BOOL)enable
+ {
+ double_release_check_enabled = enable;
}
- (int)compare:anotherObject;
diff -c libobjects/src/Foundation/NSAutoreleasePool.h:1.3 libobjects/src/Foundat
ion/NSAutoreleasePool.h:1.4
*** libobjects/src/Foundation/NSAutoreleasePool.h:1.3 Fri Aug 4 13:57:17 1995
--- libobjects/src/Foundation/NSAutoreleasePool.h Fri Aug 4 13:57:17 1995
***************
*** 38,45 ****
- (void)addObject: anObject;
+ (void) enableRelease: (BOOL)enable;
- + (void) enableDoubleReleaseCheck: (BOOL)enable;
+ (void) setPoolCountThreshhold: (unsigned)c;
@end
--- 38,45 ----
- (void)addObject: anObject;
+ (void) enableRelease: (BOOL)enable;
+ (void) setPoolCountThreshhold: (unsigned)c;
+ + (unsigned) autoreleaseCountForObject: anObject;
@end
diff -c libobjects/src/Foundation/NSObject.h:1.5 libobjects/src/Foundation/NSObj
ect.h:1.6
*** libobjects/src/Foundation/NSObject.h:1.5 Fri Aug 4 13:57:18 1995
--- libobjects/src/Foundation/NSObject.h Fri Aug 4 13:57:18 1995
***************
*** 140,145 ****
--- 140,146 ----
- shouldNotImplement:(SEL)aSel;
+ (Class) autoreleaseClass;
+ (void) setAutoreleaseClass: (Class)aClass;
+ + (void) enableDoubleReleaseCheck: (BOOL)enable;
- read: (TypedStream*)aStream;
- write: (TypedStream*)aStream;
@end
diff -c libobjects/src/Foundation/objc-load.h:1.6 libobjects/src/Foundation/objc
-load.h:1.7
*** libobjects/src/Foundation/objc-load.h:1.6 Fri Aug 4 13:57:18 1995
--- libobjects/src/Foundation/objc-load.h Fri Aug 4 13:57:19 1995
***************
*** 3,15 ****
Copyright (C) 1993, Adam Fedor.
*/
#ifndef __objc_load_h_INCLUDE
#define __objc_load_h_INCLUDE
#include <stdio.h>
! #include <objc/objc.h>
extern char *objc_executable_location();
--- 3,15 ----
Copyright (C) 1993, Adam Fedor.
*/
#ifndef __objc_load_h_INCLUDE
#define __objc_load_h_INCLUDE
#include <stdio.h>
! #include <objc/objc-api.h>
extern char *objc_executable_location();

View file

@ -1,3 +1,13 @@
2002-01-03 Adam Fedor <fedor@gnu.org>
* Source/GSFFCallInvocation.m (gs_method_for_receiver_and_selector):
Correct test for class.
* Source/GNUmakefile (AUTHORS): Remove target.
* AUTHORS: Remove.
* Admin/: Remove.
* configure.bat: Likewise.
2002-01-03 Richard Frith-Macdonald <rfm@gnu.org>
* Header/Foundation/GSXML.h: Correction standards complience
@ -20,7 +30,6 @@
* Tools/autogsdoc.m (main): When no libxml, abort with a useful error
message.
2002-01-02 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSXML.m: Tidied some methods and added autogsdoc comments.

View file

@ -76,7 +76,7 @@ DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_TARGET_INSTALL_PREFIX) \
-DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
else
GNUSTEP_INSTALL_PREFIX=$(GNUSTEP_SYSTEM_ROOT)
@ -90,24 +90,6 @@ DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \
endif
# Grep for these names to build the legally-required "AUTHORS" file.
FILE_AUTHORS = \
"Andrew Kachites McCallum" \
"Kresten Krab Thorup" \
"Adam Fedor" \
"Mark Lakata" \
"Jeremy Bettis" \
"Georg Tuparev" \
"Peter Burka" \
"Albin L. Jones" \
"Scott Christley" \
"Luke Howard" \
"Yoo C. Chung" \
"Richard Frith-Macdonald" \
"Stevo Crvenkovski" \
"Mike Kienenberger" \
"Manuel Guesdon"
# The GNU source files
GNU_MFILES = \

View file

@ -215,7 +215,7 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel)
return class_get_instance_method (object_get_class
(receiver), sel);
}
else if (object_is_meta_class (receiver))
else if (object_is_class (receiver))
{
return class_get_class_method (object_get_meta_class
(receiver), sel);

View file

@ -283,19 +283,6 @@ libgnustep-base.def.new: $(GNUSTEP_OBJ_DIR)/*o
TAGS: $(DIST_FILES)
etags $(DIST_FILES)
AUTHORS: GNUmakefile
rm -f AUTHORS
@echo Finding file authors...
@echo 'For the legal record, here is a list of who wrote what:'>AUTHORS
@for a in $(FILE_AUTHORS) \
; do \
echo >>AUTHORS; \
echo >>AUTHORS; \
echo "$${a}:" >>AUTHORS; \
egrep -l "((Written by)|(Author)|(Rewritten by)).*$${a}" \
$(DIST_FILES) >>AUTHORS; \
done
regenerate: $(DIST_FILES)
mv AUTHORS ..

View file

@ -1,68 +0,0 @@
@echo off
rem
rem configure.bat
rem Configuration program for GNUstep Base Library
rem on WIN32 operating systems using Microsoft tools.
rem
rem Copyright (C) 1996 Free Software Foundation, Inc.
rem
rem Written by: Scott Christley <scottc@net-community.com>
rem
rem This file is part of the GNUstep Base Library.
rem
rem This library is free software; you can redistribute it and/or
rem modify it under the terms of the GNU Library General Public
rem License as published by the Free Software Foundation; either
rem version 2 of the License, or (at your option) any later version.
rem
rem This library is distributed in the hope that it will be useful,
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
rem Library General Public License for more details.
rem
rem You should have received a copy of the GNU Library General Public
rem License along with this library; if not, write to the Free
rem Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
rem
rem
rem Top level makefile
rem
echo "Top level makefile"
sed -f Makefile.sed.nt Makefile.in >Makefile
rem
rem src makefile
rem
echo "Src makefile"
cd src
sed -f Makefile.sed.nt Makefile.in >Makefile
touch 0
touch 1
touch 2
touch 3
touch 4
touch 5
touch 6
touch 7
touch 8
touch 9
touch 10
touch 11
touch 12
echo "include subdirectory"
cd include
rm -f config.h
cat config.h.in >config.h
cat config-win32.h >>config.h
cd ..
cd ..
rem
rem checks makefile
rem
echo "Checks makefile"
cd checks
sed -f Makefile.sed.nt Makefile.in >Makefile
cd ..