Initial update

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/libobjc/trunk@9783 72102866-910b-0410-8b05-ffd578937521
main
fedor 25 years ago
parent 3788b5ee9a
commit 3dcf666e04

@ -0,0 +1,15 @@
2001-05-04 Adam Fedor <fedor@gnu.org>
* Previous changes before importing into GNUstep CVS.
* hash.c (hash_add): cast cachep to int.
* init.c: Change DEBUG to DEBUG_RUNTIME
* libobjc.def: Remove NXConstantString, add thread functions.
* linking.m: Remove NXConstantString
* selector.c (__sel_register_typed_name): Cast soffset_decode to int.
* sendmsg.c: Declare __objc_generate_gc_type_description extern
* objc/hash.h: Change extern to objc_EXPORT
* objc/runtime.h: Likewise. Change DEBUG to DEBUG_RUNTIME
* objc/objc-decl.h: New file.
* config: New config directory

@ -0,0 +1,188 @@
#
# GNUmakefile
#
# Copyright (C) 1998 MDlink online service center, Helge Hess
# All rights reserved.
#
# Author: Helge Hess (helge@mdlink.de)
#
# This file is part of the MDlink Object Framework 2 (MOF2)
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation.
#
# We disclaim all warranties with regard to this software, including all
# implied warranties of merchantability and fitness, in no event shall
# we be liable for any special, indirect or consequential damages or any
# damages whatsoever resulting from loss of use, data or profits, whether in
# an action of contract, negligence or other tortious action, arising out of
# or in connection with the use or performance of this software.
#
# $Id$
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/common.make
PACKAGE_NAME = gnustep-objc
VERSION=1.0.0
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
# Make sure it doesn't get installed in library_combo dir
LIBRARY_INSTALL_DIR = $(GNUSTEP_TARGET_LIBRARIES)
LIBRARY_NAME = libobjc
# dce, decosf1, irix, mach, os2, posix, pthreads, single, solaris, vxworks
THREADING = posix
ifeq ($(GNUSTEP_TARGET_OS),mingw32)
THREADING = win32
endif
GC_HEADER_FILES_DIR = ./gc/include
GC_HEADER_FILES = \
cord.h \
ec.h \
gc.h \
gc_alloc.h \
gc_cpp.h \
gc_inl.h \
gc_inline.h \
gc_typed.h \
weakpointer.h \
libobjc_HEADER_FILES = \
objc/hash.h objc/objc-list.h objc/sarray.h \
objc/objc.h objc/objc-api.h objc/objc-decls.h \
objc/NXConstStr.h objc/Object.h \
objc/Protocol.h objc/encoding.h objc/typedstream.h \
objc/thr.h
libobjc_OBJC_FILES = \
Object.m \
Protocol.m \
linking.m
ifeq ($(GNUSTEP_TARGET_OS), cygwin)
extra_C_FILES=libobjc_entry.c
else
extra_C_FILES=
endif
libobjc_C_FILES = \
archive.c \
class.c \
encoding.c \
gc.c \
hash.c \
init.c \
misc.c \
nil_method.c \
objects.c \
sarray.c \
selector.c \
sendmsg.c \
thr-$(THREADING).c \
thr.c \
$(extra_C_FILES)
# Add -DDEBUG_RUNTIME to add debug printf statments
ADDITIONAL_CPPFLAGS += \
-DIN_GCC \
-pipe \
-DSTDC_HEADERS=1\
-DHAVE_STDLIB_H
CC1OBJ = `$(CC) -print-prog-name=cc1obj`
ADDITIONAL_CFLAGS += -Wall
libobjc_HEADER_FILES_DIR = .
libobjc_HEADER_FILES_INSTALL_DIR =
libobjc_DLL_DEF = libobjc.def
ifeq ($(THREADING), single)
ADDITIONAL_CPPFLAGS += -DOBJC_WITHOUT_THREADING
endif
ifeq ($(gc), yes)
ADDITIONAL_CPPFLAGS += -DOBJC_WITH_GC=1 -DGC_DEBUG=1
ADDITIONAL_CPPFLAGS += -DDEBUG_OBJC_GC=0
libobjc_LIBRARIES_DEPEND_UPON += -lgc
ifeq ($(THREADING), solaris)
ADDITIONAL_CPPFLAGS += -DSOLARIS_THREADS
endif
else # gc
ADDITIONAL_CPPFLAGS += -DOBJC_WITH_GC=0 -DDEBUG_OBJC_GC=0
endif
ifeq ($(gc), xyes)
GC_OFILES = \
alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o \
headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o \
malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o \
typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o \
dyn_load.o \
ADDITIONAL_LIBRARY_OBJ_FILES = $(addprefix gc/, $(GC_OFILES))
endif
# Additional directories to be created during installation
ADDITIONAL_INSTALL_DIRS = $(GNUSTEP_HEADERS)/objc
-include config/$(GNUSTEP_TARGET_CPU)/config.make
-include config/$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/config.make
-include GNUmakefile.preamble
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/library.make
-include GNUmakefile.postamble
#ADDITIONAL_INCLUDE_DIRS += -Iobjc -I. -I../gcc -I../gcc/config
ADDITIONAL_INCLUDE_DIRS += \
-Iconfig/$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS) \
-Iconfig/$(GNUSTEP_TARGET_CPU)/generic \
-Iobjc -I.
before-all:: runtime-info.h
ifeq ($(gc),xyes)
after-install::
for file in $(GC_HEADER_FILES) __done; do \
if [ $$file != __done ]; then \
$(INSTALL_DATA) $(GC_HEADER_FILES_DIR)/$$file \
$(GNUSTEP_HEADERS)$(libobjc_HEADER_FILES_INSTALL_DIR)/$$file ; \
fi; \
done;
endif
$(GNUSTEP_OBJ_DIR)/thr-backends: $(GNUSTEP_OBJ_DIR)
@if [ ! -d $@ ]; then echo mkdir $@; mkdir $@; fi
runtime-info.h:
echo "" > tmp-runtime
echo "/* This file is automatically generated */" > $@
$(CC1OBJ) -print-objc-runtime-info tmp-runtime >> $@
rm -f tmp-runtime
after-clean::
rm -f runtime-info.h tmp-runtime.s
after-distclean::
rm -f config.status config.log config.cache

@ -0,0 +1,55 @@
This is a snapshot of the GCC libobjc library, which includes
a patch that fixes dallocation of posix threads, ffi library support
and other things that are not in the gcc 2.95.2 release.
In addition, a GNUmakefile file has been added so this library can be compiled
stand-alone (i.e. without the rest of the gcc sources). However, you
must have the gstep-make package installed first to do this. The library
will compile as a shared library by default (on systems that support this),
and install in the GNUstep directory structure. After doing this, recompile
GNUstep - which will automatically use the new library rather than the
default one installed with gcc.
Note this library is only meant to be used with GNUstep, since it is missing
the NXConstStr class (which GNUstep provides).
To compile this library, don't run the configure script. First edit the
GNUmakefile to set the type of threading you want, then type
make
make install
On MingW and Cygwin systems you need to explicitly add 'shared=yes' to make
(if you want DLLs, that is, otherwise use shared=no):
make shared=yes
------------------------------------------------------------------------
Changes:
------------------------------------------------------------------------
Version 1.0.0
-------------
Set threading for mingw32. Use DEBUG_RUNTIME rather than DEBUG to add
debugging statements.
Version 0.9.2
-------------
Added objc_thread_add, objc_thread_remove, and a few more objc_EXPORTS for
Windows.
Version 0.9.2
-------------
Added more config dirs. Changed extern to objc_EXPORT for Windows machines.
Changed package name to gnustep-objc to avoid possible conflicts
Version 0.9.1
-------------
Comment out NXConstantString from linking.m so there won't be a reference
to it (needed by MingW). Added config/ix86/generic
Version 0.9.0
-------------
Added config directory with various platforms. Added GNUmakefile.
Added libobjc.spec.in for RPM generation.

@ -0,0 +1,4 @@
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 64
#define PCC_BITFIELD_TYPE_MATTERS 1
#define STRUCTURE_SIZE_BOUNDARY 8

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,5 @@
#define STRUCTURE_SIZE_BOUNDARY 16
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 64

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
# $Id$
ADDITIONAL_CPPFLAGS += -DPRECOMPUTE_SELECTORS=1

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,4 @@
#define STRUCTURE_SIZE_BOUNDARY 8
#define PCC_BITFIELD_TYPE_MATTERS 1
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32

@ -0,0 +1,11 @@
Release: 1
Source: ftp://ftp.gnustep.org/pub/gnustep/libs/%{gs_name}-%{gs_version}.tar.gz
Copyright: GPL
Group: Development/Libraries
Summary: Objective-C Runtime Library
Packager: Adam Fedor <fedor@gnu.org>
Vendor: The GNUstep Project
URL: http://www.gnustep.org/
%description
Library containing the Objective-C runtime.

@ -154,7 +154,7 @@ hash_add (cache_ptr *cachep, const void *key, void *value)
(*cachep)->compare_func);
DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n",
*cachep, (*cachep)->size, new->size);
(int) *cachep, (*cachep)->size, new->size);
/* Copy the nodes from the first hash table to the new one. */
while ((node1 = hash_next (*cachep, node1)))

@ -280,7 +280,7 @@ objc_postorder_traverse (objc_class_tree *tree,
}
/* Used to print a tree class hierarchy. */
#ifdef DEBUG
#ifdef DEBUG_RUNTIME
static void
__objc_tree_print (objc_class_tree *tree, int level)
{
@ -444,7 +444,7 @@ objc_init_statics (void)
gather the module pointers so that they may be processed by the
initialization routines as soon as possible */
void
objc_DECLARE void
__objc_exec_class (Module_t module)
{
/* Have we processed any constructors previously? This flag is used to
@ -688,7 +688,7 @@ static void objc_send_load (void)
while (__objc_class_tree_list)
{
#ifdef DEBUG
#ifdef DEBUG_RUNTIME
objc_preorder_traverse (__objc_class_tree_list->head,
0, __objc_tree_print);
#endif

@ -49,7 +49,6 @@ objc_thread_add
objc_thread_remove
__objc_class_name_Object
__objc_class_name_Protocol
__objc_class_name_NXConstantString
objc_error
__objc_object_alloc
__objc_object_copy
@ -60,6 +59,15 @@ object_dispose
__objc_init_selector_tables
__objc_register_selectors_from_class
__sel_register_typed_name
__objc_runtime_mutex
__objc_is_multi_threaded
__objc_runtime_threads_alive
objc_set_thread_callback
objc_condition_allocate
objc_condition_deallocate
objc_condition_wait
objc_condition_broadcast
objc_condition_signal
sel_get_any_typed_uid
sel_get_any_uid
sel_get_name

@ -35,6 +35,6 @@ Boston, MA 02111-1307, USA. */
void __objc_linking (void)
{
[Object name];
[NXConstantString name];
//[NXConstantString name];
}

@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA. */
#include <stddef.h>
#include <string.h>
#include <objc/objc-decls.h>
#include <objc/objc.h>
/*
@ -103,7 +104,7 @@ typedef struct cache
/* Two important hash tables. */
extern cache_ptr module_hash_table, class_hash_table;
objc_EXPORT cache_ptr module_hash_table, class_hash_table;
/* Allocate and initialize a hash table. */

@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA. */
#ifndef __objc_api_INCLUDE_GNU
#define __objc_api_INCLUDE_GNU
#include "objc/objc-decls.h"
#include "objc/objc.h"
#include "objc/hash.h"
#include "objc/thr.h"
@ -96,8 +97,8 @@ struct objc_method_description
** 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);
objc_EXPORT void objc_error(id object, int code, const char* fmt, ...);
objc_EXPORT 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);
@ -135,7 +136,7 @@ objc_error_handler objc_set_error_handler(objc_error_handler func);
** Set this variable nonzero to print a line describing each
** message that is sent. (this is currently disabled)
*/
extern BOOL objc_trace;
objc_EXPORT BOOL objc_trace;
/* For every class which happens to have statically allocated instances in
@ -356,7 +357,7 @@ retval_t objc_msg_sendv(id, SEL, arglist_t);
** 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);
objc_EXPORT Class (*_objc_lookup_class)(const char *name);
/*
** This is a hook which is called by __objc_exec_class every time a class
@ -364,14 +365,14 @@ extern Class (*_objc_lookup_class)(const char *name);
** 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);
objc_EXPORT 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);
objc_EXPORT id (*_objc_object_alloc)(Class class);
objc_EXPORT id (*_objc_object_copy)(id object);
objc_EXPORT id (*_objc_object_dispose)(id object);
/*
** Standard functions for memory allocation and disposal.
@ -407,19 +408,19 @@ objc_free(void *mem);
** 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 *);
objc_EXPORT void *(*_objc_malloc)(size_t);
objc_EXPORT void *(*_objc_atomic_malloc)(size_t);
objc_EXPORT void *(*_objc_valloc)(size_t);
objc_EXPORT void *(*_objc_realloc)(void *, size_t);
objc_EXPORT void *(*_objc_calloc)(size_t, size_t);
objc_EXPORT void (*_objc_free)(void *);
/*
** Hook for method forwarding. This makes it easy to substitute a
** library, such as ffcall, that implements closures, thereby avoiding
** gcc's __builtin_apply problems.
*/
extern IMP (*__objc_msg_forward)(SEL);
objc_EXPORT IMP (*__objc_msg_forward)(SEL);
Method_t class_get_class_method(MetaClass class, SEL aSel);
@ -452,7 +453,7 @@ SEL sel_register_typed_name(const char *name, const char*type);
BOOL sel_is_mapped (SEL aSel);
extern id class_create_instance(Class class);
objc_EXPORT id class_create_instance(Class class);
static inline const char *
class_get_class_name(Class class)
@ -511,7 +512,7 @@ class_get_gc_object_type (Class class)
}
/* Mark the instance variable as innaccessible to the garbage collector */
extern void class_ivar_set_gcinvisible (Class class,
objc_EXPORT void class_ivar_set_gcinvisible (Class class,
const char* ivarname,
BOOL gcInvisible);

@ -0,0 +1,17 @@
// $Id$
#ifndef __objc_decls_H__
#define __objc_decls_H__
#if BUILD_libobjc_DLL
# define objc_EXPORT __declspec(dllexport)
# define objc_DECLARE __declspec(dllexport)
#elif libobjc_ISDLL
# define objc_EXPORT extern __declspec(dllimport)
# define objc_DECLARE extern __declspec(dllimport)
#else
# define objc_EXPORT extern
# define objc_DECLARE
#endif
#endif /* __objc_decls_H__ */

@ -42,38 +42,38 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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) */
objc_EXPORT void __objc_add_class_to_hash(Class); /* (objc-class.c) */
objc_EXPORT void __objc_init_selector_tables(void); /* (objc-sel.c) */
objc_EXPORT void __objc_init_class_tables(void); /* (objc-class.c) */
objc_EXPORT void __objc_init_dispatch_tables(void); /* (objc-dispatch.c) */
objc_EXPORT void __objc_install_premature_dtable(Class); /* (objc-dispatch.c) */
objc_EXPORT void __objc_resolve_class_links(void); /* (objc-class.c) */
objc_EXPORT void __objc_register_selectors_from_class(Class); /* (objc-sel.c) */
objc_EXPORT 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 */
objc_EXPORT int __objc_init_thread_system(void); /* thread.c */
objc_EXPORT int __objc_fini_thread_system(void); /* thread.c */
objc_EXPORT void __objc_print_dtable_stats(void); /* sendmsg.c */
extern void class_add_method_list(Class, MethodList_t);
objc_EXPORT 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);
objc_EXPORT void __objc_register_instance_methods_to_class(Class);
objc_EXPORT 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;
objc_EXPORT BOOL __objc_class_links_resolved;
/* Number of selectors stored in each of the selector tables */
extern int __objc_selector_max_index;
objc_EXPORT int __objc_selector_max_index;
/* Mutex locking __objc_selector_max_index and its arrays. */
extern objc_mutex_t __objc_runtime_mutex;
objc_EXPORT objc_mutex_t __objc_runtime_mutex;
/* Number of threads which are alive. */
extern int __objc_runtime_threads_alive;
objc_EXPORT int __objc_runtime_threads_alive;
#ifdef DEBUG
#ifdef DEBUG_RUNTIME
#define DEBUG_PRINTF(format, args...) printf (format, ## args)
#else
#define DEBUG_PRINTF(format, args...)

@ -402,7 +402,7 @@ __sel_register_typed_name (const char *name, const char *types,
}
DEBUG_PRINTF ("Record selector %s[%s] as: %ld\n", name, types,
soffset_decode (i));
(long) soffset_decode (i));
{
int is_new = (l == 0);

@ -59,6 +59,8 @@ static void __objc_install_dispatch_table_for_class (Class);
/* Forward declare some functions */
static void __objc_init_install_dtable(id, SEL);
extern void __objc_generate_gc_type_description (Class class);
/* Various forwarding functions that are used based upon the
return type for the selector.
__objc_block_forward for structures.

Loading…
Cancel
Save