From 27a5e6d2451542c01368610801f14a76ec7cd369 Mon Sep 17 00:00:00 2001 From: mccallum Date: Thu, 22 Feb 1996 16:08:26 +0000 Subject: [PATCH] ([Invocation -objectReturnValue]): New method. ([Invocation -intReturnValue]): New method. ([Invocation -returnValueIsTrue]): New method. ([Invocation -initWithTarget:selector:...]): Use switch statement to handle value arguments, instead of pointer-to-value arguments. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@968 72102866-910b-0410-8b05-ffd578937521 --- Source/Invocation.m | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/Source/Invocation.m b/Source/Invocation.m index a5c379182..23cfe2b56 100644 --- a/Source/Invocation.m +++ b/Source/Invocation.m @@ -101,6 +101,33 @@ a return value yet. */ } +- objectReturnValue +{ + [self notImplemented: _cmd]; + return nil; +} + +- (int) intReturnValue +{ + [self notImplemented: _cmd]; + return 0; +} + +- (BOOL) returnValueIsTrue +{ + switch (return_size) + { + case sizeof(char): + return (*(char*)return_value != 0); + case sizeof(short): + return (*(short*)return_value != 0); + case sizeof(long): + return (*(long*)return_value != 0); + } + [self notImplemented: _cmd]; +} + + - (void) dealloc { OBJC_FREE(encoding); @@ -270,7 +297,23 @@ my_method_get_next_argument (arglist_t argframe, va_start (ap, s); while (datum) { - memcpy (datum, va_arg (ap, void*), objc_sizeof_type(tmptype)); + #define CASE_TYPE(_C,_T) case _C: *(_T*)datum = va_arg (ap, _T); break + switch (*tmptype) + { + CASE_TYPE(_C_ID, id); + CASE_TYPE(_C_LNG, long); + CASE_TYPE(_C_ULNG, unsigned long); + CASE_TYPE(_C_INT, int); + CASE_TYPE(_C_UINT, unsigned int); + CASE_TYPE(_C_SHT, short); + CASE_TYPE(_C_USHT, unsigned short); + CASE_TYPE(_C_CHR, char); + CASE_TYPE(_C_UCHR, unsigned char); + CASE_TYPE(_C_CHARPTR, char*); + default: + [self notImplemented: _cmd]; + // memcpy (datum, va_arg (ap, void*), objc_sizeof_type(tmptype)); + } datum = my_method_get_next_argument (argframe, &tmptype); } return self;