Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3727

Show
Ignore:
Timestamp:
07/08/08 14:47:55 (5 months ago)
Author:
keinfarbton
Message:

fix compile errors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/experimental/D2.0/tango/io/FilePath.d

    r3724 r3727  
    1414        author:         Kris 
    1515 
    16         FilePath combined a means of efficiently editing and extracting  
     16        FilePath combined a means of efficiently editing and extracting 
    1717        path components and of accessing the underlying file system. 
    1818 
    19         Use module Path.d instead when you need only pedestrian access to  
    20         the file-system, and are not manipulating the path components. Use  
    21         FilePath for other scenarios, since it will often be notably more  
     19        Use module Path.d instead when you need only pedestrian access to 
     20        the file-system, and are not manipulating the path components. Use 
     21        FilePath for other scenarios, since it will often be notably more 
    2222        efficient 
    2323 
     
    6060        to the suffix i.e. ".file" is a name rather than a suffix. 
    6161 
    62         Note also that normalization of path-separators occurs by default.  
     62        Note also that normalization of path-separators occurs by default. 
    6363        This means that the use of '\' characters will be converted into 
    6464        '/' instead while parsing. To mutate the path into an O/S native 
    65         version, use the native() method. To obtain a copy instead, use the  
     65        version, use the native() method. To obtain a copy instead, use the 
    6666        path.dup.native sequence 
    6767 
     
    123123                set (filepath); 
    124124        } 
    125          
     125 
    126126        /*********************************************************************** 
    127127 
     
    194194                Returns a path representing the parent of this one. This 
    195195                will typically return the current path component, though 
    196                 with a special case where the name component is empty. In  
     196                with a special case where the name component is empty. In 
    197197                such cases, the path is scanned for a prior segment: 
    198198                --- 
     
    347347 
    348348                Convert path separators to a standard format, using '/' as 
    349                 the path separator. This is compatible with URI and all of  
     349                the path separator. This is compatible with URI and all of 
    350350                the contemporary O/S which Tango supports. Known exceptions 
    351351                include the Windows command-line processor, which considers 
     
    366366 
    367367                Convert to native O/S path separators where that is required, 
    368                 such as when dealing with the Windows command-line.  
    369                  
    370                 Note: mutates the current path. Use this pattern to obtain a  
     368                such as when dealing with the Windows command-line. 
     369 
     370                Note: mutates the current path. Use this pattern to obtain a 
    371371                copy instead: path.dup.native 
    372372 
     
    440440        /*********************************************************************** 
    441441 
    442                 Reset the content of this path, and reparse.  
     442                Reset the content of this path, and reparse. 
    443443 
    444444        ***********************************************************************/ 
     
    696696                Throws: IOException upon systen errors 
    697697 
    698                 Throws: IllegalArgumentException if a segment exists but as  
     698                Throws: IllegalArgumentException if a segment exists but as 
    699699                a file instead of a folder 
    700700 
     
    702702 
    703703        final FilePath create () 
    704         {        
     704        { 
    705705                createPath (this.toString); 
    706706                return this; 
     
    776776                Returns the time of the last modification. Accurate 
    777777                to whatever the OS supports, and in a format dictated 
    778                 by the file-system. For example NTFS keeps UTC time,  
    779                 while FAT timestamps are based on the local time.  
     778                by the file-system. For example NTFS keeps UTC time, 
     779                while FAT timestamps are based on the local time. 
    780780 
    781781        ***********************************************************************/ 
     
    790790                Returns the time of the last access. Accurate to 
    791791                whatever the OS supports, and in a format dictated 
    792                 by the file-system. For example NTFS keeps UTC time,  
     792                by the file-system. For example NTFS keeps UTC time, 
    793793                while FAT timestamps are based on the local time. 
    794794 
     
    804804                Returns the time of file creation. Accurate to 
    805805                whatever the OS supports, and in a format dictated 
    806                 by the file-system. For example NTFS keeps UTC time,   
     806                by the file-system. For example NTFS keeps UTC time, 
    807807                while FAT timestamps are based on the local time. 
    808808 
     
    841841        } 
    842842 
    843                                 { 
    844                                         version(Win32SansUnicode) 
    845                                         else 
    846                                                 return s ~ "\\"w ~ ext; 
    847                                 } 
    848843        /*********************************************************************** 
    849844 
     
    886881                Return timestamp information 
    887882 
    888                 Timstamps are returns in a format dictated by the  
    889                 file-system. For example NTFS keeps UTC time,  
     883                Timstamps are returns in a format dictated by the 
     884                file-system. For example NTFS keeps UTC time, 
    890885                while FAT timestamps are based on the local time 
    891886 
     
    918913 
    919914        final FilePath remove () 
    920         {       
     915        { 
    921916                FS.remove (cString); 
    922917                return this; 
     
    11981193                assert (fp.pop == r"C:"); 
    11991194                assert (fp.pop == r"C:"); 
    1200          
     1195 
    12011196                // special case for popping empty names 
    12021197                fp = r"C:/home/foo/bar/john/"; 
     
    14001395                assert (fp.asExt(null) == r"C:/foo/bar/test"); 
    14011396                assert (fp.asExt("foo") == r"C:/foo/bar/test.foo"); 
    1402 +/       
     1397+/ 
    14031398                } 
    14041399        } 
     
    14071402 
    14081403debug (FilePath) 
    1409 {        
     1404{ 
    14101405        import tango.io.Console; 
    14111406 
    1412         void main()  
     1407        void main() 
    14131408        { 
    14141409                assert (FilePath("/foo/").create.exists); 
  • branches/experimental/D2.0/tango/sys/Process.d

    r3726 r3727  
    384384                command ~= ' '; 
    385385            } 
    386             if (contains!(char)(_args[i], ' ') || _args[i].length == 0) 
     386            if (contains!(char)( cast(char[])_args[i], ' ') || _args[i].length == 0) 
    387387            { 
    388388                command ~= '"'; 
    389                 command ~= _args[i].substitute(cast(Cutf8)"\\", cast(Cutf8)"\\\\").substitute(cast(Cutf8)`"`, cast(Cutf8)`\"`); 
     389                command ~= (cast(char[])_args[i]).substitute(cast(char[])"\\", cast(char[])"\\\\").substitute(cast(char[])`"`, cast(char[])`\"`); 
    390390                command ~= '"'; 
    391391            } 
    392392            else 
    393393            { 
    394                 command ~= _args[i].substitute("\\", "\\\\").substitute(`"`, `\"`); 
     394                command ~= (cast(char[])_args[i]).substitute(cast(char[])"\\", cast(char[])"\\\\").substitute(cast(char[])`"`, cast(char[])`\"`); 
    395395            } 
    396396        } 
     
    12651265    in 
    12661266    { 
    1267         assert(!contains!(char)(delims, '"'), 
     1267        assert(!contains!(char)(cast(char[])delims, '"'), 
    12681268               "The argument delimiter Cutf8 cannot contain a double quotes ('\"') character"); 
    12691269    } 
     
    13301330                        state = State.InsideQuotes; 
    13311331                    } 
    1332                     else if (!contains!(char)(delims, c)) 
     1332                    else if (!contains!(char)(cast(char[])delims, c)) 
    13331333                    { 
    13341334                        start = i; 
     
    13571357                        state = State.InsideQuotes; 
    13581358                    } 
    1359                     else if (contains!(char)(delims, c)) 
     1359                    else if (contains!(char)(cast(char[])delims, c)) 
    13601360                    { 
    13611361                        appendChunksAsArg(); 
     
    14961496            char* str; 
    14971497 
    1498             if (!contains!(char)(filename, FileConst.PathSeparatorChar) && 
     1498            if (!contains!(char)(cast(char[])filename, FileConst.PathSeparatorChar) && 
    14991499                (str = getenv("PATH".ptr)) !is null) 
    15001500            { 
    1501                 Cutf8[] pathList = delimit!(char)(str[0 .. strlen(str)], ":"); 
     1501                auto pathList = delimit!(char)(cast(char[])str[0 .. strlen(str)], cast(char[])":"); 
    15021502 
    15031503                foreach ( inout path; pathList) 
  • branches/experimental/D2.0/tango/text/Util.d

    r3724 r3727  
    262262/****************************************************************************** 
    263263 
    264         Replace all instances of one array with another  
    265  
    266 ******************************************************************************/ 
    267  
    268 const(T)[] substitute(T) (const(T)[] source, const(T)[] match, const(T)[] replacement) 
     264        Replace all instances of one array with another 
     265 
     266******************************************************************************/ 
     267 
     268T[] substitute(T) (T[] source, T[] match, T[] replacement) 
    269269{ 
    270270        T[] output; 
     
    282282******************************************************************************/ 
    283283 
    284 bool contains(T) (const(T)[] source, T match) 
     284bool contains(T) (T[] source, T match) 
    285285{ 
    286286        return indexOf!(T) (source.ptr, match, source.length) != source.length; 
     
    294294******************************************************************************/ 
    295295 
    296 bool containsPattern(T) (const(T)[] source, const(T)[] match) 
     296bool containsPattern(T) (T[] source, T[] match) 
    297297{ 
    298298        return locatePattern (source, match) != source.length; 
     
    308308******************************************************************************/ 
    309309 
    310 uint locate(T, U=uint) (const(T)[] source, T match, U start=0) 
     310uint locate(T, U=uint) (T[] source, T match, U start=0) 
    311311{return locate!(T) (source, match, start);} 
    312312 
    313 uint locate(T) (const(T)[] source, T match, uint start=0) 
     313uint locate(T) (T[] source, T match, uint start=0) 
    314314{ 
    315315        if (start > source.length) 
     
    328328******************************************************************************/ 
    329329 
    330 uint locatePrior(T, U=uint) (const(T)[] source, T match, U start=uint.max) 
     330uint locatePrior(T, U=uint) (T[] source, T match, U start=uint.max) 
    331331{return locatePrior!(T)(source, match, start);} 
    332332 
    333 uint locatePrior(T) (const(T)[] source, T match, uint start=uint.max) 
     333uint locatePrior(T) (T[] source, T match, uint start=uint.max) 
    334334{ 
    335335        if (start > source.length) 
     
    351351******************************************************************************/ 
    352352 
    353 uint locatePattern(T, U=uint) (const(T)[] source, const(T)[] match, U start=0) 
     353uint locatePattern(T, U=uint) (T[] source, T[] match, U start=0) 
    354354{return locatePattern!(T) (source, match, start);} 
    355355 
    356 uint locatePattern(T) (const(T)[] source, const(T)[] match, uint start=0) 
     356uint locatePattern(T) (T[] source, T[] match, uint start=0) 
    357357{ 
    358358        uint    idx; 
    359         const(T)*      p = source.ptr + start; 
     359        T*      p = source.ptr + start; 
    360360        uint    extent = source.length - start - match.length + 1; 
    361361 
     
    412412/****************************************************************************** 
    413413 
    414         Split the provided array on the first pattern instance, and  
    415         return the resultant head and tail. The pattern is excluded  
    416         from the two segments.  
     414        Split the provided array on the first pattern instance, and 
     415        return the resultant head and tail. The pattern is excluded 
     416        from the two segments. 
    417417 
    418418        Where a segment is not found, tail will be null and the return 
    419419        value will be the original array. 
    420          
     420 
    421421******************************************************************************/ 
    422422 
     
    434434/****************************************************************************** 
    435435 
    436         Split the provided array on the last pattern instance, and  
    437         return the resultant head and tail. The pattern is excluded  
    438         from the two segments.  
     436        Split the provided array on the last pattern instance, and 
     437        return the resultant head and tail. The pattern is excluded 
     438        from the two segments. 
    439439 
    440440        Where a segment is not found, head will be null and the return 
    441441        value will be the original array. 
    442          
     442 
    443443******************************************************************************/ 
    444444 
     
    462462 
    463463        Splitting on a single delimiter is considerably faster than 
    464         splitting upon a set of alternatives.  
    465  
    466         Note that the src content is not duplicated by this function,  
     464        splitting upon a set of alternatives. 
     465 
     466        Note that the src content is not duplicated by this function, 
    467467        but is sliced instead. 
    468468 
    469469******************************************************************************/ 
    470470 
    471 const(T)[][] delimit(T) (const(T)[] src, const(T)[] set) 
    472 { 
    473         const(T)[][] result; 
     471T[][] delimit(T) (T[] src, T[] set) 
     472{ 
     473        T[][] result; 
    474474 
    475475        foreach (segment; delimiters!(T) (src, set)) 
     
    484484        excluded from each of the segments. 
    485485 
    486         Note that the src content is not duplicated by this function,  
     486        Note that the src content is not duplicated by this function, 
    487487        but is sliced instead. 
    488488 
     
    511511{ 
    512512        int count; 
    513          
     513 
    514514        foreach (line; lines (src)) 
    515515                 ++count; 
    516          
     516 
    517517        T[][] result = new T[][count]; 
    518518 
     
    526526/****************************************************************************** 
    527527 
    528         Combine a series of text segments together, each appended with  
     528        Combine a series of text segments together, each appended with 
    529529        a postfix pattern. An optional output buffer can be provided to 
    530         avoid heap activity - it should be large enough to contain the  
     530        avoid heap activity - it should be large enough to contain the 
    531531        entire output, otherwise the heap will be used instead. 
    532532 
     
    543543/****************************************************************************** 
    544544 
    545         Combine a series of text segments together, each prepended with  
    546         a prefix pattern. An optional output buffer can be provided to  
    547         avoid heap activity - it should be large enough to contain the  
     545        Combine a series of text segments together, each prepended with 
     546        a prefix pattern. An optional output buffer can be provided to 
     547        avoid heap activity - it should be large enough to contain the 
    548548        entire output, otherwise the heap will be used instead. 
    549549 
    550550        Note that, unlike join(), the output buffer is specified first 
    551         such that a set of trailing strings can be provided.  
     551        such that a set of trailing strings can be provided. 
    552552 
    553553        Returns a valid slice of the output, containing the concatenated 
     
    569569 
    570570        Note that, unlike join(), the output buffer is specified first 
    571         such that a set of trailing strings can be provided.  
     571        such that a set of trailing strings can be provided. 
    572572 
    573573        Returns a valid slice of the output, containing the concatenated 
     
    583583/****************************************************************************** 
    584584 
    585         Combine a series of text segments together, each prefixed and/or  
    586         postfixed with optional strings. An optional output buffer can be  
    587         provided to avoid heap activity - which should be large enough to  
     585        Combine a series of text segments together, each prefixed and/or 
     586        postfixed with optional strings. An optional output buffer can be 
     587        provided to avoid heap activity - which should be large enough to 
    588588        contain the entire output, otherwise the heap will be used instead. 
    589589 
    590590        Note that, unlike join(), the output buffer is specified first 
    591         such that a set of trailing strings can be provided.  
     591        such that a set of trailing strings can be provided. 
    592592 
    593593        Returns a valid slice of the output, containing the concatenated 
     
    598598T[] combine(T) (T[] dst, T[] prefix, T[] postfix, T[][] src ...) 
    599599{ 
    600         uint len = src.length * prefix.length +  
     600        uint len = src.length * prefix.length + 
    601601                   src.length * postfix.length; 
    602602 
     
    626626/****************************************************************************** 
    627627 
    628         Repeat an array for a specific number of times. An optional output  
    629         buffer can be provided to avoid heap activity - it should be large  
    630         enough to contain the entire output, otherwise the heap will be used  
     628        Repeat an array for a specific number of times. An optional output 
     629        buffer can be provided to avoid heap activity - it should be large 
     630        enough to contain the entire output, otherwise the heap will be used 
    631631        instead. 
    632632 
     
    690690******************************************************************************/ 
    691691 
    692 uint indexOf(T, U=uint) (const(T)* str, T match, U length) 
     692uint indexOf(T, U=uint) (T* str, T match, U length) 
    693693{return indexOf!(T) (str, match, length);} 
    694694 
    695 uint indexOf(T) (const(T)* str, T match, uint length) 
     695uint indexOf(T) (T* str, T match, uint length) 
    696696{ 
    697697        version (D_InlineAsm_X86) 
     
    939939******************************************************************************/ 
    940940 
    941 PatternFruct!(T) patterns(T) (const(T)[] src, const(T)[] pattern, const(T)[] sub=null) 
     941PatternFruct!(T) patterns(T) (T[] src, T[] pattern, T[] sub=null) 
    942942{ 
    943943        PatternFruct!(T) elements; 
     
    963963******************************************************************************/ 
    964964 
    965 QuoteFruct!(T) quotes(T) (const(T)[] src, const(T)[] set) 
     965QuoteFruct!(T) quotes(T) (T[] src, T[] set) 
    966966{ 
    967967        QuoteFruct!(T) quotes; 
     
    987987*******************************************************************************/ 
    988988 
    989 const(T)[] layout(T) ( T[] output, const(T)[][] layout ...) 
     989T[] layout(T) ( T[] output, T[][] layout ...) 
    990990{ 
    991991        static Cutf8 badarg   = "{index out of range}"; 
     
    10071007                      if (index < args) 
    10081008                         { 
    1009                          const(T)[] x = layout[index+1]; 
     1009                         T[] x = layout[index+1]; 
    10101010 
    10111011                         int limit = pos + x.length; 
     
    10461046        Convert 'escaped' chars to normal ones: \t => ^t for example. 
    10471047        Supports \" \' \\ \a \b \f \n \r \t \v 
    1048          
     1048 
    10491049******************************************************************************/ 
    10501050 
     
    11141114                           *d++ = '\\'; 
    11151115                     } 
    1116               *d++ = c;   
    1117               len -= 2;            
     1116              *d++ = c; 
     1117              len -= 2; 
    11181118              s += 2; 
    11191119              } while ((delta = indexOf (s, '\\', len)) < len); 
     
    11301130 
    11311131        Convert entity chars to normal ones: &amp; => ; for example. 
    1132          
     1132 
    11331133******************************************************************************/ 
    11341134 
     
    11661166                               *d++ = '\'', token = 6; 
    11671167                           break; 
    1168                             
     1168 
    11691169                      case 'g': 
    11701170                           if (len > 3 && s[1..4] == "gt;") 
    11711171                               *d++ = '>', token = 4; 
    11721172                           break; 
    1173                             
     1173 
    11741174                      case 'l': 
    11751175                           if (len > 3 && s[1..4] == "lt;") 
    11761176                               *d++ = '<', token = 4; 
    11771177                           break; 
    1178                             
     1178 
    11791179                      case 'q': 
    11801180                           if (len > 5 && s[1..6] == "quot;") 
     
    12971297 
    12981298/****************************************************************************** 
    1299        
    1300         Helper fruct for iterator lines(). A fruct is a low  
    1301         impact mechanism for capturing context relating to an  
     1299 
     1300        Helper fruct for iterator lines(). A fruct is a low 
     1301        impact mechanism for capturing context relating to an 
    13021302        opApply (conjunction of the names struct and foreach) 
    1303          
     1303 
    13041304******************************************************************************/ 
    13051305 
    13061306private struct LineFruct(T) 
    13071307{ 
    1308         private const(T)[] src; 
    1309  
    1310         int opApply (int delegate ( ref const(T)[] line) dg) 
     1308        private T[] src; 
     1309 
     1310        int opApply (int delegate ( ref T[] line) dg) 
    13111311        { 
    13121312                uint    ret, 
    13131313                        pos, 
    13141314                        mark; 
    1315                 const(T)[]     line; 
     1315                T[]     line; 
    13161316 
    13171317                const T nl = '\n'; 
     
    13471347/****************************************************************************** 
    13481348 
    1349         Helper fruct for iterator delims(). A fruct is a low  
    1350         impact mechanism for capturing context relating to an  
     1349        Helper fruct for iterator delims(). A fruct is a low 
     1350        impact mechanism for capturing context relating to an 
    13511351        opApply (conjunction of the names struct and foreach) 
    13521352 
     
    13551355private struct DelimFruct(T) 
    13561356{ 
    1357         private const(T)[] src; 
    1358         private const(T)[] set; 
    1359  
    1360         int opApply (int delegate (ref const(T)[] token) dg) 
     1357        private T[] src; 
     1358        private T[] set; 
     1359 
     1360        int opApply (int delegate (ref T[] token) dg) 
    13611361        { 
    13621362                uint    ret, 
    13631363                        pos, 
    13641364                        mark; 
    1365                 const(T)[] token; 
     1365                T[] token; 
    13661366 
    13671367                // optimize for single delimiter case 
     
    14021402/****************************************************************************** 
    14031403 
    1404         Helper fruct for iterator patterns(). A fruct is a low  
    1405         impact mechanism for capturing context relating to an  
     1404        Helper fruct for iterator patterns(). A fruct is a low 
     1405        impact mechanism for capturing context relating to an 
    14061406        opApply (conjunction of the names struct and foreach) 
    14071407 
     
    14101410private struct PatternFruct(T) 
    14111411{ 
    1412         private const(T)[] src, 
     1412        private T[] src, 
    14131413                    sub, 
    14141414                    pattern; 
    14151415 
    1416         int opApply (int delegate (ref const(T)[] token) dg) 
     1416        int opApply (int delegate (ref T[] token) dg) 
    14171417        { 
    14181418                uint    ret, 
    14191419                        pos, 
    14201420                        mark; 
    1421                 const(T)[] token; 
     1421                T[] token; 
    14221422 
    14231423                // optimize for single-element pattern 
     
    14631463/****************************************************************************** 
    14641464 
    1465         Helper fruct for iterator quotes(). A fruct is a low  
    1466         impact mechanism for capturing context relating to an  
     1465        Helper fruct for iterator quotes(). A fruct is a low 
     1466        impact mechanism for capturing context relating to an 
    14671467        opApply (conjunction of the names struct and foreach) 
    14681468 
     
    14711471private struct QuoteFruct(T) 
    14721472{ 
    1473         private const(T)[] src; 
    1474         private const(T)[] set; 
    1475  
    1476         int opApply (int delegate (ref const(T)[] token) dg) 
     1473        private T[] src; 
     1474        private T[] set; 
     1475 
     1476        int opApply (int delegate (ref T[] token) dg) 
    14771477        { 
    14781478                int ret, 
    14791479                    mark; 
    1480                 const(T)[] token; 
     1480                T[] token; 
    14811481 
    14821482                if (set.length) 
  • branches/experimental/D2.0/tango/text/convert/Integer.d

    r3724 r3727  
    44 
    55        license:        BSD style: $(LICENSE) 
    6          
     6 
    77        version:        Initial release: Nov 2005 
    8          
     8 
    99        author:         Kris 
    1010 
    11         A set of functions for converting between Cutf8 and integer  
    12         values.  
     11        A set of functions for converting between Cutf8 and integer 
     12        values. 
    1313 
    1414        Applying the D "import alias" mechanism to this module is highly 
     
    1919        auto i = Integer.parse ("32767"); 
    2020        --- 
    21          
     21 
    2222*******************************************************************************/ 
    2323 
     
    2828/****************************************************************************** 
    2929 
    30         Parse an integer value from the provided 'digits' Cutf8.  
    31  
    32         The Cutf8 is inspected for a sign and an optional radix  
    33         prefix. A radix may be provided as an argument instead,  
     30        Parse an integer value from the provided 'digits' Cutf8. 
     31 
     32        The Cutf8 is inspected for a sign and an optional radix 
     33        prefix. A radix may be provided as an argument instead, 
    3434        whereupon it must match the prefix (where present). When 
    3535        radix is set to zero, conversion will default to decimal. 
     
    3737        Throws an exception where the input text is not parsable 
    3838        in its entirety. 
    39          
     39 
    4040******************************************************************************/ 
    4141 
     
    5353/****************************************************************************** 
    5454 
    55         Parse an integer value from the provided 'digits' Cutf8.        
    56          
    57         The Cutf8 is inspected for a sign and an optional radix  
    58         prefix. A radix may be provided as an argument instead,  
     55        Parse an integer value from the provided 'digits' Cutf8. 
     56 
     57        The Cutf8 is inspected for a sign and an optional radix 
     58        prefix. A radix may be provided as an argument instead, 
    5959        whereupon it must match the prefix (where present). When 
    6060        radix is set to zero, conversion will default to decimal. 
     
    6262        Throws an exception where the input text is not parsable 
    6363        in its entirety. 
    64          
     64 
    6565******************************************************************************/ 
    6666 
     
    9292        return format (tmp, i, fmt).dup; 
    9393} 
    94                 
     94 
    9595/****************************************************************************** 
    9696 
     
    107107        return format (tmp, i, fmt).dup; 
    108108} 
    109                 
     109 
    110110/****************************************************************************** 
    111111 
     
    122122        return format (tmp, i, fmt).dup; 
    123123} 
    124                 
     124 
    125125/******************************************************************************* 
    126126 
     
    161161*******************************************************************************/ 
    162162 
    163 T[] format(T, U=long) (T[] dst, U i, T[] fmt = null) 
     163const(T)[] format(T, U=long) (T[] dst, U i, T[] fmt = null) 
    164164{return format!(T)(dst, cast(long) i, fmt);} 
    165165 
    166 T[] format(T) (T[] dst, long i, T[] fmt = null) 
     166const(T)[] format(T) (T[] dst, long i, T[] fmt = null) 
    167167{ 
    168168        char    pre, 
     
    172172        decode (fmt, type, pre, width); 
    173173        return formatter (dst, i, type, pre, width); 
    174 }  
     174} 
    175175 
    176176private void decode(T) (T[] fmt, ref char type, out char pre, out int width) 
     
    191191              } 
    192192           } 
    193 }  
     193} 
    194194 
    195195 
     
    201201{ 
    202202        uint    radix; 
    203         T[]     prefix; 
    204         T[]     numbers; 
    205 } 
    206  
    207 T[] formatter(T) (T[] dst, long i, char type, char pre, int width) 
    208 { 
    209         const T[] lower = "0123456789abcdef"; 
    210         const T[] upper = "0123456789ABCDEF"; 
    211          
     203        const(T)[]     prefix; 
     204        const(T)[]     numbers; 
     205} 
     206 
     207const(T)[] formatter(T) (T[] dst, long i, char type, char pre, int width) 
     208{ 
     209        static const lower = cast(const(T)[])"0123456789abcdef"; 
     210        static const upper = cast(const(T)[])"0123456789ABCDEF"; 
     211 
    212212        alias _FormatterInfo!(T) Info; 
    213213 
    214         const   Info[] formats =  
     214        static const   Info[] formats = 
    215215                [ 
    216                 {10, null, lower},  
    217                 {10, "-",  lower},  
    218                 {10, " ",  lower},  
    219                 {10, "+",  lower},  
    220                 { 2, "0b", lower},  
    221                 { 8, "0o", lower},  
    222                 {16, "0x", lower},  
     216                {10, null, lower}, 
     217                {10, "-",  lower}, 
     218                {10, " ",  lower}, 
     219                {10, "+",  lower}, 
     220                { 2, "0b", lower}, 
     221                { 8, "0o", lower}, 
     222                {16, "0x", lower}, 
    223223                {16, "0X", upper}, 
    224224                ]; 
     
    293293                 } while ((v /= radix) && --len); 
    294294              } 
    295          
     295 
    296296           auto prefix = (pre is '#') ? info.prefix : null; 
    297297           if (len > prefix.length) 
     
    299299              len -= prefix.length + 1; 
    300300 
    301               // prefix number with zeros?  
     301              // prefix number with zeros? 
    302302              if (width) 
    303303                 { 
     
    313313 
    314314              // return slice of provided output buffer 
    315               return dst [len .. $];                                
     315              return dst [len .. $]; 
    316316              } 
    317317           } 
    318          
     318 
    319319        return "{output width too small}"; 
    320 }  
    321  
    322  
    323 /****************************************************************************** 
    324  
    325         Parse an integer value from the provided 'digits' Cutf8.  
    326  
    327         The string is inspected for a sign and an optional radix  
    328         prefix. A radix may be provided as an argument instead,  
     320} 
     321 
     322 
     323/****************************************************************************** 
     324 
     325        Parse an integer value from the provided 'digits' Cutf8. 
     326 
     327        The string is inspected for a sign and an optional radix 
     328        prefix. A radix may be provided as an argument instead, 
    329329        whereupon it must match the prefix (where present). When 
    330330        radix is set to zero, conversion will default to decimal. 
     
    406406        an optional prefix, or the radix is zero, the prefix will 
    407407        be consumed and assigned. Where the radix is non zero and 
    408         does not match an explicit prefix, the latter will remain  
     408        does not match an explicit prefix, the latter will remain 
    409409        unconsumed. Otherwise, radix will default to 10. 
    410410 
     
    446446                           r = 16, ++p; 
    447447                           break; 
    448   
     448 
    449449                      case 'b': 
    450450                      case 'B': 
    451451                           r = 2, ++p; 
    452452                           break; 
    453   
     453 
    454454                      case 'o': 
    455455                      case 'O': 
    456456                           r = 8, ++p; 
    457457                           break; 
    458   
    459                       default:  
     458 
     459                      default: 
    460460                           break; 
    461                       }  
     461                      } 
    462462 
    463463           // default the radix to 10 
     
    484484 
    485485        Return the parsed uint 
    486          
     486 
    487487******************************************************************************/ 
    488488 
     
    507507 
    508508        Returns a populated slice of the provided output 
    509          
     509 
    510510******************************************************************************/ 
    511511 
     
    533533        { 
    534534        char[64] tmp; 
    535          
     535 
    536536        assert (toInt("1") is 1); 
    537537        assert (toLong("1") is 1);