parent
2a7c93ee56
commit
6a305f32b2
|
@ -141,7 +141,8 @@ __objc_code_unsigned_short (unsigned char* buf, unsigned short val)
|
|||
}
|
||||
|
||||
int
|
||||
objc_write_unsigned_short (struct objc_typed_stream* stream, unsigned short value)
|
||||
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);
|
||||
|
@ -252,7 +253,8 @@ __objc_code_unsigned_long (unsigned char* buf, unsigned long val)
|
|||
}
|
||||
|
||||
int
|
||||
objc_write_unsigned_long (struct objc_typed_stream* stream, unsigned long value)
|
||||
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);
|
||||
|
@ -315,7 +317,8 @@ objc_write_string_atomic (struct objc_typed_stream* stream,
|
|||
}
|
||||
|
||||
static int
|
||||
objc_write_register_common (struct objc_typed_stream* stream, unsigned long key)
|
||||
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);
|
||||
|
@ -488,7 +491,8 @@ objc_write_selector (struct objc_typed_stream* stream, SEL selector)
|
|||
else
|
||||
{
|
||||
int length;
|
||||
hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(sel_name)), (char*)sel_name);
|
||||
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;
|
||||
|
@ -840,8 +844,10 @@ objc_read_object (struct objc_typed_stream* stream, id* object)
|
|||
{
|
||||
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));
|
||||
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 */
|
||||
|
@ -948,7 +954,8 @@ objc_read_selector (struct objc_typed_stream* stream, SEL* selector)
|
|||
if (key)
|
||||
__objc_fatal("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));
|
||||
(*selector) = hash_value_for_key (stream->stream_table,
|
||||
LONG2PTR(key));
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -1019,7 +1026,8 @@ objc_write_type(TypedStream* stream, const char* type, const void* data)
|
|||
break;
|
||||
|
||||
case _C_ATOM:
|
||||
return objc_write_string_atomic (stream, *(char**)data, strlen(*(char**)data));
|
||||
return objc_write_string_atomic (stream, *(char**)data,
|
||||
strlen(*(char**)data));
|
||||
break;
|
||||
|
||||
case _C_ARY_B:
|
||||
|
|
|
@ -306,7 +306,8 @@ class_pose_as (Class impostor, Class super_class)
|
|||
if (CLS_ISCLASS (sub))
|
||||
{
|
||||
/* meta classes */
|
||||
CLASSOF (sub)->sibling_class = CLASSOF (impostor)->subclass_list;
|
||||
CLASSOF (sub)->sibling_class =
|
||||
CLASSOF (impostor)->subclass_list;
|
||||
CLASSOF (sub)->super_class = CLASSOF (impostor);
|
||||
CLASSOF (impostor)->subclass_list = CLASSOF (sub);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Basic data types for Objective C.
|
||||
Copyright (C) 1993, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
|
@ -103,9 +103,9 @@ struct objc_class {
|
|||
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. */
|
||||
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
|
||||
|
|
|
@ -174,7 +174,8 @@ sarray_at_put(struct sarray* array, sidx index, void* element)
|
|||
/* The bucket was previously empty (or something like that), */
|
||||
/* allocate a new. This is the effect of `lazy' allocation */
|
||||
new_bucket = (struct sbucket*)__objc_xmalloc(sizeof(struct sbucket));
|
||||
memcpy((void *) new_bucket, (const void*)array->empty_bucket, 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. */
|
||||
|
||||
|
|
|
@ -82,7 +82,8 @@ objc_thread_create(void (*func)(void *arg), void *arg)
|
|||
|
||||
if (pthread_create(&new_thread_handle, pthread_attr_default,
|
||||
(void *)func, arg) == 0) {
|
||||
thread_id = *(_objc_thread_t *)&new_thread_handle; /* ??? May not work! (64bit)*/
|
||||
/* ??? May not work! (64bit)*/
|
||||
thread_id = *(_objc_thread_t *)&new_thread_handle;
|
||||
pthread_detach(&new_thread_handle); /* Fully detach thread. */
|
||||
__objc_runtime_threads_alive++;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,8 @@ objc_thread_create(void (*func)(void *arg), void *arg)
|
|||
new_thread_handle = cthread_fork((cthread_fn_t)func, arg);
|
||||
|
||||
if(new_thread_handle) {
|
||||
thread_id = *(_objc_thread_t *)&new_thread_handle; /* this is not terribly portable */
|
||||
/* this is not terribly portable */
|
||||
thread_id = *(_objc_thread_t *)&new_thread_handle;
|
||||
cthread_detach(new_thread_handle); /* fully detach thread */
|
||||
__objc_runtime_threads_alive++; /* increment thread count */
|
||||
}
|
||||
|
@ -122,10 +123,10 @@ objc_thread_create(void (*func)(void *arg), void *arg)
|
|||
int
|
||||
objc_thread_set_priority(int priority)
|
||||
{
|
||||
_objc_thread_t *t = objc_thread_id();
|
||||
cthread_t cT = (cthread_t) t; /* see objc_thread_id() */
|
||||
int maxPriority = __mach_get_max_thread_priority(cT, NULL);
|
||||
int sys_priority = 0;
|
||||
_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;
|
||||
|
|
|
@ -24,10 +24,14 @@ Boston, MA 02111-1307, USA. */
|
|||
however invalidate any other reasons why the executable file might be
|
||||
covered by the GNU General Public License. */
|
||||
|
||||
#include <windows.h>
|
||||
#include <objc/thr.h>
|
||||
#include "runtime.h"
|
||||
|
||||
#ifndef __OBJC__
|
||||
#define __OBJC__
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
/********
|
||||
* This structure represents a single mutual exclusion lock. Lock semantics
|
||||
* are detailed with the subsequent functions. We use whatever lock is
|
||||
|
|
|
@ -27,10 +27,10 @@ Boston, MA 02111-1307, USA. */
|
|||
#include <stdlib.h>
|
||||
#include "runtime.h"
|
||||
|
||||
/*****************************************************************************
|
||||
/*************************************************************************
|
||||
* Universal static variables:
|
||||
*/
|
||||
int __objc_thread_exit_status = 0; /* Global exit status. */
|
||||
int __objc_thread_exit_status = 0; /* Global exit status. */
|
||||
|
||||
/* Flag which lets us know if we ever became multi threaded */
|
||||
int __objc_is_multi_threaded = 0;
|
||||
|
|
Loading…
Reference in New Issue