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

Changeset 3893

Show
Ignore:
Timestamp:
08/19/08 12:37:00 (4 months ago)
Author:
keinfarbton
Message:

More compile fixes. Regex and RegexIterator? now ok. Remaining files with DMD crash:
tango/net/http/HttpTokens.d
tango/net/ftp/FtpClient.d
tango/io/vfs/VirtualFolder.d
tango/sys/Environment.d
It seems like it is related to the tango.text.Util template functions.

Files:

Legend:

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

    r3724 r3893  
    221221                Cutf8 tail; 
    222222                //FIXME constness 
    223                 auto text = head !(char)( path, FileConst.PathSeparatorString, tail); 
     223                auto text = head ( path, FileConst.PathSeparatorString, tail); 
    224224 
    225225                auto child = text in mounts; 
     
    244244        { 
    245245                //FIXME constness 
    246                 auto tail = locatePrior !(char)(cast(char[])path, FileConst.PathSeparatorChar); 
     246                auto tail = locatePrior (path, FileConst.PathSeparatorChar); 
    247247                if (tail < path.length) 
    248248                    return folder(path[0..tail]).open.file(path[tail..$]); 
     
    358358                assert (name); 
    359359                //FIXME constness 
    360                 if (locatePrior!(char)(cast(char[])name, '.') != name.length || 
     360                if (locatePrior(name, '.') != name.length || 
    361361                    //FIXME constness 
    362                     locatePrior!(char)(cast(char[])name, FileConst.PathSeparatorChar) != name.length) 
     362                    locatePrior(name, FileConst.PathSeparatorChar) != name.length) 
    363363                    error ("'"~name~"' contains invalid characters"); 
    364364        } 
  • branches/experimental/D2.0/tango/net/ftp/FtpClient.d

    r3888 r3893  
    562562                        char[64] tmp = void; 
    563563 
    564                         this.sendCommand("EPRT", Text.layout!(char)(tmp[], cast(Cutf8)"|1|%0|%1|", cast(Cutf8)data_addr.toAddrString, cast(Cutf8)data_addr.toPortString)); 
     564                        this.sendCommand("EPRT", Text.layout (tmp[], cast(Cutf8)"|1|%0|%1|", cast(Cutf8)data_addr.toAddrString, cast(Cutf8)data_addr.toPortString)); 
    565565                        // this.sendCommand("EPRT", format("|1|%s|%s|", data_addr.toAddrString(), data_addr.toPortString())); 
    566566                        this.readResponse("200"); 
     
    579579                        char[64] tmp = void; 
    580580                        char[20] foo = void; 
    581                         auto str = Text.layout!(char) (tmp, "%0,%1,%2,%3,%4,%5", 
     581                        auto str = Text.layout (tmp, "%0,%1,%2,%3,%4,%5", 
    582582                                                Integer.format(foo[0..3], h1), 
    583583                                                Integer.format(foo[3..6], h2), 
     
    980980        if (mlst_success) 
    981981            { 
    982                 Cutf8[] lines = Text.splitLines!(char) (cast(Cutf8)response.message); 
     982                Cutf8[] lines = Text.splitLines (cast(Cutf8)response.message); 
    983983 
    984984                // We need at least 3 lines - first and last and header/footer lines. 
     
    10601060 
    10611061                // Each line is something in that directory. 
    1062                 Cutf8[] lines = Text.splitLines!(char) ( cast(Cutf8)listing.slice()); 
     1062                Cutf8[] lines = Text.splitLines ( cast(Cutf8)listing.slice()); 
    10631063                scope (exit) 
    10641064                    delete lines; 
     
    11041104 
    11051105        // Split out the lines.  Most of the time, it's one-to-one. 
    1106         Cutf8[] lines = Text.splitLines!(char)( cast(Cutf8)listing.slice()); 
     1106        Cutf8[] lines = Text.splitLines ( cast(Cutf8)listing.slice()); 
    11071107        scope (exit) 
    11081108            delete lines; 
     
    11121112                // If there are no spaces, or if there's only one... skip the line. 
    11131113                // This is probably like a "total 8" line. 
    1114                 if (Text.locate!(char)(line, ' ') == Text.locatePrior!(char)(line, ' ')) 
     1114                if (Text.locate (line, ' ') == Text.locatePrior (line, ' ')) 
    11151115                    continue; 
    11161116 
     
    11601160 
    11611161        // We have to sniff this... :/. 
    1162         switch (! Text.contains!(char) ("0123456789", line[0])) 
     1162        switch (! Text.contains ("0123456789", line[0])) 
    11631163            { 
    11641164                // Not a number; this is UNIX format. 
     
    12851285        if (filename_pos > 1) 
    12861286            { 
    1287                 auto temp_facts = Text.delimit!(char)(line[0 .. filename_pos - 1], ";"); 
     1287                auto temp_facts = Text.delimit (line[0 .. filename_pos - 1], ";"); 
    12881288 
    12891289                // Go through each fact and parse them into the array. 
    12901290                foreach (fact; temp_facts) 
    12911291                    { 
    1292                         int pos = Text.locate!(char)(fact, '='); 
     1292                        int pos = Text.locate (fact, '='); 
    12931293                        if (pos == fact.length) 
    12941294                            continue; 
     
    14211421        else 
    14221422            { 
    1423                 Cutf8[] lines = Text.splitLines !(char)(cast(Cutf8)response.message); 
     1423                Cutf8[] lines = Text.splitLines (cast(Cutf8)response.message); 
    14241424 
    14251425                // There are two more lines than features, but we also have FEAT. 
     
    14291429                for (size_t i = 1; i < lines.length - 1; i++) 
    14301430                    { 
    1431                         size_t pos = Text.locate!(char)(lines[i], ' '); 
     1431                        size_t pos = Text.locate (lines[i], ' '); 
    14321432 
    14331433                        this.supported_features[i].command = lines[i][0 .. pos]; 
  • branches/experimental/D2.0/tango/net/http/HttpTokens.d

    r3890 r3893  
    303303                if (s.length) 
    304304                   { 
    305                    auto i = Text.locate !(const(char))(s, separator); 
     305                   auto i = Text.locate (s, separator); 
    306306 
    307307                   // we should always find the separator 
  • branches/experimental/D2.0/tango/sys/Environment.d

    r3886 r3893  
    8282 
    8383                // rifle through the path (after converting to standard format) 
    84                 foreach (pe; Text.patterns !(char)(standard(get("PATH")), FileConst.SystemPathString )) 
     84                foreach (pe; Text.patterns (standard(get("PATH")), FileConst.SystemPathString )) 
    8585                         if (bin.path(pe).exists) 
    8686                             version (Windows) 
  • branches/experimental/D2.0/tango/text/Regex.d

    r3724 r3893  
    741741    } 
    742742 
    743     static CharClass opCall(CharClass cc) 
     743    static CharClass opCall(const(CharClass) cc) 
    744744    { 
    745745        CharClass ncc; 
     
    983983    alias CharRange!(char_t)    cr_t; 
    984984 
     985    alias const(char_t)[]              c_string_t; 
     986    alias const(CharClass!(char_t))    c_cc_t; 
     987    alias const(CharRange!(char_t))    c_cr_t; 
     988 
    985989    // generic data 
    986990    enum Type { 
     
    11431147    } 
    11441148 
    1145     void setInput(cc_t cc) 
    1146     { 
    1147         input = cc; 
     1149    void setInput(c_cc_t cc) 
     1150    { 
     1151        input = *cast(cc_t*)&cc; //TODO: this is not cosher. Check const! 
    11481152    } 
    11491153 
     
    11631167    } 
    11641168 
    1165     string toString() 
    1166     { 
    1167         string str; 
     1169    Cutf8 toString() 
     1170    { 
     1171        Cutf8 str; 
    11681172        switch ( type ) 
    11691173        { 
     
    11861190class RegExpException : Exception 
    11871191{ 
    1188     this(string msg) 
     1192    this(Cutf8 msg) 
    11891193    { 
    11901194        super("RegExp: "~msg); 
     
    12891293    alias CharRange!(char_t)        range_t; 
    12901294    alias CharClass!(char_t)        cc_t; 
     1295    alias const(CharClass!(char_t)) c_cc_t; 
    12911296 
    12921297    string_t    pattern; 
     
    19191924    } 
    19201925 
    1921     frag_t constructChars(cc_t charclass, predicate_t.Type type) 
     1926    frag_t constructChars(c_cc_t charclass, predicate_t.Type type) 
    19221927    { 
    19231928        debug(tnfa) Stdout.format("constructChars type={}", type); 
     
    28242829        string toString() 
    28252830        { 
    2826             string str = "[ "
     2831            string str = "[ ".dup
    28272832            bool first = true; 
    28282833            foreach ( s; elms ) { 
     
    36153620            --- 
    36163621    **********************************************************************************************/ 
    3617     this(char_t[] pattern, char_t[] attributes=null) 
     3622    this(const(char_t)[] pattern, const(char_t)[] attributes=null) 
    36183623    { 
    36193624        this(pattern, false, true); 
     
    36213626 
    36223627    /** ditto */ 
    3623     this(char_t[] pattern, bool swapMBS, bool unanchored, bool printNFA=false) 
     3628    this(const(char_t)[] pattern, bool swapMBS, bool unanchored, bool printNFA=false) 
    36243629    { 
    36253630        pattern_ = pattern; 
     
    36553660            --- 
    36563661    **********************************************************************************************/ 
    3657     static RegExpT!(char_t) opCall(char_t[] pattern, char_t[] attributes = null) 
     3662    static RegExpT!(char_t) opCall(const(char_t)[] pattern, const(char_t)[] attributes = null) 
    36583663    { 
    36593664        return new RegExpT!(char_t)(pattern, attributes); 
     
    36803685            --- 
    36813686    **********************************************************************************************/ 
    3682     public RegExpT!(char_t) search(char_t[] input) 
     3687    public RegExpT!(char_t) search(const(char_t)[] input) 
    36833688    { 
    36843689        input_ = input; 
     
    37013706        Returns: false for no match, true for match 
    37023707    **********************************************************************************************/ 
    3703     bool test(char_t[] input) 
     3708    bool test(const(char_t)[] input) 
    37043709    { 
    37053710        this.input_ = input; 
     
    39073912            Slice of input for the requested submatch, or null if no such submatch exists. 
    39083913    **********************************************************************************************/ 
    3909     char_t[] match(uint index) 
     3914    const(char_t)[] match(uint index) 
    39103915    { 
    39113916        if ( index > tdfa_.num_tags ) 
     
    39193924 
    39203925    /** ditto */ 
    3921     char_t[] opIndex(uint index) 
     3926    const(char_t)[] opIndex(uint index) 
    39223927    { 
    39233928        return match(index); 
     
    39283933        If no match was found, null is returned. 
    39293934    **********************************************************************************************/ 
    3930     char_t[] pre() 
     3935    const(char_t)[] pre() 
    39313936    { 
    39323937        auto start = registers_[0]; 
     
    39403945        If no match was found, the whole slice of the input that was processed in the last test. 
    39413946    **********************************************************************************************/ 
    3942     char_t[] post() 
     3947    const(char_t)[] post() 
    39433948    { 
    39443949        if ( registers_[1] >= 0 ) 
     
    39663971            --- 
    39673972    **********************************************************************************************/ 
    3968     char_t[][] split(char_t[] input) 
    3969     { 
    3970         auto res = new char_t[][PREALLOC]; 
     3973    const(char_t)[][] split(char_t[] input) 
     3974    { 
     3975        auto res = new const(char_t)[][PREALLOC]; 
    39713976        uint index; 
    3972         char_t[] tmp = input; 
     3977        const(char_t)[] tmp = input; 
    39733978 
    39743979        foreach ( r; search(input) ) 
     
    39893994        Returns a copy of the input with all matches replaced by replacement. 
    39903995    **********************************************************************************************/ 
    3991     char_t[] replaceAll(char_t[] input, char_t[] replacement, char_t[] output_buffer=null) 
    3992     { 
    3993         char_t[] tmp = input; 
     3996    const(char_t)[] replaceAll(const(char_t)[] input, const(char_t)[] replacement, char_t[] output_buffer=null) 
     3997    { 
     3998        const(char_t)[] tmp = input; 
    39943999        if ( output_buffer.length <= 0 ) 
    39954000            output_buffer = new char_t[input.length+replacement.length]; 
     
    40114016        Returns a copy of the input with the last match replaced by replacement. 
    40124017    **********************************************************************************************/ 
    4013     char_t[] replaceLast(char_t[] input, char_t[] replacement, char_t[] output_buffer=null) 
    4014     { 
    4015         char_t[] tmp_pre, tmp_post; 
     4018    const(char_t)[] replaceLast(const(char_t)[] input, const(char_t)[] replacement, char_t[] output_buffer=null) 
     4019    { 
     4020        const(char_t)[] tmp_pre, tmp_post; 
    40164021        if ( output_buffer.length <= 0 ) 
    40174022            output_buffer = new char_t[input.length+replacement.length]; 
     
    40374042        Returns a copy of the input with the first match replaced by replacement. 
    40384043    **********************************************************************************************/ 
    4039     char_t[] replaceFirst(char_t[] input, char_t[] replacement, char_t[] output_buffer=null) 
    4040     { 
    4041         char_t[] tmp = input; 
     4044    const(char_t)[] replaceFirst(const(char_t)[] input, const(char_t)[] replacement, char_t[] output_buffer=null) 
     4045    { 
     4046        const(char_t)[] tmp = input; 
    40424047        if ( output_buffer.length <= 0 ) 
    40434048            output_buffer = new char_t[input.length+replacement.length]; 
     
    40594064        Calls dg for each match and replaces it with dg's return value. 
    40604065    **********************************************************************************************/ 
    4061     char_t[] replaceAll(char_t[] input, char_t[] delegate(RegExpT!(char_t)) dg, char_t[] output_buffer=null) 
    4062     { 
    4063         char_t[]    tmp = input; 
     4066    const(char_t)[] replaceAll(const(char_t)[] input, char_t[] delegate(RegExpT!(char_t)) dg, char_t[] output_buffer=null) 
     4067    { 
     4068        const(char_t)[]    tmp = input; 
    40644069        uint        offset; 
    40654070        if ( output_buffer.length <= 0 ) 
     
    40834088    **********************************************************************************************/ 
    40844089    // TODO: input-end special case 
    4085     string compileToD(string func_name = "match", bool lexer=false) 
    4086     { 
    4087         string code; 
    4088         string str_type; 
     4090    Cutf8 compileToD(Cutf8 func_name = "match", bool lexer=false) 
     4091    { 
     4092        Cutf8 code; 
     4093        Cutf8 str_type; 
    40894094        static if ( is(char_t == char) ) 
    40904095            str_type = "char[]"; 
     
    43034308private: 
    43044309    const int   PREALLOC = 16; 
    4305     char_t[]    input_, 
    4306                 pattern_; 
    4307  
    4308     string compileCommand(Layout!(char) layout, tdfa_t.Command cmd, char_t[] indent) 
     4310    const(char_t)[] input_, 
     4311                    pattern_; 
     4312 
     4313    string compileCommand(Layout!(char) layout, tdfa_t.Command cmd, const(char_t)[] indent) 
    43094314    { 
    43104315        string  code, 
     
    43524357    size_t idx; /// index in string of where error occurred 
    43534358 
    4354     this(char[] s, size_t i) 
     4359    this(Cutf8 s, size_t i) 
    43554360    { 
    43564361        idx = i; 
     
    44674472    body 
    44684473    { 
    4469         char[] msg; 
     4474        Cutf8 msg; 
    44704475        dchar V; 
    44714476        size_t i = idx; 
  • branches/experimental/D2.0/tango/text/Util.d

    r3890 r3893  
    308308******************************************************************************/ 
    309309 
     310uint locate(T, U=uint) (const(T)[] source, T match, U start=0) 
     311{return locate!(T) (source, match, start);} 
     312 
    310313uint locate(T, U=uint) (T[] source, T match, U start=0) 
    311314{return locate!(T) (source, match, start);} 
    312315 
    313 uint locate(T) (T[] source, T match, uint start=0) 
     316uint locate(T) (const(T)[] source, T match, uint start=0) 
    314317{ 
    315318        if (start > source.length) 
     
    354357{return locatePattern!(T) (source, match, start);} 
    355358 
    356 uint locatePattern(T) (T[] source, T[] match, uint start=0) 
     359uint locatePattern(T) (const(T)[] source, const(T)[] match, uint start=0) 
    357360{ 
    358361        uint    idx; 
    359         T*      p = source.ptr + start; 
     362        const(T)*      p = source.ptr + start; 
    360363        uint    extent = source.length - start - match.length + 1; 
    361364 
     
    693696{return indexOf!(T) (str, match, length);} 
    694697 
    695 uint indexOf(T) (T* str, T match, uint length) 
     698uint indexOf(T) (const(T)* str, T match, uint length) 
    696699{ 
    697700        version (D_InlineAsm_X86) 
     
    939942******************************************************************************/ 
    940943 
    941 PatternFruct!(T) patterns(T) (T[] src, T[] pattern, T[] sub=null) 
     944PatternFruct!(T) patterns(T) (const(T)[] src, const(T)[] pattern, const(T)[] sub=null) 
    942945{ 
    943946        PatternFruct!(T) elements; 
     
    13381341private struct PatternFruct(T) 
    13391342{ 
    1340         private T[] src, 
     1343        private const(T)[] src, 
    13411344                    sub, 
    13421345                    pattern; 
    13431346 
    1344         int opApply (int delegate (ref T[] token) dg) 
     1347        int opApply (int delegate (ref const(T)[] token) dg) 
    13451348        { 
    13461349                uint    ret, 
    13471350                        pos, 
    13481351                        mark; 
    1349                 T[] token; 
     1352                const(T)[] token; 
    13501353 
    13511354                // optimize for single-element pattern