diff trunk/src/cmd/DDoc.d @ 744:7173ece1b696

Wrapped some macro functions inside struct MacroExpander. Warning messages from the macro expansion pass are collected now. Tidied up predefined.ddoc a bit, and added some macros. Added two messages to struct MSG. Added another opCatAssign to class InfoManager.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 09 Feb 2008 22:54:31 +0100
parents 764f660e3909
children 00f872d949ea
line wrap: on
line diff
--- a/trunk/src/cmd/DDoc.d	Sat Feb 09 19:27:14 2008 +0100
+++ b/trunk/src/cmd/DDoc.d	Sat Feb 09 22:54:31 2008 +0100
@@ -61,13 +61,20 @@
     // Generate documentation.
     auto dest = new FilePath(destDir);
     dest.append(mod.getFQN() ~ ".html");
+    InfoManager infoMan2; // Collects warnings from the macro expander.
     if (verbose)
+    {
       Stdout.formatln("{} > {}", mod.filePath, dest);
-    writeDocFile(dest.toString(), mod, mtable, incUndoc);
+      infoMan2 = new InfoManager();
+    }
+    writeDocFile(dest.toString(), mod, mtable, incUndoc, infoMan2);
+    if (infoMan2)
+      infoMan ~= infoMan2.info;
   }
 }
 
-void writeDocFile(string dest, Module mod, MacroTable mtable, bool incUndoc)
+void writeDocFile(string dest, Module mod, MacroTable mtable, bool incUndoc,
+                  InfoManager infoMan)
 {
   // Create a macro environment for this module.
   mtable = new MacroTable(mtable);
@@ -87,7 +94,7 @@
   // Set BODY macro to the text produced by the DDocEmitter.
   mtable.insert("BODY", doc.text);
   // Do the macro expansion pass.
-  auto fileText = expandMacros(mtable, "$(DDOC)");
+  auto fileText = MacroExpander.expand(mtable, "$(DDOC)", mod.filePath, infoMan);
   // Finally write the file out to the harddisk.
   auto file = new File(dest);
   file.write(fileText);