mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
completed adriancs doc changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18998 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2723d991f1
commit
93a7cd7073
7 changed files with 47 additions and 1483 deletions
|
@ -1,279 +0,0 @@
|
|||
<?xml version="1.0" encoding='ISO-8859-1'?>
|
||||
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "[[infoDictionary.dtd-ref]]">
|
||||
<gsdoc
|
||||
[[if mainInterface.interfaceTitle == Class]]
|
||||
base="[[mainInterface.className]]"
|
||||
[[else]]
|
||||
[[if mainInterface.interfaceTitle == Category]]
|
||||
base="[[mainInterface.className]]+[[mainInterface.categoryName]]"
|
||||
[[else]]
|
||||
[[if mainInterface.interfaceTitle == Protocol]]
|
||||
base="[[mainInterface.protocolName]]Protocol"
|
||||
[[else]]
|
||||
base=""
|
||||
[[endif Protocol]]
|
||||
[[endif Category]]
|
||||
[[endif Class]]
|
||||
prev="[[infoDictionary.prev]]"
|
||||
next="[[infoDictionary.next]]"
|
||||
up="[[infoDictionary.up]]"
|
||||
stylesheeturl="[[infoDictionary.stylesheeturl]]">
|
||||
<head>
|
||||
<title>[[infoDictionary.basetitle]] [[mainTitle]]</title>
|
||||
<author name="[[infoDictionary.author-name]]">
|
||||
<email address="[[infoDictionary.author-email]]"/>
|
||||
<url url="[[infoDictionary.author-url]]"/>
|
||||
<desc>[[infoDictionary.author-desc]]</desc>
|
||||
</author>
|
||||
<version>[[version]]</version>
|
||||
<date>[[timestampString]]</date>
|
||||
<abstract>
|
||||
[[if mainInterface.interfaceTitle == Class]]
|
||||
[<uref url="[[mainInterface.className]].gsdoc">Source : [[mainInterface.className]].gsdoc</uref>]
|
||||
[[else]]
|
||||
[[if mainInterface.interfaceTitle == Category]]
|
||||
[<uref url="[[mainInterface.className]]+[[mainInterface.categoryName]].gsdoc">Source : [[mainInterface.className]]+[[mainInterface.categoryName]].gsdoc</uref>]
|
||||
[[else]]
|
||||
[[if mainInterface.interfaceTitle == Protocol]]
|
||||
[<uref url="[[mainInterface.protocolName]]Protocol.gsdoc">Source : [[mainInterface.protocolName]]Protocol.gsdoc</uref>]
|
||||
[[endif Protocol]]
|
||||
[[endif Category]]
|
||||
[[endif Class]]
|
||||
<uref url="[[infoDictionary.dtd-url]]">DTD</uref>] </abstract>
|
||||
<copy>[[copyrightYear]][[if copyrightOwner.length > 0]] by [[copyrightOwner]][[endif]]</copy>
|
||||
</head>
|
||||
<body>
|
||||
<front>
|
||||
<contents/>
|
||||
</front>
|
||||
|
||||
|
||||
[[if hasMainInterface == 1]]
|
||||
<chapter id="#">
|
||||
[[endif hasMainInterface == 1]]
|
||||
|
||||
[[if hasMainInterface == 1]]
|
||||
<heading>[[mainTitle]]</heading>
|
||||
[[if mainInterface.interfaceTitle == Class]]
|
||||
<class name="[[mainInterface.className]]" [[if mainInterface.inheritsString.length > 0]] super="[[mainInterface.inheritsString]]"[[endif]]>
|
||||
[[else]]
|
||||
[[if mainInterface.interfaceTitle == Category]]
|
||||
<category name="[[mainInterface.categoryName]]" class="[[mainInterface.className]]">
|
||||
[[else]]
|
||||
[[if mainInterface.interfaceTitle == Protocol]]
|
||||
<protocol name="[[mainInterface.protocolName]]">
|
||||
[[endif Protocol]]
|
||||
[[endif Category]]
|
||||
[[endif Class]]
|
||||
|
||||
<declared>[[importString]]</declared>
|
||||
|
||||
[[if mainInterface.conformedProtocols.count > 0]]
|
||||
[[foreach protocolName mainInterface.conformedProtocols prot1]]
|
||||
<conform>[[protocolName]]</conform>
|
||||
[[endforeach prot1]]
|
||||
[[endif conformedProtocols]]
|
||||
[[endif hasMainInterface == 1]]
|
||||
|
||||
|
||||
|
||||
|
||||
[[if hasMainInterface == 1]]
|
||||
<desc>
|
||||
[[mainInterface.interfaceTitle]] Description -
|
||||
[[mainInterface.entityDescription.formattedCommentString]]
|
||||
</desc>
|
||||
[[endif hasMainInterface == 1]]
|
||||
|
||||
[[if hasMainInterface != 0]][[comment - Everything else is only done if we have an interface]]
|
||||
|
||||
|
||||
|
||||
|
||||
[[if mainInterface.interfaceTitle == Class]]
|
||||
[[if mainInterface.ivarArray.count > 0]]
|
||||
[[comment Instance Variables]]
|
||||
[[foreach ivar mainInterface.ivarArray ivar1]]
|
||||
<ivariable name="[[ivar.fullName]]" type="[[ivar.formattedType]]" posttype="[[ivar.posttype]]">
|
||||
<desc>[[ivar.entityDescription.formattedCommentString]]</desc>
|
||||
</ivariable>
|
||||
[[endforeach ivar1]]
|
||||
[[endif ivarArray]][[endif Class]]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[[if mainInterface.classMethods.count > 0]]
|
||||
[[comment Class Methods]]
|
||||
[[foreach method mainInterface.classMethods method1]]
|
||||
[[if methodIndex > 0]] [[comment Start]] [[endif]]
|
||||
[[comment <uref url="//apple_ref/occ/[[if mainInterface.interfaceTitle == Protocol]]intfm[[else]]clm[[endif]]/[[mainTitle]]/[[method.selectorName]]"></uref>
|
||||
<uref url="[[method.methodName]]">[[method.selectorName]]</uref>]]
|
||||
[[comment +]]<method type="[[method.formattedReturnType]]" factory="yes">
|
||||
[[if method.argumentCount == 0]]
|
||||
<sel>[[method.selectorName]]</sel>
|
||||
[[else]]
|
||||
[[foreach arg method.arguments arg1]]
|
||||
[[if argIndex > 0]] [[endif]]
|
||||
<sel>[[arg.argName]]:</sel>
|
||||
<arg type="[[arg.argType]]">[[arg.varName]]</arg>
|
||||
[[endforeach arg1]]
|
||||
[[endif]]
|
||||
<desc>[[method.entityDescription.formattedCommentString]]</desc>
|
||||
</method>
|
||||
[[if methodIndex > 0]] [[comment Stop]] [[endif]]
|
||||
[[endforeach method1]]
|
||||
[[endif classMethods]]
|
||||
|
||||
|
||||
[[if mainInterface.instanceMethods.count > 0]]
|
||||
[[comment Instance Methods]]
|
||||
[[foreach method mainInterface.instanceMethods method1]]
|
||||
[[if methodIndex > 0]] [[comment Start]] [[endif]]
|
||||
[[comment <uref url="//apple_ref/occ/[[if mainInterface.interfaceTitle == Protocol]]intfm[[else]]instm[[endif]]/[[mainTitle]]/[[method.selectorName]]"></uref>
|
||||
<uref url="[[method.methodName]]">[[method.selectorName]]</uref>]]
|
||||
[[comment -]] <method type="[[method.formattedReturnType]]">
|
||||
[[if method.argumentCount == 0]]
|
||||
<sel>[[method.selectorName]]</sel>
|
||||
[[else]]
|
||||
[[foreach arg method.arguments arg1]]
|
||||
[[if argIndex > 0]] [[endif]]
|
||||
<sel>[[arg.argName]]:</sel>
|
||||
<arg type="[[arg.argType]]">[[arg.varName]]</arg>
|
||||
[[endforeach arg1]]
|
||||
[[endif]]
|
||||
<desc>[[method.entityDescription.formattedCommentString]]</desc>
|
||||
</method>
|
||||
[[if methodIndex > 0]] [[comment Stop]] [[endif]]
|
||||
[[endforeach method1]]
|
||||
[[endif instanceMethods]]
|
||||
|
||||
[[if mainInterface.interfaceTitle == Class]]
|
||||
</class>
|
||||
[[else]]
|
||||
[[if mainInterface.interfaceTitle == Category]]
|
||||
</category>
|
||||
[[else]]
|
||||
[[if mainInterface.interfaceTitle == Protocol]]
|
||||
</protocol>
|
||||
[[endif Category]]
|
||||
[[endif Category]]
|
||||
[[endif Class]]
|
||||
[[endif hasMainInterface]]
|
||||
|
||||
[[if hasMainInterface == 1]]
|
||||
</chapter>
|
||||
[[endif hasMainInterface == 1]]
|
||||
|
||||
|
||||
|
||||
|
||||
[[if typedefArray.count > 0]]
|
||||
<chapter id="#">
|
||||
<heading>Defined Types</heading>
|
||||
|
||||
[[foreach group typedefGroupArray group4]]
|
||||
[[foreach typedef group.itemArray typedef1]]
|
||||
[[comment <uref url="//apple_ref/c/tdef/[[typedef.name]]">[[typedef.name]]</uref>]]
|
||||
<type name="[[typedef.name]]">
|
||||
<typespec>[[typedef.formattedValue]][[typedef.suffixValue]]</typespec>
|
||||
[[if group.comment.commentString.length > 0]]
|
||||
<desc>
|
||||
[[group.comment.formattedCommentString]]
|
||||
</desc>
|
||||
[[endif commentLength]]
|
||||
</type>
|
||||
[[endforeach typedef1]]
|
||||
[[endforeach group4]]
|
||||
</chapter>
|
||||
[[endif typedefArray]]
|
||||
|
||||
|
||||
[[if constantArray.count > 0]]
|
||||
<chapter id="#">
|
||||
<heading>Symbolic Constants</heading>
|
||||
[[foreach group constantGroupArray group5]]
|
||||
[[foreach constant group.itemArray constant1]]
|
||||
[[comment <uref url="//apple_ref/c/econst/[[constant.name]]">[[constant.name]]</uref>]]
|
||||
<constant name="[[constant.name]]" value="[[constant.formattedValue]]">
|
||||
[[if group.comment.commentString.length > 0]]
|
||||
<desc>[[group.comment.formattedCommentString]]</desc>
|
||||
[[endif commentLength]]
|
||||
</constant>
|
||||
[[endforeach constant1]]
|
||||
[[endforeach group5]]
|
||||
</chapter>
|
||||
[[endif constantArray]]
|
||||
|
||||
|
||||
[[if macroArray.count > 0]]
|
||||
<chapter id="#">
|
||||
<heading>Macro Definitions</heading>
|
||||
[[foreach group macroGroupArray group2]]
|
||||
[[foreach macro group.itemArray macro1]]
|
||||
<macro name="[[macro.name]]">
|
||||
<arg>[[macro.parameterString]]</arg>
|
||||
[[if group.comment.commentString.length > 0]]
|
||||
<desc>[[group.comment.formattedCommentString]]</desc>
|
||||
[[endif commentLength]]
|
||||
</macro>
|
||||
[[endforeach macro1]]
|
||||
[[endforeach group2]]
|
||||
</chapter>
|
||||
[[endif macroArray]]
|
||||
|
||||
|
||||
[[if functionArray.count > 0]]
|
||||
<chapter id="#">
|
||||
<heading>Functions</heading>
|
||||
[[foreach group functionGroupArray group3]]
|
||||
[[foreach function group.itemArray function1]]
|
||||
[[comment <uref url="//apple_ref/c/func/[[function.name]]">[[function.name]]</uref>]]
|
||||
<function name="[[function.name]]" type="[[function.formattedType]]">
|
||||
<desc><p>[[function.formattedParameterString]]</p>
|
||||
[[if group.comment.commentString.length > 0]]
|
||||
<p>[[group.comment.formattedCommentString]]</p>
|
||||
[[endif commentLength]]</desc></function>
|
||||
[[endforeach function1]]
|
||||
[[endforeach group3]]
|
||||
</chapter>
|
||||
[[endif functionArray]]
|
||||
|
||||
|
||||
[[if inlineFunctionArray.count > 0]]
|
||||
<chapter id="#">
|
||||
<heading>Static Inline Functions</heading>
|
||||
[[foreach group inlineFunctionGroupArray group3]]
|
||||
[[foreach function group.itemArray function1]]
|
||||
[[comment <uref url="//apple_ref/c/func/[[function.name]]">[[function.name]]</uref>]]
|
||||
<function name="[[function.name]]" type="[[function.formattedType]]">
|
||||
<desc><p>[[function.formattedParameterString]]<</p>
|
||||
[[if group.comment.commentString.length > 0]]
|
||||
<p>[[group.comment.formattedCommentString]]</p>
|
||||
[[endif commentLength]]</desc></function>
|
||||
[[endforeach function1]]
|
||||
[[endforeach group3]]
|
||||
</chapter>
|
||||
[[endif inlineFunctionArray]]
|
||||
|
||||
|
||||
[[if variableArray.count > 0]]
|
||||
<chapter id="#">
|
||||
<heading>Global Variables</heading>
|
||||
[[foreach group variableGroupArray group6]]
|
||||
[[foreach global group.itemArray global1]]
|
||||
[[comment <uref url="//apple_ref/c/data/[[global.name]]">[[global.name]]</uref>]]
|
||||
<variable name="[[global.name]]" type="[[global.formattedType]]" posttype="[[global.posttype]]">
|
||||
[[if group.comment.commentString.length > 0]]
|
||||
<desc>[[group.comment.formattedCommentString]]</desc>
|
||||
[[endif commentLength]]
|
||||
</variable>
|
||||
[[endforeach global1]]
|
||||
[[endforeach group6]]
|
||||
</chapter>
|
||||
[[endif variableArray]]
|
||||
</body>
|
||||
</gsdoc>
|
||||
|
||||
|
47
Tools/BaseTools.gsdoc
Normal file
47
Tools/BaseTools.gsdoc
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.1//EN" "http://www.gnustep.org/gsdoc-1_0_1.xml">
|
||||
<gsdoc base="BaseTools">
|
||||
<head>
|
||||
<title>Base Tools</title>
|
||||
<author name="Richard Frith-MacDonald"/>
|
||||
<author name="and various others..."/>
|
||||
</head>
|
||||
<body>
|
||||
<chapter>
|
||||
<p>
|
||||
The Base Tools are command line utilities that come with the GNUstep
|
||||
base distribution.
|
||||
</p>
|
||||
<deflist>
|
||||
<term><ref type="tool" id="autogsdoc"/></term>
|
||||
<desc>
|
||||
Parses Objective-C source to autogenerate
|
||||
<uref url="gsdoc.html">GSDoc</uref>, and converts GSDoc to HTML.
|
||||
</desc>
|
||||
<term><ref type="tool" id="cvtenc"/></term>
|
||||
<desc>Converts text files between unicode and other encodings.</desc>
|
||||
<term><ref type="tool" id="defaults"/></term>
|
||||
<desc>Supports viewing/modification of GNUstep user defaults database.
|
||||
</desc>
|
||||
<term><ref type="tool" id="gdnc"/></term>
|
||||
<desc>GNUstep distributed notification center.</desc>
|
||||
<term><ref type="tool" id="pldes"/></term>
|
||||
<desc>Converts a binary serialized property list (class instance)
|
||||
to a text representation.</desc>
|
||||
<term><ref type="tool" id="plmerge"/></term>
|
||||
<desc>Merges text property lists into a single property list.</desc>
|
||||
<term><ref type="tool" id="plparse"/></term>
|
||||
<desc>Checks that each file contains a valid text representation
|
||||
of a property list.</desc>
|
||||
<term><ref type="tool" id="plser"/></term>
|
||||
<desc>Converts a text representation of a property list to a binary
|
||||
serialized representation..</desc>
|
||||
<term><ref type="tool" id="sfparse"/></term>
|
||||
<desc>Can verify strings-file format, and convert strings files
|
||||
between different encodings.</desc>
|
||||
<term><ref type="tool" id="xmlparse"/></term>
|
||||
<desc>A simple XML format verifier and DTD validator.</desc>
|
||||
</deflist>
|
||||
</chapter>
|
||||
</body>
|
||||
</gsdoc>
|
238
Tools/dread.m
238
Tools/dread.m
|
@ -1,238 +0,0 @@
|
|||
/* This is a simple tool to read and display defaults information
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Created: October 1997
|
||||
|
||||
This file is part of the GNUstep Project
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
NSArray *domains;
|
||||
NSString *owner = nil;
|
||||
NSString *name = nil;
|
||||
NSString *user = nil;
|
||||
BOOL found = NO;
|
||||
NSDictionary *locale;
|
||||
int i;
|
||||
|
||||
proc = [NSProcessInfo processInfo];
|
||||
if (proc == nil) {
|
||||
NSLog(@"unable to get process information!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
args = [proc arguments];
|
||||
|
||||
for (i = 1; i < [args count]; i++) {
|
||||
if ([[args objectAtIndex: i] isEqual: @"--help"]) {
|
||||
printf(
|
||||
"\nThe 'dread' command lets you to read a user's defaults database.\n"
|
||||
"WARNING - this program is obsolete - please use 'defaults read' instead.\n\n"
|
||||
"Results are printed on standard output in a format suitable for input to\n"
|
||||
"the 'dwrite' command. The value of each default is quoted with \"'\" and\n"
|
||||
"may wrap over line boundaries.\n"
|
||||
"Single quotes used within a default value are repeated.\n\n"
|
||||
"If you have read access to another user's defaults database, you may include\n"
|
||||
"the '-u' flag to read that user's database rather than your own.\n\n");
|
||||
printf(
|
||||
"dread [-u uname] -g key\n"
|
||||
" read the named default from the global domain.\n\n");
|
||||
printf(
|
||||
"dread [-u uname] -l\n"
|
||||
" read all defaults from all domains.\n\n");
|
||||
printf(
|
||||
"dread [-u uname] -n key\n"
|
||||
" read values named 'key' from all domains.\n\n");
|
||||
printf(
|
||||
"dread [-u uname] -o domain\n"
|
||||
" read all defaults from the specified domain.\n\n");
|
||||
printf(
|
||||
"dread [-u uname] domain key\n"
|
||||
" read default with name 'key' from domain 'domain'.\n\n");
|
||||
printf(
|
||||
"dread [-u uname] key\n"
|
||||
" read default named 'key' from the global domain.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
i = 1;
|
||||
if ([args count] <= i) {
|
||||
NSLog(@"too few arguments supplied!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if ([[args objectAtIndex: i] isEqual: @"-u"]) {
|
||||
if ([args count] > ++i) {
|
||||
user = [args objectAtIndex: i++];
|
||||
}
|
||||
else {
|
||||
NSLog(@"no name supplied for -u option!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
if ([args count] <= i) {
|
||||
NSLog(@"too few arguments supplied!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if ([[args objectAtIndex: i] isEqual: @"-g"]) {
|
||||
owner = NSGlobalDomain;
|
||||
if ([args count] > ++i) {
|
||||
name = [args objectAtIndex: i];
|
||||
}
|
||||
else {
|
||||
NSLog(@"no key supplied for -g option!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
else if ([[args objectAtIndex: i] isEqual: @"-n"]) {
|
||||
owner = nil;
|
||||
if ([args count] > ++i) {
|
||||
name = [args objectAtIndex: i];
|
||||
}
|
||||
else {
|
||||
NSLog(@"no key supplied for -n option!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
else if ([[args objectAtIndex: i] isEqual: @"-o"]) {
|
||||
name = nil;
|
||||
if ([args count] > ++i) {
|
||||
owner = [args objectAtIndex: i];
|
||||
}
|
||||
else {
|
||||
NSLog(@"no domain name supplied for -o option!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
else if ([[args objectAtIndex: i] isEqual: @"-l"]) {
|
||||
owner = nil;
|
||||
name = nil;
|
||||
}
|
||||
else {
|
||||
if ([args count] > i+1) {
|
||||
owner = [args objectAtIndex: i];
|
||||
name = [args objectAtIndex: ++i];
|
||||
}
|
||||
else {
|
||||
owner = NSGlobalDomain;
|
||||
name = [args objectAtIndex: i];
|
||||
}
|
||||
}
|
||||
|
||||
if (user) {
|
||||
defs = [[NSUserDefaults alloc] initWithUser: user];
|
||||
}
|
||||
else {
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
}
|
||||
if (defs == nil) {
|
||||
NSLog(@"unable to access defaults database!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
/* We don't want dwrite in the defaults database - so remove it. */
|
||||
[defs removePersistentDomainForName: [proc processName]];
|
||||
|
||||
locale = [defs dictionaryRepresentation];
|
||||
domains = [defs persistentDomainNames];
|
||||
for (i = 0; i < [domains count]; i++) {
|
||||
NSString *domainName = [domains objectAtIndex: i];
|
||||
|
||||
if (owner == nil || [owner isEqual: domainName]) {
|
||||
NSDictionary *dom;
|
||||
|
||||
dom = [defs persistentDomainForName: domainName];
|
||||
if (dom) {
|
||||
if (name == nil) {
|
||||
NSEnumerator *enumerator;
|
||||
NSString *key;
|
||||
|
||||
enumerator = [dom keyEnumerator];
|
||||
while ((key = [enumerator nextObject]) != nil) {
|
||||
id obj = [dom objectForKey: key];
|
||||
const char *ptr;
|
||||
|
||||
printf("%s %s '", [domainName cString], [key cString]);
|
||||
ptr = [[obj descriptionWithLocale: locale indent: 0]
|
||||
cString];
|
||||
while (*ptr) {
|
||||
if (*ptr == '\'') {
|
||||
putchar('\'');
|
||||
}
|
||||
putchar(*ptr);
|
||||
ptr++;
|
||||
}
|
||||
printf("'\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
id obj = [dom objectForKey: name];
|
||||
|
||||
if (obj) {
|
||||
const char *ptr;
|
||||
|
||||
printf("%s %s '", [domainName cString], [name cString]);
|
||||
ptr = [[obj descriptionWithLocale: locale indent: 0]
|
||||
cString];
|
||||
while (*ptr) {
|
||||
if (*ptr == '\'') {
|
||||
putchar('\'');
|
||||
}
|
||||
putchar(*ptr);
|
||||
ptr++;
|
||||
}
|
||||
printf("'\n");
|
||||
found = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found == NO && name != nil) {
|
||||
printf("dread: couldn't read default\n");
|
||||
}
|
||||
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
221
Tools/dremove.m
221
Tools/dremove.m
|
@ -1,221 +0,0 @@
|
|||
/* This is a simple tool to remove defaults information
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Created: October 1997
|
||||
|
||||
This file is part of the GNUstep Project
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
NSMutableDictionary *domain;
|
||||
NSString *owner;
|
||||
NSString *name;
|
||||
NSString *user = nil;
|
||||
int i;
|
||||
|
||||
proc = [NSProcessInfo processInfo];
|
||||
if (proc == nil) {
|
||||
NSLog(@"unable to get process information!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
args = [proc arguments];
|
||||
|
||||
for (i = 1; i < [args count]; i++) {
|
||||
if ([[args objectAtIndex: i] isEqual: @"--help"]) {
|
||||
printf(
|
||||
"The 'dremove' command lets you delete entries in a user's defaults database.\n"
|
||||
"WARNING - this program is obsolete - please use 'defaults delete' instead.\n\n"
|
||||
"The value written must be a property list and must be enclosed in quotes.\n"
|
||||
"If you have write access to another user's database, you may include\n"
|
||||
"the '-u' flag to modify that user's database rather than your own.\n\n");
|
||||
printf(
|
||||
"dremove [-u uname] -g key\n"
|
||||
" removed the named default to the global domain.\n\n");
|
||||
printf(
|
||||
"dremove [-u uname] -o domain\n"
|
||||
" removed the named domain and all its contents.\n\n");
|
||||
printf(
|
||||
"dremove [-u uname] domain key\n"
|
||||
" remove default with name 'key' from domain 'domain'.\n\n");
|
||||
printf(
|
||||
"dremove\n"
|
||||
" read the standard input for a series of lines listing domain name and\n"
|
||||
" default key pairs to be removed. Domain names and default keys must be\n"
|
||||
" separated by spaces.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
i = 1;
|
||||
if ([args count] > i && [[args objectAtIndex: i] isEqual: @"-u"]) {
|
||||
if ([args count] > ++i) {
|
||||
user = [args objectAtIndex: i++];
|
||||
}
|
||||
else {
|
||||
NSLog(@"no name supplied for -u option!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
if (user) {
|
||||
defs = [[NSUserDefaults alloc] initWithUser: user];
|
||||
}
|
||||
else {
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
}
|
||||
if (defs == nil) {
|
||||
NSLog(@"unable to access defaults database!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if ([args count] == i) {
|
||||
char buf[BUFSIZ*10];
|
||||
|
||||
while (fgets(buf, sizeof(buf), stdin) != 0) {
|
||||
char *ptr;
|
||||
char *start;
|
||||
|
||||
start = buf;
|
||||
|
||||
ptr = start;
|
||||
while (*ptr && !isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*ptr) {
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
while (isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*start == '\0') {
|
||||
printf("dremove: invalid input\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
owner = [NSString stringWithCString: start];
|
||||
start = ptr;
|
||||
|
||||
ptr = start;
|
||||
while (*ptr && !isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*ptr) {
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
while (isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*start == '\0') {
|
||||
printf("dremove: invalid input\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
name = [NSString stringWithCString: start];
|
||||
domain = [[defs persistentDomainForName: owner] mutableCopy];
|
||||
if (domain == nil || [domain objectForKey: name] == nil) {
|
||||
printf("dremove: couldn't remove %s owned by %s\n",
|
||||
[name cString], [owner cString]);
|
||||
}
|
||||
else {
|
||||
[domain removeObjectForKey: name];
|
||||
[defs setPersistentDomain: domain forName: owner];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([[args objectAtIndex: i] isEqual: @"-g"]) {
|
||||
owner = NSGlobalDomain;
|
||||
if ([args count] > ++i) {
|
||||
name = [args objectAtIndex: i];
|
||||
}
|
||||
else {
|
||||
NSLog(@"no key supplied for -g option.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
domain = [[defs persistentDomainForName: owner] mutableCopy];
|
||||
if (domain == nil || [domain objectForKey: name] == nil) {
|
||||
printf("dremove: couldn't remove %s owned by %s\n",
|
||||
[name cString], [owner cString]);
|
||||
}
|
||||
else {
|
||||
[domain removeObjectForKey: name];
|
||||
[defs setPersistentDomain: domain forName: owner];
|
||||
}
|
||||
}
|
||||
else if ([[args objectAtIndex: i] isEqual: @"-o"]) {
|
||||
if ([args count] > ++i) {
|
||||
owner = [args objectAtIndex: i];
|
||||
}
|
||||
else {
|
||||
NSLog(@"no domain supplied for -o option.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
[defs removePersistentDomainForName: owner];
|
||||
}
|
||||
else {
|
||||
if ([args count] > i+1) {
|
||||
owner = [args objectAtIndex: i];
|
||||
name = [args objectAtIndex: ++i];
|
||||
domain = [[defs persistentDomainForName: owner] mutableCopy];
|
||||
if (domain == nil || [domain objectForKey: name] == nil) {
|
||||
printf("dremove: couldn't remove %s owned by %s\n",
|
||||
[name cString], [owner cString]);
|
||||
}
|
||||
else {
|
||||
[domain removeObjectForKey: name];
|
||||
[defs setPersistentDomain: domain forName: owner];
|
||||
}
|
||||
}
|
||||
else {
|
||||
NSLog(@"got app name '%s' but no variable name.\n",
|
||||
[[args objectAtIndex: 0] cString]);
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
/* We don't want dremove in the defaults database - so remove it. */
|
||||
[defs removePersistentDomainForName: [proc processName]];
|
||||
if ([defs synchronize] == NO) {
|
||||
NSLog(@"unable to write to defaults database - %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
314
Tools/dwrite.m
314
Tools/dwrite.m
|
@ -1,314 +0,0 @@
|
|||
/* This is a simple tool to write defaults information to the database
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Created: October 1997
|
||||
|
||||
This file is part of the GNUstep Project
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSUserDefaults *defs;
|
||||
NSProcessInfo *proc;
|
||||
NSArray *args;
|
||||
NSMutableDictionary *domain;
|
||||
NSString *owner;
|
||||
NSString *name;
|
||||
NSString *value;
|
||||
NSString *user = nil;
|
||||
const char *text;
|
||||
const char *str;
|
||||
id obj = nil;
|
||||
int i;
|
||||
|
||||
proc = [NSProcessInfo processInfo];
|
||||
if (proc == nil) {
|
||||
NSLog(@"unable to get process information!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
args = [proc arguments];
|
||||
|
||||
for (i = 1; i < [args count]; i++) {
|
||||
if ([[args objectAtIndex: i] isEqual: @"--help"]) {
|
||||
printf(
|
||||
"The 'dwrite' command lets you modify a user's defaults database.\n"
|
||||
"WARNING - this program is obsolete - please use 'defaults write' instead.\n\n"
|
||||
"The value written must be a property list and (if being read from standard\n"
|
||||
"input) must be enclosed in single quotes unless it is a simple alphanumeric\n"
|
||||
"string.\n"
|
||||
"Quotes appearing inside a quoted property list must be repeated to avoid\n"
|
||||
"their being interpreted as the end of the property list.\n"
|
||||
"If you have write access to another user's database, you may include\n"
|
||||
"the '-u' flag to modify that user's database rather than your own.\n\n");
|
||||
printf(
|
||||
"dwrite [-u uname] -g key value\n"
|
||||
" write the named default to the global domain.\n\n");
|
||||
printf(
|
||||
"dwrite [-u uname] domain key value\n"
|
||||
" write default with name 'key' to domain 'domain'.\n\n");
|
||||
printf(
|
||||
"dwrite\n"
|
||||
" read the standard input for a series of lines listing defaults to be\n"
|
||||
" written. Domain names, default keys, and default values must be\n"
|
||||
" separated on each line by spaces.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
i = 1;
|
||||
if ([args count] > i && [[args objectAtIndex: i] isEqual: @"-u"]) {
|
||||
if ([args count] > ++i) {
|
||||
user = [args objectAtIndex: i++];
|
||||
}
|
||||
else {
|
||||
NSLog(@"no name supplied for -u option!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
if (user) {
|
||||
defs = [[NSUserDefaults alloc] initWithUser: user];
|
||||
}
|
||||
else {
|
||||
defs = [NSUserDefaults standardUserDefaults];
|
||||
}
|
||||
if (defs == nil) {
|
||||
NSLog(@"unable to access defaults database!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
/* We don't want dwrite in the defaults database - so remove it. */
|
||||
[defs removePersistentDomainForName: [proc processName]];
|
||||
|
||||
if ([args count] == i) {
|
||||
char buf[BUFSIZ*10];
|
||||
|
||||
while (fgets(buf, sizeof(buf), stdin) != 0) {
|
||||
char *ptr;
|
||||
char *start;
|
||||
|
||||
obj = nil;
|
||||
start = buf;
|
||||
|
||||
ptr = start;
|
||||
while (*ptr && !isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*ptr) {
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
while (isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*start == '\0') {
|
||||
printf("dwrite: invalid input - nul domain name\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
for (str = start; *str; str++) {
|
||||
if (isspace(*str)) {
|
||||
printf("dwrite: invalid input - space in domain name.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
owner = [NSString stringWithCString: start];
|
||||
start = ptr;
|
||||
|
||||
ptr = start;
|
||||
while (*ptr && !isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*ptr) {
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
while (isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*start == '\0') {
|
||||
printf("dwrite: invalid input - nul default name.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
for (str = start; *str; str++) {
|
||||
if (isspace(*str)) {
|
||||
printf("dwrite: invalid input - space in default name.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
name = [NSString stringWithCString: start];
|
||||
start = ptr;
|
||||
|
||||
if (*start == '\'') {
|
||||
for (ptr = ++start; ; ptr++) {
|
||||
if (*ptr == '\0') {
|
||||
if (fgets(ptr, sizeof(buf) - (ptr-buf), stdin) == 0) {
|
||||
printf("dwrite: invalid input - no final quote.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
if (*ptr == '\'') {
|
||||
if (ptr[1] == '\'') {
|
||||
strcpy(ptr, &ptr[1]);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ptr = start;
|
||||
while (*ptr && !isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
if (obj == nil) {
|
||||
if (*ptr) {
|
||||
*ptr++ = '\0';
|
||||
}
|
||||
if (*start == '\0') {
|
||||
printf("dwrite: invalid input - empty property list\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
obj = [NSString stringWithCString: start];
|
||||
if (*start == '(' || *start == '{' || *start == '<') {
|
||||
id tmp = [obj propertyList];
|
||||
|
||||
if (tmp == nil) {
|
||||
printf("dwrite: invalid input - bad property list\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
else {
|
||||
obj = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
domain = [[defs persistentDomainForName: owner] mutableCopy];
|
||||
if (domain == nil) {
|
||||
domain = [NSMutableDictionary dictionaryWithCapacity:1];
|
||||
}
|
||||
[domain setObject: obj forKey: name];
|
||||
[defs setPersistentDomain: domain forName: owner];
|
||||
}
|
||||
}
|
||||
else if ([[args objectAtIndex: i] isEqual: @"-g"]) {
|
||||
if ([args count] > i+2) {
|
||||
owner = NSGlobalDomain;
|
||||
name = [args objectAtIndex: ++i];
|
||||
for (str = [name cString]; *str; str++) {
|
||||
if (isspace(*str)) {
|
||||
printf("dwrite: invalid input - space in default name.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
value = [args objectAtIndex: ++i];
|
||||
text = [value cString];
|
||||
if (*text == '(' || *text == '{' || *text == '<') {
|
||||
obj = [value propertyList];
|
||||
}
|
||||
else {
|
||||
obj = value;
|
||||
}
|
||||
if (obj == nil) {
|
||||
printf("dwrite: invalid input - bad property list\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
domain = [[defs persistentDomainForName: owner] mutableCopy];
|
||||
if (domain == nil) {
|
||||
domain = [NSMutableDictionary dictionaryWithCapacity:1];
|
||||
}
|
||||
[domain setObject: obj forKey: name];
|
||||
[defs setPersistentDomain: domain forName: owner];
|
||||
}
|
||||
else {
|
||||
NSLog(@"too few arguments supplied!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ([args count] > i+2) {
|
||||
owner = [args objectAtIndex: i];
|
||||
for (str = [owner cString]; *str; str++) {
|
||||
if (isspace(*str)) {
|
||||
printf("dwrite: invalid input - space in domain name.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
name = [args objectAtIndex: ++i];
|
||||
for (str = [name cString]; *str; str++) {
|
||||
if (isspace(*str)) {
|
||||
printf("dwrite: invalid input - space in default name.\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
value = [args objectAtIndex: ++i];
|
||||
text = [value cString];
|
||||
if (*text == '(' || *text == '{' || *text == '<') {
|
||||
obj = [value propertyList];
|
||||
}
|
||||
else {
|
||||
obj = value;
|
||||
}
|
||||
if (obj == nil) {
|
||||
printf("dwrite: invalid input - bad property list\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
domain = [[defs persistentDomainForName: owner] mutableCopy];
|
||||
if (domain == nil) {
|
||||
domain = [NSMutableDictionary dictionaryWithCapacity:1];
|
||||
}
|
||||
[domain setObject: obj forKey: name];
|
||||
[defs setPersistentDomain: domain forName: owner];
|
||||
}
|
||||
else {
|
||||
NSLog(@"too few arguments supplied!\n");
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
[defs synchronize];
|
||||
|
||||
[pool release];
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -1,408 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.5//EN" "http://www.gnustep.org/gsdoc-0_6_5.xml">
|
||||
<gsdoc base="gnustep">
|
||||
<head>
|
||||
<title>GNUstep Time Zone Reference</title>
|
||||
<author name="Yoo C. Chung">
|
||||
<email address="wacko@laplace.snu.ac.kr"/>
|
||||
<url url="http://plaza.snu.ac.kr/~wacko/"/>
|
||||
<desc>
|
||||
A person who has very little spare time, and spends it on
|
||||
stuff like GNUstep, anime fanfics, and games.
|
||||
</desc>
|
||||
</author>
|
||||
<author name="Skuld">
|
||||
<email address="skuld@yggdrasil.heaven.org"/>
|
||||
<url url="http://yggdrasil.heaven.org/skuld/"/>
|
||||
<desc>
|
||||
The goddess of the future, who will watch and guide me in my
|
||||
hunt for bugs. May all bow before her divinity.
|
||||
</desc>
|
||||
</author>
|
||||
<version>0.1</version>
|
||||
<date>6 June, 1997</date>
|
||||
<abstract>
|
||||
This documents the interface to the time zone classes in the
|
||||
GNUstep Base Library.
|
||||
</abstract>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<front>
|
||||
<contents/>
|
||||
|
||||
<chapter>
|
||||
<heading>Preface</heading>
|
||||
|
||||
<p>
|
||||
This documents the interface to the time zone classes.
|
||||
These classes are needed for proper adjustment of the local
|
||||
time in each geographical region.
|
||||
</p>
|
||||
<p>
|
||||
This is also an example, as well as a test case, of the new
|
||||
GNUstep Documentation Markup Language (GDML).
|
||||
</p>
|
||||
</chapter>
|
||||
</front>
|
||||
|
||||
<chapter>
|
||||
<heading>The Time Zone Management Classes</heading>
|
||||
|
||||
<p>
|
||||
The classes <code>NSTimeZone</code> and <code>NSTimeZoneDetail</code>
|
||||
are used to manage time zones. They are declared in
|
||||
<file>Foundation/NSDate.h</file>.
|
||||
</p>
|
||||
<p>
|
||||
<code>NSTimeZone</code> is used to specify the time zone region,
|
||||
while <code>NSTimeZoneDetail</code> is used to actually obtain the
|
||||
difference in seconds from UTC<footnote>Universal
|
||||
Coordinated Time.</footnote> that a time zone has for a certain date.
|
||||
</p>
|
||||
<class name="NSTimeZone" super="NSObject">
|
||||
|
||||
<desc>
|
||||
<p>
|
||||
The world is divided into separate time zones because
|
||||
the sun rises at different times. We really should all
|
||||
move underground and match our clocks. However,
|
||||
since this is currently not the case, our computers need
|
||||
a way to find the offset from a single agreed upon time
|
||||
and use that in local time calculations.
|
||||
</p>
|
||||
<p>
|
||||
To make things even worse, there is this evil thing
|
||||
called daylight saving time, which is usually used for
|
||||
the purpose of utilizing as much of the sun as possible
|
||||
while it is still up. (Really, everyone should stay in
|
||||
their rooms and play with their computers, but for some
|
||||
reason they don't &dots;)
|
||||
</p>
|
||||
<p>
|
||||
Therefore we need an object that knows about a time zone
|
||||
so that the appropriate object that knows all about
|
||||
offsets from UTC and whether it's daylight saving time
|
||||
for a certain date can be obtained. <code>NSTimeZone</code>
|
||||
is a class that can create such objects.
|
||||
</p>
|
||||
</desc>
|
||||
|
||||
<method factory="yes" type="NSTimeZoneDetail*">
|
||||
<sel>defaultTimeZone</sel>
|
||||
|
||||
<desc>
|
||||
Returns the time zone detail (see <ref type="class"
|
||||
id="NSTimeZoneDetail"/>) for the current time.
|
||||
</desc>
|
||||
</method>
|
||||
<method factory="yes" type="NSTimeZone*">
|
||||
<sel>localTimeZone</sel>
|
||||
|
||||
<desc>
|
||||
Returns the time zone for the local region. The local
|
||||
region is either specified with the <code>TZ</code>
|
||||
environment variable, or is specified at compile time,
|
||||
with the former taking precedence.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method factory="yes" type="NSTimeZone*">
|
||||
<sel>timeZoneForSecondsFromGMT:</sel>
|
||||
<arg type="int">seconds</arg>
|
||||
|
||||
<desc>
|
||||
Returns a time zone which is always <var>seconds</var>
|
||||
seconds off from UTC. (In OpenStep the offset is from
|
||||
GMT<footnote>Greenwich Mean Time.</footnote>, but using UTC makes
|
||||
more sense.)
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method factory="yes" type="NSTimeZoneDetail*">
|
||||
<sel>timeZoneWithAbbreviation:</sel>
|
||||
<arg type="NSString*">abbreviation</arg>
|
||||
|
||||
<desc>
|
||||
Returns a time zone detail for which the time zone
|
||||
abbreviation is <var>abbreviation</var>. Note that there can
|
||||
be many time zone details for a single abbreviation.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method factory="yes" type="NSTimeZone*">
|
||||
<sel>timeZoneWithName:</sel>
|
||||
<arg type="NSString*">aTimeZoneName</arg>
|
||||
|
||||
<desc>
|
||||
Returns a time zone for the geographical region
|
||||
specified by <var>aTimeZoneName</var>.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method type="NSTimeZoneDetail*">
|
||||
<sel>timeZoneDetailForDate:</sel>
|
||||
<arg type="NSDate*">date</arg>
|
||||
|
||||
<desc>
|
||||
Returns the appropriate time zone detail for the time
|
||||
zone and the given date <var>date</var>.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method factory="yes" type="void">
|
||||
<sel>setDefaultTimeZone:</sel>
|
||||
<arg type="NSTimeZone*">aTimeZone</arg>
|
||||
|
||||
<desc>
|
||||
Set the default time zone used for time calculation to
|
||||
the time zone specified by the string <var>aTimeZone</var>.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method factory="yes" type="NSDictionary*">
|
||||
<sel>abbreviationDictionary</sel>
|
||||
|
||||
<desc>
|
||||
Returns a dictionary that maps a time zone abbreviation
|
||||
to a single arbitrary time zone name.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method factory="yes" type="NSDictionary*">
|
||||
<sel>abbreviationMap</sel>
|
||||
|
||||
<desc>
|
||||
<p>
|
||||
Returns a dictionary that maps a time zone
|
||||
abbreviation to an array that holds all the time zone
|
||||
names that use the abbreviation.
|
||||
</p>
|
||||
<p>
|
||||
This is a GNU extension, and is not defined by
|
||||
OpenStep.
|
||||
</p>
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method type="NSString*">
|
||||
<sel>timeZoneName</sel>
|
||||
|
||||
<desc>
|
||||
Returns the name for the time zone.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method factory="yes" type="NSArray*">
|
||||
<sel>timeZoneArray</sel>
|
||||
|
||||
<desc>
|
||||
<p>
|
||||
Returns an array containing 24 arrays that in turn
|
||||
contain the time zone names that are grouped according
|
||||
to the offset from UTC. For example, a time zone that
|
||||
has an offset of 5 hours (or -19 hours) goes into the
|
||||
fifth array in the array.
|
||||
</p>
|
||||
<p>
|
||||
Note that OpenStep groups them by latitudinal region,
|
||||
and the exact details of the grouping is not
|
||||
specified.
|
||||
</p>
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method type="NSArray*">
|
||||
<sel>timeZoneDetailArray</sel>
|
||||
|
||||
<desc>
|
||||
This returns an array containing all the possible time
|
||||
zone details for the time zone.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<standards><OpenStep/><GNUstep/></standards>
|
||||
|
||||
</class>
|
||||
|
||||
<class name="NSTimeZoneDetail" super="NSTimeZone">
|
||||
|
||||
<desc>
|
||||
<p>
|
||||
A time zone doesn't know the actual offset from UTC that
|
||||
a certain region has, since the offset is not always the
|
||||
same because of changes in time rules and such. Since
|
||||
the details are different for different dates,
|
||||
<code>NSTimeZone</code> must return an object that details the
|
||||
time zone for a specific date. <code>NSTimeZoneDetail</code>
|
||||
is the class for such objects.
|
||||
</p>
|
||||
<p>
|
||||
It is from <code>NSTimeZoneDetail</code> that we obtain the
|
||||
actual offsets from UTC. In addition, we can obtain the
|
||||
time zone abbreviation (which is also dependent on the
|
||||
date) and whether the time zone uses daylight saving
|
||||
time for the date on which the time zone detail was
|
||||
created.
|
||||
</p>
|
||||
</desc>
|
||||
|
||||
<method type="BOOL">
|
||||
<sel>isDaylightSavingTimeZone</sel>
|
||||
|
||||
<desc>
|
||||
If the time zone detail describes a time zone for which
|
||||
the date the detail was created for is daylight saving
|
||||
time, return <code>YES</code>, else return <code>NO</code>.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method type="NSString*">
|
||||
<sel>timeZoneAbbreviation</sel>
|
||||
|
||||
<desc>
|
||||
Returns the abbreviation for the time zone detail.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method type="int">
|
||||
<sel>timeZoneSecondsFromGMT</sel>
|
||||
|
||||
<desc>
|
||||
<p>
|
||||
Returns the offset from UTC for local time in seconds.
|
||||
</p>
|
||||
<p>
|
||||
Note that OpenStep specifies an offset from GMT to be
|
||||
returned, but using UTC makes more sense.
|
||||
</p>
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<standards><OpenStep/><GNUstep></standards>
|
||||
</class>
|
||||
</chapter>
|
||||
<back>
|
||||
<chapter>
|
||||
<heading>Afterword</heading>
|
||||
<p>
|
||||
Hopefully, this document shows that GDML is indeed useful
|
||||
for writing documentation for GNUstep.
|
||||
</p>
|
||||
<p>
|
||||
Even if it is not, it should still be useful since it
|
||||
documents the interface to the time zone classes, and should
|
||||
easily be converted to other text markup formats.
|
||||
</p>
|
||||
<p>
|
||||
Please send any questions about the DTD or this document to
|
||||
<email address="wacko@laplace.snu.ac.kr"/>.
|
||||
</p>
|
||||
<p>
|
||||
And by the way, I've tried out the time zone implementation
|
||||
in the GNUstep Base Library and it seems to work for the
|
||||
following time zone regions:
|
||||
</p>
|
||||
<list>
|
||||
<item>Asia/Seoul</item>
|
||||
<item>US/Eastern</item>
|
||||
<item>America/Los_Angeles</item>
|
||||
</list>
|
||||
|
||||
<p>
|
||||
And here's a small incomplete class definition with somewhat
|
||||
longer method names.
|
||||
</p>
|
||||
|
||||
<class name="NSObject">
|
||||
<conform>NSObject</conform>
|
||||
<conform>NSCoding</conform>
|
||||
<conform>NSCopying</conform>
|
||||
|
||||
<desc>
|
||||
A superclass of all classes.
|
||||
</desc>
|
||||
|
||||
<method>
|
||||
<sel>perform:</sel>
|
||||
<arg type="sel">aSelector </arg>
|
||||
<sel>withObject:</sel>
|
||||
<arg>object1</arg>
|
||||
<sel>withObject:</sel>
|
||||
<arg>object2</arg>
|
||||
|
||||
<desc>
|
||||
This should really go into a protocol definition, but I
|
||||
wanted to show a class definition with protocols.
|
||||
</desc>
|
||||
</method>
|
||||
|
||||
<method type="NSString*">
|
||||
<sel>stringWithFormat:</sel>
|
||||
<arg type="NSString*">format</arg>
|
||||
<vararg/>
|
||||
|
||||
<desc>
|
||||
This is not in <code>NSObject</code>, but I wanted to show the
|
||||
use of a variable argument list.
|
||||
</desc>
|
||||
</method>
|
||||
</class>
|
||||
|
||||
<p>
|
||||
And here's an example:
|
||||
</p>
|
||||
<example>
|
||||
int
|
||||
function (void *ptr)
|
||||
{
|
||||
return realloc(ptr, 100);
|
||||
}
|
||||
</example>
|
||||
|
||||
<p>
|
||||
And here is a macro definition:
|
||||
</p>
|
||||
|
||||
<macro name="MAX">
|
||||
<arg>a</arg>
|
||||
<arg>b</arg>
|
||||
<desc>
|
||||
Return the larger between <var>a</var> and <var>b</var>.
|
||||
</desc>
|
||||
<standards><GNUstep/></standards>
|
||||
</macro>
|
||||
|
||||
<macro name="NS_DURING">
|
||||
<desc>
|
||||
Start an exception handling domain.
|
||||
</desc>
|
||||
</macro>
|
||||
|
||||
<p>
|
||||
And here is a type definition:
|
||||
</p>
|
||||
<type name="NSTimeInterval">
|
||||
<typespec>double</typespec>
|
||||
<desc>
|
||||
Used to save intervals between certain times in seconds.
|
||||
</desc>
|
||||
</type>
|
||||
|
||||
<p>
|
||||
And here is a function definition:
|
||||
</p>
|
||||
<function name="NSZoneMalloc" type="void*">
|
||||
<arg type="NSZone*">zone</arg>
|
||||
<arg type="size_t">size</arg>
|
||||
<desc>
|
||||
Allocate <var>size</var> bytes from the dynamic memory
|
||||
allocation zone <var>zone</var>.
|
||||
</desc>
|
||||
<standards><OpenStep/><GNUstep/></standards>
|
||||
</function>
|
||||
</chapter>
|
||||
<index type="class"/>
|
||||
</back>
|
||||
</body>
|
||||
</gsdoc>
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding='ISO-8859-1'?>
|
||||
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "/usr/GNUstep/System/Libraries/Resources/DTDs/gsdoc-0_6_6.dtd">
|
||||
<gsdoc base="[[indexBaseFileName]]" next="[[next]]" up="[[infoDictionary.up]]" stylesheeturl="[[infoDictionary.stylesheeturl]]">
|
||||
<head>
|
||||
<title>[[projectName]]</title>
|
||||
<author name="[[infoDictionary.authorName]]">
|
||||
<email address="[[infoDictionary.authorEMail]]"/>
|
||||
<url url="[[infoDictionary.authorURL]]"/>
|
||||
<desc>[[infoDictionary.authorDesc]]</desc>
|
||||
</author>
|
||||
<version>[[infoDictionary.version]]</version>
|
||||
<date>[[infoDictionary.date]] [[timestampString]]</date>
|
||||
<abstract>
|
||||
[<uref url="[[indexFileName]]">Source : [[indexFileName]]</uref>] <uref url="http://www.gnustep.org/gsdoc.xml">DTD</uref>]
|
||||
</abstract>
|
||||
<copy>[[infoDictionary.copyright]]</copy>
|
||||
</head>
|
||||
<body>
|
||||
[[content]]
|
||||
</body>
|
||||
</gsdoc>
|
||||
|
||||
|
Loading…
Reference in a new issue