Merge branch 'master' into numerical_locale

This commit is contained in:
rfm 2020-03-29 11:26:40 +01:00 committed by GitHub
commit 81d70b37c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 172 additions and 56 deletions

View file

@ -1,3 +1,5 @@
---
os: linux
language: cpp
dist: xenial
compiler:
@ -9,7 +11,7 @@ env:
- LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi RUNTIME_VERSION=gnustep-1.9
- LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-2.0
- LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi RUNTIME_VERSION=gnustep-2.0
matrix:
jobs:
exclude:
- compiler: gcc
env: LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-1.9
@ -21,7 +23,6 @@ matrix:
env: LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi RUNTIME_VERSION=gnustep-2.0
- compiler: clang
env: LIBRARY_COMBO=gnu-gnu-gnu
sudo: required
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y cmake pkg-config libgnutls28-dev libgmp-dev libffi-dev libicu-dev libxml2-dev libxslt1-dev libssl-dev libavahi-client-dev zlib1g-dev

View file

@ -1,8 +1,31 @@
2020-03-07 Fred Kiefer <fredkiefer@gmx.de>
2020-03-29 Fred Kiefer <fredkiefer@gmx.de>
* Source/NSString.m: Attempt to make calls to GSICUCollatorOpen()
more consistent and correct for ICU 65.
2020-03-26 Frederik Seiffert <frederik@algoriddim.com>
* Headers/Foundation/NSError.h:
* Source/NSError.m: Added NSErrorDomain typedef.
2020-03-12 Fred Kiefer <fredkiefer@gmx.de>
* Source/NSURL.m: Fix compiler warnings.
* Headers/Foundation/NSLocale.h:
* Source/NSLocale.m: Add a few convenience methods from MacOS 10.12.
2020-03-10 Frederik Seiffert <frederik@algoriddim.com>
* Source/NSURL.m: fix [NSURLComponents setURL:] throwing
exception for URLs that don't have all parts.
2020-03-01 Fred Kiefer <fredkiefer@gmx.de>
* Tests/base/NSBundle/TestInfo,
* Tests/base/NSBundle/GNUmakefile.preamble,
* Tests/base/NSBundle/resources2.m: Extend test to check for
framework resource loading.
2020-03-06 Richard Frith-Macdonald <rfm@gnu.org>
* Resources/Languages/Locale.canonical:

View file

@ -38,6 +38,8 @@ extern "C" {
@class NSArray, NSDictionary, NSString;
typedef NSString* NSErrorDomain;
/**
* Key for user info dictionary component which describes the error in
* a human readable format.
@ -103,20 +105,20 @@ GS_EXPORT NSString* const NSURLErrorFailingURLStringErrorKey;
/**
* Domain for system errors (on MACH).
*/
GS_EXPORT NSString* const NSMACHErrorDomain;
GS_EXPORT NSErrorDomain const NSMACHErrorDomain;
/**
* Domain for system errors.
*/
GS_EXPORT NSString* const NSOSStatusErrorDomain;
GS_EXPORT NSErrorDomain const NSOSStatusErrorDomain;
/**
* Domain for system and system library errors.
*/
GS_EXPORT NSString* const NSPOSIXErrorDomain;
GS_EXPORT NSErrorDomain const NSPOSIXErrorDomain;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4,GS_API_LATEST)
/**
* Domain for Foundation and AppKit (base and gui) errors.
*/
GS_EXPORT NSString* const NSCocoaErrorDomain;
GS_EXPORT NSErrorDomain const NSCocoaErrorDomain;
#endif
/**
@ -150,7 +152,7 @@ GS_EXPORT NSString* const NSCocoaErrorDomain;
* Creates and returns an autoreleased NSError instance by calling
* -initWithDomain:code:userInfo:
*/
+ (id) errorWithDomain: (NSString*)aDomain
+ (id) errorWithDomain: (NSErrorDomain)aDomain
code: (NSInteger)aCode
userInfo: (NSDictionary*)aDictionary;
@ -163,13 +165,13 @@ GS_EXPORT NSString* const NSCocoaErrorDomain;
/**
* Return the domain for this instance.
*/
- (NSString*) domain;
- (NSErrorDomain) domain;
/** <init />
* Initialises the receiver using the supplied domain, code, and info.<br />
* The domain must be non-nil.
*/
- (id) initWithDomain: (NSString*)aDomain
- (id) initWithDomain: (NSErrorDomain)aDomain
code: (NSInteger)aCode
userInfo: (NSDictionary*)aDictionary;

View file

@ -37,6 +37,7 @@ extern "C" {
@class NSMutableDictionary;
@class NSString;
@class NSCharacterSet;
typedef NSUInteger NSLocaleLanguageDirection;
enum
@ -232,6 +233,16 @@ GS_EXPORT NSString * const NSISO8601Calendar;
*/
- (id) objectForKey: (id)key;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
- (NSString *) languageCode;
- (NSString *) countryCode;
- (NSString *) scriptCode;
- (NSString *) variantCode;
- (NSCharacterSet *) exemplarCharacterSet;
- (NSString *) collationIdentifier;
- (NSString *) collatorIdentifier;
#endif
@end
#if defined(__cplusplus)

View file

@ -279,6 +279,11 @@ DEFINE_BLOCK_TYPE(NSComparator, NSComparisonResult, id, id);
*/
#define FOUNDATION_EXPORT GS_EXPORT
/**
* Declare NSExceptionName
*/
typedef NSString* NSExceptionName;
#if defined(__cplusplus)
}
#endif

View file

@ -85,16 +85,16 @@ enum
* Calls -initFileURLWithPath: which escapes characters in the
* path where necessary.
*/
+ (id) fileURLWithPath: (NSString*)aPath;
+ (instancetype) fileURLWithPath: (NSString*)aPath;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST)
/** Creates a file URL using a path built from components.
*/
+ (NSURL*) fileURLWithPathComponents: (NSArray*)components;
+ (instancetype) fileURLWithPathComponents: (NSArray*)components;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
+ (id) fileURLWithPath: (NSString*)aPath isDirectory: (BOOL)isDir;
+ (instancetype) fileURLWithPath: (NSString*)aPath isDirectory: (BOOL)isDir;
#endif
/**
* Create and return a URL with the supplied string, which should
@ -102,12 +102,12 @@ enum
* conforming to the description (in RFC2396) of an absolute URL.<br />
* Calls -initWithString:
*/
+ (id) URLWithString: (NSString*)aUrlString;
+ (instancetype) URLWithString: (NSString*)aUrlString;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
+ (id) URLByResolvingAliasFileAtURL: (NSURL*)url
options: (NSURLBookmarkResolutionOptions)options
error: (NSError**)error;
+ (instancetype) URLByResolvingAliasFileAtURL: (NSURL*)url
options: (NSURLBookmarkResolutionOptions)options
error: (NSError**)error;
#endif
/**
@ -116,8 +116,8 @@ enum
* conforming to the description (in RFC2396) of a relative URL.<br />
* Calls -initWithString:relativeToURL:
*/
+ (id) URLWithString: (NSString*)aUrlString
relativeToURL: (NSURL*)aBaseUrl;
+ (instancetype) URLWithString: (NSString*)aUrlString
relativeToURL: (NSURL*)aBaseUrl;
/**
* Initialise as a file URL with the specified path (which must
@ -128,7 +128,7 @@ enum
* specifies a directory.<br />
* Calls -initWithScheme:host:path:
*/
- (id) initFileURLWithPath: (NSString*)aPath;
- (instancetype) initFileURLWithPath: (NSString*)aPath;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST)
/**
@ -140,7 +140,8 @@ enum
* specifies a directory.<br />
* Calls -initWithScheme:host:path:
*/
- (id) initFileURLWithPath: (NSString*)aPath isDirectory: (BOOL)isDir;
- (instancetype) initFileURLWithPath: (NSString*)aPath
isDirectory: (BOOL)isDir;
#endif
/**
@ -154,15 +155,15 @@ enum
* Permits the 'aHost' part to contain 'username:password@host:port' or
* 'host:port' in addition to a simple host name or address.
*/
- (id) initWithScheme: (NSString*)aScheme
host: (NSString*)aHost
path: (NSString*)aPath;
- (instancetype) initWithScheme: (NSString*)aScheme
host: (NSString*)aHost
path: (NSString*)aPath;
/**
* Initialise as an absolute URL.<br />
* Calls -initWithString:relativeToURL:
*/
- (id) initWithString: (NSString*)aUrlString;
- (instancetype) initWithString: (NSString*)aUrlString;
/** <init />
* Initialised using aUrlString and aBaseUrl. The value of aBaseUrl
@ -172,8 +173,8 @@ enum
* Parses an empty string as an empty path.<br />
* If the string cannot be parsed the method returns nil.
*/
- (id) initWithString: (NSString*)aUrlString
relativeToURL: (NSURL*)aBaseUrl;
- (instancetype) initWithString: (NSString*)aUrlString
relativeToURL: (NSURL*)aBaseUrl;
#if GS_HAS_DECLARED_PROPERTIES
@property (readonly, getter=isFileURL) BOOL fileURL;

View file

@ -683,7 +683,8 @@ SANITY();
unsigned tmpLength;
unsigned arrayIndex = 0;
unsigned arraySize;
NSRange effectiveRange = NSMakeRange(0, NSNotFound);
// Initial value unused; set by _attributesAtIndexEffectiveRange
NSRange effectiveRange = NSMakeRange(NSNotFound, 0);
unsigned afterRangeLoc, beginRangeLoc;
NSDictionary *attrs;
NSZone *z = [self zone];
@ -795,7 +796,8 @@ SANITY();
unsigned tmpLength;
unsigned arrayIndex = 0;
unsigned arraySize;
NSRange effectiveRange = NSMakeRange(0, NSNotFound);
// Initial value unused; set by _attributesAtIndexEffectiveRange
NSRange effectiveRange = NSMakeRange(NSNotFound, 0);
GSAttrInfo *info;
int moveLocations;
unsigned start;

View file

@ -46,14 +46,14 @@ NSString* const NSRecoveryAttempterErrorKey
NSString* const NSURLErrorFailingURLErrorKey = @"NSErrorFailingURLKey";
NSString* const NSURLErrorFailingURLStringErrorKey = @"NSErrorFailingURLStringKey";
NSString* const NSMACHErrorDomain = @"NSMACHErrorDomain";
NSString* const NSOSStatusErrorDomain = @"NSOSStatusErrorDomain";
NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
NSString* const NSCocoaErrorDomain = @"NSCocoaErrorDomain";
NSErrorDomain const NSMACHErrorDomain = @"NSMACHErrorDomain";
NSErrorDomain const NSOSStatusErrorDomain = @"NSOSStatusErrorDomain";
NSErrorDomain const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
NSErrorDomain const NSCocoaErrorDomain = @"NSCocoaErrorDomain";
@implementation NSError
+ (id) errorWithDomain: (NSString*)aDomain
+ (id) errorWithDomain: (NSErrorDomain)aDomain
code: (NSInteger)aCode
userInfo: (NSDictionary*)aDictionary
{
@ -88,7 +88,7 @@ NSString* const NSCocoaErrorDomain = @"NSCocoaErrorDomain";
return [self localizedDescription];
}
- (NSString*) domain
- (NSErrorDomain) domain
{
return _domain;
}
@ -136,7 +136,7 @@ NSString* const NSCocoaErrorDomain = @"NSCocoaErrorDomain";
return self;
}
- (id) initWithDomain: (NSString*)aDomain
- (id) initWithDomain: (NSErrorDomain)aDomain
code: (NSInteger)aCode
userInfo: (NSDictionary*)aDictionary
{

View file

@ -868,6 +868,41 @@ static NSRecursiveLock *classLock = nil;
return result;
}
- (NSString *) languageCode
{
return [self objectForKey: NSLocaleLanguageCode];
}
- (NSString *) countryCode
{
return [self objectForKey: NSLocaleLanguageCode];
}
- (NSString *) scriptCode
{
return [self objectForKey: NSLocaleScriptCode];
}
- (NSString *) variantCode
{
return [self objectForKey: NSLocaleVariantCode];
}
- (NSCharacterSet *) exemplarCharacterSet
{
return [self objectForKey: NSLocaleExemplarCharacterSet];
}
- (NSString *) collationIdentifier
{
return [self objectForKey: NSLocaleCollationIdentifier];
}
- (NSString *) collatorIdentifier
{
return [self objectForKey: NSLocaleCollatorIdentifier];
}
- (NSString *) description
{
return _localeId;

View file

@ -667,7 +667,7 @@ static NSUInteger urlAlign;
isDirectory: isDir]);
}
+ (NSURL*) fileURLWithPathComponents: (NSArray*)components
+ (id) fileURLWithPathComponents: (NSArray*)components
{
return [self fileURLWithPath: [NSString pathWithComponents: components]];
}
@ -2236,6 +2236,15 @@ static NSUInteger urlAlign;
if (self != nil)
{
GS_CREATE_INTERNAL(NSURLComponents);
internal->_rangeOfFragment = NSMakeRange(NSNotFound, 0);
internal->_rangeOfHost = NSMakeRange(NSNotFound, 0);
internal->_rangeOfPassword = NSMakeRange(NSNotFound, 0);
internal->_rangeOfPath = NSMakeRange(NSNotFound, 0);
internal->_rangeOfPort = NSMakeRange(NSNotFound, 0);
internal->_rangeOfQuery = NSMakeRange(NSNotFound, 0);
internal->_rangeOfScheme = NSMakeRange(NSNotFound, 0);
internal->_rangeOfUser = NSMakeRange(NSNotFound, 0);
}
return self;
}
@ -2351,15 +2360,21 @@ static NSUInteger urlAlign;
[[url user] stringByAddingPercentEncodingWithAllowedCharacters:
[NSCharacterSet URLUserAllowedCharacterSet]]];
// Find ranges
internal->_rangeOfFragment = [[url absoluteString] rangeOfString: internal->_fragment];
internal->_rangeOfHost = [[url absoluteString] rangeOfString: internal->_host];
internal->_rangeOfPassword = [[url absoluteString] rangeOfString: internal->_password];
internal->_rangeOfPath = [[url absoluteString] rangeOfString: internal->_path];
internal->_rangeOfPort = [[url absoluteString] rangeOfString: [internal->_port stringValue]];
internal->_rangeOfQuery = [[url absoluteString] rangeOfString: internal->_query];
internal->_rangeOfScheme = [[url absoluteString] rangeOfString: internal->_scheme];
internal->_rangeOfUser = [[url absoluteString] rangeOfString: internal->_user];
{
// Find ranges
NSString *urlString = [url absoluteString];
#define URL_COMPONENT_RANGE(part) \
(part ? [urlString rangeOfString:part] : NSMakeRange(NSNotFound, 0))
internal->_rangeOfFragment = URL_COMPONENT_RANGE(internal->_fragment);
internal->_rangeOfHost = URL_COMPONENT_RANGE(internal->_host);
internal->_rangeOfPassword = URL_COMPONENT_RANGE(internal->_password);
internal->_rangeOfPath = URL_COMPONENT_RANGE(internal->_path);
internal->_rangeOfPort = URL_COMPONENT_RANGE([internal->_port stringValue]);
internal->_rangeOfQuery = URL_COMPONENT_RANGE(internal->_query);
internal->_rangeOfScheme = URL_COMPONENT_RANGE(internal->_scheme);
internal->_rangeOfUser = URL_COMPONENT_RANGE(internal->_user);
#undef URL_COMPONENT_RANGE
}
}
- (NSURL *)URLRelativeToURL: (NSURL *)baseURL

View file

@ -1,6 +1,9 @@
ADDITIONAL_INCLUDE_DIRS += -I../GenericTests/ -I../../..
ADDITIONAL_OBJCFLAGS += -Wall
resources2_LDFLAGS += -Wl,-rpath -Wl,$(CURDIR)/Resources/TestFramework.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR)
resources2_LIB_DIRS += -L./Resources/TestFramework.framework/$(GNUSTEP_TARGET_LDIR)
resources2_TOOL_LIBS += -lTestFramework
$(GNUSTEP_INSTANCE)_SUBPROJECTS = ../GenericTests

View file

@ -16,7 +16,7 @@ TestFramework_OBJC_FILES = TestFramework.m
TestFramework_RESOURCE_FILES = NonLocalRes.txt
TestFramework_LANGUAGES = English French de
TestFramework_LOCALIZED_RESOURCE_FILES = TextRes.txt
TestFramework_CURRENT_VERSION_NAME = 2
include $(GNUSTEP_MAKEFILES)/bundle.make
include $(GNUSTEP_MAKEFILES)/framework.make

View file

@ -10,16 +10,18 @@
- (NSString*)test;
@end
@interface TestFramework: NSObject
@end
static void _testBundle(NSString* name, NSString* className)
static void _testBundle(NSBundle* bundle, NSString* path, NSString* className)
{
NSBundle *bundle;
NSArray *arr, *carr;
NSString *path, *localPath;
path = [[[[[NSFileManager defaultManager] currentDirectoryPath]
stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"]
stringByAppendingPathComponent: name];
bundle = [NSBundle bundleWithPath: path];
NSString *localPath;
PASS((bundle != nil),
"bundle was found");
PASS((path != nil),
"path of bundle was found");
arr = [bundle pathsForResourcesOfType: @"txt" inDirectory: nil];
PASS((arr && [arr count]),
"-pathsForResourcesOfType:inDirectory: returns an array");
@ -89,12 +91,28 @@ static void _testBundle(NSString* name, NSString* className)
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *path;
NSBundle *bundle;
START_SET("Bundle")
_testBundle(@"TestBundle.bundle", @"TestBundle");
path = [[[[[NSFileManager defaultManager] currentDirectoryPath]
stringByStandardizingPath] stringByAppendingPathComponent: @"Resources"]
stringByAppendingPathComponent: @"TestBundle.bundle"];
bundle = [NSBundle bundleWithPath: path];
_testBundle(bundle, path, @"TestBundle");
END_SET("Bundle")
START_SET("Framework")
_testBundle(@"TestFramework.framework", @"TestFramework");
/* This method call is required to ensure that the linker does not decide to
* elide the framework linkage.
*/
[TestFramework class];
bundle = [NSBundle bundleForClass: NSClassFromString(@"TestFramework")];
path = [bundle bundlePath];
_testBundle(bundle, path, @"TestFramework");
PASS(0 == [bundle bundleVersion], "bundleVersion is zero");
END_SET("Framework");
[arp release]; arp = nil;
return 0;
}