From d6ac036afff0eeaa311098e9ad6984d2006b477c Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Mon, 10 Sep 2007 05:11:52 +0000 Subject: [PATCH] phobos 0.149 --- internal/gc/gcbits.d | 24 ++++----- internal/object.d | 2 +- linux.mak | 2 +- std/base64.d | 2 +- std/c/fenv.d | 112 ++++++++++++++++++++++++++++++++++++++++++ std/compiler.d | 2 +- std/cover.d | 2 +- std/date.d | 2 +- std/demangle.d | 2 +- std/file.d | 2 +- std/format.d | 4 +- std/math.d | 2 +- std/md5.d | 4 +- std/outbuffer.d | 2 +- std/path.d | 2 +- std/random.d | 2 +- std/stream.d | 2 +- std/string.d | 2 +- std/uri.d | 2 +- std/utf.d | 2 +- std/windows/charset.d | 2 +- std/zip.d | 2 +- std/zlib.d | 2 +- win32.mak | 23 ++++++--- 24 files changed, 163 insertions(+), 42 deletions(-) create mode 100644 std/c/fenv.d diff --git a/internal/gc/gcbits.d b/internal/gc/gcbits.d index c7a65b3f1..b133b5d65 100644 --- a/internal/gc/gcbits.d +++ b/internal/gc/gcbits.d @@ -55,8 +55,8 @@ struct GCBits } body { - return (cast(bit *)(data + 1))[i]; - //return data[1 + (i >> BITS_SHIFT)] & (1 << (i & BITS_MASK)); + //return (cast(bit *)(data + 1))[i]; + return data[1 + (i >> BITS_SHIFT)] & (1 << (i & BITS_MASK)); } void set(uint i) @@ -66,8 +66,8 @@ struct GCBits } body { - (cast(bit *)(data + 1))[i] = 1; - //data[1 + (i >> BITS_SHIFT)] |= (1 << (i & BITS_MASK)); + //(cast(bit *)(data + 1))[i] = 1; + data[1 + (i >> BITS_SHIFT)] |= (1 << (i & BITS_MASK)); } void clear(uint i) @@ -77,8 +77,8 @@ struct GCBits } body { - (cast(bit *)(data + 1))[i] = 0; - //data[1 + (i >> BITS_SHIFT)] &= ~(1 << (i & BITS_MASK)); + //(cast(bit *)(data + 1))[i] = 0; + data[1 + (i >> BITS_SHIFT)] &= ~(1 << (i & BITS_MASK)); } uint testClear(uint i) @@ -102,13 +102,13 @@ struct GCBits else { uint result; - result = (cast(bit *)(data + 1))[i]; - (cast(bit *)(data + 1))[i] = 0; + //result = (cast(bit *)(data + 1))[i]; + //(cast(bit *)(data + 1))[i] = 0; - //uint *p = &data[1 + (i >> BITS_SHIFT)]; - //uint mask = (1 << (i & BITS_MASK)); - //result = *p & mask; - //*p &= ~mask; + uint *p = &data[1 + (i >> BITS_SHIFT)]; + uint mask = (1 << (i & BITS_MASK)); + result = *p & mask; + *p &= ~mask; return result; } } diff --git a/internal/object.d b/internal/object.d index f5b898f52..850ecb343 100644 --- a/internal/object.d +++ b/internal/object.d @@ -5,7 +5,7 @@ * * This module is implicitly imported. * Macros: - * WIKI = Object + * WIKI = Phobos/Object */ /* diff --git a/linux.mak b/linux.mak index 7a1611d93..fe46ebfa2 100644 --- a/linux.mak +++ b/linux.mak @@ -103,7 +103,7 @@ SRC_STD= std/zlib.d std/zip.d std/stdint.d std/conv.d std/utf.d std/uri.d \ std/boxer.d std/cstream.d std/demangle.d std/cover.d std/bitarray.d SRC_STD_C= std/c/process.d std/c/stdlib.d std/c/time.d std/c/stdio.d \ - std/c/math.d std/c/stdarg.d std/c/stddef.d + std/c/math.d std/c/stdarg.d std/c/stddef.d std/c/fenv.d SRC_TI= \ std/typeinfo/ti_wchar.d std/typeinfo/ti_uint.d \ diff --git a/std/base64.d b/std/base64.d index dbf703179..7988390d9 100644 --- a/std/base64.d +++ b/std/base64.d @@ -2,7 +2,7 @@ * Encodes/decodes MIME base64 data. * * Macros: - * WIKI=StdBase64 + * WIKI=Phobos/StdBase64 * References: * Wikipedia Base64$(BR) * RFC 2045$(BR) diff --git a/std/c/fenv.d b/std/c/fenv.d new file mode 100644 index 000000000..15df69721 --- /dev/null +++ b/std/c/fenv.d @@ -0,0 +1,112 @@ + +/** + * C's <fenv.h> + * Authors: Walter Bright, Digital Mars, www.digitalmars.com + * License: Public Domain + * Macros: + * WIKI=Phobos/StdCFenv + */ + +module std.c.fenv; + +extern (C): + +/// Entire floating point environment + +struct fenv_t +{ + version (Windows) + { + ushort status; + ushort control; + ushort round; + ushort reserved[2]; + } + else version (linux) + { + ushort __control_word; + ushort __unused1; + ushort __status_word; + ushort __unused2; + ushort __tags; + ushort __unused3; + uint __eip; + ushort __cs_selector; + ushort __opcode; + uint __data_offset; + ushort __data_selector; + ushort __unused5; + } + else + { + static assert(0); + } +} + +alias int fexcept_t; /// Floating point status flags + +/// The various floating point exceptions +enum +{ + FE_INVALID = 1, + FE_DENORMAL = 2, + FE_DIVBYZERO = 4, + FE_OVERFLOW = 8, + FE_UNDERFLOW = 0x10, + FE_INEXACT = 0x20, + FE_ALL_EXCEPT = 0x3F, /// Mask of all the exceptions +} + +/// Rounding modes +enum +{ + FE_TONEAREST = 0, + FE_UPWARD = 0x800, + FE_DOWNWARD = 0x400, + FE_TOWARDZERO = 0xC00, +} + +version (Windows) +{ + extern fenv_t _FE_DFL_ENV; + + /// Default floating point environment + fenv_t* FE_DFL_ENV = &_FE_DFL_ENV; +} +else version (linux +{ + /// Default floating point environment + fenv_t* FE_DFL_ENV = cast(fenv_t*)(-1); +} +else +{ + static assert(0); +} + +/// Floating point precision +enum +{ + FE_FLTPREC = 0, + FE_DBLPREC = 0x200, + FE_LDBLPREC = 0x300, +} + +int fetestexcept(int excepts); +int feraiseexcept(int excepts); +int feclearexcept(int excepts); +//int fegetexcept(fexcept_t *flagp,int excepts); +//int fesetexcept(fexcept_t *flagp,int excepts); +int fegetround(); +int fesetround(int round); +int fegetprec(); +int fesetprec(int prec); +int fegetenv(fenv_t *envp); +int fesetenv(fenv_t *envp); +//void feprocentry(fenv_t *envp); +//void feprocexit(const fenv_t *envp); + +int fegetexceptflag(fexcept_t *flagp,int excepts); +int fesetexceptflag(fexcept_t *flagp,int excepts); +int feholdexcept(fenv_t *envp); +int feupdateenv(fenv_t *envp); + diff --git a/std/compiler.d b/std/compiler.d index 7a8d92c76..eb5d6539d 100644 --- a/std/compiler.d +++ b/std/compiler.d @@ -1,7 +1,7 @@ /** * Macros: - * WIKI = StdCompiler + * WIKI = Phobos/StdCompiler */ /** diff --git a/std/cover.d b/std/cover.d index 110205a0b..90455d8ad 100644 --- a/std/cover.d +++ b/std/cover.d @@ -29,7 +29,7 @@ * $(LI inline asm statements are not counted) * ) * Macros: - * WIKI = StdCover + * WIKI = Phobos/StdCover */ module std.cover; diff --git a/std/date.d b/std/date.d index bf83b6e77..8b3e09b96 100644 --- a/std/date.d +++ b/std/date.d @@ -4,7 +4,7 @@ * around a central type, d_time, from which other formats are converted to and * from. * Macros: - * WIKI = StdDate + * WIKI = Phobos/StdDate */ // Copyright (c) 1999-2005 by Digital Mars diff --git a/std/demangle.d b/std/demangle.d index 47b0f7ed4..801488c84 100644 --- a/std/demangle.d +++ b/std/demangle.d @@ -1,7 +1,7 @@ /**** * Demangle D mangled names. * Macros: - * WIKI = StdDemangle + * WIKI = Phobos/StdDemangle */ /* Author: diff --git a/std/file.d b/std/file.d index 65c6014e6..184009db9 100644 --- a/std/file.d +++ b/std/file.d @@ -1,6 +1,6 @@ /** * Macros: - * WIKI = StdFile + * WIKI = Phobos/StdFile */ /* diff --git a/std/format.d b/std/format.d index 6d23e5cc0..d4d204f29 100644 --- a/std/format.d +++ b/std/format.d @@ -3,7 +3,7 @@ * It's comparable to C99's vsprintf(). * * Macros: - * WIKI = StdFormat + * WIKI = Phobos/StdFormat */ /* @@ -38,8 +38,6 @@ private import std.utf; private import std.c.stdlib; private import std.string; -alias bool bit; - version (Windows) { version (DigitalMars) diff --git a/std/math.d b/std/math.d index 573bc160e..08d4faa45 100644 --- a/std/math.d +++ b/std/math.d @@ -2,7 +2,7 @@ /** * Macros: - * WIKI = StdMath + * WIKI = Phobos/StdMath * * TABLE_SV = * diff --git a/std/md5.d b/std/md5.d index 6a8cdfb6a..7227aac99 100644 --- a/std/md5.d +++ b/std/md5.d @@ -19,7 +19,7 @@ * $(LINK2 http://en.wikipedia.org/wiki/Md5, Wikipedia on MD5) * * Macros: - * WIKI = StdMd5 + * WIKI = Phobos/StdMd5 */ /++++++++++++++++++++++++++++++++ @@ -55,7 +55,7 @@ void MDFile(char[] filename) else { context.start(); - while ((len = fread(buffer, 1, buffer.size, file)) != 0) + while ((len = fread(buffer, 1, buffer.sizeof, file)) != 0) context.update(buffer[0 .. len]); context.finish(digest); fclose(file); diff --git a/std/outbuffer.d b/std/outbuffer.d index ae795b40f..a92540d53 100644 --- a/std/outbuffer.d +++ b/std/outbuffer.d @@ -4,7 +4,7 @@ * Boilerplate: * $(std_boilerplate.html) * Macros: - * WIKI = StdOutbuffer + * WIKI = Phobos/StdOutbuffer * Copyright: * Copyright (c) 2001-2005 by Digital Mars * All Rights Reserved diff --git a/std/path.d b/std/path.d index 154f07c09..efe96aa6a 100644 --- a/std/path.d +++ b/std/path.d @@ -1,7 +1,7 @@ /** * Macros: - * WIKI = StdPath + * WIKI = Phobos/StdPath * Copyright: * Placed into public domain. * www.digitalmars.com diff --git a/std/random.d b/std/random.d index b2c2053ec..3d88124d2 100644 --- a/std/random.d +++ b/std/random.d @@ -1,6 +1,6 @@ /** * Macros: - * WIKI = StdRandom + * WIKI = Phobos/StdRandom */ // random.d diff --git a/std/stream.d b/std/stream.d index 9bfef7b25..8aeaf0dbb 100644 --- a/std/stream.d +++ b/std/stream.d @@ -1,6 +1,6 @@ /** * Macros: - * WIKI = StdStream + * WIKI = Phobos/StdStream */ /* diff --git a/std/string.d b/std/string.d index abf4e93fa9..dcb9a8d19 100644 --- a/std/string.d +++ b/std/string.d @@ -11,7 +11,7 @@ * are done, the returned string is a copy. * * Macros: - * WIKI = StdString + * WIKI = Phobos/StdString * Copyright: * Public Domain */ diff --git a/std/uri.d b/std/uri.d index e2e4963db..ce5c4bd59 100644 --- a/std/uri.d +++ b/std/uri.d @@ -33,7 +33,7 @@ * $(LINK2 http://www.ietf.org/rfc/rfc3986.txt, RFC 3986)
* $(LINK2 http://en.wikipedia.org/wiki/Uniform_resource_identifier, Wikipedia) * Macros: - * WIKI = StdUri + * WIKI = Phobos/StdUri */ module std.uri; diff --git a/std/utf.d b/std/utf.d index 76d56501c..0d0af101d 100644 --- a/std/utf.d +++ b/std/utf.d @@ -37,7 +37,7 @@ * $(LINK http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8)
* $(LINK http://anubis.dkuug.dk/JTC1/SC2/WG2/docs/n1335) * Macros: - * WIKI = StdUtf + * WIKI = Phobos/StdUtf */ module std.utf; diff --git a/std/windows/charset.d b/std/windows/charset.d index 9630fafc6..2d723031c 100644 --- a/std/windows/charset.d +++ b/std/windows/charset.d @@ -3,7 +3,7 @@ /** * Support UTF-8 on Windows 95, 98 and ME systems. * Macros: - * WIKI = StdWindowsCharset + * WIKI = Phobos/StdWindowsCharset */ module std.windows.charset; diff --git a/std/zip.d b/std/zip.d index 9962058a0..a051e6ab5 100644 --- a/std/zip.d +++ b/std/zip.d @@ -12,7 +12,7 @@ * ) * * Macros: - * WIKI = StdZip + * WIKI = Phobos/StdZip */ module std.zip; diff --git a/std/zlib.d b/std/zlib.d index 7cb43b658..01f6f0d55 100644 --- a/std/zlib.d +++ b/std/zlib.d @@ -5,7 +5,7 @@ * $(LINK2 http://en.wikipedia.org/wiki/Zlib, Wikipedia) * * Macros: - * WIKI = StdZlib + * WIKI = Phobos/StdZlib */ diff --git a/win32.mak b/win32.mak index 87b7efc75..f6e7e6168 100644 --- a/win32.mak +++ b/win32.mak @@ -73,7 +73,7 @@ OBJS= asserterror.obj deh.obj switch.obj complex.obj gcstats.obj \ socket.obj socketstream.obj loader.obj stdarg.obj format.obj stdio.obj \ perf.obj openrj.obj uni.obj winsock.obj oldsyserror.obj \ errno.obj boxer.obj cstream.obj charset.obj \ - realtest.obj gamma.obj demangle.obj cover.obj \ + realtest.obj gamma.obj demangle.obj cover.obj bitarray.obj \ ti_Aa.obj ti_Ag.obj ti_C.obj ti_int.obj ti_char.obj \ ti_wchar.obj ti_uint.obj ti_short.obj ti_ushort.obj \ ti_byte.obj ti_ubyte.obj ti_long.obj ti_ulong.obj ti_ptr.obj \ @@ -85,7 +85,9 @@ OBJS= asserterror.obj deh.obj switch.obj complex.obj gcstats.obj \ ti_Aint.obj ti_Auint.obj ti_Along.obj ti_Aulong.obj ti_Awchar.obj \ ti_Afloat.obj ti_Adouble.obj ti_Areal.obj \ ti_Acfloat.obj ti_Acdouble.obj ti_Acreal.obj \ - ti_dchar.obj ti_Adchar.obj ti_bit.obj ti_Abit.obj ti_void.obj + ti_dchar.obj ti_Adchar.obj ti_void.obj + +# ti_bit.obj ti_Abit.obj DOCS= $(DOC)\std_path.html $(DOC)\std_math.html $(DOC)\std_outbuffer.html \ $(DOC)\std_stream.html $(DOC)\std_string.html $(DOC)\std_base64.html \ @@ -97,6 +99,7 @@ DOCS= $(DOC)\std_path.html $(DOC)\std_math.html $(DOC)\std_outbuffer.html \ $(DOC)\std_utf.html \ $(DOC)\std_cover.html \ $(DOC)\std_regexp.html \ + $(DOC)\std_bitarray.html \ $(DOC)\std_stdio.html \ $(DOC)\std_windows_charset.html @@ -111,17 +114,17 @@ SRC_STD= std\zlib.d std\zip.d std\stdint.d std\conv.d std\utf.d std\uri.d \ std\regexp.d std\random.d std\stream.d std\process.d std\recls.d \ std\socket.d std\socketstream.d std\loader.d std\stdarg.d std\format.d \ std\stdio.d std\perf.d std\openrj.d std\uni.d std\boxer.d \ - std\cstream.d std\demangle.d std\cover.d + std\cstream.d std\demangle.d std\cover.d std\bitarray.d SRC_STD_C= std\c\process.d std\c\stdlib.d std\c\time.d std\c\stdio.d \ - std\c\math.d std\c\stdarg.d std\c\stddef.d + std\c\math.d std\c\stdarg.d std\c\stddef.d std\c\fenv.d SRC_TI= \ std\typeinfo\ti_wchar.d std\typeinfo\ti_uint.d \ std\typeinfo\ti_short.d std\typeinfo\ti_ushort.d \ std\typeinfo\ti_byte.d std\typeinfo\ti_ubyte.d \ std\typeinfo\ti_long.d std\typeinfo\ti_ulong.d \ - std\typeinfo\ti_ptr.d std\typeinfo\ti_bit.d \ + std\typeinfo\ti_ptr.d \ std\typeinfo\ti_float.d std\typeinfo\ti_double.d \ std\typeinfo\ti_real.d std\typeinfo\ti_delegate.d \ std\typeinfo\ti_creal.d std\typeinfo\ti_ireal.d \ @@ -139,7 +142,9 @@ SRC_TI= \ std\typeinfo\ti_Acfloat.d std\typeinfo\ti_Acdouble.d \ std\typeinfo\ti_Acreal.d \ std\typeinfo\ti_Awchar.d std\typeinfo\ti_dchar.d \ - std\typeinfo\ti_Abit.d std\typeinfo\ti_void.d + std\typeinfo\ti_void.d + +# std\typeinfo\ti_bit.d std\typeinfo\ti_Abit.d SRC_INT= \ internal\switch.d internal\complex.c internal\critical.c \ @@ -459,6 +464,9 @@ asserterror.obj : std\asserterror.d base64.obj : std\base64.d $(DMD) -c $(DFLAGS) -inline std\base64.d +bitarray.obj : std\bitarray.d + $(DMD) -c $(DFLAGS) -inline std\bitarray.d + boxer.obj : std\boxer.d $(DMD) -c $(DFLAGS) std\boxer.d @@ -768,6 +776,9 @@ ti_int.obj : std\typeinfo\ti_int.d $(DOC)\std_base64.html : std.ddoc std\base64.d $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_base64.html std.ddoc std\base64.d +$(DOC)\std_bitarray.html : std.ddoc std\bitarray.d + $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_bitarray.html std.ddoc std\bitarray.d + $(DOC)\std_compiler.html : std.ddoc std\compiler.d $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_compiler.html std.ddoc std\compiler.d
Special Values