More defs for Darwin.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10791 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2001-08-28 18:45:17 +00:00
parent 210a1351d0
commit 0154d18d92
7 changed files with 83 additions and 4 deletions

View file

@ -780,7 +780,7 @@ static BOOL deallocNotifications = NO;
}
if (types == 0)
{
types = aSelector->sel_types;
types = sel_get_type(aSelector);
}
if (types == 0)
{
@ -2332,9 +2332,11 @@ GSSetValue(NSObject *self, NSString *key, id val, SEL sel,
+ (int) streamVersion: (TypedStream*)aStream
{
#ifndef NeXT_RUNTIME
if (aStream->mode == OBJC_READONLY)
return objc_get_stream_class_version (aStream, self);
else
#endif
return class_get_version (self);
}

View file

@ -577,6 +577,22 @@ method_types_get_next_argument (arglist_t argf, const char **type)
}
}
char*
method_types_get_first_argument (struct objc_method* m,
arglist_t argframe,
const char** type)
{
*type = m->method_types;
return method_get_next_argument (argframe, type);
}
int
method_types_get_sizeof_arguments (struct objc_method* mth)
{
const char* type = objc_skip_typespec (mth->method_types);
return atoi (type);
}
/* mframe_dissect_call()

View file

@ -125,3 +125,11 @@ mframe_destroy_argframe(const char *types, arglist_t argframe);
({ typeof(V) __v=(V); typeof(A) __a=(A); \
__a*((__v+__a-1)/__a); })
int method_types_get_sizeof_arguments (struct objc_method* mth);
char* method_types_get_next_argument (arglist_t argf, const char **type);
char* method_types_get_first_argument (struct objc_method* m,
arglist_t argframe,
const char** type);

View file

@ -25,6 +25,7 @@
#include "config.h"
#include <stdio.h>
#include <base/preface.h>
#include "mframe.h"
#ifndef ROUND
#define ROUND(V, A) \
@ -445,7 +446,33 @@ sel_types_match (const char* t1, const char* t2)
return NO;
}
id next_objc_msg_sendv(id object, SEL op, void* frame)
{
arglist_t argFrame = __builtin_apply_args();
Method *m = class_get_instance_method(object->class_pointer, op);
const char *type;
void *result;
argFrame->arg_ptr = frame;
*((id*)method_types_get_first_argument (m, argFrame, &type)) = object;
*((SEL*)method_types_get_next_argument (argFrame, &type)) = op;
result = __builtin_apply((apply_t)m->method_imp,
argFrame,
method_get_sizeof_arguments (m));
#if !defined(BROKEN_BUILTIN_APPLY) && defined(i386)
/* Special hack to avoid pushing the poped float value back to the fp
stack on i386 machines. This happens with NeXT runtime and 2.7.2
compiler. If the result value is floating point don't call
__builtin_return anymore. */
if(*m->method_types == _C_FLT || *m->method_types == _C_DBL) {
long double value = *(long double*)(((char*)result) + 8);
asm("fld %0" : : "f" (value));
}
else
#endif
__builtin_return(result);
}
/*
** Hook functions for memory allocation and disposal.