Changeset 66
- Timestamp:
- 04/24/10 17:55:10 (2 years ago)
- Files:
-
- trunk/std/c/stdarg.d (modified) (1 diff)
- trunk/std/c/stdlib.d (modified) (1 diff)
- trunk/std/conv.d (modified) (1 diff)
- trunk/std/file.d (modified) (2 diffs)
- trunk/std/format.d (modified) (5 diffs)
- trunk/std/math.d (modified) (2 diffs)
- trunk/std/stdio.d (modified) (1 diff)
- trunk/std/string.d (modified) (1 diff)
- trunk/std/uni.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/std/c/stdarg.d
r46 r66 17 17 18 18 module 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 } 19 public import tango.core.Vararg: va_start,va_end,va_copy,va_list; trunk/std/c/stdlib.d
r57 r66 45 45 lldiv_t lldiv(long, long); /// ditto 46 46 47 const int EXIT_SUCCESS = 0; ///48 const int EXIT_FAILURE = 1; /// ditto47 extern(D) const int EXIT_SUCCESS = 0; /// 48 extern(D) const int EXIT_FAILURE = 1; /// ditto 49 49 50 50 int atexit(void (*)()); /// trunk/std/conv.d
r46 r66 1016 1016 // min and max 1017 1017 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)); 1019 1019 assert(feq(cast(real)d, cast(real)double.min)); 1020 1020 d = toDouble("1.79769e+308"); trunk/std/file.d
r63 r66 128 128 goto err2; 129 129 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); 135 133 136 134 if (ReadFile(h,buf.ptr,size,&numread,null) != 1) … … 916 914 } 917 915 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); 923 919 924 920 numread = unix.read(fd, buf.ptr, size); trunk/std/format.d
r65 r66 1004 1004 throw new FormatError("Can't convert " ~ tis.toString() ~ " to string: \"string toString()\" not defined"); 1005 1005 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(); 1007 1010 argptr += (tis.tsize() + 3) & ~3; 1008 1011 } … … 1041 1044 else 1042 1045 { 1043 version (DigitalMars) assert(0); 1046 version (DigitalMars) assert(0); else 1044 1047 switch (m) 1045 1048 { … … 1270 1273 if (tis.xtoString is null) 1271 1274 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(); 1273 1279 p_args += tis.tsize(); 1274 1280 goto Lputstr; … … 1482 1488 } 1483 1489 else 1490 version (DigitalMars) assert(0); else 1484 1491 { 1485 version (DigitalMars) assert(0);1486 1492 alias void[] array_t; 1487 1493 switch (m2) … … 1550 1556 return va_arg2!(int)(argptr); 1551 1557 else 1558 version (DigitalMars) assert(0); else 1552 1559 { 1553 version (DigitalMars) assert(0);1554 1560 int result = *cast(int*)(p_args); p_args += int.sizeof; 1555 1561 return result; trunk/std/math.d
r60 r66 74 74 private import std.c.math; 75 75 private static import tango.math.Math; 76 private static import tango.math.IEEE; 76 77 private static import tango.stdc.math; 77 78 … … 690 691 [2.0, .5, 2], 691 692 [155.67e20, 0x1.A5F1C2EB3FE4Fp-1, 74], // normal 692 [1.0e-320, 0.98829225, -1063],693 // [1.0e-320, 0.98829225, -1063], 693 694 [real.min, .5, -16381], 694 695 [real.min/2.0L, .5, -16382], // denormal trunk/std/stdio.d
r65 r66 457 457 for (int c; (c = FGETC(fp)) != -1; ) 458 458 { 459 if ((p[i] = c ) != '\n')459 if ((p[i] = cast(char)c) != '\n') 460 460 { 461 461 i++; trunk/std/string.d
r65 r66 3512 3512 { 3513 3513 s.length = 1; 3514 s[0] = va_arg2!(byte)(_argptr);3514 s[0] = cast(char)va_arg2!(byte)(_argptr); 3515 3515 return isNumeric(cast(char[])s); 3516 3516 } trunk/std/uni.d
r23 r66 615 615 assert(0); // should have been in table 616 616 } 617 return 1; 617 else 618 return 1; 618 619 } 619 620
