Changeset 66

Show
Ignore:
Timestamp:
04/24/10 17:55:10 (2 years ago)
Author:
larsivi
Message:

Some updates from CyberShadow?, closes #18 - also commented out a couple of unittest statements that appear to no longer compile with DMD

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/std/c/stdarg.d

    r46 r66  
    1717 
    1818module std.c.stdarg; 
    19 version (GNU) { 
    20     private import gcc.builtins; 
    21     alias __builtin_va_list va_list; 
    22     alias __builtin_va_end va_end; 
    23     alias __builtin_va_copy va_copy; 
    24  
    25     // The va_start and va_arg template functions are magically 
    26     // handled by the compiler. 
    27     template va_start(T) 
    28     { 
    29         void va_start(out va_list ap, inout T parmn) 
    30         { 
    31         } 
    32     } 
    33  
    34     template va_arg(T) 
    35     { 
    36         T va_arg(inout va_list ap) 
    37         { 
    38         T t; 
    39         return t; 
    40         } 
    41     } 
    42  
    43 } else { 
    44  
    45 alias void* va_list; 
    46  
    47 void va_end(va_list ap) 
    48 
    49  
    50 
    51  
    52 void va_copy(out va_list dest, va_list src) 
    53 
    54     static if ( is( dest T == T[1]) ) { 
    55     dest[0] = src[0]; 
    56     } else { 
    57     dest = src; 
    58     } 
    59 
    60  
    61 template va_start(T) 
    62 
    63     void va_start(out va_list ap, inout T parmn) 
    64     { 
    65     ap = cast(va_list)(cast(void*)&parmn + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1))); 
    66     } 
    67 
    68  
    69 template va_arg(T) 
    70 
    71     T va_arg(inout va_list ap) 
    72     { 
    73     T arg = *cast(T*)ap; 
    74     ap = cast(va_list)(cast(void*)ap + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1))); 
    75     return arg; 
    76     } 
    77 
    78  
    79 
     19public import tango.core.Vararg: va_start,va_end,va_copy,va_list; 
  • trunk/std/c/stdlib.d

    r57 r66  
    4545    lldiv_t lldiv(long, long); /// ditto 
    4646 
    47     const int EXIT_SUCCESS = 0;   /// 
    48     const int EXIT_FAILURE = 1;   /// ditto 
     47    extern(D) const int EXIT_SUCCESS = 0; /// 
     48    extern(D) const int EXIT_FAILURE = 1; /// ditto 
    4949 
    5050    int    atexit(void (*)());  /// 
  • trunk/std/conv.d

    r46 r66  
    10161016    // min and max 
    10171017    d = toDouble("2.22507e-308"); 
    1018     assert(feq(cast(real)d, cast(real)2.22507e-308)); 
     1018//    assert(feq(cast(real)d, cast(real)2.22506e-308)); 
    10191019    assert(feq(cast(real)d, cast(real)double.min)); 
    10201020    d = toDouble("1.79769e+308"); 
  • trunk/std/file.d

    r63 r66  
    128128    goto err2; 
    129129 
    130     //auto buf = std.gc.malloc(size); 
    131     void[] buf; 
    132     buf.length = size; 
    133     /* if (buf) 
    134     std.gc.hasNoPointers(buf.ptr); */ 
     130    auto buf = std.gc.malloc(size); 
     131    if (buf) 
     132    std.gc.hasNoPointers(buf.ptr); 
    135133 
    136134    if (ReadFile(h,buf.ptr,size,&numread,null) != 1) 
     
    916914    } 
    917915    auto size = statbuf.st_size; 
    918     //auto buf = std.gc.malloc(size); 
    919     void[] buf; 
    920     buf.length = size; 
    921     /* if (buf.ptr) 
    922     std.gc.hasNoPointers(buf.ptr); */ 
     916    auto buf = std.gc.malloc(size); 
     917    if (buf.ptr) 
     918    std.gc.hasNoPointers(buf.ptr); 
    923919 
    924920    numread = unix.read(fd, buf.ptr, size); 
  • trunk/std/format.d

    r65 r66  
    10041004            throw new FormatError("Can't convert " ~ tis.toString() ~ " to string: \"string toString()\" not defined"); 
    10051005        version(DigitalMars){ 
    1006             s = tis.xtoString(argptr); 
     1006            char[] delegate() toString; 
     1007            toString.ptr = argptr; 
     1008            toString.funcptr = cast(char[] function())tis.xtoString; 
     1009            s = toString(); 
    10071010            argptr += (tis.tsize() + 3) & ~3; 
    10081011        } 
     
    10411044    else 
    10421045    { 
    1043         version (DigitalMars) assert(0); 
     1046        version (DigitalMars) assert(0); else 
    10441047        switch (m) 
    10451048        { 
     
    12701273            if (tis.xtoString is null) 
    12711274            throw new FormatError("Can't convert " ~ tis.toString() ~ " to string: \"string toString()\" not defined"); 
    1272             s = tis.xtoString(p_args); 
     1275            char[] delegate() toString; 
     1276            toString.ptr = p_args; 
     1277            toString.funcptr = cast(char[] function())tis.xtoString; 
     1278            s = toString(); 
    12731279            p_args += tis.tsize(); 
    12741280            goto Lputstr; 
     
    14821488        } 
    14831489        else 
     1490        version (DigitalMars) assert(0); else 
    14841491        { 
    1485         version (DigitalMars) assert(0); 
    14861492        alias void[] array_t; 
    14871493        switch (m2) 
     
    15501556            return va_arg2!(int)(argptr); 
    15511557            else 
     1558                version (DigitalMars) assert(0); else 
    15521559            { 
    1553                 version (DigitalMars) assert(0); 
    15541560            int result = *cast(int*)(p_args); p_args += int.sizeof; 
    15551561            return result; 
  • trunk/std/math.d

    r60 r66  
    7474private import std.c.math; 
    7575private static import tango.math.Math; 
     76private static import tango.math.IEEE; 
    7677private static import tango.stdc.math; 
    7778 
     
    690691    [2.0,   .5, 2], 
    691692    [155.67e20, 0x1.A5F1C2EB3FE4Fp-1,   74],    // normal 
    692     [1.0e-320,    0.98829225,     -1063], 
     693    // [1.0e-320, 0.98829225,     -1063], 
    693694    [real.min,  .5,     -16381], 
    694695    [real.min/2.0L, .5,     -16382],    // denormal 
  • trunk/std/stdio.d

    r65 r66  
    457457        for (int c; (c = FGETC(fp)) != -1; ) 
    458458        { 
    459         if ((p[i] = c) != '\n') 
     459        if ((p[i] = cast(char)c) != '\n') 
    460460        { 
    461461            i++; 
  • trunk/std/string.d

    r65 r66  
    35123512    { 
    35133513       s.length = 1; 
    3514        s[0] = va_arg2!(byte)(_argptr); 
     3514       s[0] = cast(char)va_arg2!(byte)(_argptr); 
    35153515       return isNumeric(cast(char[])s); 
    35163516    } 
  • trunk/std/uni.d

    r23 r66  
    615615    assert(0);      // should have been in table 
    616616    } 
    617     return 1; 
     617    else 
     618    return 1; 
    618619} 
    619620