diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 2001-12-18 04:13:59 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 2001-12-18 04:13:59 +0000 |
commit | 8baceaba7914799fb78a4a8a177423bab95a6fae (patch) | |
tree | cd1904fa8adf734febb3ac5d4d64250908ee2713 /contrib/libobjc/objc | |
parent | 8489cc4415b1edcaf1bfe1bc43893024b91b599d (diff) |
This commit was manufactured by cvs2svn to create tagvendor/gcc/3.0.2
'gcc-vendor-gcc_3_0_2'.
Notes
Notes:
svn path=/vendor/gcc/dist/; revision=88109
svn path=/vendor/gcc/3.0.2/; revision=88111; tag=vendor/gcc/3.0.2
Diffstat (limited to 'contrib/libobjc/objc')
-rw-r--r-- | contrib/libobjc/objc/NXConstStr.h | 44 | ||||
-rw-r--r-- | contrib/libobjc/objc/Object.h | 124 | ||||
-rw-r--r-- | contrib/libobjc/objc/Protocol.h | 58 | ||||
-rw-r--r-- | contrib/libobjc/objc/encoding.h | 99 | ||||
-rw-r--r-- | contrib/libobjc/objc/hash.h | 206 | ||||
-rw-r--r-- | contrib/libobjc/objc/objc-api.h | 597 | ||||
-rw-r--r-- | contrib/libobjc/objc/objc-list.h | 147 | ||||
-rw-r--r-- | contrib/libobjc/objc/objc.h | 158 | ||||
-rw-r--r-- | contrib/libobjc/objc/runtime.h | 88 | ||||
-rw-r--r-- | contrib/libobjc/objc/sarray.h | 237 | ||||
-rw-r--r-- | contrib/libobjc/objc/thr.h | 143 | ||||
-rw-r--r-- | contrib/libobjc/objc/typedstream.h | 132 |
12 files changed, 0 insertions, 2033 deletions
diff --git a/contrib/libobjc/objc/NXConstStr.h b/contrib/libobjc/objc/NXConstStr.h deleted file mode 100644 index c9799544a029..000000000000 --- a/contrib/libobjc/objc/NXConstStr.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Interface for the NXConstantString class for Objective-C. - Copyright (C) 1995 Free Software Foundation, Inc. - Contributed by Pieter J. Schoenmakers <tiggr@es.ele.tue.nl> - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC 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 General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -#ifndef __nxconstantstring_INCLUDE_GNU -#define __nxconstantstring_INCLUDE_GNU - -#include "objc/Object.h" - -@interface NXConstantString: Object -{ - char *c_string; - unsigned int len; -} - --(const char *) cString; --(unsigned int) length; - -@end - -#endif diff --git a/contrib/libobjc/objc/Object.h b/contrib/libobjc/objc/Object.h deleted file mode 100644 index a762acc3f7db..000000000000 --- a/contrib/libobjc/objc/Object.h +++ /dev/null @@ -1,124 +0,0 @@ -/* Interface for the Object class for Objective-C. - Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC 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 General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled - with GCC to produce an executable, this does not cause the resulting - executable to be covered by the GNU General Public License. This - exception does not however invalidate any other reasons why the - executable file might be covered by the GNU General Public License. */ - -#ifndef __object_INCLUDE_GNU -#define __object_INCLUDE_GNU - -#include <objc/objc.h> -#include <objc/typedstream.h> - -/* - * All classes are derived from Object. As such, - * this is the overhead tacked onto those objects. - */ -@interface Object -{ - Class isa; /* A pointer to the instance's class structure */ -} - - /* Initializing classes and instances */ -+ initialize; -- init; - - /* Creating, freeing, and copying instances */ -+ new; -+ alloc; -- free; -- copy; -- shallowCopy; -- deepen; -- deepCopy; - - /* Identifying classes */ -- (Class)class; -- (Class)superClass; -- (MetaClass)metaClass; -- (const char *)name; - - /* Identifying and comparing objects */ -- self; -- (unsigned int)hash; -- (BOOL)isEqual:anObject; -- (int)compare:anotherObject; - - /* Testing object type */ -- (BOOL)isMetaClass; -- (BOOL)isClass; -- (BOOL)isInstance; - - /* Testing inheritance relationships */ -- (BOOL)isKindOf:(Class)aClassObject; -- (BOOL)isMemberOf:(Class)aClassObject; -- (BOOL)isKindOfClassNamed:(const char *)aClassName; -- (BOOL)isMemberOfClassNamed:(const char *)aClassName; - - /* Testing class functionality */ -+ (BOOL)instancesRespondTo:(SEL)aSel; -- (BOOL)respondsTo:(SEL)aSel; - - /* Testing protocol conformance */ -- (BOOL)conformsTo:(Protocol*)aProtocol; - - /* Introspection */ -+ (IMP)instanceMethodFor:(SEL)aSel; -- (IMP)methodFor:(SEL)aSel; -+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel; -- (struct objc_method_description *)descriptionForMethod:(SEL)aSel; - - /* Sending messages determined at run time */ -- perform:(SEL)aSel; -- perform:(SEL)aSel with:anObject; -- perform:(SEL)aSel with:anObject1 with:anObject2; - - /* Forwarding */ -- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame; -- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame; - - /* Posing */ -+ poseAs:(Class)aClassObject; -- (Class)transmuteClassTo:(Class)aClassObject; - - /* Enforcing intentions */ -- subclassResponsibility:(SEL)aSel; -- notImplemented:(SEL)aSel; -- shouldNotImplement:(SEL)aSel; - - /* Error handling */ -- doesNotRecognize:(SEL)aSel; -- error:(const char *)aString, ...; - - /* Archiving */ -+ (int)version; -+ setVersion:(int)aVersion; -+ (int)streamVersion: (TypedStream*)aStream; - -- read: (TypedStream*)aStream; -- write: (TypedStream*)aStream; -- awake; - -@end - -#endif diff --git a/contrib/libobjc/objc/Protocol.h b/contrib/libobjc/objc/Protocol.h deleted file mode 100644 index f54b7cd2393a..000000000000 --- a/contrib/libobjc/objc/Protocol.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Declare the class Protocol for Objective C programs. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -#ifndef __Protocol_INCLUDE_GNU -#define __Protocol_INCLUDE_GNU - -#include "objc/Object.h" - -@interface Protocol : Object -{ -@private - char *protocol_name; - struct objc_protocol_list *protocol_list; - struct objc_method_description_list *instance_methods, *class_methods; -} - -/* Obtaining attributes intrinsic to the protocol */ - -- (const char *)name; - -/* Testing protocol conformance */ - -- (BOOL) conformsTo: (Protocol *)aProtocolObject; - -/* Looking up information specific to a protocol */ - -- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel; -- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel; - -@end - - - - -#endif /* not __Protocol_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/encoding.h b/contrib/libobjc/objc/encoding.h deleted file mode 100644 index b4def4302b53..000000000000 --- a/contrib/libobjc/objc/encoding.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Encoding of types for Objective C. - Copyright (C) 1993, 1997 Free Software Foundation, Inc. - -Author: Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -#ifndef __encoding_INCLUDE_GNU -#define __encoding_INCLUDE_GNU - -#include <ctype.h> -#include "objc/objc-api.h" - -#define _C_CONST 'r' -#define _C_IN 'n' -#define _C_INOUT 'N' -#define _C_OUT 'o' -#define _C_BYCOPY 'O' -#define _C_BYREF 'R' -#define _C_ONEWAY 'V' -#define _C_GCINVISIBLE '!' - -#define _F_CONST 0x01 -#define _F_IN 0x01 -#define _F_OUT 0x02 -#define _F_INOUT 0x03 -#define _F_BYCOPY 0x04 -#define _F_BYREF 0x08 -#define _F_ONEWAY 0x10 -#define _F_GCINVISIBLE 0x20 - -int objc_aligned_size (const char* type); -int objc_sizeof_type (const char* type); -int objc_alignof_type (const char* type); -int objc_aligned_size (const char* type); -int objc_promoted_size (const char* type); - -const char* objc_skip_type_qualifiers (const char* type); -const char* objc_skip_typespec (const char* type); -const char* objc_skip_offset (const char* type); -const char* objc_skip_argspec (const char* type); -int method_get_number_of_arguments (struct objc_method*); -int method_get_sizeof_arguments (struct objc_method*); - -char* method_get_first_argument (struct objc_method*, - arglist_t argframe, - const char** type); -char* method_get_next_argument (arglist_t argframe, - const char **type); -char* method_get_nth_argument (struct objc_method* m, - arglist_t argframe, - int arg, - const char **type); - -unsigned objc_get_type_qualifiers (const char* type); - - -struct objc_struct_layout -{ - const char *original_type; - const char *type; - const char *prev_type; - unsigned int record_size; - unsigned int record_align; -}; - -void objc_layout_structure (const char *type, - struct objc_struct_layout *layout); -BOOL objc_layout_structure_next_member (struct objc_struct_layout *layout); -void objc_layout_finish_structure (struct objc_struct_layout *layout, - unsigned int *size, - unsigned int *align); -void objc_layout_structure_get_info (struct objc_struct_layout *layout, - unsigned int *offset, - unsigned int *align, - const char **type); - -#endif /* __encoding_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/hash.h b/contrib/libobjc/objc/hash.h deleted file mode 100644 index bddb791c820c..000000000000 --- a/contrib/libobjc/objc/hash.h +++ /dev/null @@ -1,206 +0,0 @@ -/* Hash tables for Objective C method dispatch. - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - - -#ifndef __hash_INCLUDE_GNU -#define __hash_INCLUDE_GNU - -#include <stddef.h> -#include <objc/objc.h> - -/* - * This data structure is used to hold items - * stored in a hash table. Each node holds - * a key/value pair. - * - * Items in the cache are really of type void *. - */ -typedef struct cache_node -{ - struct cache_node *next; /* Pointer to next entry on the list. - NULL indicates end of list. */ - const void *key; /* Key used to locate the value. Used - to locate value when more than one - key computes the same hash - value. */ - void *value; /* Value stored for the key. */ -} *node_ptr; - - -/* - * This data type is the function that computes a hash code given a key. - * Therefore, the key can be a pointer to anything and the function specific - * to the key type. - * - * Unfortunately there is a mutual data structure reference problem with this - * typedef. Therefore, to remove compiler warnings the functions passed to - * hash_new will have to be casted to this type. - */ -typedef unsigned int (*hash_func_type)(void *, const void *); - -/* - * This data type is the function that compares two hash keys and returns an - * integer greater than, equal to, or less than 0, according as the first - * parameter is lexicographically greater than, equal to, or less than the - * second. - */ - -typedef int (*compare_func_type)(const void *, const void *); - - -/* - * This data structure is the cache. - * - * It must be passed to all of the hashing routines - * (except for new). - */ -typedef struct cache -{ - /* Variables used to implement the hash itself. */ - node_ptr *node_table; /* Pointer to an array of hash nodes. */ - /* Variables used to track the size of the hash table so to determine - when to resize it. */ - unsigned int size; /* Number of buckets allocated for the hash table - (number of array entries allocated for - "node_table"). Must be a power of two. */ - unsigned int used; /* Current number of entries in the hash table. */ - unsigned int mask; /* Precomputed mask. */ - - /* Variables used to implement indexing through the hash table. */ - - unsigned int last_bucket; /* Tracks which entry in the array where - the last value was returned. */ - /* Function used to compute a hash code given a key. - This function is specified when the hash table is created. */ - hash_func_type hash_func; - /* Function used to compare two hash keys to see if they are equal. */ - compare_func_type compare_func; -} *cache_ptr; - - -/* Two important hash tables. */ -extern cache_ptr module_hash_table, class_hash_table; - -/* Allocate and initialize a hash table. */ - -cache_ptr hash_new (unsigned int size, - hash_func_type hash_func, - compare_func_type compare_func); - -/* Deallocate all of the hash nodes and the cache itself. */ - -void hash_delete (cache_ptr cache); - -/* Add the key/value pair to the hash table. If the - hash table reaches a level of fullness then it will be resized. - - assert if the key is already in the hash. */ - -void hash_add (cache_ptr *cachep, const void *key, void *value); - -/* Remove the key/value pair from the hash table. - assert if the key isn't in the table. */ - -void hash_remove (cache_ptr cache, const void *key); - -/* Used to index through the hash table. Start with NULL - to get the first entry. - - Successive calls pass the value returned previously. - ** Don't modify the hash during this operation *** - - Cache nodes are returned such that key or value can - be extracted. */ - -node_ptr hash_next (cache_ptr cache, node_ptr node); - -/* Used to return a value from a hash table using a given key. */ - -void *hash_value_for_key (cache_ptr cache, const void *key); - -/* Used to determine if the given key exists in the hash table */ - -BOOL hash_is_key_in_hash (cache_ptr cache, const void *key); - -/************************************************ - - Useful hashing functions. - - Declared inline for your pleasure. - -************************************************/ - -/* Calculate a hash code by performing some - manipulation of the key pointer. (Use the lowest bits - except for those likely to be 0 due to alignment.) */ - -static inline unsigned int -hash_ptr (cache_ptr cache, const void *key) -{ - return ((size_t)key / sizeof (void *)) & cache->mask; -} - - -/* Calculate a hash code by iterating over a NULL - terminate string. */ -static inline unsigned int -hash_string (cache_ptr cache, const void *key) -{ - unsigned int ret = 0; - unsigned int ctr = 0; - - - while (*(char*)key) { - ret ^= *(char*)key++ << ctr; - ctr = (ctr + 1) % sizeof (void *); - } - - return ret & cache->mask; -} - - -/* Compare two pointers for equality. */ -static inline int -compare_ptrs (const void *k1, const void *k2) -{ - return !(k1 - k2); -} - - -/* Compare two strings. */ -static inline int -compare_strings (const void *k1, const void *k2) -{ - if (k1 == k2) - return 1; - else if (k1 == 0 || k2 == 0) - return 0; - else - return !strcmp (k1, k2); -} - - -#endif /* not __hash_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/objc-api.h b/contrib/libobjc/objc/objc-api.h deleted file mode 100644 index fe34dafb8956..000000000000 --- a/contrib/libobjc/objc/objc-api.h +++ /dev/null @@ -1,597 +0,0 @@ -/* GNU Objective-C Runtime API. - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC 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 General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled - with GCC to produce an executable, this does not cause the resulting - executable to be covered by the GNU General Public License. This - exception does not however invalidate any other reasons why the - executable file might be covered by the GNU General Public License. */ - -#ifndef __objc_api_INCLUDE_GNU -#define __objc_api_INCLUDE_GNU - -#include "objc/objc.h" -#include "objc/hash.h" -#include "objc/thr.h" -#include <stdio.h> -#include <stdarg.h> - -/* For functions which return Method_t */ -#define METHOD_NULL (Method_t)0 - /* Boolean typedefs */ -/* -** Method descriptor returned by introspective Object methods. -** This is really just the first part of the more complete objc_method -** structure defined below and used internally by the runtime. -*/ -struct objc_method_description -{ - SEL name; /* this is a selector, not a string */ - char *types; /* type encoding */ -}; - -/* Filer types used to describe Ivars and Methods. */ -#define _C_ID '@' -#define _C_CLASS '#' -#define _C_SEL ':' -#define _C_CHR 'c' -#define _C_UCHR 'C' -#define _C_SHT 's' -#define _C_USHT 'S' -#define _C_INT 'i' -#define _C_UINT 'I' -#define _C_LNG 'l' -#define _C_ULNG 'L' -#define _C_LNG_LNG 'q' -#define _C_ULNG_LNG 'Q' -#define _C_FLT 'f' -#define _C_DBL 'd' -#define _C_BFLD 'b' -#define _C_VOID 'v' -#define _C_UNDEF '?' -#define _C_PTR '^' -#define _C_CHARPTR '*' -#define _C_ATOM '%' -#define _C_ARY_B '[' -#define _C_ARY_E ']' -#define _C_UNION_B '(' -#define _C_UNION_E ')' -#define _C_STRUCT_B '{' -#define _C_STRUCT_E '}' - - -/* -** Error handling -** -** Call objc_error() or objc_verror() to record an error; this error -** routine will generally exit the program but not necessarily if the -** user has installed his own error handler. -** -** Call objc_set_error_handler to assign your own function for -** handling errors. The function should return YES if it is ok -** to continue execution, or return NO or just abort if the -** program should be stopped. The default error handler is just to -** print a message on stderr. -** -** The error handler function should be of type objc_error_handler -** The first parameter is an object instance of relevance. -** The second parameter is an error code. -** The third parameter is a format string in the printf style. -** The fourth parameter is a variable list of arguments. -*/ -extern void objc_error(id object, int code, const char* fmt, ...); -extern void objc_verror(id object, int code, const char* fmt, va_list ap); -typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap); -objc_error_handler objc_set_error_handler(objc_error_handler func); - -/* -** Error codes -** These are used by the runtime library, and your -** error handling may use them to determine if the error is -** hard or soft thus whether execution can continue or abort. -*/ -#define OBJC_ERR_UNKNOWN 0 /* Generic error */ - -#define OBJC_ERR_OBJC_VERSION 1 /* Incorrect runtime version */ -#define OBJC_ERR_GCC_VERSION 2 /* Incorrect compiler version */ -#define OBJC_ERR_MODULE_SIZE 3 /* Bad module size */ -#define OBJC_ERR_PROTOCOL_VERSION 4 /* Incorrect protocol version */ - -#define OBJC_ERR_MEMORY 10 /* Out of memory */ - -#define OBJC_ERR_RECURSE_ROOT 20 /* Attempt to archive the root - object more than once. */ -#define OBJC_ERR_BAD_DATA 21 /* Didn't read expected data */ -#define OBJC_ERR_BAD_KEY 22 /* Bad key for object */ -#define OBJC_ERR_BAD_CLASS 23 /* Unknown class */ -#define OBJC_ERR_BAD_TYPE 24 /* Bad type specification */ -#define OBJC_ERR_NO_READ 25 /* Cannot read stream */ -#define OBJC_ERR_NO_WRITE 26 /* Cannot write stream */ -#define OBJC_ERR_STREAM_VERSION 27 /* Incorrect stream version */ -#define OBJC_ERR_BAD_OPCODE 28 /* Bad opcode */ - -#define OBJC_ERR_UNIMPLEMENTED 30 /* Method is not implemented */ - -#define OBJC_ERR_BAD_STATE 40 /* Bad thread state */ - -/* -** Set this variable nonzero to print a line describing each -** message that is sent. (this is currently disabled) -*/ -extern BOOL objc_trace; - - -/* For every class which happens to have statically allocated instances in - this module, one OBJC_STATIC_INSTANCES is allocated by the compiler. - INSTANCES is NULL terminated and points to all statically allocated - instances of this class. */ -struct objc_static_instances -{ - char *class_name; - id instances[0]; -}; - -/* -** Whereas a Module (defined further down) is the root (typically) of a file, -** a Symtab is the root of the class and category definitions within the -** module. -** -** A Symtab contains a variable length array of pointers to classes and -** categories defined in the module. -*/ -typedef struct objc_symtab { - unsigned long sel_ref_cnt; /* Unknown. */ - SEL refs; /* Unknown. */ - unsigned short cls_def_cnt; /* Number of classes compiled - (defined) in the module. */ - unsigned short cat_def_cnt; /* Number of categories - compiled (defined) in the - module. */ - - void *defs[1]; /* Variable array of pointers. - cls_def_cnt of type Class - followed by cat_def_cnt of - type Category_t, followed - by a NULL terminated array - of objc_static_instances. */ -} Symtab, *Symtab_t; - - -/* -** The compiler generates one of these structures for each module that -** composes the executable (eg main.m). -** -** This data structure is the root of the definition tree for the module. -** -** A collect program runs between ld stages and creates a ObjC ctor array. -** That array holds a pointer to each module structure of the executable. -*/ -typedef struct objc_module { - unsigned long version; /* Compiler revision. */ - unsigned long size; /* sizeof(Module). */ - const char* name; /* Name of the file where the - module was generated. The - name includes the path. */ - - Symtab_t symtab; /* Pointer to the Symtab of - the module. The Symtab - holds an array of - pointers to - the classes and categories - defined in the module. */ -} Module, *Module_t; - - -/* -** The compiler generates one of these structures for a class that has -** instance variables defined in its specification. -*/ -typedef struct objc_ivar* Ivar_t; -typedef struct objc_ivar_list { - int ivar_count; /* Number of structures (Ivar) - contained in the list. One - structure per instance - variable defined in the - class. */ - struct objc_ivar { - const char* ivar_name; /* Name of the instance - variable as entered in the - class definition. */ - const char* ivar_type; /* Description of the Ivar's - type. Useful for - debuggers. */ - int ivar_offset; /* Byte offset from the base - address of the instance - structure to the variable. */ - - } ivar_list[1]; /* Variable length - structure. */ -} IvarList, *IvarList_t; - - -/* -** The compiler generates one (or more) of these structures for a class that -** has methods defined in its specification. -** -** The implementation of a class can be broken into separate pieces in a file -** and categories can break them across modules. To handle this problem is a -** singly linked list of methods. -*/ -typedef struct objc_method Method; -typedef Method* Method_t; -typedef struct objc_method_list { - struct objc_method_list* method_next; /* This variable is used to link - a method list to another. It - is a singly linked list. */ - int method_count; /* Number of methods defined in - this structure. */ - struct objc_method { - SEL method_name; /* This variable is the method's - name. It is a char*. - The unique integer passed to - objc_msg_send is a char* too. - It is compared against - method_name using strcmp. */ - const char* method_types; /* Description of the method's - parameter list. Useful for - debuggers. */ - IMP method_imp; /* Address of the method in the - executable. */ - } method_list[1]; /* Variable length - structure. */ -} MethodList, *MethodList_t; - -struct objc_protocol_list { - struct objc_protocol_list *next; - int count; - Protocol *list[1]; -}; - -/* -** This is used to assure consistent access to the info field of -** classes -*/ -#ifndef HOST_BITS_PER_LONG -#define HOST_BITS_PER_LONG (sizeof(long)*8) -#endif - -#define __CLS_INFO(cls) ((cls)->info) -#define __CLS_ISINFO(cls, mask) ((__CLS_INFO(cls)&mask)==mask) -#define __CLS_SETINFO(cls, mask) (__CLS_INFO(cls) |= mask) - -/* The structure is of type MetaClass */ -#define _CLS_META 0x2L -#define CLS_ISMETA(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_META)) - - -/* The structure is of type Class */ -#define _CLS_CLASS 0x1L -#define CLS_ISCLASS(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_CLASS)) - -/* -** The class is initialized within the runtime. This means that -** it has had correct super and sublinks assigned -*/ -#define _CLS_RESOLV 0x8L -#define CLS_ISRESOLV(cls) __CLS_ISINFO(cls, _CLS_RESOLV) -#define CLS_SETRESOLV(cls) __CLS_SETINFO(cls, _CLS_RESOLV) - -/* -** The class has been send a +initialize message or a such is not -** defined for this class -*/ -#define _CLS_INITIALIZED 0x04L -#define CLS_ISINITIALIZED(cls) __CLS_ISINFO(cls, _CLS_INITIALIZED) -#define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED) - -/* -** The class number of this class. This must be the same for both the -** class and its meta class object -*/ -#define CLS_GETNUMBER(cls) (__CLS_INFO(cls) >> (HOST_BITS_PER_LONG/2)) -#define CLS_SETNUMBER(cls, num) \ - ({ (cls)->info <<= (HOST_BITS_PER_LONG/2); \ - (cls)->info >>= (HOST_BITS_PER_LONG/2); \ - __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); }) - -/* -** The compiler generates one of these structures for each category. A class -** may have many categories and contain both instance and factory methods. -*/ -typedef struct objc_category { - const char* category_name; /* Name of the category. Name - contained in the () of the - category definition. */ - const char* class_name; /* Name of the class to which - the category belongs. */ - MethodList_t instance_methods; /* Linked list of instance - methods defined in the - category. NULL indicates no - instance methods defined. */ - MethodList_t class_methods; /* Linked list of factory - methods defined in the - category. NULL indicates no - class methods defined. */ - struct objc_protocol_list *protocols; /* List of Protocols - conformed to */ -} Category, *Category_t; - -/* -** Structure used when a message is send to a class's super class. The -** compiler generates one of these structures and passes it to -** objc_msg_super. -*/ -typedef struct objc_super { - id self; /* Id of the object sending - the message. */ - Class class; /* Object's super class. */ -} Super, *Super_t; - -IMP objc_msg_lookup_super(Super_t super, SEL sel); - -retval_t objc_msg_sendv(id, SEL, arglist_t); - - - -/* -** This is a hook which is called by objc_lookup_class and -** objc_get_class if the runtime is not able to find the class. -** This may e.g. try to load in the class using dynamic loading. -** The function is guaranteed to be passed a non-NULL name string. -*/ -extern Class (*_objc_lookup_class)(const char *name); - -/* -** This is a hook which is called by __objc_exec_class every time a class -** or a category is loaded into the runtime. This may e.g. help a -** dynamic loader determine the classes that have been loaded when -** an object file is dynamically linked in. -*/ -extern void (*_objc_load_callback)(Class class, Category* category); - -/* -** Hook functions for allocating, copying and disposing of instances -*/ -extern id (*_objc_object_alloc)(Class class); -extern id (*_objc_object_copy)(id object); -extern id (*_objc_object_dispose)(id object); - -/* -** Standard functions for memory allocation and disposal. -** Users should use these functions in their ObjC programs so -** that they work properly with garbage collectors as well as -** can take advantage of the exception/error handling available. -*/ -void * -objc_malloc(size_t size); - -void * -objc_atomic_malloc(size_t size); - -void * -objc_valloc(size_t size); - -void * -objc_realloc(void *mem, size_t size); - -void * -objc_calloc(size_t nelem, size_t size); - -void -objc_free(void *mem); - -/* -** Hook functions for memory allocation and disposal. -** This makes it easy to substitute garbage collection systems -** such as Boehm's GC by assigning these function pointers -** to the GC's allocation routines. By default these point -** to the ANSI standard malloc, realloc, free, etc. -** -** Users should call the normal objc routines above for -** memory allocation and disposal within their programs. -*/ -extern void *(*_objc_malloc)(size_t); -extern void *(*_objc_atomic_malloc)(size_t); -extern void *(*_objc_valloc)(size_t); -extern void *(*_objc_realloc)(void *, size_t); -extern void *(*_objc_calloc)(size_t, size_t); -extern void (*_objc_free)(void *); - -Method_t class_get_class_method(MetaClass class, SEL aSel); - -Method_t class_get_instance_method(Class class, SEL aSel); - -Class class_pose_as(Class impostor, Class superclass); - -Class objc_get_class(const char *name); - -Class objc_lookup_class(const char *name); - -Class objc_next_class(void **enum_state); - -const char *sel_get_name(SEL selector); - -const char *sel_get_type(SEL selector); - -SEL sel_get_uid(const char *name); - -SEL sel_get_any_uid(const char *name); - -SEL sel_get_any_typed_uid(const char *name); - -SEL sel_get_typed_uid(const char *name, const char*); - -SEL sel_register_name(const char *name); - -SEL sel_register_typed_name(const char *name, const char*type); - - -BOOL sel_is_mapped (SEL aSel); - -extern id class_create_instance(Class class); - -static inline const char * -class_get_class_name(Class class) -{ - return CLS_ISCLASS(class)?class->name:((class==Nil)?"Nil":0); -} - -static inline long -class_get_instance_size(Class class) -{ - return CLS_ISCLASS(class)?class->instance_size:0; -} - -static inline MetaClass -class_get_meta_class(Class class) -{ - return CLS_ISCLASS(class)?class->class_pointer:Nil; -} - -static inline Class -class_get_super_class(Class class) -{ - return CLS_ISCLASS(class)?class->super_class:Nil; -} - -static inline int -class_get_version(Class class) -{ - return CLS_ISCLASS(class)?class->version:-1; -} - -static inline BOOL -class_is_class(Class class) -{ - return CLS_ISCLASS(class); -} - -static inline BOOL -class_is_meta_class(Class class) -{ - return CLS_ISMETA(class); -} - - -static inline void -class_set_version(Class class, long version) -{ - if (CLS_ISCLASS(class)) - class->version = version; -} - -static inline void * -class_get_gc_object_type (Class class) -{ - return CLS_ISCLASS(class) ? class->gc_object_type : NULL; -} - -/* Mark the instance variable as innaccessible to the garbage collector */ -extern void class_ivar_set_gcinvisible (Class class, - const char* ivarname, - BOOL gcInvisible); - -static inline IMP -method_get_imp(Method_t method) -{ - return (method!=METHOD_NULL)?method->method_imp:(IMP)0; -} - -IMP get_imp (Class class, SEL sel); - -/* Redefine on NeXTSTEP so as not to conflict with system function */ -#ifdef __NeXT__ -#define object_copy gnu_object_copy -#define object_dispose gnu_object_dispose -#endif - -id object_copy(id object); - -id object_dispose(id object); - -static inline Class -object_get_class(id object) -{ - return ((object!=nil) - ? (CLS_ISCLASS(object->class_pointer) - ? object->class_pointer - : (CLS_ISMETA(object->class_pointer) - ? (Class)object - : Nil)) - : Nil); -} - -static inline const char * -object_get_class_name(id object) -{ - return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) - ?object->class_pointer->name - :((Class)object)->name) - :"Nil"); -} - -static inline MetaClass -object_get_meta_class(id object) -{ - return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) - ?object->class_pointer->class_pointer - :(CLS_ISMETA(object->class_pointer) - ?object->class_pointer - :Nil)) - :Nil); -} - -static inline Class -object_get_super_class -(id object) -{ - return ((object!=nil)?(CLS_ISCLASS(object->class_pointer) - ?object->class_pointer->super_class - :(CLS_ISMETA(object->class_pointer) - ?((Class)object)->super_class - :Nil)) - :Nil); -} - -static inline BOOL -object_is_class(id object) -{ - return CLS_ISCLASS((Class)object); -} - -static inline BOOL -object_is_instance(id object) -{ - return (object!=nil)&&CLS_ISCLASS(object->class_pointer); -} - -static inline BOOL -object_is_meta_class(id object) -{ - return CLS_ISMETA((Class)object); -} - -struct sarray* -objc_get_uninstalled_dtable(void); - -#endif /* not __objc_api_INCLUDE_GNU */ - - - diff --git a/contrib/libobjc/objc/objc-list.h b/contrib/libobjc/objc/objc-list.h deleted file mode 100644 index de083a5861e5..000000000000 --- a/contrib/libobjc/objc/objc-list.h +++ /dev/null @@ -1,147 +0,0 @@ -/* Generic single linked list to keep various information - Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC to produce an executable, this does not cause the resulting executable - to be covered by the GNU General Public License. This exception does not - however invalidate any other reasons why the executable file might be - covered by the GNU General Public License. */ - -#ifndef __GNU_OBJC_LIST_H -#define __GNU_OBJC_LIST_H - -struct objc_list { - void *head; - struct objc_list *tail; -}; - -/* Return a cons cell produced from (head . tail) */ - -static inline struct objc_list* -list_cons(void* head, struct objc_list* tail) -{ - struct objc_list* cell; - - cell = (struct objc_list*)objc_malloc(sizeof(struct objc_list)); - cell->head = head; - cell->tail = tail; - return cell; -} - -/* Return the length of a list, list_length(NULL) returns zero */ - -static inline int -list_length(struct objc_list* list) -{ - int i = 0; - while(list) - { - i += 1; - list = list->tail; - } - return i; -} - -/* Return the Nth element of LIST, where N count from zero. If N - larger than the list length, NULL is returned */ - -static inline void* -list_nth(int index, struct objc_list* list) -{ - while(index-- != 0) - { - if(list->tail) - list = list->tail; - else - return 0; - } - return list->head; -} - -/* Remove the element at the head by replacing it by its successor */ - -static inline void -list_remove_head(struct objc_list** list) -{ - if ((*list)->tail) - { - struct objc_list* tail = (*list)->tail; /* fetch next */ - *(*list) = *tail; /* copy next to list head */ - objc_free(tail); /* free next */ - } - else /* only one element in list */ - { - objc_free(*list); - (*list) = 0; - } -} - - -/* Remove the element with `car' set to ELEMENT */ - -static inline void -list_remove_elem(struct objc_list** list, void* elem) -{ - while (*list) { - if ((*list)->head == elem) - list_remove_head(list); - list = &((*list)->tail); - } -} - -/* Map FUNCTION over all elements in LIST */ - -static inline void -list_mapcar(struct objc_list* list, void(*function)(void*)) -{ - while(list) - { - (*function)(list->head); - list = list->tail; - } -} - -/* Return element that has ELEM as car */ - -static inline struct objc_list** -list_find(struct objc_list** list, void* elem) -{ - while(*list) - { - if ((*list)->head == elem) - return list; - list = &((*list)->tail); - } - return NULL; -} - -/* Free list (backwards recursive) */ - -static void -list_free(struct objc_list* list) -{ - if(list) - { - list_free(list->tail); - objc_free(list); - } -} -#endif /* not __GNU_OBJC_LIST_H */ diff --git a/contrib/libobjc/objc/objc.h b/contrib/libobjc/objc/objc.h deleted file mode 100644 index 79b2519e5765..000000000000 --- a/contrib/libobjc/objc/objc.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Basic data types for Objective C. - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -#ifndef __objc_INCLUDE_GNU -#define __objc_INCLUDE_GNU - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stddef.h> - -/* -** Definition of the boolean type. -*/ -#ifdef __vxworks -typedef int BOOL; -#else -typedef unsigned char BOOL; -#endif -#define YES (BOOL)1 -#define NO (BOOL)0 - -/* -** Definition of a selector. Selectors themselves are not unique, but -** the sel_id is a unique identifier. -*/ -typedef const struct objc_selector -{ - void *sel_id; - const char *sel_types; -} *SEL; - -inline static BOOL -sel_eq (SEL s1, SEL s2) -{ - if (s1 == 0 || s2 == 0) - return s1 == s2; - else - return s1->sel_id == s2->sel_id; -} - - -/* -** ObjC uses this typedef for untyped instances. -*/ -typedef struct objc_object { - struct objc_class* class_pointer; -} *id; - -/* -** Definition of method type. When retrieving the implementation of a -** method, this is type of the pointer returned -*/ -typedef id (*IMP)(id, SEL, ...); - -/* -** More simple types... -*/ -#define nil (id)0 /* id of Nil instance */ -#define Nil (Class)0 /* id of Nil class */ -typedef char *STR; /* String alias */ - -/* -** The compiler generates one of these structures for each class. -** -** This structure is the definition for classes. -** -** This structure is generated by the compiler in the executable and used by -** the run-time during normal messaging operations. Therefore some members -** change type. The compiler generates "char* const" and places a string in -** the following member variables: super_class. -*/ -typedef struct objc_class *MetaClass; -typedef struct objc_class *Class; -struct objc_class { - MetaClass class_pointer; /* Pointer to the class's - meta class. */ - struct objc_class* super_class; /* Pointer to the super - class. NULL for class - Object. */ - const char* name; /* Name of the class. */ - long version; /* Unknown. */ - unsigned long info; /* Bit mask. See class masks - defined above. */ - long instance_size; /* Size in bytes of the class. - The sum of the class - definition and all super - class definitions. */ - struct objc_ivar_list* ivars; /* Pointer to a structure that - describes the instance - variables in the class - definition. NULL indicates - no instance variables. Does - not include super class - variables. */ - struct objc_method_list* methods; /* Linked list of instance - methods defined for the - class. */ - struct sarray * dtable; /* Pointer to instance - method dispatch table. */ - struct objc_class* subclass_list; /* Subclasses */ - struct objc_class* sibling_class; - - struct objc_protocol_list *protocols; /* Protocols conformed to */ - void* gc_object_type; -}; - -#ifndef __OBJC__ -typedef struct objc_protocol { - struct objc_class* class_pointer; - char *protocol_name; - struct objc_protocol_list *protocol_list; - struct objc_method_description_list *instance_methods, *class_methods; -} Protocol; - -#else /* __OBJC__ */ -@class Protocol; -#endif - -typedef void* retval_t; /* return value */ -typedef void(*apply_t)(void); /* function pointer */ -typedef union { - char *arg_ptr; - char arg_regs[sizeof (char*)]; -} *arglist_t; /* argument frame */ - - -IMP objc_msg_lookup(id receiver, SEL op); - -#ifdef __cplusplus -} -#endif - -#endif /* not __objc_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/runtime.h b/contrib/libobjc/objc/runtime.h deleted file mode 100644 index b0eae4a222d3..000000000000 --- a/contrib/libobjc/objc/runtime.h +++ /dev/null @@ -1,88 +0,0 @@ -/* GNU Objective C Runtime internal declarations - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC 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 General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled with - GCC to produce an executable, this does not cause the resulting executable - to be covered by the GNU General Public License. This exception does not - however invalidate any other reasons why the executable file might be - covered by the GNU General Public License. */ - -#ifndef __objc_runtime_INCLUDE_GNU -#define __objc_runtime_INCLUDE_GNU - -#include <stdarg.h> /* for varargs and va_list's */ - -#include <stdio.h> -#include <ctype.h> - -#include <stddef.h> /* so noone else will get system versions */ -#include "assert.h" - -#include "objc/objc.h" /* core data types */ -#include "objc/objc-api.h" /* runtime api functions */ - -#include "objc/thr.h" /* thread and mutex support */ - -#include "objc/hash.h" /* hash structures */ -#include "objc/objc-list.h" /* linear lists */ - -extern void __objc_add_class_to_hash(Class); /* (objc-class.c) */ -extern void __objc_init_selector_tables(void); /* (objc-sel.c) */ -extern void __objc_init_class_tables(void); /* (objc-class.c) */ -extern void __objc_init_dispatch_tables(void); /* (objc-dispatch.c) */ -extern void __objc_install_premature_dtable(Class); /* (objc-dispatch.c) */ -extern void __objc_resolve_class_links(void); /* (objc-class.c) */ -extern void __objc_register_selectors_from_class(Class); /* (objc-sel.c) */ -extern void __objc_update_dispatch_table_for_class (Class);/* (objc-msg.c) */ - -extern int __objc_init_thread_system(void); /* thread.c */ -extern int __objc_fini_thread_system(void); /* thread.c */ -extern void __objc_print_dtable_stats(void); /* sendmsg.c */ - -extern void class_add_method_list(Class, MethodList_t); - -/* Registering instance methods as class methods for root classes */ -extern void __objc_register_instance_methods_to_class(Class); -extern Method_t search_for_method_in_list(MethodList_t list, SEL op); - -/* True when class links has been resolved */ -extern BOOL __objc_class_links_resolved; - -/* Number of selectors stored in each of the selector tables */ -extern int __objc_selector_max_index; - -/* Mutex locking __objc_selector_max_index and its arrays. */ -extern objc_mutex_t __objc_runtime_mutex; - -/* Number of threads which are alive. */ -extern int __objc_runtime_threads_alive; - -#ifdef DEBUG -#define DEBUG_PRINTF(format, args...) printf (format, ## args) -#else -#define DEBUG_PRINTF(format, args...) -#endif - -BOOL __objc_responds_to (id object, SEL sel); /* for internal use only! */ -SEL __sel_register_typed_name (const char*, const char*, - struct objc_selector*, BOOL is_const); - -#endif /* not __objc_runtime_INCLUDE_GNU */ - - diff --git a/contrib/libobjc/objc/sarray.h b/contrib/libobjc/objc/sarray.h deleted file mode 100644 index 17da27203641..000000000000 --- a/contrib/libobjc/objc/sarray.h +++ /dev/null @@ -1,237 +0,0 @@ -/* Sparse Arrays for Objective C dispatch tables - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -#ifndef __sarray_INCLUDE_GNU -#define __sarray_INCLUDE_GNU - -#define OBJC_SPARSE2 /* 2-level sparse array */ -/* #define OBJC_SPARSE3 */ /* 3-level sparse array */ - -#ifdef OBJC_SPARSE2 -extern const char* __objc_sparse2_id; -#endif - -#ifdef OBJC_SPARSE3 -extern const char* __objc_sparse3_id; -#endif - -#include <stddef.h> - -#include "objc/thr.h" - -extern int nbuckets; /* for stats */ -extern int nindices; -extern int narrays; -extern int idxsize; - -#include <assert.h> - -/* An unsigned integer of same size as a pointer */ -#define SIZET_BITS (sizeof(size_t)*8) - -#if defined(__sparc__) || defined(OBJC_SPARSE2) -#define PRECOMPUTE_SELECTORS -#endif - -#ifdef OBJC_SPARSE3 - -/* Buckets are 8 words each */ -#define BUCKET_BITS 3 -#define BUCKET_SIZE (1<<BUCKET_BITS) -#define BUCKET_MASK (BUCKET_SIZE-1) - -/* Indices are 16 words each */ -#define INDEX_BITS 4 -#define INDEX_SIZE (1<<INDEX_BITS) -#define INDEX_MASK (INDEX_SIZE-1) - -#define INDEX_CAPACITY (BUCKET_SIZE*INDEX_SIZE) - -#else /* OBJC_SPARSE2 */ - -/* Buckets are 32 words each */ -#define BUCKET_BITS 5 -#define BUCKET_SIZE (1<<BUCKET_BITS) -#define BUCKET_MASK (BUCKET_SIZE-1) - -#endif /* OBJC_SPARSE2 */ - -typedef size_t sidx; - -#ifdef PRECOMPUTE_SELECTORS - -struct soffset { -#ifdef OBJC_SPARSE3 - unsigned int unused : SIZET_BITS/4; - unsigned int eoffset : SIZET_BITS/4; - unsigned int boffset : SIZET_BITS/4; - unsigned int ioffset : SIZET_BITS/4; -#else /* OBJC_SPARSE2 */ -#ifdef __sparc__ - unsigned long boffset : (SIZET_BITS - 2) - BUCKET_BITS; - unsigned int eoffset : BUCKET_BITS; - unsigned int unused : 2; -#else - unsigned int boffset : SIZET_BITS/2; - unsigned int eoffset : SIZET_BITS/2; -#endif -#endif /* OBJC_SPARSE2 */ -}; - -union sofftype { - struct soffset off; - sidx idx; -}; - -#endif /* not PRECOMPUTE_SELECTORS */ - -union sversion { - int version; - void *next_free; -}; - -struct sbucket { - void* elems[BUCKET_SIZE]; /* elements stored in array */ - union sversion version; /* used for copy-on-write */ -}; - -#ifdef OBJC_SPARSE3 - -struct sindex { - struct sbucket* buckets[INDEX_SIZE]; - union sversion version; /* used for copy-on-write */ -}; - -#endif /* OBJC_SPARSE3 */ - -struct sarray { -#ifdef OBJC_SPARSE3 - struct sindex** indices; - struct sindex* empty_index; -#else /* OBJC_SPARSE2 */ - struct sbucket** buckets; -#endif /* OBJC_SPARSE2 */ - struct sbucket* empty_bucket; - union sversion version; /* used for copy-on-write */ - short ref_count; - struct sarray* is_copy_of; - size_t capacity; -}; - -struct sarray* sarray_new(int, void* default_element); -void sarray_free(struct sarray*); -struct sarray* sarray_lazy_copy(struct sarray*); -void sarray_realloc(struct sarray*, int new_size); -void sarray_at_put(struct sarray*, sidx index, void* elem); -void sarray_at_put_safe(struct sarray*, sidx index, void* elem); - -struct sarray* sarray_hard_copy(struct sarray*); /* ... like the name? */ -void sarray_remove_garbage(void); - - -#ifdef PRECOMPUTE_SELECTORS -/* Transform soffset values to ints and vica verca */ -static inline unsigned int -soffset_decode(sidx index) -{ - union sofftype x; - x.idx = index; -#ifdef OBJC_SPARSE3 - return x.off.eoffset - + (x.off.boffset*BUCKET_SIZE) - + (x.off.ioffset*INDEX_CAPACITY); -#else /* OBJC_SPARSE2 */ - return x.off.eoffset + (x.off.boffset*BUCKET_SIZE); -#endif /* OBJC_SPARSE2 */ -} - -static inline sidx -soffset_encode(size_t offset) -{ - union sofftype x; - x.off.eoffset = offset%BUCKET_SIZE; -#ifdef OBJC_SPARSE3 - x.off.boffset = (offset/BUCKET_SIZE)%INDEX_SIZE; - x.off.ioffset = offset/INDEX_CAPACITY; -#else /* OBJC_SPARSE2 */ - x.off.boffset = offset/BUCKET_SIZE; -#endif - return (sidx)x.idx; -} - -#else /* not PRECOMPUTE_SELECTORS */ - -static inline size_t -soffset_decode(sidx index) -{ - return index; -} - -static inline sidx -soffset_encode(size_t offset) -{ - return offset; -} -#endif /* not PRECOMPUTE_SELECTORS */ - -/* Get element from the Sparse array `array' at offset `index' */ - -static inline void* sarray_get(struct sarray* array, sidx index) -{ -#ifdef PRECOMPUTE_SELECTORS - union sofftype x; - x.idx = index; -#ifdef OBJC_SPARSE3 - return - array-> - indices[x.off.ioffset]-> - buckets[x.off.boffset]-> - elems[x.off.eoffset]; -#else /* OBJC_SPARSE2 */ - return array->buckets[x.off.boffset]->elems[x.off.eoffset]; -#endif /* OBJC_SPARSE2 */ -#else /* not PRECOMPUTE_SELECTORS */ -#ifdef OBJC_SPARSE3 - return array-> - indices[index/INDEX_CAPACITY]-> - buckets[(index/BUCKET_SIZE)%INDEX_SIZE]-> - elems[index%BUCKET_SIZE]; -#else /* OBJC_SPARSE2 */ - return array->buckets[index/BUCKET_SIZE]->elems[index%BUCKET_SIZE]; -#endif /* not OBJC_SPARSE3 */ -#endif /* not PRECOMPUTE_SELECTORS */ -} - -static inline void* sarray_get_safe(struct sarray* array, sidx index) -{ - if(soffset_decode(index) < array->capacity) - return sarray_get(array, index); - else - return (array->empty_bucket->elems[0]); -} - -#endif /* __sarray_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/thr.h b/contrib/libobjc/objc/thr.h deleted file mode 100644 index f904733695a8..000000000000 --- a/contrib/libobjc/objc/thr.h +++ /dev/null @@ -1,143 +0,0 @@ -/* Thread and mutex controls for Objective C. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 General Public License for more details. - -GNU CC is free software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the Free Software -Foundation; either version 2, or (at your option) any later version. - -GNU CC 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 General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files - compiled with GCC to produce an executable, this does not cause - the resulting executable to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - - -#ifndef __thread_INCLUDE_GNU -#define __thread_INCLUDE_GNU - -#include "objc/objc.h" - -/************************************************************************* - * Universal static variables: - */ -extern int __objc_thread_exit_status; /* Global exit status. */ - -/******** - * Thread safe implementation types and functions. - */ - -/* Thread priorities */ -#define OBJC_THREAD_INTERACTIVE_PRIORITY 2 -#define OBJC_THREAD_BACKGROUND_PRIORITY 1 -#define OBJC_THREAD_LOW_PRIORITY 0 - -/* A thread */ -typedef void * objc_thread_t; - -/* This structure represents a single mutual exclusion lock. */ -struct objc_mutex -{ - volatile objc_thread_t owner; /* Id of thread that owns. */ - volatile int depth; /* # of acquires. */ - void * backend; /* Specific to backend */ -}; -typedef struct objc_mutex *objc_mutex_t; - -/* This structure represents a single condition mutex */ -struct objc_condition -{ - void * backend; /* Specific to backend */ -}; -typedef struct objc_condition *objc_condition_t; - -/* Frontend mutex functions */ -objc_mutex_t objc_mutex_allocate(void); -int objc_mutex_deallocate(objc_mutex_t mutex); -int objc_mutex_lock(objc_mutex_t mutex); -int objc_mutex_unlock(objc_mutex_t mutex); -int objc_mutex_trylock(objc_mutex_t mutex); - -/* Frontend condition mutex functions */ -objc_condition_t objc_condition_allocate(void); -int objc_condition_deallocate(objc_condition_t condition); -int objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex); -int objc_condition_signal(objc_condition_t condition); -int objc_condition_broadcast(objc_condition_t condition); - -/* Frontend thread functions */ -objc_thread_t objc_thread_detach(SEL selector, id object, id argument); -void objc_thread_yield(void); -int objc_thread_exit(void); -int objc_thread_set_priority(int priority); -int objc_thread_get_priority(void); -void * objc_thread_get_data(void); -int objc_thread_set_data(void *value); -objc_thread_t objc_thread_id(void); - -/* - Use this to set the hook function that will be called when the - runtime initially becomes multi threaded. - The hook function is only called once, meaning only when the - 2nd thread is spawned, not for each and every thread. - - It returns the previous hook function or NULL if there is none. - - A program outside of the runtime could set this to some function so - it can be informed; for example, the GNUstep Base Library sets it - so it can implement the NSBecomingMultiThreaded notification. - */ -typedef void (*objc_thread_callback)(); -objc_thread_callback objc_set_thread_callback(objc_thread_callback func); - -/* Backend initialization functions */ -int __objc_init_thread_system(void); -int __objc_fini_thread_system(void); - -/* Backend mutex functions */ -int __objc_mutex_allocate(objc_mutex_t mutex); -int __objc_mutex_deallocate(objc_mutex_t mutex); -int __objc_mutex_lock(objc_mutex_t mutex); -int __objc_mutex_trylock(objc_mutex_t mutex); -int __objc_mutex_unlock(objc_mutex_t mutex); - -/* Backend condition mutex functions */ -int __objc_condition_allocate(objc_condition_t condition); -int __objc_condition_deallocate(objc_condition_t condition); -int __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex); -int __objc_condition_broadcast(objc_condition_t condition); -int __objc_condition_signal(objc_condition_t condition); - -/* Backend thread functions */ -objc_thread_t __objc_thread_detach(void (*func)(void *arg), void *arg); -int __objc_thread_set_priority(int priority); -int __objc_thread_get_priority(void); -void __objc_thread_yield(void); -int __objc_thread_exit(void); -objc_thread_t __objc_thread_id(void); -int __objc_thread_set_data(void *value); -void * __objc_thread_get_data(void); - -#endif /* not __thread_INCLUDE_GNU */ diff --git a/contrib/libobjc/objc/typedstream.h b/contrib/libobjc/objc/typedstream.h deleted file mode 100644 index eb4642f344be..000000000000 --- a/contrib/libobjc/objc/typedstream.h +++ /dev/null @@ -1,132 +0,0 @@ -/* GNU Objective-C Typed Streams interface. - Copyright (C) 1993, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -GNU CC 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 General Public -License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with files compiled - with GCC to produce an executable, this does not cause the resulting - executable to be covered by the GNU General Public License. This - exception does not however invalidate any other reasons why the - executable file might be covered by the GNU General Public License. */ - -#ifndef __typedstream_INCLUDE_GNU -#define __typedstream_INCLUDE_GNU - -#include "objc/objc.h" -#include "objc/hash.h" -#include <stdio.h> - -typedef int (*objc_typed_read_func)(void*, char*, int); -typedef int (*objc_typed_write_func)(void*, const char*, int); -typedef int (*objc_typed_flush_func)(void*); -typedef int (*objc_typed_eof_func)(void*); - -#define OBJC_READONLY 0x01 -#define OBJC_WRITEONLY 0x02 - -#define OBJC_MANAGED_STREAM 0x01 -#define OBJC_FILE_STREAM 0x02 -#define OBJC_MEMORY_STREAM 0x04 - -#define OBJC_TYPED_STREAM_VERSION 0x01 - -typedef struct objc_typed_stream { - void* physical; - cache_ptr object_table; /* read/written objects */ - cache_ptr stream_table; /* other read/written but shared things.. */ - cache_ptr class_table; /* class version mapping */ - cache_ptr object_refs; /* forward references */ - int mode; /* OBJC_READONLY or OBJC_WRITEONLY */ - int type; /* MANAGED, FILE, MEMORY etc bit string */ - int version; /* version used when writing */ - int writing_root_p; - objc_typed_read_func read; - objc_typed_write_func write; - objc_typed_eof_func eof; - objc_typed_flush_func flush; -} TypedStream; - -/* opcode masks */ -#define _B_VALUE 0x1fU -#define _B_CODE 0xe0U -#define _B_SIGN 0x10U -#define _B_NUMBER 0x0fU - -/* standard opcodes */ -#define _B_INVALID 0x00U -#define _B_SINT 0x20U -#define _B_NINT 0x40U -#define _B_SSTR 0x60U -#define _B_NSTR 0x80U -#define _B_RCOMM 0xa0U -#define _B_UCOMM 0xc0U -#define _B_EXT 0xe0U - -/* eXtension opcodes */ -#define _BX_OBJECT 0x00U -#define _BX_CLASS 0x01U -#define _BX_SEL 0x02U -#define _BX_OBJREF 0x03U -#define _BX_OBJROOT 0x04U -#define _BX_EXT 0x1fU - -/* -** Read and write objects as specified by TYPE. All the `last' -** arguments are pointers to the objects to read/write. -*/ - -int objc_write_type (TypedStream* stream, const char* type, const void* data); -int objc_read_type (TypedStream* stream, const char* type, void* data); - -int objc_write_types (TypedStream* stream, const char* type, ...); -int objc_read_types (TypedStream* stream, const char* type, ...); - -int objc_write_object_reference (TypedStream* stream, id object); -int objc_write_root_object (TypedStream* stream, id object); - -long objc_get_stream_class_version (TypedStream* stream, Class class); - - -/* -** Convenience functions -*/ - -int objc_write_array (TypedStream* stream, const char* type, - int count, const void* data); -int objc_read_array (TypedStream* stream, const char* type, - int count, void* data); - -int objc_write_object (TypedStream* stream, id object); -int objc_read_object (TypedStream* stream, id* object); - - - -/* -** Open a typed stream for reading or writing. MODE may be either of -** OBJC_READONLY or OBJC_WRITEONLY. -*/ - -TypedStream* objc_open_typed_stream (FILE* physical, int mode); -TypedStream* objc_open_typed_stream_for_file (const char* file_name, int mode); - -void objc_close_typed_stream (TypedStream* stream); - -BOOL objc_end_of_typed_stream (TypedStream* stream); -void objc_flush_typed_stream (TypedStream* stream); - -#endif /* not __typedstream_INCLUDE_GNU */ |