Many GSXML tidyups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13687 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-05-22 14:23:17 +00:00
parent f1ae195f0f
commit adc2057983
10 changed files with 555 additions and 746 deletions

View file

@ -1,6 +1,17 @@
2002-05-22 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSeq.h: Fix bug matching sequences with zero length range.
* Headers/gnustep/base/GSMime.h: Tell autogsdoc where to look for source
* Headers/gnustep/base/GSXML.h: Updates for consistency etc.
* Source/Additions/GSXML.m: ditto
* Tools/AGSHtml.m: Modified for changed GSXML
* Tools/AGSIndex.m: ditto
* Tools/AGSParser.m: ditto
* Tools/autogsdoc.m: ditto
* Tools/defaults.m: Fixed typo
Mostly, changes to make methods which were intended to be private
really private, and lots of modifications to make mathod names
consistent with OpenStep usage ... suggestions made by many people.
2002-05-15 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -22,6 +22,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
AutogsdocSource: Additions/GSMime.m
*/
#ifndef __GSMIME_H__

View file

@ -1,4 +1,4 @@
/* Interface for XML parsing classes
/** Interface for XML parsing classes
Copyright (C) 2000 Free Software Foundation, Inc.
@ -25,6 +25,9 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
AutogsdocSource: Additions/GSXML.m
*/
#ifndef __GSXML_H__
@ -46,18 +49,14 @@
@interface GSXMLDocument : NSObject <NSCopying>
{
void *lib; // pointer to xmllib pointer of xmlDoc struct
BOOL native;
void *lib; // pointer to xmllib pointer of xmlDoc struct
BOOL ownsLib;
}
+ (GSXMLDocument*) documentFrom: (void*)data;
+ (GSXMLDocument*) documentWithVersion: (NSString*)version;
- (NSString*) description;
- (NSString*) encoding;
- (id) initFrom: (void*)data;
- (id) initWithVersion: (NSString*)version;
- (void*) lib;
- (GSXMLNode*) makeNodeWithNamespace: (GSXMLNamespace*)ns
@ -79,21 +78,12 @@
@interface GSXMLNamespace : NSObject <NSCopying>
{
void *lib; /* pointer to struct xmlNs in the gnome xmllib */
BOOL native;
}
+ (NSString*) descriptionFromType: (int)type;
+ (GSXMLNamespace*) namespaceFrom: (void*)data;
+ (GSXMLNamespace*) namespaceWithNode: (GSXMLNode*)node
href: (NSString*)href
prefix: (NSString*)prefix;
+ (int) typeFromDescription: (NSString*)desc;
- (NSString*) href;
- (id) initFrom: (void*)data;
- (id) initWithNode: (GSXMLNode*)node
href: (NSString*)href
prefix: (NSString*)prefix;
- (void*) lib;
- (GSXMLNamespace*) next;
@ -108,24 +98,25 @@
@interface GSXMLNode : NSObject <NSCopying>
{
void *lib; /* pointer to struct xmlNode from libxml */
BOOL native;
}
+ (NSString*) descriptionFromType: (int)type;
+ (GSXMLNode*) nodeFrom: (void*) data;
+ (GSXMLNode*) nodeWithNamespace: (GSXMLNamespace*)ns name: (NSString*)name;
+ (int) typeFromDescription: (NSString*)desc;
- (GSXMLNode*) childElement;
- (GSXMLNode*) children;
- (NSDictionary*) attributes;
- (NSString*) content;
- (GSXMLDocument*) doc;
- (id) initFrom: (void*) data;
- (id) initWithNamespace: (GSXMLNamespace*)ns name: (NSString*)name;
- (GSXMLAttribute*) firstAttribute;
- (GSXMLNode*) firstChild;
- (GSXMLNode*) firstChildElement;
- (GSXMLDocument*) document;
- (void*) lib;
- (GSXMLAttribute*) makeAttributeWithName: (NSString*)name
value: (NSString*)value;
- (GSXMLNode*) makeChildWithNamespace: (GSXMLNamespace*)ns
name: (NSString*)name
content: (NSString*)content;
- (GSXMLNamespace*) makeNamespaceHref: (NSString*)href
prefix: (NSString*)prefix;
- (GSXMLNode*) makeText: (NSString*)content;
- (GSXMLNode*) makeComment: (NSString*)content;
- (GSXMLNode*) makePI: (NSString*)name
@ -133,48 +124,23 @@
- (NSString*) name;
- (GSXMLNode*) next;
- (GSXMLNode*) nextElement;
- (GSXMLNamespace*) ns;
- (GSXMLNamespace*) nsDef; /* namespace definitions on this node */
- (GSXMLNamespace*) namespace;
- (GSXMLNamespace*) namespaceDefinitions;
- (NSString*) objectForKey: (NSString*)key;
- (GSXMLNode*) parent;
- (GSXMLNode*) prev;
- (GSXMLAttribute*) properties;
- (NSMutableDictionary*) propertiesAsDictionary;
- (GSXMLNode*) previous;
- (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:
(SEL)keyTransformSel;
- (GSXMLAttribute*) setProp: (NSString*)name
value: (NSString*)value;
- (void) setObject: (NSString*)value forKey:(NSString*)key;
- (int) type;
- (NSString*) typeDescription;
@end
/* Attribute */
@interface GSXMLAttribute : GSXMLNode <NSCopying>
{
}
+ (GSXMLAttribute*) attributeFrom: (void*)data;
+ (GSXMLAttribute*) attributeWithNode: (GSXMLNode*)node
name: (NSString*)name
value: (NSString*)value;
+ (NSString*) descriptionFromType: (int)type;
+ (int) typeFromDescription: (NSString*)desc;
- (id) initWithNode: (GSXMLNode*)node
name: (NSString*)name
value: (NSString*)value;
- (NSString*) name;
- (GSXMLNamespace*) ns;
- (GSXMLAttribute*) next;
- (GSXMLAttribute*) prev;
- (int) type;
- (NSString*) typeDescription;
@interface GSXMLAttribute : GSXMLNode
- (NSString*) value;
@end
@interface GSXMLParser : NSObject
{
id src; /* source for parsing */
@ -195,7 +161,7 @@
withData: (NSData*)data;
+ (NSString*) xmlEncodingStringForStringEncoding: (NSStringEncoding)encoding;
- (GSXMLDocument*) doc;
- (GSXMLDocument*) document;
- (BOOL) doValidityChecking: (BOOL)yesno;
- (int) errNo;
- (BOOL) getWarnings: (BOOL)yesno;

File diff suppressed because it is too large Load diff

View file

@ -39,10 +39,13 @@ LIBRARY_VAR = GNUSTEP_BASE
# The library to be compiled
LIBRARY_NAME=
ifeq ($(add),yes)
LIBRARY_NAME=libgnustep-baseadd libgnustep-base
else
LIBRARY_NAME=libgnustep-base
LIBRARY_NAME += libgnustep-baseadd
endif
ifneq ($(base),no)
LIBRARY_NAME += libgnustep-base
endif
libgnustep-base_SUBPROJECTS=Additions

View file

@ -439,7 +439,7 @@ static NSMutableSet *textNodes = nil;
- (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
{
CREATE_AUTORELEASE_POOL(arp);
GSXMLNode *children = [node children];
GSXMLNode *children = [node firstChild];
if ([node type] == XML_ELEMENT_NODE)
{
@ -703,7 +703,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"<dt><b>Declared in:</b></dt>\n"];
[buf appendString: indent];
[buf appendString: @"<dd>"];
[self outputText: [node children] to: buf];
[self outputText: [node firstChild] to: buf];
[buf appendString: @"</dd>\n"];
[self decIndent];
[buf appendString: indent];
@ -744,7 +744,7 @@ static NSMutableSet *textNodes = nil;
{
[buf appendFormat: @"<a href=\"mailto:%@\"><code>", ename];
}
[self outputText: [node children] to: buf];
[self outputText: [node firstChild] to: buf];
if (ename == nil)
{
[buf appendString: @"</code>"];
@ -818,7 +818,7 @@ static NSMutableSet *textNodes = nil;
{
if ([[tmp name] isEqual: @"arg"] == YES)
{
GSXMLNode *t = [tmp children];
GSXMLNode *t = [tmp firstChild];
NSString *s;
if (hadArg == YES)
@ -934,7 +934,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: indent];
[buf appendString: @"<title>"];
[self incIndent];
[self outputText: [children children] to: buf];
[self outputText: [children firstChild] to: buf];
[self decIndent];
[buf appendString: @"</title>\n"];
[self decIndent];
@ -964,7 +964,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: indent];
[buf appendFormat: @"<h1><a name=\"title$%@\">", base];
[self outputText: [children children] to: buf];
[self outputText: [children firstChild] to: buf];
[buf appendString: @"</a></h1>\n"];
[buf appendString: indent];
@ -983,7 +983,7 @@ static NSMutableSet *textNodes = nil;
children = [children nextElement];
tmp = [author childElement];
tmp = [author firstChildElement];
if ([[tmp name] isEqual: @"email"] == YES)
{
email = tmp;
@ -1045,7 +1045,7 @@ static NSMutableSet *textNodes = nil;
{
[buf appendString: indent];
[buf appendString: @"<p><b>Version:</b> "];
[self outputText: [children children] to: buf];
[self outputText: [children firstChild] to: buf];
[buf appendString: @"</p>\n"];
children = [children nextElement];
}
@ -1053,13 +1053,13 @@ static NSMutableSet *textNodes = nil;
{
[buf appendString: indent];
[buf appendString: @"<p><b>Date:</b> "];
[self outputText: [children children] to: buf];
[self outputText: [children firstChild] to: buf];
[buf appendString: @"</p>\n"];
children = [children nextElement];
}
if ([[children name] isEqual: @"abstract"] == YES)
{
GSXMLNode *tmp = [children children];
GSXMLNode *tmp = [children firstChild];
[buf appendString: indent];
[buf appendString: @"<blockquote>\n"];
@ -1077,7 +1077,7 @@ static NSMutableSet *textNodes = nil;
{
[buf appendString: indent];
[buf appendString: @"<p><b>Copyright:</b> (C) "];
[self outputText: [children children] to: buf];
[self outputText: [children firstChild] to: buf];
[buf appendString: @"</p>\n"];
children = [children nextElement];
}
@ -1198,7 +1198,7 @@ static NSMutableSet *textNodes = nil;
{
if ([[tmp name] isEqual: @"sel"] == YES)
{
GSXMLNode *t = [tmp children];
GSXMLNode *t = [tmp firstChild];
str = [str stringByAppendingString: @"<b>"];
while (t != nil)
@ -1220,7 +1220,7 @@ static NSMutableSet *textNodes = nil;
}
else if ([[tmp name] isEqual: @"arg"] == YES)
{
GSXMLNode *t = [tmp children];
GSXMLNode *t = [tmp firstChild];
NSString *s;
s = [[tmp propertiesAsDictionary] objectForKey: @"type"];
@ -1325,7 +1325,7 @@ static NSMutableSet *textNodes = nil;
{
NSString *type = [prop objectForKey: @"type"];
NSString *r = [prop objectForKey: @"id"];
GSXMLNode *tmp = [node children];
GSXMLNode *tmp = [node firstChild];
NSString *s;
if ([type isEqual: @"method"] || [type isEqual: @"ivariable"])
@ -1401,7 +1401,7 @@ static NSMutableSet *textNodes = nil;
}
else if ([name isEqual: @"standards"])
{
GSXMLNode *tmp = [node children];
GSXMLNode *tmp = [node firstChild];
BOOL first = YES;
if (tmp != nil)
@ -1635,7 +1635,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[buf appendString: indent];
[buf appendString: @"<p>\n"];
[self incIndent];
[self outputText: [node children] to: buf];
[self outputText: [node firstChild] to: buf];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</p>\n"];
@ -1650,7 +1650,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
else if ([n isEqual: @"example"] == YES)
{
[buf appendString: @"<pre>\n"];
[self outputText: [node children] to: buf];
[self outputText: [node firstChild] to: buf];
[buf appendString: @"\n</pre>\n"];
return [node nextElement];
}
@ -1691,7 +1691,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
- (GSXMLNode*) outputList: (GSXMLNode*)node to: (NSMutableString*)buf
{
NSString *name = [node name];
GSXMLNode *children = [node childElement];
GSXMLNode *children = [node firstChildElement];
if ([name isEqual: @"list"] == YES)
{
@ -1700,7 +1700,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[self incIndent];
while (children != nil)
{
GSXMLNode *tmp = [children children];
GSXMLNode *tmp = [children firstChild];
[buf appendString: indent];
[buf appendString: @"<li>\n"];
@ -1725,7 +1725,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[self incIndent];
while (children != nil)
{
GSXMLNode *tmp = [children children];
GSXMLNode *tmp = [children firstChild];
[buf appendString: indent];
[buf appendString: @"<li>\n"];
@ -1754,13 +1754,13 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[buf appendString: indent];
[buf appendString: @"<dt>"];
[self outputText: [children children] to: buf];
[self outputText: [children firstChild] to: buf];
[buf appendString: @"</dt>\n"];
children = [children nextElement];
[buf appendString: indent];
[buf appendString: @"<dd>\n"];
[self incIndent];
tmp = [children children];
tmp = [children firstChild];
while (tmp != nil)
{
tmp = [self outputBlock: tmp to: buf inPara: NO];
@ -1785,13 +1785,13 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[buf appendString: indent];
[buf appendString: @"<dt>"];
[self outputText: [children children] to: buf];
[self outputText: [children firstChild] to: buf];
[buf appendString: @"</dt>\n"];
children = [children nextElement];
[buf appendString: indent];
[buf appendString: @"<dd>\n"];
[self incIndent];
tmp = [children children];
tmp = [children firstChild];
while (tmp != nil)
{
tmp = [self outputBlock: tmp to: buf inPara: NO];
@ -1858,7 +1858,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
GSXMLNode *t;
NSArray *a;
node = [node childElement];
node = [node firstChildElement];
if (node != nil && [[node name] isEqual: @"declared"] == YES)
{
[self outputNode: node to: buf];
@ -1877,7 +1877,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
[buf appendString: @"<dt><b>Conforms to:</b></dt>\n"];
while (node != nil && [[node name] isEqual: @"conform"] == YES)
{
NSString *text = [[node children] content];
NSString *text = [[node firstChild] content];
[buf appendString: indent];
[buf appendString: @"<dd>"];
@ -1898,9 +1898,9 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
{
t = [t nextElement];
}
if (t != nil && [t children] != nil)
if (t != nil && [t firstChild] != nil)
{
t = [t children];
t = [t firstChild];
[buf appendString: indent];
[buf appendString: @"<blockquote>\n"];
[self incIndent];

View file

@ -217,7 +217,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
*/
- (void) makeRefs: (GSXMLNode*)node
{
GSXMLNode *children = [node children];
GSXMLNode *children = [node firstChild];
GSXMLNode *next = [node next];
BOOL newUnit = NO;
@ -345,7 +345,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
{
if ([[tmp name] isEqual: @"sel"] == YES)
{
GSXMLNode *t = [tmp children];
GSXMLNode *t = [tmp firstChild];
while (t != nil)
{

View file

@ -2572,7 +2572,7 @@ fail:
while (r.length > 0)
{
/*
* Look for 'AtogsdocSource:' lines.
* Look for 'AutogsdocSource:' lines.
*/
r = [comment rangeOfString: @"AutogsdocSource:"
options: NSCaseInsensitiveSearch

View file

@ -834,6 +834,7 @@ main(int argc, char **argv, char **env)
}
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
{
GSXMLNode *root;
GSXMLParser *parser;
AGSIndex *localRefs;
@ -845,15 +846,16 @@ main(int argc, char **argv, char **env)
{
NSLog(@"WARNING %@ is not a valid document", gsdocfile);
}
if (![[[[parser doc] root] name] isEqualToString: @"gsdoc"])
root = [[parser document] root];
if (![[root name] isEqualToString: @"gsdoc"])
{
NSLog(@"not a gsdoc document - because name node is %@",
[[[parser doc] root] name]);
[root name]);
return 1;
}
localRefs = AUTORELEASE([AGSIndex new]);
[localRefs makeRefs: [[parser doc] root]];
[localRefs makeRefs: root];
/*
* accumulate index info in project references
@ -1108,6 +1110,7 @@ main(int argc, char **argv, char **env)
{
if (hDate == nil || [gDate earlierDate: hDate] == hDate)
{
GSXMLNode *root;
GSXMLParser *parser;
AGSIndex *localRefs;
AGSHtml *html;
@ -1125,15 +1128,16 @@ main(int argc, char **argv, char **env)
{
NSLog(@"WARNING %@ is not a valid document", gsdocfile);
}
if (![[[[parser doc] root] name] isEqualToString: @"gsdoc"])
root = [[parser document] root];
if (![[root name] isEqualToString: @"gsdoc"])
{
NSLog(@"not a gsdoc document - because name node is %@",
[[[parser doc] root] name]);
[root name]);
return 1;
}
localRefs = AUTORELEASE([AGSIndex new]);
[localRefs makeRefs: [[parser doc] root]];
[localRefs makeRefs: root];
/*
* We perform final output
@ -1142,7 +1146,7 @@ main(int argc, char **argv, char **env)
[html setGlobalRefs: globalRefs];
[html setProjectRefs: projectRefs];
[html setLocalRefs: localRefs];
generated = [html outputDocument: [[parser doc] root]];
generated = [html outputDocument: root];
if ([generated writeToFile: htmlfile atomically: YES] == NO)
{
NSLog(@"Sorry unable to write %@", htmlfile);

View file

@ -123,8 +123,8 @@ main(int argc, char** argv, char **env)
printf(
"A property list is a method of providing structured information consisting\n"
"of strings, arrays, dictionaries, and binary data.\n\n"
"The defaults system allows you to work with a human-readable form of a
property list which is set as the value of a default.\n\n");
"The defaults system allows you to work with a human-readable form of a\n"
"property list which is set as the value of a default.\n\n");
printf(
"In a property list, strings appear as plain text (as long as they contain\n"
"no special characters), and inside quotation marks otherwise.\n"