Header fixups for MacOSX

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15864 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2003-02-03 04:15:27 +00:00
parent bc085ac3a9
commit 072d3f3719
14 changed files with 125 additions and 35 deletions

View file

@ -1,3 +1,18 @@
2003-02-02 Stephane Corthesy <stephane@sente.ch>
Adam Fedor <fedor@gnu.org>
* Headers/gnustep/base/GSObjCRuntime.h (GS_STATIC_INLINE): Rename
from FOUNDATION_STATIC_INLINE
* Headers/gnustep/base/GCObject.h, GSXML.h: include
Foundation/Foundation.h on MacOSX.
* Source/Additions/GCArray.m, GCDictionary.m, GCObject.m: Idem.
* Source/Additions/GSCompatibility.[hm]: Change category names to
GSCompatibility.
* Source/Additions/GSNextRuntime.m (ROUND): Expand inline due to
gcc 3.1 compile problems.
* Source/Additions/Unicode.m: Don't define GetEncodingName on MacOSX
Added #ifdef HAVE_ICONV around definition of iconv_stringforencoding().
2003-02-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/Unicode.m: Fix error in check for legality of

View file

@ -30,10 +30,14 @@
#ifndef __INCLUDED_GCOBJECT_H
#define __INCLUDED_GCOBJECT_H
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSObject.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSMapTable.h>
#else
#include <Foundation/Foundation.h>
#endif
@class GCObject;

View file

@ -110,18 +110,15 @@ GS_EXPORT id GSGetValue(NSObject *self, NSString *key, SEL sel,
GS_EXPORT void GSSetValue(NSObject *self, NSString *key, id val, SEL sel,
const char *type, unsigned size, int offset);
#include <base/objc-gnu2next.h>
#include <gnustep/base/objc-gnu2next.h>
#ifndef FOUNDATION_EXPORT
#define FOUNDATION_EXPORT
#define FOUNDATION_STATIC_INLINE static inline
#endif
#define GS_STATIC_INLINE static inline
/*
* GSObjCClass() return the class of an instance.
* The argument to this function must NOT be nil.
*/
FOUNDATION_STATIC_INLINE Class
GS_STATIC_INLINE Class
GSObjCClass(id obj)
{
return obj->class_pointer;
@ -131,7 +128,7 @@ GSObjCClass(id obj)
* GSObjCIsInstance() tests to see if an id is an instance.
* The argument to this function must NOT be nil.
*/
FOUNDATION_STATIC_INLINE BOOL
GS_STATIC_INLINE BOOL
GSObjCIsInstance(id obj)
{
return CLS_ISCLASS(obj->class_pointer);
@ -141,7 +138,7 @@ GSObjCIsInstance(id obj)
* GSObjCIsKindOf() tests to see if a class inherits from another class
* The argument to this function must NOT be nil.
*/
FOUNDATION_STATIC_INLINE BOOL
GS_STATIC_INLINE BOOL
GSObjCIsKindOf(Class this, Class other)
{
while (this != Nil)
@ -157,7 +154,7 @@ GSObjCIsKindOf(Class this, Class other)
/** ## deprecated ##
*/
FOUNDATION_STATIC_INLINE const char*
GS_STATIC_INLINE const char*
GSObjCName(Class this)
{
return class_get_class_name(this);
@ -165,7 +162,7 @@ GSObjCName(Class this)
/** ## deprecated ##
*/
FOUNDATION_STATIC_INLINE const char*
GS_STATIC_INLINE const char*
GSObjCSelectorName(SEL this)
{
if (this == 0)
@ -175,7 +172,7 @@ GSObjCSelectorName(SEL this)
/** ## deprecated ##
*/
FOUNDATION_STATIC_INLINE const char*
GS_STATIC_INLINE const char*
GSObjCSelectorTypes(SEL this)
{
return sel_get_type(this);
@ -186,7 +183,7 @@ GSObjCSelectorTypes(SEL this)
* a nul pointer if the class cannot be found. <br />
* If the argument is nil, return a nul pointer.
*/
FOUNDATION_STATIC_INLINE Class
GS_STATIC_INLINE Class
GSClassFromName(const char *name)
{
if (name == 0)
@ -198,7 +195,7 @@ GSClassFromName(const char *name)
* Return the name of the supplied class, or a nul pointer if no class
* was supplied.
*/
FOUNDATION_STATIC_INLINE const char*
GS_STATIC_INLINE const char*
GSNameFromClass(Class this)
{
if (this == 0)
@ -210,7 +207,7 @@ GSNameFromClass(Class this)
* Return the name of the supplied selector, or a nul pointer if no selector
* was supplied.
*/
FOUNDATION_STATIC_INLINE const char*
GS_STATIC_INLINE const char*
GSNameFromSelector(SEL this)
{
if (this == 0)
@ -223,7 +220,7 @@ GSNameFromSelector(SEL this)
* supplied. The returned selector could be any one with the name.<br />
* If no selector exists, returns nil.
*/
FOUNDATION_STATIC_INLINE SEL
GS_STATIC_INLINE SEL
GSSelectorFromName(const char *name)
{
if (name == 0)
@ -242,7 +239,7 @@ GSSelectorFromName(const char *name)
* argument is nul. <br />
* Creates a new selector if necessary.
*/
FOUNDATION_STATIC_INLINE SEL
GS_STATIC_INLINE SEL
GSSelectorFromNameAndTypes(const char *name, const char *types)
{
if (name == 0)
@ -282,7 +279,7 @@ GSSelectorFromNameAndTypes(const char *name, const char *types)
* May return a nul pointer if the selector was a nul pointer or if it
* was not typed.
*/
FOUNDATION_STATIC_INLINE const char*
GS_STATIC_INLINE const char*
GSTypesFromSelector(SEL this)
{
if (this == 0)
@ -291,13 +288,13 @@ GSTypesFromSelector(SEL this)
}
FOUNDATION_STATIC_INLINE Class
GS_STATIC_INLINE Class
GSObjCSuper(Class this)
{
return class_get_super_class(this);
}
FOUNDATION_STATIC_INLINE int
GS_STATIC_INLINE int
GSObjCVersion(Class this)
{
return class_get_version(this);
@ -306,7 +303,12 @@ GSObjCVersion(Class this)
/*
* Return the zone in which an object belongs, without using the zone method
*/
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSZone.h>
#else
#include <Foundation/Foundation.h>
#endif
GS_EXPORT NSZone *GSObjCZone(NSObject *obj);
/*

View file

@ -34,9 +34,13 @@
#ifndef __GSXML_H__
#define __GSXML_H__
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSObject.h>
#include <Foundation/NSString.h>
#include <Foundation/NSDictionary.h>
#else
#include <Foundation/Foundation.h>
#endif
#ifndef STRICT_MACOS_X
#ifndef STRICT_OPENSTEP

View file

@ -25,9 +25,13 @@
#include "config.h"
#include <string.h>
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSException.h>
#include <Foundation/NSRange.h>
#include <Foundation/NSString.h>
#else
#include <Foundation/Foundation.h>
#endif
#include <gnustep/base/GSObjCRuntime.h>
#include <gnustep/base/GCObject.h>

View file

@ -24,8 +24,12 @@
*/
#include "config.h"
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSException.h>
#include <Foundation/NSString.h>
#else
#include <Foundation/Foundation.h>
#endif
#include <gnustep/base/GSObjCRuntime.h>
#include <gnustep/base/GCObject.h>

View file

@ -28,10 +28,14 @@
*/
#include "config.h"
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSString.h>
#include <Foundation/NSThread.h>
#else
#include <Foundation/Foundation.h>
#endif
#include <gnustep/base/GCObject.h>
#include "GSCompatibility.h"

View file

@ -143,13 +143,13 @@ typedef enum _NSGNUstepStringEncoding
NSBIG5StringEncoding // Traditional chinese
} NSGNUstepStringEncoding;
@interface NSObject(GNUStepGlue)
@interface NSObject(GSCompatibility)
+ (id) notImplemented:(SEL)selector;
- (BOOL) isInstance;
@end
// Used only in EOFault.m, -[EOFault forward::], for Object compatibility
@interface NSInvocation(GNUStepGlue)
@interface NSInvocation(GSCompatibility)
- (retval_t) returnFrame:(arglist_t)args;
- (id) initWithArgframe:(arglist_t)args selector:(SEL)selector;
@end
@ -157,12 +157,12 @@ typedef enum _NSGNUstepStringEncoding
GS_EXPORT NSArray *NSStandardLibraryPaths();
GS_EXPORT NSString *GetEncodingName(NSStringEncoding availableEncodingValue);
@interface NSString(GNUStepGlue)
@interface NSString(GSCompatibility)
- (BOOL) boolValue;
@end
GS_EXPORT BOOL GSDebugSet(NSString *level);
@interface NSProcessInfo(GNUStepGlue)
@interface NSProcessInfo(GSCompatibility)
- (NSMutableSet *) debugSet;
@end

View file

@ -25,6 +25,7 @@
#include "config.h"
#include <objc/objc-class.h>
#include "GSCompatibility.h"
#include "GSCategories.h"
/* FIXME: Need to initialize this */
NSRecursiveLock *gnustep_global_lock = NULL;
@ -107,7 +108,7 @@ GSDebugFunctionMsg(const char *func, const char *file, int line, NSString *fmt)
@end
@implementation NSProcessInfo(GNUStepGlue)
@implementation NSProcessInfo(GSCompatibility)
static NSMutableSet *_debug_set = nil;
@ -157,7 +158,7 @@ BOOL GSDebugSet(NSString *level)
@end
@implementation NSString(GNUStepGlue)
@implementation NSString(GSCompatibility)
// From GNUStep
/**
@ -180,7 +181,7 @@ BOOL GSDebugSet(NSString *level)
@end
@implementation NSInvocation(GNUStepGlue)
@implementation NSInvocation(GSCompatibility)
- (retval_t) returnFrame:(arglist_t)args
{
#warning (stephane@sente.ch) Not implemented
@ -195,11 +196,10 @@ BOOL GSDebugSet(NSString *level)
@end
@implementation NSObject(GNUStepGlue)
@implementation NSObject(GSCompatibility)
+ (id) notImplemented:(SEL)selector
{
#warning (stephane@sente.ch) Not implemented
[NSException raise: NSGenericException
format: @"method %s not implemented in %s(class)",
selector ? sel_get_name(selector) : "(null)",
@ -214,4 +214,3 @@ selector ? sel_get_name(selector) : "(null)",
}
@end

View file

@ -24,7 +24,7 @@
#include "config.h"
#include <stdio.h>
#include <base/preface.h>
#include <gnustep/base/preface.h>
#ifndef ROUND
#define ROUND(V, A) \
({ typeof(V) __v=(V); typeof(A) __a=(A); \
@ -113,7 +113,17 @@ objc_sizeof_type(const char* type)
while (*type != _C_STRUCT_E)
{
align = objc_alignof_type (type); /* padd to alignment */
#if 0
acc_size = ROUND (acc_size, align);
#else
// acc_size = ({int __v=(acc_size); int __a=(align); __a*((__v+__a-1)/__a); });
{
int __v = acc_size;
int __a = align;
acc_size = __a * ((__v + __a - 1) / __a);
}
#endif
acc_size += objc_sizeof_type (type); /* add component size */
type = objc_skip_typespec (type); /* skip component */
}
@ -243,7 +253,15 @@ objc_aligned_size (const char* type)
{
int size = objc_sizeof_type (type);
int align = objc_alignof_type (type);
#if 0
return ROUND (size, align);
#else
// return ({int __v=(size); int __a=(align); __a*((__v+__a-1)/__a); });
int __v = size;
int __a = align;
return __a * ((__v + __a - 1) / __a);
#endif
}
/*
@ -257,7 +275,15 @@ objc_promoted_size (const char* type)
int size = objc_sizeof_type (type);
int wordsize = sizeof (void*);
#if 0
return ROUND (size, wordsize);
#else
// return ({int __v=(size); int __a=(wordsize); __a*((__v+__a-1)/__a); });
int __v = size;
int __a = wordsize;
return __a * ((__v + __a - 1) / __a);
#endif
}
/*

View file

@ -29,7 +29,8 @@
*/
#include "config.h"
#include <base/preface.h>
#include <gnustep/base/preface.h>
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSArray.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSEnumerator.h>
@ -38,7 +39,10 @@
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSString.h>
#include <Foundation/NSValue.h>
#include <base/GSObjCRuntime.h>
#else
#include <Foundation/Foundation.h>
#endif
#include <gnustep/base/GSObjCRuntime.h>
#include <string.h>
/** Deprecated ... use GSObjCFindVariable() */
@ -632,8 +636,12 @@ GSObjCAddClassBehavior(Class receiver, Class behavior)
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSValue.h>
#include <Foundation/NSKeyValueCoding.h>
#else
#include <Foundation/Foundation.h>
#endif
/** Deprecated ... use GSObjCGetValue() */
id

View file

@ -44,6 +44,7 @@
#ifdef HAVE_LIBXML
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/GSXML.h>
#include <Foundation/NSData.h>
#include <Foundation/NSValue.h>
@ -54,6 +55,9 @@
#include <Foundation/NSCharacterSet.h>
#include <Foundation/NSFileManager.h>
#include <Foundation/NSInvocation.h>
#else
#include <Foundation/Foundation.h>
#endif
/* libxml headers */
#include <libxml/tree.h>
@ -3237,10 +3241,14 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
#else
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSInvocation.h>
#include <Foundation/NSString.h>
#else
#include <Foundation/Foundation.h>
#endif
/*
* Build dummy implementations of the classes if libxml is not available

View file

@ -28,14 +28,18 @@
*/
#include "config.h"
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSArray.h>
#include <Foundation/NSBundle.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSString.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSPathUtilities.h>
#else
#include <Foundation/Foundation.h>
#endif
#include "GSCompatibility.h"
#include <base/Unicode.h>
#include <gnustep/base/Unicode.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -602,12 +606,15 @@ GSEncodingName(NSStringEncoding encoding)
/**
* <strong>deprecated</strong> Use GSEncodingName()
*/
#ifndef NeXT_Foundation_LIBRARY
NSString*
GetEncodingName(NSStringEncoding encoding)
{
return GSEncodingName(encoding);
}
#endif
#ifdef HAVE_ICONV
static const char *
iconv_stringforencoding(NSStringEncoding encoding)
{
@ -617,6 +624,7 @@ iconv_stringforencoding(NSStringEncoding encoding)
}
return encodingTable[encoding]->iconv;
}
#endif
/**
* <strong>deprecated</strong>

View file

@ -50,10 +50,14 @@
#include "config.h"
#include <stdio.h>
#include <base/preface.h>
#include <base/behavior.h>
#include <gnustep/base/preface.h>
#include <gnustep/base/behavior.h>
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSException.h>
#include <Foundation/NSString.h>
#else
#include <Foundation/Foundation.h>
#endif
static BOOL class_is_kind_of(Class self, Class class);