GNUstep Base $Revision$ $Date$ 2005 Free Software Foundation, Inc. Base

The GNUstep Base library is a free software package implementing the API of the OpenStep Foundation Kit (tm), including later additions. This documentation package describes the core of the Base library, for documentation on additional classes, see the BaseAdditions documentation package.

Read the Release Notes for the current release.

Compatibility

GNUstep is generally compatible with the OpenStep specification and with recent developments of the MacOS (cocoa) API. Where MacOS deviates from the OpenStep API, GNUstep generally attempts to support both versions. In some cases the newer MacOS APIs are incompatible with OpenStep, and GNUstep usually supports the richer version. See the OpenStep Compliance section for more information on OpenStep Compliance.

In order to deal with compatiblity issues, GNUstep uses two mechanisms - it provides conditionally compiled sections of the library header files, so that software can be built that will conform strictly to a particular API, and it provides user default settings to control the behavior of the library at runtime.

Conditional compilation

Adding an option to a makefile to define one of the following preprocessor constants will modify the API visible to software being compiled -

GS_GNUSTEP_V Specifies the software version of the header being included.
Features in that header which are declared as having been introduced at or before the specified version, and not being removed until or after the specified version are available.
The version consists of five or six digits ... a major number (0-99) followed by a minor number (00-99) and a subminor number (00-00).
Features in the header file are marked as belonging to different version ranges using the GS_API_VERSION macro.
NB. This is the native versioning of the library being used via the header file. You can use this mechanism in your own libraries and frameworks.
GS_OPENSTEP_V Used only for the software version in sequence of OpenStep specification and the NeXT/Apple implementation of that specification and its extensions.
Features in the header being included which are declared as having been introduced at or before the specified version, and not being removed until or after the specified version are available.
The version consists of five or six digits ... a major number (1-99) followed by a minor number (00-99) and a subminor number (00-00).
A major number of 1 indicates the OpenStep specification ... available as the GS_API_OSSPEC preprocessor constant.
A major number of 4 indicates the OPENSTEP implementation ... available as the GS_API_OPENSTEP preprocessor constant.
A major number of 10 indicates the MacOS-X implementation ... available as the GS_API_MACOSX preprocessor constant.
Features in the header file are marked as belonging to different version ranges using the OS_API_VERSION macro.
NO_GNUSTEP GNUstep specific extensions to the OpenStep and MacOS cocoa APIs are excluded from the headers.
This is obsolete .. setting GS_OPENSTEP_V should exclude GNUstep extensions.
STRICT_MACOS_X Only methods and classes that are part of the oriignal MacOS cocoa API are made available in the headers.
This is obsolete .. setting GS_OPENSTEP_V to GS_API_MACOSX should do this.
STRICT_OPENSTEP Only methods and classes that are part of the OpenStep specification are made available in the headers.
This is obsolete .. setting GS_OPENSTEP_V to GS_API_OPENSTEP should do this.

NB These preprocessor constants are used in developer code (ie the code that users of GNUstep write) rather than by the GNUstep software itself. They permit a developer to ensure that he/she does not write code which depends upon API not present on other implementations (in practice, MacOS-X or some old OPENSTEP systems).
The actual GNUstep libraries are always built with the full GNUstep API in place, so that the feature set is as consistent as possible.

User defaults GNU-Debug

An array of strings that lists debug levels to be used within the program. These debug levels are merged with any which were set on the command line or added programmatically to the set given by the [NSProcessInfo-debugSet] method.

GSLogSyslog

Setting the user default GSLogSyslog to YES will cause log/debug output to be sent to the syslog facility (on systems which support it), rather than to the standard error stream. This is useful in environments where stderr has been re-used strangely for some reason.

GSLogThread

Setting the user default GSLogThread to YES will cause NSLog and debug output to include the current thread in the logged message.
This is useful for debugging multi-threaded applications.

GSMacOSXCompatible

Setting the user default GSMacOSXCompatible to YES will cause MacOS compatible behavior to be the default at runtime. This default may however be overridden to provide more fine grained control of system behavior.

GSOldStyleGeometry

Specifies whether the functions for producing strings describing geometric structures (NSStringFromPoint(), NSStringFromSize(), and NSStringFromRect()) should produce strings conforming to the OpenStep specification or to MacOS-X behavior. The functions for parsing those strings should cope with both cases anyway.

GSSOCKS

May be used to specify a default SOCKS5 server (and optionally a port separated from the server by a colon) to which tcp/ip connections made using the NSFileHandle extension methods should be directed.
This default overrides the SOCKS5_SERVER and SOCKS_SERVER environment variables.

Local Time Zone

Used to specify the name of the timezone to be used by the NSTimeZone class.

NSWriteOldStylePropertyLists

Specifies whether text property-list output should be in the default MacOS-X format (XML), or in the more human readable (but less powerful) original OpenStep format.

Reading of property lists is supported in either format, but only if GNUstep is built with the libxml library (which is needed to handle XML parsing).

NB. MacOS-X generates illegal XML for some strings - those which contain characters not legal in XML. GNUstep always generates legal XML, at the cost of a certain degree of compatibility. GNUstep XML property lists use a backslash to escape illegal chatracters, and consequently any string containing either a backslash or an illegal character will be written differently to the same string on MacOS-X.

NSLanguages

An array of strings that lists the users prefered languages, in order or preference. If not found the default is just English.

Environment variables

There are some environment variables used by GNUstep base, where there would be problems obtaining data from the defaults system.

CRASH_ON_ABORT

The default exception handler will either cause the program to simply terminate, or to crash - leaving a core dump. The standard behavior is to leave a core dump if the library was built for debugging, and to simply exit if it was not.

The CRASH_ON_ABORT environment variable can be used to override this behavior. If this is defined to NO, FALSE, or 0 then the program will simply exit when an exception occurs. Any other value of the variable will cause the program to generate a core dump.

GNUSTEP_STRING_ENCODING

This is used to specify the default encoding for 8-bit strings (those used by 'cstring' methods of NSString).
It may be any of the 8-bit encodings supported by your system.

If this environment variable is not set, GNUstep attempts to use the characterset specified by your operating systems, locale information (using the standard nl_langinfo function) if possible.

If there is no usable operating system defined characterset, GNUstep defaults to NSISOLatin1StringEncoding.

GNUSTEP_HOST_CPU

Used in place of GNUSTEP_TARGET_CPU if the other is missing.

GNUSTEP_HOST_DIR

Used in place of GNUSTEP_TARGET_DIR if the other is missing.

GNUSTEP_HOST_OS

Used in place of GNUSTEP_TARGET_OS if the other is missing.

GNUSTEP_LOCAL_ROOT

Used to specify the GNUstep root directory for local (non-system) resources. Typically all locally produced or contributed software is installed relative to this.

GNUSTEP_NETWORK_ROOT

Used to specify the GNUstep root directory for local (non-system) resources that are intended to be shared across a local network. Typically this is an NFS exported directory shared by many machines. It provides an alternative to GNUSTEP_LOCAL_ROOT.

GNUSTEP_SYSTEM_ROOT

Used to specify the GNUstep system root directory ... all system libraries, tools, applications, headers, resources in general are located relative to this.

GNUSTEP_USER_ROOT

This environment variable, commonly set by the make system, is not used by GNUstep programs. Instead values from .GNUsteprc are used (see later).

GNUSTEP_TARGET_CPU

Overrides the default value of the machine (hardware) name used on this system.

GNUSTEP_TARGET_DIR

Overrides the default path used to locate subdirectories for GNUstep binaries withing bundles and applications. This is normally equivalent to a path made up of the GNUSTEP_TARGET_CPU and GNUSTEP_TARGET_OS

GNUSTEP_TARGET_OS

Overrides the default value of the operating system name used on this system.

GNUSTEP_TZ

Used to specify the timezone to be used if there is no timezone specified in the user defaults system. The preferred mechanism is to use the 'Local Time Zone' value from the user defaults system.

HOMEDRIVE

Used on windoze to locate the home directory.

HOMEPATH

Used on windoze to locate the home directory.

LANGUAGES

If there is no NSLanguages user default set, and there is no language infromation available in the native system locale mechanism, then this environment variable is used to provide a list of the languages that the user prefers to use. languages listed in this variable must be separated by semicolons.

LOGNAME

This is used as the default value for the current user (as returned by the NSUserName() functions). If it is not specified, or contains an illegal value, other methods are used to get the user name.

LIBRARY_COMBO

Used to override the default value of the combination of standard libraries used to build binaries. This value locates the final subdirectory used to locate binaries.

NSDeallocateZombies

This may be used in conjunction with NSZombieEnabled to specify whether the objects should really be deallocated. If you set this to YES, the zombie logging will only work until the deallocated memory is re-used.

NSZombieEnabled

If this is set to YES, then deallocation of an object causes the object to be morphed into a Zombie ... a special object which will call the GNUstep specific GSLogZombie() function to log the method call.
You can set a breakpoint in this function and examine the process memory if you are running under a debugger.
As this overrides actual object deallocation, all memory allocated for objects will be leaked!

SOCKS5_SERVER

Specifies the default socks server to be used when making outgoing tcp/ip connections using NSFileHandle. This may also specify a port after the host name (and spearated from it by a colon).
This environment variable is used only if the GSSOCKS user default is not set.

SOCKS_SERVER

Equivalent to SOCKS5_SERVER, but used only if that is not defined.

TZ

Used to specify the timezone to be used if there is no timezone specified by any other mechanism. The preferred mechanism is to use the 'Local Time Zone' value from the user defaults system.

GNUstep Configuration File

This file is the master configuration file for GNUstep. It can be used to set the base location of all the standard paths that GNUstep programs use or know about. The location of this file depends on how the Base library was configured and what operating system it was configured on. On a GNU/Linux system, the default would be /etc/GNUstep/GNUstep.conf, for instance. This file is not required. If it does not appear, then default values will be used for the standard path locations. System paths are defined by the following:

GNUSTEP_SYSTEM_ROOT path in the file heirarchy for system/os things. GNUSTEP_NETWORK_ROOT path to network mounted resources. GNUSTEP_LOCAL_ROOT path for non-system resources for the specific machine.

Paths for each user are defined by the following:

USER_GNUSTEP_DIR Path under user's home directory for user specific GNUstep resources (eg. 'GNUstep') USER_GNUSTEP_RC Name of user configuration file (eg. '.GNUsteprc') USER_GNUSTEP_DEFAULTS Name of directory in USER_GNUSTEP_DIR for user defaults files.

Support is provided to locate OS/PLATFORM directories. A conf file may provide the definitions below:

SYS_PREFS Place for system/os preferences (eg. '/etc') SYS_APPS Place for system/os applications (eg. '/bin') SYS_LIBS Place for system/os shared libraries (eg. '/lib') SYS_ADMIN Place for system administration tools (eg. '/sbin') PLATFORM_APPS Place for non-gnustep applications (eg. '/usr/bin') PLATFORM_LIBS Place for application shared libraries (eg. '/usr/lib') PLATFORM_RESOURCES Place for shared application resources (eg. '/usr/share') PLATFORM_ADMIN Place for non-critical administrative tools (eg. '/usr/sbin') PLATFORM_LOCAL_APPS Place for machine local applications (eg. '/usr/local/bin') PLATFORM_LOCAL_LIBS Place for machine local shared libraries (eg. '/usr/local/lib/') PLATFORM_LOCAL_RESOURCES Place for machine local resources. (eg. '/usr/local/share')

These add to the path for NSSystemDomainMask, or NSLocalDomainMask as appropriate.

.GNUsteprc files

The locations of the directories in which user specific files and the user defaults database are stored are defined in the .GNUsteprc files.
If no location is given for user specific files, they are stored in the GNUstep subdirectory of the users home directory.
If a separate location is not given for the defaults database, it is stored in the same directory as other user specific files.

The presence of a .GNUsteprc file in a users home directory premits the user to customize file locations using two commands -

GNUSTEP_DEFAULTS_ROOT=... The text after the '=' is taken to be the path to the users defaults files. If it begins with a '~' character, the users home directory is prepended to it. GNUSTEP_USER_ROOT=... The text after the '=' is taken to be the path to the users files. If it begins with a '~' character, the users home directory is prepended to it.

The presence of a .GNUsteprc file in the GNUstep system directory may provide default paths for all users and may even override user specific files. This file has been deprecated in favor of the GNUstep Configuration File described above. The content of this file is as for the user specific file, but permits two additional commands:

FORCE_DEFAULTS_ROOT If this line is present, and the file specifies a GNUSTEP_DEFAULTS_ROOT, then the value given in the system-wide file is used irrespective of the user specific file. Otherwise, the value in the user specific file takes precedence. FORCE_USER_ROOT If this line is present, and the file specifies a GNUSTEP_USER_ROOT, then the value given in the system-wide file is used irrespective of the user specific file. Otherwise, the value in the user specific file takes precedence.
API Documentation Functions Types and Constants