mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
changes intended to allow use of _Bool throughout
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39010 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
deba4a80da
commit
82e7f44a2c
17 changed files with 291 additions and 40 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,6 +1,25 @@
|
|||
2015-09-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSData.h:
|
||||
* Source/Additions/GSObjCRuntime.m:
|
||||
* Source/GSFFCallInvocation.m:
|
||||
* Source/GSFormat.m:
|
||||
* Source/GSValue.m:
|
||||
* Source/NSArchiver.m:
|
||||
* Source/NSData.m:
|
||||
* Source/NSDecimalNumber.m:
|
||||
* Source/NSKeyValueObserving.m:
|
||||
* Source/NSKeyedArchiver.m:
|
||||
* Source/NSKeyedUnarchiver.m:
|
||||
* Source/NSMethodSignature.m:
|
||||
* Source/NSPortCoder.m:
|
||||
* Source/NSUnarchiver.m:
|
||||
* Source/cifframe.m:
|
||||
Implement support for C99 _Bool type.
|
||||
|
||||
2015-09-22 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Headers\GNUstepBase\GSBlocks.h
|
||||
* Headers/GNUstepBase/GSBlocks.h
|
||||
Do not enable weak on mingw, because it works only with ELF.
|
||||
|
||||
2015-09-18 Riccardo Mottola <rm@gnu.org>
|
||||
|
|
|
@ -257,6 +257,7 @@ enum {
|
|||
#define _GSC_ULNG_LNG 0x0a
|
||||
#define _GSC_FLT 0x0b
|
||||
#define _GSC_DBL 0x0c
|
||||
#define _GSC_BOOL 0x0d
|
||||
|
||||
#define _GSC_ID 0x10
|
||||
#define _GSC_CLASS 0x11
|
||||
|
|
|
@ -1090,23 +1090,23 @@ GSObjCGetVal(NSObject *self, const char *key, SEL sel,
|
|||
}
|
||||
break;
|
||||
|
||||
#if defined(_C_BOOL)
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
{
|
||||
bool v;
|
||||
_Bool v;
|
||||
|
||||
if (sel == 0)
|
||||
{
|
||||
v = *(bool *)((char *)self + offset);
|
||||
v = *(_Bool *)((char *)self + offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool (*imp)(id, SEL) =
|
||||
(bool (*)(id, SEL))[self methodForSelector: sel];
|
||||
_Bool (*imp)(id, SEL) =
|
||||
(_Bool (*)(id, SEL))[self methodForSelector: sel];
|
||||
|
||||
v = (*imp)(self, sel);
|
||||
}
|
||||
val = [NSNumber numberWithBool: v];
|
||||
val = [NSNumber numberWithBool: (BOOL)v];
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -1555,21 +1555,21 @@ GSObjCSetVal(NSObject *self, const char *key, id val, SEL sel,
|
|||
}
|
||||
break;
|
||||
|
||||
#if defined(_C_BOOL)
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
{
|
||||
bool v = [val boolValue];
|
||||
_Bool v = (_Bool)[val boolValue];
|
||||
|
||||
if (sel == 0)
|
||||
{
|
||||
bool *ptr = (bool*)((char *)self + offset);
|
||||
_Bool *ptr = (_Bool*)((char *)self + offset);
|
||||
|
||||
*ptr = v;
|
||||
}
|
||||
else
|
||||
{
|
||||
void (*imp)(id, SEL, bool) =
|
||||
(void (*)(id, SEL, bool))[self methodForSelector: sel];
|
||||
void (*imp)(id, SEL, _Bool) =
|
||||
(void (*)(id, SEL, _Bool))[self methodForSelector: sel];
|
||||
|
||||
(*imp)(self, sel, v);
|
||||
}
|
||||
|
|
|
@ -425,6 +425,11 @@ gs_sel_type_to_callback_type (const char *sel_type,
|
|||
case _C_DBL:
|
||||
vatype->type = __VAdouble;
|
||||
break;
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
vatype->type = __VAuchar;
|
||||
break;
|
||||
#endif
|
||||
case _C_STRUCT_B:
|
||||
vatype->structSize = objc_sizeof_type (sel_type);
|
||||
if (vatype->structSize > sizeof (long)
|
||||
|
@ -580,31 +585,38 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
case _C_ID:
|
||||
av_start_ptr(alist, imp, id, retval);
|
||||
break;
|
||||
|
||||
case _C_CLASS:
|
||||
av_start_ptr(alist, imp, Class, retval);
|
||||
break;
|
||||
|
||||
case _C_SEL:
|
||||
av_start_ptr(alist, imp, SEL, retval);
|
||||
break;
|
||||
|
||||
case _C_PTR:
|
||||
av_start_ptr(alist, imp, void *, retval);
|
||||
break;
|
||||
|
||||
case _C_CHARPTR:
|
||||
av_start_ptr(alist, imp, char *, retval);
|
||||
break;
|
||||
|
||||
CASE_TYPE(_C_CHR, char, av_start_char)
|
||||
CASE_TYPE(_C_UCHR, unsigned char, av_start_uchar)
|
||||
CASE_TYPE(_C_SHT, short, av_start_short)
|
||||
CASE_TYPE(_C_USHT, unsigned short, av_start_ushort)
|
||||
CASE_TYPE(_C_INT, int, av_start_int)
|
||||
CASE_TYPE(_C_UINT, unsigned int, av_start_uint)
|
||||
CASE_TYPE(_C_LNG, long, av_start_long)
|
||||
CASE_TYPE(_C_ULNG, unsigned long, av_start_ulong)
|
||||
CASE_TYPE(_C_LNG_LNG, long long, av_start_longlong)
|
||||
CASE_TYPE(_C_ULNG_LNG, unsigned long long, av_start_ulonglong)
|
||||
CASE_TYPE(_C_FLT, float, av_start_float)
|
||||
CASE_TYPE(_C_DBL, double, av_start_double)
|
||||
CASE_TYPE(_C_CHR, char, av_start_char)
|
||||
CASE_TYPE(_C_UCHR, unsigned char, av_start_uchar)
|
||||
CASE_TYPE(_C_SHT, short, av_start_short)
|
||||
CASE_TYPE(_C_USHT, unsigned short, av_start_ushort)
|
||||
CASE_TYPE(_C_INT, int, av_start_int)
|
||||
CASE_TYPE(_C_UINT, unsigned int, av_start_uint)
|
||||
CASE_TYPE(_C_LNG, long, av_start_long)
|
||||
CASE_TYPE(_C_ULNG, unsigned long, av_start_ulong)
|
||||
CASE_TYPE(_C_LNG_LNG, long long, av_start_longlong)
|
||||
CASE_TYPE(_C_ULNG_LNG, unsigned long long, av_start_ulonglong)
|
||||
CASE_TYPE(_C_FLT, float, av_start_float)
|
||||
CASE_TYPE(_C_DBL, double, av_start_double)
|
||||
#if __GNUC__ != 2
|
||||
CASE_TYPE(_C_BOOL, _Bool, av_start_uchar)
|
||||
#endif
|
||||
|
||||
case _C_STRUCT_B:
|
||||
{
|
||||
|
@ -619,9 +631,11 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
info[0].size, split, retval);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_VOID:
|
||||
av_start_void(alist, imp);
|
||||
break;
|
||||
|
||||
default:
|
||||
NSCAssert1(0, @"GSFFCallInvocation: Return Type '%s' not implemented",
|
||||
info[0].type);
|
||||
|
@ -660,6 +674,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
av_ptr(alist, id, obj);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_CLASS:
|
||||
{
|
||||
Class obj;
|
||||
|
@ -667,6 +682,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
av_ptr(alist, Class, obj);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_SEL:
|
||||
{
|
||||
SEL sel;
|
||||
|
@ -674,6 +690,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
av_ptr(alist, SEL, sel);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_PTR:
|
||||
{
|
||||
void *ptr;
|
||||
|
@ -681,6 +698,7 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
av_ptr(alist, void *, ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_CHARPTR:
|
||||
{
|
||||
char *ptr;
|
||||
|
@ -689,23 +707,27 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
|
|||
break;
|
||||
}
|
||||
|
||||
CASE_TYPE(_C_CHR, char, av_char)
|
||||
CASE_TYPE(_C_UCHR, unsigned char, av_uchar)
|
||||
CASE_TYPE(_C_SHT, short, av_short)
|
||||
CASE_TYPE(_C_USHT, unsigned short, av_ushort)
|
||||
CASE_TYPE(_C_INT, int, av_int)
|
||||
CASE_TYPE(_C_UINT, unsigned int, av_uint)
|
||||
CASE_TYPE(_C_LNG, long, av_long)
|
||||
CASE_TYPE(_C_ULNG, unsigned long, av_ulong)
|
||||
CASE_TYPE(_C_LNG_LNG, long long, av_longlong)
|
||||
CASE_TYPE(_C_ULNG_LNG, unsigned long long, av_ulonglong)
|
||||
CASE_TYPE(_C_FLT, float, av_float)
|
||||
CASE_TYPE(_C_DBL, double, av_double)
|
||||
CASE_TYPE(_C_CHR, char, av_char)
|
||||
CASE_TYPE(_C_UCHR, unsigned char, av_uchar)
|
||||
CASE_TYPE(_C_SHT, short, av_short)
|
||||
CASE_TYPE(_C_USHT, unsigned short, av_ushort)
|
||||
CASE_TYPE(_C_INT, int, av_int)
|
||||
CASE_TYPE(_C_UINT, unsigned int, av_uint)
|
||||
CASE_TYPE(_C_LNG, long, av_long)
|
||||
CASE_TYPE(_C_ULNG, unsigned long, av_ulong)
|
||||
CASE_TYPE(_C_LNG_LNG, long long, av_longlong)
|
||||
CASE_TYPE(_C_ULNG_LNG, unsigned long long, av_ulonglong)
|
||||
CASE_TYPE(_C_FLT, float, av_float)
|
||||
CASE_TYPE(_C_DBL, double, av_double)
|
||||
#if __GNUC__ != 2
|
||||
CASE_TYPE(_C_BOOL, _Bool, av_uchar)
|
||||
#endif
|
||||
|
||||
case _C_STRUCT_B:
|
||||
_av_struct(alist, size,
|
||||
info[i+1].align, datum);
|
||||
break;
|
||||
|
||||
default:
|
||||
NSCAssert1(0, @"GSFFCallInvocation: Type '%s' not implemented",
|
||||
type);
|
||||
|
@ -994,24 +1016,28 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
[invocation setArgument: &obj atIndex: i];
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_CLASS:
|
||||
{
|
||||
Class obj = va_arg_ptr (args, Class);
|
||||
[invocation setArgument: &obj atIndex: i];
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_SEL:
|
||||
{
|
||||
SEL sel = va_arg_ptr (args, SEL);
|
||||
[invocation setArgument: &sel atIndex: i];
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_PTR:
|
||||
{
|
||||
void *ptr = va_arg_ptr (args, void *);
|
||||
[invocation setArgument: &ptr atIndex: i];
|
||||
break;
|
||||
}
|
||||
|
||||
case _C_CHARPTR:
|
||||
{
|
||||
char *ptr = va_arg_ptr (args, char *);
|
||||
|
@ -1031,6 +1057,9 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
CASE_TYPE(_C_ULNG_LNG, unsigned long long, va_arg_ulonglong)
|
||||
CASE_TYPE(_C_FLT, float, va_arg_float)
|
||||
CASE_TYPE(_C_DBL, double, va_arg_double)
|
||||
#if __GNUC__ != 2
|
||||
CASE_TYPE(_C_BOOL, _Bool, va_arg_uchar)
|
||||
#endif
|
||||
|
||||
case _C_STRUCT_B:
|
||||
{
|
||||
|
@ -1039,6 +1068,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
[invocation setArgument: ptr atIndex: i];
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
NSCAssert1(0, @"GSFFCallInvocation: Type '%s' not implemented",
|
||||
type);
|
||||
|
@ -1090,10 +1120,14 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
CASE_TYPE(_C_ULNG_LNG, unsigned long long, va_return_ulonglong)
|
||||
CASE_TYPE(_C_FLT, float, va_return_float)
|
||||
CASE_TYPE(_C_DBL, double, va_return_double)
|
||||
#if __GNUC__ != 2
|
||||
CASE_TYPE(_C_BOOL, _Bool, va_return_uchar)
|
||||
#endif
|
||||
|
||||
case _C_STRUCT_B:
|
||||
_va_return_struct(args, info[0].size, info[0].align, retval);
|
||||
break;
|
||||
|
||||
case _C_VOID:
|
||||
/* FIXME ... evil hack ... where the compiler did not know
|
||||
* selector types, if may have had to assume a method returning
|
||||
|
@ -1111,6 +1145,7 @@ GSInvocationCallback (void *callback_data, va_alist args)
|
|||
va_return_void(args);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
NSCAssert1(0, @"GSFFCallInvocation: Return Type '%s' not implemented",
|
||||
info[0].type);
|
||||
|
|
|
@ -1749,7 +1749,8 @@ NSDictionary *locale)
|
|||
}
|
||||
else
|
||||
{
|
||||
string = (unichar *) {'\0'};
|
||||
static unichar empty = 0;
|
||||
string = ∅
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,9 @@ typeSize(const char* type)
|
|||
case _C_ULNG_LNG: return sizeof(unsigned long long);
|
||||
case _C_FLT: return sizeof(float);
|
||||
case _C_DBL: return sizeof(double);
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL: return sizeof(_Bool);
|
||||
#endif
|
||||
case _C_PTR: return sizeof(void*);
|
||||
case _C_CHARPTR: return sizeof(char*);
|
||||
case _C_BFLD:
|
||||
|
|
|
@ -310,6 +310,9 @@ static Class NSMutableDataMallocClass;
|
|||
case _C_ULNG_LNG: info = _GSC_ULNG_LNG | _GSC_S_LNG_LNG; break;
|
||||
case _C_FLT: info = _GSC_FLT; break;
|
||||
case _C_DBL: info = _GSC_DBL; break;
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL: info = _GSC_BOOL; break;
|
||||
#endif
|
||||
default: info = _GSC_NONE; break;
|
||||
}
|
||||
|
||||
|
@ -681,6 +684,13 @@ static Class NSMutableDataMallocClass;
|
|||
(*_serImp)(_dst, serSel, (void*)buf, @encode(double), nil);
|
||||
return;
|
||||
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
(*_tagImp)(_dst, tagSel, _GSC_BOOL);
|
||||
(*_serImp)(_dst, serSel, (void*)buf, @encode(_Bool), nil);
|
||||
return;
|
||||
#endif
|
||||
|
||||
case _C_VOID:
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"can't encode void item"];
|
||||
|
|
|
@ -1385,6 +1385,15 @@ failure:
|
|||
*(double*)data = NSSwapBigDoubleToHost(nd);
|
||||
return;
|
||||
}
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
{
|
||||
[self deserializeBytes: data
|
||||
length: sizeof(_Bool)
|
||||
atCursor: cursor];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case _C_CLASS:
|
||||
{
|
||||
uint16_t ni;
|
||||
|
@ -2663,6 +2672,11 @@ failure:
|
|||
[self appendBytes: &nd length: sizeof(NSSwappedDouble)];
|
||||
return;
|
||||
}
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
[self appendBytes: data length: sizeof(_Bool)];
|
||||
return;
|
||||
#endif
|
||||
case _C_CLASS:
|
||||
{
|
||||
const char *name = *(Class*)data?class_getName(*(Class*)data):"";
|
||||
|
@ -3145,6 +3159,13 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
*(double*)data = NSSwapBigDoubleToHost(nd);
|
||||
return;
|
||||
}
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
{
|
||||
getBytes(data, bytes, sizeof(_Bool), length, cursor);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case _C_CLASS:
|
||||
{
|
||||
uint16_t ni;
|
||||
|
@ -3979,6 +4000,11 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
(*appendImp)(self, appendSel, &nd, sizeof(NSSwappedDouble));
|
||||
return;
|
||||
}
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
(*appendImp)(self, appendSel, data, sizeof(_Bool));
|
||||
return;
|
||||
#endif
|
||||
case _C_CLASS:
|
||||
{
|
||||
const char *name = *(Class*)data?class_getName(*(Class*)data):"";
|
||||
|
|
|
@ -324,6 +324,13 @@ static NSDecimalNumber *one;
|
|||
llval = (long long)v;
|
||||
break;
|
||||
}
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
{
|
||||
llval = (long long)((*(unsigned char *)value == 0) ? 0 : 1);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef _C_LNGLNG
|
||||
case _C_LNGLNG:
|
||||
#else
|
||||
|
|
|
@ -573,6 +573,12 @@ cifframe_callback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
imp = [[GSKVOSetter class]
|
||||
instanceMethodForSelector: @selector(setterDouble:)];
|
||||
break;
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
imp = [[GSKVOSetter class]
|
||||
instanceMethodForSelector: @selector(setterChar:)];
|
||||
break;
|
||||
#endif
|
||||
case _C_ID:
|
||||
case _C_CLASS:
|
||||
case _C_PTR:
|
||||
|
|
|
@ -792,6 +792,13 @@ static NSDictionary *makeReference(unsigned ref)
|
|||
[_enc setObject: o forKey: aKey];
|
||||
return;
|
||||
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
o = [NSNumber numberWithInt: (NSInteger)*(_Bool*)address];
|
||||
[_enc setObject: o forKey: aKey];
|
||||
return;
|
||||
#endif
|
||||
|
||||
case _C_STRUCT_B:
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"-[%@ %@]: this archiver cannote encode structs",
|
||||
|
|
|
@ -748,6 +748,12 @@ static NSMapTable *globalClassMap = 0;
|
|||
*(double*)address = [o doubleValue];
|
||||
return;
|
||||
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
*(_Bool*)address = (_Bool)[o unsignedCharValue];
|
||||
return;
|
||||
#endif
|
||||
|
||||
case _C_STRUCT_B:
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"-[%@ %@]: this archiver cannote decode structs",
|
||||
|
|
|
@ -332,6 +332,97 @@ next_arg(const char *typePtr, NSArgumentInfo *info, char *outTypes)
|
|||
info->align = __alignof__(char*);
|
||||
break;
|
||||
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
info->size = sizeof(_Bool);
|
||||
info->align = __alignof__(_Bool);
|
||||
break;
|
||||
#endif
|
||||
#if defined(_C_BFLD)
|
||||
case _C_BFLD:
|
||||
/* Rely on the runtime to either provide the info or bomb out.
|
||||
* Nowadays we ought to be able to expect modern enough runtimes.
|
||||
*/
|
||||
typePtr--;
|
||||
info->size = objc_sizeof_type(typePtr);
|
||||
info->align = objc_alignof_type(typePtr);
|
||||
typePtr = objc_skip_typespec(typePtr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(_C_COMPLEX)
|
||||
case _C_COMPLEX:
|
||||
switch (*typePtr++)
|
||||
{
|
||||
case _C_CHR:
|
||||
info->size = sizeof(_Complex char);
|
||||
info->align = __alignof__(_Complex char);
|
||||
break;
|
||||
|
||||
case _C_UCHR:
|
||||
info->size = sizeof(_Complex unsigned char);
|
||||
info->align = __alignof__(_Complex unsigned char);
|
||||
break;
|
||||
|
||||
case _C_SHT:
|
||||
info->size = sizeof(_Complex short);
|
||||
info->align = __alignof__(_Complex short);
|
||||
break;
|
||||
|
||||
case _C_USHT:
|
||||
info->size = sizeof(_Complex unsigned short);
|
||||
info->align = __alignof__(_Complex unsigned short);
|
||||
break;
|
||||
|
||||
case _C_INT:
|
||||
info->size = sizeof(_Complex int);
|
||||
info->align = __alignof__(_Complex int);
|
||||
break;
|
||||
|
||||
case _C_UINT:
|
||||
info->size = sizeof(_Complex unsigned int);
|
||||
info->align = __alignof__(_Complex unsigned int);
|
||||
break;
|
||||
|
||||
case _C_LNG:
|
||||
info->size = sizeof(_Complex long);
|
||||
info->align = __alignof__(_Complex long);
|
||||
break;
|
||||
|
||||
case _C_ULNG:
|
||||
info->size = sizeof(_Complex unsigned long);
|
||||
info->align = __alignof__(_Complex unsigned long);
|
||||
break;
|
||||
|
||||
case _C_LNG_LNG:
|
||||
info->size = sizeof(_Complex long long);
|
||||
info->align = __alignof__(_Complex long long);
|
||||
break;
|
||||
|
||||
case _C_ULNG_LNG:
|
||||
info->size = sizeof(_Complex unsigned long long);
|
||||
info->align = __alignof__(_Complex unsigned long long);
|
||||
break;
|
||||
|
||||
case _C_FLT:
|
||||
info->size = sizeof(_Complex float);
|
||||
info->align = __alignof__(_Complex float);
|
||||
break;
|
||||
|
||||
case _C_DBL:
|
||||
info->size = sizeof(_Complex double);
|
||||
info->align = __alignof__(_Complex double);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
NSLog(@"unknown complex type '%s'", typePtr-2);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ typeToName1(char type)
|
|||
case _C_CHARPTR: return "cstring";
|
||||
case _C_ARY_B: return "array";
|
||||
case _C_STRUCT_B: return "struct";
|
||||
case _C_BOOL: return "_Bool";
|
||||
default:
|
||||
{
|
||||
static char buf1[32];
|
||||
|
@ -170,6 +171,7 @@ typeToName2(char type)
|
|||
case _GSC_ULNG_LNG: return "unsigned long long";
|
||||
case _GSC_FLT: return "float";
|
||||
case _GSC_DBL: return "double";
|
||||
case _GSC_BOOL: return "_Bool";
|
||||
case _GSC_PTR: return "pointer";
|
||||
case _GSC_CHARPTR: return "cstring";
|
||||
case _GSC_ARY_B: return "array";
|
||||
|
@ -218,7 +220,7 @@ static char type_map[32] = {
|
|||
#endif
|
||||
_C_FLT,
|
||||
_C_DBL,
|
||||
0,
|
||||
_C_BOOL,
|
||||
0,
|
||||
0,
|
||||
_C_ID,
|
||||
|
@ -515,6 +517,7 @@ static unsigned encodingVersion;
|
|||
#endif
|
||||
case _C_FLT: info = _GSC_FLT; break;
|
||||
case _C_DBL: info = _GSC_DBL; break;
|
||||
case _C_BOOL: info = _GSC_BOOL; break;
|
||||
default: info = _GSC_NONE; break;
|
||||
}
|
||||
|
||||
|
@ -1028,6 +1031,17 @@ static unsigned encodingVersion;
|
|||
}
|
||||
return;
|
||||
|
||||
#if __GNUC__ != 2
|
||||
case _GSC_BOOL:
|
||||
if (*type != type_map[_GSC_BOOL])
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"expected %s and got %s",
|
||||
typeToName1(*type), typeToName2(info)];
|
||||
}
|
||||
(*_dDesImp)(_src, dDesSel, address, type, &_cursor, nil);
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"read unknown type info - %d", info];
|
||||
|
@ -1200,6 +1214,7 @@ static unsigned encodingVersion;
|
|||
case _C_ULNG_LNG: info = _GSC_ULNG_LNG | _GSC_S_LNG_LNG; break;
|
||||
case _C_FLT: info = _GSC_FLT; break;
|
||||
case _C_DBL: info = _GSC_DBL; break;
|
||||
case _C_BOOL: info = _GSC_BOOL; break;
|
||||
default: info = _GSC_NONE; break;
|
||||
}
|
||||
|
||||
|
@ -1798,6 +1813,13 @@ static unsigned encodingVersion;
|
|||
(*_eSerImp)(_dst, eSerSel, (void*)buf, @encode(double), nil);
|
||||
return;
|
||||
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL:
|
||||
(*_eTagImp)(_dst, eTagSel, _GSC_BOOL);
|
||||
(*_eSerImp)(_dst, eSerSel, (void*)buf, @encode(_Bool), nil);
|
||||
return;
|
||||
#endif
|
||||
|
||||
case _C_VOID:
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"can't encode void item"];
|
||||
|
|
|
@ -78,6 +78,7 @@ typeToName1(char type)
|
|||
case _C_ULNG_LNG: return "unsigned long long";
|
||||
case _C_FLT: return "float";
|
||||
case _C_DBL: return "double";
|
||||
case _C_BOOL: return "_Bool";
|
||||
case _C_PTR: return "pointer";
|
||||
case _C_CHARPTR: return "cstring";
|
||||
case _C_ARY_B: return "array";
|
||||
|
@ -123,6 +124,7 @@ typeToName2(char type)
|
|||
case _GSC_ULNG_LNG: return "unsigned long long";
|
||||
case _GSC_FLT: return "float";
|
||||
case _GSC_DBL: return "double";
|
||||
case _GSC_BOOL: return "_Bool";
|
||||
case _GSC_PTR: return "pointer";
|
||||
case _GSC_CHARPTR: return "cstring";
|
||||
case _GSC_ARY_B: return "array";
|
||||
|
@ -166,7 +168,7 @@ static char type_map[32] = {
|
|||
_C_ULNG_LNG,
|
||||
_C_FLT,
|
||||
_C_DBL,
|
||||
0,
|
||||
_C_BOOL,
|
||||
0,
|
||||
0,
|
||||
_C_ID,
|
||||
|
@ -608,6 +610,7 @@ static unsigned encodingVersion;
|
|||
case _C_ULNG_LNG: info = _GSC_ULNG_LNG; break;
|
||||
case _C_FLT: info = _GSC_FLT; break;
|
||||
case _C_DBL: info = _GSC_DBL; break;
|
||||
case _C_BOOL: info = _GSC_BOOL; break;
|
||||
default: info = _GSC_NONE; break;
|
||||
}
|
||||
|
||||
|
@ -1257,6 +1260,16 @@ static unsigned encodingVersion;
|
|||
}
|
||||
return;
|
||||
|
||||
case _GSC_BOOL:
|
||||
if (*type != type_map[_GSC_BOOL])
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"expected %s and got %s",
|
||||
typeToName1(*type), typeToName2(info)];
|
||||
}
|
||||
(*desImp)(src, desSel, address, type, &cursor, nil);
|
||||
return;
|
||||
|
||||
default:
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"read unknown type info - %d", info];
|
||||
|
|
|
@ -540,6 +540,10 @@ cifframe_type(const char *typePtr, const char **advance)
|
|||
|
||||
case _C_VOID: ftype = &ffi_type_void;
|
||||
break;
|
||||
#if __GNUC__ != 2
|
||||
case _C_BOOL: ftype = &ffi_type_uchar;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ftype = &ffi_type_void;
|
||||
NSCAssert(0, @"Unknown type in sig");
|
||||
|
|
|
@ -215,7 +215,7 @@ NSLog(@"'%@', '%@'", NSUserName(), [attr fileOwnerAccountName]);
|
|||
PASS(YES == exists && YES == isDir, "directory exists");
|
||||
if (exists && isDir)
|
||||
{
|
||||
dir - [dir stringByStandardizingPath];
|
||||
dir = [dir stringByStandardizingPath];
|
||||
PASS([mgr removeFileAtPath: dir handler: nil], "removed directory");
|
||||
PASS(![mgr fileExistsAtPath: dir], "directory no longer exists");
|
||||
GSPrintf(stdout, @"%@\n", dir);
|
||||
|
|
Loading…
Reference in a new issue