2000-02-28 16:23:53 +00:00
|
|
|
|
/* This tool converts documentation in gsdoc format to another format
|
|
|
|
|
At present (and for the forseeable future), the only format supported
|
|
|
|
|
is HTML.
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2000 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
|
|
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
|
Created: February 2000
|
|
|
|
|
|
|
|
|
|
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.
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public
|
2000-02-28 16:23:53 +00:00
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2000-06-20 14:21:35 +00:00
|
|
|
|
/*
|
|
|
|
|
Before doing anything else - you need to install the Gnome xml parser library!
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
You need at least version 2.0.0 of the parser.
|
2000-06-20 14:21:35 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
You can find out how to get this from http: //www.xmlsoft.org
|
2000-06-20 14:21:35 +00:00
|
|
|
|
|
|
|
|
|
Once you have installed the xml parser library, you can build gsdoc
|
|
|
|
|
and install it.
|
|
|
|
|
|
|
|
|
|
Run gsdoc giving it the name of a gsdoc file as an argument, and it will
|
|
|
|
|
produce an html output file.
|
|
|
|
|
|
|
|
|
|
This is an alpha release of the software - please send fixes and improvements
|
|
|
|
|
to rfm@gnu.org
|
|
|
|
|
|
|
|
|
|
Volunteers to write gsdoc->info or gsdoc->TeX or any other translators are
|
|
|
|
|
very welcome.
|
|
|
|
|
*/
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
/*
|
|
|
|
|
Parameters:
|
2000-09-20 14:02:03 +00:00
|
|
|
|
--makeRefs = ReferencesFileName
|
|
|
|
|
With this option, gsdoc reads gsdoc files and creates
|
|
|
|
|
ReferencesFileName.gsdocrefs files which can be used
|
|
|
|
|
as --refs to make links between elements
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
--projectName = TheProjectName
|
|
|
|
|
Sets the project name to "TheProjectName"
|
|
|
|
|
It is used for index titles, ...
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
--refs = ARefFile (or --refs = ARefDirectory)
|
|
|
|
|
Use ARefFile.gsdocrefs (or files whith extensions .gsdocrefs
|
|
|
|
|
in ARefDirectory directory) as references files.
|
|
|
|
|
It enables you to make links between documentations
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
--makeIndex = MyIndexFileName
|
|
|
|
|
Create an index of the parsed files and save it as MyIndexName.gsdoc
|
|
|
|
|
You have to set --makeIndexTemplate option
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
--makeIndexTemplate = MyIndexTemplateFileName
|
|
|
|
|
The file used as index template for makeIndex option
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
--define-XXX = YYY
|
|
|
|
|
Used to define a constant named XXX with value YYY
|
|
|
|
|
in .gsdoc file, all [[infoDictionary.XXX]] texts are replaced with YYY
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
--verbose = X
|
|
|
|
|
Level of traces from 0 to ...
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
--location = file: //usr/doc/gnustep/MyProject
|
|
|
|
|
(or --location = http: //www.gnustep.org/gnustep/MyProject)
|
|
|
|
|
Location of the installed documentation (it helps to make links
|
|
|
|
|
between projects)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
file1 file2
|
|
|
|
|
.gsdoc files
|
2000-08-13 16:00:14 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2000-12-26 23:03:42 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
#include <Foundation/Foundation.h>
|
2000-06-20 13:17:22 +00:00
|
|
|
|
|
2002-05-02 21:22:06 +00:00
|
|
|
|
#ifdef HAVE_LIBXML
|
2000-06-20 13:17:22 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
2002-06-14 08:02:53 +00:00
|
|
|
|
#include <libxml/parser.h>
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *pathExtension_GSDocRefs = @"gsdocrefs";
|
|
|
|
|
NSString *pathExtension_GSDoc = @"gsdoc";
|
|
|
|
|
NSString *pathExtension_HTML = @"html";
|
|
|
|
|
int verbose = 0;
|
|
|
|
|
NSString *location = nil;
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* In text, replace keys from variables with their values
|
|
|
|
|
*variables is like something like this
|
|
|
|
|
* {
|
|
|
|
|
* "[[key1]]" = "value1";
|
|
|
|
|
* "[[key2]]" = "value2";
|
|
|
|
|
* }
|
|
|
|
|
*/
|
|
|
|
|
static NSString *
|
|
|
|
|
textByReplacingVariablesInText(NSString *text, NSDictionary *variables)
|
|
|
|
|
{
|
|
|
|
|
NSEnumerator *variablesEnum = [variables keyEnumerator];
|
|
|
|
|
id key = nil;
|
|
|
|
|
|
|
|
|
|
while ((key = [variablesEnum nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
id value = [[variables objectForKey: key] description];
|
|
|
|
|
|
|
|
|
|
text = [text stringByReplacingString: key withString: value];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* GSDocParser
|
|
|
|
|
*/
|
2000-02-28 16:23:53 +00:00
|
|
|
|
@interface GSDocParser : NSObject
|
|
|
|
|
{
|
|
|
|
|
NSString *baseName;
|
|
|
|
|
NSString *currName;
|
|
|
|
|
NSString *fileName;
|
2000-08-13 16:00:14 +00:00
|
|
|
|
NSString *nextName; //"Next" Link filename
|
|
|
|
|
NSString *prevName; //"Previous" Link filename
|
|
|
|
|
NSString *upName; //"Up" Link filename
|
|
|
|
|
NSString *styleSheetURL; // Style sheet
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableDictionary *indexes;
|
|
|
|
|
NSUserDefaults *defs;
|
|
|
|
|
NSFileManager *mgr;
|
|
|
|
|
xmlDocPtr doc;
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) getProp: (const char *)name fromNode: (xmlNodePtr)node;
|
|
|
|
|
- (NSMutableDictionary *) indexForType: (NSString *)type;
|
|
|
|
|
- (id) initWithFileName: (NSString *)name;
|
|
|
|
|
- (NSString *) parseText: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseText: (xmlNodePtr)node end: (xmlNodePtr *)endNode;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
static xmlParserInputPtr
|
2000-09-20 14:02:03 +00:00
|
|
|
|
loader(const char *url, const char *eid, xmlParserCtxtPtr *ctxt)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
extern xmlParserInputPtr xmlNewInputFromFile();
|
|
|
|
|
xmlParserInputPtr ret = 0;
|
|
|
|
|
|
2002-02-04 16:33:25 +00:00
|
|
|
|
if (url == 0)
|
|
|
|
|
{
|
|
|
|
|
url = "";
|
|
|
|
|
}
|
|
|
|
|
if (eid == 0)
|
|
|
|
|
{
|
|
|
|
|
ret = xmlNewInputFromFile(ctxt, url);
|
|
|
|
|
}
|
|
|
|
|
else if (strncmp(eid, "-//GNUstep//DTD ", 16) == 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
char buf[BUFSIZ];
|
|
|
|
|
char *ptr;
|
|
|
|
|
NSString *name;
|
|
|
|
|
NSString *file;
|
|
|
|
|
|
|
|
|
|
strcpy(buf, &eid[16]);
|
|
|
|
|
for (ptr = buf; *ptr != '\0' && *ptr != '/'; ptr++)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (*ptr == '.')
|
|
|
|
|
{
|
|
|
|
|
*ptr = '_';
|
|
|
|
|
}
|
|
|
|
|
else if (isspace(*ptr))
|
|
|
|
|
{
|
|
|
|
|
*ptr = '-';
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
*ptr = '\0';
|
|
|
|
|
name = [NSString stringWithCString: buf];
|
|
|
|
|
file = [NSBundle pathForGNUstepResource: name
|
|
|
|
|
ofType: @"dtd"
|
2000-09-20 14:02:03 +00:00
|
|
|
|
inDirectory: @"DTDs"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (file == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"unable to find GNUstep DTD - '%@' for '%s'", name, eid);
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ret = xmlNewInputFromFile(ctxt, [file cString]);
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"don't know how to load entity '%s' id '%s'", url, eid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@implementation GSDocParser
|
|
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
|
{
|
|
|
|
|
if (doc != 0)
|
|
|
|
|
{
|
|
|
|
|
xmlFreeDoc(doc);
|
|
|
|
|
doc = 0;
|
|
|
|
|
}
|
|
|
|
|
DESTROY(defs);
|
|
|
|
|
DESTROY(indexes);
|
|
|
|
|
DESTROY(baseName);
|
|
|
|
|
DESTROY(nextName);
|
|
|
|
|
DESTROY(prevName);
|
|
|
|
|
DESTROY(upName);
|
2000-08-13 16:00:14 +00:00
|
|
|
|
DESTROY(styleSheetURL);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
DESTROY(currName);
|
|
|
|
|
DESTROY(fileName);
|
|
|
|
|
[super dealloc];
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) getProp: (const char *)name fromNode: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
xmlAttrPtr attr = node->properties;
|
|
|
|
|
|
|
|
|
|
while (attr != 0 && strcmp(attr->name, name) != 0)
|
|
|
|
|
{
|
|
|
|
|
attr = attr->next;
|
|
|
|
|
}
|
2000-03-11 21:58:40 +00:00
|
|
|
|
if (attr == 0 || attr->children == 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-03-11 21:58:40 +00:00
|
|
|
|
return [self parseText: attr->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSMutableDictionary *) indexForType: (NSString *)type
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableDictionary *dict = [indexes objectForKey: type];
|
|
|
|
|
|
|
|
|
|
if (dict == nil)
|
|
|
|
|
{
|
|
|
|
|
dict = [NSMutableDictionary new];
|
|
|
|
|
[indexes setObject: dict forKey: type];
|
|
|
|
|
RELEASE(dict);
|
|
|
|
|
}
|
|
|
|
|
return dict;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (id) initWithFileName: (NSString *)name
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if ((self = [self init]) != nil)
|
|
|
|
|
{
|
|
|
|
|
xmlNodePtr cur;
|
|
|
|
|
extern int xmlDoValidityCheckingDefaultValue;
|
|
|
|
|
xmlExternalEntityLoader ldr;
|
|
|
|
|
NSString *s;
|
|
|
|
|
NSFileManager *m;
|
|
|
|
|
|
2001-08-16 09:40:08 +00:00
|
|
|
|
xmlKeepBlanksDefault(0);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
xmlDoValidityCheckingDefaultValue = 1;
|
|
|
|
|
ldr = xmlGetExternalEntityLoader();
|
|
|
|
|
if (ldr != (xmlExternalEntityLoader)loader)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
xmlSetExternalEntityLoader((xmlExternalEntityLoader)loader);
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* Ensure we have a valid file name.
|
|
|
|
|
*/
|
|
|
|
|
s = [name pathExtension];
|
|
|
|
|
m = [NSFileManager defaultManager];
|
|
|
|
|
if ([m fileExistsAtPath: name] == NO && [s length] == 0)
|
|
|
|
|
{
|
|
|
|
|
s = [name stringByAppendingPathExtension: pathExtension_GSDoc];
|
|
|
|
|
if ([m fileExistsAtPath: s] == NO)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"No such document - %@", name);
|
|
|
|
|
[self dealloc];
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
name = s;
|
|
|
|
|
}
|
|
|
|
|
fileName = [name copy];
|
|
|
|
|
/*
|
|
|
|
|
* Build an XML tree from the file.
|
|
|
|
|
*/
|
|
|
|
|
doc = xmlParseFile([name cString]);
|
|
|
|
|
if (doc == NULL)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"unparseable document - %@", fileName);
|
|
|
|
|
[self dealloc];
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Check that the document is of the right kind
|
|
|
|
|
*/
|
|
|
|
|
cur = doc->children;
|
|
|
|
|
if (cur == NULL)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"empty document - %@", fileName);
|
|
|
|
|
[self dealloc];
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
cur = cur->next;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (strcmp(cur->name, "gsdoc") != 0)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"document of the wrong type, root node != gsdoc");
|
|
|
|
|
[self dealloc];
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
baseName = [self getProp: "base" fromNode: cur];
|
|
|
|
|
if (baseName == nil)
|
|
|
|
|
{
|
|
|
|
|
//baseName = @"gsdoc";
|
|
|
|
|
ASSIGN(baseName, [fileName stringByDeletingPathExtension]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
RETAIN(baseName);
|
|
|
|
|
}
|
|
|
|
|
nextName = RETAIN([self getProp: "next" fromNode: cur]);
|
|
|
|
|
prevName = RETAIN([self getProp: "prev" fromNode: cur]);
|
|
|
|
|
upName = RETAIN([self getProp: "up" fromNode: cur]);
|
|
|
|
|
styleSheetURL = RETAIN([self getProp: "stylesheeturl" fromNode: cur]);
|
|
|
|
|
defs = RETAIN([NSUserDefaults standardUserDefaults]);
|
|
|
|
|
s = [defs stringForKey: @"BaseName"];
|
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
ASSIGN(baseName, s);
|
|
|
|
|
}
|
|
|
|
|
currName = [baseName copy];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
indexes = [NSMutableDictionary new];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseText: (xmlNodePtr)node
|
2000-03-17 13:13:08 +00:00
|
|
|
|
{
|
|
|
|
|
xmlNodePtr endNode;
|
|
|
|
|
NSString *result;
|
|
|
|
|
|
|
|
|
|
result = [self parseText: node end: &endNode];
|
|
|
|
|
if (endNode != 0)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Unexpected node type in text node - %d", endNode->type);
|
|
|
|
|
result = nil;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseText: (xmlNodePtr)node end: (xmlNodePtr *)endNode
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@interface GSDocHtml : GSDocParser
|
|
|
|
|
{
|
|
|
|
|
NSMutableDictionary *refToFile;
|
|
|
|
|
NSMutableArray *contents;
|
|
|
|
|
NSMutableArray *footnotes;
|
|
|
|
|
unsigned labelIndex;
|
|
|
|
|
unsigned footnoteIndex;
|
|
|
|
|
unsigned contentsIndex;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *projectName;
|
|
|
|
|
NSMutableDictionary *fileReferences;
|
|
|
|
|
NSMutableDictionary *generalReferences;
|
|
|
|
|
NSMutableDictionary *variablesDictionary;
|
|
|
|
|
NSString *currentClassName;
|
|
|
|
|
NSString *currentCategoryName;
|
|
|
|
|
NSString *currentProtocolName;
|
|
|
|
|
NSString *currentEOModel;
|
|
|
|
|
NSString *currentEOEntity;
|
|
|
|
|
NSString *currentEORelationship;
|
|
|
|
|
NSString *currentEORelationshipDestinationEntity;
|
|
|
|
|
NSArray *typesTypes;
|
|
|
|
|
NSArray *classesTypes;
|
|
|
|
|
NSArray *protocolsTypes;
|
|
|
|
|
NSArray *filesTypes;
|
|
|
|
|
NSArray *adaptorsTypes;
|
|
|
|
|
NSArray *EOModelsTypes;
|
|
|
|
|
NSArray *EOEntitiesTypes;
|
|
|
|
|
NSArray *EOClassPropertiesTypes;
|
|
|
|
|
NSArray *EORelationshipsTypes;
|
|
|
|
|
BOOL writeFlag;
|
|
|
|
|
BOOL processFileReferencesFlag;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) addLink: (NSString *)ref withText: (NSString *)text;
|
|
|
|
|
- (void) appendContents: (NSArray *)array toString: (NSMutableString *)text;
|
|
|
|
|
- (void) appendFootnotesToString: (NSMutableString *)text;
|
|
|
|
|
- (void) appendIndex: (NSString *)type toString: (NSMutableString *)text;
|
|
|
|
|
- (NSArray *) contents;
|
|
|
|
|
- (NSDictionary *) fileReferences;
|
|
|
|
|
- (NSDictionary *) findSymbolForKey: (NSString *)key
|
|
|
|
|
ofTypes: (NSArray *)types;
|
|
|
|
|
- (NSString *) linkForSymbol: (NSDictionary *)symbol
|
|
|
|
|
withText: (NSString *)text;
|
|
|
|
|
- (NSString *) linkForSymbolKey: (NSString *)key
|
|
|
|
|
ofTypes: (NSArray *)types
|
|
|
|
|
withText: (NSString *)text;
|
|
|
|
|
- (NSString *) linkedItem: (NSString *)item
|
|
|
|
|
ofTypes: (NSArray *)types;
|
|
|
|
|
- (NSString *) parseAuthor: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseBlock: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseBody: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseChapter: (xmlNodePtr)node contents: (NSMutableArray *)array;
|
|
|
|
|
- (NSString *) parseDef: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseDesc: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseDocument;
|
|
|
|
|
- (NSString *) parseEmbed: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseExample: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseFunction: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseHead: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseItem: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseList: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseVariable: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseIVariable: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseConstant: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseMacro: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseMethod: (xmlNodePtr)node;
|
|
|
|
|
- (NSArray *) parseStandards: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseText: (xmlNodePtr)node end: (xmlNodePtr *)endNode;
|
|
|
|
|
- (NSString *) parseDictionary: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseEOModel: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseEOEntity: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseEOAttribute: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseEOAttributeRef: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseEORelationship: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseEORelationshipComponent: (xmlNodePtr)node;
|
|
|
|
|
- (NSString *) parseEOJoin: (xmlNodePtr)node;
|
|
|
|
|
- (void) setEntry: (NSString *)entry
|
|
|
|
|
withExternalCompleteRef: (NSString *)externalCompleteRef
|
|
|
|
|
withExternalRef: (NSString *)externalRef
|
|
|
|
|
withRef: (NSString *)ref
|
|
|
|
|
inIndexOfType: (NSString *)type;
|
|
|
|
|
- (void) setGeneralReferences: (NSDictionary *)dict;
|
|
|
|
|
- (void) setProcessFileReferencesFlag: (BOOL)flag;
|
|
|
|
|
- (void) setProjectName: (NSString *)projectName;
|
|
|
|
|
- (void) setVariablesDictionary: (NSDictionary *)dict;
|
|
|
|
|
- (void) setWriteFlag: (BOOL)flag;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
@end
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
// ====================================================================
|
2000-02-28 16:23:53 +00:00
|
|
|
|
@implementation GSDocHtml
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (id) init
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if ((self = [super init]) == nil)
|
|
|
|
|
{
|
|
|
|
|
writeFlag = YES;
|
|
|
|
|
processFileReferencesFlag = YES;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typesTypes
|
|
|
|
|
= [NSArray arrayWithObjects: @"type", @"class", @"define", nil];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
RETAIN(typesTypes);
|
|
|
|
|
classesTypes = [NSArray arrayWithObjects: @"class", @"define", nil];
|
|
|
|
|
RETAIN(classesTypes);
|
|
|
|
|
protocolsTypes = [NSArray arrayWithObjects: @"protocol", @"define", nil];
|
|
|
|
|
RETAIN(protocolsTypes);
|
|
|
|
|
filesTypes = [NSArray arrayWithObjects: @"file", nil];
|
|
|
|
|
RETAIN(filesTypes);
|
|
|
|
|
adaptorsTypes = [NSArray arrayWithObjects: @"db-adaptor", nil];
|
|
|
|
|
RETAIN(adaptorsTypes);
|
|
|
|
|
EOModelsTypes = [NSArray arrayWithObjects: @"EOModel", nil];
|
|
|
|
|
RETAIN(EOModelsTypes);
|
|
|
|
|
EOEntitiesTypes = [NSArray arrayWithObjects: @"EOEntity", nil];
|
|
|
|
|
RETAIN(EOEntitiesTypes);
|
|
|
|
|
EOClassPropertiesTypes
|
|
|
|
|
= [NSArray arrayWithObjects: @"EOAttribute", @"EORelationship", nil];
|
|
|
|
|
RETAIN(EOClassPropertiesTypes);
|
|
|
|
|
EORelationshipsTypes = [NSArray arrayWithObjects: @"EORelationship", nil];
|
|
|
|
|
RETAIN(EORelationshipsTypes);
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
return self;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) addLink: (NSString *)ref withText: (NSString *)text
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *file = [refToFile objectForKey: ref];
|
|
|
|
|
|
|
|
|
|
if (file == nil)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
return [NSString stringWithFormat: @"<a href =\"#%@\">%@</a>", ref, text];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
return [NSString stringWithFormat: @"<a href =\"%@#%@\">%@</a>",
|
|
|
|
|
file, ref, text];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) appendContents: (NSArray *)array toString: (NSMutableString *)text
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned count = [array count];
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (count> 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
|
|
[text appendString: @"<ul>\r\n"];
|
|
|
|
|
for (i = 0; i < count; i++)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSDictionary *dict = [array objectAtIndex: i];
|
|
|
|
|
NSString *title = [dict objectForKey: @"Title"];
|
|
|
|
|
NSString *ref = [dict objectForKey: @"Ref"];
|
|
|
|
|
NSArray *sub = [dict objectForKey: @"Contents"];
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<li >%@\r\n",
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[self addLink: ref withText: title]];
|
|
|
|
|
[self appendContents: sub toString: text];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: @"</ul>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) appendFootnotesToString: (NSMutableString *)text
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned count = [footnotes count];
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (count> 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<h2>Footnotes </h2>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
for (i = 0; i < count; i++)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *note = [footnotes objectAtIndex: i];
|
|
|
|
|
NSString *ref = [NSString stringWithFormat: @"foot-%u", i];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<a name =\"%@\">footnote %u </a> -\r\n", ref, i];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: note];
|
|
|
|
|
[text appendString: @"<hr>\r\n"];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) appendIndex: (NSString *)type toString: (NSMutableString *)text
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSDictionary *dict = [self indexForType: type];
|
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
NSArray *keys;
|
|
|
|
|
NSString *key;
|
|
|
|
|
|
|
|
|
|
keys = [dict keysSortedByValueUsingSelector: @selector(compare:)];
|
|
|
|
|
enumerator = [keys objectEnumerator];
|
|
|
|
|
[text appendString: @"<ul>\r\n"];
|
|
|
|
|
while ((key = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
NSString *name = [dict objectForKey: key];
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<li >%@\r\n",
|
2000-08-27 17:04:16 +00:00
|
|
|
|
[self addLink: key withText: name]];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</ul>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
|
{
|
|
|
|
|
DESTROY(contents);
|
|
|
|
|
DESTROY(footnotes);
|
2000-08-16 14:08:08 +00:00
|
|
|
|
DESTROY(projectName);
|
2000-08-13 16:00:14 +00:00
|
|
|
|
DESTROY(fileReferences);
|
|
|
|
|
DESTROY(generalReferences);
|
|
|
|
|
DESTROY(variablesDictionary);
|
|
|
|
|
DESTROY(currentClassName);
|
|
|
|
|
DESTROY(currentCategoryName);
|
|
|
|
|
DESTROY(currentProtocolName);
|
2000-08-27 17:04:16 +00:00
|
|
|
|
DESTROY(currentEOModel);
|
|
|
|
|
DESTROY(currentEOEntity);
|
|
|
|
|
DESTROY(currentEORelationship);
|
|
|
|
|
DESTROY(currentEORelationshipDestinationEntity);
|
2000-08-16 14:08:08 +00:00
|
|
|
|
DESTROY(typesTypes);
|
|
|
|
|
DESTROY(classesTypes);
|
|
|
|
|
DESTROY(protocolsTypes);
|
2000-08-24 17:24:40 +00:00
|
|
|
|
DESTROY(filesTypes);
|
2000-08-27 17:04:16 +00:00
|
|
|
|
DESTROY(adaptorsTypes);
|
|
|
|
|
DESTROY(EOModelsTypes);
|
|
|
|
|
DESTROY(EOEntitiesTypes);
|
|
|
|
|
DESTROY(EOClassPropertiesTypes);
|
|
|
|
|
DESTROY(EORelationshipsTypes);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[super dealloc];
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (id) initWithFileName: (NSString *)name
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
self = [super initWithFileName: name];
|
2000-02-29 10:19:04 +00:00
|
|
|
|
if (self != nil)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-02-29 10:19:04 +00:00
|
|
|
|
mgr = RETAIN([NSFileManager defaultManager]);
|
|
|
|
|
refToFile = [NSMutableDictionary new];
|
|
|
|
|
contents = [NSMutableArray new];
|
|
|
|
|
footnotes = [NSMutableArray new];
|
|
|
|
|
if ([defs boolForKey: @"Monolithic"] == YES)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ASSIGN(currName,
|
|
|
|
|
[baseName stringByAppendingPathExtension: pathExtension_HTML]);
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
BOOL flag = NO;
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if ([mgr fileExistsAtPath: baseName isDirectory: &flag] == NO)
|
|
|
|
|
{
|
|
|
|
|
if ([mgr createDirectoryAtPath: baseName attributes: nil] == NO)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Unable to create directory '%@'", baseName);
|
|
|
|
|
RELEASE(self);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (flag == NO)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"The file '%@' is not a directory", baseName);
|
|
|
|
|
RELEASE(self);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
ASSIGN(currName,
|
|
|
|
|
[baseName stringByAppendingPathComponent: @"index.html"]);
|
|
|
|
|
}
|
2000-02-29 10:19:04 +00:00
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseAuthor: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
|
|
|
|
NSString *name = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *email = nil;
|
2000-03-05 10:50:24 +00:00
|
|
|
|
NSString *ename = nil;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSString *url = nil;
|
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
|
|
|
|
|
if (name == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing or illegal author name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing Author name: %@", name);
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "email") == 0)
|
|
|
|
|
{
|
|
|
|
|
email = [self getProp: "email" fromNode: node];
|
2000-03-11 21:58:40 +00:00
|
|
|
|
ename = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
if (node != 0 && strcmp(node->name, "url") == 0)
|
|
|
|
|
{
|
|
|
|
|
url = [self getProp: "url" fromNode: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: @"<dt>"];
|
|
|
|
|
if (url == nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"%@\r\n", name];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<a href =\"%@\">%@</a>\r\n", url, name];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
if (email != nil)
|
|
|
|
|
{
|
2000-03-05 10:50:24 +00:00
|
|
|
|
if ([ename length] == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ename = email;
|
|
|
|
|
}
|
|
|
|
|
[text appendFormat: @" (<a href =\"mailto: %@\"><code>%@</code></a>)\r\n",
|
|
|
|
|
email, ename];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
[text appendString: @"<dd>\r\n"];
|
|
|
|
|
if (desc != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: desc];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Stop parsing Author name: %@", name);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseBlock: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
if (node == 0)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"nul node when expecting block");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing block node->name: %s", node->name);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (strcmp(node->name, "class") == 0
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|| strcmp(node->name, "jclass") == 0
|
|
|
|
|
|| strcmp(node->name, "category") == 0
|
|
|
|
|
|| strcmp(node->name, "protocol") == 0
|
|
|
|
|
|| strcmp(node->name, "function") == 0
|
|
|
|
|
|| strcmp(node->name, "macro") == 0
|
|
|
|
|
|| strcmp(node->name, "type") == 0
|
|
|
|
|
|| strcmp(node->name, "variable") == 0
|
|
|
|
|
|| strcmp(node->name, "ivariable") == 0
|
|
|
|
|
|| strcmp(node->name, "constant") == 0
|
|
|
|
|
|| strcmp(node->name, "EOModel") == 0
|
|
|
|
|
|| strcmp(node->name, "EOEntity") == 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
return [self parseDef: node];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strcmp(node->name, "list") == 0
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|| strcmp(node->name, "enum") == 0
|
|
|
|
|
|| strcmp(node->name, "deflist") == 0
|
|
|
|
|
|| strcmp(node->name, "qalist") == 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
return [self parseList: node];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strcmp(node->name, "p") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
NSString *elem = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (elem == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return [NSString stringWithFormat: @"<p>\r\n%@</p>\r\n", elem];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strcmp(node->name, "example") == 0)
|
|
|
|
|
{
|
|
|
|
|
return [self parseExample: node];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strcmp(node->name, "embed") == 0)
|
|
|
|
|
{
|
|
|
|
|
return [self parseEmbed: node];
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-27 17:04:16 +00:00
|
|
|
|
if (strcmp(node->name, "dictionary") == 0)
|
|
|
|
|
{
|
|
|
|
|
return [self parseDictionary: node];
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSLog(@"unknown block type - %s", node->name);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseBody: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2002-06-25 17:23:05 +00:00
|
|
|
|
#if GS_WITH_GC == 0
|
2000-02-28 16:23:53 +00:00
|
|
|
|
CREATE_AUTORELEASE_POOL(arp);
|
2002-06-25 17:23:05 +00:00
|
|
|
|
#endif
|
2000-02-28 16:23:53 +00:00
|
|
|
|
BOOL needContents = NO;
|
|
|
|
|
NSMutableArray *back = [NSMutableArray arrayWithCapacity: 2];
|
|
|
|
|
NSMutableArray *body = [NSMutableArray arrayWithCapacity: 4];
|
|
|
|
|
NSMutableArray *front = [NSMutableArray arrayWithCapacity: 2];
|
|
|
|
|
NSString *chapter;
|
|
|
|
|
unsigned count;
|
|
|
|
|
unsigned i;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing body");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
/*
|
|
|
|
|
* Parse the front (unnumbered chapters) storing the html for each
|
2000-09-20 14:02:03 +00:00
|
|
|
|
*chapter as a separate string in the 'front' array.
|
2000-02-28 16:23:53 +00:00
|
|
|
|
*/
|
|
|
|
|
if (node != 0 && strcmp(node->name, "front") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
xmlNodePtr f = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (f != 0 && strcmp(f->name, "contents") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
needContents = YES;
|
|
|
|
|
f = f->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (f != 0 && strcmp(f->name, "chapter") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
chapter = [self parseChapter: f contents: contents];
|
|
|
|
|
if (chapter == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
[front addObject: chapter];
|
|
|
|
|
f = f->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Parse the main body of the document, storing the html for each
|
2000-09-20 14:02:03 +00:00
|
|
|
|
*chapter as a separate string in the 'body' array.
|
2000-02-28 16:23:53 +00:00
|
|
|
|
*/
|
|
|
|
|
while (node != 0 && strcmp(node->name, "chapter") == 0)
|
|
|
|
|
{
|
|
|
|
|
chapter = [self parseChapter: node contents: contents];
|
|
|
|
|
if (chapter == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[body addObject: chapter];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Parse the back unnumbered part of the document, storing the html for each
|
2000-09-20 14:02:03 +00:00
|
|
|
|
*chapter as a separate string in the 'back' array.
|
2000-02-28 16:23:53 +00:00
|
|
|
|
*/
|
|
|
|
|
if (node != 0 && strcmp(node->name, "back") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
while (node != 0 && strcmp(node->name, "chapter") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
chapter = [self parseChapter: node contents: contents];
|
|
|
|
|
if (chapter == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
[back addObject: chapter];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Ok - parsed all the chapters of the document, so we have stored the
|
2000-09-20 14:02:03 +00:00
|
|
|
|
*document structure and can output a contents list.
|
2000-02-28 16:23:53 +00:00
|
|
|
|
*/
|
|
|
|
|
if (needContents)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<h1>Contents </h1>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[self appendContents: contents toString: text];
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Now output all the chapters.
|
|
|
|
|
*/
|
|
|
|
|
count = [front count];
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
chapter = [front objectAtIndex: i];
|
|
|
|
|
[text appendString: chapter];
|
|
|
|
|
}
|
|
|
|
|
count = [body count];
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
chapter = [body objectAtIndex: i];
|
|
|
|
|
[text appendString: chapter];
|
|
|
|
|
}
|
|
|
|
|
count = [back count];
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
chapter = [back objectAtIndex: i];
|
|
|
|
|
[text appendString: chapter];
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Now output any indices requested.
|
|
|
|
|
*/
|
|
|
|
|
while (node != 0 && strcmp(node->name, "index") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *type = [self getProp: "type" fromNode: node];
|
|
|
|
|
|
|
|
|
|
if (type != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<h1>%@ index </h1>\r\n", type];
|
|
|
|
|
[self appendIndex: type toString: text];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
[self appendFootnotesToString: text];
|
|
|
|
|
[text appendString: @"</body>\r\n"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Stop parsing body");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
RELEASE(arp);
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseChapter: (xmlNodePtr)node contents: (NSMutableArray *)array
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2002-06-25 17:23:05 +00:00
|
|
|
|
#if GS_WITH_GC == 0
|
2000-02-28 16:23:53 +00:00
|
|
|
|
CREATE_AUTORELEASE_POOL(arp);
|
2002-06-25 17:23:05 +00:00
|
|
|
|
#endif
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
|
|
|
|
const char *type = node->name;
|
|
|
|
|
const char *next;
|
|
|
|
|
const char *h;
|
|
|
|
|
NSString *head;
|
|
|
|
|
NSString *ref;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *nodeId = nil;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableDictionary *dict;
|
|
|
|
|
NSMutableArray *subs;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing chapter");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
nodeId = [self getProp: "id" fromNode: node];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
ref = nodeId;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (ref == nil)
|
|
|
|
|
{
|
|
|
|
|
ref = [NSString stringWithFormat: @"cont-%u", contentsIndex++];
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node == 0 || strcmp(node->name, "heading") != 0)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"%s without heading", type);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-03-11 21:58:40 +00:00
|
|
|
|
head = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(type, "chapter") == 0)
|
|
|
|
|
{
|
|
|
|
|
next = "section";
|
|
|
|
|
h = "h2";
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(type, "section") == 0)
|
|
|
|
|
{
|
|
|
|
|
next = "subsect";
|
|
|
|
|
h = "h3";
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(type, "subsect") == 0)
|
|
|
|
|
{
|
|
|
|
|
next = "subsubsect";
|
|
|
|
|
h = "h4";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
next = "";
|
|
|
|
|
h = "h5";
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (!nodeId || ([nodeId length] > 0 && ![nodeId isEqual: @"#"]))
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *ref;
|
|
|
|
|
|
|
|
|
|
ref = [NSString stringWithFormat: @"%@##%@##%@",
|
|
|
|
|
projectName, currName, head];
|
|
|
|
|
[self setEntry: head
|
|
|
|
|
withExternalCompleteRef: ref
|
|
|
|
|
withExternalRef: head
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: [NSString stringWithCString: type]];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
/*
|
|
|
|
|
* Build content information and add it to the array at this level.
|
|
|
|
|
*/
|
|
|
|
|
subs = [NSMutableArray new];
|
|
|
|
|
dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
2000-09-20 14:02:03 +00:00
|
|
|
|
head, @"Title", ref, @"Ref", subs, @"Contents", nil];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
RELEASE(subs);
|
|
|
|
|
[array addObject: dict];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Put heading in string.
|
|
|
|
|
*/
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<%s><a name =\"%@\">%@</a></%s>\r\n", h, ref, head, h];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Try to parse block data up to the next subsection.
|
|
|
|
|
*/
|
|
|
|
|
while (node != 0 && strcmp(node->name, next) != 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *block = [self parseBlock: node];
|
|
|
|
|
|
|
|
|
|
if (block == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: block];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (node != 0 && strcmp(node->name, next) == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *chapter = [self parseChapter: node contents: subs];
|
|
|
|
|
|
|
|
|
|
if (chapter == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: chapter];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
[dict setObject: text forKey: @"Text"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Stop parsing chapter");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
RELEASE(arp);
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseDef: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing def");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-06-21 11:04:41 +00:00
|
|
|
|
if ((strcmp(node->name, "class") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|| (strcmp(node->name, "jclass") == 0))
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *className = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *superName = [self getProp: "super" fromNode: node];
|
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *declared = nil;
|
|
|
|
|
NSString *desc = nil;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableArray *conform = [NSMutableArray array];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSMutableArray *ivariables = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *factoryMethods = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *instanceMethods = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *standards = [NSMutableArray array];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (className == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing class name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (ref == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ref = className;
|
|
|
|
|
}
|
|
|
|
|
// We're working on "className"
|
|
|
|
|
ASSIGN(currentClassName, className);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Clear the methods index so it will contain only values from this class.
|
|
|
|
|
*/
|
|
|
|
|
[[self indexForType: @"method"] removeAllObjects];
|
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "declared") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
declared = [self parseText: node->children];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "conform") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[conform addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
while (node != 0 && strcmp(node->name, "ivariable") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseIVariable: node];
|
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[ivariables addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-06-21 11:04:41 +00:00
|
|
|
|
while (node != 0 && ((strcmp(node->name, "method") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|| (strcmp(node->name, "jmethod") == 0)))
|
|
|
|
|
{
|
|
|
|
|
BOOL factoryMethod;
|
|
|
|
|
NSString *s;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
factoryMethod = [[self getProp: "factory" fromNode: node] boolValue];
|
|
|
|
|
s = [self parseMethod: node];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
if (factoryMethod)
|
|
|
|
|
[factoryMethods addObject: s];
|
|
|
|
|
else
|
|
|
|
|
[instanceMethods addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "standard") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[standards addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[self setEntry: className
|
|
|
|
|
withExternalCompleteRef: className
|
|
|
|
|
withExternalRef: className
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"class"];
|
|
|
|
|
[text appendFormat: @"<h2><a name =\"%@\">%@</a></h2>\r\n",
|
|
|
|
|
ref, className];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (declared != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Declared in: </b> %@</p>\r\n", declared];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (superName != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Inherits from: </b> %@</p>\r\n",
|
|
|
|
|
[self linkedItem: superName ofTypes: classesTypes]];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([conform count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<p><b>Conforms to: </b>"];
|
|
|
|
|
for (i = 0; i < [conform count]; i++)
|
|
|
|
|
{
|
|
|
|
|
NSString *conformItem = [conform objectAtIndex: i];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
conformItem = [self linkedItem: conformItem
|
|
|
|
|
ofTypes: protocolsTypes];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"%@ %@\r\n", (i > 0 ? @", " : @""),
|
2000-09-20 14:02:03 +00:00
|
|
|
|
conformItem];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</p>\r\n"];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([standards count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<p><b>Standards: </b> %@\r\n",
|
|
|
|
|
[standards objectAtIndex: 0]];
|
|
|
|
|
for (i = 1; i < [standards count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @", %@\r\n", [standards objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</p>\r\n"];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (desc != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<hr>\r\n%@\r\n", desc];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<h2>Instance Variables </h2>\r\n"];
|
|
|
|
|
[self appendIndex: @"ivariable" toString: text];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<h2>Methods </h2>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[self appendIndex: @"method" toString: text];
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([ivariables count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<hr><h2>Instance Variables </h2>\r\n"];
|
|
|
|
|
for (i = 0; i < [ivariables count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [ivariables objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([factoryMethods count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<hr><h2>Class Methods </h2>\r\n"];
|
|
|
|
|
for (i = 0; i < [factoryMethods count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [factoryMethods objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([instanceMethods count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
|
|
[text appendString: @"<hr><h2>Instances Methods </h2>\r\n"];
|
|
|
|
|
for (i = 0; i < [instanceMethods count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [instanceMethods objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
// We've finished working on "className"
|
|
|
|
|
ASSIGN(currentClassName, nil);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "category") == 0)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *className = [self getProp: "class" fromNode: node];
|
|
|
|
|
NSString *catName = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *declared = nil;
|
|
|
|
|
NSString *desc = nil;
|
2000-08-16 14:08:08 +00:00
|
|
|
|
NSMutableArray *conform = [NSMutableArray array];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
NSMutableArray *factoryMethods = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *instanceMethods = [NSMutableArray array];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableArray *standards = [NSMutableArray array];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *name;
|
|
|
|
|
NSString *eref;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (className == nil || catName == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing category or class name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
name = [NSString stringWithFormat: @"%@ (%@)", className, catName];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (ref == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ref = name;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
// We works on a class & category
|
|
|
|
|
ASSIGN(currentClassName, className);
|
|
|
|
|
ASSIGN(currentCategoryName, catName);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
/*
|
|
|
|
|
* Clear the methods index so it will contain only values from this class.
|
|
|
|
|
*/
|
|
|
|
|
[[self indexForType: @"method"] removeAllObjects];
|
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "declared") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
declared = [self parseText: node->children];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-16 14:08:08 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "conform") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseText: node->children];
|
2000-08-16 14:08:08 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[conform addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "method") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
BOOL factoryMethod;
|
|
|
|
|
NSString *s;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
factoryMethod = [[self getProp: "factory" fromNode: node] boolValue];
|
|
|
|
|
s = [self parseMethod: node];
|
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
if (factoryMethod)
|
|
|
|
|
[factoryMethods addObject: s];
|
|
|
|
|
else
|
|
|
|
|
[instanceMethods addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "standard") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[standards addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
eref = [NSString stringWithFormat: @"%@(%@)", className, catName];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
[self setEntry: name
|
2000-09-20 14:02:03 +00:00
|
|
|
|
withExternalCompleteRef: eref
|
|
|
|
|
withExternalRef: eref
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"category"];
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<h2>%@ <a name =\"%@\">(%@) </a></h2>\r\n",
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[self linkedItem: className ofTypes: classesTypes], ref, catName];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (declared != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Declared in: </b> %@</p>\r\n", declared];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([conform count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-08-16 14:08:08 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<p><b>Conforms to: </b>\r\n"];
|
|
|
|
|
for (i = 0; i < [conform count]; i++)
|
|
|
|
|
{
|
|
|
|
|
NSString *conformItem = [conform objectAtIndex: i];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
conformItem = [self linkedItem: conformItem
|
|
|
|
|
ofTypes: protocolsTypes];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"%@ %@\r\n", (i > 0 ? @", " : @""),
|
2000-09-20 14:02:03 +00:00
|
|
|
|
conformItem];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</p>\r\n"];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([standards count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<p><b>Standards: </b> %@\r\n",
|
|
|
|
|
[standards objectAtIndex: 0]];
|
|
|
|
|
for (i = 1; i < [standards count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @", %@\r\n", [standards objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</p>\r\n"];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (desc != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<hr>\r\n%@\r\n", desc];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<h2>Methods </h2>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[self appendIndex: @"method" toString: text];
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([factoryMethods count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<hr><h2>Class Methods </h2>\r\n"];
|
|
|
|
|
for (i = 0; i < [factoryMethods count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [factoryMethods objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([instanceMethods count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<hr><h2>Instances Methods </h2>\r\n"];
|
|
|
|
|
for (i = 0; i < [instanceMethods count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [instanceMethods objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// We've finished working on this class/category
|
|
|
|
|
ASSIGN(currentClassName, nil);
|
|
|
|
|
ASSIGN(currentCategoryName, nil);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "protocol") == 0)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *protName = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *declared = nil;
|
|
|
|
|
NSString *desc = nil;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableArray *methods = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *standards = [NSMutableArray array];
|
|
|
|
|
|
|
|
|
|
if (protName == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing protocol name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (ref == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ref = protName;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
// Works on "protName"
|
|
|
|
|
ASSIGN(currentProtocolName, protName);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
/*
|
|
|
|
|
* Clear the methods index so it will contain only values from this class.
|
|
|
|
|
*/
|
|
|
|
|
[[self indexForType: @"method"] removeAllObjects];
|
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "declared") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
declared = [self parseText: node->children];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "method") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseMethod: node];
|
|
|
|
|
|
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[methods addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "standard") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseText: node->children];
|
|
|
|
|
|
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[standards addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
[self setEntry: protName
|
2000-09-20 14:02:03 +00:00
|
|
|
|
withExternalCompleteRef: protName
|
|
|
|
|
withExternalRef: protName
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"protocol"];
|
|
|
|
|
[text appendFormat: @"<h2><a name =\"%@\">%@ Protocol </a></h2>\r\n",
|
|
|
|
|
ref, protName];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (declared != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Declared in: </b> %@</p>\r\n", declared];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([standards count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<p><b>Standards: </b> %@\r\n",
|
|
|
|
|
[standards objectAtIndex: 0]];
|
|
|
|
|
for (i = 1; i < [standards count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @", %@\r\n", [standards objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</p>\r\n"];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (desc != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<hr>\r\n%@\r\n", desc];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
[self appendIndex: @"method" toString: text];
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([methods count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<hr>\r\n"];
|
|
|
|
|
for (i = 0; i < [methods count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [methods objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
// Finished working on "protName"
|
|
|
|
|
ASSIGN(currentProtocolName, nil);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "function") == 0)
|
|
|
|
|
{
|
|
|
|
|
return [self parseFunction: node];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "macro") == 0)
|
|
|
|
|
{
|
|
|
|
|
return [self parseMacro: node];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "type") == 0)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *typeName = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *declared = nil;
|
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSString *spec = nil;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableArray *standards = [NSMutableArray array];
|
|
|
|
|
|
|
|
|
|
if (typeName == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing type name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (ref == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ref = typeName;
|
|
|
|
|
}
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "typespec") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
spec = [self parseText: node->children];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (spec == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing type specification");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (node != 0 && strcmp(node->name, "declared") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
declared = [self parseText: node->children];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "standard") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[standards addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[self setEntry: typeName
|
|
|
|
|
withExternalCompleteRef: typeName
|
|
|
|
|
withExternalRef: typeName
|
|
|
|
|
withRef: ref inIndexOfType: @"type"];
|
|
|
|
|
[text appendFormat: @"<h3><a name =\"%@\">%@</a></h3>\r\n",
|
|
|
|
|
ref, typeName];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (declared != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Declared in: </b> %@</p>\r\n", declared];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([standards count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<p><b>Standards: </b> %@\r\n",
|
|
|
|
|
[standards objectAtIndex: 0]];
|
|
|
|
|
for (i = 1; i < [standards count]; i++)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @", %@\r\n", [standards objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</p>\r\n"];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<b>typedef </b> %@ %@<br>\r\n", spec, typeName];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (desc != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"\r\n%@\r\n <hr>\r\n", desc];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "variable") == 0)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
return [self parseVariable: node];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "constant") == 0)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
return [self parseConstant: node];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else if (strcmp(node->name, "EOModel") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
return [self parseEOModel: node];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else if (strcmp(node->name, "EOEntity") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
return [self parseEOEntity: node];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Definition of unknown type - %s", node->name);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseDesc: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-03-05 17:22:57 +00:00
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing desc");
|
2000-03-05 17:22:57 +00:00
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node == 0)
|
|
|
|
|
{
|
|
|
|
|
return @"";
|
|
|
|
|
}
|
2000-03-05 17:22:57 +00:00
|
|
|
|
while (node != 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-03-05 17:22:57 +00:00
|
|
|
|
if (strcmp(node->name, "list") == 0
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|| strcmp(node->name, "enum") == 0
|
|
|
|
|
|| strcmp(node->name, "deflist") == 0
|
|
|
|
|
|| strcmp(node->name, "qalist") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [self parseList: node]];
|
|
|
|
|
}
|
2000-03-05 17:22:57 +00:00
|
|
|
|
else if (strcmp(node->name, "p") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *elem = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (elem != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p>\r\n%@</p>\r\n", elem];
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-03-05 17:22:57 +00:00
|
|
|
|
else if (strcmp(node->name, "example") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: [self parseExample: node]];
|
|
|
|
|
}
|
2000-03-05 17:22:57 +00:00
|
|
|
|
else if (strcmp(node->name, "embed") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: [self parseEmbed: node]];
|
|
|
|
|
}
|
2000-03-05 17:22:57 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
xmlNodePtr old = node;
|
|
|
|
|
|
|
|
|
|
[text appendString: [self parseText: node end: &node]];
|
|
|
|
|
/*
|
|
|
|
|
* If we found text, the node will have been advanced, but if
|
|
|
|
|
*it failed we need to advance ourselves.
|
|
|
|
|
*/
|
|
|
|
|
if (node == old)
|
|
|
|
|
node = node->next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-03-05 17:22:57 +00:00
|
|
|
|
node = node->next;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-03-05 17:22:57 +00:00
|
|
|
|
return text;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseDocument
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
xmlNodePtr cur = doc->children->next->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSString *text;
|
|
|
|
|
NSString *body;
|
|
|
|
|
NSString *head;
|
|
|
|
|
|
|
|
|
|
if (cur == 0 || strcmp(cur->name, "head") != 0)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"head missing from document");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
if ((head = [self parseHead: cur]) == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
cur = cur->next;
|
|
|
|
|
if (cur == 0 || strcmp(cur->name, "body") != 0)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"body missing from document");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
if ((body = [self parseBody: cur]) == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
text = [NSString stringWithFormat: @"<html>%@%@\r\n </html>\r\n", head, body];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
// Don't write result if !writeFlag
|
|
|
|
|
if (writeFlag && [defs boolForKey: @"Monolithic"] == YES)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
// Replace "UserVariables" in text
|
|
|
|
|
text = textByReplacingVariablesInText(text, variablesDictionary);
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
// Write the result
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text writeToFile: currName atomically: YES];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseEmbed: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
return @"An Embed";
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseExample: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-03-11 21:58:40 +00:00
|
|
|
|
NSString *elem = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *cap = [self getProp: "caption" fromNode: node];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing example");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (ref == nil)
|
|
|
|
|
{
|
|
|
|
|
ref = [NSString stringWithFormat: @"label-%u", labelIndex++];
|
|
|
|
|
}
|
|
|
|
|
if (elem == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
if (cap == nil)
|
|
|
|
|
{
|
2000-08-13 16:00:14 +00:00
|
|
|
|
[self setEntry: @"example"
|
2000-09-20 14:02:03 +00:00
|
|
|
|
withExternalCompleteRef: nil
|
|
|
|
|
withExternalRef: nil
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"label"];
|
|
|
|
|
[text appendFormat: @"<a name =\"%@\">example </a>\r\n", ref];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-08-13 16:00:14 +00:00
|
|
|
|
[self setEntry: cap
|
2000-09-20 14:02:03 +00:00
|
|
|
|
withExternalCompleteRef: nil
|
|
|
|
|
withExternalRef: nil
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"label"];
|
|
|
|
|
[text appendFormat: @"<a name =\"%@\">%@</a>\r\n", ref, cap];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<pre>\r\n%@\r\n </pre>\r\n", elem];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseFunction: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *type = [self getProp: "type" fromNode: node];
|
|
|
|
|
NSString *name = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSString *declared = nil;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableString *args = [NSMutableString stringWithString: @"("];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing function");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (ref == nil)
|
|
|
|
|
{
|
|
|
|
|
ref = [NSString stringWithFormat: @"function-%u", labelIndex++];
|
|
|
|
|
}
|
|
|
|
|
if (type == nil)
|
|
|
|
|
{
|
|
|
|
|
type = @"int";
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
//Avoid ((xxx))
|
2000-09-20 14:02:03 +00:00
|
|
|
|
else if ([type hasPrefix: @"("] && [type hasSuffix: @")"])
|
|
|
|
|
{
|
2002-09-15 18:26:56 +00:00
|
|
|
|
type = [[type stringByDeletingPrefix: @"("] stringByDeletingSuffix: @")"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
type = [self linkedItem: type ofTypes: typesTypes];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "arg") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
NSString *arg = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSString *typ = [self getProp: "type" fromNode: node];
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if (arg == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
return nil;
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([args length] > 1)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: @", "];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (typ != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
//Avoid ((xxx))
|
|
|
|
|
if ([typ hasPrefix: @"("] && [typ hasSuffix: @")"])
|
|
|
|
|
{
|
2002-09-15 18:26:56 +00:00
|
|
|
|
typ = [[typ stringByDeletingPrefix: @"("]
|
|
|
|
|
stringByDeletingSuffix: @")"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
typ = [self linkedItem: typ ofTypes: typesTypes];
|
|
|
|
|
[args appendString: typ];
|
|
|
|
|
[args appendString: @" "];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[args appendString: arg];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "vararg") == 0)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([args length] > 1)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: @", ..."];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: @"..."];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
[args appendString: @")"];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "declared") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
declared = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Unexpected node in function definition - %s", node->name);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
[self setEntry: name
|
2000-09-20 14:02:03 +00:00
|
|
|
|
withExternalCompleteRef: name
|
|
|
|
|
withExternalRef: name
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"function"];
|
|
|
|
|
[text appendFormat: @"<h2><a name =\"%@\">%@</a></h2>\r\n", ref, name];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (declared != nil)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<p><b>Declared in: </b> %@</p>\r\n", declared];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<b>Prototype: </b> %@ %@%@<br>\r\n", type, name, args];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (desc != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: desc];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"\r\n <hr>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseHead: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
|
|
|
|
NSString *abstract;
|
|
|
|
|
NSString *title;
|
|
|
|
|
NSString *copyright;
|
|
|
|
|
NSString *date;
|
|
|
|
|
NSString *version;
|
|
|
|
|
BOOL hadAuthor = NO;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing head");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (node == 0 || strcmp(node->name, "title") != 0
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|| (title = [self parseText: node->children]) == nil)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"head without title");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<head>\r\n <title>%@</title>\r\n", title];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[self setEntry: title
|
|
|
|
|
withExternalCompleteRef: [currName stringByDeletingPathExtension]
|
|
|
|
|
withExternalRef: [currName stringByDeletingPathExtension]
|
|
|
|
|
withRef: [currName stringByDeletingPathExtension]
|
|
|
|
|
inIndexOfType: @"file"];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([styleSheetURL length] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<link rel = stylesheet type =\"text/css\" href =\"%@\">\r\n",
|
|
|
|
|
styleSheetURL];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: @"</head>\r\n"];
|
|
|
|
|
[text appendString: @"<body>\r\n"];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([prevName length] > 0)
|
2000-06-21 11:04:41 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
//Avoid empty link
|
|
|
|
|
NSString *test;
|
|
|
|
|
|
|
|
|
|
test = textByReplacingVariablesInText(prevName, variablesDictionary);
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([test length] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if ([[prevName pathExtension] isEqual: pathExtension_HTML] == YES)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<a href =\"%@\">[Previous] </a>\n",
|
|
|
|
|
prevName];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<a href =\"%@.html\">[Previous] </a>\n",
|
2000-09-20 14:02:03 +00:00
|
|
|
|
prevName];
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([upName length] > 0)
|
2000-06-21 11:04:41 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *test;
|
|
|
|
|
|
|
|
|
|
test = textByReplacingVariablesInText(upName, variablesDictionary);
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([test length] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if ([[upName pathExtension] isEqual: pathExtension_HTML] == YES)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<a href =\"%@\">[Up] </a>\n", upName];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<a href =\"%@.html\">[Up] </a>\n", upName];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([nextName length] > 0)
|
2000-06-21 11:04:41 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
//Avoid empty link
|
|
|
|
|
NSString *test;
|
|
|
|
|
|
|
|
|
|
test = textByReplacingVariablesInText(nextName, variablesDictionary);
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([test length] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if ([[nextName pathExtension] isEqual: pathExtension_HTML] == YES)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<a href =\"%@\">[Next] </a>\n", nextName];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<a href =\"%@.html\">[Next] </a>\n",
|
|
|
|
|
nextName];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<h1>%@</h1>\r\n", title];
|
|
|
|
|
|
|
|
|
|
node = node->next;
|
|
|
|
|
while (node != 0 && strcmp(node->name, "author") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *author = [self parseAuthor: node];
|
|
|
|
|
|
|
|
|
|
if (author == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (hadAuthor == NO)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
hadAuthor = YES;
|
|
|
|
|
[text appendString: @"<h3>Authors </h3>\r\n <dl>\r\n"];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: author];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
if (hadAuthor == YES)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: @"</dl>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (node != 0 && strcmp(node->name, "version") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
version = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
[text appendFormat: @"<p>Version: %@</p>\r\n", version];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (node != 0 && strcmp(node->name, "date") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
date = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
[text appendFormat: @"<p>Date: %@</p>\r\n", date];
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-05 17:22:57 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "abstract") == 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
abstract = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
2000-03-05 17:22:57 +00:00
|
|
|
|
[text appendFormat: @"<blockquote>%@</blockquote>\r\n", abstract];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-03-05 17:22:57 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "copy") == 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
copyright = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
2000-03-05 17:22:57 +00:00
|
|
|
|
[text appendFormat: @"<p>Copyright: %@</p>\r\n", copyright];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseItem: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2001-01-26 12:09:35 +00:00
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing item");
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2001-01-26 12:09:35 +00:00
|
|
|
|
while (node != 0)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2001-01-26 12:09:35 +00:00
|
|
|
|
BOOL step = YES;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2001-01-26 12:09:35 +00:00
|
|
|
|
if (strcmp(node->name, "class") == 0
|
|
|
|
|
|| strcmp(node->name, "category") == 0
|
|
|
|
|
|| strcmp(node->name, "protocol") == 0
|
|
|
|
|
|| strcmp(node->name, "function") == 0
|
|
|
|
|
|| strcmp(node->name, "macro") == 0
|
|
|
|
|
|| strcmp(node->name, "type") == 0
|
|
|
|
|
|| strcmp(node->name, "variable") == 0
|
|
|
|
|
|| strcmp(node->name, "ivariable") == 0
|
|
|
|
|
|| strcmp(node->name, "constant") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-01-26 12:09:35 +00:00
|
|
|
|
[text appendString: [self parseDef: node]];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2001-01-26 12:09:35 +00:00
|
|
|
|
else if (strcmp(node->name, "list") == 0
|
|
|
|
|
|| strcmp(node->name, "enum") == 0
|
|
|
|
|
|| strcmp(node->name, "deflist") == 0
|
|
|
|
|
|| strcmp(node->name, "qalist") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [self parseList: node]];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "p") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2001-01-26 12:09:35 +00:00
|
|
|
|
if (elem != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p>\r\n%@</p>\r\n", elem];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "example") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [self parseExample: node]];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "embed") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [self parseEmbed: node]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[text appendString: [self parseText: node end: &node]];
|
|
|
|
|
step = NO;
|
|
|
|
|
}
|
|
|
|
|
if (step == YES)
|
|
|
|
|
node = node->next;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2001-01-26 12:09:35 +00:00
|
|
|
|
return text;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseList: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
|
|
|
|
|
|
|
|
|
if (strcmp(node->name, "list") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<ul>\r\n"];
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "item") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<li >%@\r\n", [self parseItem: node]];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: @"</ul>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "enum") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<ol>\r\n"];
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "item") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<li >%@\r\n", [self parseItem: node]];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: @"</ol>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "deflist") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<dl>\r\n"];
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (strcmp(node->name, "term") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<dt>%@\r\n",
|
|
|
|
|
[self parseText: node->children]];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node == 0 || strcmp(node->name, "desc") != 0)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"term without desc");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
[text appendFormat: @"<dd>%@\r\n", [self parseDesc: node]];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: @"</dl>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<dl>\r\n"];
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (strcmp(node->name, "question") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<dt>%@\r\n",
|
|
|
|
|
[self parseText: node->children]];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node == 0 || strcmp(node->name, "answer") != 0)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"term without desc");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
[text appendFormat: @"<dt>%@\r\n", [self parseBlock: node->children]];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[text appendString: @"</dl>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
// Parse Variable, IVariable or constant
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseVariable: (xmlNodePtr)variableNode
|
|
|
|
|
orConstant: (xmlNodePtr)constantNode
|
|
|
|
|
ofType: (NSString *)indexType
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
xmlNodePtr node = (variableNode ? variableNode : constantNode);
|
2000-08-13 16:00:14 +00:00
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *name = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *type
|
|
|
|
|
= variableNode ? [self getProp: "type" fromNode: node] : nil;
|
|
|
|
|
NSString *posttype
|
|
|
|
|
= variableNode ? [self getProp: "posttype" fromNode: node] : nil;
|
|
|
|
|
NSString *value = [self getProp: "value" fromNode: node];
|
|
|
|
|
NSString *role = [self getProp: "role" fromNode: node];
|
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *declared = nil;
|
|
|
|
|
NSString *desc = nil;
|
2000-08-13 16:00:14 +00:00
|
|
|
|
NSMutableArray *standards = [NSMutableArray array];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *completeRefName = nil;
|
|
|
|
|
NSString *linkedType = nil;
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing variable/constant");
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if (name == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing variable/constant name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
if (variableNode!=NULL && type == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing variable type");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-08-16 14:08:08 +00:00
|
|
|
|
|
|
|
|
|
if (type)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
linkedType = [self linkedItem: type ofTypes: typesTypes];
|
|
|
|
|
}
|
2000-08-16 14:08:08 +00:00
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if (ref == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ref = name;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
node = node->children;
|
|
|
|
|
|
|
|
|
|
if (node != 0 && strcmp(node->name, "declared") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
declared = [self parseText: node->children];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
while (node != 0 && strcmp(node->name, "standard") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseText: node->children];
|
|
|
|
|
|
|
|
|
|
if (s != nil)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[standards addObject: s];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
if (currentClassName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
completeRefName
|
|
|
|
|
= [NSString stringWithFormat: @"%@::%@", currentClassName, name];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
completeRefName = name;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
[self setEntry: name
|
2000-09-20 14:02:03 +00:00
|
|
|
|
withExternalCompleteRef: completeRefName
|
|
|
|
|
withExternalRef: name
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: indexType];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<h2><a name =\"%@\">%@</a></h2>\r\n", ref, name];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if (declared != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Declared in: </b> %@</p>\r\n", declared];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([standards count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<p><b>Standards: </b> %@\r\n",
|
|
|
|
|
[standards objectAtIndex: 0]];
|
|
|
|
|
for (i = 1; i < [standards count]; i++)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @", %@\r\n", [standards objectAtIndex: i]];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"</p>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if ([role isEqual: @"except"])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<p>Exception name </p>\r\n"];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
else if ([role isEqual: @"defaults"])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<p>Defaults system key </p>\r\n"];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
else if ([role isEqual: @"notify"])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<p>Notification name </p>\r\n"];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
else if ([role isEqual: @"key"])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<p>Dictionary key </p>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if (value == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"%@ <b>%@</b>%@<br>\r\n",
|
|
|
|
|
linkedType ? linkedType : @"", name, (posttype ? posttype : @"")];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"%@ <b>%@</b>%@ = %@<br>\r\n",
|
2001-04-19 12:02:13 +00:00
|
|
|
|
linkedType ? linkedType : @"", name, (posttype ? posttype : @""),
|
|
|
|
|
value];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if (desc != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"\r\n%@\r\n", desc];
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Parse Variable
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseVariable: (xmlNodePtr)node
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing variable");
|
|
|
|
|
return [self parseVariable: node
|
|
|
|
|
orConstant: NULL
|
|
|
|
|
ofType: @"variable"];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
//Parse Instance Variable
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseIVariable: (xmlNodePtr)node
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing ivar");
|
|
|
|
|
return [self parseVariable: node
|
|
|
|
|
orConstant: NULL
|
|
|
|
|
ofType: @"ivariable"];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
// Parse Constant
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseConstant: (xmlNodePtr)node
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing constant");
|
|
|
|
|
return [self parseVariable: NULL
|
|
|
|
|
orConstant: node
|
|
|
|
|
ofType: @"constant"];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseMacro: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *name = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSString *declared = nil;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableString *args = [NSMutableString stringWithString: @"("];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing macro");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (ref == nil)
|
|
|
|
|
{
|
|
|
|
|
ref = [NSString stringWithFormat: @"macro-%u", labelIndex++];
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "arg") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
NSString *arg = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSString *typ = [self getProp: "type" fromNode: node];
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (arg == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([args length] > 1)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: @", "];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (typ != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: typ];
|
|
|
|
|
[args appendString: @" "];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
[args appendString: arg];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "vararg") == 0)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([args length] > 1)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: @", ..."];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: @"..."];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
if ([args length] == 1)
|
|
|
|
|
{
|
|
|
|
|
args = nil;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[args appendString: @")"];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "declared") == 0)
|
|
|
|
|
{
|
2000-03-11 21:58:40 +00:00
|
|
|
|
declared = [self parseText: node->children];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Unexpected node in function definition - %s", node->name);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
[self setEntry: name
|
2000-09-20 14:02:03 +00:00
|
|
|
|
withExternalCompleteRef: name
|
|
|
|
|
withExternalRef: name
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"macro"];
|
|
|
|
|
[text appendFormat: @"<h3><a name =\"%@\">%@</a></h3>\r\n", ref, name];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (declared != nil)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<p><b>Declared in: </b> %@</p>\r\n", declared];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
if (args == nil)
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<b>Declaration: </b> %@<br>\r\n", name];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<b>Declaration: </b> %@%@<br>\r\n", name, args];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (desc != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: desc];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"\r\n <hr>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseMethod: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *type = [self getProp: "type" fromNode: node];
|
|
|
|
|
NSString *over = [self getProp: "override" fromNode: node];
|
|
|
|
|
BOOL factory
|
|
|
|
|
= [[self getProp: "factory" fromNode: node] boolValue];
|
|
|
|
|
BOOL desInit
|
|
|
|
|
= [[self getProp: "init" fromNode: node] boolValue];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
NSMutableString *lText = [NSMutableString string];
|
|
|
|
|
NSMutableString *sText = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
BOOL isJava = (strcmp(node->name, "jmethod") == 0);
|
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSArray *standards = nil;
|
|
|
|
|
NSString *methodBlockName = nil;
|
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing method");
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-08-16 14:08:08 +00:00
|
|
|
|
if (currentCategoryName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSAssert(currentClassName, @"No Class Name");
|
|
|
|
|
methodBlockName = currentClassName;
|
|
|
|
|
}
|
2000-08-16 14:08:08 +00:00
|
|
|
|
else if (currentClassName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
methodBlockName = currentClassName;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
else if (currentProtocolName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
methodBlockName = currentProtocolName;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
methodBlockName = @"unknown";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
NSAssert(methodBlockName, @"No methodBlockName");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (ref == nil)
|
|
|
|
|
{
|
|
|
|
|
ref = [NSString stringWithFormat: @"method-%u",
|
2000-08-16 14:08:08 +00:00
|
|
|
|
labelIndex++];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
if (isJava)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-06-21 11:04:41 +00:00
|
|
|
|
NSMutableString *decl = [NSMutableString string];
|
|
|
|
|
NSMutableString *args = [NSMutableString stringWithString: @"("];
|
|
|
|
|
NSString *name = [self getProp: "name" fromNode: node];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-06-21 11:04:41 +00:00
|
|
|
|
if (factory)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[decl appendString: @"static "];
|
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
if (type == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
type = @"Object";
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
//Avoid ((xxx))
|
2000-09-20 14:02:03 +00:00
|
|
|
|
else if ([type hasPrefix: @"("] && [type hasSuffix: @")"])
|
|
|
|
|
{
|
2002-09-15 18:26:56 +00:00
|
|
|
|
type = [[type stringByDeletingPrefix: @"("]
|
|
|
|
|
stringByDeletingSuffix: @")"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
type = [self linkedItem: type ofTypes: typesTypes];
|
2000-06-21 11:04:41 +00:00
|
|
|
|
[decl appendString: type];
|
|
|
|
|
[decl appendString: @" "];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-06-21 11:04:41 +00:00
|
|
|
|
node = node->children;
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-06-21 11:04:41 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "arg") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *arg = [self parseText: node->children];
|
|
|
|
|
NSString *typ = [self getProp: "type" fromNode: node];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (arg == nil)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([args length] > 1)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: @", "];
|
|
|
|
|
}
|
|
|
|
|
if (typ != nil)
|
|
|
|
|
{
|
|
|
|
|
//Avoid ((xxx))
|
|
|
|
|
if ([typ hasPrefix: @"("] && [typ hasSuffix: @")"])
|
|
|
|
|
{
|
2002-09-15 18:26:56 +00:00
|
|
|
|
typ = [typ stringByDeletingPrefix: @"("];
|
|
|
|
|
typ = [typ stringByDeletingSuffix: @")"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
typ = [self linkedItem: typ ofTypes: typesTypes];
|
|
|
|
|
[args appendString: typ];
|
|
|
|
|
[args appendString: @" "];
|
|
|
|
|
}
|
|
|
|
|
[args appendString: arg];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-06-21 11:04:41 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "vararg") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([args length] > 1)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[args appendString: @", ..."];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[args appendString: @"..."];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
[args appendString: @")"];
|
|
|
|
|
|
|
|
|
|
[lText appendString: decl];
|
|
|
|
|
[lText appendString: @"<b>"];
|
|
|
|
|
[lText appendString: name];
|
|
|
|
|
[lText appendString: @"</b>"];
|
|
|
|
|
[lText appendString: args];
|
|
|
|
|
[sText appendString: decl];
|
|
|
|
|
[sText appendString: name];
|
|
|
|
|
[sText appendString: args];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (factory)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[lText appendString: @"+ ("];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[lText appendString: @"- ("];
|
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
if (type == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
type = @"id";
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
//Avoid ((xxx))
|
2000-09-20 14:02:03 +00:00
|
|
|
|
else if ([type hasPrefix: @"("] && [type hasSuffix: @")"])
|
|
|
|
|
{
|
2002-09-15 18:26:56 +00:00
|
|
|
|
type = [type stringByDeletingPrefix: @"("];
|
|
|
|
|
type = [type stringByDeletingSuffix: @")"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
type = [self linkedItem: type ofTypes: typesTypes];
|
2000-06-21 11:04:41 +00:00
|
|
|
|
[lText appendString: type];
|
|
|
|
|
[lText appendString: @")"];
|
|
|
|
|
|
|
|
|
|
node = node->children;
|
|
|
|
|
while (node != 0 && strcmp(node->name, "sel") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *sel = [self parseText: node->children];
|
2000-06-21 11:04:41 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (sel == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
[sText appendString: sel];
|
|
|
|
|
[lText appendFormat: @" <b>%@</b>", sel];
|
|
|
|
|
node = node->next;
|
|
|
|
|
if (node != 0 && strcmp(node->name, "arg") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *arg = [self parseText: node->children];
|
|
|
|
|
NSString *typ = [self getProp: "type" fromNode: node];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (arg == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
if (typ != nil)
|
|
|
|
|
{
|
|
|
|
|
//Avoid ((xxx))
|
|
|
|
|
if ([typ hasPrefix: @"("] && [typ hasSuffix: @")"])
|
|
|
|
|
{
|
2002-09-15 18:26:56 +00:00
|
|
|
|
typ = [typ stringByDeletingPrefix: @"("];
|
|
|
|
|
typ = [typ stringByDeletingSuffix: @")"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
typ = [self linkedItem: typ ofTypes: typesTypes];
|
|
|
|
|
[lText appendFormat: @" (%@)%@", typ, arg];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[lText appendString: @" "];
|
|
|
|
|
[lText appendString: arg];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
if (node != 0 && strcmp(node->name, "vararg") == 0)
|
|
|
|
|
{
|
|
|
|
|
[lText appendString: @", ..."];
|
|
|
|
|
node = node->next;
|
|
|
|
|
break;
|
2000-06-21 11:04:41 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break; /* Just a selector */
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
|
2000-03-10 11:47:52 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (node != 0)
|
|
|
|
|
{
|
2000-03-10 11:47:52 +00:00
|
|
|
|
standards = [self parseStandards: node];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-03-10 11:47:52 +00:00
|
|
|
|
|
2000-06-21 11:04:41 +00:00
|
|
|
|
if (isJava)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *eref;
|
|
|
|
|
|
|
|
|
|
eref = [NSString stringWithFormat: @"%@::%@", methodBlockName, sText];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
[self setEntry: sText
|
2000-09-20 14:02:03 +00:00
|
|
|
|
withExternalCompleteRef: eref
|
|
|
|
|
withExternalRef: eref
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"method"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-06-21 11:04:41 +00:00
|
|
|
|
if (factory)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [@"+" stringByAppendingString: sText];
|
|
|
|
|
NSString *eref;
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
eref
|
|
|
|
|
= [NSString stringWithFormat: @"+%@::%@", methodBlockName, sText];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[self setEntry: s
|
|
|
|
|
withExternalCompleteRef: eref
|
|
|
|
|
withExternalRef: eref
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"method"];
|
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSString *s = [@"-" stringByAppendingString: sText];
|
|
|
|
|
NSString *eref;
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
eref
|
|
|
|
|
= [NSString stringWithFormat: @"-%@::%@", methodBlockName, sText];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
[self setEntry: s
|
|
|
|
|
withExternalCompleteRef: eref
|
|
|
|
|
withExternalRef: eref
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"method"];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<h3><a name =\"%@\">%@</a></h3>\r\n", ref, sText];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if (desInit)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text
|
|
|
|
|
appendString: @"<b>This is the designated initialiser </b><br>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-06-21 11:04:41 +00:00
|
|
|
|
[text appendFormat: @"%@;<br>\r\n", lText];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
if ([over isEqual: @"subclass"])
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"Your subclass <em>must </em> override this "
|
2000-08-27 17:04:16 +00:00
|
|
|
|
@"abstract method.<br>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([over isEqual: @"never"])
|
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"Your subclass must <em>not </em> override this "
|
2000-08-27 17:04:16 +00:00
|
|
|
|
@"method.<br>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([standards count] > 0)
|
2000-03-10 11:47:52 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"Standards: "];
|
2000-03-10 11:47:52 +00:00
|
|
|
|
for (i = 0; i < [standards count]; i++)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @" "];
|
|
|
|
|
[text appendString: [standards objectAtIndex: i]];
|
|
|
|
|
}
|
2000-03-10 11:47:52 +00:00
|
|
|
|
[text appendString: @"<br>\r\n"];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
if (desc != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: desc];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"\r\n <hr>\r\n"];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSArray *) parseStandards: (xmlNodePtr)node
|
2000-03-10 11:47:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (node != 0)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(node->name, "standards") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableArray *a = [NSMutableArray array];
|
2000-03-10 11:47:52 +00:00
|
|
|
|
|
2000-03-11 21:58:40 +00:00
|
|
|
|
node = node->children;
|
2000-03-10 11:47:52 +00:00
|
|
|
|
while (node != 0 && node->name != 0)
|
|
|
|
|
{
|
|
|
|
|
[a addObject: [NSString stringWithCString: node->name]];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Unexpected node in method definition - %s", node->name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseText: (xmlNodePtr)node end: (xmlNodePtr *)endNode
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing text");
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-03-17 13:13:08 +00:00
|
|
|
|
*endNode = node;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
while (node != 0)
|
|
|
|
|
{
|
|
|
|
|
switch (node->type)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
case XML_TEXT_NODE:
|
|
|
|
|
[text appendFormat: @"%s", node->content];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XML_ENTITY_REF_NODE:
|
|
|
|
|
[text appendFormat: @"%s", node->content];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XML_ELEMENT_NODE:
|
|
|
|
|
if (strcmp(node->name, "br") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<br>"];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "code") == 0
|
|
|
|
|
|| strcmp(node->name, "em") == 0
|
|
|
|
|
|| strcmp(node->name, "file") == 0
|
|
|
|
|
|| strcmp(node->name, "site") == 0
|
|
|
|
|
|| strcmp(node->name, "strong") == 0
|
|
|
|
|
|| strcmp(node->name, "var") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem = [self parseText: node->children];
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<%s>%@</%s>",
|
|
|
|
|
node->name, elem, node->name];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "entry") == 0
|
|
|
|
|
|| strcmp(node->name, "label") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem;
|
|
|
|
|
NSString *ref;
|
|
|
|
|
|
|
|
|
|
elem = [self parseText: node->children];
|
|
|
|
|
ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
if (ref == nil)
|
|
|
|
|
{
|
|
|
|
|
ref = [NSString stringWithFormat: @"label-%u",
|
|
|
|
|
labelIndex++];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[self setEntry: elem
|
2001-04-19 12:02:13 +00:00
|
|
|
|
withExternalCompleteRef:
|
|
|
|
|
[NSString stringWithFormat: @"%@::%@", @"***unknown", elem]
|
|
|
|
|
withExternalRef:
|
|
|
|
|
[NSString stringWithFormat: @"%@::%@", @"***unknown", elem]
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"label"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
if (strcmp(node->name, "label") == 0)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<a name =\"%@\">%@</a>", ref, elem];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<a name =\"%@\"></a>", ref];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "footnote") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem;
|
|
|
|
|
NSString *ref;
|
|
|
|
|
|
|
|
|
|
elem = [self parseText: node->children];
|
|
|
|
|
ref = [NSString stringWithFormat: @"foot-%u",
|
|
|
|
|
[footnotes count]];
|
|
|
|
|
|
|
|
|
|
[self setEntry: elem
|
2001-04-19 12:02:13 +00:00
|
|
|
|
withExternalCompleteRef:
|
|
|
|
|
[NSString stringWithFormat: @"%@::%@", @"***unknown", elem]
|
|
|
|
|
withExternalRef:
|
|
|
|
|
[NSString stringWithFormat: @"%@::%@", @"***unknown", elem]
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"footnote"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
[footnotes addObject: elem];
|
|
|
|
|
[text appendFormat: @" %@ ",
|
|
|
|
|
[self addLink: ref withText: @"see footnote"]];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "ref") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem = [self parseText: node->children];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
// NSString *typ = [self getProp: "type" fromNode: node];
|
|
|
|
|
// NSString *cls = [self getProp: "class" fromNode: node];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
|
|
|
|
|
if ([elem length] == 0)
|
|
|
|
|
{
|
|
|
|
|
elem = ref;
|
|
|
|
|
}
|
|
|
|
|
[text appendString: [self addLink: ref withText: elem]];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "uref") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem = [self parseText: node->children];
|
|
|
|
|
NSString *ref = [self getProp: "url" fromNode: node];
|
|
|
|
|
|
|
|
|
|
if ([elem length] == 0)
|
|
|
|
|
{
|
|
|
|
|
elem = ref;
|
|
|
|
|
}
|
|
|
|
|
[text appendFormat: @"<a href =\"%@\">%@</a>", ref, elem];
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(node->name, "prjref") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem = [self parseText: node->children];
|
|
|
|
|
NSString *prjName = [self getProp: "prjname" fromNode: node];
|
|
|
|
|
NSString *prjFile = [self getProp: "file" fromNode: node];
|
|
|
|
|
NSString *symbolKey = nil;
|
|
|
|
|
NSString *link = nil;
|
|
|
|
|
|
|
|
|
|
if ([prjName length]== 0)
|
|
|
|
|
{
|
|
|
|
|
prjName = projectName;
|
|
|
|
|
}
|
|
|
|
|
if ([elem length] == 0)
|
|
|
|
|
{
|
|
|
|
|
elem = prjName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
symbolKey = [NSString stringWithFormat: @"%@##%@",
|
|
|
|
|
prjName, ([prjFile length] ? prjFile : @"index")];
|
|
|
|
|
link = [self linkForSymbolKey: symbolKey
|
|
|
|
|
ofTypes: filesTypes
|
|
|
|
|
withText: elem];
|
|
|
|
|
[text appendString: link];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return text;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
node = node->next;
|
2000-03-17 13:13:08 +00:00
|
|
|
|
*endNode = node;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseDictionaryItem: (xmlNodePtr)node
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-08-27 17:04:16 +00:00
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *key = [self getProp: "key" fromNode: node];
|
|
|
|
|
NSString *value = [self getProp: "value" fromNode: node];
|
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing dictionaryItem");
|
|
|
|
|
if (key == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"dictionaryItem must have a key");
|
2000-08-27 17:04:16 +00:00
|
|
|
|
return nil;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
[text appendFormat: @"<LI><b>%@</b> = ", key];
|
|
|
|
|
|
|
|
|
|
if (value == nil)
|
|
|
|
|
{
|
|
|
|
|
node = node->children;
|
|
|
|
|
while (node != 0)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
value = [self parseBlock: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[text appendFormat: @"%@</LI>\n", value];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseDictionary: (xmlNodePtr)node
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing dictionary");
|
|
|
|
|
|
2000-08-27 17:04:16 +00:00
|
|
|
|
node = node->children;
|
|
|
|
|
[text appendString: @"<UL>\n"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
while (node && strcmp(node->name, "dictionaryItem") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *itemString = [self parseDictionaryItem: node];
|
|
|
|
|
[text appendString: itemString];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
[text appendString: @"</UL>\n"];
|
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseEOModel: (xmlNodePtr)node
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *modelName = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *version = [self getProp: "version" fromNode: node];
|
|
|
|
|
NSString *adaptorName = [self getProp: "adaptorName" fromNode: node];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *adaptorClassName
|
|
|
|
|
= [self getProp: "adaptorClassName" fromNode: node];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSString *connectionDictionary = nil;
|
|
|
|
|
NSString *userDictionary = nil;
|
|
|
|
|
NSMutableArray *entities = [NSMutableArray array];
|
|
|
|
|
NSString *entitiesRefsList = nil;
|
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing EOModel");
|
|
|
|
|
|
|
|
|
|
if (modelName == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing model name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
// We're working on EOModel
|
2000-09-20 14:02:03 +00:00
|
|
|
|
ASSIGN(currentEOModel, modelName);
|
|
|
|
|
|
|
|
|
|
if (ref == nil)
|
|
|
|
|
{
|
|
|
|
|
ref = modelName;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
node = node->children;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "EOConnectionDictionary") == 0)
|
|
|
|
|
{
|
|
|
|
|
connectionDictionary = [self parseDictionary: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "list") == 0)
|
|
|
|
|
{
|
|
|
|
|
entitiesRefsList = [self parseList: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
while (node && strcmp(node->name, "EOEntity") == 0)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *s = [self parseEOEntity: node];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[entities addObject: s];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
node = node->next;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "EOUserDictionary") == 0)
|
|
|
|
|
{
|
|
|
|
|
userDictionary = [self parseDictionary: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[self setEntry: modelName
|
|
|
|
|
withExternalCompleteRef: modelName
|
|
|
|
|
withExternalRef: modelName
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"EOModel"];
|
|
|
|
|
[text appendFormat: @"<h2><a name =\"%@\">%@</a></h2>\r\n",
|
|
|
|
|
ref, modelName];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (version != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Version: </b> %@</p>\r\n", version];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (adaptorName != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Adaptor: </b> %@</p>\r\n",
|
|
|
|
|
[self linkedItem: adaptorName ofTypes: adaptorsTypes]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (adaptorClassName != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Adaptor Class: </b> %@</p>\r\n",
|
|
|
|
|
[self linkedItem: adaptorClassName ofTypes: classesTypes]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (desc != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<hr>\r\n%@\r\n", desc];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[text appendString: @"<h2>Entities </h2>\r\n"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
[self appendIndex: @"EOEntities"
|
2000-09-20 14:02:03 +00:00
|
|
|
|
toString: text];
|
|
|
|
|
[text appendString: @"<h2>User Dictionary </h2>\r\n"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
[self appendIndex: @"UserDictionary"
|
2000-09-20 14:02:03 +00:00
|
|
|
|
toString: text];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (desc != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<hr>\r\n%@\r\n", desc];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (entitiesRefsList != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<hr><h2>Entities </h2>\r\n"];
|
|
|
|
|
[text appendString: entitiesRefsList];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
if ([entities count] > 0)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
unsigned i = 0;
|
|
|
|
|
[text appendString: @"<hr><h2>Entities </h2>\r\n"];
|
|
|
|
|
for (i = 0; i < [entities count]; i++)
|
|
|
|
|
[text appendString: [entities objectAtIndex: i]];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (userDictionary != nil)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<hr><h2>UserDictionary </h2>\r\n%@",
|
|
|
|
|
userDictionary];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
// Stop working on EOModel
|
2000-09-20 14:02:03 +00:00
|
|
|
|
ASSIGN(currentEOModel, nil);
|
2000-08-27 17:04:16 +00:00
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseEOEntity: (xmlNodePtr)node
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *entityName = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *externalName
|
|
|
|
|
= [self getProp: "externalName" fromNode: node];
|
|
|
|
|
NSString *className = [self getProp: "className" fromNode: node];
|
|
|
|
|
NSString *modelName = [self getProp: "modelName" fromNode: node];
|
|
|
|
|
NSString *isReadOnly
|
|
|
|
|
= [self getProp: "isReadOnly" fromNode: node];
|
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSString *userDictionary = nil;
|
|
|
|
|
NSMutableArray *attributes = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *attributesUsedForLocking = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *classProperties = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *primaryKeyAttributes = [NSMutableArray array];
|
|
|
|
|
NSMutableArray *relationships = [NSMutableArray array];
|
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing EOEntity");
|
|
|
|
|
|
2002-03-28 18:10:51 +00:00
|
|
|
|
if (!entityName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing entity name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
// We're working on EOEntity
|
2000-09-20 14:02:03 +00:00
|
|
|
|
ASSIGN(currentEOEntity, entityName);
|
|
|
|
|
|
2002-03-28 18:10:51 +00:00
|
|
|
|
if (!ref)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
ref = entityName;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
node = node->children;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
while (node != 0 && strcmp(node->name, "EOAttribute") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseEOAttribute: node];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[attributes addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "EOAttributesUsedForLocking") == 0)
|
|
|
|
|
{
|
|
|
|
|
xmlNodePtr attributeNode = node->children;
|
|
|
|
|
while (attributeNode != 0
|
|
|
|
|
&& strcmp(attributeNode->name, "EOAttributeRef") == 0)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *s = [self parseEOAttributeRef: attributeNode];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[attributesUsedForLocking addObject: s];
|
|
|
|
|
}
|
|
|
|
|
attributeNode = attributeNode->next;
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (node != 0 && strcmp(node->name, "EOClassProperties") == 0)
|
|
|
|
|
{
|
|
|
|
|
xmlNodePtr attributeNode = node->children;
|
|
|
|
|
|
|
|
|
|
while (attributeNode != 0
|
|
|
|
|
&& strcmp(attributeNode->name, "EOAttributeRef") == 0)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *s = [self parseEOAttributeRef: attributeNode];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[classProperties addObject: s];
|
|
|
|
|
}
|
|
|
|
|
attributeNode = attributeNode->next;
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "EOPrimaryKeyAttributes") == 0)
|
|
|
|
|
{
|
|
|
|
|
xmlNodePtr attributeNode = node->children;
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
while (attributeNode != 0
|
|
|
|
|
&& strcmp(attributeNode->name, "EOAttributeRef") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseEOAttributeRef: attributeNode];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
|
|
|
|
{
|
|
|
|
|
[primaryKeyAttributes addObject: s];
|
|
|
|
|
}
|
|
|
|
|
attributeNode = attributeNode->next;
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (node != 0 && strcmp(node->name, "EORelationship") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseEORelationship: node];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s != nil)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[relationships addObject: s];
|
|
|
|
|
}
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "EOUserDictionary") == 0)
|
|
|
|
|
{
|
|
|
|
|
userDictionary = [self parseDictionary: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[self setEntry: entityName
|
|
|
|
|
withExternalCompleteRef: entityName
|
|
|
|
|
withExternalRef: entityName
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"EOEntity"];
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<hr><h2><a name =\"%@\">%@</a></h2>\r\n",
|
|
|
|
|
ref, entityName];
|
|
|
|
|
|
|
|
|
|
if (modelName != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Model: </b> %@</p>\r\n",
|
|
|
|
|
[self linkedItem: modelName ofTypes: EOModelsTypes]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (externalName != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>External Name: </b> %@</p>\r\n",
|
|
|
|
|
externalName];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (className != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Class: </b> %@</p>\r\n",
|
|
|
|
|
[self linkedItem: className ofTypes: classesTypes]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isReadOnly != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<p><b>Read Only: </b> %@</p>\r\n",
|
|
|
|
|
isReadOnly];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (desc != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<hr>\r\n%@\r\n", desc];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[text appendString: @"<hr>\r\n <UL>\r\n"];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([attributes count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<LI><A HREF=\"#%@__Attributes\">Attributes </A></LI>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([attributesUsedForLocking count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<LI><A HREF=\"#%@__AttributesUsedForLocking\">Attributes "
|
|
|
|
|
@"Used For Locking </A></LI>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([classProperties count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<LI><A HREF=\"#%@__ClassProperties\">Class Properties </A></LI>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([primaryKeyAttributes count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<LI><A HREF=\"#%@__PrimaryKeyAttributes\">Primary Key "
|
|
|
|
|
@"Attributes </A></LI>\r\n", entityName];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([relationships count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<LI><A HREF=\"#%@__Relationships\">Relationships </A></LI>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
}
|
|
|
|
|
if (userDictionary != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<LI><A HREF=\"#%@__UserDictionary\">User Dictionary </A></LI>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
[text appendString: @"</UL>\r\n"];
|
|
|
|
|
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([attributes count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i = 0;
|
|
|
|
|
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<hr><h3><A NAME=\"%@__Attributes\">Attributes </A></h3>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
[text appendString:
|
|
|
|
|
@"<TABLE BORDER= 1>\n <TR><TH>Name </TH><TH>Entity </TH><TH>Class "
|
|
|
|
|
@"Name </TH><TH>Type </TH><TH>DB Column Name / Definition </TH><TH>DB "
|
|
|
|
|
@"Type </TH><TH>Properties </TH><TH>UserDictionary </TH><TH>"
|
|
|
|
|
@"Description </TH></TR>\r\n"];
|
|
|
|
|
for (i = 0; i < [attributes count]; i++)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<TR>%@</TR>\r\n",
|
|
|
|
|
[attributes objectAtIndex: i]];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</TABLE>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([attributesUsedForLocking count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i = 0;
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<hr><H3><A NAME=\"%@__AttributesUsedForLocking\">"
|
|
|
|
|
@"Attributes Used For Locking </A></H3>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
[text appendString: @"<TABLE BORDER=\"1\">\r\n"];
|
|
|
|
|
for (i = 0; i < [attributesUsedForLocking count]; i++)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *elem = [attributesUsedForLocking objectAtIndex: i];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<TR><TD>%@</TD></TR>\r\n",
|
|
|
|
|
[self linkForSymbolKey:
|
|
|
|
|
[NSString stringWithFormat: @"%@##%@", currentEOEntity, elem]
|
|
|
|
|
ofTypes: EOClassPropertiesTypes
|
|
|
|
|
withText: elem]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</TABLE>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([classProperties count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i = 0;
|
|
|
|
|
|
|
|
|
|
[text appendFormat:
|
2001-04-19 12:02:13 +00:00
|
|
|
|
@"<hr><H3><A NAME=\"%@__ClassProperties\">"
|
|
|
|
|
@"Class Properties </A></h3>\r\n",
|
2000-09-20 14:02:03 +00:00
|
|
|
|
entityName];
|
|
|
|
|
[text appendString: @"<TABLE BORDER=\"1\">\r\n"];
|
|
|
|
|
for (i = 0; i < [classProperties count]; i++)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem = [classProperties objectAtIndex: i];
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<TR><TD>%@</TD></TR>\r\n",
|
|
|
|
|
[self linkForSymbolKey:
|
|
|
|
|
[NSString stringWithFormat: @"%@##%@", currentEOEntity, elem]
|
|
|
|
|
ofTypes: EOClassPropertiesTypes
|
|
|
|
|
withText: elem]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</TABLE>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([primaryKeyAttributes count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i = 0;
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<hr><H3><A NAME=\"%@__PrimaryKeyAttributes\">"
|
|
|
|
|
@"Primary Key Attributes </A></h3>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
[text appendString: @"<TABLE BORDER=\"1\">\r\n"];
|
|
|
|
|
for (i = 0; i < [primaryKeyAttributes count]; i++)
|
|
|
|
|
{
|
|
|
|
|
NSString *elem = [classProperties objectAtIndex: i];
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<TR><TD>%@</TD></TR>\r\n",
|
|
|
|
|
[self linkForSymbolKey:
|
|
|
|
|
[NSString stringWithFormat: @"%@##%@", currentEOEntity, elem]
|
|
|
|
|
ofTypes: EOClassPropertiesTypes
|
|
|
|
|
withText: elem]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</TABLE>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([relationships count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned i = 0;
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<hr><H3><A NAME=\"%@__Relationships\">"
|
|
|
|
|
@"Relationships </A></h3>\r\n", entityName];
|
|
|
|
|
|
|
|
|
|
[text appendString: @"<TABLE BORDER=\"1\">\r\n <TR><TH>Name </TH>"
|
|
|
|
|
@"<TH>Entity </TH><TH>Destination Entity </TH><TH>Properties </TH>"
|
2001-04-19 12:02:13 +00:00
|
|
|
|
@"<TH>Definition/Join(s) </TH><TH>User Dictionary </TH>"
|
2000-09-20 14:02:03 +00:00
|
|
|
|
@"<TH>Description </TH></TR>\r\n"];
|
|
|
|
|
for (i = 0; i < [relationships count]; i++)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<TR>%@</TR>\r\n",
|
|
|
|
|
[relationships objectAtIndex: i]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</TABLE>\r\n"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (userDictionary != nil)
|
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<hr><H3><A NAME=\"%@__UserDictionary\">"
|
|
|
|
|
@"User Dictionary </A></h3>\r\n",
|
|
|
|
|
entityName];
|
|
|
|
|
[text appendString: userDictionary];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
// Stop working on EOEntity
|
2000-09-20 14:02:03 +00:00
|
|
|
|
ASSIGN(currentEOEntity, nil);
|
2000-08-27 17:04:16 +00:00
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseEOAttribute: (xmlNodePtr)node
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *columnName
|
|
|
|
|
= [self getProp: "columnName" fromNode: node];
|
|
|
|
|
NSString *definition
|
|
|
|
|
= [self getProp: "definition" fromNode: node];
|
|
|
|
|
NSString *externalType
|
|
|
|
|
= [self getProp: "externalType" fromNode: node];
|
|
|
|
|
NSString *attributeName = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *valueClassName
|
|
|
|
|
= [self getProp: "valueClassName" fromNode: node];
|
|
|
|
|
NSString *valueType = [self getProp: "valueType" fromNode: node];
|
|
|
|
|
NSString *entityName
|
|
|
|
|
= [self getProp: "entityName" fromNode: node];
|
|
|
|
|
NSString *isReadOnly
|
|
|
|
|
= [self getProp: "isReadOnly" fromNode: node];
|
|
|
|
|
NSString *isDerived = [self getProp: "isDerived" fromNode: node];
|
|
|
|
|
NSString *isFlattened
|
|
|
|
|
= [self getProp: "isFlattened" fromNode: node];
|
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSString *userDictionary = nil;
|
|
|
|
|
NSString *completeRef = nil;
|
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing EOAttribute");
|
|
|
|
|
|
2000-08-27 17:04:16 +00:00
|
|
|
|
if (!attributeName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing attribute name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
completeRef
|
|
|
|
|
= [NSString stringWithFormat: @"%@##%@", currentEOEntity, attributeName];
|
|
|
|
|
if (ref == nil)
|
|
|
|
|
{
|
|
|
|
|
ref = completeRef;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
node = node->children;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node && strcmp(node->name, "EOUserDictionary") == 0)
|
|
|
|
|
{
|
|
|
|
|
userDictionary = [self parseDictionary: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (node && strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[self setEntry: attributeName
|
|
|
|
|
withExternalCompleteRef: completeRef
|
|
|
|
|
withExternalRef: completeRef
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"EOAttribute"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<TD><b><a name =\"%@\">%@</a></b></TD>",
|
|
|
|
|
ref, attributeName];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (entityName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>",
|
|
|
|
|
[self linkedItem: entityName ofTypes: EOEntitiesTypes]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (valueClassName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>",
|
|
|
|
|
[self linkedItem: valueClassName ofTypes: classesTypes]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (valueType)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", valueType];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (columnName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", columnName];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else if (definition)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", definition];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (externalType)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", externalType];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
if (isReadOnly)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"Read Only: %@<BR>", isReadOnly];
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-27 17:04:16 +00:00
|
|
|
|
if (isDerived)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"Derived: %@<BR>", isDerived];
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-27 17:04:16 +00:00
|
|
|
|
if (isFlattened)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"Flattened: %@<BR", isFlattened];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[text appendString: @"</TD>"];
|
|
|
|
|
|
2000-08-27 17:04:16 +00:00
|
|
|
|
if (userDictionary)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", userDictionary];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (desc)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", desc];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseEOAttributeRef: (xmlNodePtr)node
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *attributeName = [self getProp: "name" fromNode: node];
|
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing EOAttributeRef");
|
2000-08-27 17:04:16 +00:00
|
|
|
|
return attributeName;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseEORelationship: (xmlNodePtr)node
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
|
|
|
|
NSString *entityName = [self getProp: "entityName" fromNode: node];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *destinationEntityName
|
|
|
|
|
= [self getProp: "destinationEntityName" fromNode: node];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *relationshipName = [self getProp: "name" fromNode: node];
|
|
|
|
|
NSString *isToMany = [self getProp: "isToMany" fromNode: node];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSString *userDictionary = nil;
|
|
|
|
|
NSString *definition = nil;
|
|
|
|
|
NSMutableArray *joins = [NSMutableArray array];
|
|
|
|
|
NSString *completeRef = nil;
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing EORelationship");
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (!relationshipName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Missing relationship name");
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
completeRef
|
|
|
|
|
= [NSString stringWithFormat: @"%@##%@", currentEOEntity, relationshipName];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
// We're working on EORelationship
|
2000-09-20 14:02:03 +00:00
|
|
|
|
ASSIGN(currentEORelationship, relationshipName);
|
|
|
|
|
ASSIGN(currentEORelationshipDestinationEntity, destinationEntityName);
|
|
|
|
|
|
|
|
|
|
if (ref == nil)
|
|
|
|
|
ref = completeRef;
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
node = node->children;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (node && strcmp(node->name, "EORelationshipComponent") == 0)
|
|
|
|
|
{
|
|
|
|
|
definition = [self parseEORelationshipComponent: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
while (node && strcmp(node->name, "EOJoin") == 0)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *s = [self parseEOJoin: node];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (s)
|
|
|
|
|
{
|
|
|
|
|
[joins addObject: s];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
node = node->next;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (node && strcmp(node->name, "EOUserDictionary") == 0)
|
|
|
|
|
{
|
|
|
|
|
userDictionary = [self parseDictionary: node->children];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (node != 0 && strcmp(node->name, "desc") == 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
desc = [self parseDesc: node];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[self setEntry: relationshipName
|
|
|
|
|
withExternalCompleteRef: completeRef
|
|
|
|
|
withExternalRef: completeRef
|
|
|
|
|
withRef: ref
|
|
|
|
|
inIndexOfType: @"EORelationship"];
|
|
|
|
|
|
|
|
|
|
[text appendFormat: @"<TD><a name =\"%@\">%@</a></TD>",
|
2000-08-27 17:04:16 +00:00
|
|
|
|
completeRef,
|
|
|
|
|
relationshipName];
|
|
|
|
|
|
|
|
|
|
if (entityName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>",
|
|
|
|
|
[self linkedItem: entityName ofTypes: EOEntitiesTypes]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (destinationEntityName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>",
|
|
|
|
|
[self linkedItem: destinationEntityName ofTypes: EOEntitiesTypes]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
[text appendString: @"<TD>"];
|
|
|
|
|
if (isToMany)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"to many: %@<BR>", isToMany];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
[text appendString: @"</TD>"];
|
|
|
|
|
|
|
|
|
|
if (definition)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", definition];
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
else if ([joins count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
|
|
|
|
|
[text appendString:
|
|
|
|
|
@"<TD>\r\n <TABLE BORDER=\"1\">\r\n <TR><TH>Source attribute</TH>"
|
|
|
|
|
@"<TH>Destination Attribute </TH><TH>Operator </TH>"
|
|
|
|
|
@"<TH>Semantic </TH><TH>user Dictionary </TH>"
|
|
|
|
|
@"<TH>Description </TH></TR>"];
|
|
|
|
|
for (i = 0; i < [joins count]; i++)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<TR>%@</TR>", [joins objectAtIndex: i]];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"</TABLE>\r\n </TD>\r\n"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (userDictionary)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", userDictionary];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD></TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (desc)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", desc];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD></TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stop working on EORelationship
|
2000-09-20 14:02:03 +00:00
|
|
|
|
ASSIGN(currentEORelationshipDestinationEntity, nil);
|
|
|
|
|
ASSIGN(currentEORelationship, nil);
|
2000-08-27 17:04:16 +00:00
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseEORelationshipComponent: (xmlNodePtr)node
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *definition;
|
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing EORelationshipComponent");
|
|
|
|
|
definition = [self getProp: "definition" fromNode: node];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
node = node->children;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString:
|
|
|
|
|
[self linkForSymbolKey:
|
|
|
|
|
[NSString stringWithFormat: @"%@##%@", currentEOEntity, definition]
|
|
|
|
|
ofTypes: EOClassPropertiesTypes
|
|
|
|
|
withText: definition]];
|
|
|
|
|
while (node && strcmp(node->name, "EORelationshipComponent") == 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *s = [self parseEORelationshipComponent: node];
|
|
|
|
|
if (s)
|
|
|
|
|
[text appendFormat: @".%@", s];
|
|
|
|
|
node = node->next;
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) parseEOJoin: (xmlNodePtr)node
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableString *text = [NSMutableString string];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *ref = [self getProp: "id" fromNode: node];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *relationshipName
|
|
|
|
|
= [self getProp: "relationshipName" fromNode: node];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *joinOperator = [self getProp: "joinOperator" fromNode: node];
|
|
|
|
|
NSString *joinSemantic = [self getProp: "joinSemantic" fromNode: node];
|
|
|
|
|
NSString *sourceAttribute = [self getProp: "sourceAttribute" fromNode: node];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *destinationAttribute
|
|
|
|
|
= [self getProp: "destinationAttribute" fromNode: node];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *desc = nil;
|
|
|
|
|
NSString *userDictionary = nil;
|
|
|
|
|
|
|
|
|
|
NSDebugMLLog(@"debug", @"Start parsing EOJoin");
|
|
|
|
|
/*
|
2000-08-27 17:04:16 +00:00
|
|
|
|
if (!ref)
|
|
|
|
|
ref = relationshipName;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[self setEntry: relationshipName
|
|
|
|
|
withExternalCompleteRef: relationshipName
|
|
|
|
|
withExternalRef: relationshipName
|
|
|
|
|
withRef: ref
|
2000-08-27 17:04:16 +00:00
|
|
|
|
inIndexOfType: @"EOJoin"];
|
|
|
|
|
*/
|
2000-09-20 14:02:03 +00:00
|
|
|
|
/* [text appendFormat: @"<h2><a name =\"%@\">%@</a></h2>\r\n",
|
2000-08-27 17:04:16 +00:00
|
|
|
|
ref,
|
|
|
|
|
relationshipName];
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
if (relationshipName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>",
|
|
|
|
|
[self linkedItem: relationshipName ofTypes: EORelationshipsTypes]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendString: @"<TD></TD>"];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
*/
|
|
|
|
|
if (sourceAttribute)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>",
|
|
|
|
|
[self linkForSymbolKey:
|
|
|
|
|
[NSString stringWithFormat: @"%@##%@",
|
|
|
|
|
currentEOEntity, sourceAttribute]
|
|
|
|
|
ofTypes: EOClassPropertiesTypes
|
|
|
|
|
withText: sourceAttribute]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD></TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (destinationAttribute)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>\r\n",
|
|
|
|
|
[self linkForSymbolKey:
|
|
|
|
|
[NSString stringWithFormat: @"%@##%@",
|
|
|
|
|
currentEORelationshipDestinationEntity, destinationAttribute]
|
|
|
|
|
ofTypes: EOClassPropertiesTypes
|
|
|
|
|
withText: destinationAttribute]];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD></TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (joinOperator)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>\r\n", joinOperator];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD></TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (joinSemantic)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[text appendFormat: @"<TD>%@</TD>\r\n", joinSemantic];
|
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD></TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userDictionary)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: userDictionary];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD></TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
if (desc)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendFormat: @"<TD>%@</TD>", desc];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[text appendString: @"<TD></TD>"];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
return text;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-27 17:04:16 +00:00
|
|
|
|
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) setEntry: (NSString *)entry
|
|
|
|
|
withExternalCompleteRef: (NSString *)externalCompleteRef
|
|
|
|
|
withExternalRef: (NSString *)externalRef
|
|
|
|
|
withRef: (NSString *)ref
|
|
|
|
|
inIndexOfType: (NSString *)type
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSMutableDictionary *index = nil;
|
|
|
|
|
NSAssert(entry, @"No entry");
|
|
|
|
|
NSAssert1(ref, @"No ref for %@", entry);
|
|
|
|
|
NSAssert1(type, @"No type for %@", entry);
|
|
|
|
|
index = [self indexForType: type];
|
2000-08-27 17:04:16 +00:00
|
|
|
|
[index setObject: entry forKey: ref];
|
|
|
|
|
[refToFile setObject: currName forKey: ref];
|
|
|
|
|
|
|
|
|
|
if (processFileReferencesFlag && externalCompleteRef && externalRef)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableDictionary *typeDict = [fileReferences objectForKey: type];
|
|
|
|
|
if (!fileReferences)
|
2000-08-27 17:04:16 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
fileReferences = [NSMutableDictionary new];
|
|
|
|
|
}
|
|
|
|
|
if (!typeDict)
|
|
|
|
|
{
|
|
|
|
|
typeDict = [NSMutableDictionary dictionary];
|
|
|
|
|
[fileReferences setObject: typeDict
|
|
|
|
|
forKey: type];
|
|
|
|
|
}
|
|
|
|
|
if (![typeDict objectForKey: externalCompleteRef])
|
|
|
|
|
{
|
|
|
|
|
NSMutableDictionary *thisEntry
|
|
|
|
|
= [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
|
|
|
|
entry, @"title",
|
|
|
|
|
externalRef, @"ref",
|
|
|
|
|
externalCompleteRef, @"completeRef",
|
|
|
|
|
ref, @"fragment",
|
|
|
|
|
type, @"type",
|
|
|
|
|
[currName stringByDeletingPathExtension], @"fileName",
|
|
|
|
|
nil];
|
|
|
|
|
[typeDict setObject: thisEntry
|
|
|
|
|
forKey: externalCompleteRef];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSArray *) contents
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
|
|
|
|
return contents;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSDictionary *) fileReferences
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
|
|
|
|
return fileReferences;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) setGeneralReferences: (NSDictionary *)dict
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
ASSIGN(generalReferences, dict);
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) setVariablesDictionary: (NSDictionary *)dict
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
|
|
|
|
DESTROY(variablesDictionary);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
variablesDictionary = [dict mutableCopy];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
//Return a link for item (something like: <A HREF="TheFile.html#fragment">TheItem </A>) of type types
|
|
|
|
|
- (NSString *) linkedItem: (NSString *)item
|
|
|
|
|
ofTypes: (NSArray *)types
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *linked = nil;
|
|
|
|
|
NSRange foundRange;
|
|
|
|
|
|
|
|
|
|
foundRange = [item rangeOfCharacterFromSet:
|
|
|
|
|
[NSCharacterSet alphanumericCharacterSet]];
|
|
|
|
|
if (foundRange.length> 0)
|
|
|
|
|
{
|
|
|
|
|
NSString *goodItem = nil;
|
|
|
|
|
NSDictionary *symbol = nil;
|
|
|
|
|
NSRange goodRange = NSMakeRange(foundRange.location, 1);
|
|
|
|
|
while (foundRange.length> 0 && NSMaxRange(foundRange) < [item length])
|
|
|
|
|
{
|
|
|
|
|
foundRange = [item rangeOfCharacterFromSet:
|
|
|
|
|
[NSCharacterSet alphanumericCharacterSet]
|
|
|
|
|
options: 0
|
|
|
|
|
range: NSMakeRange(foundRange.location+1, 1)];
|
|
|
|
|
if (foundRange.length> 0)
|
|
|
|
|
goodRange.length++;
|
|
|
|
|
}
|
|
|
|
|
goodItem = [item substringWithRange: goodRange];
|
|
|
|
|
symbol = [self findSymbolForKey: goodItem
|
|
|
|
|
ofTypes: types];
|
|
|
|
|
if (symbol)
|
|
|
|
|
{
|
|
|
|
|
linked = [self linkForSymbol: symbol
|
|
|
|
|
withText: goodItem];
|
|
|
|
|
if (goodRange.location> 0)
|
|
|
|
|
{
|
|
|
|
|
linked = [NSString stringWithFormat: @"%@%@",
|
|
|
|
|
[item substringWithRange: NSMakeRange(0, goodRange.location-1)],
|
|
|
|
|
linked];
|
|
|
|
|
}
|
|
|
|
|
if (goodRange.location+goodRange.length < [item length])
|
|
|
|
|
{
|
|
|
|
|
linked = [NSString stringWithFormat: @"%@%@", linked,
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[item substringWithRange:
|
|
|
|
|
NSMakeRange(goodRange.location+goodRange.length,
|
|
|
|
|
[item length]-(goodRange.location+goodRange.length))]];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if (!linked)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
linked = item;
|
2000-08-13 16:00:14 +00:00
|
|
|
|
return linked;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) linkForSymbolKey: (NSString *)key_
|
|
|
|
|
ofTypes: (NSArray *)types
|
|
|
|
|
withText: (NSString *)text
|
2000-08-24 17:24:40 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDictionary *symbol = [self findSymbolForKey: key_ ofTypes: types];
|
2000-08-24 17:24:40 +00:00
|
|
|
|
if (symbol)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
return [self linkForSymbol: symbol withText: text];
|
2000-08-24 17:24:40 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
return text;
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
//Return the symbol for key
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSDictionary *) findSymbolForKey: (NSString *)key_ ofTypes: (NSArray *)types
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDictionary *symbol = nil;
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; symbol == nil && i < [types count]; i++)
|
|
|
|
|
{
|
|
|
|
|
id type = [types objectAtIndex: i];
|
|
|
|
|
|
|
|
|
|
symbol = [[generalReferences objectForKey: type] objectForKey: key_];
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
return symbol;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Return a link for symbol with label text
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (NSString *) linkForSymbol: (NSDictionary *)symbol
|
|
|
|
|
withText: (NSString *)text
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *symbolLocation
|
|
|
|
|
= [[symbol objectForKey: @"project"] objectForKey: @"location"];
|
|
|
|
|
NSString *locationTmp = location;
|
|
|
|
|
NSString *common = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *prefix = @"";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *fragment = nil;
|
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([locationTmp length] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
//Equal: no prefix
|
|
|
|
|
if ([locationTmp isEqual: symbolLocation] == NO)
|
|
|
|
|
{
|
|
|
|
|
if ([locationTmp hasSuffix: @"/"] == NO)
|
|
|
|
|
locationTmp = [locationTmp stringByAppendingString: @"/"];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([symbolLocation length] > 0 && ![symbolLocation hasSuffix: @"/"])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
symbolLocation = [symbolLocation stringByAppendingString: @"/"];
|
|
|
|
|
common = [symbolLocation commonPrefixWithString: location
|
|
|
|
|
options: 0];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([common length] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
int i = 0;
|
|
|
|
|
NSMutableArray *locationParts;
|
|
|
|
|
NSMutableArray *symbolLocationParts;
|
|
|
|
|
|
|
|
|
|
locationParts
|
|
|
|
|
= [[locationTmp componentsSeparatedByString: @"/"]
|
|
|
|
|
mutableCopy];
|
|
|
|
|
AUTORELEASE(locationParts);
|
|
|
|
|
symbolLocationParts
|
|
|
|
|
= [[symbolLocation componentsSeparatedByString: @"/"]
|
|
|
|
|
mutableCopy];
|
|
|
|
|
AUTORELEASE(symbolLocationParts);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[locationParts removeLastObject];
|
|
|
|
|
[symbolLocationParts removeLastObject];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
while ([locationParts count] > 0
|
|
|
|
|
&& [symbolLocationParts count] > 0
|
|
|
|
|
&& [[locationParts objectAtIndex: 0] isEqual:
|
|
|
|
|
[symbolLocationParts objectAtIndex: 0]])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
[locationParts removeObjectAtIndex: 0];
|
|
|
|
|
[symbolLocationParts removeObjectAtIndex: 0];
|
|
|
|
|
}
|
|
|
|
|
prefix = [NSString string];
|
|
|
|
|
for (i = 0; i < [locationParts count]; i++)
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
prefix = [@".." stringByAppendingPathComponent: prefix];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
for (i = 0; i < [symbolLocationParts count]; i++)
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
prefix = [prefix stringByAppendingPathComponent:
|
|
|
|
|
[symbolLocationParts objectAtIndex: i]];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2001-04-19 12:02:13 +00:00
|
|
|
|
prefix = ([symbolLocation length] > 0 ? symbolLocation : @"");
|
2000-08-13 16:00:14 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
else
|
2000-09-20 14:02:03 +00:00
|
|
|
|
// No Project Location ==> take symbol location
|
2001-04-19 12:02:13 +00:00
|
|
|
|
prefix = ([symbolLocation length] > 0 ? symbolLocation : @"");
|
2000-09-20 14:02:03 +00:00
|
|
|
|
fragment = [symbol objectForKey: @"fragment"];
|
|
|
|
|
return [NSString stringWithFormat: @"<A HREF=\"%@%@%@\">%@</A>",
|
|
|
|
|
[[prefix stringByAppendingPathComponent: [symbol objectForKey: @"fileName"]]
|
2001-04-19 12:02:13 +00:00
|
|
|
|
stringByAppendingPathExtension: pathExtension_HTML],
|
|
|
|
|
([fragment length] > 0 ? @"#" : @""),
|
|
|
|
|
(fragment ? fragment : @""),
|
|
|
|
|
text];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) setWriteFlag: (BOOL)flag
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
writeFlag = flag;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) setProcessFileReferencesFlag: (BOOL)flag
|
2000-08-16 14:08:08 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
processFileReferencesFlag = flag;
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
- (void) setProjectName: (NSString *)projectName_
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
ASSIGN(projectName, projectName_);
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-08-16 14:08:08 +00:00
|
|
|
|
@end
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
// Return files list of files in symbols
|
|
|
|
|
//
|
|
|
|
|
// symbols:
|
|
|
|
|
// {
|
2001-04-19 12:02:13 +00:00
|
|
|
|
// class =
|
|
|
|
|
// {
|
|
|
|
|
// "NSString" = { fileName = "NSString.gsdoc"; ...}
|
|
|
|
|
// "NSArray" = { fileName = "NSArray.gsdoc"; ... }
|
2000-08-16 14:08:08 +00:00
|
|
|
|
// ...
|
2001-04-19 12:02:13 +00:00
|
|
|
|
// }
|
|
|
|
|
// type = {
|
|
|
|
|
// ...
|
|
|
|
|
// }
|
|
|
|
|
// ...
|
|
|
|
|
// }
|
2000-08-13 16:00:14 +00:00
|
|
|
|
//
|
|
|
|
|
// Return:
|
|
|
|
|
// ( NSString.gsdoc, NSArray.gsdoc, ... )
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSArray *
|
|
|
|
|
FilesFromSymbols(NSDictionary *symbols)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSArray *sortedFiles = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSMutableArray *files = [NSMutableArray arrayWithCapacity: 2];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSEnumerator *typesEnumerator = [symbols keyEnumerator];
|
|
|
|
|
id typeKey = nil;
|
|
|
|
|
|
|
|
|
|
while ((typeKey = [typesEnumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
NSDictionary *type = [symbols objectForKey: typeKey];
|
|
|
|
|
NSEnumerator *symbolsEnumerator = [type keyEnumerator];
|
|
|
|
|
id symbolKey = nil;
|
|
|
|
|
|
|
|
|
|
while ((symbolKey = [symbolsEnumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
NSDictionary *symbol = [type objectForKey: symbolKey];
|
|
|
|
|
id file = [symbol objectForKey: @"fileName"];
|
|
|
|
|
|
|
|
|
|
if (![files containsObject: file])
|
|
|
|
|
[files addObject: file];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sortedFiles = [files sortedArrayUsingSelector: @selector(compare:)];
|
2000-08-13 16:00:14 +00:00
|
|
|
|
return sortedFiles;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
/*
|
|
|
|
|
* Return list of files found in dir (deep search) which have
|
|
|
|
|
* extension extension
|
|
|
|
|
*/
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSArray *
|
|
|
|
|
FilesInPathWithExtension(NSString *dir, NSString *extension)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSMutableArray *files = [NSMutableArray array];
|
|
|
|
|
NSString *file = nil;
|
|
|
|
|
NSFileManager *fm = [NSFileManager defaultManager];
|
|
|
|
|
NSDirectoryEnumerator *enumerator = [fm enumeratorAtPath: dir];
|
|
|
|
|
|
|
|
|
|
while ((file = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
file = [dir stringByAppendingPathComponent: file];
|
|
|
|
|
if ([[file pathExtension] isEqual: extension])
|
|
|
|
|
{
|
|
|
|
|
BOOL isDirectory = NO;
|
|
|
|
|
|
|
|
|
|
if ([fm fileExistsAtPath: file isDirectory: &isDirectory])
|
|
|
|
|
{
|
|
|
|
|
if (isDirectory == NO)
|
2000-08-16 14:08:08 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[files addObject: file];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
return files;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2000-08-16 14:08:08 +00:00
|
|
|
|
//--------------------------------------------------------------------
|
2000-09-20 14:02:03 +00:00
|
|
|
|
void
|
|
|
|
|
AddSymbolsToReferencesWithProjectInfo(NSDictionary *symbols,
|
|
|
|
|
NSMutableDictionary *references, NSDictionary *projectInfo, BOOL override)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *projectName = [projectInfo objectForKey: @"projectName"];
|
|
|
|
|
|
2000-08-24 17:24:40 +00:00
|
|
|
|
if (symbols)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSEnumerator *typesEnumerator = nil;
|
|
|
|
|
id typeKey = nil;
|
|
|
|
|
|
|
|
|
|
NSCAssert1([symbols isKindOfClass: [NSDictionary class]],
|
2001-04-19 12:02:13 +00:00
|
|
|
|
@"%@ is not a dictionary", symbols);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
typesEnumerator = [symbols keyEnumerator];
|
|
|
|
|
while ((typeKey = [typesEnumerator nextObject]) != nil)
|
2000-08-24 17:24:40 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDictionary *type = [symbols objectForKey: typeKey];
|
|
|
|
|
if ([type isKindOfClass: [NSDictionary class]] == NO)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Warning: Type %@ is not a dictionary", type);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSEnumerator *symbolsEnumerator;
|
|
|
|
|
id symbolKey = nil;
|
|
|
|
|
NSMutableDictionary *referencesType;
|
|
|
|
|
|
|
|
|
|
symbolsEnumerator = [type keyEnumerator];
|
|
|
|
|
referencesType = [references objectForKey: typeKey];
|
|
|
|
|
if (referencesType == nil)
|
|
|
|
|
{
|
|
|
|
|
referencesType = [NSMutableDictionary dictionary];
|
|
|
|
|
[references setObject: referencesType
|
|
|
|
|
forKey: typeKey];
|
|
|
|
|
}
|
|
|
|
|
while ((symbolKey = [symbolsEnumerator nextObject]) != nil)
|
2000-08-16 14:08:08 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDictionary *symbol = [type objectForKey: symbolKey];
|
|
|
|
|
|
|
|
|
|
if (![symbol isKindOfClass: [NSDictionary class]])
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Warning: Symbol %@ is not a dictionary", symbol);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSMutableDictionary *symbolNew;
|
|
|
|
|
|
|
|
|
|
symbolNew = [NSMutableDictionary
|
|
|
|
|
dictionaryWithDictionary: symbol];
|
|
|
|
|
if (verbose >= 4)
|
2000-08-16 14:08:08 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSLog(@"Project %@ Processing reference %@",
|
|
|
|
|
projectName, symbolKey);
|
2000-08-24 17:24:40 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (projectInfo)
|
|
|
|
|
[symbolNew setObject: projectInfo
|
|
|
|
|
forKey: @"project"];
|
|
|
|
|
NSCAssert(symbolKey, @"No symbolKey");
|
|
|
|
|
|
|
|
|
|
if (override || ![referencesType objectForKey: symbolKey])
|
|
|
|
|
[referencesType setObject: symbolNew
|
|
|
|
|
forKey: symbolKey];
|
|
|
|
|
NSCAssert1([symbolNew objectForKey: @"ref"],
|
|
|
|
|
@"No ref for symbol %@", symbolKey);
|
|
|
|
|
if (override || ![referencesType objectForKey:
|
|
|
|
|
[symbolNew objectForKey: @"ref"]])
|
|
|
|
|
{
|
|
|
|
|
[referencesType setObject: symbolNew
|
|
|
|
|
forKey: [symbolNew objectForKey:
|
|
|
|
|
@"ref"]];
|
|
|
|
|
}
|
|
|
|
|
if (projectName)
|
2000-08-24 17:24:40 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *symbolType
|
|
|
|
|
= [symbolNew objectForKey: @"type"];
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if ([symbolType isEqual: @"file"])
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *fileName
|
|
|
|
|
= [symbolNew objectForKey: @"fileName"];
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (fileName)
|
2000-08-16 14:08:08 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *fileRef = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
|
|
|
|
fileName
|
|
|
|
|
= [fileName stringByDeletingPathExtension];
|
|
|
|
|
fileRef
|
|
|
|
|
= [NSString stringWithFormat: @"%@##%@",
|
|
|
|
|
projectName, fileName];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[symbolNew setObject: fileRef
|
2001-04-19 12:02:13 +00:00
|
|
|
|
forKey: @"completeRef"];
|
|
|
|
|
if (override
|
|
|
|
|
|| ![referencesType objectForKey: fileRef])
|
|
|
|
|
{
|
|
|
|
|
[referencesType setObject: symbolNew
|
|
|
|
|
forKey: fileRef];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-24 17:24:40 +00:00
|
|
|
|
if (projectName)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *fileName
|
|
|
|
|
= [[projectInfo objectForKey: @"indexfileName"]
|
|
|
|
|
stringByDeletingPathExtension];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *fileRef = nil;
|
|
|
|
|
NSMutableDictionary *referencesType = [references objectForKey: @"file"];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (!referencesType)
|
2000-08-24 17:24:40 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
referencesType = [NSMutableDictionary dictionary];
|
|
|
|
|
[references setObject: referencesType
|
2001-04-19 12:02:13 +00:00
|
|
|
|
forKey: @"file"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
if (!fileName)
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
fileName = @"index";
|
|
|
|
|
}
|
|
|
|
|
fileRef = [NSString stringWithFormat: @"%@##%@", projectName, fileName];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (override || ![referencesType objectForKey: fileRef])
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSMutableDictionary *symbol
|
|
|
|
|
= [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
|
|
|
|
fileRef, @"completeRef",
|
|
|
|
|
fileName, @"fileName",
|
|
|
|
|
fileName, @"ref",
|
|
|
|
|
@"file", @"type",
|
|
|
|
|
nil];
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (projectInfo)
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
[symbol setObject: projectInfo
|
|
|
|
|
forKey: @"project"];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[referencesType setObject: symbol
|
2001-04-19 12:02:13 +00:00
|
|
|
|
forKey: fileRef];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
2001-04-19 12:02:13 +00:00
|
|
|
|
int
|
|
|
|
|
main(int argc, char **argv, char **env)
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
|
|
|
|
NSProcessInfo *proc;
|
|
|
|
|
NSArray *args;
|
|
|
|
|
unsigned i;
|
2000-06-29 03:51:06 +00:00
|
|
|
|
NSUserDefaults *defs;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *makeRefsFileName = nil;
|
|
|
|
|
NSString *projectName = nil;
|
|
|
|
|
NSMutableArray *files = nil;
|
|
|
|
|
NSMutableArray *references = nil;
|
|
|
|
|
NSMutableDictionary *generalReferences = nil;
|
|
|
|
|
NSMutableDictionary *projectReferences = nil;
|
|
|
|
|
NSString *makeIndexBaseFileName = nil;
|
|
|
|
|
NSString *makeIndexFileNameGSDoc = nil;
|
|
|
|
|
NSString *makeIndexTemplateFileName = nil;
|
|
|
|
|
NSMutableDictionary *infoDictionary = nil;
|
|
|
|
|
NSDictionary *variablesDictionary = nil;
|
|
|
|
|
NSMutableDictionary *projectInfo = nil;
|
|
|
|
|
BOOL goOn = YES;
|
|
|
|
|
NSFileManager *fileManager = nil;
|
|
|
|
|
CREATE_AUTORELEASE_POOL(pool);
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-06-29 03:51:06 +00:00
|
|
|
|
#ifdef GS_PASS_ARGUMENTS
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[NSProcessInfo initializeWithArguments: argv count: argc environment: env];
|
2000-06-29 03:51:06 +00:00
|
|
|
|
#endif
|
2002-06-14 08:02:53 +00:00
|
|
|
|
NSLog(@"WARNING ... gsdoc is deprecated. please use autogsdoc instead");
|
|
|
|
|
|
2000-06-29 03:51:06 +00:00
|
|
|
|
defs = [NSUserDefaults standardUserDefaults];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
|
2001-04-19 12:02:13 +00:00
|
|
|
|
@"Yes", @"Monolithic", nil]];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
proc = [NSProcessInfo processInfo];
|
|
|
|
|
if (proc == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"unable to get process information!");
|
2001-04-19 12:02:13 +00:00
|
|
|
|
goOn = NO;
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
fileManager = [NSFileManager defaultManager];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (goOn == YES)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
args = [proc arguments];
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
// First, process arguments
|
|
|
|
|
for (i = 1; goOn && i < [args count]; i++)
|
|
|
|
|
{
|
|
|
|
|
NSString *arg = [args objectAtIndex: i];
|
|
|
|
|
// is this an option ?
|
|
|
|
|
if ([arg hasPrefix: @"--"])
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *argWithoutPrefix;
|
|
|
|
|
NSString *value;
|
|
|
|
|
NSString *key;
|
|
|
|
|
NSArray *parts;
|
|
|
|
|
|
2002-09-15 18:26:56 +00:00
|
|
|
|
argWithoutPrefix = [arg stringByDeletingPrefix: @"--"];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
parts = [argWithoutPrefix componentsSeparatedByString: @"="];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
key = [parts objectAtIndex: 0];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
|
|
|
|
if ([parts count] > 1)
|
|
|
|
|
{
|
|
|
|
|
NSRange r = NSMakeRange(1, [parts count]-1);
|
|
|
|
|
NSArray *sub = [parts subarrayWithRange: r];
|
|
|
|
|
|
|
|
|
|
value = [sub componentsJoinedByString: @"="];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
value = nil;
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
// makeRefs option
|
|
|
|
|
if ([key isEqualToString: @"makeRefs"])
|
|
|
|
|
{
|
|
|
|
|
makeRefsFileName = value;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (makeRefsFileName != nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *ext = [makeRefsFileName pathExtension];
|
|
|
|
|
|
|
|
|
|
if ([ext isEqual: pathExtension_GSDocRefs] == NO)
|
|
|
|
|
{
|
|
|
|
|
makeRefsFileName = [makeRefsFileName
|
|
|
|
|
stringByAppendingPathExtension:
|
|
|
|
|
pathExtension_GSDocRefs];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
makeRefsFileName = @"";
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([key isEqualToString: @"projectName"])
|
2000-02-28 16:23:53 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
projectName = value;
|
|
|
|
|
NSCAssert([projectName length], @"No project name");
|
|
|
|
|
}
|
|
|
|
|
else if ([key isEqualToString: @"refs"])
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (references == nil)
|
|
|
|
|
{
|
|
|
|
|
references = [NSMutableArray arrayWithCapacity: 4];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSCAssert([value length], @"No index");
|
|
|
|
|
[references addObject: value];
|
|
|
|
|
}
|
|
|
|
|
else if ([key isEqualToString: @"makeIndex"])
|
|
|
|
|
{
|
|
|
|
|
makeIndexBaseFileName = value;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (makeIndexBaseFileName != nil)
|
|
|
|
|
{
|
|
|
|
|
makeIndexBaseFileName
|
|
|
|
|
= [makeIndexBaseFileName stringByDeletingPathExtension];
|
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
else
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
makeIndexBaseFileName = @"index";
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([key isEqualToString: @"makeIndexTemplate"])
|
|
|
|
|
{
|
|
|
|
|
makeIndexTemplateFileName = value;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSCAssert([makeIndexTemplateFileName length],
|
|
|
|
|
@"No makeIndexTemplate filename");
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([key hasPrefix: @"verbose"])
|
|
|
|
|
{
|
|
|
|
|
NSCAssert1(value, @"No value for %@", key);
|
|
|
|
|
verbose = [value intValue];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (verbose > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSMutableSet *debugSet = [proc debugSet];
|
|
|
|
|
[debugSet addObject: @"dflt"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ([key hasPrefix: @"location"])
|
|
|
|
|
{
|
|
|
|
|
NSCAssert1(value, @"No value for %@", key);
|
|
|
|
|
location = value;
|
|
|
|
|
}
|
|
|
|
|
else if ([key hasPrefix: @"define-"])
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (infoDictionary == nil)
|
|
|
|
|
{
|
|
|
|
|
infoDictionary = [NSMutableDictionary dictionary];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSCAssert1(value, @"No value for %@", key);
|
|
|
|
|
[infoDictionary setObject: value
|
2002-09-15 18:26:56 +00:00
|
|
|
|
forKey: [key stringByDeletingPrefix: @"define-"]];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Unknown option %@", arg);
|
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (files == nil)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
files = [NSMutableArray array];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
/*
|
|
|
|
|
* FIXME
|
|
|
|
|
* Dirty Hack to handle *.gsdoc and *
|
|
|
|
|
* We need this because sometimes, there are too many files
|
|
|
|
|
* for commande line
|
|
|
|
|
*/
|
|
|
|
|
if ([[arg lastPathComponent] hasSuffix:
|
|
|
|
|
[NSString stringWithFormat: @"*.%@", pathExtension_GSDoc]]
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|| [[arg lastPathComponent]hasSuffix: @"*"])
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSArray *dirContent = nil;
|
|
|
|
|
int ifile = 0;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
arg = [arg stringByDeletingLastPathComponent];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([arg length] == 0)
|
|
|
|
|
{
|
|
|
|
|
arg = [fileManager currentDirectoryPath];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
dirContent = [fileManager directoryContentsAtPath: arg];
|
|
|
|
|
for (ifile = 0; ifile < [dirContent count]; ifile++)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *file = [dirContent objectAtIndex: ifile];
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if ([[file pathExtension] isEqual: pathExtension_GSDoc])
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[files addObject: file];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
[files addObject: arg];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
//Default Values
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (projectName == nil)
|
|
|
|
|
{
|
|
|
|
|
projectName = @"unknown";
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if ([makeRefsFileName length]== 0)
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
makeRefsFileName = [projectName
|
|
|
|
|
stringByAppendingPathExtension: pathExtension_GSDocRefs];
|
|
|
|
|
}
|
|
|
|
|
if (makeIndexBaseFileName != nil)
|
|
|
|
|
{
|
|
|
|
|
makeIndexFileNameGSDoc = [makeIndexBaseFileName
|
|
|
|
|
stringByAppendingPathExtension: pathExtension_GSDoc];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
// Verify option compatibilities
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
// Construct project references
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
BOOL addedSymbols = NO;
|
|
|
|
|
NSDictionary *previousProjectReferences = nil;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugFLLog(@"debug", @"Construct project references");
|
2001-04-19 12:02:13 +00:00
|
|
|
|
projectReferences = [NSMutableDictionary dictionaryWithCapacity: 2];
|
|
|
|
|
[projectReferences
|
|
|
|
|
setObject: [NSMutableDictionary dictionaryWithCapacity: 2]
|
|
|
|
|
forKey: @"symbols"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
projectInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
2001-04-19 12:02:13 +00:00
|
|
|
|
projectName, @"projectName", nil];
|
|
|
|
|
if (location != nil)
|
|
|
|
|
{
|
|
|
|
|
[projectInfo setObject: location forKey: @"location"];
|
|
|
|
|
}
|
|
|
|
|
if (makeIndexBaseFileName != nil)
|
|
|
|
|
{
|
|
|
|
|
[projectInfo setObject: makeIndexBaseFileName
|
|
|
|
|
forKey: @"indexfileName"];
|
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
//Read project existing references
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (makeRefsFileName != nil)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
BOOL isDirectory = NO;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if ([fileManager fileExistsAtPath: makeRefsFileName
|
2001-04-19 12:02:13 +00:00
|
|
|
|
isDirectory: &isDirectory])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (isDirectory == NO)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
previousProjectReferences = [NSDictionary
|
|
|
|
|
dictionaryWithContentsOfFile: makeRefsFileName];
|
|
|
|
|
if ([previousProjectReferences objectForKey: @"symbols"])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
AddSymbolsToReferencesWithProjectInfo(
|
|
|
|
|
[previousProjectReferences objectForKey: @"symbols"],
|
|
|
|
|
[projectReferences objectForKey: @"symbols"],
|
|
|
|
|
projectInfo, NO);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
addedSymbols = YES;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (addedSymbols == NO)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
AddSymbolsToReferencesWithProjectInfo(nil,
|
2001-04-19 12:02:13 +00:00
|
|
|
|
[projectReferences objectForKey: @"symbols"], projectInfo, NO);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
// Process references (construct a dictionary of all references)
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSDebugFLLog(@"debug", @"Process references");
|
2001-04-19 12:02:13 +00:00
|
|
|
|
generalReferences = [NSMutableDictionary dictionaryWithCapacity: 2];
|
|
|
|
|
if ([references count] > 0)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
/*
|
|
|
|
|
* From last to first so references are taken in
|
|
|
|
|
* first to last priority
|
|
|
|
|
*/
|
|
|
|
|
while (goOn && [references count] > 0)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *file = [references lastObject];
|
|
|
|
|
BOOL isDirectory = NO;
|
|
|
|
|
|
|
|
|
|
if (![fileManager fileExistsAtPath: file
|
|
|
|
|
isDirectory: &isDirectory])
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSLog(@"Index File %@ doesn't exist", file);
|
|
|
|
|
[references removeLastObject];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (isDirectory)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSArray *tmpReferences;
|
|
|
|
|
|
|
|
|
|
tmpReferences = FilesInPathWithExtension(file,
|
|
|
|
|
pathExtension_GSDocRefs);
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (verbose >= 3)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSLog(@"Processing references directory %@", file);
|
|
|
|
|
}
|
|
|
|
|
[references removeLastObject];
|
|
|
|
|
[references addObjectsFromArray: tmpReferences];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSDictionary *generalIndexTmp = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (verbose >= 2)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Processing references file %@", file);
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
generalIndexTmp = [NSDictionary
|
|
|
|
|
dictionaryWithContentsOfFile: file];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (!generalIndexTmp)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"File %@ isn't a dictionary", file);
|
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSDictionary *fileProjectInfo;
|
|
|
|
|
NSDictionary *symbols;
|
|
|
|
|
|
|
|
|
|
fileProjectInfo
|
|
|
|
|
= [generalIndexTmp objectForKey: @"project"];
|
|
|
|
|
symbols = [generalIndexTmp objectForKey: @"symbols"];
|
|
|
|
|
|
|
|
|
|
NSCAssert1(fileProjectInfo,
|
|
|
|
|
@"No Project Info in %@", file);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSCAssert1(symbols, @"No symbols %@", file);
|
|
|
|
|
AddSymbolsToReferencesWithProjectInfo(symbols,
|
2001-04-19 12:02:13 +00:00
|
|
|
|
generalReferences, fileProjectInfo, YES);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
[references removeLastObject];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-16 14:08:08 +00:00
|
|
|
|
//Variables
|
2000-08-13 16:00:14 +00:00
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSMutableDictionary *variablesMutableDictionary;
|
|
|
|
|
NSEnumerator *enumer;
|
|
|
|
|
id key = nil;
|
|
|
|
|
|
|
|
|
|
variablesMutableDictionary = [NSMutableDictionary dictionary];
|
|
|
|
|
enumer = [infoDictionary keyEnumerator];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugFLLog(@"debug", @"Variables");
|
|
|
|
|
while ((key = [enumer nextObject]))
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
id v;
|
|
|
|
|
NSString *k;
|
|
|
|
|
|
|
|
|
|
v = [infoDictionary objectForKey: key];
|
|
|
|
|
k = [NSString stringWithFormat: @"[[infoDictionary.%@]]", key];
|
|
|
|
|
[variablesMutableDictionary setObject: v forKey: k];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
[variablesMutableDictionary setObject: [NSCalendarDate calendarDate]
|
2001-04-19 12:02:13 +00:00
|
|
|
|
forKey: @"[[timestampString]]"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (makeIndexBaseFileName)
|
|
|
|
|
{
|
|
|
|
|
[variablesMutableDictionary setObject: makeIndexFileNameGSDoc
|
2001-04-19 12:02:13 +00:00
|
|
|
|
forKey: @"[[indexFileName]]"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[variablesMutableDictionary setObject: makeIndexBaseFileName
|
2001-04-19 12:02:13 +00:00
|
|
|
|
forKey: @"[[indexBaseFileName]]"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if (projectName != nil)
|
|
|
|
|
{
|
|
|
|
|
[variablesMutableDictionary setObject: projectName
|
|
|
|
|
forKey: @"[[projectName]]"];
|
|
|
|
|
}
|
|
|
|
|
variablesDictionary = [variablesMutableDictionary copy];
|
|
|
|
|
AUTORELEASE(variablesDictionary);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
|
|
|
|
|
if (verbose >= 3)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSEnumerator *enumer = [variablesDictionary keyEnumerator];
|
|
|
|
|
id key = nil;
|
|
|
|
|
|
2000-08-13 16:00:14 +00:00
|
|
|
|
while ((key = [enumer nextObject]))
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Variables: %@=%@",
|
2001-04-19 12:02:13 +00:00
|
|
|
|
key, [variablesDictionary objectForKey: key]);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
// Find Files to parse
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSDebugFLLog(@"debug", @"Find Files to parse");
|
2001-04-19 12:02:13 +00:00
|
|
|
|
if ([files count] < 1)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"No file names given to parse.");
|
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
else
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSMutableArray *tmpNewFiles = [NSMutableArray array];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
for (i = 0; goOn && i < [files count]; i++)
|
|
|
|
|
{
|
|
|
|
|
NSString *file = [files objectAtIndex: i];
|
|
|
|
|
BOOL isDirectory = NO;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
|
|
|
|
if (![fileManager fileExistsAtPath: file
|
|
|
|
|
isDirectory: &isDirectory])
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSLog(@"File %@ doesn't exist", file);
|
|
|
|
|
goOn = NO;
|
2000-02-28 16:23:53 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
else
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (isDirectory)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSArray *tmpFiles;
|
|
|
|
|
|
|
|
|
|
tmpFiles
|
|
|
|
|
= FilesInPathWithExtension(file, pathExtension_GSDoc);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[tmpNewFiles addObjectsFromArray: tmpFiles];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[tmpNewFiles addObject: file];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
files = [[tmpNewFiles sortedArrayUsingSelector: @selector(compare:)]
|
|
|
|
|
mutableCopy];
|
|
|
|
|
AUTORELEASE(files);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
int pass = 0;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSDebugFLLog(@"debug", @"Parse Files");
|
2001-04-19 12:02:13 +00:00
|
|
|
|
/*
|
|
|
|
|
* 1st pass: don't write file, just parse them and
|
|
|
|
|
* construct project references
|
|
|
|
|
* 2nd pass: parse and write files
|
|
|
|
|
*/
|
|
|
|
|
for (pass = 0; goOn && pass < 2; pass++)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
for (i = 0; goOn && i < [files count]; i++)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *file = [files objectAtIndex: i];
|
|
|
|
|
NSString *base = [file stringByDeletingPathExtension];
|
|
|
|
|
CREATE_AUTORELEASE_POOL(arp);
|
|
|
|
|
|
|
|
|
|
// Don't process generated index file
|
|
|
|
|
if ([base isEqual: makeIndexBaseFileName])
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (verbose >= 1)
|
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSLog(@"Pass %d/2 File %d/%d - Ignoring Index File "
|
|
|
|
|
@"%@ (Process it later)",
|
|
|
|
|
(pass+1), (i+1), [files count], file);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (verbose >= 1)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Pass %d/2 File %d/%d - Processing %@",
|
2001-04-19 12:02:13 +00:00
|
|
|
|
(pass+1), (i+1), [files count], file);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
NS_DURING
|
|
|
|
|
{
|
|
|
|
|
GSDocHtml *p = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
p = [GSDocHtml alloc];
|
|
|
|
|
p = [p initWithFileName: file];
|
|
|
|
|
if (p != nil)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSString *previousFile;
|
|
|
|
|
NSString *nextFile;
|
|
|
|
|
NSMutableDictionary *vmDictionary;
|
|
|
|
|
NSString *result;
|
|
|
|
|
|
|
|
|
|
previousFile = ((i > 0) ? [files objectAtIndex: i-1]
|
|
|
|
|
: @"");
|
|
|
|
|
nextFile = (((i+1) < [files count])
|
|
|
|
|
? [files objectAtIndex: i+1] : @"");
|
|
|
|
|
vmDictionary = nil;
|
|
|
|
|
result = nil;
|
|
|
|
|
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[p setProjectName: projectName];
|
|
|
|
|
[p setGeneralReferences: generalReferences];
|
2001-04-19 12:02:13 +00:00
|
|
|
|
vmDictionary = [variablesDictionary mutableCopy];
|
|
|
|
|
[vmDictionary setObject:
|
|
|
|
|
[previousFile stringByDeletingPathExtension]
|
|
|
|
|
forKey: @"[[prev]]"];
|
|
|
|
|
[vmDictionary setObject:
|
|
|
|
|
[nextFile stringByDeletingPathExtension]
|
|
|
|
|
forKey: @"[[next]]"];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (makeIndexBaseFileName)
|
2001-04-19 12:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
[vmDictionary setObject:
|
|
|
|
|
makeIndexBaseFileName forKey: @"[[up]]"];
|
|
|
|
|
}
|
|
|
|
|
[p setVariablesDictionary: vmDictionary];
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[p setWriteFlag: (pass == 1)];
|
|
|
|
|
[p setProcessFileReferencesFlag: (pass == 0)];
|
|
|
|
|
result = [p parseDocument];
|
|
|
|
|
if (result == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Pass %d/2 File %d/%d - Error parsing %@",
|
2001-04-19 12:02:13 +00:00
|
|
|
|
(pass+1), (i+1), [files count], file);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (verbose >= 1)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSLog(@"Pass %d/2 File %d/%d"
|
|
|
|
|
@" - Parsed %@ - OK",
|
|
|
|
|
(pass+1), (i+1), [files count], file);
|
2000-08-13 16:00:14 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (pass == 0)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2001-04-19 12:02:13 +00:00
|
|
|
|
NSDebugFLLog(@"debug",
|
|
|
|
|
@"AddSymbolsToReferencesWithProjectInfo ->"
|
|
|
|
|
@" projectRefernce");
|
|
|
|
|
AddSymbolsToReferencesWithProjectInfo(
|
|
|
|
|
[p fileReferences],
|
|
|
|
|
[projectReferences
|
|
|
|
|
objectForKey: @"symbols"],
|
|
|
|
|
nil, NO);
|
|
|
|
|
NSDebugFLLog(@"debug",
|
|
|
|
|
@"AddSymbolsToReferencesWithProjectInfo ->"
|
|
|
|
|
@" generalReference");
|
|
|
|
|
AddSymbolsToReferencesWithProjectInfo(
|
|
|
|
|
[p fileReferences], generalReferences,
|
|
|
|
|
projectInfo, YES);
|
|
|
|
|
NSDebugFLLog(@"debug",
|
|
|
|
|
@"AddSymbolsToReferencesWithProjectInfo "
|
|
|
|
|
@"finished");
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
RELEASE(p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
NS_HANDLER
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Pass %d/2 File %d/%d - Parsing '%@' - %@",
|
|
|
|
|
(pass+1), (i+1), [files count], file,
|
|
|
|
|
[localException reason]);
|
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
NS_ENDHANDLER
|
|
|
|
|
}
|
2002-06-25 17:23:05 +00:00
|
|
|
|
#if GS_WITH_GC == 0
|
2000-09-20 14:02:03 +00:00
|
|
|
|
DESTROY(arp);
|
2002-06-25 17:23:05 +00:00
|
|
|
|
#endif
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
// Process Project References to generate Project Reference File
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (makeRefsFileName)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
[projectReferences setObject: projectInfo forKey: @"project"];
|
|
|
|
|
if (verbose >= 1)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Writing References File %@", makeRefsFileName);
|
|
|
|
|
}
|
|
|
|
|
if ([projectReferences writeToFile: makeRefsFileName
|
2001-04-19 12:02:13 +00:00
|
|
|
|
atomically: YES] == NO)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
NSLog(@"Error creating %@", makeRefsFileName);
|
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
// Process Project References to generate Index File
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (makeIndexBaseFileName)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSString *textTemplate
|
|
|
|
|
= [NSString stringWithContentsOfFile: makeIndexTemplateFileName];
|
|
|
|
|
NSMutableString *textStart = [NSMutableString string];
|
|
|
|
|
NSMutableString *textChapters = [NSMutableString string];
|
|
|
|
|
NSMutableString *textClasses = [NSMutableString string];
|
|
|
|
|
NSMutableString *textCategories = [NSMutableString string];
|
|
|
|
|
NSMutableString *textProtocols = [NSMutableString string];
|
|
|
|
|
NSMutableString *textFunctions = [NSMutableString string];
|
|
|
|
|
NSMutableString *textTypes = [NSMutableString string];
|
|
|
|
|
NSMutableString *textConstants = [NSMutableString string];
|
|
|
|
|
NSMutableString *textVariables = [NSMutableString string];
|
|
|
|
|
NSMutableString *textOthers = [NSMutableString string];
|
|
|
|
|
NSMutableString *textFiles = [NSMutableString string];
|
|
|
|
|
NSMutableString *textStop = [NSMutableString string];
|
|
|
|
|
NSMutableString *text = nil;
|
|
|
|
|
NSMutableDictionary *variablesMutableDictionary = nil;
|
|
|
|
|
NSString *typeTitle = nil;
|
|
|
|
|
NSString *finalText = nil;
|
|
|
|
|
NSDictionary *symbolsByType
|
|
|
|
|
= [projectReferences objectForKey: @"symbols"];
|
|
|
|
|
NSString *firstFileName = nil;
|
|
|
|
|
NSEnumerator *typesEnumerator
|
|
|
|
|
= [symbolsByType keyEnumerator];
|
|
|
|
|
id typeKey = nil;
|
|
|
|
|
|
|
|
|
|
if (verbose >= 1)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Making Index");
|
|
|
|
|
}
|
|
|
|
|
[textStart appendFormat:
|
|
|
|
|
@"<chapter>\n <heading>%@</heading>\n", projectName];
|
|
|
|
|
while ((typeKey = [typesEnumerator nextObject]))
|
|
|
|
|
{
|
|
|
|
|
if (verbose >= 2)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSLog(@"Making Index for type %@", typeKey);
|
|
|
|
|
}
|
|
|
|
|
text = nil;
|
|
|
|
|
if ([typeKey isEqual: @"ivariable"])
|
|
|
|
|
{
|
|
|
|
|
text = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Instance Variables";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"method"])
|
|
|
|
|
{
|
|
|
|
|
text = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Methods";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"file"])
|
|
|
|
|
{
|
|
|
|
|
text = textFiles;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Files";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"chapter"])
|
|
|
|
|
{
|
|
|
|
|
text = textChapters;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Chapters";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"section"])
|
|
|
|
|
{
|
|
|
|
|
text = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Section";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"ubsect"])
|
|
|
|
|
{
|
|
|
|
|
text = nil;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Subsections";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"class"]
|
|
|
|
|
|| [typeKey isEqual: @"jclass"])
|
|
|
|
|
{
|
|
|
|
|
text = textClasses;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Classes";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"protocol"])
|
|
|
|
|
{
|
|
|
|
|
text = textProtocols;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Protocols";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"category"])
|
|
|
|
|
{
|
|
|
|
|
text = textProtocols;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Categories";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"function"])
|
|
|
|
|
{
|
|
|
|
|
text = textFunctions;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Functions";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"macro"])
|
|
|
|
|
{
|
|
|
|
|
text = textFunctions;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Macros";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"constant"])
|
|
|
|
|
{
|
|
|
|
|
text = textConstants;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Constants";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([typeKey isEqual: @"variable"])
|
|
|
|
|
{
|
|
|
|
|
text = textVariables;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Global Variables";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
text = textOthers;
|
2001-04-19 12:02:13 +00:00
|
|
|
|
typeTitle = @"Others";
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
if (text != nil)
|
|
|
|
|
{
|
|
|
|
|
NSArray *symbolKeys = nil;
|
|
|
|
|
NSEnumerator *symbolsEnumerator = nil;
|
|
|
|
|
id symbolKey = nil;
|
|
|
|
|
NSDictionary *typeDict;
|
|
|
|
|
typeDict = [symbolsByType objectForKey: typeKey];
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<section>\n <heading>%@</heading>\n <list>\n", typeTitle];
|
|
|
|
|
symbolKeys = [[typeDict allKeys]
|
|
|
|
|
sortedArrayUsingSelector: @selector(compare:)];
|
|
|
|
|
symbolsEnumerator = [symbolKeys objectEnumerator];
|
|
|
|
|
while ((symbolKey = [symbolsEnumerator nextObject]))
|
|
|
|
|
{
|
|
|
|
|
NSString *fragment = nil;
|
|
|
|
|
NSDictionary *symbol = [typeDict objectForKey: symbolKey];
|
|
|
|
|
if (text == textFiles && !firstFileName)
|
|
|
|
|
firstFileName = [symbol objectForKey: @"fileName"];
|
|
|
|
|
if (verbose >= 4)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSLog(@"Making Index for symbol %@",
|
|
|
|
|
[symbol objectForKey: @"title"]);
|
|
|
|
|
}
|
|
|
|
|
fragment = [symbol objectForKey: @"fragment"];
|
|
|
|
|
[text appendFormat:
|
|
|
|
|
@"<item><uref url =\"%@%@%@\">%@</uref></item>\n",
|
|
|
|
|
[[symbol objectForKey: @"fileName"]
|
|
|
|
|
stringByAppendingPathExtension: pathExtension_HTML],
|
2001-04-19 12:02:13 +00:00
|
|
|
|
([fragment length] > 0 ? @"#" : @""),
|
2000-09-20 14:02:03 +00:00
|
|
|
|
(fragment ? fragment : @""),
|
|
|
|
|
[symbol objectForKey: @"title"]];
|
|
|
|
|
}
|
|
|
|
|
[text appendString: @"</list>\n </section>\n"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[textStop appendString: @"</chapter>\n"];
|
|
|
|
|
finalText = [NSString stringWithFormat:
|
|
|
|
|
@"%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n",
|
|
|
|
|
textStart, textChapters, textClasses, textCategories,
|
|
|
|
|
textProtocols, textFunctions, textTypes, textConstants,
|
|
|
|
|
textVariables, textOthers, textFiles, textStop];
|
|
|
|
|
variablesMutableDictionary = [variablesDictionary mutableCopy];
|
|
|
|
|
[variablesMutableDictionary setObject: finalText
|
|
|
|
|
forKey: @"[[content]]"];
|
|
|
|
|
[variablesMutableDictionary setObject: [firstFileName stringByDeletingPathExtension]
|
|
|
|
|
forKey: @"[[next]]"];
|
|
|
|
|
finalText = textByReplacingVariablesInText(textTemplate,
|
|
|
|
|
variablesMutableDictionary);
|
|
|
|
|
if (verbose >= 1)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Writing Index %@", makeIndexFileNameGSDoc);
|
|
|
|
|
}
|
|
|
|
|
if (![finalText writeToFile: makeIndexFileNameGSDoc
|
|
|
|
|
atomically: YES])
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Error creating %@", makeIndexFileNameGSDoc);
|
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-13 16:00:14 +00:00
|
|
|
|
|
|
|
|
|
// Finally, parse index
|
|
|
|
|
if (goOn)
|
2000-09-20 14:02:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (makeIndexBaseFileName)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
if (verbose >= 1)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Processing %@", makeIndexFileNameGSDoc);
|
|
|
|
|
}
|
|
|
|
|
NS_DURING
|
|
|
|
|
{
|
|
|
|
|
GSDocHtml *p = nil;
|
|
|
|
|
p = [GSDocHtml alloc];
|
|
|
|
|
p = [p initWithFileName: makeIndexFileNameGSDoc];
|
|
|
|
|
if (p != nil)
|
|
|
|
|
{
|
|
|
|
|
NSString *result = nil;
|
|
|
|
|
[p setVariablesDictionary: variablesDictionary];
|
|
|
|
|
result = [p parseDocument];
|
|
|
|
|
if (result == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Error parsing %@", makeIndexFileNameGSDoc);
|
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (verbose >= 1)
|
2000-08-13 16:00:14 +00:00
|
|
|
|
{
|
2000-09-20 14:02:03 +00:00
|
|
|
|
NSLog(@"Parsed %@ - OK", makeIndexFileNameGSDoc);
|
2000-08-13 16:00:14 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
RELEASE(p);
|
2000-08-13 16:00:14 +00:00
|
|
|
|
}
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
|
|
|
|
NS_HANDLER
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Parsing '%@' - %@",
|
|
|
|
|
makeIndexFileNameGSDoc, [localException reason]);
|
|
|
|
|
goOn = NO;
|
|
|
|
|
}
|
|
|
|
|
NS_ENDHANDLER;
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-04-19 12:02:13 +00:00
|
|
|
|
RELEASE(pool);
|
2000-08-13 16:00:14 +00:00
|
|
|
|
return (goOn ? 0 : 1);
|
2000-09-20 14:02:03 +00:00
|
|
|
|
}
|
2000-02-28 16:23:53 +00:00
|
|
|
|
|
2000-06-20 13:17:22 +00:00
|
|
|
|
#else
|
2000-06-27 17:38:46 +00:00
|
|
|
|
int
|
2000-06-20 13:17:22 +00:00
|
|
|
|
main()
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"No libxml available");
|
2000-06-27 17:38:46 +00:00
|
|
|
|
return 0;
|
2000-06-20 13:17:22 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|