Changeset 49

Show
Ignore:
Timestamp:
09/20/06 14:33:39 (5 years ago)
Author:
Derek Parnell
Message:

Upload version 3.03 (Build #2371)
modified trunk/Docs/autobuild.html
modified trunk/Docs/change_log.html
modified trunk/Docs/command_line.html
modified trunk/Docs/configuration_file.html
modified trunk/Docs/dlls.html
modified trunk/Docs/introduction.html
modified trunk/Docs/macros.html
modified trunk/Docs/pragmas.html
modified trunk/Docs/profile_file.html
modified trunk/Docs/response_file.html
modified trunk/Docs/rules.html
modified trunk/Docs/switches.html
modified trunk/Docs/todo.html
modified trunk/Docs/User_Manual.html
modified trunk/Source/build.d
modified trunk/Source/build_bn.d
modified trunk/Source/docsrc/change_log.d
modified trunk/Source/docsrc/configuration_file.d
modified trunk/Source/docsrc/User_Manual.d
modified trunk/Source/docsrc/user_manual.ddoc
modified trunk/Source/example_build.cfg
modified trunk/Source/source.d
modified trunk/Source/source_bn.d
modified trunk/Source/util/booltype.d
modified trunk/Source/util/fdt.d
modified trunk/Source/util/fdt_bn.d
modified trunk/Source/util/file2.d
modified trunk/Source/util/file2_bn.d
modified trunk/Source/util/fileex.d
modified trunk/Source/util/fileex_bn.d
modified trunk/Source/util/linetoken.d
modified trunk/Source/util/linetoken_bn.d
modified trunk/Source/util/macro.d
modified trunk/Source/util/pathex.d
modified trunk/Source/util/pathex_bn.d
modified trunk/Source/util/str.d
modified trunk/Source/util/str_bn.d
added downloads/bud_win_3.03.dbg.exe
added downloads/bud_win_3.03.exe
added downloads/build-3.03.doc.zip
added downloads/build-3.03.src.zip
added trunk/Docs/booltype.html
added trunk/Source/nix_dmd_build.cfg
added trunk/Source/nix_gnu_build.cfg
added trunk/Source/util/booltypemac.ddoc
added trunk/Source/win_dmd_build.cfg
added trunk/Source/win_gnu_build.cfg

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Docs/User_Manual.html

    r48 r49  
    111111<div class="section"><h2 class="section"><a name="authors">Authors:<span class="secdef">Derek Parnell - Melbourne</span></a></h2></div> 
    112112<div class="section"><h2 class="section"><a name="create">Initial Creation:<span class="secdef">January 2005</span></a></h2></div> 
    113 <div class="section"><h2 class="section"><a name="version">Version:<span class="secdef">3.02</span></a></h2></div> 
    114 <div class="section"><h2 class="section"><a name="date">Date:<span class="secdef">23 June 2006</span></a></h2></div> 
     113<div class="section"><h2 class="section"><a name="version">Version:<span class="secdef">3.03</span></a></h2></div> 
     114<div class="section"><h2 class="section"><a name="date">Date:<span class="secdef">20 September 2006</span></a></h2></div> 
    115115<div class="section"><h2 class="section"><a name="license">License:</a></h2> 
    116116<pre class="cite">This software is provided 'as-is', without any express or implied 
     
    139139 
    140140 
    141                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     141                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    142142 </span></div> 
    143143                 </body> 
  • trunk/Docs/autobuild.html

    r48 r49  
    6666 
    6767 
    68                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     68                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    6969 </span></div> 
    7070                 </body> 
  • trunk/Docs/change_log.html

    r48 r49  
    1010 
    1111 
    12 <p class="page_title">Build Utility <span class="page_title">&copy; 2006, Derek Parnell, Melbourne</span> 
     12<p class="page_title">bud Utility <span class="page_title">&copy; 2006, Derek Parnell, Melbourne</span> 
    1313                 <br> <a href="User_Manual.html#toc"><span class="tocref">(table of contents)</span></a></p> 
    1414                 <h1 class="topic"><a name="change_log">Topic: Change Log</a></h1> 
    1515<div class="section">A list of changes and fixes that have been made. 
    1616 
     17<h3 class="subsection"><a name="">v3.03 -- 20/September/2006 </a></h3> 
     18<div class="list"><ul>    <li class="item">** <b>FIX: Ticket #33</b> For unix editions, 'pthread' is 
     19    now a default library, '-g' is used instead of '/co' to generate 
     20    debug data, '-o ' is used instead of '-of', and spaces are placed 
     21    in between consecutive '-L' switches.  Note that if you want to place 
     22    library files on the command line, you still have to include the '.a' 
     23    file suffix. 
     24     
     25    <li class="item">** <b>FIX: Ticket #34</b> For GNU, 'gdc' is the default 
     26    linker, the library switch is now '-L-l', 'gphobos' is used instead of 
     27    'phobos', and the makefile includes the '-version=BuildVerbose' switch. 
     28     
     29    <li class="item">** <b>FIX: Ticket #35</b> It is now possible to use relative 
     30    paths on the command line files. 
     31     
     32    <li class="item">** <b>FIX</b> If you use the '-od' switch then the '-op' switch 
     33    is not used. 
     34     
     35    <li class="item">** <b>CHG: Ticket #36</b> The default name for the executable is 
     36     now 'bud', but you can change it to anything you like. 
     37     
     38    <li class="item">** <b>CHG: Ticket #37</b> Changed defaults to support GDC 
     39     out-of-the-box. 
     40     
     41    <li class="item">** <b>ENH</b> The utility now also checks for a '[darwin]' 
     42    section in the Configuration File. 
     43     
     44    <li class="item">** <b>ENH</b> The utility now supports the import syntax that 
     45    was introduced with DMD v0.163. 
     46     
     47    <li class="item">** <b>ENH</b> The distribution now includes example configuration 
     48    files for a number of environments. 
     49     
     50    <li class="item">** <b>ENH</b> The Configuration File now supports a new <i>FINAL</i> 
     51    command that allows you to run jobs after a successful build. 
     52     
     53</ul></div> 
     54 
    1755<h3 class="subsection"><a name="">v3.02 -- 23/June/2006 </a></h3> 
    1856<div class="list"><ul>    <li class="item">** <b>FIX: Ticket #27</b> When using 'gcc' as the linker tool, 
    19     <i>Build</i> now uses a space character to delimit file names. 
     57    <i><b>the utility</b></i> now uses a space character to delimit file names. 
    2058     
    2159    <li class="item">** <b>FIX: Ticket #28</b> The Optlink switch options  are now 
     
    5997    <li class="item">** <b>ENH:</b> The 'Rules' functionality now ensures that the 
    6098    output file's path exists prior to running the Rule's tool application. 
    61     <li class="item">** <b>ENH:</b> The LINKCMD is now able to be used in the Build 
     99    <li class="item">** <b>ENH:</b> The LINKCMD is now able to be used in the <i><b>utility</b></i> 
    62100    configuration file. 
    63101    <li class="item">** <b>ENH:</b> A new switch "-uses" will cause the tool to 
     
    68106 
    69107<h3 class="subsection"><a name="">v3.00 -- 05/June/2006 </a></h3> 
    70 <div class="list"><ul>    <li class="item">** <b>FIX:</b> <i>Build</i> was using the wrong object file during 
     108<div class="list"><ul>    <li class="item">** <b>FIX:</b> <i><b>the utility</b></i> was using the wrong object file during 
    71109    linkages if a target object file did not exist but one with the same name 
    72110    existed in any of the Import paths. 
    73111     
    74112    <li class="item">** <b>FIX:</b> With the <i>-R=No</i> switch, when using the Digital 
    75      Mars linker, <i>Build</i> was not formatting the command line correctly. 
     113     Mars linker, <i><b>the utility</b></i> was not formatting the command line correctly. 
    76114     
    77115    <li class="item">** <b>FIX: Ticket #10 </b> The tool now recognises the 
     
    116154    in the following areas... 
    117155      <div class="list"><ul>        <li class="item">If defined, the directory defined by the <i>ConfigPath</i> 
    118         configuration item in <i>Build's</i> configuration file. And in this 
     156        configuration item in <i>the utility's</i> configuration file. And in this 
    119157        case it doesn't look anywhere in any of the areas listed below. 
    120158        <li class="item">The current directory. 
     
    124162        <li class="item">The same directory in which the compiler resides. 
    125163        <li class="item">The directory defined by the <i>EtcPath</i> configuration item 
    126         in <i>Build's</i> configuration file. 
     164        in <i>the utility's</i> configuration file. 
    127165        </ul></div> 
    128166     
     
    169207     
    170208 
    171     <li class="item">** <b>CHG: </b> When building the <i>Build</i> application itself, 
     209    <li class="item">** <b>CHG: </b> When building the <i><b>the utility</b></i> application itself, 
    172210    you must now add <b>-version=BuildVerbose</b> to the command line if 
    173     you want an edition of <i>Build</i> that supports the <b>-V</b> (verbose) switch. As 
    174     shipped, the pre-built editions of <i>Build</i> do not support 
     211    you want an edition of <i><b>the utility</b></i> that supports the <b>-V</b> (verbose) switch. As 
     212    shipped, the pre-built editions of <i><b>the utility</b></i> do not support 
    175213    the <b>-V</b> switch. 
    176214     
     
    217255    <li class="item">** <b>FIX:</b> <i>Thanks to Carlos</i>: In Unix environments, any "-version" 
    218256    switch on the Utility's command line was not being converted to the correct Unix 
    219     format of "-fversion...". So now, if the Build tool gets 
     257    format of "-fversion...". So now, if the utility gets 
    220258    either "-version..." or "-fversion=..." on its command line, it will 
    221259    recognise it as a 'Version' request for the compiler <b>and</b> output 
     
    365403 
    366404<h3 class="subsection"><a name="">v2.00 -- 08/Apr/2005</a></h3> 
    367 <div class="list"><ul><li class="item">** <b>FIX</b>: Now supports the raw-string delimiter ` in Build's own 
     405<div class="list"><ul><li class="item">** <b>FIX</b>: Now supports the raw-string delimiter ` in the utility's own 
    368406pragma commands. 
    369407 
    370 <li class="item">** <b>FIX</b>: Now handles backslash escapes in Build's own 
     408<li class="item">** <b>FIX</b>: Now handles backslash escapes in the utility's own 
    371409pragma commands. 
    372410 
     
    616654</div> 
    617655 
    618                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     656                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    619657 </span></div> 
    620658                 </body> 
  • trunk/Docs/command_line.html

    r48 r49  
    128128 
    129129 
    130                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     130                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    131131 </span></div> 
    132132                 </body> 
  • trunk/Docs/configuration_file.html

    r48 r49  
    5353when using the DMD linker. 
    5454<pre class="code">LINKSWITCH=/info 
     55</pre> 
     56 
     57<b>FINAL</b> <br> 
     58This specifies a command that will run after the target has been 
     59successfully created. There can be any number of <i>FINAL</i> commands 
     60in a configuration file; they are all executed, and in the order presented. 
     61<br/>&nbsp;<br/> 
     62You can place special tokens in the <i>FINAL</i> command line and these will 
     63be replaced just before running the command line. 
     64<table class="conftab">  <thead class="confthead">     <td class="thcell">Token&nbsp;</td> <td class="thcell">Replacement&nbsp;</td> 
     65   </thead> 
     66   <tr class="confrow">    <td class="cell"><b>{Target}</b>&nbsp;</td> <td class="cell">The full path and name of the target file created&nbsp;</td> 
     67    </tr> 
     68   <tr class="confrow">    <td class="cell"><b>{TargetPath}</b>&nbsp;</td> <td class="cell">The path of the target file created&nbsp;</td> 
     69    </tr> 
     70   <tr class="confrow">    <td class="cell"><b>{TargetBase}</b>&nbsp;</td> <td class="cell">The name of the target file created&nbsp;</td> 
     71    </tr> 
     72</table> 
     73<pre class="code">FINAL="c:\program files\upx202w\upx" --best -q {Target} &gt;nul 
    5574</pre> 
    5675 
     
    346365        # items that only apply when building in Posix (unix). 
    347366 
     367        [darwin] 
     368        # items that only apply when building in Macintosh Darwin (OS X). 
     369 
    348370        [DigitalMars] 
    349371        # items that only apply when building with DigitalMars tools. 
     
    374396Blank lines are ignored. 
    375397 
    376 <p><span class="example"><i>Example:</i> </span></p><pre class="code">build myapp.d +final 
    377 </pre> 
    378 where if a group called '[final]' is contained in any configuration 
     398<p><span class="example"><i>Example:</i> </span></p><pre class="code">build myapp.d +production 
     399</pre> 
     400where if a group called '[production]' is contained in any configuration 
    379401file, the options in that group are used. 
    380402 
    381 <p><span class="example"><i>Example:</i> contents of [final]</span></p><pre class="code">    # This creates a production (release) edition of the app. 
    382     [final
     403<p><span class="example"><i>Example:</i> contents of [production]</span></p><pre class="code">    # This creates a production (release) edition of the app. 
     404    [production
    383405    CMDLINE=-T{Target}_{Group}  # Set the name of the executable. 
    384406    CMDLINE=-release   # Don't generate runtime checks. 
     
    398420 
    399421 
    400                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     422                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    401423 </span></div> 
    402424                 </body> 
  • trunk/Docs/dlls.html

    r48 r49  
    3636 
    3737 
    38                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     38                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    3939 </span></div> 
    4040                 </body> 
  • trunk/Docs/introduction.html

    r48 r49  
    2828 
    2929 
    30                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     30                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    3131 </span></div> 
    3232                 </body> 
  • trunk/Docs/macros.html

    r48 r49  
    151151 
    152152 
    153                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     153                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    154154 </span></div> 
    155155                 </body> 
  • trunk/Docs/pragmas.html

    r48 r49  
    243243 
    244244 
    245                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     245                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    246246 </span></div> 
    247247                 </body> 
  • trunk/Docs/profile_file.html

    r48 r49  
    100100 
    101101 
    102                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     102                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    103103 </span></div> 
    104104                 </body> 
  • trunk/Docs/response_file.html

    r48 r49  
    5050 
    5151 
    52                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     52                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    5353 </span></div> 
    5454                 </body> 
  • trunk/Docs/rules.html

    r48 r49  
    9898 
    9999 
    100                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     100                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    101101 </span></div> 
    102102                 </body> 
  • trunk/Docs/switches.html

    r48 r49  
    497497 
    498498 
    499                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     499                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    500500 </span></div> 
    501501                 </body> 
  • trunk/Docs/todo.html

    r48 r49  
    3939 
    4040 
    41                  <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27 2006 
     41                 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 
    4242 </span></div> 
    4343                 </body> 
  • trunk/Source/build.d

    r48 r49  
    66 Authors: Derek Parnell, Melbourne 
    77 Initial Creation: January 2005 
    8  Version: 3.02 
    9  Date: August 2005 
     8 Version: 3.03 
     9 Date: September 2006 
    1010 License: 
    1111        This software is provided 'as-is', without any express or implied 
     
    4040    version(Windows) { 
    4141        // OptLink Definition File 
    42         pragma (build_def, "VERSION 3.02"); 
     42        pragma (build_def, "VERSION 3.03"); 
    4343    } 
    4444} 
     
    4747private{ 
    4848    // --------- imports ---------------- 
    49     import source;          // Source File class 
    50  
    51     import util.str;        // non-standard string routines. 
    52     import util.fdt;        // File Date-Time class 
    53     import util.pathex;     // Extended Path routines. 
    54     import util.fileex;     // Extended File routines. 
    55     import util.macro;      // Macro processing routines. 
    56     import util.booltype;   // definition of True and False 
    57  
    58     import std.c.stdio; 
    59  
    60     import std.file; 
    61     import std.outbuffer; 
    62     import std.path; 
    63     import std.stdio; 
    64     import std.stream; 
    65     import std.string; 
     49    static import source;          // Source File class 
     50 
     51    static import util.str;        // non-standard string routines. 
     52    static import util.fdt;        // File Date-Time class 
     53    static import util.pathex;     // Extended Path routines. 
     54    static import util.fileex;     // Extended File routines. 
     55    static import util.macro;      // Macro processing routines. 
     56    static import util.booltype;   // definition of True and False 
     57    alias util.booltype.True True; 
     58    alias util.booltype.False False; 
     59    alias util.booltype.Bool Bool; 
     60 
     61    static import std.c.stdio; 
     62    static import std.file; 
     63    static import std.outbuffer; 
     64    static import std.path; 
     65    static import std.stdio; 
     66    static import std.stream; 
     67    static import std.string; 
    6668 
    6769    version(Windows) 
    6870    { 
    69         import std.c.windows.windows; 
     71        static import std.c.windows.windows; 
    7072    } 
    7173 
    7274    version(linux) 
    7375    { 
    74         import std.c.linux.linux; 
     76        static import std.c.linux.linux; 
    7577    } 
    7678 
    7779    version(darwin) 
    7880    { 
    79         import std.c.darwin.darwin; 
     81        static import std.c.darwin.darwin; 
    8082    } 
    8183 
     
    139141            char[] vHomePathId = "HOME"; 
    140142            char[] vEtcPath    = ""; 
     143            char[] vSymInfoSwitch = "/co"; 
     144            char[] vOutFileSwitch = "-of"; 
    141145        } 
    142146 
     
    160164            char[] vHomePathId = "HOME"; 
    161165            char[] vEtcPath    = "/etc/"; 
     166            char[] vSymInfoSwitch = "-g"; 
     167            char[] vOutFileSwitch = "-o "; 
    162168        } 
    163169 
     
    165171        char[]     vDebugSwitch = "-debug"; 
    166172        char[][]   vCompilerDefs; 
    167         char[]     vOutFileSwitch = "-of"; 
    168173        char[]     vImportPath = "-I"; 
    169174        bool       vUseModBaseName = false; 
    170         char[]     vLinkLibSwitch = "-l"; 
    171         char[]     vSymInfoSwitch = "/co"; 
     175        char[]     vLinkLibSwitch = ""; 
    172176    } 
    173177 
     
    198202            char[] vCompilerExe=`gdc`; 
    199203            char[] vCompileOnly= `-c`; 
    200             char[] vLinkerExe=`gdmd`; 
     204            char[] vLinkerExe=`gdc`; 
    201205            bool   vPostSwitches = false; 
    202206            bool   vAppendLinkSwitches = false; 
     
    212216            char[] vLibrarian = `ar`; 
    213217            char[] vLibrarianOpts = `-r`; 
    214             char[] vLinkLibSwitch = "-l-L"; 
     218            char[] vLinkLibSwitch = "-l"; 
    215219            char[] vHomePathId = "HOME"; 
    216220            char[] vEtcPath    = "/etc/"; 
     
    218222        char[]     vVersionSwitch = "-fversion"; 
    219223        char[]     vDebugSwitch = "-fdebug"; 
    220         char[]     vOutFileSwitch = "-o "; 
     224        char[]     vOutFileSwitch = "-of "; 
    221225        char[][]   vCompilerDefs; 
    222226        char[]     vImportPath = "-I "; 
    223         char[]     vSymInfoSwitch = "/co"; 
     227        char[]     vSymInfoSwitch = "-g"; 
    224228        /* GDC places object files in the directory from which it is called */ 
    225229        bool       vUseModBaseName = true; 
     
    248252    char[]       vModOutDelim  = ""; 
    249253    char[]       vModOutFile   = "_modules.ddoc"; 
     254 
     255    char[][]     vFinalProc; 
    250256 
    251257    Bool         vTestRun; 
     
    279285    char[]       vAppPath; 
    280286    char[]       vAppName; 
    281     char[]       vAppVersion = "3.02"; 
     287    char[]       vAppVersion = "3.03"; 
    282288    char[]       vTargetName;           // Output name from first file name. 
    283289    char[]       vPragmaTargetName;     // Output name from pragma. 
     
    335341 
    336342    version(Windows) { 
    337         vWinVerNum = cast(ubyte)(GetVersion() & 0xFF); 
     343        vWinVerNum = cast(ubyte)(std.c.windows.windows.GetVersion() & 0xFF); 
    338344        vWinVer = std.string.format("%d.0", vWinVerNum); 
    339345     } 
     
    345351    util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 
    346352 
    347     Source.UseModBaseName(vUseModBaseName); 
     353    source.Source.UseModBaseName(vUseModBaseName); 
    348354 
    349355} 
     
    354360{ 
    355361 
    356     writefln( 
     362    std.stdio.writefln( 
    357363        "Path and Version : %s v%s(%d)\n  built on %s" 
    358364            ,vAppPath, vAppVersion, build_bn.auto_build_number, 
     
    362368    else { 
    363369 
    364     writefln( 
     370    std.stdio.writefln( 
    365371        "Usage: %s sourcefile [options objectfiles libraries]" 
    366372            , vAppName); 
    367     writefln("  sourcefile D source file"); 
    368     writefln("  -v         Verbose (passed through to D)"); 
    369     writefln("  -V         Verbose (NOT passed through)"); 
    370     writefln("  -names     Displays the names of the files used in building the target."); 
    371     writefln("  -DCPATH<path> <path> is where the compiler has been installed."); 
    372     writefln("             Only needed if the compiler is not in the system's"); 
    373     writefln("             PATH list. Used if you are testing an alternate"); 
    374     writefln("             version of the compiler."); 
    375     writefln("  -CFPATH<path> <path> is where the D config file has been installed."); 
    376     writefln("  -full      Causes all source files, except ignored modules,"); 
    377     writefln("              to be compiled."); 
    378     writefln("  -link      Forces the linker to be called instead of the librarian."); 
    379     writefln("              (Only needed if the source files do not contain"); 
    380     writefln("               main/WinMain)"); 
    381     writefln("  -nolink    Ensures that the linker is not called."); 
    382     writefln("              (Only needed if main/WinMain is found in the source"); 
    383     writefln("               files and you do NOT want an executable created.)"); 
    384     writefln("  -lib       Forces the object files to be placed in a library."); 
    385     writefln("              (Only needed if main/WinMain is found in the source"); 
    386     writefln("               files AND you want it in a library instead of"); 
    387     writefln("               an executable.)"); 
    388     writefln("  -nolib     Ensures that the object files are not used to form"); 
    389     writefln("              a library."); 
    390     writefln("              (Only needed if main/WinMain is not found in the source"); 
    391     writefln("               files and you do NOT want a library."); 
    392     writefln("  -obj       This is the same as having both -nolib and -nolink switches."); 
    393     writefln("  -allobj    Ensures that all object files are added to a"); 
    394     writefln("              library."); 
    395     writefln("              (Normally only those in the same directory are added.)"); 
    396     writefln("  -cleanup   Ensures that all object files created during the run"); 
    397     writefln("              are removed at the end of the run, plus other work files."); 
    398     writefln("  -clean     Same as -cleanup"); 
     373    std.stdio.writefln("  sourcefile D source file"); 
     374    std.stdio.writefln("  -v         Verbose (passed through to D)"); 
     375    std.stdio.writefln("  -V         Verbose (NOT passed through)"); 
     376    std.stdio.writefln("  -names     Displays the names of the files used in building the target."); 
     377    std.stdio.writefln("  -DCPATH<path> <path> is where the compiler has been installed."); 
     378    std.stdio.writefln("             Only needed if the compiler is not in the system's"); 
     379    std.stdio.writefln("             PATH list. Used if you are testing an alternate"); 
     380    std.stdio.writefln("             version of the compiler."); 
     381    std.stdio.writefln("  -CFPATH<path> <path> is where the D config file has been installed."); 
     382    std.stdio.writefln("  -full      Causes all source files, except ignored modules,"); 
     383    std.stdio.writefln("              to be compiled."); 
     384    std.stdio.writefln("  -link      Forces the linker to be called instead of the librarian."); 
     385    std.stdio.writefln("              (Only needed if the source files do not contain"); 
     386    std.stdio.writefln("               main/WinMain)"); 
     387    std.stdio.writefln("  -nolink    Ensures that the linker is not called."); 
     388    std.stdio.writefln("              (Only needed if main/WinMain is found in the source"); 
     389    std.stdio.writefln("               files and you do NOT want an executable created.)"); 
     390    std.stdio.writefln("  -lib       Forces the object files to be placed in a library."); 
     391    std.stdio.writefln("              (Only needed if main/WinMain is found in the source"); 
     392    std.stdio.writefln("               files AND you want it in a library instead of"); 
     393    std.stdio.writefln("               an executable.)"); 
     394    std.stdio.writefln("  -nolib     Ensures that the object files are not used to form"); 
     395    std.stdio.writefln("              a library."); 
     396    std.stdio.writefln("              (Only needed if main/WinMain is not found in the source"); 
     397    std.stdio.writefln("               files and you do NOT want a library."); 
     398    std.stdio.writefln("  -obj       This is the same as having both -nolib and -nolink switches."); 
     399    std.stdio.writefln("  -allobj    Ensures that all object files are added to a"); 
     400    std.stdio.writefln("              library."); 
     401    std.stdio.writefln("              (Normally only those in the same directory are added.)"); 
     402    std.stdio.writefln("  -cleanup   Ensures that all object files created during the run"); 
     403    std.stdio.writefln("              are removed at the end of the run, plus other work files."); 
     404    std.stdio.writefln("  -clean     Same as -cleanup"); 
    399405  version(Windows) { 
    400     writefln("  -gui[:x.y] Forces a GUI application to be created. The optional"); 
    401     writefln("              :x.y can be used to build an application for a "); 
    402     writefln("              specific version of Windows. eg. -gui:4.0"); 
    403     writefln("              (Only needed if WinMain is not found in the source files"); 
    404     writefln("               or if you wish to override the default Windows version)"); 
    405     writefln("  -dll       Forces a DLL library to be created."); 
    406     writefln("              (Only needed if DllMain is not found in the source files.)"); 
     406    std.stdio.writefln("  -gui[:x.y] Forces a GUI application to be created. The optional"); 
     407    std.stdio.writefln("              :x.y can be used to build an application for a "); 
     408    std.stdio.writefln("              specific version of Windows. eg. -gui:4.0"); 
     409    std.stdio.writefln("              (Only needed if WinMain is not found in the source files"); 
     410    std.stdio.writefln("               or if you wish to override the default Windows version)"); 
     411    std.stdio.writefln("  -dll       Forces a DLL library to be created."); 
     412    std.stdio.writefln("              (Only needed if DllMain is not found in the source files.)"); 
    407413   } 
    408414 
    409     writefln("  -LIBOPT<opt> Allows you to pass <opt> to the librarian."); 
    410     writefln("  -LIBPATH=<pathlist> Used to add a semi-colon delimited list"); 
    411     writefln("                of search paths for library files."); 
    412     writefln("  -MDF<path> Overrides the default Macro Definition File"); 
    413     writefln("  -test      Does everything as normal except it displays the commands"); 
    414     writefln("              instead of running them."); 
    415     writefln("  -RDF<path> Overrides the default Rule Definition File"); 
    416     writefln("  -R=<Yes|No> Indicates whether to use a response file or command line"); 
    417     writefln("              arguments with the compiler tools."); 
    418     writefln("               -R=Yes will cause a response to be used."); 
    419     writefln("               -R=No will cause command line arguments to be used."); 
    420     writefln("               -R will reverse the current usage."); 
    421     writefln("  -PP<path>  Add a path to the Source Search List"); 
     415    std.stdio.writefln("  -LIBOPT<opt> Allows you to pass <opt> to the librarian."); 
     416    std.stdio.writefln("  -LIBPATH=<pathlist> Used to add a semi-colon delimited list"); 
     417    std.stdio.writefln("                of search paths for library files."); 
     418    std.stdio.writefln("  -MDF<path> Overrides the default Macro Definition File"); 
     419    std.stdio.writefln("  -test      Does everything as normal except it displays the commands"); 
     420    std.stdio.writefln("              instead of running them."); 
     421    std.stdio.writefln("  -RDF<path> Overrides the default Rule Definition File"); 
     422    std.stdio.writefln("  -R=<Yes|No> Indicates whether to use a response file or command line"); 
     423    std.stdio.writefln("              arguments with the compiler tools."); 
     424    std.stdio.writefln("               -R=Yes will cause a response to be used."); 
     425    std.stdio.writefln("               -R=No will cause command line arguments to be used."); 
     426    std.stdio.writefln("               -R will reverse the current usage."); 
     427    std.stdio.writefln("  -PP<path>  Add a path to the Source Search List"); 
    422428 
    423429  version(UseResponseFile) 
    424     writefln("               ** The default is to use a response file"); 
     430    std.stdio.writefln("               ** The default is to use a response file"); 
    425431  else 
    426     writefln("               ** The default is to use command line arguments"); 
    427  
    428     writefln("  -exec<param> If the link is successful, this will cause the"); 
    429     writefln("               executable just created to run. You can give it "); 
    430     writefln("               run time parameters. Anything after the '-exec' will"); 
    431     writefln("               placed in the program's command line. You will need"); 
    432     writefln("               to quote any embedded spaces."); 
    433     writefln("  -od<path>  Nominate the directory where temporary (work) files"); 
    434     writefln("             are to be created. By default they are created in"); 
    435     writefln("             the same directory as the target file."); 
    436     writefln("  -X<module> Modules/Packages to ignore (eg. -Xmylib)"); 
    437     writefln("  -M<module> Modules/Packages to notice (eg. -Mphobos)"); 
    438     writefln("  -T<targetname> The name of the target file to create. Normally"); 
    439     writefln("              the target name istaken from the first or only name"); 
    440     writefln("              of the command line."); 
    441     writefln("  -help     Displays the full 'usage' help text. "); 
    442     writefln("  -h        Same as -help, displays the full 'usage' help text."); 
    443     writefln("  -?        Same as -help, displays the full 'usage' help text."); 
    444     writefln("  -silent   Avoids unnecessary messages being displayed."); 
    445     writefln("  -noautoimport Turns off the automatic addition of source paths"); 
    446     writefln("              to the list of Import Roots."); 
    447     writefln("  -info      Displays the version and path of the Build application."); 
    448     writefln("  -nodef    Prevents a Module Definition File from being created."); 
    449     writefln("  -UMB=<Yes/No> If 'Yes' this forces the utility to expect"); 
    450     writefln("            the object file to be created or residing in the current"); 
    451     writefln("            directory."); 
     432    std.stdio.writefln("               ** The default is to use command line arguments"); 
     433 
     434    std.stdio.writefln("  -exec<param> If the link is successful, this will cause the"); 
     435    std.stdio.writefln("               executable just created to run. You can give it "); 
     436    std.stdio.writefln("               run time parameters. Anything after the '-exec' will"); 
     437    std.stdio.writefln("               placed in the program's command line. You will need"); 
     438    std.stdio.writefln("               to quote any embedded spaces."); 
     439    std.stdio.writefln("  -od<path>  Nominate the directory where temporary (work) files"); 
     440    std.stdio.writefln("             are to be created. By default they are created in"); 
     441    std.stdio.writefln("             the same directory as the target file."); 
     442    std.stdio.writefln("  -X<module> Modules/Packages to ignore (eg. -Xmylib)"); 
     443    std.stdio.writefln("  -M<module> Modules/Packages to notice (eg. -Mphobos)"); 
     444    std.stdio.writefln("  -T<targetname> The name of the target file to create. Normally"); 
     445    std.stdio.writefln("              the target name istaken from the first or only name"); 
     446    std.stdio.writefln("              of the command line."); 
     447    std.stdio.writefln("  -help     Displays the full 'usage' help text. "); 
     448    std.stdio.writefln("  -h        Same as -help, displays the full 'usage' help text."); 
     449    std.stdio.writefln("  -?        Same as -help, displays the full 'usage' help text."); 
     450    std.stdio.writefln("  -silent   Avoids unnecessary messages being displayed."); 
     451    std.stdio.writefln("  -noautoimport Turns off the automatic addition of source paths"); 
     452    std.stdio.writefln("              to the list of Import Roots."); 
     453    std.stdio.writefln("  -info      Displays the version and path of the Build application."); 
     454    std.stdio.writefln("  -nodef    Prevents a Module Definition File from being created."); 
     455    std.stdio.writefln("  -UMB=<Yes/No> If 'Yes' this forces the utility to expect"); 
     456    std.stdio.writefln("            the object file to be created or residing in the current"); 
     457    std.stdio.writefln("            directory."); 
    452458    version(Windows) 
    453459    { 
    454     writefln("  -AutoWinLibs=<Yes/No> If 'No' this prevents the tool from"); 
    455     writefln("              passing the standard set of Windows libraries"); 
    456     writefln("              to the linker for GUI applications. 'Yes' is"); 
    457     writefln("              is the default."); 
    458     } 
    459     writefln("  [...]      All other options, objectfiles and libraries are"); 
    460     writefln("              passed to the compiler"); 
    461     writefln("*Note, you can specify all or any command line value in a "); 
    462     writefln("   response file. Each value appears in its own line in the"); 
    463     writefln("   response file and you reference this file by prefixing"); 
    464     writefln("   its name with an '@' symbol on the command line."); 
    465     writefln("   Example:  build @final"); 
    466     writefln("      where a file called 'final.brf' contains the command"); 
    467     writefln("      line values (including other response file references)"); 
    468     writefln("   If the response file reference is just a single '@' then"); 
    469     writefln("   build looks for a file called 'build.brf'"); 
     460    std.stdio.writefln("  -AutoWinLibs=<Yes/No> If 'No' this prevents the tool from"); 
     461    std.stdio.writefln("              passing the standard set of Windows libraries"); 
     462    std.stdio.writefln("              to the linker for GUI applications. 'Yes' is"); 
     463    std.stdio.writefln("              is the default."); 
     464    } 
     465    std.stdio.writefln("  [...]      All other options, objectfiles and libraries are"); 
     466    std.stdio.writefln("              passed to the compiler"); 
     467    std.stdio.writefln("*Note, you can specify all or any command line value in a "); 
     468    std.stdio.writefln("   response file. Each value appears in its own line in the"); 
     469    std.stdio.writefln("   response file and you reference this file by prefixing"); 
     470    std.stdio.writefln("   its name with an '@' symbol on the command line."); 
     471    std.stdio.writefln("   Example:  build @final"); 
     472    std.stdio.writefln("      where a file called 'final.brf' contains the command"); 
     473    std.stdio.writefln("      line values (including other response file references)"); 
     474    std.stdio.writefln("   If the response file reference is just a single '@' then"); 
     475    std.stdio.writefln("   build looks for a file called 'build.brf'"); 
    470476} 
    471477} 
     
    474480// It returns the time of the most recently modified file. 
    475481//------------------------------------------------------- 
    476 FileDateTime GetNewestDateTime() 
     482util.fdt.FileDateTime GetNewestDateTime() 
    477483//------------------------------------------------------- 
    478484{ 
    479     Source lSource; 
    480     FileDateTime lModsTime = new FileDateTime(); 
    481  
    482     foreach(int i, Source lSource; Source) 
    483     { 
    484         // Get the next Source object to examine. 
    485         if (lSource.Ignore) 
    486             continue; 
    487  
    488         // Ensure that it has been processed. 
    489         lSource.search(); 
     485    source.Source lSource; 
     486    int i; 
     487 
     488    util.fdt.FileDateTime lModsTime = new util.fdt.FileDateTime(); 
     489 
     490    source.Source.AllFiles( 
     491        delegate int (inout int i, inout source.Source lSource) 
     492        { 
     493            // Get the next Source object to examine. 
     494            if (lSource.Ignore) 
     495                return 0; 
     496 
     497            // Ensure that it has been processed. 
     498            lSource.search(); 
     499 
     500            version(BuildVerbose) 
     501            { 
     502                if(vVerbose == True) { 
     503                    std.stdio.writefln("source file[%d] %s", i, 
     504                            util.pathex.AbbreviateFileName(lSource.FileName)); 
     505                } 
     506                else if(vNames == True) { 
     507                    std.stdio.writefln(" [ %s ]", util.pathex.AbbreviateFileName(lSource.FileName)); 
     508                } 
     509            } else { 
     510                if(vNames == True) { 
     511                    std.stdio.writefln(" [ %s ]", util.pathex.AbbreviateFileName(lSource.FileName)); 
     512                } 
     513            } 
     514 
     515            if (lSource.DependantsTime > lModsTime) 
     516            { 
     517                version(BuildVerbose) 
     518                { 
     519                    if(vVerbose == True) 
     520                        std.stdio.writefln("Newer time: from %s to %s", 
     521                                    lModsTime.toString(), 
     522                                    lSource.DependantsTime.toString() 
     523                                ); 
     524                } 
     525 
     526                lModsTime = lSource.DependantsTime; 
     527            } 
     528 
     529            return 0; 
     530        } 
     531    ); 
     532 
     533    // Examine any link file dependancies too. 
     534    foreach(int idx, char[] lFileName; vLinkFiles.keys) 
     535    { 
     536        util.fdt.FileDateTime lLinkTime = new util.fdt.FileDateTime(lFileName); 
    490537 
    491538        version(BuildVerbose) 
    492539        { 
    493540            if(vVerbose == True) { 
    494                 writefln("source file[%d] %s", i
    495                         util.pathex.AbbreviateFileName(lSource.FileName)); 
     541                std.stdio.writefln("link file[%d] %s %s", idx
     542                        util.pathex.AbbreviateFileName(lFileName), lLinkTime.toString()); 
    496543            } 
    497544            else if(vNames == True) { 
    498                 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lSource.FileName)); 
     545                std.stdio.writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 
    499546            } 
    500547        } else { 
    501548            if(vNames == True) { 
    502                 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lSource.FileName)); 
    503             } 
    504         } 
    505  
    506         if (lSource.DependantsTime > lModsTime) 
     549                std.stdio.writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 
     550            } 
     551        } 
     552        if (lLinkTime > lModsTime) 
    507553        { 
    508554            version(BuildVerbose) 
    509555            { 
    510556                if(vVerbose == True) 
    511                     writefln("Newer time: from %s to %s", 
    512                                 lModsTime.toString(), 
    513                                 lSource.DependantsTime.toString() 
    514                             ); 
    515             } 
    516  
    517             lModsTime = lSource.DependantsTime; 
    518         } 
    519     } 
    520  
    521     // Examine any link file dependancies too. 
    522     foreach(int i, char[] lFileName; vLinkFiles.keys) 
    523     { 
    524         FileDateTime lLinkTime = GetFileTime(lFileName); 
    525  
    526         version(BuildVerbose) 
    527         { 
    528             if(vVerbose == True) { 
    529                 writefln("link file[%d] %s %s", i, 
    530                         util.pathex.AbbreviateFileName(lFileName), lLinkTime.toString()); 
    531             } 
    532             else if(vNames == True) { 
    533                 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 
    534             } 
    535         } else { 
    536             if(vNames == True) { 
    537                 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 
    538             } 
    539         } 
    540         if (lLinkTime > lModsTime) 
    541         { 
    542             version(BuildVerbose) 
    543             { 
    544                 if(vVerbose == True) 
    545                     writefln("Newer time: from %s to %s", 
     557                    std.stdio.writefln("Newer time: from %s to %s", 
    546558                                lModsTime.toString(), 
    547559                                lLinkTime.toString() 
     
    572584    char[]      lTargetName; 
    573585    char[]      lTargetDir; 
    574     FileDateTime lTargetTime; 
    575     FileDateTime lMostRecentTime; 
    576     auto Source[]    lNonLinkingSources; 
     586    util.fdt.FileDateTime lTargetTime; 
     587    util.fdt.FileDateTime lMostRecentTime; 
     588    auto source.Source[]    lNonLinkingSources; 
    577589    char[]      lDResponseFileName; 
    578590    char[]      lLinkResponseFileName; 
     
    600612            { 
    601613                if (vVerbose == True) 
    602                     writefln("Macro file '%s' being processed.", lFile); 
     614                    std.stdio.writefln("Macro file '%s' being processed.", lFile); 
    603615            } 
    604616 
     
    611623                { 
    612624                    if ((vSilent != True) || (vVerbose == True)) 
    613                         writefln("Macro file '%s' failed to generate output", lFile); 
     625                        std.stdio.writefln("Macro file '%s' failed to generate output", lFile); 
    614626                } else { 
    615627                    if (vSilent != True) 
    616                         writefln("Macro file '%s' failed to generate output", lFile); 
     628                        std.stdio.writefln("Macro file '%s' failed to generate output", lFile); 
    617629                } 
    618630                lFile.length = 0; 
     
    622634        if (lFile.length > 0) 
    623635        { 
    624             new Source(lFile); 
     636            new source.Source(lFile); 
    625637        } 
    626638    } 
     
    629641    // found, and I was not explicitly told not to link. 
    630642    lLinking =  (vLibraryAction == LibOpt.Build) || 
    631                 (Source.WasMainFound == false) || 
     643                (source.Source.WasMainFound == false) || 
    632644                (vNoLink == True) 
    633645               ? False : True; 
     
    638650    // based on whether or not 'main' was found in the sources. 
    639651    if (vLibraryAction == LibOpt.Implicit) { 
    640         if (Source.WasMainFound){ 
     652        if (source.Source.WasMainFound){ 
    641653            vLibraryAction = LibOpt.DontBuild; 
    642654        } 
     
    656668        { 
    657669            if(vVerbose == True) 
    658                 writefln("Pragma target override is '%s'", std.path.getName(vTargetName)); 
     670                std.stdio.writefln("Pragma target override is '%s'", std.path.getName(vTargetName)); 
    659671        } 
    660672 
     
    670682        { 
    671683            if(vVerbose == True) 
    672                 writefln("Cmdline target override is '%s'", vTargetName); 
     684                std.stdio.writefln("Cmdline target override is '%s'", vTargetName); 
    673685        } 
    674686    } 
     
    680692    if (vLibraryAction == LibOpt.Build) 
    681693        // Target is a library. 
    682         lTargetName = ReplaceExtention(vTargetName, vLibExtention); 
     694        lTargetName = util.pathex.ReplaceExtention(vTargetName, vLibExtention); 
    683695 
    684696    else if (vNoLink == False) 
    685697    { 
    686         if (Source.WasMainFound) 
    687             if (Source.WasMainDLL) 
     698        if (source.Source.WasMainFound) 
     699            if (source.Source.WasMainDLL) 
    688700                // Target is a shared library. 
    689                 lTargetName = ReplaceExtention(vTargetName, vShrLibExtention); 
     701                lTargetName = util.pathex.ReplaceExtention(vTargetName, vShrLibExtention); 
    690702            else 
    691703            { 
    692704                // Target is an executable 
    693                 lTargetName = ReplaceExtention(vTargetName, vExeExtention); 
     705                lTargetName = util.pathex.ReplaceExtention(vTargetName, vExeExtention); 
    694706                vTargetExe = lTargetName; 
    695707            } 
     
    699711            // so assume they know what they are doing and also assume an 
    700712            // executable is required. 
    701             lTargetName = ReplaceExtention(vTargetName, vExeExtention); 
     713            lTargetName = util.pathex.ReplaceExtention(vTargetName, vExeExtention); 
    702714            vTargetExe = lTargetName; 
    703715        } 
     
    711723        // Get the full name of the target's location. 
    712724        lTargetName = util.pathex.CanonicalPath(lTargetName, false); 
    713         lTargetDir = getDirName(lTargetName); 
     725        lTargetDir = std.path.getDirName(lTargetName); 
    714726 
    715727        // Show user if required to. 
     
    717729        { 
    718730            if((vVerbose == True) || (vNames == True) ) 
    719                 writefln("\nBuilding target '%s'", lTargetName); 
     731                std.stdio.writefln("\nBuilding target '%s'", lTargetName); 
    720732        } 
    721733 
     
    727739        // most recently modified dependant file, we need to 
    728740        // rebuild the target. 
    729         lTargetTime = util.fdt.GetFileTime (lTargetName); 
     741        lTargetTime = new util.fdt.FileDateTime (lTargetName); 
    730742        version(BuildVerbose) 
    731743        { 
    732744            if(vVerbose == True) { 
    733                 writefln("Time %s for %s (target)", lTargetTime.toString(), lTargetName); 
    734                 writefln("Time %s (most recent)", lMostRecentTime.toString()); 
     745                std.stdio.writefln("Time %s for %s (target)", lTargetTime.toString(), lTargetName); 
     746                std.stdio.writefln("Time %s (most recent)", lMostRecentTime.toString()); 
    735747            } 
    736748        } 
     
    745757        { 
    746758            if((vVerbose == True) || (vNames == True) ) 
    747                 writefln("\nCompiling only. No target will be built."); 
     759                std.stdio.writefln("\nCompiling only. No target will be built."); 
    748760        } else { 
    749761            if(vNames == True) 
    750                 writefln("\nCompiling only. No target will be built."); 
    751         } 
    752     } 
    753  
    754     if (Source.FileCount == 0) 
     762                std.stdio.writefln("\nCompiling only. No target will be built."); 
     763        } 
     764    } 
     765 
     766    if (source.Source.FileCount == 0) 
    755767    { 
    756768        /* It is possible to only have object and library 
     
    774786        do 
    775787        { 
    776             lInitCount = Source.FileCount; 
    777             foreach(int i, Source lCurrentSource; Source) 
    778             { 
    779                 if (lCurrentSource.HasBeenScanned == false) 
    780                 { 
    781                     lCurrentSource.search(); 
    782                 } 
    783             } 
    784         } while (lInitCount != Source.FileCount); 
    785  
    786         foreach(int i, Source lCurrentSource; Source) 
    787         { 
    788             // Check each source to see if we need to recompile it. 
    789             Bool lNeedsCompiling; 
    790             char[] lShortFileName; 
    791             char[] lFileType; 
    792  
    793             lNeedsCompiling = vForceCompile; 
    794  
    795             if (lCurrentSource.Ignore) 
    796                 continue; 
    797  
    798             lShortFileName = util.pathex.AbbreviateFileName(lCurrentSource.FileName); 
    799             lFileType = std.path.getExt(lShortFileName); 
    800             if (lFileType != vSrcExtention && lFileType != vDdocExtention) 
    801                 continue; 
    802  
    803             // Only source files are examined from here on. 
    804             if (lCurrentSource.NoLink || lFileType == vDdocExtention) 
    805             { 
    806                 lNonLinkingSources ~= lCurrentSource; 
    807             } 
    808  
    809             if(lCurrentSource.FilesTime > lCurrentSource.ObjectsTime) 
    810             { 
    811                 version(BuildVerbose) 
    812                 { 
    813                     if (vVerbose == True) 
    814                         writefln("%s newer than its object file", lShortFileName); 
    815                 } 
    816  
    817                 lNeedsCompiling = True; 
    818  
    819             } else if(lCurrentSource.DependantsTime > lCurrentSource.ObjectsTime) { 
    820                 version(BuildVerbose) 
    821                 { 
    822                     if (vVerbose == True) 
    823                         writefln("%s has newer dependants than its object file.", 
    824                                     lShortFileName); 
    825                 } 
    826  
    827                 lNeedsCompiling = True; 
    828             } 
    829  
    830             if(lNeedsCompiling == True) 
    831             { 
    832                 lBuildRequired = True; 
    833                 lCompiling = True; 
    834                 lFilesToCompile ~= lShortFileName; 
    835  
    836                 // Check to see if I'm allowed to link this file. 
    837                 if (lCurrentSource.NoLink == false) 
     788            lInitCount = source.Source.FileCount; 
     789            source.Source.AllFiles( 
     790                delegate int (inout int i, inout source.Source lCurrentSource) 
     791                { 
     792                    if (lCurrentSource.HasBeenScanned == false) 
     793                    { 
     794                        lCurrentSource.search(); 
     795                    } 
     796                    return 0; 
     797                } 
     798            ); 
     799        } while (lInitCount != source.Source.FileCount); 
     800 
     801        source.Source.AllFiles( 
     802            delegate int (inout int i, inout source.Source lCurrentSource) 
     803            { 
     804                // Check each source to see if we need to recompile it. 
     805                Bool lNeedsCompiling; 
     806                char[] lShortFileName; 
     807                char[] lFileType; 
     808 
     809                lNeedsCompiling = vForceCompile; 
     810 
     811                if (lCurrentSource.Ignore) 
     812                    return 0; 
     813 
     814                lShortFileName = util.pathex.AbbreviateFileName(lCurrentSource.FileName); 
     815                lFileType = std.path.getExt(lShortFileName); 
     816                if (lFileType != vSrcExtention && lFileType != vDdocExtention) 
     817                    return 0; 
     818 
     819                // Only source files are examined from here on. 
     820                if (lCurrentSource.NoLink || lFileType == vDdocExtention) 
     821                { 
     822                    lNonLinkingSources ~= lCurrentSource; 
     823                } 
     824 
     825                if(lCurrentSource.FilesTime > lCurrentSource.ObjectsTime) 
     826                { 
     827                    version(BuildVerbose) 
     828                    { 
     829                        if (vVerbose == True) 
     830                            std.stdio.writefln("%s newer than its object file", lShortFileName); 
     831                    } 
     832 
     833                    lNeedsCompiling = True; 
     834 
     835                } else if(lCurrentSource.DependantsTime > lCurrentSource.ObjectsTime) { 
     836                    version(BuildVerbose) 
     837                    { 
     838                        if (vVerbose == True) 
     839                            std.stdio.writefln("%s has newer dependants than its object file.", 
     840                                        lShortFileName); 
     841                    } 
     842 
     843                    lNeedsCompiling = True; 
     844                } 
     845 
     846                if(lNeedsCompiling == True) 
     847                { 
     848                    lBuildRequired = True; 
     849                    lCompiling = True; 
     850                    lFilesToCompile ~= lShortFileName; 
     851 
     852                    // Check to see if I'm allowed to link this file. 
     853                    if (lCurrentSource.NoLink == false) 
     854                        lFilesToLink ~= util.pathex.AbbreviateFileName(lCurrentSource.ObjectName); 
     855 
     856                    if (vTestRun == False) 
     857                    { 
     858                        if (lCurrentSource.IncrementBuildNumber()) 
     859                        { 
     860                            version(BuildVerbose) 
     861                            { 
     862                                if (vVerbose == True) 
     863                                    std.stdio.writefln("New build number %d for %s", 
     864                                               lCurrentSource.BuildNumber, 
     865                                                lCurrentSource.ModuleName); 
     866                            } 
     867                        } 
     868                    } 
     869                } 
     870                else if (lCurrentSource.NoLink == false) 
     871                { 
    838872                    lFilesToLink ~= util.pathex.AbbreviateFileName(lCurrentSource.ObjectName); 
    839  
    840                 if (vTestRun == False) 
    841                 { 
    842                     if (lCurrentSource.IncrementBuildNumber()) 
    843                     { 
    844                         version(BuildVerbose) 
    845                         { 
    846                             if (vVerbose == True) 
    847                                 writefln("New build number %d for %s", 
    848                                            lCurrentSource.BuildNumber, 
    849                                             lCurrentSource.ModuleName); 
    850                         } 
    851                     } 
    852                 } 
    853             } 
    854             else if (lCurrentSource.NoLink == false) 
    855             { 
    856                 lFilesToLink ~= util.pathex.AbbreviateFileName(lCurrentSource.ObjectName); 
    857             } 
    858  
    859         } 
     873                } 
     874 
     875                return 0; 
     876            } 
     877        ); 
    860878    } 
    861879 
     
    863881    { 
    864882        if (vSilent == False) 
    865             writefln ("Files are up to date, no build required."); 
     883            std.stdio.writefln ("Files are up to date, no build required."); 
    866884        return 0; 
    867885    } 
     
    875893    version(Windows) 
    876894    { 
    877         if (Source.WasMainGUI) { 
     895        if (source.Source.WasMainGUI) { 
    878896            AddBuildDef("EXETYPE NT"); 
    879897            if (vWinVer.length != 0) 
     
    900918            } 
    901919        } 
    902         else if (Source.WasMainDLL) { 
     920        else if (source.Source.WasMainDLL) { 
    903921            AddBuildDef(`LIBRARY "` ~ std.path.getBaseName(lTargetName) ~ `"`); 
    904922            AddBuildDef("EXETYPE NT"); 
     
    916934        if ((vNoDef == False) && (vBuildDef.length > 0)) 
    917935        { 
    918             lDefName = ReplaceExtention(lTargetName, "def"); 
     936            lDefName = util.pathex.ReplaceExtention(lTargetName, "def"); 
    919937            if (vTemporaryPath.length != 0) 
    920938            { 
     
    961979            if (vUseResponseFile == True) 
    962980            { 
    963                 lDResponseFileName = ReplaceExtention(lTargetName, "rsp"); 
     981                lDResponseFileName = util.pathex.ReplaceExtention(lTargetName, "rsp"); 
    964982                if (vTemporaryPath.length != 0) 
    965983                { 
     
    979997            { 
    980998                if (vVerbose == True) 
    981                     writefln("Compiling with ..........\n%s\n", lCommandLine); 
     999                    std.stdio.writefln("Compiling with ..........\n%s\n", lCommandLine); 
    9821000            } 
    9831001 
    9841002            // Run Compiler to compile the source files that need it. 
    985             lRunResult = RunCommand(vCompilerPath ~ vCompilerExe, lCommand); 
     1003            lRunResult = util.fileex.RunCommand(vCompilerPath ~ vCompilerExe, lCommand); 
    9861004            if (lRunResult != 0) 
    9871005                vExecuteProgram = False; 
     
    10171035                    if (util.str.begins(lCompileArg, "-L") == True) 
    10181036                    { 
    1019                         lLinkerSwitches ~= lCompileArg[2..$]
     1037                        lLinkerSwitches ~= lCompileArg[2..$] ~ vArgDelim
    10201038                    } 
    10211039                } 
     
    10471065                // (3) Set the map name 
    10481066                if (IsMapping == True) 
    1049                     lCommandLine ~= ReplaceExtention(lTargetName, "map"); 
     1067                    lCommandLine ~= util.pathex.ReplaceExtention(lTargetName, "map"); 
    10501068 
    10511069                lCommandLine ~= "\n"; 
     
    10581076                    foreach( char[] lLib; lLibraryFiles) 
    10591077                    { 
    1060                         lCommandLine ~= util.str.enquote(lLib) ~ vArgFileDelim
    1061                     } 
    1062                     lCommandLine[$-1] = '\n'; 
     1078                        lLib =  std.path.addExt(lLib, vLibExtention)
     1079                        lCommandLine ~= vLinkLibSwitch ~ util.str.enquote(lLib) ~ "\n"; 
     1080                    } 
    10631081                } 
    10641082                else 
     
    10751093                    { 
    10761094                        if (vVerbose == True) 
    1077                             writefln("Setting LIB=%s", vLibPaths); 
     1095                            std.stdio.writefln("Setting LIB=%s", vLibPaths); 
    10781096                    } 
    10791097                    util.str.SetEnv("LIB",vLibPaths[1..$]); 
     
    11221140                    if (util.str.begins(lCompileArg, "-L") == True) 
    11231141                    { 
    1124                         lLinkerSwitches ~= lCompileArg[2..$]; 
    1125                     } 
    1126                 } 
    1127                 foreach( char[] lSwitch; std.string.split(vLinkerDefs ~ lLinkerSwitches, "/")) 
    1128                 { 
    1129                     if (lSwitch == "nomap") 
    1130                     { 
    1131                         IsMapping = False; 
    1132                     } 
    1133                     else if (lSwitch == "map") 
    1134                     { 
    1135                         IsMapping = True; 
     1142                        lLinkerSwitches ~= lCompileArg[2..$] ~ vArgDelim; 
    11361143                    } 
    11371144                } 
     
    11481155                // (3) Set the map name 
    11491156                if (IsMapping == True) 
    1150                     lLinkerSwitches ~= vMapSwitch
     1157                    lLinkerSwitches ~= vMapSwitch ~ vArgDelim
    11511158 
    11521159                // (4) Gather the libraries names. 
     
    11661173                    { 
    11671174                        if (vVerbose == True) 
    1168                             writefln("Setting LIB=%s", vLibPaths); 
     1175                            std.stdio.writefln("Setting LIB=%s", vLibPaths); 
    11691176                    } 
    11701177 
     
    11841191            if (vUseResponseFile == True) 
    11851192            { 
    1186                 lLinkResponseFileName = ReplaceExtention(lTargetName, "ksp"); 
     1193                lLinkResponseFileName = util.pathex.ReplaceExtention(lTargetName, "ksp"); 
    11871194                if (vTemporaryPath.length != 0) 
    11881195                { 
     
    12291236            { 
    12301237                if (vVerbose == True) 
    1231                     writefln("Linking with ..........\n%s\n", lCommandLine); 
     1238                    std.stdio.writefln("Linking with ..........\n%s\n", lCommandLine); 
    12321239            } 
    12331240 
     
    12381245            } 
    12391246 
    1240             lRunResult = RunCommand(vLinkerPath ~ vLinkerExe, lCommand); 
     1247            lRunResult = util.fileex.RunCommand(vLinkerPath ~ vLinkerExe, lCommand); 
    12411248            if (lRunResult != 0) 
    12421249                vExecuteProgram = False; 
     
    12471254    { 
    12481255        if (vSilent == False) 
    1249             writefln("No build required."); 
     1256            std.stdio.writefln("No build required."); 
    12501257        lRunResult = 0; 
    12511258    } 
    12521259 
    12531260    // Now build a library if requested to. 
    1254     if ( (Source.WasMainDLL)  && (lRunResult == 0) ) 
     1261    if ( (source.Source.WasMainDLL)  && (lRunResult == 0) ) 
    12551262    { 
    12561263        char[] lTargetFileName; 
     
    12711278 
    12721279            lTargetFileName = std.path.getBaseName(lTargetName); 
    1273             lRunResult = RunCommand(lImpLibPath, lImpLibArgs ~ 
     1280            lRunResult = util.fileex.RunCommand(lImpLibPath, lImpLibArgs ~ 
    12741281                                       " " ~ std.path.addExt(lTargetFileName, "lib") ~ 
    12751282                                       " " ~ std.path.addExt(lTargetFileName, "dll") ); 
     
    12891296            char[] lFileDir; 
    12901297 
    1291             lFileDir = getDirName(lFileName); 
     1298            lFileDir = std.path.getDirName(lFileName); 
    12921299            if ((vAllObjects == True) || lFileDir == "" || lFileDir == lTargetDir) 
    12931300            { 
     
    13071314        { 
    13081315            if (vUseResponseFile == True) { 
    1309                 lLResponseFileName = ReplaceExtention(lTargetName, "lsp"); 
     1316                lLResponseFileName = util.pathex.ReplaceExtention(lTargetName, "lsp"); 
    13101317                if (vTemporaryPath.length != 0) 
    13111318                { 
     
    13231330            { 
    13241331                if (vVerbose == True) 
    1325                     writefln("Librarian with ..........\n%s\n", lOutText); 
    1326             } 
    1327  
    1328             lRunResult = RunCommand(vLibrarianPath ~ vLibrarian, lCommand); 
     1332                    std.stdio.writefln("Librarian with ..........\n%s\n", lOutText); 
     1333            } 
     1334 
     1335            lRunResult = util.fileex.RunCommand(vLibrarianPath ~ vLibrarian, lCommand); 
    13291336        } 
    13301337    } 
     
    13381345        { 
    13391346            if (vVerbose == True) 
    1340                 writefln("Cleaning up ..."); 
    1341         } 
    1342  
    1343         foreach(Source lSource; Source) 
    1344         { 
    1345             if (lSource.Ignore) 
    1346                 continue; 
    1347  
    1348             if (lSource.ObjectName.length > 0) 
    1349             { 
    1350                 lHitList ~= lSource.ObjectName; 
    1351             } 
    1352         } 
    1353  
     1347                std.stdio.writefln("Cleaning up ..."); 
     1348        } 
     1349 
     1350        source.Source.AllFiles( 
     1351            delegate int (inout int i, inout source.Source lSource) 
     1352            { 
     1353                if (lSource.Ignore) 
     1354                    return 0; 
     1355 
     1356                if (lSource.ObjectName.length > 0) 
     1357                { 
     1358                    lHitList ~= lSource.ObjectName; 
     1359                } 
     1360                return 0; 
     1361            } 
     1362        ); 
    13541363        // Build's own temprary files. 
    13551364        lHitList ~= lDResponseFileName; 
     
    13591368 
    13601369        // Possible ones created by compiler, linker, and librarian. 
    1361         lHitList ~= ReplaceExtention(lTargetName, "map"); 
    1362         lHitList ~= ReplaceExtention(lTargetName, "bak"); 
    1363         lHitList ~= ReplaceExtention(lTargetName, "lst"); 
     1370        lHitList ~= util.pathex.ReplaceExtention(lTargetName, "map"); 
     1371        lHitList ~= util.pathex.ReplaceExtention(lTargetName, "bak"); 
     1372        lHitList ~= util.pathex.ReplaceExtention(lTargetName, "lst"); 
    13641373 
    13651374        foreach(char[] lFilename; lHitList) 
     
    13721381                    { 
    13731382                        if (vVerbose == True) 
    1374                             writefln("  removing %s", lFilename); 
     1383                            std.stdio.writefln("  removing %s", lFilename); 
    13751384                    } 
    13761385                    std.file.remove(lFilename); 
     
    13811390    } 
    13821391 
     1392    foreach(char[] lFinal; vFinalProc) 
     1393    { 
     1394        char[] lCommandLine; 
     1395 
     1396        lCommandLine = util.str.Expand(lFinal, "Target=" ~ lTargetName ~ 
     1397                                               ",TargetPath=" ~ std.path.getDirName(lTargetName) ~ 
     1398                                               ",TargetBase=" ~ std.path.getBaseName(lTargetName) 
     1399                         ); 
     1400        if (lCommandLine.length > 0) 
     1401        { 
     1402            util.fileex.RunCommand(lCommandLine); 
     1403        } 
     1404    } 
    13831405    return lRunResult; 
    13841406 
     
    13941416    { 
    13951417        version(Posix) 
    1396             vCompilerDefs ~= vImportPath ~ "\"" ~ lRoot ~ "\""
     1418            AddCompilerArg( vImportPath ~ "\"" ~ lRoot ~ "\"" )
    13971419        version(Windows) 
    1398             vCompilerDefs ~= vImportPath ~ lRoot; 
    1399     } 
    1400  
    1401     foreach(char[] lArg; vCompilerDefs) 
    1402     { 
    1403         AddCompilerArg( lArg ); 
     1420            AddCompilerArg( vImportPath ~ lRoot ); 
    14041421    } 
    14051422 
     
    14831500            { 
    14841501                if (vVerbose == True) 
    1485                     writefln("Multiple pragma(target,...) detected. '%s' will be used and '%s' rejected.", 
     1502                    std.stdio.writefln("Multiple pragma(target,...) detected. '%s' will be used and '%s' rejected.", 
    14861503                                    vPragmaTargetName, pPath ); 
    14871504            } 
     
    15571574    char[] lSearchName; 
    15581575 
    1559     if(pRootName.length == 0) { 
     1576    if(pRootName.length == 0) 
    15601577        return pRootName; 
    1561     } 
    1562     else { 
     1578 
    15631579    lFullName = util.pathex.CanonicalPath(pRootName); 
    15641580    version(Windows) lSearchName = std.string.tolower(lFullName); 
     
    15721588    else 
    15731589        return ""; 
    1574 
     1590 
    15751591} 
    15761592 
     
    16451661                *vDelayedValue = lSwitch; 
    16461662                vDelayedValue = null; 
    1647                 vBuildArgs ~= lSwitch; 
     1663                vReceivedArgs[$-1].ArgText ~= " " ~ lSwitch; 
    16481664                continue; 
    16491665            } 
     1666 
     1667            vReceivedArgs.length = vReceivedArgs.length + 1; 
     1668            vReceivedArgs[$-1].ArgText = lSwitch.dup; 
     1669            vReceivedArgs[$-1].CompilerArg = False; 
     1670            vReceivedArgs[$-1].DFlag = True; 
    16501671 
    16511672            if (lSwitch[1] == 'I') 
     
    16581679                    { 
    16591680                        if(vVerbose == True && lRootName.length > 0) 
    1660                                 writefln(" added root from config file %s", lRootName); 
     1681                                std.stdio.writefln(" added root from config file %s", lRootName); 
    16611682                    } 
    16621683                } 
     
    16661687                version(DigitalMars) 
    16671688                { 
    1668                 if (util.str.IsLike(lSwitch,  (vOutFileSwitch ~ "*")) == True) 
    1669                 { 
    1670                     // Target name (eg. -oftestapp) 
    1671                     vCommandTargetName = lSwitch[vOutFileSwitch.length .. $]; 
    1672                     vBuildArgs ~= lSwitch; 
    1673                     continue; 
    1674                 } 
     1689                    if (util.str.IsLike(lSwitch,  (vOutFileSwitch ~ "*")) == True) 
     1690                    { 
     1691                        // Target name (eg. -oftestapp) 
     1692                        vCommandTargetName = lSwitch[vOutFileSwitch.length .. $]; 
     1693                        continue; 
     1694                    } 
    16751695                } 
    16761696 
     
    16811701                        // Target name (eg. -o testapp) 
    16821702                        vDelayedValue = &vCommandTargetName; 
    1683                         vBuildArgs ~= lSwitch; 
    16841703                        continue; 
    16851704                    } 
     
    16911710 
    16921711                    vTemporaryPath = lSwitch[vOutputPath.length .. $]; 
    1693                     if (vTemporaryPath.length > 0 && vTemporaryPath[$-1..$] != std.path.sep) 
     1712 
     1713                    if (vTemporaryPath.length == 0) 
     1714                    { 
     1715                        vTemporaryPath = std.path.curdir; 
     1716                    } 
     1717                    if (util.str.ends(vTemporaryPath, std.path.sep) == False) 
    16941718                        vTemporaryPath ~= std.path.sep; 
    16951719 
     1720                    vTemporaryPath = AddRoot(vTemporaryPath); 
     1721                    // The path was added to the list of import roots. 
     1722                    version(BuildVerbose) 
     1723                    { 
     1724                        if(vVerbose == True) 
     1725                            std.stdio.writefln("Added root from config file Object Write Path = %s",vTemporaryPath); 
     1726                    } 
     1727                    util.pathex.MakePath(vTemporaryPath); 
     1728 
     1729                    // This one actually *is* passed thru. 
    16961730                    version(DigitalMars) 
    16971731                    { 
    1698                         lbRoot = AddRoot(vTemporaryPath); 
    1699                         if (lbRoot.length > 0){ 
    1700                             version(BuildVerbose) 
    1701                             { 
    1702                                 if(vVerbose == True) 
    1703                                     writefln("Added root from config file Object Write Path = %s",lbRoot); 
    1704                             } 
    1705                             util.pathex.MakePath(lbRoot); 
    1706                         } 
    1707                     } 
    1708  
    1709                     vBuildArgs ~= lSwitch; 
    1710                     // This one actually *is* passed thru. 
    1711                 } 
    1712  
    1713                 AddCompilerArg ( lSwitch ); 
     1732                        // Ensure we don't have both -op and -od when using dmd. 
     1733                        RemoveRecdArg("-op"); 
     1734                    } 
     1735                } 
     1736                vReceivedArgs[$-1].CompilerArg = True; 
    17141737            } 
    17151738        } 
     
    17301753        { 
    17311754            if (vVerbose == True) 
    1732                 writefln("Analyzing environment symbol DFLAGS=%s", lSymValue); 
     1755                std.stdio.writefln("Analyzing environment symbol DFLAGS=%s", lSymValue); 
    17331756        } 
    17341757 
     
    17411764// ------------------------------------------- 
    17421765{ 
    1743     char[]   lPath; 
     1766    char[]   lConfigPath; 
    17441767    char[][] lTextLines; 
    17451768    int      lPos; 
     
    17521775 
    17531776    if (vOverrideConfigPath.length > 0) 
    1754         lPath = vOverrideConfigPath ~ vConfigFile ; 
     1777        lConfigPath = vOverrideConfigPath ~ vConfigFile ; 
    17551778    else 
    1756         lPath = vConfigPath ~ vConfigFile ; 
     1779        lConfigPath = vConfigPath ~ vConfigFile ; 
    17571780    version(BuildVerbose) 
    17581781    { 
    17591782        if (vVerbose == True) 
    1760             writefln("Reading from config: %s", lPath); 
    1761     } 
    1762     util.fileex.GetTextLines(lPath, lTextLines, util.fileex.GetOpt.Exists); 
     1783            std.stdio.writefln("Reading from config: %s", lConfigPath); 
     1784    } 
     1785    util.fileex.GetTextLines(lConfigPath, lTextLines, util.fileex.GetOpt.Exists); 
    17631786 
    17641787 
     
    17721795        { 
    17731796            if (vVerbose == True) 
    1774                 writefln(" Line %d: %s", i+1, lLine); 
     1797                std.stdio.writefln(" Line %d: %s", i+1, lLine); 
    17751798        } 
    17761799 
     
    18201843            { 
    18211844                if(vVerbose == True) 
    1822                     writefln(" use %s",vLibPaths); 
     1845                    std.stdio.writefln(" use %s",vLibPaths); 
    18231846            } 
    18241847            continue; 
     
    18871910        if(vVerbose == True) 
    18881911        { 
    1889             writefln(" %s path '%s'",pType, pFilePath); 
    1890             writefln(" %s is '%s'",pType, pFileExe); 
     1912            std.stdio.writefln(" %s path '%s'",pType, pFilePath); 
     1913            std.stdio.writefln(" %s is '%s'",pType, pFileExe); 
    18911914        } 
    18921915    } 
     
    19001923    if (pList.length > 0) { 
    19011924        if (pTitle.length > 0) 
    1902             writefln("\n%s",pTitle); 
     1925            std.stdio.writefln("\n%s",pTitle); 
    19031926 
    19041927        foreach(int lIndex, char[] lListEntry; pList) { 
    1905             writefln(" [%2d]: %s",lIndex,lListEntry); 
     1928            std.stdio.writefln(" [%2d]: %s",lIndex,lListEntry); 
    19061929        } 
    19071930    } 
     
    19091932 
    19101933// ------------------------------------------- 
    1911 void DisplayItems(ExternRef[] pList, char[] pTitle = "") 
     1934void DisplayItems(source.ExternRef[] pList, char[] pTitle = "") 
    19121935// ------------------------------------------- 
    19131936{ 
    19141937    if (pList.length > 0) { 
    19151938        if (pTitle.length > 0) 
    1916             writefln("\n%s",pTitle); 
    1917  
    1918         foreach(int lIndex, ExternRef lListEntry; pList) 
    1919         { 
    1920             writef(" [%2d]: %s",lIndex,lListEntry.FilePath); 
     1939            std.stdio.writefln("\n%s",pTitle); 
     1940 
     1941        foreach(int lIndex, source.ExternRef lListEntry; pList) 
     1942        { 
     1943            std.stdio.writef(" [%2d]: %s",lIndex,lListEntry.FilePath); 
    19211944            if (lListEntry.ToolOpts.length > 0) 
    19221945                foreach(char[] lOpt; lListEntry.ToolOpts) 
    1923                     writef(" [%s]",lOpt); 
    1924             writefln(""); 
    1925         } 
    1926     } 
    1927 
    1928  
    1929 // ------------------------------------------------ 
    1930 char[] GetTemporaryPath() 
    1931 
    1932     return vTemporaryPath; 
     1946                    std.stdio.writef(" [%s]",lOpt); 
     1947            std.stdio.writefln(""); 
     1948        } 
     1949    } 
     1950
     1951 
     1952// ------------------------------------------- 
     1953void DisplayItems(CmdLineArg[] pList, char[] pTitle = "") 
     1954// ------------------------------------------- 
     1955
     1956    if (pList.length > 0) { 
     1957        if (pTitle.length > 0) 
     1958            std.stdio.writefln("\n%s",pTitle); 
     1959 
     1960        foreach(int lIndex, CmdLineArg lListEntry; pList) 
     1961        { 
     1962            if (lListEntry.ArgText.length > 0) 
     1963            { 
     1964                std.stdio.writef(" [%2d]: %s",lIndex,lListEntry.ArgText); 
     1965                if (lListEntry.DFlag == True) 
     1966                    std.stdio.writef(" (DFLAG)"); 
     1967                if (lListEntry.CompilerArg == True) 
     1968                    std.stdio.writef(" (COMPILER)"); 
     1969                std.stdio.writefln(""); 
     1970            } 
     1971        } 
     1972    } 
    19331973} 
    19341974 
     
    20042044} 
    20052045 
     2046void RemoveRecdArg(char[] pArg) 
     2047{ 
     2048    // Remove all matching received args. 
     2049    for(int i = vReceivedArgs.length - 1; i >= 0; i--) 
     2050    { 
     2051        if (pArg[$-1] == '*') 
     2052        { 
     2053            if (util.str.begins(vReceivedArgs[i].ArgText, pArg[0..$-1]) == True) 
     2054            { 
     2055                vReceivedArgs[i].ArgText = ""; 
     2056                vReceivedArgs[i].CompilerArg = False; 
     2057            } 
     2058        } 
     2059        else if (vReceivedArgs[i].ArgText == pArg) 
     2060        { 
     2061            vReceivedArgs[i].ArgText = ""; 
     2062            vReceivedArgs[i].CompilerArg = False; 
     2063        } 
     2064    } 
     2065} 
    20062066 
    20072067// ------------------------------- 
     
    20092069// ------------------------------- 
    20102070{ 
     2071    // Remove any explicitly-requested args. 
     2072    for(int j = pArgGroup.length-1; j >= 0; j--) 
     2073    { 
     2074        if (pArgGroup[j].length > 2 && 
     2075            pArgGroup[j][0..2] == "--") 
     2076        { 
     2077            char[] lArg; 
     2078            lArg = pArgGroup[j][1..$]; 
     2079            for(int i = j-1; i >= 0; i--) 
     2080            { 
     2081                if (lArg[$-1] == '*') 
     2082                { 
     2083                    if (util.str.begins(pArgGroup[i], lArg[0..$-1]) == True) 
     2084                    { 
     2085                        pArgGroup[i] = ""; 
     2086                        break; 
     2087                    } 
     2088                } 
     2089                else if (pArgGroup[i] == lArg) 
     2090                { 
     2091                    pArgGroup[i] = ""; 
     2092                    break; 
     2093                } 
     2094            } 
     2095            pArgGroup[j] = ""; 
     2096        } 
     2097    } 
     2098 
    20112099    foreach(char[] lArg; pArgGroup) 
    20122100    { 
    2013         ProcessCmdLineArg( lArg ); 
     2101        if (lArg.length > 0) 
     2102            ProcessCmdLineArg( lArg ); 
     2103    } 
     2104 
     2105    // Collect out the args that are to be passed to the compiler. 
     2106    foreach(CmdLineArg lArg; vReceivedArgs) 
     2107    { 
     2108        if (lArg.CompilerArg == True) 
     2109            AddCompilerArg(lArg.ArgText); 
    20142110    } 
    20152111} 
     
    20372133    source.GetFullPathname  = &GetFullPathname; 
    20382134    source.GetFullPathnameScan = &GetFullPathnameScan; 
    2039     source.GetObjWritePath  = &GetTemporaryPath; 
    20402135    source.AddCompilerArg   = &AddCompilerArg; 
    20412136    source.GetAppPath       = &GetAppPath; 
     
    20622157 
    20632158    // Strip off application's path from arglist. 
    2064     vAppPath=pArgs[0]; 
    2065     vAppName=getBaseName(vAppPath); 
     2159    vAppPath = pArgs[0]; 
     2160    vAppName = std.path.getBaseName(vAppPath); 
    20662161    version (Windows) 
    20672162    { 
    20682163        int DotPos; 
    2069         DotPos = rfind(vAppName, '.'); 
     2164        DotPos = std.string.rfind(vAppName, '.'); 
    20702165        if (DotPos != -1) 
    20712166        { 
     
    20942189    { 
    20952190        source.vVerboseMode = vVerbose; 
     2191 
    20962192        util.fileex.vVerbose = vVerbose; 
     2193 
    20972194        if (vVerbose == True) 
    2098             writefln("*** build v%s (build %d)***", vAppVersion, build_bn.auto_build_number); 
    2099     } 
     2195            std.stdio.writefln("*** build v%s (build %d)***", vAppVersion, build_bn.auto_build_number); 
     2196    } 
     2197 
     2198    ExamineArgs( vCombinedArgs ); 
     2199 
    21002200    util.fileex.vTestRun = vTestRun; 
    2101  
    2102     ExamineArgs( vCombinedArgs ); 
    2103  
    2104     source.mCollectUses = vCollectUses; 
     2201    source.mCollectUses  = vCollectUses; 
    21052202    source.vForceCompile = vForceCompile; 
     2203    source.ObjWritePath  = vTemporaryPath; 
    21062204 
    21072205    // Grab the external macro definitions unless otherwise told not to. 
     
    21222220    { 
    21232221        if ((vVerbose == True) || (vNames == True) ) 
    2124             writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 
     2222            std.stdio.writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 
    21252223    } else { 
    21262224        if (vNames == True) 
    2127             writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 
     2225            std.stdio.writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 
    21282226    } 
    21292227 
     
    21332231        { 
    21342232            if (vVerbose == True) 
    2135                 writefln("%s not found in PATH symbol, so assuming current directory", 
     2233                std.stdio.writefln("%s not found in PATH symbol, so assuming current directory", 
    21362234                        vCompilerExe); 
    21372235        } 
     
    21942292    { 
    21952293        if (vVerbose == True) 
    2196             writefln("Compiler installed in %s",vCompilerPath); 
     2294            std.stdio.writefln("Compiler installed in %s",vCompilerPath); 
    21972295    } 
    21982296 
     
    22102308        { 
    22112309            vDefaultLibs ~= "c"; 
    2212             vDefaultLibs ~= "phobos"; 
     2310            version(DigitalMars) 
     2311            { 
     2312                vDefaultLibs ~= "phobos"; 
     2313            } 
     2314            version(GNU) 
     2315            { 
     2316                vDefaultLibs ~= "gphobos"; 
     2317            } 
     2318            vDefaultLibs ~= "pthread"; 
    22132319            vDefaultLibs ~= "m"; 
    22142320        } 
     
    22422348        { 
    22432349            if (vSilent == False) 
    2244                 writefln("** File '%s' not found.", lFile); 
     2350                std.stdio.writefln("** File '%s' not found.", lFile); 
    22452351            lAllExist = false; 
    22462352        } 
     
    22592365        if(vVerbose == True) 
    22602366        { 
    2261             writefln(""); 
    2262             DisplayItems(vBuildArgs,      "build args: ..............."); 
     2367            std.stdio.writefln(""); 
     2368            DisplayItems(vReceivedArgs,   "build args: ..............."); 
    22632369            DisplayItems(vCompilerArgs,   "compiler args: ................"); 
    22642370            DisplayItems(vCmdLineSourceFiles,   "command line files: ..............."); 
    2265             DisplayItems(Source.AllFiles, 
     2371            DisplayItems(source.Source.AllFiles, 
    22662372                                          "source files: ..............."); 
    22672373            DisplayItems(vLinkFiles.keys, "link files: ..............."); 
     
    22802386        char[] lSymbolOutName; 
    22812387 
    2282         foreach(Source lSource; Source) 
    2283         { 
    2284             if (lSource.Ignore) 
    2285                 continue; 
    2286             if (lSource.NoLink) 
    2287                 continue; 
    2288             if (lSource.ModuleName.length == 0) 
    2289                 continue; 
    2290  
    2291             if (lModuleCount == 0) 
    2292             { 
    2293                 lSymbolData ~= vModOutPrefix; 
    2294             } 
    2295             lModuleCount++; 
    2296  
    2297             if (lModuleCount > 1) 
    2298             { 
    2299                 lSymbolData ~= vModOutDelim; 
    2300             } 
    2301  
    2302             lSymbolData ~= util.str.Expand(vModOutBody, "mod=" ~ lSource.ModuleName 
    2303                                                 ~ "," ~ "src=" ~ lSource.FileName 
    2304                                            ); 
    2305         } 
     2388        source.Source.AllFiles( 
     2389            delegate int (inout int i, inout source.Source lSource) 
     2390            { 
     2391                if (lSource.Ignore) 
     2392                    return 0; 
     2393                if (lSource.NoLink) 
     2394                    return 0; 
     2395                if (lSource.ModuleName.length == 0) 
     2396                    return 0; 
     2397 
     2398                if (lModuleCount == 0) 
     2399                { 
     2400                    lSymbolData ~= vModOutPrefix; 
     2401                } 
     2402                lModuleCount++; 
     2403 
     2404                if (lModuleCount > 1) 
     2405                { 
     2406                    lSymbolData ~= vModOutDelim; 
     2407                } 
     2408 
     2409                lSymbolData ~= util.str.Expand(vModOutBody, "mod=" ~ lSource.ModuleName 
     2410                                                    ~ "," ~ "src=" ~ lSource.FileName 
     2411                                               ); 
     2412            return 0; 
     2413            } 
     2414        ); 
    23062415        if (lModuleCount != 0) 
    23072416        { 
     
    23122421            vSymbolOutName = util.pathex.GetBaseName(vTargetName) ~ vModOutFile; 
    23132422 
    2314         // ensure requested path exists. 
    2315         util.pathex.MakePath(vSymbolOutName); 
    2316  
    2317         // write out the data buffer to disk. 
    2318         std.file.write(vSymbolOutName, lSymbolData); 
     2423        if (vTestRun == False) 
     2424        { 
     2425            // ensure requested path exists. 
     2426            util.pathex.MakePath(vSymbolOutName); 
     2427 
     2428            // write out the data buffer to disk. 
     2429            std.file.write(vSymbolOutName, lSymbolData); 
     2430        } 
     2431        else 
     2432        { 
     2433            std.stdio.writefln("Modules: %s", vSymbolOutName); 
     2434        } 
    23192435    } 
    23202436 
     
    23262442        lPrevLine.length = 0; 
    23272443        lFile ~= "[USES]\n"; 
    2328         foreach(char[] lLine; Source.Uses.sort) 
     2444        foreach(char[] lLine; source.Source.Uses.sort) 
    23292445        { 
    23302446            if (lLine != lPrevLine) 
     
    23372453        lPrevLine.length = 0; 
    23382454        lFile ~= "[USEDBY]\n"; 
    2339         foreach(char[] lLine; Source.UsedBy.sort) 
     2455        foreach(char[] lLine; source.Source.UsedBy.sort) 
    23402456        { 
    23412457            if (lLine != lPrevLine) 
     
    23492465            vUsesOutput = util.pathex.GetBaseName(vTargetName) ~ ".use"; 
    23502466 
    2351         std.file.write(vUsesOutput, lFile); 
     2467        if (vTestRun == False) 
     2468        { 
     2469            // ensure requested path exists. 
     2470            util.pathex.MakePath(vUsesOutput); 
     2471            std.file.write(vUsesOutput, lFile); 
     2472        } 
     2473        else 
     2474        { 
     2475            std.stdio.writefln("Uses: %s", vUsesOutput); 
     2476        } 
     2477 
    23522478 
    23532479    } 
     
    23592485        // Put at one blank line out first to separate it 
    23602486        // from compiler console output. 
    2361         writefln(""); 
    2362  
    2363         RunCommand( util.pathex.CanonicalPath(vTargetExe, false), 
     2487        std.stdio.writefln(""); 
     2488 
     2489        util.fileex.RunCommand( util.pathex.CanonicalPath(vTargetExe, false), 
    23642490                     std.string.strip(vRunParms)); 
    23652491    } 
     
    23932519    { 
    23942520        if (pVerbose == True) 
    2395             writefln("Response file %s", lRespFileName); 
     2521            std.stdio.writefln("Response file %s", lRespFileName); 
    23962522    } 
    23972523 
     
    24132539            { 
    24142540                if (pVerbose == True) 
    2415                     writefln("Response file arg: %s", lArg); 
     2541                    std.stdio.writefln("Response file arg: %s", lArg); 
    24162542            } 
    24172543            GatherOneArg( lArg, vCombinedArgs ); 
     
    24192545    } 
    24202546} 
     2547 
     2548struct CmdLineArg 
     2549{ 
     2550    char[] ArgText; 
     2551    Bool   CompilerArg; 
     2552    Bool   DFlag; 
     2553} 
     2554CmdLineArg[] vReceivedArgs; 
    24212555 
    24222556void ProcessCmdLineArg( char[] pArg ) 
     
    24542588    } 
    24552589 
     2590    if (pArg[0] == '-') 
     2591    { 
     2592        vReceivedArgs.length = vReceivedArgs.length + 1; 
     2593        vReceivedArgs[$-1].ArgText = pArg.dup; 
     2594        vReceivedArgs[$-1].CompilerArg = False; 
     2595        vReceivedArgs[$-1].DFlag = False; 
     2596    } 
     2597 
    24562598    switch(pArg) { 
    24572599        case "-full": 
    24582600            vForceCompile = True; 
    2459             vBuildArgs ~= pArg; 
    24602601            // Not passed thru. 
    24612602            break; 
    24622603 
    24632604        case "-link": 
    2464             Source.WasMainFound = true; 
    2465             vBuildArgs ~= pArg; 
     2605            source.Source.WasMainFound = true; 
    24662606            // Not passed thru. 
    24672607            break; 
     
    24692609        case "-nolink": 
    24702610            vNoLink = True; 
    2471             vBuildArgs ~= pArg; 
    24722611            // Not passed thru. 
    24732612            break; 
     
    24752614        case "-lib": 
    24762615            vLibraryAction = LibOpt.Build; 
    2477             vBuildArgs ~= pArg; 
    24782616            // Not passed thru. 
    24792617            break; 
     
    24812619        case "-nolib": 
    24822620            vLibraryAction = LibOpt.DontBuild; 
    2483             vBuildArgs ~= pArg; 
    24842621            // Not passed thru. 
    24852622            break; 
     
    24882625            vLibraryAction = LibOpt.DontBuild; 
    24892626            vNoLink = True; 
    2490             vBuildArgs ~= pArg; 
    24912627            // Not passed thru. 
    24922628            break; 
     
    24952631            // Not passed thru. Deprecated switch is now ignored. 
    24962632            if (vSilent == False) 
    2497                 writefln("Note: '-nounittest' ignored. This switch is no longer used."); 
     2633                std.stdio.writefln("Note: '-nounittest' ignored. This switch is no longer used."); 
    24982634            break; 
    24992635 
    25002636        case "-info": 
    25012637            DisplayUsage(false); 
    2502             vBuildArgs ~= pArg; 
    25032638            // Not passed thru. 
    25042639            break; 
     
    25062641        case "-silent": 
    25072642            vSilent = True; 
    2508             vBuildArgs ~= pArg; 
    25092643            // Not passed thru. 
    25102644            break; 
     
    25122646        case "-noautoimport": 
    25132647            vAutoImports = False; 
    2514             vBuildArgs ~= pArg; 
    25152648            // Not passed thru 
    25162649            break; 
     
    25182651        case "-nodef": 
    25192652            vNoDef = True; 
    2520             vBuildArgs ~= pArg; 
    25212653            // Not passed thru. 
    25222654            break; 
     
    25242656        case "-nomacro": 
    25252657            vMacroInput = False; 
    2526             vBuildArgs ~= pArg; 
    25272658            // Not passed thru. 
    25282659            break; 
     
    25332664        case "-?": 
    25342665            DisplayUsage(); 
    2535             vBuildArgs ~= pArg; 
    25362666            // Not passed thru. 
    25372667            break; 
     
    25392669        case "-allobj": 
    25402670            vAllObjects = True; 
    2541             vBuildArgs ~= pArg; 
    25422671            // Not passed thru. 
    25432672            break; 
     
    25452674        case "-test": 
    25462675            vTestRun = True; 
    2547             vBuildArgs ~= pArg; 
    25482676            // Not passed thru. 
    25492677            break; 
     
    25532681        case "-clean": 
    25542682            vCleanup = True; 
    2555             vBuildArgs ~= pArg; 
    25562683            // Not passed thru. 
    25572684            break; 
    25582685 
    25592686        case "-V": /* we need verbose status earlier */ 
    2560             vBuildArgs ~= pArg; 
    25612687            // Not passed thru. 
    25622688            break; 
    25632689 
    25642690        case "-names": 
    2565             vBuildArgs ~= pArg; 
    25662691            vNames = True; 
    25672692            // Not passed thru. 
     
    25762701                    // Requires symbolic debug info. 
    25772702                    vLinkerDefs ~= vSymInfoSwitch; 
    2578                     AddCompilerArg(pArg)
     2703                    vReceivedArgs[$-1].CompilerArg = True
    25792704                    break; 
    25802705                } 
     
    25842709                { 
    25852710                    vLibrarianOpts ~= " " ~ pArg[7..$].dup; 
    2586                     vBuildArgs ~= pArg; 
    25872711                    break; 
    25882712 
     
    25922716                { 
    25932717                    vLibPaths ~= vConfigSep ~ pArg[9..$].dup; 
    2594                     vBuildArgs ~= pArg; 
    25952718                    break; 
    25962719                } 
     
    26142737                        ProcessOneBuildConfig("+" ~ lSubSection, False, lFile, lLocalArgs); 
    26152738                    } 
    2616                     vBuildArgs ~= pArg; 
    26172739                    ExamineArgs(lLocalArgs); 
    26182740                    break; 
     
    26352757                        vSymbolOutName = pArg[8..$]; 
    26362758                    } 
    2637                     vBuildArgs ~= pArg; 
    26382759                    // Not passed thru. 
    26392760                    break; 
     
    26492770                    { 
    26502771                        if (vVerbose == True) 
    2651                             writefln("DCPATH was %s now %s", vCompilerPath, lNewPath); 
     2772                            std.stdio.writefln("DCPATH was %s now %s", vCompilerPath, lNewPath); 
    26522773                    } 
    26532774                    vCompilerPath = lNewPath; 
    26542775                    util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 
    2655                     vBuildArgs ~= pArg; 
    26562776                    break; 
    26572777 
     
    26662786                    { 
    26672787                        if (vVerbose == True) 
    2668                             writefln("CFPATH was %s now %s", vConfigPath, lNewPath); 
     2788                            std.stdio.writefln("CFPATH was %s now %s", vConfigPath, lNewPath); 
    26692789                    } 
    26702790                    vOverrideConfigPath = lNewPath; 
    2671                     vBuildArgs ~= pArg; 
    26722791                    util.str.SetEnv("@P", std.path.getDirName(vOverrideConfigPath)); 
    26732792                    break; 
     
    26812800                    { 
    26822801                        if (vVerbose == True) 
    2683                             writefln("Added %s to Source Scan List", lNewPath); 
    2684                     } 
    2685  
    2686                     vBuildArgs ~= pArg; 
     2802                            std.stdio.writefln("Added %s to Source Scan List", lNewPath); 
     2803                    } 
     2804 
    26872805                    if ( util.str.ends(lNewPath, std.path.sep) == False) 
    26882806                        lNewPath ~= std.path.sep; 
     
    26972815                    { 
    26982816                        if (vVerbose == True) 
    2699                             writefln("RDF was %s now %s", source.vRDFName, pArg[4..$]); 
     2817                            std.stdio.writefln("RDF was %s now %s", source.vRDFName, pArg[4..$]); 
    27002818                    } 
    27012819 
    27022820                    source.vRDFName = pArg[4..$].dup; 
    2703                     vBuildArgs ~= pArg; 
    27042821                    break; 
    27052822 
     
    27112828                    { 
    27122829                        if (vVerbose == True) 
    2713                             writefln("MDF was %s now %s", vDefMacroDefFile, pArg[4..$]); 
     2830                            std.stdio.writefln("MDF was %s now %s", vDefMacroDefFile, pArg[4..$]); 
    27142831                    } 
    27152832 
    27162833                    vDefMacroDefFile = pArg[4..$].dup; 
    2717                     vBuildArgs ~= pArg; 
    27182834                    break; 
    27192835 
     
    27232839                { 
    27242840                    vDelayedValue = &lImportSwitch; 
    2725                     vBuildArgs ~= pArg; 
    27262841                    break; 
    27272842                } 
     
    27382853                            { 
    27392854                                if(vVerbose == True) 
    2740                                     writefln("Added root from command line = %s",lRoot); 
     2855                                    std.stdio.writefln("Added root from command line = %s",lRoot); 
    27412856                            } 
    27422857                        } 
     
    27492864                    vRunParms ~= pArg[vRunSwitch.length .. $] ~ " "; 
    27502865                    vExecuteProgram = True; 
    2751                     vBuildArgs ~= pArg; 
    27522866                    break; 
    27532867                } 
     
    27572871 
    27582872                    vCollectUses = True; 
    2759                     vBuildArgs ~= pArg; 
    27602873                    if (pArg.length > 5) 
    27612874                    { 
     
    27712884                { 
    27722885 
    2773                     vBuildArgs ~= pArg; 
    27742886                    vUseModBaseName = util.str.YesNo(pArg, true); 
    2775                     Source.UseModBaseName(vUseModBaseName); 
     2887                    source.Source.UseModBaseName(vUseModBaseName); 
    27762888                    break; 
    27772889                } 
     
    27812893                { 
    27822894 
    2783                     vBuildArgs ~= pArg; 
    27842895                    vAutoWinLibs = util.str.YesNo(pArg, true); 
    27852896                    break; 
     
    28022913                        { 
    28032914                            if(vVerbose == True) 
    2804                                 writefln("Added root from Object Write Path = %s",lRoot); 
     2915                                std.stdio.writefln("Added root from Object Write Path = %s",lRoot); 
    28052916                        } 
    28062917                        util.pathex.MakePath(lRoot); 
    28072918                    } 
    28082919 
    2809                     vBuildArgs ~= pArg; 
     2920 
    28102921                    // This one actually *is* passed thru. 
     2922                    version(DigitalMars) 
     2923                    { 
     2924                        // Ensure we don't have both -op and -od when using dmd. 
     2925                        RemoveRecdArg("-op"); 
     2926                    } 
    28112927                } 
    28122928                } 
     
    28162932                    // Modules to ignore (eg. -Xmylib) 
    28172933                    vModulesToIgnore ~= pArg[2..$]; 
    2818                     vBuildArgs ~= pArg; 
    28192934                    break; 
    28202935                } 
     
    28242939                    // Modules to notice (eg. -Mphobos) 
    28252940                    vModulesToNotice ~= pArg[2..$]; 
    2826                     vBuildArgs ~= pArg; 
    28272941                    break; 
    28282942                } 
     
    28312945                { 
    28322946                    // Target name (eg. -Ttestapp) 
    2833                     vCommandTargetName = pArg[2..$]; 
    2834                     vBuildArgs ~= pArg; 
     2947 
     2948                    vCommandTargetName = util.str.Expand(pArg[2..$], 
     2949                                                         "Target=" ~ 
     2950                                                 util.pathex.GetBaseName(vCommandTargetName)); 
    28352951                    break; 
    28362952                } 
     
    28422958                    // Target name (eg. -oftestapp) 
    28432959                    vCommandTargetName = pArg[vOutFileSwitch.length .. $]; 
    2844                     vBuildArgs ~= pArg; 
    28452960                    break; 
    28462961                } 
     
    28532968                    // Target name (eg. -o testapp) 
    28542969                    vDelayedValue = &vCommandTargetName; 
    2855                     vBuildArgs ~= pArg; 
    28562970                    break; 
    28572971                } 
     
    28612975                { 
    28622976                    char lValue; 
    2863                     vBuildArgs ~= pArg; 
    28642977                    // Response file usage (eg. -R=Yes) 
    28652978                    if (pArg.length == 2) 
     
    28732986                    if (util.str.IsLike(pArg,  "-gui*"d) == True) 
    28742987                    { 
    2875                             Source.WasMainGUI = true; 
    2876                             vBuildArgs ~= pArg; 
    2877                             if (pArg.length == 4) 
    2878                                 break; 
    2879                             if (pArg[4] == ':') 
    2880                                 vWinVer = pArg[5..length]; 
    2881                             else 
    2882                                 vWinVer = pArg[4..length]; 
     2988                        source.Source.WasMainGUI = true; 
     2989                        if (pArg.length == 4) 
    28832990                            break; 
     2991                        if (pArg[4] == ':') 
     2992                            vWinVer = pArg[5..length]; 
     2993                        else 
     2994                            vWinVer = pArg[4..length]; 
     2995                        break; 
    28842996                    } 
    28852997 
    28862998                    if (pArg == "-dll") 
    28872999                    { 
    2888                             Source.WasMainDLL = true; 
    2889                             vBuildArgs ~= pArg; 
    2890                             break; 
    2891                     } 
    2892                 } 
    2893  
    2894                 AddCompilerArg( pArg ); 
     3000                        source.Source.WasMainDLL = true; 
     3001                        break; 
     3002                    } 
     3003                } 
     3004 
     3005                vReceivedArgs[$-1].CompilerArg = True; 
    28953006 
    28963007            } else { 
     
    29103021                                { 
    29113022                                    if(vVerbose == True) 
    2912                                         writefln("Added root from command line = %s",lRoot); 
     3023                                        std.stdio.writefln("Added root from command line = %s",lRoot); 
    29133024                                } 
    29143025                            } 
     
    29183029                    { 
    29193030                        *vDelayedValue = pArg; 
    2920                         vBuildArgs ~= pArg; 
     3031                        vReceivedArgs[$-1].ArgText ~= " " ~ pArg; 
    29213032                    } 
    29223033                    vDelayedValue = null; 
     
    29303041                    pArg = std.string.replace(pArg, "/", std.path.sep); 
    29313042                } 
    2932  
     3043                pArg = util.pathex.AbbreviateFileName(util.pathex.CanonicalPath(pArg, false)); 
    29333044                auto lArgExt = std.path.getExt(pArg); 
    29343045                if (lArgExt == "") 
     
    29613072                    { 
    29623073                        if(vVerbose == True) 
    2963                             writefln("Default target is '%s'", std.path.getName(vTargetName)); 
     3074                            std.stdio.writefln("Default target is '%s'", std.path.getName(vTargetName)); 
    29643075                    } 
    29653076                } 
     
    29703081} 
    29713082 
    2972 bool GatherOneArg( char[] pArg, inout char[][] pArgGroup ) 
     3083void GatherOneArg( char[] pArg, inout char[][] pArgGroup ) 
    29733084{ 
    29743085    static bool[char[]] lKnownArgs; 
    2975     bool lMergeArg = false; 
    29763086 
    29773087    pArg = std.string.strip(pArg); 
    29783088    if (pArg.length == 0) 
    2979         return lMergeArg
     3089        return
    29803090 
    29813091    version(BuildVerbose) 
     
    29873097    if ( pArg.length >= 2 && pArg[0..2] == "--") 
    29883098    {   // Need to remove an earlier matching argument. 
    2989         pArg = pArg[1..$]; 
    29903099        version(BuildVerbose) 
    29913100        { 
    2992             if ((pArg == "-V") || (pArg == "-v")) 
     3101            if ((pArg == "--V") || (pArg == "--v")) 
    29933102                vVerbose = False; 
    29943103        } 
    2995  
    2996         for(int i = pArgGroup.length-1; i >= 0; i--) 
    2997         { 
    2998             if (pArg[$-1] == '*') 
    2999             { 
    3000                 if (pArgGroup[i].begins(pArg[0..$-1]) == True) 
    3001                 { 
    3002                     pArgGroup[i] = ""; 
    3003                     break; 
    3004                 } 
    3005             } 
    3006             else if (pArgGroup[i] == pArg) 
    3007             { 
    3008                 pArgGroup[i] = ""; 
    3009                 break; 
    3010             } 
    3011         } 
    3012     } 
    3013     else if ( (pArg[0] == '@') || 
     3104        // Defer removing the earlier arg until I've examined all args. 
     3105        pArgGroup ~= pArg; 
     3106        return; 
     3107    } 
     3108 
     3109 
     3110    if ( (pArg[0] == '@') || 
    30143111              (util.str.ends(pArg, "." ~ vResponseExt) is True) 
    30153112             ) 
     
    30383135    } 
    30393136 
    3040     return lMergeArg; 
    30413137} 
    30423138 
     
    30733169    } 
    30743170 
     3171    version(darwin) 
     3172    { 
     3173        ProcessBuildConfig("+darwin", lVerbose, vCombinedArgs); 
     3174    } 
     3175 
    30753176    version(Windows) 
    30763177    { 
     
    30943195            ProcessBuildConfig("+Posix:GNU", lVerbose, vCombinedArgs); 
    30953196        } 
    3096     } 
    3097  
    3098     version(DigitalMars) if (vCompilerDefs.length == 0) vCompilerDefs  ~= "-op"; 
     3197 
     3198    } 
     3199 
     3200    version(DigitalMars) 
     3201    { 
     3202        if (vCompilerDefs.length == 0) vCompilerDefs  ~= "-op"; 
     3203    } 
    30993204 
    31003205    // Collect from original command line. 
    3101     foreach( char[] lArg; pArgs) 
     3206    foreach( char[] lArg; vCompilerDefs ~ pArgs) 
    31023207    { 
    31033208        GatherOneArg( lArg, vCombinedArgs ); 
     
    31423247    { 
    31433248        if ((pVerbose == True) && util.file2.FileExists(lMacroDefFileName) ) 
    3144             writefln("Build Macro Definition file %s", lMacroDefFileName); 
     3249            std.stdio.writefln("Build Macro Definition file %s", lMacroDefFileName); 
    31453250    } 
    31463251 
    31473252    lMacroDefLines = util.fileex.GetTextLines(lMacroDefFileName, util.fileex.GetOpt.Always); 
    31483253 
    3149     AddMacros( "build", lMacroDefLines, lMessages); 
     3254    util.macro.AddMacros( "build", lMacroDefLines, lMessages); 
    31503255    version(BuildVerbose) 
    31513256    { 
     
    31543259            foreach(char[] lMsg; lMessages) 
    31553260            { 
    3156                 writefln("%s", lMsg); 
     3261                std.stdio.writefln("%s", lMsg); 
    31573262            } 
    31583263        } 
     
    31843289    { 
    31853290        if (pVerbose == True) 
    3186             writefln("Build Configuration file %s [%s]", pPath, pArg[1..$]); 
     3291            std.stdio.writefln("Build Configuration file %s [%s]", pPath, pArg[1..$]); 
    31873292    } 
    31883293 
     
    32523357                { 
    32533358                    if (pVerbose == True) 
    3254                         writefln("Build Configuration file arg: %s", lArg); 
     3359                        std.stdio.writefln("Build Configuration file arg: %s", lArg); 
    32553360                } 
    32563361 
     
    32603365                } 
    32613366 
    3262                 if (lArg.begins("CMDLINE=") == True) 
     3367                if (util.str.begins(lArg, "CMDLINE=") == True) 
    32633368                { 
    32643369                    int lStartPos; 
     
    32953400 
    32963401                } 
    3297                 else if (lArg.begins("LIBCMD=") == True) 
     3402                else if (util.str.begins(lArg, "FINAL=") == True) 
     3403                { 
     3404                    vFinalProc ~= lArg[6..$]; 
     3405                } 
     3406                else if (util.str.begins(lArg, "LIBCMD=") == True) 
    32983407                { 
    32993408                    SetFileLocation(lArg[7..$], vLibrarianPath, vLibrarian, "librarian"); 
    33003409                } 
    3301                 else if (lArg.begins("COMPCMD=") == True) 
     3410                else if (util.str.begins(lArg, "COMPCMD=") == True) 
    33023411                { 
    33033412                    SetFileLocation(lArg[8..$], vCompilerPath, vCompilerExe, "compiler"); 
    33043413                } 
    3305                 else if (lArg.begins("LINKCMD=") == True) 
     3414                else if (util.str.begins(lArg, "LINKCMD=") == True) 
    33063415                { 
    33073416                    SetFileLocation(lArg[8..$], vLinkerPath, vLinkerExe, "linker"); 
    33083417                } 
    3309                 else if (lArg.begins("LINKSWITCH=") == True) 
     3418                else if (util.str.begins(lArg, "LINKSWITCH=") == True) 
    33103419                { 
    33113420                    vLinkerDefs = lArg[11..$].dup; 
    33123421                } 
    3313                 else if (lArg.begins("INIT:") == True) 
     3422                else if (util.str.begins(lArg, "INIT:") == True) 
    33143423                { 
    33153424                    SetInternalString( lArg[5..$] ); 
     
    33193428                    { 
    33203429                        if (vVerbose == True) 
    3321                             writefln("Bad configuration command '%s' ignored.", lArg); 
     3430                            std.stdio.writefln("Bad configuration command '%s' ignored.", lArg); 
    33223431                    } 
    33233432                } 
     
    33363445    if (lPos == -1) 
    33373446    { 
    3338         writefln("Internal String Set '%s' ignored ... '=' not found.", pCommand); 
     3447        std.stdio.writefln("Internal String Set '%s' ignored ... '=' not found.", pCommand); 
    33393448        return; 
    33403449    } 
     
    34223531        case "ArgFileDelim"    : { vArgFileDelim     = lValue.dup; break; } 
    34233532        default: 
    3424             writefln("Set Internal String '%s' ignored ... unknown name.", pCommand); 
    3425     } 
    3426 } 
     3533            std.stdio.writefln("Set Internal String '%s' ignored ... unknown name.", pCommand); 
     3534    } 
     3535} 
  • trunk/Source/build_bn.d

    r48 r49  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 2208
     4long auto_build_number = 2371
  • trunk/Source/docsrc/User_Manual.d

    r48 r49  
    103103$(SECTION $(SECTIONDEF_H authors, Authors:, Derek Parnell - Melbourne)) 
    104104$(SECTION $(SECTIONDEF_H create, Initial Creation:, January 2005)) 
    105 $(SECTION $(SECTIONDEF_H version, Version:, 3.02)) 
    106 $(SECTION $(SECTIONDEF_H date, Date:, 23 June 2006)) 
     105$(SECTION $(SECTIONDEF_H version, Version:, 3.03)) 
     106$(SECTION $(SECTIONDEF_H date, Date:, 20 September 2006)) 
    107107$(SECTION $(SECTION_H license, License:) 
    108108$(CITE 
  • trunk/Source/docsrc/change_log.d

    r48 r49  
    55A list of changes and fixes that have been made. 
    66 
     7$(SUBSECTION_H ,v3.03 -- 20/September/2006 ) 
     8$(LIST 
     9    $(ITEM ** $(B FIX: Ticket #33) For unix editions, 'pthread' is 
     10    now a default library, '-g' is used instead of '/co' to generate 
     11    debug data, '-o ' is used instead of '-of', and spaces are placed 
     12    in between consecutive '-L' switches.  Note that if you want to place 
     13    library files on the command line, you still have to include the '.a' 
     14    file suffix. 
     15    ) 
     16    $(ITEM ** $(B FIX: Ticket #34) For GNU, 'gdc' is the default 
     17    linker, the library switch is now '-L-l', 'gphobos' is used instead of 
     18    'phobos', and the makefile includes the '-version=BuildVerbose' switch. 
     19    ) 
     20    $(ITEM ** $(B FIX: Ticket #35) It is now possible to use relative 
     21    paths on the command line files. 
     22    ) 
     23    $(ITEM ** $(B FIX) If you use the '-od' switch then the '-op' switch 
     24    is not used. 
     25    ) 
     26    $(ITEM ** $(B CHG: Ticket #36) The default name for the executable is 
     27     now 'bud', but you can change it to anything you like. 
     28    ) 
     29    $(ITEM ** $(B CHG: Ticket #37) Changed defaults to support GDC 
     30     out-of-the-box. 
     31    ) 
     32    $(ITEM ** $(B ENH) The utility now also checks for a '[darwin]' 
     33    section in the Configuration File. 
     34    ) 
     35    $(ITEM ** $(B ENH) The utility now supports the import syntax that 
     36    was introduced with DMD v0.163. 
     37    ) 
     38    $(ITEM ** $(B ENH) The distribution now includes example configuration 
     39    files for a number of environments. 
     40    ) 
     41    $(ITEM ** $(B ENH) The Configuration File now supports a new $(I FINAL) 
     42    command that allows you to run jobs after a successful build. 
     43    ) 
     44) 
     45 
    746$(SUBSECTION_H ,v3.02 -- 23/June/2006 ) 
    847$(LIST 
    948    $(ITEM ** $(B FIX: Ticket #27) When using 'gcc' as the linker tool, 
    10     $(I Build) now uses a space character to delimit file names. 
     49    $(I $(B the utility)) now uses a space character to delimit file names. 
    1150    ) 
    1251    $(ITEM ** $(B FIX: Ticket #28) The Optlink switch options  are now 
     
    5190    $(ITEM ** $(B ENH:) The 'Rules' functionality now ensures that the 
    5291    output file's path exists prior to running the Rule's tool application.) 
    53     $(ITEM ** $(B ENH:) The LINKCMD is now able to be used in the Build 
     92    $(ITEM ** $(B ENH:) The LINKCMD is now able to be used in the $(I $(B utility)) 
    5493    configuration file.) 
    5594    $(ITEM ** $(B ENH:) A new switch "-uses" will cause the tool to 
     
    61100$(SUBSECTION_H ,v3.00 -- 05/June/2006 ) 
    62101$(LIST 
    63     $(ITEM ** $(B FIX:) $(I Build) was using the wrong object file during 
     102    $(ITEM ** $(B FIX:) $(I $(B the utility)) was using the wrong object file during 
    64103    linkages if a target object file did not exist but one with the same name 
    65104    existed in any of the Import paths. 
    66105    ) 
    67106    $(ITEM ** $(B FIX:) With the $(I -R=No) switch, when using the Digital 
    68      Mars linker, $(I Build) was not formatting the command line correctly. 
     107     Mars linker, $(I $(B the utility)) was not formatting the command line correctly. 
    69108    ) 
    70109    $(ITEM ** $(B FIX: Ticket #10 ) The tool now recognises the 
     
    110149      $(LIST 
    111150        $(ITEM If defined, the directory defined by the $(I ConfigPath) 
    112         configuration item in $(I Build's) configuration file. And in this 
     151        configuration item in $(I the utility's) configuration file. And in this 
    113152        case it doesn't look anywhere in any of the areas listed below.) 
    114153        $(ITEM The current directory.) 
     
    118157        $(ITEM The same directory in which the compiler resides.) 
    119158        $(ITEM The directory defined by the $(I EtcPath) configuration item 
    120         in $(I Build's) configuration file.) 
     159        in $(I the utility's) configuration file.) 
    121160        ) 
    122161    ) 
     
    164203    ) 
    165204 
    166     $(ITEM ** $(B CHG: ) When building the $(I Build) application itself, 
     205    $(ITEM ** $(B CHG: ) When building the $(I $(B the utility)) application itself, 
    167206    you must now add $(B -version=BuildVerbose) to the command line if 
    168     you want an edition of $(I Build) that supports the $(B -V) $(PAREN verbose) switch. As 
    169     shipped, the pre-built editions of $(I Build) do not support 
     207    you want an edition of $(I $(B the utility)) that supports the $(B -V) $(PAREN verbose) switch. As 
     208    shipped, the pre-built editions of $(I $(B the utility)) do not support 
    170209    the $(B -V) switch. 
    171210    ) 
     
    215254    $(ITEM ** $(B FIX:) $(I Thanks to Carlos): In Unix environments, any "-version" 
    216255    switch on the Utility's command line was not being converted to the correct Unix 
    217     format of "-fversion...". So now, if the Build tool gets 
     256    format of "-fversion...". So now, if the utility gets 
    218257    either "-version..." or "-fversion=..." on its command line, it will 
    219258    recognise it as a 'Version' request for the compiler $(B and) output 
     
    371410$(SUBSECTION_H ,v2.00 -- 08/Apr/2005) 
    372411$(LIST 
    373 $(ITEM ** $(B FIX): Now supports the raw-string delimiter ` in Build's own 
     412$(ITEM ** $(B FIX): Now supports the raw-string delimiter ` in the utility's own 
    374413pragma commands. 
    375414) 
    376 $(ITEM ** $(B FIX): Now handles backslash escapes in Build's own 
     415$(ITEM ** $(B FIX): Now handles backslash escapes in the utility's own 
    377416pragma commands. 
    378417) 
     
    641680Macros: 
    642681 Copyright = &copy; 2006, Derek Parnell, Melbourne 
    643  Title = User Manual for BUILD 
    644  Product = Build Utility 
     682 Title = User Manual for bud 
     683 Product = bud Utility 
  • trunk/Source/docsrc/configuration_file.d

    r48 r49  
    4848$(CODE 
    4949LINKSWITCH=/info 
     50) 
     51 
     52$(B FINAL) $(BR) 
     53This specifies a command that will run after the target has been 
     54successfully created. There can be any number of $(I FINAL) commands 
     55in a configuration file; they are all executed, and in the order presented. 
     56$(BL) 
     57You can place special tokens in the $(I FINAL) command line and these will 
     58be replaced just before running the command line. 
     59$(TABLE 
     60  $(THEAD 
     61     $(THCELL Token) $(THCELL Replacement) 
     62   ) 
     63   $(ROW 
     64    $(CELL $(B $(BRACE Target))) $(CELL The full path and name of the target file created) 
     65    ) 
     66   $(ROW 
     67    $(CELL $(B $(BRACE TargetPath))) $(CELL The path of the target file created) 
     68    ) 
     69   $(ROW 
     70    $(CELL $(B $(BRACE TargetBase))) $(CELL The name of the target file created) 
     71    ) 
     72) 
     73$(CODE 
     74FINAL="c:\program files\upx202w\upx" --best -q {Target} >nul 
    5075) 
    5176 
     
    352377        # items that only apply when building in Posix (unix). 
    353378 
     379        $(SQR darwin) 
     380        # items that only apply when building in Macintosh Darwin (OS X). 
     381 
    354382        $(SQR DigitalMars) 
    355383        # items that only apply when building with DigitalMars tools. 
     
    381409 
    382410$(EXAMPLE , 
    383 build myapp.d +final 
    384 ) 
    385 where if a group called '[final]' is contained in any configuration 
     411build myapp.d +production 
     412) 
     413where if a group called '[production]' is contained in any configuration 
    386414file, the options in that group are used. 
    387415 
    388 $(EXAMPLE contents of [final], 
     416$(EXAMPLE contents of [production], 
    389417    # This creates a production (release) edition of the app. 
    390     [final
     418    [production
    391419    CMDLINE=-T{Target}_{Group}  # Set the name of the executable. 
    392420    CMDLINE=-release   # Don't generate runtime checks. 
  • trunk/Source/docsrc/user_manual.ddoc

    r48 r49  
    4040LP              =( 
    4141PAREN           =($0) 
     42BRACE           ={$0} 
    4243DOLLAR          =$ 
    4344BL              =<br/>&nbsp;<br/> 
  • trunk/Source/example_build.cfg

    r48 r49  
    33[Windows] 
    44LIBCMD=%@D%\..\..\dm\bin\lib.exe 
    5 CMDLINE=-Iy:\d_proj\build\trunk\source 
    6 CMDLINE=-Iy:\dlibs 
    7 CMDLINE=-Ic:\dmd\import 
     5# CMDLINE=-Iy:\d_proj\build\trunk\source 
     6# CMDLINE=-Iy:\dlibs 
     7# CMDLINE=-Ic:\dmd\import 
    88 
    99[Posix] 
    1010LIBCMD=/bin/ar 
    11 CMDLINE=-I/usr1/d_proj/build/trunk/source 
    12 CMDLINE=-I/usr2/dlibs 
    13 CMDLINE=-I/usr2/dmd/import 
     11# CMDLINE=-I/usr1/d_proj/build/trunk/source 
     12# CMDLINE=-I/usr2/dlibs 
     13# CMDLINE=-I/usr2/dmd/import 
    1414 
    1515[Windows:DigitalMars] 
     
    3737# INIT:OutFileSwitch   =  -of 
    3838# INIT:ImportPath      =  -I 
    39 # INIT:LibLinkSwitch   =  -l 
     39# INIT:LinkLibSwitch   =  -l 
    4040# INIT:LibPathSwitch   =  -L 
    4141# INIT:MapSwitch       =  -M 
     
    9292# INIT:OutFileSwitch   =  "-o " 
    9393# INIT:ImportPath      =  "-I " 
    94 # INIT:LibLinkSwitch   =  -l 
     94# INIT:LinkLibSwitch   =  -l 
    9595# INIT:LibPathSwitch   =  -L 
    9696# INIT:MapSwitch       =  -M 
     
    147147# INIT:OutFileSwitch   =  -of 
    148148# INIT:ImportPath      =  -I 
    149 # INIT:LibLinkSwitch   =  -l 
     149# INIT:LinkLibSwitch   =  -l 
    150150# INIT:LibPathSwitch   =  -L 
    151151# INIT:MapSwitch       =  -M 
     
    202202# INIT:OutFileSwitch   =  "-o " 
    203203# INIT:ImportPath      =  "-I " 
    204 # INIT:LibLinkSwitch   =  -l-L 
     204# INIT:LinkLibSwitch   =  -l-L 
    205205# INIT:LibPathSwitch   =  -L 
    206206# INIT:MapSwitch       =  -M 
  • trunk/Source/source.d

    r48 r49  
    4747private 
    4848{ 
    49     import util.str; 
    50     import util.fdt; 
    51     import util.pathex; 
    52     import util.fileex; 
    53     import util.macro; 
    54     import util.booltype; 
    55  
    56     import std.stdio; 
    57     import std.path; 
    58     import std.ctype; 
    59     import std.file; 
    60     import std.string; 
     49    static import util.str; 
     50    static import util.fdt; 
     51    static import util.pathex; 
     52    static import util.fileex; 
     53    static import util.macro; 
     54    static import util.booltype;   // definition of True and False 
     55    alias util.booltype.True True; 
     56    alias util.booltype.False False; 
     57    alias util.booltype.Bool Bool; 
     58 
     59    static import std.stdio; 
     60    static import std.path; 
     61    static import std.ctype; 
     62    static import std.file; 
     63    static import std.string; 
    6164} 
    6265 
     
    7578    void function(char[] pPath) AddTarget; 
    7679    void function(char[] pPath) AddLink; 
    77     void function(char[] pPath, char[][] pOpts) AddExternal; 
    7880    void function(char[] pText, bool pReplace=false) AddBuildDef; 
    7981    char[][] function( ) ModulesToIgnore; 
    8082    char[] function(char[] pFile, char[][] pScanList = null) GetFullPathname; 
    8183    char[] function(char[] pFile, int pScanList) GetFullPathnameScan; 
    82     char[] function() GetObjWritePath; 
    8384    char[] function() GetAppPath; 
    8485 
     
    8788    Bool    mCollectUses; 
    8889    Bool    vForceCompile; 
     90    char[]  ObjWritePath; 
    8991    char[]  vRDFName = "default.rdf"; 
    9092    char[]  vPathId; 
     
    201203            } 
    202204            int FileCount() { return smSourceIndex.length; } 
     205 
    203206            Source opIndex(char[] pFileName) 
    204207            { 
     
    211214            } 
    212215 
    213             int opApply(int delegate(inout int lCnt, inout Source) dg) 
     216            int AllFiles(int delegate(inout int lCnt, inout Source) dg) 
    214217            { 
    215218                int result = 0; 
     
    226229            } 
    227230 
    228             int opApply(int delegate(inout Source) dg) 
     231            /* int AllFiles(int delegate(inout Source) dg) 
    229232            { 
    230233                int result = 0; 
     
    238241                return result; 
    239242            } 
    240  
     243*/ 
    241244            char[][] AllFiles() 
    242245            { 
     
    363366        if (std.path.getExt(pFileName) != "ddoc") 
    364367        { 
     368            char[] lAltName; 
    365369            mNoLink = (std.path.getExt(pFileName) == "di"); 
    366             mModuleName = FileToModulename(pFileName); 
     370            mModuleName = FileToModulename(pFileName, lAltName); 
    367371            lObjectName = addExt(pFileName,ObjExt); 
    368372            mObjectName = util.pathex.AbbreviateFileName(util.pathex.CanonicalPath(lObjectName, false)); 
     
    376380        } 
    377381 
    378         version(DigitalMars) 
    379         { 
    380             /* If a specific path for object files has been supplied 
    381                on the command line, and the current source file is 
    382                relative to the current directory, then we need to 
    383                prepend the specified object location path. 
    384             */ 
    385             if (GetObjWritePath().length != 0 && mObjectName.length != 0) 
    386             { 
    387                 if (mObjectName == lObjectName) 
    388                 { 
    389                     mObjectName = GetObjWritePath() ~ mObjectName; 
    390                     util.pathex.MakePath(mObjectName); 
    391                 } 
     382        /* If a specific path for object files has been supplied 
     383           on the command line, and the current source file is 
     384           relative to the current directory, then we need to 
     385           prepend the specified object location path. 
     386        */ 
     387        if (ObjWritePath.length != 0 && mObjectName.length != 0) 
     388        { 
     389            if (mObjectName == lObjectName) 
     390            { 
     391                mObjectName = ObjWritePath ~ std.path.getBaseName(mObjectName); 
     392                version(none) 
     393                { 
     394                    foreach(int i, inout char c; mObjectName) 
     395                    { 
     396                        if (c == ':' && i > 1) 
     397                            c = '\\'; 
     398                    } 
     399                } 
     400                util.pathex.MakePath(mObjectName); 
    392401            } 
    393402        } 
     
    400409        mBuildNumber = -1; 
    401410 
    402         mFileTime = util.fdt.GetFileTime(pFileName); 
     411        mFileTime = new util.fdt.FileDateTime(pFileName); 
    403412        mDependantsTime  = mFileTime; 
    404413 
    405         mObjectTime   = util.fdt.GetFileTime(mObjectName); 
     414        mObjectTime   = new util.fdt.FileDateTime(mObjectName); 
    406415        UpdateDependantTime(mObjectTime); 
    407416        version(BuildVerbose) 
     
    435444// -------------------------------------------------------------------- 
    436445    { 
    437         char[] [] lFiles; 
    438446        FileDateTime lCurFileTime; 
    439447        bool lCanUse; 
     
    485493                    } 
    486494                    new Source(lNewFile); 
     495                    delete lFileText; 
    487496                    return; 
    488497                } 
     
    491500            // Extract all the module references. 
    492501            ProcessTokens(lFileText, lTextPos); 
     502            delete lFileText; // Remove it from GC control. 
    493503 
    494504            lCurFileTime = new FileDateTime(); 
     
    669679        mBuildNumber++; 
    670680 
    671         std.file.write(lFileName, 
    672             std.string.format( 
    673             "module %s;\n" 
    674             "// This file is automatically maintained by the BUILD utility,\n" 
    675             "// Please refrain from manually editing it.\n" 
    676             "long auto_build_number = %d;\n", 
    677                     FileToModulename(lFileName), 
     681        { 
     682            char[] lAltName; 
     683            std.file.write(lFileName, 
     684                std.string.format( 
     685                "module %s;\n" 
     686                "// This file is automatically maintained by the BUILD utility,\n" 
     687                "// Please refrain from manually editing it.\n" 
     688                "long auto_build_number = %d;\n", 
     689                    FileToModulename(lFileName, lAltName), 
    678690                    mBuildNumber) 
    679             ); 
     691                ); 
     692        } 
    680693 
    681694        if (! (lFileName in smSourceIndex) ) 
     
    11311144 
    11321145        // import lModName.lModName, lModName, lModName.lModName.lModName; 
     1146        // import name = module : method, method, ... ; 
     1147        // import name1 = mod1, name2 = mod2, ... ; 
    11331148 
    11341149        while ((lSavedPos = pPos, 
     
    11361151                   && (lCurrentToken != ";")) 
    11371152        { 
    1138             if ( (lCurrentToken == ",") && (lModName.length > 0)) { 
    1139                 mReferencedImports ~= ModuleToFilename(lModName); 
     1153            if ( lCurrentToken == ",") 
     1154            { 
     1155                if (lModName.length > 0) 
     1156                { 
     1157                    mReferencedImports ~= ModuleToFilename(lModName); 
     1158                    lModName = ""; 
     1159                } 
     1160            } 
     1161            else if (lCurrentToken == "=") 
     1162            { 
    11401163                lModName = ""; 
    1141             } else { 
     1164            } 
     1165            else if (lCurrentToken == ":") 
     1166            { 
     1167                if (lModName.length > 0) 
     1168                { 
     1169                    mReferencedImports ~= ModuleToFilename(lModName); 
     1170                    lModName = ""; 
     1171                } 
     1172                // Once you hit a colon, there are no more module names 
     1173                // in this statement. 
     1174                while ((lCurrentToken = GetNextToken (pFileText, pPos)) !is null 
     1175                           && (lCurrentToken != ";")) 
     1176                { 
     1177                    return; 
     1178                } 
     1179            } 
     1180            else 
     1181            { 
    11421182                lModName ~= lCurrentToken; 
    11431183            } 
     
    12321272                    // Add link path to compiler switches. 
    12331273                    if (AddLink != null) 
    1234                         AddLink(lPragmaId); 
     1274                        AddLink(lPragmaId.dup); 
    12351275                    if (lCurrentToken == kCloseParen) 
    12361276                    { 
     
    12491289                    if ((lCurrentToken != ",") && (lCurrentToken != kCloseParen)) { 
    12501290                        if (AddBuildDef != null) 
    1251                             AddBuildDef(lCurrentToken); 
     1291                            AddBuildDef(lCurrentToken.dup); 
    12521292                    } 
    12531293                    if (lCurrentToken == kCloseParen){ 
     
    12801320                    } 
    12811321                    if (AddTarget != null) 
    1282                         AddTarget(lCurrentToken); 
     1322                        AddTarget(lCurrentToken.dup); 
    12831323                } 
    12841324 
     
    16021642} 
    16031643 
    1604 char[] FileToModulename(char[] pFileName
     1644char[] FileToModulename(char[] pFileName, inout char[] pAltName
    16051645{ 
    16061646    char[] lModuleName; 
     
    16091649    // Copy the name 
    16101650    lModuleName = util.pathex.AbbreviateFileName(pFileName, GetImportRoots() ); 
     1651    if (pAltName.ptr == null) 
     1652        pAltName = lModuleName.dup; 
    16111653 
    16121654 
     
    16751717    else 
    16761718    { 
     1719        char[] lAltName; 
    16771720        std.file.write(lFileName, 
    1678             std.string.format("module %s;\n" , FileToModulename(lFileName)) ~ 
     1721            std.string.format("module %s;\n" , FileToModulename(lFileName, lAltName)) ~ 
    16791722            "// This file is automatically maintained by the BUILD utility,\n" 
    16801723            "// Please refrain from manually editing it.\n" 
     
    17521795} 
    17531796 
     1797struct ExternRef 
     1798{ 
     1799    char[]   FilePath; 
     1800    char[][] ToolOpts; 
     1801    char[]   Prefix; 
     1802    char[]   Postfix; 
     1803    char[]   Rule; 
     1804} 
    17541805private 
    17551806{ 
    1756     struct ExternRef 
    1757     { 
    1758         char[]   FilePath; 
    1759         char[][] ToolOpts; 
    1760         char[]   Prefix; 
    1761         char[]   Postfix; 
    1762         char[]   Rule; 
    1763     } 
    17641807    ExternRef[]  vExternals; 
    17651808} 
     
    19091952        else if (r.InUse == eRuleUsage.Link) 
    19101953        { 
    1911             AddLink(lInFile); 
     1954            AddLink(lInFile.dup); 
    19121955        } 
    19131956        else if (r.InUse == eRuleUsage.Ignore) 
     
    19261969        else if (r.OutUse == eRuleUsage.Link) 
    19271970        { 
    1928             AddLink(lOutFile); 
     1971            AddLink(lOutFile.dup); 
    19291972        } 
    19301973 
  • trunk/Source/source_bn.d

    r48 r49  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 2055
     4long auto_build_number = 2216
  • trunk/Source/util/booltype.d

    r47 r49  
     1/* ************************************************************************* 
     2 
     3        @file booltype.d 
     4 
     5        Copyright (c) 2005 Derek Parnell 
     6 
     7 
     8 
     9                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     10 
     11 
     12        @version        Initial version, January 2005 
     13        @author         Derek Parnell 
     14 
     15 
     16**************************************************************************/ 
     17/** 
     18 * A formal Boolean type. 
     19 
     20 * This boolean data type can only be used as a boolean and not a 
     21 * pseudo bool as supplied by standard D. 
     22 
     23 * Authors: Derek Parnell 
     24 * Date: 08 aug 2006 
     25 * History: 
     26 * Licence: 
     27        This software is provided 'as-is', without any express or implied 
     28        warranty. In no event will the authors be held liable for damages 
     29        of any kind arising from the use of this software. 
     30 
     31        Permission is hereby granted to anyone to use this software for any 
     32        purpose, including commercial applications, and to alter it and/or 
     33        redistribute it freely, subject to the following restrictions: 
     34 
     35        1. The origin of this software must not be misrepresented; you must 
     36           not claim that you wrote the original software. If you use this 
     37           software in a product, an acknowledgment within documentation of 
     38           said product would be appreciated but is not required. 
     39 
     40        2. Altered source versions must be plainly marked as such, and must 
     41           not be misrepresented as being the original software. 
     42 
     43        3. This notice may not be removed or altered from any distribution 
     44           of the source. 
     45 
     46        4. Derivative works are permitted, but they must carry this notice 
     47           in full and credit the original source. 
     48 
     49**/ 
    150module util.booltype; 
     51version(build) version(BoolUnknown) pragma(include, booltypemac.ddoc); 
     52 
     53 
     54/** 
     55   Defines the capabilities of the datatype. 
     56 
     57   $(BU_Extra) 
     58 
     59**/ 
    260 
    361class Bool 
     
    563    int m_Val; 
    664 
    7     // Constructors 
     65    /** 
     66       * Constructor 
     67       * Params: 
     68       *  x = zero sets value to False. Non-zero sets value to True. 
     69       * 
     70       * Examples: 
     71       *  -------------------- 
     72       *   Bool a = new Bool(1);  // Sets initial to True. 
     73       *   Bool b = new Bool(-1);  // Sets initial to True. 
     74       *   Bool c = new Bool(100);  // Sets initial to True. 
     75       *   Bool d = new Bool(0);  // Sets initial to False. 
     76       *  -------------------- 
     77    **/ 
    878    this(int x) { m_Val = (x != 0 ? 1 : 0); } 
     79 
     80    /** 
     81       * Constructor 
     82       * Params: 
     83       *  x = Copies value to new object. 
     84       * 
     85       * Examples: 
     86       *  -------------------- 
     87       *   Bool a = new Bool(True);  // Sets initial to True. 
     88       *   Bool b = new Bool(False);  // Sets initial to False. 
     89       *   Bool c = new Bool(a);  // Sets initial to True. 
     90       *   Bool d = new Bool(b);  // Sets initial to False. 
     91       *  -------------------- 
     92    **/ 
    993    this(Bool x) { m_Val = x.m_Val; } 
     94 
     95    /** 
     96       * Constructor 
     97       * Params: 
     98       *  x = zero sets value to True when the parameter is any of 
     99          "TRUE","True","true","YES","Yes","yes","ON","On","on","T","t","1". 
     100          Any other parameter value sets the boolean to False. 
     101       * 
     102       * 
     103       * Examples: 
     104       *  -------------------- 
     105       *   Bool a = new Bool("True");  // Sets initial to True. 
     106       *   Bool b = new Bool("False");  // Sets initial to False. 
     107       *   Bool c = new Bool("1");  // Sets initial to True. 
     108       *   Bool d = new Bool("rabbit");  // Sets initial to False. 
     109       *   Bool e = new Bool("on");  // Sets initial to True. 
     110       *   Bool f = new Bool("off");  // Sets initial to False. 
     111       *   Bool g = new Bool("");  // Sets initial to False. 
     112       *  -------------------- 
     113    **/ 
    10114    this(char[] x) { 
    11115        switch (x) 
     
    14118                 "YES",  "Yes",  "yes", 
    15119                 "ON",   "On",   "on", 
    16                  "t", 
     120                 "T", "t", 
    17121                 "1" 
    18122                 : 
     
    24128    } 
    25129 
    26     this() { m_Val = 0; } 
    27  
    28     // --------------------------------- 
    29     int opEqual(Bool pOther) { 
    30         return m_Val == pOther.m_Val; 
    31     } 
    32  
    33  
    34     // --------------------------------- 
    35     // This overloads the '~' operator. 
     130    version(BoolUnknown) 
     131    { 
     132     /** 
     133       * Constructor 
     134       * 
     135       * This sets the boolean to Unknown. 
     136       * 
     137       * Examples: 
     138       *  -------------------- 
     139       *   Bool a = new Bool();  // Sets initial to Unknown; 
     140       *  -------------------- 
     141    **/ 
     142        this() { m_Val = -1; } 
     143    } 
     144    else 
     145    { 
     146     /** 
     147       * Constructor 
     148       * 
     149       * This sets the boolean to False. 
     150       * 
     151       * Examples: 
     152       *  -------------------- 
     153       *   Bool a = new Bool();  // Sets initial to False; 
     154       *  -------------------- 
     155    **/ 
     156        this() { m_Val = 0; } 
     157    } 
     158 
     159 
     160    /** 
     161       * Equality Operator 
     162       * Params: 
     163       *  pOther = The Boolean to compare this one to. 
     164       * 
     165       * 
     166       * Examples: 
     167       *  -------------------- 
     168       *   Bool a = SomeFunc(); 
     169       *   if (a == True) { . . . } 
     170       *  -------------------- 
     171    **/ 
     172    int opEquals(Bool pOther) { 
     173        version(BoolUnknown) 
     174        { 
     175        if (m_Val == -1) 
     176            throw new BoolException("opEquals LHS is not set"); 
     177 
     178        if (pOther.m_Val == -1) 
     179            throw new BoolException("opEquals RHS is not set"); 
     180        } 
     181        return (m_Val == pOther.m_Val ? 1 : 0); 
     182    } 
     183 
     184 
     185    /** 
     186       * Comparasion Operator 
     187       * 
     188       * False sorts before True. 
     189       * Params: 
     190       *  pOther = The Boolean to compare this one to. 
     191       * 
     192       * 
     193       * Examples: 
     194       *  -------------------- 
     195       *   Bool a = SomeFunc(); 
     196       *   Bool b = OtherFunc(); 
     197       *   if (a < b) { . . . } 
     198       *  -------------------- 
     199    **/ 
    36200    int opCmp(Bool pOther) { 
     201        version(BoolUnknown) 
     202        { 
     203        if (m_Val == -1) 
     204            throw new BoolException("opCmp LHS is not set"); 
     205 
     206        if (pOther.m_Val == -1) 
     207            throw new BoolException("opCmp RHS is not set"); 
     208        } 
    37209        // False sorts before True. 
    38210        if (m_Val == pOther.m_Val) 
     
    43215    } 
    44216 
    45     // --------------------------------- 
     217    /** 
     218       * Complement Operator 
     219       * Params: 
     220       *  pOther = The Boolean to compare this one to. 
     221       * 
     222       * 
     223       * Examples: 
     224       *  -------------------- 
     225       *   Bool a = ~SomeFunc(); 
     226       *   if (a == True) { . . . } 
     227       *  -------------------- 
     228    **/ 
    46229    Bool opCom() 
    47230    { 
     231        version(BoolUnknown) 
     232        { 
     233        if (m_Val == -1) 
     234            throw new BoolException("opCom value is not set"); 
     235        } 
    48236        if (m_Val == 1) 
    49237            return False; 
     
    51239    } 
    52240 
    53     // --------------------------------- 
    54     Bool opAnd(Bool x) 
    55     { 
    56         if (m_Val == 0 || x.m_Val == 0) 
     241    /** 
     242       * And Operator 
     243       * Params: 
     244       *  pOther = The Boolean to compare this one to. 
     245       * 
     246       * 
     247       * Examples: 
     248       *  -------------------- 
     249       *   Bool a = SomeFunc(); 
     250       *   Bool b = OtherFunc(); 
     251       *   Bool c = a & b; 
     252       *  -------------------- 
     253    **/ 
     254    Bool opAnd(Bool pOther) 
     255    { 
     256        version(BoolUnknown) 
     257        { 
     258        if (m_Val == -1) 
     259            throw new BoolException("opAnd LHS is not set"); 
     260 
     261        if (pOther.m_Val == -1) 
     262            throw new BoolException("opAnd RHS is not set"); 
     263        } 
     264        if (m_Val == 0 || pOther.m_Val == 0) 
    57265            return False; 
    58266        return True; 
    59267    } 
    60268 
    61     // --------------------------------- 
    62     Bool opOr(Bool x) 
    63     { 
    64         if (m_Val == 1 || x.m_Val == 1) 
     269    /** 
     270       * Or Operator 
     271       * Params: 
     272       *  pOther = The Boolean to compare this one to. 
     273       * 
     274       * 
     275       * Examples: 
     276       *  -------------------- 
     277       *   Bool a = SomeFunc(); 
     278       *   Bool b = OtherFunc(); 
     279       *   Bool c = a | b; 
     280       *  -------------------- 
     281    **/ 
     282    Bool opOr(Bool pOther) 
     283    { 
     284        version(BoolUnknown) 
     285        { 
     286        if (m_Val == -1) 
     287            throw new BoolException("opOr LHS is not set"); 
     288 
     289        if (pOther.m_Val == -1) 
     290            throw new BoolException("opOr RHS is not set"); 
     291        } 
     292        if (m_Val == 1 || pOther.m_Val == 1) 
    65293            return True; 
    66294        return False; 
    67295    } 
    68296 
    69      // --------------------------------- 
    70     Bool opXor(Bool x) 
    71     { 
    72         if (m_Val == x.m_Val) 
     297    /** 
     298       * Xor Operator 
     299       * Params: 
     300       *  pOther = The Boolean to compare this one to. 
     301       * 
     302       * 
     303       * Examples: 
     304       *  -------------------- 
     305       *   Bool a = SomeFunc(); 
     306       *   Bool b = OtherFunc(); 
     307       *   Bool c = a ^ b; 
     308       *  -------------------- 
     309    **/ 
     310    Bool opXor(Bool pOther) 
     311    { 
     312        version(BoolUnknown) 
     313        { 
     314        if (m_Val == -1) 
     315            throw new BoolException("opXor LHS is not set"); 
     316 
     317        if (pOther.m_Val == -1) 
     318            throw new BoolException("opXor RHS is not set"); 
     319        } 
     320        if (m_Val == pOther.m_Val) 
    73321            return False; 
    74322        return True; 
    75323    } 
    76324 
    77     // --------------------------------- 
    78     char[] toString() 
    79     { 
    80         if (m_Val == 1) 
    81             return "True".dup; 
    82         return "False".dup; 
    83     } 
    84  
    85     // --------------------------------- 
     325 
     326    version(DDOC) 
     327    { 
     328        version(BoolUnknown) 
     329        { 
     330        /** 
     331           * Convert to a displayable string. 
     332           * 
     333           * False displays as "False" and True dispays as "True". 
     334           * 
     335           * If the value has not been set yet, this returns "Unknown". 
     336           * 
     337           * Examples: 
     338           *  -------------------- 
     339           *   Bool a = SomeFunc(); 
     340           *   std.stdio.writefln("The result was %s", a); 
     341           *  -------------------- 
     342        **/ 
     343            char[] toString(); 
     344        } 
     345        else 
     346        { 
     347        /** 
     348           * Convert to a displayable string. 
     349           * 
     350           * False displays as "False" and True dispays as "True". 
     351           * 
     352           * Examples: 
     353           *  -------------------- 
     354           *   Bool a = SomeFunc(); 
     355           *   std.stdio.writefln("The result was %s", a); 
     356           *  -------------------- 
     357        **/ 
     358            char[] toString(); 
     359        } 
     360    } 
     361    else 
     362    { 
     363 
     364        char[] toString() 
     365        { 
     366            version(BoolUnknown) 
     367            { 
     368            if (m_Val == -1) 
     369                return "Unknown".dup; 
     370            } 
     371            if (m_Val == 1) 
     372                return "True".dup; 
     373 
     374            return "False".dup; 
     375        } 
     376    } 
     377 
     378    /** 
     379       * Convert to an integer 
     380       * 
     381       * False converts to zero(0), and True converts to one(1). 
     382       * 
     383       * Examples: 
     384       *  -------------------- 
     385       *   Bool a = SomeFunc(); 
     386       *   std.stdio.writefln("The result was %s", a.toInt); 
     387       *  -------------------- 
     388    **/ 
    86389    int toInt() 
    87390    { 
     391        version(BoolUnknown) 
     392        { 
     393        if (m_Val == -1) 
     394            throw new BoolException("toInt value is not set"); 
     395        } 
    88396        return m_Val; 
    89397    } 
    90398 
    91     // --------------------------------- 
     399    /** 
     400       * Creates a duplicate of the object. 
     401       * 
     402       * Examples: 
     403       *  -------------------- 
     404       *   Bool a = SomeFunc(); 
     405       *   Bool b = a.dup; 
     406       *  -------------------- 
     407    **/ 
    92408    Bool dup() 
    93409    { 
     410        version(BoolUnknown) 
     411        { 
     412        if (m_Val == -1) 
     413            return new Bool(); 
     414        } 
     415 
    94416        return new Bool(m_Val); 
    95417    } 
    96418 
    97 
    98 static Bool True; 
    99 static Bool False; 
    100 static this() 
     419    version(BoolUnknown) 
     420    { 
     421        /** 
     422           * Checks if the boolean has been set yet. 
     423           * 
     424           * Examples: 
     425           *  -------------------- 
     426           *   if (someBool.isSet() == True) 
     427           *   { 
     428           *       doSomethingUseful(); 
     429           *   } 
     430           * 
     431           *  -------------------- 
     432        **/ 
     433        Bool isSet() 
     434        { 
     435            if (m_Val == -1) 
     436                return True; 
     437            return False; 
     438        } 
     439    } 
     440
     441 
     442static Bool True;   /// Literal 'True' value. 
     443 
     444static Bool False;  /// Literal 'False' value. 
     445 
     446version(BoolUnknown) 
     447
     448static Bool Unknown;  /// Literal 'Unknown' value. 
     449
     450 
     451private static this() 
    101452{ 
    102453    True = new Bool(1); 
    103454    False = new Bool(0); 
    104 
    105  
     455version(BoolUnknown) 
     456
     457    Unknown = new Bool(); 
     458
     459
     460 
     461 
     462version(BoolUnknown) 
     463
     464/** 
     465   Defines the exception for this class. 
     466 
     467**/ 
     468class BoolException : Exception 
     469
     470     /** 
     471       * Constructor 
     472       * Params: 
     473       *  pMsg = Text of the message displayed during the exception. 
     474       * 
     475       * Examples: 
     476       *  -------------------- 
     477       *   throw new BoolException("Some Message"); 
     478       *  -------------------- 
     479    **/ 
     480   this(char[] pMsg) 
     481    { 
     482        super(pMsg); 
     483    } 
     484
     485
  • trunk/Source/util/fdt.d

    r48 r49  
    1 /************************************************************************** 
     1/* ************************************************************************* 
    22 
    33        @file fdt.d 
     
    55        Copyright (c) 2005 Derek Parnell 
    66 
     7                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     8 
     9 
     10        @version        Initial version, January 2005 
     11        @author         Derek Parnell 
     12 
     13 
     14**************************************************************************/ 
     15 
     16/** 
     17 * A File Date-Time type. 
     18 
     19 * This data type is used to compare and format date-time data associated 
     20 * with files. 
     21 
     22 * Authors: Derek Parnell 
     23 * Date: 08 aug 2006 
     24 * History: 
     25 * Licence: 
    726        This software is provided 'as-is', without any express or implied 
    827        warranty. In no event will the authors be held liable for damages 
     
    2746           in full and credit the original source. 
    2847&