Changeset 49
- Timestamp:
- 09/20/06 14:33:39 (5 years ago)
- Files:
-
- 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/User_Manual.html (modified) (2 diffs)
- trunk/Docs/autobuild.html (modified) (1 diff)
- trunk/Docs/booltype.html (added)
- trunk/Docs/change_log.html (modified) (9 diffs)
- trunk/Docs/command_line.html (modified) (1 diff)
- trunk/Docs/configuration_file.html (modified) (4 diffs)
- trunk/Docs/dlls.html (modified) (1 diff)
- trunk/Docs/introduction.html (modified) (1 diff)
- trunk/Docs/macros.html (modified) (1 diff)
- trunk/Docs/pragmas.html (modified) (1 diff)
- trunk/Docs/profile_file.html (modified) (1 diff)
- trunk/Docs/response_file.html (modified) (1 diff)
- trunk/Docs/rules.html (modified) (1 diff)
- trunk/Docs/switches.html (modified) (1 diff)
- trunk/Docs/todo.html (modified) (1 diff)
- trunk/Source/build.d (modified) (149 diffs)
- trunk/Source/build_bn.d (modified) (1 diff)
- trunk/Source/docsrc/User_Manual.d (modified) (1 diff)
- trunk/Source/docsrc/change_log.d (modified) (9 diffs)
- trunk/Source/docsrc/configuration_file.d (modified) (3 diffs)
- trunk/Source/docsrc/user_manual.ddoc (modified) (1 diff)
- trunk/Source/example_build.cfg (modified) (5 diffs)
- trunk/Source/nix_dmd_build.cfg (added)
- trunk/Source/nix_gnu_build.cfg (added)
- trunk/Source/source.d (modified) (25 diffs)
- trunk/Source/source_bn.d (modified) (1 diff)
- trunk/Source/util/booltype.d (modified) (6 diffs)
- trunk/Source/util/booltypemac.ddoc (added)
- trunk/Source/util/fdt.d (modified) (4 diffs)
- trunk/Source/util/fdt_bn.d (modified) (1 diff)
- trunk/Source/util/file2.d (modified) (1 diff)
- trunk/Source/util/file2_bn.d (modified) (1 diff)
- trunk/Source/util/fileex.d (modified) (6 diffs)
- trunk/Source/util/fileex_bn.d (modified) (1 diff)
- trunk/Source/util/linetoken.d (modified) (2 diffs)
- trunk/Source/util/linetoken_bn.d (modified) (1 diff)
- trunk/Source/util/macro.d (modified) (6 diffs)
- trunk/Source/util/pathex.d (modified) (9 diffs)
- trunk/Source/util/pathex_bn.d (modified) (1 diff)
- trunk/Source/util/str.d (modified) (27 diffs)
- trunk/Source/util/str_bn.d (modified) (1 diff)
- trunk/Source/win_dmd_build.cfg (added)
- trunk/Source/win_gnu_build.cfg (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Docs/User_Manual.html
r48 r49 111 111 <div class="section"><h2 class="section"><a name="authors">Authors:<span class="secdef">Derek Parnell - Melbourne</span></a></h2></div> 112 112 <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.0 2</span></a></h2></div>114 <div class="section"><h2 class="section"><a name="date">Date:<span class="secdef">2 3 June2006</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> 115 115 <div class="section"><h2 class="section"><a name="license">License:</a></h2> 116 116 <pre class="cite">This software is provided 'as-is', without any express or implied … … 139 139 140 140 141 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006141 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 142 142 </span></div> 143 143 </body> trunk/Docs/autobuild.html
r48 r49 66 66 67 67 68 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27200668 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 69 69 </span></div> 70 70 </body> trunk/Docs/change_log.html
r48 r49 10 10 11 11 12 <p class="page_title"> Build Utility <span class="page_title">© 2006, Derek Parnell, Melbourne</span>12 <p class="page_title">bud Utility <span class="page_title">© 2006, Derek Parnell, Melbourne</span> 13 13 <br> <a href="User_Manual.html#toc"><span class="tocref">(table of contents)</span></a></p> 14 14 <h1 class="topic"><a name="change_log">Topic: Change Log</a></h1> 15 15 <div class="section">A list of changes and fixes that have been made. 16 16 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 17 55 <h3 class="subsection"><a name="">v3.02 -- 23/June/2006 </a></h3> 18 56 <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. 20 58 21 59 <li class="item">** <b>FIX: Ticket #28</b> The Optlink switch options are now … … 59 97 <li class="item">** <b>ENH:</b> The 'Rules' functionality now ensures that the 60 98 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 Build99 <li class="item">** <b>ENH:</b> The LINKCMD is now able to be used in the <i><b>utility</b></i> 62 100 configuration file. 63 101 <li class="item">** <b>ENH:</b> A new switch "-uses" will cause the tool to … … 68 106 69 107 <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 during108 <div class="list"><ul> <li class="item">** <b>FIX:</b> <i><b>the utility</b></i> was using the wrong object file during 71 109 linkages if a target object file did not exist but one with the same name 72 110 existed in any of the Import paths. 73 111 74 112 <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. 76 114 77 115 <li class="item">** <b>FIX: Ticket #10 </b> The tool now recognises the … … 116 154 in the following areas... 117 155 <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 this156 configuration item in <i>the utility's</i> configuration file. And in this 119 157 case it doesn't look anywhere in any of the areas listed below. 120 158 <li class="item">The current directory. … … 124 162 <li class="item">The same directory in which the compiler resides. 125 163 <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. 127 165 </ul></div> 128 166 … … 169 207 170 208 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, 172 210 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. As174 shipped, the pre-built editions of <i> Build</i> do not support211 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 175 213 the <b>-V</b> switch. 176 214 … … 217 255 <li class="item">** <b>FIX:</b> <i>Thanks to Carlos</i>: In Unix environments, any "-version" 218 256 switch on the Utility's command line was not being converted to the correct Unix 219 format of "-fversion...". So now, if the Build toolgets257 format of "-fversion...". So now, if the utility gets 220 258 either "-version..." or "-fversion=..." on its command line, it will 221 259 recognise it as a 'Version' request for the compiler <b>and</b> output … … 365 403 366 404 <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 own405 <div class="list"><ul><li class="item">** <b>FIX</b>: Now supports the raw-string delimiter ` in the utility's own 368 406 pragma commands. 369 407 370 <li class="item">** <b>FIX</b>: Now handles backslash escapes in Build's own408 <li class="item">** <b>FIX</b>: Now handles backslash escapes in the utility's own 371 409 pragma commands. 372 410 … … 616 654 </div> 617 655 618 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006656 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 619 657 </span></div> 620 658 </body> trunk/Docs/command_line.html
r48 r49 128 128 129 129 130 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006130 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 131 131 </span></div> 132 132 </body> trunk/Docs/configuration_file.html
r48 r49 53 53 when using the DMD linker. 54 54 <pre class="code">LINKSWITCH=/info 55 </pre> 56 57 <b>FINAL</b> <br> 58 This specifies a command that will run after the target has been 59 successfully created. There can be any number of <i>FINAL</i> commands 60 in a configuration file; they are all executed, and in the order presented. 61 <br/> <br/> 62 You can place special tokens in the <i>FINAL</i> command line and these will 63 be replaced just before running the command line. 64 <table class="conftab"> <thead class="confthead"> <td class="thcell">Token </td> <td class="thcell">Replacement </td> 65 </thead> 66 <tr class="confrow"> <td class="cell"><b>{Target}</b> </td> <td class="cell">The full path and name of the target file created </td> 67 </tr> 68 <tr class="confrow"> <td class="cell"><b>{TargetPath}</b> </td> <td class="cell">The path of the target file created </td> 69 </tr> 70 <tr class="confrow"> <td class="cell"><b>{TargetBase}</b> </td> <td class="cell">The name of the target file created </td> 71 </tr> 72 </table> 73 <pre class="code">FINAL="c:\program files\upx202w\upx" --best -q {Target} >nul 55 74 </pre> 56 75 … … 346 365 # items that only apply when building in Posix (unix). 347 366 367 [darwin] 368 # items that only apply when building in Macintosh Darwin (OS X). 369 348 370 [DigitalMars] 349 371 # items that only apply when building with DigitalMars tools. … … 374 396 Blank lines are ignored. 375 397 376 <p><span class="example"><i>Example:</i> </span></p><pre class="code">build myapp.d + final377 </pre> 378 where if a group called '[ final]' is contained in any configuration398 <p><span class="example"><i>Example:</i> </span></p><pre class="code">build myapp.d +production 399 </pre> 400 where if a group called '[production]' is contained in any configuration 379 401 file, the options in that group are used. 380 402 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] 383 405 CMDLINE=-T{Target}_{Group} # Set the name of the executable. 384 406 CMDLINE=-release # Don't generate runtime checks. … … 398 420 399 421 400 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006422 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 401 423 </span></div> 402 424 </body> trunk/Docs/dlls.html
r48 r49 36 36 37 37 38 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27200638 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 39 39 </span></div> 40 40 </body> trunk/Docs/introduction.html
r48 r49 28 28 29 29 30 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27200630 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 31 31 </span></div> 32 32 </body> trunk/Docs/macros.html
r48 r49 151 151 152 152 153 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006153 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 154 154 </span></div> 155 155 </body> trunk/Docs/pragmas.html
r48 r49 243 243 244 244 245 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006245 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 246 246 </span></div> 247 247 </body> trunk/Docs/profile_file.html
r48 r49 100 100 101 101 102 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006102 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 103 103 </span></div> 104 104 </body> trunk/Docs/response_file.html
r48 r49 50 50 51 51 52 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27200652 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 53 53 </span></div> 54 54 </body> trunk/Docs/rules.html
r48 r49 98 98 99 99 100 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006100 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 101 101 </span></div> 102 102 </body> trunk/Docs/switches.html
r48 r49 497 497 498 498 499 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:272006499 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 500 500 </span></div> 501 501 </body> trunk/Docs/todo.html
r48 r49 39 39 40 40 41 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Sat Jun 24 00:43:27200641 <hr><div class="footnote"><span class="footnote">Generated by Ddoc, Wed Sep 20 16:04:49 2006 42 42 </span></div> 43 43 </body> trunk/Source/build.d
r48 r49 6 6 Authors: Derek Parnell, Melbourne 7 7 Initial Creation: January 2005 8 Version: 3.0 29 Date: August 20058 Version: 3.03 9 Date: September 2006 10 10 License: 11 11 This software is provided 'as-is', without any express or implied … … 40 40 version(Windows) { 41 41 // OptLink Definition File 42 pragma (build_def, "VERSION 3.0 2");42 pragma (build_def, "VERSION 3.03"); 43 43 } 44 44 } … … 47 47 private{ 48 48 // --------- 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; 66 68 67 69 version(Windows) 68 70 { 69 import std.c.windows.windows;71 static import std.c.windows.windows; 70 72 } 71 73 72 74 version(linux) 73 75 { 74 import std.c.linux.linux;76 static import std.c.linux.linux; 75 77 } 76 78 77 79 version(darwin) 78 80 { 79 import std.c.darwin.darwin;81 static import std.c.darwin.darwin; 80 82 } 81 83 … … 139 141 char[] vHomePathId = "HOME"; 140 142 char[] vEtcPath = ""; 143 char[] vSymInfoSwitch = "/co"; 144 char[] vOutFileSwitch = "-of"; 141 145 } 142 146 … … 160 164 char[] vHomePathId = "HOME"; 161 165 char[] vEtcPath = "/etc/"; 166 char[] vSymInfoSwitch = "-g"; 167 char[] vOutFileSwitch = "-o "; 162 168 } 163 169 … … 165 171 char[] vDebugSwitch = "-debug"; 166 172 char[][] vCompilerDefs; 167 char[] vOutFileSwitch = "-of";168 173 char[] vImportPath = "-I"; 169 174 bool vUseModBaseName = false; 170 char[] vLinkLibSwitch = "-l"; 171 char[] vSymInfoSwitch = "/co"; 175 char[] vLinkLibSwitch = ""; 172 176 } 173 177 … … 198 202 char[] vCompilerExe=`gdc`; 199 203 char[] vCompileOnly= `-c`; 200 char[] vLinkerExe=`gd md`;204 char[] vLinkerExe=`gdc`; 201 205 bool vPostSwitches = false; 202 206 bool vAppendLinkSwitches = false; … … 212 216 char[] vLibrarian = `ar`; 213 217 char[] vLibrarianOpts = `-r`; 214 char[] vLinkLibSwitch = "-l -L";218 char[] vLinkLibSwitch = "-l"; 215 219 char[] vHomePathId = "HOME"; 216 220 char[] vEtcPath = "/etc/"; … … 218 222 char[] vVersionSwitch = "-fversion"; 219 223 char[] vDebugSwitch = "-fdebug"; 220 char[] vOutFileSwitch = "-o ";224 char[] vOutFileSwitch = "-of "; 221 225 char[][] vCompilerDefs; 222 226 char[] vImportPath = "-I "; 223 char[] vSymInfoSwitch = " /co";227 char[] vSymInfoSwitch = "-g"; 224 228 /* GDC places object files in the directory from which it is called */ 225 229 bool vUseModBaseName = true; … … 248 252 char[] vModOutDelim = ""; 249 253 char[] vModOutFile = "_modules.ddoc"; 254 255 char[][] vFinalProc; 250 256 251 257 Bool vTestRun; … … 279 285 char[] vAppPath; 280 286 char[] vAppName; 281 char[] vAppVersion = "3.0 2";287 char[] vAppVersion = "3.03"; 282 288 char[] vTargetName; // Output name from first file name. 283 289 char[] vPragmaTargetName; // Output name from pragma. … … 335 341 336 342 version(Windows) { 337 vWinVerNum = cast(ubyte)( GetVersion() & 0xFF);343 vWinVerNum = cast(ubyte)(std.c.windows.windows.GetVersion() & 0xFF); 338 344 vWinVer = std.string.format("%d.0", vWinVerNum); 339 345 } … … 345 351 util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 346 352 347 Source.UseModBaseName(vUseModBaseName);353 source.Source.UseModBaseName(vUseModBaseName); 348 354 349 355 } … … 354 360 { 355 361 356 writefln(362 std.stdio.writefln( 357 363 "Path and Version : %s v%s(%d)\n built on %s" 358 364 ,vAppPath, vAppVersion, build_bn.auto_build_number, … … 362 368 else { 363 369 364 writefln(370 std.stdio.writefln( 365 371 "Usage: %s sourcefile [options objectfiles libraries]" 366 372 , 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"); 399 405 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.)"); 407 413 } 408 414 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"); 422 428 423 429 version(UseResponseFile) 424 writefln(" ** The default is to use a response file");430 std.stdio.writefln(" ** The default is to use a response file"); 425 431 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."); 452 458 version(Windows) 453 459 { 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'"); 470 476 } 471 477 } … … 474 480 // It returns the time of the most recently modified file. 475 481 //------------------------------------------------------- 476 FileDateTime GetNewestDateTime()482 util.fdt.FileDateTime GetNewestDateTime() 477 483 //------------------------------------------------------- 478 484 { 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); 490 537 491 538 version(BuildVerbose) 492 539 { 493 540 if(vVerbose == True) { 494 writefln("source file[%d] %s", i,495 util.pathex.AbbreviateFileName(l Source.FileName));541 std.stdio.writefln("link file[%d] %s %s", idx, 542 util.pathex.AbbreviateFileName(lFileName), lLinkTime.toString()); 496 543 } 497 544 else if(vNames == True) { 498 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lSource.FileName));545 std.stdio.writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 499 546 } 500 547 } else { 501 548 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) 507 553 { 508 554 version(BuildVerbose) 509 555 { 510 556 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", 546 558 lModsTime.toString(), 547 559 lLinkTime.toString() … … 572 584 char[] lTargetName; 573 585 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; 577 589 char[] lDResponseFileName; 578 590 char[] lLinkResponseFileName; … … 600 612 { 601 613 if (vVerbose == True) 602 writefln("Macro file '%s' being processed.", lFile);614 std.stdio.writefln("Macro file '%s' being processed.", lFile); 603 615 } 604 616 … … 611 623 { 612 624 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); 614 626 } else { 615 627 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); 617 629 } 618 630 lFile.length = 0; … … 622 634 if (lFile.length > 0) 623 635 { 624 new Source(lFile);636 new source.Source(lFile); 625 637 } 626 638 } … … 629 641 // found, and I was not explicitly told not to link. 630 642 lLinking = (vLibraryAction == LibOpt.Build) || 631 ( Source.WasMainFound == false) ||643 (source.Source.WasMainFound == false) || 632 644 (vNoLink == True) 633 645 ? False : True; … … 638 650 // based on whether or not 'main' was found in the sources. 639 651 if (vLibraryAction == LibOpt.Implicit) { 640 if ( Source.WasMainFound){652 if (source.Source.WasMainFound){ 641 653 vLibraryAction = LibOpt.DontBuild; 642 654 } … … 656 668 { 657 669 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)); 659 671 } 660 672 … … 670 682 { 671 683 if(vVerbose == True) 672 writefln("Cmdline target override is '%s'", vTargetName);684 std.stdio.writefln("Cmdline target override is '%s'", vTargetName); 673 685 } 674 686 } … … 680 692 if (vLibraryAction == LibOpt.Build) 681 693 // Target is a library. 682 lTargetName = ReplaceExtention(vTargetName, vLibExtention);694 lTargetName = util.pathex.ReplaceExtention(vTargetName, vLibExtention); 683 695 684 696 else if (vNoLink == False) 685 697 { 686 if ( Source.WasMainFound)687 if ( Source.WasMainDLL)698 if (source.Source.WasMainFound) 699 if (source.Source.WasMainDLL) 688 700 // Target is a shared library. 689 lTargetName = ReplaceExtention(vTargetName, vShrLibExtention);701 lTargetName = util.pathex.ReplaceExtention(vTargetName, vShrLibExtention); 690 702 else 691 703 { 692 704 // Target is an executable 693 lTargetName = ReplaceExtention(vTargetName, vExeExtention);705 lTargetName = util.pathex.ReplaceExtention(vTargetName, vExeExtention); 694 706 vTargetExe = lTargetName; 695 707 } … … 699 711 // so assume they know what they are doing and also assume an 700 712 // executable is required. 701 lTargetName = ReplaceExtention(vTargetName, vExeExtention);713 lTargetName = util.pathex.ReplaceExtention(vTargetName, vExeExtention); 702 714 vTargetExe = lTargetName; 703 715 } … … 711 723 // Get the full name of the target's location. 712 724 lTargetName = util.pathex.CanonicalPath(lTargetName, false); 713 lTargetDir = getDirName(lTargetName);725 lTargetDir = std.path.getDirName(lTargetName); 714 726 715 727 // Show user if required to. … … 717 729 { 718 730 if((vVerbose == True) || (vNames == True) ) 719 writefln("\nBuilding target '%s'", lTargetName);731 std.stdio.writefln("\nBuilding target '%s'", lTargetName); 720 732 } 721 733 … … 727 739 // most recently modified dependant file, we need to 728 740 // rebuild the target. 729 lTargetTime = util.fdt.GetFileTime (lTargetName);741 lTargetTime = new util.fdt.FileDateTime (lTargetName); 730 742 version(BuildVerbose) 731 743 { 732 744 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()); 735 747 } 736 748 } … … 745 757 { 746 758 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."); 748 760 } else { 749 761 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) 755 767 { 756 768 /* It is possible to only have object and library … … 774 786 do 775 787 { 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 { 838 872 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 ); 860 878 } 861 879 … … 863 881 { 864 882 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."); 866 884 return 0; 867 885 } … … 875 893 version(Windows) 876 894 { 877 if ( Source.WasMainGUI) {895 if (source.Source.WasMainGUI) { 878 896 AddBuildDef("EXETYPE NT"); 879 897 if (vWinVer.length != 0) … … 900 918 } 901 919 } 902 else if ( Source.WasMainDLL) {920 else if (source.Source.WasMainDLL) { 903 921 AddBuildDef(`LIBRARY "` ~ std.path.getBaseName(lTargetName) ~ `"`); 904 922 AddBuildDef("EXETYPE NT"); … … 916 934 if ((vNoDef == False) && (vBuildDef.length > 0)) 917 935 { 918 lDefName = ReplaceExtention(lTargetName, "def");936 lDefName = util.pathex.ReplaceExtention(lTargetName, "def"); 919 937 if (vTemporaryPath.length != 0) 920 938 { … … 961 979 if (vUseResponseFile == True) 962 980 { 963 lDResponseFileName = ReplaceExtention(lTargetName, "rsp");981 lDResponseFileName = util.pathex.ReplaceExtention(lTargetName, "rsp"); 964 982 if (vTemporaryPath.length != 0) 965 983 { … … 979 997 { 980 998 if (vVerbose == True) 981 writefln("Compiling with ..........\n%s\n", lCommandLine);999 std.stdio.writefln("Compiling with ..........\n%s\n", lCommandLine); 982 1000 } 983 1001 984 1002 // Run Compiler to compile the source files that need it. 985 lRunResult = RunCommand(vCompilerPath ~ vCompilerExe, lCommand);1003 lRunResult = util.fileex.RunCommand(vCompilerPath ~ vCompilerExe, lCommand); 986 1004 if (lRunResult != 0) 987 1005 vExecuteProgram = False; … … 1017 1035 if (util.str.begins(lCompileArg, "-L") == True) 1018 1036 { 1019 lLinkerSwitches ~= lCompileArg[2..$] ;1037 lLinkerSwitches ~= lCompileArg[2..$] ~ vArgDelim; 1020 1038 } 1021 1039 } … … 1047 1065 // (3) Set the map name 1048 1066 if (IsMapping == True) 1049 lCommandLine ~= ReplaceExtention(lTargetName, "map");1067 lCommandLine ~= util.pathex.ReplaceExtention(lTargetName, "map"); 1050 1068 1051 1069 lCommandLine ~= "\n"; … … 1058 1076 foreach( char[] lLib; lLibraryFiles) 1059 1077 { 1060 l CommandLine ~= 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 } 1063 1081 } 1064 1082 else … … 1075 1093 { 1076 1094 if (vVerbose == True) 1077 writefln("Setting LIB=%s", vLibPaths);1095 std.stdio.writefln("Setting LIB=%s", vLibPaths); 1078 1096 } 1079 1097 util.str.SetEnv("LIB",vLibPaths[1..$]); … … 1122 1140 if (util.str.begins(lCompileArg, "-L") == True) 1123 1141 { 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; 1136 1143 } 1137 1144 } … … 1148 1155 // (3) Set the map name 1149 1156 if (IsMapping == True) 1150 lLinkerSwitches ~= vMapSwitch ;1157 lLinkerSwitches ~= vMapSwitch ~ vArgDelim; 1151 1158 1152 1159 // (4) Gather the libraries names. … … 1166 1173 { 1167 1174 if (vVerbose == True) 1168 writefln("Setting LIB=%s", vLibPaths);1175 std.stdio.writefln("Setting LIB=%s", vLibPaths); 1169 1176 } 1170 1177 … … 1184 1191 if (vUseResponseFile == True) 1185 1192 { 1186 lLinkResponseFileName = ReplaceExtention(lTargetName, "ksp");1193 lLinkResponseFileName = util.pathex.ReplaceExtention(lTargetName, "ksp"); 1187 1194 if (vTemporaryPath.length != 0) 1188 1195 { … … 1229 1236 { 1230 1237 if (vVerbose == True) 1231 writefln("Linking with ..........\n%s\n", lCommandLine);1238 std.stdio.writefln("Linking with ..........\n%s\n", lCommandLine); 1232 1239 } 1233 1240 … … 1238 1245 } 1239 1246 1240 lRunResult = RunCommand(vLinkerPath ~ vLinkerExe, lCommand);1247 lRunResult = util.fileex.RunCommand(vLinkerPath ~ vLinkerExe, lCommand); 1241 1248 if (lRunResult != 0) 1242 1249 vExecuteProgram = False; … … 1247 1254 { 1248 1255 if (vSilent == False) 1249 writefln("No build required.");1256 std.stdio.writefln("No build required."); 1250 1257 lRunResult = 0; 1251 1258 } 1252 1259 1253 1260 // Now build a library if requested to. 1254 if ( ( Source.WasMainDLL) && (lRunResult == 0) )1261 if ( (source.Source.WasMainDLL) && (lRunResult == 0) ) 1255 1262 { 1256 1263 char[] lTargetFileName; … … 1271 1278 1272 1279 lTargetFileName = std.path.getBaseName(lTargetName); 1273 lRunResult = RunCommand(lImpLibPath, lImpLibArgs ~1280 lRunResult = util.fileex.RunCommand(lImpLibPath, lImpLibArgs ~ 1274 1281 " " ~ std.path.addExt(lTargetFileName, "lib") ~ 1275 1282 " " ~ std.path.addExt(lTargetFileName, "dll") ); … … 1289 1296 char[] lFileDir; 1290 1297 1291 lFileDir = getDirName(lFileName);1298 lFileDir = std.path.getDirName(lFileName); 1292 1299 if ((vAllObjects == True) || lFileDir == "" || lFileDir == lTargetDir) 1293 1300 { … … 1307 1314 { 1308 1315 if (vUseResponseFile == True) { 1309 lLResponseFileName = ReplaceExtention(lTargetName, "lsp");1316 lLResponseFileName = util.pathex.ReplaceExtention(lTargetName, "lsp"); 1310 1317 if (vTemporaryPath.length != 0) 1311 1318 { … … 1323 1330 { 1324 1331 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); 1329 1336 } 1330 1337 } … … 1338 1345 { 1339 1346 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 ); 1354 1363 // Build's own temprary files. 1355 1364 lHitList ~= lDResponseFileName; … … 1359 1368 1360 1369 // 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"); 1364 1373 1365 1374 foreach(char[] lFilename; lHitList) … … 1372 1381 { 1373 1382 if (vVerbose == True) 1374 writefln(" removing %s", lFilename);1383 std.stdio.writefln(" removing %s", lFilename); 1375 1384 } 1376 1385 std.file.remove(lFilename); … … 1381 1390 } 1382 1391 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 } 1383 1405 return lRunResult; 1384 1406 … … 1394 1416 { 1395 1417 version(Posix) 1396 vCompilerDefs ~= vImportPath ~ "\"" ~ lRoot ~ "\"";1418 AddCompilerArg( vImportPath ~ "\"" ~ lRoot ~ "\"" ); 1397 1419 version(Windows) 1398 vCompilerDefs ~= vImportPath ~ lRoot; 1399 } 1400 1401 foreach(char[] lArg; vCompilerDefs) 1402 { 1403 AddCompilerArg( lArg ); 1420 AddCompilerArg( vImportPath ~ lRoot ); 1404 1421 } 1405 1422 … … 1483 1500 { 1484 1501 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.", 1486 1503 vPragmaTargetName, pPath ); 1487 1504 } … … 1557 1574 char[] lSearchName; 1558 1575 1559 if(pRootName.length == 0) {1576 if(pRootName.length == 0) 1560 1577 return pRootName; 1561 } 1562 else { 1578 1563 1579 lFullName = util.pathex.CanonicalPath(pRootName); 1564 1580 version(Windows) lSearchName = std.string.tolower(lFullName); … … 1572 1588 else 1573 1589 return ""; 1574 } 1590 1575 1591 } 1576 1592 … … 1645 1661 *vDelayedValue = lSwitch; 1646 1662 vDelayedValue = null; 1647 v BuildArgs ~=lSwitch;1663 vReceivedArgs[$-1].ArgText ~= " " ~ lSwitch; 1648 1664 continue; 1649 1665 } 1666 1667 vReceivedArgs.length = vReceivedArgs.length + 1; 1668 vReceivedArgs[$-1].ArgText = lSwitch.dup; 1669 vReceivedArgs[$-1].CompilerArg = False; 1670 vReceivedArgs[$-1].DFlag = True; 1650 1671 1651 1672 if (lSwitch[1] == 'I') … … 1658 1679 { 1659 1680 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); 1661 1682 } 1662 1683 } … … 1666 1687 version(DigitalMars) 1667 1688 { 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 } 1675 1695 } 1676 1696 … … 1681 1701 // Target name (eg. -o testapp) 1682 1702 vDelayedValue = &vCommandTargetName; 1683 vBuildArgs ~= lSwitch;1684 1703 continue; 1685 1704 } … … 1691 1710 1692 1711 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) 1694 1718 vTemporaryPath ~= std.path.sep; 1695 1719 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. 1696 1730 version(DigitalMars) 1697 1731 { 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; 1714 1737 } 1715 1738 } … … 1730 1753 { 1731 1754 if (vVerbose == True) 1732 writefln("Analyzing environment symbol DFLAGS=%s", lSymValue);1755 std.stdio.writefln("Analyzing environment symbol DFLAGS=%s", lSymValue); 1733 1756 } 1734 1757 … … 1741 1764 // ------------------------------------------- 1742 1765 { 1743 char[] l Path;1766 char[] lConfigPath; 1744 1767 char[][] lTextLines; 1745 1768 int lPos; … … 1752 1775 1753 1776 if (vOverrideConfigPath.length > 0) 1754 l Path = vOverrideConfigPath ~ vConfigFile ;1777 lConfigPath = vOverrideConfigPath ~ vConfigFile ; 1755 1778 else 1756 l Path = vConfigPath ~ vConfigFile ;1779 lConfigPath = vConfigPath ~ vConfigFile ; 1757 1780 version(BuildVerbose) 1758 1781 { 1759 1782 if (vVerbose == True) 1760 writefln("Reading from config: %s", lPath);1761 } 1762 util.fileex.GetTextLines(l Path, 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); 1763 1786 1764 1787 … … 1772 1795 { 1773 1796 if (vVerbose == True) 1774 writefln(" Line %d: %s", i+1, lLine);1797 std.stdio.writefln(" Line %d: %s", i+1, lLine); 1775 1798 } 1776 1799 … … 1820 1843 { 1821 1844 if(vVerbose == True) 1822 writefln(" use %s",vLibPaths);1845 std.stdio.writefln(" use %s",vLibPaths); 1823 1846 } 1824 1847 continue; … … 1887 1910 if(vVerbose == True) 1888 1911 { 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); 1891 1914 } 1892 1915 } … … 1900 1923 if (pList.length > 0) { 1901 1924 if (pTitle.length > 0) 1902 writefln("\n%s",pTitle);1925 std.stdio.writefln("\n%s",pTitle); 1903 1926 1904 1927 foreach(int lIndex, char[] lListEntry; pList) { 1905 writefln(" [%2d]: %s",lIndex,lListEntry);1928 std.stdio.writefln(" [%2d]: %s",lIndex,lListEntry); 1906 1929 } 1907 1930 } … … 1909 1932 1910 1933 // ------------------------------------------- 1911 void DisplayItems( ExternRef[] pList, char[] pTitle = "")1934 void DisplayItems(source.ExternRef[] pList, char[] pTitle = "") 1912 1935 // ------------------------------------------- 1913 1936 { 1914 1937 if (pList.length > 0) { 1915 1938 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); 1921 1944 if (lListEntry.ToolOpts.length > 0) 1922 1945 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 // ------------------------------------------- 1953 void 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 } 1933 1973 } 1934 1974 … … 2004 2044 } 2005 2045 2046 void 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 } 2006 2066 2007 2067 // ------------------------------- … … 2009 2069 // ------------------------------- 2010 2070 { 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 2011 2099 foreach(char[] lArg; pArgGroup) 2012 2100 { 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); 2014 2110 } 2015 2111 } … … 2037 2133 source.GetFullPathname = &GetFullPathname; 2038 2134 source.GetFullPathnameScan = &GetFullPathnameScan; 2039 source.GetObjWritePath = &GetTemporaryPath;2040 2135 source.AddCompilerArg = &AddCompilerArg; 2041 2136 source.GetAppPath = &GetAppPath; … … 2062 2157 2063 2158 // 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); 2066 2161 version (Windows) 2067 2162 { 2068 2163 int DotPos; 2069 DotPos = rfind(vAppName, '.');2164 DotPos = std.string.rfind(vAppName, '.'); 2070 2165 if (DotPos != -1) 2071 2166 { … … 2094 2189 { 2095 2190 source.vVerboseMode = vVerbose; 2191 2096 2192 util.fileex.vVerbose = vVerbose; 2193 2097 2194 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 2100 2200 util.fileex.vTestRun = vTestRun; 2101 2102 ExamineArgs( vCombinedArgs ); 2103 2104 source.mCollectUses = vCollectUses; 2201 source.mCollectUses = vCollectUses; 2105 2202 source.vForceCompile = vForceCompile; 2203 source.ObjWritePath = vTemporaryPath; 2106 2204 2107 2205 // Grab the external macro definitions unless otherwise told not to. … … 2122 2220 { 2123 2221 if ((vVerbose == True) || (vNames == True) ) 2124 writefln("Current Dir '%s'", util.pathex.GetInitCurDir());2222 std.stdio.writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 2125 2223 } else { 2126 2224 if (vNames == True) 2127 writefln("Current Dir '%s'", util.pathex.GetInitCurDir());2225 std.stdio.writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 2128 2226 } 2129 2227 … … 2133 2231 { 2134 2232 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", 2136 2234 vCompilerExe); 2137 2235 } … … 2194 2292 { 2195 2293 if (vVerbose == True) 2196 writefln("Compiler installed in %s",vCompilerPath);2294 std.stdio.writefln("Compiler installed in %s",vCompilerPath); 2197 2295 } 2198 2296 … … 2210 2308 { 2211 2309 vDefaultLibs ~= "c"; 2212 vDefaultLibs ~= "phobos"; 2310 version(DigitalMars) 2311 { 2312 vDefaultLibs ~= "phobos"; 2313 } 2314 version(GNU) 2315 { 2316 vDefaultLibs ~= "gphobos"; 2317 } 2318 vDefaultLibs ~= "pthread"; 2213 2319 vDefaultLibs ~= "m"; 2214 2320 } … … 2242 2348 { 2243 2349 if (vSilent == False) 2244 writefln("** File '%s' not found.", lFile);2350 std.stdio.writefln("** File '%s' not found.", lFile); 2245 2351 lAllExist = false; 2246 2352 } … … 2259 2365 if(vVerbose == True) 2260 2366 { 2261 writefln("");2262 DisplayItems(v BuildArgs,"build args: ...............");2367 std.stdio.writefln(""); 2368 DisplayItems(vReceivedArgs, "build args: ..............."); 2263 2369 DisplayItems(vCompilerArgs, "compiler args: ................"); 2264 2370 DisplayItems(vCmdLineSourceFiles, "command line files: ..............."); 2265 DisplayItems( Source.AllFiles,2371 DisplayItems(source.Source.AllFiles, 2266 2372 "source files: ..............."); 2267 2373 DisplayItems(vLinkFiles.keys, "link files: ..............."); … … 2280 2386 char[] lSymbolOutName; 2281 2387 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 ); 2306 2415 if (lModuleCount != 0) 2307 2416 { … … 2312 2421 vSymbolOutName = util.pathex.GetBaseName(vTargetName) ~ vModOutFile; 2313 2422 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 } 2319 2435 } 2320 2436 … … 2326 2442 lPrevLine.length = 0; 2327 2443 lFile ~= "[USES]\n"; 2328 foreach(char[] lLine; Source.Uses.sort)2444 foreach(char[] lLine; source.Source.Uses.sort) 2329 2445 { 2330 2446 if (lLine != lPrevLine) … … 2337 2453 lPrevLine.length = 0; 2338 2454 lFile ~= "[USEDBY]\n"; 2339 foreach(char[] lLine; Source.UsedBy.sort)2455 foreach(char[] lLine; source.Source.UsedBy.sort) 2340 2456 { 2341 2457 if (lLine != lPrevLine) … … 2349 2465 vUsesOutput = util.pathex.GetBaseName(vTargetName) ~ ".use"; 2350 2466 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 2352 2478 2353 2479 } … … 2359 2485 // Put at one blank line out first to separate it 2360 2486 // 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), 2364 2490 std.string.strip(vRunParms)); 2365 2491 } … … 2393 2519 { 2394 2520 if (pVerbose == True) 2395 writefln("Response file %s", lRespFileName);2521 std.stdio.writefln("Response file %s", lRespFileName); 2396 2522 } 2397 2523 … … 2413 2539 { 2414 2540 if (pVerbose == True) 2415 writefln("Response file arg: %s", lArg);2541 std.stdio.writefln("Response file arg: %s", lArg); 2416 2542 } 2417 2543 GatherOneArg( lArg, vCombinedArgs ); … … 2419 2545 } 2420 2546 } 2547 2548 struct CmdLineArg 2549 { 2550 char[] ArgText; 2551 Bool CompilerArg; 2552 Bool DFlag; 2553 } 2554 CmdLineArg[] vReceivedArgs; 2421 2555 2422 2556 void ProcessCmdLineArg( char[] pArg ) … … 2454 2588 } 2455 2589 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 2456 2598 switch(pArg) { 2457 2599 case "-full": 2458 2600 vForceCompile = True; 2459 vBuildArgs ~= pArg;2460 2601 // Not passed thru. 2461 2602 break; 2462 2603 2463 2604 case "-link": 2464 Source.WasMainFound = true; 2465 vBuildArgs ~= pArg; 2605 source.Source.WasMainFound = true; 2466 2606 // Not passed thru. 2467 2607 break; … … 2469 2609 case "-nolink": 2470 2610 vNoLink = True; 2471 vBuildArgs ~= pArg;2472 2611 // Not passed thru. 2473 2612 break; … … 2475 2614 case "-lib": 2476 2615 vLibraryAction = LibOpt.Build; 2477 vBuildArgs ~= pArg;2478 2616 // Not passed thru. 2479 2617 break; … … 2481 2619 case "-nolib": 2482 2620 vLibraryAction = LibOpt.DontBuild; 2483 vBuildArgs ~= pArg;2484 2621 // Not passed thru. 2485 2622 break; … … 2488 2625 vLibraryAction = LibOpt.DontBuild; 2489 2626 vNoLink = True; 2490 vBuildArgs ~= pArg;2491 2627 // Not passed thru. 2492 2628 break; … … 2495 2631 // Not passed thru. Deprecated switch is now ignored. 2496 2632 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."); 2498 2634 break; 2499 2635 2500 2636 case "-info": 2501 2637 DisplayUsage(false); 2502 vBuildArgs ~= pArg;2503 2638 // Not passed thru. 2504 2639 break; … … 2506 2641 case "-silent": 2507 2642 vSilent = True; 2508 vBuildArgs ~= pArg;2509 2643 // Not passed thru. 2510 2644 break; … … 2512 2646 case "-noautoimport": 2513 2647 vAutoImports = False; 2514 vBuildArgs ~= pArg;2515 2648 // Not passed thru 2516 2649 break; … … 2518 2651 case "-nodef": 2519 2652 vNoDef = True; 2520 vBuildArgs ~= pArg;2521 2653 // Not passed thru. 2522 2654 break; … … 2524 2656 case "-nomacro": 2525 2657 vMacroInput = False; 2526 vBuildArgs ~= pArg;2527 2658 // Not passed thru. 2528 2659 break; … … 2533 2664 case "-?": 2534 2665 DisplayUsage(); 2535 vBuildArgs ~= pArg;2536 2666 // Not passed thru. 2537 2667 break; … … 2539 2669 case "-allobj": 2540 2670 vAllObjects = True; 2541 vBuildArgs ~= pArg;2542 2671 // Not passed thru. 2543 2672 break; … … 2545 2674 case "-test": 2546 2675 vTestRun = True; 2547 vBuildArgs ~= pArg;2548 2676 // Not passed thru. 2549 2677 break; … … 2553 2681 case "-clean": 2554 2682 vCleanup = True; 2555 vBuildArgs ~= pArg;2556 2683 // Not passed thru. 2557 2684 break; 2558 2685 2559 2686 case "-V": /* we need verbose status earlier */ 2560 vBuildArgs ~= pArg;2561 2687 // Not passed thru. 2562 2688 break; 2563 2689 2564 2690 case "-names": 2565 vBuildArgs ~= pArg;2566 2691 vNames = True; 2567 2692 // Not passed thru. … … 2576 2701 // Requires symbolic debug info. 2577 2702 vLinkerDefs ~= vSymInfoSwitch; 2578 AddCompilerArg(pArg);2703 vReceivedArgs[$-1].CompilerArg = True; 2579 2704 break; 2580 2705 } … … 2584 2709 { 2585 2710 vLibrarianOpts ~= " " ~ pArg[7..$].dup; 2586 vBuildArgs ~= pArg;2587 2711 break; 2588 2712 … … 2592 2716 { 2593 2717 vLibPaths ~= vConfigSep ~ pArg[9..$].dup; 2594 vBuildArgs ~= pArg;2595 2718 break; 2596 2719 } … … 2614 2737 ProcessOneBuildConfig("+" ~ lSubSection, False, lFile, lLocalArgs); 2615 2738 } 2616 vBuildArgs ~= pArg;2617 2739 ExamineArgs(lLocalArgs); 2618 2740 break; … … 2635 2757 vSymbolOutName = pArg[8..$]; 2636 2758 } 2637 vBuildArgs ~= pArg;2638 2759 // Not passed thru. 2639 2760 break; … … 2649 2770 { 2650 2771 if (vVerbose == True) 2651 writefln("DCPATH was %s now %s", vCompilerPath, lNewPath);2772 std.stdio.writefln("DCPATH was %s now %s", vCompilerPath, lNewPath); 2652 2773 } 2653 2774 vCompilerPath = lNewPath; 2654 2775 util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 2655 vBuildArgs ~= pArg;2656 2776 break; 2657 2777 … … 2666 2786 { 2667 2787 if (vVerbose == True) 2668 writefln("CFPATH was %s now %s", vConfigPath, lNewPath);2788 std.stdio.writefln("CFPATH was %s now %s", vConfigPath, lNewPath); 2669 2789 } 2670 2790 vOverrideConfigPath = lNewPath; 2671 vBuildArgs ~= pArg;2672 2791 util.str.SetEnv("@P", std.path.getDirName(vOverrideConfigPath)); 2673 2792 break; … … 2681 2800 { 2682 2801 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 2687 2805 if ( util.str.ends(lNewPath, std.path.sep) == False) 2688 2806 lNewPath ~= std.path.sep; … … 2697 2815 { 2698 2816 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..$]); 2700 2818 } 2701 2819 2702 2820 source.vRDFName = pArg[4..$].dup; 2703 vBuildArgs ~= pArg;2704 2821 break; 2705 2822 … … 2711 2828 { 2712 2829 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..$]); 2714 2831 } 2715 2832 2716 2833 vDefMacroDefFile = pArg[4..$].dup; 2717 vBuildArgs ~= pArg;2718 2834 break; 2719 2835 … … 2723 2839 { 2724 2840 vDelayedValue = &lImportSwitch; 2725 vBuildArgs ~= pArg;2726 2841 break; 2727 2842 } … … 2738 2853 { 2739 2854 if(vVerbose == True) 2740 writefln("Added root from command line = %s",lRoot);2855 std.stdio.writefln("Added root from command line = %s",lRoot); 2741 2856 } 2742 2857 } … … 2749 2864 vRunParms ~= pArg[vRunSwitch.length .. $] ~ " "; 2750 2865 vExecuteProgram = True; 2751 vBuildArgs ~= pArg;2752 2866 break; 2753 2867 } … … 2757 2871 2758 2872 vCollectUses = True; 2759 vBuildArgs ~= pArg;2760 2873 if (pArg.length > 5) 2761 2874 { … … 2771 2884 { 2772 2885 2773 vBuildArgs ~= pArg;2774 2886 vUseModBaseName = util.str.YesNo(pArg, true); 2775 Source.UseModBaseName(vUseModBaseName);2887 source.Source.UseModBaseName(vUseModBaseName); 2776 2888 break; 2777 2889 } … … 2781 2893 { 2782 2894 2783 vBuildArgs ~= pArg;2784 2895 vAutoWinLibs = util.str.YesNo(pArg, true); 2785 2896 break; … … 2802 2913 { 2803 2914 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); 2805 2916 } 2806 2917 util.pathex.MakePath(lRoot); 2807 2918 } 2808 2919 2809 vBuildArgs ~= pArg; 2920 2810 2921 // 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 } 2811 2927 } 2812 2928 } … … 2816 2932 // Modules to ignore (eg. -Xmylib) 2817 2933 vModulesToIgnore ~= pArg[2..$]; 2818 vBuildArgs ~= pArg;2819 2934 break; 2820 2935 } … … 2824 2939 // Modules to notice (eg. -Mphobos) 2825 2940 vModulesToNotice ~= pArg[2..$]; 2826 vBuildArgs ~= pArg;2827 2941 break; 2828 2942 } … … 2831 2945 { 2832 2946 // 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)); 2835 2951 break; 2836 2952 } … … 2842 2958 // Target name (eg. -oftestapp) 2843 2959 vCommandTargetName = pArg[vOutFileSwitch.length .. $]; 2844 vBuildArgs ~= pArg;2845 2960 break; 2846 2961 } … … 2853 2968 // Target name (eg. -o testapp) 2854 2969 vDelayedValue = &vCommandTargetName; 2855 vBuildArgs ~= pArg;2856 2970 break; 2857 2971 } … … 2861 2975 { 2862 2976 char lValue; 2863 vBuildArgs ~= pArg;2864 2977 // Response file usage (eg. -R=Yes) 2865 2978 if (pArg.length == 2) … … 2873 2986 if (util.str.IsLike(pArg, "-gui*"d) == True) 2874 2987 { 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) 2883 2990 break; 2991 if (pArg[4] == ':') 2992 vWinVer = pArg[5..length]; 2993 else 2994 vWinVer = pArg[4..length]; 2995 break; 2884 2996 } 2885 2997 2886 2998 if (pArg == "-dll") 2887 2999 { 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; 2895 3006 2896 3007 } else { … … 2910 3021 { 2911 3022 if(vVerbose == True) 2912 writefln("Added root from command line = %s",lRoot);3023 std.stdio.writefln("Added root from command line = %s",lRoot); 2913 3024 } 2914 3025 } … … 2918 3029 { 2919 3030 *vDelayedValue = pArg; 2920 v BuildArgs ~=pArg;3031 vReceivedArgs[$-1].ArgText ~= " " ~ pArg; 2921 3032 } 2922 3033 vDelayedValue = null; … … 2930 3041 pArg = std.string.replace(pArg, "/", std.path.sep); 2931 3042 } 2932 3043 pArg = util.pathex.AbbreviateFileName(util.pathex.CanonicalPath(pArg, false)); 2933 3044 auto lArgExt = std.path.getExt(pArg); 2934 3045 if (lArgExt == "") … … 2961 3072 { 2962 3073 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)); 2964 3075 } 2965 3076 } … … 2970 3081 } 2971 3082 2972 boolGatherOneArg( char[] pArg, inout char[][] pArgGroup )3083 void GatherOneArg( char[] pArg, inout char[][] pArgGroup ) 2973 3084 { 2974 3085 static bool[char[]] lKnownArgs; 2975 bool lMergeArg = false;2976 3086 2977 3087 pArg = std.string.strip(pArg); 2978 3088 if (pArg.length == 0) 2979 return lMergeArg;3089 return; 2980 3090 2981 3091 version(BuildVerbose) … … 2987 3097 if ( pArg.length >= 2 && pArg[0..2] == "--") 2988 3098 { // Need to remove an earlier matching argument. 2989 pArg = pArg[1..$];2990 3099 version(BuildVerbose) 2991 3100 { 2992 if ((pArg == "- V") || (pArg == "-v"))3101 if ((pArg == "--V") || (pArg == "--v")) 2993 3102 vVerbose = False; 2994 3103 } 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] == '@') || 3014 3111 (util.str.ends(pArg, "." ~ vResponseExt) is True) 3015 3112 ) … … 3038 3135 } 3039 3136 3040 return lMergeArg;3041 3137 } 3042 3138 … … 3073 3169 } 3074 3170 3171 version(darwin) 3172 { 3173 ProcessBuildConfig("+darwin", lVerbose, vCombinedArgs); 3174 } 3175 3075 3176 version(Windows) 3076 3177 { … … 3094 3195 ProcessBuildConfig("+Posix:GNU", lVerbose, vCombinedArgs); 3095 3196 } 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 } 3099 3204 3100 3205 // Collect from original command line. 3101 foreach( char[] lArg; pArgs)3206 foreach( char[] lArg; vCompilerDefs ~ pArgs) 3102 3207 { 3103 3208 GatherOneArg( lArg, vCombinedArgs ); … … 3142 3247 { 3143 3248 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); 3145 3250 } 3146 3251 3147 3252 lMacroDefLines = util.fileex.GetTextLines(lMacroDefFileName, util.fileex.GetOpt.Always); 3148 3253 3149 AddMacros( "build", lMacroDefLines, lMessages);3254 util.macro.AddMacros( "build", lMacroDefLines, lMessages); 3150 3255 version(BuildVerbose) 3151 3256 { … … 3154 3259 foreach(char[] lMsg; lMessages) 3155 3260 { 3156 writefln("%s", lMsg);3261 std.stdio.writefln("%s", lMsg); 3157 3262 } 3158 3263 } … … 3184 3289 { 3185 3290 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..$]); 3187 3292 } 3188 3293 … … 3252 3357 { 3253 3358 if (pVerbose == True) 3254 writefln("Build Configuration file arg: %s", lArg);3359 std.stdio.writefln("Build Configuration file arg: %s", lArg); 3255 3360 } 3256 3361 … … 3260 3365 } 3261 3366 3262 if ( lArg.begins("CMDLINE=") == True)3367 if (util.str.begins(lArg, "CMDLINE=") == True) 3263 3368 { 3264 3369 int lStartPos; … … 3295 3400 3296 3401 } 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) 3298 3407 { 3299 3408 SetFileLocation(lArg[7..$], vLibrarianPath, vLibrarian, "librarian"); 3300 3409 } 3301 else if ( lArg.begins("COMPCMD=") == True)3410 else if (util.str.begins(lArg, "COMPCMD=") == True) 3302 3411 { 3303 3412 SetFileLocation(lArg[8..$], vCompilerPath, vCompilerExe, "compiler"); 3304 3413 } 3305 else if ( lArg.begins("LINKCMD=") == True)3414 else if (util.str.begins(lArg, "LINKCMD=") == True) 3306 3415 { 3307 3416 SetFileLocation(lArg[8..$], vLinkerPath, vLinkerExe, "linker"); 3308 3417 } 3309 else if ( lArg.begins("LINKSWITCH=") == True)3418 else if (util.str.begins(lArg, "LINKSWITCH=") == True) 3310 3419 { 3311 3420 vLinkerDefs = lArg[11..$].dup; 3312 3421 } 3313 else if ( lArg.begins("INIT:") == True)3422 else if (util.str.begins(lArg, "INIT:") == True) 3314 3423 { 3315 3424 SetInternalString( lArg[5..$] ); … … 3319 3428 { 3320 3429 if (vVerbose == True) 3321 writefln("Bad configuration command '%s' ignored.", lArg);3430 std.stdio.writefln("Bad configuration command '%s' ignored.", lArg); 3322 3431 } 3323 3432 } … … 3336 3445 if (lPos == -1) 3337 3446 { 3338 writefln("Internal String Set '%s' ignored ... '=' not found.", pCommand);3447 std.stdio.writefln("Internal String Set '%s' ignored ... '=' not found.", pCommand); 3339 3448 return; 3340 3449 } … … 3422 3531 case "ArgFileDelim" : { vArgFileDelim = lValue.dup; break; } 3423 3532 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 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 2 208;4 long auto_build_number = 2371; trunk/Source/docsrc/User_Manual.d
r48 r49 103 103 $(SECTION $(SECTIONDEF_H authors, Authors:, Derek Parnell - Melbourne)) 104 104 $(SECTION $(SECTIONDEF_H create, Initial Creation:, January 2005)) 105 $(SECTION $(SECTIONDEF_H version, Version:, 3.0 2))106 $(SECTION $(SECTIONDEF_H date, Date:, 2 3 June2006))105 $(SECTION $(SECTIONDEF_H version, Version:, 3.03)) 106 $(SECTION $(SECTIONDEF_H date, Date:, 20 September 2006)) 107 107 $(SECTION $(SECTION_H license, License:) 108 108 $(CITE trunk/Source/docsrc/change_log.d
r48 r49 5 5 A list of changes and fixes that have been made. 6 6 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 7 46 $(SUBSECTION_H ,v3.02 -- 23/June/2006 ) 8 47 $(LIST 9 48 $(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. 11 50 ) 12 51 $(ITEM ** $(B FIX: Ticket #28) The Optlink switch options are now … … 51 90 $(ITEM ** $(B ENH:) The 'Rules' functionality now ensures that the 52 91 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 Build92 $(ITEM ** $(B ENH:) The LINKCMD is now able to be used in the $(I $(B utility)) 54 93 configuration file.) 55 94 $(ITEM ** $(B ENH:) A new switch "-uses" will cause the tool to … … 61 100 $(SUBSECTION_H ,v3.00 -- 05/June/2006 ) 62 101 $(LIST 63 $(ITEM ** $(B FIX:) $(I Build) was using the wrong object file during102 $(ITEM ** $(B FIX:) $(I $(B the utility)) was using the wrong object file during 64 103 linkages if a target object file did not exist but one with the same name 65 104 existed in any of the Import paths. 66 105 ) 67 106 $(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. 69 108 ) 70 109 $(ITEM ** $(B FIX: Ticket #10 ) The tool now recognises the … … 110 149 $(LIST 111 150 $(ITEM If defined, the directory defined by the $(I ConfigPath) 112 configuration item in $(I Build's) configuration file. And in this151 configuration item in $(I the utility's) configuration file. And in this 113 152 case it doesn't look anywhere in any of the areas listed below.) 114 153 $(ITEM The current directory.) … … 118 157 $(ITEM The same directory in which the compiler resides.) 119 158 $(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.) 121 160 ) 122 161 ) … … 164 203 ) 165 204 166 $(ITEM ** $(B CHG: ) When building the $(I Build) application itself,205 $(ITEM ** $(B CHG: ) When building the $(I $(B the utility)) application itself, 167 206 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. As169 shipped, the pre-built editions of $(I Build) do not support207 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 170 209 the $(B -V) switch. 171 210 ) … … 215 254 $(ITEM ** $(B FIX:) $(I Thanks to Carlos): In Unix environments, any "-version" 216 255 switch on the Utility's command line was not being converted to the correct Unix 217 format of "-fversion...". So now, if the Build toolgets256 format of "-fversion...". So now, if the utility gets 218 257 either "-version..." or "-fversion=..." on its command line, it will 219 258 recognise it as a 'Version' request for the compiler $(B and) output … … 371 410 $(SUBSECTION_H ,v2.00 -- 08/Apr/2005) 372 411 $(LIST 373 $(ITEM ** $(B FIX): Now supports the raw-string delimiter ` in Build's own412 $(ITEM ** $(B FIX): Now supports the raw-string delimiter ` in the utility's own 374 413 pragma commands. 375 414 ) 376 $(ITEM ** $(B FIX): Now handles backslash escapes in Build's own415 $(ITEM ** $(B FIX): Now handles backslash escapes in the utility's own 377 416 pragma commands. 378 417 ) … … 641 680 Macros: 642 681 Copyright = © 2006, Derek Parnell, Melbourne 643 Title = User Manual for BUILD644 Product = Build Utility682 Title = User Manual for bud 683 Product = bud Utility trunk/Source/docsrc/configuration_file.d
r48 r49 48 48 $(CODE 49 49 LINKSWITCH=/info 50 ) 51 52 $(B FINAL) $(BR) 53 This specifies a command that will run after the target has been 54 successfully created. There can be any number of $(I FINAL) commands 55 in a configuration file; they are all executed, and in the order presented. 56 $(BL) 57 You can place special tokens in the $(I FINAL) command line and these will 58 be 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 74 FINAL="c:\program files\upx202w\upx" --best -q {Target} >nul 50 75 ) 51 76 … … 352 377 # items that only apply when building in Posix (unix). 353 378 379 $(SQR darwin) 380 # items that only apply when building in Macintosh Darwin (OS X). 381 354 382 $(SQR DigitalMars) 355 383 # items that only apply when building with DigitalMars tools. … … 381 409 382 410 $(EXAMPLE , 383 build myapp.d + final384 ) 385 where if a group called '[ final]' is contained in any configuration411 build myapp.d +production 412 ) 413 where if a group called '[production]' is contained in any configuration 386 414 file, the options in that group are used. 387 415 388 $(EXAMPLE contents of [ final],416 $(EXAMPLE contents of [production], 389 417 # This creates a production (release) edition of the app. 390 [ final]418 [production] 391 419 CMDLINE=-T{Target}_{Group} # Set the name of the executable. 392 420 CMDLINE=-release # Don't generate runtime checks. trunk/Source/docsrc/user_manual.ddoc
r48 r49 40 40 LP =( 41 41 PAREN =($0) 42 BRACE ={$0} 42 43 DOLLAR =$ 43 44 BL =<br/> <br/> trunk/Source/example_build.cfg
r48 r49 3 3 [Windows] 4 4 LIBCMD=%@D%\..\..\dm\bin\lib.exe 5 CMDLINE=-Iy:\d_proj\build\trunk\source6 CMDLINE=-Iy:\dlibs7 CMDLINE=-Ic:\dmd\import5 # CMDLINE=-Iy:\d_proj\build\trunk\source 6 # CMDLINE=-Iy:\dlibs 7 # CMDLINE=-Ic:\dmd\import 8 8 9 9 [Posix] 10 10 LIBCMD=/bin/ar 11 CMDLINE=-I/usr1/d_proj/build/trunk/source12 CMDLINE=-I/usr2/dlibs13 CMDLINE=-I/usr2/dmd/import11 # CMDLINE=-I/usr1/d_proj/build/trunk/source 12 # CMDLINE=-I/usr2/dlibs 13 # CMDLINE=-I/usr2/dmd/import 14 14 15 15 [Windows:DigitalMars] … … 37 37 # INIT:OutFileSwitch = -of 38 38 # INIT:ImportPath = -I 39 # INIT:Li bLinkSwitch = -l39 # INIT:LinkLibSwitch = -l 40 40 # INIT:LibPathSwitch = -L 41 41 # INIT:MapSwitch = -M … … 92 92 # INIT:OutFileSwitch = "-o " 93 93 # INIT:ImportPath = "-I " 94 # INIT:Li bLinkSwitch = -l94 # INIT:LinkLibSwitch = -l 95 95 # INIT:LibPathSwitch = -L 96 96 # INIT:MapSwitch = -M … … 147 147 # INIT:OutFileSwitch = -of 148 148 # INIT:ImportPath = -I 149 # INIT:Li bLinkSwitch = -l149 # INIT:LinkLibSwitch = -l 150 150 # INIT:LibPathSwitch = -L 151 151 # INIT:MapSwitch = -M … … 202 202 # INIT:OutFileSwitch = "-o " 203 203 # INIT:ImportPath = "-I " 204 # INIT:Li bLinkSwitch = -l-L204 # INIT:LinkLibSwitch = -l-L 205 205 # INIT:LibPathSwitch = -L 206 206 # INIT:MapSwitch = -M trunk/Source/source.d
r48 r49 47 47 private 48 48 { 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; 61 64 } 62 65 … … 75 78 void function(char[] pPath) AddTarget; 76 79 void function(char[] pPath) AddLink; 77 void function(char[] pPath, char[][] pOpts) AddExternal;78 80 void function(char[] pText, bool pReplace=false) AddBuildDef; 79 81 char[][] function( ) ModulesToIgnore; 80 82 char[] function(char[] pFile, char[][] pScanList = null) GetFullPathname; 81 83 char[] function(char[] pFile, int pScanList) GetFullPathnameScan; 82 char[] function() GetObjWritePath;83 84 char[] function() GetAppPath; 84 85 … … 87 88 Bool mCollectUses; 88 89 Bool vForceCompile; 90 char[] ObjWritePath; 89 91 char[] vRDFName = "default.rdf"; 90 92 char[] vPathId; … … 201 203 } 202 204 int FileCount() { return smSourceIndex.length; } 205 203 206 Source opIndex(char[] pFileName) 204 207 { … … 211 214 } 212 215 213 int opApply(int delegate(inout int lCnt, inout Source) dg)216 int AllFiles(int delegate(inout int lCnt, inout Source) dg) 214 217 { 215 218 int result = 0; … … 226 229 } 227 230 228 int opApply(int delegate(inout Source) dg)231 /* int AllFiles(int delegate(inout Source) dg) 229 232 { 230 233 int result = 0; … … 238 241 return result; 239 242 } 240 243 */ 241 244 char[][] AllFiles() 242 245 { … … 363 366 if (std.path.getExt(pFileName) != "ddoc") 364 367 { 368 char[] lAltName; 365 369 mNoLink = (std.path.getExt(pFileName) == "di"); 366 mModuleName = FileToModulename(pFileName );370 mModuleName = FileToModulename(pFileName, lAltName); 367 371 lObjectName = addExt(pFileName,ObjExt); 368 372 mObjectName = util.pathex.AbbreviateFileName(util.pathex.CanonicalPath(lObjectName, false)); … … 376 380 } 377 381 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); 392 401 } 393 402 } … … 400 409 mBuildNumber = -1; 401 410 402 mFileTime = util.fdt.GetFileTime(pFileName);411 mFileTime = new util.fdt.FileDateTime(pFileName); 403 412 mDependantsTime = mFileTime; 404 413 405 mObjectTime = util.fdt.GetFileTime(mObjectName);414 mObjectTime = new util.fdt.FileDateTime(mObjectName); 406 415 UpdateDependantTime(mObjectTime); 407 416 version(BuildVerbose) … … 435 444 // -------------------------------------------------------------------- 436 445 { 437 char[] [] lFiles;438 446 FileDateTime lCurFileTime; 439 447 bool lCanUse; … … 485 493 } 486 494 new Source(lNewFile); 495 delete lFileText; 487 496 return; 488 497 } … … 491 500 // Extract all the module references. 492 501 ProcessTokens(lFileText, lTextPos); 502 delete lFileText; // Remove it from GC control. 493 503 494 504 lCurFileTime = new FileDateTime(); … … 669 679 mBuildNumber++; 670 680 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), 678 690 mBuildNumber) 679 ); 691 ); 692 } 680 693 681 694 if (! (lFileName in smSourceIndex) ) … … 1131 1144 1132 1145 // import lModName.lModName, lModName, lModName.lModName.lModName; 1146 // import name = module : method, method, ... ; 1147 // import name1 = mod1, name2 = mod2, ... ; 1133 1148 1134 1149 while ((lSavedPos = pPos, … … 1136 1151 && (lCurrentToken != ";")) 1137 1152 { 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 { 1140 1163 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 { 1142 1182 lModName ~= lCurrentToken; 1143 1183 } … … 1232 1272 // Add link path to compiler switches. 1233 1273 if (AddLink != null) 1234 AddLink(lPragmaId );1274 AddLink(lPragmaId.dup); 1235 1275 if (lCurrentToken == kCloseParen) 1236 1276 { … … 1249 1289 if ((lCurrentToken != ",") && (lCurrentToken != kCloseParen)) { 1250 1290 if (AddBuildDef != null) 1251 AddBuildDef(lCurrentToken );1291 AddBuildDef(lCurrentToken.dup); 1252 1292 } 1253 1293 if (lCurrentToken == kCloseParen){ … … 1280 1320 } 1281 1321 if (AddTarget != null) 1282 AddTarget(lCurrentToken );1322 AddTarget(lCurrentToken.dup); 1283 1323 } 1284 1324 … … 1602 1642 } 1603 1643 1604 char[] FileToModulename(char[] pFileName )1644 char[] FileToModulename(char[] pFileName, inout char[] pAltName) 1605 1645 { 1606 1646 char[] lModuleName; … … 1609 1649 // Copy the name 1610 1650 lModuleName = util.pathex.AbbreviateFileName(pFileName, GetImportRoots() ); 1651 if (pAltName.ptr == null) 1652 pAltName = lModuleName.dup; 1611 1653 1612 1654 … … 1675 1717 else 1676 1718 { 1719 char[] lAltName; 1677 1720 std.file.write(lFileName, 1678 std.string.format("module %s;\n" , FileToModulename(lFileName )) ~1721 std.string.format("module %s;\n" , FileToModulename(lFileName, lAltName)) ~ 1679 1722 "// This file is automatically maintained by the BUILD utility,\n" 1680 1723 "// Please refrain from manually editing it.\n" … … 1752 1795 } 1753 1796 1797 struct ExternRef 1798 { 1799 char[] FilePath; 1800 char[][] ToolOpts; 1801 char[] Prefix; 1802 char[] Postfix; 1803 char[] Rule; 1804 } 1754 1805 private 1755 1806 { 1756 struct ExternRef1757 {1758 char[] FilePath;1759 char[][] ToolOpts;1760 char[] Prefix;1761 char[] Postfix;1762 char[] Rule;1763 }1764 1807 ExternRef[] vExternals; 1765 1808 } … … 1909 1952 else if (r.InUse == eRuleUsage.Link) 1910 1953 { 1911 AddLink(lInFile );1954 AddLink(lInFile.dup); 1912 1955 } 1913 1956 else if (r.InUse == eRuleUsage.Ignore) … … 1926 1969 else if (r.OutUse == eRuleUsage.Link) 1927 1970 { 1928 AddLink(lOutFile );1971 AddLink(lOutFile.dup); 1929 1972 } 1930 1973 trunk/Source/source_bn.d
r48 r49 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 2 055;4 long 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 **/ 1 50 module util.booltype; 51 version(build) version(BoolUnknown) pragma(include, booltypemac.ddoc); 52 53 54 /** 55 Defines the capabilities of the datatype. 56 57 $(BU_Extra) 58 59 **/ 2 60 3 61 class Bool … … 5 63 int m_Val; 6 64 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 **/ 8 78 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 **/ 9 93 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 **/ 10 114 this(char[] x) { 11 115 switch (x) … … 14 118 "YES", "Yes", "yes", 15 119 "ON", "On", "on", 16 " t",120 "T", "t", 17 121 "1" 18 122 : … … 24 128 } 25 129 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 **/ 36 200 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 } 37 209 // False sorts before True. 38 210 if (m_Val == pOther.m_Val) … … 43 215 } 44 216 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 **/ 46 229 Bool opCom() 47 230 { 231 version(BoolUnknown) 232 { 233 if (m_Val == -1) 234 throw new BoolException("opCom value is not set"); 235 } 48 236 if (m_Val == 1) 49 237 return False; … … 51 239 } 52 240 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) 57 265 return False; 58 266 return True; 59 267 } 60 268 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) 65 293 return True; 66 294 return False; 67 295 } 68 296 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) 73 321 return False; 74 322 return True; 75 323 } 76 324 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 **/ 86 389 int toInt() 87 390 { 391 version(BoolUnknown) 392 { 393 if (m_Val == -1) 394 throw new BoolException("toInt value is not set"); 395 } 88 396 return m_Val; 89 397 } 90 398 91 // --------------------------------- 399 /** 400 * Creates a duplicate of the object. 401 * 402 * Examples: 403 * -------------------- 404 * Bool a = SomeFunc(); 405 * Bool b = a.dup; 406 * -------------------- 407 **/ 92 408 Bool dup() 93 409 { 410 version(BoolUnknown) 411 { 412 if (m_Val == -1) 413 return new Bool(); 414 } 415 94 416 return new Bool(m_Val); 95 417 } 96 418 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 442 static Bool True; /// Literal 'True' value. 443 444 static Bool False; /// Literal 'False' value. 445 446 version(BoolUnknown) 447 { 448 static Bool Unknown; /// Literal 'Unknown' value. 449 } 450 451 private static this() 101 452 { 102 453 True = new Bool(1); 103 454 False = new Bool(0); 104 } 105 455 version(BoolUnknown) 456 { 457 Unknown = new Bool(); 458 } 459 } 460 461 462 version(BoolUnknown) 463 { 464 /** 465 Defines the exception for this class. 466 467 **/ 468 class 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 /* ************************************************************************* 2 2 3 3 @file fdt.d … … 5 5 Copyright (c) 2005 Derek Parnell 6 6 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: 7 26 This software is provided 'as-is', without any express or implied 8 27 warranty. In no event will the authors be held liable for damages … … 27 46 in full and credit the original source. 28 47 &
