Changeset 54

Show
Ignore:
Timestamp:
06/29/09 09:20:29 (3 years ago)
Author:
Derek Parnell
Message:

Pre release #3 of version 3.5
* Remove D2 code.
* Added search roots: parent path of each file, current directory, all subdirs of pwd, parent of pwd, each subdir of each supplied import root, parent of each supplied import root
* Does case-insensitive file name compares in Windows.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/build.d

    r53 r54  
    3232alias char[] text; 
    3333 
    34 version(D_Version2) 
    35 
    36     mixin("alias invariant(dchar)   dcharc;"); 
    37     mixin("alias invariant(wchar)   wcharc;"); 
    38     mixin("alias invariant(char)    charc;"); 
    39 
    40 else 
    41 
     34const vMyVersion = "3.05"; 
    4235    alias char[] string; 
    4336    alias wchar[] wstring; 
     
    4639    alias dchar   dcharc; 
    4740    alias char    charc; 
    48 } 
    49  
    5041 
    5142version(unix)   version = Unix; 
     
    5445version(darwin) version = Posix; 
    5546 
    56 const vMyVersion = "3.05"; 
    5747version(build) pragma(todo, "Single file compilation"); 
    5848version(build) pragma(todo, "Output Paths"); 
     
    364354        delegate int (inout int i, inout source.Source lSource) 
    365355        { 
     356            string lParent; 
     357            string lRoot; 
     358             
     359            lParent = util.pathex.ParentPath(lSource.FileName); 
     360            lRoot = AddRoot( lParent ); 
     361            version(BuildVerbose) 
     362            { 
     363                if(lRoot.length > 0 && opts.Verbose == True)  
     364                { 
     365                    std.stdio.writefln("%s: Extra root added %s", opts.MyName, lRoot); 
     366                } 
     367            } 
     368             
    366369            // Get the next Source object to examine. 
    367370            if (lSource.Ignore) 
     
    16711674        { 
    16721675            // Scan all paths for config file but couldn't find one. 
    1673             throw new BuildException( std.string.format("Unable to find Config File '%s' in \n%s", 
    1674                      opts.ConfigFile, lPotentialPaths)); 
     1676            throw new BuildException( std.string.format("%s: Unable to find Config File '%s' in \n%s", 
     1677                     opts.MyName, opts.ConfigFile, lPotentialPaths)); 
    16751678        } 
    16761679    } 
     
    19061909    string[] lFileExtList; 
    19071910 
    1908     lFileExtList ~= std.file.getExt(pFileName); 
     1911    lFileExtList ~= std.path.getExt(pFileName); 
    19091912    if (lFileExtList[0] == opts.SrcExtension) 
    19101913    { 
     
    21102113    } 
    21112114 
     2115    // Preload import roots from the current directory.     
     2116    { 
     2117        string lCurDir = util.pathex.GetInitCurDir; 
     2118        string lRoot; 
     2119        lRoot = AddRoot(lCurDir); 
     2120        version(BuildVerbose) 
     2121        { 
     2122            if(opts.Verbose == True && lRoot.length > 0) 
     2123                std.stdio.writefln("%s: Added root from current directory = %s", opts.MyName, lRoot); 
     2124        } 
     2125         
     2126        string[] lSubDirs = util.pathex.SubDirs(lCurDir); 
     2127        foreach(string lSubDir; lSubDirs) 
     2128        {         
     2129            lRoot = AddRoot(lSubDir); 
     2130            version(BuildVerbose) 
     2131            { 
     2132                if(opts.Verbose == True && lRoot.length > 0) 
     2133                    std.stdio.writefln("%s: Added root from current directory = %s", opts.MyName, lRoot); 
     2134            } 
     2135        } 
     2136         
     2137        string lParent = util.pathex.ParentPath(lCurDir); 
     2138        lRoot = AddRoot(lParent); 
     2139        version(BuildVerbose) 
     2140        { 
     2141            if(opts.Verbose == True && lRoot.length > 0) 
     2142                std.stdio.writefln("%s: Added root from current directory = %s", opts.MyName, lRoot); 
     2143        } 
     2144    } 
     2145     
    21122146    GatherArgs( pArgs ); 
    21132147 
     
    21262160 
    21272161    if( (vTargetName.length == 0) && (vCommandTargetName.length == 0) ){ 
    2128         throw new BuildException("No target name supplied."); 
     2162        throw new BuildException(opts.MyName ~ ": No target name supplied."); 
    21292163    } 
    21302164 
     
    21622196    if (util.file2.FileExists(opts.CompilerPath ~ opts.CompilerExe) == false) 
    21632197    { 
    2164         throw new BuildException(std.string.format("The compiler '%s' was not found.", 
    2165                 opts.CompilerPath ~ opts.CompilerExe)); 
     2198        throw new BuildException(std.string.format("%s: The compiler '%s' was not found.", 
     2199                opts.MyName, opts.CompilerPath ~ opts.CompilerExe)); 
    21662200    } 
    21672201 
     
    22052239    if ( lAllExist == false) 
    22062240    { 
    2207         throw new BuildException ("Not all supplied files exist."); 
     2241        throw new BuildException (opts.MyName ~ ": Not all supplied files exist."); 
    22082242    } 
    22092243 
     
    29913025    { 
    29923026        if (vEmptyArgs == False) 
    2993             throw new BuildException("Empty arguments are not allowed"); 
     3027            throw new BuildException(opts.MyName ~ ": Empty arguments are not allowed"); 
    29943028        else 
    29953029            return; 
     
    34543488    if (lCmdCount == 0) 
    34553489    { 
    3456         throw new BuildException("No configuration file items found."); 
    3457     } 
    3458 } 
     3490        throw new BuildException(opts.MyName ~ ": No configuration file items found."); 
     3491    } 
     3492} 
  • trunk/Source/build_bn.d

    r53 r54  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 3230
     4long auto_build_number = 3379
  • trunk/Source/opts.d

    r53 r54  
    2929module opts; 
    3030private import opts_bn;    // This module's build number 
    31 version(D_Version2) 
    32 { 
    33     mixin("alias const(dchar)   dcharc;"); 
    34     mixin("alias const(wchar)   wcharc;"); 
    35     mixin("alias const(char)    charc;"); 
    36 } 
    37 else 
    38 { 
    3931    alias char[] string; 
    4032    alias wchar[] wstring; 
     
    4335    alias dchar   dcharc; 
    4436    alias char    charc; 
    45 } 
    4637 
    4738 
  • trunk/Source/opts_bn.d

    r53 r54  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 511
     4long auto_build_number = 640
  • trunk/Source/source.d

    r53 r54  
    3939module source; 
    4040private import source_bn;    // Build number for this module 
    41 version(D_Version2) 
    42 { 
    43     mixin("alias const(wchar)[] wstring;"); 
    44     mixin("alias const(dchar)[] dstring;"); 
    45     mixin("alias const(dchar)   dcharc;"); 
    46     mixin("alias const(wchar)   wcharc;"); 
    47     mixin("alias const(char)    charc;"); 
    48 } 
    49 else 
    50 { 
    5141    alias char[] string; 
    5242    alias wchar[] wstring; 
     
    5545    alias dchar   dcharc; 
    5646    alias char    charc; 
    57 } 
    5847 
    5948 
     
    8473    static import std.file; 
    8574    static import std.string; 
     75    import std.conv; 
    8676} 
    8777 
     
    320310// -------------------------------------------------------------------- 
    321311    { 
    322         if (pFileName in Source.smSourceIndex) 
     312        // Find the file. 
     313        string lFile = ExpandPathName(pFileName, False); 
     314        string lStdName; 
     315        version(Windows) 
     316        { 
     317            lStdName = std.string.tolower(lFile); 
     318        } 
     319        else 
     320        { 
     321            lStdName = lFile; 
     322        } 
     323         
     324        if (lStdName in Source.smSourceIndex) 
    323325        { 
    324326            if (pMode == Source.EMode.Update) 
    325327            { 
    326                 Source.smSourceIndex[pFileName].create(""); 
     328                Source.smSourceIndex[lStdName].create(""); 
    327329            } 
    328330            else 
     
    336338        else 
    337339        { 
    338             create(pFileName); 
     340            if (util.file2.FileExists(lFile) == false) 
     341            { 
     342                if (util.pathex.IsAbsolutePath(pFileName) == True) 
     343                { 
     344                    throw new SourceException(opts.MyName ~ ": File '" ~ pFileName ~ "' was not found at that location."); 
     345                    //return; 
     346                } 
     347                 
     348                lStdName = util.pathex.LocateFile(pFileName, GetImportRoots()); 
     349                if (lStdName.ptr == pFileName.ptr) // Full name not found. 
     350                { 
     351                    lStdName = null; 
     352                     
     353                    L_ScanSubDirs: 
     354                    foreach(string lPotentialDir; GetImportRoots()) 
     355                    { 
     356                        string[] lSubDirs = util.pathex.SubDirs(lPotentialDir); 
     357                        foreach(string lSubDir; lSubDirs) 
     358                        { 
     359     
     360                            if (util.file2.FileExists(lSubDir ~ std.path.sep ~ pFileName) == true) 
     361                            { 
     362                                string lRoot = AddRoot(lSubDir); 
     363                                version(BuildVerbose) 
     364                                { 
     365                                    if(opts.Verbose == True && lRoot.length > 0) 
     366                                        std.stdio.writefln("%s: Added root from sub directory = %s", opts.MyName, lRoot); 
     367                                } 
     368                                lStdName = lSubDir ~ std.path.sep ~ pFileName; 
     369                                break L_ScanSubDirs; 
     370                            } 
     371                        } 
     372                         
     373                        string lParent = util.pathex.ParentPath(lPotentialDir); 
     374                        if (util.file2.FileExists(lParent ~ std.path.sep ~ pFileName) == true) 
     375                        { 
     376                            string lRoot = AddRoot(lParent); 
     377                            version(BuildVerbose) 
     378                            { 
     379                                if(opts.Verbose == True && lRoot.length > 0) 
     380                                    std.stdio.writefln("%s: Added root from parent directory = %s", opts.MyName, lRoot); 
     381                            } 
     382                            lStdName = lParent ~ std.path.sep ~ pFileName; 
     383                            break L_ScanSubDirs; 
     384                        } 
     385                    } 
     386                } 
     387                 
     388                 
     389                if (lStdName.length == 0) 
     390                { 
     391                    throw new SourceException(opts.MyName ~ ": File scan did not find '" ~ pFileName ~ "'."); 
     392                } 
     393                 
     394                lFile = lStdName;   
     395                mFileName = lStdName;               
     396            } 
     397            create(lFile); 
    339398        } 
    340399    } 
     
    346405        string lObjectName; 
    347406 
     407        string lStdName; 
     408        version(Windows) 
     409        { 
     410            lStdName = std.string.tolower(pFileName); 
     411        } 
     412        else 
     413        { 
     414            lStdName = pFileName; 
     415        } 
     416         
    348417        mReferencedImports.length = 0; 
    349418        mHasBeenSearched = false; 
     
    353422            mFileName = pFileName; 
    354423            // Store this instantiation in the list of known files. 
    355             smSourceIndex[pFileName] = this; 
     424            smSourceIndex[lStdName] = this; 
    356425        } 
    357426        else 
     
    445514        if (util.file2.FileExists(mFileName) == false) 
    446515        { 
    447             throw new SourceException("File '" ~ mFileName ~ "' does not exist."); 
     516            throw new SourceException(opts.MyName ~ ": File '" ~ mFileName ~ "' was not found."); 
    448517            //return; 
    449518        } 
     
    457526        if (mHasBeenSearched == false) 
    458527        { 
    459             smScanOrder.length = smScanOrder.length + 1; 
    460             smScanOrder[$-1] = mFileName; 
     528            version(Windows) 
     529            { 
     530                smScanOrder ~= std.string.tolower(mFileName); 
     531            } 
     532            else 
     533            { 
     534                smScanOrder ~= mFileName; 
     535            } 
    461536        } 
    462537 
     
    12461321                        if ((lCurrentToken != ",") && (lCurrentToken != kCloseParen)) 
    12471322                        { 
    1248                             lPragmaId ~= lCurrentToken
     1323                            lPragmaId ~= lCurrentToken.dup
    12491324                        } 
    12501325                        else 
     
    12821357                        if (AddBuildDef != null) 
    12831358                        { 
    1284                             AddBuildDef(lCurrentToken.idup); 
     1359                            AddBuildDef(lCurrentToken.dup); 
    12851360                        } 
    12861361                    } 
     
    13661441                    } 
    13671442                    if (AddTarget != null) 
    1368                         AddTarget(lCurrentToken.idup); 
     1443                        AddTarget(lCurrentToken.dup); 
    13691444                } 
    13701445 
     
    14071482                            } 
    14081483                            else 
    1409                                 lExternOpts[$-1] = lCurrentToken.idup; 
     1484                                lExternOpts[$-1] = lCurrentToken.dup; 
     1485                                 
    14101486 
    14111487                            lCurrentToken = GetNextToken(pFileText,pPos); 
     
    14491525                    if (std.string.tolower(std.path.getExt(lCurrentToken)) == "ddoc") 
    14501526                    { 
    1451                         mReferencedImports ~= lCurrentToken.idup; 
     1527                        mReferencedImports ~= lCurrentToken.dup; 
    14521528                    } 
    14531529                    else 
     
    15211597                        lCurrentToken = `"` ~ GetStringLit(pFileText,pPos, lCurrentToken[0]) ~ `"`; 
    15221598                    } 
    1523                     mLocalArgs ~= lCurrentToken.idup; 
     1599                    mLocalArgs ~= lCurrentToken.dup; 
    15241600                } 
    15251601 
     
    16301706                    } 
    16311707 
    1632                     if (pPos > lLastPos) { throw new SourceException("Mismatched nested comments in " ~ mFileName); } 
     1708                    if (pPos > lLastPos) { throw new SourceException(opts.MyName ~ ": Mismatched nested comments in " ~ mFileName); } 
    16331709                } 
    16341710            } // else 
     
    18841960                if (lRuleIdx + 1 == lRules.length) 
    18851961                    throw new SourceException( 
    1886                             std.string.format("%s: Cannot find rule '%s'", 
    1887                                                pScanningFile, pRef.Rule)); 
     1962                            std.string.format("%s: %s: Cannot find rule '%s'", 
     1963                                               opts.MyName, pScanningFile, pRef.Rule)); 
    18881964                continue; 
    18891965            } 
     
    18961972            if ( (lExtension != r.Input) && (lExtension != r.Output)) 
    18971973                throw new SourceException( 
    1898                         std.string.format("%s: Using rule '%s' for file '%s'" 
     1974                        std.string.format("%s: %s: Using rule '%s' for file '%s'" 
    18991975                                          " but no matching file type in rule.", 
    1900                                                pScanningFile, pRef.Rule, pRef.FilePath)); 
     1976                                               opts.MyName, pScanningFile, pRef.Rule, pRef.FilePath)); 
    19011977        } 
    19021978 
     
    19181994        if (! util.file2.FileExists( lInFile ) ) 
    19191995            throw new SourceException( 
    1920                 std.string.format("External input file '%s' not found", lInFile)); 
     1996                std.string.format("%s: External input file '%s' not found", opts.MyName, lInFile)); 
    19211997 
    19221998        string lTemp; 
     
    19972073        { 
    19982074            if (Source[lInFile] is null) 
     2075            { 
    19992076                new Source(lInFile); 
     2077            } 
    20002078        } 
    20012079        else if (r.InUse == eRuleUsage.Link) 
     
    20692147                { 
    20702148                    throw new SourceException( 
    2071                         std.string.format("Rule '%s' does not specify a tool to use.", 
    2072                             lRules[$-1].Name)); 
     2149                        std.string.format("%s: Rule '%s' does not specify a tool to use.", 
     2150                            opts.MyName, lRules[$-1].Name)); 
    20732151                } 
    20742152            } 
     
    21652243    if (lRunResult != 0) 
    21662244        // If an external tool fails, stop immediately. 
    2167         throw new SourceException(std.string.format("External Tool for %s failed with code %s", pPath, lRunResult)); 
     2245        throw new SourceException(std.string.format("%s: External Tool for %s failed with code %s",  
     2246                                opts.MyName, pPath, lRunResult)); 
    21682247} 
    21692248 
  • trunk/Source/source_bn.d

    r53 r54  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 2933
     4long auto_build_number = 3076
  • trunk/Source/util/booltype.d

    r52 r54  
    5050module util.booltype; 
    5151version(build) version(BoolUnknown) pragma(include, booltypemac.ddoc); 
    52 version(D_Version2) 
    53 { 
    54     mixin("alias invariant(dchar)   dcharc;"); 
    55     mixin("alias invariant(wchar)   wcharc;"); 
    56     mixin("alias invariant(char)    charc;"); 
    57 } 
    58 else 
    59 { 
    6052    alias char[] string; 
    6153    alias wchar[] wstring; 
     
    6456    alias dchar   dcharc; 
    6557    alias char    charc; 
    66 } 
    6758 
    6859 
     
    7768class Bool 
    7869{ 
     70    //alias super.opCmp opCmp; 
     71    //alias super.opEquals opEquals; 
    7972    int m_Val; 
    8073 
     
    186179       *  -------------------- 
    187180    **/ 
     181     alias Object.opEquals opEquals; 
     182      
    188183    int opEquals(Bool pOther) { 
    189184        version(BoolUnknown) 
     
    214209       *  -------------------- 
    215210    **/ 
     211    alias Object.opCmp opCmp; 
    216212    int opCmp(Bool pOther) { 
    217213        version(BoolUnknown) 
  • trunk/Source/util/fdt.d

    r52 r54  
    5454version(linux)  version = Posix; 
    5555version(darwin) version = Posix; 
    56 version(D_Version2) 
    57 { 
    58     mixin("alias invariant(dchar)   dcharc;"); 
    59     mixin("alias invariant(wchar)   wcharc;"); 
    60     mixin("alias invariant(char)    charc;"); 
    61 } 
    62 else 
    63 { 
    6456    alias char[] string; 
    6557    alias wchar[] wstring; 
     
    6860    alias dchar   dcharc; 
    6961    alias char    charc; 
    70 } 
    7162 
    7263 
     
    194185               *  -------------------- 
    195186            **/ 
     187            alias Object.opEquals opEquals; 
    196188            int opEquals(FileDateTime pOther) { return Compare(pOther) == 0; } 
    197189 
     
    213205               *  -------------------- 
    214206            **/ 
     207            alias Object.opCmp opCmp; 
    215208            int opCmp(FileDateTime pOther) { return Compare(pOther); } 
    216209 
     
    329322               *  -------------------- 
    330323            **/ 
     324             
    331325            string toString(bool pExact = false) 
    332326            { 
     
    432426            } 
    433427 
    434             this(char[] pFileName) 
     428            this(string pFileName) 
    435429            { 
    436430                GetFileTime( pFileName ); 
     
    442436            } 
    443437 
    444             this(dchar[] pFileName) 
     438            this(dstring pFileName) 
    445439            { 
    446440                GetFileTime( std.utf.toUTF8(pFileName) ); 
     
    461455                return 0; 
    462456            } 
    463  
    464             char[] toString() 
     457             
     458            string toString() 
    465459            { 
    466460                if ( mSet == False ) 
     
    472466 
    473467 
    474             private void GetFileTime(char[] pFileName) 
     468            private void GetFileTime(string pFileName) 
    475469            { 
    476470 
  • trunk/Source/util/file2.d

    r52 r54  
    3939module util.file2; 
    4040private import util.file2_bn;   // The build number for this module. 
    41 version(D_Version2) 
    42 { 
    43     mixin("alias const(wchar)[] wstring;"); 
    44     mixin("alias const(dchar)[] dstring;"); 
    45     mixin("alias const(dchar)   dcharc;"); 
    46     mixin("alias const(wchar)   wcharc;"); 
    47     mixin("alias const(char)    charc;"); 
    48 } 
    49 else 
    50 { 
    5141    alias char[] string; 
    5242    alias wchar[] wstring; 
     
    5545    alias dchar   dcharc; 
    5646    alias char    charc; 
    57 } 
    5847 
    5948 
     
    8473        return true; 
    8574    } 
    86     try { 
    87     if(std.file.isfile(pFileName) && std.file.exists(pFileName)) 
     75     
     76    try  
    8877    { 
    89         lExistingFiles[pFileName] = true; 
    90         return true; 
    91     } 
     78        if(std.file.isfile(pFileName) && std.file.exists(pFileName)) 
     79        { 
     80            lExistingFiles[pFileName] = true; 
     81            return true; 
     82        } 
    9283    } catch { }; 
    9384    return false; 
     
    9788void PurgeFileExistsCache() 
    9889{ 
    99     string[] lKeys; 
    100  
    101     lKeys = lExistingFiles.keys.dup; 
    102     foreach(string lFile; lKeys) 
    103     { 
    104         lExistingFiles.remove(lFile); 
    105     } 
     90    lExistingFiles = null; 
    10691} 
    10792 
  • trunk/Source/util/file2_bn.d

    r53 r54  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 936
     4long auto_build_number = 1063
  • trunk/Source/util/fileex.d

    r52 r54  
    4444version(linux)  version = Posix; 
    4545version(darwin) version = Posix; 
    46 version(D_Version2) 
    47 { 
    48     mixin("alias invariant(dchar)   dcharc;"); 
    49     mixin("alias invariant(wchar)   wcharc;"); 
    50     mixin("alias invariant(char)    charc;"); 
    51 } 
    52 else 
    53 { 
    5446    alias char[] string; 
    5547    alias wchar[] wstring; 
     
    5850    alias dchar   dcharc; 
    5951    alias char    charc; 
    60 } 
    6152 
    6253alias char[] text; 
     
    206197int grep(string pData, string pPattern) 
    207198{ 
    208     return std.regexp.find(pData.idup, pPattern.idup, vGrepOpts[$-1].idup); 
     199    return std.regexp.find(pData, pPattern, vGrepOpts[$-1]); 
    209200} 
    210201 
     
    367358    return RunCommand( util.str.enquote(pExeName) ~ " " ~ pCommand, pCallBack); 
    368359} 
     360 
     361import std.c.string; 
     362//------------------------------------------------------- 
     363string copystrz(char* s) 
     364//------------------------------------------------------- 
     365{ 
     366    string ts; 
     367    char* tsp; 
     368     
     369    ts.length = std.c.string.strlen(s) + 1; 
     370    tsp = ts.ptr; 
     371    while(*s) 
     372        *tsp++ = *s++; 
     373    *tsp = '\0'; 
     374    return ts; 
     375} 
     376 
    369377//------------------------------------------------------- 
    370378int RunCommand(string pCommand, runCallBack pCallBack = null) 
     
    372380{ 
    373381    int lRC; 
    374     int lTrueRC; 
    375382 
    376383    if (pCallBack !is null) 
     
    380387          return 0; 
    381388    } 
    382  
    383  
    384     lRC = system(std.string.toStringz(pCommand)); 
    385     version(Posix) lTrueRC = ((lRC & 0xFF00) >> 8); 
    386     version(Windows) lTrueRC = lRC; 
    387  
    388     pCallBack(2, pCommand, lTrueRC); 
    389     return lTrueRC; 
    390  
    391 
    392  
     389    string TempStr; 
     390 
     391    TempStr = copystrz(std.string.toStringz(pCommand)); 
     392     
     393    lRC = system(TempStr.ptr); 
     394    version(Posix) lRC = ((lRC & 0xFF00) >> 8); 
     395 
     396    if (pCallBack !is null) 
     397        pCallBack(2, pCommand, lRC); 
     398    return lRC; 
     399
     400 
  • trunk/Source/util/fileex_bn.d

    r53 r54  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 2736; 
     4long auto_build_number = 2876; 
  • trunk/Source/util/linetoken.d

    r52 r54  
    3838module util.linetoken; 
    3939private import util.linetoken_bn; 
    40 version(D_Version2) 
    41 { 
    42     mixin("alias const(dchar)   dcharc;"); 
    43     mixin("alias const(wchar)   wcharc;"); 
    44     mixin("alias const(char)    charc;"); 
    45 } 
    46 else 
    47 { 
    4840    alias char[] string; 
    4941    alias wchar[] wstring; 
     
    5244    alias dchar   dcharc; 
    5345    alias char    charc; 
    54 } 
    5546 
    5647 
  • trunk/Source/util/linetoken_bn.d

    r53 r54  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 2883
     4long auto_build_number = 2997
  • trunk/Source/util/macroex.d

    r52 r54  
    3737**************************************************************************/ 
    3838module util.macroex; 
    39 version(D_Version2) 
    40 { 
    41     mixin("alias invariant(dchar)   dcharc;"); 
    42     mixin("alias invariant(wchar)   wcharc;"); 
    43     mixin("alias invariant(char)    charc;"); 
    44 } 
    45 else 
    46 { 
    4739    alias char[] string; 
    4840    alias wchar[] wstring; 
     
    5143    alias dchar   dcharc; 
    5244    alias char    charc; 
    53 } 
    5445 
    5546 
  • trunk/Source/util/pathex.d

    r52 r54  
    3939module util.pathex; 
    4040private import util.pathex_bn;   // The build number for this module. 
    41 version(D_Version2) 
    42 { 
    43     mixin("alias invariant(dchar)   dcharc;"); 
    44     mixin("alias invariant(wchar)   wcharc;"); 
    45     mixin("alias invariant(char)    charc;"); 
    46 } 
    47 else 
    48 { 
    4941    alias char[] string; 
    5042    alias wchar[] wstring; 
     
    5345    alias dchar   dcharc; 
    5446    alias char    charc; 
    55 } 
    5647 
    5748 
     
    119110    string lOrigDir; 
    120111    string lCurDir; 
    121     text lDrive; 
     112    string lDrive; 
    122113 
    123114    lOrigDir =  std.file.getcwd(); 
    124     lDrive.length = 2; 
    125     lDrive[0] = pDrive; 
    126     lDrive[1] = ':'; 
    127     std.file.chdir(lDrive.idup); 
     115    lDrive = pDrive ~ ":"; 
     116    std.file.chdir(lDrive); 
    128117    lCurDir = std.file.getcwd(); 
    129118    std.file.chdir(lOrigDir[0..2]); 
     
    283272          if (lRetLen != 0) 
    284273          { 
    285                   lPath = lShortPath[0..lRetLen].idup ~ lFileNamePart
     274              lPath = (lShortPath[0..lRetLen] ~ lFileNamePart).dup
    286275          } 
    287276      } 
     
    428417 
    429418// ---------------------------------------------- 
     419string ParentPath(string pPath) 
     420// ---------------------------------------------- 
     421{ 
     422    // Strip off any terminal path separator. 
     423    if (pPath.length > 0 && pPath[$-1] == std.path.sep[0]) 
     424    { 
     425        pPath.length = pPath.length - 1; 
     426    } 
     427     
     428    string lFullName = CanonicalPath(pPath, False, False); 
     429     
     430    // extract out the parent directory 
     431    for (int i = lFullName.length-1; i >= 0; i--) 
     432    { 
     433        if (lFullName[i] == std.path.sep[0]) 
     434            return lFullName[0 .. i]; 
     435    } 
     436    return ""; // Should never get here. 
     437 
     438} 
     439 
     440 
     441// ---------------------------------------------- 
    430442Bool MakePath(string pNewPath) 
    431443// ---------------------------------------------- 
     
    460472        } 
    461473    } 
    462     version(Windows) { 
     474    version(Windows)  
     475    { 
     476        // Strip off any drive specified. 
    463477        if ((lNewPath.length > 0) && (lNewPath[length-1] == ':')) 
    464478            lNewPath.length = 0; 
     
    467481    if (lNewPath.length == 0) 
    468482        return False; 
    469     else { 
     483         
    470484    // extract out the parent directory 
    471485    for (int i = lNewPath.length-1; i >= 0; i--) 
     
    479493 
    480494    // make sure the parent exists. 
    481     version(Windows) { 
     495    version(Windows)  
     496    { 
    482497        if ((lParentPath.length > 0) && (lParentPath[length-1] == ':')) 
    483498                lParentPath.length = 0; 
    484499    } 
     500     
    485501    if (lParentPath.length != 0) 
    486502    { 
     
    490506 
    491507    // create this directory 
    492     try { 
     508    try  
     509    { 
    493510        std.file.mkdir(lNewPath); 
    494511        lResult = True; 
    495512    } 
    496     catch (std.file.FileException E) { 
     513    catch  
     514    { 
    497515         // Assume the exception is that the directory already exists. 
    498516         lResult = False; 
    499517    } 
    500518    return lResult; 
    501     } 
     519 
    502520} 
    503521 
     
    763781} 
    764782 
     783// Get a list of subdirectories contained in the path. 
     784// Only one level deep is checked. 
     785// Path can be either a directory or file. 
     786 
     787string[] SubDirs( string pPath, int pIsDir = -1) 
     788{ 
     789    string lPath; 
     790    string[] lList; 
     791    int lIsDir; 
     792     
     793     
     794    lIsDir = pIsDir; 
     795    try 
     796    { 
     797        lIsDir = std.file.isdir(pPath); 
     798    } 
     799    catch { /* ignore exception, assume its meant to be a path name. */ } 
     800     
     801    if (lIsDir == 0) 
     802    { 
     803        lPath = std.path.getDirName(pPath); 
     804        if (lPath.length == 0) 
     805        { 
     806            lPath = "."; 
     807        } 
     808    } 
     809    else 
     810        lPath = pPath; 
     811         
     812    bool ldcb(std.file.DirEntry* de) 
     813    { 
     814        if (de.isdir) 
     815        { 
     816            lList ~= de.name; 
     817        } 
     818        return true; 
     819    } 
     820     
     821    std.file.listdir(lPath, &ldcb); 
     822         
     823    return lList; 
     824} 
  • trunk/Source/util/pathex_bn.d

    r53 r54  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 2760
     4long auto_build_number = 2919
  • trunk/Source/util/str.d

    r52 r54  
    4242module util.str; 
    4343private import util.str_bn; 
    44 version(D_Version2) 
    45 { 
    46     mixin("alias invariant(dchar)   dcharc;"); 
    47     mixin("alias invariant(wchar)   wcharc;"); 
    48     mixin("alias invariant(char)    charc;"); 
    49 } 
    50 else 
    51 { 
    5244    alias char[] string; 
    5345    alias wchar[] wstring; 
     
    5648    alias dchar   dcharc; 
    5749    alias char    charc; 
    58 } 
    5950 
    6051alias dchar[] dtext; 
     
    210201            } 
    211202 
    212             return lTemp.idup; 
     203            return lTemp.dup; 
    213204        } 
    214205 
     
    891882 
    892883    lUTF8[0] = pChar; 
    893     return lUTF8[0..1].idup; 
     884    return lUTF8[0..1].dup; 
    894885} 
    895886 
     
    11801171    } 
    11811172     
    1182     return (lChanged ? lResult.idup : pUTF8); 
     1173    return (lChanged ? lResult.dup : pUTF8); 
    11831174} 
    11841175 
     
    14501441    } 
    14511442 
    1452     return lResult[0..lOutPos].idup; 
     1443    return lResult[0..lOutPos].dup; 
    14531444} 
    14541445 
     
    15071498    // Do a simple test to see if any expansion is required. 
    15081499    lLine = std.utf.toUTF32(pLine); 
    1509     version(D_Version2) 
    1510     { 
    1511         lPos  = find(lLine.idup, "%"d[], 0); 
    1512         lDPos = find(lLine.idup, "$"d[], 0); 
    1513     } 
    1514     else 
    1515     { 
    1516         lPos  = find(lLine, "%"d[], 0); 
    1517         lDPos = find(lLine, "$"d[], 0); 
    1518     } 
     1500    lPos  = find(lLine, "%"d[], 0); 
     1501    lDPos = find(lLine, "$"d[], 0); 
    15191502    if (lPos == -1 && lDPos == -1) 
    15201503    { 
     
    16411624 
    16421625              lKeyVal.length = 2; 
    1643               version(D_Version2) 
    1644               { 
    1645                 lEqPos = find(lSymName.idup, "="d[], 0); 
    1646               } 
    1647               else 
    1648               { 
    1649                 lEqPos = find(lSymName, "="d[], 0); 
    1650               } 
     1626              lEqPos = find(lSymName, "="d[], 0); 
    16511627              if (lEqPos != -1) 
    16521628              { 
  • trunk/Source/util/str_bn.d

    r53 r54  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 3120
     4long auto_build_number = 3239