diff --git a/ChangeLog b/ChangeLog index df704f59a..18936768a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +1999-02-09 Adam Fedor + + * Source/HashTable.m: Moved to extensions. + * Source/List.m, Source/NXStringTable*, Source/Storage.m, + Source/objc/HashTable.h, Source/objc/List.h, + Source/objc/NXStringTable.h, Source/objc/Storage.h: + Likewise. + Tue Feb 9 14:08:00 1999 Richard Frith-Macdonald * Source/NSProcessInfo.m: Fixed login in #if construct so things diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 1052f5a10..ef1d41508 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -251,29 +251,6 @@ RNGBerkeley.h \ RandomGenerating.h \ Time.h -# NEXTSTEP source files - -NEXTSTEP_MFILES = \ -HashTable.m \ -List.m \ -NXStringTable.m \ -Storage.m - -NEXTSTEP_CFILES = - -NEXTSTEP_DERIVED_CFILES = \ -NXStringTable_scan.c - -NEXTSTEP_OTHER_SRCFILES = \ -NXStringTable_scan.l - -NEXTSTEP_HEADERS = \ -objc/HashTable.h \ -objc/List.h \ -objc/NXStringTable.h \ -objc/Storage.h \ -objc/zone.h - # GNUStep source files BASE_MFILES = \ diff --git a/Source/HashTable.m b/Source/HashTable.m deleted file mode 100644 index 3933fb04a..000000000 --- a/Source/HashTable.m +++ /dev/null @@ -1,362 +0,0 @@ -/* Implementation of Objective C NeXT-compatible HashTable object - Copyright (C) 1993,1994 Free Software Foundation, Inc. - - Written by: Andrew Kachites McCallum - Date: May 1993 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include - -#define DEFAULT_HASH_CAPACITY 32 - - -/* Some useful hash and compare functions not provided by hash.h */ - -static inline unsigned int -hash_object (cache_ptr cache, const void *key) -{ - return (([((id)key) hash]) & cache->mask); -} - -static inline int -compare_objects (const void *k1, const void *k2) -{ - return (int)[(id)k1 isEqual:(id)k2]; -} - -static inline unsigned int -hash_int (cache_ptr cache, const void *key) -{ - return ((unsigned int)key & cache->mask); -} - -static inline int -compare_ints (const void *k1, const void *k2) -{ - return !((int)k1 - (int)k2); -} - -static inline int -compare_long_ints (const void *k1, const void *k2) -{ - return !((long int)k1 - (long int)k2); -} - -@implementation HashTable - -+ initialize -{ - if (self == [HashTable class]) - [self setVersion:0]; /* beta release */ - return self; -} - -- initKeyDesc: (const char *)aKeyDesc - valueDesc: (const char *)aValueDesc - capacity: (unsigned) aCapacity -{ - hash_func_type hf; - compare_func_type cf; - - if (!aKeyDesc) - [self error:"in %s, NULL keyDesc\n", sel_get_name(_cmd)]; - if (!aValueDesc) - [self error:"in %s, NULL valueDesc\n", sel_get_name(_cmd)]; - count = 0; - keyDesc = aKeyDesc; - valueDesc = aValueDesc; - switch (*aKeyDesc) - { - case _C_ATOM: - case _C_CHARPTR : - hf = (hash_func_type)hash_string; - cf = (compare_func_type)compare_strings; - break; - case _C_ID: - case _C_CLASS: - hf = (hash_func_type)hash_object; - cf = (compare_func_type)compare_objects; - break; - case _C_PTR: - hf = (hash_func_type)hash_ptr; - cf = (compare_func_type)compare_ptrs; - break; - case _C_INT: - case _C_SEL: - case _C_UINT: - hf = (hash_func_type)hash_int; - cf = (compare_func_type)compare_ints; - break; - case _C_LNG: - case _C_ULNG: - hf = (hash_func_type)hash_int; - cf = (compare_func_type)compare_long_ints; - break; - case _C_FLT: - /* Fix this. Do something better with floats. */ - hf = (hash_func_type)hash_int; - cf = (compare_func_type)compare_ints; - break; - default: - hf = (hash_func_type)hash_int; - cf = (compare_func_type)compare_ints; - break; - } - _buckets = hash_new(aCapacity, hf, cf); - _nbBuckets = _buckets->size; - return self; -} - -- initKeyDesc:(const char *)aKeyDesc - valueDesc:(const char *)aValueDesc -{ - return [self initKeyDesc:aKeyDesc - valueDesc:aValueDesc - capacity:DEFAULT_HASH_CAPACITY]; -} - -- initKeyDesc: (const char *)aKeyDesc -{ - return [self initKeyDesc:aKeyDesc - valueDesc:@encode(id)]; -} - -- init -{ - return [self initKeyDesc:@encode(id)]; -} - -- free -{ - hash_delete(_buckets); - return [super free]; -} - -- freeObjects -{ - node_ptr node; - void *val; - - while ((node = hash_next(_buckets, 0))) - { - val = node->value; - hash_remove(_buckets, node->key); - if (*valueDesc == _C_ID) - [(id)val free]; - } - count = 0; - _nbBuckets = _buckets->size; - return self; -} - -- freeKeys:(void (*) (void *))keyFunc - values:(void (*) (void *))valueFunc -{ - /* What exactly is this supposed to do? */ - [self notImplemented:_cmd]; - return self; -} - -- empty -{ - node_ptr node; - - while ((node = hash_next(_buckets, 0))) - hash_remove(_buckets, node->key); - count = 0; - _nbBuckets = _buckets->size; - return self; -} - -- shallowCopy -{ - HashTable *c; - node_ptr node; - - c = [super shallowCopy]; - c->_buckets = hash_new(_buckets->size, - _buckets->hash_func, - _buckets->compare_func); - /* copy nodes to new copy */ - node = 0; - while ((node = hash_next(_buckets, node))) - [c insertKey:node->key value:node->value]; - - return c; -} - -- deepen -{ - node_ptr node = 0; - - if (*valueDesc == _C_ID) - { - while ((node = hash_next(_buckets, node))) - { - node->value = [(id)(node->value) deepCopy]; - } - } - /* If the hashtable contains strings should we copy them too?? - But we definitely shouldn't copy "%" keys. */ - return self; -} - -- (unsigned) count -{ - return count; -} - -- (BOOL) isKey:(const void *)aKey -{ - return hash_is_key_in_hash(_buckets, aKey); -} - -- (void *) valueForKey:(const void *)aKey -{ - return hash_value_for_key(_buckets, aKey); -} - -- (void *) insertKey:(const void *)aKey value:(void *)aValue -{ - void *prevValue; - - prevValue = hash_value_for_key(_buckets, aKey); - if (prevValue) - hash_remove(_buckets, aKey); - hash_add(&_buckets, aKey, aValue); - count = _buckets->used; - _nbBuckets = _buckets->size; - return prevValue; -} - -- (void *) removeKey:(const void *)aKey -{ - if (hash_value_for_key(_buckets, aKey)) - { - hash_remove(_buckets, aKey); - count = _buckets->used; - _nbBuckets = _buckets->size; - } - return nil; -} - -- (NXHashState) initState -{ - return (NXHashState) 0; -} - -- (BOOL) nextState:(NXHashState *)aState - key:(const void **)aKey - value:(void **)aValue -{ - *aState = hash_next(_buckets, *aState); - if (*aState) - { - *aKey = (*aState)->key; - *aValue = (*aState)->value; - return YES; - } - else - return NO; -} - -- write: (TypedStream*)aStream -{ - NXHashState state = [self initState]; - const void *k; - void *v; - - if (!strcmp(keyDesc, "%")) - [self error:"Archiving atom strings, @encode()=\"%\", not yet handled"]; - [super write: aStream]; - objc_write_types(aStream, "II**", - [self count], _nbBuckets, keyDesc, valueDesc); - while ([self nextState:&state key:&k value:&v]) - { - objc_write_type(aStream, keyDesc, &k); - objc_write_type(aStream, valueDesc, &v); - } - return self; -} - -- read: (TypedStream*)aStream -{ - unsigned cnt, capacity; - int i; - const void *k; - void *v; - - [super read:aStream]; - objc_read_types(aStream, "II**", - &cnt, &capacity, &keyDesc, &valueDesc); - if (!strcmp(keyDesc, "%")) - [self error:"Archiving atom strings, @encode()=\"%\", not yet handled"]; - [self initKeyDesc:keyDesc valueDesc:valueDesc capacity:capacity]; - for (i = 0; i < cnt; i++) - { - objc_read_type(aStream, keyDesc, &k); - objc_read_type(aStream, valueDesc, &v); - [self insertKey:k value:v]; - } - return self; -} - - -+ newKeyDesc: (const char *)aKeyDesc -{ - return [[[self class] alloc] initKeyDesc:aKeyDesc]; -} - -+ newKeyDesc:(const char *)aKeyDesc - valueDesc:(const char *)aValueDesc -{ - return [[self alloc] - initKeyDesc:aKeyDesc - valueDesc:aValueDesc]; -} - -+ newKeyDesc:(const char *)aKeyDesc - valueDesc:(const char *)aValueDesc - capacity:(unsigned)aCapacity -{ - return [[self alloc] - initKeyDesc:aKeyDesc - valueDesc:aValueDesc - capacity:aCapacity]; -} - -- makeObjectsPerform:(SEL)aSel -{ - node_ptr node = 0; - - while ((node = hash_next(_buckets, node))) - [(id)(node->value) perform:aSel]; - return self; -} - -- makeObjectsPerform:(SEL)aSel with:anObject -{ - node_ptr node = 0; - - while ((node = hash_next(_buckets, node))) - [(id)(node->value) perform:aSel with:anObject]; - return self; -} - -@end diff --git a/Source/List.m b/Source/List.m deleted file mode 100644 index 9a3be2b69..000000000 --- a/Source/List.m +++ /dev/null @@ -1,358 +0,0 @@ -/* Implementation of Objective-C NeXT-compatible List object - Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. - - This file is part of the GNUstep Base Library. - - Written by: Andrew Kachites McCallum - Date: May 1993 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include - -/* Change this #define to 0 if you want -makeObjectsPerform: and - -makeObjectsPerform:with: to access content objects in order - from lower indices to higher indices. - If you want the NeXTSTEP behavior, leave the #define as 1. */ -#define LIST_PERFORM_REVERSE_ORDER_DEFAULT 1 - -#define LIST_GROW_FACTOR 2 - - -/* memcpy() is a gcc builtin */ - - -/* Do this before adding an element */ -static inline void -incrementCount(List *self) -{ - (self->numElements)++; - if (self->numElements >= self->maxElements) - { - [self setAvailableCapacity:(self->numElements) * LIST_GROW_FACTOR]; - } -} - -/* Do this after removing an element */ -static inline void -decrementCount(List *self) -{ - (self->numElements)--; - if (self->numElements < (self->maxElements) / LIST_GROW_FACTOR) - { - [self setAvailableCapacity:(self->maxElements) / LIST_GROW_FACTOR]; - } -} - -@implementation List - -+ initialize -{ - if (self == [List class]) - [self setVersion:0]; /* beta release */ - return self; -} - -// INITIALIZING, FREEING; - -- initCount:(unsigned)numSlots; -{ - [super init]; - numElements = 0; - maxElements = numSlots; - OBJC_MALLOC(dataPtr, id, maxElements); - return self; -} - -- init -{ - return [self initCount:2]; -} - - -- free -{ - if (dataPtr) - OBJC_FREE(dataPtr); - return [super free]; -} - -- freeObjects -{ - [self makeObjectsPerform:@selector(free)]; - [self empty]; - return self; -} - -// COPYING; - -- copy -{ - return [self shallowCopy]; -} - -- shallowCopy -{ - List *c = [super shallowCopy]; - OBJC_MALLOC(c->dataPtr, id, maxElements); - memcpy(c->dataPtr, dataPtr, numElements * sizeof(id *)); - return c; -} - -- deepen -{ - int i; - - for (i = 0; i < numElements; i++) - { - dataPtr[i] = [dataPtr[i] deepCopy]; - } - return self; -} - -// COMPARING TWO LISTS; - -- (BOOL)isEqual: anObject -{ - int i; - - if ( (![anObject isKindOf:[List class]]) - || ([self count] != [anObject count])) - return NO; - for (i = 0; i < numElements; i++) - /* NeXT documentation says to compare id's. */ - if ( dataPtr[i] != [anObject objectAt:i] ) - return NO; - return YES; -} - -// MANAGING THE STORAGE CAPACITY; - -- (unsigned)capacity -{ - return maxElements; -} - -- setAvailableCapacity:(unsigned)numSlots -{ - if (numSlots > numElements) - { - maxElements = numSlots; - OBJC_REALLOC(dataPtr, id, maxElements); - return self; - } - return nil; -} - - -/* Manipulating objects by index */ - -#define CHECK_INDEX(IND) if ((IND) >= numElements) return nil -#define CHECK_OBJECT(OBJ) if (!(OBJ)) return nil - -- (unsigned)count -{ - return numElements; -} - -- objectAt:(unsigned)index -{ - CHECK_INDEX(index); - return dataPtr[index]; -} - -- lastObject -{ - if (numElements) - return dataPtr[numElements-1]; - else - return nil; -} - -- addObject:anObject -{ - [self insertObject:anObject at:numElements]; - return self; -} - -- insertObject:anObject at:(unsigned)index -{ - int i; - - if (index > 0) { - CHECK_INDEX(index-1); - } - CHECK_OBJECT(anObject); - incrementCount(self); - for (i = numElements-1; i > index; i--) - dataPtr[i] = dataPtr[i-1]; - dataPtr[i] = anObject; - return self; -} - -- removeObjectAt:(unsigned)index -{ - id oldObject; - int i; - - CHECK_INDEX(index); - oldObject = dataPtr[index]; - for (i = index; i < numElements-1; i++) - dataPtr[i] = dataPtr[i+1]; - decrementCount(self); - return oldObject; -} - -- removeLastObject -{ - if (numElements) - return [self removeObjectAt:numElements-1]; - return nil; -} - -- replaceObjectAt:(unsigned)index with:newObject -{ - id oldObject; - - CHECK_INDEX(index); - CHECK_OBJECT(newObject); - oldObject = dataPtr[index]; - dataPtr[index] = newObject; - return oldObject; -} - -/* Inefficient to send objectAt: each time, but it handles subclasses - of List nicely. */ -- appendList: (List *)otherList -{ - int i, c; - - c = [otherList count]; - /* Should we do something like this for efficiency? - [self setCapacity:numElements+c]; */ - for (i = 0; i < c; i++) - [self addObject:[otherList objectAt:i]]; - return self; -} - -/* Manipulating objects by id */ - -- (unsigned) indexOf:anObject -{ - int i; - - for (i = 0; i < numElements; i++) - if ([dataPtr[i] isEqual:anObject]) - return i; - return NX_NOT_IN_LIST; -} - -- addObjectIfAbsent:anObject -{ - CHECK_OBJECT(anObject); - if ([self indexOf:anObject] == NX_NOT_IN_LIST) - [self addObject:anObject]; - return self; -} - -- removeObject:anObject -{ - CHECK_OBJECT(anObject); - return [self removeObjectAt:[self indexOf:anObject]]; -} - -- replaceObject:anObject with:newObject -{ - return [self replaceObjectAt:[self indexOf:anObject] - with:newObject]; -} - -/* Emptying the list */ - -- empty -{ - int i; - - for (i = 0; i < numElements; i++) - dataPtr[i] = nil; - numElements = 0; - return self; -} - -/* Archiving */ - -- write: (TypedStream*)aStream -{ - [super write: aStream]; - objc_write_types (aStream, "II", &numElements, &maxElements); - objc_write_array (aStream, "@", numElements, dataPtr); - return self; -} - -- read: (TypedStream*)aStream -{ - [super read: aStream]; - objc_read_types (aStream, "II", &numElements, &maxElements); - OBJC_MALLOC(dataPtr, id, maxElements); - objc_read_array (aStream, "@", numElements, dataPtr); - return self; -} - -/* Sending messages to elements of the list */ - -- makeObjectsPerform:(SEL)aSel -{ - int i; - - /* For better interaction with List subclasses, we could use - objectAt: instead of accessing dataPtr directly. */ -#if (LIST_PERFORM_REVERSE_ORDER_DEFAULT) - for (i = numElements-1; i >= 0; i--) - [dataPtr[i] perform:aSel]; -#else - for (i = 0; i < numElements; i++) - [dataPtr[i] perform:aSel]; -#endif /* LIST_PERFORM_REVERSE_ORDER_DEFAULT */ - return self; -} - -- makeObjectsPerform:(SEL)aSel with:anObject -{ - int i; - - /* For better interaction with List subclasses, we could use - objectAt: instead of accessing dataPtr directly. */ -#if (LIST_PERFORM_REVERSE_ORDER_DEFAULT) - for (i = numElements-1; i >= 0; i--) - [dataPtr[i] perform:aSel with:anObject]; -#else - for (i = 0; i < numElements; i++) - [dataPtr[i] perform:aSel with:anObject]; -#endif /* LIST_PERFORM_REVERSE_ORDER_DEFAULT */ - return self; -} - - -/* Old-style creation */ - -+ newCount:(unsigned)numSlots -{ - return [[self alloc] initCount:numSlots]; -} - -@end diff --git a/Source/Makefile.postamble b/Source/Makefile.postamble index 18aa9e8b2..c7b76b6ad 100644 --- a/Source/Makefile.postamble +++ b/Source/Makefile.postamble @@ -131,13 +131,6 @@ $(NSNUMBER_MFILES) : NSConcreteNumber.m echo '#define TYPE_ORDER' `echo $@ | sed -e "s,[^0-9],,g"` >$@ cat $(srcdir)/NSConcreteNumber.m >> $@ -NXStringTable_scan.c: NXStringTable_scan.l - $(FLEX) $(LEXFLAGS) -t $(srcdir)/NXStringTable_scan.l \ - > NXStringTable_scan.temp - sed "s/yy/NXlex_/g" < NXStringTable_scan.temp \ - > NXStringTable_scan.c - $(RM) -f NXStringTable_scan.temp - $(GNUSTEP_OBJ_DIR)/objc-load${OEXT}: dynamic-load.h dynamic-load.h: ../config.status diff --git a/Source/NXStringTable.m b/Source/NXStringTable.m deleted file mode 100644 index 3b509e25c..000000000 --- a/Source/NXStringTable.m +++ /dev/null @@ -1,151 +0,0 @@ -/* Implementation for Objective C NeXT-compatible NXStringTable object - Copyright (C) 1993 Free Software Foundation, Inc. - - Written by: Adam Fedor - - This file is part of the GNU Objective-C Collection library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - StringTable - Hash table for strings in the NeXT StringTable style - - TODO: Should I reject duplicate keys on readFromStream? - the real MAX_STRINGTABLE_LENGTH is in NXStringTable.l, even though - it also appears in StringTable.h -*/ - -#include -#include -#include -#include -#include - -char * -CopyStringBuffer(const char *buf) -{ - char *out; - if (!buf) - return NULL; - OBJC_MALLOC(out, char, strlen(buf)+1); - if (out) - strcpy(out, buf); - return out; -} - -/* table_scan is a lexical parser created using flex. It parses a string - table and returns (1) every time it finds a token (the token is stored - in *str. It returns (-1) on an error or (0) when finished. Tokens are - guaranteed to alternate between Keys and Values. -*/ -#if HAVE_FLEX -extern int NXtable_scan(FILE *in_stream, FILE *out_stream, const char **str); -#else -/* Variables to export to yylex */ -FILE *NXscan_in; -FILE *NXscan_out; -char *NXscan_string; -#endif - -@implementation NXStringTable - -- init -{ - return [super initKeyDesc: "*" valueDesc: "*"]; -} - -- (const char *)valueForStringKey:(const char *)aString -{ - return [super valueForKey:aString]; -} - -- readFromStream:(FILE *)stream -{ - const char *str; - char *key = 0, *value; - int status; - BOOL gotKey = NO; - -#if HAVE_FLEX - status = NXtable_scan(stream, stderr, &str); -#else - NXscan_in = stream; - NXscan_out = stderr; - status = NXlex_lex(); - str = NXscan_string; -#endif - while (status > 0) { - if (gotKey) { - value = CopyStringBuffer(str); - [super insertKey:key value:value]; - } else - key = CopyStringBuffer(str); - gotKey = ~gotKey; -#if HAVE_FLEX - status = NXtable_scan(stream, stderr, &str); -#else - status = NXlex_lex(); -#endif - } - if (gotKey) { - OBJC_FREE(key); - return nil; - } - - return (status >= 0) ? self : nil; -} - -- readFromFile:(const char *)fileName -{ - id returnVal; - FILE *stream; - if ((stream = fopen(fileName, "r")) == NULL) { - perror("Error (NXStringTable)"); - return nil; - } - returnVal = [self readFromStream:stream]; - fclose(stream); - return returnVal; -} - -- writeToStream:(FILE *)stream -{ - const char *key; - char *value; - NXHashState state = [super initState]; - while ([super nextState: &state - key: (const void **)&key - value: (void **)&value]) - fprintf(stream, "\"%s\" = \"%s\";\n", key, value); - - return self; -} - -- writeToFile:(const char *)fileName -{ - FILE *stream; - if ((stream = fopen(fileName, "w")) == NULL) { - perror("Error (NXStringTable)"); - return nil; - } - [self writeToStream:stream]; - fclose(stream); - return self; -} - -@end - - diff --git a/Source/NXStringTable_scan.c b/Source/NXStringTable_scan.c deleted file mode 100644 index fb930d82e..000000000 --- a/Source/NXStringTable_scan.c +++ /dev/null @@ -1,1781 +0,0 @@ -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header$ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define NXlex_const const -#else -#define NXlex_const -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN NXlex__start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((NXlex__start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE NXlex_restart( NXlex_in ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct NXlex__buffer_state *YY_BUFFER_STATE; - -extern int NXlex_leng; -extern FILE *NXlex_in, *NXlex_out; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * NXlex_less( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the NXlex_less() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define NXlex_less(n) \ - do \ - { \ - /* Undo effects of setting up NXlex_text. */ \ - *NXlex__cp = NXlex__hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - NXlex__c_buf_p = NXlex__cp = NXlex__bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up NXlex_text again */ \ - } \ - while ( 0 ) - -#define unput(c) NXlex_unput( c, NXlex_text_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int NXlex__size_t; - - -struct NXlex__buffer_state - { - FILE *NXlex__input_file; - - char *NXlex__ch_buf; /* input buffer */ - char *NXlex__buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - NXlex__size_t NXlex__buf_size; - - /* Number of characters read into NXlex__ch_buf, not including EOB - * characters. - */ - int NXlex__n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int NXlex__is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int NXlex__is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int NXlex__at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int NXlex__fill_buffer; - - int NXlex__buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via NXlex_restart()), so that the user can continue scanning by - * just pointing NXlex_in at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE NXlex__current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER NXlex__current_buffer - - -/* NXlex__hold_char holds the character lost when NXlex_text is formed. */ -static char NXlex__hold_char; - -static int NXlex__n_chars; /* number of characters read into NXlex__ch_buf */ - - -int NXlex_leng; - -/* Points to current character in buffer. */ -static char *NXlex__c_buf_p = (char *) 0; -static int NXlex__init = 1; /* whether we need to initialize */ -static int NXlex__start = 0; /* start state number */ - -/* Flag which is used to allow NXlex_wrap()'s to do buffer switches - * instead of setting up a fresh NXlex_in. A bit of a hack ... - */ -static int NXlex__did_buffer_switch_on_eof; - -void NXlex_restart YY_PROTO(( FILE *input_file )); - -void NXlex__switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void NXlex__load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE NXlex__create_buffer YY_PROTO(( FILE *file, int size )); -void NXlex__delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void NXlex__init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void NXlex__flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER NXlex__flush_buffer( NXlex__current_buffer ) - -YY_BUFFER_STATE NXlex__scan_buffer YY_PROTO(( char *base, NXlex__size_t size )); -YY_BUFFER_STATE NXlex__scan_string YY_PROTO(( NXlex_const char *NXlex__str )); -YY_BUFFER_STATE NXlex__scan_bytes YY_PROTO(( NXlex_const char *bytes, int len )); - -static void *NXlex__flex_alloc YY_PROTO(( NXlex__size_t )); -static void *NXlex__flex_realloc YY_PROTO(( void *, NXlex__size_t )); -static void NXlex__flex_free YY_PROTO(( void * )); - -#define NXlex__new_buffer NXlex__create_buffer - -#define NXlex__set_interactive(is_interactive) \ - { \ - if ( ! NXlex__current_buffer ) \ - NXlex__current_buffer = NXlex__create_buffer( NXlex_in, YY_BUF_SIZE ); \ - NXlex__current_buffer->NXlex__is_interactive = is_interactive; \ - } - -#define NXlex__set_bol(at_bol) \ - { \ - if ( ! NXlex__current_buffer ) \ - NXlex__current_buffer = NXlex__create_buffer( NXlex_in, YY_BUF_SIZE ); \ - NXlex__current_buffer->NXlex__at_bol = at_bol; \ - } - -#define YY_AT_BOL() (NXlex__current_buffer->NXlex__at_bol) - -typedef unsigned char YY_CHAR; -FILE *NXlex_in = (FILE *) 0, *NXlex_out = (FILE *) 0; -typedef int NXlex__state_type; -extern char *NXlex_text; -#define NXlex_text_ptr NXlex_text - -static NXlex__state_type NXlex__get_previous_state YY_PROTO(( void )); -static NXlex__state_type NXlex__try_NUL_trans YY_PROTO(( NXlex__state_type current_state )); -static int NXlex__get_next_buffer YY_PROTO(( void )); -static void NXlex__fatal_error YY_PROTO(( NXlex_const char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up NXlex_text. - */ -#define YY_DO_BEFORE_ACTION \ - NXlex_text_ptr = NXlex__bp; \ - NXlex_leng = (int) (NXlex__cp - NXlex__bp); \ - NXlex__hold_char = *NXlex__cp; \ - *NXlex__cp = '\0'; \ - NXlex__c_buf_p = NXlex__cp; - -#define YY_NUM_RULES 17 -#define YY_END_OF_BUFFER 18 -static NXlex_const short int NXlex__accept[35] = - { 0, - 0, 0, 8, 8, 2, 2, 0, 0, 18, 17, - 11, 8, 9, 10, 11, 7, 6, 2, 4, 3, - 16, 13, 12, 17, 8, 1, 2, 3, 3, 5, - 16, 15, 14, 0 - } ; - -static NXlex_const int NXlex__ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 1, 1, 1, 1, 1, 1, - 1, 5, 1, 1, 1, 1, 6, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, - 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 9, 1, 1, 1, 1, 10, 10, 1, 1, - - 1, 10, 1, 1, 1, 1, 1, 1, 1, 10, - 1, 1, 1, 10, 1, 10, 1, 10, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static NXlex_const int NXlex__meta[11] = - { 0, - 1, 1, 2, 3, 4, 1, 1, 1, 3, 1 - } ; - -static NXlex_const short int NXlex__base[42] = - { 0, - 0, 0, 0, 0, 8, 11, 14, 21, 21, 64, - 64, 18, 64, 64, 14, 64, 64, 0, 64, 26, - 0, 64, 64, 5, 10, 64, 0, 28, 30, 64, - 0, 64, 64, 64, 36, 40, 44, 48, 51, 55, - 59 - } ; - -static NXlex_const short int NXlex__def[42] = - { 0, - 35, 35, 34, 3, 36, 36, 37, 37, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 38, 34, 39, - 40, 34, 34, 41, 34, 34, 38, 39, 39, 34, - 40, 34, 34, 0, 34, 34, 34, 34, 34, 34, - 34 - } ; - -static NXlex_const short int NXlex__nxt[75] = - { 0, - 11, 12, 13, 14, 11, 15, 16, 17, 11, 11, - 19, 25, 20, 19, 33, 20, 22, 23, 26, 25, - 34, 34, 24, 22, 23, 34, 34, 34, 34, 24, - 29, 30, 34, 34, 29, 30, 10, 10, 10, 10, - 18, 18, 18, 18, 21, 21, 21, 21, 27, 34, - 27, 28, 34, 28, 28, 31, 34, 34, 31, 32, - 32, 32, 32, 9, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34 - } ; - -static NXlex_const short int NXlex__chk[75] = - { 0, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 5, 25, 5, 6, 24, 6, 7, 7, 15, 12, - 9, 0, 7, 8, 8, 0, 0, 0, 0, 8, - 20, 20, 28, 28, 29, 29, 35, 35, 35, 35, - 36, 36, 36, 36, 37, 37, 37, 37, 38, 0, - 38, 39, 0, 39, 39, 40, 0, 0, 40, 41, - 41, 41, 41, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34 - } ; - -static NXlex__state_type NXlex__last_accepting_state; -static char *NXlex__last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define NXlex_more() NXlex_more_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *NXlex_text; -#line 1 "./NXStringTable_scan.l" -#define INITIAL 0 -/* Lex scanner for Objective C NeXT-compatible NXStringTable object - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - - Written by: Adam Fedor - - This file is part of the GNU Objective-C Collection library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -#line 24 "./NXStringTable_scan.l" - -#ifdef HAVE_FLEX -#define YY_DECL int NXtable_scan(FILE *NXscan_in, \ - FILE *NXscan_out, const char **buffer) -#endif -#define MAX_STRINGTABLE_LENGTH 1024 -#define KEY 1 -#define VALUE 2 - -#define NXlex_terminate() {got = 0; line = 1; return 0;} -#define return_err() {got = 0; line = 1; return -1;} -#define return_ok() {return 1;} - -#define parse 1 -#define comment 2 -#define token 3 - - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int NXlex_wrap YY_PROTO(( void )); -#else -extern int NXlex_wrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void NXlex_unput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef NXlex_text_ptr -static void NXlex__flex_strncpy YY_PROTO(( char *, NXlex_const char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int NXlex__flex_strlen YY_PROTO(( NXlex_const char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int NXlex_input YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int NXlex__start_stack_ptr = 0; -static int NXlex__start_stack_depth = 0; -static int *NXlex__start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void NXlex__push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void NXlex__pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int NXlex__top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( NXlex_text, NXlex_leng, 1, NXlex_out ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( NXlex__current_buffer->NXlex__is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( NXlex_in )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( NXlex_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, NXlex_in )) == 0) \ - && ferror( NXlex_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "NXlex_terminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef NXlex_terminate -#define NXlex_terminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) NXlex__fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int NXlex_lex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after NXlex_text and NXlex_leng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -YY_DECL - { - register NXlex__state_type NXlex__current_state; - register char *NXlex__cp, *NXlex__bp; - register int NXlex__act; - -#line 43 "./NXStringTable_scan.l" - - /* Lexical initialization - This gets executed before any analysis */ - char string_buf[MAX_STRINGTABLE_LENGTH]; - char *string_buf_ptr = NULL; - static int got; /* Holds the type of token we just got */ - static int line; - #ifndef HAVE_FLEX - extern FILE *NXscan_in; - extern FILE *NXscan_out; - extern char *NXscan_string; - #endif - if (NXlex_in != NXscan_in || line <= 1) { /* Reset */ - got = 0; - line= 1; - /* ifdef's can't start in column 1 in this part of the lex file */ - #ifdef FLEX_SCANNER - NXlex_restart(NXscan_in); - #else - /* FIXME: This is a horrible hack to get lex to reset itself at the - beggining of a new file. (And it still doesn't work right) */ - NXlex_sptr = NXlex_sbuf; - NXlex_in = NXscan_in; - #endif - } - NXlex_out = NXscan_out; - #ifdef HAVE_FLEX - *buffer = string_buf; - #else - NXscan_string = string_buf; - #endif - BEGIN(parse); - - - if ( NXlex__init ) - { - NXlex__init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! NXlex__start ) - NXlex__start = 1; /* first start state */ - - if ( ! NXlex_in ) - NXlex_in = stdin; - - if ( ! NXlex_out ) - NXlex_out = stdout; - - if ( ! NXlex__current_buffer ) - NXlex__current_buffer = - NXlex__create_buffer( NXlex_in, YY_BUF_SIZE ); - - NXlex__load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - NXlex__cp = NXlex__c_buf_p; - - /* Support of NXlex_text. */ - *NXlex__cp = NXlex__hold_char; - - /* NXlex__bp points to the position in NXlex__ch_buf of the start of - * the current run. - */ - NXlex__bp = NXlex__cp; - - NXlex__current_state = NXlex__start; -NXlex__match: - do - { - register YY_CHAR NXlex__c = NXlex__ec[YY_SC_TO_UI(*NXlex__cp)]; - if ( NXlex__accept[NXlex__current_state] ) - { - NXlex__last_accepting_state = NXlex__current_state; - NXlex__last_accepting_cpos = NXlex__cp; - } - while ( NXlex__chk[NXlex__base[NXlex__current_state] + NXlex__c] != NXlex__current_state ) - { - NXlex__current_state = (int) NXlex__def[NXlex__current_state]; - if ( NXlex__current_state >= 35 ) - NXlex__c = NXlex__meta[(unsigned int) NXlex__c]; - } - NXlex__current_state = NXlex__nxt[NXlex__base[NXlex__current_state] + (unsigned int) NXlex__c]; - ++NXlex__cp; - } - while ( NXlex__base[NXlex__current_state] != 64 ); - -NXlex__find_action: - NXlex__act = NXlex__accept[NXlex__current_state]; - if ( NXlex__act == 0 ) - { /* have to back up */ - NXlex__cp = NXlex__last_accepting_cpos; - NXlex__current_state = NXlex__last_accepting_state; - NXlex__act = NXlex__accept[NXlex__current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( NXlex__act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *NXlex__cp = NXlex__hold_char; - NXlex__cp = NXlex__last_accepting_cpos; - NXlex__current_state = NXlex__last_accepting_state; - goto NXlex__find_action; - -case 1: -YY_RULE_SETUP -#line 75 "./NXStringTable_scan.l" -BEGIN(comment); - YY_BREAK -case 2: -YY_RULE_SETUP -#line 77 "./NXStringTable_scan.l" -/* eat anything that's not a '*' */; - YY_BREAK -case 3: -YY_RULE_SETUP -#line 78 "./NXStringTable_scan.l" -/* eat up '*'s not followed by '/'s */; - YY_BREAK -case 4: -YY_RULE_SETUP -#line 79 "./NXStringTable_scan.l" -line++; - YY_BREAK -case 5: -YY_RULE_SETUP -#line 80 "./NXStringTable_scan.l" -BEGIN(parse); - YY_BREAK -case YY_STATE_EOF(comment): -#line 81 "./NXStringTable_scan.l" -{ - /* error - unterminated comment */ - fprintf(stderr, "ERROR (NXStringTable): Unterminated comment\n"); - return_err(); - } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 87 "./NXStringTable_scan.l" -{ - if (!got) { - fprintf(stderr, "\nERROR (NXStringTable): Improper use of = (Expected a key, line %d)\n", line); - return_err(); - } - if (got == VALUE) { - fprintf(stderr, "\nERROR (NXStringTable): Improper use of = (Expected a ;, line %d)\n", line); - return_err(); - } - } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 98 "./NXStringTable_scan.l" -{ - if (!got) { - fprintf(stderr, "\nERROR (NXStringTable): Improper use of ; (Expected a key, line %d)\n", line); - return_err(); - } - if (got == KEY) { - got = 0; - return_ok(); - } - got = 0; - } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 110 "./NXStringTable_scan.l" -/* Eat up white space between tokens */; - YY_BREAK -case 9: -YY_RULE_SETUP -#line 112 "./NXStringTable_scan.l" -line++; - YY_BREAK -case 10: -YY_RULE_SETUP -#line 114 "./NXStringTable_scan.l" -{string_buf_ptr = string_buf; BEGIN(token);} - YY_BREAK -case YY_STATE_EOF(parse): -#line 116 "./NXStringTable_scan.l" -NXlex_terminate(); - YY_BREAK -case 11: -YY_RULE_SETUP -#line 118 "./NXStringTable_scan.l" -{ - fprintf(stderr, "ERROR (NXStringTable): Extra characters in table (line %d)\n", line); - return_err(); - } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 123 "./NXStringTable_scan.l" -{ /* saw closing quote - all done */ - BEGIN(parse); - *string_buf_ptr = '\0'; - /* return string constant token type and - * value to parser - */ - got++; - if (got == KEY || got == VALUE) { - return_ok(); - } else { - fprintf(stderr, "ERROR (NXStringTable): Parse error, line %d \n", line); - return_err(); - } - } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 138 "./NXStringTable_scan.l" -{ - /* error - unterminated string constant */ - fprintf(stderr, "ERROR (NXStringTable): Unterminated string (line %d)\n", line); - return_err(); - } - YY_BREAK -case YY_STATE_EOF(token): -#line 144 "./NXStringTable_scan.l" -{ - /* error - unterminated string constant */ - fprintf(stderr, "ERROR (NXStringTable): Unterminated string (line %d)\n", line); - return_err(); - } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 150 "./NXStringTable_scan.l" -{*string_buf_ptr++='\\';*string_buf_ptr++ = NXlex_text[1];} - YY_BREAK -case 15: -YY_RULE_SETUP -#line 152 "./NXStringTable_scan.l" -*string_buf_ptr++ = NXlex_text[1]; - YY_BREAK -case 16: -YY_RULE_SETUP -#line 154 "./NXStringTable_scan.l" -{ - char *text_ptr = NXlex_text; - if (!text_ptr) { - fprintf(stderr, "ERROR (NXStringTable): internal parse error\n"); - break; - } - while ( *text_ptr ) - *string_buf_ptr++ = *text_ptr++; - } - YY_BREAK -case 17: -YY_RULE_SETUP -#line 164 "./NXStringTable_scan.l" -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): - NXlex_terminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int NXlex__amount_of_matched_text = (int) (NXlex__cp - NXlex_text_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *NXlex__cp = NXlex__hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( NXlex__current_buffer->NXlex__buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed NXlex_in at a new source and called - * NXlex_lex(). If so, then we have to assure - * consistency between NXlex__current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - NXlex__n_chars = NXlex__current_buffer->NXlex__n_chars; - NXlex__current_buffer->NXlex__input_file = NXlex_in; - NXlex__current_buffer->NXlex__buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for NXlex__c_buf_p "<=" to the position - * of the first EOB in the buffer, since NXlex__c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( NXlex__c_buf_p <= &NXlex__current_buffer->NXlex__ch_buf[NXlex__n_chars] ) - { /* This was really a NUL. */ - NXlex__state_type NXlex__next_state; - - NXlex__c_buf_p = NXlex_text_ptr + NXlex__amount_of_matched_text; - - NXlex__current_state = NXlex__get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * NXlex__get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - NXlex__next_state = NXlex__try_NUL_trans( NXlex__current_state ); - - NXlex__bp = NXlex_text_ptr + YY_MORE_ADJ; - - if ( NXlex__next_state ) - { - /* Consume the NUL. */ - NXlex__cp = ++NXlex__c_buf_p; - NXlex__current_state = NXlex__next_state; - goto NXlex__match; - } - - else - { - NXlex__cp = NXlex__c_buf_p; - goto NXlex__find_action; - } - } - - else switch ( NXlex__get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - NXlex__did_buffer_switch_on_eof = 0; - - if ( NXlex_wrap() ) - { - /* Note: because we've taken care in - * NXlex__get_next_buffer() to have set up - * NXlex_text, we can now set up - * NXlex__c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - NXlex__c_buf_p = NXlex_text_ptr + YY_MORE_ADJ; - - NXlex__act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! NXlex__did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - NXlex__c_buf_p = - NXlex_text_ptr + NXlex__amount_of_matched_text; - - NXlex__current_state = NXlex__get_previous_state(); - - NXlex__cp = NXlex__c_buf_p; - NXlex__bp = NXlex_text_ptr + YY_MORE_ADJ; - goto NXlex__match; - - case EOB_ACT_LAST_MATCH: - NXlex__c_buf_p = - &NXlex__current_buffer->NXlex__ch_buf[NXlex__n_chars]; - - NXlex__current_state = NXlex__get_previous_state(); - - NXlex__cp = NXlex__c_buf_p; - NXlex__bp = NXlex_text_ptr + YY_MORE_ADJ; - goto NXlex__find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of NXlex_lex */ - - -/* NXlex__get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int NXlex__get_next_buffer() - { - register char *dest = NXlex__current_buffer->NXlex__ch_buf; - register char *source = NXlex_text_ptr; - register int number_to_move, i; - int ret_val; - - if ( NXlex__c_buf_p > &NXlex__current_buffer->NXlex__ch_buf[NXlex__n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( NXlex__current_buffer->NXlex__fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( NXlex__c_buf_p - NXlex_text_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (NXlex__c_buf_p - NXlex_text_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( NXlex__current_buffer->NXlex__buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - NXlex__current_buffer->NXlex__n_chars = NXlex__n_chars = 0; - - else - { - int num_to_read = - NXlex__current_buffer->NXlex__buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = NXlex__current_buffer; - - int NXlex__c_buf_p_offset = - (int) (NXlex__c_buf_p - b->NXlex__ch_buf); - - if ( b->NXlex__is_our_buffer ) - { - int new_size = b->NXlex__buf_size * 2; - - if ( new_size <= 0 ) - b->NXlex__buf_size += b->NXlex__buf_size / 8; - else - b->NXlex__buf_size *= 2; - - b->NXlex__ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - NXlex__flex_realloc( (void *) b->NXlex__ch_buf, - b->NXlex__buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->NXlex__ch_buf = 0; - - if ( ! b->NXlex__ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - NXlex__c_buf_p = &b->NXlex__ch_buf[NXlex__c_buf_p_offset]; - - num_to_read = NXlex__current_buffer->NXlex__buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&NXlex__current_buffer->NXlex__ch_buf[number_to_move]), - NXlex__n_chars, num_to_read ); - - NXlex__current_buffer->NXlex__n_chars = NXlex__n_chars; - } - - if ( NXlex__n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - NXlex_restart( NXlex_in ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - NXlex__current_buffer->NXlex__buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - NXlex__n_chars += number_to_move; - NXlex__current_buffer->NXlex__ch_buf[NXlex__n_chars] = YY_END_OF_BUFFER_CHAR; - NXlex__current_buffer->NXlex__ch_buf[NXlex__n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - NXlex_text_ptr = &NXlex__current_buffer->NXlex__ch_buf[0]; - - return ret_val; - } - - -/* NXlex__get_previous_state - get the state just before the EOB char was reached */ - -static NXlex__state_type NXlex__get_previous_state() - { - register NXlex__state_type NXlex__current_state; - register char *NXlex__cp; - - NXlex__current_state = NXlex__start; - - for ( NXlex__cp = NXlex_text_ptr + YY_MORE_ADJ; NXlex__cp < NXlex__c_buf_p; ++NXlex__cp ) - { - register YY_CHAR NXlex__c = (*NXlex__cp ? NXlex__ec[YY_SC_TO_UI(*NXlex__cp)] : 1); - if ( NXlex__accept[NXlex__current_state] ) - { - NXlex__last_accepting_state = NXlex__current_state; - NXlex__last_accepting_cpos = NXlex__cp; - } - while ( NXlex__chk[NXlex__base[NXlex__current_state] + NXlex__c] != NXlex__current_state ) - { - NXlex__current_state = (int) NXlex__def[NXlex__current_state]; - if ( NXlex__current_state >= 35 ) - NXlex__c = NXlex__meta[(unsigned int) NXlex__c]; - } - NXlex__current_state = NXlex__nxt[NXlex__base[NXlex__current_state] + (unsigned int) NXlex__c]; - } - - return NXlex__current_state; - } - - -/* NXlex__try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = NXlex__try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static NXlex__state_type NXlex__try_NUL_trans( NXlex__state_type NXlex__current_state ) -#else -static NXlex__state_type NXlex__try_NUL_trans( NXlex__current_state ) -NXlex__state_type NXlex__current_state; -#endif - { - register int NXlex__is_jam; - register char *NXlex__cp = NXlex__c_buf_p; - - register YY_CHAR NXlex__c = 1; - if ( NXlex__accept[NXlex__current_state] ) - { - NXlex__last_accepting_state = NXlex__current_state; - NXlex__last_accepting_cpos = NXlex__cp; - } - while ( NXlex__chk[NXlex__base[NXlex__current_state] + NXlex__c] != NXlex__current_state ) - { - NXlex__current_state = (int) NXlex__def[NXlex__current_state]; - if ( NXlex__current_state >= 35 ) - NXlex__c = NXlex__meta[(unsigned int) NXlex__c]; - } - NXlex__current_state = NXlex__nxt[NXlex__base[NXlex__current_state] + (unsigned int) NXlex__c]; - NXlex__is_jam = (NXlex__current_state == 34); - - return NXlex__is_jam ? 0 : NXlex__current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void NXlex_unput( int c, register char *NXlex__bp ) -#else -static void NXlex_unput( c, NXlex__bp ) -int c; -register char *NXlex__bp; -#endif - { - register char *NXlex__cp = NXlex__c_buf_p; - - /* undo effects of setting up NXlex_text */ - *NXlex__cp = NXlex__hold_char; - - if ( NXlex__cp < NXlex__current_buffer->NXlex__ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = NXlex__n_chars + 2; - register char *dest = &NXlex__current_buffer->NXlex__ch_buf[ - NXlex__current_buffer->NXlex__buf_size + 2]; - register char *source = - &NXlex__current_buffer->NXlex__ch_buf[number_to_move]; - - while ( source > NXlex__current_buffer->NXlex__ch_buf ) - *--dest = *--source; - - NXlex__cp += (int) (dest - source); - NXlex__bp += (int) (dest - source); - NXlex__current_buffer->NXlex__n_chars = - NXlex__n_chars = NXlex__current_buffer->NXlex__buf_size; - - if ( NXlex__cp < NXlex__current_buffer->NXlex__ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--NXlex__cp = (char) c; - - - NXlex_text_ptr = NXlex__bp; - NXlex__hold_char = *NXlex__cp; - NXlex__c_buf_p = NXlex__cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int NXlex_input() -#else -static int input() -#endif - { - int c; - - *NXlex__c_buf_p = NXlex__hold_char; - - if ( *NXlex__c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* NXlex__c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( NXlex__c_buf_p < &NXlex__current_buffer->NXlex__ch_buf[NXlex__n_chars] ) - /* This was really a NUL. */ - *NXlex__c_buf_p = '\0'; - - else - { /* need more input */ - int offset = NXlex__c_buf_p - NXlex_text_ptr; - ++NXlex__c_buf_p; - - switch ( NXlex__get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because NXlex__g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - NXlex_restart( NXlex_in ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( NXlex_wrap() ) - return EOF; - - if ( ! NXlex__did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return NXlex_input(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - NXlex__c_buf_p = NXlex_text_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) NXlex__c_buf_p; /* cast for 8-bit char's */ - *NXlex__c_buf_p = '\0'; /* preserve NXlex_text */ - NXlex__hold_char = *++NXlex__c_buf_p; - - - return c; - } - - -#ifdef YY_USE_PROTOS -void NXlex_restart( FILE *input_file ) -#else -void NXlex_restart( input_file ) -FILE *input_file; -#endif - { - if ( ! NXlex__current_buffer ) - NXlex__current_buffer = NXlex__create_buffer( NXlex_in, YY_BUF_SIZE ); - - NXlex__init_buffer( NXlex__current_buffer, input_file ); - NXlex__load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void NXlex__switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void NXlex__switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( NXlex__current_buffer == new_buffer ) - return; - - if ( NXlex__current_buffer ) - { - /* Flush out information for old buffer. */ - *NXlex__c_buf_p = NXlex__hold_char; - NXlex__current_buffer->NXlex__buf_pos = NXlex__c_buf_p; - NXlex__current_buffer->NXlex__n_chars = NXlex__n_chars; - } - - NXlex__current_buffer = new_buffer; - NXlex__load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (NXlex_wrap()) processing, but the only time this flag - * is looked at is after NXlex_wrap() is called, so it's safe - * to go ahead and always set it. - */ - NXlex__did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void NXlex__load_buffer_state( void ) -#else -void NXlex__load_buffer_state() -#endif - { - NXlex__n_chars = NXlex__current_buffer->NXlex__n_chars; - NXlex_text_ptr = NXlex__c_buf_p = NXlex__current_buffer->NXlex__buf_pos; - NXlex_in = NXlex__current_buffer->NXlex__input_file; - NXlex__hold_char = *NXlex__c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE NXlex__create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE NXlex__create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) NXlex__flex_alloc( sizeof( struct NXlex__buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in NXlex__create_buffer()" ); - - b->NXlex__buf_size = size; - - /* NXlex__ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->NXlex__ch_buf = (char *) NXlex__flex_alloc( b->NXlex__buf_size + 2 ); - if ( ! b->NXlex__ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in NXlex__create_buffer()" ); - - b->NXlex__is_our_buffer = 1; - - NXlex__init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void NXlex__delete_buffer( YY_BUFFER_STATE b ) -#else -void NXlex__delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == NXlex__current_buffer ) - NXlex__current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->NXlex__is_our_buffer ) - NXlex__flex_free( (void *) b->NXlex__ch_buf ); - - NXlex__flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void NXlex__init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void NXlex__init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - NXlex__flush_buffer( b ); - - b->NXlex__input_file = file; - b->NXlex__fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->NXlex__is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->NXlex__is_interactive = 0; -#else - b->NXlex__is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void NXlex__flush_buffer( YY_BUFFER_STATE b ) -#else -void NXlex__flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->NXlex__n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->NXlex__ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->NXlex__ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->NXlex__buf_pos = &b->NXlex__ch_buf[0]; - - b->NXlex__at_bol = 1; - b->NXlex__buffer_status = YY_BUFFER_NEW; - - if ( b == NXlex__current_buffer ) - NXlex__load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE NXlex__scan_buffer( char *base, NXlex__size_t size ) -#else -YY_BUFFER_STATE NXlex__scan_buffer( base, size ) -char *base; -NXlex__size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) NXlex__flex_alloc( sizeof( struct NXlex__buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in NXlex__scan_buffer()" ); - - b->NXlex__buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->NXlex__buf_pos = b->NXlex__ch_buf = base; - b->NXlex__is_our_buffer = 0; - b->NXlex__input_file = 0; - b->NXlex__n_chars = b->NXlex__buf_size; - b->NXlex__is_interactive = 0; - b->NXlex__at_bol = 1; - b->NXlex__fill_buffer = 0; - b->NXlex__buffer_status = YY_BUFFER_NEW; - - NXlex__switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE NXlex__scan_string( NXlex_const char *NXlex__str ) -#else -YY_BUFFER_STATE NXlex__scan_string( NXlex__str ) -NXlex_const char *NXlex__str; -#endif - { - int len; - for ( len = 0; NXlex__str[len]; ++len ) - ; - - return NXlex__scan_bytes( NXlex__str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE NXlex__scan_bytes( NXlex_const char *bytes, int len ) -#else -YY_BUFFER_STATE NXlex__scan_bytes( bytes, len ) -NXlex_const char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - NXlex__size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) NXlex__flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in NXlex__scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = NXlex__scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in NXlex__scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->NXlex__is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void NXlex__push_state( int new_state ) -#else -static void NXlex__push_state( new_state ) -int new_state; -#endif - { - if ( NXlex__start_stack_ptr >= NXlex__start_stack_depth ) - { - NXlex__size_t new_size; - - NXlex__start_stack_depth += YY_START_STACK_INCR; - new_size = NXlex__start_stack_depth * sizeof( int ); - - if ( ! NXlex__start_stack ) - NXlex__start_stack = (int *) NXlex__flex_alloc( new_size ); - - else - NXlex__start_stack = (int *) NXlex__flex_realloc( - (void *) NXlex__start_stack, new_size ); - - if ( ! NXlex__start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - NXlex__start_stack[NXlex__start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void NXlex__pop_state() - { - if ( --NXlex__start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(NXlex__start_stack[NXlex__start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int NXlex__top_state() - { - return NXlex__start_stack[NXlex__start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void NXlex__fatal_error( NXlex_const char msg[] ) -#else -static void NXlex__fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine NXlex_less() so it works in section 3 code. */ - -#undef NXlex_less -#define NXlex_less(n) \ - do \ - { \ - /* Undo effects of setting up NXlex_text. */ \ - NXlex_text[NXlex_leng] = NXlex__hold_char; \ - NXlex__c_buf_p = NXlex_text + n; \ - NXlex__hold_char = *NXlex__c_buf_p; \ - *NXlex__c_buf_p = '\0'; \ - NXlex_leng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef NXlex_text_ptr -#ifdef YY_USE_PROTOS -static void NXlex__flex_strncpy( char *s1, NXlex_const char *s2, int n ) -#else -static void NXlex__flex_strncpy( s1, s2, n ) -char *s1; -NXlex_const char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int NXlex__flex_strlen( NXlex_const char *s ) -#else -static int NXlex__flex_strlen( s ) -NXlex_const char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *NXlex__flex_alloc( NXlex__size_t size ) -#else -static void *NXlex__flex_alloc( size ) -NXlex__size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *NXlex__flex_realloc( void *ptr, NXlex__size_t size ) -#else -static void *NXlex__flex_realloc( ptr, size ) -void *ptr; -NXlex__size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void NXlex__flex_free( void *ptr ) -#else -static void NXlex__flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - NXlex_lex(); - return 0; - } -#endif -#line 164 "./NXStringTable_scan.l" - - -int -NXlex_wrap() -{ - return 1; -} - -#ifdef NEED_MAIN -#ifndef HAVE_FLEX - FILE *NXscan_in; - FILE *NXscan_out; - char *NXscan_string; -#endif -int -main(int argc, char *argv[]) -{ - FILE *input; - const char *str; - int ok, value = 0; - - if (argc > 1) { - if ((input = fopen(argv[1], "r")) == NULL) { - fprintf(stderr, "Error: Couldn't open %s\n", argv[1]); - exit (1); - } - } else - exit(1); - -#ifdef HAVE_FLEX - ok = NXtable_scan( input, stdout, &str); -#else - NXscan_in = input; - NXscan_out = stdout; - ok = NXlex_lex(); - str = NXscan_string; -#endif - while (ok > 0) { - if (value) - printf("Value: %s\n", str); - else - printf("Key: %s\n", str); - value = ~value; -#ifdef HAVE_FLEX - ok = NXtable_scan( input, stdout, &str); -#else - ok = NXlex_lex(); -#endif - } - - return 0; -} -#endif diff --git a/Source/NXStringTable_scan.l b/Source/NXStringTable_scan.l deleted file mode 100644 index dd8d3e0ac..000000000 --- a/Source/NXStringTable_scan.l +++ /dev/null @@ -1,216 +0,0 @@ -/* Lex scanner for Objective C NeXT-compatible NXStringTable object - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - - Written by: Adam Fedor - - This file is part of the GNU Objective-C Collection library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -%{ - -#ifdef HAVE_FLEX -#define YY_DECL int NXtable_scan(FILE *NXscan_in, \ - FILE *NXscan_out, const char **buffer) -#endif -#define MAX_STRINGTABLE_LENGTH 1024 -#define KEY 1 -#define VALUE 2 - -#define yyterminate() {got = 0; line = 1; return 0;} -#define return_err() {got = 0; line = 1; return -1;} -#define return_ok() {return 1;} - -%} - -ESCAPES [abfnrtv] - -%s parse comment token - -%% - /* Lexical initialization - This gets executed before any analysis */ - char string_buf[MAX_STRINGTABLE_LENGTH]; - char *string_buf_ptr = NULL; - static int got; /* Holds the type of token we just got */ - static int line; - #ifndef HAVE_FLEX - extern FILE *NXscan_in; - extern FILE *NXscan_out; - extern char *NXscan_string; - #endif - if (yyin != NXscan_in || line <= 1) { /* Reset */ - got = 0; - line= 1; - /* ifdef's can't start in column 1 in this part of the lex file */ - #ifdef FLEX_SCANNER - yyrestart(NXscan_in); - #else - /* FIXME: This is a horrible hack to get lex to reset itself at the - beggining of a new file. (And it still doesn't work right) */ - yysptr = yysbuf; - yyin = NXscan_in; - #endif - } - yyout = NXscan_out; - #ifdef HAVE_FLEX - *buffer = string_buf; - #else - NXscan_string = string_buf; - #endif - BEGIN(parse); - -"/*" BEGIN(comment); - -[^*\n]* /* eat anything that's not a '*' */; -"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */; -\n line++; -"*"+"/" BEGIN(parse); -<> { - /* error - unterminated comment */ - fprintf(stderr, "ERROR (NXStringTable): Unterminated comment\n"); - return_err(); - } - -= { - if (!got) { - fprintf(stderr, "\nERROR (NXStringTable): Improper use of = (Expected a key, line %d)\n", line); - return_err(); - } - if (got == VALUE) { - fprintf(stderr, "\nERROR (NXStringTable): Improper use of = (Expected a ;, line %d)\n", line); - return_err(); - } - } - -; { - if (!got) { - fprintf(stderr, "\nERROR (NXStringTable): Improper use of ; (Expected a key, line %d)\n", line); - return_err(); - } - if (got == KEY) { - got = 0; - return_ok(); - } - got = 0; - } - -[ \t]* /* Eat up white space between tokens */; - -\n line++; - -\" {string_buf_ptr = string_buf; BEGIN(token);} - -<> yyterminate(); - -. { - fprintf(stderr, "ERROR (NXStringTable): Extra characters in table (line %d)\n", line); - return_err(); - } - -\" { /* saw closing quote - all done */ - BEGIN(parse); - *string_buf_ptr = '\0'; - /* return string constant token type and - * value to parser - */ - got++; - if (got == KEY || got == VALUE) { - return_ok(); - } else { - fprintf(stderr, "ERROR (NXStringTable): Parse error, line %d \n", line); - return_err(); - } - } - -\n { - /* error - unterminated string constant */ - fprintf(stderr, "ERROR (NXStringTable): Unterminated string (line %d)\n", line); - return_err(); - } - -<> { - /* error - unterminated string constant */ - fprintf(stderr, "ERROR (NXStringTable): Unterminated string (line %d)\n", line); - return_err(); - } - -\\{ESCAPES} {*string_buf_ptr++='\\';*string_buf_ptr++ = yytext[1];} - -\\(.|\n) *string_buf_ptr++ = yytext[1]; - -[^\\\n\"]+ { - char *text_ptr = yytext; - if (!text_ptr) { - fprintf(stderr, "ERROR (NXStringTable): internal parse error\n"); - break; - } - while ( *text_ptr ) - *string_buf_ptr++ = *text_ptr++; - } - -%% - -int -yywrap() -{ - return 1; -} - -#ifdef NEED_MAIN -#ifndef HAVE_FLEX - FILE *NXscan_in; - FILE *NXscan_out; - char *NXscan_string; -#endif -int -main(int argc, char *argv[]) -{ - FILE *input; - const char *str; - int ok, value = 0; - - if (argc > 1) { - if ((input = fopen(argv[1], "r")) == NULL) { - fprintf(stderr, "Error: Couldn't open %s\n", argv[1]); - exit (1); - } - } else - exit(1); - -#ifdef HAVE_FLEX - ok = NXtable_scan( input, stdout, &str); -#else - NXscan_in = input; - NXscan_out = stdout; - ok = yylex(); - str = NXscan_string; -#endif - while (ok > 0) { - if (value) - printf("Value: %s\n", str); - else - printf("Key: %s\n", str); - value = ~value; -#ifdef HAVE_FLEX - ok = NXtable_scan( input, stdout, &str); -#else - ok = yylex(); -#endif - } - - return 0; -} -#endif diff --git a/Source/Storage.m b/Source/Storage.m deleted file mode 100644 index 5331c9f69..000000000 --- a/Source/Storage.m +++ /dev/null @@ -1,301 +0,0 @@ -/* Implementation of Objective C NeXT-compatible Storage object - Copyright (C) 1993,1994, 1996 Free Software Foundation, Inc. - - Written by: Kresten Krab Thorup - Dept. of Mathematics and Computer Science, Aalborg U., Denmark - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -/* memcpy() and memcmp() are gcc builtin's */ - -/* Deal with bzero: */ -#if STDC_HEADERS || HAVE_STRING_H -#include -/* An ANSI string.h and pre-ANSI memory.h might conflict. */ -#if !STDC_HEADERS && HAVE_MEMORY_H -#include -#endif /* not STDC_HEADERS and HAVE_MEMORY_H */ -#define index strchr -#define rindex strrchr -#define bcopy(s, d, n) memcpy ((d), (s), (n)) -#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) -#define bzero(s, n) memset ((s), 0, (n)) -#else /* not STDC_HEADERS and not HAVE_STRING_H */ -#include -/* memory.h and strings.h conflict on some systems. */ -#endif /* not STDC_HEADERS and not HAVE_STRING_H */ - - -#define GNU_STORAGE_NTH(x,N) \ - ({ GNUStorageId* __s=(GNUStorageId*)(x); \ - (void*)(((char*)__s->dataPtr)+(__s->elementSize*(N))); }) -#define STORAGE_NTH(N) GNU_STORAGE_NTH (self, N) - -typedef struct { - @defs(Storage) -} GNUStorageId; - -@implementation Storage - -+ initialize -{ - if (self == [Storage class]) - [self setVersion:0]; /* beta release */ - return self; -} - -// INITIALIZING, FREEING; - -- initCount: (unsigned)numSlots - elementSize: (unsigned)sizeInBytes - description: (const char*)elemDesc; -{ - [super init]; - numElements = numSlots; - maxElements = (numSlots > 0) ? numSlots : 1; - elementSize = sizeInBytes; - description = elemDesc; - dataPtr = (void*) objc_malloc (maxElements * elementSize); - bzero(dataPtr, numElements * elementSize); - return self; -} - -- init -{ - return [self initCount:1 - elementSize:sizeof(id) - description:@encode(id)]; -} - - -- free -{ - if (dataPtr) - free(dataPtr); - return [super free]; -} - -- (const char*) description -{ - return description; -} - - -// COPYING; - -- shallowCopy -{ - Storage *c = [super shallowCopy]; - c->dataPtr = (void*) objc_malloc (maxElements * elementSize); - memcpy(c->dataPtr, dataPtr, numElements * elementSize); - return c; -} - -// COMPARING TWO STORAGES; - -- (BOOL)isEqual: anObject -{ - if ([anObject isKindOf: [Storage class]] - && [anObject count] == [self count] - && !memcmp(((GNUStorageId*)anObject)->dataPtr, - dataPtr, numElements*elementSize)) - return YES; - else - return NO; -} - -// MANAGING THE STORAGE CAPACITY; - -static inline void _makeRoomForAnotherIfNecessary(Storage *self) -{ - if (self->numElements == self->maxElements) - { - self->maxElements *= 2; - self->dataPtr = (void*) - objc_realloc (self->dataPtr, self->maxElements*self->elementSize); - } -} - -static inline void _shrinkIfDesired(Storage *self) -{ - if (self->numElements < (self->maxElements / 2)) - { - self->maxElements /= 2; - self->dataPtr = (void *) - objc_realloc (self->dataPtr, self->maxElements*self->elementSize); - } -} - -- setAvailableCapacity:(unsigned)numSlots -{ - if (numSlots > numElements) - { - maxElements = numSlots; - dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize); - } - return self; -} - -- setNumSlots:(unsigned)numSlots -{ - if (numSlots > numElements) - { - maxElements = numSlots; - dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize); - bzero(STORAGE_NTH(numElements), (maxElements-numElements)*elementSize); - } - else if (numSlots < numElements) - { - numElements = numSlots; - _shrinkIfDesired (self); - } - return self; -} - -/* Manipulating objects by index */ - -#define CHECK_INDEX(IND) if (IND >= numElements) return 0 - -- (unsigned) count -{ - return numElements; -} - -- (void*) elementAt: (unsigned)index -{ - CHECK_INDEX(index); - return STORAGE_NTH (index); -} - -- addElement: (void*)anElement -{ - _makeRoomForAnotherIfNecessary(self); - memcpy(STORAGE_NTH(numElements), anElement, elementSize); - numElements++; - return self; -} - -- insertElement: (void*)anElement at: (unsigned)index -{ - int i; - - CHECK_INDEX(index); - _makeRoomForAnotherIfNecessary(self); -#ifndef STABLE_MEMCPY - for (i = numElements; i >= index; i--) - memcpy (STORAGE_NTH(i+1), STORAGE_NTH(i), elementSize); -#else - memcpy (STORAGE_NTH (index+1), - STORAGE_NTH (index), - elementSize*(numElements-index)); -#endif - memcpy(STORAGE_NTH(i), anElement, elementSize); - numElements++; - return self; -} - -- removeElementAt: (unsigned)index -{ - int i; - - CHECK_INDEX(index); - numElements--; -#ifndef STABLE_MEMCPY - for (i = index; i < numElements; i++) - memcpy(STORAGE_NTH(i), - STORAGE_NTH(i+1), - elementSize); -#else - memcpy (STORAGE_NTH (index), - STORAGE_NTH (index+1), - elementSize*(numElements-index-1)); -#endif - _shrinkIfDesired(self); - return self; -} - -- removeLastElement -{ - if (numElements) - { - numElements--; - _shrinkIfDesired(self); - } - return self; -} - -- replaceElementAt:(unsigned)index with:(void*)newElement -{ - CHECK_INDEX(index); - memcpy(STORAGE_NTH(index), newElement, elementSize); - return self; -} - -/* Emptying the Storage */ - -- empty -{ - numElements = 0; - maxElements = 1; - dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize); - return self; -} - -/* Archiving */ - -- write: (TypedStream*)aStream -{ - int i; - - [super write:aStream]; - objc_write_types(aStream, "III*", - &numElements, &maxElements, &elementSize, &description); - for (i = 0; i < numElements; i++) - objc_write_type(aStream, description, STORAGE_NTH(i)); - return self; -} - -- read: (TypedStream*)aStream -{ - int i; - - [super read:aStream]; - objc_read_types(aStream, "III*", - &numElements, &maxElements, &elementSize, &description); - dataPtr = (void*) objc_malloc (maxElements * elementSize); - for (i = 0; i < numElements; i++) - objc_read_type(aStream, description, STORAGE_NTH(i)); - return self; -} - -+ new -{ - return [[self alloc] init]; -} - -+ newCount:(unsigned)count elementSize:(unsigned)sizeInBytes - description:(const char *)descriptor -{ - return [[self alloc] initCount:count elementSize:sizeInBytes - description:descriptor]; -} - -@end diff --git a/Source/objc/HashTable.h b/Source/objc/HashTable.h deleted file mode 100644 index eaa5b071e..000000000 --- a/Source/objc/HashTable.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Interface for Objective C NeXT-compatible HashTable object - Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. - - Written by: Andrew Kachites McCallum - Created: May 1993 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/****************************************************************** - TODO: - Does not implement methods for archiving itself. - Does not implement -freeKeys:values:. -******************************************************************/ - -#ifndef __HashTable_h_INCLUDE_GNU -#define __HashTable_h_INCLUDE_GNU - -#include -#include -#include - -typedef node_ptr NXHashState; - -@interface HashTable: Object -{ - unsigned count; /* Current number of associations */ - const char *keyDesc; /* Description of keys */ - const char *valueDesc; /* Description of values */ - unsigned _nbBuckets; /* Current size of the array */ - cache_ptr _buckets; /* Data array */ -} -/* We include some instance vars we don't need so we are compatible - with NeXT programs that expect them to be there */ - - -/* Initializing */ - -- init; -- initKeyDesc: (const char *)aKeyDesc; -- initKeyDesc:(const char *)aKeyDesc - valueDesc:(const char *)aValueDesc; -- initKeyDesc: (const char *) aKeyDesc - valueDesc: (const char *)aValueDesc - capacity: (unsigned) aCapacity; - -/* Freeing */ - -- free; -- freeObjects; -- freeKeys:(void (*) (void *))keyFunc - values:(void (*) (void *))valueFunc; -- empty; - -/* Copying */ - -- shallowCopy; -- deepen; - -/* Manipulating */ - -- (unsigned)count; -- (BOOL)isKey:(const void *)aKey; -- (void *)valueForKey:(const void *)aKey; -- (void *)insertKey:(const void *)aKey value:(void *)aValue; -- (void *)removeKey:(const void *)aKey; - -/* Iterating */ - -- (NXHashState)initState; -- (BOOL)nextState:(NXHashState *)aState - key:(const void **)aKey - value:(void **)aValue; - -/* Archiving */ - -- read: (TypedStream*)aStream; -- write: (TypedStream*)aStream; - -/* Old-style creation */ - -+ newKeyDesc: (const char *)aKeyDesc; -+ newKeyDesc:(const char *)aKeyDesc - valueDesc:(const char *)aValueDesc; -+ newKeyDesc:(const char *)aKeyDesc - valueDesc:(const char *)aValueDesc - capacity:(unsigned)aCapacity; - -/* Sending messages to elements of the hashtable */ - -- makeObjectsPerform:(SEL)aSel; -- makeObjectsPerform:(SEL)aSel with:anObject; - -@end - -#endif /* __HashTable_h_INCLUDE_GNU */ diff --git a/Source/objc/List.h b/Source/objc/List.h deleted file mode 100644 index beacb10ba..000000000 --- a/Source/objc/List.h +++ /dev/null @@ -1,103 +0,0 @@ -/* Interface for Objective-C NeXT-compatible List object - Copyright (C) 1993,1994 Free Software Foundation, Inc. - - Written by: Andrew Kachites McCallum - Date: May 1993 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef __List_h_INCLUDE_GNU -#define __List_h_INCLUDE_GNU - -#include - -@interface List : Object -{ - @public - id *dataPtr; /* data of the List object */ - unsigned numElements; /* Actual number of elements */ - unsigned maxElements; /* Total allocated elements */ -} - -/* Creating, copying, freeing */ - -- free; -- freeObjects; -- shallowCopy; -- deepen; - -/* Initializing */ - -- init; -- initCount:(unsigned)numSlots; - -/* Comparing two lists */ - -- (BOOL)isEqual: anObject; - -/* Managing the storage capacity */ - -- (unsigned)capacity; -- setAvailableCapacity:(unsigned)numSlots; - -/* Manipulating objects by index */ - -- (unsigned)count; -- objectAt:(unsigned)index; -- lastObject; -- addObject:anObject; -- insertObject:anObject at:(unsigned)index; -- removeObjectAt:(unsigned)index; -- removeLastObject; -- replaceObjectAt:(unsigned)index with:newObject; -- appendList: (List *)otherList; - -/* Manipulating objects by id */ - -- (unsigned)indexOf:anObject; -- addObjectIfAbsent:anObject; -- removeObject:anObject; -- replaceObject:anObject with:newObject; - -/* Emptying the list */ - -- empty; - -/* Archiving */ - -- read: (TypedStream*)aStream; -- write: (TypedStream*)aStream; - -/* Sending messages to elements of the list */ - -- makeObjectsPerform:(SEL)aSel; -- makeObjectsPerform:(SEL)aSel with:anObject; - -/* old-style creation */ - -+ newCount:(unsigned)numSlots; - -@end - -typedef struct { - @defs(List) -} NXListId; - -#define NX_ADDRESS(x) (((NXListId *)(x))->dataPtr) - -#define NX_NOT_IN_LIST 0xffffffff - -#endif /* __List_h_INCLUDE_GNU */ diff --git a/Source/objc/NXStringTable.h b/Source/objc/NXStringTable.h deleted file mode 100644 index e334a3c34..000000000 --- a/Source/objc/NXStringTable.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Interface for Objective C NeXT-compatible NXStringTable object - Copyright (C) 1993,1994, 1997 Free Software Foundation, Inc. - - Written by: Adam Fedor - - This file is part of the GNU Objective-C Collection library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - StringTable.h - Hash table for strings in the NeXT StringTable style - -*/ - -#ifndef __NXStringTable_h_INCLUDE_GNU -#define __NXStringTable_h_INCLUDE_GNU - -#include - -#define MAX_NXSTRINGTABLE_LENGTH 1024 - -@interface NXStringTable: HashTable - -- init; - -- (const char *)valueForStringKey:(const char *)aString; - -- readFromStream:(FILE *)stream; -- readFromFile:(const char *)fileName; - -- writeToStream:(FILE *)stream; -- writeToFile:(const char *)fileName; - -@end - -#if 0 -static inline const char *STRVAL(NXStringTable *table, const char *key) { - return [table valueForStringKey:key]; -} -#else -#define STRVAL(TABLE,KEY) ([TABLE valueForStringKey: KEY]) -#endif - -#endif /* __NXStringTable_h_INCLUDE_GNU */ diff --git a/Source/objc/Storage.h b/Source/objc/Storage.h deleted file mode 100644 index 7ac1ca032..000000000 --- a/Source/objc/Storage.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Interface for Objective C NeXT-compatible Storage object - Copyright (C) 1993,1994 Free Software Foundation, Inc. - - Written by: Kresten Krab Thorup - Dept. of Mathematics and Computer Science, Aalborg U., Denmark - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/****************************************************************** - TODO: - Does not implement methods for archiving itself. -******************************************************************/ - -#ifndef __Storage_h_INCLUDE_GNU -#define __Storage_h_INCLUDE_GNU - -#include - -@interface Storage : Object -{ -@public - void *dataPtr; /* data of the Storage object */ - const char *description; /* Element description */ - unsigned numElements; /* Actual number of elements */ - unsigned maxElements; /* Total allocated elements */ - unsigned elementSize; /* Element size */ -} - -/* Creating, freeing, initializing, and emptying */ - -- init; -- initCount:(unsigned)numSlots elementSize:(unsigned)sizeInBytes - description:(const char*)elemDesc; -- free; -- empty; -- shallowCopy; - -/* Manipulating the elements */ - -- (BOOL)isEqual: anObject; -- (const char *)description; -- (unsigned)count; -- (void *)elementAt:(unsigned)index; -- replaceElementAt:(unsigned)index with:(void *)anElement; -- setNumSlots:(unsigned)numSlots; -- setAvailableCapacity:(unsigned)numSlots; -- addElement:(void *)anElement; -- removeLastElement; -- insertElement:(void *)anElement at:(unsigned)index; -- removeElementAt:(unsigned)index; - -/* Archiving */ - -- write:(TypedStream *)stream; -- read:(TypedStream *)stream; - -/* old-style creation */ - -+ new; -+ newCount:(unsigned)count elementSize:(unsigned)sizeInBytes - description:(const char *)descriptor; - -@end - -typedef struct { - @defs(Storage) - } NXStorageId; - - -#endif /* __Storage_h_INCLUDE_GNU */ diff --git a/Source/objc/zone.h b/Source/objc/zone.h deleted file mode 100644 index 47ebee18a..000000000 --- a/Source/objc/zone.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __zone_h_OBJECTS_INCLUDE -#define __zone_h_OBJECTS_INCLUDE - -#include - -typedef struct _NXZone -{ - void *(*realloc)(struct _NXZone *zonep, void *ptr, size_t size); - void *(*malloc)(struct _NXZone *zonep, size_t size); - void (*free)(struct _NXZone *zonep, void *ptr); - void (*destroy)(struct _NXZone *zonep); -} NXZone; - -#define NX_NOZONE ((NXZone *)0) -#define NXZoneMalloc(zonep, size) ((*(zonep)->malloc)(zonep, size)) -#define NXZoneRealloc(zonep, ptr, size) ((*(zonep)->realloc)(zonep, ptr, size)) -#define NXZoneFree(zonep, ptr) ((*(zonep)->free)(zonep, ptr)) -#define NXDestroyZone(zonep) ((*(zonep)->destroy)(zonep)) - -extern NXZone *NXDefaultMallocZone(void); -extern NXZone *NXCreateZone(size_t startSize, size_t granularity, int canFree); -extern NXZone *NXCreateChildZone(NXZone *parentZone, size_t startSize, - size_t granularity, int canFree); -extern void NXMergeZone(NXZone *zonep); -extern void *NXZoneCalloc(NXZone *zonep, size_t numElems, size_t byteSize); -extern NXZone *NXZoneFromPtr(void *ptr); -extern void NXZonePtrInfo(void *ptr); -extern void NXNameZone(NXZone *z, const char *name); -extern int NXMallocCheck(void); - -#endif /* __zone_h_OBJECTS_INCLUDE */