mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
2000-08-24 Manuel Guesdon <mguesdon@orange-concept.com>
* Tools/gsdoc-0_6_6.dtd: added prjref element which enable explicit links between projects * Tools/gsdoc.m: handle prjref remove extensions from files in gsdocrefs (one day we'll generate other formats :- ) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7240 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
05a1551c75
commit
1843f73c82
3 changed files with 229 additions and 93 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2000-08-24 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||||
|
|
||||||
|
* Tools/gsdoc-0_6_6.dtd: added prjref element which enable explicit
|
||||||
|
links between projects
|
||||||
|
* Tools/gsdoc.m: handle prjref
|
||||||
|
remove extensions from files in gsdocrefs
|
||||||
|
(one day we'll generate other formats :-)
|
||||||
|
|
||||||
2000-08-23 Fred Kiefer <FredKiefer@gmx.de>
|
2000-08-23 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Headers/gnustep/base/NSDecimal.h:
|
* Headers/gnustep/base/NSDecimal.h:
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
<!ENTITY % phrase "var | em | code | strong | file | site">
|
<!ENTITY % phrase "var | em | code | strong | file | site">
|
||||||
|
|
||||||
<!-- Entity for cross references. -->
|
<!-- Entity for cross references. -->
|
||||||
<!ENTITY % xref "ref | uref | url | email">
|
<!ENTITY % xref "ref | uref | url | email | prjref">
|
||||||
|
|
||||||
<!-- Entity for anchors. -->
|
<!-- Entity for anchors. -->
|
||||||
<!ENTITY % anchor "label | entry">
|
<!ENTITY % anchor "label | entry">
|
||||||
|
@ -172,6 +172,14 @@
|
||||||
url CDATA #REQUIRED
|
url CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!-- A reference to a project.
|
||||||
|
The text contained appears in the output.
|
||||||
|
-->
|
||||||
|
<!ELEMENT prjref (%text;)*>
|
||||||
|
<!ATTLIST prjref
|
||||||
|
prjname CDATA #IMPLIED
|
||||||
|
file CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
|
||||||
<!--***** Anchors. *****-->
|
<!--***** Anchors. *****-->
|
||||||
|
|
||||||
|
|
304
Tools/gsdoc.m
304
Tools/gsdoc.m
|
@ -86,6 +86,7 @@ Parameters:
|
||||||
|
|
||||||
NSString* PathExtension_GSDocRefs=@"gsdocrefs";
|
NSString* PathExtension_GSDocRefs=@"gsdocrefs";
|
||||||
NSString* PathExtension_GSDoc=@"gsdoc";
|
NSString* PathExtension_GSDoc=@"gsdoc";
|
||||||
|
NSString* PathExtension_HTML=@"html";
|
||||||
int verbose=0;
|
int verbose=0;
|
||||||
NSString* location=nil;
|
NSString* location=nil;
|
||||||
|
|
||||||
|
@ -361,6 +362,7 @@ loader(const char *url, const char* eid, xmlParserCtxtPtr *ctxt)
|
||||||
NSArray* typesTypes; // Types for Types
|
NSArray* typesTypes; // Types for Types
|
||||||
NSArray* classesTypes; // Types for Classes
|
NSArray* classesTypes; // Types for Classes
|
||||||
NSArray* protocolsTypes; // Types for Protocols
|
NSArray* protocolsTypes; // Types for Protocols
|
||||||
|
NSArray* filesTypes; // Types for Files
|
||||||
BOOL writeFlag; // YES if we'll write the result
|
BOOL writeFlag; // YES if we'll write the result
|
||||||
BOOL processFileReferencesFlag; // YES if we'll add references to file references
|
BOOL processFileReferencesFlag; // YES if we'll add references to file references
|
||||||
}
|
}
|
||||||
|
@ -402,6 +404,9 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
ofTypes:(NSArray*)types;
|
ofTypes:(NSArray*)types;
|
||||||
-(NSDictionary*)findSymbolForKey:(NSString*)key_
|
-(NSDictionary*)findSymbolForKey:(NSString*)key_
|
||||||
ofTypes:(NSArray*)types;
|
ofTypes:(NSArray*)types;
|
||||||
|
-(NSString*)linkForSymbolKey:(NSString*)key_
|
||||||
|
ofTypes:(NSArray*)types
|
||||||
|
withText:(NSString*)text;
|
||||||
-(NSString*)linkForSymbol:(NSDictionary*)symbol
|
-(NSString*)linkForSymbol:(NSDictionary*)symbol
|
||||||
withText:(NSString*)text;
|
withText:(NSString*)text;
|
||||||
-(void)setWriteFlag:(BOOL)flag;
|
-(void)setWriteFlag:(BOOL)flag;
|
||||||
|
@ -424,6 +429,8 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
RETAIN(classesTypes);
|
RETAIN(classesTypes);
|
||||||
protocolsTypes=[NSArray arrayWithObjects:@"protocol",@"define",nil];
|
protocolsTypes=[NSArray arrayWithObjects:@"protocol",@"define",nil];
|
||||||
RETAIN(protocolsTypes);
|
RETAIN(protocolsTypes);
|
||||||
|
filesTypes=[NSArray arrayWithObjects:@"file",nil];
|
||||||
|
RETAIN(filesTypes);
|
||||||
};
|
};
|
||||||
return self;
|
return self;
|
||||||
};
|
};
|
||||||
|
@ -523,6 +530,7 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
DESTROY(typesTypes);
|
DESTROY(typesTypes);
|
||||||
DESTROY(classesTypes);
|
DESTROY(classesTypes);
|
||||||
DESTROY(protocolsTypes);
|
DESTROY(protocolsTypes);
|
||||||
|
DESTROY(filesTypes);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +545,7 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
footnotes = [NSMutableArray new];
|
footnotes = [NSMutableArray new];
|
||||||
if ([defs boolForKey: @"Monolithic"] == YES)
|
if ([defs boolForKey: @"Monolithic"] == YES)
|
||||||
{
|
{
|
||||||
ASSIGN(currName, [baseName stringByAppendingPathExtension: @"html"]);
|
ASSIGN(currName, [baseName stringByAppendingPathExtension:PathExtension_HTML]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -559,7 +567,7 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
ASSIGN(currName,
|
ASSIGN(currName,
|
||||||
[baseName stringByAppendingPathComponent: @"index.html"]);
|
[baseName stringByAppendingPathComponent: @"index.html"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -1731,9 +1739,9 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
[text appendFormat: @"<head>\r\n<title>%@</title>\r\n", title];
|
[text appendFormat: @"<head>\r\n<title>%@</title>\r\n", title];
|
||||||
|
|
||||||
[self setEntry:title
|
[self setEntry:title
|
||||||
withExternalCompleteRef:currName
|
withExternalCompleteRef:[currName stringByDeletingPathExtension]
|
||||||
withExternalRef:currName
|
withExternalRef:[currName stringByDeletingPathExtension]
|
||||||
withRef: currName
|
withRef: [currName stringByDeletingPathExtension]
|
||||||
inIndexOfType:@"file"];
|
inIndexOfType:@"file"];
|
||||||
|
|
||||||
if ([styleSheetURL length]>0)
|
if ([styleSheetURL length]>0)
|
||||||
|
@ -1747,7 +1755,7 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
NSString* test=TextByReplacingVariablesInText(prevName,variablesDictionary);
|
NSString* test=TextByReplacingVariablesInText(prevName,variablesDictionary);
|
||||||
if ([test length]>0)
|
if ([test length]>0)
|
||||||
{
|
{
|
||||||
if ([[prevName pathExtension] isEqual: @"html"] == YES)
|
if ([[prevName pathExtension] isEqual:PathExtension_HTML] == YES)
|
||||||
[text appendFormat: @"<a href=\"%@\">[Previous]</a>\n", prevName];
|
[text appendFormat: @"<a href=\"%@\">[Previous]</a>\n", prevName];
|
||||||
else
|
else
|
||||||
[text appendFormat: @"<a href=\"%@.html\">[Previous]</a>\n", prevName];
|
[text appendFormat: @"<a href=\"%@.html\">[Previous]</a>\n", prevName];
|
||||||
|
@ -1758,7 +1766,7 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
NSString* test=TextByReplacingVariablesInText(upName,variablesDictionary);
|
NSString* test=TextByReplacingVariablesInText(upName,variablesDictionary);
|
||||||
if ([test length]>0)
|
if ([test length]>0)
|
||||||
{
|
{
|
||||||
if ([[upName pathExtension] isEqual: @"html"] == YES)
|
if ([[upName pathExtension] isEqual:PathExtension_HTML] == YES)
|
||||||
[text appendFormat: @"<a href=\"%@\">[Up]</a>\n", upName];
|
[text appendFormat: @"<a href=\"%@\">[Up]</a>\n", upName];
|
||||||
else
|
else
|
||||||
[text appendFormat: @"<a href=\"%@.html\">[Up]</a>\n", upName];
|
[text appendFormat: @"<a href=\"%@.html\">[Up]</a>\n", upName];
|
||||||
|
@ -1770,7 +1778,7 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
NSString* test=TextByReplacingVariablesInText(nextName,variablesDictionary);
|
NSString* test=TextByReplacingVariablesInText(nextName,variablesDictionary);
|
||||||
if ([test length]>0)
|
if ([test length]>0)
|
||||||
{
|
{
|
||||||
if ([[nextName pathExtension] isEqual: @"html"] == YES)
|
if ([[nextName pathExtension] isEqual:PathExtension_HTML] == YES)
|
||||||
[text appendFormat: @"<a href=\"%@\">[Next]</a>\n", nextName];
|
[text appendFormat: @"<a href=\"%@\">[Next]</a>\n", nextName];
|
||||||
else
|
else
|
||||||
[text appendFormat: @"<a href=\"%@.html\">[Next]</a>\n", nextName];
|
[text appendFormat: @"<a href=\"%@.html\">[Next]</a>\n", nextName];
|
||||||
|
@ -2587,12 +2595,32 @@ withExternalCompleteRef: (NSString*)externalCompleteRef
|
||||||
}
|
}
|
||||||
else if (strcmp(node->name, "uref") == 0)
|
else if (strcmp(node->name, "uref") == 0)
|
||||||
{
|
{
|
||||||
NSString *elem = [self parseText: node->children];
|
NSString *elem = [self parseText: node->children];
|
||||||
NSString *ref = [self getProp: "url" fromNode: node];
|
NSString *ref = [self getProp: "url" fromNode: node];
|
||||||
|
|
||||||
if ([elem length] == 0)
|
if ([elem length] == 0)
|
||||||
elem = ref;
|
elem = ref;
|
||||||
[text appendFormat: @"<a href=\"%@\">%@</a>", ref, elem];
|
[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
|
else
|
||||||
{
|
{
|
||||||
|
@ -2644,7 +2672,7 @@ withExternalCompleteRef:(NSString*)externalCompleteRef
|
||||||
externalCompleteRef,@"completeRef",
|
externalCompleteRef,@"completeRef",
|
||||||
ref, @"fragment",
|
ref, @"fragment",
|
||||||
type, @"type",
|
type, @"type",
|
||||||
currName, @"fileName",
|
[currName stringByDeletingPathExtension], @"fileName",
|
||||||
nil];
|
nil];
|
||||||
[typeDict setObject:thisEntry
|
[typeDict setObject:thisEntry
|
||||||
forKey:externalCompleteRef];
|
forKey:externalCompleteRef];
|
||||||
|
@ -2719,6 +2747,18 @@ withExternalCompleteRef:(NSString*)externalCompleteRef
|
||||||
return linked;
|
return linked;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
-(NSString*)linkForSymbolKey:(NSString*)key_
|
||||||
|
ofTypes:(NSArray*)types
|
||||||
|
withText:(NSString*)text
|
||||||
|
{
|
||||||
|
NSDictionary* symbol=[self findSymbolForKey:key_
|
||||||
|
ofTypes:types];
|
||||||
|
if (symbol)
|
||||||
|
return [self linkForSymbol:symbol
|
||||||
|
withText:text];
|
||||||
|
else
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
|
||||||
//Return the symbol for key
|
//Return the symbol for key
|
||||||
-(NSDictionary*)findSymbolForKey:(NSString*)key_
|
-(NSDictionary*)findSymbolForKey:(NSString*)key_
|
||||||
|
@ -2737,10 +2777,11 @@ withExternalCompleteRef:(NSString*)externalCompleteRef
|
||||||
-(NSString*)linkForSymbol:(NSDictionary*)symbol
|
-(NSString*)linkForSymbol:(NSDictionary*)symbol
|
||||||
withText:(NSString*)text
|
withText:(NSString*)text
|
||||||
{
|
{
|
||||||
NSString* symbolLocation=[[symbol objectForKey:@"projectInfo"] objectForKey:@"location"];
|
NSString* symbolLocation=[[symbol objectForKey:@"project"] objectForKey:@"location"];
|
||||||
NSString* locationTmp=location;
|
NSString* locationTmp=location;
|
||||||
NSString* common=nil;
|
NSString* common=nil;
|
||||||
NSString* prefix=@"";
|
NSString* prefix=@"";
|
||||||
|
NSString* fragment=nil;
|
||||||
if ([locationTmp length]>0)
|
if ([locationTmp length]>0)
|
||||||
{
|
{
|
||||||
//Equal: no prefix
|
//Equal: no prefix
|
||||||
|
@ -2773,15 +2814,18 @@ withExternalCompleteRef:(NSString*)externalCompleteRef
|
||||||
prefix=[prefix stringByAppendingPathComponent:[symbolLocationParts objectAtIndex:i]];
|
prefix=[prefix stringByAppendingPathComponent:[symbolLocationParts objectAtIndex:i]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
prefix=symbolLocation;
|
prefix=([symbolLocation length]>0 ? symbolLocation : @"");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// No Project Location==> take symbol location
|
// No Project Location==> take symbol location
|
||||||
prefix=symbolLocation;
|
prefix=([symbolLocation length]>0 ? symbolLocation : @"");
|
||||||
return [NSString stringWithFormat:@"<A HREF=\"%@#%@\">%@</A>",
|
fragment= [symbol objectForKey:@"fragment"];
|
||||||
[prefix stringByAppendingPathComponent:[symbol objectForKey:@"fileName"]],
|
return [NSString stringWithFormat:@"<A HREF=\"%@%@%@\">%@</A>",
|
||||||
[symbol objectForKey:@"fragment"],
|
[[prefix stringByAppendingPathComponent:[symbol objectForKey:@"fileName"]]
|
||||||
|
stringByAppendingPathExtension:PathExtension_HTML],
|
||||||
|
([fragment length]>0 ? @"#" : @""),
|
||||||
|
(fragment ? fragment : @""),
|
||||||
text];
|
text];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2876,62 +2920,118 @@ void AddSymbolsToReferencesWithProjectInfo(NSDictionary* symbols,
|
||||||
NSDictionary* projectInfo,
|
NSDictionary* projectInfo,
|
||||||
BOOL override)
|
BOOL override)
|
||||||
{
|
{
|
||||||
NSEnumerator* typesEnumerator = nil;
|
NSString* projectName=[projectInfo objectForKey:@"projectName"];
|
||||||
id typeKey=nil;
|
if (symbols)
|
||||||
NSCAssert1([symbols isKindOfClass:[NSDictionary class]],
|
|
||||||
@"%@ is not a dictionary",
|
|
||||||
symbols);
|
|
||||||
typesEnumerator = [symbols keyEnumerator];
|
|
||||||
while ((typeKey = [typesEnumerator nextObject]))
|
|
||||||
{
|
{
|
||||||
NSDictionary* type=[symbols objectForKey:typeKey];
|
NSEnumerator* typesEnumerator = nil;
|
||||||
if (![type isKindOfClass:[NSDictionary class]])
|
id typeKey=nil;
|
||||||
|
NSCAssert1([symbols isKindOfClass:[NSDictionary class]],
|
||||||
|
@"%@ is not a dictionary",
|
||||||
|
symbols);
|
||||||
|
typesEnumerator = [symbols keyEnumerator];
|
||||||
|
while ((typeKey = [typesEnumerator nextObject]))
|
||||||
{
|
{
|
||||||
NSLog(@"Warning: Type %@ is not a dictionary",type);
|
NSDictionary* type=[symbols objectForKey:typeKey];
|
||||||
}
|
if (![type isKindOfClass:[NSDictionary class]])
|
||||||
else
|
|
||||||
{
|
|
||||||
NSEnumerator* symbolsEnumerator = [type keyEnumerator];
|
|
||||||
id symbolKey=nil;
|
|
||||||
NSMutableDictionary* referencesType=[references objectForKey:typeKey];
|
|
||||||
if (!referencesType)
|
|
||||||
{
|
{
|
||||||
referencesType=[NSMutableDictionary dictionary];
|
NSLog(@"Warning: Type %@ is not a dictionary",type);
|
||||||
[references setObject:referencesType
|
}
|
||||||
forKey:typeKey];
|
else
|
||||||
};
|
{
|
||||||
while ((symbolKey = [symbolsEnumerator nextObject]))
|
NSEnumerator* symbolsEnumerator = [type keyEnumerator];
|
||||||
{
|
id symbolKey=nil;
|
||||||
NSDictionary* symbol=[type objectForKey:symbolKey];
|
NSMutableDictionary* referencesType=[references objectForKey:typeKey];
|
||||||
if (![symbol isKindOfClass:[NSDictionary class]])
|
if (!referencesType)
|
||||||
{
|
{
|
||||||
NSLog(@"Warning: Symbol %@ is not a dictionary",symbol);
|
referencesType=[NSMutableDictionary dictionary];
|
||||||
}
|
[references setObject:referencesType
|
||||||
else
|
forKey:typeKey];
|
||||||
{
|
};
|
||||||
NSMutableDictionary* symbolNew=[NSMutableDictionary dictionaryWithDictionary:symbol];
|
while ((symbolKey = [symbolsEnumerator nextObject]))
|
||||||
if (verbose>=4)
|
{
|
||||||
|
NSDictionary* symbol=[type objectForKey:symbolKey];
|
||||||
|
if (![symbol isKindOfClass:[NSDictionary class]])
|
||||||
{
|
{
|
||||||
NSLog(@"Project %@ Processing reference %@",
|
NSLog(@"Warning: Symbol %@ is not a dictionary",symbol);
|
||||||
[projectInfo objectForKey:@"projectName"],
|
}
|
||||||
symbolKey);
|
else
|
||||||
};
|
{
|
||||||
if (projectInfo)
|
NSMutableDictionary* symbolNew=[NSMutableDictionary dictionaryWithDictionary:symbol];
|
||||||
[symbolNew setObject:projectInfo
|
if (verbose>=4)
|
||||||
forKey:@"projectInfo"];
|
{
|
||||||
NSCAssert(symbolKey,@"No symbolKey");
|
NSLog(@"Project %@ Processing reference %@",
|
||||||
|
projectName,
|
||||||
|
symbolKey);
|
||||||
|
};
|
||||||
|
if (projectInfo)
|
||||||
|
[symbolNew setObject:projectInfo
|
||||||
|
forKey:@"project"];
|
||||||
|
NSCAssert(symbolKey,@"No symbolKey");
|
||||||
|
|
||||||
if (override || ![referencesType objectForKey:symbolKey])
|
if (override || ![referencesType objectForKey:symbolKey])
|
||||||
[referencesType setObject:symbolNew
|
[referencesType setObject:symbolNew
|
||||||
forKey:symbolKey];
|
forKey:symbolKey];
|
||||||
NSCAssert1([symbolNew objectForKey:@"ref"],@"No ref for symbol %@",symbolKey);
|
NSCAssert1([symbolNew objectForKey:@"ref"],@"No ref for symbol %@",symbolKey);
|
||||||
if (override || ![referencesType objectForKey:[symbolNew objectForKey:@"ref"]])
|
if (override || ![referencesType objectForKey:[symbolNew objectForKey:@"ref"]])
|
||||||
[referencesType setObject:symbolNew
|
[referencesType setObject:symbolNew
|
||||||
forKey:[symbolNew objectForKey:@"ref"]];
|
forKey:[symbolNew objectForKey:@"ref"]];
|
||||||
|
if (projectName)
|
||||||
|
{
|
||||||
|
NSString* symbolType=[symbolNew objectForKey:@"type"];
|
||||||
|
if ([symbolType isEqual:@"file"])
|
||||||
|
{
|
||||||
|
NSString* fileName=[symbolNew objectForKey:@"fileName"];
|
||||||
|
if (fileName)
|
||||||
|
{
|
||||||
|
NSString* fileRef=nil;
|
||||||
|
fileName=[fileName stringByDeletingPathExtension];
|
||||||
|
fileRef=[NSString stringWithFormat:@"%@##%@",
|
||||||
|
projectName,
|
||||||
|
fileName];
|
||||||
|
[symbolNew setObject:fileRef
|
||||||
|
forKey:@"completeRef"];
|
||||||
|
if (override || ![referencesType objectForKey:fileRef])
|
||||||
|
[referencesType setObject:symbolNew
|
||||||
|
forKey:fileRef];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
if (projectName)
|
||||||
|
{
|
||||||
|
NSString* fileName=[[projectInfo objectForKey:@"indexfileName"]stringByDeletingPathExtension];
|
||||||
|
NSString* fileRef=nil;
|
||||||
|
NSMutableDictionary* referencesType=[references objectForKey:@"file"];
|
||||||
|
if (!referencesType)
|
||||||
|
{
|
||||||
|
referencesType=[NSMutableDictionary dictionary];
|
||||||
|
[references setObject:referencesType
|
||||||
|
forKey:@"file"];
|
||||||
|
};
|
||||||
|
if (!fileName)
|
||||||
|
fileName=@"index";
|
||||||
|
fileRef=[NSString stringWithFormat:@"%@##%@",
|
||||||
|
projectName,
|
||||||
|
fileName];
|
||||||
|
if (override || ![referencesType objectForKey:fileRef])
|
||||||
|
{
|
||||||
|
NSMutableDictionary* symbol=[NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
fileRef,@"completeRef",
|
||||||
|
fileName,@"fileName",
|
||||||
|
fileName,@"ref",
|
||||||
|
@"file",@"type",
|
||||||
|
nil];
|
||||||
|
if (projectInfo)
|
||||||
|
[symbol setObject:projectInfo
|
||||||
|
forKey:@"project"];
|
||||||
|
[referencesType setObject:symbol
|
||||||
|
forKey:fileRef];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -2948,7 +3048,8 @@ int main(int argc, char **argv, char **env)
|
||||||
NSMutableArray* references=nil; // Array of References files/directories
|
NSMutableArray* references=nil; // Array of References files/directories
|
||||||
NSMutableDictionary* generalReferences=nil; // References (information coming from references files/directories)
|
NSMutableDictionary* generalReferences=nil; // References (information coming from references files/directories)
|
||||||
NSMutableDictionary* projectReferences=nil; // Project References (references founds by parsing files)
|
NSMutableDictionary* projectReferences=nil; // Project References (references founds by parsing files)
|
||||||
NSString* makeIndexFileName=nil; // makeIndex file name
|
NSString* makeIndexBaseFileName=nil; // makeIndex file name
|
||||||
|
NSString* makeIndexFileNameGSDoc=nil; // makeIndex file name with gsdoc extension
|
||||||
NSString* makeIndexTemplateFileName=nil; // makeIndex template file name
|
NSString* makeIndexTemplateFileName=nil; // makeIndex template file name
|
||||||
NSMutableDictionary* infoDictionary=nil; // user info
|
NSMutableDictionary* infoDictionary=nil; // user info
|
||||||
NSDictionary* variablesDictionary=nil; // variables dictionary
|
NSDictionary* variablesDictionary=nil; // variables dictionary
|
||||||
|
@ -3021,11 +3122,11 @@ int main(int argc, char **argv, char **env)
|
||||||
// makeIndex option
|
// makeIndex option
|
||||||
else if ([key isEqualToString:@"makeIndex"])
|
else if ([key isEqualToString:@"makeIndex"])
|
||||||
{
|
{
|
||||||
makeIndexFileName=value;
|
makeIndexBaseFileName=value;
|
||||||
if (!makeIndexFileName)
|
if (makeIndexBaseFileName)
|
||||||
makeIndexFileName=@"index";
|
makeIndexBaseFileName=[makeIndexBaseFileName stringByDeletingPathExtension];
|
||||||
if (![[makeIndexFileName pathExtension] isEqual:PathExtension_GSDoc])
|
else
|
||||||
makeIndexFileName=[makeIndexFileName stringByAppendingPathExtension:PathExtension_GSDoc];
|
makeIndexBaseFileName=@"index";
|
||||||
}
|
}
|
||||||
// makeIndexTemplate option
|
// makeIndexTemplate option
|
||||||
else if ([key isEqualToString:@"makeIndexTemplate"])
|
else if ([key isEqualToString:@"makeIndexTemplate"])
|
||||||
|
@ -3105,6 +3206,8 @@ int main(int argc, char **argv, char **env)
|
||||||
projectName=@"unknown";
|
projectName=@"unknown";
|
||||||
if ([makeRefsFileName length]==0)
|
if ([makeRefsFileName length]==0)
|
||||||
makeRefsFileName=[projectName stringByAppendingPathExtension:PathExtension_GSDocRefs];
|
makeRefsFileName=[projectName stringByAppendingPathExtension:PathExtension_GSDocRefs];
|
||||||
|
if (makeIndexBaseFileName)
|
||||||
|
makeIndexFileNameGSDoc=[makeIndexBaseFileName stringByAppendingPathExtension:PathExtension_GSDoc];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Verify option compatibilities
|
// Verify option compatibilities
|
||||||
|
@ -3115,6 +3218,7 @@ int main(int argc, char **argv, char **env)
|
||||||
// Construct project references
|
// Construct project references
|
||||||
if (goOn)
|
if (goOn)
|
||||||
{
|
{
|
||||||
|
BOOL addedSymbols=NO;
|
||||||
NSDictionary* previousProjectReferences=nil;
|
NSDictionary* previousProjectReferences=nil;
|
||||||
projectReferences=[[NSMutableDictionary new] autorelease];
|
projectReferences=[[NSMutableDictionary new] autorelease];
|
||||||
[projectReferences setObject:[[NSMutableDictionary new] autorelease]
|
[projectReferences setObject:[[NSMutableDictionary new] autorelease]
|
||||||
|
@ -3125,6 +3229,10 @@ int main(int argc, char **argv, char **env)
|
||||||
if (location)
|
if (location)
|
||||||
[projectInfo setObject:location
|
[projectInfo setObject:location
|
||||||
forKey:@"location"];
|
forKey:@"location"];
|
||||||
|
if (makeIndexBaseFileName)
|
||||||
|
[projectInfo setObject:makeIndexBaseFileName
|
||||||
|
forKey:@"indexfileName"];
|
||||||
|
|
||||||
|
|
||||||
//Read project existing references
|
//Read project existing references
|
||||||
if (makeRefsFileName)
|
if (makeRefsFileName)
|
||||||
|
@ -3140,12 +3248,20 @@ int main(int argc, char **argv, char **env)
|
||||||
{
|
{
|
||||||
AddSymbolsToReferencesWithProjectInfo([previousProjectReferences objectForKey:@"symbols"],
|
AddSymbolsToReferencesWithProjectInfo([previousProjectReferences objectForKey:@"symbols"],
|
||||||
[projectReferences objectForKey:@"symbols"],
|
[projectReferences objectForKey:@"symbols"],
|
||||||
nil,
|
projectInfo,
|
||||||
NO);
|
NO);
|
||||||
|
addedSymbols=YES;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
if (!addedSymbols)
|
||||||
|
{
|
||||||
|
AddSymbolsToReferencesWithProjectInfo(nil,
|
||||||
|
[projectReferences objectForKey:@"symbols"],
|
||||||
|
projectInfo,
|
||||||
|
NO);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Process references (construct a dictionary of all references)
|
// Process references (construct a dictionary of all references)
|
||||||
|
@ -3220,11 +3336,11 @@ int main(int argc, char **argv, char **env)
|
||||||
};
|
};
|
||||||
[variablesMutableDictionary setObject:[NSCalendarDate calendarDate]
|
[variablesMutableDictionary setObject:[NSCalendarDate calendarDate]
|
||||||
forKey:@"[[timestampString]]"];
|
forKey:@"[[timestampString]]"];
|
||||||
if (makeIndexFileName)
|
if (makeIndexBaseFileName)
|
||||||
{
|
{
|
||||||
[variablesMutableDictionary setObject:makeIndexFileName
|
[variablesMutableDictionary setObject:makeIndexFileNameGSDoc
|
||||||
forKey:@"[[indexFileName]]"];
|
forKey:@"[[indexFileName]]"];
|
||||||
[variablesMutableDictionary setObject:[makeIndexFileName stringByDeletingPathExtension]
|
[variablesMutableDictionary setObject:makeIndexBaseFileName
|
||||||
forKey:@"[[indexBaseFileName]]"];
|
forKey:@"[[indexBaseFileName]]"];
|
||||||
};
|
};
|
||||||
if (projectName)
|
if (projectName)
|
||||||
|
@ -3294,7 +3410,7 @@ int main(int argc, char **argv, char **env)
|
||||||
{
|
{
|
||||||
NSString* file = [files objectAtIndex: i];
|
NSString* file = [files objectAtIndex: i];
|
||||||
NSAutoreleasePool* arp=[NSAutoreleasePool new];
|
NSAutoreleasePool* arp=[NSAutoreleasePool new];
|
||||||
if ([file isEqual:makeIndexFileName])//Don't process generated index file
|
if ([[file stringByDeletingPathExtension] isEqual:makeIndexBaseFileName])//Don't process generated index file
|
||||||
{
|
{
|
||||||
if (verbose>=1)
|
if (verbose>=1)
|
||||||
{
|
{
|
||||||
|
@ -3333,8 +3449,8 @@ int main(int argc, char **argv, char **env)
|
||||||
forKey:@"[[prev]]"];
|
forKey:@"[[prev]]"];
|
||||||
[variablesMutableDictionary setObject:[nextFile stringByDeletingPathExtension]
|
[variablesMutableDictionary setObject:[nextFile stringByDeletingPathExtension]
|
||||||
forKey:@"[[next]]"];
|
forKey:@"[[next]]"];
|
||||||
if (makeIndexFileName)
|
if (makeIndexBaseFileName)
|
||||||
[variablesMutableDictionary setObject:[makeIndexFileName stringByDeletingPathExtension]
|
[variablesMutableDictionary setObject:makeIndexBaseFileName
|
||||||
forKey:@"[[up]]"];
|
forKey:@"[[up]]"];
|
||||||
[p setVariablesDictionary:variablesMutableDictionary];
|
[p setVariablesDictionary:variablesMutableDictionary];
|
||||||
[p setWriteFlag:(pass==1)];
|
[p setWriteFlag:(pass==1)];
|
||||||
|
@ -3413,7 +3529,7 @@ int main(int argc, char **argv, char **env)
|
||||||
// Process Project References to generate Index File
|
// Process Project References to generate Index File
|
||||||
if (goOn)
|
if (goOn)
|
||||||
{
|
{
|
||||||
if (makeIndexFileName)
|
if (makeIndexBaseFileName)
|
||||||
{
|
{
|
||||||
NSString* textTemplate=[NSString stringWithContentsOfFile:makeIndexTemplateFileName];
|
NSString* textTemplate=[NSString stringWithContentsOfFile:makeIndexTemplateFileName];
|
||||||
NSMutableString* textStart=[NSMutableString string];
|
NSMutableString* textStart=[NSMutableString string];
|
||||||
|
@ -3529,6 +3645,7 @@ int main(int argc, char **argv, char **env)
|
||||||
symbolsEnumerator = [symbolKeys objectEnumerator];
|
symbolsEnumerator = [symbolKeys objectEnumerator];
|
||||||
while ((symbolKey = [symbolsEnumerator nextObject]))
|
while ((symbolKey = [symbolsEnumerator nextObject]))
|
||||||
{
|
{
|
||||||
|
NSString* fragment=nil;
|
||||||
NSDictionary* symbol=[typeDict objectForKey:symbolKey];
|
NSDictionary* symbol=[typeDict objectForKey:symbolKey];
|
||||||
if (text==textFiles && !firstFileName)
|
if (text==textFiles && !firstFileName)
|
||||||
firstFileName=[symbol objectForKey:@"fileName"];
|
firstFileName=[symbol objectForKey:@"fileName"];
|
||||||
|
@ -3536,9 +3653,12 @@ int main(int argc, char **argv, char **env)
|
||||||
{
|
{
|
||||||
NSLog(@"Making Index for symbol %@",[symbol objectForKey:@"title"]);
|
NSLog(@"Making Index for symbol %@",[symbol objectForKey:@"title"]);
|
||||||
};
|
};
|
||||||
[text appendFormat:@"<item><uref url=\"%@#%@\">%@</uref></item>\n",
|
fragment= [symbol objectForKey:@"fragment"];
|
||||||
[symbol objectForKey:@"fileName"],
|
[text appendFormat:@"<item><uref url=\"%@%@%@\">%@</uref></item>\n",
|
||||||
[symbol objectForKey:@"fragment"],
|
[[symbol objectForKey:@"fileName"]
|
||||||
|
stringByAppendingPathExtension:PathExtension_HTML],
|
||||||
|
([fragment length]>0 ? @"#" : @""),
|
||||||
|
(fragment ? fragment : @""),
|
||||||
[symbol objectForKey:@"title"]];
|
[symbol objectForKey:@"title"]];
|
||||||
};
|
};
|
||||||
[text appendString:@"</list>\n</section>\n"];
|
[text appendString:@"</list>\n</section>\n"];
|
||||||
|
@ -3566,12 +3686,12 @@ int main(int argc, char **argv, char **env)
|
||||||
finalText=TextByReplacingVariablesInText(textTemplate,variablesMutableDictionary);
|
finalText=TextByReplacingVariablesInText(textTemplate,variablesMutableDictionary);
|
||||||
if (verbose>=1)
|
if (verbose>=1)
|
||||||
{
|
{
|
||||||
NSLog(@"Writing Index %@",makeIndexFileName);
|
NSLog(@"Writing Index %@",makeIndexFileNameGSDoc);
|
||||||
};
|
};
|
||||||
if (![finalText writeToFile:makeIndexFileName
|
if (![finalText writeToFile:makeIndexFileNameGSDoc
|
||||||
atomically: YES])
|
atomically: YES])
|
||||||
{
|
{
|
||||||
NSLog(@"Error creating %@",makeIndexFileName);
|
NSLog(@"Error creating %@",makeIndexFileNameGSDoc);
|
||||||
goOn=NO;
|
goOn=NO;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -3580,17 +3700,17 @@ int main(int argc, char **argv, char **env)
|
||||||
// Finally, parse index
|
// Finally, parse index
|
||||||
if (goOn)
|
if (goOn)
|
||||||
{
|
{
|
||||||
if (makeIndexFileName)
|
if (makeIndexBaseFileName)
|
||||||
{
|
{
|
||||||
if (verbose>=1)
|
if (verbose>=1)
|
||||||
{
|
{
|
||||||
NSLog(@"Processing %@",makeIndexFileName);
|
NSLog(@"Processing %@",makeIndexFileNameGSDoc);
|
||||||
};
|
};
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
GSDocHtml *p=nil;
|
GSDocHtml *p=nil;
|
||||||
p = [GSDocHtml alloc];
|
p = [GSDocHtml alloc];
|
||||||
p = [p initWithFileName:makeIndexFileName];
|
p = [p initWithFileName:makeIndexFileNameGSDoc];
|
||||||
if (p != nil)
|
if (p != nil)
|
||||||
{
|
{
|
||||||
NSString *result = nil;
|
NSString *result = nil;
|
||||||
|
@ -3598,14 +3718,14 @@ int main(int argc, char **argv, char **env)
|
||||||
result=[p parseDocument];
|
result=[p parseDocument];
|
||||||
if (result == nil)
|
if (result == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"Error parsing %@",makeIndexFileName);
|
NSLog(@"Error parsing %@",makeIndexFileNameGSDoc);
|
||||||
goOn=NO;
|
goOn=NO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (verbose>=1)
|
if (verbose>=1)
|
||||||
{
|
{
|
||||||
NSLog(@"Parsed %@ - OK",makeIndexFileName);
|
NSLog(@"Parsed %@ - OK",makeIndexFileNameGSDoc);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
RELEASE(p);
|
RELEASE(p);
|
||||||
|
@ -3613,7 +3733,7 @@ int main(int argc, char **argv, char **env)
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
NSLog(@"Parsing '%@' - %@",makeIndexFileName, [localException reason]);
|
NSLog(@"Parsing '%@' - %@",makeIndexFileNameGSDoc, [localException reason]);
|
||||||
goOn=NO;
|
goOn=NO;
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER;
|
NS_ENDHANDLER;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue