diff --git a/Headers/Additions/GNUstepBase/GNUstep.h b/Headers/Additions/GNUstepBase/GNUstep.h index 550a43e29..fa5a97cad 100644 --- a/Headers/Additions/GNUstepBase/GNUstep.h +++ b/Headers/Additions/GNUstepBase/GNUstep.h @@ -75,6 +75,139 @@ NSAutoreleasePool *(X) = [NSAutoreleasePool new] #define NSLocalizedStaticString(X, Y) X + +/* + * Check consistency of definitions for system compatibility. + */ +#if defined(STRICT_OPENSTEP) +#define GS_OPENSTEP_V 010000 +#define NO_GNUSTEP 1 +#elif defined(STRICT_MACOS_X) +#define GS_OPENSTEP_V 100000 +#define NO_GNUSTEP 1 +#else +#undef NO_GNUSTEP +#endif + +/* + * NB. The version values below must be integers ... by convention these are + * made up of two digits each for major, minor and subminor version numbers + * (ie each is in the range 00 to 99 though a leading zero in the major + * number is not permitted). + * So for a MacOS-X 10.3.9 release the version number would be 100309 + * + * You may define GS_GNUSTEP_V or GS_OPENSTEP_V to ensure that your + * program only 'sees' the specified varsion of the API. + */ + +/** + *

Macro to check a defined GNUstep version number (GS_GNUSTEP_V) against + * the supplied arguments. Returns true if no GNUstep version is specified, + * or if ADD <= version < REM, where ADD is the version + * number at which a feature guarded by the macro was introduced and + * REM is the version number at which it was removed. + *

+ *

The version number arguments are six digit integers where the first + * two digits are the major version number, the second two are the minor + * version number and the last two are the subminor number (all left padded + * with a zero where necessary). However, for convenience you can also + * use any of several predefined constants ... + * GS_API_NONE, + * GS_API_LATEST, + * GS_API_OSSPEC, + * GS_API_OPENSTEP, + * GS_API_MACOSX + *

+ *

Also see OS_API_VERSION + *

+ *

NB. If you are changing the API (eg adding a new feature) you need + * to control the visibility io the new header file code using
+ * #if GS_API_VERSION(ADD,GS_API_LATEST)
+ * where ADD is the version number of the next minor + * release after the most recent one.
+ * As a general principle you should not change the API with + * changing subminor version numbers ... as that tends to confuse + * people (though Apple has sometimes done it). + *

+ */ +#define GS_API_VERSION(ADD,REM) \ + (!defined(GS_GNUSTEP_V) || (GS_GNUSTEP_V >= ADD && GS_GNUSTEP_V < REM)) + +/** + *

Macro to check a defined OpenStep/OPENSTEP/MacOS-X version against the + * supplied arguments. Returns true if no version is specified, or if + * ADD <= version < REM, where ADD is the version + * number at which a feature guarded by the macro was introduced and + * REM is the version number at which it was removed. + *

+ *

The version number arguments are six digit integers where the first + * two digits are the major version number, the second two are the minor + * version number and the last two are the subminor number (all left padded + * with a zero where necessary). However, for convenience you can also + * use any of several predefined constants ... + * GS_API_NONE, + * GS_API_LATEST, + * GS_API_OSSPEC, + * GS_API_OPENSTEP, + * GS_API_MACOSX + *

+ *

Also see GS_API_VERSION + *

+ */ +#define OS_API_VERSION(ADD,REM) \ + (!defined(GS_OPENSTEP_V) || (GS_OPENSTEP_V >= ADD && GS_OPENSTEP_V < REM)) + +/** + * A constant which is the lowest possible version number (0) so that + * when used as the removal version (second argument of the GS_API_VERSION + * or OS_API_VERSION macro) represents a feature which is not present in + * any version.
+ * eg.
+ * #if OS_API_VERSION + * (GS_API_NONE, GS_API_NONE)
+ * denotes code not present in OpenStep/OPENSTEP/MacOS-X + */ +#define GS_API_NONE 0 + +/** + * A constant to represent a feature which is still present in the latest + * version. This is the highest possible version number.
+ * eg.
+ * #if OS_API_VERSION + * (GS_API_MACOSX, GS_API_LATEST)
+ * denotes code present from the initial MacOS-X version onwards. + */ +#define GS_API_LATEST 999999 + +/** + * The version number of the initial OpenStep specification.
+ * eg.
+ * #if OS_API_VERSION + * (GS_API_OSSPEC, GS_API_LATEST)
+ * denotes code present from the OpenStep specification onwards. + */ +#define GS_API_OSSPEC 10000 + +/** + * The version number of the first OPENSTEP implementation.
+ * eg.
+ * #if OS_API_VERSION + * (GS_API_OPENSTEP, GS_API_LATEST)
+ * denotes code present from the initial OPENSTEP version onwards. + */ +#define GS_API_OPENSTEP 40000 + +/** + * The version number of the first MacOS-X implementation.
+ * eg.
+ * #if OS_API_VERSION + * (GS_API_MACOSX, GS_API_LATEST)
+ * denotes code present from the initial MacOS-X version onwards. + */ +#define GS_API_MACOSX 100000 + +#else +#include #endif /* GNUSTEP */ #endif /* __GNUSTEP_GNUSTEP_H_INCLUDED_ */ diff --git a/Headers/Additions/GNUstepBase/GSFunctions.h b/Headers/Additions/GNUstepBase/GSFunctions.h index 8940e6b90..d17b921e6 100644 --- a/Headers/Additions/GNUstepBase/GSFunctions.h +++ b/Headers/Additions/GNUstepBase/GSFunctions.h @@ -37,9 +37,9 @@ extern "C" { #endif +#if GS_API_VERSION(GS_API_NONE,011500) @class NSArray; @class NSString; -#if GS_API_VERSION(GS_API_NONE,011500) /** * Try to locate file/directory (aName).(anExtension) in paths. * Will return the first found or nil if nothing is found.