diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/Make-lang.in gcc-2.95/gcc/objc/Make-lang.in *** egcs-1.1.2/gcc/objc/Make-lang.in Thu May 14 17:44:32 1998 --- gcc-2.95/gcc/objc/Make-lang.in Tue Apr 20 15:47:49 1999 *************** OBJC_FLAGS_TO_PASS = \ *** 50,70 **** # # Define the names for selecting Objective-C in LANGUAGES. ! OBJC objc: cc1obj$(exeext) objc-runtime ! OBJECTIVE-C objective-c: cc1obj$(exeext) objc-runtime # Tell GNU make to ignore these if they exist. .PHONY: objective-c objc ObjC - # The Objective C thread file - OBJC_THREAD_FILE=thr-$(GCC_THREAD_FILE) - # Language-specific object files for Objective C. OBJC_OBJS = objc-parse.o objc-act.o $(C_AND_OBJC_OBJS) ! cc1obj$(exeext): $(P) $(OBJC_OBJS) $(OBJS) $(LIBDEPS) ! $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(OBJS) \ ! $(LIBS) # Objective C language specific files. --- 50,66 ---- # # Define the names for selecting Objective-C in LANGUAGES. ! OBJC objc: cc1obj$(exeext) ! OBJECTIVE-C objective-c: cc1obj$(exeext) # Tell GNU make to ignore these if they exist. .PHONY: objective-c objc ObjC # Language-specific object files for Objective C. OBJC_OBJS = objc-parse.o objc-act.o $(C_AND_OBJC_OBJS) ! cc1obj$(exeext): $(P) $(OBJS) $(OBJC_OBJS) $(LIBDEPS) ! $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(OBJC_OBJS) $(LIBS) # Objective C language specific files. *************** objc-parse.o : $(srcdir)/objc/objc-parse *** 75,83 **** $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ -c $(srcdir)/objc/objc-parse.c $(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y cd $(srcdir)/objc; \ ! $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y --- 71,80 ---- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ -c $(srcdir)/objc/objc-parse.c + $(INTL_TARGETS): $(srcdir)/objc/objc-parse.c $(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y cd $(srcdir)/objc; \ ! $(BISON) $(BISONFLAGS) -o objc-parse.c objc-parse.y $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y *************** objc-act.o : $(srcdir)/objc/objc-act.c \ *** 94,218 **** $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ -c $(srcdir)/objc/objc-act.c - objc-runtime: objc-headers libobjc.a - - # copy objc header files into build directory - objc-headers: stmp-fixinc - if [ -d include ]; then true; else mkdir include; fi - cd objc; \ - if [ -f Makefile ]; then \ - $(MAKE) copy-headers \ - tooldir=$(tooldir) \ - AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \ - GCC_FOR_TARGET="../xgcc -B../" \ - GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=../include; \ - fi - touch objc-headers - - # Objective C runtime library specific files. - - OBJC_O = objc/hash.o objc/sarray.o \ - objc/class.o objc/sendmsg.o \ - objc/init.o objc/archive.o \ - objc/encoding.o objc/selector.o \ - objc/objects.o objc/misc.o \ - objc/NXConstStr.o objc/Object.o \ - objc/Protocol.o objc/nil_method.o \ - objc/thr.o objc/linking.o \ - objc/$(OBJC_THREAD_FILE).o - - objc/hash.o: $(srcdir)/objc/hash.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/hash.c -o $@ - objc/sarray.o: $(srcdir)/objc/sarray.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/sarray.c -o $@ - objc/class.o: $(srcdir)/objc/class.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/class.c -o $@ - objc/sendmsg.o: $(srcdir)/objc/sendmsg.c $(GCC_PASSES) objc/runtime-info.h - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -Iobjc \ - -c $(srcdir)/objc/sendmsg.c -o $@ - objc/init.o: $(srcdir)/objc/init.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/init.c -o $@ - objc/archive.o: $(srcdir)/objc/archive.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/archive.c -o $@ - objc/encoding.o: $(srcdir)/objc/encoding.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/encoding.c -o $@ - objc/selector.o: $(srcdir)/objc/selector.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/selector.c -o $@ - objc/objects.o: $(srcdir)/objc/objects.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/objects.c -o $@ - objc/misc.o: $(srcdir)/objc/misc.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/misc.c -o $@ - objc/NXConstStr.o: $(srcdir)/objc/NXConstStr.m $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -fgnu-runtime -c $(srcdir)/objc/NXConstStr.m -o $@ - objc/Object.o: $(srcdir)/objc/Object.m $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -fgnu-runtime -c $(srcdir)/objc/Object.m -o $@ - objc/Protocol.o: $(srcdir)/objc/Protocol.m $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -fgnu-runtime -c $(srcdir)/objc/Protocol.m -o $@ - objc/thr.o: $(srcdir)/objc/thr.h $(srcdir)/objc/thr.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/thr.c -o $@ - objc/$(OBJC_THREAD_FILE).o: $(srcdir)/objc/$(OBJC_THREAD_FILE).c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/$(OBJC_THREAD_FILE).c -o $@ - objc/nil_method.o: $(srcdir)/objc/nil_method.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/nil_method.c -o $@ - objc/linking.o: $(srcdir)/objc/linking.m $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -fgnu-runtime -c $(srcdir)/objc/linking.m -o $@ - - objc/libobjc_entry.o: $(srcdir)/objc/libobjc_entry.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/libobjc_entry.c -o $@ - - $(OBJC_O): $(GCC_PASSES) cc1obj$(exeext) - - # Build the Objective C runtime library. - libobjc.a: cc1obj$(exeext) specs stmp-int-hdrs libgcc2.ready \ - $(USE_COLLECT2) $(EXTRA_PARTS) objc/runtime-info.h $(OBJC_O) - -rm -f libobjc.a - $(AR) $(AR_FLAGS) libobjc.a $(OBJC_O) - -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi - - libobjc_s.a: libobjc.a - mv libobjc.a libobjc_s.a - - # Create a relocatable DLL - libobjc.dll: libobjc_s.a objc/libobjc_entry.o - $(GCC_FOR_TARGET) -mdll -Wl,--base-file -Wl,libobjc.base \ - -o libobjc.dll libobjc_s.a \ - objc/libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \ - --base-file libobjc.base --output-exp libobjc.exp - $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \ - -o libobjc.dll libobjc_s.a \ - objc/libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \ - --base-file libobjc.base --output-exp libobjc.exp - $(GCC_FOR_TARGET) libobjc.exp -mdll \ - -o libobjc.dll libobjc_s.a \ - objc/libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \ - --output-lib libobjc.a - - # Platform generated information needed by ObjC runtime - objc/runtime-info.h: cc1obj$(exeext) - echo "" > tmp-runtime - echo "/* This file is automatically generated */" >$@ - ./cc1obj -print-objc-runtime-info tmp-runtime >>$@ - rm -f tmp-runtime # # Build hooks: --- 91,96 ---- *************** objc.dvi: *** 228,252 **** # Install hooks: # cc1obj is installed elsewhere as part of $(COMPILERS). ! objc.install-normal: installdirs ! -if [ -f libobjc.a ] ; then \ ! rm -f $(libsubdir)/libobjc.a; \ ! $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \ ! if $(RANLIB_TEST) ; then \ ! (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \ ! chmod a-x $(libsubdir)/libobjc.a; \ ! else true; fi ! -if [ -f libobjc_s.a ] ; then \ ! rm -f $(libsubdir)/libobjc_s.a; \ ! $(INSTALL_DATA) libobjc_s.a $(libsubdir)/libobjc_s.a; \ ! if $(RANLIB_TEST) ; then \ ! (cd $(libsubdir); $(RANLIB) libobjc_s.a); else true; fi; \ ! chmod a-x $(libsubdir)/libobjc_s.a; \ ! else true; fi ! -if [ -f libobjc.dll ] ; then \ ! rm -f $(bindir)/libobjc.dll; \ ! $(INSTALL_DATA) libobjc.dll $(bindir)/libobjc.dll; \ ! else true; fi objc.install-common: --- 106,112 ---- # Install hooks: # cc1obj is installed elsewhere as part of $(COMPILERS). ! objc.install-normal: objc.install-common: *************** objc.uninstall: *** 262,270 **** objc.mostlyclean: -rm -f tmp-objc-prs.y -rm -f objc/*$(objext) objc/xforward objc/fflags - -rm -f objc/runtime-info.h - -rm -f libobjc.a libobjc_s.a libobjc.dll - -rm -f libobjc.base libobjc.exp objc.clean: objc.mostlyclean -rm -rf objc-headers objc.distclean: --- 122,127 ---- *************** objc.maintainer-clean: *** 282,300 **** objc.stage1: stage1-start -mv objc/*$(objext) stage1/objc -mv cc1obj$(exeext) stage1 - -mv libobjc.a stage1 objc.stage2: stage2-start -mv objc/*$(objext) stage2/objc -mv cc1obj$(exeext) stage2 - -mv libobjc.a stage2 objc.stage3: stage3-start -mv objc/*$(objext) stage3/objc -mv cc1obj$(exeext) stage3 - -mv libobjc.a stage3 objc.stage4: stage4-start -mv objc/*$(objext) stage4/objc -mv cc1obj$(exeext) stage4 - -mv libobjc.a stage4 # # Maintenance hooks: --- 139,153 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/Makefile.in gcc-2.95/gcc/objc/Makefile.in *** egcs-1.1.2/gcc/objc/Makefile.in Sat Mar 21 15:49:21 1998 --- gcc-2.95/gcc/objc/Makefile.in Wed Jan 6 13:10:33 1999 *************** *** 1,5 **** ! # GNU Objective C Runtime Makefile ! # Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. # # This file is part of GNU CC. # --- 1,5 ---- ! # GNU Objective C frontend Makefile ! # Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # # This file is part of GNU CC. # *************** *** 17,37 **** # Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. ! # This makefile is run by the parent dir's makefile. ! # thisdir1=`pwd`; \ ! # srcdir1=`cd $(srcdir); pwd`; \ ! # cd objc; \ ! # $(MAKE) $(MAKEFLAGS) -f $$srcdir1/objc/Makefile libobjc.a \ ! # srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \ ! # GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \ ! # GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$$thisdir1/include ! # OBJC_THREAD_FILE="$(OBJC_THREAD_FILE)" ! # Two targets are used by ../Makefile: `all' and `mostlyclean'. SHELL=/bin/sh - .SUFFIXES: .m - OPTIMIZE= -O srcdir = . --- 17,35 ---- # Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. ! # The Makefile built from this file lives in the objc language subdirectory. ! # Its purpose is to provide support for: ! # ! # 1. recursion where necessary, and only then (building .o's), and ! # 2. building and debugging cc1objc from the language subdirectory. ! # ! # The parent Makefile handles all other chores, with help from the language ! # Makefile fragment. ! # ! # The targets for external use are `all' and `mostlyclean'. SHELL=/bin/sh OPTIMIZE= -O srcdir = . *************** all: all.indirect *** 56,88 **** ####build overrides # - OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \ - NXConstStr.h Object.h Protocol.h encoding.h typedstream.h thr.h - # Now figure out from those variables how to compile and link. ! all.indirect: Makefile compiler objc-runtime ! compiler: cd ..; $(MAKE) cc1obj$(exeext) - objc-runtime: - cd ..; $(MAKE) libobjc.a - - # copy objc headers to installation include directory - copy-headers: - -rm -fr $(incinstalldir)/objc - -mkdir $(incinstalldir)/objc - for file in $(OBJC_H); do \ - realfile=$(srcdir)/$${file}; \ - cp $${realfile} $(incinstalldir)/objc; \ - chmod a+r $(incinstalldir)/objc/$${file}; \ - done - Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure cd ..; $(SHELL) config.status mostlyclean: ! -rm -f *.o libobjc.a xforward fflags clean: mostlyclean distclean: mostlyclean extraclean: mostlyclean --- 54,70 ---- ####build overrides # # Now figure out from those variables how to compile and link. ! all.indirect: Makefile frontend ! frontend: cd ..; $(MAKE) cc1obj$(exeext) Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure cd ..; $(SHELL) config.status mostlyclean: ! -rm -f *.o xforward fflags clean: mostlyclean distclean: mostlyclean extraclean: mostlyclean diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/NXConstStr.h gcc-2.95/gcc/objc/NXConstStr.h *** egcs-1.1.2/gcc/objc/NXConstStr.h Wed May 6 14:08:33 1998 --- gcc-2.95/gcc/objc/NXConstStr.h Wed Dec 31 16:00:00 1969 *************** *** 1,44 **** - /* Interface for the NXConstantString class for Objective-C. - Copyright (C) 1995 Free Software Foundation, Inc. - Contributed by Pieter J. Schoenmakers - - 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 --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/NXConstStr.m gcc-2.95/gcc/objc/NXConstStr.m *** egcs-1.1.2/gcc/objc/NXConstStr.m Wed May 6 14:08:34 1998 --- gcc-2.95/gcc/objc/NXConstStr.m Wed Dec 31 16:00:00 1969 *************** *** 1,42 **** - /* Implementation of the NXConstantString class for Objective-C. - Copyright (C) 1995 Free Software Foundation, Inc. - Contributed by Pieter J. Schoenmakers - - 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. */ - - #include "objc/NXConstStr.h" - - @implementation NXConstantString - - -(const char *) cString - { - return (c_string); - } /* -cString */ - - -(unsigned int) length - { - return (len); - } /* -length */ - - @end --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/Object.h gcc-2.95/gcc/objc/Object.h *** egcs-1.1.2/gcc/objc/Object.h Wed May 6 14:08:35 1998 --- gcc-2.95/gcc/objc/Object.h Wed Dec 31 16:00:00 1969 *************** *** 1,124 **** - /* 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 - #include - - /* - * 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 --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/Object.m gcc-2.95/gcc/objc/Object.m *** egcs-1.1.2/gcc/objc/Object.m Wed May 6 14:08:36 1998 --- gcc-2.95/gcc/objc/Object.m Wed Dec 31 16:00:00 1969 *************** *** 1,387 **** - /* The implementation of class Object for Objective-C. - Copyright (C) 1993, 1994, 1995, 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. */ - - #include - #include "objc/Object.h" - #include "objc/Protocol.h" - #include "objc/objc-api.h" - - extern int errno; - - #define MAX_CLASS_NAME_LEN 256 - - @implementation Object - - + initialize - { - return self; - } - - - init - { - return self; - } - - + new - { - return [[self alloc] init]; - } - - + alloc - { - return class_create_instance(self); - } - - - free - { - return object_dispose(self); - } - - - copy - { - return [[self shallowCopy] deepen]; - } - - - shallowCopy - { - return object_copy(self); - } - - - deepen - { - return self; - } - - - deepCopy - { - return [self copy]; - } - - - (Class)class - { - return object_get_class(self); - } - - - (Class)superClass - { - return object_get_super_class(self); - } - - - (MetaClass)metaClass - { - return object_get_meta_class(self); - } - - - (const char *)name - { - return object_get_class_name(self); - } - - - self - { - return self; - } - - - (unsigned int)hash - { - return (size_t)self; - } - - - (BOOL)isEqual:anObject - { - return self==anObject; - } - - - (int)compare:anotherObject; - { - if ([self isEqual:anotherObject]) - return 0; - // Ordering objects by their address is pretty useless, - // so subclasses should override this is some useful way. - else if (self > anotherObject) - return 1; - else - return -1; - } - - - (BOOL)isMetaClass - { - return NO; - } - - - (BOOL)isClass - { - return object_is_class(self); - } - - - (BOOL)isInstance - { - return object_is_instance(self); - } - - - (BOOL)isKindOf:(Class)aClassObject - { - Class class; - - for (class = self->isa; class!=Nil; class = class_get_super_class(class)) - if (class==aClassObject) - return YES; - return NO; - } - - - (BOOL)isMemberOf:(Class)aClassObject - { - return self->isa==aClassObject; - } - - - (BOOL)isKindOfClassNamed:(const char *)aClassName - { - Class class; - - if (aClassName!=NULL) - for (class = self->isa; class!=Nil; class = class_get_super_class(class)) - if (!strcmp(class_get_class_name(class), aClassName)) - return YES; - return NO; - } - - - (BOOL)isMemberOfClassNamed:(const char *)aClassName - { - return ((aClassName!=NULL) - &&!strcmp(class_get_class_name(self->isa), aClassName)); - } - - + (BOOL)instancesRespondTo:(SEL)aSel - { - return class_get_instance_method(self, aSel)!=METHOD_NULL; - } - - - (BOOL)respondsTo:(SEL)aSel - { - return ((object_is_instance(self) - ?class_get_instance_method(self->isa, aSel) - :class_get_class_method(self->isa, aSel))!=METHOD_NULL); - } - - + (IMP)instanceMethodFor:(SEL)aSel - { - return method_get_imp(class_get_instance_method(self, aSel)); - } - - // Indicates if the receiving class or instance conforms to the given protocol - // not usually overridden by subclasses - // - // Modified 9/5/94 to always search the class object's protocol list, rather - // than the meta class. - - + (BOOL) conformsTo: (Protocol*)aProtocol - { - int i; - struct objc_protocol_list* proto_list; - id parent; - - for (proto_list = ((Class)self)->protocols; - proto_list; proto_list = proto_list->next) - { - for (i=0; i < proto_list->count; i++) - { - if ([proto_list->list[i] conformsTo: aProtocol]) - return YES; - } - } - - if ((parent = [self superClass])) - return [parent conformsTo: aProtocol]; - else - return NO; - } - - - (BOOL) conformsTo: (Protocol*)aProtocol - { - return [[self class] conformsTo:aProtocol]; - } - - - (IMP)methodFor:(SEL)aSel - { - return (method_get_imp(object_is_instance(self) - ?class_get_instance_method(self->isa, aSel) - :class_get_class_method(self->isa, aSel))); - } - - + (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel - { - return ((struct objc_method_description *) - class_get_instance_method(self, aSel)); - } - - - (struct objc_method_description *)descriptionForMethod:(SEL)aSel - { - return ((struct objc_method_description *) - (object_is_instance(self) - ?class_get_instance_method(self->isa, aSel) - :class_get_class_method(self->isa, aSel))); - } - - - perform:(SEL)aSel - { - IMP msg = objc_msg_lookup(self, aSel); - if (!msg) - return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; - return (*msg)(self, aSel); - } - - - perform:(SEL)aSel with:anObject - { - IMP msg = objc_msg_lookup(self, aSel); - if (!msg) - return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; - return (*msg)(self, aSel, anObject); - } - - - perform:(SEL)aSel with:anObject1 with:anObject2 - { - IMP msg = objc_msg_lookup(self, aSel); - if (!msg) - return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; - return (*msg)(self, aSel, anObject1, anObject2); - } - - - (retval_t)forward:(SEL)aSel :(arglist_t)argFrame - { - return (retval_t)[self doesNotRecognize: aSel]; - } - - - (retval_t)performv:(SEL)aSel :(arglist_t)argFrame - { - return objc_msg_sendv(self, aSel, argFrame); - } - - + poseAs:(Class)aClassObject - { - return class_pose_as(self, aClassObject); - } - - - (Class)transmuteClassTo:(Class)aClassObject - { - if (object_is_instance(self)) - if (class_is_class(aClassObject)) - if (class_get_instance_size(aClassObject)==class_get_instance_size(isa)) - if ([self isKindOf:aClassObject]) - { - Class old_isa = isa; - isa = aClassObject; - return old_isa; - } - return nil; - } - - - subclassResponsibility:(SEL)aSel - { - return [self error:"subclass should override %s", sel_get_name(aSel)]; - } - - - notImplemented:(SEL)aSel - { - return [self error:"method %s not implemented", sel_get_name(aSel)]; - } - - - shouldNotImplement:(SEL)aSel - { - return [self error:"%s should not implement %s", - object_get_class_name(self), sel_get_name(aSel)]; - } - - - doesNotRecognize:(SEL)aSel - { - return [self error:"%s does not recognize %s", - object_get_class_name(self), sel_get_name(aSel)]; - } - - #ifdef __alpha__ - extern size_t strlen(const char*); - #endif - - - error:(const char *)aString, ... - { - #define FMT "error: %s (%s)\n%s\n" - char fmt[(strlen((char*)FMT)+strlen((char*)object_get_class_name(self)) - +((aString!=NULL)?strlen((char*)aString):0)+8)]; - va_list ap; - - sprintf(fmt, FMT, object_get_class_name(self), - object_is_instance(self)?"instance":"class", - (aString!=NULL)?aString:""); - va_start(ap, aString); - objc_verror(self, OBJC_ERR_UNKNOWN, fmt, ap); - va_end(ap); - return nil; - #undef FMT - } - - + (int)version - { - return class_get_version(self); - } - - + setVersion:(int)aVersion - { - class_set_version(self, aVersion); - return self; - } - - + (int)streamVersion: (TypedStream*)aStream - { - if (aStream->mode == OBJC_READONLY) - return objc_get_stream_class_version (aStream, self); - else - return class_get_version (self); - } - - // These are used to write or read the instance variables - // declared in this particular part of the object. Subclasses - // should extend these, by calling [super read/write: aStream] - // before doing their own archiving. These methods are private, in - // the sense that they should only be called from subclasses. - - - read: (TypedStream*)aStream - { - // [super read: aStream]; - return self; - } - - - write: (TypedStream*)aStream - { - // [super write: aStream]; - return self; - } - - - awake - { - // [super awake]; - return self; - } - - @end --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/Protocol.h gcc-2.95/gcc/objc/Protocol.h *** egcs-1.1.2/gcc/objc/Protocol.h Mon Aug 11 08:58:07 1997 --- gcc-2.95/gcc/objc/Protocol.h Wed Dec 31 16:00:00 1969 *************** *** 1,58 **** - /* 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 __Protocol_INCLUDE_GNU --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/Protocol.m gcc-2.95/gcc/objc/Protocol.m *** egcs-1.1.2/gcc/objc/Protocol.m Mon Aug 11 08:58:07 1997 --- gcc-2.95/gcc/objc/Protocol.m Wed Dec 31 16:00:00 1969 *************** *** 1,128 **** - /* This file contains the implementation of class Protocol. - 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. */ - - #include "objc/Protocol.h" - #include "objc/objc-api.h" - - /* Method description list */ - struct objc_method_description_list { - int count; - struct objc_method_description list[1]; - }; - - - @implementation Protocol - { - @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 - { - return protocol_name; - } - - /* Testing protocol conformance */ - - - (BOOL) conformsTo: (Protocol *)aProtocolObject - { - int i; - struct objc_protocol_list* proto_list; - - if (!strcmp(aProtocolObject->protocol_name, self->protocol_name)) - return YES; - - for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) - { - for (i=0; i < proto_list->count; i++) - { - if ([proto_list->list[i] conformsTo: aProtocolObject]) - return YES; - } - } - - return NO; - } - - /* Looking up information specific to a protocol */ - - - (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel - { - int i; - struct objc_protocol_list* proto_list; - const char* name = sel_get_name (aSel); - struct objc_method_description *result; - - for (i = 0; i < instance_methods->count; i++) - { - if (!strcmp ((char*)instance_methods->list[i].name, name)) - return &(instance_methods->list[i]); - } - - for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) - { - for (i=0; i < proto_list->count; i++) - { - if ((result = [proto_list->list[i] - descriptionForInstanceMethod: aSel])) - return result; - } - } - - return NULL; - } - - - (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel; - { - int i; - struct objc_protocol_list* proto_list; - const char* name = sel_get_name (aSel); - struct objc_method_description *result; - - for (i = 0; i < class_methods->count; i++) - { - if (!strcmp ((char*)class_methods->list[i].name, name)) - return &(class_methods->list[i]); - } - - for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) - { - for (i=0; i < proto_list->count; i++) - { - if ((result = [proto_list->list[i] - descriptionForClassMethod: aSel])) - return result; - } - } - - return NULL; - } - - @end --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/README.threads gcc-2.95/gcc/objc/README.threads *** egcs-1.1.2/gcc/objc/README.threads Mon Aug 11 08:58:11 1997 --- gcc-2.95/gcc/objc/README.threads Wed Dec 31 16:00:00 1969 *************** *** 1,50 **** - ============================================================================== - README - Wed Nov 29 15:16:24 EST 1995 - ------------------------------------------------------------------------------ - - Limited documentation is available in the THREADS file. - - This version has been tested on Sun Solaris, SGI Irix, and Windows NT. - It should also work on any single threaded system. - - Thanks go to the following people for help test and debug the library: - - Scott Christley, scottc@ocbi.com - Andrew McCallum, mccallum@cs.rochester.edu - - galen - gchunt@cs.rochester.edu - - Any questions, bug reports, etc should be directed to: - - Scott Christley, scottc@ocbi.com - - Please do not bug Galen with email as he no longer supports the code. - - ============================================================================== - Changes from prior releases (in revered chronological order): - ------------------------------------------------------------------------------ - - * Fixed bug in copy part of sarray_realloc. I had an < which should - have been <=. (Bug report from Scott). - - ------------------------------------------------------------------------------ - - * Support for DEC OSF/1 is definitely broken. My programs always - seg-fault when I link with libpthreads.a. - - * Thread id's are no longer int's, but are instead of type - _objc_thread_t which is typedef'ed from a void *. An invalid thread - id is denoted by NULL and not -1 as before. - - ------------------------------------------------------------------------------ - - * Renamed thread-winnt.c to thread-win32.c to better reflect support - for the API on both Windows NT and Windows 95 platforms. - (Who knows, maybe even Win32s :-). - - * Fixed bugs in Win32 support as per report from Scott Christley. - - * Fixed bug in sarray_get as per report from Scott Christley. - - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/THREADS gcc-2.95/gcc/objc/THREADS *** egcs-1.1.2/gcc/objc/THREADS Sat Dec 6 09:29:41 1997 --- gcc-2.95/gcc/objc/THREADS Wed Dec 31 16:00:00 1969 *************** *** 1,374 **** - This file describes in little detail the modifications to the - Objective-C runtime needed to make it thread safe. - - First off, kudos to Galen Hunt who is the author of this great work. - - If you have an comments or just want to know where to - send me money to express your undying gratitude for threading the - Objective-C runtime you can reach Galen at: - - gchunt@cs.rochester.edu - - Any questions, comments, bug reports, etc. should send email either to the - GCC bug account or to: - - Scott Christley - - * Sarray Threading: - - The most critical component of the Objective-C runtime is the sparse array - structure (sarray). Sarrays store object selectors and implementations. - Following in the tradition of the Objective-C runtime, my threading - support assumes that fast message dispatching is far more important - than *ANY* and *ALL* other operations. The message dispatching thus - uses *NO* locks on any kind. In fact, if you look in sarray.h, you - will notice that the message dispatching has not been modified. - Instead, I have modified the sarray management functions so that all - updates to the sarray data structure can be made in parallel will - message dispatching. - - To support concurrent message dispatching, no dynamically allocated - sarray data structures are freed while more than one thread is - operational. Sarray data structures that are no longer in use are - kept in a linked list of garbage and are released whenever the program - is operating with a single thread. The programmer can also flush the - garbage list by calling sarray_remove_garbage when the programmer can - ensure that no message dispatching is taking place concurrently. The - amount of un-reclaimed sarray garbage should normally be extremely - small in a real program as sarray structures are freed only when using - the "poseAs" functionality and early in program initialization, which - normally occurs while the program is single threaded. - - ****************************************************************************** - * Static Variables: - - The following variables are either statically or globally defined. This list - does not include variables which are internal to implementation dependent - versions of thread-*.c. - - The following threading designations are used: - SAFE : Implicitly thread safe. - SINGLE : Must only be used in single thread mode. - MUTEX : Protected by single global mutex objc_runtime_mutex. - UNUSED : Not used in the runtime. - - Variable Name: Usage: Defined: Also used in: - =========================== ====== ============ ===================== - __objc_class_hash MUTEX class.c - __objc_class_links_resolved UNUSED class.c runtime.h - __objc_class_number MUTEX class.c - __objc_dangling_categories UNUSED init.c - __objc_module_list MUTEX init.c - __objc_selector_array MUTEX selector.c - __objc_selector_hash MUTEX selector.c - __objc_selector_max_index MUTEX selector.c sendmsg.c runtime.h - __objc_selector_names MUTEX selector.c - __objc_thread_exit_status SAFE thread.c - __objc_uninstalled_dtable MUTEX sendmsg.c selector.c - _objc_load_callback SAFE init.c objc-api.h - _objc_lookup_class SAFE class.c objc-api.h - _objc_object_alloc SINGLE objects.c objc-api.h - _objc_object_copy SINGLE objects.c objc-api.h - _objc_object_dispose SINGLE objects.c objc-api.h - frwd_sel SAFE2 sendmsg.c - idxsize MUTEX sarray.c sendmsg.c sarray.h - initialize_sel SAFE2 sendmsg.c - narrays MUTEX sarray.c sendmsg.c sarray.h - nbuckets MUTEX sarray.c sendmsg.c sarray.h - nindices MUTEX sarray.c sarray.h - previous_constructors SAFE1 init.c - proto_class SAFE1 init.c - unclaimed_categories MUTEX init.c - unclaimed_proto_list MUTEX init.c - uninitialized_statics MUTEX init.c - - Notes: - 1) Initialized once in unithread mode. - 2) Initialized value will always be same, guaranteed by lock on selector - hash table. - - - ****************************************************************************** - * Frontend/Backend design: - - The design of the Objective-C runtime thread and mutex functions utilizes a - frontend/backend implementation. - - The frontend, as characterized by the files thr.h and thr.c, is a set - of platform independent structures and functions which represent the - user interface. Objective-C programs should use these structures and - functions for their thread and mutex work if they wish to maintain a - high degree of portability across platforms. - - The backend is composed of a file with the necessary code to map the ObjC - thread and mutex to a platform specific implementation. For example, the - file thr-solaris.c contains the implementation for Solaris. When you - configure GCC, it attempts to pick an appropriate backend file for the - target platform; however, you can override this choice by assign the - OBJC_THREAD_FILE make variable to the basename of the backend file. This - is especially useful on platforms which have multiple thread libraries. - For example: - - make OBJC_THREAD_FILE=thr-posix - - would indicate that the generic posix backend file, thr-posix.c, should be - compiled with the ObjC runtime library. If your platform does not support - threads then you should specify the OBJC_THREAD_FILE=thr-single backend file - to compile the ObjC runtime library without thread or mutex support; note - that programs which rely upon the ObjC thread and mutex functions will - compile and link correctly but attempting to create a thread or mutex will - result in an error. - - It is questionable whether it is really necessary to have both a - frontend and backend function for all available functionality. On the - one hand, it provides a clear, consistent differentiation between what - is public and what is private with the downside of having the overhead - of multiple functions calls. For example, the function to have a thread - yield the processor is objc_thread_yield; in the current implementation - this produces a function call set: - - objc_thread_yield() -> __objc_thread_yield() -> system yield function - - This has two extra function calls over calling the platform specific function - explicitly, but the issue is whether only the overhead of a single function - is necessary. - - objc_thread_yield() -> system yield function - - This breaks the public/private dichotomy between the frontend/backend - for the sake of efficiency. It is possible to just use a preprocessor - define so as to eliminate the extra function call: - - #define objc_thread_yield() __objc_thread_yield() - - This has the undesirable effect that if objc_thread_yield is actually - turned into a function based upon future need; then ObjC programs which - access the thread functions would need to be recompiled versus just - being relinked. - - ****************************************************************************** - * Threads: - - The thread system attempts to create multiple threads using whatever - operating system or library thread support is available. It does - assume that all system functions are thread safe. Notably this means - that the system implementation of malloc and free must be thread safe. - If a system has multiple processors, the threads are configured for - full parallel processing. - - * Backend initialization functions - - __objc_init_thread_system(void), int - Initialize the thread subsystem. Called once by __objc_exec_class. - Return -1 if error otherwise return 0. - - __objc_close_thread_system(void), int - Closes the thread subsystem, not currently guaranteed to be called. - Return -1 if error otherwise return 0. - - ***** - * Frontend thread functions - * User programs should use these functions. - - objc_thread_detach(SEL selector, id object, id argument), objc_thread_t - Creates and detaches a new thread. The new thread starts by - sending the given selector with a single argument to the - given object. - - objc_thread_set_priority(int priority), int - Sets a thread's relative priority within the program. Valid - options are: - - OBJC_THREAD_INTERACTIVE_PRIORITY - OBJC_THREAD_BACKGROUND_PRIORITY - OBJC_THREAD_LOW_PRIORITY - - objc_thread_get_priority(void), int - Query a thread's priority. - - objc_thread_yield(void), void - Yields processor to another thread with equal or higher - priority. It is up to the system scheduler to determine if - the processor is taken or not. - - objc_thread_exit(void), int - Terminates a thread. If this is the last thread executing - then the program will terminate. - - objc_thread_id(void), int - Returns the current thread's id. - - objc_thread_set_data(void *value), int - Set a pointer to the thread's local storage. Local storage is - thread specific. - - objc_thread_get_data(void), void * - Returns the pointer to the thread's local storage. - - ***** - * Backend thread functions - * User programs should *NOT* directly call these functions. - - __objc_thread_detach(void (*func)(void *arg), void *arg), objc_thread_t - Spawns a new thread executing func, called by objc_thread_detach. - Return NULL if error otherwise return thread id. - - __objc_thread_set_priority(int priority), int - Set the thread's priority, called by objc_thread_set_priority. - Return -1 if error otherwise return 0. - - __objc_thread_get_priority(void), int - Query a thread's priority, called by objc_thread_get_priority. - Return -1 if error otherwise return the priority. - - __objc_thread_yield(void), void - Yields the processor, called by objc_thread_yield. - - __objc_thread_exit(void), int - Terminates the thread, called by objc_thread_exit. - Return -1 if error otherwise function does not return. - - __objc_thread_id(void), objc_thread_t - Returns the current thread's id, called by objc_thread_id. - Return -1 if error otherwise return thread id. - - __objc_thread_set_data(void *value), int - Set pointer for thread local storage, called by objc_thread_set_data. - Returns -1 if error otherwise return 0. - - __objc_thread_get_data(void), void * - Returns the pointer to the thread's local storage. - Returns NULL if error, called by objc_thread_get_data. - - - ****************************************************************************** - * Mutexes: - - Mutexes can be locked recursively. Each locked mutex remembers - its owner (by thread id) and how many times it has been locked. The - last unlock on a mutex removes the system lock and allows other - threads to access the mutex. - - ***** - * Frontend mutex functions - * User programs should use these functions. - - objc_mutex_allocate(void), objc_mutex_t - Allocates a new mutex. Mutex is initially unlocked. - Return NULL if error otherwise return mutex pointer. - - objc_mutex_deallocate(objc_mutex_t mutex), int - Free a mutex. Before freeing the mutex, makes sure that no - one else is using it. - Return -1 if error otherwise return 0. - - objc_mutex_lock(objc_mutex_t mutex), int - Locks a mutex. As mentioned earlier, the same thread may call - this routine repeatedly. - Return -1 if error otherwise return 0. - - objc_mutex_trylock(objc_mutex_t mutex), int - Attempts to lock a mutex. If lock on mutex can be acquired - then function operates exactly as objc_mutex_lock. - Return -1 if failed to acquire lock otherwise return 0. - - objc_mutex_unlock(objc_mutex_t mutex), int - Unlocks the mutex by one level. Other threads may not acquire - the mutex until this thread has released all locks on it. - Return -1 if error otherwise return 0. - - ***** - * Backend mutex functions - * User programs should *NOT* directly call these functions. - - __objc_mutex_allocate(objc_mutex_t mutex), int - Allocates a new mutex, called by objc_mutex_allocate. - Return -1 if error otherwise return 0. - - __objc_mutex_deallocate(objc_mutex_t mutex), int - Free a mutex, called by objc_mutex_deallocate. - Return -1 if error otherwise return 0. - - __objc_mutex_lock(objc_mutex_t mutex), int - Locks a mutex, called by objc_mutex_lock. - Return -1 if error otherwise return 0. - - __objc_mutex_trylock(objc_mutex_t mutex), int - Attempts to lock a mutex, called by objc_mutex_trylock. - Return -1 if failed to acquire lock or error otherwise return 0. - - __objc_mutex_unlock(objc_mutex_t mutex), int - Unlocks the mutex, called by objc_mutex_unlock. - Return -1 if error otherwise return 0. - - ****************************************************************************** - * Condition Mutexes: - - Mutexes can be locked recursively. Each locked mutex remembers - its owner (by thread id) and how many times it has been locked. The - last unlock on a mutex removes the system lock and allows other - threads to access the mutex. - - * - * Frontend condition mutex functions - * User programs should use these functions. - * - - objc_condition_allocate(void), objc_condition_t - Allocate a condition mutex. - Return NULL if error otherwise return condition pointer. - - objc_condition_deallocate(objc_condition_t condition), int - Deallocate a condition. Note that this includes an implicit - condition_broadcast to insure that waiting threads have the - opportunity to wake. It is legal to dealloc a condition only - if no other thread is/will be using it. Does NOT check for - other threads waiting but just wakes them up. - Return -1 if error otherwise return 0. - - objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int - Wait on the condition unlocking the mutex until objc_condition_signal() - or objc_condition_broadcast() are called for the same condition. The - given mutex *must* have the depth 1 so that it can be unlocked - here, for someone else can lock it and signal/broadcast the condition. - The mutex is used to lock access to the shared data that make up the - "condition" predicate. - Return -1 if error otherwise return 0. - - objc_condition_broadcast(objc_condition_t condition), int - Wake up all threads waiting on this condition. It is recommended that - the called would lock the same mutex as the threads in - objc_condition_wait before changing the "condition predicate" - and make this call and unlock it right away after this call. - Return -1 if error otherwise return 0. - - objc_condition_signal(objc_condition_t condition), int - Wake up one thread waiting on this condition. - Return -1 if error otherwise return 0. - - * - * Backend condition mutex functions - * User programs should *NOT* directly call these functions. - * - - __objc_condition_allocate(objc_condition_t condition), int - Allocate a condition mutex, called by objc_condition_allocate. - Return -1 if error otherwise return 0. - - __objc_condition_deallocate(objc_condition_t condition), int - Deallocate a condition, called by objc_condition_deallocate. - Return -1 if error otherwise return 0. - - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int - Wait on the condition, called by objc_condition_wait. - Return -1 if error otherwise return 0 when condition is met. - - __objc_condition_broadcast(objc_condition_t condition), int - Wake up all threads waiting on this condition. - Called by objc_condition_broadcast. - Return -1 if error otherwise return 0. - - __objc_condition_signal(objc_condition_t condition), int - Wake up one thread waiting on this condition. - Called by objc_condition_signal. - Return -1 if error otherwise return 0. --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/THREADS.MACH gcc-2.95/gcc/objc/THREADS.MACH *** egcs-1.1.2/gcc/objc/THREADS.MACH Mon Aug 11 08:58:12 1997 --- gcc-2.95/gcc/objc/THREADS.MACH Wed Dec 31 16:00:00 1969 *************** *** 1,23 **** - This readme refers to the file thr-mach.c. - - Under mach, thread priorities are kinda strange-- any given thread has - a MAXIMUM priority and a BASE priority. The BASE priority is the - current priority of the thread and the MAXIMUM is the maximum possible - priority the thread can assume. The developer can lower, but never - raise the maximum priority. - - The gcc concept of thread priorities is that they run at one of three - levels; interactive, background, and low. - - Under mach, this is translated to: - - interactive -- set priority to maximum - background -- set priority to 2/3 of maximum - low -- set priority to 1/3 of maximum - - This means that it is possible for a thread with the priority of - interactive to actually run at a lower priority than another thread - with a background, or even low, priority if the developer has modified - the maximum priority. - - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/archive.c gcc-2.95/gcc/objc/archive.c *** egcs-1.1.2/gcc/objc/archive.c Sat Jun 27 16:04:40 1998 --- gcc-2.95/gcc/objc/archive.c Wed Dec 31 16:00:00 1969 *************** *** 1,1651 **** - /* GNU Objective C Runtime archiving - 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. */ - - #include "config.h" - #include "runtime.h" - #include "typedstream.h" - #include "encoding.h" - - #ifdef HAVE_STDLIB_H - #include - #endif - - extern int fflush(FILE*); - - #define ROUND(V, A) \ - ({ typeof(V) __v=(V); typeof(A) __a=(A); \ - __a*((__v+__a-1)/__a); }) - - #define PTR2LONG(P) (((char*)(P))-(char*)0) - #define LONG2PTR(L) (((char*)0)+(L)) - - /* Declare some functions... */ - - static int - objc_read_class (struct objc_typed_stream* stream, Class* class); - - int objc_sizeof_type(const char* type); - - static int - objc_write_use_common (struct objc_typed_stream* stream, unsigned long key); - - static int - objc_write_register_common (struct objc_typed_stream* stream, - unsigned long key); - - static int - objc_write_class (struct objc_typed_stream* stream, - struct objc_class* class); - - const char* objc_skip_type (const char* type); - - static void __objc_finish_write_root_object(struct objc_typed_stream*); - static void __objc_finish_read_root_object(struct objc_typed_stream*); - - static __inline__ int - __objc_code_unsigned_char (unsigned char* buf, unsigned char val) - { - if ((val&_B_VALUE) == val) - { - buf[0] = val|_B_SINT; - return 1; - } - else - { - buf[0] = _B_NINT|0x01; - buf[1] = val; - return 2; - } - } - - int - objc_write_unsigned_char (struct objc_typed_stream* stream, - unsigned char value) - { - unsigned char buf[sizeof (unsigned char)+1]; - int len = __objc_code_unsigned_char (buf, value); - return (*stream->write)(stream->physical, buf, len); - } - - static __inline__ int - __objc_code_char (unsigned char* buf, char val) - { - if (val >= 0) - return __objc_code_unsigned_char (buf, val); - else - { - buf[0] = _B_NINT|_B_SIGN|0x01; - buf[1] = -val; - return 2; - } - } - - int - objc_write_char (struct objc_typed_stream* stream, char value) - { - unsigned char buf[sizeof (char)+1]; - int len = __objc_code_char (buf, value); - return (*stream->write)(stream->physical, buf, len); - } - - static __inline__ int - __objc_code_unsigned_short (unsigned char* buf, unsigned short val) - { - if ((val&_B_VALUE) == val) - { - buf[0] = val|_B_SINT; - return 1; - } - else - { - int c, b; - - buf[0] = _B_NINT; - - for (c= sizeof(short); c != 0; c -= 1) - if (((val>>(8*(c-1)))%0x100) != 0) - break; - - buf[0] |= c; - - for (b = 1; c != 0; c--, b++) - { - buf[b] = (val >> (8*(c-1)))%0x100; - } - - return b; - } - } - - int - objc_write_unsigned_short (struct objc_typed_stream* stream, - unsigned short value) - { - unsigned char buf[sizeof (unsigned short)+1]; - int len = __objc_code_unsigned_short (buf, value); - return (*stream->write)(stream->physical, buf, len); - } - - static __inline__ int - __objc_code_short (unsigned char* buf, short val) - { - int sign = (val < 0); - int size = __objc_code_unsigned_short (buf, sign ? -val : val); - if (sign) - buf[0] |= _B_SIGN; - return size; - } - - int - objc_write_short (struct objc_typed_stream* stream, short value) - { - unsigned char buf[sizeof (short)+1]; - int len = __objc_code_short (buf, value); - return (*stream->write)(stream->physical, buf, len); - } - - - static __inline__ int - __objc_code_unsigned_int (unsigned char* buf, unsigned int val) - { - if ((val&_B_VALUE) == val) - { - buf[0] = val|_B_SINT; - return 1; - } - else - { - int c, b; - - buf[0] = _B_NINT; - - for (c= sizeof(int); c != 0; c -= 1) - if (((val>>(8*(c-1)))%0x100) != 0) - break; - - buf[0] |= c; - - for (b = 1; c != 0; c--, b++) - { - buf[b] = (val >> (8*(c-1)))%0x100; - } - - return b; - } - } - - int - objc_write_unsigned_int (struct objc_typed_stream* stream, unsigned int value) - { - unsigned char buf[sizeof(unsigned int)+1]; - int len = __objc_code_unsigned_int (buf, value); - return (*stream->write)(stream->physical, buf, len); - } - - static __inline__ int - __objc_code_int (unsigned char* buf, int val) - { - int sign = (val < 0); - int size = __objc_code_unsigned_int (buf, sign ? -val : val); - if (sign) - buf[0] |= _B_SIGN; - return size; - } - - int - objc_write_int (struct objc_typed_stream* stream, int value) - { - unsigned char buf[sizeof(int)+1]; - int len = __objc_code_int (buf, value); - return (*stream->write)(stream->physical, buf, len); - } - - static __inline__ int - __objc_code_unsigned_long (unsigned char* buf, unsigned long val) - { - if ((val&_B_VALUE) == val) - { - buf[0] = val|_B_SINT; - return 1; - } - else - { - int c, b; - - buf[0] = _B_NINT; - - for (c= sizeof(long); c != 0; c -= 1) - if (((val>>(8*(c-1)))%0x100) != 0) - break; - - buf[0] |= c; - - for (b = 1; c != 0; c--, b++) - { - buf[b] = (val >> (8*(c-1)))%0x100; - } - - return b; - } - } - - int - objc_write_unsigned_long (struct objc_typed_stream* stream, - unsigned long value) - { - unsigned char buf[sizeof(unsigned long)+1]; - int len = __objc_code_unsigned_long (buf, value); - return (*stream->write)(stream->physical, buf, len); - } - - static __inline__ int - __objc_code_long (unsigned char* buf, long val) - { - int sign = (val < 0); - int size = __objc_code_unsigned_long (buf, sign ? -val : val); - if (sign) - buf[0] |= _B_SIGN; - return size; - } - - int - objc_write_long (struct objc_typed_stream* stream, long value) - { - unsigned char buf[sizeof(long)+1]; - int len = __objc_code_long (buf, value); - return (*stream->write)(stream->physical, buf, len); - } - - - int - objc_write_string (struct objc_typed_stream* stream, - const unsigned char* string, unsigned int nbytes) - { - unsigned char buf[sizeof(unsigned int)+1]; - int len = __objc_code_unsigned_int (buf, nbytes); - - if ((buf[0]&_B_CODE) == _B_SINT) - buf[0] = (buf[0]&_B_VALUE)|_B_SSTR; - - else /* _B_NINT */ - buf[0] = (buf[0]&_B_VALUE)|_B_NSTR; - - if ((*stream->write)(stream->physical, buf, len) != 0) - return (*stream->write)(stream->physical, string, nbytes); - else - return 0; - } - - int - objc_write_string_atomic (struct objc_typed_stream* stream, - unsigned char* string, unsigned int nbytes) - { - unsigned long key; - if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, string)))) - return objc_write_use_common (stream, key); - else - { - int length; - hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(string)), string); - if ((length = objc_write_register_common (stream, key))) - return objc_write_string (stream, string, nbytes); - return length; - } - } - - static int - objc_write_register_common (struct objc_typed_stream* stream, - unsigned long key) - { - unsigned char buf[sizeof (unsigned long)+2]; - int len = __objc_code_unsigned_long (buf+1, key); - if (len == 1) - { - buf[0] = _B_RCOMM|0x01; - buf[1] &= _B_VALUE; - return (*stream->write)(stream->physical, buf, len+1); - } - else - { - buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM; - return (*stream->write)(stream->physical, buf+1, len); - } - } - - static int - objc_write_use_common (struct objc_typed_stream* stream, unsigned long key) - { - unsigned char buf[sizeof (unsigned long)+2]; - int len = __objc_code_unsigned_long (buf+1, key); - if (len == 1) - { - buf[0] = _B_UCOMM|0x01; - buf[1] &= _B_VALUE; - return (*stream->write)(stream->physical, buf, 2); - } - else - { - buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM; - return (*stream->write)(stream->physical, buf+1, len); - } - } - - static __inline__ int - __objc_write_extension (struct objc_typed_stream* stream, unsigned char code) - { - if (code <= _B_VALUE) - { - unsigned char buf = code|_B_EXT; - return (*stream->write)(stream->physical, &buf, 1); - } - else - { - objc_error(nil, OBJC_ERR_BAD_OPCODE, - "__objc_write_extension: bad opcode %c\n", code); - return -1; - } - } - - __inline__ int - __objc_write_object (struct objc_typed_stream* stream, id object) - { - unsigned char buf = '\0'; - SEL write_sel = sel_get_any_uid ("write:"); - if (object) - { - __objc_write_extension (stream, _BX_OBJECT); - objc_write_class (stream, object->class_pointer); - (*objc_msg_lookup(object, write_sel))(object, write_sel, stream); - return (*stream->write)(stream->physical, &buf, 1); - } - else - return objc_write_use_common(stream, 0); - } - - int - objc_write_object_reference (struct objc_typed_stream* stream, id object) - { - unsigned long key; - if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object)))) - return objc_write_use_common (stream, key); - - __objc_write_extension (stream, _BX_OBJREF); - return objc_write_unsigned_long (stream, PTR2LONG (object)); - } - - int - objc_write_root_object (struct objc_typed_stream* stream, id object) - { - int len = 0; - if (stream->writing_root_p) - objc_error (nil, OBJC_ERR_RECURSE_ROOT, - "objc_write_root_object called recursively"); - else - { - stream->writing_root_p = 1; - __objc_write_extension (stream, _BX_OBJROOT); - if((len = objc_write_object (stream, object))) - __objc_finish_write_root_object(stream); - stream->writing_root_p = 0; - } - return len; - } - - int - objc_write_object (struct objc_typed_stream* stream, id object) - { - unsigned long key; - if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object)))) - return objc_write_use_common (stream, key); - - else if (object == nil) - return objc_write_use_common(stream, 0); - - else - { - int length; - hash_add (&stream->object_table, LONG2PTR(key=PTR2LONG(object)), object); - if ((length = objc_write_register_common (stream, key))) - return __objc_write_object (stream, object); - return length; - } - } - - __inline__ int - __objc_write_class (struct objc_typed_stream* stream, struct objc_class* class) - { - __objc_write_extension (stream, _BX_CLASS); - objc_write_string_atomic(stream, (char*)class->name, - strlen((char*)class->name)); - return objc_write_unsigned_long (stream, class->version); - } - - - static int - objc_write_class (struct objc_typed_stream* stream, - struct objc_class* class) - { - unsigned long key; - if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, class)))) - return objc_write_use_common (stream, key); - else - { - int length; - hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(class)), class); - if ((length = objc_write_register_common (stream, key))) - return __objc_write_class (stream, class); - return length; - } - } - - - __inline__ int - __objc_write_selector (struct objc_typed_stream* stream, SEL selector) - { - const char* sel_name; - __objc_write_extension (stream, _BX_SEL); - /* to handle NULL selectors */ - if ((SEL)0 == selector) - return objc_write_string (stream, "", 0); - sel_name = sel_get_name (selector); - return objc_write_string (stream, sel_name, strlen ((char*)sel_name)); - } - - int - objc_write_selector (struct objc_typed_stream* stream, SEL selector) - { - const char* sel_name; - unsigned long key; - - /* to handle NULL selectors */ - if ((SEL)0 == selector) - return __objc_write_selector (stream, selector); - - sel_name = sel_get_name (selector); - if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, sel_name)))) - return objc_write_use_common (stream, key); - else - { - int length; - hash_add (&stream->stream_table, - LONG2PTR(key=PTR2LONG(sel_name)), (char*)sel_name); - if ((length = objc_write_register_common (stream, key))) - return __objc_write_selector (stream, selector); - return length; - } - } - - - - /* - ** Read operations - */ - - __inline__ int - objc_read_char (struct objc_typed_stream* stream, char* val) - { - unsigned char buf; - int len; - len = (*stream->read)(stream->physical, &buf, 1); - if (len != 0) - { - if ((buf & _B_CODE) == _B_SINT) - (*val) = (buf & _B_VALUE); - - else if ((buf & _B_NUMBER) == 1) - { - len = (*stream->read)(stream->physical, val, 1); - if (buf&_B_SIGN) - (*val) = -1*(*val); - } - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected 8bit signed int, got %dbit int", - (int)(buf&_B_NUMBER)*8); - } - return len; - } - - - __inline__ int - objc_read_unsigned_char (struct objc_typed_stream* stream, unsigned char* val) - { - unsigned char buf; - int len; - if ((len = (*stream->read)(stream->physical, &buf, 1))) - { - if ((buf & _B_CODE) == _B_SINT) - (*val) = (buf & _B_VALUE); - - else if ((buf & _B_NUMBER) == 1) - len = (*stream->read)(stream->physical, val, 1); - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected 8bit unsigned int, got %dbit int", - (int)(buf&_B_NUMBER)*8); - } - return len; - } - - __inline__ int - objc_read_short (struct objc_typed_stream* stream, short* value) - { - unsigned char buf[sizeof(short)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - { - int pos = 1; - int nbytes = buf[0] & _B_NUMBER; - if (nbytes > sizeof (short)) - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected short, got bigger (%dbits)", nbytes*8); - len = (*stream->read)(stream->physical, buf+1, nbytes); - (*value) = 0; - while (pos <= nbytes) - (*value) = ((*value)*0x100) + buf[pos++]; - if (buf[0] & _B_SIGN) - (*value) = -(*value); - } - } - return len; - } - - __inline__ int - objc_read_unsigned_short (struct objc_typed_stream* stream, - unsigned short* value) - { - unsigned char buf[sizeof(unsigned short)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - { - int pos = 1; - int nbytes = buf[0] & _B_NUMBER; - if (nbytes > sizeof (short)) - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected short, got int or bigger"); - len = (*stream->read)(stream->physical, buf+1, nbytes); - (*value) = 0; - while (pos <= nbytes) - (*value) = ((*value)*0x100) + buf[pos++]; - } - } - return len; - } - - - __inline__ int - objc_read_int (struct objc_typed_stream* stream, int* value) - { - unsigned char buf[sizeof(int)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - { - int pos = 1; - int nbytes = buf[0] & _B_NUMBER; - if (nbytes > sizeof (int)) - objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger"); - len = (*stream->read)(stream->physical, buf+1, nbytes); - (*value) = 0; - while (pos <= nbytes) - (*value) = ((*value)*0x100) + buf[pos++]; - if (buf[0] & _B_SIGN) - (*value) = -(*value); - } - } - return len; - } - - __inline__ int - objc_read_long (struct objc_typed_stream* stream, long* value) - { - unsigned char buf[sizeof(long)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - { - int pos = 1; - int nbytes = buf[0] & _B_NUMBER; - if (nbytes > sizeof (long)) - objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger"); - len = (*stream->read)(stream->physical, buf+1, nbytes); - (*value) = 0; - while (pos <= nbytes) - (*value) = ((*value)*0x100) + buf[pos++]; - if (buf[0] & _B_SIGN) - (*value) = -(*value); - } - } - return len; - } - - __inline__ int - __objc_read_nbyte_uint (struct objc_typed_stream* stream, - unsigned int nbytes, unsigned int* val) - { - int len, pos = 0; - unsigned char buf[sizeof(unsigned int)+1]; - - if (nbytes > sizeof (int)) - objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger"); - - len = (*stream->read)(stream->physical, buf, nbytes); - (*val) = 0; - while (pos < nbytes) - (*val) = ((*val)*0x100) + buf[pos++]; - return len; - } - - - __inline__ int - objc_read_unsigned_int (struct objc_typed_stream* stream, - unsigned int* value) - { - unsigned char buf[sizeof(unsigned int)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - len = __objc_read_nbyte_uint (stream, (buf[0] & _B_VALUE), value); - - } - return len; - } - - int - __objc_read_nbyte_ulong (struct objc_typed_stream* stream, - unsigned int nbytes, unsigned long* val) - { - int len, pos = 0; - unsigned char buf[sizeof(unsigned long)+1]; - - if (nbytes > sizeof (long)) - objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger"); - - len = (*stream->read)(stream->physical, buf, nbytes); - (*val) = 0; - while (pos < nbytes) - (*val) = ((*val)*0x100) + buf[pos++]; - return len; - } - - - __inline__ int - objc_read_unsigned_long (struct objc_typed_stream* stream, - unsigned long* value) - { - unsigned char buf[sizeof(unsigned long)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - if ((buf[0] & _B_CODE) == _B_SINT) - (*value) = (buf[0] & _B_VALUE); - - else - len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), value); - - } - return len; - } - - __inline__ int - objc_read_string (struct objc_typed_stream* stream, - char** string) - { - unsigned char buf[sizeof(unsigned int)+1]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - unsigned long key = 0; - - if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ - { - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - len = (*stream->read)(stream->physical, buf, 1); - } - - switch (buf[0]&_B_CODE) { - case _B_SSTR: - { - int length = buf[0]&_B_VALUE; - (*string) = (char*)objc_malloc(length+1); - if (key) - hash_add (&stream->stream_table, LONG2PTR(key), *string); - len = (*stream->read)(stream->physical, *string, length); - (*string)[length] = '\0'; - } - break; - - case _B_UCOMM: - { - char *tmp; - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - tmp = hash_value_for_key (stream->stream_table, LONG2PTR (key)); - *string = objc_malloc (strlen(tmp) + 1); - strcpy (*string, tmp); - } - break; - - case _B_NSTR: - { - unsigned int nbytes = buf[0]&_B_VALUE; - len = __objc_read_nbyte_uint(stream, nbytes, &nbytes); - if (len) { - (*string) = (char*)objc_malloc(nbytes+1); - if (key) - hash_add (&stream->stream_table, LONG2PTR(key), *string); - len = (*stream->read)(stream->physical, *string, nbytes); - (*string)[nbytes] = '\0'; - } - } - break; - - default: - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected string, got opcode %c\n", (buf[0]&_B_CODE)); - } - } - - return len; - } - - - int - objc_read_object (struct objc_typed_stream* stream, id* object) - { - unsigned char buf[sizeof (unsigned int)]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - SEL read_sel = sel_get_any_uid ("read:"); - unsigned long key = 0; - - if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */ - { - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - len = (*stream->read)(stream->physical, buf, 1); - } - - if (buf[0] == (_B_EXT | _BX_OBJECT)) - { - Class class; - - /* get class */ - len = objc_read_class (stream, &class); - - /* create instance */ - (*object) = class_create_instance(class); - - /* register? */ - if (key) - hash_add (&stream->object_table, LONG2PTR(key), *object); - - /* send -read: */ - if (__objc_responds_to (*object, read_sel)) - (*get_imp(class, read_sel))(*object, read_sel, stream); - - /* check null-byte */ - len = (*stream->read)(stream->physical, buf, 1); - if (buf[0] != '\0') - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected null-byte, got opcode %c", buf[0]); - } - - else if ((buf[0]&_B_CODE) == _B_UCOMM) - { - if (key) - objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - (*object) = hash_value_for_key (stream->object_table, LONG2PTR(key)); - } - - else if (buf[0] == (_B_EXT | _BX_OBJREF)) /* a forward reference */ - { - struct objc_list* other; - len = objc_read_unsigned_long (stream, &key); - other = (struct objc_list*)hash_value_for_key (stream->object_refs, - LONG2PTR(key)); - hash_add (&stream->object_refs, LONG2PTR(key), - (void*)list_cons(object, other)); - } - - else if (buf[0] == (_B_EXT | _BX_OBJROOT)) /* a root object */ - { - if (key) - objc_error(nil, OBJC_ERR_BAD_KEY, - "cannot register root object..."); - len = objc_read_object (stream, object); - __objc_finish_read_root_object (stream); - } - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected object, got opcode %c", buf[0]); - } - return len; - } - - static int - objc_read_class (struct objc_typed_stream* stream, Class* class) - { - unsigned char buf[sizeof (unsigned int)]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - unsigned long key = 0; - - if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ - { - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - len = (*stream->read)(stream->physical, buf, 1); - } - - if (buf[0] == (_B_EXT | _BX_CLASS)) - { - char* class_name; - unsigned long version; - - /* get class */ - len = objc_read_string (stream, &class_name); - (*class) = objc_get_class(class_name); - objc_free(class_name); - - /* register */ - if (key) - hash_add (&stream->stream_table, LONG2PTR(key), *class); - - objc_read_unsigned_long(stream, &version); - hash_add (&stream->class_table, (*class)->name, (void*)version); - } - - else if ((buf[0]&_B_CODE) == _B_UCOMM) - { - if (key) - objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - (*class) = hash_value_for_key (stream->stream_table, LONG2PTR(key)); - if (!*class) - objc_error(nil, OBJC_ERR_BAD_CLASS, - "cannot find class for key %lu", key); - } - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected class, got opcode %c", buf[0]); - } - return len; - } - - int - objc_read_selector (struct objc_typed_stream* stream, SEL* selector) - { - unsigned char buf[sizeof (unsigned int)]; - int len; - if ((len = (*stream->read)(stream->physical, buf, 1))) - { - unsigned long key = 0; - - if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ - { - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - len = (*stream->read)(stream->physical, buf, 1); - } - - if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */ - { - char* selector_name; - - /* get selector */ - len = objc_read_string (stream, &selector_name); - /* To handle NULL selectors */ - if (0 == strlen(selector_name)) - { - (*selector) = (SEL)0; - return 0; - } - else - (*selector) = sel_get_any_uid(selector_name); - objc_free(selector_name); - - /* register */ - if (key) - hash_add (&stream->stream_table, LONG2PTR(key), (void*)*selector); - } - - else if ((buf[0]&_B_CODE) == _B_UCOMM) - { - if (key) - objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); - len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); - (*selector) = hash_value_for_key (stream->stream_table, - LONG2PTR(key)); - } - - else - objc_error(nil, OBJC_ERR_BAD_DATA, - "expected selector, got opcode %c", buf[0]); - } - return len; - } - - /* - ** USER LEVEL FUNCTIONS - */ - - /* - ** Write one object, encoded in TYPE and pointed to by DATA to the - ** typed stream STREAM. - */ - - int - objc_write_type(TypedStream* stream, const char* type, const void* data) - { - switch(*type) { - case _C_ID: - return objc_write_object (stream, *(id*)data); - break; - - case _C_CLASS: - return objc_write_class (stream, *(Class*)data); - break; - - case _C_SEL: - return objc_write_selector (stream, *(SEL*)data); - break; - - case _C_CHR: - return objc_write_char(stream, *(char*)data); - break; - - case _C_UCHR: - return objc_write_unsigned_char(stream, *(unsigned char*)data); - break; - - case _C_SHT: - return objc_write_short(stream, *(short*)data); - break; - - case _C_USHT: - return objc_write_unsigned_short(stream, *(unsigned short*)data); - break; - - case _C_INT: - return objc_write_int(stream, *(int*)data); - break; - - case _C_UINT: - return objc_write_unsigned_int(stream, *(unsigned int*)data); - break; - - case _C_LNG: - return objc_write_long(stream, *(long*)data); - break; - - case _C_ULNG: - return objc_write_unsigned_long(stream, *(unsigned long*)data); - break; - - case _C_CHARPTR: - return objc_write_string (stream, *(char**)data, strlen(*(char**)data)); - break; - - case _C_ATOM: - return objc_write_string_atomic (stream, *(char**)data, - strlen(*(char**)data)); - break; - - case _C_ARY_B: - { - int len = atoi(type+1); - while (isdigit(*++type)) - ; - return objc_write_array (stream, type, len, data); - } - break; - - case _C_STRUCT_B: - { - int acc_size = 0; - int align; - while (*type != _C_STRUCT_E && *type++ != '=') - ; /* skip "=" */ - while (*type != _C_STRUCT_E) - { - align = objc_alignof_type (type); /* padd to alignment */ - acc_size += ROUND (acc_size, align); - objc_write_type (stream, type, ((char*)data)+acc_size); - acc_size += objc_sizeof_type (type); /* add component size */ - type = objc_skip_typespec (type); /* skip component */ - } - return 1; - } - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, - "objc_write_type: cannot parse typespec: %s\n", type); - return 0; - } - } - } - - /* - ** Read one object, encoded in TYPE and pointed to by DATA to the - ** typed stream STREAM. DATA specifies the address of the types to - ** read. Expected type is checked against the type actually present - ** on the stream. - */ - - int - objc_read_type(TypedStream* stream, const char* type, void* data) - { - char c; - switch(c = *type) { - case _C_ID: - return objc_read_object (stream, (id*)data); - break; - - case _C_CLASS: - return objc_read_class (stream, (Class*)data); - break; - - case _C_SEL: - return objc_read_selector (stream, (SEL*)data); - break; - - case _C_CHR: - return objc_read_char (stream, (char*)data); - break; - - case _C_UCHR: - return objc_read_unsigned_char (stream, (unsigned char*)data); - break; - - case _C_SHT: - return objc_read_short (stream, (short*)data); - break; - - case _C_USHT: - return objc_read_unsigned_short (stream, (unsigned short*)data); - break; - - case _C_INT: - return objc_read_int (stream, (int*)data); - break; - - case _C_UINT: - return objc_read_unsigned_int (stream, (unsigned int*)data); - break; - - case _C_LNG: - return objc_read_long (stream, (long*)data); - break; - - case _C_ULNG: - return objc_read_unsigned_long (stream, (unsigned long*)data); - break; - - case _C_CHARPTR: - case _C_ATOM: - return objc_read_string (stream, (char**)data); - break; - - case _C_ARY_B: - { - int len = atoi(type+1); - while (isdigit(*++type)) - ; - return objc_read_array (stream, type, len, data); - } - break; - - case _C_STRUCT_B: - { - int acc_size = 0; - int align; - while (*type != _C_STRUCT_E && *type++ != '=') - ; /* skip "=" */ - while (*type != _C_STRUCT_E) - { - align = objc_alignof_type (type); /* padd to alignment */ - acc_size += ROUND (acc_size, align); - objc_read_type (stream, type, ((char*)data)+acc_size); - acc_size += objc_sizeof_type (type); /* add component size */ - type = objc_skip_typespec (type); /* skip component */ - } - return 1; - } - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, - "objc_read_type: cannot parse typespec: %s\n", type); - return 0; - } - } - } - - /* - ** Write the object specified by the template TYPE to STREAM. Last - ** arguments specify addresses of values to be written. It might - ** seem surprising to specify values by address, but this is extremely - ** convenient for copy-paste with objc_read_types calls. A more - ** down-to-the-earth cause for this passing of addresses is that values - ** of arbitrary size is not well supported in ANSI C for functions with - ** variable number of arguments. - */ - - int - objc_write_types (TypedStream* stream, const char* type, ...) - { - va_list args; - const char *c; - int res = 0; - - va_start(args, type); - - for (c = type; *c; c = objc_skip_typespec (c)) - { - switch(*c) { - case _C_ID: - res = objc_write_object (stream, *va_arg (args, id*)); - break; - - case _C_CLASS: - res = objc_write_class (stream, *va_arg(args, Class*)); - break; - - case _C_SEL: - res = objc_write_selector (stream, *va_arg(args, SEL*)); - break; - - case _C_CHR: - res = objc_write_char (stream, *va_arg (args, char*)); - break; - - case _C_UCHR: - res = objc_write_unsigned_char (stream, - *va_arg (args, unsigned char*)); - break; - - case _C_SHT: - res = objc_write_short (stream, *va_arg(args, short*)); - break; - - case _C_USHT: - res = objc_write_unsigned_short (stream, - *va_arg(args, unsigned short*)); - break; - - case _C_INT: - res = objc_write_int(stream, *va_arg(args, int*)); - break; - - case _C_UINT: - res = objc_write_unsigned_int(stream, *va_arg(args, unsigned int*)); - break; - - case _C_LNG: - res = objc_write_long(stream, *va_arg(args, long*)); - break; - - case _C_ULNG: - res = objc_write_unsigned_long(stream, *va_arg(args, unsigned long*)); - break; - - case _C_CHARPTR: - { - char** str = va_arg(args, char**); - res = objc_write_string (stream, *str, strlen(*str)); - } - break; - - case _C_ATOM: - { - char** str = va_arg(args, char**); - res = objc_write_string_atomic (stream, *str, strlen(*str)); - } - break; - - case _C_ARY_B: - { - int len = atoi(c+1); - const char* t = c; - while (isdigit(*++t)) - ; - res = objc_write_array (stream, t, len, va_arg(args, void*)); - t = objc_skip_typespec (t); - if (*t != _C_ARY_E) - objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t); - } - break; - - default: - objc_error(nil, OBJC_ERR_BAD_TYPE, - "objc_write_types: cannot parse typespec: %s\n", type); - } - } - va_end(args); - return res; - } - - - /* - ** Last arguments specify addresses of values to be read. Expected - ** type is checked against the type actually present on the stream. - */ - - int - objc_read_types(TypedStream* stream, const char* type, ...) - { - va_list args; - const char *c; - int res = 0; - - va_start(args, type); - - for (c = type; *c; c = objc_skip_typespec(c)) - { - switch(*c) { - case _C_ID: - res = objc_read_object(stream, va_arg(args, id*)); - break; - - case _C_CLASS: - res = objc_read_class(stream, va_arg(args, Class*)); - break; - - case _C_SEL: - res = objc_read_selector(stream, va_arg(args, SEL*)); - break; - - case _C_CHR: - res = objc_read_char(stream, va_arg(args, char*)); - break; - - case _C_UCHR: - res = objc_read_unsigned_char(stream, va_arg(args, unsigned char*)); - break; - - case _C_SHT: - res = objc_read_short(stream, va_arg(args, short*)); - break; - - case _C_USHT: - res = objc_read_unsigned_short(stream, va_arg(args, unsigned short*)); - break; - - case _C_INT: - res = objc_read_int(stream, va_arg(args, int*)); - break; - - case _C_UINT: - res = objc_read_unsigned_int(stream, va_arg(args, unsigned int*)); - break; - - case _C_LNG: - res = objc_read_long(stream, va_arg(args, long*)); - break; - - case _C_ULNG: - res = objc_read_unsigned_long(stream, va_arg(args, unsigned long*)); - break; - - case _C_CHARPTR: - case _C_ATOM: - { - char** str = va_arg(args, char**); - res = objc_read_string (stream, str); - } - break; - - case _C_ARY_B: - { - int len = atoi(c+1); - const char* t = c; - while (isdigit(*++t)) - ; - res = objc_read_array (stream, t, len, va_arg(args, void*)); - t = objc_skip_typespec (t); - if (*t != _C_ARY_E) - objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t); - } - break; - - default: - objc_error(nil, OBJC_ERR_BAD_TYPE, - "objc_read_types: cannot parse typespec: %s\n", type); - } - } - va_end(args); - return res; - } - - /* - ** Write an array of COUNT elements of TYPE from the memory address DATA. - ** This is equivalent of objc_write_type (stream, "[N]", data) - */ - - int - objc_write_array (TypedStream* stream, const char* type, - int count, const void* data) - { - int off = objc_sizeof_type(type); - const char* where = data; - - while (count-- > 0) - { - objc_write_type(stream, type, where); - where += off; - } - return 1; - } - - /* - ** Read an array of COUNT elements of TYPE into the memory address - ** DATA. The memory pointed to by data is supposed to be allocated - ** by the callee. This is equivalent of - ** objc_read_type (stream, "[N]", data) - */ - - int - objc_read_array (TypedStream* stream, const char* type, - int count, void* data) - { - int off = objc_sizeof_type(type); - char* where = (char*)data; - - while (count-- > 0) - { - objc_read_type(stream, type, where); - where += off; - } - return 1; - } - - static int - __objc_fread(FILE* file, char* data, int len) - { - return fread(data, len, 1, file); - } - - static int - __objc_fwrite(FILE* file, char* data, int len) - { - return fwrite(data, len, 1, file); - } - - static int - __objc_feof(FILE* file) - { - return feof(file); - } - - static int - __objc_no_write(FILE* file, char* data, int len) - { - objc_error (nil, OBJC_ERR_NO_WRITE, "TypedStream not open for writing"); - return 0; - } - - static int - __objc_no_read(FILE* file, char* data, int len) - { - objc_error (nil, OBJC_ERR_NO_READ, "TypedStream not open for reading"); - return 0; - } - - static int - __objc_read_typed_stream_signature (TypedStream* stream) - { - char buffer[80]; - int pos = 0; - do - (*stream->read)(stream->physical, buffer+pos, 1); - while (buffer[pos++] != '\0') - ; - sscanf (buffer, "GNU TypedStream %d", &stream->version); - if (stream->version != OBJC_TYPED_STREAM_VERSION) - objc_error (nil, OBJC_ERR_STREAM_VERSION, - "cannot handle TypedStream version %d", stream->version); - return 1; - } - - static int - __objc_write_typed_stream_signature (TypedStream* stream) - { - char buffer[80]; - sprintf(buffer, "GNU TypedStream %d", OBJC_TYPED_STREAM_VERSION); - stream->version = OBJC_TYPED_STREAM_VERSION; - (*stream->write)(stream->physical, buffer, strlen(buffer)+1); - return 1; - } - - static void __objc_finish_write_root_object(struct objc_typed_stream* stream) - { - hash_delete (stream->object_table); - stream->object_table = hash_new(64, - (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - } - - static void __objc_finish_read_root_object(struct objc_typed_stream* stream) - { - node_ptr node; - SEL awake_sel = sel_get_any_uid ("awake"); - cache_ptr free_list = hash_new (64, - (hash_func_type) hash_ptr, - (compare_func_type) compare_ptrs); - - /* resolve object forward references */ - for (node = hash_next (stream->object_refs, NULL); node; - node = hash_next (stream->object_refs, node)) - { - struct objc_list* reflist = node->value; - const void* key = node->key; - id object = hash_value_for_key (stream->object_table, key); - while(reflist) - { - *((id*)reflist->head) = object; - if (hash_value_for_key (free_list,reflist) == NULL) - hash_add (&free_list,reflist,reflist); - - reflist = reflist->tail; - } - } - - /* apply __objc_free to all objects stored in free_list */ - for (node = hash_next (free_list, NULL); node; - node = hash_next (free_list, node)) - objc_free ((void *) node->key); - - hash_delete (free_list); - - /* empty object reference table */ - hash_delete (stream->object_refs); - stream->object_refs = hash_new(8, (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - - /* call -awake for all objects read */ - if (awake_sel) - { - for (node = hash_next (stream->object_table, NULL); node; - node = hash_next (stream->object_table, node)) - { - id object = node->value; - if (__objc_responds_to (object, awake_sel)) - (*objc_msg_lookup(object, awake_sel))(object, awake_sel); - } - } - - /* empty object table */ - hash_delete (stream->object_table); - stream->object_table = hash_new(64, - (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - } - - /* - ** Open the stream PHYSICAL in MODE - */ - - TypedStream* - objc_open_typed_stream (FILE* physical, int mode) - { - TypedStream* s = (TypedStream*)objc_malloc(sizeof(TypedStream)); - - s->mode = mode; - s->physical = physical; - s->stream_table = hash_new(64, - (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - s->object_table = hash_new(64, - (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - s->eof = (objc_typed_eof_func)__objc_feof; - s->flush = (objc_typed_flush_func)fflush; - s->writing_root_p = 0; - if (mode == OBJC_READONLY) - { - s->class_table = hash_new(8, (hash_func_type)hash_string, - (compare_func_type)compare_strings); - s->object_refs = hash_new(8, (hash_func_type)hash_ptr, - (compare_func_type)compare_ptrs); - s->read = (objc_typed_read_func)__objc_fread; - s->write = (objc_typed_write_func)__objc_no_write; - __objc_read_typed_stream_signature (s); - } - else if (mode == OBJC_WRITEONLY) - { - s->class_table = 0; - s->object_refs = 0; - s->read = (objc_typed_read_func)__objc_no_read; - s->write = (objc_typed_write_func)__objc_fwrite; - __objc_write_typed_stream_signature (s); - } - else - { - objc_close_typed_stream (s); - return NULL; - } - s->type = OBJC_FILE_STREAM; - return s; - } - - /* - ** Open the file named by FILE_NAME in MODE - */ - - TypedStream* - objc_open_typed_stream_for_file (const char* file_name, int mode) - { - FILE* file = NULL; - TypedStream* s; - - if (mode == OBJC_READONLY) - file = fopen (file_name, "r"); - else - file = fopen (file_name, "w"); - - if (file) - { - s = objc_open_typed_stream (file, mode); - if (s) - s->type |= OBJC_MANAGED_STREAM; - return s; - } - else - return NULL; - } - - /* - ** Close STREAM freeing the structure it self. If it was opened with - ** objc_open_typed_stream_for_file, the file will also be closed. - */ - - void - objc_close_typed_stream (TypedStream* stream) - { - if (stream->mode == OBJC_READONLY) - { - __objc_finish_read_root_object (stream); /* Just in case... */ - hash_delete (stream->class_table); - hash_delete (stream->object_refs); - } - - hash_delete (stream->stream_table); - hash_delete (stream->object_table); - - if (stream->type == (OBJC_MANAGED_STREAM | OBJC_FILE_STREAM)) - fclose ((FILE*)stream->physical); - - objc_free(stream); - } - - BOOL - objc_end_of_typed_stream (TypedStream* stream) - { - return (*stream->eof)(stream->physical); - } - - void - objc_flush_typed_stream (TypedStream* stream) - { - (*stream->flush)(stream->physical); - } - - long - objc_get_stream_class_version (TypedStream* stream, Class class) - { - if (stream->class_table) - return PTR2LONG(hash_value_for_key (stream->class_table, class->name)); - else - return class_get_version (class); - } - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/class.c gcc-2.95/gcc/objc/class.c *** egcs-1.1.2/gcc/objc/class.c Sat Dec 6 09:29:44 1997 --- gcc-2.95/gcc/objc/class.c Wed Dec 31 16:00:00 1969 *************** *** 1,358 **** - /* GNU Objective C Runtime class related functions - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup and Dennis Glatting. - - 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. */ - - #include "runtime.h" /* the kitchen sink */ - #include "sarray.h" - - /* The table of classname->class. Used for objc_lookup_class and friends */ - static cache_ptr __objc_class_hash = 0; /* !T:MUTEX */ - - /* This is a hook which is called by objc_get_class and - objc_lookup_class if the runtime is not able to find the class. - This may e.g. try to load in the class using dynamic loading */ - Class (*_objc_lookup_class)(const char* name) = 0; /* !T:SAFE */ - - - /* True when class links has been resolved */ - BOOL __objc_class_links_resolved = NO; /* !T:UNUSED */ - - - /* Initial number of buckets size of class hash table. */ - #define CLASS_HASH_SIZE 32 - - void __objc_init_class_tables() - { - /* Allocate the class hash table */ - - if(__objc_class_hash) - return; - - objc_mutex_lock(__objc_runtime_mutex); - - __objc_class_hash - = hash_new (CLASS_HASH_SIZE, - (hash_func_type) hash_string, - (compare_func_type) compare_strings); - - objc_mutex_unlock(__objc_runtime_mutex); - } - - /* This function adds a class to the class hash table, and assigns the - class a number, unless it's already known */ - void - __objc_add_class_to_hash(Class class) - { - Class h_class; - - objc_mutex_lock(__objc_runtime_mutex); - - /* make sure the table is there */ - assert(__objc_class_hash); - - /* make sure it's not a meta class */ - assert(CLS_ISCLASS(class)); - - /* Check to see if the class is already in the hash table. */ - h_class = hash_value_for_key (__objc_class_hash, class->name); - if (!h_class) - { - /* The class isn't in the hash table. Add the class and assign a class - number. */ - static unsigned int class_number = 1; - - CLS_SETNUMBER(class, class_number); - CLS_SETNUMBER(class->class_pointer, class_number); - - ++class_number; - hash_add (&__objc_class_hash, class->name, class); - } - - objc_mutex_unlock(__objc_runtime_mutex); - } - - /* Get the class object for the class named NAME. If NAME does not - identify a known class, the hook _objc_lookup_class is called. If - this fails, nil is returned */ - Class objc_lookup_class (const char* name) - { - Class class; - - objc_mutex_lock(__objc_runtime_mutex); - - /* Make sure the class hash table exists. */ - assert (__objc_class_hash); - - class = hash_value_for_key (__objc_class_hash, name); - - objc_mutex_unlock(__objc_runtime_mutex); - - if (class) - return class; - - if (_objc_lookup_class) - return (*_objc_lookup_class)(name); - else - return 0; - } - - /* Get the class object for the class named NAME. If NAME does not - identify a known class, the hook _objc_lookup_class is called. If - this fails, an error message is issued and the system aborts */ - Class - objc_get_class (const char *name) - { - Class class; - - objc_mutex_lock(__objc_runtime_mutex); - - /* Make sure the class hash table exists. */ - assert (__objc_class_hash); - - class = hash_value_for_key (__objc_class_hash, name); - - objc_mutex_unlock(__objc_runtime_mutex); - - if (class) - return class; - - if (_objc_lookup_class) - class = (*_objc_lookup_class)(name); - - if(class) - return class; - - objc_error(nil, OBJC_ERR_BAD_CLASS, - "objc runtime: cannot find class %s\n", name); - return 0; - } - - MetaClass - objc_get_meta_class(const char *name) - { - return objc_get_class(name)->class_pointer; - } - - /* This function provides a way to enumerate all the classes in the - executable. Pass *ENUM_STATE == NULL to start the enumeration. The - function will return 0 when there are no more classes. - For example: - id class; - void *es = NULL; - while ((class = objc_next_class(&es))) - ... do something with class; - */ - Class - objc_next_class(void **enum_state) - { - objc_mutex_lock(__objc_runtime_mutex); - - /* make sure the table is there */ - assert(__objc_class_hash); - - *(node_ptr*)enum_state = - hash_next(__objc_class_hash, *(node_ptr*)enum_state); - - objc_mutex_unlock(__objc_runtime_mutex); - - if (*(node_ptr*)enum_state) - return (*(node_ptr*)enum_state)->value; - return (Class)0; - } - - /* Resolve super/subclass links for all classes. The only thing we - can be sure of is that the class_pointer for class objects point - to the right meta class objects */ - void __objc_resolve_class_links() - { - node_ptr node; - Class object_class = objc_get_class ("Object"); - - assert(object_class); - - objc_mutex_lock(__objc_runtime_mutex); - - /* Assign subclass links */ - for (node = hash_next (__objc_class_hash, NULL); node; - node = hash_next (__objc_class_hash, node)) - { - Class class1 = node->value; - - /* Make sure we have what we think we have. */ - assert (CLS_ISCLASS(class1)); - assert (CLS_ISMETA(class1->class_pointer)); - - /* The class_pointer of all meta classes point to Object's meta class. */ - class1->class_pointer->class_pointer = object_class->class_pointer; - - if (!(CLS_ISRESOLV(class1))) - { - CLS_SETRESOLV(class1); - CLS_SETRESOLV(class1->class_pointer); - - if(class1->super_class) - { - Class a_super_class - = objc_get_class ((char *) class1->super_class); - - assert (a_super_class); - - DEBUG_PRINTF ("making class connections for: %s\n", - class1->name); - - /* assign subclass links for superclass */ - class1->sibling_class = a_super_class->subclass_list; - a_super_class->subclass_list = class1; - - /* Assign subclass links for meta class of superclass */ - if (a_super_class->class_pointer) - { - class1->class_pointer->sibling_class - = a_super_class->class_pointer->subclass_list; - a_super_class->class_pointer->subclass_list - = class1->class_pointer; - } - } - else /* a root class, make its meta object */ - /* be a subclass of Object */ - { - class1->class_pointer->sibling_class - = object_class->subclass_list; - object_class->subclass_list = class1->class_pointer; - } - } - } - - /* Assign superclass links */ - for (node = hash_next (__objc_class_hash, NULL); node; - node = hash_next (__objc_class_hash, node)) - { - Class class1 = node->value; - Class sub_class; - for (sub_class = class1->subclass_list; sub_class; - sub_class = sub_class->sibling_class) - { - sub_class->super_class = class1; - if(CLS_ISCLASS(sub_class)) - sub_class->class_pointer->super_class = class1->class_pointer; - } - } - - objc_mutex_unlock(__objc_runtime_mutex); - } - - - - #define CLASSOF(c) ((c)->class_pointer) - - Class - class_pose_as (Class impostor, Class super_class) - { - node_ptr node; - Class class1; - - if (!CLS_ISRESOLV (impostor)) - __objc_resolve_class_links (); - - /* preconditions */ - assert (impostor); - assert (super_class); - assert (impostor->super_class == super_class); - assert (CLS_ISCLASS (impostor)); - assert (CLS_ISCLASS (super_class)); - assert (impostor->instance_size == super_class->instance_size); - - { - Class *subclass = &(super_class->subclass_list); - - /* move subclasses of super_class to impostor */ - while (*subclass) - { - Class nextSub = (*subclass)->sibling_class; - - if (*subclass != impostor) - { - Class sub = *subclass; - - /* classes */ - sub->sibling_class = impostor->subclass_list; - sub->super_class = impostor; - impostor->subclass_list = sub; - - /* It will happen that SUB is not a class object if it is - the top of the meta class hierarchy chain. (root - meta-class objects inherit their class object) If that is - the case... don't mess with the meta-meta class. */ - if (CLS_ISCLASS (sub)) - { - /* meta classes */ - CLASSOF (sub)->sibling_class = - CLASSOF (impostor)->subclass_list; - CLASSOF (sub)->super_class = CLASSOF (impostor); - CLASSOF (impostor)->subclass_list = CLASSOF (sub); - } - } - - *subclass = nextSub; - } - - /* set subclasses of superclass to be impostor only */ - super_class->subclass_list = impostor; - CLASSOF (super_class)->subclass_list = CLASSOF (impostor); - - /* set impostor to have no sibling classes */ - impostor->sibling_class = 0; - CLASSOF (impostor)->sibling_class = 0; - } - - /* check relationship of impostor and super_class is kept. */ - assert (impostor->super_class == super_class); - assert (CLASSOF (impostor)->super_class == CLASSOF (super_class)); - - /* This is how to update the lookup table. Regardless of - what the keys of the hashtable is, change all values that are - superclass into impostor. */ - - objc_mutex_lock(__objc_runtime_mutex); - - for (node = hash_next (__objc_class_hash, NULL); node; - node = hash_next (__objc_class_hash, node)) - { - class1 = (Class)node->value; - if (class1 == super_class) - { - node->value = impostor; /* change hash table value */ - } - } - - objc_mutex_unlock(__objc_runtime_mutex); - - /* next, we update the dispatch tables... */ - __objc_update_dispatch_table_for_class (CLASSOF (impostor)); - __objc_update_dispatch_table_for_class (impostor); - - return impostor; - } - - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/config-lang.in gcc-2.95/gcc/objc/config-lang.in *** egcs-1.1.2/gcc/objc/config-lang.in Fri Apr 3 21:27:00 1998 --- gcc-2.95/gcc/objc/config-lang.in Wed Dec 16 13:21:16 1998 *************** compilers="cc1obj\$(exeext)" *** 33,37 **** stagestuff="" diff_excludes="-x objc-parse.c -x objc-parse.y " - - echo "Using \`$srcdir/objc/thr-${thread_file}.c' as Objective-C Runtime thread file." --- 33,35 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/encoding.c gcc-2.95/gcc/objc/encoding.c *** egcs-1.1.2/gcc/objc/encoding.c Tue May 5 13:53:05 1998 --- gcc-2.95/gcc/objc/encoding.c Wed Dec 31 16:00:00 1969 *************** *** 1,554 **** - /* Encoding of types for Objective C. - Copyright (C) 1993, 1995, 1996, 1997, 1998 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. */ - - #include "encoding.h" - - #define MAX(X, Y) \ - ({ typeof(X) __x = (X), __y = (Y); \ - (__x > __y ? __x : __y); }) - - #define MIN(X, Y) \ - ({ typeof(X) __x = (X), __y = (Y); \ - (__x < __y ? __x : __y); }) - - #define ROUND(V, A) \ - ({ typeof(V) __v=(V); typeof(A) __a=(A); \ - __a*((__v+__a-1)/__a); }) - - - static inline int - atoi (const char* str) - { - int res = 0; - - while (isdigit (*str)) - res *= 10, res += (*str++ - '0'); - - return res; - } - - /* - return the size of an object specified by type - */ - - int - objc_sizeof_type(const char* type) - { - switch(*type) { - case _C_ID: - return sizeof(id); - break; - - case _C_CLASS: - return sizeof(Class); - break; - - case _C_SEL: - return sizeof(SEL); - break; - - case _C_CHR: - return sizeof(char); - break; - - case _C_UCHR: - return sizeof(unsigned char); - break; - - case _C_SHT: - return sizeof(short); - break; - - case _C_USHT: - return sizeof(unsigned short); - break; - - case _C_INT: - return sizeof(int); - break; - - case _C_UINT: - return sizeof(unsigned int); - break; - - case _C_LNG: - return sizeof(long); - break; - - case _C_ULNG: - return sizeof(unsigned long); - break; - - case _C_FLT: - return sizeof(float); - break; - - case _C_DBL: - return sizeof(double); - break; - - case _C_VOID: - return sizeof(void); - break; - case _C_PTR: - case _C_ATOM: - case _C_CHARPTR: - return sizeof(char*); - break; - - case _C_ARY_B: - { - int len = atoi(type+1); - while (isdigit(*++type)); - return len*objc_aligned_size (type); - } - break; - - case _C_STRUCT_B: - { - int acc_size = 0; - int align; - while (*type != _C_STRUCT_E && *type++ != '='); /* skip "=" */ - while (*type != _C_STRUCT_E) - { - align = objc_alignof_type (type); /* padd to alignment */ - acc_size = ROUND (acc_size, align); - acc_size += objc_sizeof_type (type); /* add component size */ - type = objc_skip_typespec (type); /* skip component */ - } - return acc_size; - } - - case _C_UNION_B: - { - int max_size = 0; - while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; - while (*type != _C_UNION_E) - { - max_size = MAX (max_size, objc_sizeof_type (type)); - type = objc_skip_typespec (type); - } - return max_size; - } - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); - return 0; - } - } - } - - - /* - Return the alignment of an object specified by type - */ - - int - objc_alignof_type(const char* type) - { - switch(*type) { - case _C_ID: - return __alignof__(id); - break; - - case _C_CLASS: - return __alignof__(Class); - break; - - case _C_SEL: - return __alignof__(SEL); - break; - - case _C_CHR: - return __alignof__(char); - break; - - case _C_UCHR: - return __alignof__(unsigned char); - break; - - case _C_SHT: - return __alignof__(short); - break; - - case _C_USHT: - return __alignof__(unsigned short); - break; - - case _C_INT: - return __alignof__(int); - break; - - case _C_UINT: - return __alignof__(unsigned int); - break; - - case _C_LNG: - return __alignof__(long); - break; - - case _C_ULNG: - return __alignof__(unsigned long); - break; - - case _C_FLT: - return __alignof__(float); - break; - - case _C_DBL: - return __alignof__(double); - break; - - case _C_PTR: - case _C_ATOM: - case _C_CHARPTR: - return __alignof__(char*); - break; - - case _C_ARY_B: - while (isdigit(*++type)) /* do nothing */; - return objc_alignof_type (type); - - case _C_STRUCT_B: - { - struct { int x; double y; } fooalign; - while(*type != _C_STRUCT_E && *type++ != '=') /* do nothing */; - if (*type != _C_STRUCT_E) - return MAX (objc_alignof_type (type), __alignof__ (fooalign)); - else - return __alignof__ (fooalign); - } - - case _C_UNION_B: - { - int maxalign = 0; - while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; - while (*type != _C_UNION_E) - { - maxalign = MAX (maxalign, objc_alignof_type (type)); - type = objc_skip_typespec (type); - } - return maxalign; - } - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); - return 0; - } - } - } - - /* - The aligned size if the size rounded up to the nearest alignment. - */ - - int - objc_aligned_size (const char* type) - { - int size = objc_sizeof_type (type); - int align = objc_alignof_type (type); - return ROUND (size, align); - } - - /* - The size rounded up to the nearest integral of the wordsize, taken - to be the size of a void*. - */ - - int - objc_promoted_size (const char* type) - { - int size = objc_sizeof_type (type); - int wordsize = sizeof (void*); - - return ROUND (size, wordsize); - } - - /* - Skip type qualifiers. These may eventually precede typespecs - occurring in method prototype encodings. - */ - - inline const char* - objc_skip_type_qualifiers (const char* type) - { - while (*type == _C_CONST - || *type == _C_IN - || *type == _C_INOUT - || *type == _C_OUT - || *type == _C_BYCOPY - || *type == _C_ONEWAY) - { - type += 1; - } - return type; - } - - - /* - Skip one typespec element. If the typespec is prepended by type - qualifiers, these are skipped as well. - */ - - const char* - objc_skip_typespec (const char* type) - { - type = objc_skip_type_qualifiers (type); - - switch (*type) { - - case _C_ID: - /* An id may be annotated by the actual type if it is known - with the @"ClassName" syntax */ - - if (*++type != '"') - return type; - else - { - while (*++type != '"') /* do nothing */; - return type + 1; - } - - /* The following are one character type codes */ - case _C_CLASS: - case _C_SEL: - case _C_CHR: - case _C_UCHR: - case _C_CHARPTR: - case _C_ATOM: - case _C_SHT: - case _C_USHT: - case _C_INT: - case _C_UINT: - case _C_LNG: - case _C_ULNG: - case _C_FLT: - case _C_DBL: - case _C_VOID: - case _C_UNDEF: - return ++type; - break; - - case _C_ARY_B: - /* skip digits, typespec and closing ']' */ - - while(isdigit(*++type)); - type = objc_skip_typespec(type); - if (*type == _C_ARY_E) - return ++type; - else - { - objc_error(nil, OBJC_ERR_BAD_TYPE, "bad array type %s\n", type); - return 0; - } - - case _C_STRUCT_B: - /* skip name, and elements until closing '}' */ - - while (*type != _C_STRUCT_E && *type++ != '='); - while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); } - return ++type; - - case _C_UNION_B: - /* skip name, and elements until closing ')' */ - - while (*type != _C_UNION_E && *type++ != '='); - while (*type != _C_UNION_E) { type = objc_skip_typespec (type); } - return ++type; - - case _C_PTR: - /* Just skip the following typespec */ - - return objc_skip_typespec (++type); - - default: - { - objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); - return 0; - } - } - } - - /* - Skip an offset as part of a method encoding. This is prepended by a - '+' if the argument is passed in registers. - */ - inline const char* - objc_skip_offset (const char* type) - { - if (*type == '+') type++; - while(isdigit(*++type)); - return type; - } - - /* - Skip an argument specification of a method encoding. - */ - const char* - objc_skip_argspec (const char* type) - { - type = objc_skip_typespec (type); - type = objc_skip_offset (type); - return type; - } - - /* - Return the number of arguments that the method MTH expects. - Note that all methods need two implicit arguments `self' and - `_cmd'. - */ - int - method_get_number_of_arguments (struct objc_method* mth) - { - int i = 0; - const char* type = mth->method_types; - while (*type) - { - type = objc_skip_argspec (type); - i += 1; - } - return i - 1; - } - - /* - Return the size of the argument block needed on the stack to invoke - the method MTH. This may be zero, if all arguments are passed in - registers. - */ - - int - method_get_sizeof_arguments (struct objc_method* mth) - { - const char* type = objc_skip_typespec (mth->method_types); - return atoi (type); - } - - /* - Return a pointer to the next argument of ARGFRAME. type points to - the last argument. Typical use of this look like: - - { - char *datum, *type; - for (datum = method_get_first_argument (method, argframe, &type); - datum; datum = method_get_next_argument (argframe, &type)) - { - unsigned flags = objc_get_type_qualifiers (type); - type = objc_skip_type_qualifiers (type); - if (*type != _C_PTR) - [portal encodeData: datum ofType: type]; - else - { - if ((flags & _F_IN) == _F_IN) - [portal encodeData: *(char**)datum ofType: ++type]; - } - } - } - */ - - char* - method_get_next_argument (arglist_t argframe, - const char **type) - { - const char *t = objc_skip_argspec (*type); - - if (*t == '\0') - return 0; - - *type = t; - t = objc_skip_typespec (t); - - if (*t == '+') - return argframe->arg_regs + atoi (++t); - else - return argframe->arg_ptr + atoi (t); - } - - /* - Return a pointer to the value of the first argument of the method - described in M with the given argumentframe ARGFRAME. The type - is returned in TYPE. type must be passed to successive calls of - method_get_next_argument. - */ - char* - method_get_first_argument (struct objc_method* m, - arglist_t argframe, - const char** type) - { - *type = m->method_types; - return method_get_next_argument (argframe, type); - } - - /* - Return a pointer to the ARGth argument of the method - M from the frame ARGFRAME. The type of the argument - is returned in the value-result argument TYPE - */ - - char* - method_get_nth_argument (struct objc_method* m, - arglist_t argframe, int arg, - const char **type) - { - const char* t = objc_skip_argspec (m->method_types); - - if (arg > method_get_number_of_arguments (m)) - return 0; - - while (arg--) - t = objc_skip_argspec (t); - - *type = t; - t = objc_skip_typespec (t); - - if (*t == '+') - return argframe->arg_regs + atoi (++t); - else - return argframe->arg_ptr + atoi (t); - } - - unsigned - objc_get_type_qualifiers (const char* type) - { - unsigned res = 0; - BOOL flag = YES; - - while (flag) - switch (*type++) - { - case _C_CONST: res |= _F_CONST; break; - case _C_IN: res |= _F_IN; break; - case _C_INOUT: res |= _F_INOUT; break; - case _C_OUT: res |= _F_OUT; break; - case _C_BYCOPY: res |= _F_BYCOPY; break; - case _C_ONEWAY: res |= _F_ONEWAY; break; - default: flag = NO; - } - - return res; - } --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/encoding.h gcc-2.95/gcc/objc/encoding.h *** egcs-1.1.2/gcc/objc/encoding.h Mon Aug 11 08:58:08 1997 --- gcc-2.95/gcc/objc/encoding.h Wed Dec 31 16:00:00 1969 *************** *** 1,75 **** - /* 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 - #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_ONEWAY 'V' - - #define _F_CONST 0x01 - #define _F_IN 0x01 - #define _F_OUT 0x02 - #define _F_INOUT 0x03 - #define _F_BYCOPY 0x04 - #define _F_ONEWAY 0x08 - - - 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); - - - #endif /* __encoding_INCLUDE_GNU */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/hash.c gcc-2.95/gcc/objc/hash.c *** egcs-1.1.2/gcc/objc/hash.c Mon Aug 11 08:58:08 1997 --- gcc-2.95/gcc/objc/hash.c Wed Dec 31 16:00:00 1969 *************** *** 1,283 **** - /* Hash tables for Objective C internal structures - Copyright (C) 1993, 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. */ - - #include "assert.h" - - #include "objc/hash.h" - - #include "runtime.h" /* for DEBUG_PRINTF */ - - /* These two macros determine when a hash table is full and - by how much it should be expanded respectively. - - These equations are percentages. */ - #define FULLNESS(cache) \ - ((((cache)->size * 75) / 100) <= (cache)->used) - #define EXPANSION(cache) \ - ((cache)->size * 2) - - cache_ptr - hash_new (unsigned int size, hash_func_type hash_func, - compare_func_type compare_func) - { - cache_ptr cache; - - /* Pass me a value greater than 0 and a power of 2. */ - assert (size); - assert (!(size & (size - 1))); - - /* Allocate the cache structure. calloc insures - its initialization for default values. */ - cache = (cache_ptr) objc_calloc (1, sizeof (struct cache)); - assert (cache); - - /* Allocate the array of buckets for the cache. - calloc initializes all of the pointers to NULL. */ - cache->node_table - = (node_ptr *) objc_calloc (size, sizeof (node_ptr)); - assert (cache->node_table); - - cache->size = size; - - /* This should work for all processor architectures? */ - cache->mask = (size - 1); - - /* Store the hashing function so that codes can be computed. */ - cache->hash_func = hash_func; - - /* Store the function that compares hash keys to - determine if they are equal. */ - cache->compare_func = compare_func; - - return cache; - } - - - void - hash_delete (cache_ptr cache) - { - node_ptr node; - node_ptr next_node; - unsigned int i; - - /* Purge all key/value pairs from the table. */ - /* Step through the nodes one by one and remove every node WITHOUT - using hash_next. this makes hash_delete much more efficient. */ - for (i = 0;i < cache->size;i++) { - if ((node = cache->node_table[i])) { - /* an entry in the hash table has been found, now step through the - nodes next in the list and free them. */ - while ((next_node = node->next)) { - hash_remove (cache,node->key); - node = next_node; - } - - hash_remove (cache,node->key); - } - } - - /* Release the array of nodes and the cache itself. */ - objc_free(cache->node_table); - objc_free(cache); - } - - - void - hash_add (cache_ptr *cachep, const void *key, void *value) - { - size_t indx = (*(*cachep)->hash_func)(*cachep, key); - node_ptr node = (node_ptr) objc_calloc (1, sizeof (struct cache_node)); - - - assert (node); - - /* Initialize the new node. */ - node->key = key; - node->value = value; - node->next = (*cachep)->node_table[indx]; - - /* Debugging. - Check the list for another key. */ - #ifdef DEBUG - { node_ptr node1 = (*cachep)->node_table[indx]; - - while (node1) { - - assert (node1->key != key); - node1 = node1->next; - } - } - #endif - - /* Install the node as the first element on the list. */ - (*cachep)->node_table[indx] = node; - - /* Bump the number of entries in the cache. */ - ++(*cachep)->used; - - /* Check the hash table's fullness. We're going - to expand if it is above the fullness level. */ - if (FULLNESS (*cachep)) { - - /* The hash table has reached its fullness level. Time to - expand it. - - I'm using a slow method here but is built on other - primitive functions thereby increasing its - correctness. */ - node_ptr node1 = NULL; - cache_ptr new = hash_new (EXPANSION (*cachep), - (*cachep)->hash_func, - (*cachep)->compare_func); - - DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n", - *cachep, (*cachep)->size, new->size); - - /* Copy the nodes from the first hash table to the new one. */ - while ((node1 = hash_next (*cachep, node1))) - hash_add (&new, node1->key, node1->value); - - /* Trash the old cache. */ - hash_delete (*cachep); - - /* Return a pointer to the new hash table. */ - *cachep = new; - } - } - - - void - hash_remove (cache_ptr cache, const void *key) - { - size_t indx = (*cache->hash_func)(cache, key); - node_ptr node = cache->node_table[indx]; - - - /* We assume there is an entry in the table. Error if it is not. */ - assert (node); - - /* Special case. First element is the key/value pair to be removed. */ - if ((*cache->compare_func)(node->key, key)) { - cache->node_table[indx] = node->next; - objc_free(node); - } else { - - /* Otherwise, find the hash entry. */ - node_ptr prev = node; - BOOL removed = NO; - - do { - - if ((*cache->compare_func)(node->key, key)) { - prev->next = node->next, removed = YES; - objc_free(node); - } else - prev = node, node = node->next; - } while (!removed && node); - assert (removed); - } - - /* Decrement the number of entries in the hash table. */ - --cache->used; - } - - - node_ptr - hash_next (cache_ptr cache, node_ptr node) - { - /* If the scan is being started then reset the last node - visitied pointer and bucket index. */ - if (!node) - cache->last_bucket = 0; - - /* If there is a node visited last then check for another - entry in the same bucket; Otherwise step to the next bucket. */ - if (node) { - if (node->next) - /* There is a node which follows the last node - returned. Step to that node and retun it. */ - return node->next; - else - ++cache->last_bucket; - } - - /* If the list isn't exhausted then search the buckets for - other nodes. */ - if (cache->last_bucket < cache->size) { - /* Scan the remainder of the buckets looking for an entry - at the head of the list. Return the first item found. */ - while (cache->last_bucket < cache->size) - if (cache->node_table[cache->last_bucket]) - return cache->node_table[cache->last_bucket]; - else - ++cache->last_bucket; - - /* No further nodes were found in the hash table. */ - return NULL; - } else - return NULL; - } - - - /* Given KEY, return corresponding value for it in CACHE. - Return NULL if the KEY is not recorded. */ - - void * - hash_value_for_key (cache_ptr cache, const void *key) - { - node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)]; - void *retval = NULL; - - if (node) - do { - if ((*cache->compare_func)(node->key, key)) { - retval = node->value; - break; - } else - node = node->next; - } while (!retval && node); - - return retval; - } - - /* Given KEY, return YES if it exists in the CACHE. - Return NO if it does not */ - - BOOL - hash_is_key_in_hash (cache_ptr cache, const void *key) - { - node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)]; - - if (node) - do { - if ((*cache->compare_func)(node->key, key)) - return YES; - else - node = node->next; - } while (node); - - return NO; - } --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/hash.h gcc-2.95/gcc/objc/hash.h *** egcs-1.1.2/gcc/objc/hash.h Mon Aug 11 08:58:08 1997 --- gcc-2.95/gcc/objc/hash.h Wed Dec 31 16:00:00 1969 *************** *** 1,206 **** - /* 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 - #include - - /* - * 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 */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/init.c gcc-2.95/gcc/objc/init.c *** egcs-1.1.2/gcc/objc/init.c Sun Jun 21 22:23:32 1998 --- gcc-2.95/gcc/objc/init.c Wed Dec 31 16:00:00 1969 *************** *** 1,834 **** - /* GNU Objective C Runtime initialization - Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup - +load support contributed by Ovidiu Predescu - - 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. */ - - #include "runtime.h" - - /* The version number of this runtime. This must match the number - defined in gcc (objc-act.c) */ - #define OBJC_VERSION 8 - #define PROTOCOL_VERSION 2 - - /* This list contains all modules currently loaded into the runtime */ - static struct objc_list* __objc_module_list = 0; /* !T:MUTEX */ - - /* This list contains all proto_list's not yet assigned class links */ - static struct objc_list* unclaimed_proto_list = 0; /* !T:MUTEX */ - - /* List of unresolved static instances. */ - static struct objc_list *uninitialized_statics = 0; /* !T:MUTEX */ - - /* Global runtime "write" mutex. */ - objc_mutex_t __objc_runtime_mutex = 0; - - /* Number of threads that are alive. */ - int __objc_runtime_threads_alive = 1; /* !T:MUTEX */ - - /* Check compiler vs runtime version */ - static void init_check_module_version (Module_t); - - /* Assign isa links to protos */ - static void __objc_init_protocols (struct objc_protocol_list* protos); - - /* Add protocol to class */ - static void __objc_class_add_protocols (Class, struct objc_protocol_list*); - - /* 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 */ - void (*_objc_load_callback)(Class class, Category* category); /* !T:SAFE */ - - /* Is all categories/classes resolved? */ - BOOL __objc_dangling_categories = NO; /* !T:UNUSED */ - - extern SEL - __sel_register_typed_name (const char *name, const char *types, - struct objc_selector *orig, BOOL is_const); - - /* Sends +load to all classes and categories in certain situations. */ - static void objc_send_load (void); - - /* Inserts all the classes defined in module in a tree of classes that - resembles the class hierarchy. This tree is traversed in preorder and the - classes in its nodes receive the +load message if these methods were not - executed before. The algorithm ensures that when the +load method of a class - is executed all the superclasses have been already received the +load - message. */ - static void __objc_create_classes_tree (Module_t module); - - static void __objc_call_callback (Module_t module); - - /* A special version that works only before the classes are completely - installed in the runtime. */ - static BOOL class_is_subclass_of_class (Class class, Class superclass); - - typedef struct objc_class_tree { - Class class; - struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */ - } objc_class_tree; - - /* This is a linked list of objc_class_tree trees. The head of these trees - are root classes (their super class is Nil). These different trees - represent different class hierarchies. */ - static struct objc_list *__objc_class_tree_list = NULL; - - /* Keeps the +load methods who have been already executed. This hash should - not be destroyed during the execution of the program. */ - static cache_ptr __objc_load_methods = NULL; - - /* Creates a tree of classes whose topmost class is directly inherited from - `upper' and the bottom class in this tree is `bottom_class'. The classes - in this tree are super classes of `bottom_class'. `subclasses' member - of each tree node point to the next subclass tree node. */ - static objc_class_tree * - create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper) - { - Class superclass = bottom_class->super_class ? - objc_lookup_class ((char*)bottom_class->super_class) - : Nil; - - objc_class_tree *tree, *prev; - - DEBUG_PRINTF ("create_tree_of_subclasses_inherited_from:"); - DEBUG_PRINTF ("bottom_class = %s, upper = %s\n", - (bottom_class ? bottom_class->name : NULL), - (upper ? upper->name : NULL)); - - tree = prev = objc_calloc (1, sizeof (objc_class_tree)); - prev->class = bottom_class; - - while (superclass != upper) - { - tree = objc_calloc (1, sizeof (objc_class_tree)); - tree->class = superclass; - tree->subclasses = list_cons (prev, tree->subclasses); - superclass = (superclass->super_class ? - objc_lookup_class ((char*)superclass->super_class) - : Nil); - prev = tree; - } - - return tree; - } - - /* Insert the `class' into the proper place in the `tree' class hierarchy. This - function returns a new tree if the class has been successfully inserted into - the tree or NULL if the class is not part of the classes hierarchy described - by `tree'. This function is private to objc_tree_insert_class(), you should - not call it directly. */ - static objc_class_tree * - __objc_tree_insert_class (objc_class_tree *tree, Class class) - { - DEBUG_PRINTF ("__objc_tree_insert_class: tree = %x, class = %s\n", - tree, class->name); - - if (tree == NULL) - return create_tree_of_subclasses_inherited_from (class, NULL); - else if (class == tree->class) - { - /* `class' has been already inserted */ - DEBUG_PRINTF ("1. class %s was previously inserted\n", class->name); - return tree; - } - else if ((class->super_class ? - objc_lookup_class ((char*)class->super_class) - : Nil) - == tree->class) - { - /* If class is a direct subclass of tree->class then add class to the - list of subclasses. First check to see if it wasn't already - inserted. */ - struct objc_list *list = tree->subclasses; - objc_class_tree *node; - - while (list) - { - /* Class has been already inserted; do nothing just return - the tree. */ - if (((objc_class_tree*)list->head)->class == class) - { - DEBUG_PRINTF ("2. class %s was previously inserted\n", - class->name); - return tree; - } - list = list->tail; - } - - /* Create a new node class and insert it into the list of subclasses */ - node = objc_calloc (1, sizeof (objc_class_tree)); - node->class = class; - tree->subclasses = list_cons (node, tree->subclasses); - DEBUG_PRINTF ("3. class %s inserted\n", class->name); - return tree; - } - else - { - /* The class is not a direct subclass of tree->class. Search for class's - superclasses in the list of subclasses. */ - struct objc_list *subclasses = tree->subclasses; - - /* Precondition: the class must be a subclass of tree->class; otherwise - return NULL to indicate our caller that it must take the next tree. */ - if (!class_is_subclass_of_class (class, tree->class)) - return NULL; - - for (; subclasses != NULL; subclasses = subclasses->tail) - { - Class aClass = ((objc_class_tree*)(subclasses->head))->class; - - if (class_is_subclass_of_class (class, aClass)) - { - /* If we found one of class's superclasses we insert the class - into its subtree and return the original tree since nothing - has been changed. */ - subclasses->head - = __objc_tree_insert_class (subclasses->head, class); - DEBUG_PRINTF ("4. class %s inserted\n", class->name); - return tree; - } - } - - /* We haven't found a subclass of `class' in the `subclasses' list. - Create a new tree of classes whose topmost class is a direct subclass - of tree->class. */ - { - objc_class_tree *new_tree - = create_tree_of_subclasses_inherited_from (class, tree->class); - tree->subclasses = list_cons (new_tree, tree->subclasses); - DEBUG_PRINTF ("5. class %s inserted\n", class->name); - return tree; - } - } - } - - /* This function inserts `class' in the right tree hierarchy classes. */ - static void - objc_tree_insert_class (Class class) - { - struct objc_list *list_node; - objc_class_tree *tree; - - list_node = __objc_class_tree_list; - while (list_node) - { - tree = __objc_tree_insert_class (list_node->head, class); - if (tree) - { - list_node->head = tree; - break; - } - else - list_node = list_node->tail; - } - - /* If the list was finished but the class hasn't been inserted, insert it - here. */ - if (!list_node) - { - __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list); - __objc_class_tree_list->head = __objc_tree_insert_class (NULL, class); - } - } - - /* Traverse tree in preorder. Used to send +load. */ - static void - objc_preorder_traverse (objc_class_tree *tree, - int level, - void (*function)(objc_class_tree*, int)) - { - struct objc_list *node; - - (*function) (tree, level); - for (node = tree->subclasses; node; node = node->tail) - objc_preorder_traverse (node->head, level + 1, function); - } - - /* Traverse tree in postorder. Used to destroy a tree. */ - static void - objc_postorder_traverse (objc_class_tree *tree, - int level, - void (*function)(objc_class_tree*, int)) - { - struct objc_list *node; - - for (node = tree->subclasses; node; node = node->tail) - objc_postorder_traverse (node->head, level + 1, function); - (*function) (tree, level); - } - - /* Used to print a tree class hierarchy. */ - #ifdef DEBUG - static void - __objc_tree_print (objc_class_tree *tree, int level) - { - int i; - - for (i = 0; i < level; i++) - printf (" "); - printf ("%s\n", tree->class->name); - } - #endif - - /* Walks on a linked list of methods in the reverse order and executes all - the methods corresponding to `op' selector. Walking in the reverse order - assures the +load of class is executed first and then +load of categories - because of the way in which categories are added to the class methods. */ - static void - __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op) - { - int i; - - if (!method_list) - return; - - /* First execute the `op' message in the following method lists */ - __objc_send_message_in_list (method_list->method_next, class, op); - - /* Search the method list. */ - for (i = 0; i < method_list->method_count; i++) - { - Method_t mth = &method_list->method_list[i]; - - if (mth->method_name && sel_eq (mth->method_name, op) - && !hash_is_key_in_hash (__objc_load_methods, mth->method_name)) - { - /* The method was found and wasn't previously executed. */ - (*mth->method_imp) ((id)class, mth->method_name); - - /* Add this method into the +load hash table */ - hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp); - - DEBUG_PRINTF ("sending +load in class: %s\n", class->name); - - break; - } - } - } - - static void - __objc_send_load (objc_class_tree *tree, int level) - { - static SEL load_sel = 0; - Class class = tree->class; - MethodList_t method_list = class->class_pointer->methods; - - if (!load_sel) - load_sel = sel_register_name ("load"); - - __objc_send_message_in_list (method_list, class, load_sel); - } - - static void - __objc_destroy_class_tree_node (objc_class_tree *tree, int level) - { - objc_free (tree); - } - - /* This is used to check if the relationship between two classes before the - runtime completely installs the classes. */ - static BOOL - class_is_subclass_of_class (Class class, Class superclass) - { - for (; class != Nil;) - { - if (class == superclass) - return YES; - class = (class->super_class ? - objc_lookup_class ((char*)class->super_class) - : Nil); - } - - return NO; - } - - /* This list contains all the classes in the runtime system for whom their - superclasses are not yet know to the runtime. */ - static struct objc_list* unresolved_classes = 0; - - /* Static function used to reference the Object and NXConstantString classes. - */ - static void - __objc_force_linking (void) - { - extern void __objc_linking (void); - __objc_linking (); - - /* Call the function to avoid compiler warning */ - __objc_force_linking (); - } - - /* Run through the statics list, removing modules as soon as all its statics - have been initialized. */ - static void - objc_init_statics (void) - { - struct objc_list **cell = &uninitialized_statics; - struct objc_static_instances **statics_in_module; - - objc_mutex_lock(__objc_runtime_mutex); - - while (*cell) - { - int module_initialized = 1; - - for (statics_in_module = (*cell)->head; - *statics_in_module; statics_in_module++) - { - struct objc_static_instances *statics = *statics_in_module; - Class class = objc_lookup_class (statics->class_name); - - if (!class) - module_initialized = 0; - /* Actually, the static's class_pointer will be NULL when we - haven't been here before. However, the comparison is to be - reminded of taking into account class posing and to think about - possible semantics... */ - else if (class != statics->instances[0]->class_pointer) - { - id *inst; - - for (inst = &statics->instances[0]; *inst; inst++) - { - (*inst)->class_pointer = class; - - /* ??? Make sure the object will not be freed. With - refcounting, invoke `-retain'. Without refcounting, do - nothing and hope that `-free' will never be invoked. */ - - /* ??? Send the object an `-initStatic' or something to - that effect now or later on? What are the semantics of - statically allocated instances, besides the trivial - NXConstantString, anyway? */ - } - } - } - if (module_initialized) - { - /* Remove this module from the uninitialized list. */ - struct objc_list *this = *cell; - *cell = this->tail; - objc_free(this); - } - else - cell = &(*cell)->tail; - } - - objc_mutex_unlock(__objc_runtime_mutex); - } /* objc_init_statics */ - - /* This function is called by constructor functions generated for each - module compiled. (_GLOBAL_$I$...) The purpose of this function is to - gather the module pointers so that they may be processed by the - initialization routines as soon as possible */ - - void - __objc_exec_class (Module_t module) - { - /* Have we processed any constructors previously? This flag is used to - indicate that some global data structures need to be built. */ - static BOOL previous_constructors = 0; - - static struct objc_list* unclaimed_categories = 0; - - /* The symbol table (defined in objc-api.h) generated by gcc */ - Symtab_t symtab = module->symtab; - - /* The statics in this module */ - struct objc_static_instances **statics - = symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt]; - - /* Entry used to traverse hash lists */ - struct objc_list** cell; - - /* The table of selector references for this module */ - SEL selectors = symtab->refs; - - /* dummy counter */ - int i; - - DEBUG_PRINTF ("received module: %s\n", module->name); - - /* check gcc version */ - init_check_module_version(module); - - /* On the first call of this routine, initialize some data structures. */ - if (!previous_constructors) - { - /* Initialize thread-safe system */ - __objc_init_thread_system(); - __objc_runtime_threads_alive = 1; - __objc_runtime_mutex = objc_mutex_allocate(); - - __objc_init_selector_tables(); - __objc_init_class_tables(); - __objc_init_dispatch_tables(); - __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list); - __objc_load_methods - = hash_new (128, (hash_func_type)hash_ptr, compare_ptrs); - previous_constructors = 1; - } - - /* Save the module pointer for later processing. (not currently used) */ - objc_mutex_lock(__objc_runtime_mutex); - __objc_module_list = list_cons(module, __objc_module_list); - - /* Replace referenced selectors from names to SEL's. */ - if (selectors) - { - for (i = 0; selectors[i].sel_id; ++i) - { - const char *name, *type; - name = (char*)selectors[i].sel_id; - type = (char*)selectors[i].sel_types; - /* Constructors are constant static data so we can safely store - pointers to them in the runtime structures. is_const == YES */ - __sel_register_typed_name (name, type, - (struct objc_selector*)&(selectors[i]), - YES); - } - } - - /* Parse the classes in the load module and gather selector information. */ - DEBUG_PRINTF ("gathering selectors from module: %s\n", module->name); - for (i = 0; i < symtab->cls_def_cnt; ++i) - { - Class class = (Class) symtab->defs[i]; - const char* superclass = (char*)class->super_class; - - /* Make sure we have what we think. */ - assert (CLS_ISCLASS(class)); - assert (CLS_ISMETA(class->class_pointer)); - DEBUG_PRINTF ("phase 1, processing class: %s\n", class->name); - - /* Initialize the subclass list to be NULL. - In some cases it isn't and this crashes the program. */ - class->subclass_list = NULL; - - /* Store the class in the class table and assign class numbers. */ - __objc_add_class_to_hash (class); - - /* Register all of the selectors in the class and meta class. */ - __objc_register_selectors_from_class (class); - __objc_register_selectors_from_class ((Class) class->class_pointer); - - /* Install the fake dispatch tables */ - __objc_install_premature_dtable(class); - __objc_install_premature_dtable(class->class_pointer); - - /* Register the instance methods as class methods, this is - only done for root classes. */ - __objc_register_instance_methods_to_class(class); - - if (class->protocols) - __objc_init_protocols (class->protocols); - - /* Check to see if the superclass is known in this point. If it's not - add the class to the unresolved_classes list. */ - if (superclass && !objc_lookup_class (superclass)) - unresolved_classes = list_cons (class, unresolved_classes); - } - - /* Process category information from the module. */ - for (i = 0; i < symtab->cat_def_cnt; ++i) - { - Category_t category = symtab->defs[i + symtab->cls_def_cnt]; - Class class = objc_lookup_class (category->class_name); - - /* If the class for the category exists then append its methods. */ - if (class) - { - - DEBUG_PRINTF ("processing categories from (module,object): %s, %s\n", - module->name, - class->name); - - /* Do instance methods. */ - if (category->instance_methods) - class_add_method_list (class, category->instance_methods); - - /* Do class methods. */ - if (category->class_methods) - class_add_method_list ((Class) class->class_pointer, - category->class_methods); - - if (category->protocols) - { - __objc_init_protocols (category->protocols); - __objc_class_add_protocols (class, category->protocols); - } - - /* Register the instance methods as class methods, this is - only done for root classes. */ - __objc_register_instance_methods_to_class(class); - } - else - { - /* The object to which the category methods belong can't be found. - Save the information. */ - unclaimed_categories = list_cons(category, unclaimed_categories); - } - } - - if (statics) - uninitialized_statics = list_cons (statics, uninitialized_statics); - if (uninitialized_statics) - objc_init_statics (); - - /* Scan the unclaimed category hash. Attempt to attach any unclaimed - categories to objects. */ - for (cell = &unclaimed_categories; - *cell; - ({ if (*cell) cell = &(*cell)->tail; })) - { - Category_t category = (*cell)->head; - Class class = objc_lookup_class (category->class_name); - - if (class) - { - DEBUG_PRINTF ("attaching stored categories to object: %s\n", - class->name); - - list_remove_head (cell); - - if (category->instance_methods) - class_add_method_list (class, category->instance_methods); - - if (category->class_methods) - class_add_method_list ((Class) class->class_pointer, - category->class_methods); - - if (category->protocols) - { - __objc_init_protocols (category->protocols); - __objc_class_add_protocols (class, category->protocols); - } - - /* Register the instance methods as class methods, this is - only done for root classes. */ - __objc_register_instance_methods_to_class(class); - } - } - - if (unclaimed_proto_list && objc_lookup_class ("Protocol")) - { - list_mapcar (unclaimed_proto_list,(void(*)(void*))__objc_init_protocols); - list_free (unclaimed_proto_list); - unclaimed_proto_list = 0; - } - - objc_send_load (); - - objc_mutex_unlock(__objc_runtime_mutex); - } - - static void objc_send_load (void) - { - if (!__objc_module_list) - return; - - /* Try to find out if all the classes loaded so far also have their - superclasses known to the runtime. We suppose that the objects that are - allocated in the +load method are in general of a class declared in the - same module. */ - if (unresolved_classes) - { - Class class = unresolved_classes->head; - - while (objc_lookup_class ((char*)class->super_class)) - { - list_remove_head (&unresolved_classes); - if (unresolved_classes) - class = unresolved_classes->head; - else - break; - } - - /* - * If we still have classes for whom we don't have yet their super - * classes known to the runtime we don't send the +load messages. - */ - if (unresolved_classes) - return; - } - - /* Special check to allow creating and sending messages to constant strings - in +load methods. If these classes are not yet known, even if all the - other classes are known, delay sending of +load. */ - if (!objc_lookup_class ("NXConstantString") || - !objc_lookup_class ("Object")) - return; - - /* Iterate over all modules in the __objc_module_list and call on them the - __objc_create_classes_tree function. This function creates a tree of - classes that resembles the class hierarchy. */ - list_mapcar (__objc_module_list, (void(*)(void*))__objc_create_classes_tree); - - while (__objc_class_tree_list) - { - #ifdef DEBUG - objc_preorder_traverse (__objc_class_tree_list->head, - 0, __objc_tree_print); - #endif - objc_preorder_traverse (__objc_class_tree_list->head, - 0, __objc_send_load); - objc_postorder_traverse (__objc_class_tree_list->head, - 0, __objc_destroy_class_tree_node); - list_remove_head (&__objc_class_tree_list); - } - - list_mapcar (__objc_module_list, (void(*)(void*))__objc_call_callback); - list_free (__objc_module_list); - __objc_module_list = NULL; - } - - static void - __objc_create_classes_tree (Module_t module) - { - /* The runtime mutex is locked in this point */ - - Symtab_t symtab = module->symtab; - int i; - - /* Iterate thru classes defined in this module and insert them in the classes - tree hierarchy. */ - for (i = 0; i < symtab->cls_def_cnt; i++) - { - Class class = (Class) symtab->defs[i]; - - objc_tree_insert_class (class); - } - } - - static void - __objc_call_callback (Module_t module) - { - /* The runtime mutex is locked in this point */ - - Symtab_t symtab = module->symtab; - int i; - - /* Iterate thru classes defined in this module and call the callback for - each one. */ - for (i = 0; i < symtab->cls_def_cnt; i++) - { - Class class = (Class) symtab->defs[i]; - - /* Call the _objc_load_callback for this class. */ - if (_objc_load_callback) - _objc_load_callback(class, 0); - } - - /* Call the _objc_load_callback for categories. Don't register the instance - methods as class methods for categories to root classes since they were - already added in the class. */ - for (i = 0; i < symtab->cat_def_cnt; i++) - { - Category_t category = symtab->defs[i + symtab->cls_def_cnt]; - Class class = objc_lookup_class (category->class_name); - - if (_objc_load_callback) - _objc_load_callback(class, category); - } - } - - /* Sanity check the version of gcc used to compile `module'*/ - static void init_check_module_version(Module_t module) - { - if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module))) - { - int code; - - if(module->version > OBJC_VERSION) - code = OBJC_ERR_OBJC_VERSION; - else if (module->version < OBJC_VERSION) - code = OBJC_ERR_GCC_VERSION; - else - code = OBJC_ERR_MODULE_SIZE; - - objc_error(nil, code, "Module %s version %d doesn't match runtime %d\n", - module->name, (int)module->version, OBJC_VERSION); - } - } - - static void - __objc_init_protocols (struct objc_protocol_list* protos) - { - int i; - static Class proto_class = 0; - - if (! protos) - return; - - objc_mutex_lock(__objc_runtime_mutex); - - if (!proto_class) - proto_class = objc_lookup_class("Protocol"); - - if (!proto_class) - { - unclaimed_proto_list = list_cons (protos, unclaimed_proto_list); - objc_mutex_unlock(__objc_runtime_mutex); - return; - } - - #if 0 - assert (protos->next == 0); /* only single ones allowed */ - #endif - - for(i = 0; i < protos->count; i++) - { - struct objc_protocol* aProto = protos->list[i]; - if (((size_t)aProto->class_pointer) == PROTOCOL_VERSION) - { - /* assign class pointer */ - aProto->class_pointer = proto_class; - - /* init super protocols */ - __objc_init_protocols (aProto->protocol_list); - } - else if (protos->list[i]->class_pointer != proto_class) - { - objc_error(nil, OBJC_ERR_PROTOCOL_VERSION, - "Version %d doesn't match runtime protocol version %d\n", - (int)((char*)protos->list[i]->class_pointer-(char*)0), - PROTOCOL_VERSION); - } - } - - objc_mutex_unlock(__objc_runtime_mutex); - } - - static void __objc_class_add_protocols (Class class, - struct objc_protocol_list* protos) - { - /* Well... */ - if (! protos) - return; - - /* Add it... */ - protos->next = class->protocols; - class->protocols = protos; - } --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/lang-specs.h gcc-2.95/gcc/objc/lang-specs.h *** egcs-1.1.2/gcc/objc/lang-specs.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/gcc/objc/lang-specs.h Mon May 17 16:37:19 1999 *************** *** 0 **** --- 1,96 ---- + /* Definitions for specs for Objective-C. + Copyright (C) 1998, 1999 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. */ + + /* This is the contribution to the `default_compilers' array in gcc.c for + objc. */ + + {".m", {"@objective-c"}}, + {"@objective-c", + #if USE_CPPLIB + {"%{E|M|MM:cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ + %{C:%{!E:%eGNU C does not support -C without using -E}}\ + %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ + %{ansi:-trigraphs -D__STRICT_ANSI__}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{traditional} %{ftraditional:-traditional}\ + %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ + %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ + %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}", + "%{!M:%{!MM:%{!E:cc1obj %i %1 \ + %{nostdinc*} %{A*} %{I*} %{P} %I\ + %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ + %{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"} + #else /* ! USE_CPPLIB */ + {"cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ + %{C:%{!E:%eGNU C does not support -C without using -E}}\ + %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ + %{ansi:-trigraphs -D__STRICT_ANSI__}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{traditional} %{ftraditional:-traditional}\ + %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ + %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ + %i %{!M:%{!MM:%{!E:%{!pipe:%g.mi}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", + "%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.mi} %1 \ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ + %{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"} + #endif /* ! USE_CPPLIB */ + }, + {".mi", {"@objc-cpp-output"}}, + {"@objc-cpp-output", + {"%{!M:%{!MM:%{!E:cc1obj %i %1 \ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n", + "%{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"}}, diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/libobjc.def gcc-2.95/gcc/objc/libobjc.def *** egcs-1.1.2/gcc/objc/libobjc.def Mon Aug 11 08:58:12 1997 --- gcc-2.95/gcc/objc/libobjc.def Wed Dec 31 16:00:00 1969 *************** *** 1,161 **** - ; GNU Objective C Runtime DLL Export Definitions - ; Copyright (C) 1997 Free Software Foundation, Inc. - ; Contributed by Scott Christley - ; - ; 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. - - LIBRARY libobjc - EXPORTS - search_for_method_in_list - objc_get_uninstalled_dtable - hash_is_key_in_hash - objc_verror - _objc_load_callback - objc_malloc - objc_atomic_malloc - objc_valloc - objc_realloc - objc_calloc - objc_free - __objc_init_thread_system - objc_mutex_allocate - objc_mutex_deallocate - objc_mutex_lock - objc_mutex_trylock - objc_mutex_unlock - objc_thread_detach - objc_thread_exit - objc_thread_get_data - objc_thread_get_priority - objc_thread_id - objc_thread_set_data - objc_thread_set_priority - objc_thread_yield - __objc_class_name_Object - __objc_class_name_Protocol - __objc_class_name_NXConstantString - objc_error - __objc_object_alloc - __objc_object_copy - __objc_object_dispose - class_create_instance - object_copy - object_dispose - __objc_init_selector_tables - __objc_register_selectors_from_class - __sel_register_typed_name - sel_get_any_typed_uid - sel_get_any_uid - sel_get_name - sel_get_type - sel_get_typed_uid - sel_get_uid - sel_is_mapped - sel_register_name - sel_register_typed_name - sel_types_match - method_get_first_argument - method_get_next_argument - method_get_nth_argument - method_get_number_of_arguments - method_get_sizeof_arguments - objc_aligned_size - objc_alignof_type - objc_get_type_qualifiers - objc_promoted_size - objc_sizeof_type - objc_skip_argspec - objc_skip_offset - objc_skip_type_qualifiers - objc_skip_typespec - __objc_read_nbyte_uint - __objc_read_nbyte_ulong - __objc_write_class - __objc_write_object - __objc_write_selector - objc_close_typed_stream - objc_end_of_typed_stream - objc_flush_typed_stream - objc_get_stream_class_version - objc_open_typed_stream - objc_open_typed_stream_for_file - objc_read_array - objc_read_char - objc_read_int - objc_read_long - objc_read_object - objc_read_selector - objc_read_short - objc_read_string - objc_read_type - objc_read_types - objc_read_unsigned_char - objc_read_unsigned_int - objc_read_unsigned_long - objc_read_unsigned_short - objc_write_array - objc_write_char - objc_write_int - objc_write_long - objc_write_object - objc_write_object_reference - objc_write_root_object - objc_write_selector - objc_write_short - objc_write_string - objc_write_string_atomic - objc_write_type - objc_write_types - objc_write_unsigned_char - objc_write_unsigned_int - objc_write_unsigned_long - objc_write_unsigned_short - __objc_exec_class - __objc_init_dispatch_tables - __objc_install_premature_dtable - __objc_print_dtable_stats - __objc_responds_to - __objc_update_dispatch_table_for_class - class_add_method_list - class_get_class_method - class_get_instance_method - get_imp - nil_method - objc_msg_lookup - objc_msg_lookup_super - objc_msg_sendv - __objc_add_class_to_hash - __objc_init_class_tables - __objc_resolve_class_links - class_pose_as - objc_get_class - objc_get_meta_class - objc_lookup_class - objc_next_class - sarray_at_put - sarray_at_put_safe - sarray_free - sarray_lazy_copy - sarray_new - sarray_realloc - sarray_remove_garbage - hash_add - hash_delete - hash_new - hash_next - hash_remove - hash_value_for_key --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/libobjc_entry.c gcc-2.95/gcc/objc/libobjc_entry.c *** egcs-1.1.2/gcc/objc/libobjc_entry.c Mon Aug 11 08:58:13 1997 --- gcc-2.95/gcc/objc/libobjc_entry.c Wed Dec 31 16:00:00 1969 *************** *** 1,55 **** - /* GNU Objective C Runtime DLL Entry - Copyright (C) 1997 Free Software Foundation, Inc. - Contributed by Scott Christley - - 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. */ - - #include - - /* - DLL entry function for Objective-C Runtime library - This function gets called everytime a process/thread attaches to DLL - */ - WINBOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, - LPVOID lpReserved) - { - switch(ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - break; - case DLL_PROCESS_DETACH: - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - } - return TRUE; - } - - /* - This section terminates the list of imports under GCC. If you do not - include this then you will have problems when linking with DLLs. - */ - asm (".section .idata$3\n" ".long 0,0,0,0,0,0,0,0"); --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/linking.m gcc-2.95/gcc/objc/linking.m *** egcs-1.1.2/gcc/objc/linking.m Mon Aug 11 08:58:12 1997 --- gcc-2.95/gcc/objc/linking.m Wed Dec 31 16:00:00 1969 *************** *** 1,40 **** - /* Force linking of classes required by Objective C runtime. - Copyright (C) 1997 Free Software Foundation, Inc. - Contributed by Ovidiu Predescu (ovidiu@net-community.com). - - 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. */ - - #include - #include - - /* Generate references to Object and NXConstanstString classes since they are - needed by the runtime system to run correctly. */ - - - void __objc_linking (void) - { - [Object name]; - [NXConstantString name]; - } - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/makefile.dos gcc-2.95/gcc/objc/makefile.dos *** egcs-1.1.2/gcc/objc/makefile.dos Mon Aug 11 08:58:08 1997 --- gcc-2.95/gcc/objc/makefile.dos Wed Dec 31 16:00:00 1969 *************** *** 1,56 **** - # GNU Objective C Runtime Makefile for compiling with djgpp - # Copyright (C) 1993, 1994, 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. - - # This Makefile is configured for GnuMAKE - - GCC_FOR_TARGET=gcc - - .SUFFIXES: .o .m - - OPTIMIZE = -O2 - - # Always search these dirs when compiling. - SUBDIR_INCLUDES = -I. -I.. -I../config - - .c.o: - $(GCC_FOR_TARGET) $(OPTIMIZE) \ - -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $< - - .m.o: - $(GCC_FOR_TARGET) $(OPTIMIZE) -fgnu-runtime \ - -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $< - - OBJC_O = hash.o sarray.o class.o sendmsg.o init.o archive.o \ - selector.o objects.o misc.o object.o protocol.o encoding.o thread.o - - libobjc.a: $(OBJC_O) - -rm -f libobjc.a - ar rc libobjc.a $(OBJC_O) - ranlib libobjc.a - - OBJC_H = hash.h objc-list.h sarray.h objc.h \ - objc-api.h \ - object.h protocol.h mutex.h \ - typedstream.h thread.h - - mostlyclean: - -rm -f *.o libobjc.a xforward fflags - clean: mostlyclean - distclean: mostlyclean - extraclean: mostlyclean --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/misc.c gcc-2.95/gcc/objc/misc.c *** egcs-1.1.2/gcc/objc/misc.c Sat Dec 6 09:29:49 1997 --- gcc-2.95/gcc/objc/misc.c Wed Dec 31 16:00:00 1969 *************** *** 1,152 **** - /* GNU Objective C Runtime Miscellaneous - Copyright (C) 1993, 1994, 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. */ - - #define __USE_FIXED_PROTOTYPES__ - #include - #include "runtime.h" - - /* - ** Error handler function - ** NULL so that default is to just print to stderr - */ - static objc_error_handler _objc_error_handler = NULL; - - /* Trigger an objc error */ - void - objc_error(id object, int code, const char* fmt, ...) - { - va_list ap; - - va_start(ap, fmt); - objc_verror(object, code, fmt, ap); - va_end(ap); - } - - /* Trigger an objc error */ - void - objc_verror(id object, int code, const char* fmt, va_list ap) - { - BOOL result = NO; - - /* Call the error handler if its there - Otherwise print to stderr */ - if (_objc_error_handler) - result = (*_objc_error_handler)(object, code, fmt, ap); - else - vfprintf (stderr, fmt, ap); - - /* Continue if the error handler says its ok - Otherwise abort the program */ - if (result) - return; - else - abort(); - } - - /* Set the error handler */ - objc_error_handler - objc_set_error_handler(objc_error_handler func) - { - objc_error_handler temp = _objc_error_handler; - _objc_error_handler = func; - return temp; - } - - /* - ** 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* res = (void*) (*_objc_malloc)(size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; - } - - void * - objc_atomic_malloc(size_t size) - { - void* res = (void*) (*_objc_atomic_malloc)(size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; - } - - void * - objc_valloc(size_t size) - { - void* res = (void*) (*_objc_valloc)(size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; - } - - void * - objc_realloc(void *mem, size_t size) - { - void* res = (void*) (*_objc_realloc)(mem, size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; - } - - void * - objc_calloc(size_t nelem, size_t size) - { - void* res = (void*) (*_objc_calloc)(nelem, size); - if(!res) - objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); - return res; - } - - void - objc_free(void *mem) - { - (*_objc_free)(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. - */ - void *(*_objc_malloc)(size_t) = malloc; - void *(*_objc_atomic_malloc)(size_t) = malloc; - void *(*_objc_valloc)(size_t) = malloc; - void *(*_objc_realloc)(void *, size_t) = realloc; - void *(*_objc_calloc)(size_t, size_t) = calloc; - void (*_objc_free)(void *) = free; --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/nil_method.c gcc-2.95/gcc/objc/nil_method.c *** egcs-1.1.2/gcc/objc/nil_method.c Mon Aug 11 08:58:12 1997 --- gcc-2.95/gcc/objc/nil_method.c Wed Dec 31 16:00:00 1969 *************** *** 1,40 **** - /* GNU Objective C Runtime nil receiver function - 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. */ - - /* This is the nil method, the function that is called when the receiver - of a method is nil */ - - #include "runtime.h" - - id - nil_method(id receiver, SEL op, ...) - { - return receiver; - } - - - - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/objc-act.c gcc-2.95/gcc/objc/objc-act.c *** egcs-1.1.2/gcc/objc/objc-act.c Mon Jun 29 10:36:07 1998 --- gcc-2.95/gcc/objc/objc-act.c Wed Apr 14 13:28:54 1999 *************** Boston, MA 02111-1307, USA. */ *** 55,61 **** #include "cpplib.h" extern cpp_reader parse_in; extern cpp_options parse_options; - static int cpp_initialized; #endif /* This is the default way of generating a method name. */ --- 55,60 ---- *************** static void dump_interface PROTO((FILE *** 284,290 **** /* Everything else. */ ! static void objc_fatal PROTO((void)); static tree define_decl PROTO((tree, tree)); static tree lookup_method_in_protocol_list PROTO((tree, tree, int)); static tree lookup_protocol_in_reflist PROTO((tree, tree)); --- 283,290 ---- /* Everything else. */ ! static void objc_fatal PROTO((void)) ! ATTRIBUTE_NORETURN; static tree define_decl PROTO((tree, tree)); static tree lookup_method_in_protocol_list PROTO((tree, tree, int)); static tree lookup_protocol_in_reflist PROTO((tree, tree)); *************** generate_struct_by_value_array () *** 591,599 **** --- 591,608 ---- exit (0); } + #if USE_CPPLIB + extern char *yy_cur; + #endif + void lang_init_options () { + #if USE_CPPLIB + cpp_reader_init (&parse_in); + parse_in.opts = &parse_options; + cpp_options_init (&parse_options); + #endif } void *************** lang_init () *** 604,610 **** With luck, we discover the real source file's name from that and put it in input_filename. */ ungetc (check_newline (), finput); ! #endif /* The line number can be -1 if we had -g3 and the input file had a directive specifying line 0. But we want predefined --- 613,622 ---- With luck, we discover the real source file's name from that and put it in input_filename. */ ungetc (check_newline (), finput); ! #else ! check_newline (); ! yy_cur--; ! #endif /* The line number can be -1 if we had -g3 and the input file had a directive specifying line 0. But we want predefined *************** lang_decode_option (argc, argv) *** 682,696 **** char **argv; { char *p = argv[0]; - #if USE_CPPLIB - if (! cpp_initialized) - { - cpp_reader_init (&parse_in); - parse_in.data = &parse_options; - cpp_options_init (&parse_options); - cpp_initialized = 1; - } - #endif if (!strcmp (p, "-lang-objc")) doing_objc_thang = 1; else if (!strcmp (p, "-gen-decls")) --- 694,699 ---- *************** my_build_string (len, str) *** 1317,1323 **** tree build_objc_string (len, str) int len; ! char *str; { tree s = build_string (len, str); --- 1320,1326 ---- tree build_objc_string (len, str) int len; ! const char *str; { tree s = build_string (len, str); *************** get_objc_string_decl (ident, section) *** 1855,1860 **** --- 1858,1865 ---- chain = meth_var_names_chain; else if (section == meth_var_types) chain = meth_var_types_chain; + else + abort (); for (; chain != 0; chain = TREE_VALUE (chain)) if (TREE_VALUE (chain) == ident) *************** build_selector_translation_table () *** 2078,2084 **** tree sc_spec, decl_specs; tree chain, initlist = NULL_TREE; int offset = 0; ! tree decl, var_decl, name; /* The corresponding pop_obstacks is in finish_decl, called at the end of this function. */ --- 2083,2089 ---- tree sc_spec, decl_specs; tree chain, initlist = NULL_TREE; int offset = 0; ! tree decl = NULL_TREE, var_decl, name; /* The corresponding pop_obstacks is in finish_decl, called at the end of this function. */ *************** add_objc_string (ident, section) *** 2350,2355 **** --- 2355,2362 ---- chain = &meth_var_names_chain; else if (section == meth_var_types) chain = &meth_var_types_chain; + else + abort (); while (*chain) { *************** build_selector_template () *** 3380,3385 **** --- 3387,3393 ---- struct objc_class *sibling_class; } struct objc_protocol_list *protocols; + void *gc_object_type; }; */ static void *************** build_class_template () *** 3515,3520 **** --- 3523,3543 ---- decl_specs, NULL_TREE); chainon (field_decl_chain, field_decl); + /* void *sel_id; */ + + decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_VOID]); + field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("sel_id")); + field_decl + = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE); + chainon (field_decl_chain, field_decl); + + /* void *gc_object_type; */ + + decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_VOID]); + field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("gc_object_type")); + field_decl + = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE); + chainon (field_decl_chain, field_decl); finish_struct (objc_class_template, field_decl_chain, NULL_TREE); } *************** generate_protocol_list (i_or_p) *** 4203,4208 **** --- 4226,4233 ---- synth_id_with_class_suffix ("_OBJC_CATEGORY_PROTOCOLS", i_or_p), build_int_2 (size + 2, 0)); + else + abort (); expr_decl = build1 (INDIRECT_REF, NULL_TREE, expr_decl); *************** build_category_initializer (type, cat_na *** 4287,4292 **** --- 4312,4318 ---- struct objc_class *sibling_class; } struct objc_protocol_list *protocols; + void *gc_object_type; }; */ static tree *************** build_shared_structure_initializer (type *** 4377,4382 **** --- 4403,4411 ---- initlist = tree_cons (NULL_TREE, expr, initlist); } + /* gc_object_type = NULL */ + initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + return build_constructor (type, nreverse (initlist)); } *************** synth_id_with_class_suffix (preamble, ct *** 4576,4581 **** --- 4605,4613 ---- = (char *) alloca (strlen (preamble) + strlen (protocol_name) + 3); sprintf (string, "%s_%s", preamble, protocol_name); } + else + abort (); + return get_identifier (string); } *************** is_objc_type_qualifier (node) *** 4590,4595 **** --- 4622,4628 ---- || node == ridpointers [(int) RID_OUT] || node == ridpointers [(int) RID_INOUT] || node == ridpointers [(int) RID_BYCOPY] + || node == ridpointers [(int) RID_BYREF] || node == ridpointers [(int) RID_ONEWAY])); } *************** build_keyword_selector (selector) *** 4676,4681 **** --- 4709,4716 ---- key_name = KEYWORD_KEY_NAME (key_chain); else if (TREE_CODE (selector) == TREE_LIST) key_name = TREE_PURPOSE (key_chain); + else + abort (); if (key_name) len += IDENTIFIER_LENGTH (key_name) + 1; *************** build_keyword_selector (selector) *** 4693,4698 **** --- 4728,4735 ---- key_name = KEYWORD_KEY_NAME (key_chain); else if (TREE_CODE (selector) == TREE_LIST) key_name = TREE_PURPOSE (key_chain); + else + abort (); if (key_name) strcat (buf, IDENTIFIER_POINTER (key_name)); *************** build_message_expr (mess) *** 4945,4950 **** --- 4982,4989 ---- sel_name = args; else if (TREE_CODE (args) == TREE_LIST) sel_name = build_keyword_selector (args); + else + abort (); /* Build the parameter list to give to the method. */ *************** build_selector_expr (selnamelist) *** 5351,5356 **** --- 5390,5397 ---- selname = selnamelist; else if (TREE_CODE (selnamelist) == TREE_LIST) selname = build_keyword_selector (selnamelist); + else + abort (); if (flag_typed_selectors) return build_typed_selector_reference (selname, 0); *************** encode_type_qualifiers (declspecs) *** 6475,6480 **** --- 6516,6523 ---- obstack_1grow (&util_obstack, 'o'); else if (ridpointers[(int) RID_BYCOPY] == TREE_VALUE (spec)) obstack_1grow (&util_obstack, 'O'); + else if (ridpointers[(int) RID_BYREF] == TREE_VALUE (spec)) + obstack_1grow (&util_obstack, 'R'); else if (ridpointers[(int) RID_ONEWAY] == TREE_VALUE (spec)) obstack_1grow (&util_obstack, 'V'); } *************** encode_type (type, curtype, format) *** 6819,6824 **** --- 6862,6923 ---- } static void + encode_complete_bitfield (int position, tree type, int size) + { + enum tree_code code = TREE_CODE (type); + char buffer[40]; + char charType = '?'; + + if (code == INTEGER_TYPE) + { + if (TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)) == 0 + && TREE_INT_CST_HIGH (TYPE_MIN_VALUE (type)) == 0) + { + /* Unsigned integer types. */ + + if (TYPE_MODE (type) == QImode) + charType = 'C'; + else if (TYPE_MODE (type) == HImode) + charType = 'S'; + else if (TYPE_MODE (type) == SImode) + { + if (type == long_unsigned_type_node) + charType = 'L'; + else + charType = 'I'; + } + else if (TYPE_MODE (type) == DImode) + charType = 'Q'; + } + + else + /* Signed integer types. */ + { + if (TYPE_MODE (type) == QImode) + charType = 'c'; + else if (TYPE_MODE (type) == HImode) + charType = 's'; + else if (TYPE_MODE (type) == SImode) + { + if (type == long_integer_type_node) + charType = 'l'; + else + charType = 'i'; + } + + else if (TYPE_MODE (type) == DImode) + charType = 'q'; + } + } + + else + abort (); + + sprintf (buffer, "b%d%c%d", position, charType, size); + obstack_grow (&util_obstack, buffer, strlen (buffer)); + } + + static void encode_field_decl (field_decl, curtype, format) tree field_decl; int curtype; *************** encode_field_decl (field_decl, curtype, *** 6826,6843 **** { tree type; ! /* If this field is obviously a bitfield, or is a bitfield that has been clobbered to look like a ordinary integer mode, go ahead and generate the bitfield typing information. */ ! type = TREE_TYPE (field_decl); ! if (DECL_BIT_FIELD (field_decl)) ! encode_bitfield (DECL_FIELD_SIZE (field_decl), format); ! else if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST ! && DECL_FIELD_SIZE (field_decl) ! && TYPE_MODE (type) > DECL_MODE (field_decl)) ! encode_bitfield (DECL_FIELD_SIZE (field_decl), format); else ! encode_type (TREE_TYPE (field_decl), curtype, format); } static tree --- 6925,6960 ---- { tree type; ! type = TREE_TYPE (field_decl); ! ! /* If this field is obviously a bitfield, or is a bitfield that has been clobbered to look like a ordinary integer mode, go ahead and generate the bitfield typing information. */ ! if (flag_next_runtime) ! { ! if (DECL_BIT_FIELD (field_decl)) ! encode_bitfield (DECL_FIELD_SIZE (field_decl), format); ! else if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST ! && DECL_FIELD_SIZE (field_decl) ! && TYPE_MODE (type) > DECL_MODE (field_decl)) ! encode_bitfield (DECL_FIELD_SIZE (field_decl), format); ! else ! encode_type (TREE_TYPE (field_decl), curtype, format); ! } else ! { ! if (DECL_BIT_FIELD (field_decl) ! || (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST ! && DECL_FIELD_SIZE (field_decl) ! && TYPE_MODE (type) > DECL_MODE (field_decl))) ! { ! encode_complete_bitfield (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field_decl)), ! DECL_BIT_FIELD_TYPE (field_decl), ! DECL_FIELD_SIZE (field_decl)); ! } ! else ! encode_type (TREE_TYPE (field_decl), curtype, format); ! } } static tree *************** gen_declarator (decl, buf, name) *** 7535,7541 **** return buf; default: ! break; } return str; --- 7652,7658 ---- return buf; default: ! abort (); } return str; diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/objc-api.h gcc-2.95/gcc/objc/objc-api.h *** egcs-1.1.2/gcc/objc/objc-api.h Mon Jun 29 14:40:48 1998 --- gcc-2.95/gcc/objc/objc-api.h Wed Dec 31 16:00:00 1969 *************** *** 1,584 **** - /* 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 - #include - - /* 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_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 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 */ - - - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/objc-list.h gcc-2.95/gcc/objc/objc-list.h *** egcs-1.1.2/gcc/objc/objc-list.h Mon Aug 11 08:58:11 1997 --- gcc-2.95/gcc/objc/objc-list.h Wed Dec 31 16:00:00 1969 *************** *** 1,147 **** - /* 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 __GNU_OBJC_LIST_H --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/objc-parse.c gcc-2.95/gcc/objc/objc-parse.c *** egcs-1.1.2/gcc/objc/objc-parse.c Sun Mar 14 03:13:11 1999 --- gcc-2.95/gcc/objc/objc-parse.c Thu Jul 29 05:46:15 1999 *************** extern void yyprint PROTO ((FILE *, in *** 146,156 **** ! #define YYFINAL 947 #define YYFLAG -32768 #define YYNTBASE 84 ! #define YYTRANSLATE(x) ((unsigned)(x) <= 316 ? yytranslate[x] : 309) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, --- 146,156 ---- ! #define YYFINAL 955 #define YYFLAG -32768 #define YYNTBASE 84 ! #define YYTRANSLATE(x) ((unsigned)(x) <= 316 ? yytranslate[x] : 311) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, *************** static const short yyprhs[] = { 0, *** 209,272 **** 509, 511, 515, 517, 521, 522, 527, 528, 535, 539, 540, 547, 551, 552, 554, 556, 559, 566, 568, 572, 573, 575, 580, 587, 592, 594, 596, 598, 600, 602, ! 603, 608, 610, 611, 614, 616, 620, 622, 623, 628, ! 630, 631, 636, 637, 643, 644, 645, 651, 652, 653, ! 659, 661, 663, 667, 671, 676, 680, 684, 688, 690, ! 692, 696, 701, 705, 709, 713, 715, 719, 723, 727, ! 732, 736, 740, 742, 744, 747, 749, 752, 754, 757, ! 758, 766, 772, 775, 776, 784, 790, 793, 794, 803, ! 804, 812, 815, 816, 818, 819, 821, 823, 826, 827, ! 831, 834, 839, 843, 845, 849, 851, 853, 856, 858, ! 862, 867, 874, 880, 882, 886, 888, 890, 894, 897, ! 900, 901, 903, 905, 908, 909, 912, 916, 920, 923, ! 927, 932, 936, 939, 943, 946, 948, 950, 953, 956, ! 957, 959, 962, 963, 964, 966, 968, 971, 975, 977, ! 980, 982, 985, 992, 998, 1004, 1007, 1010, 1015, 1016, ! 1021, 1022, 1023, 1027, 1032, 1036, 1038, 1040, 1042, 1044, ! 1047, 1048, 1053, 1055, 1059, 1060, 1061, 1069, 1075, 1078, ! 1079, 1080, 1081, 1094, 1095, 1102, 1105, 1108, 1111, 1115, ! 1122, 1131, 1142, 1155, 1159, 1164, 1166, 1168, 1169, 1176, ! 1180, 1186, 1189, 1192, 1193, 1195, 1196, 1198, 1199, 1201, ! 1203, 1207, 1212, 1214, 1218, 1219, 1222, 1225, 1226, 1231, ! 1234, 1235, 1237, 1239, 1243, 1245, 1249, 1254, 1259, 1264, ! 1269, 1274, 1275, 1278, 1280, 1283, 1285, 1289, 1291, 1295, ! 1297, 1299, 1301, 1303, 1305, 1307, 1309, 1311, 1315, 1319, ! 1324, 1325, 1326, 1337, 1338, 1345, 1346, 1347, 1360, 1361, ! 1370, 1371, 1378, 1381, 1382, 1391, 1396, 1397, 1407, 1413, ! 1414, 1421, 1422, 1424, 1428, 1432, 1434, 1436, 1438, 1440, ! 1441, 1445, 1448, 1452, 1456, 1458, 1459, 1461, 1465, 1467, ! 1471, 1474, 1475, 1476, 1477, 1485, 1486, 1487, 1488, 1496, ! 1497, 1498, 1501, 1503, 1505, 1508, 1509, 1513, 1515, 1517, ! 1518, 1519, 1525, 1526, 1527, 1533, 1538, 1540, 1546, 1549, ! 1550, 1553, 1554, 1556, 1558, 1560, 1563, 1566, 1571, 1574, ! 1577, 1579, 1583, 1586, 1589, 1592, 1593, 1596, 1597, 1601, ! 1603, 1605, 1608, 1610, 1612, 1614, 1616, 1618, 1620, 1622, ! 1624, 1626, 1628, 1630, 1632, 1634, 1636, 1638, 1640, 1642, ! 1644, 1646, 1648, 1650, 1652, 1654, 1656, 1658, 1665, 1669, ! 1675, 1678, 1680, 1682, 1684, 1687, 1689, 1693, 1696, 1698, ! 1700, 1701, 1702, 1709, 1711, 1713, 1715, 1718, 1721, 1723, ! 1728, 1733 }; static const short yyrhs[] = { -1, 85, 0, 0, 86, 88, 0, 0, 85, 87, 88, ! 0, 90, 0, 89, 0, 240, 0, 27, 59, 99, ! 76, 77, 0, 239, 88, 0, 123, 137, 77, 0, 130, 123, 137, 77, 0, 126, 123, 136, 77, 0, 130, 77, 0, 126, 77, 0, 1, 77, 0, 1, ! 78, 0, 77, 0, 0, 0, 126, 123, 163, 91, ! 117, 92, 197, 0, 126, 123, 163, 1, 0, 0, ! 0, 130, 123, 166, 93, 117, 94, 197, 0, 130, ! 123, 166, 1, 0, 0, 0, 123, 166, 95, 117, ! 96, 197, 0, 123, 166, 1, 0, 3, 0, 4, 0, 72, 0, 67, 0, 43, 0, 49, 0, 48, 0, 54, 0, 55, 0, 79, 0, 80, 0, 101, 0, 0, 101, 0, 107, 0, 101, 81, 107, 0, ! 113, 0, 50, 105, 0, 239, 105, 0, 98, 105, ! 0, 40, 97, 0, 103, 102, 0, 103, 59, 184, ! 76, 0, 104, 102, 0, 104, 59, 184, 76, 0, 33, 105, 0, 34, 105, 0, 11, 0, 29, 0, ! 102, 0, 59, 184, 76, 105, 0, 0, 59, 184, 76, 82, 106, 151, 78, 0, 105, 0, 107, 48, 107, 0, 107, 49, 107, 0, 107, 50, 107, 0, 107, 51, 107, 0, 107, 52, 107, 0, 107, 46, --- 209,272 ---- 509, 511, 515, 517, 521, 522, 527, 528, 535, 539, 540, 547, 551, 552, 554, 556, 559, 566, 568, 572, 573, 575, 580, 587, 592, 594, 596, 598, 600, 602, ! 603, 608, 610, 611, 614, 616, 620, 624, 627, 628, ! 633, 635, 636, 641, 643, 645, 647, 650, 653, 654, ! 655, 661, 662, 663, 669, 671, 673, 677, 681, 686, ! 690, 694, 698, 700, 702, 706, 711, 715, 719, 723, ! 725, 729, 733, 737, 742, 746, 750, 752, 754, 757, ! 759, 762, 764, 767, 768, 776, 782, 785, 786, 794, ! 800, 803, 804, 813, 814, 822, 825, 826, 828, 829, ! 831, 833, 836, 837, 841, 844, 849, 853, 855, 859, ! 861, 863, 866, 868, 872, 877, 884, 890, 892, 896, ! 898, 900, 904, 907, 910, 911, 913, 915, 918, 919, ! 922, 926, 930, 933, 937, 942, 946, 949, 953, 956, ! 960, 962, 964, 967, 970, 971, 973, 976, 977, 978, ! 980, 982, 985, 989, 991, 994, 996, 999, 1006, 1012, ! 1018, 1021, 1024, 1029, 1030, 1035, 1036, 1037, 1041, 1046, ! 1050, 1052, 1054, 1056, 1058, 1061, 1062, 1067, 1069, 1073, ! 1074, 1075, 1083, 1089, 1092, 1093, 1094, 1095, 1108, 1109, ! 1116, 1119, 1122, 1125, 1129, 1136, 1145, 1156, 1169, 1173, ! 1178, 1180, 1182, 1183, 1190, 1194, 1200, 1203, 1207, 1208, ! 1210, 1211, 1213, 1214, 1216, 1218, 1222, 1227, 1229, 1233, ! 1234, 1237, 1240, 1241, 1246, 1249, 1250, 1252, 1254, 1258, ! 1260, 1264, 1269, 1274, 1279, 1284, 1289, 1290, 1293, 1295, ! 1298, 1300, 1304, 1306, 1310, 1312, 1314, 1316, 1318, 1320, ! 1322, 1324, 1326, 1330, 1334, 1339, 1340, 1341, 1352, 1353, ! 1360, 1361, 1362, 1375, 1376, 1385, 1386, 1393, 1396, 1397, ! 1406, 1411, 1412, 1422, 1428, 1429, 1436, 1437, 1439, 1443, ! 1447, 1449, 1451, 1453, 1455, 1456, 1460, 1463, 1467, 1471, ! 1473, 1474, 1476, 1480, 1482, 1486, 1489, 1490, 1491, 1492, ! 1500, 1501, 1502, 1503, 1511, 1512, 1513, 1516, 1518, 1520, ! 1523, 1524, 1528, 1530, 1532, 1533, 1534, 1540, 1541, 1542, ! 1548, 1553, 1555, 1561, 1564, 1565, 1568, 1569, 1571, 1573, ! 1575, 1578, 1581, 1586, 1589, 1592, 1594, 1598, 1601, 1604, ! 1607, 1608, 1611, 1612, 1616, 1618, 1620, 1623, 1625, 1627, ! 1629, 1631, 1633, 1635, 1637, 1639, 1641, 1643, 1645, 1647, ! 1649, 1651, 1653, 1655, 1657, 1659, 1661, 1663, 1665, 1667, ! 1669, 1671, 1673, 1680, 1684, 1690, 1693, 1695, 1697, 1699, ! 1702, 1704, 1708, 1711, 1713, 1715, 1716, 1717, 1724, 1726, ! 1728, 1730, 1733, 1736, 1738, 1743, 1748 }; static const short yyrhs[] = { -1, 85, 0, 0, 86, 88, 0, 0, 85, 87, 88, ! 0, 90, 0, 89, 0, 242, 0, 27, 59, 99, ! 76, 77, 0, 241, 88, 0, 123, 137, 77, 0, 130, 123, 137, 77, 0, 126, 123, 136, 77, 0, 130, 77, 0, 126, 77, 0, 1, 77, 0, 1, ! 78, 0, 77, 0, 0, 0, 126, 123, 165, 91, ! 117, 92, 199, 0, 126, 123, 165, 1, 0, 0, ! 0, 130, 123, 168, 93, 117, 94, 199, 0, 130, ! 123, 168, 1, 0, 0, 0, 123, 168, 95, 117, ! 96, 199, 0, 123, 168, 1, 0, 3, 0, 4, 0, 72, 0, 67, 0, 43, 0, 49, 0, 48, 0, 54, 0, 55, 0, 79, 0, 80, 0, 101, 0, 0, 101, 0, 107, 0, 101, 81, 107, 0, ! 113, 0, 50, 105, 0, 241, 105, 0, 98, 105, ! 0, 40, 97, 0, 103, 102, 0, 103, 59, 186, ! 76, 0, 104, 102, 0, 104, 59, 186, 76, 0, 33, 105, 0, 34, 105, 0, 11, 0, 29, 0, ! 102, 0, 59, 186, 76, 105, 0, 0, 59, 186, 76, 82, 106, 151, 78, 0, 105, 0, 107, 48, 107, 0, 107, 49, 107, 0, 107, 50, 107, 0, 107, 51, 107, 0, 107, 52, 107, 0, 107, 46, *************** static const short yyrhs[] = { -1, *** 278,428 **** 37, 112, 38, 107, 0, 107, 36, 107, 0, 107, 35, 107, 0, 3, 0, 8, 0, 115, 0, 59, 99, 76, 0, 59, 1, 76, 0, 0, 59, 114, ! 199, 76, 0, 113, 59, 100, 76, 0, 113, 60, 99, 83, 0, 113, 58, 97, 0, 113, 57, 97, ! 0, 113, 54, 0, 113, 55, 0, 300, 0, 306, ! 0, 307, 0, 308, 0, 116, 0, 9, 0, 115, 9, 0, 75, 0, 116, 75, 0, 0, 119, 0, ! 119, 10, 0, 204, 205, 120, 0, 118, 0, 192, ! 0, 119, 118, 0, 118, 192, 0, 128, 123, 136, 77, 0, 131, 123, 137, 77, 0, 128, 77, 0, ! 131, 77, 0, 204, 205, 125, 0, 121, 0, 192, ! 0, 122, 121, 0, 121, 192, 0, 0, 0, 126, 123, 136, 77, 0, 130, 123, 137, 77, 0, 126, ! 123, 157, 0, 130, 123, 160, 0, 126, 77, 0, ! 130, 77, 0, 239, 125, 0, 134, 127, 0, 130, 134, 127, 0, 0, 127, 135, 0, 127, 5, 0, 127, 144, 0, 134, 129, 0, 131, 134, 129, 0, 0, 129, 135, 0, 129, 5, 0, 131, 0, 144, 0, 130, 131, 0, 130, 144, 0, 7, 0, 5, 0, 131, 7, 0, 131, 5, 0, 134, 133, 0, ! 186, 134, 133, 0, 0, 133, 135, 0, 6, 0, ! 170, 0, 4, 0, 67, 256, 0, 72, 256, 0, ! 257, 0, 28, 59, 99, 76, 0, 28, 59, 184, ! 76, 0, 6, 0, 7, 0, 170, 0, 139, 0, 136, 81, 139, 0, 141, 0, 137, 81, 139, 0, ! 0, 27, 59, 115, 76, 0, 0, 163, 138, 143, ! 36, 140, 149, 0, 163, 138, 143, 0, 0, 166, ! 138, 143, 36, 142, 149, 0, 166, 138, 143, 0, 0, 144, 0, 145, 0, 144, 145, 0, 30, 59, 59, 146, 76, 76, 0, 147, 0, 146, 81, 147, 0, 0, 148, 0, 148, 59, 3, 76, 0, 148, 59, 3, 81, 101, 76, 0, 148, 59, 100, 76, 0, 97, 0, 5, 0, 6, 0, 7, 0, 107, 0, 0, 82, 150, 151, 78, 0, 1, 0, 0, ! 152, 175, 0, 153, 0, 152, 81, 153, 0, 107, ! 0, 0, 82, 154, 151, 78, 0, 1, 0, 0, ! 97, 38, 155, 153, 0, 0, 58, 97, 36, 156, ! 153, 0, 0, 0, 163, 158, 117, 159, 199, 0, ! 0, 0, 166, 161, 117, 162, 199, 0, 164, 0, ! 166, 0, 59, 164, 76, 0, 164, 59, 234, 0, ! 164, 60, 99, 83, 0, 164, 60, 83, 0, 50, ! 187, 164, 0, 144, 124, 164, 0, 4, 0, 72, ! 0, 165, 59, 234, 0, 165, 60, 99, 83, 0, ! 165, 60, 83, 0, 50, 187, 165, 0, 144, 124, ! 165, 0, 4, 0, 166, 59, 234, 0, 59, 166, ! 76, 0, 50, 187, 166, 0, 166, 60, 99, 83, ! 0, 166, 60, 83, 0, 144, 124, 166, 0, 3, 0, 13, 0, 13, 144, 0, 14, 0, 14, 144, ! 0, 12, 0, 12, 144, 0, 0, 167, 97, 82, ! 171, 177, 78, 143, 0, 167, 82, 177, 78, 143, ! 0, 167, 97, 0, 0, 168, 97, 82, 172, 177, ! 78, 143, 0, 168, 82, 177, 78, 143, 0, 168, ! 97, 0, 0, 169, 97, 82, 173, 182, 176, 78, ! 143, 0, 0, 169, 82, 174, 182, 176, 78, 143, ! 0, 169, 97, 0, 0, 81, 0, 0, 81, 0, ! 178, 0, 178, 179, 0, 0, 178, 179, 77, 0, ! 178, 77, 0, 65, 59, 67, 76, 0, 132, 123, ! 180, 0, 132, 0, 186, 123, 180, 0, 186, 0, ! 1, 0, 239, 179, 0, 181, 0, 180, 81, 181, ! 0, 204, 205, 163, 143, 0, 204, 205, 163, 38, ! 107, 143, 0, 204, 205, 38, 107, 143, 0, 183, ! 0, 182, 81, 183, 0, 1, 0, 97, 0, 97, ! 36, 107, 0, 132, 185, 0, 186, 185, 0, 0, ! 188, 0, 7, 0, 186, 7, 0, 0, 187, 7, ! 0, 59, 188, 76, 0, 50, 187, 188, 0, 50, ! 187, 0, 188, 59, 227, 0, 188, 60, 99, 83, ! 0, 188, 60, 83, 0, 59, 227, 0, 60, 99, ! 83, 0, 60, 83, 0, 190, 0, 207, 0, 190, ! 207, 0, 190, 192, 0, 0, 189, 0, 1, 77, ! 0, 0, 0, 195, 0, 196, 0, 195, 196, 0, ! 32, 238, 77, 0, 199, 0, 1, 199, 0, 82, ! 0, 198, 78, 0, 198, 193, 194, 122, 191, 78, ! 0, 198, 193, 194, 1, 78, 0, 198, 193, 194, ! 189, 78, 0, 201, 206, 0, 201, 1, 0, 15, ! 59, 99, 76, 0, 0, 18, 203, 206, 17, 0, ! 0, 0, 204, 205, 209, 0, 204, 205, 220, 206, ! 0, 204, 205, 208, 0, 209, 0, 220, 0, 199, ! 0, 217, 0, 99, 77, 0, 0, 200, 16, 210, ! 206, 0, 200, 0, 200, 16, 1, 0, 0, 0, ! 17, 211, 59, 99, 76, 212, 206, 0, 202, 59, ! 99, 76, 77, 0, 202, 1, 0, 0, 0, 0, ! 19, 59, 222, 77, 213, 222, 77, 214, 222, 76, ! 215, 206, 0, 0, 20, 59, 99, 76, 216, 206, ! 0, 23, 77, 0, 24, 77, 0, 25, 77, 0, ! 25, 99, 77, 0, 27, 221, 59, 99, 76, 77, ! 0, 27, 221, 59, 99, 38, 223, 76, 77, 0, ! 27, 221, 59, 99, 38, 223, 38, 223, 76, 77, ! 0, 27, 221, 59, 99, 38, 223, 38, 223, 38, ! 226, 76, 77, 0, 26, 97, 77, 0, 26, 50, ! 99, 77, 0, 77, 0, 218, 0, 0, 19, 59, ! 113, 76, 219, 206, 0, 21, 107, 38, 0, 21, ! 107, 10, 107, 38, 0, 22, 38, 0, 97, 38, ! 0, 0, 7, 0, 0, 99, 0, 0, 224, 0, ! 225, 0, 224, 81, 225, 0, 9, 59, 99, 76, ! 0, 115, 0, 226, 81, 115, 0, 0, 228, 229, ! 0, 231, 76, 0, 0, 232, 77, 230, 229, 0, ! 1, 76, 0, 0, 10, 0, 232, 0, 232, 81, ! 10, 0, 233, 0, 232, 81, 233, 0, 126, 123, ! 165, 143, 0, 126, 123, 166, 143, 0, 126, 123, ! 185, 143, 0, 130, 123, 166, 143, 0, 130, 123, ! 185, 143, 0, 0, 235, 236, 0, 229, 0, 237, ! 76, 0, 3, 0, 237, 81, 3, 0, 97, 0, ! 238, 81, 97, 0, 31, 0, 244, 0, 242, 0, ! 243, 0, 254, 0, 264, 0, 63, 0, 97, 0, ! 241, 81, 97, 0, 73, 241, 77, 0, 74, 97, ! 97, 77, 0, 0, 0, 61, 97, 256, 82, 245, ! 258, 78, 246, 271, 63, 0, 0, 61, 97, 256, ! 247, 271, 63, 0, 0, 0, 61, 97, 38, 97, ! 256, 82, 248, 258, 78, 249, 271, 63, 0, 0, ! 61, 97, 38, 97, 256, 250, 271, 63, 0, 0, ! 62, 97, 82, 251, 258, 78, 0, 62, 97, 0, ! 0, 62, 97, 38, 97, 82, 252, 258, 78, 0, ! 62, 97, 38, 97, 0, 0, 61, 97, 59, 97, ! 76, 256, 253, 271, 63, 0, 62, 97, 59, 97, ! 76, 0, 0, 71, 97, 256, 255, 271, 63, 0, ! 0, 257, 0, 45, 241, 45, 0, 258, 259, 260, ! 0, 260, 0, 69, 0, 70, 0, 68, 0, 0, ! 260, 261, 77, 0, 260, 77, 0, 132, 123, 262, ! 0, 186, 123, 262, 0, 1, 0, 0, 263, 0, ! 262, 81, 263, 0, 163, 0, 163, 38, 107, 0, ! 38, 107, 0, 0, 0, 0, 48, 265, 281, 266, ! 282, 267, 197, 0, 0, 0, 0, 49, 268, 281, ! 269, 282, 270, 197, 0, 0, 0, 272, 273, 0, ! 276, 0, 89, 0, 273, 276, 0, 0, 273, 274, ! 89, 0, 77, 0, 1, 0, 0, 0, 48, 277, ! 281, 278, 275, 0, 0, 0, 49, 279, 281, 280, ! 275, 0, 59, 184, 76, 290, 0, 290, 0, 59, ! 184, 76, 291, 288, 0, 291, 288, 0, 0, 77, ! 283, 0, 0, 284, 0, 285, 0, 192, 0, 284, ! 285, 0, 285, 192, 0, 126, 123, 286, 77, 0, ! 126, 77, 0, 130, 77, 0, 287, 0, 286, 81, ! 287, 0, 165, 143, 0, 166, 143, 0, 185, 143, ! 0, 0, 81, 10, 0, 0, 81, 289, 231, 0, ! 292, 0, 294, 0, 291, 294, 0, 3, 0, 4, ! 0, 72, 0, 293, 0, 12, 0, 13, 0, 14, ! 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, ! 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, ! 0, 25, 0, 26, 0, 27, 0, 11, 0, 28, ! 0, 29, 0, 6, 0, 7, 0, 292, 38, 59, ! 184, 76, 97, 0, 292, 38, 97, 0, 38, 59, ! 184, 76, 97, 0, 38, 97, 0, 292, 0, 296, ! 0, 298, 0, 296, 298, 0, 101, 0, 292, 38, ! 297, 0, 38, 297, 0, 99, 0, 67, 0, 0, ! 0, 60, 301, 299, 302, 295, 83, 0, 292, 0, ! 304, 0, 305, 0, 304, 305, 0, 292, 38, 0, ! 38, 0, 64, 59, 303, 76, 0, 71, 59, 97, ! 76, 0, 66, 59, 184, 76, 0 }; #endif --- 278,430 ---- 37, 112, 38, 107, 0, 107, 36, 107, 0, 107, 35, 107, 0, 3, 0, 8, 0, 115, 0, 59, 99, 76, 0, 59, 1, 76, 0, 0, 59, 114, ! 201, 76, 0, 113, 59, 100, 76, 0, 113, 60, 99, 83, 0, 113, 58, 97, 0, 113, 57, 97, ! 0, 113, 54, 0, 113, 55, 0, 302, 0, 308, ! 0, 309, 0, 310, 0, 116, 0, 9, 0, 115, 9, 0, 75, 0, 116, 75, 0, 0, 119, 0, ! 119, 10, 0, 206, 207, 120, 0, 118, 0, 194, ! 0, 119, 118, 0, 118, 194, 0, 128, 123, 136, 77, 0, 131, 123, 137, 77, 0, 128, 77, 0, ! 131, 77, 0, 206, 207, 125, 0, 121, 0, 194, ! 0, 122, 121, 0, 121, 194, 0, 0, 0, 126, 123, 136, 77, 0, 130, 123, 137, 77, 0, 126, ! 123, 159, 0, 130, 123, 162, 0, 126, 77, 0, ! 130, 77, 0, 241, 125, 0, 134, 127, 0, 130, 134, 127, 0, 0, 127, 135, 0, 127, 5, 0, 127, 144, 0, 134, 129, 0, 131, 134, 129, 0, 0, 129, 135, 0, 129, 5, 0, 131, 0, 144, 0, 130, 131, 0, 130, 144, 0, 7, 0, 5, 0, 131, 7, 0, 131, 5, 0, 134, 133, 0, ! 188, 134, 133, 0, 0, 133, 135, 0, 6, 0, ! 172, 0, 4, 0, 67, 258, 0, 72, 258, 0, ! 259, 0, 28, 59, 99, 76, 0, 28, 59, 186, ! 76, 0, 6, 0, 7, 0, 172, 0, 139, 0, 136, 81, 139, 0, 141, 0, 137, 81, 139, 0, ! 0, 27, 59, 115, 76, 0, 0, 165, 138, 143, ! 36, 140, 149, 0, 165, 138, 143, 0, 0, 168, ! 138, 143, 36, 142, 149, 0, 168, 138, 143, 0, 0, 144, 0, 145, 0, 144, 145, 0, 30, 59, 59, 146, 76, 76, 0, 147, 0, 146, 81, 147, 0, 0, 148, 0, 148, 59, 3, 76, 0, 148, 59, 3, 81, 101, 76, 0, 148, 59, 100, 76, 0, 97, 0, 5, 0, 6, 0, 7, 0, 107, 0, 0, 82, 150, 151, 78, 0, 1, 0, 0, ! 152, 177, 0, 153, 0, 152, 81, 153, 0, 157, ! 36, 155, 0, 158, 155, 0, 0, 97, 38, 154, ! 155, 0, 155, 0, 0, 82, 156, 151, 78, 0, ! 107, 0, 1, 0, 158, 0, 157, 158, 0, 58, ! 97, 0, 0, 0, 165, 160, 117, 161, 201, 0, ! 0, 0, 168, 163, 117, 164, 201, 0, 166, 0, ! 168, 0, 59, 166, 76, 0, 166, 59, 236, 0, ! 166, 60, 99, 83, 0, 166, 60, 83, 0, 50, ! 189, 166, 0, 144, 124, 166, 0, 4, 0, 72, ! 0, 167, 59, 236, 0, 167, 60, 99, 83, 0, ! 167, 60, 83, 0, 50, 189, 167, 0, 144, 124, ! 167, 0, 4, 0, 168, 59, 236, 0, 59, 168, ! 76, 0, 50, 189, 168, 0, 168, 60, 99, 83, ! 0, 168, 60, 83, 0, 144, 124, 168, 0, 3, 0, 13, 0, 13, 144, 0, 14, 0, 14, 144, ! 0, 12, 0, 12, 144, 0, 0, 169, 97, 82, ! 173, 179, 78, 143, 0, 169, 82, 179, 78, 143, ! 0, 169, 97, 0, 0, 170, 97, 82, 174, 179, ! 78, 143, 0, 170, 82, 179, 78, 143, 0, 170, ! 97, 0, 0, 171, 97, 82, 175, 184, 178, 78, ! 143, 0, 0, 171, 82, 176, 184, 178, 78, 143, ! 0, 171, 97, 0, 0, 81, 0, 0, 81, 0, ! 180, 0, 180, 181, 0, 0, 180, 181, 77, 0, ! 180, 77, 0, 65, 59, 67, 76, 0, 132, 123, ! 182, 0, 132, 0, 188, 123, 182, 0, 188, 0, ! 1, 0, 241, 181, 0, 183, 0, 182, 81, 183, ! 0, 206, 207, 165, 143, 0, 206, 207, 165, 38, ! 107, 143, 0, 206, 207, 38, 107, 143, 0, 185, ! 0, 184, 81, 185, 0, 1, 0, 97, 0, 97, ! 36, 107, 0, 132, 187, 0, 188, 187, 0, 0, ! 190, 0, 7, 0, 188, 7, 0, 0, 189, 7, ! 0, 59, 190, 76, 0, 50, 189, 190, 0, 50, ! 189, 0, 190, 59, 229, 0, 190, 60, 99, 83, ! 0, 190, 60, 83, 0, 59, 229, 0, 60, 99, ! 83, 0, 60, 83, 0, 144, 124, 190, 0, 192, ! 0, 209, 0, 192, 209, 0, 192, 194, 0, 0, ! 191, 0, 1, 77, 0, 0, 0, 197, 0, 198, ! 0, 197, 198, 0, 32, 240, 77, 0, 201, 0, ! 1, 201, 0, 82, 0, 200, 78, 0, 200, 195, ! 196, 122, 193, 78, 0, 200, 195, 196, 1, 78, ! 0, 200, 195, 196, 191, 78, 0, 203, 208, 0, ! 203, 1, 0, 15, 59, 99, 76, 0, 0, 18, ! 205, 208, 17, 0, 0, 0, 206, 207, 211, 0, ! 206, 207, 222, 208, 0, 206, 207, 210, 0, 211, ! 0, 222, 0, 201, 0, 219, 0, 99, 77, 0, ! 0, 202, 16, 212, 208, 0, 202, 0, 202, 16, ! 1, 0, 0, 0, 17, 213, 59, 99, 76, 214, ! 208, 0, 204, 59, 99, 76, 77, 0, 204, 1, ! 0, 0, 0, 0, 19, 59, 224, 77, 215, 224, ! 77, 216, 224, 76, 217, 208, 0, 0, 20, 59, ! 99, 76, 218, 208, 0, 23, 77, 0, 24, 77, ! 0, 25, 77, 0, 25, 99, 77, 0, 27, 223, ! 59, 99, 76, 77, 0, 27, 223, 59, 99, 38, ! 225, 76, 77, 0, 27, 223, 59, 99, 38, 225, ! 38, 225, 76, 77, 0, 27, 223, 59, 99, 38, ! 225, 38, 225, 38, 228, 76, 77, 0, 26, 97, ! 77, 0, 26, 50, 99, 77, 0, 77, 0, 220, ! 0, 0, 19, 59, 113, 76, 221, 208, 0, 21, ! 107, 38, 0, 21, 107, 10, 107, 38, 0, 22, ! 38, 0, 97, 38, 143, 0, 0, 7, 0, 0, ! 99, 0, 0, 226, 0, 227, 0, 226, 81, 227, ! 0, 9, 59, 99, 76, 0, 115, 0, 228, 81, ! 115, 0, 0, 230, 231, 0, 233, 76, 0, 0, ! 234, 77, 232, 231, 0, 1, 76, 0, 0, 10, ! 0, 234, 0, 234, 81, 10, 0, 235, 0, 234, ! 81, 235, 0, 126, 123, 167, 143, 0, 126, 123, ! 168, 143, 0, 126, 123, 187, 143, 0, 130, 123, ! 168, 143, 0, 130, 123, 187, 143, 0, 0, 237, ! 238, 0, 231, 0, 239, 76, 0, 3, 0, 239, ! 81, 3, 0, 97, 0, 240, 81, 97, 0, 31, ! 0, 246, 0, 244, 0, 245, 0, 256, 0, 266, ! 0, 63, 0, 97, 0, 243, 81, 97, 0, 73, ! 243, 77, 0, 74, 97, 97, 77, 0, 0, 0, ! 61, 97, 258, 82, 247, 260, 78, 248, 273, 63, ! 0, 0, 61, 97, 258, 249, 273, 63, 0, 0, ! 0, 61, 97, 38, 97, 258, 82, 250, 260, 78, ! 251, 273, 63, 0, 0, 61, 97, 38, 97, 258, ! 252, 273, 63, 0, 0, 62, 97, 82, 253, 260, ! 78, 0, 62, 97, 0, 0, 62, 97, 38, 97, ! 82, 254, 260, 78, 0, 62, 97, 38, 97, 0, ! 0, 61, 97, 59, 97, 76, 258, 255, 273, 63, ! 0, 62, 97, 59, 97, 76, 0, 0, 71, 97, ! 258, 257, 273, 63, 0, 0, 259, 0, 45, 243, ! 45, 0, 260, 261, 262, 0, 262, 0, 69, 0, ! 70, 0, 68, 0, 0, 262, 263, 77, 0, 262, ! 77, 0, 132, 123, 264, 0, 188, 123, 264, 0, ! 1, 0, 0, 265, 0, 264, 81, 265, 0, 165, ! 0, 165, 38, 107, 0, 38, 107, 0, 0, 0, ! 0, 48, 267, 283, 268, 284, 269, 199, 0, 0, ! 0, 0, 49, 270, 283, 271, 284, 272, 199, 0, ! 0, 0, 274, 275, 0, 278, 0, 89, 0, 275, ! 278, 0, 0, 275, 276, 89, 0, 77, 0, 1, ! 0, 0, 0, 48, 279, 283, 280, 277, 0, 0, ! 0, 49, 281, 283, 282, 277, 0, 59, 186, 76, ! 292, 0, 292, 0, 59, 186, 76, 293, 290, 0, ! 293, 290, 0, 0, 77, 285, 0, 0, 286, 0, ! 287, 0, 194, 0, 286, 287, 0, 287, 194, 0, ! 126, 123, 288, 77, 0, 126, 77, 0, 130, 77, ! 0, 289, 0, 288, 81, 289, 0, 167, 143, 0, ! 168, 143, 0, 187, 143, 0, 0, 81, 10, 0, ! 0, 81, 291, 233, 0, 294, 0, 296, 0, 293, ! 296, 0, 3, 0, 4, 0, 72, 0, 295, 0, ! 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, ! 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, ! 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, ! 27, 0, 11, 0, 28, 0, 29, 0, 6, 0, ! 7, 0, 294, 38, 59, 186, 76, 97, 0, 294, ! 38, 97, 0, 38, 59, 186, 76, 97, 0, 38, ! 97, 0, 294, 0, 298, 0, 300, 0, 298, 300, ! 0, 101, 0, 294, 38, 299, 0, 38, 299, 0, ! 99, 0, 67, 0, 0, 0, 60, 303, 301, 304, ! 297, 83, 0, 294, 0, 306, 0, 307, 0, 306, ! 307, 0, 294, 38, 0, 38, 0, 64, 59, 305, ! 76, 0, 71, 59, 97, 76, 0, 66, 59, 186, ! 76, 0 }; #endif *************** static const short yyrline[] = { 0, *** 437,491 **** 410, 414, 442, 448, 451, 454, 457, 459, 463, 467, 471, 473, 476, 480, 507, 509, 511, 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, 533, 537, 539, ! 543, 545, 548, 552, 554, 561, 564, 567, 573, 733, ! 734, 736, 742, 744, 758, 781, 783, 785, 797, 811, ! 813, 815, 817, 819, 821, 823, 828, 830, 836, 838, ! 842, 844, 845, 855, 860, 862, 863, 864, 871, 877, ! 882, 885, 893, 898, 900, 901, 902, 909, 920, 924, ! 930, 935, 940, 945, 947, 949, 958, 961, 965, 967, ! 969, 974, 978, 981, 985, 988, 990, 1002, 1005, 1007, ! 1009, 1013, 1017, 1019, 1022, 1035, 1038, 1042, 1044, 1052, ! 1053, 1054, 1058, 1060, 1065, 1067, 1069, 1075, 1076, 1077, ! 1080, 1082, 1085, 1087, 1090, 1093, 1099, 1106, 1108, 1115, ! 1122, 1125, 1132, 1135, 1139, 1142, 1146, 1151, 1154, 1158, ! 1161, 1163, 1165, 1167, 1174, 1176, 1177, 1178, 1183, 1185, ! 1190, 1198, 1203, 1207, 1210, 1212, 1217, 1220, 1222, 1224, ! 1228, 1231, 1231, 1234, 1236, 1247, 1255, 1259, 1270, 1278, ! 1285, 1287, 1292, 1295, 1300, 1302, 1304, 1311, 1313, 1314, ! 1322, 1328, 1330, 1332, 1339, 1341, 1347, 1353, 1355, 1357, ! 1359, 1366, 1368, 1371, 1374, 1378, 1381, 1385, 1388, 1392, ! 1397, 1399, 1403, 1405, 1407, 1409, 1413, 1415, 1418, 1421, ! 1424, 1427, 1431, 1433, 1436, 1438, 1442, 1445, 1450, 1452, ! 1454, 1458, 1482, 1489, 1494, 1500, 1505, 1507, 1512, 1514, ! 1518, 1522, 1526, 1536, 1538, 1543, 1548, 1551, 1555, 1558, ! 1562, 1565, 1568, 1571, 1575, 1578, 1582, 1586, 1588, 1590, ! 1592, 1594, 1596, 1598, 1600, 1610, 1618, 1620, 1622, 1626, ! 1628, 1631, 1634, 1647, 1649, 1654, 1656, 1659, 1673, 1676, ! 1679, 1681, 1683, 1691, 1699, 1710, 1715, 1718, 1732, 1741, ! 1745, 1749, 1753, 1759, 1763, 1768, 1771, 1776, 1779, 1780, ! 1797, 1802, 1805, 1817, 1819, 1829, 1839, 1840, 1848, 1851, ! 1863, 1867, 1884, 1894, 1903, 1908, 1913, 1918, 1922, 1926, ! 1937, 1944, 1951, 1958, 1969, 1975, 1978, 1983, 2006, 2040, ! 2071, 2102, 2117, 2128, 2132, 2136, 2139, 2144, 2146, 2149, ! 2151, 2155, 2160, 2163, 2169, 2174, 2179, 2181, 2190, 2191, ! 2197, 2199, 2209, 2211, 2215, 2218, 2224, 2234, 2243, 2252, ! 2262, 2276, 2281, 2286, 2288, 2297, 2300, 2305, 2308, 2312, ! 2320, 2322, 2323, 2324, 2325, 2326, 2340, 2343, 2347, 2353, ! 2359, 2366, 2371, 2377, 2384, 2390, 2396, 2401, 2407, 2414, ! 2420, 2426, 2432, 2440, 2446, 2452, 2460, 2467, 2473, 2482, ! 2489, 2497, 2502, 2505, 2515, 2517, 2520, 2522, 2523, 2526, ! 2531, 2532, 2549, 2556, 2562, 2566, 2569, 2570, 2573, 2581, ! 2587, 2596, 2606, 2613, 2617, 2622, 2631, 2638, 2642, 2652, ! 2654, 2655, 2657, 2659, 2660, 2661, 2662, 2664, 2666, 2669, ! 2677, 2684, 2684, 2691, 2697, 2699, 2705, 2710, 2715, 2724, ! 2726, 2732, 2734, 2737, 2739, 2740, 2741, 2744, 2750, 2752, ! 2756, 2759, 2766, 2772, 2777, 2784, 2789, 2794, 2799, 2806, ! 2810, 2813, 2819, 2821, 2822, 2823, 2826, 2828, 2829, 2830, ! 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, ! 2841, 2842, 2843, 2844, 2845, 2846, 2846, 2849, 2855, 2860, ! 2865, 2871, 2873, 2876, 2878, 2885, 2897, 2902, 2908, 2910, ! 2916, 2920, 2921, 2927, 2929, 2932, 2934, 2940, 2945, 2951, ! 2958, 2967 }; #endif --- 439,493 ---- 410, 414, 442, 448, 451, 454, 457, 459, 463, 467, 471, 473, 476, 480, 507, 509, 511, 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, 533, 537, 539, ! 543, 545, 548, 552, 554, 561, 564, 572, 583, 743, ! 744, 746, 752, 754, 768, 791, 793, 795, 807, 821, ! 823, 825, 827, 829, 831, 833, 838, 840, 846, 848, ! 852, 854, 855, 865, 870, 872, 873, 874, 881, 887, ! 892, 895, 903, 908, 910, 911, 912, 919, 930, 934, ! 940, 945, 950, 955, 957, 959, 968, 971, 975, 977, ! 979, 984, 988, 991, 995, 998, 1000, 1012, 1015, 1017, ! 1019, 1023, 1027, 1029, 1032, 1045, 1048, 1052, 1054, 1062, ! 1063, 1064, 1068, 1070, 1075, 1077, 1079, 1085, 1086, 1087, ! 1090, 1092, 1095, 1097, 1100, 1103, 1109, 1116, 1118, 1125, ! 1132, 1135, 1142, 1145, 1149, 1152, 1156, 1161, 1164, 1168, ! 1171, 1173, 1175, 1177, 1184, 1186, 1187, 1188, 1193, 1195, ! 1200, 1208, 1213, 1217, 1220, 1222, 1227, 1229, 1230, 1233, ! 1233, 1236, 1239, 1241, 1243, 1246, 1248, 1251, 1259, 1270, ! 1278, 1282, 1293, 1301, 1308, 1310, 1315, 1318, 1323, 1325, ! 1327, 1334, 1336, 1337, 1345, 1351, 1353, 1355, 1362, 1364, ! 1370, 1376, 1378, 1380, 1382, 1389, 1391, 1394, 1397, 1401, ! 1404, 1408, 1411, 1415, 1420, 1422, 1426, 1428, 1430, 1432, ! 1436, 1438, 1441, 1444, 1447, 1450, 1454, 1456, 1459, 1461, ! 1466, 1469, 1474, 1476, 1478, 1482, 1506, 1513, 1518, 1524, ! 1529, 1531, 1536, 1538, 1542, 1546, 1550, 1560, 1562, 1567, ! 1572, 1575, 1579, 1582, 1586, 1589, 1592, 1595, 1599, 1602, ! 1606, 1610, 1612, 1614, 1616, 1618, 1620, 1622, 1624, 1628, ! 1636, 1644, 1646, 1648, 1652, 1654, 1657, 1660, 1673, 1675, ! 1680, 1682, 1685, 1699, 1702, 1705, 1707, 1709, 1717, 1725, ! 1736, 1741, 1744, 1758, 1767, 1771, 1775, 1779, 1785, 1789, ! 1794, 1797, 1802, 1805, 1806, 1823, 1828, 1831, 1843, 1845, ! 1855, 1865, 1866, 1874, 1877, 1889, 1893, 1910, 1920, 1929, ! 1934, 1939, 1944, 1948, 1952, 1963, 1970, 1977, 1984, 1995, ! 2001, 2004, 2009, 2032, 2066, 2097, 2128, 2143, 2157, 2161, ! 2165, 2168, 2173, 2175, 2178, 2180, 2184, 2189, 2192, 2198, ! 2203, 2208, 2210, 2219, 2220, 2226, 2228, 2238, 2240, 2244, ! 2247, 2253, 2263, 2272, 2281, 2291, 2305, 2310, 2315, 2317, ! 2326, 2329, 2334, 2337, 2341, 2349, 2351, 2352, 2353, 2354, ! 2355, 2369, 2372, 2376, 2382, 2388, 2395, 2400, 2406, 2413, ! 2419, 2425, 2430, 2436, 2443, 2449, 2455, 2461, 2469, 2475, ! 2481, 2489, 2496, 2502, 2511, 2518, 2526, 2531, 2534, 2544, ! 2546, 2549, 2551, 2552, 2555, 2560, 2561, 2578, 2585, 2591, ! 2595, 2598, 2599, 2602, 2610, 2616, 2625, 2635, 2642, 2646, ! 2651, 2660, 2667, 2671, 2681, 2683, 2684, 2686, 2688, 2689, ! 2690, 2691, 2693, 2695, 2698, 2706, 2713, 2713, 2720, 2726, ! 2728, 2734, 2739, 2744, 2753, 2755, 2761, 2763, 2766, 2768, ! 2769, 2770, 2773, 2779, 2781, 2785, 2788, 2795, 2801, 2806, ! 2813, 2818, 2823, 2828, 2835, 2839, 2842, 2848, 2850, 2851, ! 2852, 2855, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, ! 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, ! 2875, 2875, 2878, 2884, 2889, 2894, 2900, 2902, 2905, 2907, ! 2914, 2926, 2931, 2937, 2939, 2945, 2949, 2950, 2956, 2958, ! 2961, 2963, 2969, 2974, 2980, 2987, 2996 }; #endif *************** static const char * const yytname[] = { *** 512,539 **** "typespec","typespecqual_reserved","initdecls","notype_initdecls","maybeasm", "initdcl","@16","notype_initdcl","@17","maybe_attribute","attributes","attribute", "attribute_list","attrib","any_word","init","@18","initlist_maybe_comma","initlist1", ! "initelt","@19","@20","@21","nested_function","@22","@23","notype_nested_function", ! "@24","@25","declarator","after_type_declarator","parm_declarator","notype_declarator", ! "struct_head","union_head","enum_head","structsp","@26","@27","@28","@29","maybecomma", ! "maybecomma_warn","component_decl_list","component_decl_list2","component_decl", ! "components","component_declarator","enumlist","enumerator","typename","absdcl", ! "nonempty_type_quals","type_quals","absdcl1","stmts","lineno_stmt_or_labels", ! "xstmts","errstmt","pushlevel","maybe_label_decls","label_decls","label_decl", ! "compstmt_or_error","compstmt_start","compstmt","simple_if","if_prefix","do_stmt_start", ! "@30","save_filename","save_lineno","lineno_labeled_stmt","lineno_stmt_or_label", ! "stmt_or_label","stmt","@31","@32","@33","@34","@35","@36","@37","all_iter_stmt", ! "all_iter_stmt_simple","@38","label","maybe_type_qual","xexpr","asm_operands", ! "nonnull_asm_operands","asm_operand","asm_clobbers","parmlist","@39","parmlist_1", ! "@40","parmlist_2","parms","parm","parmlist_or_identifiers","@41","parmlist_or_identifiers_1", ! "identifiers","identifiers_or_typenames","extension","objcdef","identifier_list", ! "classdecl","aliasdecl","classdef","@42","@43","@44","@45","@46","@47","@48", ! "@49","@50","protocoldef","@51","protocolrefs","non_empty_protocolrefs","ivar_decl_list", ! "visibility_spec","ivar_decls","ivar_decl","ivars","ivar_declarator","methoddef", ! "@52","@53","@54","@55","@56","@57","methodprotolist","@58","methodprotolist2", ! "@59","semi_or_error","methodproto","@60","@61","@62","@63","methoddecl","optarglist", ! "myxdecls","mydecls","mydecl","myparms","myparm","optparmlist","@64","unaryselector", "keywordselector","selector","reservedwords","keyworddecl","messageargs","keywordarglist", ! "keywordexpr","keywordarg","receiver","objcmessageexpr","@65","@66","selectorarg", "keywordnamelist","keywordname","objcselectorexpr","objcprotocolexpr","objcencodeexpr", NULL }; #endif --- 514,541 ---- "typespec","typespecqual_reserved","initdecls","notype_initdecls","maybeasm", "initdcl","@16","notype_initdcl","@17","maybe_attribute","attributes","attribute", "attribute_list","attrib","any_word","init","@18","initlist_maybe_comma","initlist1", ! "initelt","@19","initval","@20","designator_list","designator","nested_function", ! "@21","@22","notype_nested_function","@23","@24","declarator","after_type_declarator", ! "parm_declarator","notype_declarator","struct_head","union_head","enum_head", ! "structsp","@25","@26","@27","@28","maybecomma","maybecomma_warn","component_decl_list", ! "component_decl_list2","component_decl","components","component_declarator", ! "enumlist","enumerator","typename","absdcl","nonempty_type_quals","type_quals", ! "absdcl1","stmts","lineno_stmt_or_labels","xstmts","errstmt","pushlevel","maybe_label_decls", ! "label_decls","label_decl","compstmt_or_error","compstmt_start","compstmt","simple_if", ! "if_prefix","do_stmt_start","@29","save_filename","save_lineno","lineno_labeled_stmt", ! "lineno_stmt_or_label","stmt_or_label","stmt","@30","@31","@32","@33","@34", ! "@35","@36","all_iter_stmt","all_iter_stmt_simple","@37","label","maybe_type_qual", ! "xexpr","asm_operands","nonnull_asm_operands","asm_operand","asm_clobbers","parmlist", ! "@38","parmlist_1","@39","parmlist_2","parms","parm","parmlist_or_identifiers", ! "@40","parmlist_or_identifiers_1","identifiers","identifiers_or_typenames","extension", ! "objcdef","identifier_list","classdecl","aliasdecl","classdef","@41","@42","@43", ! "@44","@45","@46","@47","@48","@49","protocoldef","@50","protocolrefs","non_empty_protocolrefs", ! "ivar_decl_list","visibility_spec","ivar_decls","ivar_decl","ivars","ivar_declarator", ! "methoddef","@51","@52","@53","@54","@55","@56","methodprotolist","@57","methodprotolist2", ! "@58","semi_or_error","methodproto","@59","@60","@61","@62","methoddecl","optarglist", ! "myxdecls","mydecls","mydecl","myparms","myparm","optparmlist","@63","unaryselector", "keywordselector","selector","reservedwords","keyworddecl","messageargs","keywordarglist", ! "keywordexpr","keywordarg","receiver","objcmessageexpr","@64","@65","selectorarg", "keywordnamelist","keywordname","objcselectorexpr","objcprotocolexpr","objcencodeexpr", NULL }; #endif *************** static const short yyr1[] = { 0, *** 559,601 **** 136, 136, 137, 137, 138, 138, 140, 139, 139, 142, 141, 141, 143, 143, 144, 144, 145, 146, 146, 147, 147, 147, 147, 147, 148, 148, 148, 148, 149, 150, ! 149, 149, 151, 151, 152, 152, 153, 154, 153, 153, ! 155, 153, 156, 153, 158, 159, 157, 161, 162, 160, ! 163, 163, 164, 164, 164, 164, 164, 164, 164, 164, ! 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, ! 166, 166, 166, 167, 167, 168, 168, 169, 169, 171, ! 170, 170, 170, 172, 170, 170, 170, 173, 170, 174, ! 170, 170, 175, 175, 176, 176, 177, 177, 178, 178, ! 178, 178, 179, 179, 179, 179, 179, 179, 180, 180, ! 181, 181, 181, 182, 182, 182, 183, 183, 184, 184, ! 185, 185, 186, 186, 187, 187, 188, 188, 188, 188, ! 188, 188, 188, 188, 188, 189, 190, 190, 190, 191, ! 191, 192, 193, 194, 194, 195, 195, 196, 197, 197, ! 198, 199, 199, 199, 199, 200, 200, 201, 203, 202, ! 204, 205, 206, 206, 207, 208, 208, 209, 209, 209, ! 210, 209, 209, 209, 211, 212, 209, 209, 209, 213, ! 214, 215, 209, 216, 209, 209, 209, 209, 209, 209, ! 209, 209, 209, 209, 209, 209, 217, 219, 218, 220, ! 220, 220, 220, 221, 221, 222, 222, 223, 223, 224, ! 224, 225, 226, 226, 228, 227, 229, 230, 229, 229, ! 231, 231, 231, 231, 232, 232, 233, 233, 233, 233, ! 233, 235, 234, 236, 236, 237, 237, 238, 238, 239, ! 240, 240, 240, 240, 240, 240, 241, 241, 242, 243, ! 245, 246, 244, 247, 244, 248, 249, 244, 250, 244, ! 251, 244, 244, 252, 244, 244, 253, 244, 244, 255, ! 254, 256, 256, 257, 258, 258, 259, 259, 259, 260, ! 260, 260, 261, 261, 261, 262, 262, 262, 263, 263, ! 263, 265, 266, 267, 264, 268, 269, 270, 264, 271, ! 272, 271, 273, 273, 273, 274, 273, 275, 275, 277, ! 278, 276, 279, 280, 276, 281, 281, 281, 281, 282, ! 282, 283, 283, 284, 284, 284, 284, 285, 285, 285, ! 286, 286, 287, 287, 287, 288, 288, 289, 288, 290, ! 291, 291, 292, 292, 292, 292, 293, 293, 293, 293, ! 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, ! 293, 293, 293, 293, 293, 293, 293, 294, 294, 294, ! 294, 295, 295, 296, 296, 297, 298, 298, 299, 299, ! 301, 302, 300, 303, 303, 304, 304, 305, 305, 306, ! 307, 308 }; static const short yyr2[] = { 0, --- 561,603 ---- 136, 136, 137, 137, 138, 138, 140, 139, 139, 142, 141, 141, 143, 143, 144, 144, 145, 146, 146, 147, 147, 147, 147, 147, 148, 148, 148, 148, 149, 150, ! 149, 149, 151, 151, 152, 152, 153, 153, 154, 153, ! 153, 156, 155, 155, 155, 157, 157, 158, 160, 161, ! 159, 163, 164, 162, 165, 165, 166, 166, 166, 166, ! 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, ! 168, 168, 168, 168, 168, 168, 168, 169, 169, 170, ! 170, 171, 171, 173, 172, 172, 172, 174, 172, 172, ! 172, 175, 172, 176, 172, 172, 177, 177, 178, 178, ! 179, 179, 180, 180, 180, 180, 181, 181, 181, 181, ! 181, 181, 182, 182, 183, 183, 183, 184, 184, 184, ! 185, 185, 186, 186, 187, 187, 188, 188, 189, 189, ! 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, ! 191, 192, 192, 192, 193, 193, 194, 195, 196, 196, ! 197, 197, 198, 199, 199, 200, 201, 201, 201, 201, ! 202, 202, 203, 205, 204, 206, 207, 208, 208, 209, ! 210, 210, 211, 211, 211, 212, 211, 211, 211, 213, ! 214, 211, 211, 211, 215, 216, 217, 211, 218, 211, ! 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, ! 211, 219, 221, 220, 222, 222, 222, 222, 223, 223, ! 224, 224, 225, 225, 226, 226, 227, 228, 228, 230, ! 229, 231, 232, 231, 231, 233, 233, 233, 233, 234, ! 234, 235, 235, 235, 235, 235, 237, 236, 238, 238, ! 239, 239, 240, 240, 241, 242, 242, 242, 242, 242, ! 242, 243, 243, 244, 245, 247, 248, 246, 249, 246, ! 250, 251, 246, 252, 246, 253, 246, 246, 254, 246, ! 246, 255, 246, 246, 257, 256, 258, 258, 259, 260, ! 260, 261, 261, 261, 262, 262, 262, 263, 263, 263, ! 264, 264, 264, 265, 265, 265, 267, 268, 269, 266, ! 270, 271, 272, 266, 273, 274, 273, 275, 275, 275, ! 276, 275, 277, 277, 279, 280, 278, 281, 282, 278, ! 283, 283, 283, 283, 284, 284, 285, 285, 286, 286, ! 286, 286, 287, 287, 287, 288, 288, 289, 289, 289, ! 290, 290, 291, 290, 292, 293, 293, 294, 294, 294, ! 294, 295, 295, 295, 295, 295, 295, 295, 295, 295, ! 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, ! 295, 295, 296, 296, 296, 296, 297, 297, 298, 298, ! 299, 300, 300, 301, 301, 303, 304, 302, 305, 305, ! 306, 306, 307, 307, 308, 309, 310 }; static const short yyr2[] = { 0, *************** static const short yyr2[] = { 0, *** 619,1429 **** 1, 3, 1, 3, 0, 4, 0, 6, 3, 0, 6, 3, 0, 1, 1, 2, 6, 1, 3, 0, 1, 4, 6, 4, 1, 1, 1, 1, 1, 0, ! 4, 1, 0, 2, 1, 3, 1, 0, 4, 1, ! 0, 4, 0, 5, 0, 0, 5, 0, 0, 5, ! 1, 1, 3, 3, 4, 3, 3, 3, 1, 1, ! 3, 4, 3, 3, 3, 1, 3, 3, 3, 4, ! 3, 3, 1, 1, 2, 1, 2, 1, 2, 0, ! 7, 5, 2, 0, 7, 5, 2, 0, 8, 0, ! 7, 2, 0, 1, 0, 1, 1, 2, 0, 3, ! 2, 4, 3, 1, 3, 1, 1, 2, 1, 3, ! 4, 6, 5, 1, 3, 1, 1, 3, 2, 2, ! 0, 1, 1, 2, 0, 2, 3, 3, 2, 3, ! 4, 3, 2, 3, 2, 1, 1, 2, 2, 0, ! 1, 2, 0, 0, 1, 1, 2, 3, 1, 2, ! 1, 2, 6, 5, 5, 2, 2, 4, 0, 4, ! 0, 0, 3, 4, 3, 1, 1, 1, 1, 2, ! 0, 4, 1, 3, 0, 0, 7, 5, 2, 0, ! 0, 0, 12, 0, 6, 2, 2, 2, 3, 6, ! 8, 10, 12, 3, 4, 1, 1, 0, 6, 3, ! 5, 2, 2, 0, 1, 0, 1, 0, 1, 1, ! 3, 4, 1, 3, 0, 2, 2, 0, 4, 2, ! 0, 1, 1, 3, 1, 3, 4, 4, 4, 4, ! 4, 0, 2, 1, 2, 1, 3, 1, 3, 1, ! 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, ! 0, 0, 10, 0, 6, 0, 0, 12, 0, 8, ! 0, 6, 2, 0, 8, 4, 0, 9, 5, 0, ! 6, 0, 1, 3, 3, 1, 1, 1, 1, 0, ! 3, 2, 3, 3, 1, 0, 1, 3, 1, 3, ! 2, 0, 0, 0, 7, 0, 0, 0, 7, 0, ! 0, 2, 1, 1, 2, 0, 3, 1, 1, 0, ! 0, 5, 0, 0, 5, 4, 1, 5, 2, 0, ! 2, 0, 1, 1, 1, 2, 2, 4, 2, 2, ! 1, 3, 2, 2, 2, 0, 2, 0, 3, 1, ! 1, 2, 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, 6, 3, 5, ! 2, 1, 1, 1, 2, 1, 3, 2, 1, 1, ! 0, 0, 6, 1, 1, 1, 2, 2, 1, 4, ! 4, 4 }; static const short yydefact[] = { 3, ! 5, 0, 0, 0, 162, 153, 160, 152, 248, 244, ! 246, 0, 0, 0, 410, 0, 462, 466, 0, 0, ! 416, 442, 0, 442, 0, 0, 19, 4, 8, 7, 0, 128, 128, 148, 139, 149, 185, 0, 0, 0, ! 161, 0, 9, 412, 413, 411, 414, 165, 415, 6, ! 17, 18, 249, 245, 247, 0, 0, 0, 32, 33, ! 35, 34, 417, 0, 0, 0, 442, 433, 163, 443, ! 442, 164, 0, 0, 243, 295, 0, 0, 173, 129, 0, 16, 0, 15, 0, 150, 139, 151, 155, 154, ! 137, 186, 269, 253, 269, 257, 260, 262, 11, 89, 90, 107, 59, 60, 0, 0, 0, 36, 38, 37, ! 0, 39, 40, 0, 551, 0, 0, 0, 109, 41, 42, 0, 0, 43, 61, 0, 0, 65, 46, 48, ! 91, 106, 0, 102, 103, 104, 105, 293, 0, 291, ! 158, 0, 291, 190, 444, 0, 513, 514, 536, 537, ! 533, 517, 518, 519, 520, 521, 522, 523, 524, 525, ! 526, 527, 528, 529, 530, 531, 532, 534, 535, 0, ! 0, 515, 463, 487, 506, 510, 516, 511, 467, 0, ! 0, 424, 0, 0, 431, 440, 419, 0, 0, 0, ! 12, 0, 0, 31, 0, 402, 0, 0, 183, 229, ! 295, 0, 230, 0, 171, 129, 0, 221, 222, 0, 0, 138, 141, 168, 169, 140, 142, 170, 0, 0, ! 0, 250, 0, 254, 0, 258, 57, 58, 52, 49, 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 53, 0, 55, 0, 0, 82, 80, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 0, 0, 44, 0, 108, 110, ! 50, 166, 295, 385, 0, 289, 292, 156, 167, 294, ! 158, 290, 196, 197, 198, 195, 0, 188, 191, 418, ! 0, 541, 0, 490, 508, 489, 0, 512, 0, 490, ! 442, 0, 421, 471, 436, 0, 450, 471, 420, 296, ! 239, 238, 174, 175, 242, 0, 237, 0, 241, 0, ! 0, 29, 0, 331, 116, 332, 182, 184, 0, 0, ! 14, 0, 0, 23, 0, 183, 402, 0, 13, 27, ! 0, 0, 183, 277, 271, 128, 268, 128, 0, 269, ! 183, 269, 286, 287, 265, 284, 0, 93, 92, 321, ! 313, 0, 0, 550, 549, 552, 559, 554, 0, 555, ! 556, 0, 0, 10, 47, 0, 0, 88, 87, 0, ! 0, 0, 0, 76, 77, 75, 74, 73, 71, 72, ! 66, 67, 68, 69, 70, 99, 98, 0, 45, 0, ! 299, 0, 303, 0, 305, 0, 385, 0, 159, 157, ! 0, 190, 44, 0, 0, 0, 464, 507, 391, 0, ! 539, 468, 429, 442, 450, 0, 0, 434, 439, 0, ! 0, 0, 0, 0, 406, 392, 128, 128, 404, 0, ! 393, 395, 403, 0, 240, 312, 0, 118, 113, 117, ! 0, 180, 227, 223, 172, 228, 21, 179, 224, 226, ! 0, 25, 0, 252, 331, 270, 331, 278, 0, 256, ! 0, 0, 266, 0, 265, 322, 314, 95, 63, 62, ! 0, 558, 560, 0, 557, 562, 561, 54, 56, 0, ! 0, 81, 79, 96, 97, 298, 297, 386, 304, 300, ! 302, 0, 187, 189, 89, 0, 0, 486, 506, 128, ! 0, 495, 491, 493, 0, 0, 509, 393, 0, 0, ! 426, 471, 437, 0, 425, 480, 483, 474, 0, 128, ! 128, 476, 473, 450, 449, 447, 448, 432, 450, 455, ! 452, 128, 128, 0, 441, 176, 390, 291, 291, 387, ! 388, 0, 405, 0, 0, 30, 319, 114, 128, 128, ! 145, 0, 0, 177, 225, 0, 272, 273, 279, 332, ! 275, 183, 183, 288, 285, 183, 0, 0, 0, 315, ! 316, 0, 0, 542, 0, 543, 544, 83, 86, 301, ! 192, 0, 194, 540, 488, 499, 291, 500, 496, 497, ! 465, 0, 469, 450, 0, 471, 422, 0, 0, 175, ! 0, 0, 0, 475, 0, 0, 456, 456, 451, 236, ! 295, 385, 129, 183, 183, 183, 295, 183, 183, 0, ! 394, 396, 407, 320, 121, 0, 122, 0, 145, 143, ! 202, 200, 199, 181, 22, 0, 26, 331, 0, 251, ! 255, 261, 183, 408, 0, 0, 0, 331, 0, 0, ! 125, 332, 307, 317, 210, 89, 0, 208, 0, 207, ! 0, 263, 205, 546, 548, 0, 553, 0, 545, 0, ! 0, 183, 183, 183, 0, 501, 538, 0, 430, 0, ! 471, 481, 484, 477, 435, 0, 459, 453, 457, 454, ! 299, 0, 402, 0, 397, 398, 399, 299, 400, 401, ! 389, 0, 0, 144, 147, 146, 0, 178, 280, 0, ! 183, 259, 318, 0, 324, 127, 126, 311, 0, 325, ! 309, 332, 308, 0, 0, 0, 211, 64, 0, 204, ! 547, 84, 193, 503, 504, 505, 498, 291, 427, 438, ! 0, 0, 0, 461, 0, 0, 234, 295, 235, 231, ! 233, 0, 119, 120, 0, 183, 0, 281, 409, 323, ! 0, 162, 0, 345, 329, 0, 0, 0, 0, 0, ! 0, 0, 0, 374, 442, 442, 366, 0, 0, 123, ! 128, 128, 338, 343, 0, 0, 335, 336, 339, 367, ! 337, 0, 213, 0, 0, 206, 502, 471, 423, 479, ! 478, 482, 485, 460, 458, 0, 232, 201, 283, 183, ! 0, 0, 331, 376, 0, 0, 372, 356, 357, 358, ! 0, 0, 0, 375, 0, 373, 340, 134, 0, 135, ! 0, 0, 327, 332, 326, 349, 0, 136, 0, 209, ! 212, 0, 282, 0, 0, 0, 377, 48, 0, 0, ! 0, 370, 359, 0, 364, 0, 0, 132, 215, 0, ! 133, 218, 344, 331, 0, 0, 214, 428, 328, 0, ! 330, 368, 350, 354, 0, 365, 0, 130, 0, 131, ! 0, 342, 333, 331, 0, 346, 331, 376, 331, 371, ! 378, 0, 216, 219, 334, 348, 331, 369, 0, 355, ! 0, 0, 379, 380, 360, 0, 0, 347, 351, 0, ! 378, 0, 0, 217, 220, 376, 0, 0, 361, 381, ! 0, 382, 0, 0, 352, 383, 0, 362, 331, 0, ! 0, 353, 363, 384, 0, 0, 0 }; ! static const short yydefgoto[] = { 945, ! 1, 2, 3, 28, 29, 30, 335, 563, 341, 566, ! 198, 447, 669, 122, 232, 398, 124, 125, 126, 127, ! 128, 582, 129, 383, 382, 380, 680, 381, 130, 233, ! 131, 132, 322, 323, 324, 558, 657, 658, 31, 193, ! 790, 437, 91, 559, 640, 438, 34, 140, 278, 35, ! 216, 204, 78, 199, 205, 646, 79, 562, 327, 328, ! 37, 287, 288, 289, 644, 717, 671, 672, 673, 736, ! 805, 849, 868, 889, 916, 871, 891, 917, 314, 208, ! 682, 209, 38, 39, 40, 41, 350, 352, 357, 225, ! 740, 474, 220, 221, 347, 568, 569, 355, 356, 142, ! 684, 143, 189, 277, 659, 660, 729, 325, 477, 579, ! 580, 581, 556, 361, 557, 794, 795, 796, 823, 844, ! 451, 845, 663, 797, 798, 874, 822, 907, 898, 926, ! 939, 899, 799, 800, 897, 801, 835, 859, 912, 913, ! 914, 937, 403, 404, 439, 630, 440, 441, 442, 317, ! 318, 443, 444, 655, 133, 43, 64, 44, 45, 46, ! 425, 691, 304, 604, 808, 522, 307, 534, 606, 47, ! 308, 69, 48, 430, 539, 431, 544, 698, 699, 49, ! 65, 294, 516, 66, 300, 520, 426, 427, 532, 613, ! 812, 533, 608, 752, 609, 753, 173, 417, 513, 514, ! 515, 685, 686, 296, 419, 174, 175, 176, 177, 178, ! 585, 586, 675, 587, 366, 134, 235, 481, 369, 370, ! 371, 135, 136, 137 }; ! static const short yypact[] = { 146, ! 163, 3062, 3062, 133,-32768,-32768,-32768,-32768, 205, 205, ! 205, 182, 209, 215,-32768, 282,-32768,-32768, 282, 282, ! -32768, 235, 282, 235, 282, 282,-32768,-32768,-32768,-32768, ! 77, 206, 2542, 195,-32768, 205,-32768, 95, 125, 150, ! -32768, 3062,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768, 205, 205, 205, 2771, 2609, 246,-32768,-32768, ! -32768,-32768,-32768, 105, 3331, 3331, 211, 49,-32768,-32768, ! 235,-32768, 23, 282,-32768,-32768, 77, 25,-32768, 205, ! 1765,-32768, 464,-32768, 77, 195,-32768, 205,-32768,-32768, ! 593,-32768, 248, 247, 248, 265,-32768, 274,-32768,-32768, ! -32768,-32768,-32768,-32768, 2771, 2771, 282,-32768,-32768,-32768, ! 2771,-32768,-32768, 1370,-32768, 257, 279, 307,-32768,-32768, ! -32768, 2771, 301, 302,-32768, 2825, 2879,-32768, 3643, 773, ! 371, 336, 2771,-32768,-32768,-32768,-32768,-32768, 362, 322, ! -32768, 387, 3451, 259,-32768, 282,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 225, ! 837,-32768,-32768,-32768, 2503, 409,-32768,-32768,-32768, 282, ! 282, 391, 282, 282,-32768,-32768,-32768, 388, 292, 144, ! -32768, 464, 77,-32768, 416,-32768, 1972, 1176, 205,-32768, ! -32768, 464,-32768, 39,-32768, 205, 1863, 234, 299, 263, ! 1784, 593,-32768,-32768,-32768,-32768, 205,-32768, 426, 419, ! 1696,-32768, 437,-32768, 239,-32768,-32768,-32768,-32768,-32768, ! 449, 469, 465, 477, 2663, 3359, 837, 282,-32768, 450, ! 2771, 1370,-32768, 1370,-32768, 2771, 2771, 518,-32768,-32768, ! 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, 2771, ! 2771, 2771,-32768,-32768, 282, 282, 2771, 2771,-32768,-32768, ! -32768,-32768,-32768, 322, 2031,-32768, 337, 670,-32768,-32768, ! -32768,-32768,-32768,-32768,-32768,-32768, 157,-32768, 498,-32768, ! 837,-32768, 484, 485, 554,-32768, 409,-32768, 256, 485, ! 235, 493,-32768, 509, 491, 502,-32768, 509,-32768,-32768, ! 299,-32768,-32768, 558, 299, 582,-32768, 3215,-32768, 511, ! 515,-32768, 879, 84,-32768,-32768, 561, 205, 372, 155, ! -32768, 464, 464,-32768, 1176, 205,-32768, 2090,-32768,-32768, ! 1176, 534, 205,-32768,-32768, 326, 525, 1910, 717, 248, ! 205, 248,-32768, 572, 529,-32768, 239,-32768,-32768,-32768, ! 536, 552, 2423,-32768,-32768,-32768,-32768, 595, 560, 3359, ! -32768, 564, 570,-32768, 3643, 577, 580, 3643, 3643, 2771, ! 620, 2771, 2771, 1580, 959, 1151, 1757, 1854, 658, 658, ! 489, 489,-32768,-32768,-32768,-32768,-32768, 583, 302, 584, ! 177, 213,-32768, 3234,-32768, 588,-32768, 2149,-32768, 670, ! 587, 259, 2933, 590, 3395, 1882,-32768,-32768, 3464, 837, ! -32768,-32768, 578, 235,-32768, 611, 3137,-32768,-32768, 421, ! 3010, 624, 75, 612,-32768,-32768,-32768, 3521,-32768, 626, ! 360,-32768,-32768, 254,-32768,-32768, 92,-32768,-32768,-32768, ! 3533,-32768, 234,-32768,-32768, 234,-32768, 668,-32768,-32768, ! 628,-32768, 638,-32768,-32768,-32768,-32768,-32768, 647,-32768, ! 650, 2771, 282, 654, 529,-32768, 703,-32768,-32768,-32768, ! 3423,-32768,-32768, 595,-32768,-32768,-32768,-32768,-32768, 698, ! 2771, 1345, 1501,-32768,-32768, 337,-32768,-32768,-32768,-32768, ! -32768, 655,-32768,-32768, 287, 663, 282,-32768, 2503, 665, ! 3245,-32768,-32768, 3521, 1946, 92,-32768, 662, 671, 92, ! -32768, 509,-32768, 543,-32768,-32768,-32768,-32768, 77, 206, ! 2542, 228,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768, 3546, 667,-32768,-32768,-32768, 592, 357,-32768, ! -32768, 3476,-32768, 743, 465,-32768,-32768,-32768, 672, 833, ! -32768, 1685, 92,-32768,-32768, 92,-32768, 674,-32768,-32768, ! 674, 205, 205, 3643,-32768, 205, 673, 282, 1011, 703, ! -32768, 1450, 2771, 715, 675, 3423,-32768,-32768, 1423,-32768, ! -32768, 2771,-32768,-32768,-32768,-32768, 592,-32768,-32768,-32768, ! -32768, 282,-32768,-32768, 693, 509,-32768, 3331, 3331, 62, ! 464, 77, 3165,-32768, 549, 3028, 405, 405,-32768,-32768, ! -32768, 357, 205, 260, 273, 205,-32768, 273, 205, 3234, ! -32768,-32768,-32768,-32768,-32768, 464,-32768, 77,-32768, 625, ! -32768,-32768, 3643,-32768,-32768, 1685,-32768,-32768, 446,-32768, ! -32768,-32768, 205,-32768, 411, 348, 914, 679, 682, 1091, ! -32768,-32768,-32768,-32768,-32768, 723, 282,-32768, 725, 3643, ! 686, 689,-32768, 302,-32768, 2771,-32768, 715,-32768, 2771, ! 318, 260, 273, 205, 427,-32768,-32768, 556,-32768, 704, ! 509,-32768,-32768,-32768,-32768, 2771, 737, 697,-32768, 697, ! 499, 410,-32768, 2208,-32768,-32768,-32768, 747,-32768,-32768, ! -32768, 435, 445, 625,-32768,-32768, 1450,-32768,-32768, 2771, ! 73,-32768,-32768, 282,-32768,-32768,-32768,-32768, 701,-32768, ! -32768,-32768,-32768, 2289, 745, 1450,-32768,-32768, 1530,-32768, ! -32768, 1423,-32768,-32768,-32768,-32768,-32768, 592,-32768,-32768, ! 719, 65, 65, 3643, 2771, 405, 398,-32768, 398,-32768, ! -32768, 700,-32768,-32768, 712, 3607, 2771,-32768,-32768,-32768, ! 2369, 754, 734,-32768,-32768, 736, 739, 2771, 758, 724, ! 726, 2717, 109, 793, 178, 289,-32768, 764, 727,-32768, ! 731, 3264,-32768, 795, 1207, 89,-32768,-32768,-32768,-32768, ! -32768, 2531,-32768, 735, 1610,-32768,-32768, 509,-32768,-32768, ! -32768,-32768,-32768, 3643,-32768, 822,-32768,-32768,-32768, 3607, ! 2771, 755,-32768, 2771, 2771, 3584,-32768,-32768,-32768,-32768, ! 738, 2771, 740,-32768, 757,-32768,-32768,-32768, 464,-32768, ! 77, 1290,-32768,-32768,-32768,-32768, 2771,-32768, 1610,-32768, ! -32768, 760,-32768, 742, 2771, 838,-32768, 799, 783, 786, ! 2771,-32768,-32768, 789,-32768, 2771, 451,-32768, 221, 456, ! -32768, 471,-32768,-32768, 2369, 791,-32768,-32768,-32768, 792, ! -32768,-32768,-32768,-32768, 3625,-32768, 54,-32768, 1176,-32768, ! 1176,-32768,-32768,-32768, 797,-32768,-32768, 2771,-32768,-32768, ! 860, 800,-32768,-32768,-32768,-32768,-32768,-32768, 802,-32768, ! 817, 80, 806,-32768,-32768, 465, 465,-32768,-32768, 2771, ! 860, 811, 860,-32768,-32768, 2771, 814, 81,-32768,-32768, ! 818,-32768, 582, 820,-32768, 371, 334,-32768,-32768, 821, ! 582,-32768,-32768, 371, 895, 899,-32768 }; static const short yypgoto[] = {-32768, ! -32768,-32768,-32768, 98, -363,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768, -12,-32768, -56, 488, -230, 383,-32768,-32768, ! -75,-32768, 439,-32768,-32768,-32768,-32768,-32768, 78,-32768, ! -272,-32768, -312, 579,-32768,-32768, 250,-32768, 44, -181, ! 110, 3, 819,-32768, 275, 7, -18, -162, 632, 104, ! -228, -581, -68, -204, -123,-32768,-32768,-32768, -255, 32, ! 90,-32768, 504,-32768, 303,-32768, -612,-32768, -653,-32768, ! -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -67, -134, ! -508, -29,-32768,-32768,-32768, -73,-32768,-32768,-32768,-32768, ! -32768, 475, -38,-32768, 603, 486, 308, 598, 487, -36, ! -70, -160, -182, -221, 300,-32768,-32768, -269,-32768,-32768, ! -32768, 385, -177,-32768, -200,-32768,-32768,-32768,-32768, -186, ! -487, -709, 306,-32768, 96,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768,-32768,-32768,-32768, 97,-32768, -801, 46,-32768, ! 47,-32768, 568,-32768, -352,-32768, 557, 563, 425, -298, ! -32768,-32768,-32768,-32768, 18,-32768, 954,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, ! -32768, 8, 0, -343,-32768, 444,-32768, 366, 231,-32768, ! -32768,-32768,-32768,-32768,-32768,-32768, -270,-32768,-32768,-32768, ! 237, 463,-32768,-32768,-32768,-32768, -20, 688,-32768,-32768, ! 483,-32768, 251, 537,-32768, 585, 633, -103,-32768, -124, ! -32768,-32768, 351, 412,-32768,-32768,-32768,-32768,-32768,-32768, ! 643,-32768,-32768,-32768 }; ! #define YYLAST 3695 static const short yytable[] = { 123, ! 139, 81, 336, 63, 32, 32, 67, 68, 33, 33, ! 71, 326, 63, 74, 86, 207, 210, 218, 329, 42, ! 42, 70, 457, 70, 333, 94, 96, 98, 462, 227, ! 228, 72, 362, 36, 36, 230, 399, 432, 459, 624, ! 53, 54, 55, 433, 32, 179, 239, 190, 33, 409, ! 298, 498, 402, 448, 712, 211, 223, 271, 346, 42, ! 348, 188, 80, 528, 88, 810, 70, 330, 313, 276, ! 70, 297, 282, 36, 182, 83, 85, 234, 186, 75, ! 458, 524, 649, 269, -112, 806, 183, 464, 195, 846, ! 401, 901, 555, 449, 229, 470, 909, 59, 60, 187, ! 50, 191, 14, 146, 765, 192, 14, 184, 80, 336, ! 767, 59, 60, 856, 206, 331, 80, 921, 933, 332, ! 196, 197, 217, 804, 931, 92, 76, 59, 60, 902, ! 185, 286, 368, 290, 293, 77, 87, 326, 218, 99, ! 320, 811, 92, 92, 92, -1, 512, 847, 326, 145, ! 546, 851, 59, 60, 326, 922, 934, 292, 832, 311, ! 141, 61, -2, 315, 892, -112, 62, 301, 302, 92, ! 305, 306, 190, 360, 734, 61, 93, 92, 365, 496, ! 62, 409, 399, 310, 905, 146, 346, 908, 348, 910, ! 615, 61, 757, 759, 453, 877, 62, 918, 456, 89, ! 372, 90, 196, 197, 218, 376, 95, 377, 455, 51, ! 52, 400, 354, 337, 338, -35, 61, 141, 406, 312, ! 80, 62, 16, 206, 80, 373, 273, 59, 60, 942, ! 454, 97, 411, 206, 14, 274, 275, 412, 349, 353, ! 56, 59, 60, 217, 771, 600, 281, 195, 180, 694, ! -175, 605, 396, 397, 414, 16, -175, 867, 59, 60, ! 688, 59, 60, 283, 284, 285, 484, 57, 542, 181, ! 543, 407, 408, 58, 141, 526, 527, 711, 570, 16, ! 570, 461, 82, 291, 59, 60, 421, 480, 497, 14, ! -472, 61, 337, 338, 75, 92, 62, -175, 310, 311, ! 70, -175, 14, 315, 144, 61, 92, 757, 423, 661, ! 62, 469, 219, 471, 420, 236, 650, 651, 703, 704, ! 652, 14, 61, 490, 141, 61, -34, 62, 222, 553, ! 62, 196, 197, 16, 554, 690, 218, 237, 601, 339, ! 141, 76, 603, 192, 354, 141, 224, 141, 61, 36, ! 77, 502, 674, 62, 634, 226, 875, 196, 197, 75, ! 206, 681, 591, 206, 206, 238, 349, 592, 705, 706, ! 707, 273, 709, 710, 75, 200, 240, 584, 310, 269, ! 274, 275, 241, 519, 298, 645, 14, 726, 647, 465, ! 731, 467, 662, 743, 141, 407, 408, 722, 241, 286, ! 402, 14, -274, -274, 760, 297, 627, 75, 200, 940, ! 270, 716, 75, 620, 941, 622, 275, 92, 510, 86, ! 751, 201, 511, 70, 446, 725, 744, 745, 746, 530, ! 202, 523, 560, 531, 14, 36, 551, 272, 701, 14, ! 552, 702, 696, 203, 708, 674, 299, 36, 75, 200, ! 36, 281, 141, 542, 201, 543, 703, 704, 36, 758, ! 354, 570, 279, 202, 309, 768, 75, 200, 77, 88, ! 529, 662, 303, 732, 316, 14, 203, 626, 629, 496, ! 548, 549, 678, 720, 342, 716, 496, 723, 535, 536, ! 537, 724, 86, 14, 594, 201, 343, 195, 538, 610, ! -175, 75, 620, 747, 202, 310, -175, 748, 243, 245, ! 819, 763, 86, 201, 351, 332, 510, 203, 625, 628, ! 511, 764, 202, 141, 358, 192, 374, 888, 14, 196, ! 197, 332, 890, 793, 141, 203, 192, 852, 260, 261, ! 262, 87, 88, 210, 359, 36, 360, -175, 621, 697, ! 697, -175, 363, 597, 561, -85, 413, 622, 275, 415, ! 80, 416, 88, 418, 853, 654, 218, 683, 424, 713, ! 793, -470, 428, 611, 612, 816, 903, 429, 904, 623, ! 80, 721, 610, 36, 195, 617, 618, 692, 693, 687, ! 102, 446, 190, 445, 75, 620, 452, 213, 214, 215, ! 463, 466, 636, 638, 9, 10, 11, 472, 610, 473, ! 535, 536, 537, 476, 87, 530, 535, 536, 537, 531, ! 607, 14, 14, 535, 536, 537, 695, 478, 623, 715, ! 214, 215, 482, 749, 87, 483, 9, 10, 11, 486, ! 218, 621, 206, 80, 36, 487, 281, 762, 206, 206, ! 622, 275, 488, 80, 735, 489, 529, 491, 494, 521, ! 936, 36, 503, 639, 336, 507, 495, 206, 944, 80, ! 499, 311, 315, 525, 793, 214, 215, 789, 311, 375, ! 206, 9, 10, 11, 378, 379, 545, 547, 697, 384, ! 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, ! 395, 550, 326, 564, 326, 258, 259, 260, 261, 262, ! 565, 769, 92, 567, 789, 924, 925, 344, 683, 141, ! 5, 788, 7, 138, 572, 831, 271, 573, 9, 10, ! 11, 576, 623, 623, 578, 588, 791, 590, 593, 80, ! 792, 596, 552, 619, 13, 633, 602, 15, 635, 75, ! 653, 802, 676, 310, 648, 689, -310, 677, 788, 730, ! -32, 16, 737, 738, 854, 36, 750, 857, 860, 739, ! 833, 869, 870, 86, 755, 864, 14, 756, 770, 623, ! 803, 809, 817, 22, 70, 70, 311, 206, 24, 818, ! 876, -33, 821, 72, 824, 827, 627, 825, 880, 834, ! 828, 836, 829, 837, 791, 622, 275, 838, 792, 887, ! 842, 872, 850, 855, 863, 866, 865, 879, 789, 802, ! 492, 493, 878, 88, 75, 620, 263, 264, 310, 265, ! 266, 267, 268, 36, 839, 841, 5, 89, 7, 90, ! 5, 857, 7, 138, 9, 10, 11, 623, 9, 10, ! 11, 14, 263, 264, 881, 265, 266, 267, 268, 883, ! 13, 884, 788, 927, 13, 886, 895, 896, 911, 857, ! 206, 758, 80, 906, 882, 920, 915, 16, 919, 321, ! 77, 16, -115, -115, -115, -115, 923, 929, -115, 932, ! -115, -115, -115, 935, 946, 87, 938, 943, 947, 22, ! 506, 858, 450, 22, 24, 212, -115, 727, 24, 637, ! 574, 848, 410, 714, 321, 504, -124, -124, -124, -124, ! -124, -124, -124, -115, -124, -124, -124, -124, -124, 589, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, ! -124, -124, -124, -124, -124, -115, -124, -124, 718, 577, ! -115, 468, 571, -124, 475, 719, -124, 728, -124, 575, ! -115, -124, -124, -124, 664, 733, 928, -124, -124, 930, ! 893, 894, -124, -124, 500, 517, 632, -124, 73, -124, ! -124, 518, 616, 700, -124, -124, 815, 422, -124, 813, ! -124, -124, -124, -124, 614, -124, 599, 679, 807, 508, ! 643, 253, 254, 255, 256, 257, 258, 259, 260, 261, ! 262, 656, 485, -331, -331, -331, -331, -331, -331, -331, ! 670, -331, -331, -331, -331, -331, 741, -331, -331, -331, ! -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, ! -331, -331, 0, -331, -331, 595, 0, 509, 0, 0, ! -331, 0, 0, -331, 0, -331, 0, 0, -331, -331, ! -331, 0, 0, 0, -331, -331, 0, 0, 0, -331, ! -331, 0, 0, 0, -331, 0, -331, -331, 0, 0, ! 0, -331, -331, 0, 643, -331, 0, -331, 0, -331, ! -331, 321, -331, -331, -331, 0, 0, 0, -331, -331, ! 0, -331, 0, 0, 0, -331, 0, -331, -331, -331, ! -331, -331, -331, -331, -331, -331, -331, -331, 742, -331, ! 0, -331, 0, -331, -331, 0, 0, 0, 0, 0, ! -331, 0, 0, -331, 754, 0, 0, 0, -331, -331, ! -331, 0, 0, 0, -331, -331, 0, 0, 0, -331, ! -331, 0, 0, 0, -331, 670, -331, -331, 766, 0, ! 0, -331, -331, 0, 0, -331, 0, -331, -306, -331, ! -331, 0, -331, 0, 670, 0, 321, 670, 0, -331, ! -331, -331, -331, 0, 0, 0, 0, -331, -331, -331, ! 0, 0, 0, 814, 254, 255, 256, 257, 258, 259, ! 260, 261, 262, -331, 0, 820, 0, 843, 0, -331, ! -331, 0, 0, 0, -331, -331, 826, -331, 0, 0, ! -331, -331, 0, -331, -331, -331, -331, -331, -331, -331, ! -331, -331, -331, -331, 0, -331, 0, -331, 0, -331, ! -331, 0, -331, 670, 0, 0, -331, -331, 0, -331, ! 0, 0, 0, 0, -331, -331, -331, -111, 0, 0, ! -331, -331, 0, 0, 0, -331, -331, 0, 0, 0, ! -331, 0, -331, -331, 0, 0, 0, -331, -331, 0, ! 0, -331, 0, -331, 0, -331, -331, 670, -331, 0, ! 873, 0, -341, -341, 0, 0, 0, -341, -341, 885, ! -341, 0, 0, 0, -341, 0, -341, -341, -341, -341, ! -341, -341, -341, -341, -341, -341, -341, 0, -341, 0, ! -341, 0, -341, -341, 0, 0, 0, 0, 0, -341, ! 0, 0, -341, 0, 0, 0, 0, -341, -341, -341, ! 0, 0, 0, -341, -341, 0, 0, 0, -341, -341, ! 0, 0, 0, -341, 0, -341, -341, 0, 0, 0, ! -341, -341, 0, 0, -341, 0, -341, 0, -341, -341, ! 231, -341, 100, 5, 0, 7, 138, 101, 102, 0, ! 103, 9, 10, 11, 250, 251, 252, 253, 254, 255, ! 256, 257, 258, 259, 260, 261, 262, 13, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 16, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, 0, 0, 116, 0, 117, 22, 0, 0, 0, 118, 24, 0, 0, 119, 0, 0, 0, 120, 121, ! 665, -94, 666, 60, 0, 0, 0, 101, 102, 248, 103, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 0, 667, 114, 115, 0, 0, 0, 116, 0, 117, 61, 0, 0, 0, 118, 62, 0, 0, 119, 0, 0, -203, 120, 121, ! 665, 668, 666, 60, 0, 0, 0, 101, 102, 0, ! 103, 251, 252, 253, 254, 255, 256, 257, 258, 259, ! 260, 261, 262, 0, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 0, 667, 114, 115, 0, 0, 0, 116, 0, 117, 61, 0, 0, 0, ! 118, 62, 0, 0, 119, 0, 0, -264, 120, 121, ! 665, 668, 666, 60, 0, 0, 0, 101, 102, 0, 103, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 0, 0, 0, 0, 0, 0, 104, 0, ! 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 0, 667, 114, 115, ! 0, 0, 0, 116, 0, 117, 61, 0, 0, 0, ! 118, 62, 0, 0, 119, 641, 0, 100, 120, 121, ! 0, 668, 101, 102, 0, 103, 344, 0, 0, 5, ! 0, 7, 138, 0, 0, 0, 0, 9, 10, 11, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, ! 0, 0, 0, 13, 107, 0, 15, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, ! 16, 0, 0, 114, 115, 0, 0, 0, 116, 0, 117, 0, 0, 0, 0, 118, 0, 0, 0, 119, ! 0, 0, 22, 120, 121, 194, 642, 24, -28, -28, ! -28, -28, 345, -267, 0, 0, -28, -28, -28, 0, ! 0, 0, 0, 0, 340, 0, 0, -24, -24, -24, ! -24, 195, -28, 0, -175, -24, -24, -24, 0, 0, ! -175, 255, 256, 257, 258, 259, 260, 261, 262, -28, ! 195, -24, 0, -175, 0, 0, 0, 0, 0, -175, ! 0, 0, 0, 196, 197, 0, 0, 0, -24, 0, ! 0, -28, 0, 0, 0, 0, -28, 0, 0, 0, ! 0, -175, 196, 197, 0, -175, -28, 0, 0, 0, ! -24, 0, 0, 0, 0, -24, 0, 0, 0, 0, ! -175, 0, 0, 334, -175, -24, -20, -20, -20, -20, ! 0, 0, 0, 0, -20, -20, -20, 0, 0, 0, ! 0, 0, 321, 0, 0, 5, 6, 7, 8, 195, ! -20, 0, -175, 9, 10, 11, 0, 0, -175, 256, ! 257, 258, 259, 260, 261, 262, 0, -20, 0, 13, ! 0, 14, 0, 5, 0, 7, 280, 0, 0, 0, ! 0, 9, 10, 11, 0, 0, 16, 0, 0, -20, ! 0, 0, 0, 0, -20, 0, 0, 13, 0, -175, ! 0, 0, 0, -175, -20, 0, 321, 0, 22, -494, ! -494, -494, -494, 24, 16, 0, 0, -494, -494, -494, ! 0, 0, 0, -492, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, -494, 100, -494, 22, 0, 0, 101, ! 102, 24, 103, 0, 0, 0, -276, -276, 0, 0, ! -494, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, ! 0, 107, -494, 0, 108, 0, 0, -494, 0, 109, ! 110, 111, 0, 0, 0, 112, 113, -494, 0, 0, 114, 115, 0, 100, 0, 116, 0, 117, 101, 102, 0, 103, 118, 0, 0, 0, 119, 0, 0, 0, ! 120, 121, 0, 0, 319, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, 100, 0, 116, 0, 117, 101, 102, 0, 103, 118, 0, 0, 0, 119, 0, 0, 0, 120, ! 121, 0, 0, 405, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, 100, 0, 116, 0, 117, 101, 102, 0, 103, 118, 0, 0, 0, 119, 0, 0, 0, 120, 121, ! 0, 0, 460, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, ! 100, 0, 116, 0, 117, 101, 102, 0, 103, 118, 0, 0, 0, 119, 0, 0, 0, 120, 121, 0, ! 0, 501, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, ! 0, 112, 113, 0, 0, 0, 114, 115, 0, 0, ! 0, 116, 0, 117, 0, 0, 0, 0, 118, 0, ! 0, 0, 119, 0, 0, 0, 120, 121, 0, 0, ! 761, 666, 772, 6, 7, 8, 101, 102, 0, 103, ! 9, 10, 11, 773, 0, 774, 775, 776, 777, 778, ! 779, 780, 781, 782, 783, 784, 13, 104, 14, 15, ! 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, ! 0, 108, 0, 16, 0, 0, 109, 110, 111, 0, ! 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, ! 0, 0, 116, 0, 117, 785, 0, 0, 0, 118, ! 786, 0, 0, 119, 0, 787, 0, 120, 121, 0, ! 360, 666, 60, 0, 0, 0, 101, 102, 0, 103, ! 0, 0, 0, 773, 0, 774, 775, 776, 777, 778, ! 779, 780, 781, 782, 783, 784, 0, 104, 0, 15, ! 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, ! 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, ! 0, 0, 112, 113, 0, 100, 0, 114, 115, 0, ! 101, 102, 116, 103, 117, 61, 0, 0, 0, 118, ! 62, 0, 0, 119, 0, 787, 0, 120, 121, 0, ! 360, 104, 0, 15, 0, 105, 106, 0, 0, 0, ! 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, ! 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, ! 0, 114, 115, 0, 0, 0, 116, 0, 117, 0, ! 0, 0, 0, 118, 0, 0, 0, 119, 0, 0, ! 0, 120, 121, 0, 479, 147, 148, 0, 149, 150, ! 0, 0, 0, 151, 152, 153, 154, 155, 156, 157, ! 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, ! 168, 169, 0, 100, 5, 6, 7, 8, 101, 102, ! 170, 103, 9, 10, 11, 5, 6, 7, 8, 0, ! 0, 0, 0, 9, 10, 11, 0, 0, 13, 104, ! 14, 15, 0, 105, 106, 0, 0, 0, 0, 13, ! 107, 14, 0, 108, 172, 16, 0, 0, 109, 110, ! 111, 0, 0, 295, 112, 113, 16, 0, 0, 114, ! 115, 0, 0, 0, 116, 0, 117, 22, 0, 0, ! 0, 118, 24, 0, 0, 119, 0, 0, 22, 120, ! 121, 100, 5, 24, 7, 138, 101, 102, 84, 103, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 13, 104, 0, 15, ! 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, ! 0, 108, 0, 16, 0, 0, 109, 110, 111, 0, ! 0, 0, 112, 113, 0, 100, 0, 114, 115, 0, ! 101, 102, 116, 103, 117, 22, 0, 0, 0, 118, ! 24, 0, 0, 119, 0, 0, 0, 120, 121, 0, ! 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, ! 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, ! 109, 110, 111, 0, 0, 0, 112, 113, 0, 100, ! 0, 114, 115, 0, 101, 102, 116, 103, 117, 364, ! 0, 0, 0, 118, 0, 0, 0, 119, 0, 0, ! 0, 120, 121, 0, 0, 104, 0, 15, 0, 105, ! 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, ! 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, ! 112, 113, 0, 100, 0, 114, 115, 0, 101, 102, ! 116, 103, 117, 0, 0, 0, 0, 118, 0, 0, ! 0, 119, 0, 830, 0, 120, 121, 0, 0, 104, ! 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, ! 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, ! 111, 0, 0, 0, 112, 113, 0, 100, 0, 114, ! 115, 0, 101, 102, 116, 103, 117, 0, 0, 0, ! 0, 118, 0, 0, 0, 119, 0, 0, 0, 120, ! 121, 0, 0, 104, 0, 15, 0, 105, 106, 0, ! 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, ! 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, ! 0, 100, 0, 242, 115, 0, 101, 102, 116, 103, ! 117, 0, 0, 0, 0, 118, 0, 0, 0, 119, ! 0, 0, 0, 120, 121, 0, 0, 104, 0, 15, ! 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, ! 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, ! 0, 0, 112, 113, 0, 505, 0, 244, 115, 0, ! 101, 102, 116, 103, 117, 0, 0, 0, 0, 118, ! 0, 0, 0, 119, 0, 0, 0, 120, 121, 0, ! 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, ! 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, ! 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, ! 0, 114, 115, 0, 0, 0, 116, 0, 117, 0, ! 0, 0, 0, 118, 0, 0, 0, 119, 0, 0, ! 540, 120, 121, 5, 0, 7, 138, 0, 0, 0, ! 0, 9, 10, 11, 0, 0, 0, 0, 540, 0, ! 0, 5, 0, 7, 138, 0, 0, 13, 0, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 16, 13, 0, 0, 0, 0, ! 0, 0, 4, 0, -128, 5, 6, 7, 8, 0, ! 0, 0, 16, 9, 10, 11, 22, -446, -446, -446, ! 0, 24, 0, 0, 0, 0, 541, -446, 12, 13, ! 0, 14, 15, 0, 22, -445, -445, -445, 0, 24, ! 0, 0, 0, 0, 541, -445, 16, 0, 0, 17, ! 18, -128, 0, 0, 0, 0, 0, 0, 0, 0, ! -128, 0, 19, 20, 21, 0, 0, 0, 22, 0, ! 0, 0, 23, 24, 25, 26, 0, 4, 27, -128, ! 5, 6, 7, 8, 0, 0, 0, 0, 9, 10, ! 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 13, 4, 14, -128, 5, 6, ! 7, 8, 0, 0, 0, 0, 9, 10, 11, 0, ! 0, 16, 0, 0, 526, 527, -128, 0, 0, 0, ! 0, 0, 13, 0, 14, -128, 0, 0, 0, 0, ! 0, 0, 0, 22, 0, 0, 0, 0, 24, 16, ! 0, 0, 0, 27, -128, 434, 0, 435, 5, 6, ! 7, 8, 0, -128, 436, 0, 9, 10, 11, 0, ! 0, 22, 0, 0, 434, 0, 24, 5, 6, 7, ! 8, 27, 13, 436, 14, 9, 10, 11, 5, 6, ! 7, 8, 0, 0, 0, 0, 9, 10, 11, 16, ! 0, 13, 0, 14, 0, 0, 0, 5, 6, 7, ! 8, 0, 13, 0, 14, 9, 10, 11, 16, 0, 0, 22, 0, 0, 0, 0, 24, 0, 0, 16, ! -391, 13, 0, 14, 0, 0, 0, 0, 0, 0, ! 22, 0, 0, 0, 0, 24, 0, 0, 16, -391, ! 0, 22, 0, 0, 0, 0, 24, 0, 0, 0, ! 0, 598, 0, 0, 0, 0, 0, 0, 0, 0, ! 22, 0, 0, 147, 148, 24, 149, 150, 0, 0, ! 840, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, ! 0, 147, 148, 0, 149, 150, 0, 0, 170, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, ! 162, 163, 164, 165, 166, 167, 168, 169, 0, 171, ! 0, 0, 0, 0, 0, 0, 367, 147, 148, 0, ! 149, 150, 172, 0, 0, 151, 152, 153, 154, 155, ! 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, ! 166, 167, 168, 169, 0, 147, 148, 0, 149, 150, ! 172, 0, 170, 151, 152, 153, 154, 155, 156, 157, ! 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, ! 168, 169, 0, 0, 5, 0, 7, 280, 0, 0, ! 583, 0, 9, 10, 11, 0, 172, 5, 6, 7, ! 8, 0, 0, 436, 0, 9, 10, 11, 13, 5, ! 6, 7, 8, 0, 0, 631, 0, 9, 10, 11, ! 0, 13, 0, 14, 172, 16, 0, 0, 0, 0, ! 273, 0, 0, 13, 0, 14, 0, 0, 16, 274, ! 275, 0, 0, 0, 0, 0, 0, 22, 0, 0, ! 16, 0, 24, 0, 5, 6, 7, 8, 0, 0, ! 22, 0, 9, 10, 11, 24, 5, 6, 7, 8, ! 0, 0, 22, 0, 9, 10, 11, 24, 13, 5, ! 14, 7, 280, 0, 0, 0, 0, 9, 10, 11, ! 13, 0, 0, 0, 0, 16, 0, 0, 0, 0, ! 0, 0, 0, 13, 0, 0, 0, 16, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, ! 16, 0, 24, 861, 0, 0, 0, 0, 0, 22, ! 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, ! 0, 0, 22, 0, 0, 0, 0, 24, 246, 247, ! 248, 862, 249, 250, 251, 252, 253, 254, 255, 256, ! 257, 258, 259, 260, 261, 262, 14, 0, 0, 0, ! 0, 246, 247, 248, 0, 249, 250, 251, 252, 253, ! 254, 255, 256, 257, 258, 259, 260, 261, 262, 246, ! 247, 248, 900, 249, 250, 251, 252, 253, 254, 255, ! 256, 257, 258, 259, 260, 261, 262, 246, 247, 248, ! 0, 249, 250, 251, 252, 253, 254, 255, 256, 257, ! 258, 259, 260, 261, 262 }; static const short yycheck[] = { 56, ! 57, 31, 207, 16, 2, 3, 19, 20, 2, 3, ! 23, 198, 25, 26, 33, 83, 85, 91, 201, 2, ! 3, 22, 335, 24, 206, 38, 39, 40, 341, 105, ! 106, 24, 233, 2, 3, 111, 267, 308, 337, 548, ! 9, 10, 11, 316, 42, 66, 122, 77, 42, 278, ! 175, 404, 274, 323, 636, 85, 95, 133, 221, 42, ! 221, 74, 31, 427, 33, 1, 67, 202, 192, 140, ! 71, 175, 143, 42, 67, 32, 33, 114, 71, 3, ! 336, 425, 570, 9, 1, 739, 38, 343, 27, 1, ! 273, 38, 1, 10, 107, 351, 898, 3, 4, 77, ! 3, 77, 30, 81, 717, 81, 30, 59, 77, 314, ! 38, 3, 4, 823, 83, 77, 85, 38, 38, 81, ! 59, 60, 91, 736, 926, 36, 50, 3, 4, 76, ! 82, 144, 236, 146, 171, 59, 33, 324, 212, 42, ! 197, 77, 53, 54, 55, 0, 416, 59, 335, 45, ! 76, 805, 3, 4, 341, 76, 76, 170, 50, 189, ! 57, 67, 0, 193, 874, 82, 72, 180, 181, 80, ! 183, 184, 202, 82, 662, 67, 82, 88, 235, 401, ! 72, 410, 413, 7, 894, 81, 349, 897, 349, 899, ! 534, 67, 701, 702, 329, 849, 72, 907, 333, 5, ! 237, 7, 59, 60, 278, 242, 82, 244, 332, 77, ! 78, 268, 225, 59, 60, 38, 67, 114, 275, 76, ! 189, 72, 45, 192, 193, 238, 50, 3, 4, 939, ! 76, 82, 76, 202, 30, 59, 60, 81, 221, 1, ! 59, 3, 4, 212, 732, 515, 143, 27, 38, 613, ! 30, 522, 265, 266, 291, 45, 36, 839, 3, 4, ! 604, 3, 4, 5, 6, 7, 370, 59, 431, 59, ! 431, 59, 60, 59, 171, 48, 49, 630, 465, 45, ! 467, 338, 77, 59, 3, 4, 299, 363, 76, 30, ! 63, 67, 59, 60, 3, 206, 72, 77, 7, 329, ! 301, 81, 30, 333, 59, 67, 217, 816, 301, 579, ! 72, 350, 65, 352, 59, 59, 572, 573, 59, 60, ! 576, 30, 67, 380, 221, 67, 38, 72, 82, 76, ! 72, 59, 60, 45, 81, 606, 410, 59, 516, 77, ! 237, 50, 520, 81, 357, 242, 82, 244, 67, 318, ! 59, 408, 583, 72, 555, 82, 844, 59, 60, 3, ! 329, 592, 76, 332, 333, 59, 349, 81, 624, 625, ! 626, 50, 628, 629, 3, 4, 76, 481, 7, 9, ! 59, 60, 81, 420, 509, 563, 30, 657, 566, 346, ! 660, 348, 579, 76, 291, 59, 60, 653, 81, 412, ! 622, 30, 77, 78, 703, 509, 50, 3, 4, 76, ! 75, 640, 3, 4, 81, 59, 60, 328, 416, 438, ! 691, 50, 416, 424, 77, 78, 682, 683, 684, 427, ! 59, 424, 451, 427, 30, 404, 77, 76, 621, 30, ! 81, 623, 38, 72, 627, 676, 38, 416, 3, 4, ! 419, 348, 349, 616, 50, 616, 59, 60, 427, 50, ! 473, 648, 76, 59, 77, 721, 3, 4, 59, 438, ! 427, 658, 82, 660, 59, 30, 72, 548, 549, 701, ! 437, 438, 586, 38, 59, 714, 708, 77, 68, 69, ! 70, 81, 511, 30, 507, 50, 78, 27, 78, 529, ! 30, 3, 4, 77, 59, 7, 36, 81, 126, 127, ! 766, 77, 531, 50, 78, 81, 514, 72, 548, 549, ! 514, 77, 59, 420, 76, 81, 77, 77, 30, 59, ! 60, 81, 77, 734, 431, 72, 81, 808, 50, 51, ! 52, 438, 511, 612, 76, 514, 82, 77, 50, 617, ! 618, 81, 76, 510, 451, 38, 59, 59, 60, 76, ! 529, 77, 531, 10, 820, 578, 640, 597, 76, 638, ! 771, 63, 82, 530, 531, 758, 889, 76, 891, 548, ! 549, 649, 612, 552, 27, 542, 543, 608, 609, 602, ! 9, 77, 622, 83, 3, 4, 36, 5, 6, 7, ! 67, 77, 559, 560, 12, 13, 14, 36, 638, 81, ! 68, 69, 70, 78, 511, 613, 68, 69, 70, 613, ! 78, 30, 30, 68, 69, 70, 78, 76, 597, 5, ! 6, 7, 38, 78, 531, 76, 12, 13, 14, 76, ! 714, 50, 611, 612, 613, 76, 543, 704, 617, 618, ! 59, 60, 76, 622, 667, 76, 613, 38, 76, 82, ! 933, 630, 76, 560, 869, 76, 83, 636, 941, 638, ! 83, 701, 702, 63, 875, 6, 7, 734, 708, 241, ! 649, 12, 13, 14, 246, 247, 63, 76, 756, 251, ! 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, ! 262, 76, 889, 36, 891, 48, 49, 50, 51, 52, ! 83, 724, 623, 76, 771, 916, 917, 1, 748, 616, ! 4, 734, 6, 7, 78, 782, 802, 78, 12, 13, ! 14, 78, 701, 702, 32, 38, 734, 83, 76, 708, ! 734, 77, 81, 77, 28, 3, 76, 31, 77, 3, ! 78, 734, 38, 7, 81, 63, 78, 83, 771, 78, ! 38, 45, 38, 78, 821, 734, 63, 824, 825, 81, ! 783, 839, 841, 792, 38, 832, 30, 81, 78, 748, ! 36, 63, 83, 67, 785, 786, 816, 756, 72, 78, ! 847, 38, 59, 786, 59, 38, 50, 59, 855, 7, ! 77, 38, 77, 77, 802, 59, 60, 77, 802, 866, ! 16, 841, 78, 59, 77, 59, 77, 76, 875, 802, ! 382, 383, 63, 792, 3, 4, 54, 55, 7, 57, ! 58, 59, 60, 802, 791, 792, 4, 5, 6, 7, ! 4, 898, 6, 7, 12, 13, 14, 816, 12, 13, ! 14, 30, 54, 55, 17, 57, 58, 59, 60, 77, ! 28, 76, 875, 920, 28, 77, 76, 76, 9, 926, ! 839, 50, 841, 77, 76, 59, 77, 45, 77, 1, ! 59, 45, 4, 5, 6, 7, 81, 77, 10, 76, ! 12, 13, 14, 76, 0, 792, 77, 77, 0, 67, ! 413, 824, 324, 67, 72, 87, 28, 658, 72, 77, ! 472, 802, 281, 639, 1, 412, 3, 4, 5, 6, ! 7, 8, 9, 45, 11, 12, 13, 14, 15, 491, ! 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, ! 27, 28, 29, 30, 31, 67, 33, 34, 646, 475, ! 72, 349, 467, 40, 357, 648, 43, 658, 45, 473, ! 82, 48, 49, 50, 580, 660, 921, 54, 55, 923, ! 875, 875, 59, 60, 407, 419, 552, 64, 25, 66, ! 67, 419, 539, 618, 71, 72, 756, 300, 75, 753, ! 77, 78, 79, 80, 532, 82, 514, 586, 748, 415, ! 562, 43, 44, 45, 46, 47, 48, 49, 50, 51, ! 52, 1, 370, 3, 4, 5, 6, 7, 8, 9, ! 582, 11, 12, 13, 14, 15, 676, 17, 18, 19, ! 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, ! 30, 31, -1, 33, 34, 509, -1, 415, -1, -1, ! 40, -1, -1, 43, -1, 45, -1, -1, 48, 49, ! 50, -1, -1, -1, 54, 55, -1, -1, -1, 59, ! 60, -1, -1, -1, 64, -1, 66, 67, -1, -1, ! -1, 71, 72, -1, 646, 75, -1, 77, -1, 79, ! 80, 1, 82, 3, 4, -1, -1, -1, 8, 9, ! -1, 11, -1, -1, -1, 15, -1, 17, 18, 19, ! 20, 21, 22, 23, 24, 25, 26, 27, 680, 29, ! -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, ! 40, -1, -1, 43, 696, -1, -1, -1, 48, 49, ! 50, -1, -1, -1, 54, 55, -1, -1, -1, 59, ! 60, -1, -1, -1, 64, 717, 66, 67, 720, -1, ! -1, 71, 72, -1, -1, 75, -1, 77, 78, 79, ! 80, -1, 82, -1, 736, -1, 1, 739, -1, 4, ! 5, 6, 7, -1, -1, -1, -1, 12, 13, 14, ! -1, -1, -1, 755, 44, 45, 46, 47, 48, 49, ! 50, 51, 52, 28, -1, 767, -1, 1, -1, 3, ! 4, -1, -1, -1, 8, 9, 778, 11, -1, -1, ! 45, 15, -1, 17, 18, 19, 20, 21, 22, 23, ! 24, 25, 26, 27, -1, 29, -1, 31, -1, 33, ! 34, -1, 67, 805, -1, -1, 40, 72, -1, 43, ! -1, -1, -1, -1, 48, 49, 50, 82, -1, -1, ! 54, 55, -1, -1, -1, 59, 60, -1, -1, -1, ! 64, -1, 66, 67, -1, -1, -1, 71, 72, -1, ! -1, 75, -1, 77, -1, 79, 80, 849, 82, -1, ! 1, -1, 3, 4, -1, -1, -1, 8, 9, 861, 11, -1, -1, -1, 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, ! -1, -1, -1, 54, 55, -1, -1, -1, 59, 60, -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, 71, 72, -1, -1, 75, -1, 77, -1, 79, 80, 1, 82, 3, 4, -1, 6, 7, 8, 9, -1, ! 11, 12, 13, 14, 40, 41, 42, 43, 44, 45, ! 46, 47, 48, 49, 50, 51, 52, 28, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, 45, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, -1, 59, 60, --- 621,1451 ---- 1, 3, 1, 3, 0, 4, 0, 6, 3, 0, 6, 3, 0, 1, 1, 2, 6, 1, 3, 0, 1, 4, 6, 4, 1, 1, 1, 1, 1, 0, ! 4, 1, 0, 2, 1, 3, 3, 2, 0, 4, ! 1, 0, 4, 1, 1, 1, 2, 2, 0, 0, ! 5, 0, 0, 5, 1, 1, 3, 3, 4, 3, ! 3, 3, 1, 1, 3, 4, 3, 3, 3, 1, ! 3, 3, 3, 4, 3, 3, 1, 1, 2, 1, ! 2, 1, 2, 0, 7, 5, 2, 0, 7, 5, ! 2, 0, 8, 0, 7, 2, 0, 1, 0, 1, ! 1, 2, 0, 3, 2, 4, 3, 1, 3, 1, ! 1, 2, 1, 3, 4, 6, 5, 1, 3, 1, ! 1, 3, 2, 2, 0, 1, 1, 2, 0, 2, ! 3, 3, 2, 3, 4, 3, 2, 3, 2, 3, ! 1, 1, 2, 2, 0, 1, 2, 0, 0, 1, ! 1, 2, 3, 1, 2, 1, 2, 6, 5, 5, ! 2, 2, 4, 0, 4, 0, 0, 3, 4, 3, ! 1, 1, 1, 1, 2, 0, 4, 1, 3, 0, ! 0, 7, 5, 2, 0, 0, 0, 12, 0, 6, ! 2, 2, 2, 3, 6, 8, 10, 12, 3, 4, ! 1, 1, 0, 6, 3, 5, 2, 3, 0, 1, ! 0, 1, 0, 1, 1, 3, 4, 1, 3, 0, ! 2, 2, 0, 4, 2, 0, 1, 1, 3, 1, ! 3, 4, 4, 4, 4, 4, 0, 2, 1, 2, ! 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, ! 1, 1, 3, 3, 4, 0, 0, 10, 0, 6, ! 0, 0, 12, 0, 8, 0, 6, 2, 0, 8, ! 4, 0, 9, 5, 0, 6, 0, 1, 3, 3, ! 1, 1, 1, 1, 0, 3, 2, 3, 3, 1, ! 0, 1, 3, 1, 3, 2, 0, 0, 0, 7, ! 0, 0, 0, 7, 0, 0, 2, 1, 1, 2, ! 0, 3, 1, 1, 0, 0, 5, 0, 0, 5, ! 4, 1, 5, 2, 0, 2, 0, 1, 1, 1, ! 2, 2, 4, 2, 2, 1, 3, 2, 2, 2, ! 0, 2, 0, 3, 1, 1, 2, 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, 6, 3, 5, 2, 1, 1, 1, 2, ! 1, 3, 2, 1, 1, 0, 0, 6, 1, 1, ! 1, 2, 2, 1, 4, 4, 4 }; static const short yydefact[] = { 3, ! 5, 0, 0, 0, 162, 153, 160, 152, 252, 248, ! 250, 0, 0, 0, 415, 0, 467, 471, 0, 0, ! 421, 447, 0, 447, 0, 0, 19, 4, 8, 7, 0, 128, 128, 148, 139, 149, 185, 0, 0, 0, ! 161, 0, 9, 417, 418, 416, 419, 165, 420, 6, ! 17, 18, 253, 249, 251, 0, 0, 0, 32, 33, ! 35, 34, 422, 0, 0, 0, 447, 438, 163, 448, ! 447, 164, 0, 0, 247, 299, 0, 0, 173, 129, 0, 16, 0, 15, 0, 150, 139, 151, 155, 154, ! 137, 186, 273, 257, 273, 261, 264, 266, 11, 89, 90, 107, 59, 60, 0, 0, 0, 36, 38, 37, ! 0, 39, 40, 0, 556, 0, 0, 0, 109, 41, 42, 0, 0, 43, 61, 0, 0, 65, 46, 48, ! 91, 106, 0, 102, 103, 104, 105, 297, 0, 295, ! 158, 0, 295, 190, 449, 0, 518, 519, 541, 542, ! 538, 522, 523, 524, 525, 526, 527, 528, 529, 530, ! 531, 532, 533, 534, 535, 536, 537, 539, 540, 0, ! 0, 520, 468, 492, 511, 515, 521, 516, 472, 0, ! 0, 429, 0, 0, 436, 445, 424, 0, 0, 0, ! 12, 0, 0, 31, 0, 407, 0, 0, 183, 233, ! 299, 0, 234, 0, 171, 129, 0, 225, 226, 0, 0, 138, 141, 168, 169, 140, 142, 170, 0, 0, ! 0, 254, 0, 258, 0, 262, 57, 58, 52, 49, 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 53, 0, 55, 0, 0, 82, 80, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 0, 0, 44, 0, 108, 110, ! 50, 166, 299, 390, 0, 129, 293, 296, 156, 167, ! 298, 158, 294, 196, 197, 198, 195, 0, 188, 191, ! 423, 0, 546, 0, 495, 513, 494, 0, 517, 0, ! 495, 447, 0, 426, 476, 441, 0, 455, 476, 425, ! 300, 243, 242, 174, 175, 246, 0, 241, 0, 245, ! 0, 0, 29, 0, 336, 116, 337, 182, 184, 0, ! 0, 14, 0, 0, 23, 0, 183, 407, 0, 13, ! 27, 0, 0, 183, 281, 275, 128, 272, 128, 0, ! 273, 183, 273, 290, 291, 269, 288, 0, 93, 92, ! 326, 318, 0, 0, 555, 554, 557, 564, 559, 0, ! 560, 561, 0, 0, 10, 47, 0, 0, 88, 87, ! 0, 0, 0, 0, 76, 77, 75, 74, 73, 71, ! 72, 66, 67, 68, 69, 70, 99, 98, 0, 45, ! 0, 303, 0, 307, 0, 309, 0, 0, 390, 0, ! 159, 157, 0, 190, 44, 0, 0, 0, 469, 512, ! 396, 0, 544, 473, 434, 447, 455, 0, 0, 439, ! 444, 0, 0, 0, 0, 0, 411, 397, 128, 128, ! 409, 0, 398, 400, 408, 0, 244, 317, 0, 118, ! 113, 117, 0, 180, 231, 227, 172, 232, 21, 179, ! 228, 230, 0, 25, 0, 256, 336, 274, 336, 282, ! 0, 260, 0, 0, 270, 0, 269, 327, 319, 95, ! 63, 62, 0, 563, 565, 0, 562, 567, 566, 54, ! 56, 0, 0, 81, 79, 96, 97, 302, 301, 391, ! 308, 310, 304, 306, 0, 187, 189, 89, 0, 0, ! 491, 511, 128, 0, 500, 496, 498, 0, 0, 514, ! 398, 0, 0, 431, 476, 442, 0, 430, 485, 488, ! 479, 0, 128, 128, 481, 478, 455, 454, 452, 453, ! 437, 455, 460, 457, 128, 128, 0, 446, 176, 395, ! 295, 295, 392, 393, 0, 410, 0, 0, 30, 324, ! 114, 128, 128, 145, 0, 0, 177, 229, 0, 276, ! 277, 283, 337, 279, 183, 183, 292, 289, 183, 0, ! 0, 0, 320, 321, 0, 0, 547, 0, 548, 549, ! 83, 86, 305, 192, 0, 194, 545, 493, 504, 295, ! 505, 501, 502, 470, 0, 474, 455, 0, 476, 427, ! 0, 0, 175, 0, 0, 0, 480, 0, 0, 461, ! 461, 456, 240, 299, 390, 129, 183, 183, 183, 299, ! 129, 183, 183, 0, 399, 401, 412, 325, 121, 0, ! 122, 0, 145, 143, 202, 200, 199, 181, 22, 0, ! 26, 336, 0, 255, 259, 265, 183, 413, 0, 0, ! 0, 336, 0, 0, 125, 337, 312, 322, 215, 89, ! 0, 212, 0, 214, 0, 267, 205, 211, 0, 0, ! 551, 553, 0, 558, 0, 550, 0, 0, 183, 183, ! 183, 0, 506, 543, 0, 435, 0, 476, 486, 489, ! 482, 440, 0, 464, 458, 462, 459, 303, 0, 407, ! 0, 402, 403, 404, 303, 0, 405, 406, 394, 0, ! 0, 144, 147, 146, 0, 178, 284, 0, 183, 263, ! 323, 0, 329, 127, 126, 316, 0, 330, 314, 337, ! 313, 0, 218, 0, 209, 64, 0, 204, 0, 217, ! 208, 552, 84, 193, 508, 509, 510, 503, 295, 432, ! 443, 0, 0, 0, 466, 0, 0, 238, 239, 235, ! 237, 0, 119, 120, 0, 183, 0, 285, 414, 328, ! 0, 162, 0, 350, 334, 0, 0, 0, 0, 0, ! 0, 0, 0, 379, 447, 447, 371, 0, 0, 123, ! 128, 128, 343, 348, 0, 0, 340, 341, 344, 372, ! 342, 0, 0, 0, 206, 207, 507, 476, 428, 484, ! 483, 487, 490, 465, 463, 236, 201, 287, 183, 0, ! 0, 336, 381, 0, 0, 377, 361, 362, 363, 0, ! 0, 0, 380, 0, 183, 345, 134, 0, 135, 0, ! 0, 332, 337, 331, 354, 0, 136, 213, 210, 0, ! 286, 0, 0, 0, 382, 48, 0, 0, 0, 375, ! 364, 0, 369, 0, 378, 0, 132, 219, 0, 133, ! 222, 349, 336, 0, 0, 433, 333, 0, 335, 373, ! 355, 359, 0, 370, 0, 130, 0, 131, 0, 347, ! 338, 336, 0, 351, 336, 381, 336, 376, 383, 0, ! 220, 223, 339, 353, 336, 374, 0, 360, 0, 0, ! 384, 385, 365, 0, 0, 352, 356, 0, 383, 0, ! 0, 221, 224, 381, 0, 0, 366, 386, 0, 387, ! 0, 0, 357, 388, 0, 367, 336, 0, 0, 358, ! 368, 389, 0, 0, 0 }; ! static const short yydefgoto[] = { 953, ! 1, 2, 3, 28, 29, 30, 336, 566, 342, 569, ! 198, 449, 673, 122, 232, 399, 124, 125, 126, 127, ! 128, 585, 129, 384, 383, 381, 687, 382, 130, 233, ! 131, 132, 323, 324, 325, 561, 661, 662, 31, 193, ! 800, 439, 91, 562, 644, 440, 34, 140, 279, 35, ! 216, 204, 78, 199, 205, 650, 79, 565, 328, 329, ! 37, 288, 289, 290, 648, 725, 675, 676, 677, 814, ! 678, 744, 679, 680, 877, 897, 924, 880, 899, 925, ! 315, 208, 689, 209, 38, 39, 40, 41, 351, 353, ! 358, 225, 748, 476, 220, 221, 348, 571, 572, 356, ! 357, 142, 691, 143, 189, 278, 663, 664, 737, 326, ! 479, 582, 583, 584, 559, 362, 560, 804, 805, 806, ! 832, 853, 453, 854, 667, 807, 808, 883, 831, 915, ! 906, 934, 947, 907, 809, 810, 905, 811, 844, 867, ! 920, 921, 922, 945, 404, 405, 441, 634, 442, 443, ! 444, 318, 319, 445, 446, 659, 133, 43, 64, 44, ! 45, 46, 427, 698, 305, 607, 818, 525, 308, 537, ! 609, 47, 309, 69, 48, 432, 542, 433, 547, 705, ! 706, 49, 65, 295, 519, 66, 301, 523, 428, 429, ! 535, 616, 822, 536, 611, 763, 612, 764, 173, 419, ! 516, 517, 518, 692, 693, 297, 421, 174, 175, 176, ! 177, 178, 588, 589, 682, 590, 367, 134, 235, 483, ! 370, 371, 372, 135, 136, 137 }; ! static const short yypact[] = { 109, ! 118, 3183, 3183, 412,-32768,-32768,-32768,-32768, 91, 91, ! 91, 65, 100, 136,-32768, 270,-32768,-32768, 270, 270, ! -32768, 132, 270, 132, 270, 270,-32768,-32768,-32768,-32768, ! 103, 128, 699, 378,-32768, 91,-32768, 119, 131, 203, ! -32768, 3183,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768, 91, 91, 91, 2892, 2730, 155,-32768,-32768, ! -32768,-32768,-32768, 68, 3447, 3447, 70, 61,-32768,-32768, ! 132,-32768, 112, 270,-32768,-32768, 103, 167,-32768, 91, ! 1306,-32768, 434,-32768, 103, 378,-32768, 91,-32768,-32768, ! 900,-32768, 160, 153, 160, 159,-32768, 175,-32768,-32768, ! -32768,-32768,-32768,-32768, 2892, 2892, 270,-32768,-32768,-32768, ! 2892,-32768,-32768, 1480,-32768, 195, 231, 239,-32768,-32768, ! -32768, 2892, 216, 225,-32768, 2946, 3000,-32768, 3714, 1127, ! 315, 255, 2892,-32768,-32768,-32768,-32768,-32768, 251, 418, ! -32768, 279, 2078, 314,-32768, 270,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 292, ! 3610,-32768,-32768,-32768, 2624, 327,-32768,-32768,-32768, 270, ! 270, 286, 270, 270,-32768,-32768,-32768, 321, 252, 301, ! -32768, 434, 103,-32768, 319,-32768, 2093, 744, 91,-32768, ! -32768, 434,-32768, 188,-32768, 91, 1969, 422, 471, 259, ! 1950, 900,-32768,-32768,-32768,-32768, 91,-32768, 332, 340, ! 1881,-32768, 347,-32768, 227,-32768,-32768,-32768,-32768,-32768, ! 357, 359, 338, 368, 2784, 3475, 3610, 270,-32768, 377, ! 2892, 1480,-32768, 1480,-32768, 2892, 2892, 408,-32768,-32768, ! 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, 2892, ! 2892, 2892,-32768,-32768, 270, 270, 2892, 2892,-32768,-32768, ! -32768,-32768,-32768, 418, 2152, 91,-32768, 481, 708,-32768, ! -32768,-32768,-32768,-32768,-32768,-32768,-32768, 22,-32768, 411, ! -32768, 3610,-32768, 391, 402, 491,-32768, 327,-32768, 404, ! 402, 132, 433,-32768, 449, 441, 439,-32768, 449,-32768, ! -32768, 471,-32768,-32768, 518, 471, 538,-32768, 3336,-32768, ! 467, 483,-32768, 1021, 82,-32768,-32768, 536, 91, 386, ! 350,-32768, 434, 434,-32768, 744, 91,-32768, 2211,-32768, ! -32768, 744, 520, 91,-32768,-32768, 475, 502, 1385, 3385, ! 160, 91, 160,-32768, 560, 523,-32768, 227,-32768,-32768, ! -32768, 540, 525, 2544,-32768,-32768,-32768,-32768, 578, 544, ! 3475,-32768, 562, 565,-32768, 3714, 569, 570, 3714, 3714, ! 2892, 604, 2892, 2892, 1690, 1278, 969, 958, 1297, 563, ! 563, 533, 533,-32768,-32768,-32768,-32768,-32768, 571, 225, ! 577, 369, 355,-32768, 3355,-32768, 579, 418,-32768, 2270, ! -32768, 708, 580, 314, 3054, 588, 3511, 2048,-32768,-32768, ! 3568, 3610,-32768,-32768, 583, 132,-32768, 590, 3258,-32768, ! -32768, 457, 3131, 608, 75, 591,-32768,-32768,-32768, 3614, ! -32768, 596, 276,-32768,-32768, 232,-32768,-32768, 90,-32768, ! -32768,-32768, 848,-32768, 422,-32768,-32768, 422,-32768, 637, ! -32768,-32768, 593,-32768, 601,-32768,-32768,-32768,-32768,-32768, ! 600,-32768, 602, 2892, 270, 603, 523,-32768, 650,-32768, ! -32768,-32768, 3539,-32768,-32768, 578,-32768,-32768,-32768,-32768, ! -32768, 646, 2892, 1612, 996,-32768,-32768, 481,-32768,-32768, ! -32768, 481,-32768,-32768, 612,-32768,-32768, 234, 609, 270, ! -32768, 2624, 610, 2663,-32768,-32768, 3614, 2067, 90,-32768, ! 618, 624, 90,-32768, 449,-32768, 530,-32768,-32768,-32768, ! -32768, 103, 128, 699, 450,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768,-32768,-32768,-32768, 3644, 631,-32768,-32768,-32768, ! 573, 344,-32768,-32768, 3580,-32768, 706, 338,-32768,-32768, ! -32768, 640, 550,-32768, 1795, 90,-32768,-32768, 90,-32768, ! 629,-32768,-32768, 629, 91, 91, 3714,-32768, 91, 641, ! 270, 1056, 650,-32768, 1560, 2892, 685, 643, 3539,-32768, ! -32768, 1533,-32768,-32768, 2892,-32768,-32768,-32768,-32768, 573, ! -32768,-32768,-32768,-32768, 270,-32768,-32768, 661, 449,-32768, ! 3447, 3447, 245, 434, 103, 3286,-32768, 561, 3149, 284, ! 284,-32768,-32768,-32768, 344, 91, 202, 220, 91,-32768, ! 91, 220, 91, 3355,-32768,-32768,-32768,-32768,-32768, 434, ! -32768, 103,-32768, 796,-32768,-32768, 3714,-32768,-32768, 1795, ! -32768,-32768, 436,-32768,-32768,-32768, 91,-32768, 285, 512, ! 920, 652, 653, 1140,-32768,-32768,-32768,-32768,-32768, 694, ! 270,-32768, 695, 3714, 656, 654,-32768,-32768, 80, 1720, ! 225,-32768, 2892,-32768, 685,-32768, 2892, 250, 202, 220, ! 91, 294,-32768,-32768, 581,-32768, 675, 449,-32768,-32768, ! -32768,-32768, 2892, 702, 662,-32768, 662, 633, 573,-32768, ! 2329,-32768,-32768,-32768, 342, 344,-32768,-32768,-32768, 336, ! 426, 796,-32768,-32768, 1560,-32768,-32768, 2892, 89,-32768, ! -32768, 270,-32768,-32768,-32768,-32768, 664,-32768,-32768,-32768, ! -32768, 2410,-32768, 1560,-32768,-32768, 1640,-32768, 1870,-32768, ! -32768,-32768, 1533,-32768,-32768,-32768,-32768,-32768, 573,-32768, ! -32768, 683, 81, 81, 3714, 2892, 284, 566, 566,-32768, ! -32768, 669,-32768,-32768, 677, 3678, 2892,-32768,-32768,-32768, ! 2490, 715, 700,-32768,-32768, 701, 705, 2892, 727, 691, ! 707, 2838, 170, 780, 222, 233,-32768, 750, 716,-32768, ! 717, 3366,-32768, 776, 1220, 87,-32768,-32768,-32768,-32768, ! -32768, 2652, 720, 1870,-32768,-32768,-32768, 449,-32768,-32768, ! -32768,-32768,-32768, 3714,-32768,-32768,-32768,-32768, 3678, 2892, ! 736,-32768, 2892, 2892, 3655,-32768,-32768,-32768,-32768, 722, ! 2892, 729,-32768, 753, 91,-32768,-32768, 434,-32768, 103, ! 1400,-32768,-32768,-32768,-32768, 2892,-32768,-32768,-32768, 751, ! -32768, 739, 2892, 802,-32768, 787, 743, 746, 2892,-32768, ! -32768, 748,-32768, 2892,-32768, 447,-32768, 172, 462,-32768, ! 461,-32768,-32768, 2490, 747,-32768,-32768, 754,-32768,-32768, ! -32768,-32768, 3696,-32768, 64,-32768, 744,-32768, 744,-32768, ! -32768,-32768, 752,-32768,-32768, 2892,-32768,-32768, 818, 756, ! -32768,-32768,-32768,-32768,-32768,-32768, 760,-32768, 779, 79, ! 762,-32768,-32768, 338, 338,-32768,-32768, 2892, 818, 771, ! 818,-32768,-32768, 2892, 775, 162,-32768,-32768, 781,-32768, ! 538, 782,-32768, 315, 257,-32768,-32768, 788, 538,-32768, ! -32768, 315, 858, 867,-32768 }; static const short yypgoto[] = {-32768, ! -32768,-32768,-32768, 83, -371,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768, -14,-32768, -56, 453, -228, 508,-32768,-32768, ! -32,-32768, 628,-32768,-32768,-32768,-32768,-32768, 38,-32768, ! -297,-32768, -305, 548,-32768,-32768, 215,-32768, 3, -166, ! 88, 5, 804,-32768, 249, 12, -29, -170, 613, 47, ! -249, -572, -69, -189, -111,-32768,-32768,-32768, 207, 54, ! 17,-32768, 480,-32768, 253,-32768, -630,-32768, 152,-32768, ! -605,-32768,-32768, 229,-32768,-32768,-32768,-32768,-32768,-32768, ! -51, -113, -482, -18,-32768,-32768,-32768, -64,-32768,-32768, ! -32768,-32768,-32768, 424, -50,-32768, 559, 442, 258, 558, ! 443, -59, -99, -169, -173, -198, 260,-32768,-32768, -282, ! -32768,-32768,-32768, 334, -412,-32768, -223,-32768,-32768,-32768, ! -32768, -160, -524, -755, 288,-32768, 35,-32768,-32768,-32768, ! -32768,-32768,-32768,-32768,-32768,-32768,-32768, 71,-32768, -738, ! 27,-32768, 26,-32768, 549,-32768, -357,-32768, 541, 543, ! 406, -304,-32768,-32768,-32768,-32768, 19,-32768, 934,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, ! -32768,-32768,-32768, -21, -5, -349,-32768, 425,-32768, 345, ! 204,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -286,-32768, ! -32768,-32768, 208, 438,-32768,-32768,-32768,-32768, -37, 676, ! -32768,-32768, 459,-32768, 219, 469,-32768, 568, 572, -142, ! -32768, -132,-32768,-32768, 299, 399,-32768,-32768,-32768,-32768, ! -32768,-32768, 619,-32768,-32768,-32768 }; ! #define YYLAST 3766 static const short yytable[] = { 123, ! 139, 63, 72, 86, 67, 68, 32, 32, 71, 363, ! 63, 74, 81, 33, 33, 210, 70, 337, 70, 435, ! 42, 42, 434, 94, 96, 98, 218, 330, 179, 411, ! 459, 207, 298, 461, 83, 85, 464, 327, 400, 334, ! 277, 450, 299, 283, 223, 182, 32, 500, 653, 186, ! 347, 349, 92, 33, 234, 36, 36, 531, 190, 188, ! 42, 70, 53, 54, 55, 70, 211, 720, 627, 92, ! 92, 92, 227, 228, 751, 403, 864, 527, 230, 87, ! 314, 820, -112, 269, 80, 50, 88, 855, 331, 239, ! 558, 451, 229, 369, 775, 36, 92, 413, 183, 402, ! 271, 909, 414, 141, 92, 75, 604, 180, -1, 408, ! 606, 294, 145, 813, 16, 749, 929, -2, 14, 184, ! 14, 59, 60, 56, 99, 337, 777, 900, 181, 287, ! 80, 291, 14, 59, 60, 515, 206, 671, 80, 910, ! 321, 742, 185, 816, 217, 856, 913, 218, 146, 916, ! 549, 918, 76, 649, 930, 293, 651, 821, 57, 926, ! 141, 77, 411, -112, 327, 302, 303, 917, 306, 307, ! 312, 361, 59, 60, 316, 327, 16, 373, 366, 347, ! 349, 327, 377, 190, 378, 61, 400, 618, 187, 282, ! 62, 950, 146, 276, 58, 939, 276, 61, 195, 941, ! 93, -175, 62, 498, 82, 59, 60, -175, 859, 502, ! 355, 401, 95, 144, 218, 781, 455, 141, 407, 841, ! 458, 457, 92, 374, 219, 768, 769, 354, 486, 59, ! 60, 14, 416, 92, 222, 603, 61, 942, 608, 350, ! 224, 62, 80, 191, 701, 206, 80, 192, -175, 14, ! 397, 398, -175, 236, 75, 206, 226, 695, 311, -35, ! 710, 711, 545, 546, 332, 217, 16, 141, 333, 61, ! -34, 195, 59, 60, 62, 876, 719, 16, 196, 197, ! 425, 14, 463, 141, 97, 423, 75, 200, 141, 237, ! 141, 240, 92, 61, 59, 60, 70, 238, 62, 665, ! 471, 76, 473, 196, 197, 241, 573, 556, 573, 594, ! 77, 312, 557, 14, 595, 316, 59, 60, 284, 285, ! 286, 703, 697, 269, 492, 754, 272, 276, 884, 270, ! 241, 482, 948, 201, 638, 340, 61, 949, 141, 192, ! 587, 62, 202, 355, 75, 92, 75, 218, 311, 467, ! 292, 469, 554, 505, 280, 203, 555, 681, 61, 196, ! 197, 731, 522, 62, 300, 732, 688, 304, 350, 298, ! 758, 14, 36, 14, 759, 311, 313, 317, 734, 299, ! 61, 739, 89, 206, 90, 62, 206, 206, 75, 200, ! 343, 630, 311, 630, 724, 282, 141, 310, 14, 287, ! 625, 275, 625, 275, 526, 770, 59, 60, 338, 339, ! 86, 762, 773, 409, 410, 14, 333, 344, 273, 361, ! 70, 666, 513, 563, 352, 456, 403, 274, 275, 514, ! 499, 532, 359, 533, 360, 201, 75, 200, 75, 200, ! 534, 551, 552, 364, 202, -85, 685, 14, 545, 546, ! 708, 629, 633, 375, 681, 276, 715, 203, 36, 709, ! 355, 276, 422, 14, 716, 14, 417, 273, 141, 415, ! 61, 36, 724, 728, 36, 62, 274, 275, 418, 141, ! 338, 339, 36, 201, 86, 201, 87, 195, 51, 52, ! -175, 573, 202, 88, 202, 597, -175, 529, 530, 564, ! 420, 666, 774, 740, 86, 203, 192, 203, 426, 498, ! 502, -475, -477, 613, 431, 600, 498, 502, 803, 196, ! 197, 513, 430, 896, 538, 539, 540, 333, 514, 196, ! 197, 860, 628, 632, 541, 614, 615, -175, 898, 409, ! 410, -175, 192, 460, 195, 210, 102, 620, 621, 447, ! 466, -278, -278, 5, 89, 7, 90, 803, 472, 448, ! 87, 9, 10, 11, 640, 642, 658, 88, 704, 704, ! 36, 454, 721, 699, 700, 75, 623, 13, 468, 218, ! 87, 690, 260, 261, 262, 80, 465, 88, 448, 733, ! 694, 911, 282, 912, 16, 474, 613, 538, 539, 540, ! 480, 729, 14, 475, 626, 631, 190, 610, 36, 643, ! 258, 259, 260, 261, 262, 484, 22, 478, 532, 485, ! 533, 24, 624, 613, 710, 711, 641, 534, 538, 539, ! 540, 625, 275, 243, 245, 75, 623, 488, 702, 311, ! 489, 493, 92, 944, 490, 491, 496, 92, 538, 539, ! 540, 952, 528, 626, 772, 506, 743, 218, 760, 497, ! 803, 501, 14, 510, 524, 141, 550, 206, 80, 36, ! 548, 553, 567, 206, 206, 568, 570, 575, 631, 576, ! 579, 581, 624, 591, 596, 799, 599, 36, 337, 312, ! 316, 625, 275, 206, 593, 80, 312, 316, 555, 605, ! 932, 933, 5, 6, 7, 8, 206, 622, 637, 652, ! 9, 10, 11, 214, 215, 704, 639, 779, 657, 9, ! 10, 11, 683, 696, 799, 684, 13, 798, 14, -315, ! 738, -32, 745, 746, 747, 840, 327, 761, 327, 766, ! 690, 780, 767, 16, 322, 819, 801, -336, -336, -336, ! -336, 826, -33, 802, 827, -336, -336, -336, 830, 833, ! 812, 626, 626, 834, 836, 22, 798, 837, 631, 631, ! 24, -336, 86, 862, 72, 84, 865, 868, 842, 271, ! 879, 654, 655, 838, 872, 656, 843, 845, -336, 70, ! 70, 851, 846, 847, 863, 36, 878, 858, 871, 885, ! 723, 214, 215, 848, 850, 873, 888, 9, 10, 11, ! -336, 874, 626, 886, 887, -336, 801, 895, 889, 891, ! 206, 892, 903, 802, 894, -111, 919, 799, 914, 904, ! 812, 881, 923, 712, 713, 714, 927, 928, 717, 718, ! 263, 264, 931, 265, 266, 267, 268, 937, 87, 865, ! 940, 5, 6, 7, 8, 88, 943, 954, 946, 9, ! 10, 11, 890, 730, 951, 36, 955, 509, 376, 798, ! 866, 935, 452, 379, 380, 13, 735, 865, 385, 386, ! 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, ! 212, 722, 16, 507, 412, 755, 756, 757, 815, 857, ! 580, 206, 726, 80, 213, 214, 215, 750, 470, 727, ! 574, 9, 10, 11, 22, 477, 668, 578, 901, 24, ! 322, 736, -124, -124, -124, -124, -124, -124, -124, 14, ! -124, -124, -124, -124, -124, 778, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, ! -124, 741, -124, -124, 902, 936, 938, 503, 73, -124, ! 636, 520, -124, 521, -124, 707, 619, -124, -124, -124, ! 825, 823, 617, -124, -124, 602, 424, 817, -124, -124, ! 598, 752, 828, -124, 511, -124, -124, 686, 512, 487, ! -124, -124, 0, 0, -124, 0, -124, -124, -124, -124, ! 0, -124, 255, 256, 257, 258, 259, 260, 261, 262, ! 494, 495, 254, 255, 256, 257, 258, 259, 260, 261, ! 262, 322, 0, 0, -115, -115, -115, -115, 0, 0, ! -115, 0, -115, -115, -115, 861, 251, 252, 253, 254, ! 255, 256, 257, 258, 259, 260, 261, 262, -115, 0, ! 0, 875, 0, 0, 0, 0, 660, 0, -336, -336, ! -336, -336, -336, -336, -336, -115, -336, -336, -336, -336, ! -336, 0, -336, -336, -336, -336, -336, -336, -336, -336, ! -336, -336, -336, -336, -336, -336, -336, -115, -336, -336, ! 0, 0, -115, 0, 0, -336, 0, 0, -336, 0, ! -336, 577, -115, -336, -336, -336, 0, 0, 0, -336, ! -336, 0, 0, 0, -336, -336, 0, 0, 0, -336, ! 592, -336, -336, 0, 0, 0, -336, -336, 0, 0, ! -336, 0, -336, 0, -336, -336, 0, -336, 0, 0, ! 322, 0, -336, -336, 0, 0, 0, -336, -336, 0, ! -336, 0, 0, 0, -336, 0, -336, -336, -336, -336, ! -336, -336, -336, -336, -336, -336, -336, 0, -336, 0, ! -336, 0, -336, -336, 0, 0, 0, 0, 0, -336, ! 263, 264, -336, 265, 266, 267, 268, -336, -336, -336, ! 0, 0, 647, -336, -336, 0, 0, 0, -336, -336, ! 0, 0, 0, -336, 0, -336, -336, 0, 0, 0, ! -336, -336, 674, 0, -336, 0, -336, -311, -336, -336, ! 852, -336, -336, -336, 0, 0, 0, -336, -336, 0, ! -336, 0, 0, 0, -336, 0, -336, -336, -336, -336, ! -336, -336, -336, -336, -336, -336, -336, 0, -336, 0, ! -336, 0, -336, -336, 0, 0, 0, 0, 0, -336, ! 0, 0, -336, 0, 0, 0, 0, -336, -336, -336, ! 0, 0, 0, -336, -336, 0, 0, 647, -336, -336, ! 0, 0, 0, -336, 0, -336, -336, 0, 0, 0, ! -336, -336, 0, 0, -336, 0, -336, 0, -336, -336, ! 0, -336, 0, 0, 0, 0, 194, 674, 0, -28, ! -28, -28, -28, 0, 753, 0, 0, -28, -28, -28, ! 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, ! 765, 0, 195, -28, 0, -175, 0, 0, 0, 0, ! 0, -175, 256, 257, 258, 259, 260, 261, 262, 0, ! -28, 0, 674, 0, 0, 776, 0, 0, 0, 0, ! 0, 0, 0, 0, 196, 197, 0, 0, 0, 0, ! 0, 674, -28, 0, 674, 0, 674, -28, 0, 0, ! 0, 0, -175, 0, 0, 0, -175, -28, 5, 0, ! 7, 281, 0, 824, 0, 0, 9, 10, 11, 0, ! 882, 0, -346, -346, 829, 0, 0, -346, -346, 0, ! -346, 0, 13, 0, -346, 835, -346, -346, -346, -346, ! -346, -346, -346, -346, -346, -346, -346, 0, -346, 16, ! -346, 0, -346, -346, 0, 0, 0, 0, 0, -346, ! 0, 674, -346, 0, 0, 0, 0, -346, -346, -346, ! 0, 22, 0, -346, -346, 0, 24, 0, -346, -346, ! 0, -280, -280, -346, 0, -346, -346, 0, 0, 0, ! -346, -346, 0, 0, -346, 0, -346, 0, -346, -346, ! 231, -346, 100, 5, 0, 7, 138, 101, 102, 0, ! 103, 9, 10, 11, 0, 0, 893, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 13, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 16, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, 0, 0, 116, 0, 117, 22, 0, 0, 0, 118, 24, 0, 0, 119, 0, 0, 0, 120, 121, ! 669, -94, 670, 60, 0, 0, 0, 101, 102, 248, 103, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 0, 671, 114, 115, 0, 0, 0, 116, 0, 117, 61, 0, 0, 0, 118, 62, 0, 0, 119, 0, 0, -203, 120, 121, ! 669, 672, 670, 60, 0, 0, 0, 101, 102, 0, ! 103, 250, 251, 252, 253, 254, 255, 256, 257, 258, ! 259, 260, 261, 262, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 0, 671, 114, 115, 0, 0, 0, 116, 0, 117, 61, 0, 0, 0, ! 118, 62, 0, 0, 119, 0, 0, -268, 120, 121, ! 669, 672, 100, 0, 0, 0, 0, 101, 102, 0, 103, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 0, 0, 0, 0, 0, 0, 104, 0, ! 15, 0, 105, 106, 0, -216, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 0, -216, 114, 115, ! 0, 0, 0, 116, 0, 117, 0, 0, 0, 0, ! 118, 0, 0, 0, 119, 645, 0, 100, 120, 121, ! 0, 672, 101, 102, 0, 103, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, ! 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, ! 0, 0, 0, 114, 115, 0, 0, 0, 116, 0, 117, 0, 0, 0, 0, 118, 0, 0, 0, 119, ! 669, 0, 100, 120, 121, 0, 646, 101, 102, 0, ! 103, 345, 0, 0, 5, 0, 7, 138, 0, 0, ! 0, 0, 9, 10, 11, 0, 0, 0, 104, 0, ! 15, 0, 105, 106, 0, 0, 0, 0, 13, 107, ! 0, 15, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 16, 0, 0, 114, 115, ! 0, 0, 0, 116, 0, 117, 0, 0, 0, 0, ! 118, 0, 0, 0, 119, 0, 0, 22, 120, 121, ! 341, 672, 24, -24, -24, -24, -24, 346, -271, 0, ! 0, -24, -24, -24, 0, 0, 0, 0, 0, 335, ! 0, 0, -20, -20, -20, -20, 195, -24, 0, -175, ! -20, -20, -20, 0, 0, -175, 0, 0, 0, 0, ! 0, 0, 0, 0, -24, 195, -20, 0, -175, 0, ! 0, 0, 0, 0, -175, 0, 0, 0, 196, 197, ! 0, 0, 0, -20, 0, 0, -24, 0, 0, 0, ! 0, -24, 0, 0, 0, 0, -175, 0, 0, 0, ! -175, -24, 0, 0, 0, -20, 0, 0, 0, 0, ! -20, 0, 0, 0, 0, -175, 0, 0, 322, -175, ! -20, 5, 6, 7, 8, 0, 0, 0, 0, 9, ! 10, 11, 0, 0, 0, 0, 0, 322, 0, 0, ! -499, -499, -499, -499, 0, 13, 0, 14, -499, -499, ! -499, 5, 0, 7, 281, 0, 0, 0, 0, 9, ! 10, 11, 16, 0, -499, 100, -499, 0, 0, 0, ! 101, 102, 0, 103, 0, 13, 0, 14, 0, 0, ! 0, -499, 0, 0, 22, 0, 0, 0, 0, 24, ! 0, 104, 16, 15, 0, 105, 106, 273, 0, -497, ! 0, 0, 107, -499, 0, 108, 274, 275, -499, 0, ! 109, 110, 111, 0, 22, 0, 112, 113, -499, 24, ! 0, 114, 115, 0, 100, 0, 116, 0, 117, 101, ! 102, 0, 103, 118, 0, 0, 0, 119, 0, 0, ! 0, 120, 121, 0, 0, 320, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, ! 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, ! 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, 100, 0, 116, 0, 117, 101, 102, 0, 103, 118, 0, 0, 0, 119, 0, 0, 0, ! 120, 121, 0, 0, 406, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, 100, 0, 116, 0, 117, 101, 102, 0, 103, 118, 0, 0, 0, 119, 0, 0, 0, 120, ! 121, 0, 0, 462, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, 100, 0, 116, 0, 117, 101, 102, 0, 103, 118, 0, 0, 0, 119, 0, 0, 0, 120, 121, ! 0, 0, 504, 0, 0, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, 0, ! 0, 0, 116, 0, 117, 0, 0, 0, 0, 118, 0, 0, 0, 119, 0, 0, 0, 120, 121, 0, ! 0, 771, 670, 782, 6, 7, 8, 101, 102, 0, ! 103, 9, 10, 11, 783, 0, 784, 785, 786, 787, ! 788, 789, 790, 791, 792, 793, 794, 13, 104, 14, ! 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, ! 0, 0, 108, 0, 16, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 0, 0, 114, 115, ! 0, 0, 0, 116, 0, 117, 795, 0, 0, 0, ! 118, 796, 0, 0, 119, 0, 797, 0, 120, 121, ! 0, 361, 670, 60, 0, 0, 0, 101, 102, 0, ! 103, 0, 0, 0, 783, 0, 784, 785, 786, 787, ! 788, 789, 790, 791, 792, 793, 794, 0, 104, 0, ! 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, ! 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 100, 0, 114, 115, ! 0, 101, 102, 116, 103, 117, 61, 0, 0, 0, ! 118, 62, 0, 0, 119, 0, 797, 0, 120, 121, ! 0, 361, 104, 0, 15, 0, 105, 106, 0, 0, ! 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, ! 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, ! 0, 0, 114, 115, 0, 0, 0, 116, 0, 117, ! 0, 0, 0, 0, 118, 0, 0, 0, 119, 0, ! 0, 0, 120, 121, 0, 481, 147, 148, 0, 149, ! 150, 0, 0, 0, 151, 152, 153, 154, 155, 156, ! 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, ! 167, 168, 169, 0, 100, 5, 6, 7, 8, 101, ! 102, 170, 103, 9, 10, 11, 5, 6, 7, 8, ! 0, 0, 0, 0, 9, 10, 11, 0, 0, 13, ! 104, 14, 15, 0, 105, 106, 0, 0, 0, 0, ! 13, 107, 14, 0, 108, 172, 16, 0, 0, 109, ! 110, 111, 0, 0, 296, 112, 113, 16, 0, 0, ! 114, 115, 0, 0, 0, 116, 0, 117, 22, 0, ! 0, 0, 118, 24, 0, 0, 119, 0, 0, 22, ! 120, 121, 100, 5, 24, 7, 138, 101, 102, 601, ! 103, 9, 10, 11, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 13, 104, 0, ! 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, ! 0, 0, 108, 0, 16, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 100, 0, 114, 115, ! 0, 101, 102, 116, 103, 117, 22, 0, 0, 0, ! 118, 24, 0, 0, 119, 0, 0, 0, 120, 121, ! 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, ! 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, ! 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, ! 100, 0, 114, 115, 0, 101, 102, 116, 103, 117, ! 365, 0, 0, 0, 118, 0, 0, 0, 119, 0, ! 0, 0, 120, 121, 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, 0, 0, ! 0, 112, 113, 0, 100, 0, 114, 115, 0, 101, ! 102, 116, 103, 117, 0, 0, 0, 0, 118, 0, ! 0, 0, 119, 0, 839, 0, 120, 121, 0, 0, ! 104, 0, 15, 0, 105, 106, 0, 0, 0, 0, ! 0, 107, 0, 0, 108, 0, 0, 0, 0, 109, ! 110, 111, 0, 0, 0, 112, 113, 0, 100, 0, ! 114, 115, 0, 101, 102, 116, 103, 117, 0, 0, ! 0, 0, 118, 0, 0, 0, 119, 0, 0, 0, ! 120, 121, 0, 0, 104, 0, 15, 0, 105, 106, ! 0, 0, 0, 0, 0, 107, 0, 0, 108, 0, ! 0, 0, 0, 109, 110, 111, 0, 0, 0, 112, ! 113, 0, 100, 0, 242, 115, 0, 101, 102, 116, ! 103, 117, 0, 0, 0, 0, 118, 0, 0, 0, ! 119, 0, 0, 0, 120, 121, 0, 0, 104, 0, ! 15, 0, 105, 106, 0, 0, 0, 0, 0, 107, ! 0, 0, 108, 0, 0, 0, 0, 109, 110, 111, ! 0, 0, 0, 112, 113, 0, 508, 0, 244, 115, ! 0, 101, 102, 116, 103, 117, 0, 0, 0, 0, ! 118, 0, 0, 0, 119, 0, 0, 0, 120, 121, ! 0, 0, 104, 0, 15, 0, 105, 106, 0, 0, ! 0, 0, 0, 107, 0, 0, 108, 0, 0, 0, ! 0, 109, 110, 111, 0, 0, 0, 112, 113, 0, ! 0, 0, 114, 115, 0, 0, 0, 116, 0, 117, ! 0, 0, 0, 0, 118, 0, 0, 0, 119, 0, ! 0, 543, 120, 121, 5, 0, 7, 138, 0, 0, ! 0, 0, 9, 10, 11, 0, 0, 0, 0, 543, ! 0, 0, 5, 0, 7, 138, 0, 0, 13, 0, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 16, 13, 0, 0, 0, ! 0, 0, 0, 4, 0, -128, 5, 6, 7, 8, ! 0, 0, 0, 16, 9, 10, 11, 22, -451, -451, ! -451, 0, 24, 0, 0, 0, 0, 544, -451, 12, ! 13, 0, 14, 15, 0, 22, -450, -450, -450, 0, ! 24, 0, 0, 0, 0, 544, -450, 16, 0, 0, ! 17, 18, -128, 0, 0, 0, 0, 0, 0, 0, ! 0, -128, 0, 19, 20, 21, 0, 0, 0, 22, ! 0, 0, 0, 23, 24, 25, 26, 0, 4, 27, ! -128, 5, 6, 7, 8, 0, 0, 0, 0, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 13, 4, 14, -128, 5, ! 6, 7, 8, 0, 0, 0, 0, 9, 10, 11, ! 0, 0, 16, 0, 0, 529, 530, -128, 0, 0, ! 0, 0, 0, 13, 0, 14, -128, 0, 0, 0, ! 0, 0, 0, 0, 22, 0, 0, 0, 0, 24, ! 16, 0, 0, 0, 27, -128, 436, 0, 437, 5, ! 6, 7, 8, 0, -128, 438, 0, 9, 10, 11, ! 0, 0, 22, 0, 0, 436, 0, 24, 5, 6, ! 7, 8, 27, 13, 438, 14, 9, 10, 11, 5, ! 6, 7, 8, 0, 0, 0, 0, 9, 10, 11, ! 16, 0, 13, 0, 14, 345, 0, 0, 5, 0, ! 7, 138, 0, 13, 0, 14, 9, 10, 11, 16, ! 0, 0, 22, 0, 0, 0, 0, 24, 0, 0, ! 16, -396, 13, 0, 0, 15, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 24, 0, 0, 16, ! -396, 0, 22, 0, 0, 0, 0, 24, 0, 0, ! 0, 0, 849, 0, 0, 0, 0, 0, 0, 147, ! 148, 22, 149, 150, 0, 0, 24, 151, 152, 153, ! 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, ! 164, 165, 166, 167, 168, 169, 0, 147, 148, 0, ! 149, 150, 0, 0, 170, 151, 152, 153, 154, 155, ! 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, ! 166, 167, 168, 169, 0, 171, 0, 0, 0, 0, ! 0, 0, 368, 147, 148, 0, 149, 150, 172, 0, ! 0, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, ! 0, 147, 148, 0, 149, 150, 172, 0, 170, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, ! 162, 163, 164, 165, 166, 167, 168, 169, 0, 0, ! 0, 5, 6, 7, 8, 0, 586, 438, 0, 9, ! 10, 11, 172, 5, 6, 7, 8, 0, 0, 635, ! 0, 9, 10, 11, 0, 13, 0, 14, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 13, 0, 14, ! 172, 0, 16, 5, 0, 7, 138, 5, 6, 7, ! 8, 9, 10, 11, 16, 9, 10, 11, 0, 0, ! 0, 0, 0, 0, 22, 0, 0, 13, 0, 24, ! 0, 13, 0, 14, 0, 0, 22, 5, 0, 7, ! 281, 24, 0, 0, 16, 9, 10, 11, 16, 0, ! 0, 0, 0, 0, 869, 0, 0, 0, 0, 0, ! 0, 13, 0, 0, 0, 0, 22, 0, 0, 0, ! 22, 24, 0, 0, 0, 24, 0, 0, 16, 246, ! 247, 248, 870, 249, 250, 251, 252, 253, 254, 255, ! 256, 257, 258, 259, 260, 261, 262, 14, 0, 0, ! 22, 0, 246, 247, 248, 24, 249, 250, 251, 252, ! 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, ! 246, 247, 248, 908, 249, 250, 251, 252, 253, 254, ! 255, 256, 257, 258, 259, 260, 261, 262, 246, 247, ! 248, 0, 249, 250, 251, 252, 253, 254, 255, 256, ! 257, 258, 259, 260, 261, 262 }; static const short yycheck[] = { 56, ! 57, 16, 24, 33, 19, 20, 2, 3, 23, 233, ! 25, 26, 31, 2, 3, 85, 22, 207, 24, 317, ! 2, 3, 309, 38, 39, 40, 91, 201, 66, 279, ! 336, 83, 175, 338, 32, 33, 342, 198, 267, 206, ! 140, 324, 175, 143, 95, 67, 42, 405, 573, 71, ! 221, 221, 36, 42, 114, 2, 3, 429, 77, 74, ! 42, 67, 9, 10, 11, 71, 85, 640, 551, 53, ! 54, 55, 105, 106, 680, 274, 832, 427, 111, 33, ! 192, 1, 1, 9, 31, 3, 33, 1, 202, 122, ! 1, 10, 107, 236, 725, 42, 80, 76, 38, 273, ! 133, 38, 81, 57, 88, 3, 519, 38, 0, 276, ! 523, 171, 45, 744, 45, 36, 38, 0, 30, 59, ! 30, 3, 4, 59, 42, 315, 38, 883, 59, 144, ! 77, 146, 30, 3, 4, 418, 83, 58, 85, 76, ! 197, 666, 82, 749, 91, 59, 902, 212, 81, 905, ! 76, 907, 50, 566, 76, 170, 569, 77, 59, 915, ! 114, 59, 412, 82, 325, 180, 181, 906, 183, 184, ! 189, 82, 3, 4, 193, 336, 45, 237, 235, 350, ! 350, 342, 242, 202, 244, 67, 415, 537, 77, 143, ! 72, 947, 81, 140, 59, 934, 143, 67, 27, 38, ! 82, 30, 72, 402, 77, 3, 4, 36, 814, 408, ! 225, 268, 82, 59, 279, 740, 330, 171, 275, 50, ! 334, 333, 206, 238, 65, 708, 709, 1, 371, 3, ! 4, 30, 292, 217, 82, 518, 67, 76, 525, 221, ! 82, 72, 189, 77, 616, 192, 193, 81, 77, 30, ! 265, 266, 81, 59, 3, 202, 82, 607, 7, 38, ! 59, 60, 433, 433, 77, 212, 45, 221, 81, 67, ! 38, 27, 3, 4, 72, 848, 634, 45, 59, 60, ! 302, 30, 339, 237, 82, 300, 3, 4, 242, 59, ! 244, 76, 276, 67, 3, 4, 302, 59, 72, 582, ! 351, 50, 353, 59, 60, 81, 467, 76, 469, 76, ! 59, 330, 81, 30, 81, 334, 3, 4, 5, 6, ! 7, 38, 609, 9, 381, 76, 76, 274, 853, 75, ! 81, 364, 76, 50, 558, 77, 67, 81, 292, 81, ! 483, 72, 59, 358, 3, 329, 3, 412, 7, 347, ! 59, 349, 77, 410, 76, 72, 81, 586, 67, 59, ! 60, 77, 422, 72, 38, 81, 595, 82, 350, 512, ! 77, 30, 319, 30, 81, 7, 76, 59, 661, 512, ! 67, 664, 5, 330, 7, 72, 333, 334, 3, 4, ! 59, 50, 7, 50, 644, 349, 350, 77, 30, 414, ! 59, 60, 59, 60, 426, 710, 3, 4, 59, 60, ! 440, 698, 77, 59, 60, 30, 81, 78, 50, 82, ! 426, 582, 418, 453, 78, 76, 625, 59, 60, 418, ! 76, 429, 76, 429, 76, 50, 3, 4, 3, 4, ! 429, 439, 440, 76, 59, 38, 589, 30, 619, 619, ! 624, 551, 552, 77, 683, 402, 630, 72, 405, 626, ! 475, 408, 59, 30, 631, 30, 76, 50, 422, 59, ! 67, 418, 722, 38, 421, 72, 59, 60, 77, 433, ! 59, 60, 429, 50, 514, 50, 440, 27, 77, 78, ! 30, 652, 59, 440, 59, 510, 36, 48, 49, 453, ! 10, 662, 77, 664, 534, 72, 81, 72, 76, 708, ! 709, 63, 63, 532, 76, 513, 715, 716, 742, 59, ! 60, 517, 82, 77, 68, 69, 70, 81, 517, 59, ! 60, 818, 551, 552, 78, 533, 534, 77, 77, 59, ! 60, 81, 81, 337, 27, 615, 9, 545, 546, 83, ! 344, 77, 78, 4, 5, 6, 7, 781, 352, 77, ! 514, 12, 13, 14, 562, 563, 581, 514, 620, 621, ! 517, 36, 642, 611, 612, 3, 4, 28, 77, 644, ! 534, 600, 50, 51, 52, 532, 67, 534, 77, 78, ! 605, 897, 546, 899, 45, 36, 615, 68, 69, 70, ! 76, 653, 30, 81, 551, 552, 625, 78, 555, 563, ! 48, 49, 50, 51, 52, 38, 67, 78, 616, 76, ! 616, 72, 50, 642, 59, 60, 77, 616, 68, 69, ! 70, 59, 60, 126, 127, 3, 4, 76, 78, 7, ! 76, 38, 626, 941, 76, 76, 76, 631, 68, 69, ! 70, 949, 63, 600, 711, 76, 671, 722, 78, 83, ! 884, 83, 30, 76, 82, 619, 76, 614, 615, 616, ! 63, 76, 36, 620, 621, 83, 76, 78, 625, 78, ! 78, 32, 50, 38, 76, 742, 77, 634, 878, 708, ! 709, 59, 60, 640, 83, 642, 715, 716, 81, 76, ! 924, 925, 4, 5, 6, 7, 653, 77, 3, 81, ! 12, 13, 14, 6, 7, 767, 77, 732, 78, 12, ! 13, 14, 38, 63, 781, 83, 28, 742, 30, 78, ! 78, 38, 38, 78, 81, 792, 897, 63, 899, 38, ! 759, 78, 81, 45, 1, 63, 742, 4, 5, 6, ! 7, 83, 38, 742, 78, 12, 13, 14, 59, 59, ! 742, 708, 709, 59, 38, 67, 781, 77, 715, 716, ! 72, 28, 802, 830, 796, 77, 833, 834, 793, 812, ! 850, 575, 576, 77, 841, 579, 7, 38, 45, 795, ! 796, 16, 77, 77, 59, 742, 848, 78, 77, 856, ! 5, 6, 7, 801, 802, 77, 863, 12, 13, 14, ! 67, 59, 759, 63, 76, 72, 812, 874, 17, 77, ! 767, 76, 76, 812, 77, 82, 9, 884, 77, 76, ! 812, 850, 77, 627, 628, 629, 77, 59, 632, 633, ! 54, 55, 81, 57, 58, 59, 60, 77, 802, 906, ! 76, 4, 5, 6, 7, 802, 76, 0, 77, 12, ! 13, 14, 76, 657, 77, 812, 0, 415, 241, 884, ! 833, 928, 325, 246, 247, 28, 662, 934, 251, 252, ! 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, ! 87, 643, 45, 414, 282, 689, 690, 691, 747, 812, ! 477, 848, 650, 850, 5, 6, 7, 679, 350, 652, ! 469, 12, 13, 14, 67, 358, 583, 475, 884, 72, ! 1, 662, 3, 4, 5, 6, 7, 8, 9, 30, ! 11, 12, 13, 14, 15, 729, 17, 18, 19, 20, ! 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, ! 31, 664, 33, 34, 884, 929, 931, 409, 25, 40, ! 555, 421, 43, 421, 45, 621, 542, 48, 49, 50, ! 767, 764, 535, 54, 55, 517, 301, 759, 59, 60, ! 512, 683, 776, 64, 417, 66, 67, 589, 417, 371, ! 71, 72, -1, -1, 75, -1, 77, 78, 79, 80, ! -1, 82, 45, 46, 47, 48, 49, 50, 51, 52, ! 383, 384, 44, 45, 46, 47, 48, 49, 50, 51, ! 52, 1, -1, -1, 4, 5, 6, 7, -1, -1, ! 10, -1, 12, 13, 14, 829, 41, 42, 43, 44, ! 45, 46, 47, 48, 49, 50, 51, 52, 28, -1, ! -1, 845, -1, -1, -1, -1, 1, -1, 3, 4, ! 5, 6, 7, 8, 9, 45, 11, 12, 13, 14, ! 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, ! 25, 26, 27, 28, 29, 30, 31, 67, 33, 34, ! -1, -1, 72, -1, -1, 40, -1, -1, 43, -1, ! 45, 474, 82, 48, 49, 50, -1, -1, -1, 54, ! 55, -1, -1, -1, 59, 60, -1, -1, -1, 64, ! 493, 66, 67, -1, -1, -1, 71, 72, -1, -1, ! 75, -1, 77, -1, 79, 80, -1, 82, -1, -1, ! 1, -1, 3, 4, -1, -1, -1, 8, 9, -1, ! 11, -1, -1, -1, 15, -1, 17, 18, 19, 20, ! 21, 22, 23, 24, 25, 26, 27, -1, 29, -1, ! 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, ! 54, 55, 43, 57, 58, 59, 60, 48, 49, 50, ! -1, -1, 565, 54, 55, -1, -1, -1, 59, 60, ! -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, ! 71, 72, 585, -1, 75, -1, 77, 78, 79, 80, ! 1, 82, 3, 4, -1, -1, -1, 8, 9, -1, 11, -1, -1, -1, 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, ! -1, -1, -1, 54, 55, -1, -1, 650, 59, 60, -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, 71, 72, -1, -1, 75, -1, 77, -1, 79, 80, + -1, 82, -1, -1, -1, -1, 1, 680, -1, 4, + 5, 6, 7, -1, 687, -1, -1, 12, 13, 14, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 703, -1, 27, 28, -1, 30, -1, -1, -1, -1, + -1, 36, 46, 47, 48, 49, 50, 51, 52, -1, + 45, -1, 725, -1, -1, 728, -1, -1, -1, -1, + -1, -1, -1, -1, 59, 60, -1, -1, -1, -1, + -1, 744, 67, -1, 747, -1, 749, 72, -1, -1, + -1, -1, 77, -1, -1, -1, 81, 82, 4, -1, + 6, 7, -1, 766, -1, -1, 12, 13, 14, -1, + 1, -1, 3, 4, 777, -1, -1, 8, 9, -1, + 11, -1, 28, -1, 15, 788, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, -1, 29, 45, + 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, + -1, 814, 43, -1, -1, -1, -1, 48, 49, 50, + -1, 67, -1, 54, 55, -1, 72, -1, 59, 60, + -1, 77, 78, 64, -1, 66, 67, -1, -1, -1, + 71, 72, -1, -1, 75, -1, 77, -1, 79, 80, 1, 82, 3, 4, -1, 6, 7, 8, 9, -1, ! 11, 12, 13, 14, -1, -1, 869, -1, -1, -1, ! -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, 45, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, -1, 59, 60, *************** static const short yycheck[] = { 56, *** 1438,1492 **** -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, 71, 72, -1, -1, 75, -1, -1, 78, 79, 80, 1, 82, 3, 4, -1, -1, -1, 8, 9, -1, ! 11, 41, 42, 43, 44, 45, 46, 47, 48, 49, ! 50, 51, 52, -1, -1, -1, -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, 58, 59, 60, -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, 71, 72, -1, -1, 75, -1, -1, 78, 79, 80, ! 1, 82, 3, 4, -1, -1, -1, 8, 9, -1, 11, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, -1, -1, -1, -1, -1, 29, -1, ! 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, 58, 59, 60, ! -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, ! 71, 72, -1, -1, 75, 1, -1, 3, 79, 80, ! -1, 82, 8, 9, -1, 11, 1, -1, -1, 4, ! -1, 6, 7, -1, -1, -1, -1, 12, 13, 14, -1, -1, -1, 29, -1, 31, -1, 33, 34, -1, ! -1, -1, -1, 28, 40, -1, 31, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, ! 45, -1, -1, 59, 60, -1, -1, -1, 64, -1, 66, -1, -1, -1, -1, 71, -1, -1, -1, 75, ! -1, -1, 67, 79, 80, 1, 82, 72, 4, 5, ! 6, 7, 77, 78, -1, -1, 12, 13, 14, -1, ! -1, -1, -1, -1, 1, -1, -1, 4, 5, 6, ! 7, 27, 28, -1, 30, 12, 13, 14, -1, -1, ! 36, 45, 46, 47, 48, 49, 50, 51, 52, 45, ! 27, 28, -1, 30, -1, -1, -1, -1, -1, 36, ! -1, -1, -1, 59, 60, -1, -1, -1, 45, -1, ! -1, 67, -1, -1, -1, -1, 72, -1, -1, -1, ! -1, 77, 59, 60, -1, 81, 82, -1, -1, -1, ! 67, -1, -1, -1, -1, 72, -1, -1, -1, -1, ! 77, -1, -1, 1, 81, 82, 4, 5, 6, 7, ! -1, -1, -1, -1, 12, 13, 14, -1, -1, -1, ! -1, -1, 1, -1, -1, 4, 5, 6, 7, 27, ! 28, -1, 30, 12, 13, 14, -1, -1, 36, 46, ! 47, 48, 49, 50, 51, 52, -1, 45, -1, 28, ! -1, 30, -1, 4, -1, 6, 7, -1, -1, -1, ! -1, 12, 13, 14, -1, -1, 45, -1, -1, 67, ! -1, -1, -1, -1, 72, -1, -1, 28, -1, 77, ! -1, -1, -1, 81, 82, -1, 1, -1, 67, 4, ! 5, 6, 7, 72, 45, -1, -1, 12, 13, 14, ! -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, 28, 3, 30, 67, -1, -1, 8, ! 9, 72, 11, -1, -1, -1, 77, 78, -1, -1, ! 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, ! -1, 40, 67, -1, 43, -1, -1, 72, -1, 48, ! 49, 50, -1, -1, -1, 54, 55, 82, -1, -1, 59, 60, -1, 3, -1, 64, -1, 66, 8, 9, -1, 11, 71, -1, -1, -1, 75, -1, -1, -1, 79, 80, -1, -1, 83, -1, -1, -1, -1, 29, --- 1460,1521 ---- -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, 71, 72, -1, -1, 75, -1, -1, 78, 79, 80, 1, 82, 3, 4, -1, -1, -1, 8, 9, -1, ! 11, 40, 41, 42, 43, 44, 45, 46, 47, 48, ! 49, 50, 51, 52, -1, -1, -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, 58, 59, 60, -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, 71, 72, -1, -1, 75, -1, -1, 78, 79, 80, ! 1, 82, 3, -1, -1, -1, -1, 8, 9, -1, 11, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, -1, -1, -1, -1, -1, 29, -1, ! 31, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, 58, 59, 60, ! -1, -1, -1, 64, -1, 66, -1, -1, -1, -1, ! 71, -1, -1, -1, 75, 1, -1, 3, 79, 80, ! -1, 82, 8, 9, -1, 11, -1, -1, -1, -1, ! -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, 31, -1, 33, 34, -1, ! -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, ! -1, -1, -1, 59, 60, -1, -1, -1, 64, -1, 66, -1, -1, -1, -1, 71, -1, -1, -1, 75, ! 1, -1, 3, 79, 80, -1, 82, 8, 9, -1, ! 11, 1, -1, -1, 4, -1, 6, 7, -1, -1, ! -1, -1, 12, 13, 14, -1, -1, -1, 29, -1, ! 31, -1, 33, 34, -1, -1, -1, -1, 28, 40, ! -1, 31, 43, -1, -1, -1, -1, 48, 49, 50, ! -1, -1, -1, 54, 55, 45, -1, -1, 59, 60, ! -1, -1, -1, 64, -1, 66, -1, -1, -1, -1, ! 71, -1, -1, -1, 75, -1, -1, 67, 79, 80, ! 1, 82, 72, 4, 5, 6, 7, 77, 78, -1, ! -1, 12, 13, 14, -1, -1, -1, -1, -1, 1, ! -1, -1, 4, 5, 6, 7, 27, 28, -1, 30, ! 12, 13, 14, -1, -1, 36, -1, -1, -1, -1, ! -1, -1, -1, -1, 45, 27, 28, -1, 30, -1, ! -1, -1, -1, -1, 36, -1, -1, -1, 59, 60, ! -1, -1, -1, 45, -1, -1, 67, -1, -1, -1, ! -1, 72, -1, -1, -1, -1, 77, -1, -1, -1, ! 81, 82, -1, -1, -1, 67, -1, -1, -1, -1, ! 72, -1, -1, -1, -1, 77, -1, -1, 1, 81, ! 82, 4, 5, 6, 7, -1, -1, -1, -1, 12, ! 13, 14, -1, -1, -1, -1, -1, 1, -1, -1, ! 4, 5, 6, 7, -1, 28, -1, 30, 12, 13, ! 14, 4, -1, 6, 7, -1, -1, -1, -1, 12, ! 13, 14, 45, -1, 28, 3, 30, -1, -1, -1, ! 8, 9, -1, 11, -1, 28, -1, 30, -1, -1, ! -1, 45, -1, -1, 67, -1, -1, -1, -1, 72, ! -1, 29, 45, 31, -1, 33, 34, 50, -1, 82, ! -1, -1, 40, 67, -1, 43, 59, 60, 72, -1, ! 48, 49, 50, -1, 67, -1, 54, 55, 82, 72, ! -1, 59, 60, -1, 3, -1, 64, -1, 66, 8, ! 9, -1, 11, 71, -1, -1, -1, 75, -1, -1, ! -1, 79, 80, -1, -1, 83, -1, -1, -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, ! -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, ! 49, 50, -1, -1, -1, 54, 55, -1, -1, -1, 59, 60, -1, 3, -1, 64, -1, 66, 8, 9, -1, 11, 71, -1, -1, -1, 75, -1, -1, -1, 79, 80, -1, -1, 83, -1, -1, -1, -1, 29, *************** static const short yycheck[] = { 56, *** 1505,1662 **** -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, -1, 59, 60, -1, ! 3, -1, 64, -1, 66, 8, 9, -1, 11, 71, -1, -1, -1, 75, -1, -1, -1, 79, 80, -1, ! -1, 83, -1, -1, -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, ! -1, 54, 55, -1, -1, -1, 59, 60, -1, -1, ! -1, 64, -1, 66, -1, -1, -1, -1, 71, -1, ! -1, -1, 75, -1, -1, -1, 79, 80, -1, -1, ! 83, 3, 4, 5, 6, 7, 8, 9, -1, 11, ! 12, 13, 14, 15, -1, 17, 18, 19, 20, 21, ! 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, ! -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, ! -1, 43, -1, 45, -1, -1, 48, 49, 50, -1, ! -1, -1, 54, 55, -1, -1, -1, 59, 60, -1, ! -1, -1, 64, -1, 66, 67, -1, -1, -1, 71, ! 72, -1, -1, 75, -1, 77, -1, 79, 80, -1, ! 82, 3, 4, -1, -1, -1, 8, 9, -1, 11, ! -1, -1, -1, 15, -1, 17, 18, 19, 20, 21, ! 22, 23, 24, 25, 26, 27, -1, 29, -1, 31, ! -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, ! -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, ! -1, -1, 54, 55, -1, 3, -1, 59, 60, -1, ! 8, 9, 64, 11, 66, 67, -1, -1, -1, 71, ! 72, -1, -1, 75, -1, 77, -1, 79, 80, -1, ! 82, 29, -1, 31, -1, 33, 34, -1, -1, -1, ! -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, ! 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, ! -1, 59, 60, -1, -1, -1, 64, -1, 66, -1, ! -1, -1, -1, 71, -1, -1, -1, 75, -1, -1, ! -1, 79, 80, -1, 82, 3, 4, -1, 6, 7, ! -1, -1, -1, 11, 12, 13, 14, 15, 16, 17, ! 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, ! 28, 29, -1, 3, 4, 5, 6, 7, 8, 9, ! 38, 11, 12, 13, 14, 4, 5, 6, 7, -1, ! -1, -1, -1, 12, 13, 14, -1, -1, 28, 29, ! 30, 31, -1, 33, 34, -1, -1, -1, -1, 28, ! 40, 30, -1, 43, 72, 45, -1, -1, 48, 49, ! 50, -1, -1, 81, 54, 55, 45, -1, -1, 59, ! 60, -1, -1, -1, 64, -1, 66, 67, -1, -1, ! -1, 71, 72, -1, -1, 75, -1, -1, 67, 79, ! 80, 3, 4, 72, 6, 7, 8, 9, 77, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, -1, -1, -1, 28, 29, -1, 31, ! -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, ! -1, 43, -1, 45, -1, -1, 48, 49, 50, -1, ! -1, -1, 54, 55, -1, 3, -1, 59, 60, -1, ! 8, 9, 64, 11, 66, 67, -1, -1, -1, 71, ! 72, -1, -1, 75, -1, -1, -1, 79, 80, -1, ! -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, ! -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, ! 48, 49, 50, -1, -1, -1, 54, 55, -1, 3, ! -1, 59, 60, -1, 8, 9, 64, 11, 66, 67, ! -1, -1, -1, 71, -1, -1, -1, 75, -1, -1, ! -1, 79, 80, -1, -1, 29, -1, 31, -1, 33, ! 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, ! -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, ! 54, 55, -1, 3, -1, 59, 60, -1, 8, 9, ! 64, 11, 66, -1, -1, -1, -1, 71, -1, -1, ! -1, 75, -1, 77, -1, 79, 80, -1, -1, 29, ! -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, ! 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, ! 50, -1, -1, -1, 54, 55, -1, 3, -1, 59, ! 60, -1, 8, 9, 64, 11, 66, -1, -1, -1, ! -1, 71, -1, -1, -1, 75, -1, -1, -1, 79, ! 80, -1, -1, 29, -1, 31, -1, 33, 34, -1, ! -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, ! -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, ! -1, 3, -1, 59, 60, -1, 8, 9, 64, 11, ! 66, -1, -1, -1, -1, 71, -1, -1, -1, 75, ! -1, -1, -1, 79, 80, -1, -1, 29, -1, 31, ! -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, ! -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, ! -1, -1, 54, 55, -1, 3, -1, 59, 60, -1, ! 8, 9, 64, 11, 66, -1, -1, -1, -1, 71, ! -1, -1, -1, 75, -1, -1, -1, 79, 80, -1, ! -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, ! -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, ! 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, ! -1, 59, 60, -1, -1, -1, 64, -1, 66, -1, ! -1, -1, -1, 71, -1, -1, -1, 75, -1, -1, ! 1, 79, 80, 4, -1, 6, 7, -1, -1, -1, ! -1, 12, 13, 14, -1, -1, -1, -1, 1, -1, ! -1, 4, -1, 6, 7, -1, -1, 28, -1, 12, 13, 14, -1, -1, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, -1, 45, 28, -1, -1, -1, -1, ! -1, -1, 1, -1, 3, 4, 5, 6, 7, -1, ! -1, -1, 45, 12, 13, 14, 67, 68, 69, 70, ! -1, 72, -1, -1, -1, -1, 77, 78, 27, 28, ! -1, 30, 31, -1, 67, 68, 69, 70, -1, 72, ! -1, -1, -1, -1, 77, 78, 45, -1, -1, 48, ! 49, 50, -1, -1, -1, -1, -1, -1, -1, -1, ! 59, -1, 61, 62, 63, -1, -1, -1, 67, -1, ! -1, -1, 71, 72, 73, 74, -1, 1, 77, 3, ! 4, 5, 6, 7, -1, -1, -1, -1, 12, 13, ! 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, -1, 28, 1, 30, 3, 4, 5, ! 6, 7, -1, -1, -1, -1, 12, 13, 14, -1, ! -1, 45, -1, -1, 48, 49, 50, -1, -1, -1, ! -1, -1, 28, -1, 30, 59, -1, -1, -1, -1, ! -1, -1, -1, 67, -1, -1, -1, -1, 72, 45, ! -1, -1, -1, 77, 50, 1, -1, 3, 4, 5, ! 6, 7, -1, 59, 10, -1, 12, 13, 14, -1, ! -1, 67, -1, -1, 1, -1, 72, 4, 5, 6, ! 7, 77, 28, 10, 30, 12, 13, 14, 4, 5, ! 6, 7, -1, -1, -1, -1, 12, 13, 14, 45, ! -1, 28, -1, 30, -1, -1, -1, 4, 5, 6, ! 7, -1, 28, -1, 30, 12, 13, 14, 45, -1, -1, 67, -1, -1, -1, -1, 72, -1, -1, 45, ! 76, 28, -1, 30, -1, -1, -1, -1, -1, -1, ! 67, -1, -1, -1, -1, 72, -1, -1, 45, 76, ! -1, 67, -1, -1, -1, -1, 72, -1, -1, -1, ! -1, 77, -1, -1, -1, -1, -1, -1, -1, -1, ! 67, -1, -1, 3, 4, 72, 6, 7, -1, -1, ! 77, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, ! -1, 3, 4, -1, 6, 7, -1, -1, 38, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ! 22, 23, 24, 25, 26, 27, 28, 29, -1, 59, ! -1, -1, -1, -1, -1, -1, 38, 3, 4, -1, ! 6, 7, 72, -1, -1, 11, 12, 13, 14, 15, ! 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, ! 26, 27, 28, 29, -1, 3, 4, -1, 6, 7, ! 72, -1, 38, 11, 12, 13, 14, 15, 16, 17, ! 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, ! 28, 29, -1, -1, 4, -1, 6, 7, -1, -1, ! 38, -1, 12, 13, 14, -1, 72, 4, 5, 6, ! 7, -1, -1, 10, -1, 12, 13, 14, 28, 4, ! 5, 6, 7, -1, -1, 10, -1, 12, 13, 14, ! -1, 28, -1, 30, 72, 45, -1, -1, -1, -1, ! 50, -1, -1, 28, -1, 30, -1, -1, 45, 59, ! 60, -1, -1, -1, -1, -1, -1, 67, -1, -1, ! 45, -1, 72, -1, 4, 5, 6, 7, -1, -1, ! 67, -1, 12, 13, 14, 72, 4, 5, 6, 7, ! -1, -1, 67, -1, 12, 13, 14, 72, 28, 4, ! 30, 6, 7, -1, -1, -1, -1, 12, 13, 14, ! 28, -1, -1, -1, -1, 45, -1, -1, -1, -1, ! -1, -1, -1, 28, -1, -1, -1, 45, -1, -1, ! -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, ! 45, -1, 72, 10, -1, -1, -1, -1, -1, 67, ! -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, ! -1, -1, 67, -1, -1, -1, -1, 72, 35, 36, ! 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, ! 47, 48, 49, 50, 51, 52, 30, -1, -1, -1, ! -1, 35, 36, 37, -1, 39, 40, 41, 42, 43, ! 44, 45, 46, 47, 48, 49, 50, 51, 52, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, ! 46, 47, 48, 49, 50, 51, 52, 35, 36, 37, ! -1, 39, 40, 41, 42, 43, 44, 45, 46, 47, ! 48, 49, 50, 51, 52 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ ! #line 3 "/usr/cygnus/progressive-98r1/share/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. --- 1534,1680 ---- -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, -1, -1, 59, 60, -1, ! -1, -1, 64, -1, 66, -1, -1, -1, -1, 71, -1, -1, -1, 75, -1, -1, -1, 79, 80, -1, ! -1, 83, 3, 4, 5, 6, 7, 8, 9, -1, ! 11, 12, 13, 14, 15, -1, 17, 18, 19, 20, ! 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, ! 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, ! -1, -1, 43, -1, 45, -1, -1, 48, 49, 50, ! -1, -1, -1, 54, 55, -1, -1, -1, 59, 60, ! -1, -1, -1, 64, -1, 66, 67, -1, -1, -1, ! 71, 72, -1, -1, 75, -1, 77, -1, 79, 80, ! -1, 82, 3, 4, -1, -1, -1, 8, 9, -1, ! 11, -1, -1, -1, 15, -1, 17, 18, 19, 20, ! 21, 22, 23, 24, 25, 26, 27, -1, 29, -1, ! 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, ! -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, ! -1, -1, -1, 54, 55, -1, 3, -1, 59, 60, ! -1, 8, 9, 64, 11, 66, 67, -1, -1, -1, ! 71, 72, -1, -1, 75, -1, 77, -1, 79, 80, ! -1, 82, 29, -1, 31, -1, 33, 34, -1, -1, ! -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, ! -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, ! -1, -1, 59, 60, -1, -1, -1, 64, -1, 66, ! -1, -1, -1, -1, 71, -1, -1, -1, 75, -1, ! -1, -1, 79, 80, -1, 82, 3, 4, -1, 6, ! 7, -1, -1, -1, 11, 12, 13, 14, 15, 16, ! 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, ! 27, 28, 29, -1, 3, 4, 5, 6, 7, 8, ! 9, 38, 11, 12, 13, 14, 4, 5, 6, 7, ! -1, -1, -1, -1, 12, 13, 14, -1, -1, 28, ! 29, 30, 31, -1, 33, 34, -1, -1, -1, -1, ! 28, 40, 30, -1, 43, 72, 45, -1, -1, 48, ! 49, 50, -1, -1, 81, 54, 55, 45, -1, -1, ! 59, 60, -1, -1, -1, 64, -1, 66, 67, -1, ! -1, -1, 71, 72, -1, -1, 75, -1, -1, 67, ! 79, 80, 3, 4, 72, 6, 7, 8, 9, 77, ! 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, -1, -1, -1, -1, 28, 29, -1, ! 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, ! -1, -1, 43, -1, 45, -1, -1, 48, 49, 50, ! -1, -1, -1, 54, 55, -1, 3, -1, 59, 60, ! -1, 8, 9, 64, 11, 66, 67, -1, -1, -1, ! 71, 72, -1, -1, 75, -1, -1, -1, 79, 80, ! -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, ! -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, ! -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, ! 3, -1, 59, 60, -1, 8, 9, 64, 11, 66, ! 67, -1, -1, -1, 71, -1, -1, -1, 75, -1, ! -1, -1, 79, 80, -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, -1, -1, ! -1, 54, 55, -1, 3, -1, 59, 60, -1, 8, ! 9, 64, 11, 66, -1, -1, -1, -1, 71, -1, ! -1, -1, 75, -1, 77, -1, 79, 80, -1, -1, ! 29, -1, 31, -1, 33, 34, -1, -1, -1, -1, ! -1, 40, -1, -1, 43, -1, -1, -1, -1, 48, ! 49, 50, -1, -1, -1, 54, 55, -1, 3, -1, ! 59, 60, -1, 8, 9, 64, 11, 66, -1, -1, ! -1, -1, 71, -1, -1, -1, 75, -1, -1, -1, ! 79, 80, -1, -1, 29, -1, 31, -1, 33, 34, ! -1, -1, -1, -1, -1, 40, -1, -1, 43, -1, ! -1, -1, -1, 48, 49, 50, -1, -1, -1, 54, ! 55, -1, 3, -1, 59, 60, -1, 8, 9, 64, ! 11, 66, -1, -1, -1, -1, 71, -1, -1, -1, ! 75, -1, -1, -1, 79, 80, -1, -1, 29, -1, ! 31, -1, 33, 34, -1, -1, -1, -1, -1, 40, ! -1, -1, 43, -1, -1, -1, -1, 48, 49, 50, ! -1, -1, -1, 54, 55, -1, 3, -1, 59, 60, ! -1, 8, 9, 64, 11, 66, -1, -1, -1, -1, ! 71, -1, -1, -1, 75, -1, -1, -1, 79, 80, ! -1, -1, 29, -1, 31, -1, 33, 34, -1, -1, ! -1, -1, -1, 40, -1, -1, 43, -1, -1, -1, ! -1, 48, 49, 50, -1, -1, -1, 54, 55, -1, ! -1, -1, 59, 60, -1, -1, -1, 64, -1, 66, ! -1, -1, -1, -1, 71, -1, -1, -1, 75, -1, ! -1, 1, 79, 80, 4, -1, 6, 7, -1, -1, ! -1, -1, 12, 13, 14, -1, -1, -1, -1, 1, ! -1, -1, 4, -1, 6, 7, -1, -1, 28, -1, 12, 13, 14, -1, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, -1, -1, 45, 28, -1, -1, -1, ! -1, -1, -1, 1, -1, 3, 4, 5, 6, 7, ! -1, -1, -1, 45, 12, 13, 14, 67, 68, 69, ! 70, -1, 72, -1, -1, -1, -1, 77, 78, 27, ! 28, -1, 30, 31, -1, 67, 68, 69, 70, -1, ! 72, -1, -1, -1, -1, 77, 78, 45, -1, -1, ! 48, 49, 50, -1, -1, -1, -1, -1, -1, -1, ! -1, 59, -1, 61, 62, 63, -1, -1, -1, 67, ! -1, -1, -1, 71, 72, 73, 74, -1, 1, 77, ! 3, 4, 5, 6, 7, -1, -1, -1, -1, 12, 13, 14, -1, -1, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, -1, -1, 28, 1, 30, 3, 4, ! 5, 6, 7, -1, -1, -1, -1, 12, 13, 14, ! -1, -1, 45, -1, -1, 48, 49, 50, -1, -1, ! -1, -1, -1, 28, -1, 30, 59, -1, -1, -1, ! -1, -1, -1, -1, 67, -1, -1, -1, -1, 72, ! 45, -1, -1, -1, 77, 50, 1, -1, 3, 4, ! 5, 6, 7, -1, 59, 10, -1, 12, 13, 14, ! -1, -1, 67, -1, -1, 1, -1, 72, 4, 5, ! 6, 7, 77, 28, 10, 30, 12, 13, 14, 4, ! 5, 6, 7, -1, -1, -1, -1, 12, 13, 14, ! 45, -1, 28, -1, 30, 1, -1, -1, 4, -1, ! 6, 7, -1, 28, -1, 30, 12, 13, 14, 45, ! -1, -1, 67, -1, -1, -1, -1, 72, -1, -1, ! 45, 76, 28, -1, -1, 31, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, 72, -1, -1, 45, ! 76, -1, 67, -1, -1, -1, -1, 72, -1, -1, ! -1, -1, 77, -1, -1, -1, -1, -1, -1, 3, ! 4, 67, 6, 7, -1, -1, 72, 11, 12, 13, ! 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ! 24, 25, 26, 27, 28, 29, -1, 3, 4, -1, ! 6, 7, -1, -1, 38, 11, 12, 13, 14, 15, ! 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, ! 26, 27, 28, 29, -1, 59, -1, -1, -1, -1, ! -1, -1, 38, 3, 4, -1, 6, 7, 72, -1, ! -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, ! -1, 3, 4, -1, 6, 7, 72, -1, 38, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ! 22, 23, 24, 25, 26, 27, 28, 29, -1, -1, ! -1, 4, 5, 6, 7, -1, 38, 10, -1, 12, ! 13, 14, 72, 4, 5, 6, 7, -1, -1, 10, ! -1, 12, 13, 14, -1, 28, -1, 30, -1, -1, ! -1, -1, -1, -1, -1, -1, -1, 28, -1, 30, ! 72, -1, 45, 4, -1, 6, 7, 4, 5, 6, ! 7, 12, 13, 14, 45, 12, 13, 14, -1, -1, ! -1, -1, -1, -1, 67, -1, -1, 28, -1, 72, ! -1, 28, -1, 30, -1, -1, 67, 4, -1, 6, ! 7, 72, -1, -1, 45, 12, 13, 14, 45, -1, ! -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, ! -1, 28, -1, -1, -1, -1, 67, -1, -1, -1, ! 67, 72, -1, -1, -1, 72, -1, -1, 45, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, ! 46, 47, 48, 49, 50, 51, 52, 30, -1, -1, ! 67, -1, 35, 36, 37, 72, 39, 40, 41, 42, ! 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, ! 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ! 45, 46, 47, 48, 49, 50, 51, 52, 35, 36, ! 37, -1, 39, 40, 41, 42, 43, 44, 45, 46, ! 47, 48, 49, 50, 51, 52 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ ! #line 3 "/usr/lib/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. *************** __yy_memcpy (char *to, char *from, int c *** 1849,1855 **** #endif #endif ! #line 196 "/usr/cygnus/progressive-98r1/share/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. --- 1867,1873 ---- #endif #endif ! #line 196 "/usr/lib/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. *************** case 64: *** 2439,2445 **** tree type = yyvsp[-5].ttype; finish_init (); ! if (pedantic) pedwarn ("ANSI C forbids constructor expressions"); if (TYPE_NAME (type) != 0) { --- 2457,2463 ---- tree type = yyvsp[-5].ttype; finish_init (); ! if (pedantic && ! flag_isoc9x) pedwarn ("ANSI C forbids constructor expressions"); if (TYPE_NAME (type) != 0) { *************** case 86: *** 2558,2574 **** break;} case 87: #line 565 "objc-parse.y" ! { yyval.ttype = build_modify_expr (yyvsp[-2].ttype, NOP_EXPR, yyvsp[0].ttype); ! C_SET_EXP_ORIGINAL_CODE (yyval.ttype, MODIFY_EXPR); ; break;} case 88: ! #line 568 "objc-parse.y" ! { yyval.ttype = build_modify_expr (yyvsp[-2].ttype, yyvsp[-1].code, yyvsp[0].ttype); /* This inhibits warnings in truthvalue_conversion. */ ! C_SET_EXP_ORIGINAL_CODE (yyval.ttype, ERROR_MARK); ; break;} case 89: ! #line 575 "objc-parse.y" { yyval.ttype = lastiddecl; if (!yyval.ttype || yyval.ttype == error_mark_node) --- 2576,2602 ---- break;} case 87: #line 565 "objc-parse.y" ! { char class; ! yyval.ttype = build_modify_expr (yyvsp[-2].ttype, NOP_EXPR, yyvsp[0].ttype); ! class = TREE_CODE_CLASS (TREE_CODE (yyval.ttype)); ! if (class == 'e' || class == '1' ! || class == '2' || class == '<') ! C_SET_EXP_ORIGINAL_CODE (yyval.ttype, MODIFY_EXPR); ! ; break;} case 88: ! #line 573 "objc-parse.y" ! { char class; ! yyval.ttype = build_modify_expr (yyvsp[-2].ttype, yyvsp[-1].code, yyvsp[0].ttype); /* This inhibits warnings in truthvalue_conversion. */ ! class = TREE_CODE_CLASS (TREE_CODE (yyval.ttype)); ! if (class == 'e' || class == '1' ! || class == '2' || class == '<') ! C_SET_EXP_ORIGINAL_CODE (yyval.ttype, ERROR_MARK); ! ; break;} case 89: ! #line 585 "objc-parse.y" { yyval.ttype = lastiddecl; if (!yyval.ttype || yyval.ttype == error_mark_node) *************** case 89: *** 2729,2739 **** ; break;} case 91: ! #line 735 "objc-parse.y" { yyval.ttype = combine_strings (yyvsp[0].ttype); ; break;} case 92: ! #line 737 "objc-parse.y" { char class = TREE_CODE_CLASS (TREE_CODE (yyvsp[-1].ttype)); if (class == 'e' || class == '1' || class == '2' || class == '<') --- 2757,2767 ---- ; break;} case 91: ! #line 745 "objc-parse.y" { yyval.ttype = combine_strings (yyvsp[0].ttype); ; break;} case 92: ! #line 747 "objc-parse.y" { char class = TREE_CODE_CLASS (TREE_CODE (yyvsp[-1].ttype)); if (class == 'e' || class == '1' || class == '2' || class == '<') *************** case 92: *** 2741,2751 **** yyval.ttype = yyvsp[-1].ttype; ; break;} case 93: ! #line 743 "objc-parse.y" { yyval.ttype = error_mark_node; ; break;} case 94: ! #line 745 "objc-parse.y" { if (current_function_decl == 0) { error ("braced-group within expression allowed only inside a function"); --- 2769,2779 ---- yyval.ttype = yyvsp[-1].ttype; ; break;} case 93: ! #line 753 "objc-parse.y" { yyval.ttype = error_mark_node; ; break;} case 94: ! #line 755 "objc-parse.y" { if (current_function_decl == 0) { error ("braced-group within expression allowed only inside a function"); *************** case 94: *** 2761,2767 **** yyval.ttype = expand_start_stmt_expr (); ; break;} case 95: ! #line 759 "objc-parse.y" { tree rtl_exp; if (pedantic) pedwarn ("ANSI C forbids braced-groups within expressions"); --- 2789,2795 ---- yyval.ttype = expand_start_stmt_expr (); ; break;} case 95: ! #line 769 "objc-parse.y" { tree rtl_exp; if (pedantic) pedwarn ("ANSI C forbids braced-groups within expressions"); *************** case 95: *** 2786,2800 **** ; break;} case 96: ! #line 782 "objc-parse.y" { yyval.ttype = build_function_call (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} case 97: ! #line 784 "objc-parse.y" { yyval.ttype = build_array_ref (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} case 98: ! #line 786 "objc-parse.y" { if (doing_objc_thang) { --- 2814,2828 ---- ; break;} case 96: ! #line 792 "objc-parse.y" { yyval.ttype = build_function_call (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} case 97: ! #line 794 "objc-parse.y" { yyval.ttype = build_array_ref (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} case 98: ! #line 796 "objc-parse.y" { if (doing_objc_thang) { *************** case 98: *** 2808,2814 **** ; break;} case 99: ! #line 798 "objc-parse.y" { tree expr = build_indirect_ref (yyvsp[-2].ttype, "->"); --- 2836,2842 ---- ; break;} case 99: ! #line 808 "objc-parse.y" { tree expr = build_indirect_ref (yyvsp[-2].ttype, "->"); *************** case 99: *** 2824,2903 **** ; break;} case 100: ! #line 812 "objc-parse.y" { yyval.ttype = build_unary_op (POSTINCREMENT_EXPR, yyvsp[-1].ttype, 0); ; break;} case 101: ! #line 814 "objc-parse.y" { yyval.ttype = build_unary_op (POSTDECREMENT_EXPR, yyvsp[-1].ttype, 0); ; break;} case 102: ! #line 816 "objc-parse.y" { yyval.ttype = build_message_expr (yyvsp[0].ttype); ; break;} case 103: ! #line 818 "objc-parse.y" { yyval.ttype = build_selector_expr (yyvsp[0].ttype); ; break;} case 104: ! #line 820 "objc-parse.y" { yyval.ttype = build_protocol_expr (yyvsp[0].ttype); ; break;} case 105: ! #line 822 "objc-parse.y" { yyval.ttype = build_encode_expr (yyvsp[0].ttype); ; break;} case 106: ! #line 824 "objc-parse.y" { yyval.ttype = build_objc_string_object (yyvsp[0].ttype); ; break;} case 108: ! #line 831 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 110: ! #line 839 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 113: ! #line 847 "objc-parse.y" { c_mark_varargs (); if (pedantic) pedwarn ("ANSI C does not permit use of `varargs.h'"); ; break;} case 114: ! #line 857 "objc-parse.y" { ; break;} case 119: ! #line 873 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} case 120: ! #line 878 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} case 121: ! #line 883 "objc-parse.y" { shadow_tag_warned (yyvsp[-1].ttype, 1); pedwarn ("empty declaration"); ; break;} case 122: ! #line 886 "objc-parse.y" { pedwarn ("empty declaration"); ; break;} case 123: ! #line 895 "objc-parse.y" { ; break;} case 128: ! #line 910 "objc-parse.y" { yyval.itype = suspend_momentary (); pending_xref_error (); declspec_stack = tree_cons (prefix_attributes, --- 2852,2931 ---- ; break;} case 100: ! #line 822 "objc-parse.y" { yyval.ttype = build_unary_op (POSTINCREMENT_EXPR, yyvsp[-1].ttype, 0); ; break;} case 101: ! #line 824 "objc-parse.y" { yyval.ttype = build_unary_op (POSTDECREMENT_EXPR, yyvsp[-1].ttype, 0); ; break;} case 102: ! #line 826 "objc-parse.y" { yyval.ttype = build_message_expr (yyvsp[0].ttype); ; break;} case 103: ! #line 828 "objc-parse.y" { yyval.ttype = build_selector_expr (yyvsp[0].ttype); ; break;} case 104: ! #line 830 "objc-parse.y" { yyval.ttype = build_protocol_expr (yyvsp[0].ttype); ; break;} case 105: ! #line 832 "objc-parse.y" { yyval.ttype = build_encode_expr (yyvsp[0].ttype); ; break;} case 106: ! #line 834 "objc-parse.y" { yyval.ttype = build_objc_string_object (yyvsp[0].ttype); ; break;} case 108: ! #line 841 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 110: ! #line 849 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 113: ! #line 857 "objc-parse.y" { c_mark_varargs (); if (pedantic) pedwarn ("ANSI C does not permit use of `varargs.h'"); ; break;} case 114: ! #line 867 "objc-parse.y" { ; break;} case 119: ! #line 883 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} case 120: ! #line 888 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} case 121: ! #line 893 "objc-parse.y" { shadow_tag_warned (yyvsp[-1].ttype, 1); pedwarn ("empty declaration"); ; break;} case 122: ! #line 896 "objc-parse.y" { pedwarn ("empty declaration"); ; break;} case 123: ! #line 905 "objc-parse.y" { ; break;} case 128: ! #line 920 "objc-parse.y" { yyval.itype = suspend_momentary (); pending_xref_error (); declspec_stack = tree_cons (prefix_attributes, *************** case 128: *** 2907,3037 **** ¤t_declspecs, &prefix_attributes); ; break;} case 129: ! #line 921 "objc-parse.y" { prefix_attributes = chainon (prefix_attributes, yyvsp[0].ttype); ; break;} case 130: ! #line 926 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} case 131: ! #line 931 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} case 132: ! #line 936 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} case 133: ! #line 941 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} case 134: ! #line 946 "objc-parse.y" { shadow_tag (yyvsp[-1].ttype); ; break;} case 135: ! #line 948 "objc-parse.y" { pedwarn ("empty declaration"); ; break;} case 136: ! #line 950 "objc-parse.y" { pedantic = yyvsp[-1].itype; ; break;} case 137: ! #line 960 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 138: ! #line 962 "objc-parse.y" { yyval.ttype = chainon (yyvsp[0].ttype, tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[-2].ttype)); ; break;} case 139: ! #line 966 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 140: ! #line 968 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 141: ! #line 970 "objc-parse.y" { if (extra_warnings) warning ("`%s' is not at beginning of declaration", IDENTIFIER_POINTER (yyvsp[0].ttype)); yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 142: ! #line 975 "objc-parse.y" { yyval.ttype = tree_cons (yyvsp[0].ttype, NULL_TREE, yyvsp[-1].ttype); ; break;} case 143: ! #line 980 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 144: ! #line 982 "objc-parse.y" { yyval.ttype = chainon (yyvsp[0].ttype, tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[-2].ttype)); ; break;} case 145: ! #line 987 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 146: ! #line 989 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 147: ! #line 991 "objc-parse.y" { if (extra_warnings) warning ("`%s' is not at beginning of declaration", IDENTIFIER_POINTER (yyvsp[0].ttype)); yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 148: ! #line 1004 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 149: ! #line 1006 "objc-parse.y" { yyval.ttype = tree_cons (yyvsp[0].ttype, NULL_TREE, NULL_TREE); ; break;} case 150: ! #line 1008 "objc-parse.y" { yyval.ttype = chainon (yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 151: ! #line 1010 "objc-parse.y" { yyval.ttype = tree_cons (yyvsp[0].ttype, NULL_TREE, yyvsp[-1].ttype); ; break;} case 152: ! #line 1015 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); TREE_STATIC (yyval.ttype) = 1; ; break;} case 153: ! #line 1018 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); ; break;} case 154: ! #line 1020 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); TREE_STATIC (yyval.ttype) = 1; ; break;} case 155: ! #line 1023 "objc-parse.y" { if (extra_warnings && TREE_STATIC (yyvsp[-1].ttype)) warning ("`%s' is not at beginning of declaration", IDENTIFIER_POINTER (yyvsp[0].ttype)); --- 2935,3065 ---- ¤t_declspecs, &prefix_attributes); ; break;} case 129: ! #line 931 "objc-parse.y" { prefix_attributes = chainon (prefix_attributes, yyvsp[0].ttype); ; break;} case 130: ! #line 936 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} case 131: ! #line 941 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} case 132: ! #line 946 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} case 133: ! #line 951 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} case 134: ! #line 956 "objc-parse.y" { shadow_tag (yyvsp[-1].ttype); ; break;} case 135: ! #line 958 "objc-parse.y" { pedwarn ("empty declaration"); ; break;} case 136: ! #line 960 "objc-parse.y" { pedantic = yyvsp[-1].itype; ; break;} case 137: ! #line 970 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 138: ! #line 972 "objc-parse.y" { yyval.ttype = chainon (yyvsp[0].ttype, tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[-2].ttype)); ; break;} case 139: ! #line 976 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 140: ! #line 978 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 141: ! #line 980 "objc-parse.y" { if (extra_warnings) warning ("`%s' is not at beginning of declaration", IDENTIFIER_POINTER (yyvsp[0].ttype)); yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 142: ! #line 985 "objc-parse.y" { yyval.ttype = tree_cons (yyvsp[0].ttype, NULL_TREE, yyvsp[-1].ttype); ; break;} case 143: ! #line 990 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 144: ! #line 992 "objc-parse.y" { yyval.ttype = chainon (yyvsp[0].ttype, tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[-2].ttype)); ; break;} case 145: ! #line 997 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 146: ! #line 999 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 147: ! #line 1001 "objc-parse.y" { if (extra_warnings) warning ("`%s' is not at beginning of declaration", IDENTIFIER_POINTER (yyvsp[0].ttype)); yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 148: ! #line 1014 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 149: ! #line 1016 "objc-parse.y" { yyval.ttype = tree_cons (yyvsp[0].ttype, NULL_TREE, NULL_TREE); ; break;} case 150: ! #line 1018 "objc-parse.y" { yyval.ttype = chainon (yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 151: ! #line 1020 "objc-parse.y" { yyval.ttype = tree_cons (yyvsp[0].ttype, NULL_TREE, yyvsp[-1].ttype); ; break;} case 152: ! #line 1025 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); TREE_STATIC (yyval.ttype) = 1; ; break;} case 153: ! #line 1028 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); ; break;} case 154: ! #line 1030 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); TREE_STATIC (yyval.ttype) = 1; ; break;} case 155: ! #line 1033 "objc-parse.y" { if (extra_warnings && TREE_STATIC (yyvsp[-1].ttype)) warning ("`%s' is not at beginning of declaration", IDENTIFIER_POINTER (yyvsp[0].ttype)); *************** case 155: *** 3039,3188 **** TREE_STATIC (yyval.ttype) = TREE_STATIC (yyvsp[-1].ttype); ; break;} case 156: ! #line 1037 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 157: ! #line 1039 "objc-parse.y" { yyval.ttype = chainon (yyvsp[0].ttype, tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[-2].ttype)); ; break;} case 158: ! #line 1043 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 159: ! #line 1045 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 162: ! #line 1055 "objc-parse.y" { /* For a typedef name, record the meaning, not the name. In case of `foo foo, bar;'. */ yyval.ttype = lookup_name (yyvsp[0].ttype); ; break;} case 163: ! #line 1059 "objc-parse.y" { yyval.ttype = get_static_reference (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 164: ! #line 1061 "objc-parse.y" { yyval.ttype = get_object_reference (yyvsp[0].ttype); ; break;} case 165: ! #line 1066 "objc-parse.y" { yyval.ttype = get_object_reference (yyvsp[0].ttype); ; break;} case 166: ! #line 1068 "objc-parse.y" { yyval.ttype = TREE_TYPE (yyvsp[-1].ttype); ; break;} case 167: ! #line 1070 "objc-parse.y" { yyval.ttype = groktypename (yyvsp[-1].ttype); ; break;} case 175: ! #line 1092 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 176: ! #line 1094 "objc-parse.y" { if (TREE_CHAIN (yyvsp[-1].ttype)) yyvsp[-1].ttype = combine_strings (yyvsp[-1].ttype); yyval.ttype = yyvsp[-1].ttype; ; break;} case 177: ! #line 1101 "objc-parse.y" { yyval.ttype = start_decl (yyvsp[-3].ttype, current_declspecs, 1, yyvsp[-1].ttype, prefix_attributes); start_init (yyval.ttype, yyvsp[-2].ttype, global_bindings_p ()); ; break;} case 178: ! #line 1106 "objc-parse.y" { finish_init (); finish_decl (yyvsp[-1].ttype, yyvsp[0].ttype, yyvsp[-4].ttype); ; break;} case 179: ! #line 1109 "objc-parse.y" { tree d = start_decl (yyvsp[-2].ttype, current_declspecs, 0, yyvsp[0].ttype, prefix_attributes); finish_decl (d, NULL_TREE, yyvsp[-1].ttype); ; break;} case 180: ! #line 1117 "objc-parse.y" { yyval.ttype = start_decl (yyvsp[-3].ttype, current_declspecs, 1, yyvsp[-1].ttype, prefix_attributes); start_init (yyval.ttype, yyvsp[-2].ttype, global_bindings_p ()); ; break;} case 181: ! #line 1122 "objc-parse.y" { finish_init (); decl_attributes (yyvsp[-1].ttype, yyvsp[-3].ttype, prefix_attributes); finish_decl (yyvsp[-1].ttype, yyvsp[0].ttype, yyvsp[-4].ttype); ; break;} case 182: ! #line 1126 "objc-parse.y" { tree d = start_decl (yyvsp[-2].ttype, current_declspecs, 0, yyvsp[0].ttype, prefix_attributes); finish_decl (d, NULL_TREE, yyvsp[-1].ttype); ; break;} case 183: ! #line 1134 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 184: ! #line 1136 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 185: ! #line 1141 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 186: ! #line 1143 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 187: ! #line 1148 "objc-parse.y" { yyval.ttype = yyvsp[-2].ttype; ; break;} case 188: ! #line 1153 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 189: ! #line 1155 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} case 190: ! #line 1160 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 191: ! #line 1162 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[0].ttype, NULL_TREE); ; break;} case 192: ! #line 1164 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-3].ttype, build_tree_list (NULL_TREE, yyvsp[-1].ttype)); ; break;} case 193: ! #line 1166 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-5].ttype, tree_cons (NULL_TREE, yyvsp[-3].ttype, yyvsp[-1].ttype)); ; break;} case 194: ! #line 1168 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} case 200: ! #line 1186 "objc-parse.y" { really_start_incremental_init (NULL_TREE); /* Note that the call to clear_momentary is in process_init_element. */ push_momentary (); ; break;} case 201: ! #line 1191 "objc-parse.y" { yyval.ttype = pop_init_level (0); if (yyval.ttype == error_mark_node && ! (yychar == STRING || yychar == CONSTANT)) --- 3067,3216 ---- TREE_STATIC (yyval.ttype) = TREE_STATIC (yyvsp[-1].ttype); ; break;} case 156: ! #line 1047 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 157: ! #line 1049 "objc-parse.y" { yyval.ttype = chainon (yyvsp[0].ttype, tree_cons (NULL_TREE, yyvsp[-1].ttype, yyvsp[-2].ttype)); ; break;} case 158: ! #line 1053 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 159: ! #line 1055 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} case 162: ! #line 1065 "objc-parse.y" { /* For a typedef name, record the meaning, not the name. In case of `foo foo, bar;'. */ yyval.ttype = lookup_name (yyvsp[0].ttype); ; break;} case 163: ! #line 1069 "objc-parse.y" { yyval.ttype = get_static_reference (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 164: ! #line 1071 "objc-parse.y" { yyval.ttype = get_object_reference (yyvsp[0].ttype); ; break;} case 165: ! #line 1076 "objc-parse.y" { yyval.ttype = get_object_reference (yyvsp[0].ttype); ; break;} case 166: ! #line 1078 "objc-parse.y" { yyval.ttype = TREE_TYPE (yyvsp[-1].ttype); ; break;} case 167: ! #line 1080 "objc-parse.y" { yyval.ttype = groktypename (yyvsp[-1].ttype); ; break;} case 175: ! #line 1102 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 176: ! #line 1104 "objc-parse.y" { if (TREE_CHAIN (yyvsp[-1].ttype)) yyvsp[-1].ttype = combine_strings (yyvsp[-1].ttype); yyval.ttype = yyvsp[-1].ttype; ; break;} case 177: ! #line 1111 "objc-parse.y" { yyval.ttype = start_decl (yyvsp[-3].ttype, current_declspecs, 1, yyvsp[-1].ttype, prefix_attributes); start_init (yyval.ttype, yyvsp[-2].ttype, global_bindings_p ()); ; break;} case 178: ! #line 1116 "objc-parse.y" { finish_init (); finish_decl (yyvsp[-1].ttype, yyvsp[0].ttype, yyvsp[-4].ttype); ; break;} case 179: ! #line 1119 "objc-parse.y" { tree d = start_decl (yyvsp[-2].ttype, current_declspecs, 0, yyvsp[0].ttype, prefix_attributes); finish_decl (d, NULL_TREE, yyvsp[-1].ttype); ; break;} case 180: ! #line 1127 "objc-parse.y" { yyval.ttype = start_decl (yyvsp[-3].ttype, current_declspecs, 1, yyvsp[-1].ttype, prefix_attributes); start_init (yyval.ttype, yyvsp[-2].ttype, global_bindings_p ()); ; break;} case 181: ! #line 1132 "objc-parse.y" { finish_init (); decl_attributes (yyvsp[-1].ttype, yyvsp[-3].ttype, prefix_attributes); finish_decl (yyvsp[-1].ttype, yyvsp[0].ttype, yyvsp[-4].ttype); ; break;} case 182: ! #line 1136 "objc-parse.y" { tree d = start_decl (yyvsp[-2].ttype, current_declspecs, 0, yyvsp[0].ttype, prefix_attributes); finish_decl (d, NULL_TREE, yyvsp[-1].ttype); ; break;} case 183: ! #line 1144 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 184: ! #line 1146 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 185: ! #line 1151 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 186: ! #line 1153 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 187: ! #line 1158 "objc-parse.y" { yyval.ttype = yyvsp[-2].ttype; ; break;} case 188: ! #line 1163 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 189: ! #line 1165 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} case 190: ! #line 1170 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} case 191: ! #line 1172 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[0].ttype, NULL_TREE); ; break;} case 192: ! #line 1174 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-3].ttype, build_tree_list (NULL_TREE, yyvsp[-1].ttype)); ; break;} case 193: ! #line 1176 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-5].ttype, tree_cons (NULL_TREE, yyvsp[-3].ttype, yyvsp[-1].ttype)); ; break;} case 194: ! #line 1178 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} case 200: ! #line 1196 "objc-parse.y" { really_start_incremental_init (NULL_TREE); /* Note that the call to clear_momentary is in process_init_element. */ push_momentary (); ; break;} case 201: ! #line 1201 "objc-parse.y" { yyval.ttype = pop_init_level (0); if (yyval.ttype == error_mark_node && ! (yychar == STRING || yychar == CONSTANT)) *************** case 201: *** 3191,3226 **** pop_momentary_nofree (); ; break;} case 202: ! #line 1199 "objc-parse.y" { yyval.ttype = error_mark_node; ; break;} case 203: ! #line 1205 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids empty initializer braces"); ; break;} ! case 207: ! #line 1219 "objc-parse.y" ! { process_init_element (yyvsp[0].ttype); ; break;} ! case 208: ! #line 1221 "objc-parse.y" { push_init_level (0); ; break;} ! case 209: ! #line 1223 "objc-parse.y" { process_init_element (pop_init_level (0)); ; break;} ! case 211: ! #line 1229 "objc-parse.y" ! { set_init_label (yyvsp[-1].ttype); ; break;} ! case 213: ! #line 1232 "objc-parse.y" ! { set_init_label (yyvsp[-1].ttype); ; break;} ! case 215: ! #line 1238 "objc-parse.y" { push_c_function_context (); if (! start_function (current_declspecs, yyvsp[0].ttype, prefix_attributes, NULL_TREE, 1)) --- 3219,3254 ---- pop_momentary_nofree (); ; break;} case 202: ! #line 1209 "objc-parse.y" { yyval.ttype = error_mark_node; ; break;} case 203: ! #line 1215 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids empty initializer braces"); ; break;} ! case 209: ! #line 1231 "objc-parse.y" ! { set_init_label (yyvsp[-1].ttype); ; break;} ! case 212: ! #line 1238 "objc-parse.y" { push_init_level (0); ; break;} ! case 213: ! #line 1240 "objc-parse.y" { process_init_element (pop_init_level (0)); ; break;} ! case 214: ! #line 1242 "objc-parse.y" ! { process_init_element (yyvsp[0].ttype); ; break;} ! case 218: ! #line 1253 "objc-parse.y" ! { set_init_label (yyvsp[0].ttype); ; break;} ! case 219: ! #line 1261 "objc-parse.y" { push_c_function_context (); if (! start_function (current_declspecs, yyvsp[0].ttype, prefix_attributes, NULL_TREE, 1)) *************** case 215: *** 3230,3246 **** } reinit_parse_for_function (); ; break;} ! case 216: ! #line 1247 "objc-parse.y" { store_parm_decls (); ; break;} ! case 217: ! #line 1255 "objc-parse.y" { finish_function (1); pop_c_function_context (); ; break;} ! case 218: ! #line 1261 "objc-parse.y" { push_c_function_context (); if (! start_function (current_declspecs, yyvsp[0].ttype, prefix_attributes, NULL_TREE, 1)) --- 3258,3274 ---- } reinit_parse_for_function (); ; break;} ! case 220: ! #line 1270 "objc-parse.y" { store_parm_decls (); ; break;} ! case 221: ! #line 1278 "objc-parse.y" { finish_function (1); pop_c_function_context (); ; break;} ! case 222: ! #line 1284 "objc-parse.y" { push_c_function_context (); if (! start_function (current_declspecs, yyvsp[0].ttype, prefix_attributes, NULL_TREE, 1)) *************** case 218: *** 3250,3446 **** } reinit_parse_for_function (); ; break;} ! case 219: ! #line 1270 "objc-parse.y" { store_parm_decls (); ; break;} ! case 220: ! #line 1278 "objc-parse.y" { finish_function (1); pop_c_function_context (); ; break;} ! case 223: ! #line 1294 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 224: ! #line 1296 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 225: ! #line 1301 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 226: ! #line 1303 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ; break;} ! case 227: ! #line 1305 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 228: ! #line 1312 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 231: ! #line 1324 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 232: ! #line 1329 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 233: ! #line 1331 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ; break;} ! case 234: ! #line 1333 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 235: ! #line 1340 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 237: ! #line 1349 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 238: ! #line 1354 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 239: ! #line 1356 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 240: ! #line 1358 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 241: ! #line 1360 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ; break;} ! case 242: ! #line 1367 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 244: ! #line 1373 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 245: ! #line 1375 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 246: ! #line 1380 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 247: ! #line 1382 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 248: ! #line 1387 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 249: ! #line 1389 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 250: ! #line 1394 "objc-parse.y" { yyval.ttype = start_struct (RECORD_TYPE, yyvsp[-1].ttype); /* Start scope of tag before parsing components. */ ; break;} ! case 251: ! #line 1398 "objc-parse.y" { yyval.ttype = finish_struct (yyvsp[-3].ttype, yyvsp[-2].ttype, chainon (yyvsp[-6].ttype, yyvsp[0].ttype)); ; break;} ! case 252: ! #line 1400 "objc-parse.y" { yyval.ttype = finish_struct (start_struct (RECORD_TYPE, NULL_TREE), yyvsp[-2].ttype, chainon (yyvsp[-4].ttype, yyvsp[0].ttype)); ; break;} ! case 253: ! #line 1404 "objc-parse.y" { yyval.ttype = xref_tag (RECORD_TYPE, yyvsp[0].ttype); ; break;} ! case 254: ! #line 1406 "objc-parse.y" { yyval.ttype = start_struct (UNION_TYPE, yyvsp[-1].ttype); ; break;} ! case 255: ! #line 1408 "objc-parse.y" { yyval.ttype = finish_struct (yyvsp[-3].ttype, yyvsp[-2].ttype, chainon (yyvsp[-6].ttype, yyvsp[0].ttype)); ; break;} ! case 256: ! #line 1410 "objc-parse.y" { yyval.ttype = finish_struct (start_struct (UNION_TYPE, NULL_TREE), yyvsp[-2].ttype, chainon (yyvsp[-4].ttype, yyvsp[0].ttype)); ; break;} ! case 257: ! #line 1414 "objc-parse.y" { yyval.ttype = xref_tag (UNION_TYPE, yyvsp[0].ttype); ; break;} ! case 258: ! #line 1416 "objc-parse.y" { yyvsp[0].itype = suspend_momentary (); yyval.ttype = start_enum (yyvsp[-1].ttype); ; break;} ! case 259: ! #line 1419 "objc-parse.y" { yyval.ttype= finish_enum (yyvsp[-4].ttype, nreverse (yyvsp[-3].ttype), chainon (yyvsp[-7].ttype, yyvsp[0].ttype)); resume_momentary (yyvsp[-5].itype); ; break;} ! case 260: ! #line 1422 "objc-parse.y" { yyvsp[0].itype = suspend_momentary (); yyval.ttype = start_enum (NULL_TREE); ; break;} ! case 261: ! #line 1425 "objc-parse.y" { yyval.ttype= finish_enum (yyvsp[-4].ttype, nreverse (yyvsp[-3].ttype), chainon (yyvsp[-6].ttype, yyvsp[0].ttype)); resume_momentary (yyvsp[-5].itype); ; break;} ! case 262: ! #line 1428 "objc-parse.y" { yyval.ttype = xref_tag (ENUMERAL_TYPE, yyvsp[0].ttype); ; break;} ! case 266: ! #line 1439 "objc-parse.y" ! { if (pedantic) pedwarn ("comma at end of enumerator list"); ; break;} ! case 267: ! #line 1444 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 268: ! #line 1446 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); pedwarn ("no semicolon at end of struct or union"); ; break;} ! case 269: ! #line 1451 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 270: ! #line 1453 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[-1].ttype); ; break;} ! case 271: ! #line 1455 "objc-parse.y" { if (pedantic) pedwarn ("extra semicolon in struct or union specified"); ; break;} ! case 272: ! #line 1459 "objc-parse.y" { tree interface = lookup_interface (yyvsp[-1].ttype); --- 3278,3475 ---- } reinit_parse_for_function (); ; break;} ! case 223: ! #line 1293 "objc-parse.y" { store_parm_decls (); ; break;} ! case 224: ! #line 1301 "objc-parse.y" { finish_function (1); pop_c_function_context (); ; break;} ! case 227: ! #line 1317 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 228: ! #line 1319 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 229: ! #line 1324 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 230: ! #line 1326 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ; break;} ! case 231: ! #line 1328 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 232: ! #line 1335 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 235: ! #line 1347 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 236: ! #line 1352 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 237: ! #line 1354 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ; break;} ! case 238: ! #line 1356 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 239: ! #line 1363 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 241: ! #line 1372 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 242: ! #line 1377 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 243: ! #line 1379 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 244: ! #line 1381 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 245: ! #line 1383 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ; break;} ! case 246: ! #line 1390 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 248: ! #line 1396 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 249: ! #line 1398 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 250: ! #line 1403 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 251: ! #line 1405 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 252: ! #line 1410 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 253: ! #line 1412 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 254: ! #line 1417 "objc-parse.y" { yyval.ttype = start_struct (RECORD_TYPE, yyvsp[-1].ttype); /* Start scope of tag before parsing components. */ ; break;} ! case 255: ! #line 1421 "objc-parse.y" { yyval.ttype = finish_struct (yyvsp[-3].ttype, yyvsp[-2].ttype, chainon (yyvsp[-6].ttype, yyvsp[0].ttype)); ; break;} ! case 256: ! #line 1423 "objc-parse.y" { yyval.ttype = finish_struct (start_struct (RECORD_TYPE, NULL_TREE), yyvsp[-2].ttype, chainon (yyvsp[-4].ttype, yyvsp[0].ttype)); ; break;} ! case 257: ! #line 1427 "objc-parse.y" { yyval.ttype = xref_tag (RECORD_TYPE, yyvsp[0].ttype); ; break;} ! case 258: ! #line 1429 "objc-parse.y" { yyval.ttype = start_struct (UNION_TYPE, yyvsp[-1].ttype); ; break;} ! case 259: ! #line 1431 "objc-parse.y" { yyval.ttype = finish_struct (yyvsp[-3].ttype, yyvsp[-2].ttype, chainon (yyvsp[-6].ttype, yyvsp[0].ttype)); ; break;} ! case 260: ! #line 1433 "objc-parse.y" { yyval.ttype = finish_struct (start_struct (UNION_TYPE, NULL_TREE), yyvsp[-2].ttype, chainon (yyvsp[-4].ttype, yyvsp[0].ttype)); ; break;} ! case 261: ! #line 1437 "objc-parse.y" { yyval.ttype = xref_tag (UNION_TYPE, yyvsp[0].ttype); ; break;} ! case 262: ! #line 1439 "objc-parse.y" { yyvsp[0].itype = suspend_momentary (); yyval.ttype = start_enum (yyvsp[-1].ttype); ; break;} ! case 263: ! #line 1442 "objc-parse.y" { yyval.ttype= finish_enum (yyvsp[-4].ttype, nreverse (yyvsp[-3].ttype), chainon (yyvsp[-7].ttype, yyvsp[0].ttype)); resume_momentary (yyvsp[-5].itype); ; break;} ! case 264: ! #line 1445 "objc-parse.y" { yyvsp[0].itype = suspend_momentary (); yyval.ttype = start_enum (NULL_TREE); ; break;} ! case 265: ! #line 1448 "objc-parse.y" { yyval.ttype= finish_enum (yyvsp[-4].ttype, nreverse (yyvsp[-3].ttype), chainon (yyvsp[-6].ttype, yyvsp[0].ttype)); resume_momentary (yyvsp[-5].itype); ; break;} ! case 266: ! #line 1451 "objc-parse.y" { yyval.ttype = xref_tag (ENUMERAL_TYPE, yyvsp[0].ttype); ; break;} ! case 270: ! #line 1462 "objc-parse.y" ! { if (pedantic && ! flag_isoc9x) ! pedwarn ("comma at end of enumerator list"); ; break;} ! case 271: ! #line 1468 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 272: ! #line 1470 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); pedwarn ("no semicolon at end of struct or union"); ; break;} ! case 273: ! #line 1475 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 274: ! #line 1477 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[-1].ttype); ; break;} ! case 275: ! #line 1479 "objc-parse.y" { if (pedantic) pedwarn ("extra semicolon in struct or union specified"); ; break;} ! case 276: ! #line 1483 "objc-parse.y" { tree interface = lookup_interface (yyvsp[-1].ttype); *************** case 272: *** 3454,3617 **** } ; break;} ! case 273: ! #line 1484 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} ! case 274: ! #line 1490 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids member declarations with no members"); shadow_tag(yyvsp[0].ttype); yyval.ttype = NULL_TREE; ; break;} ! case 275: ! #line 1495 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} ! case 276: ! #line 1501 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids member declarations with no members"); shadow_tag(yyvsp[0].ttype); yyval.ttype = NULL_TREE; ; break;} ! case 277: ! #line 1506 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 278: ! #line 1508 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; pedantic = yyvsp[-1].itype; ; break;} ! case 280: ! #line 1515 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 281: ! #line 1520 "objc-parse.y" { yyval.ttype = grokfield (yyvsp[-3].filename, yyvsp[-2].lineno, yyvsp[-1].ttype, current_declspecs, NULL_TREE); decl_attributes (yyval.ttype, yyvsp[0].ttype, prefix_attributes); ; break;} ! case 282: ! #line 1524 "objc-parse.y" { yyval.ttype = grokfield (yyvsp[-5].filename, yyvsp[-4].lineno, yyvsp[-3].ttype, current_declspecs, yyvsp[-1].ttype); decl_attributes (yyval.ttype, yyvsp[0].ttype, prefix_attributes); ; break;} ! case 283: ! #line 1527 "objc-parse.y" { yyval.ttype = grokfield (yyvsp[-4].filename, yyvsp[-3].lineno, NULL_TREE, current_declspecs, yyvsp[-1].ttype); decl_attributes (yyval.ttype, yyvsp[0].ttype, prefix_attributes); ; break;} ! case 285: ! #line 1539 "objc-parse.y" { if (yyvsp[-2].ttype == error_mark_node) yyval.ttype = yyvsp[-2].ttype; else yyval.ttype = chainon (yyvsp[0].ttype, yyvsp[-2].ttype); ; break;} ! case 286: ! #line 1544 "objc-parse.y" { yyval.ttype = error_mark_node; ; break;} ! case 287: ! #line 1550 "objc-parse.y" { yyval.ttype = build_enumerator (yyvsp[0].ttype, NULL_TREE); ; break;} ! case 288: ! #line 1552 "objc-parse.y" { yyval.ttype = build_enumerator (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 289: ! #line 1557 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 290: ! #line 1559 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 291: ! #line 1564 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 293: ! #line 1570 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 294: ! #line 1572 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} ! case 295: ! #line 1577 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 296: ! #line 1579 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} ! case 297: ! #line 1584 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 298: ! #line 1587 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 299: ! #line 1589 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[0].ttype, NULL_TREE); ; break;} ! case 300: ! #line 1591 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 301: ! #line 1593 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 302: ! #line 1595 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ; break;} ! case 303: ! #line 1597 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, NULL_TREE, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 304: ! #line 1599 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, NULL_TREE, yyvsp[-1].ttype); ; break;} ! case 305: ! #line 1601 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); ; break;} ! case 306: ! #line 1612 "objc-parse.y" { if (pedantic && yyvsp[0].ends_in_label) pedwarn ("ANSI C forbids label at end of compound statement"); ; break;} ! case 308: ! #line 1621 "objc-parse.y" { yyval.ends_in_label = yyvsp[0].ends_in_label; ; break;} ! case 309: ! #line 1623 "objc-parse.y" { yyval.ends_in_label = 0; ; break;} ! case 313: ! #line 1635 "objc-parse.y" { emit_line_note (input_filename, lineno); pushlevel (0); clear_last_expr (); --- 3483,3650 ---- } ; break;} ! case 277: ! #line 1508 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} ! case 278: ! #line 1514 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids member declarations with no members"); shadow_tag(yyvsp[0].ttype); yyval.ttype = NULL_TREE; ; break;} ! case 279: ! #line 1519 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} ! case 280: ! #line 1525 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids member declarations with no members"); shadow_tag(yyvsp[0].ttype); yyval.ttype = NULL_TREE; ; break;} ! case 281: ! #line 1530 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 282: ! #line 1532 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; pedantic = yyvsp[-1].itype; ; break;} ! case 284: ! #line 1539 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 285: ! #line 1544 "objc-parse.y" { yyval.ttype = grokfield (yyvsp[-3].filename, yyvsp[-2].lineno, yyvsp[-1].ttype, current_declspecs, NULL_TREE); decl_attributes (yyval.ttype, yyvsp[0].ttype, prefix_attributes); ; break;} ! case 286: ! #line 1548 "objc-parse.y" { yyval.ttype = grokfield (yyvsp[-5].filename, yyvsp[-4].lineno, yyvsp[-3].ttype, current_declspecs, yyvsp[-1].ttype); decl_attributes (yyval.ttype, yyvsp[0].ttype, prefix_attributes); ; break;} ! case 287: ! #line 1551 "objc-parse.y" { yyval.ttype = grokfield (yyvsp[-4].filename, yyvsp[-3].lineno, NULL_TREE, current_declspecs, yyvsp[-1].ttype); decl_attributes (yyval.ttype, yyvsp[0].ttype, prefix_attributes); ; break;} ! case 289: ! #line 1563 "objc-parse.y" { if (yyvsp[-2].ttype == error_mark_node) yyval.ttype = yyvsp[-2].ttype; else yyval.ttype = chainon (yyvsp[0].ttype, yyvsp[-2].ttype); ; break;} ! case 290: ! #line 1568 "objc-parse.y" { yyval.ttype = error_mark_node; ; break;} ! case 291: ! #line 1574 "objc-parse.y" { yyval.ttype = build_enumerator (yyvsp[0].ttype, NULL_TREE); ; break;} ! case 292: ! #line 1576 "objc-parse.y" { yyval.ttype = build_enumerator (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 293: ! #line 1581 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 294: ! #line 1583 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 295: ! #line 1588 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 297: ! #line 1594 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 298: ! #line 1596 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} ! case 299: ! #line 1601 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 300: ! #line 1603 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyvsp[-1].ttype); ; break;} ! case 301: ! #line 1608 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 302: ! #line 1611 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 303: ! #line 1613 "objc-parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[0].ttype, NULL_TREE); ; break;} ! case 304: ! #line 1615 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 305: ! #line 1617 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 306: ! #line 1619 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, yyvsp[-2].ttype, NULL_TREE); ; break;} ! case 307: ! #line 1621 "objc-parse.y" { yyval.ttype = build_nt (CALL_EXPR, NULL_TREE, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 308: ! #line 1623 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, NULL_TREE, yyvsp[-1].ttype); ; break;} ! case 309: ! #line 1625 "objc-parse.y" { yyval.ttype = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); ; break;} ! case 310: ! #line 1629 "objc-parse.y" ! { yyval.ttype = yyvsp[0].ttype; ; ! break;} ! case 311: ! #line 1638 "objc-parse.y" { if (pedantic && yyvsp[0].ends_in_label) pedwarn ("ANSI C forbids label at end of compound statement"); ; break;} ! case 313: ! #line 1647 "objc-parse.y" { yyval.ends_in_label = yyvsp[0].ends_in_label; ; break;} ! case 314: ! #line 1649 "objc-parse.y" { yyval.ends_in_label = 0; ; break;} ! case 318: ! #line 1661 "objc-parse.y" { emit_line_note (input_filename, lineno); pushlevel (0); clear_last_expr (); *************** case 313: *** 3621,3633 **** add_objc_decls (); ; break;} ! case 315: ! #line 1650 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids label declarations"); ; break;} ! case 318: ! #line 1661 "objc-parse.y" { tree link; for (link = yyvsp[-1].ttype; link; link = TREE_CHAIN (link)) { --- 3654,3666 ---- add_objc_decls (); ; break;} ! case 320: ! #line 1676 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids label declarations"); ; break;} ! case 323: ! #line 1687 "objc-parse.y" { tree link; for (link = yyvsp[-1].ttype; link; link = TREE_CHAIN (link)) { *************** case 318: *** 3637,3656 **** } ; break;} ! case 319: ! #line 1675 "objc-parse.y" {; break;} ! case 321: ! #line 1679 "objc-parse.y" { compstmt_count++; ; break;} ! case 322: ! #line 1682 "objc-parse.y" { yyval.ttype = convert (void_type_node, integer_zero_node); ; break;} ! case 323: ! #line 1684 "objc-parse.y" { emit_line_note (input_filename, lineno); expand_end_bindings (getdecls (), 1, 0); yyval.ttype = poplevel (1, 1, 0); --- 3670,3689 ---- } ; break;} ! case 324: ! #line 1701 "objc-parse.y" {; break;} ! case 326: ! #line 1705 "objc-parse.y" { compstmt_count++; ; break;} ! case 327: ! #line 1708 "objc-parse.y" { yyval.ttype = convert (void_type_node, integer_zero_node); ; break;} ! case 328: ! #line 1710 "objc-parse.y" { emit_line_note (input_filename, lineno); expand_end_bindings (getdecls (), 1, 0); yyval.ttype = poplevel (1, 1, 0); *************** case 323: *** 3659,3666 **** else pop_momentary (); ; break;} ! case 324: ! #line 1692 "objc-parse.y" { emit_line_note (input_filename, lineno); expand_end_bindings (getdecls (), kept_level_p (), 0); yyval.ttype = poplevel (kept_level_p (), 0, 0); --- 3692,3699 ---- else pop_momentary (); ; break;} ! case 329: ! #line 1718 "objc-parse.y" { emit_line_note (input_filename, lineno); expand_end_bindings (getdecls (), kept_level_p (), 0); yyval.ttype = poplevel (kept_level_p (), 0, 0); *************** case 324: *** 3669,3676 **** else pop_momentary (); ; break;} ! case 325: ! #line 1700 "objc-parse.y" { emit_line_note (input_filename, lineno); expand_end_bindings (getdecls (), kept_level_p (), 0); yyval.ttype = poplevel (kept_level_p (), 0, 0); --- 3702,3709 ---- else pop_momentary (); ; break;} ! case 330: ! #line 1726 "objc-parse.y" { emit_line_note (input_filename, lineno); expand_end_bindings (getdecls (), kept_level_p (), 0); yyval.ttype = poplevel (kept_level_p (), 0, 0); *************** case 325: *** 3679,3686 **** else pop_momentary (); ; break;} ! case 328: ! #line 1720 "objc-parse.y" { emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno); c_expand_start_cond (truthvalue_conversion (yyvsp[-1].ttype), 0, compstmt_count); --- 3712,3719 ---- else pop_momentary (); ; break;} ! case 333: ! #line 1746 "objc-parse.y" { emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno); c_expand_start_cond (truthvalue_conversion (yyvsp[-1].ttype), 0, compstmt_count); *************** case 328: *** 3689,3696 **** if_stmt_line = yyvsp[-4].lineno; position_after_white_space (); ; break;} ! case 329: ! #line 1734 "objc-parse.y" { stmt_count++; compstmt_count++; emit_line_note (yyvsp[-2].filename, yyvsp[-1].lineno); --- 3722,3729 ---- if_stmt_line = yyvsp[-4].lineno; position_after_white_space (); ; break;} ! case 334: ! #line 1760 "objc-parse.y" { stmt_count++; compstmt_count++; emit_line_note (yyvsp[-2].filename, yyvsp[-1].lineno); *************** case 329: *** 3699,3742 **** expand_start_loop_continue_elsewhere (1); position_after_white_space (); ; break;} ! case 330: ! #line 1742 "objc-parse.y" { expand_loop_continue_here (); ; break;} ! case 331: ! #line 1746 "objc-parse.y" { yyval.filename = input_filename; ; break;} ! case 332: ! #line 1750 "objc-parse.y" { yyval.lineno = lineno; ; break;} ! case 333: ! #line 1755 "objc-parse.y" { ; break;} ! case 334: ! #line 1760 "objc-parse.y" { ; break;} ! case 335: ! #line 1765 "objc-parse.y" { yyval.ends_in_label = yyvsp[0].ends_in_label; ; break;} ! case 336: ! #line 1770 "objc-parse.y" { yyval.ends_in_label = 0; ; break;} ! case 337: ! #line 1772 "objc-parse.y" { yyval.ends_in_label = 1; ; break;} ! case 338: ! #line 1778 "objc-parse.y" { stmt_count++; ; break;} ! case 340: ! #line 1781 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno); /* It appears that this should not be done--that a non-lvalue array --- 3732,3775 ---- expand_start_loop_continue_elsewhere (1); position_after_white_space (); ; break;} ! case 335: ! #line 1768 "objc-parse.y" { expand_loop_continue_here (); ; break;} ! case 336: ! #line 1772 "objc-parse.y" { yyval.filename = input_filename; ; break;} ! case 337: ! #line 1776 "objc-parse.y" { yyval.lineno = lineno; ; break;} ! case 338: ! #line 1781 "objc-parse.y" { ; break;} ! case 339: ! #line 1786 "objc-parse.y" { ; break;} ! case 340: ! #line 1791 "objc-parse.y" { yyval.ends_in_label = yyvsp[0].ends_in_label; ; break;} ! case 341: ! #line 1796 "objc-parse.y" { yyval.ends_in_label = 0; ; break;} ! case 342: ! #line 1798 "objc-parse.y" { yyval.ends_in_label = 1; ; break;} ! case 343: ! #line 1804 "objc-parse.y" { stmt_count++; ; break;} ! case 345: ! #line 1807 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno); /* It appears that this should not be done--that a non-lvalue array *************** case 340: *** 3754,3773 **** iterator_expand (yyvsp[-1].ttype); clear_momentary (); ; break;} ! case 341: ! #line 1798 "objc-parse.y" { c_expand_start_else (); yyvsp[-1].itype = stmt_count; position_after_white_space (); ; break;} ! case 342: ! #line 1802 "objc-parse.y" { c_expand_end_cond (); if (extra_warnings && stmt_count == yyvsp[-3].itype) warning ("empty body in an else-statement"); ; break;} ! case 343: ! #line 1806 "objc-parse.y" { c_expand_end_cond (); /* This warning is here instead of in simple_if, because we do not want a warning if an empty if is followed by an --- 3787,3806 ---- iterator_expand (yyvsp[-1].ttype); clear_momentary (); ; break;} ! case 346: ! #line 1824 "objc-parse.y" { c_expand_start_else (); yyvsp[-1].itype = stmt_count; position_after_white_space (); ; break;} ! case 347: ! #line 1828 "objc-parse.y" { c_expand_end_cond (); if (extra_warnings && stmt_count == yyvsp[-3].itype) warning ("empty body in an else-statement"); ; break;} ! case 348: ! #line 1832 "objc-parse.y" { c_expand_end_cond (); /* This warning is here instead of in simple_if, because we do not want a warning if an empty if is followed by an *************** case 343: *** 3777,3788 **** warning_with_file_and_line (if_stmt_file, if_stmt_line, "empty body in an if-statement"); ; break;} ! case 344: ! #line 1818 "objc-parse.y" { c_expand_end_cond (); ; break;} ! case 345: ! #line 1820 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-2].filename, yyvsp[-1].lineno); /* The emit_nop used to come before emit_line_note, --- 3810,3821 ---- warning_with_file_and_line (if_stmt_file, if_stmt_line, "empty body in an if-statement"); ; break;} ! case 349: ! #line 1844 "objc-parse.y" { c_expand_end_cond (); ; break;} ! case 350: ! #line 1846 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-2].filename, yyvsp[-1].lineno); /* The emit_nop used to come before emit_line_note, *************** case 345: *** 3793,3800 **** We will see. --rms, July 15, 1991. */ emit_nop (); ; break;} ! case 346: ! #line 1830 "objc-parse.y" { /* Don't start the loop till we have succeeded in parsing the end test. This is to make sure that we end every loop we start. */ --- 3826,3833 ---- We will see. --rms, July 15, 1991. */ emit_nop (); ; break;} ! case 351: ! #line 1856 "objc-parse.y" { /* Don't start the loop till we have succeeded in parsing the end test. This is to make sure that we end every loop we start. */ *************** case 346: *** 3804,3828 **** truthvalue_conversion (yyvsp[-1].ttype)); position_after_white_space (); ; break;} ! case 347: ! #line 1839 "objc-parse.y" { expand_end_loop (); ; break;} ! case 348: ! #line 1842 "objc-parse.y" { emit_line_note (input_filename, lineno); expand_exit_loop_if_false (NULL_PTR, truthvalue_conversion (yyvsp[-2].ttype)); expand_end_loop (); clear_momentary (); ; break;} ! case 349: ! #line 1849 "objc-parse.y" { expand_end_loop (); clear_momentary (); ; break;} ! case 350: ! #line 1853 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno); /* See comment in `while' alternative, above. */ --- 3837,3861 ---- truthvalue_conversion (yyvsp[-1].ttype)); position_after_white_space (); ; break;} ! case 352: ! #line 1865 "objc-parse.y" { expand_end_loop (); ; break;} ! case 353: ! #line 1868 "objc-parse.y" { emit_line_note (input_filename, lineno); expand_exit_loop_if_false (NULL_PTR, truthvalue_conversion (yyvsp[-2].ttype)); expand_end_loop (); clear_momentary (); ; break;} ! case 354: ! #line 1875 "objc-parse.y" { expand_end_loop (); clear_momentary (); ; break;} ! case 355: ! #line 1879 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno); /* See comment in `while' alternative, above. */ *************** case 350: *** 3834,3846 **** fn without calling expand_end_loop. */ ; break;} ! case 351: ! #line 1865 "objc-parse.y" { yyvsp[0].lineno = lineno; yyval.filename = input_filename; ; break;} ! case 352: ! #line 1868 "objc-parse.y" { /* Start the loop. Doing this after parsing all the expressions ensures we will end the loop. */ --- 3867,3879 ---- fn without calling expand_end_loop. */ ; break;} ! case 356: ! #line 1891 "objc-parse.y" { yyvsp[0].lineno = lineno; yyval.filename = input_filename; ; break;} ! case 357: ! #line 1894 "objc-parse.y" { /* Start the loop. Doing this after parsing all the expressions ensures we will end the loop. */ *************** case 352: *** 3857,3864 **** yyvsp[-2].filename = input_filename; position_after_white_space (); ; break;} ! case 353: ! #line 1884 "objc-parse.y" { /* Emit the increment expression, with a line number. */ emit_line_note (yyvsp[-4].filename, yyvsp[-5].lineno); expand_loop_continue_here (); --- 3890,3897 ---- yyvsp[-2].filename = input_filename; position_after_white_space (); ; break;} ! case 358: ! #line 1910 "objc-parse.y" { /* Emit the increment expression, with a line number. */ emit_line_note (yyvsp[-4].filename, yyvsp[-5].lineno); expand_loop_continue_here (); *************** case 353: *** 3870,3877 **** pop_momentary (); expand_end_loop (); ; break;} ! case 354: ! #line 1895 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno); c_expand_start_case (yyvsp[-1].ttype); --- 3903,3910 ---- pop_momentary (); expand_end_loop (); ; break;} ! case 359: ! #line 1921 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno); c_expand_start_case (yyvsp[-1].ttype); *************** case 354: *** 3880,3921 **** push_momentary (); position_after_white_space (); ; break;} ! case 355: ! #line 1903 "objc-parse.y" { expand_end_case (yyvsp[-3].ttype); if (yychar == CONSTANT || yychar == STRING) pop_momentary_nofree (); else pop_momentary (); ; break;} ! case 356: ! #line 1909 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno); if ( ! expand_exit_something ()) error ("break statement not within loop or switch"); ; break;} ! case 357: ! #line 1914 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno); if (! expand_continue_loop (NULL_PTR)) error ("continue statement not within a loop"); ; break;} ! case 358: ! #line 1919 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno); c_expand_return (NULL_TREE); ; break;} ! case 359: ! #line 1923 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-4].filename, yyvsp[-3].lineno); c_expand_return (yyvsp[-1].ttype); ; break;} ! case 360: ! #line 1927 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-7].filename, yyvsp[-6].lineno); STRIP_NOPS (yyvsp[-2].ttype); --- 3913,3954 ---- push_momentary (); position_after_white_space (); ; break;} ! case 360: ! #line 1929 "objc-parse.y" { expand_end_case (yyvsp[-3].ttype); if (yychar == CONSTANT || yychar == STRING) pop_momentary_nofree (); else pop_momentary (); ; break;} ! case 361: ! #line 1935 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno); if ( ! expand_exit_something ()) error ("break statement not within loop or switch"); ; break;} ! case 362: ! #line 1940 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno); if (! expand_continue_loop (NULL_PTR)) error ("continue statement not within a loop"); ; break;} ! case 363: ! #line 1945 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-3].filename, yyvsp[-2].lineno); c_expand_return (NULL_TREE); ; break;} ! case 364: ! #line 1949 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-4].filename, yyvsp[-3].lineno); c_expand_return (yyvsp[-1].ttype); ; break;} ! case 365: ! #line 1953 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-7].filename, yyvsp[-6].lineno); STRIP_NOPS (yyvsp[-2].ttype); *************** case 360: *** 3926,3957 **** else error ("argument of `asm' is not a constant string"); ; break;} ! case 361: ! #line 1938 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-9].filename, yyvsp[-8].lineno); c_expand_asm_operands (yyvsp[-4].ttype, yyvsp[-2].ttype, NULL_TREE, NULL_TREE, yyvsp[-6].ttype == ridpointers[(int)RID_VOLATILE], input_filename, lineno); ; break;} ! case 362: ! #line 1945 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-11].filename, yyvsp[-10].lineno); c_expand_asm_operands (yyvsp[-6].ttype, yyvsp[-4].ttype, yyvsp[-2].ttype, NULL_TREE, yyvsp[-8].ttype == ridpointers[(int)RID_VOLATILE], input_filename, lineno); ; break;} ! case 363: ! #line 1953 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-13].filename, yyvsp[-12].lineno); c_expand_asm_operands (yyvsp[-8].ttype, yyvsp[-6].ttype, yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[-10].ttype == ridpointers[(int)RID_VOLATILE], input_filename, lineno); ; break;} ! case 364: ! #line 1959 "objc-parse.y" { tree decl; stmt_count++; emit_line_note (yyvsp[-4].filename, yyvsp[-3].lineno); --- 3959,3990 ---- else error ("argument of `asm' is not a constant string"); ; break;} ! case 366: ! #line 1964 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-9].filename, yyvsp[-8].lineno); c_expand_asm_operands (yyvsp[-4].ttype, yyvsp[-2].ttype, NULL_TREE, NULL_TREE, yyvsp[-6].ttype == ridpointers[(int)RID_VOLATILE], input_filename, lineno); ; break;} ! case 367: ! #line 1971 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-11].filename, yyvsp[-10].lineno); c_expand_asm_operands (yyvsp[-6].ttype, yyvsp[-4].ttype, yyvsp[-2].ttype, NULL_TREE, yyvsp[-8].ttype == ridpointers[(int)RID_VOLATILE], input_filename, lineno); ; break;} ! case 368: ! #line 1979 "objc-parse.y" { stmt_count++; emit_line_note (yyvsp[-13].filename, yyvsp[-12].lineno); c_expand_asm_operands (yyvsp[-8].ttype, yyvsp[-6].ttype, yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[-10].ttype == ridpointers[(int)RID_VOLATILE], input_filename, lineno); ; break;} ! case 369: ! #line 1985 "objc-parse.y" { tree decl; stmt_count++; emit_line_note (yyvsp[-4].filename, yyvsp[-3].lineno); *************** case 364: *** 3963,3978 **** } ; break;} ! case 365: ! #line 1970 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids `goto *expr;'"); stmt_count++; emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno); expand_computed_goto (convert (ptr_type_node, yyvsp[-1].ttype)); ; break;} ! case 368: ! #line 1985 "objc-parse.y" { /* The value returned by this action is */ /* 1 if everything is OK */ --- 3996,4011 ---- } ; break;} ! case 370: ! #line 1996 "objc-parse.y" { if (pedantic) pedwarn ("ANSI C forbids `goto *expr;'"); stmt_count++; emit_line_note (yyvsp[-5].filename, yyvsp[-4].lineno); expand_computed_goto (convert (ptr_type_node, yyvsp[-1].ttype)); ; break;} ! case 373: ! #line 2011 "objc-parse.y" { /* The value returned by this action is */ /* 1 if everything is OK */ *************** case 368: *** 3994,4008 **** } ; break;} ! case 369: ! #line 2006 "objc-parse.y" { if (yyvsp[-1].itype) iterator_for_loop_end (yyvsp[-3].ttype); ; break;} ! case 370: ! #line 2041 "objc-parse.y" { register tree value = check_case_value (yyvsp[-1].ttype); register tree label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); --- 4027,4041 ---- } ; break;} ! case 374: ! #line 2032 "objc-parse.y" { if (yyvsp[-1].itype) iterator_for_loop_end (yyvsp[-3].ttype); ; break;} ! case 375: ! #line 2067 "objc-parse.y" { register tree value = check_case_value (yyvsp[-1].ttype); register tree label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); *************** case 370: *** 4034,4041 **** } position_after_white_space (); ; break;} ! case 371: ! #line 2072 "objc-parse.y" { register tree value1 = check_case_value (yyvsp[-3].ttype); register tree value2 = check_case_value (yyvsp[-1].ttype); register tree label --- 4067,4074 ---- } position_after_white_space (); ; break;} ! case 376: ! #line 2098 "objc-parse.y" { register tree value1 = check_case_value (yyvsp[-3].ttype); register tree value2 = check_case_value (yyvsp[-1].ttype); register tree label *************** case 371: *** 4067,4074 **** } position_after_white_space (); ; break;} ! case 372: ! #line 2103 "objc-parse.y" { tree duplicate; register tree label --- 4100,4107 ---- } position_after_white_space (); ; break;} ! case 377: ! #line 2129 "objc-parse.y" { tree duplicate; register tree label *************** case 372: *** 4084,4145 **** } position_after_white_space (); ; break;} ! case 373: ! #line 2118 "objc-parse.y" ! { tree label = define_label (input_filename, lineno, yyvsp[-1].ttype); stmt_count++; emit_nop (); if (label) ! expand_label (label); position_after_white_space (); ; break;} ! case 374: ! #line 2130 "objc-parse.y" { emit_line_note (input_filename, lineno); yyval.ttype = NULL_TREE; ; break;} ! case 375: ! #line 2133 "objc-parse.y" { emit_line_note (input_filename, lineno); ; break;} ! case 376: ! #line 2138 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 378: ! #line 2145 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 381: ! #line 2152 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 382: ! #line 2157 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 383: ! #line 2162 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, combine_strings (yyvsp[0].ttype), NULL_TREE); ; break;} ! case 384: ! #line 2164 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, combine_strings (yyvsp[0].ttype), yyvsp[-2].ttype); ; break;} ! case 385: ! #line 2170 "objc-parse.y" { pushlevel (0); clear_parm_order (); declare_parm_level (0); ; break;} ! case 386: ! #line 2174 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; parmlist_tags_warning (); poplevel (0, 0, 0); ; break;} ! case 388: ! #line 2182 "objc-parse.y" { tree parm; if (pedantic) pedwarn ("ANSI C forbids forward parameter declarations"); --- 4117,4181 ---- } position_after_white_space (); ; break;} ! case 378: ! #line 2144 "objc-parse.y" ! { tree label = define_label (input_filename, lineno, yyvsp[-2].ttype); stmt_count++; emit_nop (); if (label) ! { ! expand_label (label); ! decl_attributes (label, yyvsp[0].ttype, NULL_TREE); ! } position_after_white_space (); ; break;} ! case 379: ! #line 2159 "objc-parse.y" { emit_line_note (input_filename, lineno); yyval.ttype = NULL_TREE; ; break;} ! case 380: ! #line 2162 "objc-parse.y" { emit_line_note (input_filename, lineno); ; break;} ! case 381: ! #line 2167 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 383: ! #line 2174 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 386: ! #line 2181 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 387: ! #line 2186 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 388: ! #line 2191 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, combine_strings (yyvsp[0].ttype), NULL_TREE); ; break;} ! case 389: ! #line 2193 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, combine_strings (yyvsp[0].ttype), yyvsp[-2].ttype); ; break;} ! case 390: ! #line 2199 "objc-parse.y" { pushlevel (0); clear_parm_order (); declare_parm_level (0); ; break;} ! case 391: ! #line 2203 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; parmlist_tags_warning (); poplevel (0, 0, 0); ; break;} ! case 393: ! #line 2211 "objc-parse.y" { tree parm; if (pedantic) pedwarn ("ANSI C forbids forward parameter declarations"); *************** case 388: *** 4148,4167 **** TREE_ASM_WRITTEN (parm) = 1; clear_parm_order (); ; break;} ! case 389: ! #line 2190 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 390: ! #line 2192 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); ; break;} ! case 391: ! #line 2198 "objc-parse.y" { yyval.ttype = get_parm_info (0); ; break;} ! case 392: ! #line 2200 "objc-parse.y" { yyval.ttype = get_parm_info (0); /* Gcc used to allow this as an extension. However, it does not work for all targets, and thus has been disabled. --- 4184,4203 ---- TREE_ASM_WRITTEN (parm) = 1; clear_parm_order (); ; break;} ! case 394: ! #line 2219 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} ! case 395: ! #line 2221 "objc-parse.y" { yyval.ttype = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); ; break;} ! case 396: ! #line 2227 "objc-parse.y" { yyval.ttype = get_parm_info (0); ; break;} ! case 397: ! #line 2229 "objc-parse.y" { yyval.ttype = get_parm_info (0); /* Gcc used to allow this as an extension. However, it does not work for all targets, and thus has been disabled. *************** case 392: *** 4172,4195 **** error ("ANSI C requires a named argument before `...'"); ; break;} ! case 393: ! #line 2210 "objc-parse.y" { yyval.ttype = get_parm_info (1); ; break;} ! case 394: ! #line 2212 "objc-parse.y" { yyval.ttype = get_parm_info (0); ; break;} ! case 395: ! #line 2217 "objc-parse.y" { push_parm_decl (yyvsp[0].ttype); ; break;} ! case 396: ! #line 2219 "objc-parse.y" { push_parm_decl (yyvsp[0].ttype); ; break;} ! case 397: ! #line 2226 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, --- 4208,4231 ---- error ("ANSI C requires a named argument before `...'"); ; break;} ! case 398: ! #line 2239 "objc-parse.y" { yyval.ttype = get_parm_info (1); ; break;} ! case 399: ! #line 2241 "objc-parse.y" { yyval.ttype = get_parm_info (0); ; break;} ! case 400: ! #line 2246 "objc-parse.y" { push_parm_decl (yyvsp[0].ttype); ; break;} ! case 401: ! #line 2248 "objc-parse.y" { push_parm_decl (yyvsp[0].ttype); ; break;} ! case 402: ! #line 2255 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, *************** case 397: *** 4199,4206 **** declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 398: ! #line 2235 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, --- 4235,4242 ---- declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 403: ! #line 2264 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, *************** case 398: *** 4210,4217 **** declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 399: ! #line 2244 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, --- 4246,4253 ---- declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 404: ! #line 2273 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, *************** case 399: *** 4221,4228 **** declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 400: ! #line 2253 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, --- 4257,4264 ---- declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 405: ! #line 2282 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, *************** case 400: *** 4232,4239 **** declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 401: ! #line 2263 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, --- 4268,4275 ---- declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 406: ! #line 2292 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, *************** case 401: *** 4243,4291 **** declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 402: ! #line 2277 "objc-parse.y" { pushlevel (0); clear_parm_order (); declare_parm_level (1); ; break;} ! case 403: ! #line 2281 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; parmlist_tags_warning (); poplevel (0, 0, 0); ; break;} ! case 405: ! #line 2289 "objc-parse.y" { tree t; for (t = yyvsp[-1].ttype; t; t = TREE_CHAIN (t)) if (TREE_VALUE (t) == NULL_TREE) error ("`...' in old-style identifier list"); yyval.ttype = tree_cons (NULL_TREE, NULL_TREE, yyvsp[-1].ttype); ; break;} ! case 406: ! #line 2299 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ; break;} ! case 407: ! #line 2301 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ; break;} ! case 408: ! #line 2307 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ; break;} ! case 409: ! #line 2309 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ; break;} ! case 410: ! #line 2314 "objc-parse.y" { yyval.itype = pedantic; pedantic = 0; ; break;} ! case 416: ! #line 2327 "objc-parse.y" { if (objc_implementation_context) { --- 4279,4327 ---- declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 407: ! #line 2306 "objc-parse.y" { pushlevel (0); clear_parm_order (); declare_parm_level (1); ; break;} ! case 408: ! #line 2310 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; parmlist_tags_warning (); poplevel (0, 0, 0); ; break;} ! case 410: ! #line 2318 "objc-parse.y" { tree t; for (t = yyvsp[-1].ttype; t; t = TREE_CHAIN (t)) if (TREE_VALUE (t) == NULL_TREE) error ("`...' in old-style identifier list"); yyval.ttype = tree_cons (NULL_TREE, NULL_TREE, yyvsp[-1].ttype); ; break;} ! case 411: ! #line 2328 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ; break;} ! case 412: ! #line 2330 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ; break;} ! case 413: ! #line 2336 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ; break;} ! case 414: ! #line 2338 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ; break;} ! case 415: ! #line 2343 "objc-parse.y" { yyval.itype = pedantic; pedantic = 0; ; break;} ! case 421: ! #line 2356 "objc-parse.y" { if (objc_implementation_context) { *************** case 416: *** 4297,4411 **** warning ("`@end' must appear in an implementation context"); ; break;} ! case 417: ! #line 2342 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ; break;} ! case 418: ! #line 2344 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ; break;} ! case 419: ! #line 2349 "objc-parse.y" { objc_declare_class (yyvsp[-1].ttype); ; break;} ! case 420: ! #line 2355 "objc-parse.y" { objc_declare_alias (yyvsp[-2].ttype, yyvsp[-1].ttype); ; break;} ! case 421: ! #line 2361 "objc-parse.y" { objc_interface_context = objc_ivar_context = start_class (CLASS_INTERFACE_TYPE, yyvsp[-2].ttype, NULL_TREE, yyvsp[-1].ttype); objc_public_flag = 0; ; break;} ! case 422: ! #line 2367 "objc-parse.y" { continue_class (objc_interface_context); ; break;} ! case 423: ! #line 2372 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 424: ! #line 2378 "objc-parse.y" { objc_interface_context = start_class (CLASS_INTERFACE_TYPE, yyvsp[-1].ttype, NULL_TREE, yyvsp[0].ttype); continue_class (objc_interface_context); ; break;} ! case 425: ! #line 2385 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 426: ! #line 2391 "objc-parse.y" { objc_interface_context = objc_ivar_context = start_class (CLASS_INTERFACE_TYPE, yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[-1].ttype); objc_public_flag = 0; ; break;} ! case 427: ! #line 2397 "objc-parse.y" { continue_class (objc_interface_context); ; break;} ! case 428: ! #line 2402 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 429: ! #line 2408 "objc-parse.y" { objc_interface_context = start_class (CLASS_INTERFACE_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, yyvsp[0].ttype); continue_class (objc_interface_context); ; break;} ! case 430: ! #line 2415 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 431: ! #line 2421 "objc-parse.y" { objc_implementation_context = objc_ivar_context = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-1].ttype, NULL_TREE, NULL_TREE); objc_public_flag = 0; ; break;} ! case 432: ! #line 2427 "objc-parse.y" { objc_ivar_chain = continue_class (objc_implementation_context); ; break;} ! case 433: ! #line 2433 "objc-parse.y" { objc_implementation_context = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[0].ttype, NULL_TREE, NULL_TREE); --- 4333,4447 ---- warning ("`@end' must appear in an implementation context"); ; break;} ! case 422: ! #line 2371 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ; break;} ! case 423: ! #line 2373 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-2].ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ; break;} ! case 424: ! #line 2378 "objc-parse.y" { objc_declare_class (yyvsp[-1].ttype); ; break;} ! case 425: ! #line 2384 "objc-parse.y" { objc_declare_alias (yyvsp[-2].ttype, yyvsp[-1].ttype); ; break;} ! case 426: ! #line 2390 "objc-parse.y" { objc_interface_context = objc_ivar_context = start_class (CLASS_INTERFACE_TYPE, yyvsp[-2].ttype, NULL_TREE, yyvsp[-1].ttype); objc_public_flag = 0; ; break;} ! case 427: ! #line 2396 "objc-parse.y" { continue_class (objc_interface_context); ; break;} ! case 428: ! #line 2401 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 429: ! #line 2407 "objc-parse.y" { objc_interface_context = start_class (CLASS_INTERFACE_TYPE, yyvsp[-1].ttype, NULL_TREE, yyvsp[0].ttype); continue_class (objc_interface_context); ; break;} ! case 430: ! #line 2414 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 431: ! #line 2420 "objc-parse.y" { objc_interface_context = objc_ivar_context = start_class (CLASS_INTERFACE_TYPE, yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[-1].ttype); objc_public_flag = 0; ; break;} ! case 432: ! #line 2426 "objc-parse.y" { continue_class (objc_interface_context); ; break;} ! case 433: ! #line 2431 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 434: ! #line 2437 "objc-parse.y" { objc_interface_context = start_class (CLASS_INTERFACE_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, yyvsp[0].ttype); continue_class (objc_interface_context); ; break;} ! case 435: ! #line 2444 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 436: ! #line 2450 "objc-parse.y" { objc_implementation_context = objc_ivar_context = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-1].ttype, NULL_TREE, NULL_TREE); objc_public_flag = 0; ; break;} ! case 437: ! #line 2456 "objc-parse.y" { objc_ivar_chain = continue_class (objc_implementation_context); ; break;} ! case 438: ! #line 2462 "objc-parse.y" { objc_implementation_context = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[0].ttype, NULL_TREE, NULL_TREE); *************** case 433: *** 4413,4435 **** = continue_class (objc_implementation_context); ; break;} ! case 434: ! #line 2441 "objc-parse.y" { objc_implementation_context = objc_ivar_context = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE); objc_public_flag = 0; ; break;} ! case 435: ! #line 2447 "objc-parse.y" { objc_ivar_chain = continue_class (objc_implementation_context); ; break;} ! case 436: ! #line 2453 "objc-parse.y" { objc_implementation_context = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); --- 4449,4471 ---- = continue_class (objc_implementation_context); ; break;} ! case 439: ! #line 2470 "objc-parse.y" { objc_implementation_context = objc_ivar_context = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE); objc_public_flag = 0; ; break;} ! case 440: ! #line 2476 "objc-parse.y" { objc_ivar_chain = continue_class (objc_implementation_context); ; break;} ! case 441: ! #line 2482 "objc-parse.y" { objc_implementation_context = start_class (CLASS_IMPLEMENTATION_TYPE, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); *************** case 436: *** 4437,4459 **** = continue_class (objc_implementation_context); ; break;} ! case 437: ! #line 2461 "objc-parse.y" { objc_interface_context = start_class (CATEGORY_INTERFACE_TYPE, yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[0].ttype); continue_class (objc_interface_context); ; break;} ! case 438: ! #line 2468 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 439: ! #line 2474 "objc-parse.y" { objc_implementation_context = start_class (CATEGORY_IMPLEMENTATION_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE); --- 4473,4495 ---- = continue_class (objc_implementation_context); ; break;} ! case 442: ! #line 2490 "objc-parse.y" { objc_interface_context = start_class (CATEGORY_INTERFACE_TYPE, yyvsp[-4].ttype, yyvsp[-2].ttype, yyvsp[0].ttype); continue_class (objc_interface_context); ; break;} ! case 443: ! #line 2497 "objc-parse.y" { finish_class (objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 444: ! #line 2503 "objc-parse.y" { objc_implementation_context = start_class (CATEGORY_IMPLEMENTATION_TYPE, yyvsp[-3].ttype, yyvsp[-1].ttype, NULL_TREE); *************** case 439: *** 4461,4490 **** = continue_class (objc_implementation_context); ; break;} ! case 440: ! #line 2484 "objc-parse.y" { remember_protocol_qualifiers (); objc_interface_context = start_protocol(PROTOCOL_INTERFACE_TYPE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 441: ! #line 2490 "objc-parse.y" { forget_protocol_qualifiers(); finish_protocol(objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 442: ! #line 2499 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 444: ! #line 2507 "objc-parse.y" { if (yyvsp[-2].code == LT_EXPR && yyvsp[0].code == GT_EXPR) yyval.ttype = yyvsp[-1].ttype; --- 4497,4526 ---- = continue_class (objc_implementation_context); ; break;} ! case 445: ! #line 2513 "objc-parse.y" { remember_protocol_qualifiers (); objc_interface_context = start_protocol(PROTOCOL_INTERFACE_TYPE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 446: ! #line 2519 "objc-parse.y" { forget_protocol_qualifiers(); finish_protocol(objc_interface_context); objc_interface_context = NULL_TREE; ; break;} ! case 447: ! #line 2528 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 449: ! #line 2536 "objc-parse.y" { if (yyvsp[-2].code == LT_EXPR && yyvsp[0].code == GT_EXPR) yyval.ttype = yyvsp[-1].ttype; *************** case 444: *** 4492,4548 **** YYERROR1; ; break;} ! case 447: ! #line 2521 "objc-parse.y" { objc_public_flag = 2; ; break;} ! case 448: ! #line 2522 "objc-parse.y" { objc_public_flag = 0; ; break;} ! case 449: ! #line 2523 "objc-parse.y" { objc_public_flag = 1; ; break;} ! case 450: ! #line 2528 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 452: ! #line 2533 "objc-parse.y" { if (pedantic) pedwarn ("extra semicolon in struct or union specified"); ; break;} ! case 453: ! #line 2551 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} ! case 454: ! #line 2557 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} ! case 455: ! #line 2563 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 456: ! #line 2568 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 459: ! #line 2575 "objc-parse.y" { yyval.ttype = add_instance_variable (objc_ivar_context, objc_public_flag, --- 4528,4584 ---- YYERROR1; ; break;} ! case 452: ! #line 2550 "objc-parse.y" { objc_public_flag = 2; ; break;} ! case 453: ! #line 2551 "objc-parse.y" { objc_public_flag = 0; ; break;} ! case 454: ! #line 2552 "objc-parse.y" { objc_public_flag = 1; ; break;} ! case 455: ! #line 2557 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 457: ! #line 2562 "objc-parse.y" { if (pedantic) pedwarn ("extra semicolon in struct or union specified"); ; break;} ! case 458: ! #line 2580 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} ! case 459: ! #line 2586 "objc-parse.y" { yyval.ttype = yyvsp[0].ttype; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-1].itype); ; break;} ! case 460: ! #line 2592 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 461: ! #line 2597 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 464: ! #line 2604 "objc-parse.y" { yyval.ttype = add_instance_variable (objc_ivar_context, objc_public_flag, *************** case 459: *** 4550,4565 **** NULL_TREE); ; break;} ! case 460: ! #line 2582 "objc-parse.y" { yyval.ttype = add_instance_variable (objc_ivar_context, objc_public_flag, yyvsp[-2].ttype, current_declspecs, yyvsp[0].ttype); ; break;} ! case 461: ! #line 2588 "objc-parse.y" { yyval.ttype = add_instance_variable (objc_ivar_context, objc_public_flag, --- 4586,4601 ---- NULL_TREE); ; break;} ! case 465: ! #line 2611 "objc-parse.y" { yyval.ttype = add_instance_variable (objc_ivar_context, objc_public_flag, yyvsp[-2].ttype, current_declspecs, yyvsp[0].ttype); ; break;} ! case 466: ! #line 2617 "objc-parse.y" { yyval.ttype = add_instance_variable (objc_ivar_context, objc_public_flag, *************** case 461: *** 4567,4574 **** current_declspecs, yyvsp[0].ttype); ; break;} ! case 462: ! #line 2598 "objc-parse.y" { remember_protocol_qualifiers (); if (objc_implementation_context) --- 4603,4610 ---- current_declspecs, yyvsp[0].ttype); ; break;} ! case 467: ! #line 2627 "objc-parse.y" { remember_protocol_qualifiers (); if (objc_implementation_context) *************** case 462: *** 4577,4584 **** fatal ("method definition not in class context"); ; break;} ! case 463: ! #line 2606 "objc-parse.y" { forget_protocol_qualifiers (); add_class_method (objc_implementation_context, yyvsp[0].ttype); --- 4613,4620 ---- fatal ("method definition not in class context"); ; break;} ! case 468: ! #line 2635 "objc-parse.y" { forget_protocol_qualifiers (); add_class_method (objc_implementation_context, yyvsp[0].ttype); *************** case 463: *** 4586,4606 **** objc_method_context = yyvsp[0].ttype; ; break;} ! case 464: ! #line 2613 "objc-parse.y" { continue_method_def (); ; break;} ! case 465: ! #line 2617 "objc-parse.y" { finish_method_def (); objc_method_context = NULL_TREE; ; break;} ! case 466: ! #line 2623 "objc-parse.y" { remember_protocol_qualifiers (); if (objc_implementation_context) --- 4622,4642 ---- objc_method_context = yyvsp[0].ttype; ; break;} ! case 469: ! #line 2642 "objc-parse.y" { continue_method_def (); ; break;} ! case 470: ! #line 2646 "objc-parse.y" { finish_method_def (); objc_method_context = NULL_TREE; ; break;} ! case 471: ! #line 2652 "objc-parse.y" { remember_protocol_qualifiers (); if (objc_implementation_context) *************** case 466: *** 4609,4616 **** fatal ("method definition not in class context"); ; break;} ! case 467: ! #line 2631 "objc-parse.y" { forget_protocol_qualifiers (); add_instance_method (objc_implementation_context, yyvsp[0].ttype); --- 4645,4652 ---- fatal ("method definition not in class context"); ; break;} ! case 472: ! #line 2660 "objc-parse.y" { forget_protocol_qualifiers (); add_instance_method (objc_implementation_context, yyvsp[0].ttype); *************** case 467: *** 4618,4885 **** objc_method_context = yyvsp[0].ttype; ; break;} ! case 468: ! #line 2638 "objc-parse.y" { continue_method_def (); ; break;} ! case 469: ! #line 2642 "objc-parse.y" { finish_method_def (); objc_method_context = NULL_TREE; ; break;} ! case 471: ! #line 2654 "objc-parse.y" {yyval.ttype = NULL_TREE; ; break;} ! case 476: ! #line 2661 "objc-parse.y" {yyval.ttype = NULL_TREE; ; break;} ! case 480: ! #line 2671 "objc-parse.y" { /* Remember protocol qualifiers in prototypes. */ remember_protocol_qualifiers (); objc_inherit_code = CLASS_METHOD_DECL; ; break;} ! case 481: ! #line 2677 "objc-parse.y" { /* Forget protocol qualifiers here. */ forget_protocol_qualifiers (); add_class_method (objc_interface_context, yyvsp[0].ttype); ; break;} ! case 483: ! #line 2685 "objc-parse.y" { /* Remember protocol qualifiers in prototypes. */ remember_protocol_qualifiers (); objc_inherit_code = INSTANCE_METHOD_DECL; ; break;} ! case 484: ! #line 2691 "objc-parse.y" { /* Forget protocol qualifiers here. */ forget_protocol_qualifiers (); add_instance_method (objc_interface_context, yyvsp[0].ttype); ; break;} ! case 486: ! #line 2701 "objc-parse.y" { yyval.ttype = build_method_decl (objc_inherit_code, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 487: ! #line 2706 "objc-parse.y" { yyval.ttype = build_method_decl (objc_inherit_code, NULL_TREE, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 488: ! #line 2711 "objc-parse.y" { yyval.ttype = build_method_decl (objc_inherit_code, yyvsp[-3].ttype, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 489: ! #line 2716 "objc-parse.y" { yyval.ttype = build_method_decl (objc_inherit_code, NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 498: ! #line 2746 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 499: ! #line 2751 "objc-parse.y" { shadow_tag (yyvsp[-1].ttype); ; break;} ! case 500: ! #line 2753 "objc-parse.y" { pedwarn ("empty declaration"); ; break;} ! case 501: ! #line 2758 "objc-parse.y" { push_parm_decl (yyvsp[0].ttype); ; break;} ! case 502: ! #line 2760 "objc-parse.y" { push_parm_decl (yyvsp[0].ttype); ; break;} ! case 503: ! #line 2768 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, yyvsp[0].ttype)); ; break;} ! case 504: ! #line 2773 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, yyvsp[0].ttype)); ; break;} ! case 505: ! #line 2778 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, yyvsp[0].ttype)); ; break;} ! case 506: ! #line 2786 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 507: ! #line 2790 "objc-parse.y" { /* oh what a kludge! */ yyval.ttype = (tree)1; ; break;} ! case 508: ! #line 2795 "objc-parse.y" { pushlevel (0); ; break;} ! case 509: ! #line 2799 "objc-parse.y" { /* returns a tree list node generated by get_parm_info */ yyval.ttype = yyvsp[0].ttype; poplevel (0, 0, 0); ; break;} ! case 512: ! #line 2814 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} - case 517: - #line 2827 "objc-parse.y" - { yyval.ttype = get_identifier (token_buffer); ; - break;} - case 518: - #line 2828 "objc-parse.y" - { yyval.ttype = get_identifier (token_buffer); ; - break;} - case 519: - #line 2829 "objc-parse.y" - { yyval.ttype = get_identifier (token_buffer); ; - break;} - case 520: - #line 2830 "objc-parse.y" - { yyval.ttype = get_identifier (token_buffer); ; - break;} - case 521: - #line 2831 "objc-parse.y" - { yyval.ttype = get_identifier (token_buffer); ; - break;} case 522: ! #line 2832 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 523: ! #line 2833 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 524: ! #line 2834 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 525: ! #line 2835 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 526: ! #line 2836 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 527: ! #line 2837 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 528: ! #line 2838 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 529: ! #line 2839 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 530: ! #line 2840 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 531: ! #line 2841 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 532: ! #line 2842 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 533: ! #line 2843 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 534: ! #line 2844 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 535: ! #line 2845 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 538: ! #line 2851 "objc-parse.y" { yyval.ttype = build_keyword_decl (yyvsp[-5].ttype, yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 539: ! #line 2856 "objc-parse.y" { yyval.ttype = build_keyword_decl (yyvsp[-2].ttype, NULL_TREE, yyvsp[0].ttype); ; break;} ! case 540: ! #line 2861 "objc-parse.y" { yyval.ttype = build_keyword_decl (NULL_TREE, yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 541: ! #line 2866 "objc-parse.y" { yyval.ttype = build_keyword_decl (NULL_TREE, NULL_TREE, yyvsp[0].ttype); ; break;} ! case 545: ! #line 2879 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 546: ! #line 2887 "objc-parse.y" { if (TREE_CHAIN (yyvsp[0].ttype) == NULL_TREE) /* just return the expr., remove a level of indirection */ --- 4654,4921 ---- objc_method_context = yyvsp[0].ttype; ; break;} ! case 473: ! #line 2667 "objc-parse.y" { continue_method_def (); ; break;} ! case 474: ! #line 2671 "objc-parse.y" { finish_method_def (); objc_method_context = NULL_TREE; ; break;} ! case 476: ! #line 2683 "objc-parse.y" {yyval.ttype = NULL_TREE; ; break;} ! case 481: ! #line 2690 "objc-parse.y" {yyval.ttype = NULL_TREE; ; break;} ! case 485: ! #line 2700 "objc-parse.y" { /* Remember protocol qualifiers in prototypes. */ remember_protocol_qualifiers (); objc_inherit_code = CLASS_METHOD_DECL; ; break;} ! case 486: ! #line 2706 "objc-parse.y" { /* Forget protocol qualifiers here. */ forget_protocol_qualifiers (); add_class_method (objc_interface_context, yyvsp[0].ttype); ; break;} ! case 488: ! #line 2714 "objc-parse.y" { /* Remember protocol qualifiers in prototypes. */ remember_protocol_qualifiers (); objc_inherit_code = INSTANCE_METHOD_DECL; ; break;} ! case 489: ! #line 2720 "objc-parse.y" { /* Forget protocol qualifiers here. */ forget_protocol_qualifiers (); add_instance_method (objc_interface_context, yyvsp[0].ttype); ; break;} ! case 491: ! #line 2730 "objc-parse.y" { yyval.ttype = build_method_decl (objc_inherit_code, yyvsp[-2].ttype, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 492: ! #line 2735 "objc-parse.y" { yyval.ttype = build_method_decl (objc_inherit_code, NULL_TREE, yyvsp[0].ttype, NULL_TREE); ; break;} ! case 493: ! #line 2740 "objc-parse.y" { yyval.ttype = build_method_decl (objc_inherit_code, yyvsp[-3].ttype, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 494: ! #line 2745 "objc-parse.y" { yyval.ttype = build_method_decl (objc_inherit_code, NULL_TREE, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 503: ! #line 2775 "objc-parse.y" { current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary (yyvsp[-2].itype); ; break;} ! case 504: ! #line 2780 "objc-parse.y" { shadow_tag (yyvsp[-1].ttype); ; break;} ! case 505: ! #line 2782 "objc-parse.y" { pedwarn ("empty declaration"); ; break;} ! case 506: ! #line 2787 "objc-parse.y" { push_parm_decl (yyvsp[0].ttype); ; break;} ! case 507: ! #line 2789 "objc-parse.y" { push_parm_decl (yyvsp[0].ttype); ; break;} ! case 508: ! #line 2797 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, yyvsp[0].ttype)); ; break;} ! case 509: ! #line 2802 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, yyvsp[0].ttype)); ; break;} ! case 510: ! #line 2807 "objc-parse.y" { yyval.ttype = build_tree_list (build_tree_list (current_declspecs, yyvsp[-1].ttype), build_tree_list (prefix_attributes, yyvsp[0].ttype)); ; break;} ! case 511: ! #line 2815 "objc-parse.y" { yyval.ttype = NULL_TREE; ; break;} ! case 512: ! #line 2819 "objc-parse.y" { /* oh what a kludge! */ yyval.ttype = (tree)1; ; break;} ! case 513: ! #line 2824 "objc-parse.y" { pushlevel (0); ; break;} ! case 514: ! #line 2828 "objc-parse.y" { /* returns a tree list node generated by get_parm_info */ yyval.ttype = yyvsp[0].ttype; poplevel (0, 0, 0); ; break;} ! case 517: ! #line 2843 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 522: ! #line 2856 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 523: ! #line 2857 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 524: ! #line 2858 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 525: ! #line 2859 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 526: ! #line 2860 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 527: ! #line 2861 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 528: ! #line 2862 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 529: ! #line 2863 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 530: ! #line 2864 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 531: ! #line 2865 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 532: ! #line 2866 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 533: ! #line 2867 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 534: ! #line 2868 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 535: ! #line 2869 "objc-parse.y" ! { yyval.ttype = get_identifier (token_buffer); ; ! break;} ! case 536: ! #line 2870 "objc-parse.y" ! { yyval.ttype = get_identifier (token_buffer); ; ! break;} ! case 537: ! #line 2871 "objc-parse.y" { yyval.ttype = get_identifier (token_buffer); ; break;} case 538: ! #line 2872 "objc-parse.y" ! { yyval.ttype = get_identifier (token_buffer); ; ! break;} ! case 539: ! #line 2873 "objc-parse.y" ! { yyval.ttype = get_identifier (token_buffer); ; ! break;} ! case 540: ! #line 2874 "objc-parse.y" ! { yyval.ttype = get_identifier (token_buffer); ; ! break;} ! case 543: ! #line 2880 "objc-parse.y" { yyval.ttype = build_keyword_decl (yyvsp[-5].ttype, yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 544: ! #line 2885 "objc-parse.y" { yyval.ttype = build_keyword_decl (yyvsp[-2].ttype, NULL_TREE, yyvsp[0].ttype); ; break;} ! case 545: ! #line 2890 "objc-parse.y" { yyval.ttype = build_keyword_decl (NULL_TREE, yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 546: ! #line 2895 "objc-parse.y" { yyval.ttype = build_keyword_decl (NULL_TREE, NULL_TREE, yyvsp[0].ttype); ; break;} ! case 550: ! #line 2908 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 551: ! #line 2916 "objc-parse.y" { if (TREE_CHAIN (yyvsp[0].ttype) == NULL_TREE) /* just return the expr., remove a level of indirection */ *************** case 546: *** 4889,4965 **** yyval.ttype = yyvsp[0].ttype; ; break;} ! case 547: ! #line 2899 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 548: ! #line 2903 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ; break;} ! case 550: ! #line 2911 "objc-parse.y" { yyval.ttype = get_class_reference (yyvsp[0].ttype); ; break;} ! case 551: ! #line 2918 "objc-parse.y" { objc_receiver_context = 1; ; break;} ! case 552: ! #line 2920 "objc-parse.y" { objc_receiver_context = 0; ; break;} ! case 553: ! #line 2922 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 557: ! #line 2935 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 558: ! #line 2942 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-1].ttype, NULL_TREE); ; break;} ! case 559: ! #line 2946 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, NULL_TREE); ; break;} ! case 560: ! #line 2953 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 561: ! #line 2960 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 562: ! #line 2969 "objc-parse.y" { yyval.ttype = groktypename (yyvsp[-1].ttype); ; break;} } /* the action file gets copied in in place of this dollarsign */ ! #line 498 "/usr/cygnus/progressive-98r1/share/bison.simple" yyvsp -= yylen; yyssp -= yylen; --- 4925,5001 ---- yyval.ttype = yyvsp[0].ttype; ; break;} ! case 552: ! #line 2928 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-2].ttype, yyvsp[0].ttype); ; break;} ! case 553: ! #line 2932 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype); ; break;} ! case 555: ! #line 2940 "objc-parse.y" { yyval.ttype = get_class_reference (yyvsp[0].ttype); ; break;} ! case 556: ! #line 2947 "objc-parse.y" { objc_receiver_context = 1; ; break;} ! case 557: ! #line 2949 "objc-parse.y" { objc_receiver_context = 0; ; break;} ! case 558: ! #line 2951 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} ! case 562: ! #line 2964 "objc-parse.y" { yyval.ttype = chainon (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} ! case 563: ! #line 2971 "objc-parse.y" { yyval.ttype = build_tree_list (yyvsp[-1].ttype, NULL_TREE); ; break;} ! case 564: ! #line 2975 "objc-parse.y" { yyval.ttype = build_tree_list (NULL_TREE, NULL_TREE); ; break;} ! case 565: ! #line 2982 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 566: ! #line 2989 "objc-parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} ! case 567: ! #line 2998 "objc-parse.y" { yyval.ttype = groktypename (yyvsp[-1].ttype); ; break;} } /* the action file gets copied in in place of this dollarsign */ ! #line 498 "/usr/lib/bison.simple" yyvsp -= yylen; yyssp -= yylen; *************** yyerrhandle: *** 5155,5159 **** yystate = yyn; goto yynewstate; } ! #line 2974 "objc-parse.y" --- 5191,5195 ---- yystate = yyn; goto yynewstate; } ! #line 3003 "objc-parse.y" diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/objc-parse.y gcc-2.95/gcc/objc/objc-parse.y *** egcs-1.1.2/gcc/objc/objc-parse.y Sun Mar 14 03:13:11 1999 --- gcc-2.95/gcc/objc/objc-parse.y Thu Jul 29 05:46:15 1999 *************** *** 1,6 **** /*WARNING: This file is automatically generated!*/ /* YACC parser for C syntax and for Objective C. -*-c-*- ! Copyright (C) 1987, 88, 89, 92-97, 1998 Free Software Foundation, Inc. This file is part of GNU CC. --- 1,6 ---- /*WARNING: This file is automatically generated!*/ /* YACC parser for C syntax and for Objective C. -*-c-*- ! Copyright (C) 1987, 88, 89, 92-98, 1999 Free Software Foundation, Inc. This file is part of GNU CC. *************** char *language_string = "GNU Obj-C"; *** 82,88 **** yylval contains an IDENTIFIER_NODE which indicates which one. */ %token TYPESPEC ! /* Reserved words that qualify type: "const" or "volatile". yylval contains an IDENTIFIER_NODE which indicates which one. */ %token TYPE_QUAL --- 82,88 ---- yylval contains an IDENTIFIER_NODE which indicates which one. */ %token TYPESPEC ! /* Reserved words that qualify type: "const", "volatile", or "restrict". yylval contains an IDENTIFIER_NODE which indicates which one. */ %token TYPE_QUAL *************** cast_expr: *** 483,489 **** tree type = $2; finish_init (); ! if (pedantic) pedwarn ("ANSI C forbids constructor expressions"); if (TYPE_NAME (type) != 0) { --- 483,489 ---- tree type = $2; finish_init (); ! if (pedantic && ! flag_isoc9x) pedwarn ("ANSI C forbids constructor expressions"); if (TYPE_NAME (type) != 0) { *************** expr_no_commas: *** 562,573 **** { skip_evaluation -= $1 == boolean_true_node; $$ = build_conditional_expr ($1, $2, $5); } | expr_no_commas '=' expr_no_commas ! { $$ = build_modify_expr ($1, NOP_EXPR, $3); ! C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); } | expr_no_commas ASSIGN expr_no_commas ! { $$ = build_modify_expr ($1, $2, $3); /* This inhibits warnings in truthvalue_conversion. */ ! C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); } ; primary: --- 562,583 ---- { skip_evaluation -= $1 == boolean_true_node; $$ = build_conditional_expr ($1, $2, $5); } | expr_no_commas '=' expr_no_commas ! { char class; ! $$ = build_modify_expr ($1, NOP_EXPR, $3); ! class = TREE_CODE_CLASS (TREE_CODE ($$)); ! if (class == 'e' || class == '1' ! || class == '2' || class == '<') ! C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); ! } | expr_no_commas ASSIGN expr_no_commas ! { char class; ! $$ = build_modify_expr ($1, $2, $3); /* This inhibits warnings in truthvalue_conversion. */ ! class = TREE_CODE_CLASS (TREE_CODE ($$)); ! if (class == 'e' || class == '1' ! || class == '2' || class == '<') ! C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); ! } ; primary: *************** initlist1: *** 1215,1236 **** /* `initelt' is a single element of an initializer. It may use braces. */ initelt: ! expr_no_commas ! { process_init_element ($1); } ! | '{' { push_init_level (0); } initlist_maybe_comma '}' { process_init_element (pop_init_level (0)); } | error /* These are for labeled elements. The syntax for an array element initializer conflicts with the syntax for an Objective-C message, so don't include these productions in the Objective-C grammar. */ - | identifier ':' - { set_init_label ($1); } - initelt - | '.' identifier '=' - { set_init_label ($2); } - initelt ; nested_function: --- 1225,1259 ---- /* `initelt' is a single element of an initializer. It may use braces. */ initelt: ! designator_list '=' initval ! | designator initval ! | identifier ':' ! { set_init_label ($1); } ! initval ! | initval ! ; ! ! initval: ! '{' { push_init_level (0); } initlist_maybe_comma '}' { process_init_element (pop_init_level (0)); } + | expr_no_commas + { process_init_element ($1); } | error + ; + + designator_list: + designator + | designator_list designator + ; + + designator: + '.' identifier + { set_init_label ($2); } /* These are for labeled elements. The syntax for an array element initializer conflicts with the syntax for an Objective-C message, so don't include these productions in the Objective-C grammar. */ ; nested_function: *************** maybecomma: *** 1436,1442 **** maybecomma_warn: /* empty */ | ',' ! { if (pedantic) pedwarn ("comma at end of enumerator list"); } ; component_decl_list: --- 1459,1466 ---- maybecomma_warn: /* empty */ | ',' ! { if (pedantic && ! flag_isoc9x) ! pedwarn ("comma at end of enumerator list"); } ; component_decl_list: *************** absdcl1: /* a nonempty absolute declara *** 1601,1606 **** --- 1625,1632 ---- { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); } /* ??? It appears we have to support attributes here, however using prefix_attributes is wrong. */ + | attributes setattrs absdcl1 + { $$ = $3; } ; /* at least one statement, the first of which parses without error. */ *************** label: CASE expr_no_commas ':' *** 2114,2125 **** error_with_decl (duplicate, "this is the first default label"); } position_after_white_space (); } ! | identifier ':' { tree label = define_label (input_filename, lineno, $1); stmt_count++; emit_nop (); if (label) ! expand_label (label); position_after_white_space (); } ; --- 2140,2154 ---- error_with_decl (duplicate, "this is the first default label"); } position_after_white_space (); } ! | identifier ':' maybe_attribute { tree label = define_label (input_filename, lineno, $1); stmt_count++; emit_nop (); if (label) ! { ! expand_label (label); ! decl_attributes (label, $3, NULL_TREE); ! } position_after_white_space (); } ; diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/objc-tree.def gcc-2.95/gcc/objc/objc-tree.def *** egcs-1.1.2/gcc/objc/objc-tree.def Thu Dec 11 22:49:29 1997 --- gcc-2.95/gcc/objc/objc-tree.def Wed Jan 6 13:10:34 1999 *************** *** 1,7 **** /* This file contains the definitions and documentation for the additional tree codes used in the Objective C front end (see tree.def for the standard codes). ! Copyright (C) 1990 Free Software Foundation, Inc. This file is part of GNU CC. --- 1,7 ---- /* This file contains the definitions and documentation for the additional tree codes used in the Objective C front end (see tree.def for the standard codes). ! Copyright (C) 1990, 1997 Free Software Foundation, Inc. This file is part of GNU CC. diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/objc.h gcc-2.95/gcc/objc/objc.h *** egcs-1.1.2/gcc/objc/objc.h Mon Aug 11 08:58:09 1997 --- gcc-2.95/gcc/objc/objc.h Wed Dec 31 16:00:00 1969 *************** *** 1,157 **** - /* 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 - - /* - ** 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 */ - }; - - #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 */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/objects.c gcc-2.95/gcc/objc/objects.c *** egcs-1.1.2/gcc/objc/objects.c Mon Aug 11 08:58:09 1997 --- gcc-2.95/gcc/objc/objects.c Wed Dec 31 16:00:00 1969 *************** *** 1,92 **** - /* GNU Objective C Runtime class related functions - 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. */ - - #include "../tconfig.h" /* include defs of bzero for target */ - #include "runtime.h" /* the kitchen sink */ - - id __objc_object_alloc(Class); - id __objc_object_dispose(id); - id __objc_object_copy(id); - - id (*_objc_object_alloc)(Class) = __objc_object_alloc; /* !T:SINGLE */ - id (*_objc_object_dispose)(id) = __objc_object_dispose; /* !T:SINGLE */ - id (*_objc_object_copy)(id) = __objc_object_copy; /* !T:SINGLE */ - - id - class_create_instance(Class class) - { - id new = nil; - if (CLS_ISCLASS(class)) - new = (*_objc_object_alloc)(class); - if (new!=nil) - { - memset (new, 0, class->instance_size); - new->class_pointer = class; - } - return new; - } - - id - object_copy(id object) - { - if ((object!=nil)&&CLS_ISCLASS(object->class_pointer)) - return (*_objc_object_copy)(object); - else - return nil; - } - - id - object_dispose(id object) - { - if ((object!=nil)&&CLS_ISCLASS(object->class_pointer)) - { - if (_objc_object_dispose) - (*_objc_object_dispose)(object); - else - objc_free(object); - } - return nil; - } - - id __objc_object_alloc(Class class) - { - return (id)objc_malloc(class->instance_size); - } - - id __objc_object_dispose(id object) - { - objc_free(object); - return 0; - } - - id __objc_object_copy(id object) - { - id copy = class_create_instance(object->class_pointer); - memcpy(copy, object, object->class_pointer->instance_size); - return copy; - } - - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/runtime.h gcc-2.95/gcc/objc/runtime.h *** egcs-1.1.2/gcc/objc/runtime.h Sat Dec 6 09:29:59 1997 --- gcc-2.95/gcc/objc/runtime.h Wed Dec 31 16:00:00 1969 *************** *** 1,88 **** - /* 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 /* for varargs and va_list's */ - - #include - #include - - #include /* 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 */ - - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/sarray.c gcc-2.95/gcc/objc/sarray.c *** egcs-1.1.2/gcc/objc/sarray.c Mon Aug 11 08:58:10 1997 --- gcc-2.95/gcc/objc/sarray.c Wed Dec 31 16:00:00 1969 *************** *** 1,522 **** - /* Sparse Arrays for Objective C dispatch tables - 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. */ - - #include "objc/sarray.h" - #include "objc/runtime.h" - #include - #include "assert.h" - - int nbuckets = 0; /* !T:MUTEX */ - int nindices = 0; /* !T:MUTEX */ - int narrays = 0; /* !T:MUTEX */ - int idxsize = 0; /* !T:MUTEX */ - - static void * first_free_data = NULL; /* !T:MUTEX */ - - #ifdef OBJC_SPARSE2 - const char* __objc_sparse2_id = "2 level sparse indices"; - #endif - - #ifdef OBJC_SPARSE3 - const char* __objc_sparse3_id = "3 level sparse indices"; - #endif - - #ifdef __alpha__ - const void *memcpy (void*, const void*, size_t); - #endif - - /* This function removes any structures left over from free operations - that were not safe in a multi-threaded environment. */ - void - sarray_remove_garbage(void) - { - void **vp; - void *np; - - objc_mutex_lock(__objc_runtime_mutex); - - vp = first_free_data; - first_free_data = NULL; - - while (vp) { - np = *vp; - objc_free(vp); - vp = np; - } - - objc_mutex_unlock(__objc_runtime_mutex); - } - - /* Free a block of dynamically allocated memory. If we are in multi-threaded - mode, it is ok to free it. If not, we add it to the garbage heap to be - freed later. */ - - static void - sarray_free_garbage(void *vp) - { - objc_mutex_lock(__objc_runtime_mutex); - - if (__objc_runtime_threads_alive == 1) { - objc_free(vp); - if (first_free_data) - sarray_remove_garbage(); - } - else { - *(void **)vp = first_free_data; - first_free_data = vp; - } - - objc_mutex_unlock(__objc_runtime_mutex); - } - - /* sarray_at_put : copies data in such a way as to be thread reader safe. */ - void - sarray_at_put(struct sarray* array, sidx index, void* element) - { - #ifdef OBJC_SPARSE3 - struct sindex** the_index; - struct sindex* new_index; - #endif - struct sbucket** the_bucket; - struct sbucket* new_bucket; - #ifdef OBJC_SPARSE3 - size_t ioffset; - #endif - size_t boffset; - size_t eoffset; - #ifdef PRECOMPUTE_SELECTORS - union sofftype xx; - xx.idx = index; - #ifdef OBJC_SPARSE3 - ioffset = xx.off.ioffset; - #endif - boffset = xx.off.boffset; - eoffset = xx.off.eoffset; - #else /* not PRECOMPUTE_SELECTORS */ - #ifdef OBJC_SPARSE3 - ioffset = index/INDEX_CAPACITY; - boffset = (index/BUCKET_SIZE)%INDEX_SIZE; - eoffset = index%BUCKET_SIZE; - #else - boffset = index/BUCKET_SIZE; - eoffset = index%BUCKET_SIZE; - #endif - #endif /* not PRECOMPUTE_SELECTORS */ - - assert(soffset_decode(index) < array->capacity); /* Range check */ - - #ifdef OBJC_SPARSE3 - the_index = &(array->indices[ioffset]); - the_bucket = &((*the_index)->buckets[boffset]); - #else - the_bucket = &(array->buckets[boffset]); - #endif - - if ((*the_bucket)->elems[eoffset] == element) - return; /* great! we just avoided a lazy copy */ - - #ifdef OBJC_SPARSE3 - - /* First, perform lazy copy/allocation of index if needed */ - - if ((*the_index) == array->empty_index) { - - /* The index was previously empty, allocate a new */ - new_index = (struct sindex*)objc_malloc(sizeof(struct sindex)); - memcpy(new_index, array->empty_index, sizeof(struct sindex)); - new_index->version.version = array->version.version; - *the_index = new_index; /* Prepared for install. */ - the_bucket = &((*the_index)->buckets[boffset]); - - nindices += 1; - } else if ((*the_index)->version.version != array->version.version) { - - /* This index must be lazy copied */ - struct sindex* old_index = *the_index; - new_index = (struct sindex*)objc_malloc(sizeof(struct sindex)); - memcpy( new_index, old_index, sizeof(struct sindex)); - new_index->version.version = array->version.version; - *the_index = new_index; /* Prepared for install. */ - the_bucket = &((*the_index)->buckets[boffset]); - - nindices += 1; - } - - #endif /* OBJC_SPARSE3 */ - - /* next, perform lazy allocation/copy of the bucket if needed */ - - if ((*the_bucket) == array->empty_bucket) { - - /* The bucket was previously empty (or something like that), */ - /* allocate a new. This is the effect of `lazy' allocation */ - new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket)); - memcpy((void *) new_bucket, (const void*)array->empty_bucket, - sizeof(struct sbucket)); - new_bucket->version.version = array->version.version; - *the_bucket = new_bucket; /* Prepared for install. */ - - nbuckets += 1; - - } else if ((*the_bucket)->version.version != array->version.version) { - - /* Perform lazy copy. */ - struct sbucket* old_bucket = *the_bucket; - new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket)); - memcpy( new_bucket, old_bucket, sizeof(struct sbucket)); - new_bucket->version.version = array->version.version; - *the_bucket = new_bucket; /* Prepared for install. */ - - nbuckets += 1; - - } - (*the_bucket)->elems[eoffset] = element; - } - - void - sarray_at_put_safe(struct sarray* array, sidx index, void* element) - { - if(soffset_decode(index) >= array->capacity) - sarray_realloc(array, soffset_decode(index)+1); - sarray_at_put(array, index, element); - } - - struct sarray* - sarray_new (int size, void* default_element) - { - struct sarray* arr; - #ifdef OBJC_SPARSE3 - size_t num_indices = ((size-1)/(INDEX_CAPACITY))+1; - struct sindex ** new_indices; - #else /* OBJC_SPARSE2 */ - size_t num_indices = ((size-1)/BUCKET_SIZE)+1; - struct sbucket ** new_buckets; - #endif - int counter; - - assert(size > 0); - - /* Allocate core array */ - arr = (struct sarray*) objc_malloc(sizeof(struct sarray)); - arr->version.version = 0; - - /* Initialize members */ - #ifdef OBJC_SPARSE3 - arr->capacity = num_indices*INDEX_CAPACITY; - new_indices = (struct sindex**) - objc_malloc(sizeof(struct sindex*)*num_indices); - - arr->empty_index = (struct sindex*) objc_malloc(sizeof(struct sindex)); - arr->empty_index->version.version = 0; - - narrays += 1; - idxsize += num_indices; - nindices += 1; - - #else /* OBJC_SPARSE2 */ - arr->capacity = num_indices*BUCKET_SIZE; - new_buckets = (struct sbucket**) - objc_malloc(sizeof(struct sbucket*)*num_indices); - - narrays += 1; - idxsize += num_indices; - - #endif - - arr->empty_bucket = (struct sbucket*) objc_malloc(sizeof(struct sbucket)); - arr->empty_bucket->version.version = 0; - - nbuckets += 1; - - arr->ref_count = 1; - arr->is_copy_of = (struct sarray*)0; - - for (counter=0; counterempty_bucket->elems[counter] = default_element; - - #ifdef OBJC_SPARSE3 - for (counter=0; counterempty_index->buckets[counter] = arr->empty_bucket; - - for (counter=0; counterempty_index; - - #else /* OBJC_SPARSE2 */ - - for (counter=0; counterempty_bucket; - - #endif - - #ifdef OBJC_SPARSE3 - arr->indices = new_indices; - #else /* OBJC_SPARSE2 */ - arr->buckets = new_buckets; - #endif - - return arr; - } - - - /* Reallocate the sparse array to hold `newsize' entries - Note: We really allocate and then free. We have to do this to ensure that - any concurrent readers notice the update. */ - - void - sarray_realloc(struct sarray* array, int newsize) - { - #ifdef OBJC_SPARSE3 - size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY; - size_t new_max_index = ((newsize-1)/INDEX_CAPACITY); - size_t rounded_size = (new_max_index+1)*INDEX_CAPACITY; - - struct sindex ** new_indices; - struct sindex ** old_indices; - - #else /* OBJC_SPARSE2 */ - size_t old_max_index = (array->capacity-1)/BUCKET_SIZE; - size_t new_max_index = ((newsize-1)/BUCKET_SIZE); - size_t rounded_size = (new_max_index+1)*BUCKET_SIZE; - - struct sbucket ** new_buckets; - struct sbucket ** old_buckets; - - #endif - - int counter; - - assert(newsize > 0); - - /* The size is the same, just ignore the request */ - if(rounded_size <= array->capacity) - return; - - assert(array->ref_count == 1); /* stop if lazy copied... */ - - /* We are asked to extend the array -- allocate new bucket table, */ - /* and insert empty_bucket in newly allocated places. */ - if(rounded_size > array->capacity) - { - - #ifdef OBJC_SPARSE3 - new_max_index += 4; - rounded_size = (new_max_index+1)*INDEX_CAPACITY; - - #else /* OBJC_SPARSE2 */ - new_max_index += 4; - rounded_size = (new_max_index+1)*BUCKET_SIZE; - #endif - - /* update capacity */ - array->capacity = rounded_size; - - #ifdef OBJC_SPARSE3 - /* alloc to force re-read by any concurrent readers. */ - old_indices = array->indices; - new_indices = (struct sindex**) - objc_malloc((new_max_index+1)*sizeof(struct sindex*)); - #else /* OBJC_SPARSE2 */ - old_buckets = array->buckets; - new_buckets = (struct sbucket**) - objc_malloc((new_max_index+1)*sizeof(struct sbucket*)); - #endif - - /* copy buckets below old_max_index (they are still valid) */ - for(counter = 0; counter <= old_max_index; counter++ ) { - #ifdef OBJC_SPARSE3 - new_indices[counter] = old_indices[counter]; - #else /* OBJC_SPARSE2 */ - new_buckets[counter] = old_buckets[counter]; - #endif - } - - #ifdef OBJC_SPARSE3 - /* reset entries above old_max_index to empty_bucket */ - for(counter = old_max_index+1; counter <= new_max_index; counter++) - new_indices[counter] = array->empty_index; - #else /* OBJC_SPARSE2 */ - /* reset entries above old_max_index to empty_bucket */ - for(counter = old_max_index+1; counter <= new_max_index; counter++) - new_buckets[counter] = array->empty_bucket; - #endif - - #ifdef OBJC_SPARSE3 - /* install the new indices */ - array->indices = new_indices; - #else /* OBJC_SPARSE2 */ - array->buckets = new_buckets; - #endif - - #ifdef OBJC_SPARSE3 - /* free the old indices */ - sarray_free_garbage(old_indices); - #else /* OBJC_SPARSE2 */ - sarray_free_garbage(old_buckets); - #endif - - idxsize += (new_max_index-old_max_index); - return; - } - } - - - /* Free a sparse array allocated with sarray_new */ - - void - sarray_free(struct sarray* array) { - - #ifdef OBJC_SPARSE3 - size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY; - struct sindex ** old_indices; - #else - size_t old_max_index = (array->capacity-1)/BUCKET_SIZE; - struct sbucket ** old_buckets; - #endif - int counter = 0; - - assert(array->ref_count != 0); /* Freed multiple times!!! */ - - if(--(array->ref_count) != 0) /* There exists copies of me */ - return; - - #ifdef OBJC_SPARSE3 - old_indices = array->indices; - #else - old_buckets = array->buckets; - #endif - - if((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0)) - sarray_free(array->is_copy_of); - - /* Free all entries that do not point to empty_bucket */ - for(counter = 0; counter <= old_max_index; counter++ ) { - #ifdef OBJC_SPARSE3 - struct sindex* idx = old_indices[counter]; - if((idx != array->empty_index) && - (idx->version.version == array->version.version)) { - int c2; - for(c2=0; c2buckets[c2]; - if((bkt != array->empty_bucket) && - (bkt->version.version == array->version.version)) - { - sarray_free_garbage(bkt); - nbuckets -= 1; - } - } - sarray_free_garbage(idx); - nindices -= 1; - } - #else /* OBJC_SPARSE2 */ - struct sbucket* bkt = array->buckets[counter]; - if ((bkt != array->empty_bucket) && - (bkt->version.version == array->version.version)) - { - sarray_free_garbage(bkt); - nbuckets -= 1; - } - #endif - } - - #ifdef OBJC_SPARSE3 - /* free empty_index */ - if(array->empty_index->version.version == array->version.version) { - sarray_free_garbage(array->empty_index); - nindices -= 1; - } - #endif - - /* free empty_bucket */ - if(array->empty_bucket->version.version == array->version.version) { - sarray_free_garbage(array->empty_bucket); - nbuckets -= 1; - } - idxsize -= (old_max_index+1); - narrays -= 1; - - #ifdef OBJC_SPARSE3 - /* free bucket table */ - sarray_free_garbage(array->indices); - - #else - /* free bucket table */ - sarray_free_garbage(array->buckets); - - #endif - - /* free array */ - sarray_free_garbage(array); - } - - /* This is a lazy copy. Only the core of the structure is actually */ - /* copied. */ - - struct sarray* - sarray_lazy_copy(struct sarray* oarr) - { - struct sarray* arr; - - #ifdef OBJC_SPARSE3 - size_t num_indices = ((oarr->capacity-1)/INDEX_CAPACITY)+1; - struct sindex ** new_indices; - #else /* OBJC_SPARSE2 */ - size_t num_indices = ((oarr->capacity-1)/BUCKET_SIZE)+1; - struct sbucket ** new_buckets; - #endif - - /* Allocate core array */ - arr = (struct sarray*) objc_malloc(sizeof(struct sarray)); /* !!! */ - arr->version.version = oarr->version.version + 1; - #ifdef OBJC_SPARSE3 - arr->empty_index = oarr->empty_index; - #endif - arr->empty_bucket = oarr->empty_bucket; - arr->ref_count = 1; - oarr->ref_count += 1; - arr->is_copy_of = oarr; - arr->capacity = oarr->capacity; - - #ifdef OBJC_SPARSE3 - /* Copy bucket table */ - new_indices = (struct sindex**) - objc_malloc(sizeof(struct sindex*)*num_indices); - memcpy( new_indices,oarr->indices, - sizeof(struct sindex*)*num_indices); - arr->indices = new_indices; - #else - /* Copy bucket table */ - new_buckets = (struct sbucket**) - objc_malloc(sizeof(struct sbucket*)*num_indices); - memcpy( new_buckets,oarr->buckets, - sizeof(struct sbucket*)*num_indices); - arr->buckets = new_buckets; - #endif - - idxsize += num_indices; - narrays += 1; - - return arr; - } --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/sarray.h gcc-2.95/gcc/objc/sarray.h *** egcs-1.1.2/gcc/objc/sarray.h Mon Aug 11 08:58:10 1997 --- gcc-2.95/gcc/objc/sarray.h Wed Dec 31 16:00:00 1969 *************** *** 1,237 **** - /* 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 - - #include "objc/thr.h" - - extern int nbuckets; /* for stats */ - extern int nindices; - extern int narrays; - extern int idxsize; - - #include - - /* 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< - 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 */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/selector.c gcc-2.95/gcc/objc/selector.c *** egcs-1.1.2/gcc/objc/selector.c Sat Dec 6 09:30:01 1997 --- gcc-2.95/gcc/objc/selector.c Wed Dec 31 16:00:00 1969 *************** *** 1,458 **** - /* GNU Objective C Runtime selector related functions - 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. */ - - #include "runtime.h" - #include "objc/sarray.h" - #include "encoding.h" - - /* Initial selector hash table size. Value doesn't matter much */ - #define SELECTOR_HASH_SIZE 128 - - /* Tables mapping selector names to uid and opposite */ - static struct sarray* __objc_selector_array = 0; /* uid -> sel !T:MUTEX */ - static struct sarray* __objc_selector_names = 0; /* uid -> name !T:MUTEX */ - static cache_ptr __objc_selector_hash = 0; /* name -> uid !T:MUTEX */ - - static void register_selectors_from_list(MethodList_t); - - /* Number of selectors stored in each of the above tables */ - int __objc_selector_max_index = 0; /* !T:MUTEX */ - - void __objc_init_selector_tables() - { - __objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0); - __objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0); - __objc_selector_hash - = hash_new (SELECTOR_HASH_SIZE, - (hash_func_type) hash_string, - (compare_func_type) compare_strings); - } - - /* This routine is given a class and records all of the methods in its class - structure in the record table. */ - void - __objc_register_selectors_from_class (Class class) - { - MethodList_t method_list; - - method_list = class->methods; - while (method_list) - { - register_selectors_from_list (method_list); - method_list = method_list->method_next; - } - } - - - /* This routine is given a list of methods and records each of the methods in - the record table. This is the routine that does the actual recording - work. - - This one is only called for Class objects. For categories, - class_add_method_list is called. - */ - static void - register_selectors_from_list (MethodList_t method_list) - { - int i = 0; - while (i < method_list->method_count) - { - Method_t method = &method_list->method_list[i]; - method->method_name - = sel_register_typed_name ((const char*)method->method_name, - method->method_types); - i += 1; - } - } - - - /* Register instance methods as class methods for root classes */ - void __objc_register_instance_methods_to_class(Class class) - { - MethodList_t method_list; - MethodList_t class_method_list; - int max_methods_no = 16; - MethodList_t new_list; - Method_t curr_method; - - /* Only if a root class. */ - if(class->super_class) - return; - - /* Allocate a method list to hold the new class methods */ - new_list = objc_calloc(sizeof(struct objc_method_list) - + sizeof(struct objc_method[max_methods_no]), 1); - method_list = class->methods; - class_method_list = class->class_pointer->methods; - curr_method = &new_list->method_list[0]; - - /* Iterate through the method lists for the class */ - while (method_list) - { - int i; - - /* Iterate through the methods from this method list */ - for (i = 0; i < method_list->method_count; i++) - { - Method_t mth = &method_list->method_list[i]; - if (mth->method_name - && !search_for_method_in_list (class_method_list, - mth->method_name)) - { - /* This instance method isn't a class method. - Add it into the new_list. */ - *curr_method = *mth; - - /* Reallocate the method list if necessary */ - if(++new_list->method_count == max_methods_no) - new_list = - objc_realloc(new_list, sizeof(struct objc_method_list) - + sizeof(struct - objc_method[max_methods_no += 16])); - curr_method = &new_list->method_list[new_list->method_count]; - } - } - - method_list = method_list->method_next; - } - - /* If we created any new class methods - then attach the method list to the class */ - if (new_list->method_count) - { - new_list = - objc_realloc(new_list, sizeof(struct objc_method_list) - + sizeof(struct objc_method[new_list->method_count])); - new_list->method_next = class->class_pointer->methods; - class->class_pointer->methods = new_list; - } - - __objc_update_dispatch_table_for_class (class->class_pointer); - } - - - /* Returns YES iff t1 and t2 have same method types, but we ignore - the argframe layout */ - BOOL - sel_types_match (const char* t1, const char* t2) - { - if (!t1 || !t2) - return NO; - while (*t1 && *t2) - { - if (*t1 == '+') t1++; - if (*t2 == '+') t2++; - while (isdigit(*t1)) t1++; - while (isdigit(*t2)) t2++; - /* xxx Remove these next two lines when qualifiers are put in - all selectors, not just Protocol selectors. */ - t1 = objc_skip_type_qualifiers(t1); - t2 = objc_skip_type_qualifiers(t2); - if (!*t1 && !*t2) - return YES; - if (*t1 != *t2) - return NO; - t1++; - t2++; - } - return NO; - } - - /* return selector representing name */ - SEL - sel_get_typed_uid (const char *name, const char *types) - { - struct objc_list *l; - sidx i; - - objc_mutex_lock(__objc_runtime_mutex); - - i = (sidx) hash_value_for_key (__objc_selector_hash, name); - if (i == 0) - { - objc_mutex_unlock(__objc_runtime_mutex); - return 0; - } - - for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - l; l = l->tail) - { - SEL s = (SEL)l->head; - if (types == 0 || s->sel_types == 0) - { - if (s->sel_types == types) - { - objc_mutex_unlock(__objc_runtime_mutex); - return s; - } - } - else if (sel_types_match (s->sel_types, types)) - { - objc_mutex_unlock(__objc_runtime_mutex); - return s; - } - } - - objc_mutex_unlock(__objc_runtime_mutex); - return 0; - } - - /* Return selector representing name; prefer a selector with non-NULL type */ - SEL - sel_get_any_typed_uid (const char *name) - { - struct objc_list *l; - sidx i; - SEL s = NULL; - - objc_mutex_lock(__objc_runtime_mutex); - - i = (sidx) hash_value_for_key (__objc_selector_hash, name); - if (i == 0) - { - objc_mutex_unlock(__objc_runtime_mutex); - return 0; - } - - for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - l; l = l->tail) - { - s = (SEL) l->head; - if (s->sel_types) - { - objc_mutex_unlock(__objc_runtime_mutex); - return s; - } - } - - objc_mutex_unlock(__objc_runtime_mutex); - return s; - } - - /* return selector representing name */ - SEL - sel_get_any_uid (const char *name) - { - struct objc_list *l; - sidx i; - - objc_mutex_lock(__objc_runtime_mutex); - - i = (sidx) hash_value_for_key (__objc_selector_hash, name); - if (soffset_decode (i) == 0) - { - objc_mutex_unlock(__objc_runtime_mutex); - return 0; - } - - l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - objc_mutex_unlock(__objc_runtime_mutex); - - if (l == 0) - return 0; - - return (SEL)l->head; - } - - /* return selector representing name */ - SEL - sel_get_uid (const char *name) - { - return sel_register_typed_name (name, 0); - } - - /* Get name of selector. If selector is unknown, the empty string "" - is returned */ - const char* - sel_get_name (SEL selector) - { - const char *ret; - - objc_mutex_lock(__objc_runtime_mutex); - if ((soffset_decode((sidx)selector->sel_id) > 0) - && (soffset_decode((sidx)selector->sel_id) <= __objc_selector_max_index)) - ret = sarray_get_safe (__objc_selector_names, (sidx) selector->sel_id); - else - ret = 0; - objc_mutex_unlock(__objc_runtime_mutex); - return ret; - } - - BOOL - sel_is_mapped (SEL selector) - { - unsigned int idx = soffset_decode ((sidx)selector->sel_id); - return ((idx > 0) && (idx <= __objc_selector_max_index)); - } - - - const char* - sel_get_type (SEL selector) - { - if (selector) - return selector->sel_types; - else - return 0; - } - - /* The uninstalled dispatch table */ - extern struct sarray* __objc_uninstalled_dtable; - - /* Store the passed selector name in the selector record and return its - selector value (value returned by sel_get_uid). - Assumes that the calling function has locked down __objc_runtime_mutex. */ - /* is_const parameter tells us if the name and types parameters - are really constant or not. If YES then they are constant and - we can just store the pointers. If NO then we need to copy - name and types because the pointers may disappear later on. */ - SEL - __sel_register_typed_name (const char *name, const char *types, - struct objc_selector *orig, BOOL is_const) - { - struct objc_selector* j; - sidx i; - struct objc_list *l; - - i = (sidx) hash_value_for_key (__objc_selector_hash, name); - if (soffset_decode (i) != 0) - { - for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - l; l = l->tail) - { - SEL s = (SEL)l->head; - if (types == 0 || s->sel_types == 0) - { - if (s->sel_types == types) - { - if (orig) - { - orig->sel_id = (void*)i; - return orig; - } - else - return s; - } - } - else if (!strcmp (s->sel_types, types)) - { - if (orig) - { - orig->sel_id = (void*)i; - return orig; - } - else - return s; - } - } - if (orig) - j = orig; - else - j = objc_malloc (sizeof (struct objc_selector)); - - j->sel_id = (void*)i; - /* Can we use the pointer or must copy types? Don't copy if NULL */ - if ((is_const) || (types == 0)) - j->sel_types = (const char*)types; - else { - j->sel_types = (char *) objc_malloc(strlen(types)+1); - strcpy((char *)j->sel_types, types); - } - l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); - } - else - { - __objc_selector_max_index += 1; - i = soffset_encode(__objc_selector_max_index); - if (orig) - j = orig; - else - j = objc_malloc (sizeof (struct objc_selector)); - - j->sel_id = (void*)i; - /* Can we use the pointer or must copy types? Don't copy if NULL */ - if ((is_const) || (types == 0)) - j->sel_types = (const char*)types; - else { - j->sel_types = (char *) objc_malloc(strlen(types)+1); - strcpy((char *)j->sel_types, types); - } - l = 0; - } - - DEBUG_PRINTF ("Record selector %s[%s] as: %ld\n", name, types, - soffset_decode (i)); - - { - int is_new = (l == 0); - const char *new_name; - - /* Can we use the pointer or must copy name? Don't copy if NULL */ - if ((is_const) || (name == 0)) - new_name = name; - else { - new_name = (char *) objc_malloc(strlen(name)+1); - strcpy((char *)new_name, name); - } - - l = list_cons ((void*)j, l); - sarray_at_put_safe (__objc_selector_names, i, (void *) new_name); - sarray_at_put_safe (__objc_selector_array, i, (void *) l); - if (is_new) - hash_add (&__objc_selector_hash, (void *) new_name, (void *) i); - } - - sarray_realloc(__objc_uninstalled_dtable, __objc_selector_max_index+1); - - return (SEL) j; - } - - SEL - sel_register_name (const char *name) - { - SEL ret; - - objc_mutex_lock(__objc_runtime_mutex); - /* Assume that name is not constant static memory and needs to be - copied before put into a runtime structure. is_const == NO */ - ret = __sel_register_typed_name (name, 0, 0, NO); - objc_mutex_unlock(__objc_runtime_mutex); - - return ret; - } - - SEL - sel_register_typed_name (const char *name, const char *type) - { - SEL ret; - - objc_mutex_lock(__objc_runtime_mutex); - /* Assume that name and type are not constant static memory and need to - be copied before put into a runtime structure. is_const == NO */ - ret = __sel_register_typed_name (name, type, 0, NO); - objc_mutex_unlock(__objc_runtime_mutex); - - return ret; - } - --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/sendmsg.c gcc-2.95/gcc/objc/sendmsg.c *** egcs-1.1.2/gcc/objc/sendmsg.c Mon Jun 29 14:40:49 1998 --- gcc-2.95/gcc/objc/sendmsg.c Wed Dec 31 16:00:00 1969 *************** *** 1,651 **** - /* GNU Objective C Runtime message lookup - Copyright (C) 1993, 1995, 1996, 1997, 1998 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. */ - - #include "../tconfig.h" - #include "runtime.h" - #include "sarray.h" - #include "encoding.h" - #include "runtime-info.h" - - /* this is how we hack STRUCT_VALUE to be 1 or 0 */ - #define gen_rtx(args...) 1 - #define gen_rtx_MEM(args...) 1 - #define rtx int - - #if !defined(STRUCT_VALUE) || STRUCT_VALUE == 0 - #define INVISIBLE_STRUCT_RETURN 1 - #else - #define INVISIBLE_STRUCT_RETURN 0 - #endif - - /* The uninstalled dispatch table */ - struct sarray* __objc_uninstalled_dtable = 0; /* !T:MUTEX */ - - /* Send +initialize to class */ - static void __objc_send_initialize(Class); - - static void __objc_install_dispatch_table_for_class (Class); - - /* Forward declare some functions */ - static void __objc_init_install_dtable(id, SEL); - - /* Various forwarding functions that are used based upon the - return type for the selector. - __objc_block_forward for structures. - __objc_double_forward for floats/doubles. - __objc_word_forward for pointers or types that fit in registers. - */ - static double __objc_double_forward(id, SEL, ...); - static id __objc_word_forward(id, SEL, ...); - typedef struct { id many[8]; } __big; - #if INVISIBLE_STRUCT_RETURN - static __big - #else - static id - #endif - __objc_block_forward(id, SEL, ...); - static Method_t search_for_method_in_hierarchy (Class class, SEL sel); - Method_t search_for_method_in_list(MethodList_t list, SEL op); - id nil_method(id, SEL, ...); - - /* Given a selector, return the proper forwarding implementation. */ - __inline__ - IMP - __objc_get_forward_imp (SEL sel) - { - const char *t = sel->sel_types; - - if (t && (*t == '[' || *t == '(' || *t == '{') - #ifdef OBJC_MAX_STRUCT_BY_VALUE - && objc_sizeof_type(t) > OBJC_MAX_STRUCT_BY_VALUE - #endif - ) - return (IMP)__objc_block_forward; - else if (t && (*t == 'f' || *t == 'd')) - return (IMP)__objc_double_forward; - else - return (IMP)__objc_word_forward; - } - - /* Given a class and selector, return the selector's implementation. */ - __inline__ - IMP - get_imp (Class class, SEL sel) - { - void* res = sarray_get_safe (class->dtable, (size_t) sel->sel_id); - if (res == 0) - { - /* Not a valid method */ - if(class->dtable == __objc_uninstalled_dtable) - { - /* The dispatch table needs to be installed. */ - objc_mutex_lock(__objc_runtime_mutex); - __objc_install_dispatch_table_for_class (class); - objc_mutex_unlock(__objc_runtime_mutex); - /* Call ourselves with the installed dispatch table - and get the real method */ - res = get_imp(class, sel); - } - else - { - /* The dispatch table has been installed so the - method just doesn't exist for the class. - Return the forwarding implementation. */ - res = __objc_get_forward_imp(sel); - } - } - return res; - } - - /* Query if an object can respond to a selector, returns YES if the - object implements the selector otherwise NO. Does not check if the - method can be forwarded. */ - __inline__ - BOOL - __objc_responds_to (id object, SEL sel) - { - void* res; - - /* Install dispatch table if need be */ - if (object->class_pointer->dtable == __objc_uninstalled_dtable) - { - objc_mutex_lock(__objc_runtime_mutex); - __objc_install_dispatch_table_for_class (object->class_pointer); - objc_mutex_unlock(__objc_runtime_mutex); - } - - /* Get the method from the dispatch table */ - res = sarray_get_safe (object->class_pointer->dtable, (size_t) sel->sel_id); - return (res != 0); - } - - /* This is the lookup function. All entries in the table are either a - valid method *or* zero. If zero then either the dispatch table - needs to be installed or it doesn't exist and forwarding is attempted. */ - __inline__ - IMP - objc_msg_lookup(id receiver, SEL op) - { - IMP result; - if(receiver) - { - result = sarray_get_safe (receiver->class_pointer->dtable, - (sidx)op->sel_id); - if (result == 0) - { - /* Not a valid method */ - if(receiver->class_pointer->dtable == __objc_uninstalled_dtable) - { - /* The dispatch table needs to be installed. - This happens on the very first method call to the class. */ - __objc_init_install_dtable(receiver, op); - - /* Get real method for this in newly installed dtable */ - result = get_imp(receiver->class_pointer, op); - } - else - { - /* The dispatch table has been installed so the - method just doesn't exist for the class. - Attempt to forward the method. */ - result = __objc_get_forward_imp(op); - } - } - return result; - } - else - return nil_method; - } - - IMP - objc_msg_lookup_super (Super_t super, SEL sel) - { - if (super->self) - return get_imp (super->class, sel); - else - return nil_method; - } - - int method_get_sizeof_arguments (Method*); - - retval_t - objc_msg_sendv(id object, SEL op, arglist_t arg_frame) - { - Method* m = class_get_instance_method(object->class_pointer, op); - const char *type; - *((id*)method_get_first_argument (m, arg_frame, &type)) = object; - *((SEL*)method_get_next_argument (arg_frame, &type)) = op; - return __builtin_apply((apply_t)m->method_imp, - arg_frame, - method_get_sizeof_arguments (m)); - } - - void - __objc_init_dispatch_tables() - { - __objc_uninstalled_dtable - = sarray_new(200, 0); - } - - /* This function is called by objc_msg_lookup when the - dispatch table needs to be installed; thus it is called once - for each class, namely when the very first message is sent to it. */ - static void - __objc_init_install_dtable(id receiver, SEL op) - { - /* This may happen, if the programmer has taken the address of a - method before the dtable was initialized... too bad for him! */ - if(receiver->class_pointer->dtable != __objc_uninstalled_dtable) - return; - - objc_mutex_lock(__objc_runtime_mutex); - - if(CLS_ISCLASS(receiver->class_pointer)) - { - /* receiver is an ordinary object */ - assert(CLS_ISCLASS(receiver->class_pointer)); - - /* install instance methods table */ - __objc_install_dispatch_table_for_class (receiver->class_pointer); - - /* call +initialize -- this will in turn install the factory - dispatch table if not already done :-) */ - __objc_send_initialize(receiver->class_pointer); - } - else - { - /* receiver is a class object */ - assert(CLS_ISCLASS((Class)receiver)); - assert(CLS_ISMETA(receiver->class_pointer)); - - /* Install real dtable for factory methods */ - __objc_install_dispatch_table_for_class (receiver->class_pointer); - - if (strcmp (sel_get_name (op), "initialize")) - __objc_send_initialize((Class)receiver); - else - CLS_SETINITIALIZED((Class)receiver); - } - objc_mutex_unlock(__objc_runtime_mutex); - } - - /* Install dummy table for class which causes the first message to - that class (or instances hereof) to be initialized properly */ - void - __objc_install_premature_dtable(Class class) - { - assert(__objc_uninstalled_dtable); - class->dtable = __objc_uninstalled_dtable; - } - - /* Send +initialize to class if not already done */ - static void - __objc_send_initialize(Class class) - { - /* This *must* be a class object */ - assert(CLS_ISCLASS(class)); - assert(!CLS_ISMETA(class)); - - if (!CLS_ISINITIALIZED(class)) - { - CLS_SETINITIALIZED(class); - CLS_SETINITIALIZED(class->class_pointer); - - if(class->super_class) - __objc_send_initialize(class->super_class); - - { - SEL op = sel_register_name ("initialize"); - Class tmpclass = class; - IMP imp = 0; - - while (!imp && tmpclass) { - MethodList_t method_list = tmpclass->class_pointer->methods; - - while(!imp && method_list) { - int i; - Method_t method; - - for (i=0;imethod_count;i++) { - method = &(method_list->method_list[i]); - if (method->method_name - && method->method_name->sel_id == op->sel_id) { - imp = method->method_imp; - break; - } - } - - method_list = method_list->method_next; - - } - - tmpclass = tmpclass->super_class; - } - if (imp) - (*imp)((id)class, op); - - } - } - } - - /* Walk on the methods list of class and install the methods in the reverse - order of the lists. Since methods added by categories are before the methods - of class in the methods list, this allows categories to substitute methods - declared in class. However if more than one category replaces the same - method nothing is guaranteed about what method will be used. - Assumes that __objc_runtime_mutex is locked down. */ - static void - __objc_install_methods_in_dtable (Class class, MethodList_t method_list) - { - int i; - - if (!method_list) - return; - - if (method_list->method_next) - __objc_install_methods_in_dtable (class, method_list->method_next); - - for (i = 0; i < method_list->method_count; i++) - { - Method_t method = &(method_list->method_list[i]); - sarray_at_put_safe (class->dtable, - (sidx) method->method_name->sel_id, - method->method_imp); - } - } - - /* Assumes that __objc_runtime_mutex is locked down. */ - static void - __objc_install_dispatch_table_for_class (Class class) - { - Class super; - - /* If the class has not yet had its class links resolved, we must - re-compute all class links */ - if(!CLS_ISRESOLV(class)) - __objc_resolve_class_links(); - - super = class->super_class; - - if (super != 0 && (super->dtable == __objc_uninstalled_dtable)) - __objc_install_dispatch_table_for_class (super); - - /* Allocate dtable if necessary */ - if (super == 0) - { - objc_mutex_lock(__objc_runtime_mutex); - class->dtable = sarray_new (__objc_selector_max_index, 0); - objc_mutex_unlock(__objc_runtime_mutex); - } - else - class->dtable = sarray_lazy_copy (super->dtable); - - __objc_install_methods_in_dtable (class, class->methods); - } - - void - __objc_update_dispatch_table_for_class (Class class) - { - Class next; - struct sarray *arr; - - /* not yet installed -- skip it */ - if (class->dtable == __objc_uninstalled_dtable) - return; - - objc_mutex_lock(__objc_runtime_mutex); - - arr = class->dtable; - __objc_install_premature_dtable (class); /* someone might require it... */ - sarray_free (arr); /* release memory */ - - /* could have been lazy... */ - __objc_install_dispatch_table_for_class (class); - - if (class->subclass_list) /* Traverse subclasses */ - for (next = class->subclass_list; next; next = next->sibling_class) - __objc_update_dispatch_table_for_class (next); - - objc_mutex_unlock(__objc_runtime_mutex); - } - - - /* This function adds a method list to a class. This function is - typically called by another function specific to the run-time. As - such this function does not worry about thread safe issues. - - This one is only called for categories. Class objects have their - methods installed right away, and their selectors are made into - SEL's by the function __objc_register_selectors_from_class. */ - void - class_add_method_list (Class class, MethodList_t list) - { - int i; - - /* Passing of a linked list is not allowed. Do multiple calls. */ - assert (!list->method_next); - - /* Check for duplicates. */ - for (i = 0; i < list->method_count; ++i) - { - Method_t method = &list->method_list[i]; - - if (method->method_name) /* Sometimes these are NULL */ - { - /* This is where selector names are transmogrified to SEL's */ - method->method_name = - sel_register_typed_name ((const char*)method->method_name, - method->method_types); - } - } - - /* Add the methods to the class's method list. */ - list->method_next = class->methods; - class->methods = list; - - /* Update the dispatch table of class */ - __objc_update_dispatch_table_for_class (class); - } - - Method_t - class_get_instance_method(Class class, SEL op) - { - return search_for_method_in_hierarchy(class, op); - } - - Method_t - class_get_class_method(MetaClass class, SEL op) - { - return search_for_method_in_hierarchy(class, op); - } - - - /* Search for a method starting from the current class up its hierarchy. - Return a pointer to the method's method structure if found. NULL - otherwise. */ - - static Method_t - search_for_method_in_hierarchy (Class cls, SEL sel) - { - Method_t method = NULL; - Class class; - - if (! sel_is_mapped (sel)) - return NULL; - - /* Scan the method list of the class. If the method isn't found in the - list then step to its super class. */ - for (class = cls; ((! method) && class); class = class->super_class) - method = search_for_method_in_list (class->methods, sel); - - return method; - } - - - - /* Given a linked list of method and a method's name. Search for the named - method's method structure. Return a pointer to the method's method - structure if found. NULL otherwise. */ - Method_t - search_for_method_in_list (MethodList_t list, SEL op) - { - MethodList_t method_list = list; - - if (! sel_is_mapped (op)) - return NULL; - - /* If not found then we'll search the list. */ - while (method_list) - { - int i; - - /* Search the method list. */ - for (i = 0; i < method_list->method_count; ++i) - { - Method_t method = &method_list->method_list[i]; - - if (method->method_name) - if (method->method_name->sel_id == op->sel_id) - return method; - } - - /* The method wasn't found. Follow the link to the next list of - methods. */ - method_list = method_list->method_next; - } - - return NULL; - } - - static retval_t __objc_forward (id object, SEL sel, arglist_t args); - - /* Forwarding pointers/integers through the normal registers */ - static id - __objc_word_forward (id rcv, SEL op, ...) - { - void *args, *res; - - args = __builtin_apply_args (); - res = __objc_forward (rcv, op, args); - if (res) - __builtin_return (res); - else - return res; - } - - /* Specific routine for forwarding floats/double because of - architectural differences on some processors. i386s for - example which uses a floating point stack versus general - registers for floating point numbers. This forward routine - makes sure that GCC restores the proper return values */ - static double - __objc_double_forward (id rcv, SEL op, ...) - { - void *args, *res; - - args = __builtin_apply_args (); - res = __objc_forward (rcv, op, args); - __builtin_return (res); - } - - #if INVISIBLE_STRUCT_RETURN - static __big - #else - static id - #endif - __objc_block_forward (id rcv, SEL op, ...) - { - void *args, *res; - - args = __builtin_apply_args (); - res = __objc_forward (rcv, op, args); - if (res) - __builtin_return (res); - else - #if INVISIBLE_STRUCT_RETURN - return (__big) {{0, 0, 0, 0, 0, 0, 0, 0}}; - #else - return nil; - #endif - } - - - /* This function is installed in the dispatch table for all methods which are - not implemented. Thus, it is called when a selector is not recognized. */ - static retval_t - __objc_forward (id object, SEL sel, arglist_t args) - { - IMP imp; - static SEL frwd_sel = 0; /* !T:SAFE2 */ - SEL err_sel; - - /* first try if the object understands forward:: */ - if (!frwd_sel) - frwd_sel = sel_get_any_uid("forward::"); - - if (__objc_responds_to (object, frwd_sel)) - { - imp = get_imp(object->class_pointer, frwd_sel); - return (*imp)(object, frwd_sel, sel, args); - } - - /* If the object recognizes the doesNotRecognize: method then we're going - to send it. */ - err_sel = sel_get_any_uid ("doesNotRecognize:"); - if (__objc_responds_to (object, err_sel)) - { - imp = get_imp (object->class_pointer, err_sel); - return (*imp) (object, err_sel, sel); - } - - /* The object doesn't recognize the method. Check for responding to - error:. If it does then sent it. */ - { - size_t strlen (const char*); - char msg[256 + strlen ((const char*)sel_get_name (sel)) - + strlen ((const char*)object->class_pointer->name)]; - - sprintf (msg, "(%s) %s does not recognize %s", - (CLS_ISMETA(object->class_pointer) - ? "class" - : "instance" ), - object->class_pointer->name, sel_get_name (sel)); - - err_sel = sel_get_any_uid ("error:"); - if (__objc_responds_to (object, err_sel)) - { - imp = get_imp (object->class_pointer, err_sel); - return (*imp) (object, sel_get_any_uid ("error:"), msg); - } - - /* The object doesn't respond to doesNotRecognize: or error:; Therefore, - a default action is taken. */ - objc_error (object, OBJC_ERR_UNIMPLEMENTED, "%s\n", msg); - - return 0; - } - } - - void - __objc_print_dtable_stats() - { - int total = 0; - - objc_mutex_lock(__objc_runtime_mutex); - - printf("memory usage: (%s)\n", - #ifdef OBJC_SPARSE2 - "2-level sparse arrays" - #else - "3-level sparse arrays" - #endif - ); - - printf("arrays: %d = %ld bytes\n", narrays, - (long)narrays*sizeof(struct sarray)); - total += narrays*sizeof(struct sarray); - printf("buckets: %d = %ld bytes\n", nbuckets, - (long)nbuckets*sizeof(struct sbucket)); - total += nbuckets*sizeof(struct sbucket); - - printf("idxtables: %d = %ld bytes\n", idxsize, (long)idxsize*sizeof(void*)); - total += idxsize*sizeof(void*); - printf("-----------------------------------\n"); - printf("total: %d bytes\n", total); - printf("===================================\n"); - - objc_mutex_unlock(__objc_runtime_mutex); - } - - /* Returns the uninstalled dispatch table indicator. - If a class' dispatch table points to __objc_uninstalled_dtable - then that means it needs its dispatch table to be installed. */ - __inline__ - struct sarray* - objc_get_uninstalled_dtable() - { - return __objc_uninstalled_dtable; - } --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-dce.c gcc-2.95/gcc/objc/thr-dce.c *** egcs-1.1.2/gcc/objc/thr-dce.c Wed Dec 24 15:56:08 1997 --- gcc-2.95/gcc/objc/thr-dce.c Wed Dec 31 16:00:00 1969 *************** *** 1,281 **** - /* GNU Objective C Runtime Thread Interface - 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. - - 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. */ - - #include - #include - #include "runtime.h" - - /* Key structure for maintaining thread specific storage */ - static pthread_key_t _objc_thread_storage; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* Initialize the thread storage key */ - return pthread_keycreate(&_objc_thread_storage, NULL); - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - /* Destroy the thread storage key */ - /* Not implemented yet */ - /* return pthread_key_delete(&_objc_thread_storage); */ - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if (pthread_create(&new_thread_handle, pthread_attr_default, - (void *)func, arg) == 0) - { - /* ??? May not work! (64bit) */ - thread_id = *(objc_thread_t *)&new_thread_handle; - pthread_detach(&new_thread_handle); /* Fully detach thread. */ - } - else - thread_id = NULL; - - return thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - int sys_priority = 0; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; - break; - } - - /* Change the priority. */ - if (pthread_setprio(pthread_self(), sys_priority) >= 0) - return 0; - else - /* Failed */ - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - int sys_priority; - - if ((sys_priority = pthread_getprio(pthread_self())) >= 0) { - if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP) - return OBJC_THREAD_INTERACTIVE_PRIORITY; - if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP) - return OBJC_THREAD_BACKGROUND_PRIORITY; - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Failed */ - return -1; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - pthread_yield(); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* exit the thread */ - pthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - pthread_t self = pthread_self(); - - return (objc_thread_t) pthread_getunique_np (&self); - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - return pthread_setspecific(_objc_thread_storage, value); - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - void *value = NULL; - - if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) - return value; - - return NULL; - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), - pthread_mutexattr_default)) - return -1; - else - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) - return -1; - else - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1) - return -1; - else - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - - /* - if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) - return -1; - else - return 0; - */ - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); - */ - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), - (pthread_mutex_t *)(&(mutex->backend))); - */ - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); - */ - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); - */ - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-decosf1.c gcc-2.95/gcc/objc/thr-decosf1.c *** egcs-1.1.2/gcc/objc/thr-decosf1.c Sat Dec 6 09:30:03 1997 --- gcc-2.95/gcc/objc/thr-decosf1.c Wed Dec 31 16:00:00 1969 *************** *** 1,281 **** - /* GNU Objective C Runtime Thread Interface - 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. - - 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. */ - - #include - #include - #include "runtime.h" - - /* Key structure for maintaining thread specific storage */ - static pthread_key_t _objc_thread_storage; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* Initialize the thread storage key */ - return pthread_keycreate(&_objc_thread_storage, NULL); - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - /* Destroy the thread storage key */ - /* Not implemented yet */ - /* return pthread_key_delete(&_objc_thread_storage); */ - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if (pthread_create(&new_thread_handle, pthread_attr_default, - (void *)func, arg) == 0) - { - /* ??? May not work! (64bit) */ - thread_id = *(objc_thread_t *)&new_thread_handle; - pthread_detach(&new_thread_handle); /* Fully detach thread. */ - } - else - thread_id = NULL; - - return thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - int sys_priority = 0; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; - break; - } - - /* Change the priority. */ - if (pthread_setprio(pthread_self(), sys_priority) >= 0) - return 0; - else - /* Failed */ - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - int sys_priority; - - if ((sys_priority = pthread_getprio(pthread_self())) >= 0) { - if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP) - return OBJC_THREAD_INTERACTIVE_PRIORITY; - if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP) - return OBJC_THREAD_BACKGROUND_PRIORITY; - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Failed */ - return -1; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - pthread_yield(); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* exit the thread */ - pthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - pthread_t self = pthread_self(); - - return (objc_thread_t) pthread_getunique_np (&self); - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - return pthread_setspecific(_objc_thread_storage, value); - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - void *value = NULL; - - if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) - return value; - - return NULL; - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), - pthread_mutexattr_default)) - return -1; - else - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) - return -1; - else - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1) - return -1; - else - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - - /* - if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) - return -1; - else - return 0; - */ - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); - */ - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), - (pthread_mutex_t *)(&(mutex->backend))); - */ - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); - */ - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - - /* - return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); - */ - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-irix.c gcc-2.95/gcc/objc/thr-irix.c *** egcs-1.1.2/gcc/objc/thr-irix.c Sat Dec 6 09:30:04 1997 --- gcc-2.95/gcc/objc/thr-irix.c Wed Dec 31 16:00:00 1969 *************** *** 1,235 **** - /* GNU Objective C Runtime Thread Interface - SGI IRIX Implementation - 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. - - 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. */ - - #include - #include - #include - #include - #include - #include - #include "runtime.h" - - /* Key structure for maintaining thread specific storage */ - static void * __objc_shared_arena_handle = NULL; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* Name of IRIX arena. */ - char arena_name[64]; - - DEBUG_PRINTF("__objc_init_thread_system\n"); - - /* Construct a temporary name for arena. */ - sprintf(arena_name, "/usr/tmp/objc_%05u", (unsigned)getpid()); - - /* Up to 256 threads. Arena only for threads. */ - usconfig(CONF_INITUSERS, 256); - usconfig(CONF_ARENATYPE, US_SHAREDONLY); - - /* Initialize the arena */ - if (!(__objc_shared_arena_handle = usinit(arena_name))) - /* Failed */ - return -1; - - return 0; - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - objc_thread_t thread_id; - int sys_id; - - if ((sys_id = sproc((void *)func, PR_SALL, arg)) >= 0) - thread_id = (objc_thread_t)sys_id; - else - thread_id = NULL; - - return thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - /* Not implemented yet */ - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - /* Not implemented yet */ - return OBJC_THREAD_INTERACTIVE_PRIORITY; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - sginap(0); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* IRIX only has exit. */ - exit(__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - /* Threads are processes. */ - return (objc_thread_t)get_pid(); - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - *((void **)&PRDA->usr_prda) = value; - return 0; - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - return *((void **)&PRDA->usr_prda); - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - if (!( (ulock_t)(mutex->backend) = usnewlock(__objc_shared_arena_handle) )) - return -1; - else - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - usfreelock((ulock_t)(mutex->backend), __objc_shared_arena_handle); - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - if (ussetlock((ulock_t)(mutex->backend)) == 0) - return -1; - else - return 0; - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - if (ustestlock((ulock_t)(mutex->backend)) == 0) - return -1; - else - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - usunsetlock((ulock_t)(mutex->backend)); - return 0; - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - /* Unimplemented. */ - return -1; - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-mach.c gcc-2.95/gcc/objc/thr-mach.c *** egcs-1.1.2/gcc/objc/thr-mach.c Sat Dec 6 09:30:05 1997 --- gcc-2.95/gcc/objc/thr-mach.c Wed Dec 31 16:00:00 1969 *************** *** 1,312 **** - /* GNU Objective C Runtime Thread Implementation - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - Modified for Mach threads by Bill Bumgarner - Condition functions added by Mircea Oancea - - 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. */ - - #include - #include - #include - #include "runtime.h" - - /* - Obtain the maximum thread priority that can set for t. Under the - mach threading model, it is possible for the developer to adjust the - maximum priority downward only-- cannot be raised without superuser - privileges. Once lowered, it cannot be raised. - */ - static int __mach_get_max_thread_priority(cthread_t t, int *base) - { - thread_t threadP; - kern_return_t error; - struct thread_sched_info info; - unsigned int info_count=THREAD_SCHED_INFO_COUNT; - - if (t == NULL) - return -1; - - threadP = cthread_thread(t); /* get thread underlying */ - - error=thread_info(threadP, THREAD_SCHED_INFO, - (thread_info_t)&info, &info_count); - - if (error != KERN_SUCCESS) - return -1; - - if (base != NULL) - *base = info.base_priority; - - return info.max_priority; - } - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - return 0; - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - objc_thread_t thread_id; - cthread_t new_thread_handle; - - /* create thread */ - new_thread_handle = cthread_fork((cthread_fn_t)func, arg); - - if(new_thread_handle) - { - /* this is not terribly portable */ - thread_id = *(objc_thread_t *)&new_thread_handle; - cthread_detach(new_thread_handle); - } - else - thread_id = NULL; - - return thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - objc_thread_t *t = objc_thread_id(); - cthread_t cT = (cthread_t) t; - int maxPriority = __mach_get_max_thread_priority(cT, NULL); - int sys_priority = 0; - - if (maxPriority == -1) - return -1; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = maxPriority; - break; - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = (maxPriority * 2) / 3; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = maxPriority / 3; - break; - default: - return -1; - } - - if (sys_priority == 0) - return -1; - - /* Change the priority */ - if (cthread_priority(cT, sys_priority, 0) == KERN_SUCCESS) - return 0; - else - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - objc_thread_t *t = objc_thread_id(); - cthread_t cT = (cthread_t) t; /* see objc_thread_id() */ - int basePriority; - int maxPriority; - int sys_priority = 0; - - int interactiveT, backgroundT, lowT; /* thresholds */ - - maxPriority = __mach_get_max_thread_priority(cT, &basePriority); - - if(maxPriority == -1) - return -1; - - if (basePriority > ( (maxPriority * 2) / 3)) - return OBJC_THREAD_INTERACTIVE_PRIORITY; - - if (basePriority > ( maxPriority / 3)) - return OBJC_THREAD_BACKGROUND_PRIORITY; - - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - cthread_yield(); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* exit the thread */ - cthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - cthread_t self = cthread_self(); - - return *(objc_thread_t *)&self; - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - cthread_set_data(cthread_self(), (any_t) value); - return 0; - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - return (void *) cthread_data(cthread_self()); - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - int err = 0; - mutex->backend = objc_malloc(sizeof(struct mutex)); - - err = mutex_init((mutex_t)(mutex->backend)); - - if (err != 0) - { - objc_free(mutex->backend); - return -1; - } - else - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - mutex_clear((mutex_t)(mutex->backend)); - - objc_free(mutex->backend); - mutex->backend = NULL; - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - mutex_lock((mutex_t)(mutex->backend)); - return 0; - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - if (mutex_try_lock((mutex_t)(mutex->backend)) == 0) - return -1; - else - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - mutex_unlock((mutex_t)(mutex->backend)); - return 0; - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - condition->backend = objc_malloc(sizeof(struct condition)); - condition_init((condition_t)(condition->backend)); - return 0; - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - condition_clear((condition_t)(condition->backend)); - objc_free(condition->backend); - condition->backend = NULL; - return 0; - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - condition_wait((condition_t)(condition->backend), - (mutex_t)(mutex->backend)); - return 0; - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - condition_broadcast((condition_t)(condition->backend)); - return 0; - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - condition_signal((condition_t)(condition->backend)); - return 0; - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-os2.c gcc-2.95/gcc/objc/thr-os2.c *** egcs-1.1.2/gcc/objc/thr-os2.c Sat Dec 6 09:30:06 1997 --- gcc-2.95/gcc/objc/thr-os2.c Wed Dec 31 16:00:00 1969 *************** *** 1,267 **** - /* GNU Objective C Runtime Thread Interface - OS/2 emx Implementation - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Thomas Baier (baier@ci.tuwien.ac.at) - - 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. */ - - #include - #include "runtime.h" - - #define INCL_DOSSEMAPHORES - #define INCL_DOSPROCESS - - /* - * conflicts with objc.h: SEL, BOOL, id - * solution: prefixing those with _OS2_ before including - */ - #define SEL _OS2_SEL - #define BOOL _OS2_BOOL - #define id _OS2_id - #include - #undef id - #undef SEL - #undef BOOL - - #include - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - return 0; - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - int thread_id = 0; - - if ((thread_id = _beginthread (func,NULL,32768,arg)) < 0) - thread_id = 0; - - return (objc_thread_t)thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - ULONG sys_class = 0; - ULONG sys_priority = 0; - - /* OBJC_THREAD_INTERACTIVE_PRIORITY -> PRTYC_FOREGROUNDSERVER - * OBJC_THREAD_BACKGROUND_PRIORITY -> PRTYC_REGULAR - * OBJC_THREAD_LOW_PRIORITY -> PRTYC_IDLETIME */ - - switch (priority) { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_class = PRTYC_REGULAR; - sys_priority = 10; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_class = PRTYC_IDLETIME; - sys_priority = 25; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_class = PRTYC_IDLETIME; - sys_priority = 0; - break; - } - - /* Change priority */ - if (!DosSetPriority (PRTYS_THREAD,sys_class,sys_priority,*_threadid)) - return 0; - else - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - PTIB ptib; - PPIB ppib; - - /* get information about current thread */ - DosGetInfoBlocks (&ptib,&ppib); - - switch (ptib->tib_ptib2->tib2_ulpri) - { - case PRTYC_IDLETIME: - case PRTYC_REGULAR: - case PRTYC_TIMECRITICAL: - case PRTYC_FOREGROUNDSERVER: - default: - return OBJC_THREAD_INTERACTIVE_PRIORITY; - } - - return -1; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - DosSleep (0); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* terminate the thread, NEVER use DosExit () */ - _endthread (); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - return (objc_thread_t) *_threadid; - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - *_threadstore () = value; - - return 0; - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - return *_threadstore (); - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - if (DosCreateMutexSem (NULL, (HMTX)(&(mutex->backend)),0L,0) > 0) - return -1; - else - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - DosCloseMutexSem ((HMTX)(mutex->backend)); - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - if (DosRequestMutexSem ((HMTX)(mutex->backend),-1L) != 0) - return -1; - else - return 0; - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - if (DosRequestMutexSem ((HMTX)(mutex->backend),0L) != 0) - return -1; - else - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - if (DosReleaseMutexSem((HMTX)(mutex->backend)) != 0) - return -1; - else - return 0; - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - /* Unimplemented. */ - return -1; - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-posix.c gcc-2.95/gcc/objc/thr-posix.c *** egcs-1.1.2/gcc/objc/thr-posix.c Sat Dec 6 09:30:07 1997 --- gcc-2.95/gcc/objc/thr-posix.c Wed Dec 31 16:00:00 1969 *************** *** 1,229 **** - /* GNU Objective C Runtime Thread Interface for POSIX compliant threads - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - Modified for Linux/Pthreads by Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de) - - 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. */ - - #include - #include "runtime.h" - #include - - /* Key structure for maintaining thread specific storage */ - static pthread_key_t _objc_thread_storage; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* Initialize the thread storage key */ - return pthread_key_create(&_objc_thread_storage, NULL); - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) ) - thread_id = *(objc_thread_t *)&new_thread_handle; - else - thread_id = NULL; - - return thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - /* Not implemented yet */ - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - /* Not implemented yet */ - return -1; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - sched_yield(); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* exit the thread */ - pthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - pthread_t self = pthread_self(); - - return *(objc_thread_t *)&self; - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - return pthread_setspecific(_objc_thread_storage, value); - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - return pthread_getspecific(_objc_thread_storage); - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - mutex->backend = objc_malloc(sizeof(pthread_mutex_t)); - - if (pthread_mutex_init((pthread_mutex_t *)mutex->backend, NULL)) - { - objc_free(mutex->backend); - mutex->backend = NULL; - return -1; - } - - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - if (pthread_mutex_destroy((pthread_mutex_t *)mutex->backend)) - return -1; - - objc_free(mutex->backend); - mutex->backend = NULL; - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - return pthread_mutex_lock((pthread_mutex_t *)mutex->backend); - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - return pthread_mutex_trylock((pthread_mutex_t *)mutex->backend); - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - return pthread_mutex_unlock((pthread_mutex_t *)mutex->backend); - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - condition->backend = objc_malloc(sizeof(pthread_cond_t)); - - if (pthread_cond_init((pthread_cond_t *)condition->backend, NULL)) - { - objc_free(condition->backend); - condition->backend = NULL; - return -1; - } - - return 0; - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - if (pthread_cond_destroy((pthread_cond_t *)condition->backend)) - return -1; - - objc_free(condition->backend); - condition->backend = NULL; - return 0; - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - return pthread_cond_wait((pthread_cond_t *)condition->backend, - (pthread_mutex_t *)mutex->backend); - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - return pthread_cond_broadcast((pthread_cond_t *)condition->backend); - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - return pthread_cond_signal((pthread_cond_t *)condition->backend); - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-pthreads.c gcc-2.95/gcc/objc/thr-pthreads.c *** egcs-1.1.2/gcc/objc/thr-pthreads.c Sat Dec 6 09:30:07 1997 --- gcc-2.95/gcc/objc/thr-pthreads.c Wed Dec 31 16:00:00 1969 *************** *** 1,218 **** - /* GNU Objective C Runtime Thread Implementation for PCThreads under GNU/Linux. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Scott Christley - Condition functions added by: Mircea Oancea - - 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. */ - - #include - #include - #include "runtime.h" - - /* Key structure for maintaining thread specific storage */ - static pthread_key_t _objc_thread_storage; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* Initialize the thread storage key */ - return pthread_key_create(&_objc_thread_storage, NULL); - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - /* Destroy the thread storage key */ - /* Not implemented yet */ - /* return pthread_key_delete(&_objc_thread_storage); */ - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - objc_thread_t thread_id; - pthread_t new_thread_handle; - - if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) ) - thread_id = *(objc_thread_t *)&new_thread_handle; - else - thread_id = NULL; - - return thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - /* Not implemented yet */ - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - /* Not implemented yet */ - return OBJC_THREAD_INTERACTIVE_PRIORITY; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - pthread_yield(NULL); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* exit the thread */ - pthread_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - pthread_t self = pthread_self(); - - return *(objc_thread_t *)&self; - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - return pthread_setspecific(_objc_thread_storage, value); - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - void *value = NULL; - - if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) - return value; - - return NULL; - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), NULL)) - return -1; - else - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) - return -1; - else - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - return pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))); - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) - return -1; - else - return 0; - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), - (pthread_mutex_t *)(&(mutex->backend))); - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-single.c gcc-2.95/gcc/objc/thr-single.c *** egcs-1.1.2/gcc/objc/thr-single.c Mon Aug 11 08:58:11 1997 --- gcc-2.95/gcc/objc/thr-single.c Wed Dec 31 16:00:00 1969 *************** *** 1,192 **** - /* GNU Objective C Runtime Thread Implementation - 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. - - 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. */ - - #include - #include "runtime.h" - - /* Thread local storage for a single thread */ - static void *thread_local_storage = NULL; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* No thread support available */ - return -1; - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - /* No thread support available */ - return -1; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - /* No thread support available */ - return NULL; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - /* No thread support available */ - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - return OBJC_THREAD_INTERACTIVE_PRIORITY; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - return; - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* No thread support available */ - /* Should we really exit the program */ - /* exit(&__objc_thread_exit_status); */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - /* No thread support, use 1. */ - return (objc_thread_t)1; - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - thread_local_storage = value; - return 0; - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - return thread_local_storage; - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - /* There can only be one thread, so we always get the lock */ - return 0; - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - /* There can only be one thread, so we always get the lock */ - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - return 0; - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - return 0; - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - return 0; - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - return 0; - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - return 0; - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - return 0; - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-solaris.c gcc-2.95/gcc/objc/thr-solaris.c *** egcs-1.1.2/gcc/objc/thr-solaris.c Sat Dec 6 09:30:09 1997 --- gcc-2.95/gcc/objc/thr-solaris.c Wed Dec 31 16:00:00 1969 *************** *** 1,259 **** - /* GNU Objective C Runtime Thread Interface - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) - Conditions added by Mircea Oancea (mircea@first.elcom.pub.ro) - - 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. */ - - #include - #include "runtime.h" - - #include - #include - #include - - /* Key structure for maintaining thread specific storage */ - static thread_key_t __objc_thread_data_key; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* Initialize the thread storage key */ - if (thr_keycreate(&__objc_thread_data_key, NULL) == 0) - return 0; - else - return -1; - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - objc_thread_t thread_id; - thread_t new_thread_id = 0; - - if (thr_create(NULL, 0, (void *)func, arg, - THR_DETACHED | THR_NEW_LWP, - &new_thread_id) == 0) - thread_id = *(objc_thread_t *)&new_thread_id; - else - thread_id = NULL; - - return thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - int sys_priority = 0; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = 300; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = 200; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = 1000; - break; - } - - /* Change priority */ - if (thr_setprio(thr_self(), sys_priority) == 0) - return 0; - else - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - int sys_priority; - - if (thr_getprio(thr_self(), &sys_priority) == 0) - { - if (sys_priority >= 250) - return OBJC_THREAD_INTERACTIVE_PRIORITY; - else if (sys_priority >= 150) - return OBJC_THREAD_BACKGROUND_PRIORITY; - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Couldn't get priority. */ - return -1; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - thr_yield(); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* exit the thread */ - thr_exit(&__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - return (objc_thread_t)thr_self(); - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - if (thr_setspecific(__objc_thread_data_key, value) == 0) - return 0; - else - return -1; - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - void *value = NULL; - - if (thr_getspecific(__objc_thread_data_key, &value) == 0) - return value; - - return NULL; - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - if (mutex_init( (mutex_t *)(&(mutex->backend)), USYNC_THREAD, 0)) - return -1; - else - return 0; - } - - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - mutex_destroy((mutex_t *)(&(mutex->backend))); - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - if (mutex_lock((mutex_t *)(&(mutex->backend))) != 0) - return -1; - else - return 0; - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - if (mutex_trylock((mutex_t *)(&(mutex->backend))) != 0) - return -1; - else - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - if (mutex_unlock((mutex_t *)(&(mutex->backend))) != 0) - return -1; - else - return 0; - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - return cond_init((cond_t *)(&(condition->backend)), USYNC_THREAD, NULL); - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - return cond_destroy((cond_t *)(&(condition->backend))); - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - return cond_wait((cond_t *)(&(condition->backend)), - (mutex_t *)(&(mutex->backend))); - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - return cond_broadcast((cond_t *)(&(condition->backend))); - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - return cond_signal((cond_t *)(&(condition->backend))); - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-vxworks.c gcc-2.95/gcc/objc/thr-vxworks.c *** egcs-1.1.2/gcc/objc/thr-vxworks.c Thu Apr 2 15:15:06 1998 --- gcc-2.95/gcc/objc/thr-vxworks.c Wed Dec 31 16:00:00 1969 *************** *** 1,192 **** - /* GNU Objective C Runtime Thread Implementation - 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. - - 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. */ - - #include - #include "runtime.h" - - /* Thread local storage for a single thread */ - static void *thread_local_storage = NULL; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* No thread support available */ - return -1; - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - /* No thread support available */ - return -1; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - /* No thread support available */ - return NULL; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - /* No thread support available */ - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - return OBJC_THREAD_INTERACTIVE_PRIORITY; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - return; - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* No thread support available */ - /* Should we really exit the program */ - /* exit(&__objc_thread_exit_status); */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - /* No thread support, use 1. */ - return (objc_thread_t)1; - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - thread_local_storage = value; - return 0; - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - return thread_local_storage; - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - /* There can only be one thread, so we always get the lock */ - return 0; - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - /* There can only be one thread, so we always get the lock */ - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - return 0; - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - return 0; - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - return 0; - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - return 0; - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - return 0; - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - return 0; - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr-win32.c gcc-2.95/gcc/objc/thr-win32.c *** egcs-1.1.2/gcc/objc/thr-win32.c Sat Dec 6 09:30:08 1997 --- gcc-2.95/gcc/objc/thr-win32.c Wed Dec 31 16:00:00 1969 *************** *** 1,272 **** - /* GNU Objective C Runtime Thread Interface - Win32 Implementation - 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. - - 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. */ - - #include - #include "runtime.h" - - #ifndef __OBJC__ - #define __OBJC__ - #endif - #include - - /* Key structure for maintaining thread specific storage */ - static DWORD __objc_data_tls = (DWORD)-1; - - /* Backend initialization functions */ - - /* Initialize the threads subsystem. */ - int - __objc_init_thread_system(void) - { - /* Initialize the thread storage key */ - if ((__objc_data_tls = TlsAlloc()) != (DWORD)-1) - return 0; - else - return -1; - } - - /* Close the threads subsystem. */ - int - __objc_close_thread_system(void) - { - if (__objc_data_tls != (DWORD)-1) - TlsFree(__objc_data_tls); - return 0; - } - - /* Backend thread functions */ - - /* Create a new thread of execution. */ - objc_thread_t - __objc_thread_detach(void (*func)(void *arg), void *arg) - { - DWORD thread_id = 0; - HANDLE win32_handle; - - if (!(win32_handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, - arg, 0, &thread_id))) - thread_id = 0; - - return (objc_thread_t)thread_id; - } - - /* Set the current thread's priority. */ - int - __objc_thread_set_priority(int priority) - { - int sys_priority = 0; - - switch (priority) - { - case OBJC_THREAD_INTERACTIVE_PRIORITY: - sys_priority = THREAD_PRIORITY_NORMAL; - break; - default: - case OBJC_THREAD_BACKGROUND_PRIORITY: - sys_priority = THREAD_PRIORITY_BELOW_NORMAL; - break; - case OBJC_THREAD_LOW_PRIORITY: - sys_priority = THREAD_PRIORITY_LOWEST; - break; - } - - /* Change priority */ - if (SetThreadPriority(GetCurrentThread(), sys_priority)) - return 0; - else - return -1; - } - - /* Return the current thread's priority. */ - int - __objc_thread_get_priority(void) - { - int sys_priority; - - sys_priority = GetThreadPriority(GetCurrentThread()); - - switch (sys_priority) - { - case THREAD_PRIORITY_HIGHEST: - case THREAD_PRIORITY_TIME_CRITICAL: - case THREAD_PRIORITY_ABOVE_NORMAL: - case THREAD_PRIORITY_NORMAL: - return OBJC_THREAD_INTERACTIVE_PRIORITY; - - default: - case THREAD_PRIORITY_BELOW_NORMAL: - return OBJC_THREAD_BACKGROUND_PRIORITY; - - case THREAD_PRIORITY_IDLE: - case THREAD_PRIORITY_LOWEST: - return OBJC_THREAD_LOW_PRIORITY; - } - - /* Couldn't get priority. */ - return -1; - } - - /* Yield our process time to another thread. */ - void - __objc_thread_yield(void) - { - Sleep(0); - } - - /* Terminate the current thread. */ - int - __objc_thread_exit(void) - { - /* exit the thread */ - ExitThread(__objc_thread_exit_status); - - /* Failed if we reached here */ - return -1; - } - - /* Returns an integer value which uniquely describes a thread. */ - objc_thread_t - __objc_thread_id(void) - { - return (objc_thread_t)GetCurrentThreadId(); - } - - /* Sets the thread's local storage pointer. */ - int - __objc_thread_set_data(void *value) - { - if (TlsSetValue(__objc_data_tls, value)) - return 0; - else - return -1; - } - - /* Returns the thread's local storage pointer. */ - void * - __objc_thread_get_data(void) - { - return TlsGetValue(__objc_data_tls); /* Return thread data. */ - } - - /* Backend mutex functions */ - - /* Allocate a mutex. */ - int - __objc_mutex_allocate(objc_mutex_t mutex) - { - if ((mutex->backend = (void *)CreateMutex(NULL, 0, NULL)) == NULL) - return -1; - else - return 0; - } - - /* Deallocate a mutex. */ - int - __objc_mutex_deallocate(objc_mutex_t mutex) - { - CloseHandle((HANDLE)(mutex->backend)); - return 0; - } - - /* Grab a lock on a mutex. */ - int - __objc_mutex_lock(objc_mutex_t mutex) - { - int status; - - status = WaitForSingleObject((HANDLE)(mutex->backend), INFINITE); - if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED) - return -1; - else - return 0; - } - - /* Try to grab a lock on a mutex. */ - int - __objc_mutex_trylock(objc_mutex_t mutex) - { - int status; - - status = WaitForSingleObject((HANDLE)(mutex->backend), 0); - if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED) - return -1; - else - return 0; - } - - /* Unlock the mutex */ - int - __objc_mutex_unlock(objc_mutex_t mutex) - { - if (ReleaseMutex((HANDLE)(mutex->backend)) == 0) - return -1; - else - return 0; - } - - /* Backend condition mutex functions */ - - /* Allocate a condition. */ - int - __objc_condition_allocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Deallocate a condition. */ - int - __objc_condition_deallocate(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Wait on the condition */ - int - __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - /* Unimplemented. */ - return -1; - } - - /* Wake up all threads waiting on this condition. */ - int - __objc_condition_broadcast(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* Wake up one thread waiting on this condition. */ - int - __objc_condition_signal(objc_condition_t condition) - { - /* Unimplemented. */ - return -1; - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr.c gcc-2.95/gcc/objc/thr.c *** egcs-1.1.2/gcc/objc/thr.c Mon Aug 11 08:58:11 1997 --- gcc-2.95/gcc/objc/thr.c Wed Dec 31 16:00:00 1969 *************** *** 1,534 **** - /* GNU Objective C Runtime Thread Interface - 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. - - 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. */ - - #include - #include "runtime.h" - - /* Global exit status. */ - int __objc_thread_exit_status = 0; - - /* Flag which lets us know if we ever became multi threaded */ - int __objc_is_multi_threaded = 0; - - /* The hook function called when the runtime becomes multi threaded */ - objc_thread_callback _objc_became_multi_threaded = NULL; - - /* - 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. - */ - objc_thread_callback objc_set_thread_callback(objc_thread_callback func) - { - objc_thread_callback temp = _objc_became_multi_threaded; - _objc_became_multi_threaded = func; - return temp; - } - - /* - Private functions - - These functions are utilized by the frontend, but they are not - considered part of the public interface. - */ - - /* - First function called in a thread, starts everything else. - - This function is passed to the backend by objc_thread_detach - as the starting function for a new thread. - */ - struct __objc_thread_start_state - { - SEL selector; - id object; - id argument; - }; - - static volatile void - __objc_thread_detach_function(struct __objc_thread_start_state *istate) - { - /* Valid state? */ - if (istate) { - id (*imp)(id,SEL,id); - SEL selector = istate->selector; - id object = istate->object; - id argument = istate->argument; - - /* Don't need anymore so free it */ - objc_free(istate); - - /* Clear out the thread local storage */ - objc_thread_set_data(NULL); - - /* Check to see if we just became multi threaded */ - if (!__objc_is_multi_threaded) - { - __objc_is_multi_threaded = 1; - - /* Call the hook function */ - if (_objc_became_multi_threaded != NULL) - (*_objc_became_multi_threaded)(); - } - - /* Call the method */ - if ((imp = (id(*)(id, SEL, id))objc_msg_lookup(object, selector))) - (*imp)(object, selector, argument); - else - objc_error(object, OBJC_ERR_UNIMPLEMENTED, - "objc_thread_detach called with bad selector.\n"); - } - else - objc_error(nil, OBJC_ERR_BAD_STATE, - "objc_thread_detach called with NULL state.\n"); - - /* Exit the thread */ - objc_thread_exit(); - } - - /* - Frontend functions - - These functions constitute the public interface to the Objective-C thread - and mutex functionality. - */ - - /* Frontend thread functions */ - - /* - Detach a new thread of execution and return its id. Returns NULL if fails. - Thread is started by sending message with selector to object. Message - takes a single argument. - */ - objc_thread_t - objc_thread_detach(SEL selector, id object, id argument) - { - struct __objc_thread_start_state *istate; - objc_thread_t thread_id = NULL; - - /* Allocate the state structure */ - if (!(istate = (struct __objc_thread_start_state *) - objc_malloc(sizeof(*istate)))) - return NULL; - - /* Initialize the state structure */ - istate->selector = selector; - istate->object = object; - istate->argument = argument; - - /* lock access */ - objc_mutex_lock(__objc_runtime_mutex); - - /* Call the backend to spawn the thread */ - if ((thread_id = __objc_thread_detach((void *)__objc_thread_detach_function, - istate)) == NULL) - { - /* failed! */ - objc_mutex_unlock(__objc_runtime_mutex); - objc_free(istate); - return NULL; - } - - /* Increment our thread counter */ - __objc_runtime_threads_alive++; - objc_mutex_unlock(__objc_runtime_mutex); - - return thread_id; - } - - /* Set the current thread's priority. */ - int - objc_thread_set_priority(int priority) - { - /* Call the backend */ - return __objc_thread_set_priority(priority); - } - - /* Return the current thread's priority. */ - int - objc_thread_get_priority(void) - { - /* Call the backend */ - return __objc_thread_get_priority(); - } - - /* - Yield our process time to another thread. Any BUSY waiting that is done - by a thread should use this function to make sure that other threads can - make progress even on a lazy uniprocessor system. - */ - void - objc_thread_yield(void) - { - /* Call the backend */ - __objc_thread_yield(); - } - - /* - Terminate the current tread. Doesn't return. - Actually, if it failed returns -1. - */ - int - objc_thread_exit(void) - { - /* Decrement our counter of the number of threads alive */ - objc_mutex_lock(__objc_runtime_mutex); - __objc_runtime_threads_alive--; - objc_mutex_unlock(__objc_runtime_mutex); - - /* Call the backend to terminate the thread */ - return __objc_thread_exit(); - } - - /* - Returns an integer value which uniquely describes a thread. Must not be - NULL which is reserved as a marker for "no thread". - */ - objc_thread_t - objc_thread_id(void) - { - /* Call the backend */ - return __objc_thread_id(); - } - - /* - Sets the thread's local storage pointer. - Returns 0 if successful or -1 if failed. - */ - int - objc_thread_set_data(void *value) - { - /* Call the backend */ - return __objc_thread_set_data(value); - } - - /* - Returns the thread's local storage pointer. Returns NULL on failure. - */ - void * - objc_thread_get_data(void) - { - /* Call the backend */ - return __objc_thread_get_data(); - } - - /* Frontend mutex functions */ - - /* - Allocate a mutex. Return the mutex pointer if successful or NULL if the - allocation failed for any reason. - */ - objc_mutex_t - objc_mutex_allocate(void) - { - objc_mutex_t mutex; - - /* Allocate the mutex structure */ - if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex)))) - return NULL; - - /* Call backend to create the mutex */ - if (__objc_mutex_allocate(mutex)) - { - /* failed! */ - objc_free(mutex); - return NULL; - } - - /* Initialize mutex */ - mutex->owner = NULL; - mutex->depth = 0; - return mutex; - } - - /* - Deallocate a mutex. Note that this includes an implicit mutex_lock to - insure that no one else is using the lock. It is legal to deallocate - a lock if we have a lock on it, but illegal to deallocate a lock held - by anyone else. - Returns the number of locks on the thread. (1 for deallocate). - */ - int - objc_mutex_deallocate(objc_mutex_t mutex) - { - int depth; - - /* Valid mutex? */ - if (!mutex) - return -1; - - /* Acquire lock on mutex */ - depth = objc_mutex_lock(mutex); - - /* Call backend to destroy mutex */ - if (__objc_mutex_deallocate(mutex)) - return -1; - - /* Free the mutex structure */ - objc_free(mutex); - - /* Return last depth */ - return depth; - } - - /* - Grab a lock on a mutex. If this thread already has a lock on this mutex - then we increment the lock count. If another thread has a lock on the - mutex we block and wait for the thread to release the lock. - Returns the lock count on the mutex held by this thread. - */ - int - objc_mutex_lock(objc_mutex_t mutex) - { - objc_thread_t thread_id; - int status; - - /* Valid mutex? */ - if (!mutex) - return -1; - - /* If we already own the lock then increment depth */ - thread_id = objc_thread_id(); - if (mutex->owner == thread_id) - return ++mutex->depth; - - /* Call the backend to lock the mutex */ - status = __objc_mutex_lock(mutex); - - /* Failed? */ - if (status) - return status; - - /* Successfully locked the thread */ - mutex->owner = thread_id; - return mutex->depth = 1; - } - - /* - Try to grab a lock on a mutex. If this thread already has a lock on - this mutex then we increment the lock count and return it. If another - thread has a lock on the mutex returns -1. - */ - int - objc_mutex_trylock(objc_mutex_t mutex) - { - objc_thread_t thread_id; - int status; - - /* Valid mutex? */ - if (!mutex) - return -1; - - /* If we already own the lock then increment depth */ - thread_id = objc_thread_id(); - if (mutex->owner == thread_id) - return ++mutex->depth; - - /* Call the backend to try to lock the mutex */ - status = __objc_mutex_trylock(mutex); - - /* Failed? */ - if (status) - return status; - - /* Successfully locked the thread */ - mutex->owner = thread_id; - return mutex->depth = 1; - } - - /* - Unlocks the mutex by one level. - Decrements the lock count on this mutex by one. - If the lock count reaches zero, release the lock on the mutex. - Returns the lock count on the mutex. - It is an error to attempt to unlock a mutex which this thread - doesn't hold in which case return -1 and the mutex is unaffected. - */ - int - objc_mutex_unlock(objc_mutex_t mutex) - { - objc_thread_t thread_id; - int status; - - /* Valid mutex? */ - if (!mutex) - return -1; - - /* If another thread owns the lock then abort */ - thread_id = objc_thread_id(); - if (mutex->owner != thread_id) - return -1; - - /* Decrement depth and return */ - if (mutex->depth > 1) - return --mutex->depth; - - /* Depth down to zero so we are no longer the owner */ - mutex->depth = 0; - mutex->owner = NULL; - - /* Have the backend unlock the mutex */ - status = __objc_mutex_unlock(mutex); - - /* Failed? */ - if (status) - return status; - - return 0; - } - - /* Frontend condition mutex functions */ - - /* - Allocate a condition. Return the condition pointer if successful or NULL - if the allocation failed for any reason. - */ - objc_condition_t - objc_condition_allocate(void) - { - objc_condition_t condition; - - /* Allocate the condition mutex structure */ - if (!(condition = - (objc_condition_t)objc_malloc(sizeof(struct objc_condition)))) - return NULL; - - /* Call the backend to create the condition mutex */ - if (__objc_condition_allocate(condition)) - { - /* failed! */ - objc_free(condition); - return NULL; - } - - /* Success! */ - return condition; - } - - /* - Deallocate a condition. Note that this includes an implicit - condition_broadcast to insure that waiting threads have the opportunity - to wake. It is legal to dealloc a condition only if no other - thread is/will be using it. Here we do NOT check for other threads - waiting but just wake them up. - */ - int - objc_condition_deallocate(objc_condition_t condition) - { - /* Broadcast the condition */ - if (objc_condition_broadcast(condition)) - return -1; - - /* Call the backend to destroy */ - if (__objc_condition_deallocate(condition)) - return -1; - - /* Free the condition mutex structure */ - objc_free(condition); - - return 0; - } - - /* - Wait on the condition unlocking the mutex until objc_condition_signal() - or objc_condition_broadcast() are called for the same condition. The - given mutex *must* have the depth set to 1 so that it can be unlocked - here, so that someone else can lock it and signal/broadcast the condition. - The mutex is used to lock access to the shared data that make up the - "condition" predicate. - */ - int - objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) - { - objc_thread_t thread_id; - - /* Valid arguments? */ - if (!mutex || !condition) - return -1; - - /* Make sure we are owner of mutex */ - thread_id = objc_thread_id(); - if (mutex->owner != thread_id) - return -1; - - /* Cannot be locked more than once */ - if (mutex->depth > 1) - return -1; - - /* Virtually unlock the mutex */ - mutex->depth = 0; - mutex->owner = (objc_thread_t)NULL; - - /* Call the backend to wait */ - __objc_condition_wait(condition, mutex); - - /* Make ourselves owner of the mutex */ - mutex->owner = thread_id; - mutex->depth = 1; - - return 0; - } - - /* - Wake up all threads waiting on this condition. It is recommended that - the called would lock the same mutex as the threads in objc_condition_wait - before changing the "condition predicate" and make this call and unlock it - right away after this call. - */ - int - objc_condition_broadcast(objc_condition_t condition) - { - /* Valid condition mutex? */ - if (!condition) - return -1; - - return __objc_condition_broadcast(condition); - } - - /* - Wake up one thread waiting on this condition. It is recommended that - the called would lock the same mutex as the threads in objc_condition_wait - before changing the "condition predicate" and make this call and unlock it - right away after this call. - */ - int - objc_condition_signal(objc_condition_t condition) - { - /* Valid condition mutex? */ - if (!condition) - return -1; - - return __objc_condition_signal(condition); - } - - /* End of File */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/thr.h gcc-2.95/gcc/objc/thr.h *** egcs-1.1.2/gcc/objc/thr.h Mon Aug 11 08:58:12 1997 --- gcc-2.95/gcc/objc/thr.h Wed Dec 31 16:00:00 1969 *************** *** 1,143 **** - /* 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 */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/gcc/objc/typedstream.h gcc-2.95/gcc/objc/typedstream.h *** egcs-1.1.2/gcc/objc/typedstream.h Wed May 6 14:08:39 1998 --- gcc-2.95/gcc/objc/typedstream.h Wed Dec 31 16:00:00 1969 *************** *** 1,132 **** - /* 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 - - 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 */ --- 0 ---- diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/ChangeLog gcc-2.95/libobjc/ChangeLog *** egcs-1.1.2/libobjc/ChangeLog Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/ChangeLog Wed Jul 28 21:39:50 1999 *************** *** 0 **** --- 1,147 ---- + Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) + + * gcc-2.95 Released. + + Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com) + + * gcc-2.95 Released. + + Mon Jun 21 05:40:15 1999 John David Anglin + + * init.c (__objc_force_linking): Make global. + + Thu May 20 03:20:59 1999 Jeffrey A Law (law@cygnus.com) + + * configure.in (AC_EXEEXT): Remove call. + (compiler_name): Explicitly check with no extension and .exe + extension. + * configure: Regenerate. + + Sun Apr 25 01:15:34 1999 Mumit Khan + + * Makefile.in (CC1OBJ): Define in terms of CC. + (runtime-info.h): Use. + + Fri April 8 08:21:07 1999 Ovidiu Predescu + + * objc-features.texi: Updated the URL to Boehm's GC page. + + Fri Mar 26 23:41:07 1999 Ovidiu Predescu + + * archive.c (__objc_code_char, __objc_write_char): Explicitly specify + the char as being signed (patch from Daniel Jacobowitz + ). + + Wed Mar 24 22:41:28 1999 Mumit Khan + + * configure.in (AC_PREREQ): Update to 2.13. + (AC_EXEEXT): Call to find possible file extension. + (compiler_name): Use. + * configure: Regenerate. + + Wed Jan 27 02:31:01 1999 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (ALL_CFLAGS): Add -DIN_GCC. + + Tue Jan 5 01:38:53 1999 Jeffrey A Law (law@cygnus.com) + + * configure.in (thread_file): Correct and simplify code to find + the thread file. + * configure: Rebuilt. + + 1998-11-26 Manfred Hollstein + + * configure.in (compiler_name): Add check to detect if this + language's compiler has been built. + * configure: Regenerate. + + Mon Nov 23 16:50:28 1998 Kaveh R. Ghazi + + * configure.in: Use AC_PREREQ(2.12.1). + + Thu Nov 19 20:33:37 1998 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (runtime-info.h): Avoid GNU make extensions. + + Sun Nov 8 17:46:14 1998 Kaveh R. Ghazi + + * Makefile.in (INCLUDES): Add -I$(srcdir)/$(MULTISRCTOP)../include. + + Thu Oct 22 14:34:06 1998 Kaveh R. Ghazi + + * configure.in: Use AC_CONFIG_AUX_DIR($topsrcdir). + + Sat Oct 17 05:21:31 1998 Ovidiu Predescu + + * objc-features.texi (Top): Changed the email address. + * objc-features.texi (Garbage Collection): Use @uref instead of @url. + + Mon Oct 11 21:25:27 1998 Ovidiu Predescu + + * encoding.c: Redefine get_inner_array_type to get the first entry + in the structure. + + Thu Oct 8 12:21:14 1998 Richard Frith-Macdonald + + * encoding.c (objc_skip_type_qualifiers): Handle _C_BYREF. + (objc_get_type_qualifiers): Similarly. + * objc/encoding.h (_C_BYREF): Define. + (_F_BYREF): Define. + + 1998-10-07 David S. Miller + + * objc/sarray.h: Make boffset be an unsigned long when sparc so it + works out on 64-bit systems. + + Tue Oct 6 20:32:06 1998 Alexandre Oliva + + * Makefile.in (INCLUDES): Make it multilib-friendly. + + Fri Oct 2 07:12:14 1998 H.J. Lu (hjl@gnu.org) + + * Makefile.in (INCLUDES): Add -I$(srcdir)/../gcc. + + Thu Oct 1 22:33:03 1998 Robert Lipe + Jeffrey A Law (law@cygnus.com) + + * Makefile.in (INCLUDES): Reference gcc via $MULTIBUILDTOP. + (FLAGS_TO_PASS): Added. + (runtime-info.h): Reference cc1ibj via $MULTIBUILDTOP. + + * archive.c: Change config.h to tconfig.h. + + * configure.in: Find gcc's object directory even for multilibs. + + Wed Sep 30 18:17:17 1998 Robert Lipe + + * configure.in: Escape ^ in grep string. + * configure: Rebuilt. + + Wed Sep 30 09:14:52 1998 Jeffrey A Law (law@cygnus.com) + + * All .h files pushed down into the objc/ subdirectory. + * Makefile.in (copy_headers): Corresponding changes. + * configure.in (AC_INIT): Corresponding changes. + * configure: Rebuilt. + + 1998-09-30 Ben Elliston + Jeff Law + + * Makefile.in: Rewrite. + + * configure.in: Likewise. + + * configure: Regenerate. + + * All .c files. Remove "objc" prefix when including objc header + files. Include tconfig.h, not ../tconfig.h. + + Mon Sep 21 23:27:10 1998 Ovidiu Predescu + + * encoding.c (TREE_TYPE, ARRAY_TYPE): Define. + (get_inner_array_type): Define. + + 1998-09-21 Ben Elliston + + * New directory. Moved files from ../gcc/objc. + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/Makefile.in gcc-2.95/libobjc/Makefile.in *** egcs-1.1.2/libobjc/Makefile.in Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/Makefile.in Sat Apr 24 17:21:51 1999 *************** *** 0 **** --- 1,317 ---- + #Makefile for GNU Objective C runtime library. + #Copyright (C) 1993, 95-97, 1998 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. */ + + #This was cribbed from the libchill, libiberty and libstdc++ + #Makefile.in files. Some of this stuff may be unnecessary and + #worthless. + + SHELL = /bin/sh + + #### Start of system configuration section. #### + + srcdir = @srcdir@ + VPATH = @srcdir@ + prefix = @prefix@ + exec_prefix = @exec_prefix@ + target_alias = @target_alias@ + gcc_version = @gcc_version@ + gcc_version_trigger = @gcc_version_trigger@ + + libdir = $(exec_prefix)/lib + libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version) + incinstalldir = $(libsubdir)/include + + # Multilib support variables. + MULTISRCTOP = + MULTIBUILDTOP = + MULTIDIRS = + MULTISUBDIR = + MULTIDO = true + MULTICLEAN = true + + # Not configured per top-level version, since that doesn't get passed + # down at configure time, but overrridden by the top-level install + # target. + INSTALL = @INSTALL@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_DATA = @INSTALL_DATA@ + + AR = @AR@ + AR_FLAGS = rc + + RANLIB = @RANLIB@ + + CC = @CC@ + CFLAGS = @CFLAGS@ + ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) -DIN_GCC + + # + # Define the cc1obj in terms of the CC that is passed on from higher + # level make. This is needed to make sure we can create runtime-info.h + # when doing canadian cross builds where running ../../gcc/cc1obj + # does not make any sense. + # + CC1OBJ = `$(CC) -print-prog-name=cc1obj` + + INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \ + -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \ + -I$(srcdir)/$(MULTISRCTOP)../include + + OBJC_GCFLAGS=-DOBJC_WITH_GC=1 + OBJC_THREAD_FILE=thr-@OBJC_THREAD_FILE@ + + .SUFFIXES: + .SUFFIXES: .c .m .o + + .c.o: + $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $< + + .m.o: + $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $< + + # Flags to pass to a recursive make. + FLAGS_TO_PASS = \ + "AR=$(AR)" \ + "AR_FLAGS=$(AR_FLAGS)" \ + "CC=$(CC)" \ + "CFLAGS=$(CFLAGS)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "EXTRA_OFILES=$(EXTRA_OFILES)" \ + "HDEFINES=$(HDEFINES)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LOADLIBES=$(LOADLIBES)" \ + "PICFLAG=$(PICFLAG)" \ + "RANLIB=$(RANLIB)" \ + "SHELL=$(SHELL)" + + all: libobjc.a @OBJC_BOEHM_GC@ + $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all + + # User-visible header files. + + OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \ + NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \ + thr.h + + # Modules that comprise the runtime library. + + OBJS = archive.o class.o encoding.o gc.o hash.o init.o linking.o \ + misc.o nil_method.o NXConstStr.o Object.o objects.o \ + Protocol.o sarray.o selector.o sendmsg.o thr.o \ + $(OBJC_THREAD_FILE).o + + OBJS_GC = archive_gc.o class_gc.o encoding_gc.o gc_gc.o hash_gc.o \ + init_gc.o linking_gc.o misc_gc.o nil_method_gc.o \ + NXConstStr_gc.o Object_gc.o objects_gc.o Protocol_gc.o \ + sarray_gc.o selector_gc.o sendmsg_gc.o thr_gc.o \ + $(OBJC_THREAD_FILE)_gc.o + + runtime-info.h: + echo "" > tmp-runtime + echo "/* This file is automatically generated */" > $@ + $(CC1OBJ) -print-objc-runtime-info tmp-runtime >> $@ + rm -f tmp-runtime + + archive_gc.o: archive.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + class_gc.o: class.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + encoding_gc.o: encoding.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + gc.o: gc.c + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< + + gc_gc.o: gc.c + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ + $(INCLUDES) $< + + hash_gc.o: hash.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + init_gc.o: init.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + linking.o: linking.m + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< + + linking_gc.o: linking.m + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ + $(INCLUDES) $< + + misc_gc.o: misc.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + nil_method_gc.o: nil_method.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + NXConstStr.o: NXConstStr.m + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< + + NXConstStr_gc.o: NXConstStr.m + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ + $(INCLUDES) $< + + Object.o: Object.m + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< + + Object_gc.o: Object.m + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ + $(INCLUDES) $< + + objects_gc.o: objects.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + Protocol.o: Protocol.m + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< + + Protocol_gc.o: Protocol.m + $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ + $(INCLUDES) $< + + sarray_gc.o: sarray.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + selector_gc.o: selector.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + sendmsg.o: sendmsg.c runtime-info.h + $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $< + + sendmsg_gc.o: sendmsg.c runtime-info.h + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + thr_gc.o: thr.c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + $(OBJC_THREAD_FILE)_gc.o: $(OBJC_THREAD_FILE).c + $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) $(INCLUDES) $< + + doc: info dvi html + + libobjc.a: $(OBJS) + $(AR) $(AR_FLAGS) $@ $(OBJS) + $(RANLIB) $@ + + libobjc_gc.a: $(OBJS_GC) + $(AR) $(AR_FLAGS) $@ $(OBJS_GC) + $(RANLIB) $@ + + libobjc_s.a: libobjc.a + mv libobjc.a libobjc_s.a + + # Create a relocatable DLL + libobjc.dll: libobjc_s.a libobjc_entry.o + $(CC) -mdll -Wl,--base-file -Wl,libobjc.base \ + -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 + $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ + --base-file libobjc.base --output-exp libobjc.exp + $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \ + -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 + $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ + --base-file libobjc.base --output-exp libobjc.exp + $(GCC_FOR_TARGET) libobjc.exp -mdll \ + -o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32 + $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \ + --output-lib libobjc.a + + info: objc-features.info + dvi: objc-features.dvi + html: objc-features_toc.html + + objc-features.info: $(srcdir)/objc-features.texi + makeinfo $(srcdir)/objc-features.texi + + objc-features.dvi: $(srcdir)/objc-features.texi + texi2dvi $(srcdir)/objc-features.texi + + objc-features_toc.html: objc-features.texi + texi2html -split_node $(srcdir)/objc-features.texi + + Makefile: Makefile.in config.status + $(SHELL) config.status + + config.status: configure + rm -f config.cache + CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \ + CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck + + ${srcdir}/configure: configure.in + rm -f config.cache + cd ${srcdir} && autoconf + + install: install-libs copy-headers + + install-libs: installdirs + -if test -f libobjc.a ; then \ + rm -f $(libsubdir)/libobjc.a; \ + $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \ + chmod a-x $(libsubdir)/libobjc.a; \ + else true; fi + -if test -f libobjc_gc.a ; then \ + rm -f $(libsubdir)/libobjc_gc.a; \ + $(INSTALL_DATA) libobjc_gc.a $(libsubdir)/libobjc_gc.a; \ + chmod a-x $(libsubdir)/libobjc_gc.a; \ + else true; fi + -if test -f libobjc_s.a ; then \ + rm -f $(libsubdir)/libobjc_s.a; \ + $(INSTALL_DATA) libobjc_s.a $(libsubdir)/libobjc_s.a; \ + chmod a-x $(libsubdir)/libobjc_s.a; \ + else true; fi + -if test -f libobjc.dll ; then \ + rm -f $(bindir)/libobjc.dll; \ + $(INSTALL_DATA) libobjc.dll $(bindir)/libobjc.dll; \ + else true; fi + + # Copy Objective C headers to installation include directory. + copy-headers: + -rm -rf $(incinstalldir)/objc + -mkdir $(incinstalldir)/objc + for file in $(OBJC_H); do \ + realfile=$(srcdir)/objc/$${file}; \ + cp $${realfile} $(incinstalldir)/objc; \ + chmod a+r $(incinstalldir)/objc/$${file}; \ + done + + check uninstall install-strip dist installcheck installdirs: + + mostlyclean: + -rm -f runtime-info.h tmp-runtime.s *.o libobjc* xforward \ + fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \ + *.toc *.tp *.vr *.html libobj.exp + @$(MULTICLEAN) multi-clean DO=mostlyclean + + clean: mostlyclean + rm -f config.log + @$(MULTICLEAN) multi-clean DO=clean + + distclean: clean + @$(MULTICLEAN) multi-clean DO=distclean + rm -f config.cache config.status Makefile configure + + maintainer-clean realclean: distclean + + .PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \ + install-strip dist installcheck installdirs diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/NXConstStr.m gcc-2.95/libobjc/NXConstStr.m *** egcs-1.1.2/libobjc/NXConstStr.m Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/NXConstStr.m Sun Sep 20 18:22:06 1998 *************** *** 0 **** --- 1,42 ---- + /* Implementation of the NXConstantString class for Objective-C. + Copyright (C) 1995 Free Software Foundation, Inc. + Contributed by Pieter J. Schoenmakers + + 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. */ + + #include "objc/NXConstStr.h" + + @implementation NXConstantString + + -(const char *) cString + { + return (c_string); + } /* -cString */ + + -(unsigned int) length + { + return (len); + } /* -length */ + + @end diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/Object.m gcc-2.95/libobjc/Object.m *** egcs-1.1.2/libobjc/Object.m Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/Object.m Sun Sep 20 18:22:06 1998 *************** *** 0 **** --- 1,387 ---- + /* The implementation of class Object for Objective-C. + Copyright (C) 1993, 1994, 1995, 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. */ + + #include + #include "objc/Object.h" + #include "objc/Protocol.h" + #include "objc/objc-api.h" + + extern int errno; + + #define MAX_CLASS_NAME_LEN 256 + + @implementation Object + + + initialize + { + return self; + } + + - init + { + return self; + } + + + new + { + return [[self alloc] init]; + } + + + alloc + { + return class_create_instance(self); + } + + - free + { + return object_dispose(self); + } + + - copy + { + return [[self shallowCopy] deepen]; + } + + - shallowCopy + { + return object_copy(self); + } + + - deepen + { + return self; + } + + - deepCopy + { + return [self copy]; + } + + - (Class)class + { + return object_get_class(self); + } + + - (Class)superClass + { + return object_get_super_class(self); + } + + - (MetaClass)metaClass + { + return object_get_meta_class(self); + } + + - (const char *)name + { + return object_get_class_name(self); + } + + - self + { + return self; + } + + - (unsigned int)hash + { + return (size_t)self; + } + + - (BOOL)isEqual:anObject + { + return self==anObject; + } + + - (int)compare:anotherObject; + { + if ([self isEqual:anotherObject]) + return 0; + // Ordering objects by their address is pretty useless, + // so subclasses should override this is some useful way. + else if (self > anotherObject) + return 1; + else + return -1; + } + + - (BOOL)isMetaClass + { + return NO; + } + + - (BOOL)isClass + { + return object_is_class(self); + } + + - (BOOL)isInstance + { + return object_is_instance(self); + } + + - (BOOL)isKindOf:(Class)aClassObject + { + Class class; + + for (class = self->isa; class!=Nil; class = class_get_super_class(class)) + if (class==aClassObject) + return YES; + return NO; + } + + - (BOOL)isMemberOf:(Class)aClassObject + { + return self->isa==aClassObject; + } + + - (BOOL)isKindOfClassNamed:(const char *)aClassName + { + Class class; + + if (aClassName!=NULL) + for (class = self->isa; class!=Nil; class = class_get_super_class(class)) + if (!strcmp(class_get_class_name(class), aClassName)) + return YES; + return NO; + } + + - (BOOL)isMemberOfClassNamed:(const char *)aClassName + { + return ((aClassName!=NULL) + &&!strcmp(class_get_class_name(self->isa), aClassName)); + } + + + (BOOL)instancesRespondTo:(SEL)aSel + { + return class_get_instance_method(self, aSel)!=METHOD_NULL; + } + + - (BOOL)respondsTo:(SEL)aSel + { + return ((object_is_instance(self) + ?class_get_instance_method(self->isa, aSel) + :class_get_class_method(self->isa, aSel))!=METHOD_NULL); + } + + + (IMP)instanceMethodFor:(SEL)aSel + { + return method_get_imp(class_get_instance_method(self, aSel)); + } + + // Indicates if the receiving class or instance conforms to the given protocol + // not usually overridden by subclasses + // + // Modified 9/5/94 to always search the class object's protocol list, rather + // than the meta class. + + + (BOOL) conformsTo: (Protocol*)aProtocol + { + int i; + struct objc_protocol_list* proto_list; + id parent; + + for (proto_list = ((Class)self)->protocols; + proto_list; proto_list = proto_list->next) + { + for (i=0; i < proto_list->count; i++) + { + if ([proto_list->list[i] conformsTo: aProtocol]) + return YES; + } + } + + if ((parent = [self superClass])) + return [parent conformsTo: aProtocol]; + else + return NO; + } + + - (BOOL) conformsTo: (Protocol*)aProtocol + { + return [[self class] conformsTo:aProtocol]; + } + + - (IMP)methodFor:(SEL)aSel + { + return (method_get_imp(object_is_instance(self) + ?class_get_instance_method(self->isa, aSel) + :class_get_class_method(self->isa, aSel))); + } + + + (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel + { + return ((struct objc_method_description *) + class_get_instance_method(self, aSel)); + } + + - (struct objc_method_description *)descriptionForMethod:(SEL)aSel + { + return ((struct objc_method_description *) + (object_is_instance(self) + ?class_get_instance_method(self->isa, aSel) + :class_get_class_method(self->isa, aSel))); + } + + - perform:(SEL)aSel + { + IMP msg = objc_msg_lookup(self, aSel); + if (!msg) + return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; + return (*msg)(self, aSel); + } + + - perform:(SEL)aSel with:anObject + { + IMP msg = objc_msg_lookup(self, aSel); + if (!msg) + return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; + return (*msg)(self, aSel, anObject); + } + + - perform:(SEL)aSel with:anObject1 with:anObject2 + { + IMP msg = objc_msg_lookup(self, aSel); + if (!msg) + return [self error:"invalid selector passed to %s", sel_get_name(_cmd)]; + return (*msg)(self, aSel, anObject1, anObject2); + } + + - (retval_t)forward:(SEL)aSel :(arglist_t)argFrame + { + return (retval_t)[self doesNotRecognize: aSel]; + } + + - (retval_t)performv:(SEL)aSel :(arglist_t)argFrame + { + return objc_msg_sendv(self, aSel, argFrame); + } + + + poseAs:(Class)aClassObject + { + return class_pose_as(self, aClassObject); + } + + - (Class)transmuteClassTo:(Class)aClassObject + { + if (object_is_instance(self)) + if (class_is_class(aClassObject)) + if (class_get_instance_size(aClassObject)==class_get_instance_size(isa)) + if ([self isKindOf:aClassObject]) + { + Class old_isa = isa; + isa = aClassObject; + return old_isa; + } + return nil; + } + + - subclassResponsibility:(SEL)aSel + { + return [self error:"subclass should override %s", sel_get_name(aSel)]; + } + + - notImplemented:(SEL)aSel + { + return [self error:"method %s not implemented", sel_get_name(aSel)]; + } + + - shouldNotImplement:(SEL)aSel + { + return [self error:"%s should not implement %s", + object_get_class_name(self), sel_get_name(aSel)]; + } + + - doesNotRecognize:(SEL)aSel + { + return [self error:"%s does not recognize %s", + object_get_class_name(self), sel_get_name(aSel)]; + } + + #ifdef __alpha__ + extern size_t strlen(const char*); + #endif + + - error:(const char *)aString, ... + { + #define FMT "error: %s (%s)\n%s\n" + char fmt[(strlen((char*)FMT)+strlen((char*)object_get_class_name(self)) + +((aString!=NULL)?strlen((char*)aString):0)+8)]; + va_list ap; + + sprintf(fmt, FMT, object_get_class_name(self), + object_is_instance(self)?"instance":"class", + (aString!=NULL)?aString:""); + va_start(ap, aString); + objc_verror(self, OBJC_ERR_UNKNOWN, fmt, ap); + va_end(ap); + return nil; + #undef FMT + } + + + (int)version + { + return class_get_version(self); + } + + + setVersion:(int)aVersion + { + class_set_version(self, aVersion); + return self; + } + + + (int)streamVersion: (TypedStream*)aStream + { + if (aStream->mode == OBJC_READONLY) + return objc_get_stream_class_version (aStream, self); + else + return class_get_version (self); + } + + // These are used to write or read the instance variables + // declared in this particular part of the object. Subclasses + // should extend these, by calling [super read/write: aStream] + // before doing their own archiving. These methods are private, in + // the sense that they should only be called from subclasses. + + - read: (TypedStream*)aStream + { + // [super read: aStream]; + return self; + } + + - write: (TypedStream*)aStream + { + // [super write: aStream]; + return self; + } + + - awake + { + // [super awake]; + return self; + } + + @end diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/Protocol.m gcc-2.95/libobjc/Protocol.m *** egcs-1.1.2/libobjc/Protocol.m Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/Protocol.m Sun Sep 20 18:22:06 1998 *************** *** 0 **** --- 1,128 ---- + /* This file contains the implementation of class Protocol. + 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. */ + + #include "objc/Protocol.h" + #include "objc/objc-api.h" + + /* Method description list */ + struct objc_method_description_list { + int count; + struct objc_method_description list[1]; + }; + + + @implementation Protocol + { + @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 + { + return protocol_name; + } + + /* Testing protocol conformance */ + + - (BOOL) conformsTo: (Protocol *)aProtocolObject + { + int i; + struct objc_protocol_list* proto_list; + + if (!strcmp(aProtocolObject->protocol_name, self->protocol_name)) + return YES; + + for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) + { + for (i=0; i < proto_list->count; i++) + { + if ([proto_list->list[i] conformsTo: aProtocolObject]) + return YES; + } + } + + return NO; + } + + /* Looking up information specific to a protocol */ + + - (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel + { + int i; + struct objc_protocol_list* proto_list; + const char* name = sel_get_name (aSel); + struct objc_method_description *result; + + for (i = 0; i < instance_methods->count; i++) + { + if (!strcmp ((char*)instance_methods->list[i].name, name)) + return &(instance_methods->list[i]); + } + + for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) + { + for (i=0; i < proto_list->count; i++) + { + if ((result = [proto_list->list[i] + descriptionForInstanceMethod: aSel])) + return result; + } + } + + return NULL; + } + + - (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel; + { + int i; + struct objc_protocol_list* proto_list; + const char* name = sel_get_name (aSel); + struct objc_method_description *result; + + for (i = 0; i < class_methods->count; i++) + { + if (!strcmp ((char*)class_methods->list[i].name, name)) + return &(class_methods->list[i]); + } + + for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) + { + for (i=0; i < proto_list->count; i++) + { + if ((result = [proto_list->list[i] + descriptionForClassMethod: aSel])) + return result; + } + } + + return NULL; + } + + @end diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/README gcc-2.95/libobjc/README *** egcs-1.1.2/libobjc/README Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/README Thu Sep 17 01:04:29 1998 *************** *** 0 **** --- 1,97 ---- + + GNU Objective C notes + ********************* + + This document is to explain what has been done, and a little about how + specific features differ from other implementations. The runtime has + been completely rewritten in gcc 2.4. The earlier runtime had several + severe bugs and was rather incomplete. The compiler has had several + new features added as well. + + This is not documentation for Objective C, it is usable to someone + who knows Objective C from somewhere else. + + + Runtime API functions + ===================== + + The runtime is modeled after the NeXT Objective C runtime. That is, + most functions have semantics as it is known from the NeXT. The + names, however, have changed. All runtime API functions have names + of lowercase letters and underscores as opposed to the + `traditional' mixed case names. + The runtime api functions are not documented as of now. + Someone offered to write it, and did it, but we were not allowed to + use it by his university (Very sad story). We have started writing + the documentation over again. This will be announced in appropriate + places when it becomes available. + + + Protocols + ========= + + Protocols are now fully supported. The semantics is exactly as on the + NeXT. There is a flag to specify how protocols should be typechecked + when adopted to classes. The normal typechecker requires that all + methods in a given protocol must be implemented in the class that + adopts it -- it is not enough to inherit them. The flag + `-Wno-protocol' causes it to allow inherited methods, while + `-Wprotocols' is the default which requires them defined. + + + +initialize + =========== + + This method, if defined, is called before any other instance or class + methods of that particular class. This method is not inherited, and + is thus not called as initializer for a subclass that doesn't define + it itself. Thus, each +initialize method is called exactly once (or + never if no methods of that particular class is never called). + Besides this, it is allowed to have several +initialize methods, one + for each category. The order in which these (multiple methods) are + called is not well defined. I am not completely certain what the + semantics of this method is for other implementations, but this is + how it works for GNU Objective C. + + + Passivation/Activation/Typedstreams + =================================== + + This is supported in the style of NeXT TypedStream's. Consult the + headerfile Typedstreams.h for api functions. I (Kresten) have + rewritten it in Objective C, but this implementation is not part of + 2.4, it is available from the GNU Objective C prerelease archive. + There is one difference worth noting concerning objects stored with + objc_write_object_reference (aka NXWriteObjectReference). When these + are read back in, their object is not guaranteed to be available until + the `-awake' method is called in the object that requests that object. + To objc_read_object you must pass a pointer to an id, which is valid + after exit from the function calling it (like e.g. an instance + variable). In general, you should not use objects read in until the + -awake method is called. + + + Acknowledgements + ================ + + The GNU Objective C team: Geoffrey Knauth (manager), + Tom Wood (compiler) and Kresten Krab Thorup + (runtime) would like to thank a some people for + participating in the development of the present GNU Objective C. + + Paul Burchard and Andrew McCallum + has been very helpful debugging the + runtime. Eric Herring has been very helpful + cleaning up after the documentation-copyright disaster and is now + helping with the new documentation. + + Steve Naroff and Richard Stallman + has been very helpful with implementation details + in the compiler. + + + Bug Reports + =========== + + Please read the section `Submitting Bugreports' of the gcc manual + before you submit any bugs. diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/README.threads gcc-2.95/libobjc/README.threads *** egcs-1.1.2/libobjc/README.threads Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/README.threads Thu Sep 17 01:04:29 1998 *************** *** 0 **** --- 1,50 ---- + ============================================================================== + README.threads - Wed Nov 29 15:16:24 EST 1995 + ------------------------------------------------------------------------------ + + Limited documentation is available in the THREADS file. + + This version has been tested on Sun Solaris, SGI Irix, and Windows NT. + It should also work on any single threaded system. + + Thanks go to the following people for help test and debug the library: + + Scott Christley, scottc@ocbi.com + Andrew McCallum, mccallum@cs.rochester.edu + + galen + gchunt@cs.rochester.edu + + Any questions, bug reports, etc should be directed to: + + Scott Christley, scottc@ocbi.com + + Please do not bug Galen with email as he no longer supports the code. + + ============================================================================== + Changes from prior releases (in revered chronological order): + ------------------------------------------------------------------------------ + + * Fixed bug in copy part of sarray_realloc. I had an < which should + have been <=. (Bug report from Scott). + + ------------------------------------------------------------------------------ + + * Support for DEC OSF/1 is definitely broken. My programs always + seg-fault when I link with libpthreads.a. + + * Thread id's are no longer int's, but are instead of type + _objc_thread_t which is typedef'ed from a void *. An invalid thread + id is denoted by NULL and not -1 as before. + + ------------------------------------------------------------------------------ + + * Renamed thread-winnt.c to thread-win32.c to better reflect support + for the API on both Windows NT and Windows 95 platforms. + (Who knows, maybe even Win32s :-). + + * Fixed bugs in Win32 support as per report from Scott Christley. + + * Fixed bug in sarray_get as per report from Scott Christley. + + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/THREADS gcc-2.95/libobjc/THREADS *** egcs-1.1.2/libobjc/THREADS Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/THREADS Thu Sep 17 01:04:29 1998 *************** *** 0 **** --- 1,374 ---- + This file describes in little detail the modifications to the + Objective-C runtime needed to make it thread safe. + + First off, kudos to Galen Hunt who is the author of this great work. + + If you have an comments or just want to know where to + send me money to express your undying gratitude for threading the + Objective-C runtime you can reach Galen at: + + gchunt@cs.rochester.edu + + Any questions, comments, bug reports, etc. should send email either to the + GCC bug account or to: + + Scott Christley + + * Sarray Threading: + + The most critical component of the Objective-C runtime is the sparse array + structure (sarray). Sarrays store object selectors and implementations. + Following in the tradition of the Objective-C runtime, my threading + support assumes that fast message dispatching is far more important + than *ANY* and *ALL* other operations. The message dispatching thus + uses *NO* locks on any kind. In fact, if you look in sarray.h, you + will notice that the message dispatching has not been modified. + Instead, I have modified the sarray management functions so that all + updates to the sarray data structure can be made in parallel will + message dispatching. + + To support concurrent message dispatching, no dynamically allocated + sarray data structures are freed while more than one thread is + operational. Sarray data structures that are no longer in use are + kept in a linked list of garbage and are released whenever the program + is operating with a single thread. The programmer can also flush the + garbage list by calling sarray_remove_garbage when the programmer can + ensure that no message dispatching is taking place concurrently. The + amount of un-reclaimed sarray garbage should normally be extremely + small in a real program as sarray structures are freed only when using + the "poseAs" functionality and early in program initialization, which + normally occurs while the program is single threaded. + + ****************************************************************************** + * Static Variables: + + The following variables are either statically or globally defined. This list + does not include variables which are internal to implementation dependent + versions of thread-*.c. + + The following threading designations are used: + SAFE : Implicitly thread safe. + SINGLE : Must only be used in single thread mode. + MUTEX : Protected by single global mutex objc_runtime_mutex. + UNUSED : Not used in the runtime. + + Variable Name: Usage: Defined: Also used in: + =========================== ====== ============ ===================== + __objc_class_hash MUTEX class.c + __objc_class_links_resolved UNUSED class.c runtime.h + __objc_class_number MUTEX class.c + __objc_dangling_categories UNUSED init.c + __objc_module_list MUTEX init.c + __objc_selector_array MUTEX selector.c + __objc_selector_hash MUTEX selector.c + __objc_selector_max_index MUTEX selector.c sendmsg.c runtime.h + __objc_selector_names MUTEX selector.c + __objc_thread_exit_status SAFE thread.c + __objc_uninstalled_dtable MUTEX sendmsg.c selector.c + _objc_load_callback SAFE init.c objc-api.h + _objc_lookup_class SAFE class.c objc-api.h + _objc_object_alloc SINGLE objects.c objc-api.h + _objc_object_copy SINGLE objects.c objc-api.h + _objc_object_dispose SINGLE objects.c objc-api.h + frwd_sel SAFE2 sendmsg.c + idxsize MUTEX sarray.c sendmsg.c sarray.h + initialize_sel SAFE2 sendmsg.c + narrays MUTEX sarray.c sendmsg.c sarray.h + nbuckets MUTEX sarray.c sendmsg.c sarray.h + nindices MUTEX sarray.c sarray.h + previous_constructors SAFE1 init.c + proto_class SAFE1 init.c + unclaimed_categories MUTEX init.c + unclaimed_proto_list MUTEX init.c + uninitialized_statics MUTEX init.c + + Notes: + 1) Initialized once in unithread mode. + 2) Initialized value will always be same, guaranteed by lock on selector + hash table. + + + ****************************************************************************** + * Frontend/Backend design: + + The design of the Objective-C runtime thread and mutex functions utilizes a + frontend/backend implementation. + + The frontend, as characterized by the files thr.h and thr.c, is a set + of platform independent structures and functions which represent the + user interface. Objective-C programs should use these structures and + functions for their thread and mutex work if they wish to maintain a + high degree of portability across platforms. + + The backend is composed of a file with the necessary code to map the ObjC + thread and mutex to a platform specific implementation. For example, the + file thr-solaris.c contains the implementation for Solaris. When you + configure GCC, it attempts to pick an appropriate backend file for the + target platform; however, you can override this choice by assign the + OBJC_THREAD_FILE make variable to the basename of the backend file. This + is especially useful on platforms which have multiple thread libraries. + For example: + + make OBJC_THREAD_FILE=thr-posix + + would indicate that the generic posix backend file, thr-posix.c, should be + compiled with the ObjC runtime library. If your platform does not support + threads then you should specify the OBJC_THREAD_FILE=thr-single backend file + to compile the ObjC runtime library without thread or mutex support; note + that programs which rely upon the ObjC thread and mutex functions will + compile and link correctly but attempting to create a thread or mutex will + result in an error. + + It is questionable whether it is really necessary to have both a + frontend and backend function for all available functionality. On the + one hand, it provides a clear, consistent differentiation between what + is public and what is private with the downside of having the overhead + of multiple functions calls. For example, the function to have a thread + yield the processor is objc_thread_yield; in the current implementation + this produces a function call set: + + objc_thread_yield() -> __objc_thread_yield() -> system yield function + + This has two extra function calls over calling the platform specific function + explicitly, but the issue is whether only the overhead of a single function + is necessary. + + objc_thread_yield() -> system yield function + + This breaks the public/private dichotomy between the frontend/backend + for the sake of efficiency. It is possible to just use a preprocessor + define so as to eliminate the extra function call: + + #define objc_thread_yield() __objc_thread_yield() + + This has the undesirable effect that if objc_thread_yield is actually + turned into a function based upon future need; then ObjC programs which + access the thread functions would need to be recompiled versus just + being relinked. + + ****************************************************************************** + * Threads: + + The thread system attempts to create multiple threads using whatever + operating system or library thread support is available. It does + assume that all system functions are thread safe. Notably this means + that the system implementation of malloc and free must be thread safe. + If a system has multiple processors, the threads are configured for + full parallel processing. + + * Backend initialization functions + + __objc_init_thread_system(void), int + Initialize the thread subsystem. Called once by __objc_exec_class. + Return -1 if error otherwise return 0. + + __objc_close_thread_system(void), int + Closes the thread subsystem, not currently guaranteed to be called. + Return -1 if error otherwise return 0. + + ***** + * Frontend thread functions + * User programs should use these functions. + + objc_thread_detach(SEL selector, id object, id argument), objc_thread_t + Creates and detaches a new thread. The new thread starts by + sending the given selector with a single argument to the + given object. + + objc_thread_set_priority(int priority), int + Sets a thread's relative priority within the program. Valid + options are: + + OBJC_THREAD_INTERACTIVE_PRIORITY + OBJC_THREAD_BACKGROUND_PRIORITY + OBJC_THREAD_LOW_PRIORITY + + objc_thread_get_priority(void), int + Query a thread's priority. + + objc_thread_yield(void), void + Yields processor to another thread with equal or higher + priority. It is up to the system scheduler to determine if + the processor is taken or not. + + objc_thread_exit(void), int + Terminates a thread. If this is the last thread executing + then the program will terminate. + + objc_thread_id(void), int + Returns the current thread's id. + + objc_thread_set_data(void *value), int + Set a pointer to the thread's local storage. Local storage is + thread specific. + + objc_thread_get_data(void), void * + Returns the pointer to the thread's local storage. + + ***** + * Backend thread functions + * User programs should *NOT* directly call these functions. + + __objc_thread_detach(void (*func)(void *arg), void *arg), objc_thread_t + Spawns a new thread executing func, called by objc_thread_detach. + Return NULL if error otherwise return thread id. + + __objc_thread_set_priority(int priority), int + Set the thread's priority, called by objc_thread_set_priority. + Return -1 if error otherwise return 0. + + __objc_thread_get_priority(void), int + Query a thread's priority, called by objc_thread_get_priority. + Return -1 if error otherwise return the priority. + + __objc_thread_yield(void), void + Yields the processor, called by objc_thread_yield. + + __objc_thread_exit(void), int + Terminates the thread, called by objc_thread_exit. + Return -1 if error otherwise function does not return. + + __objc_thread_id(void), objc_thread_t + Returns the current thread's id, called by objc_thread_id. + Return -1 if error otherwise return thread id. + + __objc_thread_set_data(void *value), int + Set pointer for thread local storage, called by objc_thread_set_data. + Returns -1 if error otherwise return 0. + + __objc_thread_get_data(void), void * + Returns the pointer to the thread's local storage. + Returns NULL if error, called by objc_thread_get_data. + + + ****************************************************************************** + * Mutexes: + + Mutexes can be locked recursively. Each locked mutex remembers + its owner (by thread id) and how many times it has been locked. The + last unlock on a mutex removes the system lock and allows other + threads to access the mutex. + + ***** + * Frontend mutex functions + * User programs should use these functions. + + objc_mutex_allocate(void), objc_mutex_t + Allocates a new mutex. Mutex is initially unlocked. + Return NULL if error otherwise return mutex pointer. + + objc_mutex_deallocate(objc_mutex_t mutex), int + Free a mutex. Before freeing the mutex, makes sure that no + one else is using it. + Return -1 if error otherwise return 0. + + objc_mutex_lock(objc_mutex_t mutex), int + Locks a mutex. As mentioned earlier, the same thread may call + this routine repeatedly. + Return -1 if error otherwise return 0. + + objc_mutex_trylock(objc_mutex_t mutex), int + Attempts to lock a mutex. If lock on mutex can be acquired + then function operates exactly as objc_mutex_lock. + Return -1 if failed to acquire lock otherwise return 0. + + objc_mutex_unlock(objc_mutex_t mutex), int + Unlocks the mutex by one level. Other threads may not acquire + the mutex until this thread has released all locks on it. + Return -1 if error otherwise return 0. + + ***** + * Backend mutex functions + * User programs should *NOT* directly call these functions. + + __objc_mutex_allocate(objc_mutex_t mutex), int + Allocates a new mutex, called by objc_mutex_allocate. + Return -1 if error otherwise return 0. + + __objc_mutex_deallocate(objc_mutex_t mutex), int + Free a mutex, called by objc_mutex_deallocate. + Return -1 if error otherwise return 0. + + __objc_mutex_lock(objc_mutex_t mutex), int + Locks a mutex, called by objc_mutex_lock. + Return -1 if error otherwise return 0. + + __objc_mutex_trylock(objc_mutex_t mutex), int + Attempts to lock a mutex, called by objc_mutex_trylock. + Return -1 if failed to acquire lock or error otherwise return 0. + + __objc_mutex_unlock(objc_mutex_t mutex), int + Unlocks the mutex, called by objc_mutex_unlock. + Return -1 if error otherwise return 0. + + ****************************************************************************** + * Condition Mutexes: + + Mutexes can be locked recursively. Each locked mutex remembers + its owner (by thread id) and how many times it has been locked. The + last unlock on a mutex removes the system lock and allows other + threads to access the mutex. + + * + * Frontend condition mutex functions + * User programs should use these functions. + * + + objc_condition_allocate(void), objc_condition_t + Allocate a condition mutex. + Return NULL if error otherwise return condition pointer. + + objc_condition_deallocate(objc_condition_t condition), int + Deallocate a condition. Note that this includes an implicit + condition_broadcast to insure that waiting threads have the + opportunity to wake. It is legal to dealloc a condition only + if no other thread is/will be using it. Does NOT check for + other threads waiting but just wakes them up. + Return -1 if error otherwise return 0. + + objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int + Wait on the condition unlocking the mutex until objc_condition_signal() + or objc_condition_broadcast() are called for the same condition. The + given mutex *must* have the depth 1 so that it can be unlocked + here, for someone else can lock it and signal/broadcast the condition. + The mutex is used to lock access to the shared data that make up the + "condition" predicate. + Return -1 if error otherwise return 0. + + objc_condition_broadcast(objc_condition_t condition), int + Wake up all threads waiting on this condition. It is recommended that + the called would lock the same mutex as the threads in + objc_condition_wait before changing the "condition predicate" + and make this call and unlock it right away after this call. + Return -1 if error otherwise return 0. + + objc_condition_signal(objc_condition_t condition), int + Wake up one thread waiting on this condition. + Return -1 if error otherwise return 0. + + * + * Backend condition mutex functions + * User programs should *NOT* directly call these functions. + * + + __objc_condition_allocate(objc_condition_t condition), int + Allocate a condition mutex, called by objc_condition_allocate. + Return -1 if error otherwise return 0. + + __objc_condition_deallocate(objc_condition_t condition), int + Deallocate a condition, called by objc_condition_deallocate. + Return -1 if error otherwise return 0. + + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int + Wait on the condition, called by objc_condition_wait. + Return -1 if error otherwise return 0 when condition is met. + + __objc_condition_broadcast(objc_condition_t condition), int + Wake up all threads waiting on this condition. + Called by objc_condition_broadcast. + Return -1 if error otherwise return 0. + + __objc_condition_signal(objc_condition_t condition), int + Wake up one thread waiting on this condition. + Called by objc_condition_signal. + Return -1 if error otherwise return 0. diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/THREADS.MACH gcc-2.95/libobjc/THREADS.MACH *** egcs-1.1.2/libobjc/THREADS.MACH Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/THREADS.MACH Thu Sep 17 01:04:29 1998 *************** *** 0 **** --- 1,23 ---- + This readme refers to the file thr-mach.c. + + Under mach, thread priorities are kinda strange-- any given thread has + a MAXIMUM priority and a BASE priority. The BASE priority is the + current priority of the thread and the MAXIMUM is the maximum possible + priority the thread can assume. The developer can lower, but never + raise the maximum priority. + + The gcc concept of thread priorities is that they run at one of three + levels; interactive, background, and low. + + Under mach, this is translated to: + + interactive -- set priority to maximum + background -- set priority to 2/3 of maximum + low -- set priority to 1/3 of maximum + + This means that it is possible for a thread with the priority of + interactive to actually run at a lower priority than another thread + with a background, or even low, priority if the developer has modified + the maximum priority. + + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/archive.c gcc-2.95/libobjc/archive.c *** egcs-1.1.2/libobjc/archive.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/archive.c Fri Mar 26 15:44:04 1999 *************** *** 0 **** --- 1,1651 ---- + /* GNU Objective C Runtime archiving + 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. */ + + #include "tconfig.h" + #include "runtime.h" + #include "typedstream.h" + #include "encoding.h" + + #ifdef HAVE_STDLIB_H + #include + #endif + + extern int fflush(FILE*); + + #define ROUND(V, A) \ + ({ typeof(V) __v=(V); typeof(A) __a=(A); \ + __a*((__v+__a-1)/__a); }) + + #define PTR2LONG(P) (((char*)(P))-(char*)0) + #define LONG2PTR(L) (((char*)0)+(L)) + + /* Declare some functions... */ + + static int + objc_read_class (struct objc_typed_stream* stream, Class* class); + + int objc_sizeof_type(const char* type); + + static int + objc_write_use_common (struct objc_typed_stream* stream, unsigned long key); + + static int + objc_write_register_common (struct objc_typed_stream* stream, + unsigned long key); + + static int + objc_write_class (struct objc_typed_stream* stream, + struct objc_class* class); + + const char* objc_skip_type (const char* type); + + static void __objc_finish_write_root_object(struct objc_typed_stream*); + static void __objc_finish_read_root_object(struct objc_typed_stream*); + + static __inline__ int + __objc_code_unsigned_char (unsigned char* buf, unsigned char val) + { + if ((val&_B_VALUE) == val) + { + buf[0] = val|_B_SINT; + return 1; + } + else + { + buf[0] = _B_NINT|0x01; + buf[1] = val; + return 2; + } + } + + int + objc_write_unsigned_char (struct objc_typed_stream* stream, + unsigned char value) + { + unsigned char buf[sizeof (unsigned char)+1]; + int len = __objc_code_unsigned_char (buf, value); + return (*stream->write)(stream->physical, buf, len); + } + + static __inline__ int + __objc_code_char (unsigned char* buf, signed char val) + { + if (val >= 0) + return __objc_code_unsigned_char (buf, val); + else + { + buf[0] = _B_NINT|_B_SIGN|0x01; + buf[1] = -val; + return 2; + } + } + + int + objc_write_char (struct objc_typed_stream* stream, signed char value) + { + unsigned char buf[sizeof (char)+1]; + int len = __objc_code_char (buf, value); + return (*stream->write)(stream->physical, buf, len); + } + + static __inline__ int + __objc_code_unsigned_short (unsigned char* buf, unsigned short val) + { + if ((val&_B_VALUE) == val) + { + buf[0] = val|_B_SINT; + return 1; + } + else + { + int c, b; + + buf[0] = _B_NINT; + + for (c= sizeof(short); c != 0; c -= 1) + if (((val>>(8*(c-1)))%0x100) != 0) + break; + + buf[0] |= c; + + for (b = 1; c != 0; c--, b++) + { + buf[b] = (val >> (8*(c-1)))%0x100; + } + + return b; + } + } + + int + objc_write_unsigned_short (struct objc_typed_stream* stream, + unsigned short value) + { + unsigned char buf[sizeof (unsigned short)+1]; + int len = __objc_code_unsigned_short (buf, value); + return (*stream->write)(stream->physical, buf, len); + } + + static __inline__ int + __objc_code_short (unsigned char* buf, short val) + { + int sign = (val < 0); + int size = __objc_code_unsigned_short (buf, sign ? -val : val); + if (sign) + buf[0] |= _B_SIGN; + return size; + } + + int + objc_write_short (struct objc_typed_stream* stream, short value) + { + unsigned char buf[sizeof (short)+1]; + int len = __objc_code_short (buf, value); + return (*stream->write)(stream->physical, buf, len); + } + + + static __inline__ int + __objc_code_unsigned_int (unsigned char* buf, unsigned int val) + { + if ((val&_B_VALUE) == val) + { + buf[0] = val|_B_SINT; + return 1; + } + else + { + int c, b; + + buf[0] = _B_NINT; + + for (c= sizeof(int); c != 0; c -= 1) + if (((val>>(8*(c-1)))%0x100) != 0) + break; + + buf[0] |= c; + + for (b = 1; c != 0; c--, b++) + { + buf[b] = (val >> (8*(c-1)))%0x100; + } + + return b; + } + } + + int + objc_write_unsigned_int (struct objc_typed_stream* stream, unsigned int value) + { + unsigned char buf[sizeof(unsigned int)+1]; + int len = __objc_code_unsigned_int (buf, value); + return (*stream->write)(stream->physical, buf, len); + } + + static __inline__ int + __objc_code_int (unsigned char* buf, int val) + { + int sign = (val < 0); + int size = __objc_code_unsigned_int (buf, sign ? -val : val); + if (sign) + buf[0] |= _B_SIGN; + return size; + } + + int + objc_write_int (struct objc_typed_stream* stream, int value) + { + unsigned char buf[sizeof(int)+1]; + int len = __objc_code_int (buf, value); + return (*stream->write)(stream->physical, buf, len); + } + + static __inline__ int + __objc_code_unsigned_long (unsigned char* buf, unsigned long val) + { + if ((val&_B_VALUE) == val) + { + buf[0] = val|_B_SINT; + return 1; + } + else + { + int c, b; + + buf[0] = _B_NINT; + + for (c= sizeof(long); c != 0; c -= 1) + if (((val>>(8*(c-1)))%0x100) != 0) + break; + + buf[0] |= c; + + for (b = 1; c != 0; c--, b++) + { + buf[b] = (val >> (8*(c-1)))%0x100; + } + + return b; + } + } + + int + objc_write_unsigned_long (struct objc_typed_stream* stream, + unsigned long value) + { + unsigned char buf[sizeof(unsigned long)+1]; + int len = __objc_code_unsigned_long (buf, value); + return (*stream->write)(stream->physical, buf, len); + } + + static __inline__ int + __objc_code_long (unsigned char* buf, long val) + { + int sign = (val < 0); + int size = __objc_code_unsigned_long (buf, sign ? -val : val); + if (sign) + buf[0] |= _B_SIGN; + return size; + } + + int + objc_write_long (struct objc_typed_stream* stream, long value) + { + unsigned char buf[sizeof(long)+1]; + int len = __objc_code_long (buf, value); + return (*stream->write)(stream->physical, buf, len); + } + + + int + objc_write_string (struct objc_typed_stream* stream, + const unsigned char* string, unsigned int nbytes) + { + unsigned char buf[sizeof(unsigned int)+1]; + int len = __objc_code_unsigned_int (buf, nbytes); + + if ((buf[0]&_B_CODE) == _B_SINT) + buf[0] = (buf[0]&_B_VALUE)|_B_SSTR; + + else /* _B_NINT */ + buf[0] = (buf[0]&_B_VALUE)|_B_NSTR; + + if ((*stream->write)(stream->physical, buf, len) != 0) + return (*stream->write)(stream->physical, string, nbytes); + else + return 0; + } + + int + objc_write_string_atomic (struct objc_typed_stream* stream, + unsigned char* string, unsigned int nbytes) + { + unsigned long key; + if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, string)))) + return objc_write_use_common (stream, key); + else + { + int length; + hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(string)), string); + if ((length = objc_write_register_common (stream, key))) + return objc_write_string (stream, string, nbytes); + return length; + } + } + + static int + objc_write_register_common (struct objc_typed_stream* stream, + unsigned long key) + { + unsigned char buf[sizeof (unsigned long)+2]; + int len = __objc_code_unsigned_long (buf+1, key); + if (len == 1) + { + buf[0] = _B_RCOMM|0x01; + buf[1] &= _B_VALUE; + return (*stream->write)(stream->physical, buf, len+1); + } + else + { + buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM; + return (*stream->write)(stream->physical, buf+1, len); + } + } + + static int + objc_write_use_common (struct objc_typed_stream* stream, unsigned long key) + { + unsigned char buf[sizeof (unsigned long)+2]; + int len = __objc_code_unsigned_long (buf+1, key); + if (len == 1) + { + buf[0] = _B_UCOMM|0x01; + buf[1] &= _B_VALUE; + return (*stream->write)(stream->physical, buf, 2); + } + else + { + buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM; + return (*stream->write)(stream->physical, buf+1, len); + } + } + + static __inline__ int + __objc_write_extension (struct objc_typed_stream* stream, unsigned char code) + { + if (code <= _B_VALUE) + { + unsigned char buf = code|_B_EXT; + return (*stream->write)(stream->physical, &buf, 1); + } + else + { + objc_error(nil, OBJC_ERR_BAD_OPCODE, + "__objc_write_extension: bad opcode %c\n", code); + return -1; + } + } + + __inline__ int + __objc_write_object (struct objc_typed_stream* stream, id object) + { + unsigned char buf = '\0'; + SEL write_sel = sel_get_any_uid ("write:"); + if (object) + { + __objc_write_extension (stream, _BX_OBJECT); + objc_write_class (stream, object->class_pointer); + (*objc_msg_lookup(object, write_sel))(object, write_sel, stream); + return (*stream->write)(stream->physical, &buf, 1); + } + else + return objc_write_use_common(stream, 0); + } + + int + objc_write_object_reference (struct objc_typed_stream* stream, id object) + { + unsigned long key; + if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object)))) + return objc_write_use_common (stream, key); + + __objc_write_extension (stream, _BX_OBJREF); + return objc_write_unsigned_long (stream, PTR2LONG (object)); + } + + int + objc_write_root_object (struct objc_typed_stream* stream, id object) + { + int len = 0; + if (stream->writing_root_p) + objc_error (nil, OBJC_ERR_RECURSE_ROOT, + "objc_write_root_object called recursively"); + else + { + stream->writing_root_p = 1; + __objc_write_extension (stream, _BX_OBJROOT); + if((len = objc_write_object (stream, object))) + __objc_finish_write_root_object(stream); + stream->writing_root_p = 0; + } + return len; + } + + int + objc_write_object (struct objc_typed_stream* stream, id object) + { + unsigned long key; + if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object)))) + return objc_write_use_common (stream, key); + + else if (object == nil) + return objc_write_use_common(stream, 0); + + else + { + int length; + hash_add (&stream->object_table, LONG2PTR(key=PTR2LONG(object)), object); + if ((length = objc_write_register_common (stream, key))) + return __objc_write_object (stream, object); + return length; + } + } + + __inline__ int + __objc_write_class (struct objc_typed_stream* stream, struct objc_class* class) + { + __objc_write_extension (stream, _BX_CLASS); + objc_write_string_atomic(stream, (char*)class->name, + strlen((char*)class->name)); + return objc_write_unsigned_long (stream, class->version); + } + + + static int + objc_write_class (struct objc_typed_stream* stream, + struct objc_class* class) + { + unsigned long key; + if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, class)))) + return objc_write_use_common (stream, key); + else + { + int length; + hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(class)), class); + if ((length = objc_write_register_common (stream, key))) + return __objc_write_class (stream, class); + return length; + } + } + + + __inline__ int + __objc_write_selector (struct objc_typed_stream* stream, SEL selector) + { + const char* sel_name; + __objc_write_extension (stream, _BX_SEL); + /* to handle NULL selectors */ + if ((SEL)0 == selector) + return objc_write_string (stream, "", 0); + sel_name = sel_get_name (selector); + return objc_write_string (stream, sel_name, strlen ((char*)sel_name)); + } + + int + objc_write_selector (struct objc_typed_stream* stream, SEL selector) + { + const char* sel_name; + unsigned long key; + + /* to handle NULL selectors */ + if ((SEL)0 == selector) + return __objc_write_selector (stream, selector); + + sel_name = sel_get_name (selector); + if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, sel_name)))) + return objc_write_use_common (stream, key); + else + { + int length; + hash_add (&stream->stream_table, + LONG2PTR(key=PTR2LONG(sel_name)), (char*)sel_name); + if ((length = objc_write_register_common (stream, key))) + return __objc_write_selector (stream, selector); + return length; + } + } + + + + /* + ** Read operations + */ + + __inline__ int + objc_read_char (struct objc_typed_stream* stream, char* val) + { + unsigned char buf; + int len; + len = (*stream->read)(stream->physical, &buf, 1); + if (len != 0) + { + if ((buf & _B_CODE) == _B_SINT) + (*val) = (buf & _B_VALUE); + + else if ((buf & _B_NUMBER) == 1) + { + len = (*stream->read)(stream->physical, val, 1); + if (buf&_B_SIGN) + (*val) = -1*(*val); + } + + else + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected 8bit signed int, got %dbit int", + (int)(buf&_B_NUMBER)*8); + } + return len; + } + + + __inline__ int + objc_read_unsigned_char (struct objc_typed_stream* stream, unsigned char* val) + { + unsigned char buf; + int len; + if ((len = (*stream->read)(stream->physical, &buf, 1))) + { + if ((buf & _B_CODE) == _B_SINT) + (*val) = (buf & _B_VALUE); + + else if ((buf & _B_NUMBER) == 1) + len = (*stream->read)(stream->physical, val, 1); + + else + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected 8bit unsigned int, got %dbit int", + (int)(buf&_B_NUMBER)*8); + } + return len; + } + + __inline__ int + objc_read_short (struct objc_typed_stream* stream, short* value) + { + unsigned char buf[sizeof(short)+1]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + if ((buf[0] & _B_CODE) == _B_SINT) + (*value) = (buf[0] & _B_VALUE); + + else + { + int pos = 1; + int nbytes = buf[0] & _B_NUMBER; + if (nbytes > sizeof (short)) + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected short, got bigger (%dbits)", nbytes*8); + len = (*stream->read)(stream->physical, buf+1, nbytes); + (*value) = 0; + while (pos <= nbytes) + (*value) = ((*value)*0x100) + buf[pos++]; + if (buf[0] & _B_SIGN) + (*value) = -(*value); + } + } + return len; + } + + __inline__ int + objc_read_unsigned_short (struct objc_typed_stream* stream, + unsigned short* value) + { + unsigned char buf[sizeof(unsigned short)+1]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + if ((buf[0] & _B_CODE) == _B_SINT) + (*value) = (buf[0] & _B_VALUE); + + else + { + int pos = 1; + int nbytes = buf[0] & _B_NUMBER; + if (nbytes > sizeof (short)) + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected short, got int or bigger"); + len = (*stream->read)(stream->physical, buf+1, nbytes); + (*value) = 0; + while (pos <= nbytes) + (*value) = ((*value)*0x100) + buf[pos++]; + } + } + return len; + } + + + __inline__ int + objc_read_int (struct objc_typed_stream* stream, int* value) + { + unsigned char buf[sizeof(int)+1]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + if ((buf[0] & _B_CODE) == _B_SINT) + (*value) = (buf[0] & _B_VALUE); + + else + { + int pos = 1; + int nbytes = buf[0] & _B_NUMBER; + if (nbytes > sizeof (int)) + objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger"); + len = (*stream->read)(stream->physical, buf+1, nbytes); + (*value) = 0; + while (pos <= nbytes) + (*value) = ((*value)*0x100) + buf[pos++]; + if (buf[0] & _B_SIGN) + (*value) = -(*value); + } + } + return len; + } + + __inline__ int + objc_read_long (struct objc_typed_stream* stream, long* value) + { + unsigned char buf[sizeof(long)+1]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + if ((buf[0] & _B_CODE) == _B_SINT) + (*value) = (buf[0] & _B_VALUE); + + else + { + int pos = 1; + int nbytes = buf[0] & _B_NUMBER; + if (nbytes > sizeof (long)) + objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger"); + len = (*stream->read)(stream->physical, buf+1, nbytes); + (*value) = 0; + while (pos <= nbytes) + (*value) = ((*value)*0x100) + buf[pos++]; + if (buf[0] & _B_SIGN) + (*value) = -(*value); + } + } + return len; + } + + __inline__ int + __objc_read_nbyte_uint (struct objc_typed_stream* stream, + unsigned int nbytes, unsigned int* val) + { + int len, pos = 0; + unsigned char buf[sizeof(unsigned int)+1]; + + if (nbytes > sizeof (int)) + objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger"); + + len = (*stream->read)(stream->physical, buf, nbytes); + (*val) = 0; + while (pos < nbytes) + (*val) = ((*val)*0x100) + buf[pos++]; + return len; + } + + + __inline__ int + objc_read_unsigned_int (struct objc_typed_stream* stream, + unsigned int* value) + { + unsigned char buf[sizeof(unsigned int)+1]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + if ((buf[0] & _B_CODE) == _B_SINT) + (*value) = (buf[0] & _B_VALUE); + + else + len = __objc_read_nbyte_uint (stream, (buf[0] & _B_VALUE), value); + + } + return len; + } + + int + __objc_read_nbyte_ulong (struct objc_typed_stream* stream, + unsigned int nbytes, unsigned long* val) + { + int len, pos = 0; + unsigned char buf[sizeof(unsigned long)+1]; + + if (nbytes > sizeof (long)) + objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger"); + + len = (*stream->read)(stream->physical, buf, nbytes); + (*val) = 0; + while (pos < nbytes) + (*val) = ((*val)*0x100) + buf[pos++]; + return len; + } + + + __inline__ int + objc_read_unsigned_long (struct objc_typed_stream* stream, + unsigned long* value) + { + unsigned char buf[sizeof(unsigned long)+1]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + if ((buf[0] & _B_CODE) == _B_SINT) + (*value) = (buf[0] & _B_VALUE); + + else + len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), value); + + } + return len; + } + + __inline__ int + objc_read_string (struct objc_typed_stream* stream, + char** string) + { + unsigned char buf[sizeof(unsigned int)+1]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + unsigned long key = 0; + + if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ + { + len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); + len = (*stream->read)(stream->physical, buf, 1); + } + + switch (buf[0]&_B_CODE) { + case _B_SSTR: + { + int length = buf[0]&_B_VALUE; + (*string) = (char*)objc_malloc(length+1); + if (key) + hash_add (&stream->stream_table, LONG2PTR(key), *string); + len = (*stream->read)(stream->physical, *string, length); + (*string)[length] = '\0'; + } + break; + + case _B_UCOMM: + { + char *tmp; + len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); + tmp = hash_value_for_key (stream->stream_table, LONG2PTR (key)); + *string = objc_malloc (strlen(tmp) + 1); + strcpy (*string, tmp); + } + break; + + case _B_NSTR: + { + unsigned int nbytes = buf[0]&_B_VALUE; + len = __objc_read_nbyte_uint(stream, nbytes, &nbytes); + if (len) { + (*string) = (char*)objc_malloc(nbytes+1); + if (key) + hash_add (&stream->stream_table, LONG2PTR(key), *string); + len = (*stream->read)(stream->physical, *string, nbytes); + (*string)[nbytes] = '\0'; + } + } + break; + + default: + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected string, got opcode %c\n", (buf[0]&_B_CODE)); + } + } + + return len; + } + + + int + objc_read_object (struct objc_typed_stream* stream, id* object) + { + unsigned char buf[sizeof (unsigned int)]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + SEL read_sel = sel_get_any_uid ("read:"); + unsigned long key = 0; + + if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */ + { + len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); + len = (*stream->read)(stream->physical, buf, 1); + } + + if (buf[0] == (_B_EXT | _BX_OBJECT)) + { + Class class; + + /* get class */ + len = objc_read_class (stream, &class); + + /* create instance */ + (*object) = class_create_instance(class); + + /* register? */ + if (key) + hash_add (&stream->object_table, LONG2PTR(key), *object); + + /* send -read: */ + if (__objc_responds_to (*object, read_sel)) + (*get_imp(class, read_sel))(*object, read_sel, stream); + + /* check null-byte */ + len = (*stream->read)(stream->physical, buf, 1); + if (buf[0] != '\0') + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected null-byte, got opcode %c", buf[0]); + } + + else if ((buf[0]&_B_CODE) == _B_UCOMM) + { + if (key) + objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); + len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); + (*object) = hash_value_for_key (stream->object_table, LONG2PTR(key)); + } + + else if (buf[0] == (_B_EXT | _BX_OBJREF)) /* a forward reference */ + { + struct objc_list* other; + len = objc_read_unsigned_long (stream, &key); + other = (struct objc_list*)hash_value_for_key (stream->object_refs, + LONG2PTR(key)); + hash_add (&stream->object_refs, LONG2PTR(key), + (void*)list_cons(object, other)); + } + + else if (buf[0] == (_B_EXT | _BX_OBJROOT)) /* a root object */ + { + if (key) + objc_error(nil, OBJC_ERR_BAD_KEY, + "cannot register root object..."); + len = objc_read_object (stream, object); + __objc_finish_read_root_object (stream); + } + + else + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected object, got opcode %c", buf[0]); + } + return len; + } + + static int + objc_read_class (struct objc_typed_stream* stream, Class* class) + { + unsigned char buf[sizeof (unsigned int)]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + unsigned long key = 0; + + if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ + { + len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); + len = (*stream->read)(stream->physical, buf, 1); + } + + if (buf[0] == (_B_EXT | _BX_CLASS)) + { + char* class_name; + unsigned long version; + + /* get class */ + len = objc_read_string (stream, &class_name); + (*class) = objc_get_class(class_name); + objc_free(class_name); + + /* register */ + if (key) + hash_add (&stream->stream_table, LONG2PTR(key), *class); + + objc_read_unsigned_long(stream, &version); + hash_add (&stream->class_table, (*class)->name, (void*)version); + } + + else if ((buf[0]&_B_CODE) == _B_UCOMM) + { + if (key) + objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); + len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); + (*class) = hash_value_for_key (stream->stream_table, LONG2PTR(key)); + if (!*class) + objc_error(nil, OBJC_ERR_BAD_CLASS, + "cannot find class for key %lu", key); + } + + else + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected class, got opcode %c", buf[0]); + } + return len; + } + + int + objc_read_selector (struct objc_typed_stream* stream, SEL* selector) + { + unsigned char buf[sizeof (unsigned int)]; + int len; + if ((len = (*stream->read)(stream->physical, buf, 1))) + { + unsigned long key = 0; + + if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */ + { + len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); + len = (*stream->read)(stream->physical, buf, 1); + } + + if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */ + { + char* selector_name; + + /* get selector */ + len = objc_read_string (stream, &selector_name); + /* To handle NULL selectors */ + if (0 == strlen(selector_name)) + { + (*selector) = (SEL)0; + return 0; + } + else + (*selector) = sel_get_any_uid(selector_name); + objc_free(selector_name); + + /* register */ + if (key) + hash_add (&stream->stream_table, LONG2PTR(key), (void*)*selector); + } + + else if ((buf[0]&_B_CODE) == _B_UCOMM) + { + if (key) + objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode..."); + len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key); + (*selector) = hash_value_for_key (stream->stream_table, + LONG2PTR(key)); + } + + else + objc_error(nil, OBJC_ERR_BAD_DATA, + "expected selector, got opcode %c", buf[0]); + } + return len; + } + + /* + ** USER LEVEL FUNCTIONS + */ + + /* + ** Write one object, encoded in TYPE and pointed to by DATA to the + ** typed stream STREAM. + */ + + int + objc_write_type(TypedStream* stream, const char* type, const void* data) + { + switch(*type) { + case _C_ID: + return objc_write_object (stream, *(id*)data); + break; + + case _C_CLASS: + return objc_write_class (stream, *(Class*)data); + break; + + case _C_SEL: + return objc_write_selector (stream, *(SEL*)data); + break; + + case _C_CHR: + return objc_write_char(stream, *(signed char*)data); + break; + + case _C_UCHR: + return objc_write_unsigned_char(stream, *(unsigned char*)data); + break; + + case _C_SHT: + return objc_write_short(stream, *(short*)data); + break; + + case _C_USHT: + return objc_write_unsigned_short(stream, *(unsigned short*)data); + break; + + case _C_INT: + return objc_write_int(stream, *(int*)data); + break; + + case _C_UINT: + return objc_write_unsigned_int(stream, *(unsigned int*)data); + break; + + case _C_LNG: + return objc_write_long(stream, *(long*)data); + break; + + case _C_ULNG: + return objc_write_unsigned_long(stream, *(unsigned long*)data); + break; + + case _C_CHARPTR: + return objc_write_string (stream, *(char**)data, strlen(*(char**)data)); + break; + + case _C_ATOM: + return objc_write_string_atomic (stream, *(char**)data, + strlen(*(char**)data)); + break; + + case _C_ARY_B: + { + int len = atoi(type+1); + while (isdigit(*++type)) + ; + return objc_write_array (stream, type, len, data); + } + break; + + case _C_STRUCT_B: + { + int acc_size = 0; + int align; + while (*type != _C_STRUCT_E && *type++ != '=') + ; /* skip "=" */ + while (*type != _C_STRUCT_E) + { + align = objc_alignof_type (type); /* padd to alignment */ + acc_size += ROUND (acc_size, align); + objc_write_type (stream, type, ((char*)data)+acc_size); + acc_size += objc_sizeof_type (type); /* add component size */ + type = objc_skip_typespec (type); /* skip component */ + } + return 1; + } + + default: + { + objc_error(nil, OBJC_ERR_BAD_TYPE, + "objc_write_type: cannot parse typespec: %s\n", type); + return 0; + } + } + } + + /* + ** Read one object, encoded in TYPE and pointed to by DATA to the + ** typed stream STREAM. DATA specifies the address of the types to + ** read. Expected type is checked against the type actually present + ** on the stream. + */ + + int + objc_read_type(TypedStream* stream, const char* type, void* data) + { + char c; + switch(c = *type) { + case _C_ID: + return objc_read_object (stream, (id*)data); + break; + + case _C_CLASS: + return objc_read_class (stream, (Class*)data); + break; + + case _C_SEL: + return objc_read_selector (stream, (SEL*)data); + break; + + case _C_CHR: + return objc_read_char (stream, (char*)data); + break; + + case _C_UCHR: + return objc_read_unsigned_char (stream, (unsigned char*)data); + break; + + case _C_SHT: + return objc_read_short (stream, (short*)data); + break; + + case _C_USHT: + return objc_read_unsigned_short (stream, (unsigned short*)data); + break; + + case _C_INT: + return objc_read_int (stream, (int*)data); + break; + + case _C_UINT: + return objc_read_unsigned_int (stream, (unsigned int*)data); + break; + + case _C_LNG: + return objc_read_long (stream, (long*)data); + break; + + case _C_ULNG: + return objc_read_unsigned_long (stream, (unsigned long*)data); + break; + + case _C_CHARPTR: + case _C_ATOM: + return objc_read_string (stream, (char**)data); + break; + + case _C_ARY_B: + { + int len = atoi(type+1); + while (isdigit(*++type)) + ; + return objc_read_array (stream, type, len, data); + } + break; + + case _C_STRUCT_B: + { + int acc_size = 0; + int align; + while (*type != _C_STRUCT_E && *type++ != '=') + ; /* skip "=" */ + while (*type != _C_STRUCT_E) + { + align = objc_alignof_type (type); /* padd to alignment */ + acc_size += ROUND (acc_size, align); + objc_read_type (stream, type, ((char*)data)+acc_size); + acc_size += objc_sizeof_type (type); /* add component size */ + type = objc_skip_typespec (type); /* skip component */ + } + return 1; + } + + default: + { + objc_error(nil, OBJC_ERR_BAD_TYPE, + "objc_read_type: cannot parse typespec: %s\n", type); + return 0; + } + } + } + + /* + ** Write the object specified by the template TYPE to STREAM. Last + ** arguments specify addresses of values to be written. It might + ** seem surprising to specify values by address, but this is extremely + ** convenient for copy-paste with objc_read_types calls. A more + ** down-to-the-earth cause for this passing of addresses is that values + ** of arbitrary size is not well supported in ANSI C for functions with + ** variable number of arguments. + */ + + int + objc_write_types (TypedStream* stream, const char* type, ...) + { + va_list args; + const char *c; + int res = 0; + + va_start(args, type); + + for (c = type; *c; c = objc_skip_typespec (c)) + { + switch(*c) { + case _C_ID: + res = objc_write_object (stream, *va_arg (args, id*)); + break; + + case _C_CLASS: + res = objc_write_class (stream, *va_arg(args, Class*)); + break; + + case _C_SEL: + res = objc_write_selector (stream, *va_arg(args, SEL*)); + break; + + case _C_CHR: + res = objc_write_char (stream, *va_arg (args, char*)); + break; + + case _C_UCHR: + res = objc_write_unsigned_char (stream, + *va_arg (args, unsigned char*)); + break; + + case _C_SHT: + res = objc_write_short (stream, *va_arg(args, short*)); + break; + + case _C_USHT: + res = objc_write_unsigned_short (stream, + *va_arg(args, unsigned short*)); + break; + + case _C_INT: + res = objc_write_int(stream, *va_arg(args, int*)); + break; + + case _C_UINT: + res = objc_write_unsigned_int(stream, *va_arg(args, unsigned int*)); + break; + + case _C_LNG: + res = objc_write_long(stream, *va_arg(args, long*)); + break; + + case _C_ULNG: + res = objc_write_unsigned_long(stream, *va_arg(args, unsigned long*)); + break; + + case _C_CHARPTR: + { + char** str = va_arg(args, char**); + res = objc_write_string (stream, *str, strlen(*str)); + } + break; + + case _C_ATOM: + { + char** str = va_arg(args, char**); + res = objc_write_string_atomic (stream, *str, strlen(*str)); + } + break; + + case _C_ARY_B: + { + int len = atoi(c+1); + const char* t = c; + while (isdigit(*++t)) + ; + res = objc_write_array (stream, t, len, va_arg(args, void*)); + t = objc_skip_typespec (t); + if (*t != _C_ARY_E) + objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t); + } + break; + + default: + objc_error(nil, OBJC_ERR_BAD_TYPE, + "objc_write_types: cannot parse typespec: %s\n", type); + } + } + va_end(args); + return res; + } + + + /* + ** Last arguments specify addresses of values to be read. Expected + ** type is checked against the type actually present on the stream. + */ + + int + objc_read_types(TypedStream* stream, const char* type, ...) + { + va_list args; + const char *c; + int res = 0; + + va_start(args, type); + + for (c = type; *c; c = objc_skip_typespec(c)) + { + switch(*c) { + case _C_ID: + res = objc_read_object(stream, va_arg(args, id*)); + break; + + case _C_CLASS: + res = objc_read_class(stream, va_arg(args, Class*)); + break; + + case _C_SEL: + res = objc_read_selector(stream, va_arg(args, SEL*)); + break; + + case _C_CHR: + res = objc_read_char(stream, va_arg(args, char*)); + break; + + case _C_UCHR: + res = objc_read_unsigned_char(stream, va_arg(args, unsigned char*)); + break; + + case _C_SHT: + res = objc_read_short(stream, va_arg(args, short*)); + break; + + case _C_USHT: + res = objc_read_unsigned_short(stream, va_arg(args, unsigned short*)); + break; + + case _C_INT: + res = objc_read_int(stream, va_arg(args, int*)); + break; + + case _C_UINT: + res = objc_read_unsigned_int(stream, va_arg(args, unsigned int*)); + break; + + case _C_LNG: + res = objc_read_long(stream, va_arg(args, long*)); + break; + + case _C_ULNG: + res = objc_read_unsigned_long(stream, va_arg(args, unsigned long*)); + break; + + case _C_CHARPTR: + case _C_ATOM: + { + char** str = va_arg(args, char**); + res = objc_read_string (stream, str); + } + break; + + case _C_ARY_B: + { + int len = atoi(c+1); + const char* t = c; + while (isdigit(*++t)) + ; + res = objc_read_array (stream, t, len, va_arg(args, void*)); + t = objc_skip_typespec (t); + if (*t != _C_ARY_E) + objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t); + } + break; + + default: + objc_error(nil, OBJC_ERR_BAD_TYPE, + "objc_read_types: cannot parse typespec: %s\n", type); + } + } + va_end(args); + return res; + } + + /* + ** Write an array of COUNT elements of TYPE from the memory address DATA. + ** This is equivalent of objc_write_type (stream, "[N]", data) + */ + + int + objc_write_array (TypedStream* stream, const char* type, + int count, const void* data) + { + int off = objc_sizeof_type(type); + const char* where = data; + + while (count-- > 0) + { + objc_write_type(stream, type, where); + where += off; + } + return 1; + } + + /* + ** Read an array of COUNT elements of TYPE into the memory address + ** DATA. The memory pointed to by data is supposed to be allocated + ** by the callee. This is equivalent of + ** objc_read_type (stream, "[N]", data) + */ + + int + objc_read_array (TypedStream* stream, const char* type, + int count, void* data) + { + int off = objc_sizeof_type(type); + char* where = (char*)data; + + while (count-- > 0) + { + objc_read_type(stream, type, where); + where += off; + } + return 1; + } + + static int + __objc_fread(FILE* file, char* data, int len) + { + return fread(data, len, 1, file); + } + + static int + __objc_fwrite(FILE* file, char* data, int len) + { + return fwrite(data, len, 1, file); + } + + static int + __objc_feof(FILE* file) + { + return feof(file); + } + + static int + __objc_no_write(FILE* file, char* data, int len) + { + objc_error (nil, OBJC_ERR_NO_WRITE, "TypedStream not open for writing"); + return 0; + } + + static int + __objc_no_read(FILE* file, char* data, int len) + { + objc_error (nil, OBJC_ERR_NO_READ, "TypedStream not open for reading"); + return 0; + } + + static int + __objc_read_typed_stream_signature (TypedStream* stream) + { + char buffer[80]; + int pos = 0; + do + (*stream->read)(stream->physical, buffer+pos, 1); + while (buffer[pos++] != '\0') + ; + sscanf (buffer, "GNU TypedStream %d", &stream->version); + if (stream->version != OBJC_TYPED_STREAM_VERSION) + objc_error (nil, OBJC_ERR_STREAM_VERSION, + "cannot handle TypedStream version %d", stream->version); + return 1; + } + + static int + __objc_write_typed_stream_signature (TypedStream* stream) + { + char buffer[80]; + sprintf(buffer, "GNU TypedStream %d", OBJC_TYPED_STREAM_VERSION); + stream->version = OBJC_TYPED_STREAM_VERSION; + (*stream->write)(stream->physical, buffer, strlen(buffer)+1); + return 1; + } + + static void __objc_finish_write_root_object(struct objc_typed_stream* stream) + { + hash_delete (stream->object_table); + stream->object_table = hash_new(64, + (hash_func_type)hash_ptr, + (compare_func_type)compare_ptrs); + } + + static void __objc_finish_read_root_object(struct objc_typed_stream* stream) + { + node_ptr node; + SEL awake_sel = sel_get_any_uid ("awake"); + cache_ptr free_list = hash_new (64, + (hash_func_type) hash_ptr, + (compare_func_type) compare_ptrs); + + /* resolve object forward references */ + for (node = hash_next (stream->object_refs, NULL); node; + node = hash_next (stream->object_refs, node)) + { + struct objc_list* reflist = node->value; + const void* key = node->key; + id object = hash_value_for_key (stream->object_table, key); + while(reflist) + { + *((id*)reflist->head) = object; + if (hash_value_for_key (free_list,reflist) == NULL) + hash_add (&free_list,reflist,reflist); + + reflist = reflist->tail; + } + } + + /* apply __objc_free to all objects stored in free_list */ + for (node = hash_next (free_list, NULL); node; + node = hash_next (free_list, node)) + objc_free ((void *) node->key); + + hash_delete (free_list); + + /* empty object reference table */ + hash_delete (stream->object_refs); + stream->object_refs = hash_new(8, (hash_func_type)hash_ptr, + (compare_func_type)compare_ptrs); + + /* call -awake for all objects read */ + if (awake_sel) + { + for (node = hash_next (stream->object_table, NULL); node; + node = hash_next (stream->object_table, node)) + { + id object = node->value; + if (__objc_responds_to (object, awake_sel)) + (*objc_msg_lookup(object, awake_sel))(object, awake_sel); + } + } + + /* empty object table */ + hash_delete (stream->object_table); + stream->object_table = hash_new(64, + (hash_func_type)hash_ptr, + (compare_func_type)compare_ptrs); + } + + /* + ** Open the stream PHYSICAL in MODE + */ + + TypedStream* + objc_open_typed_stream (FILE* physical, int mode) + { + TypedStream* s = (TypedStream*)objc_malloc(sizeof(TypedStream)); + + s->mode = mode; + s->physical = physical; + s->stream_table = hash_new(64, + (hash_func_type)hash_ptr, + (compare_func_type)compare_ptrs); + s->object_table = hash_new(64, + (hash_func_type)hash_ptr, + (compare_func_type)compare_ptrs); + s->eof = (objc_typed_eof_func)__objc_feof; + s->flush = (objc_typed_flush_func)fflush; + s->writing_root_p = 0; + if (mode == OBJC_READONLY) + { + s->class_table = hash_new(8, (hash_func_type)hash_string, + (compare_func_type)compare_strings); + s->object_refs = hash_new(8, (hash_func_type)hash_ptr, + (compare_func_type)compare_ptrs); + s->read = (objc_typed_read_func)__objc_fread; + s->write = (objc_typed_write_func)__objc_no_write; + __objc_read_typed_stream_signature (s); + } + else if (mode == OBJC_WRITEONLY) + { + s->class_table = 0; + s->object_refs = 0; + s->read = (objc_typed_read_func)__objc_no_read; + s->write = (objc_typed_write_func)__objc_fwrite; + __objc_write_typed_stream_signature (s); + } + else + { + objc_close_typed_stream (s); + return NULL; + } + s->type = OBJC_FILE_STREAM; + return s; + } + + /* + ** Open the file named by FILE_NAME in MODE + */ + + TypedStream* + objc_open_typed_stream_for_file (const char* file_name, int mode) + { + FILE* file = NULL; + TypedStream* s; + + if (mode == OBJC_READONLY) + file = fopen (file_name, "r"); + else + file = fopen (file_name, "w"); + + if (file) + { + s = objc_open_typed_stream (file, mode); + if (s) + s->type |= OBJC_MANAGED_STREAM; + return s; + } + else + return NULL; + } + + /* + ** Close STREAM freeing the structure it self. If it was opened with + ** objc_open_typed_stream_for_file, the file will also be closed. + */ + + void + objc_close_typed_stream (TypedStream* stream) + { + if (stream->mode == OBJC_READONLY) + { + __objc_finish_read_root_object (stream); /* Just in case... */ + hash_delete (stream->class_table); + hash_delete (stream->object_refs); + } + + hash_delete (stream->stream_table); + hash_delete (stream->object_table); + + if (stream->type == (OBJC_MANAGED_STREAM | OBJC_FILE_STREAM)) + fclose ((FILE*)stream->physical); + + objc_free(stream); + } + + BOOL + objc_end_of_typed_stream (TypedStream* stream) + { + return (*stream->eof)(stream->physical); + } + + void + objc_flush_typed_stream (TypedStream* stream) + { + (*stream->flush)(stream->physical); + } + + long + objc_get_stream_class_version (TypedStream* stream, Class class) + { + if (stream->class_table) + return PTR2LONG(hash_value_for_key (stream->class_table, class->name)); + else + return class_get_version (class); + } + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/class.c gcc-2.95/libobjc/class.c *** egcs-1.1.2/libobjc/class.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/class.c Sun Sep 20 18:22:06 1998 *************** *** 0 **** --- 1,358 ---- + /* GNU Objective C Runtime class related functions + Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + Contributed by Kresten Krab Thorup and Dennis Glatting. + + 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. */ + + #include "runtime.h" /* the kitchen sink */ + #include "sarray.h" + + /* The table of classname->class. Used for objc_lookup_class and friends */ + static cache_ptr __objc_class_hash = 0; /* !T:MUTEX */ + + /* This is a hook which is called by objc_get_class and + objc_lookup_class if the runtime is not able to find the class. + This may e.g. try to load in the class using dynamic loading */ + Class (*_objc_lookup_class)(const char* name) = 0; /* !T:SAFE */ + + + /* True when class links has been resolved */ + BOOL __objc_class_links_resolved = NO; /* !T:UNUSED */ + + + /* Initial number of buckets size of class hash table. */ + #define CLASS_HASH_SIZE 32 + + void __objc_init_class_tables() + { + /* Allocate the class hash table */ + + if(__objc_class_hash) + return; + + objc_mutex_lock(__objc_runtime_mutex); + + __objc_class_hash + = hash_new (CLASS_HASH_SIZE, + (hash_func_type) hash_string, + (compare_func_type) compare_strings); + + objc_mutex_unlock(__objc_runtime_mutex); + } + + /* This function adds a class to the class hash table, and assigns the + class a number, unless it's already known */ + void + __objc_add_class_to_hash(Class class) + { + Class h_class; + + objc_mutex_lock(__objc_runtime_mutex); + + /* make sure the table is there */ + assert(__objc_class_hash); + + /* make sure it's not a meta class */ + assert(CLS_ISCLASS(class)); + + /* Check to see if the class is already in the hash table. */ + h_class = hash_value_for_key (__objc_class_hash, class->name); + if (!h_class) + { + /* The class isn't in the hash table. Add the class and assign a class + number. */ + static unsigned int class_number = 1; + + CLS_SETNUMBER(class, class_number); + CLS_SETNUMBER(class->class_pointer, class_number); + + ++class_number; + hash_add (&__objc_class_hash, class->name, class); + } + + objc_mutex_unlock(__objc_runtime_mutex); + } + + /* Get the class object for the class named NAME. If NAME does not + identify a known class, the hook _objc_lookup_class is called. If + this fails, nil is returned */ + Class objc_lookup_class (const char* name) + { + Class class; + + objc_mutex_lock(__objc_runtime_mutex); + + /* Make sure the class hash table exists. */ + assert (__objc_class_hash); + + class = hash_value_for_key (__objc_class_hash, name); + + objc_mutex_unlock(__objc_runtime_mutex); + + if (class) + return class; + + if (_objc_lookup_class) + return (*_objc_lookup_class)(name); + else + return 0; + } + + /* Get the class object for the class named NAME. If NAME does not + identify a known class, the hook _objc_lookup_class is called. If + this fails, an error message is issued and the system aborts */ + Class + objc_get_class (const char *name) + { + Class class; + + objc_mutex_lock(__objc_runtime_mutex); + + /* Make sure the class hash table exists. */ + assert (__objc_class_hash); + + class = hash_value_for_key (__objc_class_hash, name); + + objc_mutex_unlock(__objc_runtime_mutex); + + if (class) + return class; + + if (_objc_lookup_class) + class = (*_objc_lookup_class)(name); + + if(class) + return class; + + objc_error(nil, OBJC_ERR_BAD_CLASS, + "objc runtime: cannot find class %s\n", name); + return 0; + } + + MetaClass + objc_get_meta_class(const char *name) + { + return objc_get_class(name)->class_pointer; + } + + /* This function provides a way to enumerate all the classes in the + executable. Pass *ENUM_STATE == NULL to start the enumeration. The + function will return 0 when there are no more classes. + For example: + id class; + void *es = NULL; + while ((class = objc_next_class(&es))) + ... do something with class; + */ + Class + objc_next_class(void **enum_state) + { + objc_mutex_lock(__objc_runtime_mutex); + + /* make sure the table is there */ + assert(__objc_class_hash); + + *(node_ptr*)enum_state = + hash_next(__objc_class_hash, *(node_ptr*)enum_state); + + objc_mutex_unlock(__objc_runtime_mutex); + + if (*(node_ptr*)enum_state) + return (*(node_ptr*)enum_state)->value; + return (Class)0; + } + + /* Resolve super/subclass links for all classes. The only thing we + can be sure of is that the class_pointer for class objects point + to the right meta class objects */ + void __objc_resolve_class_links() + { + node_ptr node; + Class object_class = objc_get_class ("Object"); + + assert(object_class); + + objc_mutex_lock(__objc_runtime_mutex); + + /* Assign subclass links */ + for (node = hash_next (__objc_class_hash, NULL); node; + node = hash_next (__objc_class_hash, node)) + { + Class class1 = node->value; + + /* Make sure we have what we think we have. */ + assert (CLS_ISCLASS(class1)); + assert (CLS_ISMETA(class1->class_pointer)); + + /* The class_pointer of all meta classes point to Object's meta class. */ + class1->class_pointer->class_pointer = object_class->class_pointer; + + if (!(CLS_ISRESOLV(class1))) + { + CLS_SETRESOLV(class1); + CLS_SETRESOLV(class1->class_pointer); + + if(class1->super_class) + { + Class a_super_class + = objc_get_class ((char *) class1->super_class); + + assert (a_super_class); + + DEBUG_PRINTF ("making class connections for: %s\n", + class1->name); + + /* assign subclass links for superclass */ + class1->sibling_class = a_super_class->subclass_list; + a_super_class->subclass_list = class1; + + /* Assign subclass links for meta class of superclass */ + if (a_super_class->class_pointer) + { + class1->class_pointer->sibling_class + = a_super_class->class_pointer->subclass_list; + a_super_class->class_pointer->subclass_list + = class1->class_pointer; + } + } + else /* a root class, make its meta object */ + /* be a subclass of Object */ + { + class1->class_pointer->sibling_class + = object_class->subclass_list; + object_class->subclass_list = class1->class_pointer; + } + } + } + + /* Assign superclass links */ + for (node = hash_next (__objc_class_hash, NULL); node; + node = hash_next (__objc_class_hash, node)) + { + Class class1 = node->value; + Class sub_class; + for (sub_class = class1->subclass_list; sub_class; + sub_class = sub_class->sibling_class) + { + sub_class->super_class = class1; + if(CLS_ISCLASS(sub_class)) + sub_class->class_pointer->super_class = class1->class_pointer; + } + } + + objc_mutex_unlock(__objc_runtime_mutex); + } + + + + #define CLASSOF(c) ((c)->class_pointer) + + Class + class_pose_as (Class impostor, Class super_class) + { + node_ptr node; + Class class1; + + if (!CLS_ISRESOLV (impostor)) + __objc_resolve_class_links (); + + /* preconditions */ + assert (impostor); + assert (super_class); + assert (impostor->super_class == super_class); + assert (CLS_ISCLASS (impostor)); + assert (CLS_ISCLASS (super_class)); + assert (impostor->instance_size == super_class->instance_size); + + { + Class *subclass = &(super_class->subclass_list); + + /* move subclasses of super_class to impostor */ + while (*subclass) + { + Class nextSub = (*subclass)->sibling_class; + + if (*subclass != impostor) + { + Class sub = *subclass; + + /* classes */ + sub->sibling_class = impostor->subclass_list; + sub->super_class = impostor; + impostor->subclass_list = sub; + + /* It will happen that SUB is not a class object if it is + the top of the meta class hierarchy chain. (root + meta-class objects inherit their class object) If that is + the case... don't mess with the meta-meta class. */ + if (CLS_ISCLASS (sub)) + { + /* meta classes */ + CLASSOF (sub)->sibling_class = + CLASSOF (impostor)->subclass_list; + CLASSOF (sub)->super_class = CLASSOF (impostor); + CLASSOF (impostor)->subclass_list = CLASSOF (sub); + } + } + + *subclass = nextSub; + } + + /* set subclasses of superclass to be impostor only */ + super_class->subclass_list = impostor; + CLASSOF (super_class)->subclass_list = CLASSOF (impostor); + + /* set impostor to have no sibling classes */ + impostor->sibling_class = 0; + CLASSOF (impostor)->sibling_class = 0; + } + + /* check relationship of impostor and super_class is kept. */ + assert (impostor->super_class == super_class); + assert (CLASSOF (impostor)->super_class == CLASSOF (super_class)); + + /* This is how to update the lookup table. Regardless of + what the keys of the hashtable is, change all values that are + superclass into impostor. */ + + objc_mutex_lock(__objc_runtime_mutex); + + for (node = hash_next (__objc_class_hash, NULL); node; + node = hash_next (__objc_class_hash, node)) + { + class1 = (Class)node->value; + if (class1 == super_class) + { + node->value = impostor; /* change hash table value */ + } + } + + objc_mutex_unlock(__objc_runtime_mutex); + + /* next, we update the dispatch tables... */ + __objc_update_dispatch_table_for_class (CLASSOF (impostor)); + __objc_update_dispatch_table_for_class (impostor); + + return impostor; + } + + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/configure gcc-2.95/libobjc/configure *** egcs-1.1.2/libobjc/configure Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/configure Thu Jul 29 05:46:14 1999 *************** *** 0 **** --- 1,1459 ---- + #! /bin/sh + + # Guess values for system-dependent variables and create Makefiles. + # Generated automatically using autoconf version 2.13 + # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. + # + # This configure script is free software; the Free Software Foundation + # gives unlimited permission to copy, distribute and modify it. + + # Defaults: + ac_help= + ac_default_prefix=/usr/local + # Any additions from configure.in: + ac_help="$ac_help + --enable-objc-gc enable the use of Boehm's garbage collector with + the GNU Objective-C runtime." + + # Initialize some variables set by options. + # The variables have the same names as the options, with + # dashes changed to underlines. + build=NONE + cache_file=./config.cache + exec_prefix=NONE + host=NONE + no_create= + nonopt=NONE + no_recursion= + prefix=NONE + program_prefix=NONE + program_suffix=NONE + program_transform_name=s,x,x, + silent= + site= + srcdir= + target=NONE + verbose= + x_includes=NONE + x_libraries=NONE + bindir='${exec_prefix}/bin' + sbindir='${exec_prefix}/sbin' + libexecdir='${exec_prefix}/libexec' + datadir='${prefix}/share' + sysconfdir='${prefix}/etc' + sharedstatedir='${prefix}/com' + localstatedir='${prefix}/var' + libdir='${exec_prefix}/lib' + includedir='${prefix}/include' + oldincludedir='/usr/include' + infodir='${prefix}/info' + mandir='${prefix}/man' + + # Initialize some other variables. + subdirs= + MFLAGS= MAKEFLAGS= + SHELL=${CONFIG_SHELL-/bin/sh} + # Maximum number of lines to put in a shell here document. + ac_max_here_lines=12 + + ac_prev= + for ac_option + do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF + Usage: configure [options] [host] + Options: [defaults in brackets after descriptions] + Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure + Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names + EOF + cat << EOF + Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] + Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR + EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac + done + + if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } + fi + + trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + + # File descriptor usage: + # 0 standard input + # 1 file creation + # 2 errors and warnings + # 3 some systems may open it to /dev/tty + # 4 used on the Kubota Titan + # 6 checking for... messages and results + # 5 compiler messages saved in config.log + if test "$silent" = yes; then + exec 6>/dev/null + else + exec 6>&1 + fi + exec 5>./config.log + + echo "\ + This file contains any messages produced by compilers while + running configure, to aid debugging if configure makes a mistake. + " 1>&5 + + # Strip out --no-create and --no-recursion so they do not pile up. + # Also quote any args containing shell metacharacters. + ac_configure_args= + for ac_arg + do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac + done + + # NLS nuisances. + # Only set these to C if already set. These must not be set unconditionally + # because not all systems understand e.g. LANG=C (notably SCO). + # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! + # Non-C LC_CTYPE values break the ctype check. + if test "${LANG+set}" = set; then LANG=C; export LANG; fi + if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi + if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi + if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + + # confdefs.h avoids OS command line length limits that DEFS can exceed. + rm -rf conftest* confdefs.h + # AIX cpp loses on an empty file, so make sure it contains at least a newline. + echo > confdefs.h + + # A filename unique to this package, relative to the directory that + # configure is in, which we can look for to find out if srcdir is correct. + ac_unique_file=objc/objc.h + + # Find the source files, if location was not specified. + if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi + else + ac_srcdir_defaulted=no + fi + if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi + fi + srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + + # Prefer explicitly selected file to automatically selected ones. + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi + for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi + done + + if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file + else + echo "creating cache $cache_file" + > $cache_file + fi + + ac_ext=c + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' + ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' + ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + cross_compiling=$ac_cv_prog_cc_cross + + ac_exeext= + ac_objext=o + if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' + ' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi + else + ac_n= ac_c='\c' ac_t= + fi + + + #AC_CONFIG_HEADER(config.h) + + if test "${srcdir}" = "." ; then + if test "${with_target_subdir}" != "." ; then + topsrcdir=${with_multisrctop}../.. + else + topsrcdir=${with_multisrctop}.. + fi + else + topsrcdir=${srcdir}/.. + fi + ac_aux_dir= + for ac_dir in $topsrcdir $srcdir/$topsrcdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi + done + if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $topsrcdir $srcdir/$topsrcdir" 1>&2; exit 1; } + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + # If the language specific compiler does not exist, but the "gcc" directory + # does, we do not build anything. Note, $r is set by the top-level Makefile. + # Note that when we look for the compiler, we search both with and without + # extension to handle cross and canadian cross builds. + compiler_name=cc1obj + rm -f skip-this-dir + echo $ac_n "checking if compiler $compiler_name has been built""... $ac_c" 1>&6 + echo "configure:566: checking if compiler $compiler_name has been built" >&5 + if eval "test \"`echo '$''{'objc_cv_compiler_exists'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + objc_cv_compiler_exists=yes + if test -n "$r"; then + if test -d "$r"/gcc; then + if test -f "$r"/gcc/$compiler_name \ + || test -f "$r"/gcc/$compiler_name.exe; then + true + else + objc_cv_compiler_exists=no + echo "rm -f config.cache config.log multilib.out" > skip-this-dir + fi + fi + fi + + fi + + echo "$ac_t""$objc_cv_compiler_exists" 1>&6 + if test x$objc_cv_compiler_exists = xno + then + rm -f Makefile conftest* confdefs* core + exit 0 + fi + + # For ObjC we'll set CC to point at the built gcc, but this will get it into + # the makefiles + # Extract the first word of "gcc", so it can be a program name with args. + set dummy gcc; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:597: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" + fi + fi + CC="$ac_cv_prog_CC" + if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. + set dummy cc; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:627: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" + if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi + fi + fi + fi + CC="$ac_cv_prog_CC" + if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. + set dummy cl; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:678: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" + fi + fi + CC="$ac_cv_prog_CC" + if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } + fi + + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 + echo "configure:710: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + + ac_ext=c + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' + ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' + ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + cross_compiling=$ac_cv_prog_cc_cross + + cat > conftest.$ac_ext << EOF + + #line 721 "configure" + #include "confdefs.h" + + main(){return(0);} + EOF + if { (eval echo configure:726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no + fi + rm -fr conftest* + ac_ext=c + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' + ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' + ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + cross_compiling=$ac_cv_prog_cc_cross + + echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 + if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } + fi + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 + echo "configure:752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 + echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 + cross_compiling=$ac_cv_prog_cc_cross + + echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 + echo "configure:757: checking whether we are using GNU C" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes + else + ac_cv_prog_gcc=no + fi + fi + + echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + + if test $ac_cv_prog_gcc = yes; then + GCC=yes + else + GCC= + fi + + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 + echo "configure:785: checking whether ${CC-cc} accepts -g" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + echo 'void f(){}' > conftest.c + if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes + else + ac_cv_prog_cc_g=no + fi + rm -f conftest* + + fi + + echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi + else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi + fi + + + test "$AR" || AR=ar + + if test "$RANLIB"; then : + + else + # Extract the first word of "ranlib", so it can be a program name with args. + set dummy ranlib; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:825: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" + fi + fi + RANLIB="$ac_cv_prog_RANLIB" + if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + fi + # Find a good install program. We prefer a C program (faster), + # so one script is as good as another. But avoid the broken or + # incompatible versions: + # SysV /etc/install, /usr/sbin/install + # SunOS /usr/etc/install + # IRIX /sbin/install + # AIX /bin/install + # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag + # AFS /usr/afsws/bin/install, which mishandles nonexistent args + # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" + # ./install, which can be erroneously created by make from ./install.sh. + echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 + echo "configure:865: checking for a BSD compatible install" >&5 + if test -z "$INSTALL"; then + if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + + fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi + fi + echo "$ac_t""$INSTALL" 1>&6 + + # Use test -z because SunOS4 sh mishandles braces in ${var-val}. + # It thinks the first close brace ends the variable substitution. + test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + + test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + + # Sanity check for the cross-compilation case: + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 + echo "configure:921: checking how to run the C preprocessor" >&5 + # On Suns, sometimes $CPP names a directory. + if test -n "$CPP" && test -d "$CPP"; then + CPP= + fi + if test -z "$CPP"; then + if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:976: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp + fi + rm -f conftest* + fi + rm -f conftest* + fi + rm -f conftest* + ac_cv_prog_CPP="$CPP" + fi + CPP="$ac_cv_prog_CPP" + else + ac_cv_prog_CPP="$CPP" + fi + echo "$ac_t""$CPP" 1>&6 + + ac_safe=`echo "stdio.h" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for stdio.h""... $ac_c" 1>&6 + echo "configure:1002: checking for stdio.h" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:1012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : + else + echo "$ac_t""no" 1>&6 + { echo "configure: error: Can't find stdio.h. + You must have a usable C system for the target already installed, at least + including headers and, preferably, the library, before you can configure + the Objective C runtime system. If necessary, install gcc now with + \`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'." 1>&2; exit 1; } + fi + + + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 + echo "configure:1040: checking for ANSI C header files" >&5 + if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + #include + #include + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:1053: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : + else + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + fi + + if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : + else + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + fi + + if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : + else + cat > conftest.$ac_ext < + #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') + #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) + #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) + int main () { int i; for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); + exit (0); } + + EOF + if { (eval echo configure:1120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + : + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no + fi + rm -fr conftest* + fi + + fi + fi + + echo "$ac_t""$ac_cv_header_stdc" 1>&6 + if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF + #define STDC_HEADERS 1 + EOF + + fi + + + # Determine the name of the GCC thread file. + + echo $ac_n "checking for thread file""... $ac_c" 1>&6 + echo "configure:1147: checking for thread file" >&5 + if eval "test \"`echo '$''{'objc_cv_thread_file'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -f "$r"/gcc/Makefile + then + objc_cv_thread_file=`grep \^GCC_THREAD_FILE "$r"/gcc/Makefile | awk -F= '{ print $2 }'` + else + { echo "configure: error: not found" 1>&2; exit 1; } + fi + fi + + echo "$ac_t""$objc_cv_thread_file" 1>&6 + OBJC_THREAD_FILE=$objc_cv_thread_file + + + # Check whether --enable-objc-gc or --disable-objc-gc was given. + if test "${enable_objc_gc+set}" = set; then + enableval="$enable_objc_gc" + if [ x$enable_objc_gc = xno ]; then + OBJC_BOEHM_GC='' + else + OBJC_BOEHM_GC=libobjc_gc.a + fi + else + OBJC_BOEHM_GC='' + fi + + + + + # We need multilib support, but only if configuring for the target. + trap '' 1 2 15 + cat > confcache <<\EOF + # This file is a shell script that caches the results of configure + # tests run on this system so they can be shared between configure + # scripts and configure runs. It is not useful on other systems. + # If it contains results you don't want to keep, you may remove or edit it. + # + # By default, configure uses ./config.cache as the cache file, + # creating it if it does not exist already. You can give configure + # the --cache-file=FILE option to use a different cache file; that is + # what configure does when it calls configure scripts in + # subdirectories, so they share the cache. + # Giving --cache-file=/dev/null disables caching, for debugging configure. + # config.status only pays attention to the cache file if you give it the + # --recheck option to rerun configure. + # + EOF + # The following way of writing the cache mishandles newlines in values, + # but we know of no workaround that is simple, portable, and efficient. + # So, don't put newlines in cache variables' values. + # Ultrix sh set writes to stderr and can't be redirected directly, + # and sets the high bit in the cache file unless we assign to the vars. + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache + if cmp -s $cache_file confcache; then + : + else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi + fi + rm -f confcache + + trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + + test "x$prefix" = xNONE && prefix=$ac_default_prefix + # Let make expand exec_prefix. + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + + # Any assignment to VPATH causes Sun make to only execute + # the first set of double-colon rules, so remove it if not needed. + # If there is a colon in the path, we need to keep it. + if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + fi + + trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + + # Transform confdefs.h into DEFS. + # Protect against shell expansion while executing Makefile rules. + # Protect against Makefile macro expansion. + cat > conftest.defs <<\EOF + s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g + s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g + s%\[%\\&%g + s%\]%\\&%g + s%\$%$$%g + EOF + DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` + rm -f conftest.defs + + + # Without the "./", some shells look in PATH for config.status. + : ${CONFIG_STATUS=./config.status} + + echo creating $CONFIG_STATUS + rm -f $CONFIG_STATUS + cat > $CONFIG_STATUS </dev/null | sed 1q`: + # + # $0 $ac_configure_args + # + # Compiler output produced by configure, useful for debugging + # configure, is in ./config.log if it exists. + + ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" + for ac_option + do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac + done + + ac_given_srcdir=$srcdir + ac_given_INSTALL="$INSTALL" + + trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 + EOF + cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF + $ac_vpsub + $extrasub + s%@SHELL@%$SHELL%g + s%@CFLAGS@%$CFLAGS%g + s%@CPPFLAGS@%$CPPFLAGS%g + s%@CXXFLAGS@%$CXXFLAGS%g + s%@FFLAGS@%$FFLAGS%g + s%@DEFS@%$DEFS%g + s%@LDFLAGS@%$LDFLAGS%g + s%@LIBS@%$LIBS%g + s%@exec_prefix@%$exec_prefix%g + s%@prefix@%$prefix%g + s%@program_transform_name@%$program_transform_name%g + s%@bindir@%$bindir%g + s%@sbindir@%$sbindir%g + s%@libexecdir@%$libexecdir%g + s%@datadir@%$datadir%g + s%@sysconfdir@%$sysconfdir%g + s%@sharedstatedir@%$sharedstatedir%g + s%@localstatedir@%$localstatedir%g + s%@libdir@%$libdir%g + s%@includedir@%$includedir%g + s%@oldincludedir@%$oldincludedir%g + s%@infodir@%$infodir%g + s%@mandir@%$mandir%g + s%@CC@%$CC%g + s%@AR@%$AR%g + s%@RANLIB@%$RANLIB%g + s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g + s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g + s%@INSTALL_DATA@%$INSTALL_DATA%g + s%@CPP@%$CPP%g + s%@OBJC_THREAD_FILE@%$OBJC_THREAD_FILE%g + s%@OBJC_BOEHM_GC@%$OBJC_BOEHM_GC%g + + CEOF + EOF + + cat >> $CONFIG_STATUS <<\EOF + + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. + ac_file=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_cmds # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds="" + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi + EOF + + cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ + # $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub + s%@configure_input@%$configure_input%g + s%@srcdir@%$srcdir%g + s%@top_srcdir@%$top_srcdir%g + s%@INSTALL@%$INSTALL%g + " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file + fi; done + rm -f conftest.s* + + EOF + cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + if test -n "$CONFIG_FILES"; then + if test -n "${with_target_subdir}"; then + # FIXME: We shouldn't need to set ac_file + ac_file=Makefile + . ${topsrcdir}/config-ml.in + fi + fi + exit 0 + EOF + chmod +x $CONFIG_STATUS + rm -fr confdefs* $ac_clean_files + test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/configure.in gcc-2.95/libobjc/configure.in *** egcs-1.1.2/libobjc/configure.in Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/configure.in Wed May 19 19:28:53 1999 *************** *** 0 **** --- 1,142 ---- + # Process this file with autoconf to produce a configure script. + # Copyright (C) 1995, 1997, 1998, 1999 Free Software Foundation, Inc. + # Contributed by Dave Love (d.love@dl.ac.uk). + # + #This file is part of GNU Objective C. + # + #GNU Objective C 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 Objective C 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 Objective C; see the file COPYING. If not, write to + #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + #02111-1307, USA. + + AC_PREREQ(2.13) + AC_INIT(objc/objc.h) + #AC_CONFIG_HEADER(config.h) + + if test "${srcdir}" = "." ; then + if test "${with_target_subdir}" != "." ; then + topsrcdir=${with_multisrctop}../.. + else + topsrcdir=${with_multisrctop}.. + fi + else + topsrcdir=${srcdir}/.. + fi + dnl This is needed for a multilibbed build in the source tree so + dnl that install-sh and config.sub get found. + AC_CONFIG_AUX_DIR($topsrcdir) + + # If the language specific compiler does not exist, but the "gcc" directory + # does, we do not build anything. Note, $r is set by the top-level Makefile. + # Note that when we look for the compiler, we search both with and without + # extension to handle cross and canadian cross builds. + compiler_name=cc1obj + rm -f skip-this-dir + AC_MSG_CHECKING(if compiler $compiler_name has been built) + AC_CACHE_VAL(objc_cv_compiler_exists, + [objc_cv_compiler_exists=yes + if test -n "$r"; then + if test -d "$r"/gcc; then + if test -f "$r"/gcc/$compiler_name \ + || test -f "$r"/gcc/$compiler_name.exe; then + true + else + objc_cv_compiler_exists=no + echo "rm -f config.cache config.log multilib.out" > skip-this-dir + fi + fi + fi + ]) + AC_MSG_RESULT($objc_cv_compiler_exists) + if test x$objc_cv_compiler_exists = xno + then + rm -f Makefile conftest* confdefs* core + exit 0 + fi + + dnl Checks for programs. + # For ObjC we'll set CC to point at the built gcc, but this will get it into + # the makefiles + AC_PROG_CC + + test "$AR" || AR=ar + AC_SUBST(AR) + if test "$RANLIB"; then : + AC_SUBST(RANLIB) + else + AC_PROG_RANLIB + fi + AC_PROG_INSTALL + + dnl Checks for libraries. + + dnl Checks for header files. + # Sanity check for the cross-compilation case: + AC_CHECK_HEADER(stdio.h,:, + [AC_MSG_ERROR([Can't find stdio.h. + You must have a usable C system for the target already installed, at least + including headers and, preferably, the library, before you can configure + the Objective C runtime system. If necessary, install gcc now with + \`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])]) + + AC_HEADER_STDC + + # Determine the name of the GCC thread file. + + AC_CACHE_CHECK([for thread file],objc_cv_thread_file, + [if test -f "$r"/gcc/Makefile + then + objc_cv_thread_file=`grep \^GCC_THREAD_FILE "$r"/gcc/Makefile | awk -F= '{ print $2 }'` + else + AC_MSG_ERROR([not found]) + fi]) + OBJC_THREAD_FILE=$objc_cv_thread_file + AC_SUBST(OBJC_THREAD_FILE) + + AC_ARG_ENABLE(objc-gc, + [ --enable-objc-gc enable the use of Boehm's garbage collector with + the GNU Objective-C runtime.], + if [[[ x$enable_objc_gc = xno ]]]; then + OBJC_BOEHM_GC='' + else + OBJC_BOEHM_GC=libobjc_gc.a + fi, + OBJC_BOEHM_GC='') + AC_SUBST(OBJC_BOEHM_GC) + + + # We need multilib support, but only if configuring for the target. + AC_OUTPUT(Makefile, + [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + if test -n "$CONFIG_FILES"; then + if test -n "${with_target_subdir}"; then + # FIXME: We shouldn't need to set ac_file + ac_file=Makefile + . ${topsrcdir}/config-ml.in + fi + fi], + srcdir=${srcdir} + host=${host} + target=${target} + with_target_subdir=${with_target_subdir} + with_multisubdir=${with_multisubdir} + ac_configure_args="--enable-multilib ${ac_configure_args}" + CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + topsrcdir=${topsrcdir} + ) + + dnl Local Variables: + dnl comment-start: "dnl " + dnl comment-end: "" + dnl comment-start-skip: "\\bdnl\\b\\s *" + dnl End: diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/encoding.c gcc-2.95/libobjc/encoding.c *** egcs-1.1.2/libobjc/encoding.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/encoding.c Fri Oct 16 15:19:21 1998 *************** *** 0 **** --- 1,918 ---- + /* Encoding of types for Objective C. + Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Contributed by Kresten Krab Thorup + Bitfield support by Ovidiu Predescu + + 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. */ + + #include "tconfig.h" + #include "objc-api.h" + #include "encoding.h" + + #define MAX(X, Y) \ + ({ typeof(X) __x = (X), __y = (Y); \ + (__x > __y ? __x : __y); }) + + #define MIN(X, Y) \ + ({ typeof(X) __x = (X), __y = (Y); \ + (__x < __y ? __x : __y); }) + + #define ROUND(V, A) \ + ({ typeof(V) __v=(V); typeof(A) __a=(A); \ + __a*((__v+__a-1)/__a); }) + + + /* Various hacks for objc_layout_record. These are used by the target + macros. */ + + #define TREE_CODE(TYPE) *TYPE + #define TREE_TYPE(TREE) TREE + + #define RECORD_TYPE _C_STRUCT_B + #define UNION_TYPE _C_UNION_B + #define QUAL_UNION_TYPE _C_UNION_B + #define ARRAY_TYPE _C_ARY_B + + #define TYPE_FIELDS(TYPE) objc_skip_typespec (TYPE) + + #define DECL_MODE(TYPE) *(TYPE) + + #define DFmode _C_DBL + + #define get_inner_array_type(TYPE) ((TYPE) + 1) + + + static inline int + atoi (const char* str) + { + int res = 0; + + while (isdigit (*str)) + res *= 10, res += (*str++ - '0'); + + return res; + } + + /* + return the size of an object specified by type + */ + + int + objc_sizeof_type (const char* type) + { + /* Skip the variable name if any */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + + switch(*type) { + case _C_ID: + return sizeof(id); + break; + + case _C_CLASS: + return sizeof(Class); + break; + + case _C_SEL: + return sizeof(SEL); + break; + + case _C_CHR: + return sizeof(char); + break; + + case _C_UCHR: + return sizeof(unsigned char); + break; + + case _C_SHT: + return sizeof(short); + break; + + case _C_USHT: + return sizeof(unsigned short); + break; + + case _C_INT: + return sizeof(int); + break; + + case _C_UINT: + return sizeof(unsigned int); + break; + + case _C_LNG: + return sizeof(long); + break; + + case _C_ULNG: + return sizeof(unsigned long); + break; + + case _C_LNG_LNG: + return sizeof(long long); + break; + + case _C_ULNG_LNG: + return sizeof(unsigned long long); + break; + + case _C_FLT: + return sizeof(float); + break; + + case _C_DBL: + return sizeof(double); + break; + + case _C_VOID: + return sizeof(void); + break; + case _C_PTR: + case _C_ATOM: + case _C_CHARPTR: + return sizeof(char*); + break; + + case _C_ARY_B: + { + int len = atoi(type+1); + while (isdigit(*++type)); + return len*objc_aligned_size (type); + } + break; + + case _C_BFLD: + { + /* The new encoding of bitfields is: b 'position' 'type' 'size' */ + int position, size; + int startByte, endByte; + + position = atoi (type + 1); + while (isdigit (*++type)); + size = atoi (type + 1); + + startByte = position / BITS_PER_UNIT; + endByte = (position + size) / BITS_PER_UNIT; + return endByte - startByte; + } + + case _C_STRUCT_B: + { + struct objc_struct_layout layout; + unsigned int size; + + objc_layout_structure (type, &layout); + while (objc_layout_structure_next_member (&layout)) + /* do nothing */ ; + objc_layout_finish_structure (&layout, &size, NULL); + + return size; + } + + case _C_UNION_B: + { + int max_size = 0; + while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; + while (*type != _C_UNION_E) + { + /* Skip the variable name if any */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + max_size = MAX (max_size, objc_sizeof_type (type)); + type = objc_skip_typespec (type); + } + return max_size; + } + + default: + { + objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); + return 0; + } + } + } + + + /* + Return the alignment of an object specified by type + */ + + int + objc_alignof_type(const char* type) + { + /* Skip the variable name if any */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + switch(*type) { + case _C_ID: + return __alignof__(id); + break; + + case _C_CLASS: + return __alignof__(Class); + break; + + case _C_SEL: + return __alignof__(SEL); + break; + + case _C_CHR: + return __alignof__(char); + break; + + case _C_UCHR: + return __alignof__(unsigned char); + break; + + case _C_SHT: + return __alignof__(short); + break; + + case _C_USHT: + return __alignof__(unsigned short); + break; + + case _C_INT: + return __alignof__(int); + break; + + case _C_UINT: + return __alignof__(unsigned int); + break; + + case _C_LNG: + return __alignof__(long); + break; + + case _C_ULNG: + return __alignof__(unsigned long); + break; + + case _C_LNG_LNG: + return __alignof__(long long); + break; + + case _C_ULNG_LNG: + return __alignof__(unsigned long long); + break; + + case _C_FLT: + return __alignof__(float); + break; + + case _C_DBL: + return __alignof__(double); + break; + + case _C_PTR: + case _C_ATOM: + case _C_CHARPTR: + return __alignof__(char*); + break; + + case _C_ARY_B: + while (isdigit(*++type)) /* do nothing */; + return objc_alignof_type (type); + + case _C_STRUCT_B: + { + struct objc_struct_layout layout; + unsigned int align; + + objc_layout_structure (type, &layout); + while (objc_layout_structure_next_member (&layout)) + /* do nothing */; + objc_layout_finish_structure (&layout, NULL, &align); + + return align; + } + + case _C_UNION_B: + { + int maxalign = 0; + while (*type != _C_UNION_E && *type++ != '=') /* do nothing */; + while (*type != _C_UNION_E) + { + /* Skip the variable name if any */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + maxalign = MAX (maxalign, objc_alignof_type (type)); + type = objc_skip_typespec (type); + } + return maxalign; + } + + default: + { + objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); + return 0; + } + } + } + + /* + The aligned size if the size rounded up to the nearest alignment. + */ + + int + objc_aligned_size (const char* type) + { + int size, align; + + /* Skip the variable name */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + + size = objc_sizeof_type (type); + align = objc_alignof_type (type); + + return ROUND (size, align); + } + + /* + The size rounded up to the nearest integral of the wordsize, taken + to be the size of a void*. + */ + + int + objc_promoted_size (const char* type) + { + int size, wordsize; + + /* Skip the variable name */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + + size = objc_sizeof_type (type); + wordsize = sizeof (void*); + + return ROUND (size, wordsize); + } + + /* + Skip type qualifiers. These may eventually precede typespecs + occurring in method prototype encodings. + */ + + inline const char* + objc_skip_type_qualifiers (const char* type) + { + while (*type == _C_CONST + || *type == _C_IN + || *type == _C_INOUT + || *type == _C_OUT + || *type == _C_BYCOPY + || *type == _C_BYREF + || *type == _C_ONEWAY + || *type == _C_GCINVISIBLE) + { + type += 1; + } + return type; + } + + + /* + Skip one typespec element. If the typespec is prepended by type + qualifiers, these are skipped as well. + */ + + const char* + objc_skip_typespec (const char* type) + { + /* Skip the variable name if any */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + + type = objc_skip_type_qualifiers (type); + + switch (*type) { + + case _C_ID: + /* An id may be annotated by the actual type if it is known + with the @"ClassName" syntax */ + + if (*++type != '"') + return type; + else + { + while (*++type != '"') /* do nothing */; + return type + 1; + } + + /* The following are one character type codes */ + case _C_CLASS: + case _C_SEL: + case _C_CHR: + case _C_UCHR: + case _C_CHARPTR: + case _C_ATOM: + case _C_SHT: + case _C_USHT: + case _C_INT: + case _C_UINT: + case _C_LNG: + case _C_ULNG: + case _C_LNG_LNG: + case _C_ULNG_LNG: + case _C_FLT: + case _C_DBL: + case _C_VOID: + case _C_UNDEF: + return ++type; + break; + + case _C_ARY_B: + /* skip digits, typespec and closing ']' */ + + while(isdigit(*++type)); + type = objc_skip_typespec(type); + if (*type == _C_ARY_E) + return ++type; + else + { + objc_error(nil, OBJC_ERR_BAD_TYPE, "bad array type %s\n", type); + return 0; + } + + case _C_BFLD: + /* The new encoding of bitfields is: b 'position' 'type' 'size' */ + while (isdigit (*++type)); /* skip position */ + while (isdigit (*++type)); /* skip type and size */ + return type; + + case _C_STRUCT_B: + /* skip name, and elements until closing '}' */ + + while (*type != _C_STRUCT_E && *type++ != '='); + while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); } + return ++type; + + case _C_UNION_B: + /* skip name, and elements until closing ')' */ + + while (*type != _C_UNION_E && *type++ != '='); + while (*type != _C_UNION_E) { type = objc_skip_typespec (type); } + return ++type; + + case _C_PTR: + /* Just skip the following typespec */ + + return objc_skip_typespec (++type); + + default: + { + objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type); + return 0; + } + } + } + + /* + Skip an offset as part of a method encoding. This is prepended by a + '+' if the argument is passed in registers. + */ + inline const char* + objc_skip_offset (const char* type) + { + if (*type == '+') type++; + while(isdigit(*++type)); + return type; + } + + /* + Skip an argument specification of a method encoding. + */ + const char* + objc_skip_argspec (const char* type) + { + type = objc_skip_typespec (type); + type = objc_skip_offset (type); + return type; + } + + /* + Return the number of arguments that the method MTH expects. + Note that all methods need two implicit arguments `self' and + `_cmd'. + */ + int + method_get_number_of_arguments (struct objc_method* mth) + { + int i = 0; + const char* type = mth->method_types; + while (*type) + { + type = objc_skip_argspec (type); + i += 1; + } + return i - 1; + } + + /* + Return the size of the argument block needed on the stack to invoke + the method MTH. This may be zero, if all arguments are passed in + registers. + */ + + int + method_get_sizeof_arguments (struct objc_method* mth) + { + const char* type = objc_skip_typespec (mth->method_types); + return atoi (type); + } + + /* + Return a pointer to the next argument of ARGFRAME. type points to + the last argument. Typical use of this look like: + + { + char *datum, *type; + for (datum = method_get_first_argument (method, argframe, &type); + datum; datum = method_get_next_argument (argframe, &type)) + { + unsigned flags = objc_get_type_qualifiers (type); + type = objc_skip_type_qualifiers (type); + if (*type != _C_PTR) + [portal encodeData: datum ofType: type]; + else + { + if ((flags & _F_IN) == _F_IN) + [portal encodeData: *(char**)datum ofType: ++type]; + } + } + } + */ + + char* + method_get_next_argument (arglist_t argframe, + const char **type) + { + const char *t = objc_skip_argspec (*type); + + if (*t == '\0') + return 0; + + *type = t; + t = objc_skip_typespec (t); + + if (*t == '+') + return argframe->arg_regs + atoi (++t); + else + return argframe->arg_ptr + atoi (t); + } + + /* + Return a pointer to the value of the first argument of the method + described in M with the given argumentframe ARGFRAME. The type + is returned in TYPE. type must be passed to successive calls of + method_get_next_argument. + */ + char* + method_get_first_argument (struct objc_method* m, + arglist_t argframe, + const char** type) + { + *type = m->method_types; + return method_get_next_argument (argframe, type); + } + + /* + Return a pointer to the ARGth argument of the method + M from the frame ARGFRAME. The type of the argument + is returned in the value-result argument TYPE + */ + + char* + method_get_nth_argument (struct objc_method* m, + arglist_t argframe, int arg, + const char **type) + { + const char* t = objc_skip_argspec (m->method_types); + + if (arg > method_get_number_of_arguments (m)) + return 0; + + while (arg--) + t = objc_skip_argspec (t); + + *type = t; + t = objc_skip_typespec (t); + + if (*t == '+') + return argframe->arg_regs + atoi (++t); + else + return argframe->arg_ptr + atoi (t); + } + + unsigned + objc_get_type_qualifiers (const char* type) + { + unsigned res = 0; + BOOL flag = YES; + + while (flag) + switch (*type++) + { + case _C_CONST: res |= _F_CONST; break; + case _C_IN: res |= _F_IN; break; + case _C_INOUT: res |= _F_INOUT; break; + case _C_OUT: res |= _F_OUT; break; + case _C_BYCOPY: res |= _F_BYCOPY; break; + case _C_BYREF: res |= _F_BYREF; break; + case _C_ONEWAY: res |= _F_ONEWAY; break; + case _C_GCINVISIBLE: res |= _F_GCINVISIBLE; break; + default: flag = NO; + } + + return res; + } + + + /* The following three functions can be used to determine how a + structure is laid out by the compiler. For example: + + struct objc_struct_layout layout; + int i; + + objc_layout_structure (type, &layout); + while (objc_layout_structure_next_member (&layout)) + { + int position, align; + const char *type; + + objc_layout_structure_get_info (&layout, &position, &align, &type); + printf ("element %d has offset %d, alignment %d\n", + i++, position, align); + } + + These functions are used by objc_sizeof_type and objc_alignof_type + functions to compute the size and alignment of structures. The + previous method of computing the size and alignment of a structure + was not working on some architectures, particulary on AIX, and in + the presence of bitfields inside the structure. */ + void + objc_layout_structure (const char *type, + struct objc_struct_layout *layout) + { + const char *ntype; + + if (*type++ != _C_STRUCT_B) + { + objc_error(nil, OBJC_ERR_BAD_TYPE, + "record type expected in objc_layout_structure, got %s\n", + type); + } + + layout->original_type = type; + + /* Skip "=" if any. Avoid embedded structures and unions. */ + ntype = type; + while (*ntype != _C_STRUCT_E && *ntype != _C_STRUCT_B && *ntype != _C_UNION_B + && *ntype++ != '=') + /* do nothing */; + + /* If there's a "=", ntype - 1 points to '='; skip the the name */ + if (*(ntype - 1) == '=') + type = ntype; + + layout->type = type; + layout->prev_type = NULL; + layout->record_size = 0; + layout->record_align = BITS_PER_UNIT; + + #ifdef STRUCTURE_SIZE_BOUNDARY + layout->record_align = MAX (layout->record_align, STRUCTURE_SIZE_BOUNDARY); + #endif + } + + + BOOL + objc_layout_structure_next_member (struct objc_struct_layout *layout) + { + register int known_align = layout->record_size; + register int desired_align = 0; + + /* The following are used only if the field is a bitfield */ + register const char *bfld_type; + register int bfld_type_size, bfld_type_align, bfld_field_size; + + /* The current type without the type qualifiers */ + const char *type; + + #if 1 + if (layout->prev_type == NULL) + { + layout->prev_type = layout->type; + layout->type = objc_skip_typespec (layout->prev_type); + return YES; + } + #endif + + /* Add the size of the previous field to the size of the record. */ + if (layout->prev_type) + { + type = objc_skip_type_qualifiers (layout->prev_type); + + if (*type != _C_BFLD) + layout->record_size += objc_sizeof_type (type) * BITS_PER_UNIT; + else { + desired_align = 1; + /* Get the bitfield's type */ + for (bfld_type = type + 1; + isdigit(*bfld_type); + bfld_type++) + /* do nothing */; + + bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT; + bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; + bfld_field_size = atoi (objc_skip_typespec (bfld_type)); + layout->record_size += bfld_field_size; + } + } + + if (*layout->type == _C_STRUCT_E) + return NO; + + /* Skip the variable name if any */ + if (*layout->type == '"') + { + for (layout->type++; *layout->type++ != '"';) + /* do nothing */; + } + + type = objc_skip_type_qualifiers (layout->type); + + if (*type != _C_BFLD) + desired_align = objc_alignof_type(type) * BITS_PER_UNIT; + else + { + desired_align = 1; + /* Skip the bitfield's offset */ + for (bfld_type = type + 1; isdigit(*bfld_type); bfld_type++) + /* do nothing */; + + bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT; + bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; + bfld_field_size = atoi (objc_skip_typespec (bfld_type)); + } + + #ifdef BIGGEST_FIELD_ALIGNMENT + desired_align = MIN (desired_align, BIGGEST_FIELD_ALIGNMENT); + #endif + #ifdef ADJUST_FIELD_ALIGN + desired_align = ADJUST_FIELD_ALIGN (type, desired_align); + #endif + + /* Record must have at least as much alignment as any field. + Otherwise, the alignment of the field within the record + is meaningless. */ + #ifndef PCC_BITFIELD_TYPE_MATTERS + layout->record_align = MAX (layout->record_align, desired_align); + #else + if (*type == _C_BFLD) + { + /* For these machines, a zero-length field does not + affect the alignment of the structure as a whole. + It does, however, affect the alignment of the next field + within the structure. */ + if (bfld_field_size) + layout->record_align = MAX (layout->record_align, desired_align); + else + desired_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT; + + /* A named bit field of declared type `int' + forces the entire structure to have `int' alignment. + Q1: How is encoded this thing and how to check for it? + Q2: How to determine maximum_field_alignment at runtime? */ + + /* if (DECL_NAME (field) != 0) */ + { + int type_align = bfld_type_align; + #if 0 + if (maximum_field_alignment != 0) + type_align = MIN (type_align, maximum_field_alignment); + else if (DECL_PACKED (field)) + type_align = MIN (type_align, BITS_PER_UNIT); + #endif + + layout->record_align = MAX (layout->record_align, type_align); + } + } + else + layout->record_align = MAX (layout->record_align, desired_align); + #endif + + /* Does this field automatically have alignment it needs + by virtue of the fields that precede it and the record's + own alignment? */ + + if (*type == _C_BFLD) + layout->record_size = atoi (type + 1); + else if (layout->record_size % desired_align != 0) + { + /* No, we need to skip space before this field. + Bump the cumulative size to multiple of field alignment. */ + layout->record_size = ROUND (layout->record_size, desired_align); + } + + /* Jump to the next field in record. */ + + layout->prev_type = layout->type; + layout->type = objc_skip_typespec (layout->type); /* skip component */ + + return YES; + } + + + void objc_layout_finish_structure (struct objc_struct_layout *layout, + unsigned int *size, + unsigned int *align) + { + if (layout->type && *layout->type == _C_STRUCT_E) + { + /* Work out the alignment of the record as one expression and store + in the record type. Round it up to a multiple of the record's + alignment. */ + + #ifdef ROUND_TYPE_ALIGN + layout->record_align = ROUND_TYPE_ALIGN (layout->original_type, + 1, + layout->record_align); + #else + layout->record_align = MAX (1, layout->record_align); + #endif + + #ifdef ROUND_TYPE_SIZE + layout->record_size = ROUND_TYPE_SIZE (layout->original_type, + layout->record_size, + layout->record_align); + #else + /* Round the size up to be a multiple of the required alignment */ + layout->record_size = ROUND (layout->record_size, layout->record_align); + #endif + + layout->type = NULL; + } + if (size) + *size = layout->record_size / BITS_PER_UNIT; + if (align) + *align = layout->record_align / BITS_PER_UNIT; + } + + + void objc_layout_structure_get_info (struct objc_struct_layout *layout, + unsigned int *offset, + unsigned int *align, + const char **type) + { + if (offset) + *offset = layout->record_size / BITS_PER_UNIT; + if (align) + *align = layout->record_align / BITS_PER_UNIT; + if (type) + *type = layout->prev_type; + } diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/gc.c gcc-2.95/libobjc/gc.c *** egcs-1.1.2/libobjc/gc.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/gc.c Tue Sep 29 19:13:09 1998 *************** *** 0 **** --- 1,458 ---- + /* Basic data types for Objective C. + Copyright (C) 1998 Free Software Foundation, Inc. + Contributed by Ovidiu Predescu. + + 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. */ + + #include "tconfig.h" + #include "objc.h" + #include "encoding.h" + + #include + #include + + #if OBJC_WITH_GC + + #include + + /* gc_typed.h uses the following but doesn't declare them */ + typedef GC_word word; + typedef GC_signed_word signed_word; + + #if BITS_PER_WORD == 32 + # define LOGWL 5 + # define modWORDSZ(n) ((n) & 0x1f) /* n mod size of word */ + #endif + + #if BITS_PER_WORD == 64 + # define LOGWL 6 + # define modWORDSZ(n) ((n) & 0x3f) /* n mod size of word */ + #endif + + #define divWORDSZ(n) ((n) >> LOGWL) /* divide n by size of word */ + + #include + + /* The following functions set up in `mask` the corresponding pointers. + The offset is incremented with the size of the type. */ + + #define ROUND(V, A) \ + ({ typeof(V) __v=(V); typeof(A) __a=(A); \ + __a*((__v+__a-1)/__a); }) + + #define SET_BIT_FOR_OFFSET(mask, offset) \ + GC_set_bit(mask, offset / sizeof (void*)) + + /* Some prototypes */ + static void + __objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset); + static void + __objc_gc_setup_union (GC_bitmap mask, const char *type, int offset); + + + static void + __objc_gc_setup_array (GC_bitmap mask, const char *type, int offset) + { + int i, len = atoi(type + 1); + + while (isdigit(*++type)) + /* do nothing */; /* skip the size of the array */ + + switch (*type) { + case _C_ARY_B: + for (i = 0; i < len; i++) + __objc_gc_setup_array (mask, type, offset); + break; + + case _C_STRUCT_B: + for (i = 0; i < len; i++) + __objc_gc_setup_struct (mask, type, offset); + break; + + case _C_UNION_B: + for (i = 0; i < len; i++) + __objc_gc_setup_union (mask, type, offset); + break; + + default: + break; + } + } + + static void + __objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset) + { + struct objc_struct_layout layout; + unsigned int position; + const char *mtype; + + objc_layout_structure (type, &layout); + + while (objc_layout_structure_next_member (&layout)) + { + BOOL gc_invisible = NO; + + objc_layout_structure_get_info (&layout, &position, NULL, &mtype); + + /* Skip the variable name */ + if (*mtype == '"') + { + for (mtype++; *mtype++ != '"';) + /* do nothing */; + } + + if (*mtype == _C_GCINVISIBLE) + { + gc_invisible = YES; + mtype++; + } + + /* Add to position the offset of this structure */ + position += offset; + + switch (*mtype) { + case _C_ID: + case _C_CLASS: + case _C_SEL: + case _C_PTR: + case _C_CHARPTR: + case _C_ATOM: + if (!gc_invisible) + SET_BIT_FOR_OFFSET(mask, position); + break; + + case _C_ARY_B: + __objc_gc_setup_array (mask, mtype, position); + break; + + case _C_STRUCT_B: + __objc_gc_setup_struct (mask, mtype, position); + break; + + case _C_UNION_B: + __objc_gc_setup_union (mask, mtype, position); + break; + + default: + break; + } + } + } + + static void + __objc_gc_setup_union (GC_bitmap mask, const char *type, int offset) + { + /* Sub-optimal, quick implementation: assume the union is made of + pointers, set up the mask accordingly. */ + + int i, size, align; + + /* Skip the variable name */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + + size = objc_sizeof_type (type); + align = objc_alignof_type (type); + + offset = ROUND(offset, align); + for (i = 0; i < size; i += sizeof (void*)) + { + SET_BIT_FOR_OFFSET(mask, offset); + offset += sizeof (void*); + } + } + + + /* Iterates over the types in the structure that represents the class + encoding and sets the bits in mask according to each ivar type. */ + static void + __objc_gc_type_description_from_type (GC_bitmap mask, const char *type) + { + struct objc_struct_layout layout; + unsigned int offset, align; + const char *ivar_type; + + objc_layout_structure (type, &layout); + + while (objc_layout_structure_next_member (&layout)) + { + BOOL gc_invisible = NO; + + objc_layout_structure_get_info (&layout, &offset, &align, &ivar_type); + + /* Skip the variable name */ + if (*ivar_type == '"') + { + for (ivar_type++; *ivar_type++ != '"';) + /* do nothing */; + } + + if (*ivar_type == _C_GCINVISIBLE) + { + gc_invisible = YES; + ivar_type++; + } + + switch (*ivar_type) { + case _C_ID: + case _C_CLASS: + case _C_SEL: + case _C_PTR: + case _C_CHARPTR: + if (!gc_invisible) + SET_BIT_FOR_OFFSET(mask, offset); + break; + + case _C_ARY_B: + __objc_gc_setup_array (mask, ivar_type, offset); + break; + + case _C_STRUCT_B: + __objc_gc_setup_struct (mask, ivar_type, offset); + break; + + case _C_UNION_B: + __objc_gc_setup_union (mask, ivar_type, offset); + break; + + default: + break; + } + } + } + + /* Computes in *type the full type encoding of this class including + its super classes. '*size' gives the total number of bytes allocated + into *type, '*current' the number of bytes used so far by the + encoding. */ + static void + __objc_class_structure_encoding (Class class, char **type, int *size, + int *current) + { + int i, ivar_count; + struct objc_ivar_list* ivars; + + if (!class) + { + strcat (*type, "{"); + *current++; + return; + } + + /* Add the type encodings of the super classes */ + __objc_class_structure_encoding (class->super_class, type, size, current); + + ivars = class->ivars; + if (!ivars) + return; + + ivar_count = ivars->ivar_count; + + for (i = 0; i < ivar_count; i++) + { + struct objc_ivar *ivar = &(ivars->ivar_list[i]); + const char *ivar_type = ivar->ivar_type; + int len = strlen (ivar_type); + + if (*current + len + 1 >= *size) + { + /* Increase the size of the encoding string so that it + contains this ivar's type. */ + *size = ROUND(*current + len + 1, 10); + *type = objc_realloc (*type, *size); + } + strcat (*type + *current, ivar_type); + *current += len; + } + } + + + /* Allocates the memory that will hold the type description for class + and calls the __objc_class_structure_encoding that generates this + value. */ + void + __objc_generate_gc_type_description (Class class) + { + GC_bitmap mask; + int bits_no, size; + int type_size = 10, current; + char *class_structure_type; + + if (!CLS_ISCLASS(class)) + return; + + /* We have to create a mask in which each bit counts for a pointer member. + We take into consideration all the non-pointer instance variables and we + round them up to the alignment. */ + + /* The number of bits in the mask is the size of an instance in bytes divided + by the size of a pointer. */ + bits_no = (ROUND(class_get_instance_size (class), sizeof(void*)) + / sizeof (void*)); + size = ROUND(bits_no, BITS_PER_WORD) / BITS_PER_WORD; + mask = objc_atomic_malloc (size * sizeof (int)); + memset (mask, 0, size * sizeof (int)); + + class_structure_type = objc_atomic_malloc (type_size); + *class_structure_type = current = 0; + __objc_class_structure_encoding (class, &class_structure_type, + &type_size, ¤t); + if (current + 1 == type_size) + class_structure_type = objc_realloc (class_structure_type, ++type_size); + strcat (class_structure_type + current, "}"); + // printf ("type description for '%s' is %s\n", class->name, class_structure_type); + + __objc_gc_type_description_from_type (mask, class_structure_type); + objc_free (class_structure_type); + + #define DEBUG 1 + #ifdef DEBUG + printf (" mask for '%s', type '%s' (bits %d, mask size %d) is:", + class_structure_type, class->name, bits_no, size); + { + int i; + for (i = 0; i < size; i++) + printf (" %lx", mask[i]); + } + puts (""); + #endif + + class->gc_object_type = (void*)GC_make_descriptor (mask, bits_no); + } + + + /* Returns YES if type denotes a pointer type, NO otherwise */ + static inline BOOL + __objc_ivar_pointer (const char *type) + { + type = objc_skip_type_qualifiers (type); + + return (*type == _C_ID + || *type == _C_CLASS + || *type == _C_SEL + || *type == _C_PTR + || *type == _C_CHARPTR + || *type == _C_ATOM); + } + + + /* Mark the instance variable whose name is given by ivarname as a + weak pointer (a pointer hidden to the garbage collector) if + gc_invisible is true. If gc_invisible is false it unmarks the + instance variable and makes it a normal pointer, visible to the + garbage collector. + + This operation only makes sense on instance variables that are + pointers. */ + void + class_ivar_set_gcinvisible (Class class, const char* ivarname, + BOOL gc_invisible) + { + int i, ivar_count; + struct objc_ivar_list* ivars; + + if (!class || !ivarname) + return; + + ivars = class->ivars; + if (!ivars) + return; + + ivar_count = ivars->ivar_count; + + for (i = 0; i < ivar_count; i++) + { + struct objc_ivar *ivar = &(ivars->ivar_list[i]); + const char *type; + + if (!ivar->ivar_name || strcmp (ivar->ivar_name, ivarname)) + continue; + + assert (ivar->ivar_type); + type = ivar->ivar_type; + + /* Skip the variable name */ + if (*type == '"') + { + for (type++; *type++ != '"';) + /* do nothing */; + } + + if (*type == _C_GCINVISIBLE) + { + char *new_type; + + if (gc_invisible || !__objc_ivar_pointer (type)) + return; /* The type of the variable already matches the + requested gc_invisible type */ + + /* The variable is gc_invisible and we have to reverse it */ + new_type = objc_atomic_malloc (strlen (ivar->ivar_type)); + strncpy (new_type, ivar->ivar_type, + (size_t)(type - ivar->ivar_type)); + strcat (new_type, type + 1); + ivar->ivar_type = new_type; + } + else + { + char *new_type; + + if (!gc_invisible || !__objc_ivar_pointer (type)) + return; /* The type of the variable already matches the + requested gc_invisible type */ + + /* The variable is gc visible and we have to make it gc_invisible */ + new_type = objc_malloc (strlen (ivar->ivar_type) + 2); + strncpy (new_type, ivar->ivar_type, + (size_t)(type - ivar->ivar_type)); + strcat (new_type, "!"); + strcat (new_type, type); + ivar->ivar_type = new_type; + } + + __objc_generate_gc_type_description (class); + return; + } + + /* Search the instance variable in the superclasses */ + class_ivar_set_gcinvisible (class->super_class, ivarname, gc_invisible); + } + + #else /* !OBJC_WITH_GC */ + + void + __objc_generate_gc_type_description (Class class) + { + } + + void class_ivar_set_gcinvisible (Class class, + const char* ivarname, + BOOL gc_invisible) + { + } + + #endif /* OBJC_WITH_GC */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/hash.c gcc-2.95/libobjc/hash.c *** egcs-1.1.2/libobjc/hash.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/hash.c Tue Sep 29 19:13:10 1998 *************** *** 0 **** --- 1,283 ---- + /* Hash tables for Objective C internal structures + Copyright (C) 1993, 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. */ + + #include "assert.h" + + #include "hash.h" + + #include "runtime.h" /* for DEBUG_PRINTF */ + + /* These two macros determine when a hash table is full and + by how much it should be expanded respectively. + + These equations are percentages. */ + #define FULLNESS(cache) \ + ((((cache)->size * 75) / 100) <= (cache)->used) + #define EXPANSION(cache) \ + ((cache)->size * 2) + + cache_ptr + hash_new (unsigned int size, hash_func_type hash_func, + compare_func_type compare_func) + { + cache_ptr cache; + + /* Pass me a value greater than 0 and a power of 2. */ + assert (size); + assert (!(size & (size - 1))); + + /* Allocate the cache structure. calloc insures + its initialization for default values. */ + cache = (cache_ptr) objc_calloc (1, sizeof (struct cache)); + assert (cache); + + /* Allocate the array of buckets for the cache. + calloc initializes all of the pointers to NULL. */ + cache->node_table + = (node_ptr *) objc_calloc (size, sizeof (node_ptr)); + assert (cache->node_table); + + cache->size = size; + + /* This should work for all processor architectures? */ + cache->mask = (size - 1); + + /* Store the hashing function so that codes can be computed. */ + cache->hash_func = hash_func; + + /* Store the function that compares hash keys to + determine if they are equal. */ + cache->compare_func = compare_func; + + return cache; + } + + + void + hash_delete (cache_ptr cache) + { + node_ptr node; + node_ptr next_node; + unsigned int i; + + /* Purge all key/value pairs from the table. */ + /* Step through the nodes one by one and remove every node WITHOUT + using hash_next. this makes hash_delete much more efficient. */ + for (i = 0;i < cache->size;i++) { + if ((node = cache->node_table[i])) { + /* an entry in the hash table has been found, now step through the + nodes next in the list and free them. */ + while ((next_node = node->next)) { + hash_remove (cache,node->key); + node = next_node; + } + + hash_remove (cache,node->key); + } + } + + /* Release the array of nodes and the cache itself. */ + objc_free(cache->node_table); + objc_free(cache); + } + + + void + hash_add (cache_ptr *cachep, const void *key, void *value) + { + size_t indx = (*(*cachep)->hash_func)(*cachep, key); + node_ptr node = (node_ptr) objc_calloc (1, sizeof (struct cache_node)); + + + assert (node); + + /* Initialize the new node. */ + node->key = key; + node->value = value; + node->next = (*cachep)->node_table[indx]; + + /* Debugging. + Check the list for another key. */ + #ifdef DEBUG + { node_ptr node1 = (*cachep)->node_table[indx]; + + while (node1) { + + assert (node1->key != key); + node1 = node1->next; + } + } + #endif + + /* Install the node as the first element on the list. */ + (*cachep)->node_table[indx] = node; + + /* Bump the number of entries in the cache. */ + ++(*cachep)->used; + + /* Check the hash table's fullness. We're going + to expand if it is above the fullness level. */ + if (FULLNESS (*cachep)) { + + /* The hash table has reached its fullness level. Time to + expand it. + + I'm using a slow method here but is built on other + primitive functions thereby increasing its + correctness. */ + node_ptr node1 = NULL; + cache_ptr new = hash_new (EXPANSION (*cachep), + (*cachep)->hash_func, + (*cachep)->compare_func); + + DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n", + *cachep, (*cachep)->size, new->size); + + /* Copy the nodes from the first hash table to the new one. */ + while ((node1 = hash_next (*cachep, node1))) + hash_add (&new, node1->key, node1->value); + + /* Trash the old cache. */ + hash_delete (*cachep); + + /* Return a pointer to the new hash table. */ + *cachep = new; + } + } + + + void + hash_remove (cache_ptr cache, const void *key) + { + size_t indx = (*cache->hash_func)(cache, key); + node_ptr node = cache->node_table[indx]; + + + /* We assume there is an entry in the table. Error if it is not. */ + assert (node); + + /* Special case. First element is the key/value pair to be removed. */ + if ((*cache->compare_func)(node->key, key)) { + cache->node_table[indx] = node->next; + objc_free(node); + } else { + + /* Otherwise, find the hash entry. */ + node_ptr prev = node; + BOOL removed = NO; + + do { + + if ((*cache->compare_func)(node->key, key)) { + prev->next = node->next, removed = YES; + objc_free(node); + } else + prev = node, node = node->next; + } while (!removed && node); + assert (removed); + } + + /* Decrement the number of entries in the hash table. */ + --cache->used; + } + + + node_ptr + hash_next (cache_ptr cache, node_ptr node) + { + /* If the scan is being started then reset the last node + visitied pointer and bucket index. */ + if (!node) + cache->last_bucket = 0; + + /* If there is a node visited last then check for another + entry in the same bucket; Otherwise step to the next bucket. */ + if (node) { + if (node->next) + /* There is a node which follows the last node + returned. Step to that node and retun it. */ + return node->next; + else + ++cache->last_bucket; + } + + /* If the list isn't exhausted then search the buckets for + other nodes. */ + if (cache->last_bucket < cache->size) { + /* Scan the remainder of the buckets looking for an entry + at the head of the list. Return the first item found. */ + while (cache->last_bucket < cache->size) + if (cache->node_table[cache->last_bucket]) + return cache->node_table[cache->last_bucket]; + else + ++cache->last_bucket; + + /* No further nodes were found in the hash table. */ + return NULL; + } else + return NULL; + } + + + /* Given KEY, return corresponding value for it in CACHE. + Return NULL if the KEY is not recorded. */ + + void * + hash_value_for_key (cache_ptr cache, const void *key) + { + node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)]; + void *retval = NULL; + + if (node) + do { + if ((*cache->compare_func)(node->key, key)) { + retval = node->value; + break; + } else + node = node->next; + } while (!retval && node); + + return retval; + } + + /* Given KEY, return YES if it exists in the CACHE. + Return NO if it does not */ + + BOOL + hash_is_key_in_hash (cache_ptr cache, const void *key) + { + node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)]; + + if (node) + do { + if ((*cache->compare_func)(node->key, key)) + return YES; + else + node = node->next; + } while (node); + + return NO; + } diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/init.c gcc-2.95/libobjc/init.c *** egcs-1.1.2/libobjc/init.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/init.c Sun Jun 20 21:41:26 1999 *************** *** 0 **** --- 1,834 ---- + /* GNU Objective C Runtime initialization + Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + Contributed by Kresten Krab Thorup + +load support contributed by Ovidiu Predescu + + 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. */ + + #include "runtime.h" + + /* The version number of this runtime. This must match the number + defined in gcc (objc-act.c) */ + #define OBJC_VERSION 8 + #define PROTOCOL_VERSION 2 + + /* This list contains all modules currently loaded into the runtime */ + static struct objc_list* __objc_module_list = 0; /* !T:MUTEX */ + + /* This list contains all proto_list's not yet assigned class links */ + static struct objc_list* unclaimed_proto_list = 0; /* !T:MUTEX */ + + /* List of unresolved static instances. */ + static struct objc_list *uninitialized_statics = 0; /* !T:MUTEX */ + + /* Global runtime "write" mutex. */ + objc_mutex_t __objc_runtime_mutex = 0; + + /* Number of threads that are alive. */ + int __objc_runtime_threads_alive = 1; /* !T:MUTEX */ + + /* Check compiler vs runtime version */ + static void init_check_module_version (Module_t); + + /* Assign isa links to protos */ + static void __objc_init_protocols (struct objc_protocol_list* protos); + + /* Add protocol to class */ + static void __objc_class_add_protocols (Class, struct objc_protocol_list*); + + /* 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 */ + void (*_objc_load_callback)(Class class, Category* category); /* !T:SAFE */ + + /* Is all categories/classes resolved? */ + BOOL __objc_dangling_categories = NO; /* !T:UNUSED */ + + extern SEL + __sel_register_typed_name (const char *name, const char *types, + struct objc_selector *orig, BOOL is_const); + + /* Sends +load to all classes and categories in certain situations. */ + static void objc_send_load (void); + + /* Inserts all the classes defined in module in a tree of classes that + resembles the class hierarchy. This tree is traversed in preorder and the + classes in its nodes receive the +load message if these methods were not + executed before. The algorithm ensures that when the +load method of a class + is executed all the superclasses have been already received the +load + message. */ + static void __objc_create_classes_tree (Module_t module); + + static void __objc_call_callback (Module_t module); + + /* A special version that works only before the classes are completely + installed in the runtime. */ + static BOOL class_is_subclass_of_class (Class class, Class superclass); + + typedef struct objc_class_tree { + Class class; + struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */ + } objc_class_tree; + + /* This is a linked list of objc_class_tree trees. The head of these trees + are root classes (their super class is Nil). These different trees + represent different class hierarchies. */ + static struct objc_list *__objc_class_tree_list = NULL; + + /* Keeps the +load methods who have been already executed. This hash should + not be destroyed during the execution of the program. */ + static cache_ptr __objc_load_methods = NULL; + + /* Creates a tree of classes whose topmost class is directly inherited from + `upper' and the bottom class in this tree is `bottom_class'. The classes + in this tree are super classes of `bottom_class'. `subclasses' member + of each tree node point to the next subclass tree node. */ + static objc_class_tree * + create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper) + { + Class superclass = bottom_class->super_class ? + objc_lookup_class ((char*)bottom_class->super_class) + : Nil; + + objc_class_tree *tree, *prev; + + DEBUG_PRINTF ("create_tree_of_subclasses_inherited_from:"); + DEBUG_PRINTF ("bottom_class = %s, upper = %s\n", + (bottom_class ? bottom_class->name : NULL), + (upper ? upper->name : NULL)); + + tree = prev = objc_calloc (1, sizeof (objc_class_tree)); + prev->class = bottom_class; + + while (superclass != upper) + { + tree = objc_calloc (1, sizeof (objc_class_tree)); + tree->class = superclass; + tree->subclasses = list_cons (prev, tree->subclasses); + superclass = (superclass->super_class ? + objc_lookup_class ((char*)superclass->super_class) + : Nil); + prev = tree; + } + + return tree; + } + + /* Insert the `class' into the proper place in the `tree' class hierarchy. This + function returns a new tree if the class has been successfully inserted into + the tree or NULL if the class is not part of the classes hierarchy described + by `tree'. This function is private to objc_tree_insert_class(), you should + not call it directly. */ + static objc_class_tree * + __objc_tree_insert_class (objc_class_tree *tree, Class class) + { + DEBUG_PRINTF ("__objc_tree_insert_class: tree = %x, class = %s\n", + tree, class->name); + + if (tree == NULL) + return create_tree_of_subclasses_inherited_from (class, NULL); + else if (class == tree->class) + { + /* `class' has been already inserted */ + DEBUG_PRINTF ("1. class %s was previously inserted\n", class->name); + return tree; + } + else if ((class->super_class ? + objc_lookup_class ((char*)class->super_class) + : Nil) + == tree->class) + { + /* If class is a direct subclass of tree->class then add class to the + list of subclasses. First check to see if it wasn't already + inserted. */ + struct objc_list *list = tree->subclasses; + objc_class_tree *node; + + while (list) + { + /* Class has been already inserted; do nothing just return + the tree. */ + if (((objc_class_tree*)list->head)->class == class) + { + DEBUG_PRINTF ("2. class %s was previously inserted\n", + class->name); + return tree; + } + list = list->tail; + } + + /* Create a new node class and insert it into the list of subclasses */ + node = objc_calloc (1, sizeof (objc_class_tree)); + node->class = class; + tree->subclasses = list_cons (node, tree->subclasses); + DEBUG_PRINTF ("3. class %s inserted\n", class->name); + return tree; + } + else + { + /* The class is not a direct subclass of tree->class. Search for class's + superclasses in the list of subclasses. */ + struct objc_list *subclasses = tree->subclasses; + + /* Precondition: the class must be a subclass of tree->class; otherwise + return NULL to indicate our caller that it must take the next tree. */ + if (!class_is_subclass_of_class (class, tree->class)) + return NULL; + + for (; subclasses != NULL; subclasses = subclasses->tail) + { + Class aClass = ((objc_class_tree*)(subclasses->head))->class; + + if (class_is_subclass_of_class (class, aClass)) + { + /* If we found one of class's superclasses we insert the class + into its subtree and return the original tree since nothing + has been changed. */ + subclasses->head + = __objc_tree_insert_class (subclasses->head, class); + DEBUG_PRINTF ("4. class %s inserted\n", class->name); + return tree; + } + } + + /* We haven't found a subclass of `class' in the `subclasses' list. + Create a new tree of classes whose topmost class is a direct subclass + of tree->class. */ + { + objc_class_tree *new_tree + = create_tree_of_subclasses_inherited_from (class, tree->class); + tree->subclasses = list_cons (new_tree, tree->subclasses); + DEBUG_PRINTF ("5. class %s inserted\n", class->name); + return tree; + } + } + } + + /* This function inserts `class' in the right tree hierarchy classes. */ + static void + objc_tree_insert_class (Class class) + { + struct objc_list *list_node; + objc_class_tree *tree; + + list_node = __objc_class_tree_list; + while (list_node) + { + tree = __objc_tree_insert_class (list_node->head, class); + if (tree) + { + list_node->head = tree; + break; + } + else + list_node = list_node->tail; + } + + /* If the list was finished but the class hasn't been inserted, insert it + here. */ + if (!list_node) + { + __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list); + __objc_class_tree_list->head = __objc_tree_insert_class (NULL, class); + } + } + + /* Traverse tree in preorder. Used to send +load. */ + static void + objc_preorder_traverse (objc_class_tree *tree, + int level, + void (*function)(objc_class_tree*, int)) + { + struct objc_list *node; + + (*function) (tree, level); + for (node = tree->subclasses; node; node = node->tail) + objc_preorder_traverse (node->head, level + 1, function); + } + + /* Traverse tree in postorder. Used to destroy a tree. */ + static void + objc_postorder_traverse (objc_class_tree *tree, + int level, + void (*function)(objc_class_tree*, int)) + { + struct objc_list *node; + + for (node = tree->subclasses; node; node = node->tail) + objc_postorder_traverse (node->head, level + 1, function); + (*function) (tree, level); + } + + /* Used to print a tree class hierarchy. */ + #ifdef DEBUG + static void + __objc_tree_print (objc_class_tree *tree, int level) + { + int i; + + for (i = 0; i < level; i++) + printf (" "); + printf ("%s\n", tree->class->name); + } + #endif + + /* Walks on a linked list of methods in the reverse order and executes all + the methods corresponding to `op' selector. Walking in the reverse order + assures the +load of class is executed first and then +load of categories + because of the way in which categories are added to the class methods. */ + static void + __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op) + { + int i; + + if (!method_list) + return; + + /* First execute the `op' message in the following method lists */ + __objc_send_message_in_list (method_list->method_next, class, op); + + /* Search the method list. */ + for (i = 0; i < method_list->method_count; i++) + { + Method_t mth = &method_list->method_list[i]; + + if (mth->method_name && sel_eq (mth->method_name, op) + && !hash_is_key_in_hash (__objc_load_methods, mth->method_name)) + { + /* The method was found and wasn't previously executed. */ + (*mth->method_imp) ((id)class, mth->method_name); + + /* Add this method into the +load hash table */ + hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp); + + DEBUG_PRINTF ("sending +load in class: %s\n", class->name); + + break; + } + } + } + + static void + __objc_send_load (objc_class_tree *tree, int level) + { + static SEL load_sel = 0; + Class class = tree->class; + MethodList_t method_list = class->class_pointer->methods; + + if (!load_sel) + load_sel = sel_register_name ("load"); + + __objc_send_message_in_list (method_list, class, load_sel); + } + + static void + __objc_destroy_class_tree_node (objc_class_tree *tree, int level) + { + objc_free (tree); + } + + /* This is used to check if the relationship between two classes before the + runtime completely installs the classes. */ + static BOOL + class_is_subclass_of_class (Class class, Class superclass) + { + for (; class != Nil;) + { + if (class == superclass) + return YES; + class = (class->super_class ? + objc_lookup_class ((char*)class->super_class) + : Nil); + } + + return NO; + } + + /* This list contains all the classes in the runtime system for whom their + superclasses are not yet know to the runtime. */ + static struct objc_list* unresolved_classes = 0; + + /* Extern function used to reference the Object and NXConstantString classes. + */ + + extern void __objc_force_linking (void); + + void + __objc_force_linking (void) + { + extern void __objc_linking (void); + __objc_linking (); + } + + /* Run through the statics list, removing modules as soon as all its statics + have been initialized. */ + static void + objc_init_statics (void) + { + struct objc_list **cell = &uninitialized_statics; + struct objc_static_instances **statics_in_module; + + objc_mutex_lock(__objc_runtime_mutex); + + while (*cell) + { + int module_initialized = 1; + + for (statics_in_module = (*cell)->head; + *statics_in_module; statics_in_module++) + { + struct objc_static_instances *statics = *statics_in_module; + Class class = objc_lookup_class (statics->class_name); + + if (!class) + module_initialized = 0; + /* Actually, the static's class_pointer will be NULL when we + haven't been here before. However, the comparison is to be + reminded of taking into account class posing and to think about + possible semantics... */ + else if (class != statics->instances[0]->class_pointer) + { + id *inst; + + for (inst = &statics->instances[0]; *inst; inst++) + { + (*inst)->class_pointer = class; + + /* ??? Make sure the object will not be freed. With + refcounting, invoke `-retain'. Without refcounting, do + nothing and hope that `-free' will never be invoked. */ + + /* ??? Send the object an `-initStatic' or something to + that effect now or later on? What are the semantics of + statically allocated instances, besides the trivial + NXConstantString, anyway? */ + } + } + } + if (module_initialized) + { + /* Remove this module from the uninitialized list. */ + struct objc_list *this = *cell; + *cell = this->tail; + objc_free(this); + } + else + cell = &(*cell)->tail; + } + + objc_mutex_unlock(__objc_runtime_mutex); + } /* objc_init_statics */ + + /* This function is called by constructor functions generated for each + module compiled. (_GLOBAL_$I$...) The purpose of this function is to + gather the module pointers so that they may be processed by the + initialization routines as soon as possible */ + + void + __objc_exec_class (Module_t module) + { + /* Have we processed any constructors previously? This flag is used to + indicate that some global data structures need to be built. */ + static BOOL previous_constructors = 0; + + static struct objc_list* unclaimed_categories = 0; + + /* The symbol table (defined in objc-api.h) generated by gcc */ + Symtab_t symtab = module->symtab; + + /* The statics in this module */ + struct objc_static_instances **statics + = symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt]; + + /* Entry used to traverse hash lists */ + struct objc_list** cell; + + /* The table of selector references for this module */ + SEL selectors = symtab->refs; + + /* dummy counter */ + int i; + + DEBUG_PRINTF ("received module: %s\n", module->name); + + /* check gcc version */ + init_check_module_version(module); + + /* On the first call of this routine, initialize some data structures. */ + if (!previous_constructors) + { + /* Initialize thread-safe system */ + __objc_init_thread_system(); + __objc_runtime_threads_alive = 1; + __objc_runtime_mutex = objc_mutex_allocate(); + + __objc_init_selector_tables(); + __objc_init_class_tables(); + __objc_init_dispatch_tables(); + __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list); + __objc_load_methods + = hash_new (128, (hash_func_type)hash_ptr, compare_ptrs); + previous_constructors = 1; + } + + /* Save the module pointer for later processing. (not currently used) */ + objc_mutex_lock(__objc_runtime_mutex); + __objc_module_list = list_cons(module, __objc_module_list); + + /* Replace referenced selectors from names to SEL's. */ + if (selectors) + { + for (i = 0; selectors[i].sel_id; ++i) + { + const char *name, *type; + name = (char*)selectors[i].sel_id; + type = (char*)selectors[i].sel_types; + /* Constructors are constant static data so we can safely store + pointers to them in the runtime structures. is_const == YES */ + __sel_register_typed_name (name, type, + (struct objc_selector*)&(selectors[i]), + YES); + } + } + + /* Parse the classes in the load module and gather selector information. */ + DEBUG_PRINTF ("gathering selectors from module: %s\n", module->name); + for (i = 0; i < symtab->cls_def_cnt; ++i) + { + Class class = (Class) symtab->defs[i]; + const char* superclass = (char*)class->super_class; + + /* Make sure we have what we think. */ + assert (CLS_ISCLASS(class)); + assert (CLS_ISMETA(class->class_pointer)); + DEBUG_PRINTF ("phase 1, processing class: %s\n", class->name); + + /* Initialize the subclass list to be NULL. + In some cases it isn't and this crashes the program. */ + class->subclass_list = NULL; + + /* Store the class in the class table and assign class numbers. */ + __objc_add_class_to_hash (class); + + /* Register all of the selectors in the class and meta class. */ + __objc_register_selectors_from_class (class); + __objc_register_selectors_from_class ((Class) class->class_pointer); + + /* Install the fake dispatch tables */ + __objc_install_premature_dtable(class); + __objc_install_premature_dtable(class->class_pointer); + + /* Register the instance methods as class methods, this is + only done for root classes. */ + __objc_register_instance_methods_to_class(class); + + if (class->protocols) + __objc_init_protocols (class->protocols); + + /* Check to see if the superclass is known in this point. If it's not + add the class to the unresolved_classes list. */ + if (superclass && !objc_lookup_class (superclass)) + unresolved_classes = list_cons (class, unresolved_classes); + } + + /* Process category information from the module. */ + for (i = 0; i < symtab->cat_def_cnt; ++i) + { + Category_t category = symtab->defs[i + symtab->cls_def_cnt]; + Class class = objc_lookup_class (category->class_name); + + /* If the class for the category exists then append its methods. */ + if (class) + { + + DEBUG_PRINTF ("processing categories from (module,object): %s, %s\n", + module->name, + class->name); + + /* Do instance methods. */ + if (category->instance_methods) + class_add_method_list (class, category->instance_methods); + + /* Do class methods. */ + if (category->class_methods) + class_add_method_list ((Class) class->class_pointer, + category->class_methods); + + if (category->protocols) + { + __objc_init_protocols (category->protocols); + __objc_class_add_protocols (class, category->protocols); + } + + /* Register the instance methods as class methods, this is + only done for root classes. */ + __objc_register_instance_methods_to_class(class); + } + else + { + /* The object to which the category methods belong can't be found. + Save the information. */ + unclaimed_categories = list_cons(category, unclaimed_categories); + } + } + + if (statics) + uninitialized_statics = list_cons (statics, uninitialized_statics); + if (uninitialized_statics) + objc_init_statics (); + + /* Scan the unclaimed category hash. Attempt to attach any unclaimed + categories to objects. */ + for (cell = &unclaimed_categories; + *cell; + ({ if (*cell) cell = &(*cell)->tail; })) + { + Category_t category = (*cell)->head; + Class class = objc_lookup_class (category->class_name); + + if (class) + { + DEBUG_PRINTF ("attaching stored categories to object: %s\n", + class->name); + + list_remove_head (cell); + + if (category->instance_methods) + class_add_method_list (class, category->instance_methods); + + if (category->class_methods) + class_add_method_list ((Class) class->class_pointer, + category->class_methods); + + if (category->protocols) + { + __objc_init_protocols (category->protocols); + __objc_class_add_protocols (class, category->protocols); + } + + /* Register the instance methods as class methods, this is + only done for root classes. */ + __objc_register_instance_methods_to_class(class); + } + } + + if (unclaimed_proto_list && objc_lookup_class ("Protocol")) + { + list_mapcar (unclaimed_proto_list,(void(*)(void*))__objc_init_protocols); + list_free (unclaimed_proto_list); + unclaimed_proto_list = 0; + } + + objc_send_load (); + + objc_mutex_unlock(__objc_runtime_mutex); + } + + static void objc_send_load (void) + { + if (!__objc_module_list) + return; + + /* Try to find out if all the classes loaded so far also have their + superclasses known to the runtime. We suppose that the objects that are + allocated in the +load method are in general of a class declared in the + same module. */ + if (unresolved_classes) + { + Class class = unresolved_classes->head; + + while (objc_lookup_class ((char*)class->super_class)) + { + list_remove_head (&unresolved_classes); + if (unresolved_classes) + class = unresolved_classes->head; + else + break; + } + + /* + * If we still have classes for whom we don't have yet their super + * classes known to the runtime we don't send the +load messages. + */ + if (unresolved_classes) + return; + } + + /* Special check to allow creating and sending messages to constant strings + in +load methods. If these classes are not yet known, even if all the + other classes are known, delay sending of +load. */ + if (!objc_lookup_class ("NXConstantString") || + !objc_lookup_class ("Object")) + return; + + /* Iterate over all modules in the __objc_module_list and call on them the + __objc_create_classes_tree function. This function creates a tree of + classes that resembles the class hierarchy. */ + list_mapcar (__objc_module_list, (void(*)(void*))__objc_create_classes_tree); + + while (__objc_class_tree_list) + { + #ifdef DEBUG + objc_preorder_traverse (__objc_class_tree_list->head, + 0, __objc_tree_print); + #endif + objc_preorder_traverse (__objc_class_tree_list->head, + 0, __objc_send_load); + objc_postorder_traverse (__objc_class_tree_list->head, + 0, __objc_destroy_class_tree_node); + list_remove_head (&__objc_class_tree_list); + } + + list_mapcar (__objc_module_list, (void(*)(void*))__objc_call_callback); + list_free (__objc_module_list); + __objc_module_list = NULL; + } + + static void + __objc_create_classes_tree (Module_t module) + { + /* The runtime mutex is locked in this point */ + + Symtab_t symtab = module->symtab; + int i; + + /* Iterate thru classes defined in this module and insert them in the classes + tree hierarchy. */ + for (i = 0; i < symtab->cls_def_cnt; i++) + { + Class class = (Class) symtab->defs[i]; + + objc_tree_insert_class (class); + } + } + + static void + __objc_call_callback (Module_t module) + { + /* The runtime mutex is locked in this point */ + + Symtab_t symtab = module->symtab; + int i; + + /* Iterate thru classes defined in this module and call the callback for + each one. */ + for (i = 0; i < symtab->cls_def_cnt; i++) + { + Class class = (Class) symtab->defs[i]; + + /* Call the _objc_load_callback for this class. */ + if (_objc_load_callback) + _objc_load_callback(class, 0); + } + + /* Call the _objc_load_callback for categories. Don't register the instance + methods as class methods for categories to root classes since they were + already added in the class. */ + for (i = 0; i < symtab->cat_def_cnt; i++) + { + Category_t category = symtab->defs[i + symtab->cls_def_cnt]; + Class class = objc_lookup_class (category->class_name); + + if (_objc_load_callback) + _objc_load_callback(class, category); + } + } + + /* Sanity check the version of gcc used to compile `module'*/ + static void init_check_module_version(Module_t module) + { + if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module))) + { + int code; + + if(module->version > OBJC_VERSION) + code = OBJC_ERR_OBJC_VERSION; + else if (module->version < OBJC_VERSION) + code = OBJC_ERR_GCC_VERSION; + else + code = OBJC_ERR_MODULE_SIZE; + + objc_error(nil, code, "Module %s version %d doesn't match runtime %d\n", + module->name, (int)module->version, OBJC_VERSION); + } + } + + static void + __objc_init_protocols (struct objc_protocol_list* protos) + { + int i; + static Class proto_class = 0; + + if (! protos) + return; + + objc_mutex_lock(__objc_runtime_mutex); + + if (!proto_class) + proto_class = objc_lookup_class("Protocol"); + + if (!proto_class) + { + unclaimed_proto_list = list_cons (protos, unclaimed_proto_list); + objc_mutex_unlock(__objc_runtime_mutex); + return; + } + + #if 0 + assert (protos->next == 0); /* only single ones allowed */ + #endif + + for(i = 0; i < protos->count; i++) + { + struct objc_protocol* aProto = protos->list[i]; + if (((size_t)aProto->class_pointer) == PROTOCOL_VERSION) + { + /* assign class pointer */ + aProto->class_pointer = proto_class; + + /* init super protocols */ + __objc_init_protocols (aProto->protocol_list); + } + else if (protos->list[i]->class_pointer != proto_class) + { + objc_error(nil, OBJC_ERR_PROTOCOL_VERSION, + "Version %d doesn't match runtime protocol version %d\n", + (int)((char*)protos->list[i]->class_pointer-(char*)0), + PROTOCOL_VERSION); + } + } + + objc_mutex_unlock(__objc_runtime_mutex); + } + + static void __objc_class_add_protocols (Class class, + struct objc_protocol_list* protos) + { + /* Well... */ + if (! protos) + return; + + /* Add it... */ + protos->next = class->protocols; + class->protocols = protos; + } diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/libobjc.def gcc-2.95/libobjc/libobjc.def *** egcs-1.1.2/libobjc/libobjc.def Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/libobjc.def Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,161 ---- + ; GNU Objective C Runtime DLL Export Definitions + ; Copyright (C) 1997 Free Software Foundation, Inc. + ; Contributed by Scott Christley + ; + ; 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. + + LIBRARY libobjc + EXPORTS + search_for_method_in_list + objc_get_uninstalled_dtable + hash_is_key_in_hash + objc_verror + _objc_load_callback + objc_malloc + objc_atomic_malloc + objc_valloc + objc_realloc + objc_calloc + objc_free + __objc_init_thread_system + objc_mutex_allocate + objc_mutex_deallocate + objc_mutex_lock + objc_mutex_trylock + objc_mutex_unlock + objc_thread_detach + objc_thread_exit + objc_thread_get_data + objc_thread_get_priority + objc_thread_id + objc_thread_set_data + objc_thread_set_priority + objc_thread_yield + __objc_class_name_Object + __objc_class_name_Protocol + __objc_class_name_NXConstantString + objc_error + __objc_object_alloc + __objc_object_copy + __objc_object_dispose + class_create_instance + object_copy + object_dispose + __objc_init_selector_tables + __objc_register_selectors_from_class + __sel_register_typed_name + sel_get_any_typed_uid + sel_get_any_uid + sel_get_name + sel_get_type + sel_get_typed_uid + sel_get_uid + sel_is_mapped + sel_register_name + sel_register_typed_name + sel_types_match + method_get_first_argument + method_get_next_argument + method_get_nth_argument + method_get_number_of_arguments + method_get_sizeof_arguments + objc_aligned_size + objc_alignof_type + objc_get_type_qualifiers + objc_promoted_size + objc_sizeof_type + objc_skip_argspec + objc_skip_offset + objc_skip_type_qualifiers + objc_skip_typespec + __objc_read_nbyte_uint + __objc_read_nbyte_ulong + __objc_write_class + __objc_write_object + __objc_write_selector + objc_close_typed_stream + objc_end_of_typed_stream + objc_flush_typed_stream + objc_get_stream_class_version + objc_open_typed_stream + objc_open_typed_stream_for_file + objc_read_array + objc_read_char + objc_read_int + objc_read_long + objc_read_object + objc_read_selector + objc_read_short + objc_read_string + objc_read_type + objc_read_types + objc_read_unsigned_char + objc_read_unsigned_int + objc_read_unsigned_long + objc_read_unsigned_short + objc_write_array + objc_write_char + objc_write_int + objc_write_long + objc_write_object + objc_write_object_reference + objc_write_root_object + objc_write_selector + objc_write_short + objc_write_string + objc_write_string_atomic + objc_write_type + objc_write_types + objc_write_unsigned_char + objc_write_unsigned_int + objc_write_unsigned_long + objc_write_unsigned_short + __objc_exec_class + __objc_init_dispatch_tables + __objc_install_premature_dtable + __objc_print_dtable_stats + __objc_responds_to + __objc_update_dispatch_table_for_class + class_add_method_list + class_get_class_method + class_get_instance_method + get_imp + nil_method + objc_msg_lookup + objc_msg_lookup_super + objc_msg_sendv + __objc_add_class_to_hash + __objc_init_class_tables + __objc_resolve_class_links + class_pose_as + objc_get_class + objc_get_meta_class + objc_lookup_class + objc_next_class + sarray_at_put + sarray_at_put_safe + sarray_free + sarray_lazy_copy + sarray_new + sarray_realloc + sarray_remove_garbage + hash_add + hash_delete + hash_new + hash_next + hash_remove + hash_value_for_key diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/libobjc_entry.c gcc-2.95/libobjc/libobjc_entry.c *** egcs-1.1.2/libobjc/libobjc_entry.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/libobjc_entry.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,55 ---- + /* GNU Objective C Runtime DLL Entry + Copyright (C) 1997 Free Software Foundation, Inc. + Contributed by Scott Christley + + 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. */ + + #include + + /* + DLL entry function for Objective-C Runtime library + This function gets called everytime a process/thread attaches to DLL + */ + WINBOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, + LPVOID lpReserved) + { + switch(ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + } + return TRUE; + } + + /* + This section terminates the list of imports under GCC. If you do not + include this then you will have problems when linking with DLLs. + */ + asm (".section .idata$3\n" ".long 0,0,0,0,0,0,0,0"); diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/linking.m gcc-2.95/libobjc/linking.m *** egcs-1.1.2/libobjc/linking.m Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/linking.m Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,40 ---- + /* Force linking of classes required by Objective C runtime. + Copyright (C) 1997 Free Software Foundation, Inc. + Contributed by Ovidiu Predescu (ovidiu@net-community.com). + + 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. */ + + #include + #include + + /* Generate references to Object and NXConstanstString classes since they are + needed by the runtime system to run correctly. */ + + + void __objc_linking (void) + { + [Object name]; + [NXConstantString name]; + } + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/makefile.dos gcc-2.95/libobjc/makefile.dos *** egcs-1.1.2/libobjc/makefile.dos Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/makefile.dos Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,56 ---- + # GNU Objective C Runtime Makefile for compiling with djgpp + # Copyright (C) 1993, 1994, 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. + + # This Makefile is configured for GnuMAKE + + GCC_FOR_TARGET=gcc + + .SUFFIXES: .o .m + + OPTIMIZE = -O2 + + # Always search these dirs when compiling. + SUBDIR_INCLUDES = -I. -I.. -I../config + + .c.o: + $(GCC_FOR_TARGET) $(OPTIMIZE) \ + -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $< + + .m.o: + $(GCC_FOR_TARGET) $(OPTIMIZE) -fgnu-runtime \ + -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $< + + OBJC_O = hash.o sarray.o class.o sendmsg.o init.o archive.o \ + selector.o objects.o misc.o object.o protocol.o encoding.o thread.o + + libobjc.a: $(OBJC_O) + -rm -f libobjc.a + ar rc libobjc.a $(OBJC_O) + ranlib libobjc.a + + OBJC_H = hash.h objc-list.h sarray.h objc.h \ + objc-api.h \ + object.h protocol.h mutex.h \ + typedstream.h thread.h + + mostlyclean: + -rm -f *.o libobjc.a xforward fflags + clean: mostlyclean + distclean: mostlyclean + extraclean: mostlyclean diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/misc.c gcc-2.95/libobjc/misc.c *** egcs-1.1.2/libobjc/misc.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/misc.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,180 ---- + /* GNU Objective C Runtime Miscellaneous + Copyright (C) 1993, 1994, 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. */ + + #define __USE_FIXED_PROTOTYPES__ + #include + #include "runtime.h" + + /* + ** Error handler function + ** NULL so that default is to just print to stderr + */ + static objc_error_handler _objc_error_handler = NULL; + + /* Trigger an objc error */ + void + objc_error(id object, int code, const char* fmt, ...) + { + va_list ap; + + va_start(ap, fmt); + objc_verror(object, code, fmt, ap); + va_end(ap); + } + + /* Trigger an objc error */ + void + objc_verror(id object, int code, const char* fmt, va_list ap) + { + BOOL result = NO; + + /* Call the error handler if its there + Otherwise print to stderr */ + if (_objc_error_handler) + result = (*_objc_error_handler)(object, code, fmt, ap); + else + vfprintf (stderr, fmt, ap); + + /* Continue if the error handler says its ok + Otherwise abort the program */ + if (result) + return; + else + abort(); + } + + /* Set the error handler */ + objc_error_handler + objc_set_error_handler(objc_error_handler func) + { + objc_error_handler temp = _objc_error_handler; + _objc_error_handler = func; + return temp; + } + + /* + ** 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* res = (void*) (*_objc_malloc)(size); + if(!res) + objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); + return res; + } + + void * + objc_atomic_malloc(size_t size) + { + void* res = (void*) (*_objc_atomic_malloc)(size); + if(!res) + objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); + return res; + } + + void * + objc_valloc(size_t size) + { + void* res = (void*) (*_objc_valloc)(size); + if(!res) + objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); + return res; + } + + void * + objc_realloc(void *mem, size_t size) + { + void* res = (void*) (*_objc_realloc)(mem, size); + if(!res) + objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); + return res; + } + + void * + objc_calloc(size_t nelem, size_t size) + { + void* res = (void*) (*_objc_calloc)(nelem, size); + if(!res) + objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n"); + return res; + } + + void + objc_free(void *mem) + { + (*_objc_free)(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. + */ + + #if OBJC_WITH_GC + #include + + static void *GC_calloc (size_t nelem, size_t size) + { + void* p = GC_malloc (nelem * size); + if (!p) + objc_error (nil, OBJC_ERR_MEMORY, "Virtual memory exhausted!\n"); + + memset (p, 0, nelem * size); + return p; + } + + static void noFree (void* p) {} + + void *(*_objc_malloc)(size_t) = GC_malloc; + void *(*_objc_atomic_malloc)(size_t) = GC_malloc_atomic; + void *(*_objc_valloc)(size_t) = GC_malloc; + void *(*_objc_realloc)(void *, size_t) = GC_realloc; + void *(*_objc_calloc)(size_t, size_t) = GC_calloc; + void (*_objc_free)(void *) = noFree; + + #else + + void *(*_objc_malloc)(size_t) = malloc; + void *(*_objc_atomic_malloc)(size_t) = malloc; + void *(*_objc_valloc)(size_t) = malloc; + void *(*_objc_realloc)(void *, size_t) = realloc; + void *(*_objc_calloc)(size_t, size_t) = calloc; + void (*_objc_free)(void *) = free; + + + #endif diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/nil_method.c gcc-2.95/libobjc/nil_method.c *** egcs-1.1.2/libobjc/nil_method.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/nil_method.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,40 ---- + /* GNU Objective C Runtime nil receiver function + 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. */ + + /* This is the nil method, the function that is called when the receiver + of a method is nil */ + + #include "runtime.h" + + id + nil_method(id receiver, SEL op, ...) + { + return receiver; + } + + + + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/NXConstStr.h gcc-2.95/libobjc/objc/NXConstStr.h *** egcs-1.1.2/libobjc/objc/NXConstStr.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/NXConstStr.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,44 ---- + /* Interface for the NXConstantString class for Objective-C. + Copyright (C) 1995 Free Software Foundation, Inc. + Contributed by Pieter J. Schoenmakers + + 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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/Object.h gcc-2.95/libobjc/objc/Object.h *** egcs-1.1.2/libobjc/objc/Object.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/Object.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,124 ---- + /* 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 + #include + + /* + * 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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/Protocol.h gcc-2.95/libobjc/objc/Protocol.h *** egcs-1.1.2/libobjc/objc/Protocol.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/Protocol.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,58 ---- + /* 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 __Protocol_INCLUDE_GNU diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/encoding.h gcc-2.95/libobjc/objc/encoding.h *** egcs-1.1.2/libobjc/objc/encoding.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/encoding.h Thu Oct 8 04:23:35 1998 *************** *** 0 **** --- 1,99 ---- + /* 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 + #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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/hash.h gcc-2.95/libobjc/objc/hash.h *** egcs-1.1.2/libobjc/objc/hash.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/hash.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,206 ---- + /* 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 + #include + + /* + * 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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/objc-api.h gcc-2.95/libobjc/objc/objc-api.h *** egcs-1.1.2/libobjc/objc/objc-api.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/objc-api.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,597 ---- + /* 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 + #include + + /* 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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/objc-list.h gcc-2.95/libobjc/objc/objc-list.h *** egcs-1.1.2/libobjc/objc/objc-list.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/objc-list.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,147 ---- + /* 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 __GNU_OBJC_LIST_H diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/objc.h gcc-2.95/libobjc/objc/objc.h *** egcs-1.1.2/libobjc/objc/objc.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/objc.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,158 ---- + /* 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 + + /* + ** 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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/runtime.h gcc-2.95/libobjc/objc/runtime.h *** egcs-1.1.2/libobjc/objc/runtime.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/runtime.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,88 ---- + /* 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 /* for varargs and va_list's */ + + #include + #include + + #include /* 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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/sarray.h gcc-2.95/libobjc/objc/sarray.h *** egcs-1.1.2/libobjc/objc/sarray.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/sarray.h Tue Oct 6 19:21:54 1998 *************** *** 0 **** --- 1,237 ---- + /* 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 + + #include "objc/thr.h" + + extern int nbuckets; /* for stats */ + extern int nindices; + extern int narrays; + extern int idxsize; + + #include + + /* 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< + 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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/thr.h gcc-2.95/libobjc/objc/thr.h *** egcs-1.1.2/libobjc/objc/thr.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/thr.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,143 ---- + /* 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 -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc/typedstream.h gcc-2.95/libobjc/objc/typedstream.h *** egcs-1.1.2/libobjc/objc/typedstream.h Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc/typedstream.h Wed Sep 30 01:17:56 1998 *************** *** 0 **** --- 1,132 ---- + /* 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 + + 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 */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objc-features.texi gcc-2.95/libobjc/objc-features.texi *** egcs-1.1.2/libobjc/objc-features.texi Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objc-features.texi Thu Apr 8 02:23:35 1999 *************** *** 0 **** --- 1,392 ---- + \input texinfo @c -*-texinfo-*- + @c %**start of header + @setfilename objc-features.info + @settitle GNU Objective-C runtime features + @setchapternewpage odd + @c %**end of header + + @node Top, Executing code before main, , (dir), (dir) + @comment node-name, next, previous, up + + @chapter GNU Objective-C runtime features + + This document is meant to describe some of the GNU Objective-C runtime + features. It is not intended to teach you Objective-C, there are several + resources on the Internet that present the language. Questions and + comments about this document to Ovidiu Predescu + @code{}. + + @menu + * Executing code before main:: + * Type encoding:: + * Garbage Collection:: + @end menu + + + @node Executing code before main, What you can and what you cannot do in +load, Top, Top + @section @code{+load}: Executing code before main + + + The GNU Objective-C runtime provides a way that allows you to execute + code before the execution of the program enters the @code{main} + function. The code is executed on a per-class and a per-category basis, + through a special class method @code{+load}. + + This facility is very useful if you want to initialize global variables + which can be accessed by the program directly, without sending a message + to the class first. The usual way to initialize global variables, in the + @code{+initialize} method, might not be useful because + @code{+initialize} is only called when the first message is sent to a + class object, which in some cases could be too late. + + Suppose for example you have a @code{FileStream} class that declares + @code{Stdin}, @code{Stdout} and @code{Stderr} as global variables, like + below: + + @example + + FileStream *Stdin = nil; + FileStream *Stdout = nil; + FileStream *Stderr = nil; + + @@implementation FileStream + + + (void)initialize + @{ + Stdin = [[FileStream new] initWithFd:0]; + Stdout = [[FileStream new] initWithFd:1]; + Stderr = [[FileStream new] initWithFd:2]; + @} + + /* Other methods here */ + @@end + + @end example + + In this example, the initialization of @code{Stdin}, @code{Stdout} and + @code{Stderr} in @code{+initialize} occurs too late. The programmer can + send a message to one of these objects before the variables are actually + initialized, thus sending messages to the @code{nil} object. The + @code{+initialize} method which actually initializes the global + variables is not invoked until the first message is sent to the class + object. The solution would require these variables to be initialized + just before entering @code{main}. + + The correct solution of the above problem is to use the @code{+load} + method instead of @code{+initialize}: + + @example + + @@implementation FileStream + + + (void)load + @{ + Stdin = [[FileStream new] initWithFd:0]; + Stdout = [[FileStream new] initWithFd:1]; + Stderr = [[FileStream new] initWithFd:2]; + @} + + /* Other methods here */ + @@end + + @end example + + The @code{+load} is a method that is not overridden by categories. If a + class and a category of it both implement @code{+load}, both methods are + invoked. This allows some additional initializations to be performed in + a category. + + This mechanism is not intended to be a replacement for @code{+initialize}. + You should be aware of its limitations when you decide to use it + instead of @code{+initialize}. + + @menu + * What you can and what you cannot do in +load:: + @end menu + + + @node What you can and what you cannot do in +load, Type encoding, Executing code before main, Executing code before main + @subsection What you can and what you cannot do in @code{+load} + + The +load implementation in the GNU runtime guarantees you the following + things: + + @itemize @bullet + + @item + you can write whatever C code you like; + + @item + you can send messages to Objective-C constant strings (@@"this is a + constant string"); + + @item + you can allocate and send messages to objects whose class is implemented + in the same file; + + @item + the @code{+load} implementation of all super classes of a class are executed before the @code{+load} of that class is executed; + + @item + the @code{+load} implementation of a class is executed before the + @code{+load} implementation of any category. + + @end itemize + + In particular, the following things, even if they can work in a + particular case, are not guaranteed: + + @itemize @bullet + + @item + allocation of or sending messages to arbitrary objects; + + @item + allocation of or sending messages to objects whose classes have a + category implemented in the same file; + + @end itemize + + You should make no assumptions about receiving @code{+load} in sibling + classes when you write @code{+load} of a class. The order in which + sibling classes receive @code{+load} is not guaranteed. + + The order in which @code{+load} and @code{+initialize} are called could + be problematic if this matters. If you don't allocate objects inside + @code{+load}, it is guaranteed that @code{+load} is called before + @code{+initialize}. If you create an object inside @code{+load} the + @code{+initialize} method of object's class is invoked even if + @code{+load} was not invoked. Note if you explicitly call @code{+load} + on a class, @code{+initialize} will be called first. To avoid possible + problems try to implement only one of these methods. + + The @code{+load} method is also invoked when a bundle is dynamically + loaded into your running program. This happens automatically without any + intervening operation from you. When you write bundles and you need to + write @code{+load} you can safely create and send messages to objects whose + classes already exist in the running program. The same restrictions as + above apply to classes defined in bundle. + + + + @node Type encoding, Garbage Collection, What you can and what you cannot do in +load, Top + @section Type encoding + + The Objective-C compiler generates type encodings for all the + types. These type encodings are used at runtime to find out information + about selectors and methods and about objects and classes. + + The types are encoded in the following way: + + @c @sp 1 + + @multitable @columnfractions .25 .75 + @item @code{char} + @tab @code{c} + @item @code{unsigned char} + @tab @code{C} + @item @code{short} + @tab @code{s} + @item @code{unsigned short} + @tab @code{S} + @item @code{int} + @tab @code{i} + @item @code{unsigned int} + @tab @code{I} + @item @code{long} + @tab @code{l} + @item @code{unsigned long} + @tab @code{L} + @item @code{long long} + @tab @code{q} + @item @code{unsigned long long} + @tab @code{Q} + @item @code{float} + @tab @code{f} + @item @code{double} + @tab @code{d} + @item @code{void} + @tab @code{v} + @item @code{id} + @tab @code{@@} + @item @code{Class} + @tab @code{#} + @item @code{SEL} + @tab @code{:} + @item @code{char*} + @tab @code{*} + @item unknown type + @tab @code{?} + @item bitfields + @tab @code{b} followed by the starting position of the bitfield, the type of the bitfield and the size of the bitfield (the bitfields encoding was changed from the NeXT's compiler encoding, see below) + @end multitable + + @c @sp 1 + + The encoding of bitfields has changed to allow bitfields to be properly + handled by the runtime functions that compute sizes and alignments of + types that contain bitfields. The previous encoding contained only the + size of the bitfield. Using only this information it is not possible to + reliably compute the size occupied by the bitfield. This is very + important in the presence of the Boehm's garbage collector because the + objects are allocated using the typed memory facility available in this + collector. The typed memory allocation requires information about where + the pointers are located inside the object. + + The position in the bitfield is the position, counting in bits, of the + bit closest to the beginning of the structure. + + The non-atomic types are encoded as follows: + + @c @sp 1 + + @multitable @columnfractions .2 .8 + @item pointers + @tab @code{'^'} followed by the pointed type. + @item arrays + @tab @code{'['} followed by the number of elements in the array followed by the type of the elements followed by @code{']'} + @item structures + @tab @code{'@{'} followed by the name of the structure (or '?' if the structure is unnamed), the '=' sign, the type of the members and by @code{'@}'} + @item unions + @tab @code{'('} followed by the name of the structure (or '?' if the union is unnamed), the '=' sign, the type of the members followed by @code{')'} + @end multitable + + Here are some types and their encodings, as they are generated by the + compiler on a i386 machine: + + @sp 1 + + @multitable @columnfractions .25 .75 + @item Objective-C type + @tab Compiler encoding + @item + @example + int a[10]; + @end example + @tab @code{[10i]} + @item + @example + struct @{ + int i; + float f[3]; + int a:3; + int b:2; + char c; + @} + @end example + @tab @code{@{?=i[3f]b128i3b131i2c@}} + @end multitable + + @sp 1 + + In addition to the types the compiler also encodes the type + specifiers. The table below describes the encoding of the current + Objective-C type specifiers: + + @sp 1 + + @multitable @columnfractions .25 .75 + @item Specifier + @tab Encoding + @item @code{const} + @tab @code{r} + @item @code{in} + @tab @code{n} + @item @code{inout} + @tab @code{N} + @item @code{out} + @tab @code{o} + @item @code{bycopy} + @tab @code{O} + @item @code{oneway} + @tab @code{V} + @end multitable + + @sp 1 + + The type specifiers are encoded just before the type. Unlike types + however, the type specifiers are only encoded when they appear in method + argument types. + + + @node Garbage Collection, , Type encoding, Top + + @page + @section Garbage Collection + + Support for a new memory management policy has been added by using a + powerful conservative garbage collector, known as the + Boehm-Demers-Weiser conservative garbage collector. It is available from + @w{@uref{http://reality.sgi.com/boehm_mti/gc.html}}. + + To enable the support for it you have to configure the compiler using an + additional argument, @w{@kbd{--enable-objc-gc}}. You need to have + garbage collector installed before building the compiler. This will + build an additional runtime library which has several enhancements to + support the garbage collector. The new library has a new name, + @kbd{libobjc_gc.a} to not conflict with the non-garbage-collected + library. + + When the garbage collector is used, the objects are allocated using the + so-called typed memory allocation mechanism available in the + Boehm-Demers-Weiser collector. This mode requires precise information on + where pointers are located inside objects. This information is computed + once per class, immediately after the class has been initialized. + + There is a new runtime function @code{class_ivar_set_gcinvisible()} + which can be used to declare a so-called @strong{weak pointer} + reference. Such a pointer is basically hidden for the garbage collector; + this can be useful in certain situations, especially when you want to + keep track of the allocated objects, yet allow them to be + collected. This kind of pointers can only be members of objects, you + cannot declare a global pointer as a weak reference. Every type which is + a pointer type can be declared a weak pointer, including @code{id}, + @code{Class} and @code{SEL}. + + Here is an example of how to use this feature. Suppose you want to + implement a class whose instances hold a weak pointer reference; the + following class does this: + + @example + + @@interface WeakPointer : Object + @{ + const void* weakPointer; + @} + + - initWithPointer:(const void*)p; + - (const void*)weakPointer; + @@end + + + @@implementation WeakPointer + + + (void)initialize + @{ + class_ivar_set_gcinvisible (self, "weakPointer", YES); + @} + + - initWithPointer:(const void*)p + @{ + weakPointer = p; + return self; + @} + + - (const void*)weakPointer + @{ + return weakPointer; + @} + + @@end + + @end example + + Weak pointers are supported through a new type character specifier + represented by the @code{'!'} character. The + @code{class_ivar_set_gcinvisible()} function adds or removes this + specifier to the string type description of the instance variable named + as argument. + + + @bye + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/objects.c gcc-2.95/libobjc/objects.c *** egcs-1.1.2/libobjc/objects.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/objects.c Tue Sep 29 19:13:11 1998 *************** *** 0 **** --- 1,105 ---- + /* GNU Objective C Runtime class related functions + 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. */ + + #include "tconfig.h" /* include defs of bzero for target */ + #include "objc.h" + #include "runtime.h" /* the kitchen sink */ + + #if OBJC_WITH_GC + # include + #endif + + id __objc_object_alloc(Class); + id __objc_object_dispose(id); + id __objc_object_copy(id); + + id (*_objc_object_alloc)(Class) = __objc_object_alloc; /* !T:SINGLE */ + id (*_objc_object_dispose)(id) = __objc_object_dispose; /* !T:SINGLE */ + id (*_objc_object_copy)(id) = __objc_object_copy; /* !T:SINGLE */ + + id + class_create_instance(Class class) + { + id new = nil; + + #if OBJC_WITH_GC + if (CLS_ISCLASS(class)) + new = (id)GC_malloc_explicitly_typed (class->instance_size, + class->gc_object_type); + #else + if (CLS_ISCLASS(class)) + new = (*_objc_object_alloc)(class); + #endif + + if (new!=nil) + { + memset (new, 0, class->instance_size); + new->class_pointer = class; + } + return new; + } + + id + object_copy(id object) + { + if ((object!=nil)&&CLS_ISCLASS(object->class_pointer)) + return (*_objc_object_copy)(object); + else + return nil; + } + + id + object_dispose(id object) + { + if ((object!=nil)&&CLS_ISCLASS(object->class_pointer)) + { + if (_objc_object_dispose) + (*_objc_object_dispose)(object); + else + objc_free(object); + } + return nil; + } + + id __objc_object_alloc(Class class) + { + return (id)objc_malloc(class->instance_size); + } + + id __objc_object_dispose(id object) + { + objc_free(object); + return 0; + } + + id __objc_object_copy(id object) + { + id copy = class_create_instance(object->class_pointer); + memcpy(copy, object, object->class_pointer->instance_size); + return copy; + } + + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/sarray.c gcc-2.95/libobjc/sarray.c *** egcs-1.1.2/libobjc/sarray.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/sarray.c Tue Sep 29 19:13:12 1998 *************** *** 0 **** --- 1,522 ---- + /* Sparse Arrays for Objective C dispatch tables + 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. */ + + #include "sarray.h" + #include "runtime.h" + #include + #include "assert.h" + + int nbuckets = 0; /* !T:MUTEX */ + int nindices = 0; /* !T:MUTEX */ + int narrays = 0; /* !T:MUTEX */ + int idxsize = 0; /* !T:MUTEX */ + + static void * first_free_data = NULL; /* !T:MUTEX */ + + #ifdef OBJC_SPARSE2 + const char* __objc_sparse2_id = "2 level sparse indices"; + #endif + + #ifdef OBJC_SPARSE3 + const char* __objc_sparse3_id = "3 level sparse indices"; + #endif + + #ifdef __alpha__ + const void *memcpy (void*, const void*, size_t); + #endif + + /* This function removes any structures left over from free operations + that were not safe in a multi-threaded environment. */ + void + sarray_remove_garbage(void) + { + void **vp; + void *np; + + objc_mutex_lock(__objc_runtime_mutex); + + vp = first_free_data; + first_free_data = NULL; + + while (vp) { + np = *vp; + objc_free(vp); + vp = np; + } + + objc_mutex_unlock(__objc_runtime_mutex); + } + + /* Free a block of dynamically allocated memory. If we are in multi-threaded + mode, it is ok to free it. If not, we add it to the garbage heap to be + freed later. */ + + static void + sarray_free_garbage(void *vp) + { + objc_mutex_lock(__objc_runtime_mutex); + + if (__objc_runtime_threads_alive == 1) { + objc_free(vp); + if (first_free_data) + sarray_remove_garbage(); + } + else { + *(void **)vp = first_free_data; + first_free_data = vp; + } + + objc_mutex_unlock(__objc_runtime_mutex); + } + + /* sarray_at_put : copies data in such a way as to be thread reader safe. */ + void + sarray_at_put(struct sarray* array, sidx index, void* element) + { + #ifdef OBJC_SPARSE3 + struct sindex** the_index; + struct sindex* new_index; + #endif + struct sbucket** the_bucket; + struct sbucket* new_bucket; + #ifdef OBJC_SPARSE3 + size_t ioffset; + #endif + size_t boffset; + size_t eoffset; + #ifdef PRECOMPUTE_SELECTORS + union sofftype xx; + xx.idx = index; + #ifdef OBJC_SPARSE3 + ioffset = xx.off.ioffset; + #endif + boffset = xx.off.boffset; + eoffset = xx.off.eoffset; + #else /* not PRECOMPUTE_SELECTORS */ + #ifdef OBJC_SPARSE3 + ioffset = index/INDEX_CAPACITY; + boffset = (index/BUCKET_SIZE)%INDEX_SIZE; + eoffset = index%BUCKET_SIZE; + #else + boffset = index/BUCKET_SIZE; + eoffset = index%BUCKET_SIZE; + #endif + #endif /* not PRECOMPUTE_SELECTORS */ + + assert(soffset_decode(index) < array->capacity); /* Range check */ + + #ifdef OBJC_SPARSE3 + the_index = &(array->indices[ioffset]); + the_bucket = &((*the_index)->buckets[boffset]); + #else + the_bucket = &(array->buckets[boffset]); + #endif + + if ((*the_bucket)->elems[eoffset] == element) + return; /* great! we just avoided a lazy copy */ + + #ifdef OBJC_SPARSE3 + + /* First, perform lazy copy/allocation of index if needed */ + + if ((*the_index) == array->empty_index) { + + /* The index was previously empty, allocate a new */ + new_index = (struct sindex*)objc_malloc(sizeof(struct sindex)); + memcpy(new_index, array->empty_index, sizeof(struct sindex)); + new_index->version.version = array->version.version; + *the_index = new_index; /* Prepared for install. */ + the_bucket = &((*the_index)->buckets[boffset]); + + nindices += 1; + } else if ((*the_index)->version.version != array->version.version) { + + /* This index must be lazy copied */ + struct sindex* old_index = *the_index; + new_index = (struct sindex*)objc_malloc(sizeof(struct sindex)); + memcpy( new_index, old_index, sizeof(struct sindex)); + new_index->version.version = array->version.version; + *the_index = new_index; /* Prepared for install. */ + the_bucket = &((*the_index)->buckets[boffset]); + + nindices += 1; + } + + #endif /* OBJC_SPARSE3 */ + + /* next, perform lazy allocation/copy of the bucket if needed */ + + if ((*the_bucket) == array->empty_bucket) { + + /* The bucket was previously empty (or something like that), */ + /* allocate a new. This is the effect of `lazy' allocation */ + new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket)); + memcpy((void *) new_bucket, (const void*)array->empty_bucket, + sizeof(struct sbucket)); + new_bucket->version.version = array->version.version; + *the_bucket = new_bucket; /* Prepared for install. */ + + nbuckets += 1; + + } else if ((*the_bucket)->version.version != array->version.version) { + + /* Perform lazy copy. */ + struct sbucket* old_bucket = *the_bucket; + new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket)); + memcpy( new_bucket, old_bucket, sizeof(struct sbucket)); + new_bucket->version.version = array->version.version; + *the_bucket = new_bucket; /* Prepared for install. */ + + nbuckets += 1; + + } + (*the_bucket)->elems[eoffset] = element; + } + + void + sarray_at_put_safe(struct sarray* array, sidx index, void* element) + { + if(soffset_decode(index) >= array->capacity) + sarray_realloc(array, soffset_decode(index)+1); + sarray_at_put(array, index, element); + } + + struct sarray* + sarray_new (int size, void* default_element) + { + struct sarray* arr; + #ifdef OBJC_SPARSE3 + size_t num_indices = ((size-1)/(INDEX_CAPACITY))+1; + struct sindex ** new_indices; + #else /* OBJC_SPARSE2 */ + size_t num_indices = ((size-1)/BUCKET_SIZE)+1; + struct sbucket ** new_buckets; + #endif + int counter; + + assert(size > 0); + + /* Allocate core array */ + arr = (struct sarray*) objc_malloc(sizeof(struct sarray)); + arr->version.version = 0; + + /* Initialize members */ + #ifdef OBJC_SPARSE3 + arr->capacity = num_indices*INDEX_CAPACITY; + new_indices = (struct sindex**) + objc_malloc(sizeof(struct sindex*)*num_indices); + + arr->empty_index = (struct sindex*) objc_malloc(sizeof(struct sindex)); + arr->empty_index->version.version = 0; + + narrays += 1; + idxsize += num_indices; + nindices += 1; + + #else /* OBJC_SPARSE2 */ + arr->capacity = num_indices*BUCKET_SIZE; + new_buckets = (struct sbucket**) + objc_malloc(sizeof(struct sbucket*)*num_indices); + + narrays += 1; + idxsize += num_indices; + + #endif + + arr->empty_bucket = (struct sbucket*) objc_malloc(sizeof(struct sbucket)); + arr->empty_bucket->version.version = 0; + + nbuckets += 1; + + arr->ref_count = 1; + arr->is_copy_of = (struct sarray*)0; + + for (counter=0; counterempty_bucket->elems[counter] = default_element; + + #ifdef OBJC_SPARSE3 + for (counter=0; counterempty_index->buckets[counter] = arr->empty_bucket; + + for (counter=0; counterempty_index; + + #else /* OBJC_SPARSE2 */ + + for (counter=0; counterempty_bucket; + + #endif + + #ifdef OBJC_SPARSE3 + arr->indices = new_indices; + #else /* OBJC_SPARSE2 */ + arr->buckets = new_buckets; + #endif + + return arr; + } + + + /* Reallocate the sparse array to hold `newsize' entries + Note: We really allocate and then free. We have to do this to ensure that + any concurrent readers notice the update. */ + + void + sarray_realloc(struct sarray* array, int newsize) + { + #ifdef OBJC_SPARSE3 + size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY; + size_t new_max_index = ((newsize-1)/INDEX_CAPACITY); + size_t rounded_size = (new_max_index+1)*INDEX_CAPACITY; + + struct sindex ** new_indices; + struct sindex ** old_indices; + + #else /* OBJC_SPARSE2 */ + size_t old_max_index = (array->capacity-1)/BUCKET_SIZE; + size_t new_max_index = ((newsize-1)/BUCKET_SIZE); + size_t rounded_size = (new_max_index+1)*BUCKET_SIZE; + + struct sbucket ** new_buckets; + struct sbucket ** old_buckets; + + #endif + + int counter; + + assert(newsize > 0); + + /* The size is the same, just ignore the request */ + if(rounded_size <= array->capacity) + return; + + assert(array->ref_count == 1); /* stop if lazy copied... */ + + /* We are asked to extend the array -- allocate new bucket table, */ + /* and insert empty_bucket in newly allocated places. */ + if(rounded_size > array->capacity) + { + + #ifdef OBJC_SPARSE3 + new_max_index += 4; + rounded_size = (new_max_index+1)*INDEX_CAPACITY; + + #else /* OBJC_SPARSE2 */ + new_max_index += 4; + rounded_size = (new_max_index+1)*BUCKET_SIZE; + #endif + + /* update capacity */ + array->capacity = rounded_size; + + #ifdef OBJC_SPARSE3 + /* alloc to force re-read by any concurrent readers. */ + old_indices = array->indices; + new_indices = (struct sindex**) + objc_malloc((new_max_index+1)*sizeof(struct sindex*)); + #else /* OBJC_SPARSE2 */ + old_buckets = array->buckets; + new_buckets = (struct sbucket**) + objc_malloc((new_max_index+1)*sizeof(struct sbucket*)); + #endif + + /* copy buckets below old_max_index (they are still valid) */ + for(counter = 0; counter <= old_max_index; counter++ ) { + #ifdef OBJC_SPARSE3 + new_indices[counter] = old_indices[counter]; + #else /* OBJC_SPARSE2 */ + new_buckets[counter] = old_buckets[counter]; + #endif + } + + #ifdef OBJC_SPARSE3 + /* reset entries above old_max_index to empty_bucket */ + for(counter = old_max_index+1; counter <= new_max_index; counter++) + new_indices[counter] = array->empty_index; + #else /* OBJC_SPARSE2 */ + /* reset entries above old_max_index to empty_bucket */ + for(counter = old_max_index+1; counter <= new_max_index; counter++) + new_buckets[counter] = array->empty_bucket; + #endif + + #ifdef OBJC_SPARSE3 + /* install the new indices */ + array->indices = new_indices; + #else /* OBJC_SPARSE2 */ + array->buckets = new_buckets; + #endif + + #ifdef OBJC_SPARSE3 + /* free the old indices */ + sarray_free_garbage(old_indices); + #else /* OBJC_SPARSE2 */ + sarray_free_garbage(old_buckets); + #endif + + idxsize += (new_max_index-old_max_index); + return; + } + } + + + /* Free a sparse array allocated with sarray_new */ + + void + sarray_free(struct sarray* array) { + + #ifdef OBJC_SPARSE3 + size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY; + struct sindex ** old_indices; + #else + size_t old_max_index = (array->capacity-1)/BUCKET_SIZE; + struct sbucket ** old_buckets; + #endif + int counter = 0; + + assert(array->ref_count != 0); /* Freed multiple times!!! */ + + if(--(array->ref_count) != 0) /* There exists copies of me */ + return; + + #ifdef OBJC_SPARSE3 + old_indices = array->indices; + #else + old_buckets = array->buckets; + #endif + + if((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0)) + sarray_free(array->is_copy_of); + + /* Free all entries that do not point to empty_bucket */ + for(counter = 0; counter <= old_max_index; counter++ ) { + #ifdef OBJC_SPARSE3 + struct sindex* idx = old_indices[counter]; + if((idx != array->empty_index) && + (idx->version.version == array->version.version)) { + int c2; + for(c2=0; c2buckets[c2]; + if((bkt != array->empty_bucket) && + (bkt->version.version == array->version.version)) + { + sarray_free_garbage(bkt); + nbuckets -= 1; + } + } + sarray_free_garbage(idx); + nindices -= 1; + } + #else /* OBJC_SPARSE2 */ + struct sbucket* bkt = array->buckets[counter]; + if ((bkt != array->empty_bucket) && + (bkt->version.version == array->version.version)) + { + sarray_free_garbage(bkt); + nbuckets -= 1; + } + #endif + } + + #ifdef OBJC_SPARSE3 + /* free empty_index */ + if(array->empty_index->version.version == array->version.version) { + sarray_free_garbage(array->empty_index); + nindices -= 1; + } + #endif + + /* free empty_bucket */ + if(array->empty_bucket->version.version == array->version.version) { + sarray_free_garbage(array->empty_bucket); + nbuckets -= 1; + } + idxsize -= (old_max_index+1); + narrays -= 1; + + #ifdef OBJC_SPARSE3 + /* free bucket table */ + sarray_free_garbage(array->indices); + + #else + /* free bucket table */ + sarray_free_garbage(array->buckets); + + #endif + + /* free array */ + sarray_free_garbage(array); + } + + /* This is a lazy copy. Only the core of the structure is actually */ + /* copied. */ + + struct sarray* + sarray_lazy_copy(struct sarray* oarr) + { + struct sarray* arr; + + #ifdef OBJC_SPARSE3 + size_t num_indices = ((oarr->capacity-1)/INDEX_CAPACITY)+1; + struct sindex ** new_indices; + #else /* OBJC_SPARSE2 */ + size_t num_indices = ((oarr->capacity-1)/BUCKET_SIZE)+1; + struct sbucket ** new_buckets; + #endif + + /* Allocate core array */ + arr = (struct sarray*) objc_malloc(sizeof(struct sarray)); /* !!! */ + arr->version.version = oarr->version.version + 1; + #ifdef OBJC_SPARSE3 + arr->empty_index = oarr->empty_index; + #endif + arr->empty_bucket = oarr->empty_bucket; + arr->ref_count = 1; + oarr->ref_count += 1; + arr->is_copy_of = oarr; + arr->capacity = oarr->capacity; + + #ifdef OBJC_SPARSE3 + /* Copy bucket table */ + new_indices = (struct sindex**) + objc_malloc(sizeof(struct sindex*)*num_indices); + memcpy( new_indices,oarr->indices, + sizeof(struct sindex*)*num_indices); + arr->indices = new_indices; + #else + /* Copy bucket table */ + new_buckets = (struct sbucket**) + objc_malloc(sizeof(struct sbucket*)*num_indices); + memcpy( new_buckets,oarr->buckets, + sizeof(struct sbucket*)*num_indices); + arr->buckets = new_buckets; + #endif + + idxsize += num_indices; + narrays += 1; + + return arr; + } diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/selector.c gcc-2.95/libobjc/selector.c *** egcs-1.1.2/libobjc/selector.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/selector.c Tue Sep 29 19:13:13 1998 *************** *** 0 **** --- 1,458 ---- + /* GNU Objective C Runtime selector related functions + 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. */ + + #include "runtime.h" + #include "sarray.h" + #include "encoding.h" + + /* Initial selector hash table size. Value doesn't matter much */ + #define SELECTOR_HASH_SIZE 128 + + /* Tables mapping selector names to uid and opposite */ + static struct sarray* __objc_selector_array = 0; /* uid -> sel !T:MUTEX */ + static struct sarray* __objc_selector_names = 0; /* uid -> name !T:MUTEX */ + static cache_ptr __objc_selector_hash = 0; /* name -> uid !T:MUTEX */ + + static void register_selectors_from_list(MethodList_t); + + /* Number of selectors stored in each of the above tables */ + int __objc_selector_max_index = 0; /* !T:MUTEX */ + + void __objc_init_selector_tables() + { + __objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0); + __objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0); + __objc_selector_hash + = hash_new (SELECTOR_HASH_SIZE, + (hash_func_type) hash_string, + (compare_func_type) compare_strings); + } + + /* This routine is given a class and records all of the methods in its class + structure in the record table. */ + void + __objc_register_selectors_from_class (Class class) + { + MethodList_t method_list; + + method_list = class->methods; + while (method_list) + { + register_selectors_from_list (method_list); + method_list = method_list->method_next; + } + } + + + /* This routine is given a list of methods and records each of the methods in + the record table. This is the routine that does the actual recording + work. + + This one is only called for Class objects. For categories, + class_add_method_list is called. + */ + static void + register_selectors_from_list (MethodList_t method_list) + { + int i = 0; + while (i < method_list->method_count) + { + Method_t method = &method_list->method_list[i]; + method->method_name + = sel_register_typed_name ((const char*)method->method_name, + method->method_types); + i += 1; + } + } + + + /* Register instance methods as class methods for root classes */ + void __objc_register_instance_methods_to_class(Class class) + { + MethodList_t method_list; + MethodList_t class_method_list; + int max_methods_no = 16; + MethodList_t new_list; + Method_t curr_method; + + /* Only if a root class. */ + if(class->super_class) + return; + + /* Allocate a method list to hold the new class methods */ + new_list = objc_calloc(sizeof(struct objc_method_list) + + sizeof(struct objc_method[max_methods_no]), 1); + method_list = class->methods; + class_method_list = class->class_pointer->methods; + curr_method = &new_list->method_list[0]; + + /* Iterate through the method lists for the class */ + while (method_list) + { + int i; + + /* Iterate through the methods from this method list */ + for (i = 0; i < method_list->method_count; i++) + { + Method_t mth = &method_list->method_list[i]; + if (mth->method_name + && !search_for_method_in_list (class_method_list, + mth->method_name)) + { + /* This instance method isn't a class method. + Add it into the new_list. */ + *curr_method = *mth; + + /* Reallocate the method list if necessary */ + if(++new_list->method_count == max_methods_no) + new_list = + objc_realloc(new_list, sizeof(struct objc_method_list) + + sizeof(struct + objc_method[max_methods_no += 16])); + curr_method = &new_list->method_list[new_list->method_count]; + } + } + + method_list = method_list->method_next; + } + + /* If we created any new class methods + then attach the method list to the class */ + if (new_list->method_count) + { + new_list = + objc_realloc(new_list, sizeof(struct objc_method_list) + + sizeof(struct objc_method[new_list->method_count])); + new_list->method_next = class->class_pointer->methods; + class->class_pointer->methods = new_list; + } + + __objc_update_dispatch_table_for_class (class->class_pointer); + } + + + /* Returns YES iff t1 and t2 have same method types, but we ignore + the argframe layout */ + BOOL + sel_types_match (const char* t1, const char* t2) + { + if (!t1 || !t2) + return NO; + while (*t1 && *t2) + { + if (*t1 == '+') t1++; + if (*t2 == '+') t2++; + while (isdigit(*t1)) t1++; + while (isdigit(*t2)) t2++; + /* xxx Remove these next two lines when qualifiers are put in + all selectors, not just Protocol selectors. */ + t1 = objc_skip_type_qualifiers(t1); + t2 = objc_skip_type_qualifiers(t2); + if (!*t1 && !*t2) + return YES; + if (*t1 != *t2) + return NO; + t1++; + t2++; + } + return NO; + } + + /* return selector representing name */ + SEL + sel_get_typed_uid (const char *name, const char *types) + { + struct objc_list *l; + sidx i; + + objc_mutex_lock(__objc_runtime_mutex); + + i = (sidx) hash_value_for_key (__objc_selector_hash, name); + if (i == 0) + { + objc_mutex_unlock(__objc_runtime_mutex); + return 0; + } + + for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); + l; l = l->tail) + { + SEL s = (SEL)l->head; + if (types == 0 || s->sel_types == 0) + { + if (s->sel_types == types) + { + objc_mutex_unlock(__objc_runtime_mutex); + return s; + } + } + else if (sel_types_match (s->sel_types, types)) + { + objc_mutex_unlock(__objc_runtime_mutex); + return s; + } + } + + objc_mutex_unlock(__objc_runtime_mutex); + return 0; + } + + /* Return selector representing name; prefer a selector with non-NULL type */ + SEL + sel_get_any_typed_uid (const char *name) + { + struct objc_list *l; + sidx i; + SEL s = NULL; + + objc_mutex_lock(__objc_runtime_mutex); + + i = (sidx) hash_value_for_key (__objc_selector_hash, name); + if (i == 0) + { + objc_mutex_unlock(__objc_runtime_mutex); + return 0; + } + + for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); + l; l = l->tail) + { + s = (SEL) l->head; + if (s->sel_types) + { + objc_mutex_unlock(__objc_runtime_mutex); + return s; + } + } + + objc_mutex_unlock(__objc_runtime_mutex); + return s; + } + + /* return selector representing name */ + SEL + sel_get_any_uid (const char *name) + { + struct objc_list *l; + sidx i; + + objc_mutex_lock(__objc_runtime_mutex); + + i = (sidx) hash_value_for_key (__objc_selector_hash, name); + if (soffset_decode (i) == 0) + { + objc_mutex_unlock(__objc_runtime_mutex); + return 0; + } + + l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); + objc_mutex_unlock(__objc_runtime_mutex); + + if (l == 0) + return 0; + + return (SEL)l->head; + } + + /* return selector representing name */ + SEL + sel_get_uid (const char *name) + { + return sel_register_typed_name (name, 0); + } + + /* Get name of selector. If selector is unknown, the empty string "" + is returned */ + const char* + sel_get_name (SEL selector) + { + const char *ret; + + objc_mutex_lock(__objc_runtime_mutex); + if ((soffset_decode((sidx)selector->sel_id) > 0) + && (soffset_decode((sidx)selector->sel_id) <= __objc_selector_max_index)) + ret = sarray_get_safe (__objc_selector_names, (sidx) selector->sel_id); + else + ret = 0; + objc_mutex_unlock(__objc_runtime_mutex); + return ret; + } + + BOOL + sel_is_mapped (SEL selector) + { + unsigned int idx = soffset_decode ((sidx)selector->sel_id); + return ((idx > 0) && (idx <= __objc_selector_max_index)); + } + + + const char* + sel_get_type (SEL selector) + { + if (selector) + return selector->sel_types; + else + return 0; + } + + /* The uninstalled dispatch table */ + extern struct sarray* __objc_uninstalled_dtable; + + /* Store the passed selector name in the selector record and return its + selector value (value returned by sel_get_uid). + Assumes that the calling function has locked down __objc_runtime_mutex. */ + /* is_const parameter tells us if the name and types parameters + are really constant or not. If YES then they are constant and + we can just store the pointers. If NO then we need to copy + name and types because the pointers may disappear later on. */ + SEL + __sel_register_typed_name (const char *name, const char *types, + struct objc_selector *orig, BOOL is_const) + { + struct objc_selector* j; + sidx i; + struct objc_list *l; + + i = (sidx) hash_value_for_key (__objc_selector_hash, name); + if (soffset_decode (i) != 0) + { + for (l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); + l; l = l->tail) + { + SEL s = (SEL)l->head; + if (types == 0 || s->sel_types == 0) + { + if (s->sel_types == types) + { + if (orig) + { + orig->sel_id = (void*)i; + return orig; + } + else + return s; + } + } + else if (!strcmp (s->sel_types, types)) + { + if (orig) + { + orig->sel_id = (void*)i; + return orig; + } + else + return s; + } + } + if (orig) + j = orig; + else + j = objc_malloc (sizeof (struct objc_selector)); + + j->sel_id = (void*)i; + /* Can we use the pointer or must copy types? Don't copy if NULL */ + if ((is_const) || (types == 0)) + j->sel_types = (const char*)types; + else { + j->sel_types = (char *) objc_malloc(strlen(types)+1); + strcpy((char *)j->sel_types, types); + } + l = (struct objc_list*)sarray_get_safe (__objc_selector_array, i); + } + else + { + __objc_selector_max_index += 1; + i = soffset_encode(__objc_selector_max_index); + if (orig) + j = orig; + else + j = objc_malloc (sizeof (struct objc_selector)); + + j->sel_id = (void*)i; + /* Can we use the pointer or must copy types? Don't copy if NULL */ + if ((is_const) || (types == 0)) + j->sel_types = (const char*)types; + else { + j->sel_types = (char *) objc_malloc(strlen(types)+1); + strcpy((char *)j->sel_types, types); + } + l = 0; + } + + DEBUG_PRINTF ("Record selector %s[%s] as: %ld\n", name, types, + soffset_decode (i)); + + { + int is_new = (l == 0); + const char *new_name; + + /* Can we use the pointer or must copy name? Don't copy if NULL */ + if ((is_const) || (name == 0)) + new_name = name; + else { + new_name = (char *) objc_malloc(strlen(name)+1); + strcpy((char *)new_name, name); + } + + l = list_cons ((void*)j, l); + sarray_at_put_safe (__objc_selector_names, i, (void *) new_name); + sarray_at_put_safe (__objc_selector_array, i, (void *) l); + if (is_new) + hash_add (&__objc_selector_hash, (void *) new_name, (void *) i); + } + + sarray_realloc(__objc_uninstalled_dtable, __objc_selector_max_index+1); + + return (SEL) j; + } + + SEL + sel_register_name (const char *name) + { + SEL ret; + + objc_mutex_lock(__objc_runtime_mutex); + /* Assume that name is not constant static memory and needs to be + copied before put into a runtime structure. is_const == NO */ + ret = __sel_register_typed_name (name, 0, 0, NO); + objc_mutex_unlock(__objc_runtime_mutex); + + return ret; + } + + SEL + sel_register_typed_name (const char *name, const char *type) + { + SEL ret; + + objc_mutex_lock(__objc_runtime_mutex); + /* Assume that name and type are not constant static memory and need to + be copied before put into a runtime structure. is_const == NO */ + ret = __sel_register_typed_name (name, type, 0, NO); + objc_mutex_unlock(__objc_runtime_mutex); + + return ret; + } + diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/sendmsg.c gcc-2.95/libobjc/sendmsg.c *** egcs-1.1.2/libobjc/sendmsg.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/sendmsg.c Tue Sep 29 19:13:14 1998 *************** *** 0 **** --- 1,648 ---- + /* GNU Objective C Runtime message lookup + Copyright (C) 1993, 1995, 1996, 1997, 1998 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. */ + + #include "tconfig.h" + #include "runtime.h" + #include "sarray.h" + #include "encoding.h" + #include "runtime-info.h" + + /* this is how we hack STRUCT_VALUE to be 1 or 0 */ + #define gen_rtx(args...) 1 + #define gen_rtx_MEM(args...) 1 + #define rtx int + + #if !defined(STRUCT_VALUE) || STRUCT_VALUE == 0 + #define INVISIBLE_STRUCT_RETURN 1 + #else + #define INVISIBLE_STRUCT_RETURN 0 + #endif + + /* The uninstalled dispatch table */ + struct sarray* __objc_uninstalled_dtable = 0; /* !T:MUTEX */ + + /* Send +initialize to class */ + static void __objc_send_initialize(Class); + + static void __objc_install_dispatch_table_for_class (Class); + + /* Forward declare some functions */ + static void __objc_init_install_dtable(id, SEL); + + /* Various forwarding functions that are used based upon the + return type for the selector. + __objc_block_forward for structures. + __objc_double_forward for floats/doubles. + __objc_word_forward for pointers or types that fit in registers. + */ + static double __objc_double_forward(id, SEL, ...); + static id __objc_word_forward(id, SEL, ...); + typedef struct { id many[8]; } __big; + #if INVISIBLE_STRUCT_RETURN + static __big + #else + static id + #endif + __objc_block_forward(id, SEL, ...); + static Method_t search_for_method_in_hierarchy (Class class, SEL sel); + Method_t search_for_method_in_list(MethodList_t list, SEL op); + id nil_method(id, SEL, ...); + + /* Given a selector, return the proper forwarding implementation. */ + __inline__ + IMP + __objc_get_forward_imp (SEL sel) + { + const char *t = sel->sel_types; + + if (t && (*t == '[' || *t == '(' || *t == '{') + #ifdef OBJC_MAX_STRUCT_BY_VALUE + && objc_sizeof_type(t) > OBJC_MAX_STRUCT_BY_VALUE + #endif + ) + return (IMP)__objc_block_forward; + else if (t && (*t == 'f' || *t == 'd')) + return (IMP)__objc_double_forward; + else + return (IMP)__objc_word_forward; + } + + /* Given a class and selector, return the selector's implementation. */ + __inline__ + IMP + get_imp (Class class, SEL sel) + { + void* res = sarray_get_safe (class->dtable, (size_t) sel->sel_id); + if (res == 0) + { + /* Not a valid method */ + if(class->dtable == __objc_uninstalled_dtable) + { + /* The dispatch table needs to be installed. */ + objc_mutex_lock(__objc_runtime_mutex); + __objc_install_dispatch_table_for_class (class); + objc_mutex_unlock(__objc_runtime_mutex); + /* Call ourselves with the installed dispatch table + and get the real method */ + res = get_imp(class, sel); + } + else + { + /* The dispatch table has been installed so the + method just doesn't exist for the class. + Return the forwarding implementation. */ + res = __objc_get_forward_imp(sel); + } + } + return res; + } + + /* Query if an object can respond to a selector, returns YES if the + object implements the selector otherwise NO. Does not check if the + method can be forwarded. */ + __inline__ + BOOL + __objc_responds_to (id object, SEL sel) + { + void* res; + + /* Install dispatch table if need be */ + if (object->class_pointer->dtable == __objc_uninstalled_dtable) + { + objc_mutex_lock(__objc_runtime_mutex); + __objc_install_dispatch_table_for_class (object->class_pointer); + objc_mutex_unlock(__objc_runtime_mutex); + } + + /* Get the method from the dispatch table */ + res = sarray_get_safe (object->class_pointer->dtable, (size_t) sel->sel_id); + return (res != 0); + } + + /* This is the lookup function. All entries in the table are either a + valid method *or* zero. If zero then either the dispatch table + needs to be installed or it doesn't exist and forwarding is attempted. */ + __inline__ + IMP + objc_msg_lookup(id receiver, SEL op) + { + IMP result; + if(receiver) + { + result = sarray_get_safe (receiver->class_pointer->dtable, + (sidx)op->sel_id); + if (result == 0) + { + /* Not a valid method */ + if(receiver->class_pointer->dtable == __objc_uninstalled_dtable) + { + /* The dispatch table needs to be installed. + This happens on the very first method call to the class. */ + __objc_init_install_dtable(receiver, op); + + /* Get real method for this in newly installed dtable */ + result = get_imp(receiver->class_pointer, op); + } + else + { + /* The dispatch table has been installed so the + method just doesn't exist for the class. + Attempt to forward the method. */ + result = __objc_get_forward_imp(op); + } + } + return result; + } + else + return nil_method; + } + + IMP + objc_msg_lookup_super (Super_t super, SEL sel) + { + if (super->self) + return get_imp (super->class, sel); + else + return nil_method; + } + + int method_get_sizeof_arguments (Method*); + + retval_t + objc_msg_sendv(id object, SEL op, arglist_t arg_frame) + { + Method* m = class_get_instance_method(object->class_pointer, op); + const char *type; + *((id*)method_get_first_argument (m, arg_frame, &type)) = object; + *((SEL*)method_get_next_argument (arg_frame, &type)) = op; + return __builtin_apply((apply_t)m->method_imp, + arg_frame, + method_get_sizeof_arguments (m)); + } + + void + __objc_init_dispatch_tables() + { + __objc_uninstalled_dtable + = sarray_new(200, 0); + } + + /* This function is called by objc_msg_lookup when the + dispatch table needs to be installed; thus it is called once + for each class, namely when the very first message is sent to it. */ + static void + __objc_init_install_dtable(id receiver, SEL op) + { + /* This may happen, if the programmer has taken the address of a + method before the dtable was initialized... too bad for him! */ + if(receiver->class_pointer->dtable != __objc_uninstalled_dtable) + return; + + objc_mutex_lock(__objc_runtime_mutex); + + if(CLS_ISCLASS(receiver->class_pointer)) + { + /* receiver is an ordinary object */ + assert(CLS_ISCLASS(receiver->class_pointer)); + + /* install instance methods table */ + __objc_install_dispatch_table_for_class (receiver->class_pointer); + + /* call +initialize -- this will in turn install the factory + dispatch table if not already done :-) */ + __objc_send_initialize(receiver->class_pointer); + } + else + { + /* receiver is a class object */ + assert(CLS_ISCLASS((Class)receiver)); + assert(CLS_ISMETA(receiver->class_pointer)); + + /* Install real dtable for factory methods */ + __objc_install_dispatch_table_for_class (receiver->class_pointer); + + __objc_send_initialize((Class)receiver); + } + objc_mutex_unlock(__objc_runtime_mutex); + } + + /* Install dummy table for class which causes the first message to + that class (or instances hereof) to be initialized properly */ + void + __objc_install_premature_dtable(Class class) + { + assert(__objc_uninstalled_dtable); + class->dtable = __objc_uninstalled_dtable; + } + + /* Send +initialize to class if not already done */ + static void + __objc_send_initialize(Class class) + { + /* This *must* be a class object */ + assert(CLS_ISCLASS(class)); + assert(!CLS_ISMETA(class)); + + if (!CLS_ISINITIALIZED(class)) + { + CLS_SETINITIALIZED(class); + CLS_SETINITIALIZED(class->class_pointer); + + /* Create the garbage collector type memory description */ + __objc_generate_gc_type_description (class); + + if(class->super_class) + __objc_send_initialize(class->super_class); + + { + SEL op = sel_register_name ("initialize"); + IMP imp = 0; + MethodList_t method_list = class->class_pointer->methods; + + while (method_list) { + int i; + Method_t method; + + for (i = 0; i< method_list->method_count; i++) { + method = &(method_list->method_list[i]); + if (method->method_name + && method->method_name->sel_id == op->sel_id) { + imp = method->method_imp; + break; + } + } + + if (imp) + break; + + method_list = method_list->method_next; + + } + if (imp) + (*imp)((id)class, op); + + } + } + } + + /* Walk on the methods list of class and install the methods in the reverse + order of the lists. Since methods added by categories are before the methods + of class in the methods list, this allows categories to substitute methods + declared in class. However if more than one category replaces the same + method nothing is guaranteed about what method will be used. + Assumes that __objc_runtime_mutex is locked down. */ + static void + __objc_install_methods_in_dtable (Class class, MethodList_t method_list) + { + int i; + + if (!method_list) + return; + + if (method_list->method_next) + __objc_install_methods_in_dtable (class, method_list->method_next); + + for (i = 0; i < method_list->method_count; i++) + { + Method_t method = &(method_list->method_list[i]); + sarray_at_put_safe (class->dtable, + (sidx) method->method_name->sel_id, + method->method_imp); + } + } + + /* Assumes that __objc_runtime_mutex is locked down. */ + static void + __objc_install_dispatch_table_for_class (Class class) + { + Class super; + + /* If the class has not yet had its class links resolved, we must + re-compute all class links */ + if(!CLS_ISRESOLV(class)) + __objc_resolve_class_links(); + + super = class->super_class; + + if (super != 0 && (super->dtable == __objc_uninstalled_dtable)) + __objc_install_dispatch_table_for_class (super); + + /* Allocate dtable if necessary */ + if (super == 0) + { + objc_mutex_lock(__objc_runtime_mutex); + class->dtable = sarray_new (__objc_selector_max_index, 0); + objc_mutex_unlock(__objc_runtime_mutex); + } + else + class->dtable = sarray_lazy_copy (super->dtable); + + __objc_install_methods_in_dtable (class, class->methods); + } + + void + __objc_update_dispatch_table_for_class (Class class) + { + Class next; + struct sarray *arr; + + /* not yet installed -- skip it */ + if (class->dtable == __objc_uninstalled_dtable) + return; + + objc_mutex_lock(__objc_runtime_mutex); + + arr = class->dtable; + __objc_install_premature_dtable (class); /* someone might require it... */ + sarray_free (arr); /* release memory */ + + /* could have been lazy... */ + __objc_install_dispatch_table_for_class (class); + + if (class->subclass_list) /* Traverse subclasses */ + for (next = class->subclass_list; next; next = next->sibling_class) + __objc_update_dispatch_table_for_class (next); + + objc_mutex_unlock(__objc_runtime_mutex); + } + + + /* This function adds a method list to a class. This function is + typically called by another function specific to the run-time. As + such this function does not worry about thread safe issues. + + This one is only called for categories. Class objects have their + methods installed right away, and their selectors are made into + SEL's by the function __objc_register_selectors_from_class. */ + void + class_add_method_list (Class class, MethodList_t list) + { + int i; + + /* Passing of a linked list is not allowed. Do multiple calls. */ + assert (!list->method_next); + + /* Check for duplicates. */ + for (i = 0; i < list->method_count; ++i) + { + Method_t method = &list->method_list[i]; + + if (method->method_name) /* Sometimes these are NULL */ + { + /* This is where selector names are transmogrified to SEL's */ + method->method_name = + sel_register_typed_name ((const char*)method->method_name, + method->method_types); + } + } + + /* Add the methods to the class's method list. */ + list->method_next = class->methods; + class->methods = list; + + /* Update the dispatch table of class */ + __objc_update_dispatch_table_for_class (class); + } + + Method_t + class_get_instance_method(Class class, SEL op) + { + return search_for_method_in_hierarchy(class, op); + } + + Method_t + class_get_class_method(MetaClass class, SEL op) + { + return search_for_method_in_hierarchy(class, op); + } + + + /* Search for a method starting from the current class up its hierarchy. + Return a pointer to the method's method structure if found. NULL + otherwise. */ + + static Method_t + search_for_method_in_hierarchy (Class cls, SEL sel) + { + Method_t method = NULL; + Class class; + + if (! sel_is_mapped (sel)) + return NULL; + + /* Scan the method list of the class. If the method isn't found in the + list then step to its super class. */ + for (class = cls; ((! method) && class); class = class->super_class) + method = search_for_method_in_list (class->methods, sel); + + return method; + } + + + + /* Given a linked list of method and a method's name. Search for the named + method's method structure. Return a pointer to the method's method + structure if found. NULL otherwise. */ + Method_t + search_for_method_in_list (MethodList_t list, SEL op) + { + MethodList_t method_list = list; + + if (! sel_is_mapped (op)) + return NULL; + + /* If not found then we'll search the list. */ + while (method_list) + { + int i; + + /* Search the method list. */ + for (i = 0; i < method_list->method_count; ++i) + { + Method_t method = &method_list->method_list[i]; + + if (method->method_name) + if (method->method_name->sel_id == op->sel_id) + return method; + } + + /* The method wasn't found. Follow the link to the next list of + methods. */ + method_list = method_list->method_next; + } + + return NULL; + } + + static retval_t __objc_forward (id object, SEL sel, arglist_t args); + + /* Forwarding pointers/integers through the normal registers */ + static id + __objc_word_forward (id rcv, SEL op, ...) + { + void *args, *res; + + args = __builtin_apply_args (); + res = __objc_forward (rcv, op, args); + if (res) + __builtin_return (res); + else + return res; + } + + /* Specific routine for forwarding floats/double because of + architectural differences on some processors. i386s for + example which uses a floating point stack versus general + registers for floating point numbers. This forward routine + makes sure that GCC restores the proper return values */ + static double + __objc_double_forward (id rcv, SEL op, ...) + { + void *args, *res; + + args = __builtin_apply_args (); + res = __objc_forward (rcv, op, args); + __builtin_return (res); + } + + #if INVISIBLE_STRUCT_RETURN + static __big + #else + static id + #endif + __objc_block_forward (id rcv, SEL op, ...) + { + void *args, *res; + + args = __builtin_apply_args (); + res = __objc_forward (rcv, op, args); + if (res) + __builtin_return (res); + else + #if INVISIBLE_STRUCT_RETURN + return (__big) {{0, 0, 0, 0, 0, 0, 0, 0}}; + #else + return nil; + #endif + } + + + /* This function is installed in the dispatch table for all methods which are + not implemented. Thus, it is called when a selector is not recognized. */ + static retval_t + __objc_forward (id object, SEL sel, arglist_t args) + { + IMP imp; + static SEL frwd_sel = 0; /* !T:SAFE2 */ + SEL err_sel; + + /* first try if the object understands forward:: */ + if (!frwd_sel) + frwd_sel = sel_get_any_uid("forward::"); + + if (__objc_responds_to (object, frwd_sel)) + { + imp = get_imp(object->class_pointer, frwd_sel); + return (*imp)(object, frwd_sel, sel, args); + } + + /* If the object recognizes the doesNotRecognize: method then we're going + to send it. */ + err_sel = sel_get_any_uid ("doesNotRecognize:"); + if (__objc_responds_to (object, err_sel)) + { + imp = get_imp (object->class_pointer, err_sel); + return (*imp) (object, err_sel, sel); + } + + /* The object doesn't recognize the method. Check for responding to + error:. If it does then sent it. */ + { + size_t strlen (const char*); + char msg[256 + strlen ((const char*)sel_get_name (sel)) + + strlen ((const char*)object->class_pointer->name)]; + + sprintf (msg, "(%s) %s does not recognize %s", + (CLS_ISMETA(object->class_pointer) + ? "class" + : "instance" ), + object->class_pointer->name, sel_get_name (sel)); + + err_sel = sel_get_any_uid ("error:"); + if (__objc_responds_to (object, err_sel)) + { + imp = get_imp (object->class_pointer, err_sel); + return (*imp) (object, sel_get_any_uid ("error:"), msg); + } + + /* The object doesn't respond to doesNotRecognize: or error:; Therefore, + a default action is taken. */ + objc_error (object, OBJC_ERR_UNIMPLEMENTED, "%s\n", msg); + + return 0; + } + } + + void + __objc_print_dtable_stats() + { + int total = 0; + + objc_mutex_lock(__objc_runtime_mutex); + + printf("memory usage: (%s)\n", + #ifdef OBJC_SPARSE2 + "2-level sparse arrays" + #else + "3-level sparse arrays" + #endif + ); + + printf("arrays: %d = %ld bytes\n", narrays, + (long)narrays*sizeof(struct sarray)); + total += narrays*sizeof(struct sarray); + printf("buckets: %d = %ld bytes\n", nbuckets, + (long)nbuckets*sizeof(struct sbucket)); + total += nbuckets*sizeof(struct sbucket); + + printf("idxtables: %d = %ld bytes\n", idxsize, (long)idxsize*sizeof(void*)); + total += idxsize*sizeof(void*); + printf("-----------------------------------\n"); + printf("total: %d bytes\n", total); + printf("===================================\n"); + + objc_mutex_unlock(__objc_runtime_mutex); + } + + /* Returns the uninstalled dispatch table indicator. + If a class' dispatch table points to __objc_uninstalled_dtable + then that means it needs its dispatch table to be installed. */ + __inline__ + struct sarray* + objc_get_uninstalled_dtable() + { + return __objc_uninstalled_dtable; + } diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-dce.c gcc-2.95/libobjc/thr-dce.c *** egcs-1.1.2/libobjc/thr-dce.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-dce.c Tue Sep 29 19:13:15 1998 *************** *** 0 **** --- 1,281 ---- + /* GNU Objective C Runtime Thread Interface + 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. + + 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. */ + + #include + #include + #include "runtime.h" + + /* Key structure for maintaining thread specific storage */ + static pthread_key_t _objc_thread_storage; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* Initialize the thread storage key */ + return pthread_keycreate(&_objc_thread_storage, NULL); + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + /* Destroy the thread storage key */ + /* Not implemented yet */ + /* return pthread_key_delete(&_objc_thread_storage); */ + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + objc_thread_t thread_id; + pthread_t new_thread_handle; + + if (pthread_create(&new_thread_handle, pthread_attr_default, + (void *)func, arg) == 0) + { + /* ??? May not work! (64bit) */ + thread_id = *(objc_thread_t *)&new_thread_handle; + pthread_detach(&new_thread_handle); /* Fully detach thread. */ + } + else + thread_id = NULL; + + return thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + int sys_priority = 0; + + switch (priority) + { + case OBJC_THREAD_INTERACTIVE_PRIORITY: + sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2; + break; + default: + case OBJC_THREAD_BACKGROUND_PRIORITY: + sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; + break; + case OBJC_THREAD_LOW_PRIORITY: + sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; + break; + } + + /* Change the priority. */ + if (pthread_setprio(pthread_self(), sys_priority) >= 0) + return 0; + else + /* Failed */ + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + int sys_priority; + + if ((sys_priority = pthread_getprio(pthread_self())) >= 0) { + if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP) + return OBJC_THREAD_INTERACTIVE_PRIORITY; + if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP) + return OBJC_THREAD_BACKGROUND_PRIORITY; + return OBJC_THREAD_LOW_PRIORITY; + } + + /* Failed */ + return -1; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + pthread_yield(); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* exit the thread */ + pthread_exit(&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + pthread_t self = pthread_self(); + + return (objc_thread_t) pthread_getunique_np (&self); + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + return pthread_setspecific(_objc_thread_storage, value); + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + void *value = NULL; + + if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) + return value; + + return NULL; + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), + pthread_mutexattr_default)) + return -1; + else + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) + return -1; + else + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1) + return -1; + else + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + + /* + if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) + return -1; + else + return 0; + */ + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); + */ + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), + (pthread_mutex_t *)(&(mutex->backend))); + */ + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); + */ + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); + */ + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-decosf1.c gcc-2.95/libobjc/thr-decosf1.c *** egcs-1.1.2/libobjc/thr-decosf1.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-decosf1.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,281 ---- + /* GNU Objective C Runtime Thread Interface + 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. + + 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. */ + + #include + #include + #include "runtime.h" + + /* Key structure for maintaining thread specific storage */ + static pthread_key_t _objc_thread_storage; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* Initialize the thread storage key */ + return pthread_keycreate(&_objc_thread_storage, NULL); + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + /* Destroy the thread storage key */ + /* Not implemented yet */ + /* return pthread_key_delete(&_objc_thread_storage); */ + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + objc_thread_t thread_id; + pthread_t new_thread_handle; + + if (pthread_create(&new_thread_handle, pthread_attr_default, + (void *)func, arg) == 0) + { + /* ??? May not work! (64bit) */ + thread_id = *(objc_thread_t *)&new_thread_handle; + pthread_detach(&new_thread_handle); /* Fully detach thread. */ + } + else + thread_id = NULL; + + return thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + int sys_priority = 0; + + switch (priority) + { + case OBJC_THREAD_INTERACTIVE_PRIORITY: + sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2; + break; + default: + case OBJC_THREAD_BACKGROUND_PRIORITY: + sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; + break; + case OBJC_THREAD_LOW_PRIORITY: + sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; + break; + } + + /* Change the priority. */ + if (pthread_setprio(pthread_self(), sys_priority) >= 0) + return 0; + else + /* Failed */ + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + int sys_priority; + + if ((sys_priority = pthread_getprio(pthread_self())) >= 0) { + if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP) + return OBJC_THREAD_INTERACTIVE_PRIORITY; + if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP) + return OBJC_THREAD_BACKGROUND_PRIORITY; + return OBJC_THREAD_LOW_PRIORITY; + } + + /* Failed */ + return -1; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + pthread_yield(); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* exit the thread */ + pthread_exit(&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + pthread_t self = pthread_self(); + + return (objc_thread_t) pthread_getunique_np (&self); + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + return pthread_setspecific(_objc_thread_storage, value); + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + void *value = NULL; + + if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) + return value; + + return NULL; + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), + pthread_mutexattr_default)) + return -1; + else + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) + return -1; + else + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1) + return -1; + else + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + + /* + if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) + return -1; + else + return 0; + */ + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); + */ + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), + (pthread_mutex_t *)(&(mutex->backend))); + */ + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); + */ + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); + */ + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-irix.c gcc-2.95/libobjc/thr-irix.c *** egcs-1.1.2/libobjc/thr-irix.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-irix.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,235 ---- + /* GNU Objective C Runtime Thread Interface - SGI IRIX Implementation + 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. + + 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. */ + + #include + #include + #include + #include + #include + #include + #include "runtime.h" + + /* Key structure for maintaining thread specific storage */ + static void * __objc_shared_arena_handle = NULL; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* Name of IRIX arena. */ + char arena_name[64]; + + DEBUG_PRINTF("__objc_init_thread_system\n"); + + /* Construct a temporary name for arena. */ + sprintf(arena_name, "/usr/tmp/objc_%05u", (unsigned)getpid()); + + /* Up to 256 threads. Arena only for threads. */ + usconfig(CONF_INITUSERS, 256); + usconfig(CONF_ARENATYPE, US_SHAREDONLY); + + /* Initialize the arena */ + if (!(__objc_shared_arena_handle = usinit(arena_name))) + /* Failed */ + return -1; + + return 0; + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + objc_thread_t thread_id; + int sys_id; + + if ((sys_id = sproc((void *)func, PR_SALL, arg)) >= 0) + thread_id = (objc_thread_t)sys_id; + else + thread_id = NULL; + + return thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + /* Not implemented yet */ + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + /* Not implemented yet */ + return OBJC_THREAD_INTERACTIVE_PRIORITY; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + sginap(0); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* IRIX only has exit. */ + exit(__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + /* Threads are processes. */ + return (objc_thread_t)get_pid(); + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + *((void **)&PRDA->usr_prda) = value; + return 0; + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + return *((void **)&PRDA->usr_prda); + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + if (!( (ulock_t)(mutex->backend) = usnewlock(__objc_shared_arena_handle) )) + return -1; + else + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + usfreelock((ulock_t)(mutex->backend), __objc_shared_arena_handle); + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + if (ussetlock((ulock_t)(mutex->backend)) == 0) + return -1; + else + return 0; + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + if (ustestlock((ulock_t)(mutex->backend)) == 0) + return -1; + else + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + usunsetlock((ulock_t)(mutex->backend)); + return 0; + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + /* Unimplemented. */ + return -1; + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-mach.c gcc-2.95/libobjc/thr-mach.c *** egcs-1.1.2/libobjc/thr-mach.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-mach.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,312 ---- + /* GNU Objective C Runtime Thread Implementation + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) + Modified for Mach threads by Bill Bumgarner + Condition functions added by Mircea Oancea + + 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. */ + + #include + #include + #include + #include "runtime.h" + + /* + Obtain the maximum thread priority that can set for t. Under the + mach threading model, it is possible for the developer to adjust the + maximum priority downward only-- cannot be raised without superuser + privileges. Once lowered, it cannot be raised. + */ + static int __mach_get_max_thread_priority(cthread_t t, int *base) + { + thread_t threadP; + kern_return_t error; + struct thread_sched_info info; + unsigned int info_count=THREAD_SCHED_INFO_COUNT; + + if (t == NULL) + return -1; + + threadP = cthread_thread(t); /* get thread underlying */ + + error=thread_info(threadP, THREAD_SCHED_INFO, + (thread_info_t)&info, &info_count); + + if (error != KERN_SUCCESS) + return -1; + + if (base != NULL) + *base = info.base_priority; + + return info.max_priority; + } + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + return 0; + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + objc_thread_t thread_id; + cthread_t new_thread_handle; + + /* create thread */ + new_thread_handle = cthread_fork((cthread_fn_t)func, arg); + + if(new_thread_handle) + { + /* this is not terribly portable */ + thread_id = *(objc_thread_t *)&new_thread_handle; + cthread_detach(new_thread_handle); + } + else + thread_id = NULL; + + return thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + objc_thread_t *t = objc_thread_id(); + cthread_t cT = (cthread_t) t; + int maxPriority = __mach_get_max_thread_priority(cT, NULL); + int sys_priority = 0; + + if (maxPriority == -1) + return -1; + + switch (priority) + { + case OBJC_THREAD_INTERACTIVE_PRIORITY: + sys_priority = maxPriority; + break; + case OBJC_THREAD_BACKGROUND_PRIORITY: + sys_priority = (maxPriority * 2) / 3; + break; + case OBJC_THREAD_LOW_PRIORITY: + sys_priority = maxPriority / 3; + break; + default: + return -1; + } + + if (sys_priority == 0) + return -1; + + /* Change the priority */ + if (cthread_priority(cT, sys_priority, 0) == KERN_SUCCESS) + return 0; + else + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + objc_thread_t *t = objc_thread_id(); + cthread_t cT = (cthread_t) t; /* see objc_thread_id() */ + int basePriority; + int maxPriority; + int sys_priority = 0; + + int interactiveT, backgroundT, lowT; /* thresholds */ + + maxPriority = __mach_get_max_thread_priority(cT, &basePriority); + + if(maxPriority == -1) + return -1; + + if (basePriority > ( (maxPriority * 2) / 3)) + return OBJC_THREAD_INTERACTIVE_PRIORITY; + + if (basePriority > ( maxPriority / 3)) + return OBJC_THREAD_BACKGROUND_PRIORITY; + + return OBJC_THREAD_LOW_PRIORITY; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + cthread_yield(); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* exit the thread */ + cthread_exit(&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + cthread_t self = cthread_self(); + + return *(objc_thread_t *)&self; + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + cthread_set_data(cthread_self(), (any_t) value); + return 0; + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + return (void *) cthread_data(cthread_self()); + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + int err = 0; + mutex->backend = objc_malloc(sizeof(struct mutex)); + + err = mutex_init((mutex_t)(mutex->backend)); + + if (err != 0) + { + objc_free(mutex->backend); + return -1; + } + else + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + mutex_clear((mutex_t)(mutex->backend)); + + objc_free(mutex->backend); + mutex->backend = NULL; + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + mutex_lock((mutex_t)(mutex->backend)); + return 0; + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + if (mutex_try_lock((mutex_t)(mutex->backend)) == 0) + return -1; + else + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + mutex_unlock((mutex_t)(mutex->backend)); + return 0; + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + condition->backend = objc_malloc(sizeof(struct condition)); + condition_init((condition_t)(condition->backend)); + return 0; + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + condition_clear((condition_t)(condition->backend)); + objc_free(condition->backend); + condition->backend = NULL; + return 0; + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + condition_wait((condition_t)(condition->backend), + (mutex_t)(mutex->backend)); + return 0; + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + condition_broadcast((condition_t)(condition->backend)); + return 0; + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + condition_signal((condition_t)(condition->backend)); + return 0; + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-os2.c gcc-2.95/libobjc/thr-os2.c *** egcs-1.1.2/libobjc/thr-os2.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-os2.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,267 ---- + /* GNU Objective C Runtime Thread Interface - OS/2 emx Implementation + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Contributed by Thomas Baier (baier@ci.tuwien.ac.at) + + 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. */ + + #include + #include "runtime.h" + + #define INCL_DOSSEMAPHORES + #define INCL_DOSPROCESS + + /* + * conflicts with objc.h: SEL, BOOL, id + * solution: prefixing those with _OS2_ before including + */ + #define SEL _OS2_SEL + #define BOOL _OS2_BOOL + #define id _OS2_id + #include + #undef id + #undef SEL + #undef BOOL + + #include + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + return 0; + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + int thread_id = 0; + + if ((thread_id = _beginthread (func,NULL,32768,arg)) < 0) + thread_id = 0; + + return (objc_thread_t)thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + ULONG sys_class = 0; + ULONG sys_priority = 0; + + /* OBJC_THREAD_INTERACTIVE_PRIORITY -> PRTYC_FOREGROUNDSERVER + * OBJC_THREAD_BACKGROUND_PRIORITY -> PRTYC_REGULAR + * OBJC_THREAD_LOW_PRIORITY -> PRTYC_IDLETIME */ + + switch (priority) { + case OBJC_THREAD_INTERACTIVE_PRIORITY: + sys_class = PRTYC_REGULAR; + sys_priority = 10; + break; + default: + case OBJC_THREAD_BACKGROUND_PRIORITY: + sys_class = PRTYC_IDLETIME; + sys_priority = 25; + break; + case OBJC_THREAD_LOW_PRIORITY: + sys_class = PRTYC_IDLETIME; + sys_priority = 0; + break; + } + + /* Change priority */ + if (!DosSetPriority (PRTYS_THREAD,sys_class,sys_priority,*_threadid)) + return 0; + else + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + PTIB ptib; + PPIB ppib; + + /* get information about current thread */ + DosGetInfoBlocks (&ptib,&ppib); + + switch (ptib->tib_ptib2->tib2_ulpri) + { + case PRTYC_IDLETIME: + case PRTYC_REGULAR: + case PRTYC_TIMECRITICAL: + case PRTYC_FOREGROUNDSERVER: + default: + return OBJC_THREAD_INTERACTIVE_PRIORITY; + } + + return -1; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + DosSleep (0); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* terminate the thread, NEVER use DosExit () */ + _endthread (); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + return (objc_thread_t) *_threadid; + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + *_threadstore () = value; + + return 0; + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + return *_threadstore (); + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + if (DosCreateMutexSem (NULL, (HMTX)(&(mutex->backend)),0L,0) > 0) + return -1; + else + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + DosCloseMutexSem ((HMTX)(mutex->backend)); + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + if (DosRequestMutexSem ((HMTX)(mutex->backend),-1L) != 0) + return -1; + else + return 0; + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + if (DosRequestMutexSem ((HMTX)(mutex->backend),0L) != 0) + return -1; + else + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + if (DosReleaseMutexSem((HMTX)(mutex->backend)) != 0) + return -1; + else + return 0; + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + /* Unimplemented. */ + return -1; + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-posix.c gcc-2.95/libobjc/thr-posix.c *** egcs-1.1.2/libobjc/thr-posix.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-posix.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,229 ---- + /* GNU Objective C Runtime Thread Interface for POSIX compliant threads + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) + Modified for Linux/Pthreads by Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de) + + 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. */ + + #include + #include "runtime.h" + #include + + /* Key structure for maintaining thread specific storage */ + static pthread_key_t _objc_thread_storage; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* Initialize the thread storage key */ + return pthread_key_create(&_objc_thread_storage, NULL); + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + objc_thread_t thread_id; + pthread_t new_thread_handle; + + if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) ) + thread_id = *(objc_thread_t *)&new_thread_handle; + else + thread_id = NULL; + + return thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + /* Not implemented yet */ + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + /* Not implemented yet */ + return -1; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + sched_yield(); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* exit the thread */ + pthread_exit(&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + pthread_t self = pthread_self(); + + return *(objc_thread_t *)&self; + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + return pthread_setspecific(_objc_thread_storage, value); + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + return pthread_getspecific(_objc_thread_storage); + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + mutex->backend = objc_malloc(sizeof(pthread_mutex_t)); + + if (pthread_mutex_init((pthread_mutex_t *)mutex->backend, NULL)) + { + objc_free(mutex->backend); + mutex->backend = NULL; + return -1; + } + + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + if (pthread_mutex_destroy((pthread_mutex_t *)mutex->backend)) + return -1; + + objc_free(mutex->backend); + mutex->backend = NULL; + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + return pthread_mutex_lock((pthread_mutex_t *)mutex->backend); + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + return pthread_mutex_trylock((pthread_mutex_t *)mutex->backend); + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + return pthread_mutex_unlock((pthread_mutex_t *)mutex->backend); + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + condition->backend = objc_malloc(sizeof(pthread_cond_t)); + + if (pthread_cond_init((pthread_cond_t *)condition->backend, NULL)) + { + objc_free(condition->backend); + condition->backend = NULL; + return -1; + } + + return 0; + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + if (pthread_cond_destroy((pthread_cond_t *)condition->backend)) + return -1; + + objc_free(condition->backend); + condition->backend = NULL; + return 0; + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + return pthread_cond_wait((pthread_cond_t *)condition->backend, + (pthread_mutex_t *)mutex->backend); + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + return pthread_cond_broadcast((pthread_cond_t *)condition->backend); + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + return pthread_cond_signal((pthread_cond_t *)condition->backend); + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-pthreads.c gcc-2.95/libobjc/thr-pthreads.c *** egcs-1.1.2/libobjc/thr-pthreads.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-pthreads.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,218 ---- + /* GNU Objective C Runtime Thread Implementation for PCThreads under GNU/Linux. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Contributed by Scott Christley + Condition functions added by: Mircea Oancea + + 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. */ + + #include + #include + #include "runtime.h" + + /* Key structure for maintaining thread specific storage */ + static pthread_key_t _objc_thread_storage; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* Initialize the thread storage key */ + return pthread_key_create(&_objc_thread_storage, NULL); + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + /* Destroy the thread storage key */ + /* Not implemented yet */ + /* return pthread_key_delete(&_objc_thread_storage); */ + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + objc_thread_t thread_id; + pthread_t new_thread_handle; + + if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) ) + thread_id = *(objc_thread_t *)&new_thread_handle; + else + thread_id = NULL; + + return thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + /* Not implemented yet */ + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + /* Not implemented yet */ + return OBJC_THREAD_INTERACTIVE_PRIORITY; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + pthread_yield(NULL); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* exit the thread */ + pthread_exit(&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + pthread_t self = pthread_self(); + + return *(objc_thread_t *)&self; + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + return pthread_setspecific(_objc_thread_storage, value); + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + void *value = NULL; + + if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) + return value; + + return NULL; + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), NULL)) + return -1; + else + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) + return -1; + else + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + return pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))); + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) + return -1; + else + return 0; + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), + (pthread_mutex_t *)(&(mutex->backend))); + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-single.c gcc-2.95/libobjc/thr-single.c *** egcs-1.1.2/libobjc/thr-single.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-single.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,192 ---- + /* GNU Objective C Runtime Thread Implementation + 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. + + 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. */ + + #include + #include "runtime.h" + + /* Thread local storage for a single thread */ + static void *thread_local_storage = NULL; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* No thread support available */ + return -1; + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + /* No thread support available */ + return -1; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + /* No thread support available */ + return NULL; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + /* No thread support available */ + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + return OBJC_THREAD_INTERACTIVE_PRIORITY; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + return; + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* No thread support available */ + /* Should we really exit the program */ + /* exit(&__objc_thread_exit_status); */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + /* No thread support, use 1. */ + return (objc_thread_t)1; + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + thread_local_storage = value; + return 0; + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + return thread_local_storage; + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + /* There can only be one thread, so we always get the lock */ + return 0; + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + /* There can only be one thread, so we always get the lock */ + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + return 0; + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + return 0; + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + return 0; + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + return 0; + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + return 0; + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + return 0; + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-solaris.c gcc-2.95/libobjc/thr-solaris.c *** egcs-1.1.2/libobjc/thr-solaris.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-solaris.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,259 ---- + /* GNU Objective C Runtime Thread Interface + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) + Conditions added by Mircea Oancea (mircea@first.elcom.pub.ro) + + 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. */ + + #include + #include "runtime.h" + + #include + #include + #include + + /* Key structure for maintaining thread specific storage */ + static thread_key_t __objc_thread_data_key; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* Initialize the thread storage key */ + if (thr_keycreate(&__objc_thread_data_key, NULL) == 0) + return 0; + else + return -1; + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + objc_thread_t thread_id; + thread_t new_thread_id = 0; + + if (thr_create(NULL, 0, (void *)func, arg, + THR_DETACHED | THR_NEW_LWP, + &new_thread_id) == 0) + thread_id = *(objc_thread_t *)&new_thread_id; + else + thread_id = NULL; + + return thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + int sys_priority = 0; + + switch (priority) + { + case OBJC_THREAD_INTERACTIVE_PRIORITY: + sys_priority = 300; + break; + default: + case OBJC_THREAD_BACKGROUND_PRIORITY: + sys_priority = 200; + break; + case OBJC_THREAD_LOW_PRIORITY: + sys_priority = 1000; + break; + } + + /* Change priority */ + if (thr_setprio(thr_self(), sys_priority) == 0) + return 0; + else + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + int sys_priority; + + if (thr_getprio(thr_self(), &sys_priority) == 0) + { + if (sys_priority >= 250) + return OBJC_THREAD_INTERACTIVE_PRIORITY; + else if (sys_priority >= 150) + return OBJC_THREAD_BACKGROUND_PRIORITY; + return OBJC_THREAD_LOW_PRIORITY; + } + + /* Couldn't get priority. */ + return -1; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + thr_yield(); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* exit the thread */ + thr_exit(&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + return (objc_thread_t)thr_self(); + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + if (thr_setspecific(__objc_thread_data_key, value) == 0) + return 0; + else + return -1; + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + void *value = NULL; + + if (thr_getspecific(__objc_thread_data_key, &value) == 0) + return value; + + return NULL; + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + if (mutex_init( (mutex_t *)(&(mutex->backend)), USYNC_THREAD, 0)) + return -1; + else + return 0; + } + + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + mutex_destroy((mutex_t *)(&(mutex->backend))); + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + if (mutex_lock((mutex_t *)(&(mutex->backend))) != 0) + return -1; + else + return 0; + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + if (mutex_trylock((mutex_t *)(&(mutex->backend))) != 0) + return -1; + else + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + if (mutex_unlock((mutex_t *)(&(mutex->backend))) != 0) + return -1; + else + return 0; + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + return cond_init((cond_t *)(&(condition->backend)), USYNC_THREAD, NULL); + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + return cond_destroy((cond_t *)(&(condition->backend))); + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + return cond_wait((cond_t *)(&(condition->backend)), + (mutex_t *)(&(mutex->backend))); + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + return cond_broadcast((cond_t *)(&(condition->backend))); + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + return cond_signal((cond_t *)(&(condition->backend))); + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-vxworks.c gcc-2.95/libobjc/thr-vxworks.c *** egcs-1.1.2/libobjc/thr-vxworks.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-vxworks.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,192 ---- + /* GNU Objective C Runtime Thread Implementation + 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. + + 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. */ + + #include + #include "runtime.h" + + /* Thread local storage for a single thread */ + static void *thread_local_storage = NULL; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* No thread support available */ + return -1; + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + /* No thread support available */ + return -1; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + /* No thread support available */ + return NULL; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + /* No thread support available */ + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + return OBJC_THREAD_INTERACTIVE_PRIORITY; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + return; + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* No thread support available */ + /* Should we really exit the program */ + /* exit(&__objc_thread_exit_status); */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + /* No thread support, use 1. */ + return (objc_thread_t)1; + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + thread_local_storage = value; + return 0; + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + return thread_local_storage; + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + /* There can only be one thread, so we always get the lock */ + return 0; + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + /* There can only be one thread, so we always get the lock */ + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + return 0; + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + return 0; + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + return 0; + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + return 0; + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + return 0; + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + return 0; + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr-win32.c gcc-2.95/libobjc/thr-win32.c *** egcs-1.1.2/libobjc/thr-win32.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr-win32.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,272 ---- + /* GNU Objective C Runtime Thread Interface - Win32 Implementation + 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. + + 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. */ + + #include + #include "runtime.h" + + #ifndef __OBJC__ + #define __OBJC__ + #endif + #include + + /* Key structure for maintaining thread specific storage */ + static DWORD __objc_data_tls = (DWORD)-1; + + /* Backend initialization functions */ + + /* Initialize the threads subsystem. */ + int + __objc_init_thread_system(void) + { + /* Initialize the thread storage key */ + if ((__objc_data_tls = TlsAlloc()) != (DWORD)-1) + return 0; + else + return -1; + } + + /* Close the threads subsystem. */ + int + __objc_close_thread_system(void) + { + if (__objc_data_tls != (DWORD)-1) + TlsFree(__objc_data_tls); + return 0; + } + + /* Backend thread functions */ + + /* Create a new thread of execution. */ + objc_thread_t + __objc_thread_detach(void (*func)(void *arg), void *arg) + { + DWORD thread_id = 0; + HANDLE win32_handle; + + if (!(win32_handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, + arg, 0, &thread_id))) + thread_id = 0; + + return (objc_thread_t)thread_id; + } + + /* Set the current thread's priority. */ + int + __objc_thread_set_priority(int priority) + { + int sys_priority = 0; + + switch (priority) + { + case OBJC_THREAD_INTERACTIVE_PRIORITY: + sys_priority = THREAD_PRIORITY_NORMAL; + break; + default: + case OBJC_THREAD_BACKGROUND_PRIORITY: + sys_priority = THREAD_PRIORITY_BELOW_NORMAL; + break; + case OBJC_THREAD_LOW_PRIORITY: + sys_priority = THREAD_PRIORITY_LOWEST; + break; + } + + /* Change priority */ + if (SetThreadPriority(GetCurrentThread(), sys_priority)) + return 0; + else + return -1; + } + + /* Return the current thread's priority. */ + int + __objc_thread_get_priority(void) + { + int sys_priority; + + sys_priority = GetThreadPriority(GetCurrentThread()); + + switch (sys_priority) + { + case THREAD_PRIORITY_HIGHEST: + case THREAD_PRIORITY_TIME_CRITICAL: + case THREAD_PRIORITY_ABOVE_NORMAL: + case THREAD_PRIORITY_NORMAL: + return OBJC_THREAD_INTERACTIVE_PRIORITY; + + default: + case THREAD_PRIORITY_BELOW_NORMAL: + return OBJC_THREAD_BACKGROUND_PRIORITY; + + case THREAD_PRIORITY_IDLE: + case THREAD_PRIORITY_LOWEST: + return OBJC_THREAD_LOW_PRIORITY; + } + + /* Couldn't get priority. */ + return -1; + } + + /* Yield our process time to another thread. */ + void + __objc_thread_yield(void) + { + Sleep(0); + } + + /* Terminate the current thread. */ + int + __objc_thread_exit(void) + { + /* exit the thread */ + ExitThread(__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; + } + + /* Returns an integer value which uniquely describes a thread. */ + objc_thread_t + __objc_thread_id(void) + { + return (objc_thread_t)GetCurrentThreadId(); + } + + /* Sets the thread's local storage pointer. */ + int + __objc_thread_set_data(void *value) + { + if (TlsSetValue(__objc_data_tls, value)) + return 0; + else + return -1; + } + + /* Returns the thread's local storage pointer. */ + void * + __objc_thread_get_data(void) + { + return TlsGetValue(__objc_data_tls); /* Return thread data. */ + } + + /* Backend mutex functions */ + + /* Allocate a mutex. */ + int + __objc_mutex_allocate(objc_mutex_t mutex) + { + if ((mutex->backend = (void *)CreateMutex(NULL, 0, NULL)) == NULL) + return -1; + else + return 0; + } + + /* Deallocate a mutex. */ + int + __objc_mutex_deallocate(objc_mutex_t mutex) + { + CloseHandle((HANDLE)(mutex->backend)); + return 0; + } + + /* Grab a lock on a mutex. */ + int + __objc_mutex_lock(objc_mutex_t mutex) + { + int status; + + status = WaitForSingleObject((HANDLE)(mutex->backend), INFINITE); + if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED) + return -1; + else + return 0; + } + + /* Try to grab a lock on a mutex. */ + int + __objc_mutex_trylock(objc_mutex_t mutex) + { + int status; + + status = WaitForSingleObject((HANDLE)(mutex->backend), 0); + if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED) + return -1; + else + return 0; + } + + /* Unlock the mutex */ + int + __objc_mutex_unlock(objc_mutex_t mutex) + { + if (ReleaseMutex((HANDLE)(mutex->backend)) == 0) + return -1; + else + return 0; + } + + /* Backend condition mutex functions */ + + /* Allocate a condition. */ + int + __objc_condition_allocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Deallocate a condition. */ + int + __objc_condition_deallocate(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Wait on the condition */ + int + __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + /* Unimplemented. */ + return -1; + } + + /* Wake up all threads waiting on this condition. */ + int + __objc_condition_broadcast(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* Wake up one thread waiting on this condition. */ + int + __objc_condition_signal(objc_condition_t condition) + { + /* Unimplemented. */ + return -1; + } + + /* End of File */ diff -x de.gmo -x fr.gmo -Nrc3p egcs-1.1.2/libobjc/thr.c gcc-2.95/libobjc/thr.c *** egcs-1.1.2/libobjc/thr.c Wed Dec 31 16:00:00 1969 --- gcc-2.95/libobjc/thr.c Sun Sep 20 18:22:07 1998 *************** *** 0 **** --- 1,534 ---- + /* GNU Objective C Runtime Thread Interface + 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. + + 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. */ + + #include + #include "runtime.h" + + /* Global exit status. */ + int __objc_thread_exit_status = 0; + + /* Flag which lets us know if we ever became multi threaded */ + int __objc_is_multi_threaded = 0; + + /* The hook function called when the runtime becomes multi threaded */ + objc_thread_callback _objc_became_multi_threaded = NULL; + + /* + 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. + */ + objc_thread_callback objc_set_thread_callback(objc_thread_callback func) + { + objc_thread_callback temp = _objc_became_multi_threaded; + _objc_became_multi_threaded = func; + return temp; + } + + /* + Private functions + + These functions are utilized by the frontend, but they are not + considered part of the public interface. + */ + + /* + First function called in a thread, starts everything else. + + This function is passed to the backend by objc_thread_detach + as the starting function for a new thread. + */ + struct __objc_thread_start_state + { + SEL selector; + id object; + id argument; + }; + + static volatile void + __objc_thread_detach_function(struct __objc_thread_start_state *istate) + { + /* Valid state? */ + if (istate) { + id (*imp)(id,SEL,id); + SEL selector = istate->selector; + id object = istate->object; + id argument = istate->argument; + + /* Don't need anymore so free it */ + objc_free(istate); + + /* Clear out the thread local storage */ + objc_thread_set_data(NULL); + + /* Check to see if we just became multi threaded */ + if (!__objc_is_multi_threaded) + { + __objc_is_multi_threaded = 1; + + /* Call the hook function */ + if (_objc_became_multi_threaded != NULL) + (*_objc_became_multi_threaded)(); + } + + /* Call the method */ + if ((imp = (id(*)(id, SEL, id))objc_msg_lookup(object, selector))) + (*imp)(object, selector, argument); + else + objc_error(object, OBJC_ERR_UNIMPLEMENTED, + "objc_thread_detach called with bad selector.\n"); + } + else + objc_error(nil, OBJC_ERR_BAD_STATE, + "objc_thread_detach called with NULL state.\n"); + + /* Exit the thread */ + objc_thread_exit(); + } + + /* + Frontend functions + + These functions constitute the public interface to the Objective-C thread + and mutex functionality. + */ + + /* Frontend thread functions */ + + /* + Detach a new thread of execution and return its id. Returns NULL if fails. + Thread is started by sending message with selector to object. Message + takes a single argument. + */ + objc_thread_t + objc_thread_detach(SEL selector, id object, id argument) + { + struct __objc_thread_start_state *istate; + objc_thread_t thread_id = NULL; + + /* Allocate the state structure */ + if (!(istate = (struct __objc_thread_start_state *) + objc_malloc(sizeof(*istate)))) + return NULL; + + /* Initialize the state structure */ + istate->selector = selector; + istate->object = object; + istate->argument = argument; + + /* lock access */ + objc_mutex_lock(__objc_runtime_mutex); + + /* Call the backend to spawn the thread */ + if ((thread_id = __objc_thread_detach((void *)__objc_thread_detach_function, + istate)) == NULL) + { + /* failed! */ + objc_mutex_unlock(__objc_runtime_mutex); + objc_free(istate); + return NULL; + } + + /* Increment our thread counter */ + __objc_runtime_threads_alive++; + objc_mutex_unlock(__objc_runtime_mutex); + + return thread_id; + } + + /* Set the current thread's priority. */ + int + objc_thread_set_priority(int priority) + { + /* Call the backend */ + return __objc_thread_set_priority(priority); + } + + /* Return the current thread's priority. */ + int + objc_thread_get_priority(void) + { + /* Call the backend */ + return __objc_thread_get_priority(); + } + + /* + Yield our process time to another thread. Any BUSY waiting that is done + by a thread should use this function to make sure that other threads can + make progress even on a lazy uniprocessor system. + */ + void + objc_thread_yield(void) + { + /* Call the backend */ + __objc_thread_yield(); + } + + /* + Terminate the current tread. Doesn't return. + Actually, if it failed returns -1. + */ + int + objc_thread_exit(void) + { + /* Decrement our counter of the number of threads alive */ + objc_mutex_lock(__objc_runtime_mutex); + __objc_runtime_threads_alive--; + objc_mutex_unlock(__objc_runtime_mutex); + + /* Call the backend to terminate the thread */ + return __objc_thread_exit(); + } + + /* + Returns an integer value which uniquely describes a thread. Must not be + NULL which is reserved as a marker for "no thread". + */ + objc_thread_t + objc_thread_id(void) + { + /* Call the backend */ + return __objc_thread_id(); + } + + /* + Sets the thread's local storage pointer. + Returns 0 if successful or -1 if failed. + */ + int + objc_thread_set_data(void *value) + { + /* Call the backend */ + return __objc_thread_set_data(value); + } + + /* + Returns the thread's local storage pointer. Returns NULL on failure. + */ + void * + objc_thread_get_data(void) + { + /* Call the backend */ + return __objc_thread_get_data(); + } + + /* Frontend mutex functions */ + + /* + Allocate a mutex. Return the mutex pointer if successful or NULL if the + allocation failed for any reason. + */ + objc_mutex_t + objc_mutex_allocate(void) + { + objc_mutex_t mutex; + + /* Allocate the mutex structure */ + if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex)))) + return NULL; + + /* Call backend to create the mutex */ + if (__objc_mutex_allocate(mutex)) + { + /* failed! */ + objc_free(mutex); + return NULL; + } + + /* Initialize mutex */ + mutex->owner = NULL; + mutex->depth = 0; + return mutex; + } + + /* + Deallocate a mutex. Note that this includes an implicit mutex_lock to + insure that no one else is using the lock. It is legal to deallocate + a lock if we have a lock on it, but illegal to deallocate a lock held + by anyone else. + Returns the number of locks on the thread. (1 for deallocate). + */ + int + objc_mutex_deallocate(objc_mutex_t mutex) + { + int depth; + + /* Valid mutex? */ + if (!mutex) + return -1; + + /* Acquire lock on mutex */ + depth = objc_mutex_lock(mutex); + + /* Call backend to destroy mutex */ + if (__objc_mutex_deallocate(mutex)) + return -1; + + /* Free the mutex structure */ + objc_free(mutex); + + /* Return last depth */ + return depth; + } + + /* + Grab a lock on a mutex. If this thread already has a lock on this mutex + then we increment the lock count. If another thread has a lock on the + mutex we block and wait for the thread to release the lock. + Returns the lock count on the mutex held by this thread. + */ + int + objc_mutex_lock(objc_mutex_t mutex) + { + objc_thread_t thread_id; + int status; + + /* Valid mutex? */ + if (!mutex) + return -1; + + /* If we already own the lock then increment depth */ + thread_id = objc_thread_id(); + if (mutex->owner == thread_id) + return ++mutex->depth; + + /* Call the backend to lock the mutex */ + status = __objc_mutex_lock(mutex); + + /* Failed? */ + if (status) + return status; + + /* Successfully locked the thread */ + mutex->owner = thread_id; + return mutex->depth = 1; + } + + /* + Try to grab a lock on a mutex. If this thread already has a lock on + this mutex then we increment the lock count and return it. If another + thread has a lock on the mutex returns -1. + */ + int + objc_mutex_trylock(objc_mutex_t mutex) + { + objc_thread_t thread_id; + int status; + + /* Valid mutex? */ + if (!mutex) + return -1; + + /* If we already own the lock then increment depth */ + thread_id = objc_thread_id(); + if (mutex->owner == thread_id) + return ++mutex->depth; + + /* Call the backend to try to lock the mutex */ + status = __objc_mutex_trylock(mutex); + + /* Failed? */ + if (status) + return status; + + /* Successfully locked the thread */ + mutex->owner = thread_id; + return mutex->depth = 1; + } + + /* + Unlocks the mutex by one level. + Decrements the lock count on this mutex by one. + If the lock count reaches zero, release the lock on the mutex. + Returns the lock count on the mutex. + It is an error to attempt to unlock a mutex which this thread + doesn't hold in which case return -1 and the mutex is unaffected. + */ + int + objc_mutex_unlock(objc_mutex_t mutex) + { + objc_thread_t thread_id; + int status; + + /* Valid mutex? */ + if (!mutex) + return -1; + + /* If another thread owns the lock then abort */ + thread_id = objc_thread_id(); + if (mutex->owner != thread_id) + return -1; + + /* Decrement depth and return */ + if (mutex->depth > 1) + return --mutex->depth; + + /* Depth down to zero so we are no longer the owner */ + mutex->depth = 0; + mutex->owner = NULL; + + /* Have the backend unlock the mutex */ + status = __objc_mutex_unlock(mutex); + + /* Failed? */ + if (status) + return status; + + return 0; + } + + /* Frontend condition mutex functions */ + + /* + Allocate a condition. Return the condition pointer if successful or NULL + if the allocation failed for any reason. + */ + objc_condition_t + objc_condition_allocate(void) + { + objc_condition_t condition; + + /* Allocate the condition mutex structure */ + if (!(condition = + (objc_condition_t)objc_malloc(sizeof(struct objc_condition)))) + return NULL; + + /* Call the backend to create the condition mutex */ + if (__objc_condition_allocate(condition)) + { + /* failed! */ + objc_free(condition); + return NULL; + } + + /* Success! */ + return condition; + } + + /* + Deallocate a condition. Note that this includes an implicit + condition_broadcast to insure that waiting threads have the opportunity + to wake. It is legal to dealloc a condition only if no other + thread is/will be using it. Here we do NOT check for other threads + waiting but just wake them up. + */ + int + objc_condition_deallocate(objc_condition_t condition) + { + /* Broadcast the condition */ + if (objc_condition_broadcast(condition)) + return -1; + + /* Call the backend to destroy */ + if (__objc_condition_deallocate(condition)) + return -1; + + /* Free the condition mutex structure */ + objc_free(condition); + + return 0; + } + + /* + Wait on the condition unlocking the mutex until objc_condition_signal() + or objc_condition_broadcast() are called for the same condition. The + given mutex *must* have the depth set to 1 so that it can be unlocked + here, so that someone else can lock it and signal/broadcast the condition. + The mutex is used to lock access to the shared data that make up the + "condition" predicate. + */ + int + objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) + { + objc_thread_t thread_id; + + /* Valid arguments? */ + if (!mutex || !condition) + return -1; + + /* Make sure we are owner of mutex */ + thread_id = objc_thread_id(); + if (mutex->owner != thread_id) + return -1; + + /* Cannot be locked more than once */ + if (mutex->depth > 1) + return -1; + + /* Virtually unlock the mutex */ + mutex->depth = 0; + mutex->owner = (objc_thread_t)NULL; + + /* Call the backend to wait */ + __objc_condition_wait(condition, mutex); + + /* Make ourselves owner of the mutex */ + mutex->owner = thread_id; + mutex->depth = 1; + + return 0; + } + + /* + Wake up all threads waiting on this condition. It is recommended that + the called would lock the same mutex as the threads in objc_condition_wait + before changing the "condition predicate" and make this call and unlock it + right away after this call. + */ + int + objc_condition_broadcast(objc_condition_t condition) + { + /* Valid condition mutex? */ + if (!condition) + return -1; + + return __objc_condition_broadcast(condition); + } + + /* + Wake up one thread waiting on this condition. It is recommended that + the called would lock the same mutex as the threads in objc_condition_wait + before changing the "condition predicate" and make this call and unlock it + right away after this call. + */ + int + objc_condition_signal(objc_condition_t condition) + { + /* Valid condition mutex? */ + if (!condition) + return -1; + + return __objc_condition_signal(condition); + } + + /* End of File */