mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
documented functions, types, constants, and variables
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19797 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b8a296b3df
commit
0d31eca394
39 changed files with 1010 additions and 116 deletions
|
@ -210,6 +210,12 @@
|
|||
|
||||
|
||||
/* Exceptions */
|
||||
|
||||
/**
|
||||
* Specified in OpenStep to be raised by [NSArchiver] or subclasses if there
|
||||
* are problems initializing or encoding. <em>Not currently used.
|
||||
* NSInternalInconsistencyException usually raised instead.</em>
|
||||
*/
|
||||
GS_EXPORT NSString * const NSInconsistentArchiveException;
|
||||
|
||||
#endif /* __NSArchiver_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
|
|
@ -30,8 +30,18 @@
|
|||
@class NSThread;
|
||||
|
||||
|
||||
/* Each thread has its own copy of these variables.
|
||||
A pointer to this structure is an ivar of NSThread. */
|
||||
/**
|
||||
* Each thread has its own copy of these variables.
|
||||
<example>
|
||||
{
|
||||
NSAutoreleasePool *current_pool; // current pool for thread
|
||||
unsigned total_objects_count; // total #/autoreleased objects over thread's lifetime
|
||||
id *pool_cache; // cache of previously-allocated pools,
|
||||
int pool_cache_size; // used internally for recycling
|
||||
int pool_cache_count;
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef struct autorelease_thread_vars
|
||||
{
|
||||
/* The current, default NSAutoreleasePool for the calling thread;
|
||||
|
@ -58,8 +68,18 @@ typedef struct autorelease_thread_vars
|
|||
|
||||
|
||||
|
||||
/* Each pool holds its objects-to-be-released in a linked-list of
|
||||
these structures. */
|
||||
/**
|
||||
* Each pool holds its objects-to-be-released in a linked-list of
|
||||
these structures.
|
||||
<example>
|
||||
{
|
||||
struct autorelease_array_list *next;
|
||||
unsigned size;
|
||||
unsigned count;
|
||||
id objects[0];
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef struct autorelease_array_list
|
||||
{
|
||||
struct autorelease_array_list *next;
|
||||
|
|
|
@ -35,8 +35,30 @@
|
|||
@class NSDictionary;
|
||||
@class NSMutableDictionary;
|
||||
|
||||
/**
|
||||
* Notification posted when a bundle is loaded. The notification object is
|
||||
* the [NSBundle] itself. The notification also contains a <em>userInfo</em>
|
||||
* dictionary, containing the single key '<code>NSLoadedClasses</code>',
|
||||
* mapped to an [NSArray] containing the names of each class and category
|
||||
* loaded (as strings).
|
||||
*/
|
||||
GS_EXPORT NSString* NSBundleDidLoadNotification;
|
||||
|
||||
/**
|
||||
* A user default affecting the behavior of
|
||||
* [NSBundle-localizedStringForKey:value:table:]. If set, the value of the
|
||||
* key will be returned as an uppercase string rather than any localized
|
||||
* equivalent found. This can be useful during development to check where
|
||||
* a given string in the UI is "coming from".
|
||||
*/
|
||||
GS_EXPORT NSString* NSShowNonLocalizedStrings;
|
||||
|
||||
/**
|
||||
* When an [NSBundle] loads classes and posts a
|
||||
* <code>NSBundleDidLoadNotification</code>, its <em>userInfo</em> dictionary
|
||||
* contains this key, mapped to an [NSArray] containing the names of each
|
||||
* class and category loaded (as strings).
|
||||
*/
|
||||
GS_EXPORT NSString* NSLoadedClasses;
|
||||
|
||||
/**
|
||||
|
@ -203,7 +225,7 @@ GS_EXPORT NSString* NSLoadedClasses;
|
|||
root path/bundlePath/"language.lproj"
|
||||
</example>
|
||||
<p>
|
||||
where lanuage.lproj can be any localized language directory inside
|
||||
where language.lproj can be any localized language directory inside
|
||||
the bundle.
|
||||
</p>
|
||||
<p>
|
||||
|
@ -224,8 +246,12 @@ GS_EXPORT NSString* NSLoadedClasses;
|
|||
ofType: (NSString*)ext;
|
||||
|
||||
/**
|
||||
Returns the value for the key found in the strings file tableName,
|
||||
or Localizable.strings if tableName is nil.
|
||||
Returns the value for the key found in the strings file tableName, or
|
||||
Localizable.strings if tableName is nil. Behavior depends on whether the
|
||||
user default <code>NSShowNonLocalizedStrings</code> is set. If set, the
|
||||
value of the key will be returned as an uppercase string rather than any
|
||||
localized equivalent found. This can be useful during development to
|
||||
check where a given string in the UI is "coming from".
|
||||
*/
|
||||
- (NSString*) localizedStringForKey: (NSString*)key
|
||||
value: (NSString*)value
|
||||
|
@ -340,9 +366,10 @@ GS_EXPORT NSString* NSLoadedClasses;
|
|||
|
||||
@end
|
||||
|
||||
/** Warning - the following should never be used. */
|
||||
/** Warning - do not use this. */
|
||||
#define GSLocalizedString(key, comment) \
|
||||
[[NSBundle gnustepBundle] localizedStringForKey:(key) value:@"" table:nil]
|
||||
/** Warning - do not use this. */
|
||||
#define GSLocalizedStringFromTable(key, tbl, comment) \
|
||||
[[NSBundle gnustepBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
|
||||
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
@class NSDictionary;
|
||||
@class NSString;
|
||||
|
||||
/**
|
||||
* Posted by [NSClassDescription+classDescriptionForClass:] when a class
|
||||
* description cannot be found for a class. The implementation will check
|
||||
* again after the notification is (synchronously) processed, allowing
|
||||
* descriptions to be registered lazily.
|
||||
*/
|
||||
GS_EXPORT NSString* const NSClassDescriptionNeededForClassNotification;
|
||||
|
||||
@interface NSClassDescription : NSObject
|
||||
|
|
|
@ -42,12 +42,41 @@
|
|||
* Keys for the NSDictionary returned by [NSConnection -statistics]
|
||||
*/
|
||||
/* These in OPENSTEP 4.2 */
|
||||
/**
|
||||
* Key for dictionary returned by [NSConnection-statistics]: number of
|
||||
* messages replied to so far by the remote connection.
|
||||
*/
|
||||
GS_EXPORT NSString *NSConnectionRepliesReceived;
|
||||
|
||||
/**
|
||||
* Key for dictionary returned by [NSConnection-statistics]: number of
|
||||
* messages sent so far to the remote connection.
|
||||
*/
|
||||
GS_EXPORT NSString *NSConnectionRepliesSent;
|
||||
|
||||
/**
|
||||
* Key for dictionary returned by [NSConnection-statistics]: number of
|
||||
* messages received so far from the remote connection.
|
||||
*/
|
||||
GS_EXPORT NSString *NSConnectionRequestsReceived;
|
||||
|
||||
/**
|
||||
* Key for dictionary returned by [NSConnection-statistics]: number of
|
||||
* messages sent so far to the remote connection.
|
||||
*/
|
||||
GS_EXPORT NSString *NSConnectionRequestsSent;
|
||||
/* These Are GNUstep extras */
|
||||
|
||||
/**
|
||||
* GNUstep-specific key for dictionary returned by [NSConnection-statistics]:
|
||||
* number of local objects currently in use remotely.
|
||||
*/
|
||||
GS_EXPORT NSString *NSConnectionLocalCount; /* Objects sent out */
|
||||
|
||||
/**
|
||||
* GNUstep-specific key for dictionary returned by [NSConnection-statistics]:
|
||||
* number of remote objects currently in use.
|
||||
*/
|
||||
GS_EXPORT NSString *NSConnectionProxyCount; /* Objects received */
|
||||
|
||||
|
||||
|
@ -185,6 +214,8 @@ GS_EXPORT NSString *NSConnectionProxyCount; /* Objects received */
|
|||
|
||||
@end
|
||||
|
||||
/* PENDING: This is not referenced elsewhere in Base. Is it still needed? */
|
||||
/** Present for backwards compatibility. Do not use. */
|
||||
GS_EXPORT NSString *ConnectionBecameInvalidNotification;
|
||||
|
||||
@interface Object (NSConnectionDelegate)
|
||||
|
@ -265,9 +296,30 @@ GS_EXPORT NSString *ConnectionBecameInvalidNotification;
|
|||
/*
|
||||
* NSRunLoop mode, NSNotification name and NSException strings.
|
||||
*/
|
||||
|
||||
/**
|
||||
* [NSRunLoop] mode for [NSConnection] objects waiting for replies.
|
||||
* Mainly used internally by distributed objects system.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSConnectionReplyMode;
|
||||
|
||||
/**
|
||||
* Posted when an [NSConnection] is deallocated or it is notified its port is
|
||||
* deactivated. (Note, connections to remote ports don't get such a
|
||||
* notification.) Receivers should deregister themselves for notifications
|
||||
* from the given connection.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSConnectionDidDieNotification;
|
||||
|
||||
/**
|
||||
* Posted when an [NSConnection] is initialized.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSConnectionDidInitializeNotification; /* OPENSTEP */
|
||||
|
||||
/**
|
||||
* Raised by an [NSConnection] on receiving a message that it or its delegate
|
||||
* cannot authenticate.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFailedAuthenticationException; /* MacOS-X */
|
||||
|
||||
#endif /* __NSConnection_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
|
|
@ -442,11 +442,22 @@ GS_EXPORT BOOL NSDeallocateZombies;
|
|||
#define NSWarnMLog(format, args...)
|
||||
#endif
|
||||
|
||||
/* Getting stack information. Use caution with this. It uses builtin
|
||||
gcc functions and currently only works up to 100 frames
|
||||
*/
|
||||
/**
|
||||
* Retrieve stack information. Use caution: uses built-in gcc functions
|
||||
* and currently only works up to 100 frames.
|
||||
*/
|
||||
GS_EXPORT void *NSFrameAddress(int offset);
|
||||
|
||||
/**
|
||||
* Retrieve stack information. Use caution: uses built-in gcc functions
|
||||
* and currently only works up to 100 frames.
|
||||
*/
|
||||
GS_EXPORT void *NSReturnAddress(int offset);
|
||||
|
||||
/**
|
||||
* Retrieve stack information. Use caution: uses built-in gcc functions
|
||||
* and currently only works up to 100 frames.
|
||||
*/
|
||||
GS_EXPORT unsigned NSCountFrames(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,6 +35,14 @@
|
|||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
/**
|
||||
* Enumerated type for specifying decimal rounding behavior. Can be one of
|
||||
* <code>NSRoundDown</code> (always round down), <code>NSRoundUp</code>
|
||||
* (always round up), <code>NSRoundPlain</code> ("normal" rounding (up from
|
||||
* .5 or above, down otherwise), <code>NSRoundBankers</code> (as "Plain" but
|
||||
* .5 rounds to make last remaining digit even). See the
|
||||
* [(NSDecimalNumberBehaviors)] protocol.
|
||||
*/
|
||||
typedef enum {
|
||||
NSRoundDown,
|
||||
NSRoundUp,
|
||||
|
@ -42,6 +50,22 @@ typedef enum {
|
|||
NSRoundBankers /* Make last digit even */
|
||||
} NSRoundingMode;
|
||||
|
||||
/**
|
||||
* Enumerated type for specifying a decimal calculation error. Can be one of
|
||||
* the following:
|
||||
* <deflist>
|
||||
* <term><code>NSCalculationNoError</code></term>
|
||||
* <desc>No error occurred.</desc>
|
||||
* <term><code>NSCalculationLossOfPrecision</code></term>
|
||||
* <desc>The number can't be represented in 38 significant digits.</desc>
|
||||
* <term><code>NSCalculationOverflow</code></term>
|
||||
* <desc>The number is too large to represent.</desc>
|
||||
* <term><code>NSCalculationUnderflow</code></term>
|
||||
* <desc>The number is too small to represent.</desc>
|
||||
* <term><code>NSCalculationDivideByZero</code></term>
|
||||
* <desc>The caller tried to divide by 0.</desc>
|
||||
* </deflist>
|
||||
*/
|
||||
typedef enum {
|
||||
NSCalculationNoError = 0,
|
||||
NSCalculationUnderflow, /* result became zero */
|
||||
|
@ -87,45 +111,103 @@ typedef struct {
|
|||
#endif
|
||||
} NSDecimal;
|
||||
|
||||
/** Returns whether decimal represents an invalid number. */
|
||||
static inline BOOL
|
||||
NSDecimalIsNotANumber(const NSDecimal *decimal)
|
||||
{
|
||||
return (decimal->validNumber == NO);
|
||||
}
|
||||
|
||||
/** Copies value of decimal number to preallocated destination. */
|
||||
GS_EXPORT void
|
||||
NSDecimalCopy(NSDecimal *destination, const NSDecimal *source);
|
||||
|
||||
/** Tries to reduce memory used to store number internally. */
|
||||
GS_EXPORT void
|
||||
NSDecimalCompact(NSDecimal *number);
|
||||
|
||||
/**
|
||||
* Returns <code>NSOrderedDescending</code>, <code>NSOrderedSame</code>, or
|
||||
* <code>NSOrderedAscending</code> depending on whether leftOperand is
|
||||
* greater than, equal to, or less than rightOperand.
|
||||
*/
|
||||
GS_EXPORT NSComparisonResult
|
||||
NSDecimalCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand);
|
||||
|
||||
/**
|
||||
* Rounds number to result such that it has at most scale digits to the right
|
||||
* of its decimal point, according to mode (see the
|
||||
* [(NSDecimalNumberBehaviors)] protocol). The result should be preallocated
|
||||
* but can be the same as number.
|
||||
*/
|
||||
GS_EXPORT void
|
||||
NSDecimalRound(NSDecimal *result, const NSDecimal *number, int scale, NSRoundingMode mode);
|
||||
|
||||
/**
|
||||
* Sets the exponents of n1 and n2 to equal one another, adjusting mantissas
|
||||
* as necessary to preserve values. This makes certain operations quicker.
|
||||
*/
|
||||
GS_EXPORT NSCalculationError
|
||||
NSDecimalNormalize(NSDecimal *n1, NSDecimal *n2, NSRoundingMode mode);
|
||||
|
||||
/**
|
||||
* Adds two decimals and returns result to 38-digit precision. See the
|
||||
* [(NSDecimalNumberBehaviors)] protocol for a description of mode and the
|
||||
* return value. The result should be preallocated but can be the same as
|
||||
* left or right.
|
||||
*/
|
||||
GS_EXPORT NSCalculationError
|
||||
NSDecimalAdd(NSDecimal *result, const NSDecimal *left, const NSDecimal *right, NSRoundingMode mode);
|
||||
|
||||
/**
|
||||
* Subtracts two decimals and returns result to 38-digit precision. See the
|
||||
* [(NSDecimalNumberBehaviors)] protocol for a description of mode and the
|
||||
* return value. The result should be preallocated but can be the same as
|
||||
* left or right.
|
||||
*/
|
||||
GS_EXPORT NSCalculationError
|
||||
NSDecimalSubtract(NSDecimal *result, const NSDecimal *left, const NSDecimal *right, NSRoundingMode mode);
|
||||
|
||||
/**
|
||||
* Multiplies two decimals and returns result to 38-digit precision. See the
|
||||
* [(NSDecimalNumberBehaviors)] protocol for a description of mode and the
|
||||
* return value. The result should be preallocated but can be the same as
|
||||
* l or r.
|
||||
*/
|
||||
GS_EXPORT NSCalculationError
|
||||
NSDecimalMultiply(NSDecimal *result, const NSDecimal *l, const NSDecimal *r, NSRoundingMode mode);
|
||||
|
||||
/**
|
||||
* Divides l by rr and returns result to 38-digit precision. See the
|
||||
* [(NSDecimalNumberBehaviors)] protocol for a description of mode and the
|
||||
* return value. The result should be preallocated but can be the same as
|
||||
* l or rr.
|
||||
*/
|
||||
GS_EXPORT NSCalculationError
|
||||
NSDecimalDivide(NSDecimal *result, const NSDecimal *l, const NSDecimal *rr, NSRoundingMode mode);
|
||||
|
||||
/**
|
||||
* Raises n to power and returns result to 38-digit precision. See the
|
||||
* [(NSDecimalNumberBehaviors)] protocol for a description of mode and the
|
||||
* return value. The result should be preallocated but can be the same as
|
||||
* n or power.
|
||||
*/
|
||||
GS_EXPORT NSCalculationError
|
||||
NSDecimalPower(NSDecimal *result, const NSDecimal *n, unsigned power, NSRoundingMode mode);
|
||||
|
||||
/**
|
||||
* Multiplies n by 10^power and returns result to 38-digit precision. See the
|
||||
* [(NSDecimalNumberBehaviors)] protocol for a description of mode and the
|
||||
* return value. The result should be preallocated but can be the same as
|
||||
* n or power.
|
||||
*/
|
||||
GS_EXPORT NSCalculationError
|
||||
NSDecimalMultiplyByPowerOf10(NSDecimal *result, const NSDecimal *n, short power, NSRoundingMode mode);
|
||||
|
||||
/**
|
||||
* Returns a string representing the full decimal value, formatted according
|
||||
* to locale (send nil here for default locale).
|
||||
*/
|
||||
GS_EXPORT NSString*
|
||||
NSDecimalString(const NSDecimal *decimal, NSDictionary *locale);
|
||||
|
||||
|
@ -133,24 +215,30 @@ NSDecimalString(const NSDecimal *decimal, NSDictionary *locale);
|
|||
// GNUstep extensions to make the implementation of NSDecimalNumber totaly
|
||||
// independent for NSDecimals internal representation
|
||||
|
||||
// Give back the biggest NSDecimal
|
||||
/** Give back the biggest NSDecimal in (preallocated) result. */
|
||||
GS_EXPORT void
|
||||
NSDecimalMax(NSDecimal *result);
|
||||
|
||||
// Give back the smallest NSDecimal
|
||||
/** Give back the smallest NSDecimal in (preallocated) result. */
|
||||
GS_EXPORT void
|
||||
NSDecimalMin(NSDecimal *result);
|
||||
|
||||
// Give back the value of a NSDecimal as a double
|
||||
/** Give back the value of a NSDecimal as a double in (preallocated) result. */
|
||||
GS_EXPORT double
|
||||
NSDecimalDouble(NSDecimal *number);
|
||||
|
||||
// Create a NSDecimal with a mantissa, exponent and a negative flag
|
||||
/**
|
||||
* Create a NSDecimal with a mantissa, exponent and a negative flag in
|
||||
* (preallocated) result.
|
||||
*/
|
||||
GS_EXPORT void
|
||||
NSDecimalFromComponents(NSDecimal *result, unsigned long long mantissa,
|
||||
short exponent, BOOL negative);
|
||||
|
||||
// Create a NSDecimal from a string using the local
|
||||
/**
|
||||
* Create a NSDecimal from a string using the locale, in (preallocated)
|
||||
* result.
|
||||
*/
|
||||
GS_EXPORT void
|
||||
NSDecimalFromString(NSDecimal *result, NSString *numberValue,
|
||||
NSDictionary *locale);
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
@end
|
||||
|
||||
/**
|
||||
* A utility class adopting [NSDecimalNumberBehaviors] protocol. Can be used
|
||||
* A utility class adopting [(NSDecimalNumberBehaviors)] protocol. Can be used
|
||||
* to control [NSDecimalNumber] rounding and exception-handling behavior, by
|
||||
* passing an instance as an argument to any [NSDecimalNumber] method ending
|
||||
* with <code>...Behavior:</code>.
|
||||
|
@ -134,7 +134,7 @@
|
|||
|
||||
/**
|
||||
* Constructor setting all behavior. (For more precise control over error
|
||||
* handling, create your own class implementing the [NSDecimalNumberBehaviors]
|
||||
* handling, create your own class implementing the [(NSDecimalNumberBehaviors)]
|
||||
* protocol.)
|
||||
*/
|
||||
+ (id)decimalNumberHandlerWithRoundingMode:(NSRoundingMode)roundingMode
|
||||
|
@ -146,7 +146,7 @@
|
|||
|
||||
/**
|
||||
* Initializor setting all behavior. (For more precise control over error
|
||||
* handling, create your own class implementing the [NSDecimalNumberBehaviors]
|
||||
* handling, create your own class implementing the [(NSDecimalNumberBehaviors)]
|
||||
* protocol.)
|
||||
*/
|
||||
- (id)initWithRoundingMode:(NSRoundingMode)roundingMode
|
||||
|
|
|
@ -31,6 +31,19 @@
|
|||
#include <Foundation/NSNotification.h>
|
||||
|
||||
|
||||
/**
|
||||
* Enumeration of possible values for specifying how
|
||||
* [NSDistributedNotificationCenter] deals with notifications when the
|
||||
* process to which the notification should be delivered is suspended:
|
||||
<example>
|
||||
{
|
||||
NSNotificationSuspensionBehaviorDrop, // drop the notification
|
||||
NSNotificationSuspensionBehaviorCoalesce, // drop all for this process but the latest-sent notification
|
||||
NSNotificationSuspensionBehaviorHold, // queue all notifications for this process until it is resumed
|
||||
NSNotificationSuspensionBehaviorDeliverImmediately // resume the process and deliver
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef enum {
|
||||
NSNotificationSuspensionBehaviorDrop,
|
||||
NSNotificationSuspensionBehaviorCoalesce,
|
||||
|
@ -38,8 +51,17 @@ typedef enum {
|
|||
NSNotificationSuspensionBehaviorDeliverImmediately
|
||||
} NSNotificationSuspensionBehavior;
|
||||
|
||||
/**
|
||||
* Type for [NSDistributedNotificationCenter+notificationCenterForType:] -
|
||||
* localhost broadcast only. This is the only type on OS X.
|
||||
*/
|
||||
GS_EXPORT NSString *NSLocalNotificationCenterType;
|
||||
#ifndef NO_GNUSTEP
|
||||
|
||||
/**
|
||||
* Type of [NSDistributedNotificationCenter+notificationCenterForType:] -
|
||||
* localhost and LAN broadcast. This type is available only on GNUstep.
|
||||
*/
|
||||
GS_EXPORT NSString *GSNetworkNotificationCenterType;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -76,6 +76,10 @@ GS_EXPORT NSString* const NSParseErrorException;
|
|||
#endif
|
||||
|
||||
/* Exception handler definitions */
|
||||
|
||||
/**
|
||||
* The actual structure for an NSHandler. You shouldn't need to worry about it.
|
||||
*/
|
||||
typedef struct _NSHandler
|
||||
{
|
||||
jmp_buf jumpState; /* place to longjmp to */
|
||||
|
@ -83,8 +87,19 @@ typedef struct _NSHandler
|
|||
NSException *exception;
|
||||
} NSHandler;
|
||||
|
||||
/**
|
||||
* This is the exception handler called when an exception is generated and
|
||||
* not caught by the programmer (by enclosing in <code>NS_DURING</code> and
|
||||
* <code>NS_HANDLER</code>...<code>NS_ENDHANDLER</code>). It prints an error
|
||||
* message and exits the program. You can change this behavior by calling
|
||||
* <code>NSSetUncaughtExceptionHandler(fn_ptr)</code>.
|
||||
*/
|
||||
typedef void NSUncaughtExceptionHandler(NSException *exception);
|
||||
|
||||
/**
|
||||
* Variable used to hold the current uncaught exception handler. Use the
|
||||
* function NSSetUncaughtExceptionHandler() to set.
|
||||
*/
|
||||
GS_EXPORT NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
|
||||
#define NSGetUncaughtExceptionHandler() _NSUncaughtExceptionHandler
|
||||
#define NSSetUncaughtExceptionHandler(proc) \
|
||||
|
@ -109,8 +124,9 @@ GS_EXPORT NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
|
|||
NS_VALRETURN, NS_VOIDRETURN, or just falling out the bottom.
|
||||
*/
|
||||
|
||||
/* private support routines. Do not call directly. */
|
||||
/** Private support routine. Do not call directly. */
|
||||
GS_EXPORT void _NSAddHandler( NSHandler *handler );
|
||||
/** Private support routine. Do not call directly. */
|
||||
GS_EXPORT void _NSRemoveHandler( NSHandler *handler );
|
||||
|
||||
#define NS_DURING { NSHandler NSLocalHandler; \
|
||||
|
|
|
@ -87,19 +87,64 @@
|
|||
|
||||
// Notification names.
|
||||
|
||||
/**
|
||||
* Posted when one of the [NSFileHandle] methods
|
||||
* <code>acceptConnectionInBackground...</code> succeeds and has connected to a
|
||||
* stream-type socket in another process. The notification's
|
||||
* <em>userInfo</em> dictionary will contain the [NSFileHandle] for the near
|
||||
* end of the connection (associated to the key
|
||||
* '<code>NSFileHandleNotificationFileHandleItem</code>').
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFileHandleConnectionAcceptedNotification;
|
||||
|
||||
/**
|
||||
* Posted when one of the [NSFileHandle] methods
|
||||
* <code>waitForDataInBackground...</code> has been informed that data is
|
||||
* available. The receiving [NSFileHandle] is passed in the notification.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFileHandleDataAvailableNotification;
|
||||
|
||||
/**
|
||||
* Posted when one of the [NSFileHandle] methods readDataInBackground... has
|
||||
* consumed data. The receiving [NSFileHandle] is passed in the
|
||||
* notification's <em>userInfo</em> dictionary associated to the key
|
||||
* '<code>NSFileHandleNotificationDataItem</code>'.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFileHandleReadCompletionNotification;
|
||||
|
||||
/**
|
||||
* Posted when one of the [NSFileHandle] methods
|
||||
* <code>readToEndOfFileInBackground...</code> has finished. The receiving
|
||||
* [NSFileHandle] is passed in the notification's <em>userInfo</em> dictionary
|
||||
* associated to the key '<code>NSFileHandleNotificationDataItem</code>'.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFileHandleReadToEndOfFileCompletionNotification;
|
||||
|
||||
// Keys for accessing userInfo dictionary in notification handlers.
|
||||
|
||||
/**
|
||||
* Dictionary key for [NSFileHandle] notifications used to mark the
|
||||
* [NSFileHandle] receiving data.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFileHandleNotificationDataItem;
|
||||
|
||||
/**
|
||||
* Dictionary key for [NSFileHandle] notifications used to mark the
|
||||
* [NSFileHandle] that has established a stream-socket connection.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFileHandleNotificationFileHandleItem;
|
||||
|
||||
/**
|
||||
* Dictionary key for [NSFileHandle] notifications postable to certain run
|
||||
* loop modes, associated to an NSArray containing the modes allowed.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFileHandleNotificationMonitorModes;
|
||||
|
||||
// Exceptions
|
||||
|
||||
/**
|
||||
* Exception raised when attempts to read from an [NSFileHandle] channel fail.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSFileHandleOperationException;
|
||||
|
||||
@interface NSPipe : NSObject
|
||||
|
@ -170,10 +215,22 @@ GS_EXPORT NSString * const NSFileHandleOperationException;
|
|||
|
||||
// GNUstep Notification names.
|
||||
|
||||
/**
|
||||
* Notification posted when an asynchronous [NSFileHandle] connection
|
||||
* attempt (to an FTP, HTTP, or other internet server) has succeeded.
|
||||
*/
|
||||
GS_EXPORT NSString * const GSFileHandleConnectCompletionNotification;
|
||||
|
||||
/**
|
||||
* Notification posted when an asynchronous [NSFileHandle] write
|
||||
* operation (to an FTP, HTTP, or other internet server) has succeeded.
|
||||
*/
|
||||
GS_EXPORT NSString * const GSFileHandleWriteCompletionNotification;
|
||||
|
||||
// Message describing error in async accept,read,write operation.
|
||||
/**
|
||||
* Message describing error in asynchronous [NSFileHandle] accept,read,write
|
||||
* operation.
|
||||
*/
|
||||
GS_EXPORT NSString * const GSFileHandleNotificationError;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -178,41 +178,101 @@
|
|||
@end /* NSDirectoryEnumerator */
|
||||
|
||||
/* File Attributes */
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileAppendOnly;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileCreationDate;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileDeviceIdentifier;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileExtensionHidden;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileGroupOwnerAccountID;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileGroupOwnerAccountName;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileHFSCreatorCode;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileHFSTypeCode;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileImmutable;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileModificationDate;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileOwnerAccountID;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileOwnerAccountName;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFilePosixPermissions;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileReferenceCount;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileSize;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileSystemFileNumber;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileSystemNumber;
|
||||
/** File attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileType;
|
||||
|
||||
/* File Types */
|
||||
|
||||
/** Possible value for '<code>NSFileType</code>' key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileTypeDirectory;
|
||||
/** Possible value for '<code>NSFileType</code>' key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileTypeRegular;
|
||||
/** Possible value for '<code>NSFileType</code>' key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileTypeSymbolicLink;
|
||||
/** Possible value for '<code>NSFileType</code>' key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileTypeSocket;
|
||||
/** Possible value for '<code>NSFileType</code>' key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileTypeFifo;
|
||||
/** Possible value for '<code>NSFileType</code>' key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileTypeCharacterSpecial;
|
||||
/** Possible value for '<code>NSFileType</code>' key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileTypeBlockSpecial;
|
||||
/** Possible value for '<code>NSFileType</code>' key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileTypeUnknown;
|
||||
|
||||
/* FileSystem Attributes */
|
||||
|
||||
/** File system attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileSystemSize;
|
||||
/** File system attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileSystemFreeSize;
|
||||
/** File system attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileSystemNodes;
|
||||
/** File system attribute key in dictionary returned by
|
||||
[NSFileManager-fileAttributesAtPath:traverseLink:]. */
|
||||
GS_EXPORT NSString* const NSFileSystemFreeNodes;
|
||||
|
||||
/* Easy access to attributes in a dictionary */
|
||||
|
|
|
@ -62,6 +62,7 @@ struct _NSPoint
|
|||
#ifndef STRICT_OPENSTEP
|
||||
/** Array of NSPoint structs. */
|
||||
typedef NSPoint *NSPointArray;
|
||||
/** Pointer to NSPoint struct. */
|
||||
typedef NSPoint *NSPointPointer;
|
||||
#endif
|
||||
|
||||
|
@ -79,7 +80,9 @@ struct _NSSize
|
|||
};
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
/** Array of NSSize structs. */
|
||||
typedef NSSize *NSSizeArray;
|
||||
/** Pointer to NSSize struct. */
|
||||
typedef NSSize *NSSizePointer;
|
||||
#endif
|
||||
|
||||
|
@ -98,12 +101,22 @@ struct _NSRect
|
|||
};
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
/** Array of NSPoint structs. */
|
||||
/** Array of NSRect structs. */
|
||||
typedef NSRect *NSRectArray;
|
||||
/** Pointer to NSRect struct. */
|
||||
typedef NSRect *NSRectPointer;
|
||||
#endif
|
||||
|
||||
/* Sides of a rectangle. */
|
||||
/** Sides of a rectangle.
|
||||
<example>
|
||||
{
|
||||
NSMinXEdge,
|
||||
NSMinYEdge,
|
||||
NSMaxXEdge,
|
||||
NSMaxYEdge
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef enum _NSRectEdge NSRectEdge;
|
||||
enum _NSRectEdge
|
||||
{
|
||||
|
@ -139,10 +152,10 @@ static const NSSize NSZeroSize __attribute__((unused)); /* Zero size. */
|
|||
|
||||
/** Create Basic Structures... **/
|
||||
|
||||
/* Returns an NSPoint having x-coordinate X and y-coordinate Y. */
|
||||
GS_GEOM_SCOPE NSPoint
|
||||
NSMakePoint(float x, float y) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns an NSPoint having x-coordinate X and y-coordinate Y. */
|
||||
GS_GEOM_SCOPE NSPoint
|
||||
NSMakePoint(float x, float y)
|
||||
{
|
||||
|
@ -153,10 +166,10 @@ NSMakePoint(float x, float y)
|
|||
return point;
|
||||
}
|
||||
|
||||
/* Returns an NSSize having width WIDTH and height HEIGHT. */
|
||||
GS_GEOM_SCOPE NSSize
|
||||
NSMakeSize(float w, float h) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns an NSSize having width w and height h. */
|
||||
GS_GEOM_SCOPE NSSize
|
||||
NSMakeSize(float w, float h)
|
||||
{
|
||||
|
@ -167,10 +180,10 @@ NSMakeSize(float w, float h)
|
|||
return size;
|
||||
}
|
||||
|
||||
/* Returns an NSRect having point of origin (X, Y) and size {W, H}. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSMakeRect(float x, float y, float w, float h) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns an NSRect having point of origin (x, y) and size {w, h}. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSMakeRect(float x, float y, float w, float h)
|
||||
{
|
||||
|
@ -185,91 +198,91 @@ NSMakeRect(float x, float y, float w, float h)
|
|||
|
||||
/** Get a Rectangle's Coordinates... **/
|
||||
|
||||
/* Returns the greatest x-coordinate value still inside ARECT. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMaxX(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the greatest x-coordinate value still inside aRect. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMaxX(NSRect aRect)
|
||||
{
|
||||
return aRect.origin.x + aRect.size.width;
|
||||
}
|
||||
|
||||
/* Returns the greatest y-coordinate value still inside ARECT. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMaxY(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the greatest y-coordinate value still inside aRect. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMaxY(NSRect aRect)
|
||||
{
|
||||
return aRect.origin.y + aRect.size.height;
|
||||
}
|
||||
|
||||
/* Returns the x-coordinate of ARECT's middle point. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMidX(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the x-coordinate of aRect's middle point. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMidX(NSRect aRect)
|
||||
{
|
||||
return aRect.origin.x + (aRect.size.width / 2.0);
|
||||
}
|
||||
|
||||
/* Returns the y-coordinate of ARECT's middle point. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMidY(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the y-coordinate of aRect's middle point. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMidY(NSRect aRect)
|
||||
{
|
||||
return aRect.origin.y + (aRect.size.height / 2.0);
|
||||
}
|
||||
|
||||
/* Returns the least x-coordinate value still inside ARECT. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMinX(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the least x-coordinate value still inside aRect. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMinX(NSRect aRect)
|
||||
{
|
||||
return aRect.origin.x;
|
||||
}
|
||||
|
||||
/* Returns the least y-coordinate value still inside ARECT. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMinY(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the least y-coordinate value still inside aRect. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSMinY(NSRect aRect)
|
||||
{
|
||||
return aRect.origin.y;
|
||||
}
|
||||
|
||||
/* Returns ARECT's width. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSWidth(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns aRect's width. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSWidth(NSRect aRect)
|
||||
{
|
||||
return aRect.size.width;
|
||||
}
|
||||
|
||||
/* Returns ARECT's height. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSHeight(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns aRect's height. */
|
||||
GS_GEOM_SCOPE float
|
||||
NSHeight(NSRect aRect)
|
||||
{
|
||||
return aRect.size.height;
|
||||
}
|
||||
|
||||
/* Returns 'YES' iff the area of ARECT is zero (i.e., iff either
|
||||
* of ARECT's width or height is negative or zero). */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSIsEmptyRect(NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns 'YES' iff the area of aRect is zero (i.e., iff either
|
||||
* of aRect's width or height is negative or zero). */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSIsEmptyRect(NSRect aRect)
|
||||
{
|
||||
|
@ -278,11 +291,11 @@ NSIsEmptyRect(NSRect aRect)
|
|||
|
||||
/** Modify a Copy of a Rectangle... **/
|
||||
|
||||
/* Returns the rectangle obtained by translating ARECT
|
||||
* horizontally by DX and vertically by DY. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSOffsetRect(NSRect aRect, float dx, float dy) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the rectangle obtained by translating aRect
|
||||
* horizontally by dx and vertically by dy. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSOffsetRect(NSRect aRect, float dx, float dy)
|
||||
{
|
||||
|
@ -293,12 +306,12 @@ NSOffsetRect(NSRect aRect, float dx, float dy)
|
|||
return rect;
|
||||
}
|
||||
|
||||
/* Returns the rectangle obtained by moving each of ARECT's
|
||||
* horizontal sides inward by DY and each of ARECT's vertical
|
||||
* sides inward by DX. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSInsetRect(NSRect aRect, float dX, float dY) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the rectangle obtained by moving each of aRect's
|
||||
* horizontal sides inward by dy and each of aRect's vertical
|
||||
* sides inward by dx. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSInsetRect(NSRect aRect, float dX, float dY)
|
||||
{
|
||||
|
@ -310,10 +323,10 @@ NSInsetRect(NSRect aRect, float dX, float dY)
|
|||
return rect;
|
||||
}
|
||||
|
||||
/* Divides ARECT into two rectangles (namely SLICE and REMAINDER) by
|
||||
* "cutting" ARECT---parallel to, and a distance AMOUNT from the edge
|
||||
* of ARECT determined by EDGE. You may pass 0 in as either of SLICE or
|
||||
* REMAINDER to avoid obtaining either of the created rectangles. */
|
||||
/** Divides aRect into two rectangles (namely slice and remainder) by
|
||||
* "cutting" aRect---parallel to, and a distance amount from the given edge
|
||||
* of aRect. You may pass 0 in as either of slice or
|
||||
* remainder to avoid obtaining either of the created rectangles. */
|
||||
GS_EXPORT void
|
||||
NSDivideRect(NSRect aRect,
|
||||
NSRect *slice,
|
||||
|
@ -321,20 +334,20 @@ NSDivideRect(NSRect aRect,
|
|||
float amount,
|
||||
NSRectEdge edge);
|
||||
|
||||
/* Returns a rectangle obtained by expanding ARECT minimally
|
||||
/** Returns a rectangle obtained by expanding aRect minimally
|
||||
* so that all four of its defining components are integers. */
|
||||
GS_EXPORT NSRect
|
||||
NSIntegralRect(NSRect aRect);
|
||||
|
||||
/** Compute a Third Rectangle from Two Rectangles... **/
|
||||
|
||||
/* Returns the smallest rectangle which contains both ARECT
|
||||
* and BRECT (modulo a set of measure zero). If either of ARECT
|
||||
* or BRECT is an empty rectangle, then the other rectangle is
|
||||
* returned. If both are empty, then the empty rectangle is returned. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSUnionRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the smallest rectangle which contains both aRect
|
||||
* and bRect (modulo a set of measure zero). If either of aRect
|
||||
* or bRect is an empty rectangle, then the other rectangle is
|
||||
* returned. If both are empty, then the empty rectangle is returned. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSUnionRect(NSRect aRect, NSRect bRect)
|
||||
{
|
||||
|
@ -358,14 +371,14 @@ NSUnionRect(NSRect aRect, NSRect bRect)
|
|||
return rect;
|
||||
}
|
||||
|
||||
/* Returns the largest rectange which lies in both ARECT and
|
||||
* BRECT. If ARECT and BRECT have empty intersection (or, rather,
|
||||
* intersection of measure zero, since this includes having their
|
||||
* intersection be only a point or a line), then the empty
|
||||
* rectangle is returned. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSIntersectionRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns the largest rectange which lies in both aRect and
|
||||
* bRect. If aRect and bRect have empty intersection (or, rather,
|
||||
* intersection of measure zero, since this includes having their
|
||||
* intersection be only a point or a line), then the empty
|
||||
* rectangle is returned. */
|
||||
GS_GEOM_SCOPE NSRect
|
||||
NSIntersectionRect (NSRect aRect, NSRect bRect)
|
||||
{
|
||||
|
@ -404,10 +417,10 @@ NSIntersectionRect (NSRect aRect, NSRect bRect)
|
|||
|
||||
/** Test geometric relationships... **/
|
||||
|
||||
/* Returns 'YES' iff ARECT's and BRECT's origin and size are the same. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSEqualRects(NSRect aRect, NSRect bRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns 'YES' iff aRect's and bRect's origin and size are the same. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSEqualRects(NSRect aRect, NSRect bRect)
|
||||
{
|
||||
|
@ -417,10 +430,10 @@ NSEqualRects(NSRect aRect, NSRect bRect)
|
|||
&& (NSHeight(aRect) == NSHeight(bRect))) ? YES : NO;
|
||||
}
|
||||
|
||||
/* Returns 'YES' iff ASIZE's and BSIZE's width and height are the same. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSEqualSizes(NSSize aSize, NSSize bSize) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns 'YES' iff aSize's and bSize's width and height are the same. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSEqualSizes(NSSize aSize, NSSize bSize)
|
||||
{
|
||||
|
@ -428,11 +441,11 @@ NSEqualSizes(NSSize aSize, NSSize bSize)
|
|||
&& (aSize.height == bSize.height)) ? YES : NO;
|
||||
}
|
||||
|
||||
/* Returns 'YES' iff APOINT's and BPOINT's x- and y-coordinates
|
||||
* are the same. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSEqualPoints(NSPoint aPoint, NSPoint bPoint) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns 'YES' iff aPoint's and bPoint's x- and y-coordinates
|
||||
* are the same. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSEqualPoints(NSPoint aPoint, NSPoint bPoint)
|
||||
{
|
||||
|
@ -440,10 +453,10 @@ NSEqualPoints(NSPoint aPoint, NSPoint bPoint)
|
|||
&& (aPoint.y == bPoint.y)) ? YES : NO;
|
||||
}
|
||||
|
||||
/* Returns 'YES' iff APOINT is inside ARECT. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSMouseInRect(NSPoint aPoint, NSRect aRect, BOOL flipped) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns 'YES' iff aPoint is inside aRect. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSMouseInRect(NSPoint aPoint, NSRect aRect, BOOL flipped)
|
||||
{
|
||||
|
@ -459,22 +472,22 @@ NSMouseInRect(NSPoint aPoint, NSRect aRect, BOOL flipped)
|
|||
&& (aPoint.y <= NSMaxY(aRect))) ? YES : NO;
|
||||
}
|
||||
|
||||
/* Just like 'NSMouseInRect(aPoint, aRect, YES)'. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSPointInRect(NSPoint aPoint, NSRect aRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Just like 'NSMouseInRect(aPoint, aRect, YES)'. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSPointInRect(NSPoint aPoint, NSRect aRect)
|
||||
{
|
||||
return NSMouseInRect(aPoint, aRect, YES);
|
||||
}
|
||||
|
||||
/* Returns 'YES' iff ARECT totally encloses BRECT. NOTE: For
|
||||
* this to be the case, ARECT cannot be empty, nor can any side
|
||||
* of BRECT coincide with any side of ARECT. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSContainsRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns 'YES' iff aRect totally encloses bRect. NOTE: For
|
||||
* this to be the case, aRect cannot be empty, nor can any side
|
||||
* of bRect coincide with any side of aRect. */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSContainsRect(NSRect aRect, NSRect bRect)
|
||||
{
|
||||
|
@ -489,6 +502,8 @@ NSContainsRect(NSRect aRect, NSRect bRect)
|
|||
GS_GEOM_SCOPE BOOL
|
||||
NSIntersectsRect(NSRect aRect, NSRect bRect) GS_GEOM_ATTR;
|
||||
|
||||
/** Returns YES if aRect and bRect have non-zero intersection area
|
||||
(intersecting at a line or a point doesn't count). */
|
||||
GS_GEOM_SCOPE BOOL
|
||||
NSIntersectsRect(NSRect aRect, NSRect bRect)
|
||||
{
|
||||
|
@ -503,24 +518,34 @@ NSIntersectsRect(NSRect aRect, NSRect bRect)
|
|||
/** Get a String Representation... **/
|
||||
|
||||
#ifdef __OBJC__
|
||||
/* Returns an NSString of the form "{x=X; y=Y}", where
|
||||
* X and Y are the x- and y-coordinates of APOINT, respectively. */
|
||||
/** Returns an NSString of the form "{x=X; y=Y}", where
|
||||
* X and Y are the x- and y-coordinates of aPoint, respectively. */
|
||||
GS_EXPORT NSString *
|
||||
NSStringFromPoint(NSPoint aPoint);
|
||||
|
||||
/* Returns an NSString of the form "{x=X; y=Y; width=W; height=H}",
|
||||
/** Returns an NSString of the form "{x=X; y=Y; width=W; height=H}",
|
||||
* where X, Y, W, and H are the x-coordinate, y-coordinate,
|
||||
* width, and height of ARECT, respectively. */
|
||||
* width, and height of aRect, respectively. */
|
||||
GS_EXPORT NSString *
|
||||
NSStringFromRect(NSRect aRect);
|
||||
|
||||
/* Returns an NSString of the form "{width=W; height=H}", where
|
||||
* W and H are the width and height of ASIZE, respectively. */
|
||||
/** Returns an NSString of the form "{width=W; height=H}", where
|
||||
* W and H are the width and height of aSize, respectively. */
|
||||
GS_EXPORT NSString *
|
||||
NSStringFromSize(NSSize aSize);
|
||||
|
||||
/** Parses point from string of form "<code>{x=a; y=b}</code>". (0,0) returned
|
||||
if parsing fails. */
|
||||
GS_EXPORT NSPoint NSPointFromString(NSString* string);
|
||||
|
||||
/** Parses size from string of form "<code>{width=a; height=b}</code>". Size of
|
||||
0,0 returned if parsing fails. */
|
||||
GS_EXPORT NSSize NSSizeFromString(NSString* string);
|
||||
|
||||
/** Parses point from string of form "<code>{x=a; y=b; width=c;
|
||||
height=d}</code>". Rectangle of 0 size at origin returned if parsing
|
||||
fails.
|
||||
*/
|
||||
GS_EXPORT NSRect NSRectFromString(NSString* string);
|
||||
|
||||
#endif /* __OBJC__ */
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
/**
|
||||
* Implements <em>keyed</em> archiving of object graphs. This archiver
|
||||
* should be used instead of [NSArchiver] for new implementations. Classes
|
||||
* implementing [NSCoding] should check the [NSCoder-allowsKeyedCoding]
|
||||
* implementing [(NSCoding)] should check the [NSCoder-allowsKeyedCoding]
|
||||
* method and if the response is YES, encode/decode their fields using the
|
||||
* <code>...forKey:</code> [NSCoder] methods, which provide for more robust
|
||||
* forwards and backwards compatibility.
|
||||
|
@ -203,7 +203,7 @@
|
|||
/**
|
||||
* Implements <em>keyed</em> unarchiving of object graphs. The keyed archiver
|
||||
* should be used instead of [NSArchiver] for new implementations. Classes
|
||||
* implementing [NSCoding] should check the [NSCoder-allowsKeyedCoding]
|
||||
* implementing [(NSCoding)] should check the [NSCoder-allowsKeyedCoding]
|
||||
* method and if the response is YES, encode/decode their fields using the
|
||||
* <code>...forKey:</code> [NSCoder] methods, which provide for more robust
|
||||
* forwards and backwards compatibility.
|
||||
|
|
|
@ -54,12 +54,34 @@
|
|||
* Posting styles into notification queue
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enumeration of possible timings for distribution of notifications handed
|
||||
* to an [NSNotificationQueue]:
|
||||
<example>
|
||||
{
|
||||
NSPostWhenIdle, // post when runloop is idle
|
||||
NSPostASAP, // post soon
|
||||
NSPostNow // post synchronously
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef enum {
|
||||
NSPostWhenIdle,
|
||||
NSPostASAP,
|
||||
NSPostNow
|
||||
} NSPostingStyle;
|
||||
|
||||
/**
|
||||
* Enumeration of possible ways to combine notifications when dealing with
|
||||
* [NSNotificationQueue]:
|
||||
<example>
|
||||
{
|
||||
NSNotificationNoCoalescing, // don't combine
|
||||
NSNotificationCoalescingOnName, // combine all registered with same name
|
||||
NSNotificationCoalescingOnSender // combine all registered with same object
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef enum {
|
||||
NSNotificationNoCoalescing = 0,
|
||||
NSNotificationCoalescingOnName = 1,
|
||||
|
@ -70,6 +92,9 @@ typedef enum {
|
|||
* NSNotificationQueue class
|
||||
*/
|
||||
|
||||
/**
|
||||
* Structure used internally by [NSNotificationQueue].
|
||||
*/
|
||||
struct _NSNotificationQueueList;
|
||||
|
||||
@interface NSNotificationQueue : NSObject
|
||||
|
@ -102,7 +127,7 @@ struct _NSNotificationQueueList;
|
|||
|
||||
#ifndef NO_GNUSTEP
|
||||
/*
|
||||
* Functions used by the the NSRunLoop
|
||||
* Functions used by the NSRunLoop
|
||||
*/
|
||||
extern void GSNotifyASAP(void);
|
||||
extern void GSNotifyIdle(void);
|
||||
|
|
|
@ -301,9 +301,9 @@ enum {NSNotFound = 0x7fffffff};
|
|||
Removed because OpenStep has -(NSString*)name; */
|
||||
@end
|
||||
|
||||
/* Global lock to be used by classes when operating on any global
|
||||
data that invoke other methods which also access global; thus,
|
||||
creating the potential for deadlock. */
|
||||
/** Global lock to be used by classes when operating on any global
|
||||
data that invoke other methods which also access global; thus,
|
||||
creating the potential for deadlock. */
|
||||
GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
||||
|
||||
@interface NSObject (GNUstep)
|
||||
|
|
|
@ -49,6 +49,29 @@ GS_EXPORT NSString *NSHomeDirectory(void);
|
|||
GS_EXPORT NSString *NSHomeDirectoryForUser(NSString *loginName);
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
/**
|
||||
* Enumeration of possible requested directory type specifiers for
|
||||
* NSSearchPathForDirectoriesInDomains() function. These correspond to the
|
||||
* subdirectories that may be found under, e.g., $GNUSTEP_SYSTEM_ROOT, such
|
||||
* as "Library" and "Applications".
|
||||
<example>
|
||||
{
|
||||
NSApplicationDirectory,
|
||||
NSDemoApplicationDirectory,
|
||||
NSDeveloperApplicationDirectory,
|
||||
NSAdminApplicationDirectory,
|
||||
NSLibraryDirectory,
|
||||
NSDeveloperDirectory,
|
||||
NSUserDirectory,
|
||||
NSDocumentationDirectory,
|
||||
NSAllApplicationsDirectory,
|
||||
NSAllLibrariesDirectory,
|
||||
GSLibrariesDirectory,
|
||||
GSToolsDirectory,
|
||||
GSApplicationSupportDirectory
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NSApplicationDirectory,
|
||||
|
@ -66,6 +89,11 @@ typedef enum
|
|||
GSApplicationSupportDirectory,
|
||||
} NSSearchPathDirectory;
|
||||
|
||||
/**
|
||||
* Mask type for NSSearchPathForDirectoriesInDomains() function. A bitwise OR
|
||||
* of one or more of <code>NSUserDomainMask, NSLocalDomainMask,
|
||||
* NSNetworkDomainMask, NSSystemDomainMask, NSAllDomainsMask</code>.
|
||||
*/
|
||||
typedef unsigned int NSSearchPathDomainMask;
|
||||
#define NSUserDomainMask 0x00000001
|
||||
#define NSLocalDomainMask 0x00000002
|
||||
|
|
|
@ -47,6 +47,12 @@
|
|||
@class NSPortMessage;
|
||||
@class NSHost;
|
||||
|
||||
/**
|
||||
* Exception raised by [NSPort], [NSConnection], and friends if sufficient
|
||||
* time elapses while waiting for a response, or if the receiving port is
|
||||
* invalidated before a request can be received. See
|
||||
* [NSConnection-setReplyTimeout:].
|
||||
*/
|
||||
GS_EXPORT NSString * const NSPortTimeoutException; /* OPENSTEP */
|
||||
|
||||
/**
|
||||
|
@ -166,12 +172,19 @@ GS_EXPORT NSString * const NSPortTimeoutException; /* OPENSTEP */
|
|||
@end
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Notification posted when an instance of [NSPort] or a subclass becomes
|
||||
* invalid.
|
||||
*/
|
||||
GS_EXPORT NSString* NSPortDidBecomeInvalidNotification;
|
||||
|
||||
#define PortBecameInvalidNotification NSPortDidBecomeInvalidNotification
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
|
||||
/**
|
||||
* Native socket type.
|
||||
*/
|
||||
typedef SOCKET NSSocketNativeHandle;
|
||||
|
||||
@class GSTcpHandle;
|
||||
|
|
|
@ -63,8 +63,8 @@
|
|||
* how an NSRange works.
|
||||
* </p>
|
||||
* <p>
|
||||
* An NSRange consists of a location and a length. The points
|
||||
* that are considered to lie in a range are the integers from
|
||||
* An NSRange consists of a <em>location</em> and a <em>length</em>. The
|
||||
* points that are considered to lie in a range are the integers from
|
||||
* the location to the location plus the length, so the number
|
||||
* of points in a range is the length of the range plus one.<br />
|
||||
* However, if you consider these points like the marks on a
|
||||
|
@ -81,6 +81,7 @@ struct _NSRange
|
|||
};
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
/** Pointer to an NSRange structure. */
|
||||
typedef NSRange *NSRangePointer;
|
||||
#endif
|
||||
|
||||
|
@ -104,6 +105,7 @@ typedef NSRange *NSRangePointer;
|
|||
GS_RANGE_SCOPE unsigned
|
||||
NSMaxRange(NSRange range) GS_RANGE_ATTR;
|
||||
|
||||
/** Returns top end of range (location + length). */
|
||||
GS_RANGE_SCOPE unsigned
|
||||
NSMaxRange(NSRange range)
|
||||
{
|
||||
|
@ -113,15 +115,16 @@ NSMaxRange(NSRange range)
|
|||
GS_RANGE_SCOPE BOOL
|
||||
NSLocationInRange(unsigned location, NSRange range) GS_RANGE_ATTR;
|
||||
|
||||
/** Returns whether location is greater than or equal to range's location
|
||||
* and less than its max.
|
||||
*/
|
||||
GS_RANGE_SCOPE BOOL
|
||||
NSLocationInRange(unsigned location, NSRange range)
|
||||
{
|
||||
return (location >= range.location) && (location < NSMaxRange(range));
|
||||
}
|
||||
|
||||
GS_RANGE_SCOPE NSRange
|
||||
NSMakeRange(unsigned int location, unsigned int length) GS_RANGE_ATTR;
|
||||
|
||||
/** Convenience method for raising an NSRangeException. */
|
||||
GS_EXPORT void _NSRangeExceptionRaise (void);
|
||||
/* NB: The implementation of _NSRangeExceptionRaise is:
|
||||
[NSException raise: NSRangeException
|
||||
|
@ -131,6 +134,10 @@ GS_EXPORT void _NSRangeExceptionRaise (void);
|
|||
file (NSRange.h) can be included without problems in the
|
||||
implementation of the base classes themselves. */
|
||||
|
||||
GS_RANGE_SCOPE NSRange
|
||||
NSMakeRange(unsigned int location, unsigned int length) GS_RANGE_ATTR;
|
||||
|
||||
/** Creates new range starting at location and of given length. */
|
||||
GS_RANGE_SCOPE NSRange
|
||||
NSMakeRange(unsigned int location, unsigned int length)
|
||||
{
|
||||
|
@ -149,6 +156,7 @@ NSMakeRange(unsigned int location, unsigned int length)
|
|||
GS_RANGE_SCOPE BOOL
|
||||
NSEqualRanges(NSRange range1, NSRange range2) GS_RANGE_ATTR;
|
||||
|
||||
/** Returns whether range1 and range2 have same location and length. */
|
||||
GS_RANGE_SCOPE BOOL
|
||||
NSEqualRanges(NSRange range1, NSRange range2)
|
||||
{
|
||||
|
@ -159,6 +167,8 @@ NSEqualRanges(NSRange range1, NSRange range2)
|
|||
GS_RANGE_SCOPE NSRange
|
||||
NSUnionRange(NSRange range1, NSRange range2) GS_RANGE_ATTR;
|
||||
|
||||
/** Returns range going from minimum of aRange's and bRange's locations to
|
||||
maximum of their two max's. */
|
||||
GS_RANGE_SCOPE NSRange
|
||||
NSUnionRange(NSRange aRange, NSRange bRange)
|
||||
{
|
||||
|
@ -173,6 +183,9 @@ NSUnionRange(NSRange aRange, NSRange bRange)
|
|||
GS_RANGE_SCOPE NSRange
|
||||
NSIntersectionRange(NSRange range1, NSRange range2) GS_RANGE_ATTR;
|
||||
|
||||
/** Returns range containing indices existing in both aRange and bRange. If
|
||||
* the returned length is 0, the location is undefined and should be ignored.
|
||||
*/
|
||||
GS_RANGE_SCOPE NSRange
|
||||
NSIntersectionRange (NSRange aRange, NSRange bRange)
|
||||
{
|
||||
|
@ -191,7 +204,11 @@ NSIntersectionRange (NSRange aRange, NSRange bRange)
|
|||
|
||||
@class NSString;
|
||||
|
||||
/** Returns string of form {location=a, length=b}. */
|
||||
GS_EXPORT NSString *NSStringFromRange(NSRange range);
|
||||
|
||||
/** Parses range from string of form {location=a, length=b}, otherwise returns
|
||||
range with 0 location and length if this fails. */
|
||||
GS_EXPORT NSRange NSRangeFromString(NSString *aString);
|
||||
|
||||
#ifdef GS_DEFINED_MAX
|
||||
|
@ -205,15 +222,18 @@ GS_EXPORT NSRange NSRangeFromString(NSString *aString);
|
|||
#endif
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
/*
|
||||
/**
|
||||
* To be used inside a method for making sure that a range does not specify
|
||||
* anything outsize the size of an array/string.
|
||||
* anything outside the size of an array/string. Raises exception if range
|
||||
* extends beyond [0,size).
|
||||
*/
|
||||
#define GS_RANGE_CHECK(RANGE, SIZE) \
|
||||
if (RANGE.location > SIZE || RANGE.length > (SIZE - RANGE.location)) \
|
||||
[NSException raise: NSRangeException \
|
||||
format: @"in %s, range { %u, %u } extends beyond size (%u)", \
|
||||
GSNameFromSelector(_cmd), RANGE.location, RANGE.length, SIZE]
|
||||
|
||||
/** Checks whether INDEX is strictly less than OVER (within C array space). */
|
||||
#define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \
|
||||
if (INDEX >= OVER) \
|
||||
[NSException raise: NSRangeException \
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
|
||||
@class NSTimer, NSDate, NSPort;
|
||||
|
||||
/* Mode strings. */
|
||||
/**
|
||||
* Run loop mode used to deal with input sources other than NSConnections or
|
||||
* dialog windows. Most commonly used. Defined in
|
||||
* <code>Foundation/NSRunLoop.h</code>.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSDefaultRunLoopMode;
|
||||
|
||||
@interface NSRunLoop : NSObject <GCFinalization>
|
||||
|
@ -90,6 +94,18 @@ GS_EXPORT NSString * const NSDefaultRunLoopMode;
|
|||
* GNUstep extensions
|
||||
*/
|
||||
|
||||
/**
|
||||
* GNUstep extension: enumeration of event types that an [NSRunLoop] watcher
|
||||
* can watch for. See [NSRunLoop-addEvent:type:watcher:forMode:].
|
||||
<example>
|
||||
{
|
||||
ET_RDESC, // Watch for descriptor becoming readable.
|
||||
ET_WDESC, // Watch for descriptor becoming writeable.
|
||||
ET_RPORT, // Watch for message arriving on port.
|
||||
ET_EDESC // Watch for descriptor with out-of-band data.
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef enum {
|
||||
ET_RDESC, /* Watch for descriptor becoming readable. */
|
||||
ET_WDESC, /* Watch for descriptor becoming writeable. */
|
||||
|
@ -116,7 +132,7 @@ typedef enum {
|
|||
/**
|
||||
* Callback message sent to object when the event it it waiting
|
||||
* for occurs. The 'data' and 'type' valueds are those passed in the
|
||||
* original addEvent:type:watcher:forMode: method.
|
||||
* original -addEvent:type:watcher:forMode: method.
|
||||
* The 'extra' value may be additional data returned depending
|
||||
* on the type of event.
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSRange.h>
|
||||
|
||||
/**
|
||||
* Type for representing unicode characters. (16-bit)
|
||||
*/
|
||||
typedef unsigned short unichar;
|
||||
|
||||
@class NSArray;
|
||||
|
@ -47,6 +50,30 @@ enum
|
|||
NSAnchoredSearch = 8
|
||||
};
|
||||
|
||||
/**
|
||||
* <p>Enumeration of available encodings for converting between bytes and
|
||||
* characters (in [NSString]s). The ones that are shared with OpenStep and
|
||||
* Cocoa are: <code>NSASCIIStringEncoding, NSNEXTSTEPStringEncoding,
|
||||
* NSJapaneseEUCStringEncoding, NSUTF8StringEncoding,
|
||||
* NSISOLatin1StringEncoding, NSSymbolStringEncoding,
|
||||
* NSNonLossyASCIIStringEncoding, NSShiftJISStringEncoding,
|
||||
* NSISOLatin2StringEncoding, NSUnicodeStringEncoding,
|
||||
* NSWindowsCP1251StringEncoding, NSWindowsCP1252StringEncoding,
|
||||
* NSWindowsCP1253StringEncoding, NSWindowsCP1254StringEncoding,
|
||||
* NSWindowsCP1250StringEncoding, NSISO2022JPStringEncoding,
|
||||
* NSMacOSRomanStringEncoding, NSProprietaryStringEncoding</code>.</p>
|
||||
*
|
||||
* <p>Additional encodings available under GNUstep are:
|
||||
* <code>NSKOI8RStringEncoding, NSISOLatin3StringEncoding,
|
||||
* NSISOLatin4StringEncoding, NSISOCyrillicStringEncoding,
|
||||
* NSISOArabicStringEncoding, NSISOGreekStringEncoding,
|
||||
* NSISOHebrewStringEncoding, NSISOLatin5StringEncoding,
|
||||
* NSISOLatin6StringEncoding, NSISOThaiStringEncoding,
|
||||
* NSISOLatin7StringEncoding, NSISOLatin8StringEncoding,
|
||||
* NSISOLatin9StringEncoding, NSGB2312StringEncoding, NSUTF7StringEncoding,
|
||||
* NSGSM0338StringEncoding, NSBIG5StringEncoding,
|
||||
* NSKoreanEUCStringEncoding</code>.</p>
|
||||
*/
|
||||
typedef enum _NSStringEncoding
|
||||
{
|
||||
/* NB. Must not have an encoding with value zero - so we can use zero to
|
||||
|
@ -368,8 +395,8 @@ enum {
|
|||
@end
|
||||
|
||||
#ifdef NeXT_RUNTIME
|
||||
/* For internal use with NeXT runtime;
|
||||
needed, until Apple Radar 2870817 is fixed. */
|
||||
/** For internal use with NeXT runtime;
|
||||
needed, until Apple Radar 2870817 is fixed. */
|
||||
extern struct objc_class _NSConstantStringClassReference;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -99,6 +99,11 @@
|
|||
#endif
|
||||
@end
|
||||
|
||||
/**
|
||||
* Notification posted when an [NSTask] terminates, either due to the
|
||||
* subprocess ending or the [NSTask-terminate] method explicitly being
|
||||
* called.
|
||||
*/
|
||||
GS_EXPORT NSString* NSTaskDidTerminateNotification;
|
||||
|
||||
#endif /* __NSTask_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
|
|
@ -109,14 +109,28 @@ GS_EXPORT void GSUnregisterCurrentThread (void);
|
|||
* OpenStep compatibility, the actual notification names are the more
|
||||
* modern OPENSTEP/MacOS versions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Notification posted the first time a new [NSThread] is created or a
|
||||
* separate thread from another library is registered in an application.
|
||||
* Before such a notification has been posted you can assume the application
|
||||
* is in single-threaded mode and locks are not necessary.
|
||||
*/
|
||||
GS_EXPORT NSString *NSWillBecomeMultiThreadedNotification;
|
||||
#define NSBecomingMultiThreaded NSWillBecomeMultiThreadedNotification
|
||||
|
||||
/**
|
||||
* Notification posted when an [NSThread] instance receives an exit message,
|
||||
* or an external thread has been deregistered.
|
||||
*/
|
||||
GS_EXPORT NSString *NSThreadWillExitNotification;
|
||||
#define NSThreadExiting NSThreadWillExitNotification
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
|
||||
/**
|
||||
* Notification posted (only in GNUstep) whenever a new thread is started up.
|
||||
*/
|
||||
GS_EXPORT NSString *NSThreadDidStartNotification;
|
||||
|
||||
/*
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
|
||||
@class NSNumber;
|
||||
|
||||
/**
|
||||
* URL scheme constant for use with [NSURL-initWithScheme:host:path:].
|
||||
*/
|
||||
GS_EXPORT NSString* NSURLFileScheme;
|
||||
|
||||
@interface NSURL: NSObject <NSCoding, NSCopying, NSURLHandleClient>
|
||||
|
|
|
@ -35,19 +35,74 @@
|
|||
@class NSURLHandle;
|
||||
@class NSURL;
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain status code.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSHTTPPropertyStatusCodeKey;
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain status reason.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSHTTPPropertyStatusReasonKey;
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain HTTP version supported by server.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSHTTPPropertyServerHTTPVersionKey;
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain redirection headers.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSHTTPPropertyRedirectionHeadersKey;
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain error page data.
|
||||
*/
|
||||
GS_EXPORT NSString * const NSHTTPPropertyErrorPageDataKey;
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain local host.
|
||||
*/
|
||||
GS_EXPORT NSString * const GSHTTPPropertyLocalHostKey;
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain method (GET, POST, etc.).
|
||||
*/
|
||||
GS_EXPORT NSString * const GSHTTPPropertyMethodKey;
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain proxy host.
|
||||
*/
|
||||
GS_EXPORT NSString * const GSHTTPPropertyProxyHostKey;
|
||||
|
||||
/**
|
||||
* Key for passing to [NSURLHandle]'s <code>propertyForKey..</code> methods to
|
||||
* obtain proxy port.
|
||||
*/
|
||||
GS_EXPORT NSString * const GSHTTPPropertyProxyPortKey;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Enumerated type returned by [NSURLHandle-status]:
|
||||
<example>
|
||||
{
|
||||
NSURLHandleNotLoaded
|
||||
NSURLHandleLoadSucceeded,
|
||||
NSURLHandleLoadInProgress,
|
||||
NSURLHandleLoadFailed
|
||||
}
|
||||
</example>
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NSURLHandleNotLoaded = 0,
|
||||
|
@ -61,6 +116,7 @@ typedef enum
|
|||
* receive notification of events on the handle.
|
||||
*/
|
||||
@protocol NSURLHandleClient
|
||||
|
||||
/**
|
||||
* Sent by the NSURLHandle object when some data becomes available
|
||||
* from the handle. Note that this does not mean that all data has become
|
||||
|
|
|
@ -36,12 +36,41 @@ enum {
|
|||
};
|
||||
|
||||
/* Public notification */
|
||||
|
||||
/**
|
||||
* Notification posted whenever [NSUndoManager] opens or closes an undo group.
|
||||
* The undo manager itself is posted, with no <em>userInfo</em> dictionary.
|
||||
*/
|
||||
GS_EXPORT NSString *NSUndoManagerCheckpointNotification;
|
||||
|
||||
/**
|
||||
* Notification posted after an [NSUndoManager] opens an undo group.
|
||||
*/
|
||||
GS_EXPORT NSString *NSUndoManagerDidOpenUndoGroupNotification;
|
||||
|
||||
/**
|
||||
* Notification posted after an [NSUndoManager] executes a redo operation.
|
||||
*/
|
||||
GS_EXPORT NSString *NSUndoManagerDidRedoChangeNotification;
|
||||
|
||||
/**
|
||||
* Notification posted after an [NSUndoManager] executes an undo operation.
|
||||
*/
|
||||
GS_EXPORT NSString *NSUndoManagerDidUndoChangeNotification;
|
||||
|
||||
/**
|
||||
* Notification posted before an [NSUndoManager] closes an undo group.
|
||||
*/
|
||||
GS_EXPORT NSString *NSUndoManagerWillCloseUndoGroupNotification;
|
||||
|
||||
/**
|
||||
* Notification posted before an [NSUndoManager] will execute a redo operation.
|
||||
*/
|
||||
GS_EXPORT NSString *NSUndoManagerWillRedoChangeNotification;
|
||||
|
||||
/**
|
||||
* Notification posted before an [NSUndoManager] will execute an undo operation.
|
||||
*/
|
||||
GS_EXPORT NSString *NSUndoManagerWillUndoChangeNotification;
|
||||
|
||||
@interface NSUndoManager: NSObject
|
||||
|
|
|
@ -38,56 +38,143 @@
|
|||
@class NSDistributedLock;
|
||||
|
||||
/* Standard domains */
|
||||
|
||||
/**
|
||||
* User defaults domain for process arguments. Command-line arguments
|
||||
* (attribute-value pairs, as in "-NSFoo bar") are placed into this domain.
|
||||
*/
|
||||
GS_EXPORT NSString* const NSArgumentDomain;
|
||||
|
||||
/**
|
||||
* User defaults domain for system defaults.
|
||||
*/
|
||||
GS_EXPORT NSString* const NSGlobalDomain;
|
||||
|
||||
/**
|
||||
* User defaults domain for application-registered "default defaults".
|
||||
*/
|
||||
GS_EXPORT NSString* const NSRegistrationDomain;
|
||||
|
||||
|
||||
/* Public notification */
|
||||
|
||||
/**
|
||||
* Notification posted when a defaults synchronize has been performed (see
|
||||
* [NSUserDefaults-synchronize]) and changes have been loaded in from disk.
|
||||
*/
|
||||
GS_EXPORT NSString* const NSUserDefaultsDidChangeNotification;
|
||||
|
||||
/* Backwards compatibility */
|
||||
#define NSUserDefaultsChanged NSUserDefaultsDidChangeNotification
|
||||
|
||||
/* Keys for language-dependent information */
|
||||
|
||||
/** Key for locale dictionary: names of days of week. */
|
||||
GS_EXPORT NSString* const NSWeekDayNameArray;
|
||||
|
||||
/** Key for locale dictionary: abbreviations of days of week. */
|
||||
GS_EXPORT NSString* const NSShortWeekDayNameArray;
|
||||
|
||||
/** Key for locale dictionary: names of months of year. */
|
||||
GS_EXPORT NSString* const NSMonthNameArray;
|
||||
|
||||
/** Key for locale dictionary: abbreviations of months of year. */
|
||||
GS_EXPORT NSString* const NSShortMonthNameArray;
|
||||
|
||||
/** Key for locale dictionary: format string for feeding to [NSDateFormatter].*/
|
||||
GS_EXPORT NSString* const NSTimeFormatString;
|
||||
|
||||
/** Key for locale dictionary: format string for feeding to [NSDateFormatter].*/
|
||||
GS_EXPORT NSString* const NSDateFormatString;
|
||||
|
||||
/** Key for locale dictionary: format string for feeding to [NSDateFormatter].*/
|
||||
GS_EXPORT NSString* const NSShortDateFormatString;
|
||||
|
||||
/** Key for locale dictionary: format string for feeding to [NSDateFormatter].*/
|
||||
GS_EXPORT NSString* const NSTimeDateFormatString;
|
||||
|
||||
/** Key for locale dictionary: format string for feeding to [NSDateFormatter].*/
|
||||
GS_EXPORT NSString* const NSShortTimeDateFormatString;
|
||||
|
||||
/** Key for locale dictionary: currency symbol. */
|
||||
GS_EXPORT NSString* const NSCurrencySymbol;
|
||||
|
||||
/** Key for locale dictionary: decimal separator. */
|
||||
GS_EXPORT NSString* const NSDecimalSeparator;
|
||||
|
||||
/** Key for locale dictionary: thousands separator. */
|
||||
GS_EXPORT NSString* const NSThousandsSeparator;
|
||||
|
||||
/** Key for locale dictionary: three-letter ISO 4217 currency abbreviation. */
|
||||
GS_EXPORT NSString* const NSInternationalCurrencyString;
|
||||
|
||||
/** Key for locale dictionary: text formatter string for monetary amounts. */
|
||||
GS_EXPORT NSString* const NSCurrencyString;
|
||||
|
||||
/** Key for locale dictionary: array of strings for 0-9. */
|
||||
GS_EXPORT NSString* const NSDecimalDigits;
|
||||
|
||||
/** Key for locale dictionary: array of strings for AM and PM. */
|
||||
GS_EXPORT NSString* const NSAMPMDesignation;
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
|
||||
/**
|
||||
* Array of arrays, first member of specifying a time, next members one or
|
||||
* more colloquial names for the time, as in "(0, midnight), (12, noon,
|
||||
* lunch)".
|
||||
*/
|
||||
GS_EXPORT NSString* const NSHourNameDesignations;
|
||||
|
||||
/** Strings for "year", "month", "week". */
|
||||
GS_EXPORT NSString* const NSYearMonthWeekDesignations;
|
||||
|
||||
/** Key for locale dictionary: adjectives that modify values in
|
||||
NSYearMonthWeekDesignations, as in "last", "previous", etc.. */
|
||||
GS_EXPORT NSString* const NSEarlierTimeDesignations;
|
||||
|
||||
/** Key for locale dictionary: adjectives that modify values in
|
||||
NSYearMonthWeekDesignations, as in "next", "subsequent", etc.. */
|
||||
GS_EXPORT NSString* const NSLaterTimeDesignations;
|
||||
|
||||
/** Key for locale dictionary: one or more strings designating the current
|
||||
day, such as "today". */
|
||||
GS_EXPORT NSString* const NSThisDayDesignations;
|
||||
|
||||
/** Key for locale dictionary: one or more strings designating the next
|
||||
day, such as "tomorrow". */
|
||||
GS_EXPORT NSString* const NSNextDayDesignations;
|
||||
|
||||
/** Key for locale dictionary: one or more strings designating the next
|
||||
day, such as "day after tomorrow". */
|
||||
GS_EXPORT NSString* const NSNextNextDayDesignations;
|
||||
|
||||
/** Key for locale dictionary: one or more strings designating the previous
|
||||
day, such as "yesterday". */
|
||||
GS_EXPORT NSString* const NSPriorDayDesignations;
|
||||
|
||||
/** Key for locale dictionary: string with 'Y', 'M', 'D', and 'H' designating
|
||||
the default method of writing dates, as in "MDYH" for the U.S.. */
|
||||
GS_EXPORT NSString* const NSDateTimeOrdering;
|
||||
|
||||
/** Key for locale dictionary: name of language. */
|
||||
GS_EXPORT NSString* const NSLanguageName;
|
||||
|
||||
/** Key for locale dictionary: two-letter ISO code. */
|
||||
GS_EXPORT NSString* const NSLanguageCode;
|
||||
|
||||
/** Key for locale dictionary: formal name of language. */
|
||||
GS_EXPORT NSString* const NSFormalName;
|
||||
#ifndef NO_GNUSTEP
|
||||
/** Key for locale dictionary: name of locale. */
|
||||
GS_EXPORT NSString* const NSLocale;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* General implementation notes:
|
||||
|
||||
OpenStep spec currently is either complete nor consitent. Therefor
|
||||
we had to take several implementation decisions which make vary in
|
||||
OpenStep spec currently is either complete nor consistent. Therefore
|
||||
we had to take several implementation decisions which may vary in
|
||||
different OpenStep implementations.
|
||||
|
||||
- We add a new instance method initWithFile: as a designated
|
||||
|
|
|
@ -342,7 +342,7 @@
|
|||
|
||||
@end
|
||||
|
||||
/*
|
||||
/**
|
||||
* Cache info for internal use by NSNumber concrete subclasses.
|
||||
*/
|
||||
typedef struct {
|
||||
|
@ -350,10 +350,12 @@ typedef struct {
|
|||
void (*getValue)(NSNumber*, SEL, void*);
|
||||
} GSNumberInfo;
|
||||
|
||||
/** Internal method for caching. */
|
||||
GSNumberInfo *GSNumberInfoFromObject(NSNumber *o);
|
||||
#define GS_SMALL 16
|
||||
/*
|
||||
* Get cached values for integers in the range -GS_SMALL to +GS_SMALL
|
||||
/**
|
||||
* Internal method: get cached values for integers in the range
|
||||
* - GS_SMALL to + GS_SMALL
|
||||
*/
|
||||
unsigned GSSmallHash(int n);
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,28 @@
|
|||
#ifndef __NSZone_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSZone_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
/**
|
||||
* Primary structure representing an <code>NSZone</code>. Technically it
|
||||
* consists of a set of function pointers for zone upkeep functions plus some
|
||||
* other things-
|
||||
<example>
|
||||
{
|
||||
// Functions for zone.
|
||||
void *(*malloc)(struct _NSZone *zone, size_t size);
|
||||
void *(*realloc)(struct _NSZone *zone, void *ptr, size_t size);
|
||||
void (*free)(struct _NSZone *zone, void *ptr);
|
||||
void (*recycle)(struct _NSZone *zone);
|
||||
BOOL (*check)(struct _NSZone *zone);
|
||||
BOOL (*lookup)(struct _NSZone *zone, void *ptr);
|
||||
|
||||
// Zone statistics (not always maintained).
|
||||
struct NSZoneStats (*stats)(struct _NSZone *zone);
|
||||
|
||||
size_t gran; // Zone granularity (passed in on initialization)
|
||||
NSString *name; // Name of zone (default is 'nil')
|
||||
NSZone *next; // Pointer used for internal management of multiple zones.
|
||||
}</example>
|
||||
*/
|
||||
typedef struct _NSZone NSZone;
|
||||
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
|
@ -35,8 +57,24 @@ typedef struct _NSZone NSZone;
|
|||
@class NSString;
|
||||
|
||||
|
||||
/* The members are the same as the structure mstats which is in the
|
||||
GNU C library. */
|
||||
/**
|
||||
* <code>NSZoneStats</code> is the structure returned by the NSZoneStats()
|
||||
* function that summarizes the current usage of a zone. It is similar to
|
||||
* the structure <em>mstats</em> in the GNU C library. It has 5 fields of
|
||||
* type <code>size_t</code>-
|
||||
* <deflist>
|
||||
* <term><code>bytes_total</code></term>
|
||||
* <desc>This is the total size of memory managed by the zone, in bytes.</desc>
|
||||
* <term><code>chunks_used</code></term>
|
||||
* <desc>This is the number of memory chunks in use in the zone.</desc>
|
||||
* <term><code>bytes_used</code></term>
|
||||
* <desc>This is the number of bytes in use.</desc>
|
||||
* <term><code>chunks_free</code></term>
|
||||
* <desc>This is the number of memory chunks that are not in use.</desc>
|
||||
* <term><code>bytes_free</code></term>
|
||||
* <desc>This is the number of bytes managed by the zone that are not in use.</desc>
|
||||
* </deflist>
|
||||
*/
|
||||
struct NSZoneStats
|
||||
{
|
||||
size_t bytes_total;
|
||||
|
@ -46,6 +84,28 @@ struct NSZoneStats
|
|||
size_t bytes_free;
|
||||
};
|
||||
|
||||
/**
|
||||
* Primary structure representing an <code>NSZone</code>. Technically it
|
||||
* consists of a set of function pointers for zone upkeep functions plus some
|
||||
* other things-
|
||||
<example>
|
||||
{
|
||||
// Functions for zone.
|
||||
void *(*malloc)(struct _NSZone *zone, size_t size);
|
||||
void *(*realloc)(struct _NSZone *zone, void *ptr, size_t size);
|
||||
void (*free)(struct _NSZone *zone, void *ptr);
|
||||
void (*recycle)(struct _NSZone *zone);
|
||||
BOOL (*check)(struct _NSZone *zone);
|
||||
BOOL (*lookup)(struct _NSZone *zone, void *ptr);
|
||||
|
||||
// Zone statistics (not always maintained).
|
||||
struct NSZoneStats (*stats)(struct _NSZone *zone);
|
||||
|
||||
size_t gran; // Zone granularity (passed in on initialization)
|
||||
NSString *name; // Name of zone (default is 'nil')
|
||||
NSZone *next; // Pointer used for internal management of multiple zones.
|
||||
}</example>
|
||||
*/
|
||||
struct _NSZone
|
||||
{
|
||||
/* Functions for zone. */
|
||||
|
@ -62,6 +122,11 @@ struct _NSZone
|
|||
NSZone *next;
|
||||
};
|
||||
|
||||
/**
|
||||
* Try to get more memory - the normal process has failed.
|
||||
* If we can't do anything, just return a null pointer.
|
||||
* Try to do some logging if possible.
|
||||
*/
|
||||
void *GSOutOfMemory(size_t size, BOOL retry);
|
||||
|
||||
#ifdef IN_NSZONE_M
|
||||
|
@ -97,6 +162,13 @@ GS_ZONE_SCOPE NSZone* GSAtomicMallocZone (void)
|
|||
GS_ZONE_SCOPE NSZone* NSZoneFromPointer (void *ptr)
|
||||
{ return __nszone_private_hidden_default_zone; }
|
||||
|
||||
/**
|
||||
* Allocates and returns memory for elems items of size bytes, in the
|
||||
* given zone. Returns NULL if allocation of size 0 requested. Raises
|
||||
* <code>NSMallocException</code> if not enough free memory in zone to
|
||||
* allocate and no more can be obtained from system, unless using the
|
||||
* default zone, in which case NULL is returned.
|
||||
*/
|
||||
GS_ZONE_SCOPE void* NSZoneMalloc (NSZone *zone, size_t size)
|
||||
{
|
||||
void *ptr;
|
||||
|
@ -111,6 +183,13 @@ GS_ZONE_SCOPE void* NSZoneMalloc (NSZone *zone, size_t size)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates and returns cleared memory for elems items of size bytes, in the
|
||||
* given zone. Returns NULL if allocation of size 0 requested. Raises
|
||||
* <code>NSMallocException</code> if not enough free memory in zone to
|
||||
* allocate and no more can be obtained from system, unless using the
|
||||
* default zone, in which case NULL is returned.
|
||||
*/
|
||||
GS_ZONE_SCOPE void* NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes)
|
||||
{
|
||||
size_t size = elems * bytes;
|
||||
|
@ -144,10 +223,16 @@ GS_ZONE_SCOPE void NSZoneFree (NSZone *zone, void *ptr)
|
|||
GC_FREE(ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name of the given zone (useful for debugging and logging).
|
||||
*/
|
||||
GS_ZONE_SCOPE void NSSetZoneName (NSZone *zone, NSString *name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name of the given zone (useful for debugging and logging).
|
||||
*/
|
||||
GS_ZONE_SCOPE NSString* NSZoneName (NSZone *zone)
|
||||
{
|
||||
return nil;
|
||||
|
@ -155,6 +240,12 @@ GS_ZONE_SCOPE NSString* NSZoneName (NSZone *zone)
|
|||
|
||||
#ifndef NO_GNUSTEP
|
||||
|
||||
/**
|
||||
* Allocates mmemory of size bytes from zone, with the assumption that the
|
||||
* memory will never contain pointers. This is only relevant in situations
|
||||
* where a form of garbage collection is enabled, and NSZoneMalloc() should
|
||||
* always be used otherwise. Not defined by OpenStep or OS X.
|
||||
*/
|
||||
GS_ZONE_SCOPE void* NSZoneMallocAtomic (NSZone *zone, size_t size)
|
||||
{
|
||||
return NSZoneMalloc(GSAtomicMallocZone(), size);
|
||||
|
@ -178,6 +269,10 @@ GS_EXPORT NSZone* NSCreateZone (size_t start, size_t gran, BOOL canFree);
|
|||
|
||||
GS_ZONE_SCOPE NSZone* NSDefaultMallocZone (void) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Returns the default zone used for memory allocation, created at startup.
|
||||
* This zone cannot be recycled.
|
||||
*/
|
||||
GS_ZONE_SCOPE NSZone* NSDefaultMallocZone (void)
|
||||
{
|
||||
return __nszone_private_hidden_default_zone;
|
||||
|
@ -185,6 +280,10 @@ GS_ZONE_SCOPE NSZone* NSDefaultMallocZone (void)
|
|||
|
||||
GS_ZONE_SCOPE NSZone* GSAtomicMallocZone (void) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Returns the default zone used for atomic memory allocation (see
|
||||
* NSMallocAtomic()), if no zone is specified.
|
||||
*/
|
||||
GS_ZONE_SCOPE NSZone* GSAtomicMallocZone (void)
|
||||
{
|
||||
return NSDefaultMallocZone();
|
||||
|
@ -194,6 +293,13 @@ GS_EXPORT NSZone* NSZoneFromPointer (void *ptr);
|
|||
|
||||
GS_ZONE_SCOPE void* NSZoneMalloc (NSZone *zone, size_t size) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Allocates and returns cleared memory for elems items of size bytes, in the
|
||||
* given zone. Returns NULL if allocation of size 0 requested. Raises
|
||||
* <code>NSMallocException</code> if not enough free memory in zone to
|
||||
* allocate and no more can be obtained from system, unless using the
|
||||
* default zone, in which case NULL is returned.
|
||||
*/
|
||||
GS_ZONE_SCOPE void* NSZoneMalloc (NSZone *zone, size_t size)
|
||||
{
|
||||
if (!zone)
|
||||
|
@ -201,11 +307,25 @@ GS_ZONE_SCOPE void* NSZoneMalloc (NSZone *zone, size_t size)
|
|||
return (zone->malloc)(zone, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates and returns cleared memory for elems items of size bytes, in the
|
||||
* given zone. Returns NULL if allocation of size 0 requested. Raises
|
||||
* <code>NSMallocException</code> if not enough free memory in zone to
|
||||
* allocate and no more can be obtained from system, unless using the
|
||||
* default zone, in which case NULL is returned.
|
||||
*/
|
||||
GS_EXPORT void* NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes);
|
||||
|
||||
GS_ZONE_SCOPE void*
|
||||
NSZoneRealloc (NSZone *zone, void *ptr, size_t size) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Reallocates the chunk of memory in zone pointed to by ptr to a new one of
|
||||
* size bytes. Existing contents in ptr are copied over. Raises an
|
||||
* <code>NSMallocException</code> if insufficient memory is available in the
|
||||
* zone and no more memory can be obtained from the system, unless using the
|
||||
* default zone, in which case NULL is returned.
|
||||
*/
|
||||
GS_ZONE_SCOPE void* NSZoneRealloc (NSZone *zone, void *ptr, size_t size)
|
||||
{
|
||||
if (!zone)
|
||||
|
@ -215,6 +335,13 @@ GS_ZONE_SCOPE void* NSZoneRealloc (NSZone *zone, void *ptr, size_t size)
|
|||
|
||||
GS_ZONE_SCOPE void NSRecycleZone (NSZone *zone) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Return memory for an entire zone to system. In fact, this will not be done
|
||||
* unless all memory in the zone has been explicitly freed (by calls to
|
||||
* ZNSZoneFree()). For "non-freeable" zones, the number of NSZoneFree() calls
|
||||
* must simply equal the number of allocation calls. The default zone, on the
|
||||
* other hand, cannot be recycled.
|
||||
*/
|
||||
GS_ZONE_SCOPE void NSRecycleZone (NSZone *zone)
|
||||
{
|
||||
if (!zone)
|
||||
|
@ -224,6 +351,12 @@ GS_ZONE_SCOPE void NSRecycleZone (NSZone *zone)
|
|||
|
||||
GS_ZONE_SCOPE void NSZoneFree (NSZone *zone, void *ptr) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Frees memory pointed to by ptr (which should have been allocated by a
|
||||
* previous call to NSZoneMalloc(), NSZoneCalloc(), or NSZoneRealloc()) and
|
||||
* returns it to zone. Note, if this is a nonfreeable zone, the memory is
|
||||
* not actually freed, but the count of number of free()s is updated.
|
||||
*/
|
||||
GS_ZONE_SCOPE void NSZoneFree (NSZone *zone, void *ptr)
|
||||
{
|
||||
if (!zone)
|
||||
|
@ -235,6 +368,10 @@ GS_EXPORT void NSSetZoneName (NSZone *zone, NSString *name);
|
|||
|
||||
GS_ZONE_SCOPE NSString* NSZoneName (NSZone *zone) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Returns the name assigned to the zone, if one has been given (see
|
||||
* NSSetZoneName()), otherwise nil. Useful for debugging/logging.
|
||||
*/
|
||||
GS_ZONE_SCOPE NSString* NSZoneName (NSZone *zone)
|
||||
{
|
||||
if (!zone)
|
||||
|
@ -246,6 +383,12 @@ GS_ZONE_SCOPE NSString* NSZoneName (NSZone *zone)
|
|||
GS_ZONE_SCOPE void*
|
||||
NSZoneMallocAtomic (NSZone *zone, size_t size) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Allocates memory of size bytes from zone, with the assumption that the
|
||||
* memory will never contain pointers. This is only relevant in situations
|
||||
* where a form of garbage collection is enabled, and NSZoneMalloc() should
|
||||
* always be used otherwise. Not defined by OpenStep or OS X.
|
||||
*/
|
||||
GS_ZONE_SCOPE void* NSZoneMallocAtomic (NSZone *zone, size_t size)
|
||||
{
|
||||
if (!zone)
|
||||
|
@ -255,6 +398,9 @@ GS_ZONE_SCOPE void* NSZoneMallocAtomic (NSZone *zone, size_t size)
|
|||
|
||||
GS_ZONE_SCOPE BOOL NSZoneCheck (NSZone *zone) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Checks integrity of a zone. Not defined by OpenStep or OS X.
|
||||
*/
|
||||
GS_ZONE_SCOPE BOOL NSZoneCheck (NSZone *zone)
|
||||
{
|
||||
if (!zone)
|
||||
|
@ -264,6 +410,10 @@ GS_ZONE_SCOPE BOOL NSZoneCheck (NSZone *zone)
|
|||
|
||||
GS_ZONE_SCOPE struct NSZoneStats NSZoneStats (NSZone *zone) GS_ZONE_ATTR;
|
||||
|
||||
/**
|
||||
* Obtain statistics about the zone. Implementation emphasis is on
|
||||
* correctness, not speed. Not defined by OpenStep or OS X.
|
||||
*/
|
||||
GS_ZONE_SCOPE struct NSZoneStats NSZoneStats (NSZone *zone)
|
||||
{
|
||||
if (!zone)
|
||||
|
|
|
@ -1496,27 +1496,27 @@ static NSLock *cached_proxies_gate = nil;
|
|||
* <deflist>
|
||||
* <term>NSConnectionRepliesReceived</term>
|
||||
* <desc>
|
||||
* The number of messages replied to by the remote NSConnection
|
||||
* The number of messages replied to by the remote NSConnection.
|
||||
* </desc>
|
||||
* <term>NSConnectionRepliesSent</term>
|
||||
* <desc>
|
||||
* The number of replies sent to the remote NSConnection
|
||||
* The number of replies sent to the remote NSConnection.
|
||||
* </desc>
|
||||
* <term>NSConnectionRequestsReceived</term>
|
||||
* <desc>
|
||||
* The number of messages recieved from the remote NSConnection
|
||||
* The number of messages recieved from the remote NSConnection.
|
||||
* </desc>
|
||||
* <term>NSConnectionRequestsSent</term>
|
||||
* <desc>
|
||||
* The number of messages sent to the remote NSConnection
|
||||
* The number of messages sent to the remote NSConnection.
|
||||
* </desc>
|
||||
* <term>NSConnectionLocalCount</term>
|
||||
* <desc>
|
||||
* The number of local objects currently vended
|
||||
* The number of local objects currently vended.
|
||||
* </desc>
|
||||
* <term>NSConnectionProxyCount</term>
|
||||
* <desc>
|
||||
* The number of remote objects currently in use
|
||||
* The number of remote objects currently in use.
|
||||
* </desc>
|
||||
* </deflist>
|
||||
*/
|
||||
|
|
|
@ -53,7 +53,8 @@
|
|||
* <p>Both keys and values are retained by the implementation, and released
|
||||
* when either their entry is dropped or the entire dictionary is deallocated.
|
||||
* This differs from the implementation on OS X, where keys are copied instead
|
||||
* of being retained and must therefore implement the [NSCopying] protocol.</p>
|
||||
* of being retained and must therefore implement the [(NSCopying)] protocol.
|
||||
* </p>
|
||||
*
|
||||
* <p>Objects of this class are immutable. For a mutable version, use the
|
||||
* [NSMutableDictionary] subclass.</p>
|
||||
|
@ -1118,7 +1119,7 @@ compareIt(id o1, id o2, void* context)
|
|||
* is raised. If aKey already in dictionary, the value it maps to is
|
||||
* silently replaced. aKey and anObject are both retained. (This differs
|
||||
* from OS X, where the key is copied and must therefore implement the
|
||||
* [NSCopying] protocol.)
|
||||
* [(NSCopying)] protocol.)
|
||||
*/
|
||||
- (void) setObject: anObject forKey: (id)aKey
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
static NSFileManager *mgr = nil;
|
||||
|
||||
/**
|
||||
* This class does not adopt the [NSLocking] protocol but supports locking
|
||||
* This class does not adopt the [(NSLocking)] protocol but supports locking
|
||||
* across processes, including processes on different machines, as long as
|
||||
* they can access a common filesystem.
|
||||
*/
|
||||
|
|
|
@ -160,7 +160,7 @@ NSRealMemoryAvailable ()
|
|||
}
|
||||
|
||||
/**
|
||||
* Allocate memory for this process and return a pointer to it (or a nul
|
||||
* Allocate memory for this process and return a pointer to it (or a null
|
||||
* pointer on failure).
|
||||
*/
|
||||
void *
|
||||
|
|
|
@ -867,6 +867,13 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
|
||||
#else
|
||||
|
||||
/**
|
||||
* Perform a poll for the specified runloop context.
|
||||
* If the method has been called re-entrantly, the contexts stack
|
||||
* will list all the contexts with polls in progress
|
||||
* and this method must tell those outer contexts not to handle events
|
||||
* which are handled by this context.
|
||||
*/
|
||||
- (BOOL) pollUntil: (int)milliseconds within: (NSArray*)contexts
|
||||
{
|
||||
struct timeval timeout;
|
||||
|
|
|
@ -621,10 +621,10 @@ pty_slave(const char* name)
|
|||
/**
|
||||
* Sends a terminate signal to the receiver and any subtasks.<br />
|
||||
* If the task has not been launched, raises an
|
||||
* NSInvalidArgumentException.<br />
|
||||
* <code>NSInvalidArgumentException</code>.<br />
|
||||
* Has no effect on a task that has already terminated.<br />
|
||||
* When a task temrinates, either due to this method being called,
|
||||
* or normal termination, an NSTaskDidTerminateNotification is
|
||||
* When a task terminates, either due to this method being called,
|
||||
* or normal termination, an <code>NSTaskDidTerminateNotification</code> is
|
||||
* posted.
|
||||
*/
|
||||
- (void) terminate
|
||||
|
|
|
@ -1609,7 +1609,7 @@ static unsigned urlAlign;
|
|||
* An informal protocol to which clients may conform if they wish to be
|
||||
* notified of the progress in loading a URL for them. NSURL conforms to
|
||||
* this protocol but all methods are implemented as no-ops. See also
|
||||
* the [NSURLHandleClient] protocol.
|
||||
* the [(NSURLHandleClient)] protocol.
|
||||
*/
|
||||
@implementation NSObject (NSURLClient)
|
||||
|
||||
|
|
|
@ -580,8 +580,8 @@ NSString *NSUndoManagerWillUndoChangeNotification =
|
|||
* Performs a redo of previous undo request by taking the top grouping
|
||||
* from the redo stack and invoking them. This method posts an
|
||||
* NSUndoManagerCheckpointNotification notification to allow the client
|
||||
* to porcess any pending changes before proceding. If there are groupings
|
||||
* on the redo stack, the top object is poped of the stack and invoked
|
||||
* to process any pending changes before proceding. If there are groupings
|
||||
* on the redo stack, the top object is popped off the stack and invoked
|
||||
* within a nested [-beginUndoGrouping]/[-endUndoGrouping]. During this
|
||||
* pocessing, the operations registered for undo are recorded on the undo
|
||||
* stack again.<br />
|
||||
|
@ -959,8 +959,8 @@ NSString *NSUndoManagerWillUndoChangeNotification =
|
|||
* Performs an undo by taking the top grouping
|
||||
* from the undo stack and invoking them. This method posts an
|
||||
* NSUndoManagerCheckpointNotification notification to allow the client
|
||||
* to porcess any pending changes before proceding. If there are groupings
|
||||
* on the undo stack, the top object is poped of the stack and invoked
|
||||
* to process any pending changes before procedding. If there are groupings
|
||||
* on the undo stack, the top object is popped off the stack and invoked
|
||||
* within a nested beginUndoGrouping/endUndoGrouping. During this
|
||||
* pocessing, the undo operations registered for undo are recorded on the redo
|
||||
* stack.<br />
|
||||
|
|
|
@ -208,7 +208,7 @@ static void updateCache(NSUserDefaults *self)
|
|||
* </p>
|
||||
* <p>
|
||||
* NB. The GNUstep implementation differs from the Apple one in
|
||||
* that it is thread-safe while Apples (as of MacOS-X 10.1) is not.
|
||||
* that it is thread-safe while Apple's (as of MacOS-X 10.1) is not.
|
||||
* </p>
|
||||
*/
|
||||
@implementation NSUserDefaults: NSObject
|
||||
|
@ -911,7 +911,7 @@ static NSString *pathForUser(NSString *user)
|
|||
/**
|
||||
* Adds the domain names aName to the search list of the receiver.<br />
|
||||
* The domain is added after the application domain.<br />
|
||||
* Suites may be removed using the -removeSuiteName: method.
|
||||
* Suites may be removed using the -removeSuiteNamed: method.
|
||||
*/
|
||||
- (void) addSuiteNamed: (NSString*)aName
|
||||
{
|
||||
|
@ -1786,7 +1786,7 @@ static BOOL isPlistObject(id o)
|
|||
|
||||
/**
|
||||
* Removes the named domain from the serach list of the receiver.<br />
|
||||
* Suites may be added using the -addSuiteName: method.
|
||||
* Suites may be added using the -addSuiteNamed: method.
|
||||
*/
|
||||
- (void) removeSuiteNamed: (NSString*)aName
|
||||
{
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
#include "Foundation/NSZone.h"
|
||||
#include "Foundation/NSLock.h"
|
||||
|
||||
/*
|
||||
/**
|
||||
* Try to get more memory - the normal process has failed.
|
||||
* If we can't do anything, just return a null pointer.
|
||||
* Try to do some logging if possible.
|
||||
|
@ -412,6 +412,10 @@ NSZone* __nszone_private_hidden_default_zone = &default_zone;
|
|||
*/
|
||||
static NSZone *zone_list = 0;
|
||||
|
||||
/**
|
||||
* Searches and finds the zone ptr was allocated from. The speed depends
|
||||
* upon the number of zones and their size.
|
||||
*/
|
||||
GS_DECLARE NSZone*
|
||||
NSZoneFromPointer(void *ptr)
|
||||
{
|
||||
|
@ -1582,6 +1586,14 @@ rrealloc (NSZone *zone, void *ptr, size_t size)
|
|||
|
||||
static void rnfree (NSZone *zone, void *ptr);
|
||||
|
||||
/**
|
||||
* Creates a new zone of start bytes, which will grow and shrink by
|
||||
* granularity bytes. If canFree is 0, memory in zone is allocated but
|
||||
* never freed, meaning allocation will be very fast. The whole zone can
|
||||
* still be freed with NSRecycleZone(), and you should still call NSZoneFree
|
||||
* on memory in the zone that is no longer needed, since a count of allocated
|
||||
* pointers is kept and must reach zero before freeing the zone.
|
||||
*/
|
||||
NSZone*
|
||||
NSCreateZone (size_t start, size_t gran, BOOL canFree)
|
||||
{
|
||||
|
@ -1697,12 +1709,21 @@ NSCreateZone (size_t start, size_t gran, BOOL canFree)
|
|||
return newZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates and returns cleared memory for elems items of size bytes, in the
|
||||
* given zone. Returns NULL if allocation of size 0 requested. Raises
|
||||
* <code>NSMallocException</code> if not enough free memory in zone to
|
||||
* allocate and no more can be obtained from system.
|
||||
*/
|
||||
void*
|
||||
NSZoneCalloc (NSZone *zone, size_t elems, size_t bytes)
|
||||
{
|
||||
return memset(NSZoneMalloc(zone, elems*bytes), 0, elems*bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets name of the given zone (useful for debugging and logging).
|
||||
*/
|
||||
void
|
||||
NSSetZoneName (NSZone *zone, NSString *name)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue