diff --git a/ChangeLog b/ChangeLog index a34f65a7e..d1757bd92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-06-04 Richard Frith-Macdonald + + * 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 * Headers/Foundation/NSFileManager.h: hide private method in enumerator, diff --git a/Headers/Foundation/NSObject.h b/Headers/Foundation/NSObject.h index b73ab91bd..f7cb96c81 100644 --- a/Headers/Foundation/NSObject.h +++ b/Headers/Foundation/NSObject.h @@ -40,15 +40,15 @@ /* * NB. The version values below must be integers ... by convention these are - * made up of two digits each for major and minor version numbers - * (ie each is in the range 00 to 99) with subminor numbers ignored. - * So for a MacOS-X 10.3.9 release the version number would be 1003 + * made up of two digits each for major, minor and subminor version numbers + * (ie each is in the range 00 to 99). + * 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 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 * supplied arguments. Returns true if no GNUstep version is specified, * or if ADD <= VER < REM @@ -56,7 +56,7 @@ #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 <= VER < REM @@ -64,6 +64,26 @@ #define OS_API_VERSION(ADD,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 #include diff --git a/Headers/Foundation/NSString.h b/Headers/Foundation/NSString.h index b0c2f1689..f6c7987a9 100644 --- a/Headers/Foundation/NSString.h +++ b/Headers/Foundation/NSString.h @@ -299,7 +299,7 @@ enum { - (const char*) cString; #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; - (void) getCString: (char*)buffer maxLength: (unsigned int)maxLength diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index 0d0e8a371..417eeadc4 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -2368,12 +2368,12 @@ static NSString *mainFont = nil; } else if (add < 10) { - [buf appendString: @"OPENSTEP"]; + [buf appendString: @"OPENSTEP "]; [buf appendString: ovadd]; } else { - [buf appendString: @"MacOS-X"]; + [buf appendString: @"MacOS-X "]; [buf appendString: ovadd]; } if (dep > add) @@ -2381,12 +2381,12 @@ static NSString *mainFont = nil; [buf appendString: @" deprecated at "]; if (add < 10) { - [buf appendString: @"OPENSTEP"]; + [buf appendString: @"OPENSTEP "]; [buf appendString: ovdep]; } else { - [buf appendString: @"MacOS-X"]; + [buf appendString: @"MacOS-X "]; [buf appendString: ovdep]; } } @@ -2395,12 +2395,12 @@ static NSString *mainFont = nil; [buf appendString: @" removed at "]; if (add < 10) { - [buf appendString: @"OPENSTEP"]; + [buf appendString: @"OPENSTEP "]; [buf appendString: ovrem]; } else { - [buf appendString: @"MacOS-X"]; + [buf appendString: @"MacOS-X "]; [buf appendString: ovrem]; } } diff --git a/Tools/AGSParser.m b/Tools/AGSParser.m index 76673e1eb..4e5b16d38 100644 --- a/Tools/AGSParser.m +++ b/Tools/AGSParser.m @@ -2976,10 +2976,8 @@ fail: ver = [self parseVersion]; if ([ver length] == 0) { - ver = @"0"; + ver = @"0.0.0"; } - i = [ver intValue]; - ver = [NSString stringWithFormat: @"%d.%d", i/100, i%100]; if (openstep) { [top setObject: ver forKey: @"ovadd"]; @@ -2997,12 +2995,10 @@ fail: ver = [self parseVersion]; if ([ver length] == 0) { - ver = @"9999"; + ver = @"99.99.99"; } - i = [ver intValue]; - if (i != 9999 && [ver isEqualToString: @"NEVER"] == NO) + if ([ver isEqualToString: @"99.99.99"] == NO) { - ver = [NSString stringWithFormat: @"%d.%d", i/100, i%100]; if (openstep) { [top setObject: ver forKey: @"ovrem"]; @@ -3020,12 +3016,10 @@ fail: ver = [self parseVersion]; if ([ver length] == 0) { - ver = @"9999"; + ver = @"99.99.99"; } - i = [ver intValue]; - if (i != 9999 && [ver isEqualToString: @"NEVER"] == NO) + if ([ver isEqualToString: @"99.99.99"] == NO) { - ver = [NSString stringWithFormat: @"%d.%d", i/100, i%100]; if (openstep) { [top setObject: ver forKey: @"ovdep"]; @@ -3343,7 +3337,8 @@ fail: - (NSString*) parseVersion { - unsigned start; + unsigned i; + NSString *str; while (pos < length && [spaces characterIsMember: buffer[pos]] == YES) { @@ -3355,18 +3350,40 @@ fail: } if (!isdigit(buffer[pos])) { - return [self parseIdentifier]; + str = [self parseIdentifier]; } - start = pos; - while (pos < length) + else { - 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