# HG changeset patch # User Jari-Matti M?kel? # Date 1206629815 -7200 # Node ID 51edcd435b3057b823af09b71637f904c634fbe0 # Parent a8b3de00655469c8323ef53cc303f70c3cb62db7 Removed the old implementation of docgen. This isn't in usable state currently so I'll remove it temporarily. Hopefully there will a new version based on xml processing later. diff -r a8b3de006554 -r 51edcd435b30 src/docgen/archdoc.xmi --- a/src/docgen/archdoc.xmi Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1066 +0,0 @@ - - - - - umbrello uml modeller http://uml.sf.net - 1.5.8 - UnicodeUTF8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/config/configurator.d --- a/src/docgen/config/configurator.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.config.configurator; - -import docgen.config.reader; -import docgen.config.reflection; -import docgen.misc.options; - -import Integer = tango.text.convert.Integer; -import tango.io.stream.FileStream; -import tango.io.Stdout; - -/** - * Class for handling and merging doc generator options. - */ -interface Configurator { - /** - * Merges configuration options from the given file. - */ - void mergeConfiguration(char[] cfgFile); - - /** - * Returns a hierarchical structure of configuration options. - */ - DocGeneratorOptions *getConfiguration(); -} - -private DocGeneratorOptions options; -private Struct!(options) opt; -private const cases = makeTypeStringForStruct!(opt); - -class DefaultConfigurator : Configurator { - private: - - DocGeneratorOptions options; - - public: - - const defaultProfileLocation = "docgen/config/default.cfg"; - - this() { - mergeConfiguration(defaultProfileLocation); - } - - this(char[] cfgFile) { - this(); - mergeConfiguration(cfgFile); - } - - void mergeConfiguration(char[] cfgFile) { - - auto inputStream = new FileInput(cfgFile); - auto content = new char[inputStream.length]; - auto bytesRead = inputStream.read (content); - - assert(bytesRead == inputStream.length, "Error reading configuration file"); - - auto tokens = lex(content); - auto configuration = parse(tokens); - - foreach(key, val; configuration) { - bool err() { - throw new Exception( - "Configurator: Invalid key-val pair " ~ key ~ - "=" ~ (val.length ? val[0] : "null")); - } - - // cuteness, lul - mixin(_switch( - mixin(cases) ~ - `default: throw new Exception("Illegal configuration key " ~ key);` - )); - } - } - - DocGeneratorOptions *getConfiguration() { - return &options; - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/config/default.cfg --- a/src/docgen/config/default.cfg Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -# -# This file contains the default configuration. You don't need to -# worry about this, the system will load the settings automatically. -# -# If you need to customize settings, just take a copy of this or -# write one from scratch and pass the new file location as a -# command line parameter. -# - - -(options - (graph - (imageFormat PNG) - (depth -1) - (nodeColor white) - (cyclicNodeColor tomato) - (unlocatableNodeColor gray) - (depColor black) - (cyclicDepColor red) - (publicDepColor blue) - (clusterColor blue) - (includeUnlocatableModules true) - (highlightCyclicEdges true) - (highlightCyclicVertices true) - (groupByPackageNames true) - (groupByFullPackageName false) - ) - (listing - (literateStyle true) - (enableListings true) - ) - (templates - (title "Test project") - (versionString 1.0) - (copyright "Crashtest dummy") - (paperSize a4paper) - (shortFileNames false) - (templateStyle default) - ) - (parser - (importPaths) - (rootPaths) - (strRegexps) - (commentFormat Doxygen) - (depth -1) - ) - (outputFormats LaTeX HTML PlainText) - (outputDir tmp/) -) diff -r a8b3de006554 -r 51edcd435b30 src/docgen/config/reader.d --- a/src/docgen/config/reader.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.config.reader; - -debug import tango.io.Stdout; - -/** - * Lexes a s-exp like input - */ -char[][] lex(char[] input) { - char[][] tokens; - - uint state = 0, level = 0; - size_t sidx = 0; - - void err(size_t i, int type = 0) { - auto b = input[i<20 ? 0 : i-20..i]; - auto e = input[i+1..i+21>$ ? $ : i+21]; - - throw new Exception("Lex: " ~ - (type == 0 ? "Illegal character" : - type == 1 ? "Wrong number of parenthesis" : - "Unexpected end of input") ~ - ": " ~ b ~ " >>>" ~ input[i] ~ "<<< " ~ e ~ "." - ); - } - void begin(size_t i) { sidx = i; } - void end(size_t i) { tokens ~= input[sidx..i]; } - - foreach(size_t i, c; input) { - if (sidx > i) continue; - switch(c) { // states space, token, textEnd - case '"': // starts a ""-string - switch(state) { - case 0: - char[] buf; - bool escape; - char d; - sidx = i; - while(!((d = input[++sidx]) == '"' && !escape) && sidx 0) end(input.length); - - debug { - foreach(i, tok; tokens) - Stdout.format("{}{}", tok, (i != tokens.length-1 ? " " : "")); - Stdout.newline; - } - - return tokens; -} - -/** - * Parser a s-exp like input used by the config files. - */ -char[][][char[]] parse(char[][] tokens) { - char[][][char[]] values; - size_t i = 1; - - void err(size_t j) { - auto b = tokens[j < 5 ? 0 : j-5..j]; - auto e = tokens[j+1..j+6>$ ? $ : j+6]; - char[] tmp; - foreach(t; b) tmp ~= t ~ " "; - tmp ~= ">>>" ~ tokens[j] ~ "<<< "; - foreach(t; e) tmp ~= t ~ " "; - - throw new Exception( - "Parse: Illegal token: " ~ tmp ~ "." - ); - } - - if (tokens[0] != "(") err(0); - - void doParse(char[] prefix = null) { - if (tokens[i] == "(" || - tokens[i] == ")") err(i); - if (prefix) prefix ~= "."; - auto v = prefix ~ tokens[i++]; - //values[v] = null; - while (tokens[i] != ")") - if (tokens[i++] == "(") - doParse(v); - else - values[v] ~= tokens[i-1]; - i++; - } - - doParse(); - - return values; -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/config/reflection.d --- a/src/docgen/config/reflection.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,275 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.config.reflection; - -import docgen.misc.meta; -import docgen.misc.options; - -//// -// -// Macros for reading input -// -//// - -char[] _wrong(char[] key) { - return `if (val.length != 1) throw new Exception( - "Wrong number of arguments for `~key~`");`; -} - -char[] _switch(char[] stuff) { - return "switch(key) {" ~ stuff ~ "}"; -} - -char[] _parseI(char[] key) { - return `case "` ~ key ~ `":` ~ _wrong(key) ~ key ~ - `= Integer.parse(val[0]); continue;`; -} - -char[] _parseS(char[] key) { - return `case "` ~ key ~ `":` ~ _wrong(key) ~ key ~ - `= val[0]; continue;`; -} - -char[] _parseB(char[] key) { - return `case "` ~ key ~ `":` ~ _wrong(key) ~ key ~ - `= val[0] == "true" ? true : val[0] == "false" ? false : err(); continue;`; -} - -char[] _parseList(char[] key) { - return `case "` ~ key ~ `":foreach(v; val) ` ~ - key ~ `~= v; continue;`; -} - -template _parseEnum_(bool list, char[] key, V...) { - static if (V.length>1) - const char[] _parseEnum_ = - `case "` ~ V[0] ~ `":` ~ key ~ (list ? "~" : "") ~ `=` ~ V[1] ~ `; continue;` \n ~ - _parseEnum_!(list, key, V[2..$]); - else - const char[] _parseEnum_ = ""; -} - -template _parseEnum(char[] key, V...) { - const char[] _parseEnum = `case "` ~ key ~ - `":` ~ _wrong(key) ~ `switch(val[0]) {` ~ - _parseEnum_!(false, key, V) ~ - `default: err(); } continue;`; -} - -template _parseEnumList(char[] key, V...) { - const char[] _parseEnumList = `case "` ~ key ~ - `":` ~ `foreach (item; val) switch(item) {` ~ - _parseEnum_!(true, key, V) ~ - `default: err(); } continue;`; -} - -//// -// -// Reflection for properties. This code will hopefully get better when the dmdfe bugs get fixed. -// -//// - -// dmdfe bug -- Seriously WTF? -char[] fixType(char[] type) { - return type[$-1] == ' ' ? type[0..$-1] : type; -} - -// take the last part of field name -char[] getLastName(char[] field) { - if (field.length == 0) return ""; - int t = 0; - // dmdfe bug: a while loop causes index out of bounds error - for (int i=field.length-1; i >= 0; i--) - if (field[i] == '.') { t = i+1; break; } - return field[t..$]; -} - -// dmdfe bug: cannot return evalType alias -template _evalType(char[] type) { - mixin("alias "~type~" value;"); -} - -// Note: stuple wrappers needed for tuples, otherwise: -// dmdfe bug: cc1d: ../.././gcc/d/dmd/expression.c:4865: virtual Expression* DotIdExp::semantic(Scope*): Assertion `0' failed. -template evalType(char[] type) { - alias _evalType!(type).value evalType; -} - -// wraps the reflected struct and enum data inside struct because otherwise the handling becomes impossibly hard -template getType(T) { - static if(is(T == struct)) - alias Struct!(T) getType; - else static if(is(T == enum)) - alias Enum!(T) getType; - else static if(isEnumList!(T)) - alias Enum!(enumListType!(T), true) getType; - else - alias T getType; -} - -template getTypes(alias S, int idx = S.tupleof.length) { - static if(idx) - alias Tuple!(getTypes!(S, idx-1), getType!(typeof(S.tupleof[idx-1]))) getTypes; - else - alias Tuple!() getTypes; -} - -/** - * Extracts the comma separated struct field names using .tupleof.stringof. - * This is needed since the struct.tupleof[n].stringof is broken for enums and tuples in dmdfe. - * - * Bugs: handling of tuples - */ -char[] __getNames(char[] type) { - char[] tmp; - bool end = false; - - foreach(c; type[5..$]) { - if (c != ' ' && c != '(' && c != ')' && end) tmp ~= c; - if (c == ',') end = false; - if (c == '.') end = true; - } - - return tmp; -} - -template _getNames(char[] str, T...) { - static if (str.length) { - static if (str[0] == ',') - alias _getNames!(str[1..$], T, "") _getNames; - else - alias _getNames!(str[1..$], T[0..$-1], T[$-1] ~ str[0]) _getNames; - } else - alias T _getNames; -} - -template getNames(char[] str) { - alias _getNames!(__getNames(str), "") getNames; -} - -struct Struct(alias T) { - const type = "struct"; // used for pattern matching... apparently there's no other way - const name = fixType(T.stringof); // dmdfe bug: trailing space - alias STuple!(getNames!(T.tupleof.stringof)) names; - alias STuple!(getTypes!(T)) types; -} - -struct Enum(alias T, bool list = false) { - const type = list ? "enumlist" : "enum"; // used for pattern matching... apparently there's no other way - const name = T.stringof[1..$]; // dmdfe bug: returns enum base type instead enum type - alias evalType!("___"~name).tuple elements; -} - -// determines the enumtype[] type -template isEnumList(T : T[]) { - const isEnumList = T.stringof[0] == '_'; -} - -template isEnumList(T) { - const isEnumList = false; -} - -template enumListType(T : T[]) { - alias T enumListType; -} - -template enumListType(T) { - static assert(false, "Not enum list type!"); -} - -char[] createIParser(char[] field) { - return `_parseI("` ~ field ~ `") ~` \n; -} - -char[] createBParser(char[] field) { - return `_parseB("` ~ field ~ `") ~` \n; -} - -char[] createSParser(char[] field) { - return `_parseS("` ~ field ~ `") ~` \n; -} - -char[] createLParser(char[] field) { - return `_parseList("` ~ field ~ `") ~` \n; -} - -char[] createEParser(char[] field, char[] contents) { - return `_parseEnum!("` ~ field ~ `",` ~ contents ~ `) ~` \n; -} - -char[] createELParser(char[] field, char[] contents) { - return `_parseEnumList!("` ~ field ~ `",` ~ contents ~ `) ~` \n; -} - -template _makeEnumString(char[] t, E...) { - static if (E.length) - const _makeEnumString = `"` ~ E[0] ~ `", "` ~ t ~ "." ~ E[0] ~ `",` ~ - _makeEnumString!(t, E[1..$]); - else - const _makeEnumString = ""; -} - -// avoids the following dmdfe bugs: -// - Error: elements is not a type (typeof(T).elements) -// - Error: tuple is not a valid template value argument (T.elements where T is the complex type def) -template makeEnumString(char[] t, T) { - const makeEnumString = _makeEnumString!(t, T.elements); -} - -/** - * Generates code for parsing data from the configuration data structure. - */ -template makeTypeString(int i, N, T, char[] prefix) { - static assert(N.tuple.length == T.tuple.length); - static if (i < N.tuple.length) { - static if (is(T.tuple[i] == bool)) - const makeTypeString = createBParser(prefix ~ N.tuple[i]) ~ makeTypeString!(i+1, N, T, prefix); - else static if (is(T.tuple[i] : int)) - const makeTypeString = createIParser(prefix ~ N.tuple[i]) ~ makeTypeString!(i+1, N, T, prefix); - else static if (is(T.tuple[i] == char[])) - const makeTypeString = createSParser(prefix ~ N.tuple[i]) ~ makeTypeString!(i+1, N, T, prefix); - else static if (is(T.tuple[i] == char[][])) - const makeTypeString = createLParser(prefix ~ N.tuple[i]) ~ makeTypeString!(i+1, N, T, prefix); - else static if (is(T.tuple[i] == struct)) { - static if (T.tuple[i].type == "struct") - const makeTypeString = makeTypeString!(0, typeof(T.tuple[i].names), - typeof(T.tuple[i].types), prefix~N.tuple[i]~".") ~ - makeTypeString!(i+1, N, T, prefix); - else static if (T.tuple[i].type == "enum") - const makeTypeString = createEParser(prefix ~ N.tuple[i], - makeEnumString!(T.tuple[i].name, T.tuple[i])[0..$-1]) ~ - makeTypeString!(i+1, N, T, prefix); - else static if (T.tuple[i].type == "enumlist") - const makeTypeString = createELParser(prefix ~ N.tuple[i], - makeEnumString!(T.tuple[i].name, T.tuple[i])[0..$-1]) ~ - makeTypeString!(i+1, N, T, prefix); - else { - const makeTypeString = "?" ~ makeTypeString!(i+1, N, T, prefix); - static assert(false, "Unknown type"); - } - } else { - const makeTypeString = "?" ~ makeTypeString!(i+1, N, T, prefix); - static assert(false, "Unknown type"); - } - } else - const makeTypeString = ""; -} - -template makeTypeStringForStruct(alias opt) { - const makeTypeStringForStruct = makeTypeString!(0, opt.names, opt.types, opt.name~".")[0..$-2]; -} - -/* some leftovers -template handleType(T, char[] prefix="") { - static if(is(typeof(T) == struct)) { - static if(T.type == "enum") - // another dmdfe weirdness: T.stringof == "Enum!(Type)" here, but if do - // alias T handleType;, the result.stringof is "struct Enum". - alias T handleType; - } else - alias T handleType; -} -*/ - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/docgen.d --- a/src/docgen/docgen.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.docgen; - -import docgen.graphutils.writers; -import docgen.config.configurator; -import docgen.document.latexgenerator; -import docgen.document.htmlgenerator; -import docgen.document.xmlgenerator; -import docgen.document.plaintextgenerator; - -//import dil.Settings; -import dil.SettingsLoader; - -import tango.core.Array; -import tango.text.Text; -import tango.io.Stdout; - -void usage() { - Stdout( - "Usage: docgen rootpath importpath_1 ... importpath_n outputdir" - ).newline; -} - -void main(char[][] args) { - dil.SettingsLoader.loadSettings(); - - Stdout(docgen_version).newline.newline; - - if (args.length<3) { - usage(); - return; - } - - Configurator config = new DefaultConfigurator(); - - auto options = config.getConfiguration(); - options.parser.rootPaths = [ args[1] ]; - options.parser.importPaths = args[2..$-1]; - options.outputDir = args[$-1]; - - alias DepGraph.Vertex Vertex; - alias DepGraph.Edge Edge; - - Module[] cachedModules; - DepGraph cachedGraph; - - void parser(ref Module[] modules, ref DepGraph depGraph) { - Edge[] edges; - Vertex[char[]] vertices; - - if (cachedGraph !is null) { - modules = cachedModules; - depGraph = cachedGraph; - return; - } - - int id = 1; - - Parser.loadModules( - options.parser.rootPaths, - options.parser.importPaths, - options.parser.strRegexps, - options.graph.includeUnlocatableModules, - options.parser.depth, - (char[] fqn, char[] path, Module m) { - if (m is null) { - if (fqn in vertices) { - debug Stdout.format("{} already set.\n", fqn); - return; - } - auto vertex = new Vertex(fqn, path, id++); - vertices[fqn] = vertex; - debug Stdout.format("Setting {} = {}.\n", fqn, path); - } else { - vertices[m.moduleFQN] = new Vertex(m.moduleFQN, m.filePath, id++); - debug Stdout.format("Setting {} = {}.\n", m.moduleFQN, m.filePath); - } - }, - (Module imported, Module importer, bool isPublic, bool isStatic) { - debug Stdout.format("Connecting {} - {}.\n", imported.moduleFQN, importer.moduleFQN); - auto edge = vertices[imported.moduleFQN].addChild(vertices[importer.moduleFQN]); - edge.isPublic = isPublic; - edge.isStatic = isStatic; - edges ~= edge; - }, - modules - ); - - modules.sort( - (Module a, Module b) { return ((new Text!(char)(a.moduleFQN)).compare(b.moduleFQN)) < 0; } - ); - - depGraph.edges = edges; - depGraph.vertices = vertices.values; - - cachedGraph = depGraph; - cachedModules = modules; - } - - GraphCache graphcache = new DefaultGraphCache(); - - foreach(format; options.outputFormats) { - DocGenerator generator; - - switch(format) { - case DocFormat.LaTeX: - Stdout("Generating LaTeX docs.."); - generator = new LaTeXDocGenerator(*options, &parser, graphcache); - break; - case DocFormat.HTML: - Stdout("Generating HTML docs.."); - generator = new HTMLDocGenerator(*options, &parser, graphcache); - break; - case DocFormat.XML: - Stdout("Generating XML docs.."); - generator = new XMLDocGenerator(*options, &parser); - break; - case DocFormat.PlainText: - Stdout("Generating plain text docs.."); - generator = new PlainTextDocGenerator(*options, &parser, graphcache); - break; - default: throw new Exception("Format not supported"); - } - - generator.generate(); - Stdout("done.").newline; - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/document/generator.d --- a/src/docgen/document/generator.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.document.generator; - -import docgen.misc.misc; -import docgen.misc.parser; -public import docgen.misc.options; -import docgen.page.writers; -import docgen.moduledoc.writers; -import docgen.graphutils.writers; -import docgen.sourcelisting.writers; -import docgen.config.configurator; -import tango.io.stream.FileStream; -import tango.io.FilePath; -import tango.io.FileScan; -debug import tango.io.Stdout; - - -alias void delegate(ref Module[], ref DepGraph) ParserDg; - -abstract class DefaultDocGenerator : DocGenerator { - protected: - - DocFormat docFormat; - auto makeFile = "make.sh"; - char[] genDir; - - DocGeneratorOptions m_options; - ParserDg m_parser; - PageWriter docWriter; - - GraphWriterFactory graphFactory; - PageWriterFactory pageFactory; - ListingWriterFactory listingFactory; - ModuleDocWriterFactory moduleDocFactory; - - Module[] modules; - DepGraph depGraph; - - public: - - this(DocGeneratorOptions options, ParserDg parser) { - m_options = options; - m_parser = parser; - - createGraphWriterFactory(); - createPageWriterFactory(); - createListingWriterFactory(); - createModuleDocWriterFactory(); - - // create output dir - (new FilePath(options.outputDir ~ "/" ~ genDir)).create(); - - // copy static files - copyStaticContent(); - } - - DocGeneratorOptions *options() { - return &m_options; - } - - protected: - - void createGraphWriterFactory() { - graphFactory = new DefaultGraphWriterFactory(this); - } - - void createPageWriterFactory() { - pageFactory = new DefaultPageWriterFactory(this); - } - - void createListingWriterFactory() { - listingFactory = new DefaultListingWriterFactory(this); - } - - void createModuleDocWriterFactory() { - moduleDocFactory = new DefaultModuleDocWriterFactory(this); - } - - char[] outPath(char[] file) { - return options.outputDir ~ "/" ~ genDir ~ "/" ~ file; - } - - void copyStaticContent() { - auto scan = new FileScan(); - scan(templateDir~options.templates.templateStyle~"/"~formatDirs[docFormat]~"/static/"); - - foreach(filePath; scan.files) { - (new FilePath(outPath(filePath.file))).copy(filePath.toString()); - } - - debug Stdout(scan.files.length)(" static files copied.\n"); - } - - FileOutput outputFile(char[] fname) { - return new FileOutput(outPath(fname)); - } - - void parseSources() { - depGraph = new DepGraph(); - m_parser(modules, depGraph); - } - - //--- - - void writeSimpleFile(char[] fname, void delegate() dg) { - auto docFile = outputFile(fname); - - docWriter.setOutput([docFile]); - dg(); - - docFile.close(); - } - - /** - * Generates "makefile" for processing e.g. .dot files. - */ - void generateMakeFile(char[][] args ...) { - writeSimpleFile(makeFile, { docWriter.generateCustomPage("makefile", args); } ); - } - -} - -abstract class DefaultCachingDocGenerator : DefaultDocGenerator, CachingDocGenerator { - private: - - GraphCache m_graphCache; - - public: - - this(DocGeneratorOptions options, ParserDg parser, GraphCache graphCache) { - super(options, parser); - m_graphCache = graphCache; - } - - GraphCache graphCache() { - return m_graphCache; - } - - protected: - - void createGraphWriterFactory() { - graphFactory = new DefaultCachingGraphWriterFactory(this); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/document/htmlgenerator.d --- a/src/docgen/document/htmlgenerator.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.document.htmlgenerator; - -import docgen.document.generator; -import docgen.misc.misc; -import tango.io.stream.FileStream; -import tango.text.Util : replace; - -class HTMLDocGenerator : DefaultCachingDocGenerator { - private: - - auto docFileNames = [ - "index.html"[], "toc.html"[], "classes.html"[], - "modules.html"[], "files.html"[] - ]; - - auto depGraphFile = "depgraph.dot"; - auto depGraphDocFile = "depgraph.html"; - auto styleSheetFile = "default.css"; - - public: - - this(DocGeneratorOptions options, ParserDg parser, GraphCache graphcache) { - genDir = "html"; - docFormat = DocFormat.HTML; - super(options, parser, graphcache); - } - - /** - * Generates the documentation. - */ - void generate() { - parseSources(); - - docWriter = pageFactory.createPageWriter( null, docFormat ); - - // stylesheet needs to be created first to propagate the css file name - generateStyleSheet(); - - generateDoc(); - - if (options.listing.enableListings) - generateListings(); - - generateClasses(); - generateModules(); - generateDependencies(); - generateMakeFile(imageFormatExts[options.graph.imageFormat]); - } - - protected: - - /** - * Generates document skeleton. - */ - void generateDoc() { - writeSimpleFile(docFileNames[0], { - docWriter.generateFirstPage(); - }); - /* - writeSimpleFile(docFileNames[1], { - docWriter.generateTOC(modules); - docWriter.generateCustomPage("pagetemplate2", docgen_version); - });*/ - } - - /** - * Generates a global style sheet. - */ - void generateStyleSheet() { - writeSimpleFile(styleSheetFile, { - docWriter.generateCustomPage("stylesheet"); - }); - } - - /** - * Generates documentation for classes. - */ - void generateClasses() { - writeSimpleFile(docFileNames[2], { - docWriter.generateClassSection(); - docWriter.generateCustomPage("pagetemplate2", docgen_version); - }); - } - - /** - * Generates documentation for modules. - */ - void generateModules() { - writeSimpleFile(docFileNames[3], { - docWriter.generateModuleSection(modules); - docWriter.generateCustomPage("pagetemplate2", docgen_version); - }); - -// auto mdw = moduleDocFactory.createModuleDocWriter(docWriter, docFormat); - - } - - /** - * Generates source file listings. - */ - void generateListings() { - writeSimpleFile(docFileNames[4], { - docWriter.generateListingSection(modules); - - char[][] contents; - - contents ~= "("; - - foreach(mod; modules) { - auto FQN = mod.moduleFQN; - auto dstFname = replace(mod.moduleFQN.dup, '.', '_') ~ ".html"; - contents ~= `` ~ FQN ~ ""; - } - - contents ~= ")"; - - docWriter.addList(contents, false); - - docWriter.generateCustomPage("pagetemplate2", docgen_version); - }); - - auto writer = listingFactory.createListingWriter(docWriter, docFormat); - - foreach(mod; modules) { - auto dstFname = replace(mod.moduleFQN.dup, '.', '_') ~ ".html"; - - writeSimpleFile(dstFname, { - auto srcFile = new FileInput(mod.filePath); - writer.generateListing(srcFile, null, mod.moduleFQN); - srcFile.close(); - }); - } - } - - /** - * Generates dependency graphs. - */ - void generateDependencies() { - writeSimpleFile(depGraphDocFile, { - docWriter.generateDepGraphSection(); - - auto imgFile = outputFile(depGraphFile); - - auto writer = graphFactory.createGraphWriter( docWriter, GraphFormat.Dot ); - writer.generateDepGraph(depGraph, imgFile); - - imgFile.close(); - - docWriter.generateCustomPage("pagetemplate2", docgen_version); - }); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/document/latexgenerator.d --- a/src/docgen/document/latexgenerator.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.document.latexgenerator; - -import docgen.document.generator; -import docgen.misc.misc; -import tango.io.stream.FileStream; -import tango.text.Util : replace; - -/** - * Main routine for LaTeX doc generation. - */ -class LaTeXDocGenerator : DefaultCachingDocGenerator { - private: - - auto docFileName = "document.tex"; - auto depGraphDocFile = "dependencies.tex"; - auto depGraphFile = "depgraph.dot"; - auto listingFile = "files.tex"; - auto modulesFile = "modules.tex"; - - public: - - this(DocGeneratorOptions options, ParserDg parser, GraphCache graphcache) { - genDir = "latex"; - docFormat = DocFormat.LaTeX; - - super(options, parser, graphcache); - } - - /** - * Generates the documentation. - */ - void generate() { - parseSources(); - - generateDoc(); - - if (options.listing.enableListings) - generateListings(); - - generateClasses(); - generateModules(); - generateDependencies(); - generateMakeFile(docFileName, "pdf"); - } - - protected: - - /** - * Generates document skeleton. - */ - void generateDoc() { - auto docFile = outputFile(docFileName); - docWriter = pageFactory.createPageWriter( [ docFile ], docFormat ); - - docWriter.generateFirstPage(); - docWriter.generateTOC(modules); - docWriter.generateClassSection(); - docWriter.generateModuleSection(modules); - docWriter.generateListingSection(modules); - docWriter.generateDepGraphSection(); - docWriter.generateIndexSection(); - docWriter.generateLastPage(); - - docFile.close(); - } - - /** - * Generates documentation for classes. - */ - void generateClasses() { - auto docFile = outputFile(modulesFile); - docFile.close(); - } - - /** - * Generates documentation for modules. - */ - void generateModules() { - auto docFile = outputFile(modulesFile); - docFile.close(); - } - - /** - * Generates source file listings. - */ - void generateListings() { - writeSimpleFile(listingFile, { - auto writer = listingFactory.createListingWriter(docWriter, docFormat); - - foreach(mod; modules) { - auto dstFname = replace(mod.moduleFQN.dup, '.', '_') ~ ".d"; - - auto srcFile = new FileInput(mod.filePath); - auto dstFile = outputFile(dstFname); - - writer.generateListing(srcFile, dstFile, mod.moduleFQN); - - srcFile.close(); - dstFile.close(); - } - }); - } - - /** - * Generates dependency graphs. - */ - void generateDependencies() { - writeSimpleFile(depGraphDocFile, { - auto imgFile = outputFile(depGraphFile); - - auto writer = graphFactory.createGraphWriter( docWriter, GraphFormat.Dot ); - writer.generateDepGraph(depGraph, imgFile); - - imgFile.close(); - }); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/document/plaintextgenerator.d --- a/src/docgen/document/plaintextgenerator.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.document.plaintextgenerator; - -import docgen.document.generator; -import docgen.misc.misc; -import tango.io.stream.FileStream; -import tango.io.FilePath; -import tango.text.Util : replace; - -class PlainTextDocGenerator : DefaultCachingDocGenerator { - private: - - auto docFileNames = [ - "index.txt"[], "toc.txt"[], "classes.txt"[], - "modules.txt"[], "files.txt"[] - ]; - - auto depGraphFile = "depgraph.dot"; - auto depGraphDocFile = "depgraph.txt"; - - public: - - this(DocGeneratorOptions options, ParserDg parser, GraphCache graphcache) { - genDir = "txt"; - docFormat = DocFormat.PlainText; - - super(options, parser, graphcache); - } - - /** - * Generates the documentation. - */ - void generate() { - parseSources(); - - docWriter = pageFactory.createPageWriter( null, docFormat ); - - generateDoc(); - - if (options.listing.enableListings) - generateListings(); - - generateClasses(); - generateModules(); - generateDependencies(); - generateMakeFile(imageFormatExts[options.graph.imageFormat]); - } - - protected: - - /** - * Generates document skeleton. - */ - void generateDoc() { - writeSimpleFile(docFileNames[0], { - docWriter.generateFirstPage(); - }); - - writeSimpleFile(docFileNames[1], { - docWriter.generateTOC(modules); - }); - } - - /** - * Generates documentation for classes. - */ - void generateClasses() { - writeSimpleFile(docFileNames[2], { - docWriter.generateClassSection(); - }); - } - - /** - * Generates documentation for modules. - */ - void generateModules() { - writeSimpleFile(docFileNames[3], { - docWriter.generateModuleSection(modules); - }); - } - - /** - * Generates source file listings. - */ - void generateListings() { - writeSimpleFile(docFileNames[4], { - docWriter.generateListingSection(modules); - - char[][] contents; - - foreach(mod; modules) { - auto FQN = mod.moduleFQN; - contents ~= FQN ~ " (see " ~ replace(FQN.dup, '.', '_') ~ ".d)"; - } - - docWriter.addList(contents, false); - }); - - foreach(mod; modules) - (new FilePath(outPath(replace(mod.moduleFQN.dup, '.', '_') ~ ".d"))).copy(mod.filePath); - } - - /** - * Generates dependency graphs. - */ - void generateDependencies() { - writeSimpleFile(depGraphDocFile, { - docWriter.generateDepGraphSection(); - - auto imgFile = outputFile(depGraphFile); - - auto writer = graphFactory.createGraphWriter( docWriter, GraphFormat.Dot ); - writer.generateDepGraph(depGraph, imgFile); - - imgFile.close(); - }); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/document/xmlgenerator.d --- a/src/docgen/document/xmlgenerator.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.document.xmlgenerator; - -import docgen.document.generator; -import docgen.misc.misc; -import tango.io.stream.FileStream; -import tango.text.Util : replace; - -class XMLDocGenerator : DefaultDocGenerator { - public: - - this(DocGeneratorOptions options, ParserDg parser) { - genDir = "xml"; - docFormat = DocFormat.XML; - - super(options, parser); - } - - void generate() { /* TODO */ } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/graphutils/dotwriter.d --- a/src/docgen/graphutils/dotwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/** - * Author: Aziz Köksal & Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.graphutils.dotwriter; -import docgen.graphutils.writer; - -import tango.io.Print: Print; -import tango.text.convert.Layout : Layout; -import tango.io.FilePath; -import tango.text.Util; -import tango.text.convert.Sprint; -debug import tango.io.Stdout; - -/** - * Creates a graph rule file for the dot utility. - */ -class DotWriter : AbstractGraphWriter { - public: - - this(GraphWriterFactory factory, PageWriter writer) { - super(factory, writer); - } - - void generateDepGraph(DepGraph depGraph, OutputStream imageFile) { - generateImageTag(imageFile); - - auto image = generateDepImageFile(depGraph); - auto printer = new Print!(char)(new Layout!(char), imageFile); - printer(image); - } - - protected: - - char[] generateDepImageFile(DepGraph depGraph) { - char[] image; - auto sprint = new Sprint!(char); - - auto edges = depGraph.edges; - auto vertices = depGraph.vertices; - - DepGraph.Vertex[][char[]] verticesByPckgName; - if (factory.options.graph.groupByFullPackageName || - factory.options.graph.groupByPackageNames) { - foreach (mod; vertices) { - auto parts = mod.name.delimit("."); - - if (parts.length>1) { - auto pkg = parts[0..$-1].join("."); - verticesByPckgName[pkg] ~= mod; - } - } - } - - if (factory.options.graph.highlightCyclicVertices || - factory.options.graph.highlightCyclicEdges) - depGraph.markCycles(); - - image ~= "Digraph ModuleDependencies {\n"; - - foreach (module_; vertices) { - auto nodeName = - factory.options.graph.groupByPackageNames ? - module_.name.split(".")[$-1] : - module_.name; - - image ~= sprint.format( - ` n{} [label="{}",style=filled,fillcolor={}];`\n, - module_.id, - nodeName, - module_.cyclic && factory.options.graph.highlightCyclicVertices ? - factory.options.graph.cyclicNodeColor : - module_.incoming.length == 0 && module_.outgoing.length == 0 ? - factory.options.graph.unlocatableNodeColor : - factory.options.graph.nodeColor - ); - } - - foreach (edge; edges) - image ~= sprint.format( - ` n{} -> n{}[color={}];`\n, - edge.outgoing.id, - edge.incoming.id, - edge.cyclic ? - factory.options.graph.cyclicDepColor : - edge.isPublic ? - factory.options.graph.publicDepColor ~ ",style=bold" : - factory.options.graph.depColor - ); - - if (factory.options.graph.groupByPackageNames) - - if (!factory.options.graph.groupByFullPackageName) { - foreach (packageName, vertices; verticesByPckgName) { - auto name = packageName.split("."); - - if (name.length > 1) { - char[] pkg; - foreach(part; name) { - pkg ~= part ~ "."; - image ~= sprint.format( - `subgraph "cluster_{0}" {{`\n` label="{0}"`\n, - pkg[0..$-1], - pkg[0..$-1] - ); - } - for (int i=0; i< name.length; i++) { - image ~= "}\n"; - } - } - } - } - foreach (packageName, vertices; verticesByPckgName) { - image ~= sprint.format( - ` subgraph "cluster_{0}" {{`\n` label="{0}";color=` - ~ factory.options.graph.clusterColor ~ `;`\n` `, - packageName, - packageName - ); - - foreach (module_; vertices) - image ~= sprint.format(`n{0};`, module_.id); - image ~= "\n }\n"; - } - - image ~= "}"; - - return image; - } - - void generateImageTag(OutputStream imageFile) { - // name of the .dot file - char[] fn = (cast(Object)imageFile.conduit).toString(); - fn = FilePath(fn).file; - - fn = fn[0..$-3] ~ imageFormatExts[factory.options.graph.imageFormat]; - - writer.addGraphics(fn); - } -} - -class CachingDotWriter : DotWriter { - private: - - CachingGraphWriterFactory factory; - - public: - - this(CachingGraphWriterFactory factory, PageWriter writer) { - super(factory, writer); - this.factory = factory; - } - - override void generateDepGraph(DepGraph depGraph, OutputStream imageFile) { - generateImageTag(imageFile); - - auto cached = factory.graphCache.getCachedGraph(depGraph, GraphFormat.Dot); - - auto printer = new Print!(char)(new Layout!(char), imageFile); - - if (cached) { - printer(cached); - } else { - auto image = generateDepImageFile(depGraph); - factory.graphCache.setCachedGraph(depGraph, GraphFormat.Dot, image); - printer(image); - } - } -} - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/graphutils/modulenamewriter.d --- a/src/docgen/graphutils/modulenamewriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/** - * Author: Aziz Köksal & Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.graphutils.modulenamewriter; -import docgen.graphutils.writer; - -import tango.io.Print: Print; -import tango.text.convert.Layout : Layout; - -class ModuleNameWriter : AbstractGraphWriter { - public: - - this(GraphWriterFactory factory, PageWriter writer) { - super(factory, writer); - } - - void generateDepGraph(DepGraph depGraph, OutputStream imageFile) { - char[][] contents; - - auto edges = depGraph.edges; - auto vertices = depGraph.vertices; - - void doList(DepGraph.Vertex[] v, uint level) { - if (!level) return; - - contents ~= "("; - - foreach (vertex; v) { - contents ~= vertex.name; - if (vertex.outgoing.length) - doList(vertex.outgoing, level-1); - } - - contents ~= ")"; - } - - doList(vertices, factory.options.graph.depth); - - writer.addList(contents, false); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/graphutils/modulepathwriter.d --- a/src/docgen/graphutils/modulepathwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/** - * Author: Aziz Köksal & Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.graphutils.modulepathwriter; -import docgen.graphutils.writer; - -import tango.io.Print: Print; -import tango.text.convert.Layout : Layout; - -class ModulePathWriter : AbstractGraphWriter { - public: - - this(GraphWriterFactory factory, PageWriter writer) { - super(factory, writer); - } - - void generateDepGraph(DepGraph depGraph, OutputStream imageFile) { - char[][] contents; - - auto edges = depGraph.edges; - auto vertices = depGraph.vertices; - - void doList(DepGraph.Vertex[] v, uint level) { - if (!level) return; - - contents ~= "("; - - foreach (vertex; v) { - contents ~= vertex.location; - if (vertex.outgoing.length) - doList(vertex.outgoing, level-1); - } - - contents ~= ")"; - } - - doList(vertices, factory.options.graph.depth); - - writer.addList(contents, false); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/graphutils/primitives.d --- a/src/docgen/graphutils/primitives.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/** - * Author: Aziz Köksal & Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.graphutils.primitives; - -/** - * Extendible graph class. Should support separation of concerns now better with mixins. - * Provides a method for cycle marking. - */ -class Graph(alias V, alias E, int capacity = 1) { - static class Edge { - Vertex outgoing, incoming; - //bool cyclic = true; - - this(Vertex o, Vertex i) { - outgoing = o; - incoming = i; - o.outgoingEdges ~= this; - i.incomingEdges ~= this; - } - - bool cyclic() { - return outgoing.cyclic && incoming.cyclic; - } - - mixin E; - } - - static class Vertex { - Edge[] incomingEdges; - Edge[] outgoingEdges; - bool cyclic = true; - - Edge addChild(Vertex v) { - return new Edge(v, this); - } - - Edge addParent(Vertex v) { - return v.addChild(this); - } - - Vertex[] incoming() { - Vertex[] tmp; - - foreach(edge; incomingEdges) - tmp ~= edge.outgoing; - - return tmp; - } - - Vertex[] outgoing() { - Vertex[] tmp; - - foreach(edge; outgoingEdges) - tmp ~= edge.incoming; - - return tmp; - } - - mixin V; - } - - Vertex[] vertices; - Edge[] edges; - - this() { - vertices.length = capacity; - vertices.length = 0; - edges.length = capacity; - edges.length = 0; - } - - void add(Vertex vertex) { vertices ~= vertex; } - - void add(Edge edge) { edges ~= edge; } - - void connect(Vertex from, Vertex to) { edges ~= from.addParent(to); } - - void connect(int from, int to) { connect(vertices[from], vertices[to]); } - - /** - * Starts from non-cyclic nodes and propagates two both directions. - * Bugs: marks non-cyclic imports between two cycles as cyclic. Could be fixed later if it's really needed (slow) - */ - void markCycles() { - void mark(Vertex v) { - v.cyclic = false; - foreach(o; v.outgoing) { - if (!o.cyclic) continue; - - // propagate - bool cyclic = false; - foreach(p; o.incoming) if (p.cyclic) { cyclic = true; break; } - if (!cyclic) mark(o); - } - } - - void mark2(Vertex v) { - v.cyclic = false; - foreach(o; v.incoming) { - if (!o.cyclic) continue; - - // propagate - bool cyclic = false; - foreach(p; o.outgoing) if (p.cyclic) { cyclic = true; break; } - if (!cyclic) mark2(o); - } - } - - foreach(e; vertices) - if (e.cyclic) { - if (!e.incoming.length) mark(e); - if (!e.outgoing.length) mark2(e); - } - } -} - -template Empty() {} - - -// graph elements used in dep graphs - - -template DepEdge() { - bool isPublic; /// Public import. - bool isStatic; /// Static import. -} - -template DepVertex() { - char[] name; - char[] location; - uint id; - - this(char[] name, char[] location, uint id = 0) { - this.name = name; - this.location = location; - this.id = id; - } -} - -alias Graph!(DepVertex, DepEdge, 100) DepGraph; diff -r a8b3de006554 -r 51edcd435b30 src/docgen/graphutils/writer.d --- a/src/docgen/graphutils/writer.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.graphutils.writer; - -public import docgen.misc.misc; -public import docgen.graphutils.primitives; -public import docgen.page.writer; -debug import tango.io.Stdout; - -interface GraphWriter { - void generateDepGraph(DepGraph depGraph, OutputStream imageFile); -} - -interface GraphWriterFactory : WriterFactory { - GraphWriter createGraphWriter(PageWriter writer, GraphFormat outputFormat); -} - -interface CachingGraphWriterFactory : GraphWriterFactory { - GraphCache graphCache(); -} -/+ -/** - * Marks all cycles in the graph. - * - * May have bugs, but is a bit simpler than the previous version. - */ -void findCycles(Vertex[] vertices, Edge[] edges) { - debug void p() { - foreach(e; edges) Stderr(e.type)(" "c); - Stderr.newline; - } - - bool visit(Edge edge) { - if (edge.cycleType == CycleType.Reserved) { - edge.cycleType = CycleType.Cyclic; - version(VerboseDebug) p(); - return true; - } - - bool wasCyclic = edge.isCyclic(); - edge.cycleType = CycleType.Reserved; - version(VerboseDebug) p(); - - foreach(edge2; edge.incoming.outgoingEdges) - if (visit(edge2)) { - if (edge.isCyclic()) { - edge.cycleType = CycleType.Reserved; - wasCyclic = true; - version(VerboseDebug) p(); - continue; - } - edge.cycleType = CycleType.Cyclic; - return true; - } - - edge.cycleType = wasCyclic ? CycleType.Cyclic : CycleType.Cyclefree; - version(VerboseDebug) p(); - return false; - } - - foreach(vertex; vertices) - foreach(edge; vertex.outgoingEdges) - if (edge.cycleType == CycleType.Unspecified) { - visit(edge); - debug Stderr("*\n"); - } -} -+/ - -abstract class AbstractGraphWriter : AbstractWriter!(GraphWriterFactory), GraphWriter { - protected: - - PageWriter writer; - - public: - - this(GraphWriterFactory factory, PageWriter writer) { - super(factory); - this.writer = writer; - } -} - -class DefaultGraphCache : GraphCache { - private: - - char[][Object][GraphFormat] m_graphCache; - - public: - - char[] getCachedGraph(Object graph, GraphFormat format) { - debug Stdout("Starting graph lookup\n"); - debug Stdout(&graph, format).newline; - debug Stdout(&m_graphCache).newline; - - auto lookup1 = format in m_graphCache; - if (lookup1) { - auto lookup2 = graph in *lookup1; - if (lookup2) { - return *lookup2; - } - } - debug Stdout("Graph cache miss!\n"); - return null; - } - - void setCachedGraph(Object graph, GraphFormat format, char[] - contents) { - m_graphCache[format][graph] = contents; - debug Stdout("Graph cache updated!\n"); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/graphutils/writers.d --- a/src/docgen/graphutils/writers.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.graphutils.writers; - -public import docgen.graphutils.writer; -import docgen.graphutils.dotwriter; -import docgen.graphutils.modulepathwriter; -import docgen.graphutils.modulenamewriter; - -class DefaultGraphWriterFactory : AbstractWriterFactory, GraphWriterFactory { - public: - - this(DocGenerator generator) { - super(generator); - } - - GraphWriter createGraphWriter(PageWriter writer, GraphFormat outputFormat) { - switch (outputFormat) { - case GraphFormat.Dot: - return new DotWriter(this, writer); - case GraphFormat.ModuleNames: - return new ModuleNameWriter(this, writer); - case GraphFormat.ModulePaths: - return new ModulePathWriter(this, writer); - default: - throw new Exception("Graph writer type does not exist!"); - } - } -} - -class DefaultCachingGraphWriterFactory : AbstractWriterFactory, CachingGraphWriterFactory { - public: - - CachingDocGenerator generator; - - this(CachingDocGenerator generator) { - super(generator); - this.generator = generator; - } - - GraphCache graphCache() { - return generator.graphCache; - } - - override GraphWriter createGraphWriter(PageWriter writer, GraphFormat outputFormat) { - switch (outputFormat) { - case GraphFormat.Dot: - return new CachingDotWriter(this, writer); - case GraphFormat.ModuleNames: - return new ModuleNameWriter(this, writer); - case GraphFormat.ModulePaths: - return new ModulePathWriter(this, writer); - default: - throw new Exception("Graph writer type does not exist!"); - } - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/lstlang0.sty --- a/src/docgen/lstlang0.sty Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -%% -%% D definition (c) 2007 Jari-Matti Mäkelä -%% -\lst@definelanguage{D}% - {morekeywords={abstract,alias,align,asm,assert,auto,body,bool,break,% - byte,case,cast,catch,cdouble,cent,cfloat,char,class,const,continue,% - creal,dchar,debug,default,delegate,delete,deprecated,do,double,% - else,enum,export,extern,false,final,finally,float,for,foreach,% - foreach_reverse,function,goto,idouble,if,ifloat,import,in,inout,% - int,interface,invariant,ireal,is,lazy,long,macro,mixin,module,new,% - null,out,override,package,pragma,private,protected,public,real,ref,% - return,scope,short,static,struct,super,switch,synchronized,template,% - this,throw,true,try,typedef,typeid,typeof,ubyte,ucent,uint,ulong,% - union,unittest,ushort,version,void,volatile,wchar,while,with},% - sensitive,% - morecomment=[s]{/*}{*/},% - morecomment=[n]{/+}{+/},% - morecomment=[l]//,% - morestring=[b]",% - morestring=[b]`% - }[keywords,comments,strings]% \ No newline at end of file diff -r a8b3de006554 -r 51edcd435b30 src/docgen/misc/meta.d --- a/src/docgen/misc/meta.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.misc.meta; - -/// tuple literal workaround -template Tuple(T...) { alias T Tuple; } - -/// another tuple literal workaround (can be nested & avoids at least one dmdfe bug) -struct STuple(T...) { alias T tuple; } - - -// (a -> b), [a] -> [b] -template map(alias S, T...) { - static if (T.length) - alias Tuple!(S!(T[0]), map!(S, T[1..$])) map; - else - alias T map; -} - -/// (a -> Bool), [a] -> [a] -template filter(alias S, T...) { - static if (!T.length) - alias Tuple!() filter; - else static if (S!(T[0])) - alias Tuple!(T[0], filter!(S, T[1..$])) filter; - else - alias filter!(S, T[1..$]) filter; -} - -/// Int -> Bool -template odd(int T) { - const odd = T%2 == 1; -} - -/// Int -> Bool -template even(int T) { - const even = !odd!(T); -} - -/// a [a] -> a -- max x y = max2 x (max y) -T max(T, U...)(T a, U b) { - static if (b.length) - return a > max(b) ? a : max(b); - else - return a; -} - -/// a [a] -> a -- min x y = min2 x (min y) -T min(T, U...)(T a, U b) { - static if (b.length) - return a < min(b) ? a : min(b); - else - return a; -} - -/// Upcasts derivatives of B to B -template UpCast(B, T) { alias T UpCast; } -template UpCast(B, T : B) { alias B UpCast; } - -/// converts integer to ascii, base 10 -char[] itoa(int i) { - char[] ret; - auto numbers = "0123456789ABCDEF"; - - do { - ret = numbers[i%10] ~ ret; - i /= 10; - } while (i) - - return ret; -} - -/// Enum stuff - -template _genList(char[] pre, char[] post, T...) { - static if (T.length) - const _genList = pre ~ T[0] ~ post ~ (T.length>1 ? "," : "") ~ - _genList!(pre, post, T[1..$]); - else - const _genList = ``; -} - -/** - * Creates - * - a typedef for enum (workaround for .tupleof.stringof) - * - the enum structure - * - string array of enum items (for runtime programming) - * - string tuple of enum items (for metaprogramming - char[][] doesn't work) - */ -template createEnum(char[] tName, char[] eName, char[] arName, char[] alName, T...) { - const createEnum = - "typedef int " ~ tName ~ ";" ~ - "enum " ~ eName ~ ":" ~ tName ~ "{" ~ _genList!("", "", T) ~ "};" ~ - "char[][] " ~ arName ~ "=[" ~ _genList!(`"`, `"[]`, T) ~ "];" ~ - "alias STuple!(" ~ _genList!(`"`, `"`, T) ~ ") " ~ alName ~ ";"; -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/misc/misc.d --- a/src/docgen/misc/misc.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.misc.misc; -import docgen.misc.options; -import tango.io.model.IConduit : OutputStream; - -char[] docgen_version = "Dil document generator 0.1"; - -interface DocGenerator { - DocGeneratorOptions *options(); - void generate(); -} - -interface GraphCache { - char[] getCachedGraph(Object graph, GraphFormat format); - void setCachedGraph(Object graph, GraphFormat format, char[] contents); -} - -interface CachingDocGenerator : DocGenerator { - GraphCache graphCache(); -} - -interface WriterFactory { - DocGeneratorOptions *options(); -} - -abstract class AbstractWriterFactory : WriterFactory { - protected DocGenerator generator; - - public: - - DocGeneratorOptions *options() { - return generator.options; - } - - this(DocGenerator generator) { - this.generator = generator; - } -} - - -template AbstractWriter(T, int n = 0) { - abstract class AbstractWriter { - protected T factory; - protected OutputStream[] outputs; - - static if (n > 0) { - this(T factory, OutputStream[] outputs) { - this.factory = factory; - this.outputs = outputs; - assert(outputs.length == n, "Incorrect number of outputs"); - } - } - - this(T factory) { - this.factory = factory; - } - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/misc/options.d --- a/src/docgen/misc/options.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.misc.options; - -import docgen.misc.meta; - -/** creates reflective enums, syntax: enum name + list of elements */ -template optionEnum(char[] name, T...) { - const optionEnum = createEnum!("_" ~ name, name, "__" ~ name, "___" ~ name, T); -} - -/** Supported document output formats. */ -mixin(optionEnum!("DocFormat", "LaTeX", "XML", "HTML", "PlainText")); - -/** - * Supported comment formats. - * - * http://www.stack.nl/~dimitri/doxygen/docblocks.html - * http://www.digitalmars.com/d/ddoc.html - */ -mixin(optionEnum!("CommentFormat", "Ddoc", "Doxygen")); - -/** Supported image formats. */ -mixin(optionEnum!("ImageFormat", "PNG", "SVG", "GIF", "PDF")); - -/** Image format extensions. */ -const imageFormatExts = [ "png", "svg", "gif", "pdf" ]; - -/** Supported graph writers. */ -mixin(optionEnum!("GraphFormat", "Dot", "ModuleNames", "ModulePaths")); - -struct GraphOptions { - /// image format to use for graphs - ImageFormat imageFormat; - /// maximum depth of dependencies in graphs - uint depth; - /// color of normal modules - char[] nodeColor; - /// color of the modules in cyclic dep relation - char[] cyclicNodeColor; - /// unlocatable module color - char[] unlocatableNodeColor; - /// color of the dependencies - char[] depColor; - /// color of the dependencies in cyclic dep relation - char[] cyclicDepColor; - /// color of the public dependencies - char[] publicDepColor; - /// package color - char[] clusterColor; - /// include unlocatable modules to the dep graph - bool includeUnlocatableModules; - /// highlight imports in cyclic dep relation - bool highlightCyclicEdges; - /// highlight modules in cyclic dep relation - bool highlightCyclicVertices; - /// group modules by package names in dep graph - bool groupByPackageNames; - /// group modules hierarchically or by full package name - bool groupByFullPackageName; -} - -struct ListingOptions { - /// use literate programming symbols [LaTeX] - bool literateStyle; - /// enable source code listings - bool enableListings; -} - -struct TemplateOptions { - /// project title - char[] title; - /// project version - char[] versionString; - /// copyright notice - char[] copyright; - /// paper size [LaTeX] - char[] paperSize; - /// use short file names [HTML] - bool shortFileNames; - /// page template style to use, customizable via docgen/templates - char[] templateStyle; -} - -struct ParserOptions { - /// paths to search for imports - char[][] importPaths; - /// paths to "root files" - char[][] rootPaths; - /// regexps for excluding modules - char[][] strRegexps; - /// comment format [comment parser] - CommentFormat commentFormat; - /// maximum depth of dependencies - uint depth; -} - -struct DocGeneratorOptions { - /// location for the generated output - char[] outputDir; - - /// list of document formats to be generated - DocFormat[] outputFormats; - - GraphOptions graph; - ListingOptions listing; - TemplateOptions templates; - ParserOptions parser; -} - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/misc/parser.d --- a/src/docgen/misc/parser.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +0,0 @@ -/** - * Author: Aziz Köksal & Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.misc.parser; - -import dil.parser.Parser; -import dil.parser.ImportParser; -import dil.File; -import dil.Settings; -public import dil.semantic.Module; -import tango.text.Regex : RegExp = Regex; -import tango.io.FilePath; -import tango.io.FileSystem; -import tango.core.Array : remove; -import tango.text.Util; -import docgen.misc.meta; -debug import tango.io.Stdout; - -alias void delegate (char[] fqn, char[] path, Module module_) modDg; -alias void delegate (Module imported, Module importer, bool isPublic, bool isStatic) importDg; - -class Parser { - protected: - -// ParserOptions m_options; - - - static char[] findModuleFilePath(char[] moduleFQNPath, char[][] importPaths) { - auto filePath = new FilePath(); - foreach (importPath; importPaths) { - filePath.set(importPath); - filePath.append(moduleFQNPath); - - foreach (moduleSuffix; [".d", ".di"/*interface file*/]) - { - filePath.suffix(moduleSuffix); - debug Stdout("Trying ")(filePath.toString()).newline; - if (filePath.exists()) - return filePath.toString(); - } - } - - debug Stdout(" * ")(moduleFQNPath)(" does not exist in imports\n")(); - return null; - } - - public: - - /** - * Imports the transitive closure of imports starting from "filePath", - * limited by recursionDepth. - * - * The search can be filtered by providing a list of regexps that match the - * FQNs of modules to be ignored. - * - * Params: - * filePath = Path of the file to parse - * importPaths = Directories to look for imports - * strRegexps = Filter regexps - * IncludeUnlocatableModules = Call the delegate also for unlocatable files - * recursionDepth = How many levels of imports to follow (-1 = no limit) - * mdg = Delegate that gets called for every module found - * idg = Delegate that gets called for every import found - * modules = List of parsed modules - */ - static void loadModules(char[] filePath, char[][] importPaths, char[][] strRegexps, - bool IncludeUnlocatableModules, int recursionDepth, - modDg mdg, importDg idg, out Module[] modules) { - - loadModules([filePath], importPaths, strRegexps, IncludeUnlocatableModules, - recursionDepth, mdg, idg, modules); - } - - /** - * Imports the transitive closure of imports starting from "filePath", - * limited by recursionDepth. - * - * The search can be filtered by providing a list of regexps that match the - * FQNs of modules to be ignored. - * - * Params: - * filePaths = Paths of the files to parse - * importPaths = Directories to look for imports - * strRegexps = Filter regexps - * IncludeUnlocatableModules = Call the delegate also for unlocatable files - * recursionDepth = How many levels of imports to follow (-1 = no limit) - * mdg = Delegate that gets called for every module found - * idg = Delegate that gets called for every import found - * modules = List of parsed modules - */ - static void loadModules(char[][] filePaths, char[][] importPaths, char[][] strRegexps, - bool IncludeUnlocatableModules, int recursionDepth, - modDg mdg, importDg idg, out Module[] modules) { - - // Initialize regular expressions. - RegExp[] regexps; - foreach (strRegexp; strRegexps) - regexps ~= new RegExp(strRegexp); - - importPaths ~= "."; - - // Add directory of file and global directories to import paths. - foreach(filePath; filePaths) { - auto fileDir = (new FilePath(filePath)).folder(); - if (fileDir.length) - importPaths ~= fileDir; - } - -// importPaths ~= GlobalSettings.importPaths; - - debug foreach(path; importPaths) { - Stdout("Import path: ")(path).newline; - } - - Module[char[]] loadedModules; - - Module loadModule(char[] moduleFQNPath, int depth) { - if (depth == 0) return null; - - debug Stdout("Loading ")(moduleFQNPath).newline; - - // Return already loaded module. - auto mod_ = moduleFQNPath in loadedModules; - if (mod_ !is null) { - debug Stdout(" Already loaded.")(moduleFQNPath).newline; - return *mod_; - } - - auto FQN = replace(moduleFQNPath.dup, dirSep, '.'); - - // Ignore module names matching regular expressions. - foreach (rx; regexps) - if (rx.test(FQN)) return null; - - auto moduleFilePath = findModuleFilePath(moduleFQNPath, importPaths); - - debug Stdout(" FQN ")(FQN).newline; - debug Stdout(" Module path ")(moduleFilePath).newline; - - Module mod = null; - - if (moduleFilePath is null) { - if (IncludeUnlocatableModules) - mdg(FQN, moduleFQNPath, null); - } else { - mod = new Module(moduleFilePath); - - // Use lightweight ImportParser. -// mod.parser = new ImportParser(loadFile(moduleFilePath), moduleFilePath); - mod.parse(); - - debug Stdout(" Parsed FQN ")(mod.getFQN()).newline; - - // autoinclude dirs (similar to Java) - // running docgen in foo/bar/abc/ also finds foo/xyz/zzz.d if module names are right - { - // foo.bar.mod -> [ "foo", "bar" ] - auto modPackage = split(mod.getFQN, ".")[0..$-1]; - auto modDir = split(FileSystem.toAbsolute(new FilePath(moduleFilePath)).standard().folder(), "/"); - auto modLocation = modDir[0..modDir.remove(".")]; - - bool matches = false; - int i; - - for(i = 1; i <= min(modPackage.length, modLocation.length); i++) { - matches = true; - debug Stdout(" Decl: ")(modPackage[$-i]).newline; - debug Stdout(" Path: ")(modLocation[$-i]).newline; - if (modPackage[$-i] != modLocation[$-i]) { - matches = false; - break; - } - } - if (matches) { - auto loc = modLocation[0..$-i+1].join("/"); - debug Stdout(" Autoadding import: ")(loc).newline; - importPaths ~= loc; - } - } - - mdg(FQN, moduleFQNPath, mod); - loadedModules[moduleFQNPath] = mod; - - foreach (importDecl; mod.imports) - foreach(moduleFQN_; importDecl.getModuleFQNs(dirSep)) { - auto loaded_mod = loadModule(moduleFQN_, depth == -1 ? depth : depth-1); - - if (loaded_mod !is null) { - idg(loaded_mod, mod, importDecl.isPublic(), importDecl.isStatic()); - } else if (IncludeUnlocatableModules) { - auto tmp = new Module(null); - tmp.setFQN(replace(moduleFQN_.dup, dirSep, '.')); - idg(tmp, mod, importDecl.isPublic(), importDecl.isStatic()); - } - } - } - - return mod; - } // loadModule - - foreach(filePath; filePaths) - loadModule(filePath, recursionDepth); - - // Finished loading modules. - - // Ordered list of loaded modules. - modules = loadedModules.values; - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/misc/textutils.d --- a/src/docgen/misc/textutils.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/** - * Author: Aziz Köksal & Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.misc.textutils; - -// copied from Generate.d -char[] xml_escape(char[] text) -{ - char[] result; - result.length = text.length; - result.length = 0; - foreach(c; text) - switch(c) - { - case '<': result ~= "<"; break; - case '>': result ~= ">"; break; - case '&': result ~= "&"; break; - default: result ~= c; - } - return result; -} - -char[] plainTextHeading(char[] s) { - char[] line; - line.length = 80; - line[] = '='; - - return s ~ \n ~ line[0..s.length].dup ~ \n ~ \n; -} - -char[] plainTextHorizLine(int l = 80) { - char[] line; - line.length = 80; - line[] = '-'; - - return line[0..l].dup ~ \n; -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/moduledoc/htmlwriter.d --- a/src/docgen/moduledoc/htmlwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.moduledoc.htmlwriter; - -import docgen.moduledoc.writer; -import docgen.misc.textutils; - - -/** - * TODO - */ -class HTMLWriter : AbstractWriter!(ModuleDocWriterFactory), ModuleDocWriter { - PageWriter writer; - - this(ModuleDocWriterFactory factory, PageWriter writer) { - super(factory); - this.writer = writer; - } - - void generateModuleDoc(Module mod, OutputStream output) { - - /* - auto inputStream = cast(FileInput)input; - auto content = new char[inputStream.length]; - auto bytesRead = inputStream.read (content); - - assert(bytesRead == inputStream.length, "Error reading source file"); - assert(output == null); - - writer.addListing( - moduleName, - xml_escape(content) - );*/ - } -} - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/moduledoc/writer.d --- a/src/docgen/moduledoc/writer.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.moduledoc.writer; - -import docgen.misc.misc; -public import docgen.page.writer; -import tango.io.model.IConduit : OutputStream, InputStream; - -interface ModuleDocWriter { - void generateModuleDoc(Module mod, OutputStream output); -} - -interface ModuleDocWriterFactory : WriterFactory { - ModuleDocWriter createModuleDocWriter(PageWriter writer, DocFormat outputFormat); -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/moduledoc/writers.d --- a/src/docgen/moduledoc/writers.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.moduledoc.writers; - -public import docgen.moduledoc.writer; -//import docgen.moduledoc.latexwriter; -import docgen.moduledoc.htmlwriter; -//import docgen.moduledoc.xmlwriter; - -class DefaultModuleDocWriterFactory : AbstractWriterFactory, ModuleDocWriterFactory { - this(DocGenerator generator) { - super(generator); - } - - ModuleDocWriter createModuleDocWriter(PageWriter writer, DocFormat outputFormat) { - switch (outputFormat) {/* - case DocFormat.LaTeX: - return new LaTeXWriter(this, writer); - case DocFormat.XML: - return new XMLWriter(this, writer);*/ - case DocFormat.HTML: - return new HTMLWriter(this, writer); - default: - throw new Exception("Moduledoc writer type does not exist!"); - } - } -} - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/page/htmlwriter.d --- a/src/docgen/page/htmlwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.page.htmlwriter; - -import docgen.page.writer; -import docgen.misc.textutils; -import tango.io.FileConduit : FileConduit; -import tango.text.convert.Sprint; -import tango.io.FilePath; - -/** - * Writes a HTML document skeleton. - */ -class HTMLWriter : AbstractPageWriter!("html") { - private: - - char[] styleSheetFile; - - public: - - this(PageWriterFactory factory, OutputStream[] outputs) { - super(factory); - } - - override void generateClassSection() { - print.format(getTemplate("classes"), factory.options.templates.title); - } - - override void generateModuleSection(Module[] modules) { - print.format(getTemplate("modules"), factory.options.templates.title); - } - - override void generateListingSection(Module[] modules) { - print.format(getTemplate("listings"), factory.options.templates.title); - } - - override void generateDepGraphSection() { - print.format(getTemplate("dependencies"), factory.options.templates.title); - } - - void generateFirstPage() { - print.format( - getTemplate("firstpage"), - factory.options.templates.title, - factory.options.templates.versionString, - factory.options.templates.copyright - ); - - footer(); - } - - /** - * A hack for figuring out the stylesheet file name. - */ - override void generateCustomPage(char[] name, char[][] args ...) { - super.generateCustomPage(name, args); - - if (name == "stylesheet") { - styleSheetFile = (new FilePath( - (cast(Object)outputs[0].conduit).toString())).file(); - } - } - - /** - * Overrides the default template fetcher in order to - * provide a consistent layout for all pages. - */ - override char[] getTemplate(char[] name) { - auto content = super.getTemplate(name); - - foreach(pageName; [ - "firstpage"[], "toc"[], "classes"[], "modules"[], "listing"[], - "listings"[], "dependencies"[], "lastpage"[] ]) { - if (name == pageName) { - auto sprint = new Sprint!(char)(5120); - char[] title = factory.options.templates.title ~ " "; - switch(name) { - case "firstpage": title ~= "Documentation"; break; - case "toc": title ~= "TOC"; break; - case "classes": title ~= "Class index"; break; - case "modules": title ~= "Module index"; break; - case "listing": title ~= "File contents"; break; - case "listings": title ~= "File index"; break; - case "dependencies": title ~="Dependencies"; break; - } - return - sprint.format(super.getTemplate("pagetemplate"), styleSheetFile, title) ~ - content; - } - } - - return content; - } - - void addList(char[][] contents, bool ordered) { - foreach(item; contents) { - switch(item) { - case "(": print(ordered ? "
    " : "
      "); continue; - case ")": print(ordered ? "
" : ""); continue; - default: print("
  • ")(item)("
  • "); - } - } - } - - override void addListing(char[] moduleName, char[] contents, bool inline) { - print.format(getTemplate("listing"), moduleName, contents); - - footer(); - } - - protected: - - /** - * Writes the page footer. - */ - void footer() { - print.format(getTemplate("pagetemplate2"), docgen_version); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/page/latexwriter.d --- a/src/docgen/page/latexwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.page.latexwriter; - -import docgen.page.writer; -import tango.io.FileConduit : FileConduit; - -/** - * Writes a LaTeX document skeleton. - */ -class LaTeXWriter : AbstractPageWriter!("latex", 1) { - this(PageWriterFactory factory, OutputStream[] outputs) { - super(factory, outputs); - } - - void generateFirstPage() { - print.format( - getTemplate("firstpage"), - factory.options.templates.paperSize, - factory.options.templates.title, - factory.options.templates.versionString, - docgen_version, - timeNow(), - factory.options.listing.literateStyle ? "" : "%" - ); - } - - void addList(char[][] contents, bool ordered) { - foreach(item; contents) { - switch(item) { - case "(": print(ordered ? "\\begin{enumerate}" : "\\begin{itemize}"); continue; - case ")": print(ordered ? "\\end{enumerate}" : "\\end{itemize}"); continue; - default: print("\\item")(item)(\n); - } - } - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/page/plaintextwriter.d --- a/src/docgen/page/plaintextwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.page.plaintextwriter; - -import docgen.page.writer; -import docgen.misc.textutils; -import tango.io.FileConduit : FileConduit; - -/** - * Writes a plain text document skeleton. - */ -class PlainTextWriter : AbstractPageWriter!("plaintext") { - this(PageWriterFactory factory, OutputStream[] outputs) { - super(factory); - } - - override void generateTOC(Module[] modules) { - print.format(getTemplate("toc")); - } - - override void generateModuleSection(Module[] modules) { - print.format(getTemplate("modules")); - } - - override void generateListingSection(Module[] modules) { - print.format(getTemplate("listings")); - } - - void generateDepGraphSection() { - print.format(getTemplate("dependencies")); - } - - void generateFirstPage() { - print.format(getTemplate("firstpage"), - plainTextHeading(factory.options.templates.title ~ " Reference Manual"), - factory.options.templates.versionString, - docgen_version, - timeNow() - ); - } - - void addList(char[][] contents, bool ordered) { - uint[] counters; - foreach(item; contents) { - switch(item) { - case "(": counters ~= 1; continue; - case ")": counters.length = counters.length - 1; continue; - default: - if (counters.length>0) - for (int i=0; i <= counters.length; i++) - print(" "); - if (ordered) - print(++counters[$-1])(". ")(item)(\n); - else - print("* ")(item)(\n); - } - } - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/page/writer.d --- a/src/docgen/page/writer.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.page.writer; - -public import docgen.misc.misc; -public import docgen.misc.options; -public import docgen.misc.parser; -import tango.io.model.IConduit : OutputStream; -import tango.time.chrono.Gregorian; -import tango.text.locale.Core; -import tango.time.WallClock; -import tango.text.convert.Sprint; -import tango.io.stream.FileStream; -import tango.io.Stdout; -import tango.io.Print: Print; -import tango.text.convert.Layout : Layout; -import tango.io.FilePath; -import tango.io.FileScan; - -const templateDir = "docgen/templates/"; - -const formatDirs = [ "latex"[], "xml"[], "html"[], "plaintext"[] ]; - -/** - * Writes the logical subcomponents of a document, - * e.g. sections, embedded graphics, lists - */ -interface PageWriter { - /** - * Updates the outputstreams. - */ - void setOutput(OutputStream[] outputs); - - /** - * Generates the first page(s). - */ - void generateFirstPage(); - - /** - * Generates table of contents. - */ - void generateTOC(Module[] modules); - - /** - * Generates class documentation section. - */ - void generateClassSection(); - - /** - * Generates module documentation section. - */ - void generateModuleSection(Module[] modules); - - /** - * Generates source code listing section. - */ - void generateListingSection(Module[] modules); - - /** - * Generates dependency graph section. - */ - void generateDepGraphSection(); - - /** - * Generates an index section. - */ - void generateIndexSection(); - - /** - * Generates the last page(s). - */ - void generateLastPage(); - - /** - * Generates a page using a custom template file. - * - * Some examples: style sheet, DTD files, makefiles. - */ - void generateCustomPage(char[] name, char[][] args ...); - - // --- page components - // - /* - * Adds an external graphics file. - */ - void addGraphics(char[] imageFile); - - /** - * Adds a source code listing. - */ - void addListing(char[] moduleName, char[] contents, bool inline = true); - - /** - * Adds a list of items. - */ - void addList(char[][] contents, bool ordered); -} - -interface PageWriterFactory : WriterFactory { - PageWriter createPageWriter(OutputStream[] outputs, DocFormat outputFormat); -} - -template AbstractPageWriter(char[] format, int n = 0) { - abstract class AbstractPageWriter : AbstractWriter!(PageWriterFactory, n), PageWriter { - protected: - - char[][char[]] m_templates; - Print!(char) print; - - public: - - this(PageWriterFactory factory, OutputStream[] outputs) { - this(factory); - setOutput(outputs); - } - - void setOutput(OutputStream[] outputs) { - this.outputs = outputs; - static if (n > 0) - assert(outputs.length == n, "Incorrect number of outputs"); - - print = new Print!(char)(new Layout!(char), outputs[0]); - } - - void generateTOC(Module[] modules) { - print.format(getTemplate("toc")); - } - - void generateClassSection() { - print.format(getTemplate("classes")); - } - - void generateModuleSection(Module[] modules) { - print.format(getTemplate("modules")); - } - - void generateListingSection(Module[] modules) { - print.format(getTemplate("listings")); - } - - void generateDepGraphSection() { - print.format(getTemplate("dependencies")); - } - - void generateIndexSection() { - print.format(getTemplate("index")); - } - - void generateLastPage() { - print.format(getTemplate("lastpage")); - } - - void generateCustomPage(char[] name, char[][] args ...) { - switch(args.length) { - case 0: print.format(getTemplate(name)); break; - case 1: print.format(getTemplate(name), args[0]); break; - case 2: print.format(getTemplate(name), args[0], args[1]); break; - case 3: print.format(getTemplate(name), args[0], args[1], args[2]); break; - default: throw new Exception("Too many arguments"); - } - } - - //--- - - void addGraphics(char[] imageFile) { - print.format(getTemplate("graphics"), imageFile); - } - - void addListing(char[] moduleName, char[] contents, bool inline) { - print.format(getTemplate("listing"), moduleName, contents); - } - - protected: - - this(PageWriterFactory factory) { - super(factory); - - auto scan = new FileScan(); - scan(templateDir~factory.options.templates.templateStyle~"/"~format~"/", ".tpl"); - - debug Stdout(scan.files.length)(" template files loaded.\n"); - - foreach(tpl; scan.files) { - m_templates[tpl.name] = loadTemplate(tpl.toString()); - } - } - - char[] getTemplate(char[] name) { - auto tpl = name in m_templates; - assert(tpl, "Error: template ["~format~"/"~name~"] not found!"); - return *tpl; - } - - char[] loadTemplate(char[] fn) { - scope(failure) { - Stderr("Warning: error opening template "~fn~"."); - return null; - } - - auto file = new FileInput(fn); - auto content = new char[file.length]; - auto bytesRead = file.read(content); - - assert(bytesRead == file.length, "Error reading template"); - - file.close(); - - return content; - } - - char[] timeNow() { - auto n = WallClock.now; - auto c = Gregorian.generic; - auto d = c.toDate(n); - auto sprint = new Sprint!(char); - - auto culture = new Culture("en-GB"); - auto dateTimeFormat = culture.dateTimeFormat(); - - return sprint.format("{} {} {} {}", - dateTimeFormat.getAbbreviatedDayName(c.getDayOfWeek(n)), - 1,//d.day(), - //dateTimeFormat.getAbbreviatedMonthName(d.month()), - 2,//d.month(), - 3//d.year()) //FIXME: something is broken here (Error: function expected before (), not *(&d + 8u) of type uint) - ).dup; - } - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/page/writers.d --- a/src/docgen/page/writers.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.page.writers; - -public import docgen.page.writer; -import docgen.page.htmlwriter; -import docgen.page.xmlwriter; -import docgen.page.plaintextwriter; -import docgen.page.latexwriter; - -class DefaultPageWriterFactory : AbstractWriterFactory, PageWriterFactory { - this(DocGenerator generator) { - super(generator); - } - - PageWriter createPageWriter(OutputStream[] outputs, DocFormat outputFormat) { - switch (outputFormat) { - case DocFormat.LaTeX: - return new LaTeXWriter(this, outputs); - case DocFormat.XML: - return new XMLWriter(this, outputs); - case DocFormat.HTML: - return new HTMLWriter(this, outputs); - case DocFormat.PlainText: - return new PlainTextWriter(this, outputs); - default: - throw new Exception("Document writer type does not exist!"); - } - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/page/xmlwriter.d --- a/src/docgen/page/xmlwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.page.xmlwriter; - -import docgen.page.writer; -import docgen.misc.textutils; -import tango.io.FileConduit : FileConduit; - -//TODO: this is mostly broken now - -/** - * TODO - */ -class XMLWriter : AbstractPageWriter!("xml", 1) { - this(PageWriterFactory factory, OutputStream[] outputs) { - super(factory, outputs); - } - - void generateTOC(Module[] modules) { - // TODO - print.format(getTemplate("toc")); - } - - void generateModuleSection() { - // TODO - print.format(getTemplate("modules")); - } - - void generateListingSection() { - // TODO - print.format(getTemplate("listings")); - } - - void generateDepGraphSection() { - // TODO - print.format(getTemplate("dependencies")); - } - - void generateIndexSection() { } - - void generateLastPage() { } - - void generateFirstPage() { } - - void addList(char[][] contents, bool ordered) { - foreach(item; contents) { - switch(item) { - case "(": print(ordered ? "
      " : "
        "); continue; - case ")": print(ordered ? "
    " : ""); continue; - default: print("
  • ")(xml_escape(item))("
  • "); - } - } - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/sourcelisting/htmlwriter.d --- a/src/docgen/sourcelisting/htmlwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.sourcelisting.htmlwriter; - -import docgen.sourcelisting.writer; -import docgen.misc.textutils; -//import dil.Parser; -import tango.io.stream.FileStream; - - -/** - * TODO - */ -class HTMLWriter : AbstractWriter!(ListingWriterFactory), ListingWriter { - PageWriter writer; - - this(ListingWriterFactory factory, PageWriter writer) { - super(factory); - this.writer = writer; - } - - //void generateListing(Parser parser) { /* TODO */ } - - void generateListing(InputStream input, OutputStream output, char[] moduleName) { - auto inputStream = cast(FileInput)input; - auto content = new char[inputStream.length]; - auto bytesRead = inputStream.read (content); - - assert(bytesRead == inputStream.length, "Error reading source file"); - assert(output == null); - - writer.addListing( - moduleName, - xml_escape(content) - ); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/sourcelisting/latexwriter.d --- a/src/docgen/sourcelisting/latexwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.sourcelisting.latexwriter; - -import docgen.sourcelisting.writer; -//import dil.Parser; -import tango.io.FilePath; - -/** - * Adds a code listing section for the given file. - */ -class LaTeXWriter : AbstractWriter!(ListingWriterFactory), ListingWriter { - PageWriter writer; - - this(ListingWriterFactory factory, PageWriter writer) { - super(factory); - this.writer = writer; - } - - //void generateListing(Parser parser) { /* TODO */ } - - void generateListing(InputStream input, OutputStream output, char[] moduleName) { - output.copy(input); - - writer.addListing( - moduleName, - FilePath((cast(Object)output.conduit).toString()).file - ); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/sourcelisting/writer.d --- a/src/docgen/sourcelisting/writer.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.sourcelisting.writer; - -import docgen.misc.misc; -public import docgen.page.writer; -//import dil.Parser; -import tango.io.model.IConduit : OutputStream, InputStream; - -interface ListingWriter { - //void generateListing(Parser parser); - void generateListing(InputStream input, OutputStream output, char[] moduleName); -} - -interface ListingWriterFactory : WriterFactory { - ListingWriter createListingWriter(PageWriter writer, DocFormat outputFormat); -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/sourcelisting/writers.d --- a/src/docgen/sourcelisting/writers.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.sourcelisting.writers; - -public import docgen.sourcelisting.writer; -import docgen.sourcelisting.latexwriter; -import docgen.sourcelisting.htmlwriter; -import docgen.sourcelisting.xmlwriter; - -class DefaultListingWriterFactory : AbstractWriterFactory, ListingWriterFactory { - this(DocGenerator generator) { - super(generator); - } - - ListingWriter createListingWriter(PageWriter writer, DocFormat outputFormat) { - switch (outputFormat) { - case DocFormat.LaTeX: - return new LaTeXWriter(this, writer); - case DocFormat.XML: - return new XMLWriter(this, writer); - case DocFormat.HTML: - return new HTMLWriter(this, writer); - default: - throw new Exception("Listing writer type does not exist!"); - } - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/sourcelisting/xmlwriter.d --- a/src/docgen/sourcelisting/xmlwriter.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.sourcelisting.xmlwriter; - -import docgen.sourcelisting.writer; -//import dil.Parser; - -/** - * TODO - */ -class XMLWriter : AbstractWriter!(ListingWriterFactory), ListingWriter { - PageWriter writer; - - this(ListingWriterFactory factory, PageWriter writer) { - super(factory); - this.writer = writer; - } - - //void generateListing(Parser parser) { /* TODO */ } - void generateListing(InputStream input, OutputStream output, char[] moduleName) { /* TODO */ } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/README --- a/src/docgen/templates/README Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -The docgen uses the following template file names by default - -firstpage -toc -classes -modules -listings -dependencies -index -lastpage -langdef -makefile -graphics -listing diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/classes.tpl --- a/src/docgen/templates/default/html/classes.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -

    {0} Class List

    diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/dependencies.tpl --- a/src/docgen/templates/default/html/dependencies.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -

    {} Dependencies

    diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/firstpage.tpl --- a/src/docgen/templates/default/html/firstpage.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -

    {0} Documentation

    -

    {1}

    -

    © {2}

    diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/graphics.tpl --- a/src/docgen/templates/default/html/graphics.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -

    diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/listing.tpl --- a/src/docgen/templates/default/html/listing.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -

    {0} Contents

    -
    {1}
    diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/listings.tpl --- a/src/docgen/templates/default/html/listings.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -

    {0} File List

    diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/makefile.tpl --- a/src/docgen/templates/default/html/makefile.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -#!/bin/sh - -for i in *.dot; do - F=`echo $i|sed 's/dot/{0}/'` - dot $i -T{0} -o$F -done - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/modules.tpl --- a/src/docgen/templates/default/html/modules.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -

    {0} Module List

    diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/pagetemplate.tpl --- a/src/docgen/templates/default/html/pagetemplate.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - - {1} - - - - - - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/pagetemplate2.tpl --- a/src/docgen/templates/default/html/pagetemplate2.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -
    -

    Generated by {0}

    - - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/static/tab_b.gif Binary file src/docgen/templates/default/html/static/tab_b.gif has changed diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/static/tab_l.gif Binary file src/docgen/templates/default/html/static/tab_l.gif has changed diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/static/tab_r.gif Binary file src/docgen/templates/default/html/static/tab_r.gif has changed diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/static/tabs.css --- a/src/docgen/templates/default/html/static/tabs.css Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ - -DIV.tabs -{ - float : left; - width : 100%; - background : url("tab_b.gif") repeat-x bottom; - margin-bottom : 4px; -} - -DIV.tabs UL -{ - margin : 0px; - padding-left : 10px; - list-style : none; -} - -DIV.tabs LI, DIV.tabs FORM -{ - display : inline; - margin : 0px; - padding : 0px; -} - -DIV.tabs FORM -{ - float : right; -} - -DIV.tabs A -{ - float : left; - background : url("tab_r.gif") no-repeat right top; - border-bottom : 1px solid #84B0C7; - font-size : x-small; - font-weight : bold; - text-decoration : none; -} - -DIV.tabs A:hover -{ - background-position: 100% -150px; -} - -DIV.tabs A:link, DIV.tabs A:visited, -DIV.tabs A:active, DIV.tabs A:hover -{ - color: #1A419D; -} - -DIV.tabs SPAN -{ - float : left; - display : block; - background : url("tab_l.gif") no-repeat left top; - padding : 5px 9px; - white-space : nowrap; -} - -DIV.tabs INPUT -{ - float : right; - display : inline; - font-size : 1em; -} - -DIV.tabs TD -{ - font-size : x-small; - font-weight : bold; - text-decoration : none; -} - - - -/* Commented Backslash Hack hides rule from IE5-Mac \*/ -DIV.tabs SPAN {float : none;} -/* End IE5-Mac hack */ - -DIV.tabs A:hover SPAN -{ - background-position: 0% -150px; -} - -DIV.tabs LI.current A -{ - background-position: 100% -150px; - border-width : 0px; -} - -DIV.tabs LI.current SPAN -{ - background-position: 0% -150px; - padding-bottom : 6px; -} - -DIV.nav -{ - background : none; - border : none; - border-bottom : 1px solid #84B0C7; -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/stylesheet.tpl --- a/src/docgen/templates/default/html/stylesheet.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -@import "tabs.css"; - -body {{ -background: #fff; -} - -h1, h2 {{ -text-align: center; -} - -h1 {{ -font-size: 1.5em; -} - -h2#version {{ -font-size: 0.8em; -} - -h2 {{ -font-size: 1.1em; -} - -hr {{ -height: 0; -border: 0; -border-bottom: 1px solid black; -} - -#generator {{ -text-align: right; -font-size: small; -font-style: italic; -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/html/toc.tpl --- a/src/docgen/templates/default/html/toc.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - {0} Reference Manual - - - - - - -

    Table of Contents

    -
    -{0} - - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/classes.tpl --- a/src/docgen/templates/default/latex/classes.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -\chapter{{Class documentation} -\input{{classes} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/dependencies.tpl --- a/src/docgen/templates/default/latex/dependencies.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -\chapter{{Dependency diagram} -\input{{dependencies} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/firstpage.tpl --- a/src/docgen/templates/default/latex/firstpage.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -\documentclass[{0}]{{book} -\usepackage{{a4wide} -\usepackage{{makeidx} -\usepackage{{fancyhdr} -\usepackage{{graphicx} -\usepackage{{hyperref} -\usepackage{{multicol} -\usepackage{{float} -\usepackage{{textcomp} -\usepackage{{alltt} -\usepackage[utf8]{{inputenc} -\usepackage{{listings} -\lstnewenvironment{{dcode} -{{ \lstset{{language=d} } -{{} -\lstset{{ - {5} literate= - {5} {{<=}{{{{$\leq$}}1 - {5} {{>=}{{{{$\geq$}}1 - {5} {{!=}{{{{$\neq$}}1 - {5} {{...}{{{{$\dots$}}1 - {5} {{~}{{{{$\sim$}}1, - stringstyle=\ttfamily, - inputencoding=utf8, - extendedchars=false, - columns=fixed, - basicstyle=\small -} -\hypersetup{{backref,colorlinks=true} -\makeindex -\setcounter{{tocdepth}{{1} -\newcommand{{\clearemptydoublepage}{{\newpage{{\pagestyle{{empty}\cleardoublepage}} -\def\thechapter{{\Roman{{chapter}} -\def\thesection{{\arabic{{chapter}.\arabic{{section}} -% \renewcommand{{\footrulewidth}{{0.4pt} - -\begin{{document} - -\begin{{titlepage} -\vspace*{{7cm} -\begin{{center} -{{\Large {1} Reference Manual\\[1ex]\large {2} }\\ -\vspace*{{1cm} -{{\large Generated by {3} }\\ -\vspace*{{0.5cm} -{{\small {4} }\\ -\end{{center} -\end{{titlepage} - -\clearemptydoublepage diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/graphics.tpl --- a/src/docgen/templates/default/latex/graphics.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -\includegraphics[width=1\textwidth,height=1\textheight,keepaspectratio]{{{0}} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/index.tpl --- a/src/docgen/templates/default/latex/index.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -\printindex diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/lastpage.tpl --- a/src/docgen/templates/default/latex/lastpage.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -\end{{document} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/listing.tpl --- a/src/docgen/templates/default/latex/listing.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -\section{{Module {0}} -\lstinputlisting[language=d]{{{1}} -\clearpage \ No newline at end of file diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/listings.tpl --- a/src/docgen/templates/default/latex/listings.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -\chapter{{File listings} -\input{{files} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/makefile.tpl --- a/src/docgen/templates/default/latex/makefile.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#!/bin/sh - -for i in *.dot; do - F=`echo $i|sed 's/dot/{1}/'` - dot $i -T{1} -o$F -done - -pdflatex {0} -makeindex document -pdflatex {0} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/modules.tpl --- a/src/docgen/templates/default/latex/modules.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -\chapter{{Module documentation} -\input{{modules} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/static/lstlang0.sty --- a/src/docgen/templates/default/latex/static/lstlang0.sty Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -%% -%% D definition (c) 2007 Jari-Matti Mäkelä -%% -\lst@definelanguage{D}% - {morekeywords={abstract,alias,align,asm,assert,auto,body,bool,break,% - byte,case,cast,catch,cdouble,cent,cfloat,char,class,const,continue,% - creal,dchar,debug,default,delegate,delete,deprecated,do,double,% - else,enum,export,extern,false,final,finally,float,for,foreach,% - foreach_reverse,function,goto,idouble,if,ifloat,import,in,inout,% - int,interface,invariant,ireal,is,lazy,long,macro,mixin,module,new,% - null,out,override,package,pragma,private,protected,public,real,ref,% - return,scope,short,static,struct,super,switch,synchronized,template,% - this,throw,true,try,typedef,typeid,typeof,ubyte,ucent,uint,ulong,% - union,unittest,ushort,version,void,volatile,wchar,while,with},% - sensitive,% - - morecomment=[s]{/*}{*/},% - morecomment=[n]{/+}{+/},% - morecomment=[l]//,% - morestring=[b]",% - morestring=[b]`% - }[keywords,comments,strings]% diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/latex/toc.tpl --- a/src/docgen/templates/default/latex/toc.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -\tableofcontents -\thispagestyle{{empty} - -\clearemptydoublepage - -\setcounter{{page}{{1} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/classes.tpl --- a/src/docgen/templates/default/plaintext/classes.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -Class List ----------- - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/dependencies.tpl --- a/src/docgen/templates/default/plaintext/dependencies.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -Module Dependencies -------------------- - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/firstpage.tpl --- a/src/docgen/templates/default/plaintext/firstpage.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -{0} - -Version {1} - -Generated by {2} - -{3} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/graphics.tpl --- a/src/docgen/templates/default/plaintext/graphics.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -See {}. \ No newline at end of file diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/listing.tpl --- a/src/docgen/templates/default/plaintext/listing.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -Module {0} -See {1}. - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/listings.tpl --- a/src/docgen/templates/default/plaintext/listings.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -File listings -------------- - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/makefile.tpl --- a/src/docgen/templates/default/plaintext/makefile.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -#!/bin/sh - -for i in *.dot; do - F=`echo $i|sed 's/dot/{0}/'` - dot $i -T{0} -o$F -done - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/modules.tpl --- a/src/docgen/templates/default/plaintext/modules.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -Module List ------------ - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/templates/default/plaintext/toc.tpl --- a/src/docgen/templates/default/plaintext/toc.tpl Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -Table of Contents ------------------ - -1. Class documentation - -2. Module documentation - -3. File listings - -4. Dependency diagram diff -r a8b3de006554 -r 51edcd435b30 src/docgen/tests/common.d --- a/src/docgen/tests/common.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.tests.common; - -import docgen.misc.misc; -import docgen.misc.options; -import docgen.config.configurator; - -class TestDocGenerator : DocGenerator { - Configurator config; - - this() { - config = new DefaultConfigurator(); - } - - public void generate() { - - } - - public DocGeneratorOptions *options() { - return config.getConfiguration(); - } -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/tests/doctemplate.d --- a/src/docgen/tests/doctemplate.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.tests.doctemplate; - -import docgen.tests.common; -import docgen.page.writers; -import tango.io.FileConduit; - -// doc template -//@unittest -void doctemplate1() { - auto gen = new TestDocGenerator; - auto fname = "doctemplate.tex"; - - auto gwf = new DefaultPageWriterFactory(gen); - auto file = new FileConduit("docgen/teststuff/" ~ fname, FileConduit.WriteCreate); - auto writer = gwf.createPageWriter( [ file ], DocFormat.LaTeX ); - - writer.generateFirstPage(); - writer.generateTOC(null); - writer.generateModuleSection(null); - writer.generateListingSection(null); - writer.generateDepGraphSection(); - writer.generateIndexSection(); - writer.generateLastPage(); - - file.close(); -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/tests/graphs.d --- a/src/docgen/tests/graphs.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.tests.graphs; - -import docgen.tests.common; -import docgen.misc.parser; -import docgen.graphutils.writers; -import docgen.page.writers; -import tango.io.FileConduit; -import dil.semantic.Module; - -alias DepGraph.Edge Edge; -alias DepGraph.Vertex Vertex; - -void saveDefaultGraph(DepGraph depGraph, char[] fname) { - auto gen = new TestDocGenerator; - gen.options.graph.highlightCyclicVertices = true; - gen.options.graph.imageFormat = ImageFormat.SVG; - //gen.options.graph.graphFormat = GraphFormat.ModuleNames; - //gen.options.graph.graphFormat = GraphFormat.ModulePaths; - gen.options.graph.depth = 5; - auto ddf = new DefaultPageWriterFactory(gen); - auto gwf = new DefaultGraphWriterFactory(gen); - auto file = new FileConduit("docgen/teststuff/" ~ fname, FileConduit.WriteCreate); - auto file2 = new FileConduit("docgen/teststuff/" ~ fname ~ "-2", FileConduit.WriteCreate); - - auto writer = gwf.createGraphWriter( - ddf.createPageWriter( [ file2 ], DocFormat.LaTeX), - GraphFormat.Dot - ); - - writer.generateDepGraph(depGraph, file); - - file.close(); - file2.close(); -} - -// no edges -//@unittest -void graph1() { - auto g = new DepGraph; - g.add(new Vertex("mod_a", "path.to.mod_a", 1)); - g.add(new Vertex("mod_b", "path.to.mod_b", 2)); - g.add(new Vertex("mod_c", "path.to.mod_c", 3)); - - saveDefaultGraph(g, "graph1.dot"); -} - - -// simple tree structure -//@unittest -void graph2() { - auto g = new DepGraph; - g.add(new Vertex("mod_a", "path.to.mod_a", 1)); - g.add(new Vertex("mod_b", "path.to.mod_b", 2)); - g.add(new Vertex("mod_c", "path.to.mod_c", 3)); - g.add(new Vertex("mod_d", "path.to.mod_d", 4)); - - g.connect(1, 0); - g.connect(2, 0); - g.connect(3, 2); - - saveDefaultGraph(g, "graph2.dot"); -} - -// circular imports -//@unittest -void graph3() { - auto g = new DepGraph; - g.add(new Vertex("mod_a", "path.to.mod_a", 1)); - g.add(new Vertex("mod_b", "path.to.mod_b", 2)); - g.add(new Vertex("mod_c", "path.to.mod_c", 3)); - g.add(new Vertex("mod_d", "path.to.mod_d", 4)); - - g.connect(1, 0); - g.connect(2, 1); - g.connect(0, 2); - - saveDefaultGraph(g, "graph3.dot"); -} - -// more complex graph -//@unittest -void graph4() { - auto g = new DepGraph; - g.add(new Vertex("mod_a", "path.to.mod_a", 1)); - g.add(new Vertex("mod_b", "path.to.mod_b", 2)); - g.add(new Vertex("mod_c", "path.to.mod_c", 3)); - g.add(new Vertex("mod_d", "path.to.mod_d", 4)); - g.add(new Vertex("mod_e", "path.to.mod_e", 5)); - g.add(new Vertex("mod_f", "path.to.mod_f", 6)); - g.add(new Vertex("mod_g", "path.to.mod_g", 7)); - - g.connect(1, 0); - g.connect(2, 1); - g.connect(0, 2); - g.connect(0, 3); - g.connect(0, 4); - g.connect(3, 1); - g.connect(4, 1); - g.connect(0, 6); - g.connect(5, 1); - g.connect(5, 6); - g.connect(6, 0); - - saveDefaultGraph(g, "graph4.dot"); -} - - -// parses the test modules and creates a dep graph -//@unittest -void graph5() { - auto gen = new TestDocGenerator; - gen.options.graph.highlightCyclicVertices = true; - gen.options.graph.imageFormat = ImageFormat.PDF; - gen.options.outputFormats = [ DocFormat.LaTeX ]; - auto fname = "dependencies.tex"; - auto imgFname = "depgraph.dot"; - - auto ddf = new DefaultPageWriterFactory(gen); - auto gwf = new DefaultGraphWriterFactory(gen); - auto file = new FileConduit("docgen/teststuff/" ~ fname, FileConduit.WriteCreate); - auto imgFile = new FileConduit("docgen/teststuff/" ~ imgFname, FileConduit.WriteCreate); - - Module[] modules; - Edge[] edges; - Vertex[char[]] vertices; - int id = 1; - - Parser.loadModules( - [ "c" ], [ "docgen/teststuff/" ], - null, true, -1, - (char[] fqn, char[] path, Module m) { - vertices[m.moduleFQN] = new DepGraph.Vertex(m.moduleFQN, m.filePath, id++); - }, - (Module imported, Module importer, bool isPublic, bool isStatic) { - auto edge = vertices[imported.moduleFQN].addChild(vertices[importer.moduleFQN]); - edge.isPublic = isPublic; - edge.isStatic = isStatic; - edges ~= edge; - }, - modules - ); - - auto writer = gwf.createGraphWriter( - ddf.createPageWriter( [ file ], DocFormat.LaTeX ), - GraphFormat.Dot - ); - - auto graph = new DepGraph; - graph.edges = edges; - graph.vertices = vertices.values; - - writer.generateDepGraph(graph, imgFile); - - file.close(); - imgFile.close(); -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/tests/listing.d --- a/src/docgen/tests/listing.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.tests.listing; - -import docgen.misc.parser; -import docgen.tests.common; -import docgen.sourcelisting.writers; -import docgen.page.writers; -import tango.io.FileConduit; -import tango.text.Util; - -// doc template -//@unittest -void listing1() { - auto gen = new TestDocGenerator; - gen.options.outputFormats = [ DocFormat.LaTeX ]; - auto fname = "files.tex"; - - auto ddf = new DefaultPageWriterFactory(gen); - auto dlwf = new DefaultListingWriterFactory(gen); - auto file = new FileConduit("docgen/teststuff/" ~ fname, FileConduit.WriteCreate); - - - Module[] modules; - - Parser.loadModules( - [ "c" ], [ "docgen/teststuff/" ], - null, true, -1, - (char[] fqn, char[] path, Module m) {}, - (Module imported, Module importer, bool isPublic, bool isStatic) {}, - modules - ); - - foreach(mod; modules) { - auto dstFname = replace(mod.moduleFQN.dup, '.', '_'); - - auto srcFile = new FileConduit(mod.filePath); - auto dstFile = new FileConduit("docgen/teststuff/_" ~ dstFname ~ ".d", FileConduit.WriteCreate); - auto writer = dlwf.createListingWriter( ddf.createPageWriter( [ file ], - DocFormat.LaTeX ), DocFormat.LaTeX ); - - writer.generateListing(srcFile, dstFile, mod.moduleFQN); - - srcFile.close(); - dstFile.close(); - } - - file.close(); -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/tests/parse.d --- a/src/docgen/tests/parse.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.tests.parse; - -import docgen.misc.parser; -import tango.io.FileConduit; -import tango.io.Print: Print; -import tango.text.convert.Layout : Layout; - -void saveToFile(char[] fname, void delegate(Print!(char) file) foo) { - auto file = new FileConduit("docgen/teststuff/" ~ fname, FileConduit.WriteCreate); - auto output = new Print!(char)(new Layout!(char), file); - - foo(output); - - file.close(); -} - -// load some test files -//@unittest -void parse1() { - saveToFile("parse1.txt", (Print!(char) file){ - Module[] modules; - - Parser.loadModules( - [ "c" ], [ "docgen/teststuff/" ], - null, true, -1, - (char[] fqn, char[] path, Module m) { - file.format("{0} = {1}\n", fqn, path); - }, - (Module imported, Module importer, bool isPublic, bool isStatic) { - file.format("{0} <- {1}\n", - imported ? imported.moduleFQN : "null"[], - importer ? importer.moduleFQN : "null"[] - ); - }, - modules - ); - }); -} - -// load the imports of dil -//@unittest -void parse2() { - saveToFile("parse2.txt", (Print!(char) file){ - Module[] modules; - - Parser.loadModules( - [ "docgen/testsuite" ], [".", "/home/jm/d/tango/"], - null, true, -1, - (char[] fqn, char[] path, Module m) { - file.format("{0} = {1}\n", fqn, path); - }, - (Module imported, Module importer, bool isPublic, bool isStatic) { - file.format("{0} <- {1}\n", - imported ? imported.moduleFQN : "null"[], - importer ? importer.moduleFQN : "null"[] - ); - }, - modules - ); - }); -} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/teststuff/a.d --- a/src/docgen/teststuff/a.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module a; - -void foo() {} -void bar() {} diff -r a8b3de006554 -r 51edcd435b30 src/docgen/teststuff/b.d --- a/src/docgen/teststuff/b.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module b; - -import a; - diff -r a8b3de006554 -r 51edcd435b30 src/docgen/teststuff/c.d --- a/src/docgen/teststuff/c.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module c; - -import a; -import b; diff -r a8b3de006554 -r 51edcd435b30 src/docgen/teststuff/clean.sh --- a/src/docgen/teststuff/clean.sh Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -rm _* -rm dep* -rm doc* -rm *.tex -rm graph* -rm parse* -touch modules.tex diff -r a8b3de006554 -r 51edcd435b30 src/docgen/teststuff/lstlang0.sty --- a/src/docgen/teststuff/lstlang0.sty Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -%% -%% D definition (c) 2007 Jari-Matti Mäkelä -%% -\lst@definelanguage{D}% - {morekeywords={abstract,alias,align,asm,assert,auto,body,bool,break,% - byte,case,cast,catch,cdouble,cent,cfloat,char,class,const,continue,% - creal,dchar,debug,default,delegate,delete,deprecated,do,double,% - else,enum,export,extern,false,final,finally,float,for,foreach,% - foreach_reverse,function,goto,idouble,if,ifloat,import,in,inout,% - int,interface,invariant,ireal,is,lazy,long,macro,mixin,module,new,% - null,out,override,package,pragma,private,protected,public,real,ref,% - return,scope,short,static,struct,super,switch,synchronized,template,% - this,throw,true,try,typedef,typeid,typeof,ubyte,ucent,uint,ulong,% - union,unittest,ushort,version,void,volatile,wchar,while,with},% - sensitive,% - morecomment=[s]{/*}{*/},% - morecomment=[n]{/+}{+/},% - morecomment=[l]//,% - morestring=[b]",% - morestring=[b]`% - }[keywords,comments,strings]% \ No newline at end of file diff -r a8b3de006554 -r 51edcd435b30 src/docgen/teststuff/modules.tex diff -r a8b3de006554 -r 51edcd435b30 src/docgen/testsuite.d --- a/src/docgen/testsuite.d Mon Mar 24 19:00:58 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/** - * Author: Jari-Matti Mäkelä - * License: GPL3 - */ -module docgen.testsuite; - -import docgen.tests.graphs; -import docgen.tests.parse; -import docgen.tests.doctemplate; -import docgen.tests.listing; -//import docgen.tests.sexp; -import tango.io.Stdout; - -/** - * A temporary test program for the docgen package. - * I'll replace this with proper unittests in the future. - * - */ -void main() { - Stdout("Running..\n")(); - - Stdout(" Test1\n")(); - graph1(); - Stdout(" Test2\n")(); - graph2(); - Stdout(" Test3\n")(); - graph3(); - Stdout(" Test4\n")(); - graph4(); - Stdout(" Test5\n")(); - graph5(); - Stdout(" Test6\n")(); - parse1(); - Stdout(" Test7\n")(); - parse2(); - Stdout(" Test8\n")(); - doctemplate1(); - Stdout(" Test9\n")(); - listing1(); -// loadConfig(); - Stdout("done.\n")(); -}