2010-02-19 08:12:46 +00:00
|
|
|
/* Header file for all objective-c code in the base library.
|
|
|
|
* This imports all the common headers in a consistent order such that
|
|
|
|
* we can be sure only local headers are used rather than any which
|
|
|
|
* might be from an earlier build.
|
|
|
|
*/
|
|
|
|
|
2014-06-18 22:49:39 +00:00
|
|
|
#ifndef COMMON_H
|
|
|
|
#define COMMON_H
|
|
|
|
|
|
|
|
#include "config.h"
|
2012-10-30 13:35:00 +00:00
|
|
|
|
2012-04-27 11:58:56 +00:00
|
|
|
#if defined(HAVE_STRING_H)
|
2012-09-03 13:36:45 +00:00
|
|
|
/* For POSIX strerror_r() and others
|
2012-04-27 11:58:56 +00:00
|
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
|
2012-10-30 13:35:00 +00:00
|
|
|
#if defined(HAVE_STRINGS_H)
|
|
|
|
/* For strcasecmp() and others
|
|
|
|
*/
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
2012-04-27 11:58:56 +00:00
|
|
|
#include <errno.h>
|
|
|
|
|
2010-03-12 13:55:11 +00:00
|
|
|
/* If this is included in a file in the Additions subdirectory, and we are
|
|
|
|
* building for use with the NeXT/Apple Foundation, then we need to import
|
|
|
|
* the native headers in preference to any of our own.
|
|
|
|
*/
|
|
|
|
#if defined(NeXT_Foundation_LIBRARY)
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#endif
|
|
|
|
|
2010-02-20 18:05:00 +00:00
|
|
|
#import "GNUstepBase/GSConfig.h"
|
2013-04-14 09:04:40 +00:00
|
|
|
#import "GNUstepBase/GSVersionMacros.h"
|
2010-02-19 08:12:46 +00:00
|
|
|
|
2011-02-16 06:26:14 +00:00
|
|
|
/* Set localisation macro for use within the base library itsself.
|
|
|
|
*/
|
|
|
|
#define GS_LOCALISATION_BUNDLE \
|
|
|
|
[NSBundle bundleForLibrary: @"gnustep-base" version: \
|
|
|
|
OBJC_STRINGIFY(GNUSTEP_BASE_MAJOR_VERSION.GNUSTEP_BASE_MINOR_VERSION)]
|
|
|
|
|
2010-02-25 05:26:57 +00:00
|
|
|
#import "GNUstepBase/GNUstep.h"
|
|
|
|
|
2010-02-19 08:12:46 +00:00
|
|
|
/* Foundation/NSObject.h imports <Foundation/NSZone.h> and
|
|
|
|
* <Foundation/NSObjCRuntime.h> so we import local versions first.
|
|
|
|
*/
|
|
|
|
#import "Foundation/NSZone.h"
|
|
|
|
#import "Foundation/NSObjCRuntime.h"
|
|
|
|
|
|
|
|
/* Almost all headers import <Foundation/NSObject.h> so we import
|
|
|
|
* "Foundation/NSObject.h" first, to ensure we have a local copy.
|
|
|
|
*/
|
|
|
|
#import "Foundation/NSObject.h"
|
2013-08-22 15:44:54 +00:00
|
|
|
#import "GNUstepBase/NSObject+GNUstepBase.h"
|
2010-02-19 08:12:46 +00:00
|
|
|
|
|
|
|
/* These headers are used in almost every file.
|
|
|
|
*/
|
|
|
|
#import "Foundation/NSString.h"
|
|
|
|
#import "Foundation/NSDebug.h"
|
2011-02-16 06:26:14 +00:00
|
|
|
|
2011-02-20 07:58:11 +00:00
|
|
|
/* These headers needed for string localisation ... hopefully we will
|
|
|
|
* localise all the exceptions and debug/error messages in all the source
|
|
|
|
* some day, so localisation needs ot be in the common header for all code.
|
|
|
|
*/
|
2011-02-15 06:25:54 +00:00
|
|
|
#import "Foundation/NSBundle.h"
|
|
|
|
#import "GNUstepBase/NSBundle+GNUstepBase.h"
|
|
|
|
|
2011-10-14 16:54:33 +00:00
|
|
|
/* We need to wrap unistd.h because it is used throughout the code and some
|
2011-10-20 09:52:01 +00:00
|
|
|
* versions include __block as a variable name, and clang also defines that
|
|
|
|
* and depends on the definition later ... so we resort to the fragile hack
|
|
|
|
* of redefining according to the observed definition.
|
2011-10-14 16:54:33 +00:00
|
|
|
*/
|
2011-10-14 15:46:13 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2011-10-20 09:52:01 +00:00
|
|
|
# ifdef __block
|
|
|
|
# undef __block
|
|
|
|
# define __block __gs_unistd_block
|
|
|
|
# include <unistd.h>
|
|
|
|
# undef __block
|
|
|
|
# define __block __attribute__((__blocks__(byref)))
|
2011-10-22 13:59:05 +00:00
|
|
|
# else
|
|
|
|
# define __block __gs_unistd_block
|
|
|
|
# include <unistd.h>
|
|
|
|
# undef __block
|
2011-10-20 09:52:01 +00:00
|
|
|
# endif
|
2011-10-14 15:46:13 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-18 16:58:12 +00:00
|
|
|
/* Redefine some functions/variables when using the MSVC ABI on Windows.
|
2021-01-18 13:20:14 +00:00
|
|
|
*/
|
|
|
|
#ifdef _MSC_VER
|
2021-08-10 15:06:26 +00:00
|
|
|
# include <io.h>
|
2021-01-18 13:20:14 +00:00
|
|
|
# define strncasecmp _strnicmp
|
|
|
|
# define strcasecmp _stricmp
|
|
|
|
# define write(fd, buffer, count) _write(fd, buffer, count)
|
|
|
|
# define close(fd) _close(fd)
|
2021-08-18 16:58:12 +00:00
|
|
|
|
|
|
|
// time.h
|
|
|
|
# define tzset _tzset
|
|
|
|
# define tzname _tzname
|
|
|
|
# define timezone _timezone
|
|
|
|
# define daylight _daylight
|
2021-01-18 13:20:14 +00:00
|
|
|
#endif
|
|
|
|
|
2014-06-18 22:49:39 +00:00
|
|
|
#endif /* COMMON_H */
|