+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@class NSData, NSMutableData;
@@ -87,7 +92,7 @@
intoData: (NSMutableData*)d;
@end
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/**
* GNUstep extends serialization by having the option to make the
* resulting data more compact by ensuring that repeated strings
@@ -163,7 +168,7 @@
@end
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/**
* GNUstep extends deserialization by having the option to make the
* resulting data more compact by ensuring that repeated strings
@@ -187,4 +192,8 @@
#endif
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __NSSerialization_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSSet.h b/Headers/Foundation/NSSet.h
index fc45deab6..949702ade 100644
--- a/Headers/Foundation/NSSet.h
+++ b/Headers/Foundation/NSSet.h
@@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
AutogsdocSource: NSSet.m
AutogsdocSource: NSCountedSet.m
@@ -28,8 +28,13 @@
#ifndef _NSSet_h_GNUSTEP_BASE_INCLUDE
#define _NSSet_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@class NSArray, NSString, NSEnumerator, NSDictionary;
@@ -39,7 +44,7 @@
+ (id) setWithArray: (NSArray*)objects;
+ (id) setWithObject: (id)anObject;
+ (id) setWithObjects: (id)firstObject, ...;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
+ (id) setWithObjects: (id*)objects
count: (unsigned)count;
#endif
@@ -66,7 +71,7 @@
- (void) makeObjectsPerform: (SEL)aSelector;
- (void) makeObjectsPerform: (SEL)aSelector withObject: (id)argument;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (void) makeObjectsPerformSelector: (SEL)aSelector;
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: (id)argument;
#endif
@@ -86,7 +91,7 @@
- (void) minusSet: (NSSet*)other;
- (void) removeAllObjects;
- (void) removeObject: (id)anObject;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (void) setSet: (NSSet*)other;
#endif
- (void) unionSet: (NSSet*)other;
@@ -98,7 +103,7 @@
@end
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/**
* Utility methods for using a counted set to handle uniquing of objects.
@@ -173,6 +178,10 @@ void GSUPurge(unsigned count);
*/
id GSUSet(id anObject, unsigned count);
-#endif /* NO_GNUSTEP */
+#endif /* GS_API_NONE */
+
+#if defined(__cplusplus)
+}
+#endif
#endif
diff --git a/Headers/Foundation/NSSortDescriptor.h b/Headers/Foundation/NSSortDescriptor.h
index fafe9009f..fdd6ee147 100644
--- a/Headers/Foundation/NSSortDescriptor.h
+++ b/Headers/Foundation/NSSortDescriptor.h
@@ -18,52 +18,109 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#ifndef __NSSortDescriptor_h_GNUSTEP_BASE_INCLUDE
#define __NSSortDescriptor_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
-#include
+#if OS_API_VERSION(100300,GS_API_LATEST)
+
+#import
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@class NSString;
+/**
+ * Instances of this class are used to perform multi-level sorts of
+ * arrays containging collections or other objects whose properties
+ * can be obtained using key names.
+ */
@interface NSSortDescriptor : NSObject
{
- NSString * _key;
- BOOL _ascending;
- SEL _selector;
+ NSString *_key;
+ BOOL _ascending;
+ SEL _selector;
}
-// initialization
-- (id) initWithKey: (NSString *) key ascending: (BOOL) ascending;
-- (id) initWithKey: (NSString *) key
- ascending: (BOOL) ascending
- selector: (SEL) selector;
-
-// getting information about a sort descriptor's setup
+/** Returns a flag indicating whether the sort descriptor sorts objects
+ * in ascending order (YES) or descending order (NO).
+ */
- (BOOL) ascending;
+
+/** Returns the result of comparing object1 to object2 using the property
+ * whose key is defined in the receiver and using the selector of the
+ * receiver. If the receiver performs a descending order sort, the
+ * result of this comparison is the opposite of that prroduced by
+ * applying the selector.
+ */
+- (NSComparisonResult) compareObject: (id)object1 toObject: (id)object2;
+
+/** Initialises the receiver for comparisons using the 'compare:' selector
+ * and the specified key and ordering.
+ */
+- (id) initWithKey: (NSString *)key
+ ascending: (BOOL)ascending;
+
+/**
+ * Initialises the receiver to perform comparisons in the specified order
+ * using selector to compar the property key of each object.
+ */
+- (id) initWithKey: (NSString *)key
+ ascending: (BOOL)ascending
+ selector: (SEL)selector;
+
+/** Returns the key used to obtain the property on which comparisons are based.
+ */
- (NSString *) key;
+
+/** Returns the selector used to compare the properties of objects.
+ */
- (SEL) selector;
-// using sort descriptors
-- (NSComparisonResult) compareObject: (id) object1 toObject: (id) object2;
+/** Returns a copy of the receiver which compares and sorts in reversed
+ * order.
+ */
- (id) reversedSortDescriptor;
-
@end
@interface NSArray (NSSortDescriptorSorting)
-- (NSArray *) sortedArrayUsingDescriptors: (NSArray *) sortDescriptors;
+/**
+ * Produces a sorted array using the mechanism described for
+ * [NSMutableArray-sortUsingDescriptors:]
+ */
+- (NSArray *) sortedArrayUsingDescriptors: (NSArray *)sortDescriptors;
@end
@interface NSMutableArray (NSSortDescriptorSorting)
-- (void) sortUsingDescriptors: (NSArray *) sortDescriptors;
+/**
+ * This method works like this: first, it sorts the entire
+ * contents of the array using the first sort descriptor. Then,
+ * after each sort-run, it looks whether there are sort
+ * descriptors left to process, and if yes, looks at the partially
+ * sorted array, finds all portions in it which are equal
+ * (evaluate to NSOrderedSame) and applies the following
+ * descriptor onto them. It repeats this either until all
+ * descriptors have been applied or there are no more equal
+ * portions (equality ranges) left in the array.
+ */
+- (void) sortUsingDescriptors: (NSArray *)sortDescriptors;
@end
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* 100400 */
+
#endif /* __NSSortDescriptor_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSSpellServer.h b/Headers/Foundation/NSSpellServer.h
new file mode 100644
index 000000000..67efca4b5
--- /dev/null
+++ b/Headers/Foundation/NSSpellServer.h
@@ -0,0 +1,135 @@
+/*
+ NSSpellServer.h
+
+ Class to allow a spell checker to be available to other apps
+
+ Copyright (C) 1996 Free Software Foundation, Inc.
+
+ Author: Gregory John Casamento
+ Date: 2001
+
+ Author of previous version: Scott Christley
+ Date: 1996
+
+ This file is part of the GNUstep Base Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _GNUstep_H_NSSpellServer
+#define _GNUstep_H_NSSpellServer
+
+#import
+
+#import
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+// Forward declarations
+@class NSConnection;
+@class NSMutableArray;
+@class NSMutableDictionary;
+
+@interface NSSpellServer : NSObject
+{
+@private
+ id _delegate;
+ BOOL _caseSensitive;
+ unsigned char _dummy[3];
+ NSMutableDictionary *_userDictionaries;
+ NSString *_currentLanguage;
+ NSArray *_ignoredWords;
+ void *_reserved;
+}
+
+// Checking in Your Service
+- (BOOL) registerLanguage: (NSString *)language
+ byVendor: (NSString *)vendor;
+
+// Assigning a Delegate
+- (id) delegate;
+- (void) setDelegate: (id)anObject;
+
+// Running the Service
+- (void) run;
+
+// Checking User Dictionaries
+- (BOOL) isWordInUserDictionaries: (NSString *)word
+ caseSensitive: (BOOL)flag;
+@end
+
+/**
+ This is an informal protocol since the
+ NSSpellChecker will need to use a proxy object
+ to call these methods.
+
+ These methods need to be implemented by the spell service
+ so that the NSSpellServer instance call call them when
+ necessary.
+*/
+@interface NSObject (NSSpellServerDelegate)
+/**
+ *
+ * This method is called when the user begins spell checking the document.
+ * The parameters are: sender
the spell server instance which
+ * invoked this method, stringToCheck
this is the string which
+ * the spell service is going to attempt to find misspelled words in,
+ * language
the language to check in, wordCount
the
+ * number of words checked, and countOnly
a flag which dictates
+ * if them method checks the spelling or just counts the words in the given
+ * string.
+ *
+ *
+ * Returns a range for any word it finds that is misspelled.
+ *
+ */
+- (NSRange) spellServer: (NSSpellServer *)sender
+findMisspelledWordInString: (NSString *)stringToCheck
+ language: (NSString *)language
+ wordCount: (int *)wordCount
+ countOnly: (BOOL)countOnly;
+
+/**
+ * Attempts to guess the correct spelling of word
.
+ */
+- (NSArray *) spellServer: (NSSpellServer *)sender
+ suggestGuessesForWord: (NSString *)word
+ inLanguage: (NSString *)language;
+
+/**
+ * Records the new word in the user's dictionary for the given language.
+ */
+- (void) spellServer: (NSSpellServer *)sender
+ didLearnWord: (NSString *)word
+ inLanguage: (NSString *)language;
+
+/**
+ * Forgets the given word in the user's dictionary for the given language.
+ */
+- (void) spellServer: (NSSpellServer *)sender
+ didForgetWord: (NSString *)word
+ inLanguage: (NSString *)language;
+@end
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // _GNUstep_H_NSSpellServer
diff --git a/Headers/Foundation/NSStream.h b/Headers/Foundation/NSStream.h
index d24b17dce..7df6c8fb9 100644
--- a/Headers/Foundation/NSStream.h
+++ b/Headers/Foundation/NSStream.h
@@ -23,11 +23,16 @@
#ifndef __NSStream_h_GNUSTEP_BASE_INCLUDE
#define __NSStream_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
typedef enum {
NSStreamStatusNotOpen = 0,
NSStreamStatusOpening = 1,
@@ -331,6 +336,10 @@ GS_EXPORT NSString * const NSStreamSOCKSProxyVersionKey;
- (void) stream: (NSStream*)sStream handleEvent: (NSStreamEvent)anEvent;
@end
+#if defined(__cplusplus)
+}
#endif
-#endif /* __NSStream_h_GNUSTEP_BASE_INCLUDE */
+#endif /* 100200 */
+
+#endif /* __NSStream_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSString.h b/Headers/Foundation/NSString.h
index 57613a888..ecf0e2176 100644
--- a/Headers/Foundation/NSString.h
+++ b/Headers/Foundation/NSString.h
@@ -24,9 +24,14 @@
#ifndef __NSString_h_GNUSTEP_BASE_INCLUDE
#define __NSString_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
-#include
+#import
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
/**
* Type for representing unicode characters. (16-bit)
@@ -37,7 +42,7 @@ typedef unsigned short unichar;
@class NSCharacterSet;
@class NSData;
@class NSDictionary;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
@class NSURL;
#endif
@@ -48,7 +53,8 @@ enum
NSCaseInsensitiveSearch = 1,
NSLiteralSearch = 2,
NSBackwardsSearch = 4,
- NSAnchoredSearch = 8
+ NSAnchoredSearch = 8,
+ NSNumericSearch = 64 /* MacOS-X 10.2 */
};
/**
@@ -100,7 +106,6 @@ typedef enum _NSStringEncoding
NSMacOSRomanStringEncoding = 30,
NSProprietaryStringEncoding = 31,
-// GNUstep additions
NSKOI8RStringEncoding = 50, // Russian/Cyrillic
NSISOLatin3StringEncoding = 51, // ISO-8859-3; South European
NSISOLatin4StringEncoding = 52, // ISO-8859-4; North European
@@ -282,7 +287,7 @@ enum {
// Getting C Strings
- (const char*) cString;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST)
- (const char*) cStringUsingEncoding: (NSStringEncoding)encoding;
@@ -533,7 +538,7 @@ enum {
// for methods working with decomposed strings
- (int) _baseLength;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
/**
* Concatenates the path components in the array and returns the result.
* This method does not remove empty path components, but does recognize an
@@ -614,10 +619,10 @@ enum {
- (const char *)UTF8String;
#endif
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
+ (Class) constantStringClass;
- (BOOL) boolValue;
-#endif /* NO_GNUSTEP */
+#endif /* GS_API_NONE */
@end
@@ -689,7 +694,7 @@ enum {
extern struct objc_class _NSConstantStringClassReference;
#endif
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
@interface NSMutableString (GNUstep)
- (NSString*) immutableProxy;
@@ -793,6 +798,10 @@ extern struct objc_class _NSConstantStringClassReference;
- (void) trimSpaces;
@end
-#endif /* NO_GNUSTEP */
+#endif /* GS_API_NONE */
+
+#if defined(__cplusplus)
+}
+#endif
#endif /* __NSString_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSTask.h b/Headers/Foundation/NSTask.h
index 74b5228d2..352d6ccde 100644
--- a/Headers/Foundation/NSTask.h
+++ b/Headers/Foundation/NSTask.h
@@ -18,18 +18,23 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#ifndef __NSTask_h_GNUSTEP_BASE_INCLUDE
#define __NSTask_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
-#include
-#include
-#include
-#include
+#import
+#import
+#import
+#import
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@interface NSTask : NSObject
{
@@ -77,7 +82,7 @@
* Obtaining task state
*/
- (BOOL) isRunning;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (int) processIdentifier;
#endif
- (int) terminationStatus;
@@ -87,14 +92,14 @@
*/
- (void) interrupt;
- (void) launch;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (BOOL) resume;
- (BOOL) suspend;
#endif
- (void) terminate;
- (void) waitUntilExit;
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
- (BOOL) usePseudoTerminal;
- (NSString*) validatedLaunchPath;
#endif
@@ -107,4 +112,8 @@
*/
GS_EXPORT NSString* const NSTaskDidTerminateNotification;
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __NSTask_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSThread.h b/Headers/Foundation/NSThread.h
index 7c6268232..d5e829b65 100644
--- a/Headers/Foundation/NSThread.h
+++ b/Headers/Foundation/NSThread.h
@@ -19,17 +19,22 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#ifndef __NSThread_h_GNUSTEP_BASE_INCLUDE
#define __NSThread_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
-#include
-#include
-#include // for struct autorelease_thread_vars
+#import
+#import
+#import
+#import // for struct autorelease_thread_vars
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@interface NSThread : NSObject
{
@@ -58,7 +63,7 @@
@end
-#ifndef STRICT_OPENSTEP
+#if GS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
@interface NSObject(NSMainThreadPerformAdditions)
- (void) performSelectorOnMainThread: (SEL)aSelector
withObject: (id)anObject
@@ -70,7 +75,7 @@
@end
#endif
-#ifndef NO_GNUSTEP
+#if GS_API_VERSION(GS_API_NONE, GS_API_NONE)
/*
* Don't use the following functions unless you really know what you are
* doing !
@@ -129,7 +134,7 @@ GS_EXPORT NSString* const NSWillBecomeMultiThreadedNotification;
GS_EXPORT NSString* const NSThreadWillExitNotification;
#define NSThreadExiting NSThreadWillExitNotification
-#ifndef NO_GNUSTEP
+#if GS_API_VERSION(GS_API_NONE, GS_API_NONE)
/**
* Notification posted whenever a new thread is started up. This is a
@@ -144,4 +149,8 @@ GS_EXPORT NSThread *GSCurrentThread(void);
GS_EXPORT NSMutableDictionary *GSCurrentThreadDictionary(void);
#endif
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __NSThread_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSTimeZone.h b/Headers/Foundation/NSTimeZone.h
index 778b82ae8..99a7f583a 100644
--- a/Headers/Foundation/NSTimeZone.h
+++ b/Headers/Foundation/NSTimeZone.h
@@ -15,14 +15,19 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#ifndef __NSTimeZone_h_GNUSTEP_BASE_INCLUDE
#define __NSTimeZone_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@class NSArray;
@class NSDate;
@@ -47,13 +52,13 @@
+ (NSArray*) timeZoneArray;
- (NSArray*) timeZoneDetailArray;
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/* Returns an dictionary that maps abbreviations to the array
containing all the time zone names that use the abbreviation. */
+ (NSDictionary*) abbreviationMap;
#endif
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_NONE)
+ (void) resetSystemTimeZone;
+ (NSTimeZone*) systemTimeZone;
+ (NSTimeZone*) timeZoneWithName: (NSString*)name data: (NSData*)data;
@@ -70,7 +75,7 @@
- (int) secondsFromGMTForDate: (NSDate*)aDate;
#endif
-#ifndef STRICT_MACOS_X
+#if OS_API_VERSION(GS_API_OPENSTEP, GS_API_MACOSX)
- (NSTimeZoneDetail*) timeZoneDetailForDate: (NSDate*)date;
- (NSString*) timeZoneName;
#endif
@@ -84,7 +89,7 @@
+ (NSTimeZone*) timeZoneWithAbbreviation: (NSString*)abbreviation;
@end
-#ifndef STRICT_MACOS_X
+#if OS_API_VERSION(GS_API_OPENSTEP, GS_API_MACOSX)
@interface NSTimeZoneDetail : NSTimeZone
- (BOOL) isDaylightSavingTimeZone;
- (NSString*) timeZoneAbbreviation;
@@ -92,5 +97,9 @@
@end
#endif
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __NSTimeZone_h_GNUSTEP_BASE_INCLUDE*/
diff --git a/Headers/Foundation/NSTimer.h b/Headers/Foundation/NSTimer.h
index 372faecfa..066b6aae7 100644
--- a/Headers/Foundation/NSTimer.h
+++ b/Headers/Foundation/NSTimer.h
@@ -18,17 +18,22 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
-#ifndef __NSTimer_include__
-#define __NSTimer_include__
+#ifndef __NSTimer_h_GNUSTEP_BASE_INCLUDE
+#define __NSTimer_h_GNUSTEP_BASE_INCLUDE
+#import
/* This class is currently thrown together. When it is cleaned up, it
may no longer be concrete. */
-#include
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
/*
* NB. NSRunLoop is optimised using a hack that knows about the
@@ -72,7 +77,7 @@
- (id) userInfo;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (id) initWithFireDate: (NSDate*)fd
interval: (NSTimeInterval)ti
target: (id)object
@@ -86,4 +91,8 @@
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif /* __NSTimer_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSURL.h b/Headers/Foundation/NSURL.h
index e18f7bffb..6dad0bcaf 100644
--- a/Headers/Foundation/NSURL.h
+++ b/Headers/Foundation/NSURL.h
@@ -18,16 +18,21 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
-#ifndef _NSURL_h__
-#define _NSURL_h__
+#ifndef __NSURL_h_GNUSTEP_BASE_INCLUDE
+#define __NSURL_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
+#import
-#ifndef STRICT_OPENSTEP
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
@class NSNumber;
@@ -112,6 +117,11 @@ GS_EXPORT NSString* const NSURLFileScheme;
resourceDidFailLoadingWithReason: (NSString*)reason;
@end
+#endif /* GS_API_MACOSX */
+
+#if defined(__cplusplus)
+}
#endif
-#endif //_NSUrl_h__
+#endif /* __NSURL_h_GNUSTEP_BASE_INCLUDE */
+
diff --git a/Headers/Foundation/NSURLAuthenticationChallenge.h b/Headers/Foundation/NSURLAuthenticationChallenge.h
index 13630cd4f..5050c8fad 100644
--- a/Headers/Foundation/NSURLAuthenticationChallenge.h
+++ b/Headers/Foundation/NSURLAuthenticationChallenge.h
@@ -24,11 +24,16 @@
#ifndef __NSURLAuthenticationChallenge_h_GNUSTEP_BASE_INCLUDE
#define __NSURLAuthenticationChallenge_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSError;
@class NSURLAuthenticationChallenge;
@class NSURLCredential;
@@ -141,5 +146,10 @@
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLCache.h b/Headers/Foundation/NSURLCache.h
index be021900e..2dec90d28 100644
--- a/Headers/Foundation/NSURLCache.h
+++ b/Headers/Foundation/NSURLCache.h
@@ -24,11 +24,16 @@
#ifndef __NSURLCache_h_GNUSTEP_BASE_INCLUDE
#define __NSURLCache_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSData;
@class NSDictionary;
@class NSURLRequest;
@@ -189,5 +194,10 @@ typedef enum
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLConnection.h b/Headers/Foundation/NSURLConnection.h
index 5e8fcc8f6..b38ea0762 100644
--- a/Headers/Foundation/NSURLConnection.h
+++ b/Headers/Foundation/NSURLConnection.h
@@ -24,11 +24,16 @@
#ifndef __NSURLConnection_h_GNUSTEP_BASE_INCLUDE
#define __NSURLConnection_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSCachedURLResponse;
@class NSData;
@class NSError;
@@ -224,5 +229,10 @@
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLCredential.h b/Headers/Foundation/NSURLCredential.h
index f6d2c849c..94f53486f 100644
--- a/Headers/Foundation/NSURLCredential.h
+++ b/Headers/Foundation/NSURLCredential.h
@@ -24,11 +24,16 @@
#ifndef __NSURLCredential_h_GNUSTEP_BASE_INCLUDE
#define __NSURLCredential_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSString;
/**
@@ -101,5 +106,10 @@ typedef enum {
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLCredentialStorage.h b/Headers/Foundation/NSURLCredentialStorage.h
index 142568f53..273d1073b 100644
--- a/Headers/Foundation/NSURLCredentialStorage.h
+++ b/Headers/Foundation/NSURLCredentialStorage.h
@@ -24,11 +24,16 @@
#ifndef __NSURLCredentialStorage_h_GNUSTEP_BASE_INCLUDE
#define __NSURLCredentialStorage_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSDictionary;
@class NSString;
@class NSURLCredential;
@@ -99,5 +104,10 @@ extern NSString *const NSURLCredentialStorageChangedNotification;
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLDownload.h b/Headers/Foundation/NSURLDownload.h
index f60b1abaa..c2d99d818 100644
--- a/Headers/Foundation/NSURLDownload.h
+++ b/Headers/Foundation/NSURLDownload.h
@@ -24,11 +24,16 @@
#ifndef __NSURLDownload_h_GNUSTEP_BASE_INCLUDE
#define __NSURLDownload_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSData;
@class NSError;
@class NSString;
@@ -202,5 +207,10 @@
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLError.h b/Headers/Foundation/NSURLError.h
index 9f3c28899..942874165 100644
--- a/Headers/Foundation/NSURLError.h
+++ b/Headers/Foundation/NSURLError.h
@@ -24,11 +24,16 @@
#ifndef __NSURLError_h_GNUSTEP_BASE_INCLUDE
#define __NSURLError_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSString;
/**
@@ -84,5 +89,10 @@ enum
NSURLErrorDownloadDecodingFailedToComplete = -3007,
};
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLHandle.h b/Headers/Foundation/NSURLHandle.h
index 9938a4f74..adb98b51d 100644
--- a/Headers/Foundation/NSURLHandle.h
+++ b/Headers/Foundation/NSURLHandle.h
@@ -18,16 +18,21 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
-#ifndef _NSURLHandle_h__
-#define _NSURLHandle_h__
+#ifndef __NSURLHandle_h_GNUSTEP_BASE_INCLUDE
+#define __NSURLHandle_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
-#ifndef STRICT_OPENSTEP
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@class NSData;
@class NSString;
@@ -66,7 +71,7 @@ GS_EXPORT NSString * const NSHTTPPropertyRedirectionHeadersKey;
*/
GS_EXPORT NSString * const NSHTTPPropertyErrorPageDataKey;
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/**
* Key for passing to [NSURLHandle]'s propertyForKey..
methods to
@@ -210,6 +215,11 @@ typedef enum
@end
+#if defined(__cplusplus)
+}
#endif
#endif
+
+#endif /* __NSURLHandle_h_GNUSTEP_BASE_INCLUDE */
+
diff --git a/Headers/Foundation/NSURLProtectionSpace.h b/Headers/Foundation/NSURLProtectionSpace.h
index 347b25fb6..2230a598e 100644
--- a/Headers/Foundation/NSURLProtectionSpace.h
+++ b/Headers/Foundation/NSURLProtectionSpace.h
@@ -24,11 +24,16 @@
#ifndef __NSURLProtectionSpace_h_GNUSTEP_BASE_INCLUDE
#define __NSURLProtectionSpace_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSString;
extern NSString * const NSURLProtectionSpaceFTPProxy; /** An FTP proxy */
@@ -125,5 +130,10 @@ authenticationMethod: (NSString *)authenticationMethod;
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLProtocol.h b/Headers/Foundation/NSURLProtocol.h
index 8a8c2756b..53ff2b125 100644
--- a/Headers/Foundation/NSURLProtocol.h
+++ b/Headers/Foundation/NSURLProtocol.h
@@ -24,12 +24,17 @@
#ifndef __NSURLProtocol_h_GNUSTEP_BASE_INCLUDE
#define __NSURLProtocol_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
-#include
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#import
@class NSCachedURLResponse;
@class NSError;
@@ -218,5 +223,10 @@
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLRequest.h b/Headers/Foundation/NSURLRequest.h
index e2addf86b..324bf1f95 100644
--- a/Headers/Foundation/NSURLRequest.h
+++ b/Headers/Foundation/NSURLRequest.h
@@ -24,11 +24,16 @@
#ifndef __NSURLRequest_h_GNUSTEP_BASE_INCLUDE
#define __NSURLRequest_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSData;
@class NSDate;
@class NSDictionary;
@@ -271,5 +276,10 @@ typedef enum
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSURLResponse.h b/Headers/Foundation/NSURLResponse.h
index 43fd161f4..e503fedc8 100644
--- a/Headers/Foundation/NSURLResponse.h
+++ b/Headers/Foundation/NSURLResponse.h
@@ -24,11 +24,16 @@
#ifndef __NSURLResponse_h_GNUSTEP_BASE_INCLUDE
#define __NSURLResponse_h_GNUSTEP_BASE_INCLUDE
-
-#include
+#import
#if OS_API_VERSION(100200,GS_API_LATEST) && GS_API_VERSION(011300,GS_API_LATEST)
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSDictionary;
@class NSString;
@@ -116,5 +121,10 @@
@end
+#if defined(__cplusplus)
+}
#endif
+
+#endif
+
#endif
diff --git a/Headers/Foundation/NSUndoManager.h b/Headers/Foundation/NSUndoManager.h
index 1e969aa7f..05b41d943 100644
--- a/Headers/Foundation/NSUndoManager.h
+++ b/Headers/Foundation/NSUndoManager.h
@@ -17,14 +17,21 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#ifndef __NSUndoManager_h_OBJECTS_INCLUDE
#define __NSUndoManager_h_OBJECTS_INCLUDE
+#import
-#include
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
+
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@class NSArray;
@class NSString;
@@ -128,4 +135,10 @@ GS_EXPORT NSString* const NSUndoManagerWillUndoChangeNotification;
@end
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* GS_API_MACOSX */
+
#endif /* __NSUndoManager_h_OBJECTS_INCLUDE */
diff --git a/Headers/Foundation/NSUserDefaults.h b/Headers/Foundation/NSUserDefaults.h
index f5a8e8174..db239f124 100644
--- a/Headers/Foundation/NSUserDefaults.h
+++ b/Headers/Foundation/NSUserDefaults.h
@@ -25,10 +25,15 @@
#ifndef __NSUserDefaults_h_OBJECTS_INCLUDE
#define __NSUserDefaults_h_OBJECTS_INCLUDE
+#include
#include
#include
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
@class NSArray;
@class NSMutableArray;
@class NSDictionary;
@@ -125,7 +130,7 @@ GS_EXPORT NSString* const NSDecimalDigits;
/** Key for locale dictionary: array of strings for AM and PM. */
GS_EXPORT NSString* const NSAMPMDesignation;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GSAPI_MACOSX, GSAPI_LAST)
/**
* Array of arrays of NSStrings, first member of each specifying a time,
@@ -222,69 +227,278 @@ GS_EXPORT NSString* const NSLocale;
NSDistributedLock *_fileLock;
}
-/* Getting the Shared Instance */
+/**
+ * Returns the shared defaults object. If it doesn't exist yet, it's
+ * created. The defaults are initialized for the current user.
+ * The search list is guaranteed to be standard only the first time
+ * this method is invoked. The shared instance is provided as a
+ * convenience; other instances may also be created.
+ */
+ (NSUserDefaults*) standardUserDefaults;
-#ifndef STRICT_OPENSTEP
-/*
- * Called by GSSetUserName() to get the defaults system to use the defaults
- * of a new user.
+
+#if OS_API_VERSION(GSAPI_MACOSX, GSAPI_LAST)
+/**
+ * Resets the shared user defaults object to reflect the current
+ * user ID. Needed by setuid processes which change the user they
+ * are running as.
+ * In GNUstep you should call GSSetUserName() when changing your
+ * effective user ID, and that function will call this function for you.
*/
+ (void) resetStandardUserDefaults;
#endif
-#ifndef STRICT_OPENSTEP
-#ifndef STRICT_MACOS_X
+
+#if OS_API_VERSION(GSAPI_NONE, GSAPI_NONE)
+/**
+ * Returns the array of user languages preferences. Uses the
+ * NSLanguages user default if available, otherwise
+ * tries to infer setup from operating system information etc
+ * (in particular, uses the LANGUAGES environment variable).
+ */
+ (NSArray*) userLanguages;
+
+/**
+ * Sets the array of user languages preferences. Places the specified
+ * array in the NSLanguages user default.
+ */
+ (void) setUserLanguages: (NSArray*)languages;
#endif
+
+#if OS_API_VERSION(GSAPI_MACOSX, GSAPI_LAST)
+/**
+ * Adds the domain names aName to the search list of the receiver.
+ * The domain is added after the application domain.
+ * Suites may be removed using the -removeSuiteNamed: method.
+ */
+- (void) addSuiteNamed: (NSString*)aName;
#endif
-/* Initializing the User Defaults */
+/**
+ * Looks up a value for a specified default using -objectForKey:
+ * and checks that it is an NSArray object. Returns nil if it is not.
+ */
+- (NSArray*) arrayForKey: (NSString*)defaultName;
+
+/**
+ * Looks up a value for a specified default using -objectForKey:
+ * and returns its boolean representation.
+ * Returns NO if it is not a boolean.
+ * The text 'yes' or 'true' or any non zero numeric value is considered
+ * to be a boolean YES. Other string values are NO.
+ * NB. This differs slightly from the documented behavior for MacOS-X
+ * (August 2002) in that the GNUstep version accepts the string 'TRUE'
+ * as equivalent to 'YES'.
+ */
+- (BOOL) boolForKey: (NSString*)defaultName;
+
+/**
+ * Looks up a value for a specified default using -objectForKey:
+ * and checks that it is an NSData object. Returns nil if it is not.
+ */
+- (NSData*) dataForKey: (NSString*)defaultName;
+
+/**
+ * Looks up a value for a specified default using -objectForKey:
+ * and checks that it is an NSDictionary object. Returns nil if it is not.
+ */
+- (NSDictionary*) dictionaryForKey: (NSString*)defaultName;
+
+/**
+ * Looks up a value for a specified default using -objectForKey:
+ * and checks that it is a float. Returns 0.0 if it is not.
+ */
+- (float) floatForKey: (NSString*)defaultName;
+
+/**
+ * Initializes defaults for current user calling initWithUser:
+ */
- (id) init;
+
+/**
+ * Initializes defaults for the specified user calling -initWithContentsOfFile:
+ */
- (id) initWithUser: (NSString*)userName;
+
+/**
+ *
+ * Initializes defaults for the specified path. Returns an object with
+ * an empty search list.
+ */
- (id) initWithContentsOfFile: (NSString*)path; // This is a new method
-/* Getting and Setting a Default */
-- (NSArray*) arrayForKey: (NSString*)defaultName;
-- (BOOL) boolForKey: (NSString*)defaultName;
-- (NSData*) dataForKey: (NSString*)defaultName;
-- (NSDictionary*) dictionaryForKey: (NSString*)defaultName;
-- (float) floatForKey: (NSString*)defaultName;
+/**
+ * Looks up a value for a specified default using -objectForKey:
+ * and returns its integer value or 0 if it is not representable
+ * as an integer.
+ */
- (int) integerForKey: (NSString*)defaultName;
-- (id) objectForKey: (NSString*)defaultName;
-- (void) removeObjectForKey: (NSString*)defaultName;
-- (void) setBool: (BOOL)value forKey: (NSString*)defaultName;
-- (void) setFloat: (float)value forKey: (NSString*)defaultName;
-- (void) setInteger: (int)value forKey: (NSString*)defaultName;
-- (void) setObject: (id)value forKey: (NSString*)defaultName;
-- (NSArray*) stringArrayForKey: (NSString*)defaultName;
-- (NSString*) stringForKey: (NSString*)defaultName;
-/* Returning the Search List */
-- (NSArray*) searchList;
-- (void) setSearchList: (NSArray*)newList;
-#ifndef STRICT_OPENSTEP
-- (void) addSuiteNamed: (NSString*)aName;
+/**
+ * Looks up a value for a specified default using.
+ * The lookup is performed by accessing the domains in the order
+ * given in the search list.
+ *
Returns nil if defaultName cannot be found.
+ */
+- (id) objectForKey: (NSString*)defaultName;
+
+/**
+ * Removes the default with the specified name from the application
+ * domain.
+ */
+- (void) removeObjectForKey: (NSString*)defaultName;
+
+#if OS_API_VERSION(GSAPI_MACOSX, GSAPI_LAST)
+/**
+ * Removes the named domain from the search list of the receiver.
+ * Suites may be added using the -addSuiteNamed: method.
+ */
- (void) removeSuiteNamed: (NSString*)aName;
#endif
-/* Maintaining Persistent Domains */
+/**
+ * Returns an array listing the domains searched in order to look up
+ * a value in the defaults system. The order of the names in the
+ * array is the order in which the domains are searched.
+ */
+- (NSArray*) searchList;
+
+/**
+ * Sets a boolean value for defaultName in the application domain.
+ * Calls -setObject:forKey: to make the change by storing a boolean
+ * [NSNumber] instance.
+ */
+- (void) setBool: (BOOL)value forKey: (NSString*)defaultName;
+
+/**
+ * Sets a float value for defaultName in the application domain.
+ * Calls -setObject:forKey: to make the change by storing a float
+ * [NSNumber] instance.
+ */
+- (void) setFloat: (float)value forKey: (NSString*)defaultName;
+
+/**
+ * Sets an integer value for defaultName in the application domain.
+ * Calls -setObject:forKey: to make the change by storing an intege
+ * [NSNumber] instance.
+ */
+- (void) setInteger: (int)value forKey: (NSString*)defaultName;
+
+/**
+ * Sets an object value for defaultName in the application domain.
+ * The defaultName must be a non-empty string.
+ * The value must be an instance of one of the [NSString-propertyList]
+ * classes.
+ * Causes a NSUserDefaultsDidChangeNotification to be posted
+ * if this is the first change to a persistent-domain since the
+ * last -synchronize.
+ *
+ * If value is nil, this is equivalent to the -removeObjectForKey: method.
+ */
+- (void) setObject: (id)value forKey: (NSString*)defaultName;
+
+/**
+ * Sets the list of the domains searched in order to look up
+ * a value in the defaults system. The order of the names in the
+ * array is the order in which the domains are searched.
+ * On lookup, the first match is used.
+ */
+- (void) setSearchList: (NSArray*)newList;
+
+/**
+ * Calls -arrayForKey: to get an array value for defaultName and checks
+ * that the array contents are string objects ... if not, returns nil.
+ */
+- (NSArray*) stringArrayForKey: (NSString*)defaultName;
+
+/**
+ * Looks up a value for a specified default using -objectForKey:
+ * and checks that it is an NSString. Returns nil if it is not.
+ */
+- (NSString*) stringForKey: (NSString*)defaultName;
+
+/**
+ * Returns the persistent domain specified by domainName.
+ */
- (NSDictionary*) persistentDomainForName: (NSString*)domainName;
+
+/**
+ * Returns an array listing the name of all the persistent domains.
+ */
- (NSArray*) persistentDomainNames;
+
+/**
+ * Removes the persistent domain specified by domainName from the
+ * user defaults.
+ *
Causes a NSUserDefaultsDidChangeNotification to be posted
+ * if this is the first change to a persistent-domain since the
+ * last -synchronize.
+ */
- (void) removePersistentDomainForName: (NSString*)domainName;
+
+/**
+ * Replaces the persistent-domain specified by domainName with
+ * domain ... a dictionary containing keys and defaults values.
+ *
Raises an NSInvalidArgumentException if domainName already
+ * exists as a volatile-domain.
+ *
Causes a NSUserDefaultsDidChangeNotification to be posted
+ * if this is the first change to a persistent-domain since the
+ * last -synchronize.
+ */
- (void) setPersistentDomain: (NSDictionary*)domain
forName: (NSString*)domainName;
+
+/**
+ * Ensures that the in-memory and on-disk representations of the defaults
+ * are in sync. You may call this yourself, but probably don't need to
+ * since it is invoked at intervals whenever a runloop is running.
+ * If any persistent domain is changed by reading new values from disk,
+ * an NSUserDefaultsDidChangeNotification is posted.
+ */
- (BOOL) synchronize;
-/* Maintaining Volatile Domains */
+/**
+ * Removes the volatile domain specified by domainName from the
+ * user defaults.
+ */
- (void) removeVolatileDomainForName: (NSString*)domainName;
+
+/**
+ * Sets the volatile-domain specified by domainName to
+ * domain ... a dictionary containing keys and defaults values.
+ * Raises an NSInvalidArgumentException if domainName already
+ * exists as either a volatile-domain or a persistent-domain.
+ */
- (void) setVolatileDomain: (NSDictionary*)domain
forName: (NSString*)domainName;
+
+/**
+ * Returns the volatile domain specified by domainName.
+ */
- (NSDictionary*) volatileDomainForName: (NSString*)domainName;
+
+/**
+ * Returns an array listing the name of all the volatile domains.
+ */
- (NSArray*) volatileDomainNames;
-/* Making Advanced Use of Defaults */
+/**
+ * Returns a dictionary representing the current state of the defaults
+ * system ... this is a merged version of all the domains in the
+ * search list.
+ */
- (NSDictionary*) dictionaryRepresentation;
+
+/**
+ * Merges the contents of the dictionary newVals into the registration
+ * domain. Registration defaults may be added to or replaced using this
+ * method, but may never be removed. Thus, setting registration defaults
+ * at any point in your program guarantees that the defaults will be
+ * available thereafter.
+ */
- (void) registerDefaults: (NSDictionary*)newVals;
@end
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __NSUserDefaults_h_OBJECTS_INCLUDE */
diff --git a/Headers/Foundation/NSUtilities.h b/Headers/Foundation/NSUtilities.h
index 898be54ae..e5c00095a 100644
--- a/Headers/Foundation/NSUtilities.h
+++ b/Headers/Foundation/NSUtilities.h
@@ -18,16 +18,16 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#ifndef __NSUtilties_h_GNUSTEP_BASE_INCLUDE
#define __NSUtilties_h_GNUSTEP_BASE_INCLUDE
-#include
-#include
-#include
-#include
+#import
+#import
+#import
+#import
#endif /* __NSUtilties_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSValue.h b/Headers/Foundation/NSValue.h
index 350cadb0b..91f5f4e08 100644
--- a/Headers/Foundation/NSValue.h
+++ b/Headers/Foundation/NSValue.h
@@ -18,15 +18,21 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#ifndef __NSValue_h_GNUSTEP_BASE_INCLUDE
#define __NSValue_h_GNUSTEP_BASE_INCLUDE
+#import
-#include
-#include
+#import
+#import
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@class NSString;
@@ -90,7 +96,7 @@
*/
+ (NSValue*) valueWithSize: (NSSize)size;
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
/**
* Synonym for value:withObjCType: .
*/
@@ -106,7 +112,7 @@
* both contents and declared type of the two values must match.
*/
- (BOOL) isEqualToValue: (NSValue*)other;
-#endif
+#endif /* GS_API_MACOSX */
// Accessing Data
@@ -318,7 +324,7 @@
- (BOOL) isEqualToNumber: (NSNumber*)otherNumber;
@end
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/**
* GNUstep specific (non-standard) additions to the NSNumber class.
@@ -363,4 +369,8 @@ GSNumberInfo *GSNumberInfoFromObject(NSNumber *o);
unsigned GSSmallHash(int n);
#endif
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* __NSValue_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSValueTransformer.h b/Headers/Foundation/NSValueTransformer.h
new file mode 100644
index 000000000..21724943a
--- /dev/null
+++ b/Headers/Foundation/NSValueTransformer.h
@@ -0,0 +1,119 @@
+/* Interface for NSValueTransformer for GNUStep
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ Written Dr. H. Nikolaus Schaller
+ Created on Mon Mar 21 2005.
+ Updatesd and documented by Richard Frith-Macdonald
+
+ This file is part of the GNUstep Base Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
+ */
+
+#ifndef __NSValueTransformer_h_GNUSTEP_BASE_INCLUDE
+#define __NSValueTransformer_h_GNUSTEP_BASE_INCLUDE
+#import
+
+#if OS_API_VERSION(100300,GS_API_LATEST) && GS_API_VERSION(010200,GS_API_LATEST)
+
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+@class NSArray;
+@class NSString;
+
+/** This transformer converts a YES to a NO and a NO to a YES.
+ */
+GS_EXPORT NSString* const NSNegateBooleanTransformerName;
+
+/** This transformer converts a nil value to a YES.
+ * Not reversible.
+ */
+GS_EXPORT NSString* const NSIsNilTransformerName;
+
+/** This transformer converts a non-nil value to a YES.
+ * Not reversible.
+ */
+GS_EXPORT NSString* const NSIsNotNilTransformerName;
+
+/** This transformer converts an [NSData] instance to the object
+ * archived in it, or archives an object inot an [NSData].
+ */
+GS_EXPORT NSString* const NSUnarchiveFromDataTransformerName;
+
+/** Instances of the NSValueTransformer class are used to convert
+ * values from one representation to another. The base class is
+ * abstract and its methods must be overridden by subclasses to do
+ * the actual work.
+ */
+@interface NSValueTransformer : NSObject
+
+/**
+ * Returns a flag indicating whether the transformer permits reverse
+ * transformations.
+ */
++ (BOOL) allowsReverseTransformation;
+
+/**
+ * Registers transformer to handle transformations with the specified
+ * name.
+ */
++ (void) setValueTransformer: (NSValueTransformer *)transformer
+ forName: (NSString *)name;
+
+/**
+ * Returns the class of the value produced by this transformer.
+ */
++ (Class) transformedValueClass;
+
+/**
+ * Returns the transformer registered for the specified name, or nil
+ * if no transformer is registered for name.
+ */
++ (NSValueTransformer *) valueTransformerForName: (NSString *)name;
+
+/**
+ * Returns an array listing the names of all registered value transformers.
+ */
++ (NSArray *) valueTransformerNames;
+
+/**
+ * Performs a reverse transformation on the specified value and returns the
+ * resulting object.
+ * The default implementation raises an exception if
+ * +allowsReverseTransformation returns NO, otherwise it calls
+ * -transformedValue: and returns the result.
+ */
+- (id) reverseTransformedValue: (id)value;
+
+/**
+ * Subclasses should override this method to perform the actual transformation
+ * (and reverse transformation if applicable) and return the result.
+ */
+- (id) transformedValue: (id)value;
+
+@end
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* OS_API_VERSION */
+
+#endif /* __NSValueTransformer_h_GNUSTEP_BASE_INCLUDE */
diff --git a/Headers/Foundation/NSXMLParser.h b/Headers/Foundation/NSXMLParser.h
index 582b2a14d..178c9b6f9 100644
--- a/Headers/Foundation/NSXMLParser.h
+++ b/Headers/Foundation/NSXMLParser.h
@@ -26,10 +26,15 @@
#ifndef __NSXMLParser_h_GNUSTEP_BASE_INCLUDE
#define __NSXMLParser_h_GNUSTEP_BASE_INCLUDE
+#import
-#ifndef STRICT_OPENSTEP
+#if OS_API_VERSION(100300, GS_API_LATEST)
-#include
+#import
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
@class NSData, NSDictionary, NSError, NSString, NSURL;
@@ -399,5 +404,10 @@ typedef enum {
NSXMLParserDelegateAbortedParseError = 512
} NSXMLParserError;
-#endif /* STRICT_OPENSTEP */
-#endif /* __NSXMLParser_h_GNUSTEP_BASE_INCLUDE*/
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+#endif /* __NSXMLParser_h_GNUSTEP_BASE_INCLUDE */
+
diff --git a/Headers/Foundation/NSZone.h b/Headers/Foundation/NSZone.h
index e3a9da929..c7d98e257 100644
--- a/Headers/Foundation/NSZone.h
+++ b/Headers/Foundation/NSZone.h
@@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
AutogsdocSource: NSZone.m
AutogsdocSource: NSPage.m
@@ -28,6 +28,7 @@
#ifndef __NSZone_h_GNUSTEP_BASE_INCLUDE
#define __NSZone_h_GNUSTEP_BASE_INCLUDE
+#import
/**
* Primary structure representing an NSZone
. Technically it
@@ -53,10 +54,14 @@
*/
typedef struct _NSZone NSZone;
-#include
+#import
@class NSString;
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
/**
* NSZoneStats
is the structure returned by the NSZoneStats()
@@ -242,7 +247,7 @@ GS_ZONE_SCOPE NSString* NSZoneName (NSZone *zone)
return nil;
}
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/**
* Allocates mmemory of size bytes from zone, with the assumption that the
@@ -383,7 +388,7 @@ GS_ZONE_SCOPE NSString* NSZoneName (NSZone *zone)
return zone->name;
}
-#ifndef NO_GNUSTEP
+#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
GS_ZONE_SCOPE void*
NSZoneMallocAtomic (NSZone *zone, size_t size) GS_ZONE_ATTR;
@@ -424,7 +429,7 @@ GS_ZONE_SCOPE struct NSZoneStats NSZoneStats (NSZone *zone)
zone = NSDefaultMallocZone();
return (zone->stats)(zone);
}
-#endif /* NO_GNUSTEP */
+#endif /* GS_API_NONE */
#endif /* GS_WITH_GC */
@@ -447,4 +452,8 @@ GS_EXPORT void NSDeallocateMemoryPages (void *ptr, unsigned bytes);
GS_EXPORT void NSCopyMemoryPages (const void *src, void *dest, unsigned bytes);
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* not __NSZone_h_GNUSTEP_BASE_INCLUDE */
diff --git a/INSTALL b/INSTALL
index 221dd01c3..da32ac4cb 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,3 @@
- ftp.gnustep.org
-
- pub/daily-snapshots
-
0.1 Introduction
================
diff --git a/Makefile.postamble b/Makefile.postamble
index e477a1638..4a9c6be8d 100644
--- a/Makefile.postamble
+++ b/Makefile.postamble
@@ -38,13 +38,13 @@
# Things to do after compiling
# after-all::
-$(INSTALL_ROOT_DIR)$(GNUSTEP_MAKEFILES)/Additional:
- $(ECHO_CREATING)$(MKDIRS) $(INSTALL_ROOT_DIR)$(GNUSTEP_MAKEFILES)/Additional$(END_ECHO)
+$(DESTDIR)$(GNUSTEP_MAKEFILES)/Additional:
+ $(ECHO_CREATING)$(MKDIRS) $(DESTDIR)$(GNUSTEP_MAKEFILES)/Additional$(END_ECHO)
# Things to do before installing
-before-install:: $(INSTALL_ROOT_DIR)$(GNUSTEP_MAKEFILES)/Additional
+before-install:: $(DESTDIR)$(GNUSTEP_MAKEFILES)/Additional
$(ECHO_NOTHING)$(INSTALL_DATA) base.make \
- $(INSTALL_ROOT_DIR)$(GNUSTEP_MAKEFILES)/Additional/base.make$(END_ECHO)
+ $(DESTDIR)$(GNUSTEP_MAKEFILES)/Additional/base.make$(END_ECHO)
# Things to do after installing
# after-install::
@@ -54,7 +54,8 @@ before-install:: $(INSTALL_ROOT_DIR)$(GNUSTEP_MAKEFILES)/Additional
# Things to do after uninstalling
after-uninstall::
- $(ECHO_NOTHING)rm -f $(INSTALL_ROOT_DIR)$(GNUSTEP_MAKEFILES)/Additional/base.make$(END_ECHO)
+ $(ECHO_NOTHING)rm -f $(DESTDIR)$(GNUSTEP_MAKEFILES)/Additional/base.make$(END_ECHO)
+
# Things to do before cleaning
# before-clean::
diff --git a/NEWS b/NEWS
index 2c92c5930..4125b7304 100644
--- a/NEWS
+++ b/NEWS
@@ -1,15 +1,19 @@
- ftp.gnustep.org
-
- pub/daily-snapshots
-
1 News
******
-The currently released version of the library is `1.13.1'.
+The currently released version of the library is `1.14.0'.
- See the `ReleaseNotes.html' document for more information.
+See the `ReleaseNotes.html' document for more information.
-1.1 Noteworthy changes in version `1.13.1'
+1.1 Noteworthy changes in version `1.14.0'
+==========================================
+
+Many portability (particularly for ms-windows) and MacOS-X
+compatibility fixes. New MacOS-X classes and incorporation of
+NSAffineTransform and NSSpellServer which were formerly in the gui
+library. Improved performance of amssively multithreaded programs.
+
+1.2 Noteworthy changes in version `1.13.1'
==========================================
Various minor bugs and MacOS-X incompatibilities fixed. One important
@@ -18,13 +22,13 @@ objects from strings. One fix for a serious (crash) bug when
initialising the bundles system in an application which has a lot of
frameworks linked to it. See the release notes for more details.
-1.2 Noteworthy changes in version `1.13.0'
+1.3 Noteworthy changes in version `1.13.0'
==========================================
Several sets of classes have been added for dealing with urls and
predicates. A few minor api changes have occured as well.
-1.3 Noteworthy changes in version `1.12.0'
+1.4 Noteworthy changes in version `1.12.0'
==========================================
There have been a number of API changes and several methods have been
@@ -40,7 +44,7 @@ can be set to not write to an external file at all, for developers who
wish to use the library as a stand-alone library or in other situations
where using external resources is not desired.
-1.4 Noteworthy changes in version `1.11.2'
+1.5 Noteworthy changes in version `1.11.2'
==========================================
* Support for GNUstep.conf and relocation of the filesystem is much
@@ -57,7 +61,7 @@ where using external resources is not desired.
* Some support for keeping user defaults in the Windows registry
implemented.
-1.5 Noteworthy changes in version `1.11.1'
+1.6 Noteworthy changes in version `1.11.1'
==========================================
* New Cocoa class NSSortDescriptor
@@ -69,7 +73,7 @@ where using external resources is not desired.
* More support for debugging on mingw, including writing logs to
debugger and event viewer.
-1.6 Noteworthy changes in version `1.11.0'
+1.7 Noteworthy changes in version `1.11.0'
==========================================
This release is binary incompatible with previous releases. The
@@ -88,12 +92,12 @@ new version.
* NSRunLoop and related classes use natvie win32 event handling on
Windows machines.
-1.7 Noteworthy changes in version `1.10.3'
+1.8 Noteworthy changes in version `1.10.3'
==========================================
This version includes a few minor bug fixes.
-1.8 Noteworthy changes in version `1.10.2'
+1.9 Noteworthy changes in version `1.10.2'
==========================================
This version mostly includes minor fixes and updates.
@@ -107,8 +111,8 @@ This version mostly includes minor fixes and updates.
* Use a proper one-to-one abbreviation dictionary for NSTimeZone.
-1.9 Noteworthy changes in version `1.10.1'
-==========================================
+1.10 Noteworthy changes in version `1.10.1'
+===========================================
This version mostly includes minor fixes and updates.
@@ -122,7 +126,7 @@ This version mostly includes minor fixes and updates.
* Designated initializers for NSArray, NSDictionary, NSSet, and
NSString have been changed for MacOS X compatibility.
-1.10 Noteworthy changes in version `1.10.0'
+1.11 Noteworthy changes in version `1.10.0'
===========================================
Note the interface version of the library has changed so that apps,
@@ -136,7 +140,7 @@ use it.
* Mac OSX XML compatibility fixes.
-1.11 Noteworthy changes in version `1.9.2'
+1.12 Noteworthy changes in version `1.9.2'
==========================================
* GSMime parsing ignores extraneous data
@@ -154,7 +158,7 @@ use it.
* Binary incompatibility: NSUnarchiver, GSIMapTable have new ivars
added
-1.12 Noteworthy changes in version `1.9.1'
+1.13 Noteworthy changes in version `1.9.1'
==========================================
* Default string encoding taken from system nl_langinfo if not set
@@ -165,7 +169,7 @@ use it.
* NSPropertyLists class added, also decodes Mac OS X binary propery
lists.
-1.13 Noteworthy changes in version `1.9.0'
+1.14 Noteworthy changes in version `1.9.0'
==========================================
* Lazy locking implemented (see GSLock documentation)
@@ -182,7 +186,7 @@ use it.
* NSString subclass heirarchy reorganized to fix problems with
copying and ownership of data.
-1.14 Noteworthy changes in version `1.8.0'
+1.15 Noteworthy changes in version `1.8.0'
==========================================
Read the NEWS file for a complete list of changes since the last stable
@@ -192,14 +196,14 @@ changes in gnustep-make, several components of gnustep-base are located
in different locations. Generally this should not affect the
compilation or running of applications and tools.
-1.15 Noteworthy changes in version `1.7.4'
+1.16 Noteworthy changes in version `1.7.4'
==========================================
* Added Korean encoding
* Updated use of ObjCRuntime functions.
-1.16 Noteworthy changes in version `1.7.3'
+1.17 Noteworthy changes in version `1.7.3'
==========================================
Note in this version there have been large changes to the location of
@@ -211,7 +215,7 @@ specific headers may not compile because of this.
* New TraditionalChinese language.
-1.17 Noteworthy changes in version `1.7.2'
+1.18 Noteworthy changes in version `1.7.2'
==========================================
* NSUndoManager improvements
@@ -222,12 +226,12 @@ specific headers may not compile because of this.
* Improvements to handle selectors better over remote connections.
-1.18 Noteworthy changes in version `1.7.1'
+1.19 Noteworthy changes in version `1.7.1'
==========================================
Bug fixes.
-1.19 Noteworthy changes in version `1.7.0'
+1.20 Noteworthy changes in version `1.7.0'
==========================================
See gnustep-make for comments on the filesystem change. Some components
@@ -244,7 +248,7 @@ changes:
* Added man page for gdomap
-1.20 Noteworthy changes in version `1.6.0'
+1.21 Noteworthy changes in version `1.6.0'
==========================================
* More MinGW support
@@ -259,7 +263,7 @@ changes:
* Any many many bug fixes and minor improvements.
-1.21 Noteworthy changes in version `1.5.1'
+1.22 Noteworthy changes in version `1.5.1'
==========================================
* Port NSThread to MingW
@@ -278,7 +282,7 @@ changes:
* NSTimeZone code rewritten for speed.
-1.22 Noteworthy changes in version `1.5.0'
+1.23 Noteworthy changes in version `1.5.0'
==========================================
* New MacOSX methods implemented (NSString, NSArray, NSObject)
@@ -287,12 +291,12 @@ changes:
* Tcp connections use runloop in NSConnectionReplyMode.
-1.23 Noteworthy changes in version `1.4.0'
+1.24 Noteworthy changes in version `1.4.0'
==========================================
* gdomap - security bug fixes.
-1.24 Noteworthy changes in version `1.3.4'
+1.25 Noteworthy changes in version `1.3.4'
==========================================
This is a first pre-release version for 1.4.
@@ -304,7 +308,7 @@ users are urged to upgrade to this version as soon as possible.
* New combined Unix/Windows version of NSFileHandle
-1.25 Noteworthy changes in version `1.3.3'
+1.26 Noteworthy changes in version `1.3.3'
==========================================
Note there are interface and binary changes in this release that
@@ -325,7 +329,7 @@ gnustep-base.
* Support for system-wide .GNUsteprc
-1.26 Noteworthy changes in version `1.3.2'
+1.27 Noteworthy changes in version `1.3.2'
==========================================
* Corrections for handling Windows file paths, etc
@@ -343,7 +347,7 @@ gnustep-base.
* Unicode and UTF8 handling improvements.
-1.27 Noteworthy changes in version `1.3.0'
+1.28 Noteworthy changes in version `1.3.0'
==========================================
* Moved additional classes into subprojects and/or bundles to make it
@@ -359,7 +363,7 @@ gnustep-base.
* New, partially finished Objective-C/Foundation programming manual.
-1.28 Noteworthy changes in version `1.1.0'
+1.29 Noteworthy changes in version `1.1.0'
==========================================
* Removed use of distributed lock to sync defaults file.
@@ -381,7 +385,7 @@ gnustep-base.
* XML property lists
-1.29 Noteworthy changes in version `1.0.2'
+1.30 Noteworthy changes in version `1.0.2'
==========================================
Mostly a bug fix release to work with the new gcc 3.0.
@@ -389,7 +393,7 @@ Mostly a bug fix release to work with the new gcc 3.0.
* Added support for special gcc 3.0 options (constant string
support).
-1.30 Noteworthy changes in version `1.0.1'
+1.31 Noteworthy changes in version `1.0.1'
==========================================
* Many fixes to work better with Darwin (still not there).
@@ -405,7 +409,7 @@ Mostly a bug fix release to work with the new gcc 3.0.
* More memory debugging support.
-1.31 Noteworthy changes in version `1.0.0'
+1.32 Noteworthy changes in version `1.0.0'
==========================================
* Fix parsing of arguments for new linux kernels.
@@ -416,7 +420,7 @@ Mostly a bug fix release to work with the new gcc 3.0.
* Update unicode support and fixes
-1.32 Noteworthy changes in version `0.9.1'
+1.33 Noteworthy changes in version `0.9.1'
==========================================
* New MacOSX compatible files for NSCalendarDate, NSTimeZone
@@ -429,7 +433,7 @@ Mostly a bug fix release to work with the new gcc 3.0.
* Added some gettext compatible localization macros.
-1.33 Noteworthy changes in version `0.9.1'
+1.34 Noteworthy changes in version `0.9.1'
==========================================
* Fixes for building on FreeBSD
@@ -440,7 +444,7 @@ Mostly a bug fix release to work with the new gcc 3.0.
* Updated for Makefile package changes.
-1.34 Noteworthy changes in version `0.9.0'
+1.35 Noteworthy changes in version `0.9.0'
==========================================
* Workaround when no host IP set.
@@ -478,7 +482,7 @@ Mostly a bug fix release to work with the new gcc 3.0.
* Removed obsolete classes.
-1.35 Noteworthy changes in version `0.6.6'
+1.36 Noteworthy changes in version `0.6.6'
==========================================
* Lots of new documentation.
@@ -495,7 +499,7 @@ Mostly a bug fix release to work with the new gcc 3.0.
* More optimization of classes.
-1.36 Noteworthy changes in version `0.6.5'
+1.37 Noteworthy changes in version `0.6.5'
==========================================
* Better debugging information.
@@ -509,7 +513,7 @@ Mostly a bug fix release to work with the new gcc 3.0.
* Lots of optimizations and bug fixes.
-1.37 Noteworthy changes in version `0.6.0'
+1.38 Noteworthy changes in version `0.6.0'
==========================================
Most of the changes to the Base Library are bug fixes and updates to
@@ -525,7 +529,7 @@ and installations, and is considered to be fairly stable.
* Performance boosts in many classes.
-1.38 Noteworthy changes in version `0.5.5'
+1.39 Noteworthy changes in version `0.5.5'
==========================================
Too many changes to mention in detail, but here is a list of a few:
@@ -544,14 +548,14 @@ Too many changes to mention in detail, but here is a list of a few:
pasteboards.
-1.39 Noteworthy changes in version `0.5.1'
+1.40 Noteworthy changes in version `0.5.1'
==========================================
* Additional runtime functions for interaction with Guile and
ObjC-Guile library.
-1.40 Noteworthy changes in version `0.5.0'
+1.41 Noteworthy changes in version `0.5.0'
==========================================
* Improvements to the NSInvocation class, from Masatake Yamato
@@ -566,7 +570,7 @@ Too many changes to mention in detail, but here is a list of a few:
.
-1.41 Noteworthy changes in version `0.4.0'
+1.42 Noteworthy changes in version `0.4.0'
==========================================
* New tools for maintaining the defaults database.
@@ -601,7 +605,7 @@ Too many changes to mention in detail, but here is a list of a few:
* Many, many, many, many bug fixes and new classes.
-1.42 Noteworthy changes since version `0.1.19'
+1.43 Noteworthy changes since version `0.1.19'
==============================================
* The library has changed its name from `libobjects' to
@@ -703,7 +707,7 @@ Too many changes to mention in detail, but here is a list of a few:
* ...and many bug fixes.
-1.43 Noteworthy changes since version `0.1.14'
+1.44 Noteworthy changes since version `0.1.14'
==============================================
* Can be made as a shared library by passing `--enabled-shared' to
@@ -738,7 +742,7 @@ Too many changes to mention in detail, but here is a list of a few:
places.
-1.44 Noteworthy changes since version `0.1.13'
+1.45 Noteworthy changes since version `0.1.13'
==============================================
* NSProcessInfo class, thanks to Georg Tuparev.
@@ -753,7 +757,7 @@ Too many changes to mention in detail, but here is a list of a few:
* Many bug fixes.
-1.45 Noteworthy changes since version `0.1.12'
+1.46 Noteworthy changes since version `0.1.12'
==============================================
* Bug fixes: installation; NSArray and NSDictionary copying;
@@ -762,7 +766,7 @@ Too many changes to mention in detail, but here is a list of a few:
ChangeLog for more details.
-1.46 Noteworthy changes since version `0.1.10'
+1.47 Noteworthy changes since version `0.1.10'
==============================================
* Now using `src', `config' and `doc' directories to un-clutter the
@@ -780,7 +784,7 @@ Too many changes to mention in detail, but here is a list of a few:
* And several bug fixes. See the ChangeLog for details.
-1.47 Noteworthy changes since version `0.1.9'
+1.48 Noteworthy changes since version `0.1.9'
=============================================
* Renamed "foundation" include file directory to "Foundation", in
@@ -790,7 +794,7 @@ Too many changes to mention in detail, but here is a list of a few:
0.1.9.
-1.48 Noteworthy changes since version `0.1.8'
+1.49 Noteworthy changes since version `0.1.8'
=============================================
* Many new GNUStep classes: NSEnumerator, NSArrayEnumerator, NSCoder,
@@ -827,7 +831,7 @@ Too many changes to mention in detail, but here is a list of a few:
implementations back in Collection.m.
-1.49 Noteworthy changes since version `0.1.7'
+1.50 Noteworthy changes since version `0.1.7'
=============================================
* Thanks to Adam Fedor , classes
@@ -849,7 +853,7 @@ Too many changes to mention in detail, but here is a list of a few:
deallocation and behavior adding. See the ChangeLog for details.
-1.50 Noteworthy changes since version `0.1.5'
+1.51 Noteworthy changes since version `0.1.5'
=============================================
* Better string handling. NSString is now fleshed out, and I've
@@ -877,7 +881,7 @@ Too many changes to mention in detail, but here is a list of a few:
are in the ChangeLog.
-1.51 Noteworthy changes since version `0.1.3'
+1.52 Noteworthy changes since version `0.1.3'
=============================================
This release not well tested at all. We desperately need someone to
@@ -904,7 +908,7 @@ made on GNUSTEP.
`autorelease', `dealloc' instead of `free'.
-1.52 Noteworthy changes since version `0.1.0'
+1.53 Noteworthy changes since version `0.1.0'
=============================================
* New category: ObjectRetaining. New classes: AutoreleasePool,
@@ -914,7 +918,7 @@ made on GNUSTEP.
README.ULTRIX. Time.m patched for Solaris 2.4. test12.m free fix.
-1.53 Noteworthy changes in version `0.1.0'
+1.54 Noteworthy changes in version `0.1.0'
==========================================
* Renamed the library from `libcoll' to `libgnustep-base'. (See the
@@ -948,7 +952,7 @@ made on GNUSTEP.
for NeXT-compatible zone functions.
-1.54 Noteworthy changes in verion `940524'
+1.55 Noteworthy changes in verion `940524'
==========================================
* A NeXT-compatible NXStringTable object, thanks to Adam Fedor
@@ -975,7 +979,7 @@ made on GNUSTEP.
for better NeXT-compability. And more.
-1.55 Noteworthy changes in version `931026'
+1.56 Noteworthy changes in version `931026'
===========================================
* Installation using `./configure' and `autoconf'
diff --git a/NSCharacterSets/GNUmakefile b/NSCharacterSets/GNUmakefile
index 80f441746..800d83e59 100644
--- a/NSCharacterSets/GNUmakefile
+++ b/NSCharacterSets/GNUmakefile
@@ -21,10 +21,19 @@
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02111 USA.
+ifeq ($(GNUSTEP_MAKEFILES),)
+ GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
+endif
+
+ifeq ($(GNUSTEP_MAKEFILES),)
+ $(error You need to set GNUSTEP_MAKEFILES before compiling!)
+endif
+
# Install into the system root by default
-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
+GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../base.make
+
include $(GNUSTEP_MAKEFILES)/common.make
CHARSET_FILES = \
diff --git a/NSTimeZones/GNUmakefile b/NSTimeZones/GNUmakefile
index 627e6f613..60c3849f5 100644
--- a/NSTimeZones/GNUmakefile
+++ b/NSTimeZones/GNUmakefile
@@ -18,18 +18,30 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02111 USA.
+
+ifeq ($(GNUSTEP_MAKEFILES),)
+ GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
+endif
+
+ifeq ($(GNUSTEP_MAKEFILES),)
+ $(error You need to set GNUSTEP_MAKEFILES before compiling!)
+endif
# Install into the system root by default
-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
+GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../base.make
+
include $(GNUSTEP_MAKEFILES)/common.make
include ../Version
include ../config.mak
-resourcedir = $(GNUSTEP_RESOURCES)/gnustep-base
+libgnustep-base_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
+
+resourcedir = $(GNUSTEP_LIBRARY)/Libraries/gnustep-base/Versions/$(libgnustep-base_INTERFACE_VERSION)/Resources
TIMEZONE_ARCHIVE = \
NSTimeZones.tar
diff --git a/NSTimeZones/NSTimeZones.tar b/NSTimeZones/NSTimeZones.tar
index d2aa6b956..52acaf444 100644
Binary files a/NSTimeZones/NSTimeZones.tar and b/NSTimeZones/NSTimeZones.tar differ
diff --git a/README b/README
index 98c182280..00393a9b9 100644
--- a/README
+++ b/README
@@ -1,18 +1,13 @@
1 Readme
********
- ftp.gnustep.org
+The GNUstep Base Library is a library of general-purpose, non-graphical
+Objective C objects. For example, it includes classes for strings,
+object collections, byte streams, typed coders, invocations,
+notifications, notification dispatchers, moments in time, network ports,
+remote object messaging support (distributed objects), and event loops.
- pub/daily-snapshots
-
- The GNUstep Base Library is a library of general-purpose,
-non-graphical Objective C objects. For example, it includes classes
-for strings, object collections, byte streams, typed coders,
-invocations, notifications, notification dispatchers, moments in time,
-network ports, remote object messaging support (distributed objects),
-and event loops.
-
- It provides functionality that aims to implement the non-graphical
+It provides functionality that aims to implement the non-graphical
portion of the OpenStep standard (the Foundation library).
1.1 Initial reading
diff --git a/Resources/GNUmakefile b/Resources/GNUmakefile
index 450813c7e..99ddc7803 100644
--- a/Resources/GNUmakefile
+++ b/Resources/GNUmakefile
@@ -19,15 +19,31 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02111 USA.
-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
+ifeq ($(GNUSTEP_MAKEFILES),)
+ GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
+endif
+
+ifeq ($(GNUSTEP_MAKEFILES),)
+ $(error You need to set GNUSTEP_MAKEFILES before compiling!)
+endif
+
+GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../base.make
+
include $(GNUSTEP_MAKEFILES)/common.make
+include ../Version
+libgnustep-base_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
+
RESOURCE_SET_NAME = base-resources
-base-resources_RESOURCE_FILES_INSTALL_DIR = Library/Libraries/Resources/gnustep-base
+# This is for gnustep-make >= 14-02-2007
+base-resources_INSTALL_DIR = $(GNUSTEP_LIBRARY)/Libraries/gnustep-base/Versions/$(libgnustep-base_INTERFACE_VERSION)/Resources
+# This is kept temporarily for gnustep-make < 14-02-2007
+base-resources_RESOURCE_FILES_INSTALL_DIR = /Library/Libraries/Resources/gnustep-base
base-resources_LANGUAGES = English German French Italian TraditionalChinese \
Spanish Esperanto Korean
base-resources_LOCALIZED_RESOURCE_FILES = Localizable.strings
diff --git a/SSL/GNUmakefile b/SSL/GNUmakefile
index a4c264d71..9fd586799 100644
--- a/SSL/GNUmakefile
+++ b/SSL/GNUmakefile
@@ -19,18 +19,25 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02111 USA.
#
+ifeq ($(GNUSTEP_MAKEFILES),)
+ GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
+endif
+
+ifeq ($(GNUSTEP_MAKEFILES),)
+ $(error You need to set GNUSTEP_MAKEFILES before compiling!)
+endif
+
# Install into the system root by default
-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
+GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
# This must set be before reading common.make, which will read the
# Additional makefiles.
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../base.make
-# Include common.make as the first thing, as this defined
-# FOUNDATION_LIB which is used in ../config.mak
include $(GNUSTEP_MAKEFILES)/common.make
-include ../config.mak
@@ -45,6 +52,11 @@ ifeq ($(HAVE_OPENSSL), yes)
# The bundles to be compiled
BUNDLE_NAME=SSL
+# Interface version changes with each minor release
+include ../Version
+libgnustep-base_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
+SSL_INSTALL_DIR = $(GNUSTEP_LIBRARY)/Libraries/gnustep-base/Versions/$(libgnustep-base_INTERFACE_VERSION)/Resources/
+
# Additional search directories for linking
SSL_LIB_DIRS += -L$(GNUSTEP_OBJ_DIR)
diff --git a/SSL/GSSSLHandle.m b/SSL/GSSSLHandle.m
index 856de0af8..de7837f90 100644
--- a/SSL/GSSSLHandle.m
+++ b/SSL/GSSSLHandle.m
@@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
@@ -49,10 +50,10 @@
#include
#undef id
-#include
#include
#include
+#include "GSPrivate.h"
#if defined(__MINGW32__)
#include
@@ -78,10 +79,9 @@
#ifdef HAVE_UNISTD_H
#include
#endif
-#include
static NSString*
-sslError(int err, int e)
+sslError(int err)
{
NSString *str;
@@ -105,8 +105,12 @@ sslError(int err, int e)
str = @"Want X509 Lookup Error";
break;
case SSL_ERROR_SYSCALL:
- str = [NSString stringWithFormat: @"Syscall error %d - %s",
- e, GSLastErrorStr(e)];
+ {
+ NSError *e = [NSError _last];
+
+ str = [NSString stringWithFormat: @"Syscall error %d - %@",
+ [e code], [e description]];
+ }
break;
case SSL_ERROR_SSL:
str = @"SSL Error: really helpful";
@@ -222,7 +226,6 @@ sslError(int err, int e)
}
if (ret != 1)
{
- int e = errno;
NSDate *final;
NSDate *when;
NSTimeInterval last = 0.0;
@@ -251,7 +254,6 @@ sslError(int err, int e)
ret = SSL_accept(ssl);
if (ret != 1)
{
- e = errno;
err = SSL_get_error(ssl, ret);
}
else
@@ -269,7 +271,7 @@ sslError(int err, int e)
* Some other error ... not just a timeout or disconnect
*/
NSLog(@"unable to accept SSL connection from %@:%@ - %@",
- address, service, sslError(err, e));
+ address, service, sslError(err));
ERR_print_errors_fp(stderr);
}
@@ -328,7 +330,6 @@ sslError(int err, int e)
}
if (ret != 1)
{
- int e = errno;
NSDate *final;
NSDate *when;
NSTimeInterval last = 0.0;
@@ -357,7 +358,6 @@ sslError(int err, int e)
ret = SSL_connect(ssl);
if (ret != 1)
{
- e = errno;
err = SSL_get_error(ssl, ret);
}
else
@@ -369,13 +369,14 @@ sslError(int err, int e)
RELEASE(final);
if (err != SSL_ERROR_NONE)
{
+ if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)
if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)
{
/*
* Some other error ... not just a timeout or disconnect
*/
NSLog(@"unable to make SSL connection to %@:%@ - %@",
- address, service, sslError(err, e));
+ address, service, sslError(err));
ERR_print_errors_fp(stderr);
}
RELEASE(self);
@@ -437,7 +438,7 @@ sslError(int err, int e)
if (ret != 1)
{
NSLog(@"Failed to set certificate file to %@ - %@",
- certFile, sslError(ERR_get_error(), errno));
+ certFile, sslError(ERR_get_error()));
}
}
if ([privateKey length] > 0)
@@ -447,7 +448,7 @@ sslError(int err, int e)
if (ret != 1)
{
NSLog(@"Failed to set private key file to %@ - %@",
- privateKey, sslError(ERR_get_error(), errno));
+ privateKey, sslError(ERR_get_error()));
}
}
}
diff --git a/SSL/Makefile.postamble b/SSL/Makefile.postamble
index eb9a7b605..479836236 100644
--- a/SSL/Makefile.postamble
+++ b/SSL/Makefile.postamble
@@ -67,7 +67,7 @@
# Things to do after distcleaning
after-distclean::
- rm -rf $(GNUSTEP_TARGET_DIR)/config.h
+ rm -rf $(GNUSTEP_TARGET_DIR)/config.h config.status config.log config.cache TAGS config.mak config.h
# Things to do before checking
# before-check::
@@ -75,14 +75,20 @@ after-distclean::
# Things to do after checking
# after-check::
-config.mak: config.mak.in
- ./configure
+config.mak: config.mak.in config.status
+ ./config.status
#
# The config.h file is specific to a target
#
-$(GNUSTEP_TARGET_DIR)/config.h: ../config.status
+$(GNUSTEP_TARGET_DIR)/config.h: config.status
+ ./config.status
+ifneq ($(GNUSTEP_TARGET_DIR), .)
$(MKDIRS) $(GNUSTEP_TARGET_DIR)
-mv config.h $(GNUSTEP_TARGET_DIR)
-touch $(GNUSTEP_TARGET_DIR)/config.h
+endif
+# Run configure manually if you need to pass any options
+config.status:
+ ./configure
diff --git a/SSL/Makefile.preamble b/SSL/Makefile.preamble
index 4b9926ba9..8b8d42b40 100644
--- a/SSL/Makefile.preamble
+++ b/SSL/Makefile.preamble
@@ -48,8 +48,12 @@ ADDITIONAL_OBJCFLAGS = $(SSLFLAGS)
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
+# FIXME - the -I../Source seems wrong because it might
+# include config.h from gnustep-base instead of the
+# one in this directory. It is required to find
+# GSPrivate.h on non-flattened though.
ADDITIONAL_INCLUDE_DIRS = -I./$(GNUSTEP_TARGET_DIR) \
- -I../Source/$(GNUSTEP_TARGET_DIR) \
+ -I../Source/$(GNUSTEP_TARGET_DIR) -I../Source \
-I../Headers/Additions -I../Headers
# Additional LDFLAGS to pass to the linker
diff --git a/SSL/configure b/SSL/configure
index b67b2efb5..face9fd36 100755
--- a/SSL/configure
+++ b/SSL/configure
@@ -1348,15 +1348,35 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
#--------------------------------------------------------------------
# Miscellaneous flags
#--------------------------------------------------------------------
-# Set location of GNUstep dirs for later use
-GNUSTEP_HDIR=$GNUSTEP_SYSTEM_ROOT/Headers
-if test "$GNUSTEP_FLATTENED" = yes; then
- GNUSTEP_LDIR=$GNUSTEP_SYSTEM_ROOT/Libraries
-else
+
+#
+# It looks like we ought to source the whole GNUstep.sh here, and even
+# ask it to output all variables! That way we have access to (eg)
+# GNUSTEP_SYSTEM_HEADERS below.
+#
+GNUSTEP_SH_EXPORT_ALL_VARIABLES=yes
+. "$GNUSTEP_MAKEFILES/GNUstep.sh"
+unset GNUSTEP_SH_EXPORT_ALL_VARIABLES
+
+# For backwards compatibility, define GNUSTEP_SYSTEM_HEADERS from
+# GNUSTEP_SYSTEM_ROOT if not set yet.
+if test x"$GNUSTEP_SYSTEM_HEADERS" = x""; then
+ GNUSTEP_SYSTEM_HEADERS="$GNUSTEP_SYSTEM_ROOT/Library/Headers"
+fi
+
+if test x"$GNUSTEP_SYSTEM_LIBRARIES" = x""; then
+ GNUSTEP_SYSTEM_LIBRARIES="$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
+fi
+
+if test "$GNUSTEP_IS_FLATTENED" = no; then
clean_target_os=`$GNUSTEP_MAKEFILES/clean_os.sh $target_os`
clean_target_cpu=`$GNUSTEP_MAKEFILES/clean_cpu.sh $target_cpu`
obj_dir=$clean_target_cpu/$clean_target_os
- GNUSTEP_LDIR=$GNUSTEP_SYSTEM_ROOT/Libraries/$obj_dir
+ GNUSTEP_LDIR=$GNUSTEP_SYSTEM_LIBRARIES/$obj_dir
+ GNUSTEP_HDIR=$GNUSTEP_SYSTEM_HEADERS/$LIBRARY_COMBO
+else
+ GNUSTEP_LDIR=$GNUSTEP_SYSTEM_LIBRARIES
+ GNUSTEP_HDIR=$GNUSTEP_SYSTEM_HEADERS
fi
#
diff --git a/SSL/configure.ac b/SSL/configure.ac
index acada4258..9c7fe854d 100644
--- a/SSL/configure.ac
+++ b/SSL/configure.ac
@@ -40,15 +40,35 @@ AC_CONFIG_AUX_DIR($GNUSTEP_MAKEFILES)
#--------------------------------------------------------------------
# Miscellaneous flags
#--------------------------------------------------------------------
-# Set location of GNUstep dirs for later use
-GNUSTEP_HDIR=$GNUSTEP_SYSTEM_ROOT/Headers
-if test "$GNUSTEP_FLATTENED" = yes; then
- GNUSTEP_LDIR=$GNUSTEP_SYSTEM_ROOT/Libraries
-else
+
+#
+# It looks like we ought to source the whole GNUstep.sh here, and even
+# ask it to output all variables! That way we have access to (eg)
+# GNUSTEP_SYSTEM_HEADERS below.
+#
+GNUSTEP_SH_EXPORT_ALL_VARIABLES=yes
+. "$GNUSTEP_MAKEFILES/GNUstep.sh"
+unset GNUSTEP_SH_EXPORT_ALL_VARIABLES
+
+# For backwards compatibility, define GNUSTEP_SYSTEM_HEADERS from
+# GNUSTEP_SYSTEM_ROOT if not set yet.
+if test x"$GNUSTEP_SYSTEM_HEADERS" = x""; then
+ GNUSTEP_SYSTEM_HEADERS="$GNUSTEP_SYSTEM_ROOT/Library/Headers"
+fi
+
+if test x"$GNUSTEP_SYSTEM_LIBRARIES" = x""; then
+ GNUSTEP_SYSTEM_LIBRARIES="$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
+fi
+
+if test "$GNUSTEP_IS_FLATTENED" = no; then
clean_target_os=`$GNUSTEP_MAKEFILES/clean_os.sh $target_os`
clean_target_cpu=`$GNUSTEP_MAKEFILES/clean_cpu.sh $target_cpu`
obj_dir=$clean_target_cpu/$clean_target_os
- GNUSTEP_LDIR=$GNUSTEP_SYSTEM_ROOT/Libraries/$obj_dir
+ GNUSTEP_LDIR=$GNUSTEP_SYSTEM_LIBRARIES/$obj_dir
+ GNUSTEP_HDIR=$GNUSTEP_SYSTEM_HEADERS/$LIBRARY_COMBO
+else
+ GNUSTEP_LDIR=$GNUSTEP_SYSTEM_LIBRARIES
+ GNUSTEP_HDIR=$GNUSTEP_SYSTEM_HEADERS
fi
#
diff --git a/Source/Additions/GNUmakefile b/Source/Additions/GNUmakefile
index 28b6276fd..d494a77d6 100644
--- a/Source/Additions/GNUmakefile
+++ b/Source/Additions/GNUmakefile
@@ -19,7 +19,8 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02111 USA.
#
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../base.make
diff --git a/Source/Additions/GSCategories.m b/Source/Additions/GSCategories.m
index a2e551517..016e1b4f7 100644
--- a/Source/Additions/GSCategories.m
+++ b/Source/Additions/GSCategories.m
@@ -24,9 +24,10 @@
*/
#include "config.h"
#include
-#include
+#include "Foundation/Foundation.h"
#include "GNUstepBase/GSCategories.h"
#include "GNUstepBase/GSLock.h"
+#include "GSPrivate.h"
/* Test for ASCII whitespace which is safe for unicode characters */
#define space(C) ((C) > 127 ? NO : isspace(C))
@@ -899,6 +900,87 @@ static void MD5Transform (uint32_t buf[4], uint32_t const in[16])
}
@end
+
+
+/**
+ * GNUstep specific (non-standard) additions to the NSError class.
+ * Possibly to be made public
+ */
+@implementation NSError(GSCategories)
+
+#ifndef HAVE_STRERROR
+static const char *
+strerror(int eno)
+{
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+
+ if (eno < 0 || eno >= sys_nerr)
+ {
+ return("unknown error number");
+ }
+ return(sys_errlist[eno]);
+}
+#endif
+
+/*
+ * Returns an NSError instance encapsulating the last system error.
+ * The user info dictionary of this object will be mutable, so that
+ * additional information can be placed in it by higher level code.
+ */
++ (NSError*) _last
+{
+#if defined(__MINGW32__)
+ return [self _systemError: GetLastError()];
+#else
+ extern int errno;
+
+ return [self _systemError: errno];
+#endif
+}
+
++ (NSError*) _systemError: (long)code
+{
+ NSError *error;
+ NSString *domain;
+ NSDictionary *info;
+#if defined(__MINGW32__)
+ LPVOID lpMsgBuf;
+ NSString *message;
+
+ domain = NSOSStatusErrorDomain;
+ FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPWSTR) &lpMsgBuf, 0, NULL );
+ message = [NSString stringWithCharacters: lpMsgBuf length: wcslen(lpMsgBuf)];
+ LocalFree(lpMsgBuf);
+ info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ message, NSLocalizedDescriptionKey,
+ nil];
+#else
+ NSString *message;
+
+ /* FIXME ... not all are POSIX, should we use NSMachErrorDomain for some? */
+ domain = NSPOSIXErrorDomain;
+ message = [NSString stringWithCString: strerror(code)
+ encoding: [NSString defaultCStringEncoding]];
+ /* FIXME ... can we do better localisation? */
+ info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ message, NSLocalizedDescriptionKey,
+ nil];
+#endif
+
+ /* NB we use a mutable dictionary so that calling code can add extra
+ * information to the dictionary before passing it up to higher level
+ * code.
+ */
+ error = [self errorWithDomain: domain code: code userInfo: info];
+ return error;
+}
+@end
+
+
+
/**
* GNUstep specific (non-standard) additions to the NSNumber class.
*/
diff --git a/Source/Additions/GSCompatibility.m b/Source/Additions/GSCompatibility.m
index ac52fb382..296b54595 100644
--- a/Source/Additions/GSCompatibility.m
+++ b/Source/Additions/GSCompatibility.m
@@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "config.h"
@@ -27,16 +28,11 @@
#include "GNUstepBase/GSCategories.h"
#include "GNUstepBase/GCObject.h"
-NSString *GetEncodingName(NSStringEncoding availableEncodingValue)
-{
- // Deprecated
- return GSEncodingName(availableEncodingValue);
-}
-
-NSString *GSEncodingName(NSStringEncoding availableEncodingValue)
-{
- return (NSString *)CFStringGetNameOfEncoding(CFStringConvertNSStringEncodingToEncoding(availableEncodingValue));
-}
+/* Avoid compiler warnings about internal method
+*/
+@interface NSError (GNUstep)
++ (NSError*) _last;
+@end
NSThread *GSCurrentThread()
{
@@ -50,7 +46,7 @@ NSMutableDictionary *GSCurrentThreadDictionary()
NSArray *NSStandardLibraryPaths()
{
- return NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory,
+ return NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory,
NSAllDomainsMask, YES);
}
@@ -68,28 +64,28 @@ void NSDecimalFromComponents(NSDecimal *result,
NSString*
GSDebugMethodMsg(id obj, SEL sel, const char *file, int line, NSString *fmt)
{
- NSString *message;
- Class cls = (Class)obj;
- char c = '+';
+ NSString *message;
+ Class cls = (Class)obj;
+ char c = '+';
- if ([obj isInstance] == YES)
+ if ([obj isInstance] == YES)
{
- c = '-';
- cls = [obj class];
+ c = '-';
+ cls = [obj class];
}
- message = [NSString stringWithFormat: @"File %s: %d. In [%@ %c%@] %@",
- file, line, NSStringFromClass(cls), c, NSStringFromSelector(sel), fmt];
- return message;
+ message = [NSString stringWithFormat: @"File %s: %d. In [%@ %c%@] %@",
+ file, line, NSStringFromClass(cls), c, NSStringFromSelector(sel), fmt];
+ return message;
}
NSString*
GSDebugFunctionMsg(const char *func, const char *file, int line, NSString *fmt)
{
- NSString *message;
+ NSString *message;
- message = [NSString stringWithFormat: @"File %s: %d. In %s %@",
- file, line, func, fmt];
- return message;
+ message = [NSString stringWithFormat: @"File %s: %d. In %s %@",
+ file, line, func, fmt];
+ return message;
}
@implementation NSArray (GSCompatibility)
@@ -260,7 +256,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0)
{
- NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
return nil;
}
@@ -277,8 +273,8 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) < 0)
{
- NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(sin.sin_addr),
- NSSwapBigShortToHost(sin.sin_port), GSLastErrorStr(errno));
+ NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
+ NSSwapBigShortToHost(sin.sin_port), [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
@@ -286,7 +282,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (listen(net, 5) < 0)
{
- NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
@@ -294,7 +290,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (getsockname(net, (struct sockaddr*)&sin, &size) < 0)
{
- NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
@@ -323,7 +319,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (getsockname([self fileDescriptor], (struct sockaddr*)&sin, &size) < 0)
{
- NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to get socket name - %@", [NSError _last]);
return nil;
}
@@ -363,23 +359,23 @@ BOOL GSDebugSet(NSString *level)
- (NSMutableSet *) debugSet
// Derived from GNUStep's
{
- if (_debug_set == nil){
- int argc = [[self arguments] count];
- NSMutableSet *mySet;
- int i;
+ if (_debug_set == nil)
+ {
+ int argc = [[self arguments] count];
+ NSMutableSet *mySet;
+ int i;
- mySet = [NSMutableSet new];
- for (i = 0; i < argc; i++)
- {
- NSString *str = [[self arguments] objectAtIndex:i];
+ mySet = [NSMutableSet new];
+ for (i = 0; i < argc; i++)
+ {
+ NSString *str = [[self arguments] objectAtIndex:i];
- if ([str hasPrefix: @"--GNU-Debug="])
- [mySet addObject: [str substringFromIndex: 12]];
- }
- _debug_set = mySet;
+ if ([str hasPrefix: @"--GNU-Debug="])
+ [mySet addObject: [str substringFromIndex: 12]];
+ }
+ _debug_set = mySet;
}
-
- return _debug_set;
+ return _debug_set;
}
@end
@@ -394,15 +390,15 @@ BOOL GSDebugSet(NSString *level)
*/
- (BOOL) boolValue
{
- if ([self caseInsensitiveCompare: @"YES"] == NSOrderedSame)
+ if ([self caseInsensitiveCompare: @"YES"] == NSOrderedSame)
{
return YES;
}
- if ([self caseInsensitiveCompare: @"true"] == NSOrderedSame)
+ if ([self caseInsensitiveCompare: @"true"] == NSOrderedSame)
{
return YES;
}
- return [self intValue] != 0 ? YES : NO;
+ return [self intValue] != 0 ? YES : NO;
}
- (NSString*) substringFromRange:(NSRange)range
@@ -416,13 +412,13 @@ BOOL GSDebugSet(NSString *level)
- (retval_t) returnFrame:(arglist_t)args
{
#warning (stephane@sente.ch) Not implemented
- return (retval_t)[self notImplemented:_cmd];
+ return (retval_t)[self notImplemented:_cmd];
}
- (id) initWithArgframe:(arglist_t)args selector:(SEL)selector
{
#warning (stephane@sente.ch) Not implemented
- return [self notImplemented:_cmd];
+ return [self notImplemented:_cmd];
}
@end
diff --git a/Source/Additions/GSFunctions.m b/Source/Additions/GSFunctions.m
index 169ede7bd..9d9529a28 100644
--- a/Source/Additions/GSFunctions.m
+++ b/Source/Additions/GSFunctions.m
@@ -28,6 +28,7 @@
#include "config.h"
#include "GNUstepBase/preface.h"
#include "GNUstepBase/GSFunctions.h"
+#include "GNUstepBase/GSCategories.h"
#include "Foundation/Foundation.h"
NSString *
@@ -40,6 +41,8 @@ GSFindNamedFile(NSArray *paths, NSString *aName, NSString *anExtension)
NSCParameterAssert(aName != nil);
NSCParameterAssert(paths != nil);
+GSOnceFLog(@"deprecated ... trivial to code directly");
+
/* make up the name with extension if given */
if (anExtension != nil)
{
diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m
index 2b8998ed2..1e3642aa1 100644
--- a/Source/Additions/GSMime.m
+++ b/Source/Additions/GSMime.m
@@ -56,6 +56,7 @@
#include "GNUstepBase/GSMime.h"
#include "GNUstepBase/GSXML.h"
#include "GNUstepBase/GSCategories.h"
+#include "GNUstepBase/Unicode.h"
#include
#include
diff --git a/Source/Additions/GSObjCRuntime.m b/Source/Additions/GSObjCRuntime.m
index 452274c9f..a1c13cc25 100644
--- a/Source/Additions/GSObjCRuntime.m
+++ b/Source/Additions/GSObjCRuntime.m
@@ -117,14 +117,6 @@ GSAllocateMutexAt(objc_mutex_t *request)
objc_mutex_unlock(local_lock);
}
-/** Deprecated ... use GSObjCFindVariable() */
-BOOL
-GSFindInstanceVariable(id obj, const char *name,
- const char **type, unsigned int *size, int *offset)
-{
- return GSObjCFindVariable(obj, name, type, size, offset);
-}
-
/**
* This function is used to locate information about the instance
* variable of obj called name. It returns YES if the variable
@@ -274,16 +266,10 @@ GSObjCVariableNames(id obj)
return array;
}
-/** Deprecated ... use GSObjCGetVariable() */
-void
-GSGetVariable(id obj, int offset, unsigned int size, void *data)
-{
- GSObjCGetVariable(obj, offset, size, data);
-}
/**
* Gets the value from an instance variable in obj
* This function performs no checking ... you should use it only where
- * you are providing information from a call to GSFindVariable()
+ * you are providing information from a call to GSObjCFindVariable()
* and you know that the data area provided is the correct size.
*/
void
@@ -292,12 +278,6 @@ GSObjCGetVariable(id obj, int offset, unsigned int size, void *data)
memcpy(data, ((void*)obj) + offset, size);
}
-/** Deprecated ... use GSObjCSetVariable() */
-void
-GSSetVariable(id obj, int offset, unsigned int size, const void *data)
-{
- GSObjCSetVariable(obj, offset, size, data);
-}
/**
* Sets the value in an instance variable in obj
* This function performs no checking ... you should use it only where
@@ -1475,13 +1455,6 @@ GSObjCAddClassBehavior(Class receiver, Class behavior)
#endif
-/** Deprecated ... use GSObjCGetVal() */
-id
-GSGetValue(NSObject *self, NSString *key, SEL sel,
- const char *type, unsigned size, int offset)
-{
- return GSObjCGetVal(self, [key UTF8String], sel, type, size, offset);
-}
/**
* This is used internally by the key-value coding methods, to get a
* value from an object either via an accessor method (if sel is
@@ -1801,13 +1774,6 @@ GSObjCGetValue(NSObject *self, NSString *key, SEL sel,
return GSObjCGetVal(self, [key UTF8String], sel, type, size, offset);
}
-/** Deprecated ... use GSObjCSetVal() */
-void
-GSSetValue(NSObject *self, NSString *key, id val, SEL sel,
- const char *type, unsigned size, int offset)
-{
- GSObjCSetVal(self, [key UTF8String], val, sel, type, size, offset);
-}
/**
* This is used internally by the key-value coding methods, to set a
* value in an object either via an accessor method (if sel is
diff --git a/Source/Additions/GSXML.m b/Source/Additions/GSXML.m
index 539af032f..010225a48 100644
--- a/Source/Additions/GSXML.m
+++ b/Source/Additions/GSXML.m
@@ -43,6 +43,7 @@
#include "config.h"
#include "GNUstepBase/preface.h"
#include "GNUstepBase/GSCategories.h"
+#include "GNUstepBase/Unicode.h"
#ifdef HAVE_LIBXML
@@ -4934,6 +4935,7 @@ static void indentation(unsigned level, NSMutableString *str)
NL;
INDENT(3);
[str appendString: @""];
+ NL;
INDENT(2);
[str appendString: @""];
NL;
@@ -5075,7 +5077,6 @@ static void indentation(unsigned level, NSMutableString *str)
[handle writeProperty: pKey forKey: GSHTTPPropertyKeyFileKey];
[handle writeProperty: pwd forKey: GSHTTPPropertyPasswordKey];
}
- [handle addClient: self];
#else
connectionURL = [url copy];
connection = nil;
@@ -5309,6 +5310,7 @@ static void indentation(unsigned level, NSMutableString *str)
repeats: NO];
#ifdef GNUSTEP
+ [handle addClient: self];
[handle writeProperty: @"POST" forKey: GSHTTPPropertyMethodKey];
[handle writeProperty: @"GSXMLRPC/1.0.0" forKey: @"User-Agent"];
[handle writeProperty: @"text/xml" forKey: @"Content-Type"];
@@ -5393,6 +5395,9 @@ static void indentation(unsigned level, NSMutableString *str)
ASSIGN(result, reason);
[timer invalidate];
timer = nil;
+#ifdef GNUSTEP
+ [handle removeClient: self];
+#endif
if ([delegate respondsToSelector: @selector(completedXMLRPC:)])
{
[delegate completedXMLRPC: self];
@@ -5406,9 +5411,23 @@ static void indentation(unsigned level, NSMutableString *str)
- (void) URLHandleResourceDidCancelLoading: (NSURLHandle*)sender
{
- ASSIGN(result, @"timeout");
+ NSString *str;
+
[timer invalidate];
timer = nil;
+#ifdef GNUSTEP
+ [handle removeClient: self];
+#endif
+ str = [handle propertyForKeyIfAvailable: NSHTTPPropertyStatusCodeKey];
+ if (str == nil)
+ {
+ str = @"timeout";
+ }
+ else
+ {
+ str = [NSString stringWithFormat: @"HTTP status %@", str];
+ }
+ ASSIGN(result, str);
if ([delegate respondsToSelector: @selector(completedXMLRPC:)])
{
[delegate completedXMLRPC: self];
@@ -5452,6 +5471,9 @@ static void indentation(unsigned level, NSMutableString *str)
[timer invalidate];
timer = nil;
+#ifdef GNUSTEP
+ [handle removeClient: self];
+#endif
if ([delegate respondsToSelector: @selector(completedXMLRPC:)])
{
@@ -5512,7 +5534,6 @@ didReceiveAuthenticationChallenge: (NSURLAuthenticationChallenge*)challenge
{
NSMutableArray *params = [NSMutableArray array];
id fault = nil;
- int code;
NS_DURING
{
diff --git a/Source/Additions/Makefile.preamble b/Source/Additions/Makefile.preamble
index 8963da2f9..b68b1b068 100644
--- a/Source/Additions/Makefile.preamble
+++ b/Source/Additions/Makefile.preamble
@@ -55,8 +55,9 @@ endif
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
+# FIXME - the -I../ is for GSPrivate.h
ADDITIONAL_INCLUDE_DIRS = -I../../Headers/Additions \
- -I../$(GNUSTEP_TARGET_DIR)
+ -I../$(GNUSTEP_TARGET_DIR) -I../
ifeq ($(FOUNDATION_LIB),gnu)
ADDITIONAL_INCLUDE_DIRS += -I../../Headers
diff --git a/Source/Additions/Unicode.m b/Source/Additions/Unicode.m
index 8ca2f9190..6b95d9d51 100644
--- a/Source/Additions/Unicode.m
+++ b/Source/Additions/Unicode.m
@@ -24,7 +24,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "config.h"
@@ -32,6 +33,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -39,9 +41,13 @@
#else
#include
#endif
+
#include "GNUstepBase/GSLock.h"
+#include "GNUstepBase/GSMime.h"
#include "GNUstepBase/GSCategories.h"
#include "GNUstepBase/Unicode.h"
+
+#include "../GSPrivate.h"
#include
#include
#include
@@ -52,15 +58,15 @@
typedef struct {unichar from; unsigned char to;} _ucc_;
-#include "GNUstepBase/unicode/cyrillic.h"
-#include "GNUstepBase/unicode/latin2.h"
-#include "GNUstepBase/unicode/latin9.h"
-#include "GNUstepBase/unicode/nextstep.h"
-#include "GNUstepBase/unicode/caseconv.h"
-#include "GNUstepBase/unicode/cop.h"
-#include "GNUstepBase/unicode/decomp.h"
-#include "GNUstepBase/unicode/gsm0338.h"
-#include "GNUstepBase/unicode/thai.h"
+#include "unicode/cyrillic.h"
+#include "unicode/latin2.h"
+#include "unicode/latin9.h"
+#include "unicode/nextstep.h"
+#include "unicode/caseconv.h"
+#include "unicode/cop.h"
+#include "unicode/decomp.h"
+#include "unicode/gsm0338.h"
+#include "unicode/thai.h"
#ifdef HAVE_ICONV
#ifdef HAVE_GICONV_H
@@ -130,6 +136,7 @@ static GSLazyLock *local_lock = nil;
typedef unsigned char unc;
static NSStringEncoding defEnc = GSUndefinedEncoding;
+static NSStringEncoding natEnc = GSUndefinedEncoding;
static NSStringEncoding *_availableEncodings = 0;
struct _strenc_ {
@@ -329,7 +336,8 @@ static void GSSetupEncodingTable(void)
}
}
-BOOL GSEncodingSupported(NSStringEncoding enc)
+BOOL
+GSPrivateIsEncodingSupported(NSStringEncoding enc)
{
GSSetupEncodingTable();
@@ -385,46 +393,6 @@ BOOL GSEncodingSupported(NSStringEncoding enc)
return NO;
}
-/**
- * Returns a nul terminated array of the available string encodings.
- */
-NSStringEncoding *
-GetAvailableEncodings()
-{
- if (_availableEncodings == 0)
- {
- GSSetupEncodingTable();
- [GS_INITIALIZED_LOCK(local_lock, GSLazyLock) lock];
- if (_availableEncodings == 0)
- {
- NSStringEncoding *encodings;
- unsigned pos;
- unsigned i;
-
- /*
- * Now build up a list of supported encodings ... in the
- * format needed to support [NSString+availableStringEncodings]
- * Check to see what iconv support we have as we go along.
- * This is also the place where we determine the name we use
- * for iconv to support unicode.
- */
- encodings = objc_malloc(sizeof(NSStringEncoding) * (encTableSize+1));
- pos = 0;
- for (i = 0; i < encTableSize+1; i++)
- {
- if (GSEncodingSupported(i) == YES)
- {
- encodings[pos++] = i;
- }
- }
- encodings[pos] = 0;
- _availableEncodings = encodings;
- }
- [local_lock unlock];
- }
- return _availableEncodings;
-}
-
/** Returns the NSStringEncoding that matches the specified
* character set registry and encoding information. For instance,
* for the iso8859-5 character set, the registry is iso8859 and
@@ -435,95 +403,13 @@ GetAvailableEncodings()
NSStringEncoding
GSEncodingForRegistry (NSString *registry, NSString *encoding)
{
- if ([registry isEqualToString: @"iso8859"])
- {
- if ([encoding isEqualToString: @"1"])
- return NSISOLatin1StringEncoding;
- else if ([encoding isEqualToString: @"2"])
- return NSISOLatin2StringEncoding;
- else if ([encoding isEqualToString: @"3"])
- return NSISOLatin3StringEncoding;
- else if ([encoding isEqualToString: @"4"])
- return NSISOLatin4StringEncoding;
- else if ([encoding isEqualToString: @"5"])
- return NSISOCyrillicStringEncoding;
- else if ([encoding isEqualToString: @"6"])
- return NSISOArabicStringEncoding;
- else if ([encoding isEqualToString: @"7"])
- return NSISOGreekStringEncoding;
- else if ([encoding isEqualToString: @"8"])
- return NSISOHebrewStringEncoding;
- else if ([encoding isEqualToString: @"11"])
- return NSISOThaiStringEncoding;
- else if ([encoding isEqualToString: @"15"])
- return NSISOLatin9StringEncoding;
- // Other latin encodings are currently not supported
- }
- else if ([registry isEqualToString: @"iso10646"])
- {
- if ([encoding isEqualToString: @"1"])
- return NSUnicodeStringEncoding;
- }
- else if ([registry isEqualToString: @"microsoft"])
- {
- if ([encoding isEqualToString: @"symbol"])
- return NSSymbolStringEncoding;
- else if ([encoding isEqualToString: @"cp1250"])
- return NSWindowsCP1250StringEncoding;
- else if ([encoding isEqualToString: @"cp1251"])
- return NSWindowsCP1251StringEncoding;
- else if ([encoding isEqualToString: @"cp1252"])
- return NSWindowsCP1252StringEncoding;
- else if ([encoding isEqualToString: @"cp1253"])
- return NSWindowsCP1253StringEncoding;
- else if ([encoding isEqualToString: @"cp1254"])
- return NSWindowsCP1254StringEncoding;
- }
- else if ([registry isEqualToString: @"apple"])
- {
- if ([encoding isEqualToString: @"roman"])
- return NSMacOSRomanStringEncoding;
- }
- else if ([registry isEqualToString: @"jisx0201.1976"])
- {
- if ([encoding isEqualToString: @"0"])
- return NSShiftJISStringEncoding;
- }
- else if ([registry isEqualToString: @"iso646.1991"])
- {
- if ([encoding isEqualToString: @"irv"])
- return NSASCIIStringEncoding;
- }
- else if ([registry isEqualToString: @"koi8"])
- {
- if ([encoding isEqualToString: @"r"])
- return NSKOI8RStringEncoding;
- }
- else if ([registry isEqualToString: @"gb2312.1980"])
- {
- if ([encoding isEqualToString: @"0"])
- return NSGB2312StringEncoding;
- }
- else if ([registry isEqualToString: @"big5"])
- {
- if ([encoding isEqualToString: @"0"])
- return NSBIG5StringEncoding;
- }
- else if ([registry isEqualToString: @"ksc5601.1987"])
- {
- return NSKoreanEUCStringEncoding;
- }
- else if ([registry isEqualToString: @"ksc5601.1997"])
- {
- return NSKoreanEUCStringEncoding;
- }
- else if ([registry isEqualToString:@"utf8"]
- || [registry isEqualToString:@"utf-8"])
- {
- return NSUTF8StringEncoding;
- }
+ NSString *charset = registry;
- return GSUndefinedEncoding;
+ if ([encoding length] > 0 && [encoding isEqualToString: @"0"] == NO)
+ {
+ charset = [NSString stringWithFormat: @"%@-%@", registry, encoding];
+ }
+ return [GSMimeDocument encodingFromCharset: charset];
}
/** Try to deduce the string encoding from the locale string
@@ -532,7 +418,7 @@ GSEncodingForRegistry (NSString *registry, NSString *encoding)
* deduced from the clocale string itself. If clocale isn't set or
* no match can be found, returns GSUndefinedEncoding.
*/
-/* It would be really nice if this could be used in GetDefEncoding, but
+/* It would be really nice if this could be used in +defaultCStringEncoding, but
* there are too many dependancies on other parts of the library to
* make this practical (even if everything possible was written in C,
* we'd still need some way to find the Locale.encodings file).
@@ -555,23 +441,25 @@ GSEncodingFromLocale(const char *clocale)
/* Locale contains the 'codeset' section. Parse it and see
if we know what encoding this cooresponds to */
NSString *registry;
+ NSString *charset;
NSArray *array;
char *s;
s = strchr (clocale, '.');
- registry = [[NSString stringWithCString: s+1] lowercaseString];
+ registry = [[NSString stringWithUTF8String: s+1] lowercaseString];
array = [registry componentsSeparatedByString: @"-"];
registry = [array objectAtIndex: 0];
if ([array count] > 1)
{
- encodstr = [array lastObject];
+ charset = [NSString stringWithFormat: @"%@-%@",
+ registry, [array lastObject]];
}
else
{
- encodstr = @"0";
+ charset = registry;
}
- encoding = GSEncodingForRegistry(registry, encodstr);
+ encoding = [GSMimeDocument encodingFromCharset: charset];
}
else
{
@@ -594,7 +482,7 @@ GSEncodingFromLocale(const char *clocale)
dict = [NSDictionary dictionaryWithContentsOfFile: table];
encodstr = [dict objectForKey:
- [NSString stringWithCString: clocale]];
+ [NSString stringWithUTF8String: clocale]];
if (encodstr == nil)
return GSUndefinedEncoding;
@@ -620,299 +508,6 @@ GSEncodingFromLocale(const char *clocale)
return encoding;
}
-/**
- * Return the default encoding
- */
-NSStringEncoding
-GetDefEncoding(void)
-{
- if (defEnc == GSUndefinedEncoding)
- {
- char *encoding;
- unsigned int count;
-
- GSSetupEncodingTable();
-
- [GS_INITIALIZED_LOCK(local_lock, GSLazyLock) lock];
- if (defEnc != GSUndefinedEncoding)
- {
- [local_lock unlock];
- return defEnc;
- }
-
- encoding = getenv("GNUSTEP_STRING_ENCODING");
- if (encoding != 0)
- {
- count = 0;
- while (str_encoding_table[count].enc
- && strcasecmp(str_encoding_table[count].ename, encoding)
- && strcasecmp(str_encoding_table[count].iconv, encoding))
- {
- count++;
- }
- if (str_encoding_table[count].enc)
- {
- defEnc = str_encoding_table[count].enc;
- }
- else
- {
- fprintf(stderr,
- "WARNING: %s - encoding not supported.\n", encoding);
- fprintf(stderr,
- " NSISOLatin1StringEncoding set as default.\n");
- defEnc = NSISOLatin1StringEncoding;
- }
- }
- if (defEnc == GSUndefinedEncoding)
- {
- /* Encoding not set */
-#if HAVE_LANGINFO_CODESET
- /* Take it from the system locale information. */
- encoding = nl_langinfo(CODESET);
-/*
- * First handle the fallback response from nl_langinfo() ...
- * if we are getting the default value we can't assume that
- * the user has set anything up at all, so we must use the
- * OpenStep/GNUstep default encopding ... latin1, even though
- * the nl_langinfo() stuff would say default is ascii.
- */
- if (strcmp(encoding, "ANSI_X3.4-1968") == 0 /* glibc */
- || strcmp(encoding, "ISO_646.IRV:1983") == 0 /* glibc */
- || strcmp(encoding, "646") == 0 /* Solaris NetBSD */)
- defEnc = NSISOLatin1StringEncoding;
- else if (strcmp(encoding, "EUC-JP") == 0 /* glibc */
- /* HP-UX IRIX OSF/1 Solaris NetBSD */
- || strcmp(encoding, "eucJP") == 0
- || strcmp(encoding, "IBM-eucJP") == 0 /* AIX */)
- defEnc = NSJapaneseEUCStringEncoding;
- else if (strcmp(encoding, "UTF-8") == 0 /* glibc AIX OSF/1 Solaris */
- || strcmp(encoding, "utf8") == 0 /* HP-UX */)
- defEnc = NSUTF8StringEncoding;
- else if (strcmp(encoding, "ISO-8859-1") == 0 /* glibc */
- /* AIX IRIX OSF/1 Solaris NetBSD */
- || strcmp(encoding, "ISO8859-1") == 0
- || strcmp(encoding, "iso88591") == 0 /* HP-UX */)
- defEnc = NSISOLatin1StringEncoding;
- else if (strcmp(encoding, "IBM-932") == 0 /* AIX */
- || strcmp(encoding, "SJIS") == 0 /* HP-UX OSF/1 NetBSD */
- || strcmp(encoding, "PCK") == 0 /* Solaris */)
- defEnc = NSShiftJISStringEncoding;
- else if (strcmp(encoding, "ISO-8859-2") == 0 /* glibc */
- /* AIX IRIX OSF/1 Solaris NetBSD */
- || strcmp(encoding, "ISO8859-2") == 0
- || strcmp(encoding, "iso88592") == 0 /* HP-UX */)
- defEnc = NSISOLatin2StringEncoding;
- else if (strcmp(encoding, "CP1251") == 0 /* glibc */
- || strcmp(encoding, "ansi-1251") == 0 /* Solaris */)
- defEnc = NSWindowsCP1251StringEncoding;
- else if (strcmp(encoding, "CP1252") == 0 /* */
- || strcmp(encoding, "IBM-1252") == 0 /* AIX */)
- defEnc = NSWindowsCP1252StringEncoding;
- else if (strcmp(encoding, "ISO-8859-5") == 0 /* glibc */
- /* AIX IRIX OSF/1 Solaris NetBSD */
- || strcmp(encoding, "ISO8859-5") == 0
- || strcmp(encoding, "iso88595") == 0 /* HP-UX */)
- defEnc = NSISOCyrillicStringEncoding;
- else if (strcmp(encoding, "KOI8-R") == 0 /* glibc */
- || strcmp(encoding, "koi8-r") == 0 /* Solaris */)
- defEnc = NSKOI8RStringEncoding;
- else if (strcmp(encoding, "ISO-8859-3") == 0 /* glibc */
- || strcmp(encoding, "ISO8859-3") == 0 /* Solaris */)
- defEnc = NSISOLatin3StringEncoding;
- else if (strcmp(encoding, "ISO-8859-4") == 0 /* */
- || strcmp(encoding, "ISO8859-4") == 0 /* OSF/1 Solaris NetBSD */)
- defEnc = NSISOLatin4StringEncoding;
- else if (strcmp(encoding, "ISO-8859-6") == 0 /* glibc */
- || strcmp(encoding, "ISO8859-6") == 0 /* AIX Solaris */
- || strcmp(encoding, "iso88596") == 0 /* HP-UX */)
- defEnc = NSISOArabicStringEncoding;
- else if (strcmp(encoding, "ISO-8859-7") == 0 /* glibc */
- || strcmp(encoding, "ISO8859-7") == 0 /* AIX IRIX OSF/1 Solaris */
- || strcmp(encoding, "iso88597") == 0 /* HP-UX */)
- defEnc = NSISOGreekStringEncoding;
- else if (strcmp(encoding, "ISO-8859-8") == 0 /* glibc */
- || strcmp(encoding, "ISO8859-8") == 0 /* AIX OSF/1 Solaris */
- || strcmp(encoding, "iso88598") == 0 /* HP-UX */)
- defEnc = NSISOHebrewStringEncoding;
- else if (strcmp(encoding, "ISO-8859-9") == 0 /* glibc */
- || strcmp(encoding, "ISO8859-9") == 0 /* AIX IRIX OSF/1 Solaris */
- || strcmp(encoding, "iso88599") == 0 /* HP-UX */)
- defEnc = NSISOLatin5StringEncoding;
- else if (strcmp(encoding, "ISO-8859-10") == 0 /* */
- || strcmp(encoding, "ISO8859-10") == 0 /* */)
- defEnc = NSISOLatin6StringEncoding;
- else if (strcmp(encoding, "TIS-620") == 0 /* glibc AIX */
- || strcmp(encoding, "tis620") == 0 /* HP-UX */
- || strcmp(encoding, "TIS620.2533") == 0 /* Solaris */
- || strcmp(encoding, "TACTIS") == 0 /* OSF/1 */)
- defEnc = NSISOThaiStringEncoding;
- else if (strcmp(encoding, "ISO-8859-13") == 0 /* glibc */
- || strcmp(encoding, "ISO8859-13") == 0 /* */
- || strcmp(encoding, "IBM-921") == 0 /* AIX */)
- defEnc = NSISOLatin7StringEncoding;
- else if (strcmp(encoding, "ISO-8859-14") == 0 /* glibc */
- || strcmp(encoding, "ISO8859-14") == 0 /* */)
- defEnc = NSISOLatin8StringEncoding;
- else if (strcmp(encoding, "ISO-8859-15") == 0 /* glibc */
- /* AIX OSF/1 Solaris NetBSD */
- || strcmp(encoding, "ISO8859-15") == 0
- || strcmp(encoding, "iso885915") == 0 /* HP-UX */)
- defEnc = NSISOLatin9StringEncoding;
- else if (strcmp(encoding, "GB2312") == 0 /* glibc */
- || strcmp(encoding, "gb2312") == 0 /* Solaris */
- || strcmp(encoding, "eucCN") == 0 /* IRIX NetBSD */
- || strcmp(encoding, "IBM-eucCN") == 0 /* AIX */
- || strcmp(encoding, "hp15CN") == 0 /* HP-UX */)
- defEnc = NSGB2312StringEncoding;
- else if (strcmp(encoding, "BIG5") == 0 /* glibc Solaris NetBSD */
- || strcmp(encoding, "big5") == 0 /* AIX HP-UX OSF/1 */)
- defEnc = NSBIG5StringEncoding;
- else if (strcmp(encoding, "EUC-KR") == 0 /* glibc */
- || strcmp(encoding, "eucKR") == 0 /* HP-UX IRIX OSF/1 NetBSD */
- || strcmp(encoding, "IBM-eucKR") == 0 /* AIX */
- || strcmp(encoding, "5601") == 0 /* Solaris */)
- defEnc = NSKoreanEUCStringEncoding;
- else
-#endif
- defEnc = NSISOLatin1StringEncoding;
- }
- else if (GSEncodingSupported(defEnc) == NO)
- {
- fprintf(stderr, "WARNING: %s - encoding not implemented as "
- "default c string encoding.\n", encoding);
- fprintf(stderr,
- " NSISOLatin1StringEncoding set as default.\n");
- defEnc = NSISOLatin1StringEncoding;
- }
- [local_lock unlock];
- }
- return defEnc;
-}
-
-BOOL
-GSIsByteEncoding(NSStringEncoding encoding)
-{
- if (GSEncodingSupported(encoding) == NO)
- {
- return NO;
- }
- return encodingTable[encoding]->eightBit;
-}
-
-/**
- * Returns the standard name for the specified encoding.
- */
-#ifndef NeXT_Foundation_LIBRARY
-NSString*
-GSEncodingName(NSStringEncoding encoding)
-{
- if (GSEncodingSupported(encoding) == NO)
- {
- return @"Unknown encoding";
- }
- return [NSString stringWithCString: encodingTable[encoding]->ename];
-}
-#endif
-
-/**
- * deprecated Use GSEncodingName()
- */
-#ifndef NeXT_Foundation_LIBRARY
-NSString*
-GetEncodingName(NSStringEncoding encoding)
-{
- return GSEncodingName(encoding);
-}
-#endif
-
-/**
- * deprecated
- * See GSToUnicode() and GSFromUnicode()
- */
-unichar
-encode_chartouni(unsigned char c, NSStringEncoding enc)
-{
- BOOL result;
- unsigned int size = 1;
- unichar u = 0;
- unichar *dst = &u;
-
- result = GSToUnicode(&dst, &size, &c, 1, enc, 0, 0);
- if (result == NO)
- {
- return 0;
- }
- return u;
-}
-
-/**
- * deprecated
- * See GSToUnicode() and GSFromUnicode()
- */
-unsigned char
-encode_unitochar(unichar u, NSStringEncoding enc)
-{
- BOOL result;
- unsigned int size = 1;
- unsigned char c = 0;
- unsigned char *dst = &c;
-
- result = GSFromUnicode(&dst, &size, &u, 1, enc, 0, 0);
- if (result == NO)
- {
- return 0;
- }
- return c;
-}
-
-/**
- * deprecated
- * See GSToUnicode() and GSFromUnicode()
- */
-unsigned
-encode_unitochar_strict(unichar u, NSStringEncoding enc)
-{
- BOOL result;
- unsigned int size = 1;
- unsigned char c = 0;
- unsigned char *dst = &c;
-
- result = GSFromUnicode(&dst, &size, &u, 1, enc, 0, GSUniStrict);
- if (result == NO)
- {
- return 0;
- }
- return c;
-}
-
-/**
- * deprecated
- * See GSToUnicode() and GSFromUnicode()
- */
-unichar
-chartouni(unsigned char c)
-{
- if (defEnc == GSUndefinedEncoding)
- {
- defEnc = GetDefEncoding();
- }
- return encode_chartouni(c, defEnc);
-}
-
-/**
- * deprecated
- * See GSToUnicode() and GSFromUnicode()
- */
-unsigned char
-unitochar(unichar u)
-{
- if (defEnc == GSUndefinedEncoding)
- {
- defEnc = GetDefEncoding();
- }
- return encode_unitochar(u, defEnc);
-}
-
/**
* Uses direct access into a two-level table to map cases.
* The two-level table method is less space efficient (but still not bad) than
@@ -942,7 +537,7 @@ uni_toupper(unichar ch)
}
unsigned char
-uni_cop(unichar u)
+GSPrivateUniCop(unichar u)
{
if (u < uni_cop_table[0].code)
{
@@ -987,6 +582,12 @@ uni_cop(unichar u)
}
}
+unsigned char
+uni_cop(unichar u)
+{
+ return GSPrivateUniCop(u);
+}
+
BOOL
uni_isnonsp(unichar u)
{
@@ -998,7 +599,7 @@ uni_isnonsp(unichar u)
return YES;
// FIXME check is uni_cop good for this
- if (uni_cop(u))
+ if (GSPrivateUniCop(u))
return YES;
else
return NO;
@@ -1050,46 +651,6 @@ uni_is_decomp(unichar u)
}
}
-/**
- * deprecated
- * See GSToUnicode() and GSFromUnicode()
- */
-int encode_ustrtocstr(char *dst, int dl, const unichar *src, int sl,
- NSStringEncoding enc, BOOL strict)
-{
- BOOL result;
- unsigned int options = (strict == YES) ? GSUniStrict : 0;
- unsigned int old = dl;
-
- result = GSFromUnicode((unsigned char**)&dst, (unsigned int*)&dl,
- src, sl, enc, 0, options);
- if (result == NO)
- {
- return 0;
- }
- return old - dl; // Number of characters.
-}
-
-/**
- * deprecated
- * See GSToUnicode() and GSFromUnicode()
- */
-int encode_cstrtoustr(unichar *dst, int dl, const char *src, int sl,
- NSStringEncoding enc)
-{
- BOOL result;
- unsigned int old = dl;
-
- result = GSToUnicode(&dst, (unsigned int*)&dl, (unsigned char*)src,
- sl, enc, 0, 0);
- if (result == NO)
- {
- return 0;
- }
- return old - dl;
-}
-
-
/**
* Function to check a block of data for validity as a unicode string and
* say whether it contains solely ASCII or solely Latin1 data.
@@ -1531,7 +1092,7 @@ tables:
const char *estr = 0;
BOOL done = NO;
- if (GSEncodingSupported(enc) == YES)
+ if (GSPrivateIsEncodingSupported(enc) == YES)
{
estr = encodingTable[enc]->iconv;
}
@@ -1552,7 +1113,7 @@ tables:
if (cd == (iconv_t)-1)
{
NSLog(@"No iconv for encoding %@ tried to use %s",
- GetEncodingName(enc), estr);
+ GSPrivateEncodingName(enc), estr);
result = NO;
goto done;
}
@@ -2224,7 +1785,7 @@ iconv_start:
const char *estr = 0;
BOOL done = NO;
- if (GSEncodingSupported(enc) == YES)
+ if (GSPrivateIsEncodingSupported(enc) == YES)
{
if (strict == NO)
{
@@ -2257,7 +1818,7 @@ iconv_start:
if (cd == (iconv_t)-1)
{
NSLog(@"No iconv for encoding %@ tried to use %s",
- GetEncodingName(enc), estr);
+ GSPrivateEncodingName(enc), estr);
result = NO;
goto done;
}
@@ -2414,3 +1975,253 @@ iconv_start:
#undef GROW
+
+
+NSStringEncoding*
+GSPrivateAvailableEncodings()
+{
+ if (_availableEncodings == 0)
+ {
+ GSSetupEncodingTable();
+ [GS_INITIALIZED_LOCK(local_lock, GSLazyLock) lock];
+ if (_availableEncodings == 0)
+ {
+ NSStringEncoding *encodings;
+ unsigned pos;
+ unsigned i;
+
+ /*
+ * Now build up a list of supported encodings ... in the
+ * format needed to support [NSString+availableStringEncodings]
+ * Check to see what iconv support we have as we go along.
+ * This is also the place where we determine the name we use
+ * for iconv to support unicode.
+ */
+ encodings = objc_malloc(sizeof(NSStringEncoding) * (encTableSize+1));
+ pos = 0;
+ for (i = 0; i < encTableSize+1; i++)
+ {
+ if (GSPrivateIsEncodingSupported(i) == YES)
+ {
+ encodings[pos++] = i;
+ }
+ }
+ encodings[pos] = 0;
+ _availableEncodings = encodings;
+ }
+ [local_lock unlock];
+ }
+ return _availableEncodings;
+}
+
+NSStringEncoding
+GSPrivateDefaultCStringEncoding()
+{
+ if (defEnc == GSUndefinedEncoding)
+ {
+ char *encoding;
+ unsigned int count;
+
+ GSSetupEncodingTable();
+
+ [GS_INITIALIZED_LOCK(local_lock, GSLazyLock) lock];
+ if (defEnc != GSUndefinedEncoding)
+ {
+ [local_lock unlock];
+ return defEnc;
+ }
+
+ if (natEnc == GSUndefinedEncoding)
+ {
+ /* Encoding not set */
+#if HAVE_LANGINFO_CODESET
+ /* Take it from the system locale information. */
+ encoding = nl_langinfo(CODESET);
+ /*
+ * First handle the fallback response from nl_langinfo() ...
+ * if we are getting the default value we can't assume that
+ * the user has set anything up at all, so we must use the
+ * OpenStep/GNUstep default encopding ... latin1, even though
+ * the nl_langinfo() stuff would say default is ascii.
+ */
+ if (strcmp(encoding, "ANSI_X3.4-1968") == 0 /* glibc */
+ || strcmp(encoding, "ISO_646.IRV:1983") == 0 /* glibc */
+ || strcmp(encoding, "646") == 0 /* Solaris NetBSD */)
+ natEnc = NSISOLatin1StringEncoding;
+ else if (strcmp(encoding, "EUC-JP") == 0 /* glibc */
+ /* HP-UX IRIX OSF/1 Solaris NetBSD */
+ || strcmp(encoding, "eucJP") == 0
+ || strcmp(encoding, "IBM-eucJP") == 0 /* AIX */)
+ natEnc = NSJapaneseEUCStringEncoding;
+ else if (strcmp(encoding, "UTF-8") == 0 /* glibc AIX OSF/1 Solaris */
+ || strcmp(encoding, "utf8") == 0 /* HP-UX */)
+ natEnc = NSUTF8StringEncoding;
+ else if (strcmp(encoding, "ISO-8859-1") == 0 /* glibc */
+ /* AIX IRIX OSF/1 Solaris NetBSD */
+ || strcmp(encoding, "ISO8859-1") == 0
+ || strcmp(encoding, "iso88591") == 0 /* HP-UX */)
+ natEnc = NSISOLatin1StringEncoding;
+ else if (strcmp(encoding, "IBM-932") == 0 /* AIX */
+ || strcmp(encoding, "SJIS") == 0 /* HP-UX OSF/1 NetBSD */
+ || strcmp(encoding, "PCK") == 0 /* Solaris */)
+ natEnc = NSShiftJISStringEncoding;
+ else if (strcmp(encoding, "ISO-8859-2") == 0 /* glibc */
+ /* AIX IRIX OSF/1 Solaris NetBSD */
+ || strcmp(encoding, "ISO8859-2") == 0
+ || strcmp(encoding, "iso88592") == 0 /* HP-UX */)
+ natEnc = NSISOLatin2StringEncoding;
+ else if (strcmp(encoding, "CP1251") == 0 /* glibc */
+ || strcmp(encoding, "ansi-1251") == 0 /* Solaris */)
+ natEnc = NSWindowsCP1251StringEncoding;
+ else if (strcmp(encoding, "CP1252") == 0 /* */
+ || strcmp(encoding, "IBM-1252") == 0 /* AIX */)
+ natEnc = NSWindowsCP1252StringEncoding;
+ else if (strcmp(encoding, "ISO-8859-5") == 0 /* glibc */
+ /* AIX IRIX OSF/1 Solaris NetBSD */
+ || strcmp(encoding, "ISO8859-5") == 0
+ || strcmp(encoding, "iso88595") == 0 /* HP-UX */)
+ natEnc = NSISOCyrillicStringEncoding;
+ else if (strcmp(encoding, "KOI8-R") == 0 /* glibc */
+ || strcmp(encoding, "koi8-r") == 0 /* Solaris */)
+ natEnc = NSKOI8RStringEncoding;
+ else if (strcmp(encoding, "ISO-8859-3") == 0 /* glibc */
+ || strcmp(encoding, "ISO8859-3") == 0 /* Solaris */)
+ natEnc = NSISOLatin3StringEncoding;
+ else if (strcmp(encoding, "ISO-8859-4") == 0 /* */
+ || strcmp(encoding, "ISO8859-4") == 0 /* OSF/1 Solaris NetBSD */)
+ natEnc = NSISOLatin4StringEncoding;
+ else if (strcmp(encoding, "ISO-8859-6") == 0 /* glibc */
+ || strcmp(encoding, "ISO8859-6") == 0 /* AIX Solaris */
+ || strcmp(encoding, "iso88596") == 0 /* HP-UX */)
+ natEnc = NSISOArabicStringEncoding;
+ else if (strcmp(encoding, "ISO-8859-7") == 0 /* glibc */
+ || strcmp(encoding, "ISO8859-7") == 0 /* AIX IRIX OSF/1 Solaris */
+ || strcmp(encoding, "iso88597") == 0 /* HP-UX */)
+ natEnc = NSISOGreekStringEncoding;
+ else if (strcmp(encoding, "ISO-8859-8") == 0 /* glibc */
+ || strcmp(encoding, "ISO8859-8") == 0 /* AIX OSF/1 Solaris */
+ || strcmp(encoding, "iso88598") == 0 /* HP-UX */)
+ natEnc = NSISOHebrewStringEncoding;
+ else if (strcmp(encoding, "ISO-8859-9") == 0 /* glibc */
+ || strcmp(encoding, "ISO8859-9") == 0 /* AIX IRIX OSF/1 Solaris */
+ || strcmp(encoding, "iso88599") == 0 /* HP-UX */)
+ natEnc = NSISOLatin5StringEncoding;
+ else if (strcmp(encoding, "ISO-8859-10") == 0 /* */
+ || strcmp(encoding, "ISO8859-10") == 0 /* */)
+ natEnc = NSISOLatin6StringEncoding;
+ else if (strcmp(encoding, "TIS-620") == 0 /* glibc AIX */
+ || strcmp(encoding, "tis620") == 0 /* HP-UX */
+ || strcmp(encoding, "TIS620.2533") == 0 /* Solaris */
+ || strcmp(encoding, "TACTIS") == 0 /* OSF/1 */)
+ natEnc = NSISOThaiStringEncoding;
+ else if (strcmp(encoding, "ISO-8859-13") == 0 /* glibc */
+ || strcmp(encoding, "ISO8859-13") == 0 /* */
+ || strcmp(encoding, "IBM-921") == 0 /* AIX */)
+ natEnc = NSISOLatin7StringEncoding;
+ else if (strcmp(encoding, "ISO-8859-14") == 0 /* glibc */
+ || strcmp(encoding, "ISO8859-14") == 0 /* */)
+ natEnc = NSISOLatin8StringEncoding;
+ else if (strcmp(encoding, "ISO-8859-15") == 0 /* glibc */
+ /* AIX OSF/1 Solaris NetBSD */
+ || strcmp(encoding, "ISO8859-15") == 0
+ || strcmp(encoding, "iso885915") == 0 /* HP-UX */)
+ natEnc = NSISOLatin9StringEncoding;
+ else if (strcmp(encoding, "GB2312") == 0 /* glibc */
+ || strcmp(encoding, "gb2312") == 0 /* Solaris */
+ || strcmp(encoding, "eucCN") == 0 /* IRIX NetBSD */
+ || strcmp(encoding, "IBM-eucCN") == 0 /* AIX */
+ || strcmp(encoding, "hp15CN") == 0 /* HP-UX */)
+ natEnc = NSGB2312StringEncoding;
+ else if (strcmp(encoding, "BIG5") == 0 /* glibc Solaris NetBSD */
+ || strcmp(encoding, "big5") == 0 /* AIX HP-UX OSF/1 */)
+ natEnc = NSBIG5StringEncoding;
+ else if (strcmp(encoding, "EUC-KR") == 0 /* glibc */
+ || strcmp(encoding, "eucKR") == 0 /* HP-UX IRIX OSF/1 NetBSD */
+ || strcmp(encoding, "IBM-eucKR") == 0 /* AIX */
+ || strcmp(encoding, "5601") == 0 /* Solaris */)
+ natEnc = NSKoreanEUCStringEncoding;
+#endif
+ }
+
+ encoding = getenv("GNUSTEP_STRING_ENCODING");
+ if (encoding != 0)
+ {
+ count = 0;
+ while (str_encoding_table[count].enc
+ && strcasecmp(str_encoding_table[count].ename, encoding)
+ && strcasecmp(str_encoding_table[count].iconv, encoding))
+ {
+ count++;
+ }
+ if (str_encoding_table[count].enc)
+ {
+ defEnc = str_encoding_table[count].enc;
+ }
+ else
+ {
+ fprintf(stderr,
+ "WARNING: %s - encoding not supported.\n", encoding);
+ fprintf(stderr,
+ " NSISOLatin1StringEncoding set as default.\n");
+ defEnc = NSISOLatin1StringEncoding;
+ }
+ }
+ if (defEnc == GSUndefinedEncoding)
+ {
+ defEnc = natEnc;
+ }
+ if (defEnc == GSUndefinedEncoding)
+ {
+ defEnc = NSISOLatin1StringEncoding;
+ }
+ else if (GSPrivateIsEncodingSupported(defEnc) == NO)
+ {
+ fprintf(stderr, "WARNING: %s - encoding not implemented as "
+ "default c string encoding.\n", encoding);
+ fprintf(stderr,
+ " NSISOLatin1StringEncoding set as default.\n");
+ defEnc = NSISOLatin1StringEncoding;
+ }
+
+ if (natEnc == GSUndefinedEncoding)
+ {
+ natEnc = defEnc;
+ }
+
+ [local_lock unlock];
+ }
+ return defEnc;
+}
+
+NSString*
+GSPrivateEncodingName(NSStringEncoding encoding)
+{
+ if (GSPrivateIsEncodingSupported(encoding) == NO)
+ {
+ return @"Unknown encoding";
+ }
+ return [NSString stringWithUTF8String: encodingTable[encoding]->ename];
+}
+
+BOOL
+GSPrivateIsByteEncoding(NSStringEncoding encoding)
+{
+ if (GSPrivateIsEncodingSupported(encoding) == NO)
+ {
+ return NO;
+ }
+ return encodingTable[encoding]->eightBit;
+}
+
+NSStringEncoding
+GSPrivateNativeCStringEncoding()
+{
+ if (natEnc == GSUndefinedEncoding)
+ {
+ /* GSPrivateDefaultCStringEncoding() will actually set the encoding.
+ */
+ GSPrivateDefaultCStringEncoding();
+ }
+ return natEnc;
+}
+
diff --git a/Headers/Additions/GNUstepBase/unicode/caseconv.h b/Source/Additions/unicode/caseconv.h
similarity index 98%
rename from Headers/Additions/GNUstepBase/unicode/caseconv.h
rename to Source/Additions/unicode/caseconv.h
index b7754b9b1..e1107bfa0 100644
--- a/Headers/Additions/GNUstepBase/unicode/caseconv.h
+++ b/Source/Additions/unicode/caseconv.h
@@ -8,7 +8,7 @@
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
*/
-unichar gs_casemap_empty_table[] = {
+static unichar gs_casemap_empty_table[] = {
0x0,
0x0,
0x0,
@@ -267,7 +267,7 @@ unichar gs_casemap_empty_table[] = {
0x0,
};
-unichar gs_tolower_map_table_0[] = {
+static unichar gs_tolower_map_table_0[] = {
0x0,
0x0,
0x0,
@@ -525,7 +525,8 @@ unichar gs_tolower_map_table_0[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_1[] = {
+
+static unichar gs_tolower_map_table_1[] = {
0x101, /* 0 */
0x0,
0x103, /* 2 */
@@ -783,7 +784,8 @@ unichar gs_tolower_map_table_1[] = {
0x1ff, /* fe */
0x0,
};
-unichar gs_tolower_map_table_2[] = {
+
+static unichar gs_tolower_map_table_2[] = {
0x201, /* 0 */
0x0,
0x203, /* 2 */
@@ -1041,7 +1043,8 @@ unichar gs_tolower_map_table_2[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_3[] = {
+
+static unichar gs_tolower_map_table_3[] = {
0x0,
0x0,
0x0,
@@ -1299,7 +1302,8 @@ unichar gs_tolower_map_table_3[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_4[] = {
+
+static unichar gs_tolower_map_table_4[] = {
0x450, /* 0 */
0x451, /* 1 */
0x452, /* 2 */
@@ -1557,7 +1561,8 @@ unichar gs_tolower_map_table_4[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_5[] = {
+
+static unichar gs_tolower_map_table_5[] = {
0x0,
0x0,
0x0,
@@ -1815,7 +1820,8 @@ unichar gs_tolower_map_table_5[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_1e[] = {
+
+static unichar gs_tolower_map_table_1e[] = {
0x1e01, /* 0 */
0x0,
0x1e03, /* 2 */
@@ -2073,7 +2079,8 @@ unichar gs_tolower_map_table_1e[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_1f[] = {
+
+static unichar gs_tolower_map_table_1f[] = {
0x0,
0x0,
0x0,
@@ -2331,7 +2338,8 @@ unichar gs_tolower_map_table_1f[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_21[] = {
+
+static unichar gs_tolower_map_table_21[] = {
0x0,
0x0,
0x0,
@@ -2589,7 +2597,8 @@ unichar gs_tolower_map_table_21[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_24[] = {
+
+static unichar gs_tolower_map_table_24[] = {
0x0,
0x0,
0x0,
@@ -2847,7 +2856,8 @@ unichar gs_tolower_map_table_24[] = {
0x0,
0x0,
};
-unichar gs_tolower_map_table_ff[] = {
+
+static unichar gs_tolower_map_table_ff[] = {
0x0,
0x0,
0x0,
@@ -3106,7 +3116,7 @@ unichar gs_tolower_map_table_ff[] = {
0x0,
};
-unichar *gs_tolower_map[] = {
+static unichar *gs_tolower_map[] = {
gs_tolower_map_table_0,
gs_tolower_map_table_1,
gs_tolower_map_table_2,
@@ -3365,7 +3375,7 @@ unichar *gs_tolower_map[] = {
gs_tolower_map_table_ff,
};
-unichar gs_toupper_map_table_0[] = {
+static unichar gs_toupper_map_table_0[] = {
0x0,
0x0,
0x0,
@@ -3624,7 +3634,7 @@ unichar gs_toupper_map_table_0[] = {
0x178, /* ff */
};
-unichar gs_toupper_map_table_1[] = {
+static unichar gs_toupper_map_table_1[] = {
0x0,
0x100, /* 1 */
0x0,
@@ -3883,7 +3893,7 @@ unichar gs_toupper_map_table_1[] = {
0x1fe, /* ff */
};
-unichar gs_toupper_map_table_2[] = {
+static unichar gs_toupper_map_table_2[] = {
0x0,
0x200, /* 1 */
0x0,
@@ -4142,7 +4152,7 @@ unichar gs_toupper_map_table_2[] = {
0x0,
};
-unichar gs_toupper_map_table_3[] = {
+static unichar gs_toupper_map_table_3[] = {
0x0,
0x0,
0x0,
@@ -4401,7 +4411,7 @@ unichar gs_toupper_map_table_3[] = {
0x0,
};
-unichar gs_toupper_map_table_4[] = {
+static unichar gs_toupper_map_table_4[] = {
0x0,
0x0,
0x0,
@@ -4660,7 +4670,7 @@ unichar gs_toupper_map_table_4[] = {
0x0,
};
-unichar gs_toupper_map_table_5[] = {
+static unichar gs_toupper_map_table_5[] = {
0x0,
0x0,
0x0,
@@ -4919,31 +4929,7 @@ unichar gs_toupper_map_table_5[] = {
0x0,
};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-unichar gs_toupper_map_table_1e[] = {
+static unichar gs_toupper_map_table_1e[] = {
0x0,
0x1e00, /* 1 */
0x0,
@@ -5202,7 +5188,7 @@ unichar gs_toupper_map_table_1e[] = {
0x0,
};
-unichar gs_toupper_map_table_1f[] = {
+static unichar gs_toupper_map_table_1f[] = {
0x1f08, /* 0 */
0x1f09, /* 1 */
0x1f0a, /* 2 */
@@ -5461,8 +5447,7 @@ unichar gs_toupper_map_table_1f[] = {
0x0,
};
-
-unichar gs_toupper_map_table_21[] = {
+static unichar gs_toupper_map_table_21[] = {
0x0,
0x0,
0x0,
@@ -5721,9 +5706,7 @@ unichar gs_toupper_map_table_21[] = {
0x0,
};
-
-
-unichar gs_toupper_map_table_24[] = {
+static unichar gs_toupper_map_table_24[] = {
0x0,
0x0,
0x0,
@@ -5982,225 +5965,7 @@ unichar gs_toupper_map_table_24[] = {
0x0,
};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-unichar gs_toupper_map_table_ff[] = {
+static unichar gs_toupper_map_table_ff[] = {
0x0,
0x0,
0x0,
@@ -6459,8 +6224,7 @@ unichar gs_toupper_map_table_ff[] = {
0x0,
};
-
-unichar *gs_toupper_map[] = {
+static unichar *gs_toupper_map[] = {
gs_toupper_map_table_0,
gs_toupper_map_table_1,
gs_toupper_map_table_2,
diff --git a/Headers/Additions/GNUstepBase/unicode/cop.h b/Source/Additions/unicode/cop.h
similarity index 98%
rename from Headers/Additions/GNUstepBase/unicode/cop.h
rename to Source/Additions/unicode/cop.h
index 7d74be7d1..5e80ea872 100644
--- a/Headers/Additions/GNUstepBase/unicode/cop.h
+++ b/Source/Additions/unicode/cop.h
@@ -9,9 +9,9 @@
struct _cop_ {unichar code; unsigned char cop;};
-const unsigned int uni_cop_table_size = 355;
-struct _cop_ uni_cop_table[]=
+static const unsigned int uni_cop_table_size = 355;
+static struct _cop_ uni_cop_table[]=
{
{0x0300,230},
{0x0301,230},
diff --git a/Headers/Additions/GNUstepBase/unicode/cyrillic.h b/Source/Additions/unicode/cyrillic.h
similarity index 94%
rename from Headers/Additions/GNUstepBase/unicode/cyrillic.h
rename to Source/Additions/unicode/cyrillic.h
index 4096eb2d1..7facce19d 100644
--- a/Headers/Additions/GNUstepBase/unicode/cyrillic.h
+++ b/Source/Additions/unicode/cyrillic.h
@@ -8,9 +8,8 @@
*/
-const unsigned int Cyrillic_conv_base = 0x80;
-
-unichar Cyrillic_char_to_uni_table[] =
+static const unsigned int Cyrillic_conv_base = 0x80;
+static unichar Cyrillic_char_to_uni_table[] =
{
0x0080,
0x0081,
@@ -144,9 +143,8 @@ unichar Cyrillic_char_to_uni_table[] =
// Unicode to ISO_8859-5,1988 maping
-const unsigned int Cyrillic_uni_to_char_table_size = 128;
-
-_ucc_ Cyrillic_uni_to_char_table[]=
+static const unsigned int Cyrillic_uni_to_char_table_size = 128;
+static _ucc_ Cyrillic_uni_to_char_table[]=
{
{0x0080,0x80},
{0x0081,0x81},
diff --git a/Headers/Additions/GNUstepBase/unicode/decomp.h b/Source/Additions/unicode/decomp.h
similarity index 99%
rename from Headers/Additions/GNUstepBase/unicode/decomp.h
rename to Source/Additions/unicode/decomp.h
index 1b94a6881..54c8919ad 100644
--- a/Headers/Additions/GNUstepBase/unicode/decomp.h
+++ b/Source/Additions/unicode/decomp.h
@@ -9,9 +9,9 @@
struct _dec_ {unichar code; unichar decomp[5];};
-const unsigned int uni_dec_table_size = 1052;
-struct _dec_ uni_dec_table[]=
+static const unsigned int uni_dec_table_size = 1052;
+static struct _dec_ uni_dec_table[]=
{
{0x00C0, {0x0041, 0x0300, 0}},
{0x00C1, {0x0041, 0x0301, 0}},
diff --git a/Headers/Additions/GNUstepBase/unicode/gsm0338.h b/Source/Additions/unicode/gsm0338.h
similarity index 96%
rename from Headers/Additions/GNUstepBase/unicode/gsm0338.h
rename to Source/Additions/unicode/gsm0338.h
index d9c164772..af7d8e21a 100644
--- a/Headers/Additions/GNUstepBase/unicode/gsm0338.h
+++ b/Source/Additions/unicode/gsm0338.h
@@ -10,9 +10,8 @@
// GSM0338 to Unicode maping
-const unsigned int GSM0338_conv_base = 0x00;
-
-unichar GSM0338_char_to_uni_table[] =
+static const unsigned int GSM0338_conv_base = 0x00;
+static unichar GSM0338_char_to_uni_table[] =
{
0x0040,
0x00A3,
@@ -144,7 +143,7 @@ unichar GSM0338_char_to_uni_table[] =
0x00E0
};
-_ucc_ GSM0338_uni_to_char_table[] =
+static _ucc_ GSM0338_uni_to_char_table[] =
{
{0x000A,0x0A,},
{0x000D,0x0D,},
@@ -277,7 +276,7 @@ _ucc_ GSM0338_uni_to_char_table[] =
};
#define GSM0338_tsize (sizeof(GSM0338_uni_to_char_table)/sizeof(_ucc_))
-_ucc_ GSM0338_escapes[] =
+static _ucc_ GSM0338_escapes[] =
{
{0x000C,0x0A}, /* Form feed */
{0x005B,0x3C}, /* '[' */
@@ -300,7 +299,7 @@ _ucc_ GSM0338_escapes[] =
* a cut down version suitable for use when delivering data to phones
* which don't support escape sequences.
*/
-_ucc_ GSM0338_lossy[] =
+static _ucc_ GSM0338_lossy[] =
{
{0x005B,0x3C}, /* '[' => '<' */
{0x005C,0x2F}, /* '\\' => '/' */
diff --git a/Headers/Additions/GNUstepBase/unicode/latin2.h b/Source/Additions/unicode/latin2.h
similarity index 95%
rename from Headers/Additions/GNUstepBase/unicode/latin2.h
rename to Source/Additions/unicode/latin2.h
index 743d57e04..df7e18f0f 100644
--- a/Headers/Additions/GNUstepBase/unicode/latin2.h
+++ b/Source/Additions/unicode/latin2.h
@@ -10,9 +10,8 @@
// ISO_8859-2 to Unicode maping
-const unsigned int Latin2_conv_base = 0x80;
-
-unichar Latin2_char_to_uni_table[] =
+static const unsigned int Latin2_conv_base = 0x80;
+static unichar Latin2_char_to_uni_table[] =
{
0x0080,
0x0081,
@@ -146,9 +145,8 @@ unichar Latin2_char_to_uni_table[] =
// Unicode to ISO_8859-2 maping
-const unsigned int Latin2_uni_to_char_table_size = 128;
-
-_ucc_ Latin2_uni_to_char_table[]=
+static const unsigned int Latin2_uni_to_char_table_size = 128;
+static _ucc_ Latin2_uni_to_char_table[]=
{
{0x0080,0x80},
{0x0081,0x81},
diff --git a/Headers/Additions/GNUstepBase/unicode/latin9.h b/Source/Additions/unicode/latin9.h
similarity index 95%
rename from Headers/Additions/GNUstepBase/unicode/latin9.h
rename to Source/Additions/unicode/latin9.h
index 8f3b36419..7826cbcbb 100644
--- a/Headers/Additions/GNUstepBase/unicode/latin9.h
+++ b/Source/Additions/unicode/latin9.h
@@ -10,9 +10,8 @@
// ISO_8859-15 to Unicode maping
-const unsigned int Latin9_conv_base = 0x80;
-
-unichar Latin9_char_to_uni_table[] =
+static const unsigned int Latin9_conv_base = 0x80;
+static unichar Latin9_char_to_uni_table[] =
{
0x0080,
0x0081,
@@ -146,9 +145,8 @@ unichar Latin9_char_to_uni_table[] =
// Unicode to ISO_8859-15 maping
-const unsigned int Latin9_uni_to_char_table_size = 128;
-
-_ucc_ Latin9_uni_to_char_table[]=
+static const unsigned int Latin9_uni_to_char_table_size = 128;
+static _ucc_ Latin9_uni_to_char_table[]=
{
{0x0080, 0x80},
{0x0081, 0x81},
diff --git a/Headers/Additions/GNUstepBase/unicode/nextstep.h b/Source/Additions/unicode/nextstep.h
similarity index 94%
rename from Headers/Additions/GNUstepBase/unicode/nextstep.h
rename to Source/Additions/unicode/nextstep.h
index 979ae6201..95c881a9f 100644
--- a/Headers/Additions/GNUstepBase/unicode/nextstep.h
+++ b/Source/Additions/unicode/nextstep.h
@@ -7,8 +7,8 @@
notice and this notice are preserved.
*/
-const unsigned int Next_conv_base = 0x80;
-unichar Next_char_to_uni_table[] =
+static const unsigned int Next_conv_base = 0x80;
+static unichar Next_char_to_uni_table[] =
{
0x00A0,
0x00C0,
@@ -135,9 +135,8 @@ unichar Next_char_to_uni_table[] =
// Unicode to NextStep maping
-const unsigned int Next_uni_to_char_table_size = 128;
-
-_ucc_ Next_uni_to_char_table[]=
+static const unsigned int Next_uni_to_char_table_size = 128;
+static _ucc_ Next_uni_to_char_table[]=
{
{0x00A0,0x80},
{0x00A1,0xA1},
diff --git a/Headers/Additions/GNUstepBase/unicode/thai.h b/Source/Additions/unicode/thai.h
similarity index 93%
rename from Headers/Additions/GNUstepBase/unicode/thai.h
rename to Source/Additions/unicode/thai.h
index 54b6c259a..ddcae5935 100644
--- a/Headers/Additions/GNUstepBase/unicode/thai.h
+++ b/Source/Additions/unicode/thai.h
@@ -8,9 +8,8 @@
*/
-const unsigned int Thai_conv_base = 0xA0;
-
-unichar Thai_char_to_uni_table[] =
+static const unsigned int Thai_conv_base = 0xA0;
+static unichar Thai_char_to_uni_table[] =
{
0x00A0,
0x0E01,
@@ -112,9 +111,8 @@ unichar Thai_char_to_uni_table[] =
/* Unicode to ISO_8859-11 maping */
-const unsigned int Thai_uni_to_char_table_size = 88;
-
-_ucc_ Thai_uni_to_char_table[]=
+static const unsigned int Thai_uni_to_char_table_size = 88;
+static _ucc_ Thai_uni_to_char_table[]=
{
{0x00A0,0xA0},
{0x0E01,0xA1},
diff --git a/Source/DocMakefile b/Source/DocMakefile
index 5dc814719..897e34bb7 100644
--- a/Source/DocMakefile
+++ b/Source/DocMakefile
@@ -75,6 +75,7 @@ NSKeyValueObserving.h \
NSLock.h \
NSMapTable.h \
NSMethodSignature.h \
+NSNetServices.h \
NSNotification.h \
NSNotificationQueue.h \
NSNull.h \
@@ -117,6 +118,7 @@ NSURLRequest.h \
NSURLResponse.h \
NSUserDefaults.h \
NSValue.h \
+NSValueTransformer.h \
NSXMLParser.h \
NSZone.h
@@ -131,8 +133,8 @@ GSLock.h \
GSMime.h \
GSObjCRuntime.h \
GSUnion.h \
+GSVersionMacros.h \
GSXML.h \
-GSFunctions.h \
behavior.h \
Unicode.h \
GCObject.h \
diff --git a/Source/GNUmakefile b/Source/GNUmakefile
index accff0355..7b08148a4 100644
--- a/Source/GNUmakefile
+++ b/Source/GNUmakefile
@@ -23,18 +23,27 @@
# Boston, MA 02111 USA.
#
+ifeq ($(GNUSTEP_MAKEFILES),)
+ GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
+endif
+
+ifeq ($(GNUSTEP_MAKEFILES),)
+ $(error You need to set GNUSTEP_MAKEFILES before compiling!)
+endif
+
# Install into the system root by default
-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
+GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../base.make
+
include $(GNUSTEP_MAKEFILES)/common.make
include ../Version
include ../config.mak
# Interface version changes with each minor release
-libgnustep-base_INTERFACE_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}
-libgnustep-baseadd_INTERFACE_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}
+libgnustep-base_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
+libgnustep-baseadd_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
PACKAGE_NAME = gnustep-base
@@ -62,16 +71,15 @@ ifeq ($(GNUSTEP_TARGET_OS), mingw32)
DEFS= -DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \
-DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
- -DGNUSTEP_FLATTENED=\"$(GNUSTEP_FLATTENED)\" \
+ -DGNUSTEP_IS_FLATTENED=\"$(GNUSTEP_IS_FLATTENED)\" \
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
-
else
DEFS= -DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \
-DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
- -DGNUSTEP_FLATTENED=\"$(GNUSTEP_FLATTENED)\" \
+ -DGNUSTEP_IS_FLATTENED=\"$(GNUSTEP_IS_FLATTENED)\" \
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
endif
@@ -79,7 +87,6 @@ endif
# The GNU source files
GNU_MFILES = \
-GSCompatibility.m \
GSLocale.m \
preface.m \
mframe.m
@@ -108,6 +115,7 @@ win32-def.top \
libgnustep-base.def
ADD_HEADERS = \
+GSVersionMacros.h \
GSObjCRuntime.h \
GSCategories.h \
GSFileHandle.h \
@@ -145,10 +153,11 @@ GSSet.m \
GSStream.m \
GSString.m \
GSValue.m \
-NSAttributedString.m \
+NSAffineTransform.m \
NSArchiver.m \
NSArray.m \
NSAssertionHandler.m \
+NSAttributedString.m \
NSAutoreleasePool.m \
NSBundle.m \
NSCachedURLResponse.m \
@@ -221,6 +230,7 @@ NSSet.m \
NSSocketPort.m \
NSSocketPortNameServer.m \
NSSortDescriptor.m \
+NSSpellServer.m \
NSString.m \
NSTask.m \
NSThread.m \
@@ -242,6 +252,7 @@ NSURLResponse.m \
NSURLHandle.m \
NSUserDefaults.m \
NSValue.m \
+NSValueTransformer.m \
NSXMLParser.m \
NSZone.m \
externs.m \
@@ -253,6 +264,11 @@ BASE_MFILES += \
GSFileHandle.m \
NSMessagePort.m \
NSMessagePortNameServer.m
+
+ifeq ($(GNUSTEP_BASE_HAVE_MDNS), 1)
+BASE_MFILES += NSNetServices.m
+endif
+
endif
ifeq ($(WITH_FFI),libffi)
@@ -278,6 +294,7 @@ tzfile.h
FOUNDATION_HEADERS = \
Foundation.h \
+NSAffineTransform.h \
NSArchiver.h \
NSArray.h \
NSAttributedString.h \
@@ -322,6 +339,7 @@ NSKeyValueObserving.h \
NSLock.h \
NSMapTable.h \
NSMethodSignature.h \
+NSNetServices.h \
NSNotification.h \
NSNotificationQueue.h \
NSNull.h \
@@ -344,6 +362,7 @@ NSScanner.h \
NSSerialization.h \
NSSet.h \
NSSortDescriptor.h \
+NSSpellServer.h \
NSStream.h \
NSString.h \
NSTask.h \
@@ -367,27 +386,19 @@ NSURLResponse.h \
NSUserDefaults.h \
NSUtilities.h \
NSValue.h \
+NSValueTransformer.h \
NSXMLParser.h \
NSZone.h
-UNICODE_HEADERS = \
-unicode/caseconv.h \
-unicode/cop.h \
-unicode/cyrillic.h \
-unicode/latin2.h \
-unicode/decomp.h \
-unicode/nextstep.h
-
HEADERS_INSTALL = $(GNU_HEADERS) \
- $(FOUNDATION_HEADERS) \
- $(UNICODE_HEADERS)
+ $(FOUNDATION_HEADERS)
GENERATED_HFILES = \
dynamic-load.h \
$(HEADER_DIR_BASE)/preface.h \
$(GNUSTEP_TARGET_DIR)/mframe.h \
$(GNUSTEP_TARGET_DIR)/config.h \
-$(GNUSTEP_TARGET_DIR)/GSConfig.h
+$(GNUSTEP_TARGET_DIR)/GNUstepBase/GSConfig.h
ifeq ($(HAVE_INET_PTON), no)
GNU_CFILES += inet_pton.c
@@ -408,7 +419,12 @@ libgnustep-base_HEADER_FILES = $(FOUNDATION_HEADERS)
# Resources
RESOURCE_SET_NAME = libbase-resources
-libbase-resources_RESOURCE_FILES_INSTALL_DIR = Library/Libraries/Resources/gnustep-base
+
+# This is for gnustep-make >= 14-02-2007
+libbase-resources_INSTALL_DIR = $(GNUSTEP_LIBRARY)/Libraries/gnustep-base/Versions/$(libgnustep-base_INTERFACE_VERSION)/Resources
+# This is kept temporarily for gnustep-make < 14-02-2007
+libbase-resources_RESOURCE_FILES_INSTALL_DIR = /Library/Libraries/Resources/gnustep-base
+
libbase-resources_LANGUAGES =
libbase-resources_LOCALIZED_RESOURCE_FILES =
libbase-resources_RESOURCE_DIRS =
diff --git a/Source/GSArray.m b/Source/GSArray.m
index b4a9ec3b4..adb6c534e 100644
--- a/Source/GSArray.m
+++ b/Source/GSArray.m
@@ -36,6 +36,8 @@
// For private method _decodeArrayOfObjectsForKey:
#include "Foundation/NSKeyedArchiver.h"
+#include "GSPrivate.h"
+
static SEL eqSel;
static SEL oaiSel;
@@ -54,39 +56,10 @@ static Class GSInlineArrayClass;
@interface GSArrayEnumeratorReverse : GSArrayEnumerator
@end
-
-@interface GSArray : NSArray
-{
-@public
- id *_contents_array;
- unsigned _count;
-}
-@end
-
-@interface GSInlineArray : GSArray
-{
-}
-@end
-
-@interface GSMutableArray : NSMutableArray
-{
-@public
- id *_contents_array;
- unsigned _count;
- unsigned _capacity;
- int _grow_factor;
-}
-@end
-
@interface GSMutableArray (GSArrayBehavior)
- (void) _raiseRangeExceptionWithIndex: (unsigned)index from: (SEL)sel;
@end
-@interface GSPlaceholderArray : NSArray
-{
-}
-@end
-
@implementation GSArray
- (void) _raiseRangeExceptionWithIndex: (unsigned)index from: (SEL)sel
diff --git a/Source/GSCompatibility.m b/Source/GSCompatibility.m
deleted file mode 100644
index 9728439a4..000000000
--- a/Source/GSCompatibility.m
+++ /dev/null
@@ -1,61 +0,0 @@
-/** Runtime MacOSX compatibility functionality
- Copyright (C) 2000 Free Software Foundation, Inc.
-
- Written by: Richard Frith-Macdonald
- Date: August 2000
-
- This file is part of the GNUstep Base Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
- */
-
-#include "config.h"
-#include "Foundation/Foundation.h"
-#include "Foundation/NSDebug.h"
-
-#include "GSPrivate.h"
-
-@class GSMutableString;
-
-#ifndef HAVE_RINT
-#include
-static double rint(double a)
-{
- return (floor(a+0.5));
-}
-#endif
-
-/*
- * Runtime MacOS-X compatibility flags.
- */
-
-BOOL GSMacOSXCompatibleGeometry(void)
-{
- if (GSUserDefaultsFlag(GSOldStyleGeometry) == YES)
- return NO;
- return GSUserDefaultsFlag(GSMacOSXCompatible);
-}
-
-BOOL GSMacOSXCompatiblePropertyLists(void)
-{
-#if defined(HAVE_LIBXML)
- if (GSUserDefaultsFlag(NSWriteOldStylePropertyLists) == YES)
- return NO;
- return GSUserDefaultsFlag(GSMacOSXCompatible);
-#else
- return NO;
-#endif
-}
-
diff --git a/Source/GSConcreteValue.m b/Source/GSConcreteValue.m
index f02b550fe..1665d1ee6 100644
--- a/Source/GSConcreteValue.m
+++ b/Source/GSConcreteValue.m
@@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "config.h"
diff --git a/Source/GSConcreteValueTemplate.m b/Source/GSConcreteValueTemplate.m
index 4a4596925..60e82fe6f 100644
--- a/Source/GSConcreteValueTemplate.m
+++ b/Source/GSConcreteValueTemplate.m
@@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
diff --git a/Source/GSCountedSet.m b/Source/GSCountedSet.m
index 7fa3a140f..ef96f00c7 100644
--- a/Source/GSCountedSet.m
+++ b/Source/GSCountedSet.m
@@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "config.h"
diff --git a/Source/GSDictionary.m b/Source/GSDictionary.m
index 07789b3ff..1e23a8118 100644
--- a/Source/GSDictionary.m
+++ b/Source/GSDictionary.m
@@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
diff --git a/Source/GSFFCallInvocation.m b/Source/GSFFCallInvocation.m
index bc491be9e..c542004d1 100644
--- a/Source/GSFFCallInvocation.m
+++ b/Source/GSFFCallInvocation.m
@@ -141,7 +141,7 @@ static objc_mutex_t ff_callback_map_lock = NULL;
static vacallReturnTypeInfo returnTypeInfo [STATIC_CALLBACK_LIST_SIZE];
/* Function that implements the actual forwarding */
-void
+static void
GSInvocationCallback(void *callback_data, va_alist args);
/*
@@ -168,7 +168,7 @@ gs_offset(const char *type, int index)
/* Determines if the structure type can be returned entirely in registers.
See the avcall or vacall man pages for more info. FIXME: I'm betting
this won't work if a structure contains another structure */
-int
+static int
gs_splittable (const char *type)
{
int i, numtypes;
@@ -297,7 +297,7 @@ gs_find_by_receiver_best_typed_sel (id receiver, SEL sel)
Only passes the first part. Is used for determining
the return type for the vacall macros.
*/
-void
+static void
gs_sel_type_to_callback_type (const char *sel_type,
vacallReturnTypeInfo *vatype)
{
@@ -771,7 +771,7 @@ gs_protocol_selector(const char *types)
* information.
*/
-void
+static void
GSInvocationCallback (void *callback_data, va_alist args)
{
id obj;
diff --git a/Source/GSFFIInvocation.m b/Source/GSFFIInvocation.m
index 58d183c10..7f55423b0 100644
--- a/Source/GSFFIInvocation.m
+++ b/Source/GSFFIInvocation.m
@@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "Foundation/NSException.h"
#include "Foundation/NSCoder.h"
@@ -44,7 +45,7 @@ typedef void (*ffi_closure_fun) (ffi_cif*,void*,void**,void*);
typedef void (*f_fun) ();
-void GSFFIInvocationCallback(ffi_cif*, void*, void **, void*);
+static void GSFFIInvocationCallback(ffi_cif*, void*, void **, void*);
/*
* If we are using the GNU ObjC runtime we could
@@ -407,7 +408,7 @@ gs_protocol_selector(const char *types)
return NO;
}
-void
+static void
GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
{
id obj;
diff --git a/Source/GSFTPURLHandle.m b/Source/GSFTPURLHandle.m
index 64d5a035e..b029e8ec9 100644
--- a/Source/GSFTPURLHandle.m
+++ b/Source/GSFTPURLHandle.m
@@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "config.h"
@@ -36,6 +37,7 @@
#include "Foundation/NSFileHandle.h"
#include "Foundation/NSDebug.h"
#include "GNUstepBase/GSMime.h"
+#include "GSPrivate.h"
GS_EXPORT NSString * const GSTelnetNotification;
GS_EXPORT NSString * const GSTelnetErrorKey;
@@ -972,14 +974,12 @@ static NSLock *urlLock = nil;
protocol: @"tcp"];
if (sock == nil)
{
- extern int errno;
-
/*
* Tell superclass that the load failed - let it do housekeeping.
*/
[self backgroundLoadDidFailWithReason: [NSString stringWithFormat:
- @"Unable to connect to %@:%@ ... %s",
- host, port, GSLastErrorStr(errno)]];
+ @"Unable to connect to %@:%@ ... %@",
+ host, port, [NSError _last]]];
return;
}
cHandle = [[GSTelnetHandle alloc] initWithHandle: sock isConnected: NO];
diff --git a/Source/GSFileHandle.m b/Source/GSFileHandle.m
index 94523c5a9..ba5c4efb5 100644
--- a/Source/GSFileHandle.m
+++ b/Source/GSFileHandle.m
@@ -42,6 +42,7 @@
#include "Foundation/NSProcessInfo.h"
#include "Foundation/NSUserDefaults.h"
#include "Foundation/NSDebug.h"
+#include "GSPrivate.h"
#include "../Tools/gdomap.h"
@@ -797,7 +798,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1)
{
- NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
return nil;
}
@@ -811,8 +812,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == -1)
{
- NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(lsin.sin_addr),
- GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
+ NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr),
+ GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
@@ -830,9 +831,9 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
if (errno != EINPROGRESS)
{
- NSLog(@"unable to make connection to %s:%d - %s",
+ NSLog(@"unable to make connection to %s:%d - %@",
inet_ntoa(sin.sin_addr),
- GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
+ GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
RELEASE(self);
return nil;
}
@@ -896,7 +897,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1)
{
- NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self);
return nil;
}
@@ -913,8 +914,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == -1)
{
- NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(sin.sin_addr),
- GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
+ NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
+ GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
@@ -922,7 +923,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (listen(net, 256) == -1)
{
- NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
@@ -930,7 +931,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(net, (struct sockaddr*)&sin, &size) == -1)
{
- NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(net);
RELEASE(self);
return nil;
@@ -1095,8 +1096,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fstat(desc, &sbuf) < 0)
{
- NSLog(@"unable to get status of descriptor %d - %s",
- desc, GSLastErrorStr(errno));
+ NSLog(@"unable to get status of descriptor %d - %@",
+ desc, [NSError _last]);
}
else
{
@@ -1317,8 +1318,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (len < 0)
{
[NSException raise: NSFileHandleOperationException
- format: @"unable to read from descriptor - %s",
- GSLastErrorStr(errno)];
+ format: @"unable to read from descriptor - %@",
+ [NSError _last]];
}
return d;
}
@@ -1342,8 +1343,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (len < 0)
{
[NSException raise: NSFileHandleOperationException
- format: @"unable to read from descriptor - %s",
- GSLastErrorStr(errno)];
+ format: @"unable to read from descriptor - %@",
+ [NSError _last]];
}
return d;
}
@@ -1368,8 +1369,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (got < 0)
{
[NSException raise: NSFileHandleOperationException
- format: @"unable to read from descriptor - %s",
- GSLastErrorStr(errno)];
+ format: @"unable to read from descriptor - %@",
+ [NSError _last]];
}
[d setLength: got];
}
@@ -1391,8 +1392,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
else if (got < 0)
{
[NSException raise: NSFileHandleOperationException
- format: @"unable to read from descriptor - %s",
- GSLastErrorStr(errno)];
+ format: @"unable to read from descriptor - %@",
+ [NSError _last]];
}
}
while (len > 0 && got > 0);
@@ -1437,8 +1438,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (rval < 0)
{
[NSException raise: NSFileHandleOperationException
- format: @"unable to write to descriptor - %s",
- GSLastErrorStr(errno)];
+ format: @"unable to write to descriptor - %@",
+ [NSError _last]];
}
}
@@ -1543,8 +1544,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (result < 0)
{
[NSException raise: NSFileHandleOperationException
- format: @"failed to move to offset in file - %s",
- GSLastErrorStr(errno)];
+ format: @"failed to move to offset in file - %@",
+ [NSError _last]];
}
return (unsigned long long)result;
}
@@ -1567,8 +1568,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (result < 0)
{
[NSException raise: NSFileHandleOperationException
- format: @"failed to move to offset in file - %s",
- GSLastErrorStr(errno)];
+ format: @"failed to move to offset in file - %@",
+ [NSError _last]];
}
return (unsigned long long)result;
}
@@ -1591,8 +1592,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (result < 0)
{
[NSException raise: NSFileHandleOperationException
- format: @"failed to move to offset in file - %s",
- GSLastErrorStr(errno)];
+ format: @"failed to move to offset in file - %@",
+ [NSError _last]];
}
}
@@ -1927,8 +1928,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
NSString *s;
- s = [NSString stringWithFormat: @"Accept attempt failed - %s",
- GSLastErrorStr(errno)];
+ s = [NSString stringWithFormat: @"Accept attempt failed - %@",
+ [NSError _last]];
[readInfo setObject: s forKey: GSFileHandleNotificationError];
}
else
@@ -1995,8 +1996,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
NSString *s;
- s = [NSString stringWithFormat: @"Read attempt failed - %s",
- GSLastErrorStr(errno)];
+ s = [NSString stringWithFormat: @"Read attempt failed - %@",
+ [NSError _last]];
[readInfo setObject: s forKey: GSFileHandleNotificationError];
[self postReadNotification];
}
@@ -2023,16 +2024,26 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (operation == GSFileHandleConnectCompletionNotification
|| operation == GSSOCKSConnect)
{ // Connection attempt completed.
+ extern int errno;
int result;
+ int rval;
unsigned len = sizeof(result);
- if (getsockopt(descriptor, SOL_SOCKET, SO_ERROR,
- (char*)&result, &len) == 0 && result != 0)
+ rval = getsockopt(descriptor, SOL_SOCKET, SO_ERROR, (char*)&result, &len);
+ if (rval != 0)
{
NSString *s;
- s = [NSString stringWithFormat: @"Connect attempt failed - %s",
- GSLastErrorStr(result)];
+ s = [NSString stringWithFormat: @"Connect attempt failed - %@",
+ [NSError _last]];
+ [info setObject: s forKey: GSFileHandleNotificationError];
+ }
+ else if (result != 0)
+ {
+ NSString *s;
+
+ s = [NSString stringWithFormat: @"Connect attempt failed - %@",
+ [NSError _systemError: result]];
[info setObject: s forKey: GSFileHandleNotificationError];
}
else
@@ -2065,7 +2076,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s;
s = [NSString stringWithFormat:
- @"Write attempt failed - %s", GSLastErrorStr(errno)];
+ @"Write attempt failed - %@", [NSError _last]];
[info setObject: s forKey: GSFileHandleNotificationError];
[self postWriteNotification];
}
@@ -2141,8 +2152,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
if (fcntl(descriptor, F_SETFL, e) < 0)
{
- NSLog(@"unable to set non-blocking mode for %d - %s",
- descriptor, GSLastErrorStr(errno));
+ NSLog(@"unable to set non-blocking mode for %d - %@",
+ descriptor, [NSError _last]);
}
else
{
@@ -2151,8 +2162,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
else
{
- NSLog(@"unable to get non-blocking mode for %d - %s",
- descriptor, GSLastErrorStr(errno));
+ NSLog(@"unable to get non-blocking mode for %d - %@",
+ descriptor, [NSError _last]);
}
}
}
@@ -2170,11 +2181,11 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == -1)
{
- NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to get socket name - %@", [NSError _last]);
}
else
{
- str = [NSString stringWithCString: (char*)inet_ntoa(sin.sin_addr)];
+ str = [NSString stringWithUTF8String: (char*)inet_ntoa(sin.sin_addr)];
}
return str;
}
@@ -2187,7 +2198,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == -1)
{
- NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
+ NSLog(@"unable to get socket name - %@", [NSError _last]);
}
else
{
diff --git a/Source/GSFormat.h b/Source/GSFormat.h
deleted file mode 100644
index 1c7b54f8e..000000000
--- a/Source/GSFormat.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* GSFormat - printf-style formatting
-
- Copyright (C) 2000 Free Software Foundation, Inc.
-
- Written by: Kai Henningsen
- Created: Jan 2001
-
- This file is part of the GNUstep Base Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
-*/
-
-#ifndef __GSFormat_H_
-#define __GSFormat_H_
-
-#include
-#include "GSPrivate.h"
-
-@class NSDictionary;
-
-void
-GSFormat(GSStr fb, const unichar *fmt, va_list ap, NSDictionary *loc);
-
-#endif
-
diff --git a/Source/GSFormat.m b/Source/GSFormat.m
index fb0ab5693..4a28ff8c8 100644
--- a/Source/GSFormat.m
+++ b/Source/GSFormat.m
@@ -73,7 +73,8 @@
#include "Foundation/NSZone.h"
#include "Foundation/NSDebug.h"
#include "GNUstepBase/GSLocale.h"
-#include "GSFormat.h"
+
+#include "GSPrivate.h"
#include // for strstr()
#include
@@ -218,10 +219,10 @@ enum
/* Digits. */
/* Lower-case digits. */
-const char _itowa_lower_digits[36]
+static const char _itowa_lower_digits[36]
= "0123456789abcdefghijklmnopqrstuvwxyz";
/* Upper-case digits. */
-const char _itowa_upper_digits[36]
+static const char _itowa_upper_digits[36]
= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -758,9 +759,13 @@ parse_one_spec (const unichar *format, size_t posn, struct printf_spec *spec,
return nargs;
}
+static inline void GSStrAppendUnichar(GSStr s, unichar u)
+{
+ GSPrivateStrAppendUnichars(s, &u, 1);
+}
#define outchar(Ch) GSStrAppendUnichar(s, Ch)
-#define outstring(String, Len) GSStrAppendUnichars(s, String, Len)
+#define outstring(String, Len) GSPrivateStrAppendUnichars(s, String, Len)
/* For handling long_double and longlong we use the same flag. If
`long' and `long long' are effectively the same type define it to
@@ -798,7 +803,7 @@ static unichar *group_number (unichar *, unichar *, const char *, NSString *);
/* The function itself. */
void
-GSFormat (GSStr s, const unichar *format, va_list ap,
+GSPrivateFormat (GSStr s, const unichar *format, va_list ap,
NSDictionary *locale)
{
/* The character used as thousands separator. */
@@ -1690,9 +1695,10 @@ NSDictionary *locale)
LABEL (form_strerror):
/* Print description of error ERRNO. */
- string =
- (unichar *) GSLastErrorStr(save_errno);
- is_long = 0; /* This is no wide-char string. */
+ errno = save_errno;
+ string = (unichar *)[[[NSError _last] localizedDescription]
+ cStringUsingEncoding: NSUnicodeStringEncoding];
+ is_long = 1; /* This is a unicode string. */
goto LABEL (print_string);
LABEL (form_character):
/* Character. */
@@ -1735,7 +1741,7 @@ NSDictionary *locale)
{
/* Write "(null)" if there's space. */
if (prec == -1
- || prec >= (int) (sizeof (null) / sizeof (null[0])) - 1)
+ || prec >= (int) (sizeof (null) / sizeof (null[0])) - 1)
{
string = (unichar *) null;
len = (sizeof (null) / sizeof (null[0])) - 1;
@@ -1757,8 +1763,8 @@ NSDictionary *locale)
if (enc == GSUndefinedEncoding)
{
- enc = GetDefEncoding();
- byteEncoding = GSIsByteEncoding(enc);
+ enc = [NSString defaultCStringEncoding];
+ byteEncoding = GSPrivateIsByteEncoding(enc);
}
len = strlen(str); // Number of bytes to convert.
diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m
index d0fd2909f..fce29d1f7 100644
--- a/Source/GSHTTPURLHandle.m
+++ b/Source/GSHTTPURLHandle.m
@@ -617,6 +617,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
GSMimeHeader *info;
NSString *val;
float ver;
+ int code;
connectionState = idle;
[nc removeObserver: self name: nil object: sock];
@@ -635,7 +636,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
*/
info = [document headerNamed: @"http"];
val = [info objectForKey: NSHTTPPropertyStatusCodeKey];
- if ([val intValue] == 401 && self->challenged < 2)
+ code = [val intValue];
+ if (code == 401 && self->challenged < 2)
{
GSMimeHeader *ah;
@@ -734,8 +736,17 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
bodyPos = 0;
DESTROY(wData);
NSResetMapTable(wProperties);
- [self didLoadBytes: [d subdataWithRange: r]
- loadComplete: YES];
+ if (code >= 200 && code < 300)
+ {
+ [self didLoadBytes: [d subdataWithRange: r]
+ loadComplete: YES];
+ }
+ else
+ {
+ [self didLoadBytes: [d subdataWithRange: r]
+ loadComplete: NO];
+ [self cancelLoadInBackground];
+ }
}
else
{
@@ -1378,8 +1389,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
* Tell superclass that the load failed - let it do housekeeping.
*/
[self backgroundLoadDidFailWithReason:
- [NSString stringWithFormat: @"Unable to connect to %@:%@ ... %s",
- host, port, GSLastErrorStr(errno)]];
+ [NSString stringWithFormat: @"Unable to connect to %@:%@ ... %@",
+ host, port, [NSError _last]]];
return;
}
RETAIN(sock);
@@ -1389,7 +1400,11 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
name: GSFileHandleConnectCompletionNotification
object: sock];
connectionState = connecting;
- if (debug) NSLog(@"%@ start connect", NSStringFromSelector(_cmd));
+ if (debug)
+ {
+ NSLog(@"%@ start connect to %@:%@",
+ NSStringFromSelector(_cmd), host, port);
+ }
}
else
{
diff --git a/Source/GSLocale.m b/Source/GSLocale.m
index 013496cf2..7f5d0ca17 100644
--- a/Source/GSLocale.m
+++ b/Source/GSLocale.m
@@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "config.h"
#include "GNUstepBase/GSLocale.h"
@@ -36,6 +37,8 @@
#include "Foundation/NSUserDefaults.h"
#include "Foundation/NSBundle.h"
+#include "GSPrivate.h"
+
/*
* Function called by [NSObject +initialize] to setup locale information
* from environment variables. Must *not* use any ObjC code since it needs
@@ -75,12 +78,14 @@ GSSetLocale(int category, NSString *locale)
locale = nil;
if (clocale != 0)
{
- locale = [NSString stringWithCString: clocale];
+ locale = [NSString stringWithUTF8String: clocale];
}
return locale;
}
-#define GSLanginfo(value) [NSString stringWithCString: nl_langinfo (value)]
+#define GSLanginfo(value) [NSString stringWithCString: nl_langinfo (value) \
+encoding: GSPrivateNativeCStringEncoding()]
+
/* Creates a locale dictionary from information provided by i18n functions.
Many, but not all, of the keys are filled in or inferred from the
@@ -154,33 +159,33 @@ GSDomainFromDefaultLocale(void)
/* Currency Information */
if (lconv->currency_symbol)
{
- [dict setObject: [NSString stringWithCString: lconv->currency_symbol]
+ [dict setObject: [NSString stringWithUTF8String: lconv->currency_symbol]
forKey: NSCurrencySymbol];
}
if (lconv->int_curr_symbol)
{
- [dict setObject: [NSString stringWithCString: lconv->int_curr_symbol]
+ [dict setObject: [NSString stringWithUTF8String: lconv->int_curr_symbol]
forKey: NSInternationalCurrencyString];
}
if (lconv->mon_decimal_point)
{
- [dict setObject: [NSString stringWithCString: lconv->mon_decimal_point]
+ [dict setObject: [NSString stringWithUTF8String: lconv->mon_decimal_point]
forKey: NSInternationalCurrencyString];
}
if (lconv->mon_thousands_sep)
{
- [dict setObject: [NSString stringWithCString: lconv->mon_thousands_sep]
+ [dict setObject: [NSString stringWithUTF8String: lconv->mon_thousands_sep]
forKey: NSInternationalCurrencyString];
}
if (lconv->decimal_point)
{
- [dict setObject: [NSString stringWithCString: lconv->decimal_point]
+ [dict setObject: [NSString stringWithUTF8String: lconv->decimal_point]
forKey: NSDecimalSeparator];
}
if (lconv->thousands_sep)
{
- [dict setObject: [NSString stringWithCString: lconv->thousands_sep]
+ [dict setObject: [NSString stringWithUTF8String: lconv->thousands_sep]
forKey: NSThousandsSeparator];
}
diff --git a/Source/GSPrivate.h b/Source/GSPrivate.h
index 9c28e5381..e01802f86 100644
--- a/Source/GSPrivate.h
+++ b/Source/GSPrivate.h
@@ -21,8 +21,18 @@
MA 02111 USA.
*/
-#ifndef __GSPrivate_h_
-#define __GSPrivate_h_
+#ifndef _GSPrivate_h_
+#define _GSPrivate_h_
+
+#include "Foundation/NSError.h"
+
+@class NSNotification;
+
+#if ( (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) ) && HAVE_VISIBILITY_ATTRIBUTE )
+#define GS_ATTRIB_PRIVATE __attribute__ ((visibility("internal")))
+#else
+#define GS_ATTRIB_PRIVATE
+#endif
/* Absolute Gregorian date for NSDate reference date Jan 01 2001
*
@@ -39,6 +49,39 @@
#include "GNUstepBase/GSObjCRuntime.h"
+#include "Foundation/NSArray.h"
+
+
+@interface GSArray : NSArray
+{
+@public
+ id *_contents_array;
+ unsigned _count;
+}
+@end
+
+@interface GSMutableArray : NSMutableArray
+{
+@public
+ id *_contents_array;
+ unsigned _count;
+ unsigned _capacity;
+ int _grow_factor;
+}
+@end
+
+@interface GSInlineArray : GSArray
+{
+}
+@end
+
+@interface GSPlaceholderArray : NSArray
+{
+}
+@end
+
+#include "Foundation/NSString.h"
+
/**
* Macro to manage memory for chunks of code that need to work with
* arrays of items. Use this to start the block of code using
@@ -100,17 +143,6 @@
because NXConstantString returns a pointer
to it's internal pointer. */
-/*
- * Function to get the name of a string encoding as an NSString.
- */
-GS_EXPORT NSString *GSEncodingName(NSStringEncoding encoding);
-
-/*
- * Function to determine whether data in a particular encoding can
- * generally be represented as 8-bit characters including ascii.
- */
-GS_EXPORT BOOL GSIsByteEncoding(NSStringEncoding encoding);
-
/*
* Type to hold either UTF-16 (unichar) or 8-bit encodings,
* while satisfying alignment constraints.
@@ -172,11 +204,6 @@ typedef struct {
} GSStr_t;
typedef GSStr_t *GSStr;
-/*
- * Functions to append to GSStr
- */
-extern void GSStrAppendUnichar(GSStr s, unichar);
-extern void GSStrAppendUnichars(GSStr s, const unichar *u, unsigned l);
/*
* Enumeration for MacOS-X compatibility user defaults settings.
@@ -192,21 +219,6 @@ typedef enum {
GSUserDefaultMaxFlag // End marker.
} GSUserDefaultFlagType;
-/*
- * Get the dictionary representation.
- */
-NSDictionary *GSUserDefaultsDictionaryRepresentation(void);
-
-/*
- * Get one of several potentially useful flags.
- */
-BOOL GSUserDefaultsFlag(GSUserDefaultFlagType type);
-
-/**
- * Get a flag from an environment variable - return def if not defined.
- */
-BOOL GSEnvironmentFlag(const char *name, BOOL def);
-
/**
@@ -230,13 +242,213 @@ BOOL GSEnvironmentFlag(const char *name, BOOL def);
- (const char*) type;
@end
-/*
- * Functions used by the NSRunLoop and friends for processing
- * queued notifications.
+/* Get error information.
*/
-extern void GSNotifyASAP(void);
-extern void GSNotifyIdle(void);
-extern BOOL GSNotifyMore(void);
+@interface NSError (GSCategories)
++ (NSError*) _last;
++ (NSError*) _systemError: (long)number;
+@end
-#endif /* __GSPrivate_h_ */
+/* Used by NSException uncaught exception handler - must not call any
+ * methods/functions which might cause a recursive exception.
+ */
+const char*
+GSPrivateArgZero() GS_ATTRIB_PRIVATE;
+
+/* get the available string encodings (nul terminated array)
+ */
+NSStringEncoding *
+GSPrivateAvailableEncodings() GS_ATTRIB_PRIVATE;
+
+/* Initialise constant strings
+ */
+void
+GSPrivateBuildStrings(void) GS_ATTRIB_PRIVATE;
+
+/* Used to check for termination of background tasks.
+ */
+BOOL
+GSPrivateCheckTasks(void) GS_ATTRIB_PRIVATE;
+
+/* get the default C-string encoding.
+ */
+NSStringEncoding
+GSPrivateDefaultCStringEncoding() GS_ATTRIB_PRIVATE;
+
+/* Get default locale quickly (usually from cache).
+ * External apps would cache the locale themselves.
+ */
+NSDictionary *
+GSPrivateDefaultLocale() GS_ATTRIB_PRIVATE;
+
+/* Get one of several standard values.
+ */
+BOOL
+GSPrivateDefaultsFlag(GSUserDefaultFlagType type) GS_ATTRIB_PRIVATE;
+
+/* get the name of a string encoding as an NSString.
+ */
+NSString *
+GSPrivateEncodingName(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
+
+/* get a flag from an environment variable - return def if not defined.
+ */
+BOOL
+GSPrivateEnvironmentFlag(const char *name, BOOL def) GS_ATTRIB_PRIVATE;
+
+/* Get the path to the xcurrent executable.
+ */
+NSString *
+GSPrivateExecutablePath(void) GS_ATTRIB_PRIVATE;
+
+/* Format arguments into an internal string.
+ */
+void
+GSPrivateFormat(GSStr fb, const unichar *fmt, va_list ap, NSDictionary *loc)
+ GS_ATTRIB_PRIVATE;
+
+/* determine whether data in a particular encoding can
+ * generally be represented as 8-bit characters including ascii.
+ */
+BOOL
+GSPrivateIsByteEncoding(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
+
+/* determine whether encoding is currently supported.
+ */
+BOOL
+GSPrivateIsEncodingSupported(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
+
+/* Hash function to hash up to limit bytes from data of specified length.
+ * If the flag is NO then a result of 0 is mapped to 0xffffffff.
+ * This is a pretty useful general purpose hash function.
+ */
+static inline unsigned
+GSPrivateHash(const void *data, unsigned length, unsigned limit, BOOL zero)
+ __attribute__((unused));
+static inline unsigned
+GSPrivateHash(const void *data, unsigned length, unsigned limit, BOOL zero)
+{
+ unsigned ret = length;
+ unsigned l = length;
+
+ if (limit < length)
+ {
+ l = limit;
+ }
+ while (l-- > 0)
+ {
+ ret = (ret << 5) + ret + ((const unsigned char*)data)[l];
+ }
+ if (ret == 0 && zero == NO)
+ {
+ ret = 0xffffffff;
+ }
+ return ret;
+}
+
+/* load a module into the runtime
+ */
+long
+GSPrivateLoadModule(NSString *filename, FILE *errorStream,
+ void (*loadCallback)(Class, struct objc_category *),
+ void **header, NSString *debugFilename) GS_ATTRIB_PRIVATE;
+
+/* Get the native C-string encoding as used by locale specific code in the
+ * operating system. This may differ from the default C-string encoding
+ * if the latter has bewen set via an environment variable.
+ */
+NSStringEncoding
+GSPrivateNativeCStringEncoding() GS_ATTRIB_PRIVATE;
+
+/* Function used by the NSRunLoop and friends for processing
+ * queued notifications which should be processed at the first safe moment.
+ */
+void GSPrivateNotifyASAP(void) GS_ATTRIB_PRIVATE;
+
+/* Function used by the NSRunLoop and friends for processing
+ * queued notifications which should be processed when the loop is idle.
+ */
+void GSPrivateNotifyIdle(void) GS_ATTRIB_PRIVATE;
+
+/* Function used by the NSRunLoop and friends for determining whether
+ * there are more queued notifications to be processed.
+ */
+BOOL GSPrivateNotifyMore(void) GS_ATTRIB_PRIVATE;
+
+/* Function to return the hash value for a small integer (used by NSNumber).
+ */
+unsigned
+GSPrivateSmallHash(int n) GS_ATTRIB_PRIVATE;
+
+/* Function to append data to an GSStr
+ */
+void
+GSPrivateStrAppendUnichars(GSStr s, const unichar *u, unsigned l)
+ GS_ATTRIB_PRIVATE;
+
+/* Make the content of this string into unicode if it is not in
+ * the external defaults C string encoding.
+ */
+void
+GSPrivateStrExternalize(GSStr s) GS_ATTRIB_PRIVATE;
+
+/*
+ * GSPrivateSymbolPath() returns the path to the object file from
+ * which a certain class was loaded.
+ *
+ * If the class was loaded from a shared library, this returns the
+ * filesystem path to the shared library; if it was loaded from a
+ * dynamical object (such as a bundle or framework dynamically
+ * loaded), it returns the filesystem path to the object file; if the
+ * class was loaded from the main executable, it returns the
+ * filesystem path to the main executable path.
+ *
+ * This function is implemented by using the available features of
+ * the dynamic linker on the specific platform we are running on.
+ *
+ * On some platforms, the dynamic linker does not provide enough
+ * facilities to support the GSPrivateSymbolPath() function at all;
+ * in this case, GSPrivateSymbolPath() always returns nil.
+ *
+ * On my platform (a Debian GNU Linux), it seems the dynamic linker
+ * always returns the filesystem path that was used to load the
+ * module. So it returns the full filesystem path for shared libraries
+ * and bundles (which is very nice), but unfortunately it returns
+ * argv[0] (which might be something as horrible as './obj/test')
+ * for classes in the main executable.
+ *
+ * If theCategory argument is not NULL, GSPrivateSymbolPath() will return
+ * the filesystem path to the module from which the category theCategory
+ * of the class theClass was loaded.
+ *
+ * Currently, the function will return nil if any of the following
+ * conditions is satisfied:
+ * - the required functionality is not available on the platform we are
+ * running on;
+ * - memory allocation fails;
+ * - the symbol for that class/category could not be found.
+ *
+ * In general, if the function returns nil, it means something serious
+ * went wrong in the system preventing it from getting the symbol path.
+ * If your code is to be portable, you (unfortunately) have to be prepared
+ * to work around it in some way when this happens.
+ *
+ * It seems that this function has no corresponding function in the NeXT
+ * runtime ... as far as I know.
+ */
+NSString *
+GSPrivateSymbolPath (Class theClass, Category *theCategory) GS_ATTRIB_PRIVATE;
+
+/* Combining class for composite unichars
+ */
+unsigned char
+GSPrivateUniCop(unichar u) GS_ATTRIB_PRIVATE;
+
+/* unload a module from the runtime (not implemented)
+ */
+long
+GSPrivateUnloadModule(FILE *errorStream,
+ void (*unloadCallback)(Class, struct objc_category *)) GS_ATTRIB_PRIVATE;
+
+#endif /* _GSPrivate_h_ */
diff --git a/Source/GSSet.m b/Source/GSSet.m
index f4978142c..f9034fcf7 100644
--- a/Source/GSSet.m
+++ b/Source/GSSet.m
@@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "config.h"
diff --git a/Source/GSStream.m b/Source/GSStream.m
index cf84fec00..8c1184f72 100644
--- a/Source/GSStream.m
+++ b/Source/GSStream.m
@@ -28,12 +28,12 @@
#include
#include
#include
-#include
#include
#include
#include
#include "GSStream.h"
+#include "GSPrivate.h"
NSString * const NSStreamDataWrittenToMemoryStreamKey
= @"NSStreamDataWrittenToMemoryStreamKey";
@@ -228,10 +228,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
{
if ([_modes containsObject: mode])
{
- if ([self _isOpened])
- {
- [_runloop removeStream: self mode: mode];
- }
+ [_runloop removeStream: self mode: mode];
[_modes removeObject: mode];
if ([_modes count] == 0)
{
@@ -251,6 +248,10 @@ static RunLoopEventType typeForStream(NSStream *aStream)
mode = [mode copy];
[_modes addObject: mode];
RELEASE(mode);
+ /* We only add open streams to the runloop .. subclasses may add
+ * streams when they are in the process of opening if they need
+ * to do so.
+ */
if ([self _isOpened])
{
[_runloop addStream: self mode: mode];
@@ -364,7 +365,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
theError = [NSError errorWithDomain: NSPOSIXErrorDomain
code: errno
userInfo: nil];
- NSLog(@"%@ error(%d): - %s", self, errno, GSLastErrorStr(errno));
+ NSLog(@"%@ error(%d): - %@", self, errno, [NSError _last]);
ASSIGN(_lastError, theError);
_currentStatus = NSStreamStatusError;
}
@@ -1216,7 +1217,7 @@ static NSString * const GSSOCKSAckConn = @"GSSOCKSAckConn";
a = [NSString stringWithUTF8String:
(const char*)rbuffer];
}
- else if (rbuffer[3] == 4)
+ else
{
unsigned char buf[40];
int i = 4;
diff --git a/Source/GSString.m b/Source/GSString.m
index 7eda9e196..1afb07543 100644
--- a/Source/GSString.m
+++ b/Source/GSString.m
@@ -48,17 +48,19 @@
#include "Foundation/NSObjCRuntime.h"
#include "Foundation/NSKeyedArchiver.h"
#include "GNUstepBase/GSObjCRuntime.h"
-#include "GSFormat.h"
#include
#include "GSPrivate.h"
-extern BOOL GSEncodingSupported(NSStringEncoding enc);
-
/* memcpy(), strlen(), strcmp() are gcc builtin's */
#include "GNUstepBase/Unicode.h"
+static BOOL isByteEncoding(NSStringEncoding enc)
+{
+ return GSPrivateIsByteEncoding(enc);
+}
+
#ifdef NeXT_RUNTIME
/* Used by the Darwin/NeXT ObjC Runtime
until Apple Radar 2870817 is fixed. */
@@ -250,10 +252,18 @@ setup(void)
if (beenHere == NO)
{
- extern NSStringEncoding GetDefEncoding(void);
-
beenHere = YES;
+ /*
+ * Cache the default string encoding, and set the internal encoding
+ * used by 8-bit character strings to match if possible.
+ */
+ externalEncoding = GSPrivateDefaultCStringEncoding();
+ if (isByteEncoding(externalEncoding) == YES)
+ {
+ internalEncoding = externalEncoding;
+ }
+
/*
* Cache pointers to classes to work round misfeature in
* GNU compiler/runtime system where class lookup is very slow.
@@ -291,16 +301,6 @@ setup(void)
caiSel = @selector(characterAtIndex:);
gcrSel = @selector(getCharacters:range:);
ranSel = @selector(rangeOfComposedCharacterSequenceAtIndex:);
-
- /*
- * Cache the default string encoding, and set the internal encoding
- * used by 8-bit character strings to match if possible.
- */
- externalEncoding = GetDefEncoding();
- if (GSIsByteEncoding(externalEncoding) == YES)
- {
- internalEncoding = externalEncoding;
- }
}
}
@@ -451,7 +451,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
void *chars = 0;
BOOL flag = NO;
- if (GSEncodingSupported(encoding) == NO)
+ if (GSPrivateIsEncodingSupported(encoding) == NO)
{
return nil; // Invalid encoding
}
@@ -494,7 +494,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
BOOL isLatin1 = NO;
GSStr me;
- if (GSEncodingSupported(encoding) == NO)
+ if (GSPrivateIsEncodingSupported(encoding) == NO)
{
if (flag == YES && bytes != 0)
{
@@ -536,7 +536,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
encoding = internalEncoding;
}
}
- else if (encoding != internalEncoding && GSIsByteEncoding(encoding) == YES)
+ else if (encoding != internalEncoding && isByteEncoding(encoding) == YES)
{
unsigned i;
@@ -704,7 +704,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
/*
* Now set up 'f' as a GSMutableString object whose initial buffer is
- * allocated on the stack. The GSFormat function can write into it.
+ * allocated on the stack. The GSPrivateFormat function can write into it.
*/
f.isa = GSMutableStringClass;
f._zone = NSDefaultMallocZone();
@@ -713,7 +713,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
f._count = 0;
f._flags.wide = 0;
f._flags.free = 0;
- GSFormat(&f, fmt, argList, locale);
+ GSPrivateFormat(&f, fmt, argList, locale);
if (fmt != fbuf)
{
objc_free(fmt);
@@ -1026,7 +1026,7 @@ canBeConvertedToEncoding_c(GSStr self, NSStringEncoding enc)
&& enc != internalEncoding
&& enc != NSUTF8StringEncoding
&& enc != NSUnicodeStringEncoding
- && ((internalEncoding != NSASCIIStringEncoding) || !GSIsByteEncoding(enc)))
+ && ((internalEncoding != NSASCIIStringEncoding) || !isByteEncoding(enc)))
{
unsigned l = 0;
unichar *r = 0;
@@ -1404,7 +1404,7 @@ dataUsingEncoding_c(GSStr self, NSStringEncoding encoding, BOOL lossy)
if ((encoding == internalEncoding)
|| ((internalEncoding == NSASCIIStringEncoding)
- && (encoding == NSUTF8StringEncoding || GSIsByteEncoding(encoding))))
+ && (encoding == NSUTF8StringEncoding || isByteEncoding(encoding))))
{
unsigned char *buff;
@@ -1624,7 +1624,10 @@ getCString_c(GSStr self, char *buffer, unsigned int maxLength,
o._contents.c = self->_contents.c;
GSStrWiden((GSStr)&o);
getCString_u((GSStr)&o, buffer, maxLength, aRange, leftoverRange);
- NSZoneFree(o._zone, o._contents.u);
+ if (o._flags.free == 1)
+ {
+ NSZoneFree(o._zone, o._contents.u);
+ }
return;
}
@@ -1788,7 +1791,7 @@ getCStringE_c(GSStr self, char *buffer, unsigned int maxLength,
}
if (enc == NSUTF8StringEncoding
- && GSIsByteEncoding(internalEncoding))
+ && isByteEncoding(internalEncoding))
{
unsigned i;
@@ -1823,7 +1826,7 @@ getCStringE_c(GSStr self, char *buffer, unsigned int maxLength,
}
if (enc == NSASCIIStringEncoding
- && GSIsByteEncoding(internalEncoding))
+ && isByteEncoding(internalEncoding))
{
unsigned i;
@@ -3447,8 +3450,9 @@ agree, create a new GSUnicodeInlineString otherwise.
/*
* Make sure we have the format string in a nul terminated array of
- * unichars for passing to GSFormat. Use on-stack memory for performance
- * unless the size of the format string is really big (a rare occurrence).
+ * unichars for passing to GSPrivateFormat. Use on-stack memory for
+ * performance unless the size of the format string is really big
+ * (a rare occurrence).
*/
len = [format length];
if (len >= 1024)
@@ -3470,7 +3474,7 @@ agree, create a new GSUnicodeInlineString otherwise.
_zone = GSObjCZone(self);
#endif
}
- GSFormat((GSStr)self, fmt, ap, nil);
+ GSPrivateFormat((GSStr)self, fmt, ap, nil);
_flags.hash = 0; // Invalidate the hash for this string.
if (fmt != buf)
{
@@ -3778,7 +3782,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
encoding = internalEncoding;
}
}
- else if (encoding != internalEncoding && GSIsByteEncoding(encoding) == YES)
+ else if (encoding != internalEncoding && isByteEncoding(encoding) == YES)
{
unsigned i;
@@ -3968,7 +3972,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
[format getCharacters: fmt];
fmt[len] = '\0';
- GSFormat((GSStr)self, fmt, argList, locale);
+ GSPrivateFormat((GSStr)self, fmt, argList, locale);
if (fmt != fbuf)
{
objc_free(fmt);
@@ -5025,7 +5029,8 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
/**
* Append characters to a string.
*/
-void GSStrAppendUnichars(GSStr s, const unichar *u, unsigned l)
+void
+GSPrivateStrAppendUnichars(GSStr s, const unichar *u, unsigned l)
{
/*
* Make the string wide if necessary.
@@ -5097,45 +5102,9 @@ void GSStrAppendUnichars(GSStr s, const unichar *u, unsigned l)
}
}
-void GSStrAppendUnichar(GSStr s, unichar u)
-{
- /*
- * Make the string wide if necessary.
- */
- if (s->_flags.wide == 0)
- {
- if (u > 255 || (u > 127 && internalEncoding != NSISOLatin1StringEncoding))
- {
- GSStrWiden(s);
- }
- }
- /*
- * Make room for the characters we are appending.
- */
- if (s->_count + 2 >= s->_capacity)
- {
- GSStrMakeSpace(s, 1);
- }
-
- /*
- * Copy the characters into place.
- */
- if (s->_flags.wide == 1)
- {
- s->_contents.u[s->_count++] = u;
- }
- else
- {
- s->_contents.c[s->_count++] = u;
- }
-}
-
-/*
- * Make the content of this string into unicode if it is not in
- * the external defaults C string encoding.
- */
-void GSStrExternalize(GSStr s)
+void
+GSPrivateStrExternalize(GSStr s)
{
if (s->_flags.wide == 0 && internalEncoding != externalEncoding)
{
diff --git a/Source/GSURLPrivate.h b/Source/GSURLPrivate.h
index ff2f22e43..6ab7ea57d 100644
--- a/Source/GSURLPrivate.h
+++ b/Source/GSURLPrivate.h
@@ -33,7 +33,6 @@
#include "Foundation/NSAutoreleasePool.h"
#include "Foundation/NSData.h"
#include "Foundation/NSDictionary.h"
-#include "Foundation/NSError.h"
#include "Foundation/NSException.h"
#include "Foundation/NSHTTPCookie.h"
#include "Foundation/NSHTTPCookieStorage.h"
diff --git a/Source/GSValue.m b/Source/GSValue.m
index 421714ced..225319dba 100644
--- a/Source/GSValue.m
+++ b/Source/GSValue.m
@@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
*/
#include "config.h"
diff --git a/Source/GSeq.h b/Source/GSeq.h
index f925a9820..9e9f6ddc0 100644
--- a/Source/GSeq.h
+++ b/Source/GSeq.h
@@ -167,9 +167,10 @@ static inline void GSeq_normalize(GSeq seq)
notdone = NO;
for (i = 1; i < count; i++)
{
- if (uni_cop(*second))
+ if (GSPrivateUniCop(*second))
{
- if (uni_cop(*first) > uni_cop(*second))
+ if (GSPrivateUniCop(*first)
+ > GSPrivateUniCop(*second))
{
unichar tmp = *first;
@@ -177,7 +178,8 @@ static inline void GSeq_normalize(GSeq seq)
*second = tmp;
notdone = YES;
}
- else if (uni_cop(*first) == uni_cop(*second))
+ else if (GSPrivateUniCop(*first)
+ == GSPrivateUniCop(*second))
{
if (*first > *second)
{
diff --git a/Source/Makefile.postamble b/Source/Makefile.postamble
index f15373c53..647431c0b 100644
--- a/Source/Makefile.postamble
+++ b/Source/Makefile.postamble
@@ -54,12 +54,9 @@ after-install::
$(INSTALL_DATA) ../Headers/Additions/GNUstepBase/$$file \
$(GNUSTEP_HEADERS)/GNUstepBase/$$file ; \
done
- for file in $(UNICODE_HEADERS); do \
- $(INSTALL_DATA) ../Headers/Additions/GNUstepBase/$$file \
- $(GNUSTEP_HEADERS)/GNUstepBase/$$file ; \
- done
- $(INSTALL_DATA) $(GNUSTEP_TARGET_DIR)/GSConfig.h \
- $(GNUSTEP_HEADERS)/$(GNUSTEP_TARGET_DIR)
+ $(MKDIRS) $(GNUSTEP_HEADERS)/$(GNUSTEP_TARGET_DIR)/GNUstepBase
+ $(INSTALL_DATA) $(GNUSTEP_TARGET_DIR)/GNUstepBase/GSConfig.h \
+ $(GNUSTEP_HEADERS)/$(GNUSTEP_TARGET_DIR)/GNUstepBase/GSConfig.h
if [ "$(INSTALL_ROOT_DIR)" = "" ]; then \
services=/etc/services; \
if [ "`$(WHOAMI)`" != root ]; then \
@@ -84,10 +81,7 @@ before-uninstall::
for file in $(GNU_HEADERS); do \
rm -f $(GNUSTEP_HEADERS)/GNUstepBase/$$file ; \
done
- for file in $(UNICODE_HEADERS); do \
- rm -f $(GNUSTEP_HEADERS)/GNUstepBase/$$file ; \
- done
- rm -f $(GNUSTEP_HEADERS)/$(GNUSTEP_TARGET_DIR)/GSConfig.h
+ rm -f $(GNUSTEP_HEADERS)/$(GNUSTEP_TARGET_DIR)/GNUstepBase/GSConfig.h
# Things to do before cleaning
# before-clean::
@@ -103,9 +97,9 @@ after-clean::
after-distclean::
rm -f mframe/mframe.h Foundation \
NSNumber[0-9]*.m GSValue[0-9]*.m
- rm -rf $(GNUSTEP_TARGET_DIR)/config.h
+ rm -rf $(GNUSTEP_TARGET_DIR)/GNUstepBase
+ rm -rf $(GNUSTEP_TARGET_DIR)/mframe.h
rm -rf $(GNUSTEP_TARGET_DIR)/mframe.h
- rm -rf $(GNUSTEP_TARGET_DIR)/GSConfig.h
rm -rf $(GNUSTEP_TARGET_CPU)
# Things to do before checking
@@ -130,10 +124,10 @@ $(GNUSTEP_TARGET_DIR)/config.h: ../config.status
-mv $(HEADER_DIR_BASE)/config.h $(GNUSTEP_TARGET_DIR)
-touch $(GNUSTEP_TARGET_DIR)/config.h
-$(GNUSTEP_TARGET_DIR)/GSConfig.h: ../config.status
- $(MKDIRS) $(GNUSTEP_TARGET_DIR)
- -mv $(HEADER_DIR_BASE)/GSConfig.h $(GNUSTEP_TARGET_DIR)
- -touch $(GNUSTEP_TARGET_DIR)/GSConfig.h
+$(GNUSTEP_TARGET_DIR)/GNUstepBase/GSConfig.h: ../config.status
+ $(MKDIRS) $(GNUSTEP_TARGET_DIR)/GNUstepBase
+ -mv $(HEADER_DIR_BASE)/GSConfig.h $(GNUSTEP_TARGET_DIR)/GNUstepBase
+ -touch $(GNUSTEP_TARGET_DIR)/GNUstepBase/GSConfig.h
$(GNUSTEP_TARGET_DIR)/mframe.h: mframe/config.status
$(MKDIRS) $(GNUSTEP_TARGET_DIR)
diff --git a/Source/Makefile.preamble b/Source/Makefile.preamble
index 2733671ca..cf4ce45e5 100644
--- a/Source/Makefile.preamble
+++ b/Source/Makefile.preamble
@@ -62,8 +62,10 @@ ADDITIONAL_OBJCFLAGS =
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
-ADDITIONAL_INCLUDE_DIRS = -I../Headers/Additions -I../Headers \
- -I./$(GNUSTEP_TARGET_DIR)
+ADDITIONAL_INCLUDE_DIRS = \
+ -I../Headers/Additions \
+ -I../Headers \
+ -I./$(GNUSTEP_TARGET_DIR)
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS =
diff --git a/Source/NSAffineTransform.m b/Source/NSAffineTransform.m
new file mode 100644
index 000000000..0f3a0c281
--- /dev/null
+++ b/Source/NSAffineTransform.m
@@ -0,0 +1,600 @@
+/** NSAffineTransform.m
+
+
+ This class provides a way to perform affine transforms. It provides
+ a matrix for transforming from one coordinate system to another.
+
+ Copyright (C) 1996,1999 Free Software Foundation, Inc.
+
+ Author: Ovidiu Predescu
+ Date: August 1997
+ Author: Richard Frith-Macdonald
+ Date: March 1999
+
+ This file is part of the GNUstep Base Library.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02111 USA.
+*/
+
+#include "config.h"
+#include
+
+#import "Foundation/NSArray.h"
+#import "Foundation/NSException.h"
+#import "Foundation/NSString.h"
+#import "Foundation/NSAffineTransform.h"
+#import "Foundation/NSCoder.h"
+#import "Foundation/NSDebug.h"
+
+/* Private definitions */
+#define A _matrix.m11
+#define B _matrix.m12
+#define C _matrix.m21
+#define D _matrix.m22
+#define TX _matrix.tX
+#define TY _matrix.tY
+
+/* A Postscript matrix looks like this:
+
+ / a b 0 \
+ | c d 0 |
+ \ tx ty 1 /
+
+ */
+
+static const float pi = 3.1415926535897932384626434;
+
+#if 0
+#define valid(o) NSAssert((o->_isIdentity && o->A==1.0 && o->B==0.0 && o->C==0.0 && o->D==1.0) || (o->_isFlipY && o->A==1.0 && o->B==0.0 && o->C==0.0 && o->D==-1.0) || !(o->_isIdentity||o->_isFlipY), NSInternalInconsistencyException)
+#define check() valid(self)
+#else
+#define valid(o)
+#define check()
+#endif
+
+/* Quick function to multiply two coordinate matrices. C = AB */
+static inline NSAffineTransformStruct
+matrix_multiply (NSAffineTransformStruct MA, NSAffineTransformStruct MB)
+{
+ NSAffineTransformStruct MC;
+ MC.m11 = MA.m11 * MB.m11 + MA.m12 * MB.m21;
+ MC.m12 = MA.m11 * MB.m12 + MA.m12 * MB.m22;
+ MC.m21 = MA.m21 * MB.m11 + MA.m22 * MB.m21;
+ MC.m22 = MA.m21 * MB.m12 + MA.m22 * MB.m22;
+ MC.tX = MA.tX * MB.m11 + MA.tY * MB.m21 + MB.tX;
+ MC.tY = MA.tX * MB.m12 + MA.tY * MB.m22 + MB.tY;
+ return MC;
+}
+
+/*
+ MC.m11 = MA->A * MB->A + MA->B * MB->C;
+ MC.m12 = MA->A * MB->B + MA->B * MB->D;
+ MC.m21 = MA->C * MB->A + MA->D * MB->C;
+ MC.m22 = MA->C * MB->B + MA->D * MB->D;
+ MC.tX = MA->TX * MB->A + MA->TY * MB->C + MB->TX;
+ MC.tY = MA->TX * MB->B + MA->TY * MB->D + MB->TY;
+ */
+
+@implementation NSAffineTransform
+
+static NSAffineTransformStruct identityTransform = {
+ 1.0, 0.0, 0.0, 1.0, 0.0, 0.0
+};
+
+/**
+ * Return an autoreleased instance of this class.
+ */
++ (NSAffineTransform*) transform
+{
+ NSAffineTransform *t;
+
+ t = (NSAffineTransform*)NSAllocateObject(self, 0, NSDefaultMallocZone());
+ t->_matrix = identityTransform;
+ t->_isIdentity = YES;
+ return AUTORELEASE(t);
+}
+
+/**
+ * Return an autoreleased instance of this class.
+ */
++ (id) new
+{
+ NSAffineTransform *t;
+
+ t = (NSAffineTransform*)NSAllocateObject(self, 0, NSDefaultMallocZone());
+ t->_matrix = identityTransform;
+ t->_isIdentity = YES;
+ return t;
+}
+
+/**
+ * Appends the transform matrix to the receiver. This is done by performing a
+ * matrix multiplication of the receiver with aTransform so that aTransform
+ * is the first transform applied to the user coordinate. The new
+ * matrix then replaces the receiver's matrix.
+ */
+- (void) appendTransform: (NSAffineTransform*)aTransform
+{
+ valid(aTransform);
+
+ if (aTransform->_isIdentity)
+ {
+ TX += aTransform->TX;
+ TY += aTransform->TY;
+ check();
+ return;
+ }
+
+ if (aTransform->_isFlipY)
+ {
+ B = -B;
+ D = -D;
+ TX = aTransform->TX + TX;
+ TY = aTransform->TY - TY;
+ if (_isIdentity)
+ {
+ _isFlipY = YES;
+ _isIdentity = NO;
+ }
+ else if (_isFlipY)
+ {
+ _isFlipY = NO;
+ _isIdentity = YES;
+ }
+ check();
+ return;
+ }
+
+ if (_isIdentity)
+ {
+ A = aTransform->A;
+ B = aTransform->B;
+ C = aTransform->C;
+ D = aTransform->D;
+ TX = TX * aTransform->A + TY * aTransform->C + aTransform->TX;
+ TY = TX * aTransform->B + TY * aTransform->D + aTransform->TY;
+ _isIdentity = NO; // because aTransform is not an identity transform.
+ _isFlipY = aTransform->_isFlipY;
+ check();
+ return;
+ }
+
+ if (_isFlipY)
+ {
+ A = aTransform->A;
+ B = aTransform->B;
+ C = -aTransform->C;
+ D = -aTransform->D;
+ TX = TX * aTransform->A + TY * aTransform->C + aTransform->TX;
+ TY = TX * aTransform->B + TY * aTransform->D + aTransform->TY;
+ _isIdentity = NO;
+ _isFlipY = NO;
+ check();
+ return;
+ }
+
+ _matrix = matrix_multiply(_matrix, aTransform->_matrix);
+ _isIdentity = NO;
+ _isFlipY = NO;
+ check();
+}
+
+- (NSString*) description
+{
+ return [NSString stringWithFormat:
+ @"NSAffineTransform ((%f, %f) (%f, %f) (%f, %f))", A, B, C, D, TX, TY];
+}
+
+/**
+ * Initialize the transformation matrix instance to the identity matrix.
+ * The identity matrix transforms a point to itself.
+ */
+- (id) init
+{
+ _matrix = identityTransform;
+ _isIdentity = YES;
+ return self;
+}
+
+/**
+ * Initialize the receiever's instance with the instance represented
+ * by aTransform.
+ */
+- (id) initWithTransform: (NSAffineTransform*)aTransform
+{
+ _matrix = aTransform->_matrix;
+ _isIdentity = aTransform->_isIdentity;
+ _isFlipY = aTransform->_isFlipY;
+ return self;
+}
+
+/**
+ * Calculates the inverse of the receiver's matrix and replaces the
+ * receiever's matrix with it.
+ */
+- (void) invert
+{
+ float newA, newB, newC, newD, newTX, newTY;
+ float det;
+
+ if (_isIdentity)
+ {
+ TX = -TX;
+ TY = -TY;
+ return;
+ }
+
+ if (_isFlipY)
+ {
+ TX = -TX;
+ return;
+ }
+
+ det = A * D - B * C;
+ if (det == 0)
+ {
+ NSLog (@"error: determinant of matrix is 0!");
+ return;
+ }
+
+ newA = D / det;
+ newB = -B / det;
+ newC = -C / det;
+ newD = A / det;
+ newTX = (-D * TX + C * TY) / det;
+ newTY = (B * TX - A * TY) / det;
+
+ NSDebugLLog(@"NSAffineTransform",
+ @"inverse of matrix ((%f, %f) (%f, %f) (%f, %f))\n"
+ @"is ((%f, %f) (%f, %f) (%f, %f))",
+ A, B, C, D, TX, TY,
+ newA, newB, newC, newD, newTX, newTY);
+
+ A = newA; B = newB;
+ C = newC; D = newD;
+ TX = newTX; TY = newTY;
+}
+
+/**
+ * Prepends the transform matrix to the receiver. This is done by performing a
+ * matrix multiplication of the receiver with aTransform so that aTransform
+ * is the last transform applied to the user coordinate. The new
+ * matrix then replaces the receiver's matrix.
+ */
+- (void) prependTransform: (NSAffineTransform*)aTransform
+{
+ valid(aTransform);
+
+ if (aTransform->_isIdentity)
+ {
+ TX = aTransform->TX * A + aTransform->TY * C + TX;
+ TY = aTransform->TX * B + aTransform->TY * D + TY;
+ check();
+ return;
+ }
+
+ if (aTransform->_isFlipY)
+ {
+ TX = aTransform->TX * A + aTransform->TY * C + TX;
+ TY = aTransform->TX * B + aTransform->TY * D + TY;
+ C = -C;
+ D = -D;
+ if (_isIdentity)
+ {
+ _isFlipY = YES;
+ _isIdentity = NO;
+ }
+ else if (_isFlipY)
+ {
+ _isFlipY = NO;
+ _isIdentity = YES;
+ }
+ check();
+ return;
+ }
+
+ if (_isIdentity)
+ {
+ A = aTransform->A;
+ B = aTransform->B;
+ C = aTransform->C;
+ D = aTransform->D;
+ TX += aTransform->TX;
+ TY += aTransform->TY;
+ _isIdentity = NO;
+ _isFlipY = aTransform->_isFlipY;
+ check();
+ return;
+ }
+
+ if (_isFlipY)
+ {
+ A = aTransform->A;
+ B = -aTransform->B;
+ C = aTransform->C;
+ D = -aTransform->D;
+ TX += aTransform->TX;
+ TY -= aTransform->TY;
+ _isIdentity = NO;
+ _isFlipY = NO;
+ check();
+ return;
+ }
+
+ _matrix = matrix_multiply(aTransform->_matrix, _matrix);
+ _isIdentity = NO;
+ _isFlipY = NO;
+ check();
+}
+
+/**
+ * Applies the rotation specified by angle in degrees. Points transformed
+ * with the transformation matrix of the receiver are rotated counter-clockwise
+ * by the number of degrees specified by angle.
+ */
+- (void) rotateByDegrees: (float)angle
+{
+ [self rotateByRadians: pi * angle / 180];
+}
+
+/**
+ * Applies the rotation specified by angle in radians. Points transformed
+ * with the transformation matrix of the receiver are rotated counter-clockwise
+ * by the number of radians specified by angle.
+ */
+- (void) rotateByRadians: (float)angleRad
+{
+ if (angleRad != 0.0)
+ {
+ float sine;
+ float cosine;
+ NSAffineTransformStruct rotm;
+
+ sine = sin (angleRad);
+ cosine = cos (angleRad);
+ rotm.m11 = cosine;
+ rotm.m12 = sine;
+ rotm.m21 = -sine;
+ rotm.m22 = cosine;
+ rotm.tX = rotm.tY = 0;
+ _matrix = matrix_multiply(rotm, _matrix);
+ _isIdentity = NO;
+ _isFlipY = NO;
+ check();
+ }
+}
+
+/**
+ * Scales the transformation matrix of the reciever by the factor specified
+ * by scale.
+ */
+- (void) scaleBy: (float)scale
+{
+ NSAffineTransformStruct scam = identityTransform;
+
+ scam.m11 = scale;
+ scam.m22 = scale;
+ _matrix = matrix_multiply(scam, _matrix);
+ _isIdentity = NO;
+ _isFlipY = NO;
+ check();
+}
+
+/**
+ * Scales the X axis of the receiver's transformation matrix
+ * by scaleX and the Y axis of the transformation matrix by scaleY.
+ */
+- (void) scaleXBy: (float)scaleX yBy: (float)scaleY
+{
+ if (_isIdentity && scaleX == 1.0)
+ {
+ if (scaleY == 1.0)
+ {
+ return; // no scaling
+ }
+ if (scaleY == -1.0)
+ {
+ D = -1.0;
+ _isFlipY = YES;
+ _isIdentity = NO;
+ return;
+ }
+ }
+
+ if (_isFlipY && scaleX == 1.0)
+ {
+ if (scaleY == 1.0)
+ {
+ return; // no scaling
+ }
+ if (scaleY == -1.0)
+ {
+ D = 1.0;
+ _isFlipY = NO;
+ _isIdentity = YES;
+ return;
+ }
+ }
+
+ A *= scaleX;
+ B *= scaleX;
+ C *= scaleY;
+ D *= scaleY;
+ _isIdentity = NO;
+ _isFlipY = NO;
+}
+
+/**
+ *
+ * Sets the structure which represents the matrix of the reciever.
+ * The struct is of the form:
+ * {m11, m12, m21, m22, tX, tY}
+ */
+- (void) setTransformStruct: (NSAffineTransformStruct)val
+{
+ _matrix = val;
+ _isIdentity = NO;
+ _isFlipY = NO;
+ if (A == 1.0 && B == 0.0 && C == 0.0)
+ {
+ if (D == 1.0)
+ {
+ _isIdentity = YES;
+ }
+ else if (D == -1.0)
+ {
+ _isFlipY = YES;
+ }
+ }
+ check();
+}
+
+/**
+ * Transforms a single point based on the transformation matrix.
+ * Returns the resulting point.
+ */
+- (NSPoint) transformPoint: (NSPoint)aPoint
+{
+ NSPoint new;
+
+ if (_isIdentity)
+ {
+ new.x = TX + aPoint.x;
+ new.y = TY + aPoint.y;
+ }
+ else if (_isFlipY)
+ {
+ new.x = TX + aPoint.x;
+ new.y = TY - aPoint.y;
+ }
+ else
+ {
+ new.x = A * aPoint.x + C * aPoint.y + TX;
+ new.y = B * aPoint.x + D * aPoint.y + TY;
+ }
+
+ return new;
+}
+
+/**
+ * Transforms the NSSize represented by aSize using the reciever's
+ * transformation matrix. Returns the resulting NSSize.
+ * NB. A transform can result in negative size components ... so calling
+ * code should check for and deal with that situation.
+ */
+- (NSSize) transformSize: (NSSize)aSize
+{
+ if (_isIdentity)
+ {
+ return aSize;
+ }
+ else
+ {
+ NSSize new;
+
+ if (_isFlipY)
+ {
+ new.width = aSize.width;
+ new.height = -aSize.height;
+ }
+ else
+ {
+ new.width = A * aSize.width + C * aSize.height;
+ new.height = B * aSize.width + D * aSize.height;
+ }
+ return new;
+ }
+}
+
+/**
+ *
+ * Returns the