diff trunk/src/main.d @ 391:33b566df6af4

Migrated project to Tango. Decremented the numbers of the format placeholders in the localized messages by one. Replaced all instances of writef/ln with Stdout. Added module common.d with string aliases and a global Layout!(char) instance. Replaced %s format specifiers with index placeholders in html/xml_tags. Changed member Information.arguments to string message. Copied std.metastring, std.uni and std.utf from Phobos.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 15 Sep 2007 17:12:26 +0200
parents 0bd21b746a04
children bb935c6f9b7a
line wrap: on
line diff
--- a/trunk/src/main.d	Wed Sep 12 21:03:41 2007 +0200
+++ b/trunk/src/main.d	Sat Sep 15 17:12:26 2007 +0200
@@ -13,14 +13,16 @@
 import cmd.Generate;
 import cmd.Statistics;
 import cmd.ImportGraph;
-import std.stdio, std.conv;
+import common;
+
+import Integer = tango.text.convert.Integer;
 
 void main(char[][] args)
 {
   GlobalSettings.load();
 
   if (args.length <= 1)
-    return writefln(helpMain());
+    return Stdout(helpMain()).newline;
 
   string command = args[1];
   switch (command)
@@ -59,7 +61,7 @@
       else if(strbeg(arg, "-r"))
         regexps ~= arg[2..$];
       else if(strbeg(arg, "-l"))
-        levels = toUint(arg[2..$]);
+        levels = Integer.parse (arg[2..$]);
       else
         switch (arg)
         {
@@ -96,7 +98,7 @@
     if (args.length == 3)
       printHelp(args[2]);
     else
-      writefln(helpMain());
+      Stdout(helpMain());
     break;
   default:
   }
@@ -120,7 +122,7 @@
 
 char[] helpMain()
 {
-  return format(MID.HelpMain, VERSION, COMMANDS, COMPILED_WITH, COMPILED_VERSION, COMPILED_DATE);
+  return FormatMsg(MID.HelpMain, VERSION, COMMANDS, COMPILED_WITH, COMPILED_VERSION, COMPILED_DATE);
 }
 
 void printHelp(char[] command)
@@ -137,7 +139,7 @@
   default:
     msg = helpMain();
   }
-  writefln(msg);
+  Stdout(msg).newline;
 }
 
 void parse(string fileName)
@@ -158,6 +160,6 @@
 print(root.children, "");
 foreach (error; parser.errors)
 {
-  writefln(`%s(%d)P: %s`, parser.lx.fileName, error.loc, error.getMsg);
+  Stdout.format(`{0}({1})P: {2}`, parser.lx.fileName, error.loc, error.getMsg);
 }
 }