mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Improve versioning macros
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21279 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2676653a26
commit
2f39ffd602
5 changed files with 77 additions and 32 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-06-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Headers/Foundation/NSObject.h: Add subminor number to versioning
|
||||||
|
macros as apple sometimes add/remove things at subminor versions.
|
||||||
|
Add some constants for versions.
|
||||||
|
* Tools/AGSParser.m: Support subminor version info
|
||||||
|
* Tools/AGSHatm.m: ditto
|
||||||
|
|
||||||
2005-06-04 Richard Frith-Macdonald <rfm@gnu.org>
|
2005-06-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Headers/Foundation/NSFileManager.h: hide private method in enumerator,
|
* Headers/Foundation/NSFileManager.h: hide private method in enumerator,
|
||||||
|
|
|
@ -40,15 +40,15 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NB. The version values below must be integers ... by convention these are
|
* NB. The version values below must be integers ... by convention these are
|
||||||
* made up of two digits each for major and minor version numbers
|
* made up of two digits each for major, minor and subminor version numbers
|
||||||
* (ie each is in the range 00 to 99) with subminor numbers ignored.
|
* (ie each is in the range 00 to 99).
|
||||||
* So for a MacOS-X 10.3.9 release the version number would be 1003
|
* 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
|
* You may define GS_GNUSTEP_V or GS_OPENSTEP_V to ensure that your
|
||||||
* program only 'sees' the specified vartsion of the API.
|
* program only 'sees' the specified varsion of the API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Macro to check a defined GNUstep version number (GS_GNUSTEP_V) against the
|
* Macro to check a defined GNUstep version number (GS_GNUSTEP_V) against the
|
||||||
* supplied arguments. Returns true if no GNUstep version is specified,
|
* supplied arguments. Returns true if no GNUstep version is specified,
|
||||||
* or if ADD <= VER < REM
|
* or if ADD <= VER < REM
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
#define GS_API_VERSION(ADD,REM) \
|
#define GS_API_VERSION(ADD,REM) \
|
||||||
(!defined(GS_GNUSTEP_V) || (GS_GNUSTEP_V >= ADD && GS_GNUSTEP_V < 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
|
* Macro to check a defined OpenStep/OPENSTEP/MacOS-X version against the
|
||||||
* supplied arguments. Returns true if no version is specified, or if
|
* supplied arguments. Returns true if no version is specified, or if
|
||||||
* ADD <= VER < REM
|
* ADD <= VER < REM
|
||||||
|
@ -64,6 +64,26 @@
|
||||||
#define OS_API_VERSION(ADD,REM) \
|
#define OS_API_VERSION(ADD,REM) \
|
||||||
(!defined(GS_OPENSTEP_V) || (GS_OPENSTEP_V >= ADD && GS_OPENSTEP_V < REM))
|
(!defined(GS_OPENSTEP_V) || (GS_OPENSTEP_V >= ADD && GS_OPENSTEP_V < REM))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A constant to represent a feature which is still present in the latest
|
||||||
|
* version. This is the highest possible version number.
|
||||||
|
*/
|
||||||
|
#define GS_API_LATEST 999999
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version number of the initial OpenStep specification
|
||||||
|
*/
|
||||||
|
#define GS_API_OSSPEC 000000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version number of the first OPENSTEP implemenation
|
||||||
|
*/
|
||||||
|
#define GS_API_OPENSTEP 040000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version number of the first MacOS-X implementation
|
||||||
|
*/
|
||||||
|
#define GS_API_MACOSX 100000
|
||||||
|
|
||||||
#include <Foundation/NSObjCRuntime.h>
|
#include <Foundation/NSObjCRuntime.h>
|
||||||
#include <GNUstepBase/preface.h>
|
#include <GNUstepBase/preface.h>
|
||||||
|
|
|
@ -299,7 +299,7 @@ enum {
|
||||||
- (const char*) cString;
|
- (const char*) cString;
|
||||||
#ifndef STRICT_OPENSTEP
|
#ifndef STRICT_OPENSTEP
|
||||||
|
|
||||||
#if OS_API_VERSION(1004,9999) && GS_API_VERSION(0102,9999)
|
#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST)
|
||||||
- (const char*) cStringUsingEncoding: (NSStringEncoding)encoding;
|
- (const char*) cStringUsingEncoding: (NSStringEncoding)encoding;
|
||||||
- (void) getCString: (char*)buffer
|
- (void) getCString: (char*)buffer
|
||||||
maxLength: (unsigned int)maxLength
|
maxLength: (unsigned int)maxLength
|
||||||
|
|
|
@ -2368,12 +2368,12 @@ static NSString *mainFont = nil;
|
||||||
}
|
}
|
||||||
else if (add < 10)
|
else if (add < 10)
|
||||||
{
|
{
|
||||||
[buf appendString: @"OPENSTEP"];
|
[buf appendString: @"OPENSTEP "];
|
||||||
[buf appendString: ovadd];
|
[buf appendString: ovadd];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[buf appendString: @"MacOS-X"];
|
[buf appendString: @"MacOS-X "];
|
||||||
[buf appendString: ovadd];
|
[buf appendString: ovadd];
|
||||||
}
|
}
|
||||||
if (dep > add)
|
if (dep > add)
|
||||||
|
@ -2381,12 +2381,12 @@ static NSString *mainFont = nil;
|
||||||
[buf appendString: @" deprecated at "];
|
[buf appendString: @" deprecated at "];
|
||||||
if (add < 10)
|
if (add < 10)
|
||||||
{
|
{
|
||||||
[buf appendString: @"OPENSTEP"];
|
[buf appendString: @"OPENSTEP "];
|
||||||
[buf appendString: ovdep];
|
[buf appendString: ovdep];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[buf appendString: @"MacOS-X"];
|
[buf appendString: @"MacOS-X "];
|
||||||
[buf appendString: ovdep];
|
[buf appendString: ovdep];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2395,12 +2395,12 @@ static NSString *mainFont = nil;
|
||||||
[buf appendString: @" removed at "];
|
[buf appendString: @" removed at "];
|
||||||
if (add < 10)
|
if (add < 10)
|
||||||
{
|
{
|
||||||
[buf appendString: @"OPENSTEP"];
|
[buf appendString: @"OPENSTEP "];
|
||||||
[buf appendString: ovrem];
|
[buf appendString: ovrem];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[buf appendString: @"MacOS-X"];
|
[buf appendString: @"MacOS-X "];
|
||||||
[buf appendString: ovrem];
|
[buf appendString: ovrem];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2976,10 +2976,8 @@ fail:
|
||||||
ver = [self parseVersion];
|
ver = [self parseVersion];
|
||||||
if ([ver length] == 0)
|
if ([ver length] == 0)
|
||||||
{
|
{
|
||||||
ver = @"0";
|
ver = @"0.0.0";
|
||||||
}
|
}
|
||||||
i = [ver intValue];
|
|
||||||
ver = [NSString stringWithFormat: @"%d.%d", i/100, i%100];
|
|
||||||
if (openstep)
|
if (openstep)
|
||||||
{
|
{
|
||||||
[top setObject: ver forKey: @"ovadd"];
|
[top setObject: ver forKey: @"ovadd"];
|
||||||
|
@ -2997,12 +2995,10 @@ fail:
|
||||||
ver = [self parseVersion];
|
ver = [self parseVersion];
|
||||||
if ([ver length] == 0)
|
if ([ver length] == 0)
|
||||||
{
|
{
|
||||||
ver = @"9999";
|
ver = @"99.99.99";
|
||||||
}
|
}
|
||||||
i = [ver intValue];
|
if ([ver isEqualToString: @"99.99.99"] == NO)
|
||||||
if (i != 9999 && [ver isEqualToString: @"NEVER"] == NO)
|
|
||||||
{
|
{
|
||||||
ver = [NSString stringWithFormat: @"%d.%d", i/100, i%100];
|
|
||||||
if (openstep)
|
if (openstep)
|
||||||
{
|
{
|
||||||
[top setObject: ver forKey: @"ovrem"];
|
[top setObject: ver forKey: @"ovrem"];
|
||||||
|
@ -3020,12 +3016,10 @@ fail:
|
||||||
ver = [self parseVersion];
|
ver = [self parseVersion];
|
||||||
if ([ver length] == 0)
|
if ([ver length] == 0)
|
||||||
{
|
{
|
||||||
ver = @"9999";
|
ver = @"99.99.99";
|
||||||
}
|
}
|
||||||
i = [ver intValue];
|
if ([ver isEqualToString: @"99.99.99"] == NO)
|
||||||
if (i != 9999 && [ver isEqualToString: @"NEVER"] == NO)
|
|
||||||
{
|
{
|
||||||
ver = [NSString stringWithFormat: @"%d.%d", i/100, i%100];
|
|
||||||
if (openstep)
|
if (openstep)
|
||||||
{
|
{
|
||||||
[top setObject: ver forKey: @"ovdep"];
|
[top setObject: ver forKey: @"ovdep"];
|
||||||
|
@ -3343,7 +3337,8 @@ fail:
|
||||||
|
|
||||||
- (NSString*) parseVersion
|
- (NSString*) parseVersion
|
||||||
{
|
{
|
||||||
unsigned start;
|
unsigned i;
|
||||||
|
NSString *str;
|
||||||
|
|
||||||
while (pos < length && [spaces characterIsMember: buffer[pos]] == YES)
|
while (pos < length && [spaces characterIsMember: buffer[pos]] == YES)
|
||||||
{
|
{
|
||||||
|
@ -3355,18 +3350,40 @@ fail:
|
||||||
}
|
}
|
||||||
if (!isdigit(buffer[pos]))
|
if (!isdigit(buffer[pos]))
|
||||||
{
|
{
|
||||||
return [self parseIdentifier];
|
str = [self parseIdentifier];
|
||||||
}
|
}
|
||||||
start = pos;
|
else
|
||||||
while (pos < length)
|
|
||||||
{
|
{
|
||||||
if (!isdigit(buffer[pos]))
|
i = pos;
|
||||||
|
while (pos < length)
|
||||||
{
|
{
|
||||||
break;
|
if (!isdigit(buffer[pos]))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pos++;
|
||||||
}
|
}
|
||||||
pos++;
|
str = [NSString stringWithCharacters: &buffer[i] length: pos - i];
|
||||||
}
|
}
|
||||||
return [NSString stringWithCharacters: &buffer[start] length: pos - start];
|
if ([str isEqualToString: @"GS_API_LATEST"] == YES)
|
||||||
|
{
|
||||||
|
str = @"999999";
|
||||||
|
}
|
||||||
|
else if ([str isEqualToString: @"GS_API_OSSPEC"] == YES)
|
||||||
|
{
|
||||||
|
str = @"000000";
|
||||||
|
}
|
||||||
|
else if ([str isEqualToString: @"GS_API_OPENSTEP"] == YES)
|
||||||
|
{
|
||||||
|
str = @"000400";
|
||||||
|
}
|
||||||
|
else if ([str isEqualToString: @"GS_API_MACOSX"] == YES)
|
||||||
|
{
|
||||||
|
str = @"100000";
|
||||||
|
}
|
||||||
|
i = [str intValue];
|
||||||
|
return [NSString stringWithFormat: @"%d.%d.%d",
|
||||||
|
i/10000, (i/100)%100, i%100];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) reset
|
- (void) reset
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue