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

Changeset 4384

Show
Ignore:
Timestamp:
03/05/09 10:17:05 (3 years ago)
Author:
fawzi
Message:

reducing diffs with druntime, adding mac support, general reorganization

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/build-dmd.sh

    r4325 r4384  
    1616dmdsettings 
    1717 
    18 make clean -fdmd-posix.mak           || goerror 
    19 make lib doc install -fdmd-posix.mak SYSTEM_VERSION="$POSIXFLAG"  || goerror 
     18make clean-all -fdmd-posix.mak           || goerror 
     19make all install -fdmd-posix.mak SYSTEM_VERSION="$POSIXFLAG"  || goerror 
    2020make clean -fdmd-posix.mak           || goerror 
    2121chmod 644 ../tango/core/*.di         || goerror 
  • trunk/lib/build-gdc.sh

    r4325 r4384  
    1 #!/usr/bin/env bash 
     1#!/usr/bin/env bash -v 
    22cd "`dirname $0`" 
    33 
  • trunk/lib/common/tango/core/Runtime.d

    r3456 r4384  
    77 */ 
    88module tango.core.Runtime; 
    9  
     9debug private extern(C) int printf(char*,...); 
    1010 
    1111private 
     
    147147//////////////////////////////////////////////////////////////////////////////// 
    148148 
    149  
    150149/** 
    151150 * This routine is called by the runtime to run module unit tests on startup. 
     
    161160    if( Runtime.sm_moduleUnitTester is null ) 
    162161    { 
     162        debug printf("unittest start\n"); 
    163163        foreach( m; ModuleInfo ) 
    164164        { 
    165             if( m.unitTest ) 
     165            if( m.unitTest ) { 
     166                char[] name=m.name~"\n\0"; 
     167                debug printf(name.ptr); 
    166168                m.unitTest(); 
     169            } 
    167170        } 
     171        debug printf("unittest end\n"); 
    168172        return true; 
    169173    } 
  • trunk/lib/common/tango/posix.mak

    r4325 r4384  
    1111#       Delete unneeded files created by build process 
    1212 
    13 LIB_TARGET=libtango-cc-tango.a 
    14 LIB_MASK=libtango-cc-tango*.a 
     13LIB_BASE=libtango-cc-tango 
     14LIB_BUILD= 
     15LIB_TARGET=$(LIB_BASE)$(LIB_BUILD).a 
     16LIB_MASK=$(LIB_BASE)*.a 
    1517 
    1618CP=cp -f 
     
    2224SYSTEM_VERSION= 
    2325 
    24 CFLAGS=-O $(ADD_CFLAGS) 
    25 #CFLAGS=-g $(ADD_CFLAGS) 
     26CFLAGS_RELEASE=-O $(ADD_CFLAGS) 
     27CFLAGS_DEBUG=-g $(ADD_CFLAGS) 
    2628 
    27 DFLAGS=-release -O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
    28 #DFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
     29DFLAGS_RELEASE=-release -O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) -I../../.. 
     30DFLAGS_DEBUG=-g -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) -I../../.. 
     31TFLAGS_RELEASE=-O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
     32TFLAGS_DEBUG=-g -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
    2933 
    30 TFLAGS=-O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
    31 #TFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
     34ifeq ($(VERSION),debug) 
     35CFLAGS=$(CFLAGS_DEBUG) 
     36DFLAGS=$(DFLAGS_DEBUG) 
     37TFLAGS=$(TFLAGS_DEBUG) 
     38else 
     39CFLAGS=$(CFLAGS_RELEASE) 
     40DFLAGS=$(DFLAGS_RELEASE) 
     41TFLAGS=$(TFLAGS_RELEASE) 
     42endif 
    3243 
    3344DOCFLAGS=-version=DDoc $(SYSTEM_VERSION) 
     
    4253 
    4354.SUFFIXES: .s .S .c .cpp .d .html .o 
     55.PHONY : lib lib-release lib-debug unittest all doc clean install clean-all 
    4456 
    4557.s.o: 
     
    6375#   $(DC) -c -o- $(DOCFLAGS) -Df$*.html tango.ddoc $< 
    6476 
    65 targets : lib doc 
    66 all     : lib doc 
    67 tango   : lib 
    68 lib     : tango.lib 
    69 doc     : tango.doc 
     77all     : lib-release lib-debug doc 
     78tango   : lib-release lib-debug 
     79 
     80###################################################### 
     81unittest : 
     82    make -fposix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     83    make -fposix.mak lib DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" \ 
     84        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS) -unittest -debug=UnitTest" \ 
     85        SYSTEM_VERSION="$(SYSTEM_VERSION)" 
     86lib-release : 
     87    make -fposix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     88    make -fposix.mak DC="$(DC)" LIB_BUILD="" VERSION=release lib \ 
     89        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
     90lib-debug : 
     91    make -fposix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     92    make -fposix.mak DC="$(DC)" LIB_BUILD="-d" VERSION=debug lib \ 
     93        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
    7094 
    7195###################################################### 
     
    103127 
    104128###################################################### 
    105  
    106 tango.lib : $(LIB_TARGET) 
    107  
     129lib : $(LIB_TARGET) 
    108130$(LIB_TARGET) : $(ALL_OBJS) 
    109131    $(RM) $@ 
    110132    $(LC) $@ $(ALL_OBJS) 
    111133 
    112 tango.doc : $(ALL_DOCS) 
     134tango.doc:doc 
     135doc : $(ALL_DOCS) 
    113136    echo Documentation generated. 
    114137 
     
    125148    find . -name "*.di" | xargs $(RM) 
    126149    $(RM) $(ALL_OBJS) 
     150 
     151clean-all: clean 
    127152    $(RM) $(ALL_DOCS) 
    128153    find . -name "$(LIB_MASK)" | xargs $(RM) 
  • trunk/lib/compiler/dmd/OBJECTDEFS.inc

    r4357 r4384  
    2222    rt/dmain2.obj \ 
    2323    invariant.obj \ 
     24    rt/invariant_.obj \ 
    2425    rt/lifetime.obj \ 
    2526    rt/memory.obj \ 
     
    3435OBJ_POSIX=rt/alloca.obj \ 
    3536    rt/cmath2.obj \ 
     37    rt/gcosx.obj \ 
    3638    rt/deh2.obj \ 
    3739    rt/llmath.obj 
  • trunk/lib/compiler/dmd/invariant.d

    r454 r4384  
    1  
    21/* 
    32 * Placed into the Public Domain 
     
    65 */ 
    76 
     7private { 
     8    extern(C) int printf(char*,...); 
     9} 
    810void _d_invariant(Object o) 
    911{   ClassInfo c; 
     
    1214 
    1315    // BUG: needs to be filename/line of caller, not library routine 
    14     assert(o !is null); // just do null check, not invariant check 
    15  
     16    assert(o !is null); // just do null check, not invariant check 
    1617    c = o.classinfo; 
    1718    do 
    1819    { 
    19    if (c.classInvariant) 
    20    
    21        (*c.classInvariant)(o); 
    22    
    23    c = c.base; 
     20        if (c.classInvariant) 
     21       
     22            (*c.classInvariant)(o); 
     23       
     24        c = c.base; 
    2425    } while (c); 
    2526} 
  • trunk/lib/compiler/dmd/object_.d

    r4357 r4384  
    4242    import tango.stdc.string; // : memcmp, memcpy, memmove; 
    4343    import tango.stdc.stdlib; // : calloc, realloc, free; 
    44     import util.string; 
     44    import rt.util.string; 
    4545    debug(PRINTF) import tango.stdc.stdio; // : printf; 
    4646 
     
    6767 
    6868alias size_t hash_t; 
     69alias int equals_t; 
    6970 
    7071/** 
     
    111112     * Returns !=0 if this object does have the same contents as obj. 
    112113     */ 
    113     int opEquals(Object o) 
    114     { 
    115         return cast(int)(this is o); 
     114    equals_t opEquals(Object o) 
     115    { 
     116        return cast(equals_t)(this is o); 
    116117    } 
    117118 
     
    152153    void function(Object) classInvariant; 
    153154    uint        flags; 
    154     //  1:                      // IUnknown 
     155    //  1:                      // is IUnknown or is derived from IUnknown 
    155156    //  2:                      // has no possible pointers into GC memory 
    156157    //  4:                      // has offTi[] member 
     
    230231    } 
    231232 
    232     int opEquals(Object o) 
     233    override equals_t opEquals(Object o) 
    233234    { 
    234235        /* TypeInfo instances are singletons, but duplicates can exist 
     
    239240            return 1; 
    240241        TypeInfo ti = cast(TypeInfo)o; 
    241         return cast(int)(ti && this.toString() == ti.toString()); 
     242        return cast(equals_t)(ti && this.toString() == ti.toString()); 
    242243    } 
    243244 
    244245    /// Returns a hash of the instance of a type. 
    245     hash_t getHash(void *p) { return cast(hash_t)p; } 
     246    hash_t getHash(in void* p) { return cast(hash_t)p; } 
    246247 
    247248    /// Compares two instances for equality. 
    248     int equals(void *p1, void *p2) { return cast(int)(p1 == p2); } 
     249    equals_t equals(in void* p1, in void* p2) { return p1 == p2; } 
    249250 
    250251    /// Compares two instances for &lt;, ==, or &gt;. 
    251     int compare(void *p1, void *p2) { return 0; } 
     252    int compare(in void* p1, in void* p2) { return 0; } 
    252253 
    253254    /// Returns size of the type. 
     
    255256 
    256257    /// Swaps two instances of the type. 
    257     void swap(void *p1, void *p2) 
     258    void swap(void* p1, void* p2) 
    258259    { 
    259260        size_t n = tsize(); 
    260261        for (size_t i = 0; i < n; i++) 
    261         {   byte t; 
    262  
    263             t = (cast(byte *)p1)[i]; 
    264             (cast(byte *)p1)[i] = (cast(byte *)p2)[i]; 
    265             (cast(byte *)p2)[i] = t; 
     262        { 
     263            byte t = (cast(byte *)p1)[i]; 
     264            (cast(byte*)p1)[i] = (cast(byte*)p2)[i]; 
     265            (cast(byte*)p2)[i] = t; 
    266266        } 
    267267    } 
     
    283283class TypeInfo_Typedef : TypeInfo 
    284284{ 
    285     char[] toString() { return name; } 
    286  
    287     int opEquals(Object o) 
    288     {   TypeInfo_Typedef c; 
    289  
    290         return cast(int) 
    291                 (this is o || 
    292                 ((c = cast(TypeInfo_Typedef)o) !is null && 
    293                  this.name == c.name && 
    294                  this.base == c.base)); 
    295     } 
    296  
    297     hash_t getHash(void *p) { return base.getHash(p); } 
    298     int equals(void *p1, void *p2) { return base.equals(p1, p2); } 
    299     int compare(void *p1, void *p2) { return base.compare(p1, p2); } 
    300     size_t tsize() { return base.tsize(); } 
    301     void swap(void *p1, void *p2) { return base.swap(p1, p2); } 
    302  
    303     TypeInfo next() { return base.next(); } 
    304     uint flags() { return base.flags(); } 
    305     void[] init() { return m_init.length ? m_init : base.init(); } 
     285    override char[] toString() { return name; } 
     286 
     287    override equals_t opEquals(Object o) 
     288    { 
     289        TypeInfo_Typedef c; 
     290        return this is o || 
     291               ((c = cast(TypeInfo_Typedef)o) !is null && 
     292                this.name == c.name && 
     293                this.base == c.base); 
     294    } 
     295 
     296    override hash_t getHash(in void* p) { return base.getHash(p); } 
     297    override equals_t equals(in void* p1, in void* p2) { return base.equals(p1, p2); } 
     298    override int compare(in void* p1, in void* p2) { return base.compare(p1, p2); } 
     299    override size_t tsize() { return base.tsize(); } 
     300    override void swap(void* p1, void* p2) { return base.swap(p1, p2); } 
     301 
     302    override TypeInfo next() { return base.next(); } 
     303    override uint flags() { return base.flags(); } 
     304    override void[] init() { return m_init.length ? m_init : base.init(); } 
    306305 
    307306    TypeInfo base; 
     
    312311class TypeInfo_Enum : TypeInfo_Typedef 
    313312{ 
     313 
    314314} 
    315315 
    316316class TypeInfo_Pointer : TypeInfo 
    317317{ 
    318     char[] toString() { return m_next.toString() ~ "*"; } 
    319  
    320     int opEquals(Object o) 
    321     {   TypeInfo_Pointer c; 
    322  
     318    override char[] toString() { return m_next.toString() ~ "*"; } 
     319 
     320    override equals_t opEquals(Object o) 
     321    { 
     322        TypeInfo_Pointer c; 
    323323        return this is o || 
    324324                ((c = cast(TypeInfo_Pointer)o) !is null && 
     
    326326    } 
    327327 
    328     hash_t getHash(void *p) 
     328    override hash_t getHash(in void* p) 
    329329    { 
    330330        return cast(hash_t)*cast(void**)p; 
    331331    } 
    332332 
    333     int equals(void *p1, void *p2) 
    334     { 
    335         return cast(int)(*cast(void* *)p1 == *cast(void* *)p2); 
    336     } 
    337  
    338     int compare(void *p1, void *p2) 
    339     { 
    340         if (*cast(void* *)p1 < *cast(void* *)p2) 
     333    override equals_t equals(in void* p1, in void* p2) 
     334    { 
     335        return cast(equals_t)(*cast(void**)p1 == *cast(void**)p2); 
     336    } 
     337 
     338    override int compare(in void* p1, in void* p2) 
     339    { 
     340        if (*cast(void**)p1 < *cast(void**)p2) 
    341341            return -1; 
    342         else if (*cast(void* *)p1 > *cast(void* *)p2) 
     342        else if (*cast(void**)p1 > *cast(void**)p2) 
    343343            return 1; 
    344344        else 
     
    346346    } 
    347347 
    348     size_t tsize() 
     348    override size_t tsize() 
    349349    { 
    350350        return (void*).sizeof; 
    351351    } 
    352352 
    353     void swap(void *p1, void *p2) 
    354     {   void* tmp; 
    355         tmp = *cast(void**)p1; 
     353    override void swap(void* p1, void* p2) 
     354    { 
     355        void* tmp = *cast(void**)p1; 
    356356        *cast(void**)p1 = *cast(void**)p2; 
    357357        *cast(void**)p2 = tmp; 
    358358    } 
    359359 
    360     TypeInfo next() { return m_next; } 
    361     uint flags() { return 1; } 
     360    override TypeInfo next() { return m_next; } 
     361    override uint flags() { return 1; } 
    362362 
    363363    TypeInfo m_next; 
     
    366366class TypeInfo_Array : TypeInfo 
    367367{ 
    368     char[] toString() { return value.toString() ~ "[]"; } 
    369  
    370     int opEquals(Object o) 
    371     {   TypeInfo_Array c; 
    372  
    373         return cast(int) 
    374                (this is o || 
    375                 ((c = cast(TypeInfo_Array)o) !is null && 
    376                  this.value == c.value)); 
    377     } 
    378  
    379     hash_t getHash(void *p) 
    380     {   size_t sz = value.tsize(); 
     368    override char[] toString() { return value.toString() ~ "[]"; } 
     369 
     370    override equals_t opEquals(Object o) 
     371    { 
     372        TypeInfo_Array c; 
     373        return this is o || 
     374               ((c = cast(TypeInfo_Array)o) !is null && 
     375                this.value == c.value); 
     376    } 
     377 
     378    override hash_t getHash(in void* p) 
     379    { 
     380       size_t sz = value.tsize(); 
    381381        hash_t hash = 0; 
    382382        void[] a = *cast(void[]*)p; 
     
    386386    } 
    387387 
    388     int equals(void *p1, void *p2) 
     388    override equals_t equals(in void* p1, in void* p2) 
    389389    { 
    390390        void[] a1 = *cast(void[]*)p1; 
    391391        void[] a2 = *cast(void[]*)p2; 
    392392        if (a1.length != a2.length) 
    393             return 0
     393            return false
    394394        size_t sz = value.tsize(); 
    395395        for (size_t i = 0; i < a1.length; i++) 
    396396        { 
    397397            if (!value.equals(a1.ptr + i * sz, a2.ptr + i * sz)) 
    398                 return 0
    399         } 
    400         return 1
    401     } 
    402  
    403     int compare(void *p1, void *p2) 
     398                return false
     399        } 
     400        return true
     401    } 
     402 
     403    override int compare(in void* p1, in void* p2) 
    404404    { 
    405405        void[] a1 = *cast(void[]*)p1; 
     
    419419    } 
    420420 
    421     size_t tsize() 
     421    override size_t tsize() 
    422422    { 
    423423        return (void[]).sizeof; 
    424424    } 
    425425 
    426     void swap(void *p1, void *p2) 
    427     {   void[] tmp; 
    428         tmp = *cast(void[]*)p1; 
     426    override void swap(void* p1, void* p2) 
     427    { 
     428        void[] tmp = *cast(void[]*)p1; 
    429429        *cast(void[]*)p1 = *cast(void[]*)p2; 
    430430        *cast(void[]*)p2 = tmp; 
     
    433433    TypeInfo value; 
    434434 
    435     TypeInfo next() 
     435    override TypeInfo next() 
    436436    { 
    437437        return value; 
    438 
    439  
    440     uint flags() { return 1; } 
     438   
     439 
     440    override uint flags() { return 1; } 
    441441} 
    442442 
    443443class TypeInfo_StaticArray : TypeInfo 
    444444{ 
    445     char[] toString() 
     445    override char[] toString() 
    446446    { 
    447447        char [10] tmp = void; 
     
    449449    } 
    450450 
    451     int opEquals(Object o) 
    452     {   TypeInfo_StaticArray c; 
    453  
    454         return cast(int) 
    455                (this is o || 
    456                 ((c = cast(TypeInfo_StaticArray)o) !is null && 
    457                 this.len == c.len && 
    458                  this.value == c.value)); 
    459     } 
    460  
    461     hash_t getHash(void *p) 
    462     {   size_t sz = value.tsize(); 
     451    override equals_t opEquals(Object o) 
     452    { 
     453        TypeInfo_StaticArray c; 
     454        return this is o || 
     455               ((c = cast(TypeInfo_StaticArray)o) !is null && 
     456                this.len == c.len && 
     457                this.value == c.value); 
     458    } 
     459 
     460    override hash_t getHash(in void* p) 
     461    { 
     462       size_t sz = value.tsize(); 
    463463        hash_t hash = 0; 
    464464        for (size_t i = 0; i < len; i++) 
     
    467467    } 
    468468 
    469     int equals(void *p1, void *p2) 
     469    override equals_t equals(in void* p1, in void* p2) 
    470470    { 
    471471        size_t sz = value.tsize(); 
     
    474474        { 
    475475            if (!value.equals(p1 + u * sz, p2 + u * sz)) 
    476                 return 0
    477         } 
    478         return 1
    479     } 
    480  
    481     int compare(void *p1, void *p2) 
     476                return false
     477        } 
     478        return true
     479    } 
     480 
     481    override int compare(in void* p1, in void* p2) 
    482482    { 
    483483        size_t sz = value.tsize(); 
     
    492492    } 
    493493 
    494     size_t tsize() 
     494    override size_t tsize() 
    495495    { 
    496496        return len * value.tsize(); 
    497497    } 
    498498 
    499     void swap(void *p1, void *p2) 
    500     {   void* tmp; 
     499    override void swap(void* p1, void* p2) 
     500    { 
     501        void* tmp; 
    501502        size_t sz = value.tsize(); 
    502503        ubyte[16] buffer; 
     
    518519    } 
    519520 
    520     void[] init() { return value.init(); } 
    521     TypeInfo next() { return value; } 
    522     uint flags() { return value.flags(); } 
     521    override void[] init() { return value.init(); } 
     522    override TypeInfo next() { return value; } 
     523    override uint flags() { return value.flags(); } 
    523524 
    524525    TypeInfo value; 
    525     size_t len; 
     526    size_t   len; 
    526527} 
    527528 
    528529class TypeInfo_AssociativeArray : TypeInfo 
    529530{ 
    530     char[] toString() 
     531    override char[] toString() 
    531532    { 
    532533        return next.toString() ~ "[" ~ key.toString() ~ "]"; 
    533534    } 
    534535 
    535     int opEquals(Object o) 
    536     {   TypeInfo_AssociativeArray c; 
    537  
     536    override equals_t opEquals(Object o) 
     537    { 
     538        TypeInfo_AssociativeArray c; 
    538539        return this is o || 
    539540                ((c = cast(TypeInfo_AssociativeArray)o) !is null && 
     
    544545    // BUG: need to add the rest of the functions 
    545546 
    546     size_t tsize() 
     547    override size_t tsize() 
    547548    { 
    548549        return (char[int]).sizeof; 
    549550    } 
    550551 
    551     TypeInfo next() { return value; } 
    552     uint flags() { return 1; } 
     552    override TypeInfo next() { return value; } 
     553    override uint flags() { return 1; } 
    553554 
    554555    TypeInfo value; 
     
    558559class TypeInfo_Function : TypeInfo 
    559560{ 
    560     char[] toString() 
     561    override char[] toString() 
    561562    { 
    562563        return next.toString() ~ "()"; 
    563564    } 
    564565 
    565     int opEquals(Object o) 
    566     {   TypeInfo_Function c; 
    567  
     566    override equals_t opEquals(Object o) 
     567    { 
     568        TypeInfo_Function c; 
    568569        return this is o || 
    569570                ((c = cast(TypeInfo_Function)o) !is null && 
     
    573574    // BUG: need to add the rest of the functions 
    574575 
    575     size_t tsize() 
     576    override size_t tsize() 
    576577    { 
    577578        return 0;       // no size for functions 
     
    583584class TypeInfo_Delegate : TypeInfo 
    584585{ 
    585     char[] toString() 
    586     { 
    587         return next.toString() ~ " delegate()"
    588     } 
    589  
    590     int opEquals(Object o) 
    591     {   TypeInfo_Delegate c; 
    592  
     586    override char[] toString() 
     587    { 
     588        return (next.toString() ~ " delegate()")
     589    } 
     590 
     591    override equals_t opEquals(Object o) 
     592    { 
     593        TypeInfo_Delegate c; 
    593594        return this is o || 
    594595                ((c = cast(TypeInfo_Delegate)o) !is null && 
     
    598599    // BUG: need to add the rest of the functions 
    599600 
    600     size_t tsize() 
    601     {   alias int delegate() dg; 
     601    override size_t tsize() 
     602    { 
     603        alias int delegate() dg; 
    602604        return dg.sizeof; 
    603605    } 
    604606 
    605     uint flags() { return 1; } 
     607    override uint flags() { return 1; } 
    606608 
    607609    TypeInfo next; 
     
    610612class TypeInfo_Class : TypeInfo 
    611613{ 
    612     char[] toString() { return info.name; } 
    613  
    614     int opEquals(Object o) 
    615     {   TypeInfo_Class c; 
    616  
     614    override char[] toString() { return info.name; } 
     615 
     616    override equals_t opEquals(Object o) 
     617    { 
     618        TypeInfo_Class c; 
    617619        return this is o || 
    618620                ((c = cast(TypeInfo_Class)o) !is null && 
     
    620622    } 
    621623 
    622     hash_t getHash(void *p) 
     624    override hash_t getHash(in void* p) 
    623625    { 
    624626        Object o = *cast(Object*)p; 
     
    626628    } 
    627629 
    628     int equals(void *p1, void *p2) 
     630    override equals_t equals(in void* p1, in void* p2) 
    629631    { 
    630632        Object o1 = *cast(Object*)p1; 
     
    634636    } 
    635637 
    636     int compare(void *p1, void *p2) 
     638    override int compare(in void* p1, in void* p2) 
    637639    { 
    638640        Object o1 = *cast(Object*)p1; 
     
    644646        { 
    645647            if (o1) 
    646             {   if (!o2) 
     648            { 
     649                if (!o2) 
    647650                    c = 1; 
    648651                else 
     
    655658    } 
    656659 
    657     size_t tsize() 
     660    override size_t tsize() 
    658661    { 
    659662        return Object.sizeof; 
    660663    } 
    661664 
    662     uint flags() { return 1; } 
    663  
    664     OffsetTypeInfo[] offTi() 
     665    override uint flags() { return 1; } 
     666 
     667    override OffsetTypeInfo[] offTi() 
    665668    { 
    666669        return (info.flags & 4) ? info.offTi : null; 
     
    672675class TypeInfo_Interface : TypeInfo 
    673676{ 
    674     char[] toString() { return info.name; } 
    675  
    676     int opEquals(Object o) 
    677     {   TypeInfo_Interface c; 
    678  
     677    override char[] toString() { return info.name; } 
     678 
     679    override equals_t opEquals(Object o) 
     680    { 
     681        TypeInfo_Interface c; 
    679682        return this is o || 
    680683                ((c = cast(TypeInfo_Interface)o) !is null && 
     
    682685    } 
    683686 
    684     hash_t getHash(void *p) 
     687    override hash_t getHash(in void* p) 
    685688    { 
    686689        Interface* pi = **cast(Interface ***)*cast(void**)p; 
     
    690693    } 
    691694 
    692     int equals(void *p1, void *p2) 
     695    override equals_t equals(in void* p1, in void* p2) 
    693696    { 
    694697        Interface* pi = **cast(Interface ***)*cast(void**)p1; 
     
    700703    } 
    701704 
    702     int compare(void *p1, void *p2) 
     705    override int compare(in void* p1, in void* p2) 
    703706    { 
    704707        Interface* pi = **cast(Interface ***)*cast(void**)p1; 
     
    712715        { 
    713716            if (o1) 
    714             {   if (!o2) 
     717            { 
     718                if (!o2) 
    715719                    c = 1; 
    716720                else 
     
    723727    } 
    724728 
    725     size_t tsize() 
     729    override size_t tsize() 
    726730    { 
    727731        return Object.sizeof; 
    728732    } 
    729733 
    730     uint flags() { return 1; } 
     734    override uint flags() { return 1; } 
    731735 
    732736    ClassInfo info; 
     
    735739class TypeInfo_Struct : TypeInfo 
    736740{ 
    737     char[] toString() { return name; } 
    738  
    739     int opEquals(Object o) 
    740     {   TypeInfo_Struct s; 
    741  
     741    override char[] toString() { return name; } 
     742 
     743    override equals_t opEquals(Object o) 
     744    { 
     745        TypeInfo_Struct s; 
    742746        return this is o || 
    743747                ((s = cast(TypeInfo_Struct)o) !is null && 
     
    746750    } 
    747751 
    748     hash_t getHash(void *p) 
    749     {   hash_t h; 
    750  
     752    override hash_t getHash(in void* p) 
     753    { 
    751754        assert(p); 
    752755        if (xtoHash) 
    753         {   debug(PRINTF) printf("getHash() using xtoHash\n"); 
    754             h = (*xtoHash)(p); 
     756        { 
     757            debug(PRINTF) printf("getHash() using xtoHash\n"); 
     758            return (*xtoHash)(p); 
    755759        } 
    756760        else 
    757761        { 
     762            hash_t h; 
    758763            debug(PRINTF) printf("getHash() using default hash\n"); 
    759764            // A sorry hash algorithm. 
    760765            // Should use the one for strings. 
    761766            // BUG: relies on the GC not moving objects 
     767            auto q = cast(ubyte*)p; 
    762768            for (size_t i = 0; i < init.length; i++) 
    763             {   h = h * 9 + *cast(ubyte*)p; 
    764                 p++; 
     769            { 
     770                h = h * 9 + *q; 
     771                q++; 
    765772            } 
    766         } 
    767         return h; 
    768     } 
    769  
    770     int equals(void *p1, void *p2) 
    771     {   int c; 
    772  
     773            return h; 
     774        } 
     775    } 
     776 
     777    override equals_t equals(in void* p1, in void* p2) 
     778    { 
    773779        if (p1 == p2) 
    774             c = 1
     780            return true
    775781        else if (!p1 || !p2) 
    776             c = 0
     782            return false
    777783        else if (xopEquals) 
    778             c = (*xopEquals)(p1, p2); 
     784            return (*xopEquals)(p1, p2); 
    779785        else 
    780786            // BUG: relies on the GC not moving objects 
    781             c = (memcmp(p1, p2, init.length) == 0); 
    782         return c; 
    783     } 
    784  
    785     int compare(void *p1, void *p2) 
    786     { 
    787         int c = 0; 
    788  
     787            return memcmp(p1, p2, init.length) == 0; 
     788    } 
     789 
     790    override int compare(in void* p1, in void* p2) 
     791    { 
    789792        // Regard null references as always being "less than" 
    790793        if (p1 != p2) 
    791794        { 
    792795            if (p1) 
    793             {   if (!p2) 
    794                     c = 1; 
     796            { 
     797                if (!p2) 
     798                    return true; 
    795799                else if (xopCmp) 
    796            c = (*xopCmp)(p2, p1); 
     800                    return (*xopCmp)(p2, p1); 
    797801                else 
    798802                    // BUG: relies on the GC not moving objects 
    799                     c = memcmp(p1, p2, init.length); 
     803                    return memcmp(p1, p2, init.length); 
    800804            } 
    801805            else 
    802                 c = -1; 
    803         } 
    804         return c
    805     } 
    806  
    807     size_t tsize() 
     806                return -1; 
     807        } 
     808        return 0
     809    } 
     810 
     811    override size_t tsize() 
    808812    { 
    809813        return init.length; 
    810814    } 
    811815 
    812     void[] init() { return m_init; } 
    813  
    814     uint flags() { return m_flags; } 
     816    override void[] init() { return m_init; } 
     817 
     818    override uint flags() { return m_flags; } 
    815819 
    816820    char[] name; 
    817821    void[] m_init;      // initializer; init.ptr == null if 0 initialize 
    818822 
    819     hash_t function(void*)    xtoHash; 
    820     int function(void*,void*) xopEquals; 
    821     int function(void*,void*) xopCmp; 
    822     char[] function(void*)    xtoString; 
     823    hash_t   function(in void*)           xtoHash; 
     824    equals_t function(in void*, in void*) xopEquals; 
     825    int      function(in void*, in void*) xopCmp; 
     826    char[]   function(in void*)           xtoString; 
    823827 
    824828    uint m_flags; 
     
    829833    TypeInfo[] elements; 
    830834 
    831     char[] toString() 
     835    override char[] toString() 
    832836    { 
    833837        char[] s; 
     
    843847    } 
    844848 
    845     int opEquals(Object o) 
     849    override equals_t opEquals(Object o) 
    846850    { 
    847851        if (this is o) 
    848             return 1
     852            return true
    849853 
    850854        auto t = cast(TypeInfo_Tuple)o; 
     
    854858            { 
    855859                if (elements[i] != t.elements[i]) 
    856                     return 0
     860                    return false
    857861            } 
    858             return 1
    859         } 
    860         return 0
    861     } 
    862  
    863     hash_t getHash(void *p) 
     862            return true
     863        } 
     864        return false
     865    } 
     866 
     867    override hash_t getHash(in void* p) 
    864868    { 
    865869        assert(0); 
    866870    } 
    867871 
    868     int equals(void *p1, void *p2) 
     872    override equals_t equals(in void* p1, in void* p2) 
    869873    { 
    870874        assert(0); 
    871875    } 
    872876 
    873     int compare(void *p1, void *p2) 
     877    override int compare(in void* p1, in void* p2) 
    874878    { 
    875879        assert(0); 
    876880    } 
    877881 
    878     size_t tsize() 
     882    override size_t tsize() 
    879883    { 
    880884        assert(0); 
    881885    } 
    882886 
    883     void swap(void *p1, void *p2) 
     887    override void swap(void* p1, void* p2) 
    884888    { 
    885889        assert(0); 
     
    906910    Exception   next; 
    907911 
    908     this( char[] msg, Exception next = null ) 
     912    this( char[] msg, Exception next=null ) 
    909913    { 
    910914        this.msg = msg; 
     
    921925    } 
    922926 
    923     char[] toString() 
     927    override char[] toString() 
    924928    { 
    925929        return msg; 
     
    10291033} 
    10301034 
     1035version (OSX) 
     1036{ 
     1037    extern (C) 
     1038    { 
     1039    extern void* _minfo_beg; 
     1040    extern void* _minfo_end; 
     1041    } 
     1042} 
     1043 
    10311044ModuleInfo[] _moduleinfo_dtors; 
    10321045uint         _moduleinfo_dtors_i; 
     
    10561069        } 
    10571070    } 
    1058  
     1071     
     1072    version (OSX){ 
     1073    /* The ModuleInfo references are stored in the special segment 
     1074     * __minfodata, which is bracketed by the segments __minfo_beg 
     1075     * and __minfo_end. The variables _minfo_beg and _minfo_end 
     1076     * are of zero size and are in the two bracketing segments, 
     1077     * respectively. 
     1078     */ 
     1079        size_t length = cast(ModuleInfo*)&_minfo_end - cast(ModuleInfo*)&_minfo_beg; 
     1080        _moduleinfo_array = (cast(ModuleInfo*)&_minfo_beg)[0 .. length]; 
     1081        debug printf("moduleinfo: ptr = %p, length = %d\n", _moduleinfo_array.ptr, _moduleinfo_array.length); 
     1082 
     1083        debug foreach (m; _moduleinfo_array) 
     1084        { 
     1085            //printf("\t%p\n", m); 
     1086            printf("\t%.*s\n", m.name); 
     1087        } 
     1088    } 
     1089     
    10591090    version (Win32) 
    10601091    { 
     
    10641095 
    10651096    _moduleinfo_dtors = new ModuleInfo[_moduleinfo_array.length]; 
    1066     debug(PRINTF) printf("_moduleinfo_dtors = x%x\n", cast(void *)_moduleinfo_dtors); 
     1097    debug(PRINTF) printf("_moduleinfo_dtors = x%x\n", cast(void*)_moduleinfo_dtors); 
    10671098    _moduleIndependentCtors(); 
    10681099    _moduleCtor2(null,_moduleinfo_array, 0); 
  • trunk/lib/compiler/dmd/posix.mak

    r4357 r4384  
    3232CFLAGS_RELEASE=-O $(ADD_CFLAGS) 
    3333CFLAGS_DEBUG=-g $(ADD_CFLAGS) 
    34 DFLAGS_RELEASE=-release -O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) -I../../.. -I$(SRC_DIR)/rt 
    35 DFLAGS_DEBUG=-g -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) -I../../.. -I$(SRC_DIR)/rt 
     34DFLAGS_RELEASE=-release -O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) -I../../.. -I$(SRC_DIR) 
     35DFLAGS_DEBUG=-g -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) -I../../.. -I$(SRC_DIR) 
    3636TFLAGS_RELEASE=-O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
    3737TFLAGS_DEBUG=-g -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
  • trunk/lib/compiler/dmd/rt/aApply.d

    r4357 r4384  
    3030 */ 
    3131 
     32module rt.aApply; 
     33 
    3234/* This code handles decoding UTF strings for foreach loops. 
    3335 * There are 6 combinations of conversions between char, wchar, 
     
    3537 */ 
    3638 
    37 private import util.utf; 
     39private import rt.util.utf; 
    3840 
    3941/********************************************** 
     
    102104            else 
    103105            { 
    104        w = cast(wchar)((((d - 0x10000) >> 10) & 0x3FF) + 0xD800); 
     106                w = cast(wchar)((((d - 0x10000) >> 10) & 0x3FF) + 0xD800); 
    105107                result = dg(cast(void *)&w); 
    106108                if (result) 
    107109                    break; 
    108        w = cast(wchar)(((d - 0x10000) & 0x3FF) + 0xDC00); 
     110                w = cast(wchar)(((d - 0x10000) & 0x3FF) + 0xDC00); 
    109111            } 
    110112        } 
     
    199201        else 
    200202        { 
    201        w = cast(wchar)((((d - 0x10000) >> 10) & 0x3FF) + 0xD800); 
     203            w = cast(wchar)((((d - 0x10000) >> 10) & 0x3FF) + 0xD800); 
    202204            result = dg(cast(void *)&w); 
    203205            if (result) 
    204206                break; 
    205        w = cast(wchar)(((d - 0x10000) & 0x3FF) + 0xDC00); 
     207            w = cast(wchar)(((d - 0x10000) & 0x3FF) + 0xDC00); 
    206208        } 
    207209        result = dg(cast(void *)&w); 
     
    290292            else 
    291293            { 
    292        w = cast(wchar) ((((d - 0x10000) >> 10) & 0x3FF) + 0xD800); 
     294                w = cast(wchar) ((((d - 0x10000) >> 10) & 0x3FF) + 0xD800); 
    293295                result = dg(&i, cast(void *)&w); 
    294296                if (result) 
    295297                    break; 
    296        w = cast(wchar) (((d - 0x10000) & 0x3FF) + 0xDC00); 
     298                w = cast(wchar) (((d - 0x10000) & 0x3FF) + 0xDC00); 
    297299            } 
    298300        } 
     
    393395        else 
    394396        { 
    395        w = cast(wchar) ((((d - 0x10000) >> 10) & 0x3FF) + 0xD800); 
     397            w = cast(wchar) ((((d - 0x10000) >> 10) & 0x3FF) + 0xD800); 
    396398            result = dg(&j, cast(void *)&w); 
    397399            if (result) 
    398400                break; 
    399        w = cast(wchar) (((d - 0x10000) & 0x3FF) + 0xDC00); 
     401            w = cast(wchar) (((d - 0x10000) & 0x3FF) + 0xDC00); 
    400402        } 
    401403        result = dg(&j, cast(void *)&w); 
  • trunk/lib/compiler/dmd/rt/aApplyR.d

    r4357 r4384  
    1  
    21/** 
    32 * Part of the D programming language runtime library. 
     
    3130 */ 
    3231 
     32module rt.aApplyR; 
     33 
    3334/* This code handles decoding UTF strings for foreach_reverse loops. 
    3435 * There are 6 combinations of conversions between char, wchar, 
     
    3637 */ 
    3738 
    38 private import util.utf; 
     39private import rt.util.utf; 
    3940 
    4041/**********************************************/ 
     
    8081    debug(apply) printf("_aApplyRcd1.unittest\n"); 
    8182 
    82     auto s = "hello"c
     83    auto s = "hello"c[]
    8384    int i; 
    8485 
     
    144145    debug(apply) printf("_aApplyRwd1.unittest\n"); 
    145146 
    146     auto s = "hello"w
     147    auto s = "hello"w[]
    147148    int i; 
    148149 
     
    230231    debug(apply) printf("_aApplyRcw1.unittest\n"); 
    231232 
    232     auto s = "hello"c
     233    auto s = "hello"c[]
    233234    int i; 
    234235 
     
    311312    debug(apply) printf("_aApplyRwc1.unittest\n"); 
    312313 
    313     auto s = "hello"w
     314    auto s = "hello"w[]
    314315    int i; 
    315316 
     
    390391    debug(apply) printf("_aApplyRdc1.unittest\n"); 
    391392 
    392     auto s = "hello"d
     393    auto s = "hello"d[]
    393394    int i; 
    394395 
     
    462463    debug(apply) printf("_aApplyRdw1.unittest\n"); 
    463464 
    464     auto s = "hello"d
     465    auto s = "hello"d[]
    465466    int i; 
    466467 
     
    544545    debug(apply) printf("_aApplyRcd2.unittest\n"); 
    545546 
    546     auto s = "hello"c
     547    auto s = "hello"c[]
    547548    int i; 
    548549 
     
    609610    debug(apply) printf("_aApplyRwd2.unittest\n"); 
    610611 
    611     auto s = "hello"w
     612    auto s = "hello"w[]
    612613    int i; 
    613614 
     
    697698    debug(apply) printf("_aApplyRcw2.unittest\n"); 
    698699 
    699     auto s = "hello"c
     700    auto s = "hello"c[]
    700701    int i; 
    701702 
     
    780781    debug(apply) printf("_aApplyRwc2.unittest\n"); 
    781782 
    782     auto s = "hello"w
     783    auto s = "hello"w[]
    783784    int i; 
    784785 
     
    860861    debug(apply) printf("_aApplyRdc2.unittest\n"); 
    861862 
    862     auto s = "hello"d
     863    auto s = "hello"d[]
    863864    int i; 
    864865 
     
    934935    debug(apply) printf("_aApplyRdw2.unittest\n"); 
    935936 
    936     auto s = "hello"d
     937    auto s = "hello"d[]
    937938    int i; 
    938939 
     
    972973    assert(i == 5); 
    973974} 
    974  
    975  
  • trunk/lib/compiler/dmd/rt/aaA.d

    r4357 r4384  
    3131 *  Modified by Sean Kelly <sean@f4.ca> for use with Tango. 
    3232 */ 
     33 
     34module rt.aaA; 
    3335 
    3436private 
     
    585587                    _aaRehash_x(e); 
    586588            } 
     589            delete aa.b; 
    587590 
    588591            newb.nodes = aa.nodes; 
     
    591594 
    592595        *paa.a = newb; 
     596        _aaBalance(paa); 
    593597    } 
    594598    return (*paa).a; 
    595599} 
    596600 
    597  
     601/******************************************** 
     602 * Balance an array. 
     603 */ 
     604 
     605void _aaBalance(AA* paa) 
     606
     607    //printf("_aaBalance()\n"); 
     608    if (paa.a) 
     609    { 
     610        aaA*[16] tmp; 
     611        aaA*[] array = tmp; 
     612        auto aa = paa.a; 
     613        foreach (j, e; aa.b) 
     614        { 
     615            /* Temporarily store contents of bucket in array[] 
     616             */ 
     617            size_t k = 0; 
     618            void addToArray(aaA* e) 
     619            { 
     620                while (e) 
     621                {   addToArray(e.left); 
     622                    if (k == array.length) 
     623                        array.length = array.length * 2; 
     624                    array[k++] = e; 
     625                    e = e.right; 
     626                } 
     627            } 
     628            addToArray(e); 
     629            /* The contents of the bucket are now sorted into array[]. 
     630             * Rebuild the tree. 
     631             */ 
     632            void buildTree(aaA** p, size_t x1, size_t x2) 
     633            { 
     634                if (x1 >= x2) 
     635                    *p = null; 
     636                else 
     637                {   auto mid = (x1 + x2) >> 1; 
     638                    *p = array[mid]; 
     639                    buildTree(&(*p).left, x1, mid); 
     640                    buildTree(&(*p).right, mid + 1, x2); 
     641                } 
     642            } 
     643            auto p = &aa.b[j]; 
     644            buildTree(p, 0, k); 
     645        } 
     646    } 
     647
    598648/******************************************** 
    599649 * Produce array of N byte keys from aa. 
  • trunk/lib/compiler/dmd/rt/adi.d

    r4357 r4384  
    3333 */ 
    3434 
     35module rt.adi; 
    3536 
    3637//debug=adi;            // uncomment to turn on debugging printf's 
     
    4041    import tango.stdc.string; 
    4142    import tango.stdc.stdlib; 
    42     import util.utf; 
     43    import rt.util.utf; 
    4344 
    4445    enum BlkAttr : uint 
     
    146147unittest 
    147148{ 
    148     auto a = "abcd"c
     149    auto a = "abcd"c[]
    149150 
    150151    auto r = a.dup.reverse; 
     
    245246unittest 
    246247{ 
    247     wstring a = "abcd"; 
    248     wstring r; 
     248    wchar[] a = "abcd"; 
     249    wchar[] r; 
    249250 
    250251    r = a.dup.reverse; 
  • trunk/lib/compiler/dmd/rt/alloca.d

    r4357 r4384  
    44 * Written by Walter Bright 
    55 */ 
     6 
     7module rt.alloca; 
    68 
    79/+ 
     
    1820 * work right, do not change its name, do not call it from other compilers. 
    1921 * Input: 
    20  * nbytes  number of bytes to allocate 
    21  * ECX address of variable with # of bytes in locals 
    22  *     This is adjusted upon return to reflect the additional 
    23  *     size of the stack frame. 
     22 *      nbytes  number of bytes to allocate 
     23 *      ECX     address of variable with # of bytes in locals 
     24 *              This is adjusted upon return to reflect the additional 
     25 *              size of the stack frame. 
    2426 * Returns: 
    25  * EAX allocated data, null if stack overflows 
     27 *      EAX     allocated data, null if stack overflows 
    2628 */ 
    2729 
     
    3032    asm 
    3133    { 
    32    naked           
    33    mov EDX,ECX     
    34    mov EAX,4[ESP]  ; // get nbytes 
    35    push    EBX     
    36    push    EDI     
    37    push    ESI     
    38    add EAX,3       
    39    and EAX,0xFFFFFFFC  ; // round up to dword 
    40    jnz Abegin     
    41    mov EAX,4       ; // allow zero bytes allocation, 0 rounded to dword is 4.. 
     34        naked                   
     35        mov     EDX,ECX         
     36        mov     EAX,4[ESP]      ; // get nbytes 
     37        push    EBX             
     38        push    EDI             
     39        push    ESI             
     40        add     EAX,3           
     41        and     EAX,0xFFFFFFFC  ; // round up to dword 
     42        jnz     Abegin         
     43        mov     EAX,4           ; // allow zero bytes allocation, 0 rounded to dword is 4.. 
    4244    Abegin: 
    43    mov ESI,EAX     ; // ESI = nbytes 
    44    neg EAX     
    45    add EAX,ESP     ; // EAX is now what the new ESP will be. 
    46    jae Aoverflow   
     45        mov     ESI,EAX         ; // ESI = nbytes 
     46        neg     EAX             
     47        add     EAX,ESP         ; // EAX is now what the new ESP will be. 
     48        jae     Aoverflow       
    4749    } 
    4850    version (Win32) 
     
    5052    asm 
    5153    { 
    52    // We need to be careful about the guard page 
    53    // Thus, for every 4k page, touch it to cause the OS to load it in. 
    54    mov ECX,EAX     ; // ECX is new location for stack 
    55    mov EBX,ESI     ; // EBX is size to "grow" stack 
     54        // We need to be careful about the guard page 
     55        // Thus, for every 4k page, touch it to cause the OS to load it in. 
     56        mov     ECX,EAX         ; // ECX is new location for stack 
     57        mov     EBX,ESI         ; // EBX is size to "grow" stack 
    5658    L1: 
    57    test    [ECX+EBX],EBX   ; // bring in page 
    58    sub EBX,0x1000  ; // next 4K page down 
    59    jae L1      ; // if more pages 
    60    test    [ECX],EBX   ; // bring in last page 
     59        test    [ECX+EBX],EBX   ; // bring in page 
     60        sub     EBX,0x1000      ; // next 4K page down 
     61        jae     L1              ; // if more pages 
     62        test    [ECX],EBX       ; // bring in last page 
    6163    } 
    6264    } 
     
    6567    asm 
    6668    { 
    67    // is ESP off bottom? 
    68    cmp EAX,_x386_break
    69    jbe Aoverflow   
     69        // is ESP off bottom? 
     70        cmp     EAX,_x386_break
     71        jbe     Aoverflow       
    7072    } 
    7173    } 
     
    7476    asm 
    7577    { 
    76    cmp EAX,_pastdata   
    77    jbe Aoverflow   ; // Unlikely - ~2 Gbytes under UNIX 
     78        cmp     EAX,_pastdata   
     79        jbe     Aoverflow       ; // Unlikely - ~2 Gbytes under UNIX 
    7880    } 
    7981    } 
    8082    asm 
    8183    { 
    82    // Copy down to [ESP] the temps on the stack. 
    83    // The number of temps is (EBP - ESP - locals). 
    84    mov ECX,EBP     
    85    sub ECX,ESP     
    86    sub ECX,[EDX]   ; // ECX = number of temps (bytes) to move. 
    87    add [EDX],ESI   ; // adjust locals by nbytes for next call to alloca() 
    88    mov ESP,EAX     ; // Set up new stack pointer. 
    89    add EAX,ECX     ; // Return value = ESP + temps. 
    90    mov EDI,ESP     ; // Destination of copy of temps. 
    91    add ESI,ESP     ; // Source of copy. 
    92    shr ECX,2       ; // ECX to count of dwords in temps 
    93                  // Always at least 4 (nbytes, EIP, ESI,and EDI). 
    94    rep         
    95    movsd           
    96    jmp done       
     84        // Copy down to [ESP] the temps on the stack. 
     85        // The number of temps is (EBP - ESP - locals). 
     86        mov     ECX,EBP         
     87        sub     ECX,ESP         
     88        sub     ECX,[EDX]       ; // ECX = number of temps (bytes) to move. 
     89        add     [EDX],ESI       ; // adjust locals by nbytes for next call to alloca() 
     90        mov     ESP,EAX         ; // Set up new stack pointer. 
     91        add     EAX,ECX         ; // Return value = ESP + temps. 
     92        mov     EDI,ESP         ; // Destination of copy of temps. 
     93        add     ESI,ESP         ; // Source of copy. 
     94        shr     ECX,2           ; // ECX to count of dwords in temps 
     95                                  // Always at least 4 (nbytes, EIP, ESI,and EDI). 
     96        rep                     
     97        movsd                   
     98        jmp     done           
    9799 
    98100    Aoverflow: 
    99    // Overflowed the stack.  Return null 
    100    xor EAX,EAX     
     101        // Overflowed the stack.  Return null 
     102        xor     EAX,EAX         
    101103 
    102104    done: 
    103    pop ESI     
    104    pop EDI     
    105    pop EBX     
    106    ret         
     105        pop     ESI             
     106        pop     EDI             
     107        pop     EBX             
     108        ret                     
    107109    } 
    108110} 
    109  
    110  
    111  
    112  
    113  
    114  
    115  
    116  
    117  
    118  
    119  
    120  
    121  
    122  
    123  
    124  
    125  
    126  
    127  
    128  
    129  
    130  
  • trunk/lib/compiler/dmd/rt/arraybyte.d

    r4357 r4384  
    1010 */ 
    1111 
    12 import util.cpuid; 
     12module rt.arraybyte; 
     13 
     14import rt.util.cpuid; 
    1315 
    1416debug(UnitTest) 
    1517{ 
     18    private extern(C) int printf(char*,...); 
    1619    /* This is so unit tests will test every CPU variant 
    1720     */ 
    1821    int cpuid; 
    1922    const int CPUID_MAX = 4; 
    20     bool mmx()      { return cpuid == 1 && util.cpuid.mmx(); } 
    21     bool sse()      { return cpuid == 2 && util.cpuid.sse(); } 
    22     bool sse2()     { return cpuid == 3 && util.cpuid.sse2(); } 
    23     bool amd3dnow() { return cpuid == 4 && util.cpuid.amd3dnow(); } 
     23    bool mmx()      { return cpuid == 1 && rt.util.cpuid.mmx(); } 
     24    bool sse()      { return cpuid == 2 && rt.util.cpuid.sse(); } 
     25    bool sse2()     { return cpuid == 3 && rt.util.cpuid.sse2(); } 
     26    bool amd3dnow() { return cpuid == 4 && rt.util.cpuid.amd3dnow(); } 
    2427} 
    2528else 
    2629{ 
    27     alias util.cpuid.mmx mmx; 
    28     alias util.cpuid.sse sse; 
    29     alias util.cpuid.sse2 sse2; 
    30     alias util.cpuid.amd3dnow amd3dnow; 
     30    alias rt.util.cpuid.mmx mmx; 
     31    alias rt.util.cpuid.sse sse; 
     32    alias rt.util.cpuid.sse2 sse2; 
     33    alias rt.util.cpuid.amd3dnow amd3dnow; 
    3134} 
    3235 
  • trunk/lib/compiler/dmd/rt/arraycast.d

    r4357 r4384  
    2525 *  Modified by Sean Kelly <sean@f4.ca> for use with Tango. 
    2626 */ 
     27 
     28module rt.arraycast; 
    2729 
    2830/****************************************** 
  • trunk/lib/compiler/dmd/rt/arraycat.d

    r4357 r4384  
    3030 */ 
    3131 
     32module rt.arraycat; 
     33 
    3234private 
    3335{ 
  • trunk/lib/compiler/dmd/rt/arraydouble.d

    r4357 r4384  
    66 */ 
    77 
    8 import util.cpuid; 
     8module rt.arraydouble; 
     9 
     10import rt.util.cpuid; 
    911 
    1012debug(UnitTest) 
    1113{ 
     14    private extern(C) int printf(char*,...); 
    1215    /* This is so unit tests will test every CPU variant 
    1316     */ 
    1417    int cpuid; 
    1518    const int CPUID_MAX = 5; 
    16     bool mmx()      { return cpuid == 1 && util.cpuid.mmx(); } 
    17     bool sse()      { return cpuid == 2 && util.cpuid.sse(); } 
    18     bool sse2()     { return cpuid == 3 && util.cpuid.sse2(); } 
    19     bool amd3dnow() { return cpuid == 4 && util.cpuid.amd3dnow(); } 
     19    bool mmx()      { return cpuid == 1 && rt.util.cpuid.mmx(); } 
     20    bool sse()      { return cpuid == 2 && rt.util.cpuid.sse(); } 
     21    bool sse2()     { return cpuid == 3 && rt.util.cpuid.sse2(); } 
     22    bool amd3dnow() { return cpuid == 4 && rt.util.cpuid.amd3dnow(); } 
    2023} 
    2124else 
    2225{ 
    23     import util.cpuid; 
    24     alias util.cpuid.mmx mmx; 
    25     alias util.cpuid.sse sse; 
    26     alias util.cpuid.sse2 sse2; 
    27     alias util.cpuid.amd3dnow amd3dnow; 
     26    import rt.util.cpuid; 
     27    alias rt.util.cpuid.mmx mmx; 
     28    alias rt.util.cpuid.sse sse; 
     29    alias rt.util.cpuid.sse2 sse2; 
     30    alias rt.util.cpuid.amd3dnow amd3dnow; 
    2831} 
    2932 
  • trunk/lib/compiler/dmd/rt/arrayfloat.d

    r4357 r4384  
    66 */ 
    77 
    8 import util.cpuid; 
     8module rt.arrayfloat; 
     9 
     10import rt.util.cpuid; 
    911 
    1012debug(UnitTest) 
    1113{ 
     14    private extern(C) int printf(char*,...); 
    1215    /* This is so unit tests will test every CPU variant 
    1316     */ 
    1417    int cpuid; 
    1518    const int CPUID_MAX = 5; 
    16     bool mmx()      { return cpuid == 1 && util.cpuid.mmx(); } 
    17     bool sse()      { return cpuid == 2 && util.cpuid.sse(); } 
    18     bool sse2()     { return cpuid == 3 && util.cpuid.sse2(); } 
    19     bool amd3dnow() { return cpuid == 4 && util.cpuid.amd3dnow(); } 
     19    bool mmx()      { return cpuid == 1 && rt.util.cpuid.mmx(); } 
     20    bool sse()      { return cpuid == 2 && rt.util.cpuid.sse(); } 
     21    bool sse2()     { return cpuid == 3 && rt.util.cpuid.sse2(); } 
     22    bool amd3dnow() { return cpuid == 4 && rt.util.cpuid.amd3dnow(); } 
    2023} 
    2124else 
    2225{ 
    23     import util.cpuid; 
    24     alias util.cpuid.mmx mmx; 
    25     alias util.cpuid.sse sse; 
    26     alias util.cpuid.sse2 sse2; 
    27     alias util.cpuid.amd3dnow amd3dnow; 
     26    alias rt.util.cpuid.mmx mmx; 
     27    alias rt.util.cpuid.sse sse; 
     28    alias rt.util.cpuid.sse2 sse2; 
     29    alias rt.util.cpuid.amd3dnow amd3dnow; 
    2830} 
    2931 
  • trunk/lib/compiler/dmd/rt/arrayint.d

    r4357 r4384  
    1010 */ 
    1111 
    12 import util.cpuid; 
     12module rt.arrayint; 
     13 
     14private import rt.util.cpuid; 
    1315 
    1416debug(UnitTest) 
    1517{ 
     18    private extern(C) int printf(char*,...); 
    1619    /* This is so unit tests will test every CPU variant 
    1720     */ 
    1821    int cpuid; 
    1922    const int CPUID_MAX = 4; 
    20     bool mmx()      { return cpuid == 1 && util.cpuid.mmx(); } 
    21     bool sse()      { return cpuid == 2 && util.cpuid.sse(); } 
    22     bool sse2()     { return cpuid == 3 && util.cpuid.sse2(); } 
    23     bool amd3dnow() { return cpuid == 4 && util.cpuid.amd3dnow(); } 
     23    bool mmx()      { return cpuid == 1 && rt.util.cpuid.mmx(); } 
     24    bool sse()      { return cpuid == 2 && rt.util.cpuid.sse(); } 
     25    bool sse2()     { return cpuid == 3 && rt.util.cpuid.sse2(); } 
     26    bool amd3dnow() { return cpuid == 4 && rt.util.cpuid.amd3dnow(); } 
    2427} 
    2528else 
    2629{ 
    27     alias util.cpuid.mmx mmx; 
    28     alias util.cpuid.sse sse; 
    29     alias util.cpuid.sse2 sse2; 
    30     alias util.cpuid.amd3dnow amd3dnow; 
     30    alias rt.util.cpuid.mmx mmx; 
     31    alias rt.util.cpuid.sse sse; 
     32    alias rt.util.cpuid.sse2 sse2; 
     33    alias rt.util.cpuid.amd3dnow amd3dnow; 
    3134} 
    3235 
  • trunk/lib/compiler/dmd/rt/arrayreal.d

    r4357 r4384  
    55 */ 
    66 
    7 import util.cpuid; 
     7module rt.arrayreal; 
     8 
     9import rt.util.cpuid; 
    810 
    911debug(UnitTest) 
    1012{ 
     13    private extern(C) int printf(char*,...); 
    1114    /* This is so unit tests will test every CPU variant 
    1215     */ 
    1316    int cpuid; 
    1417    const int CPUID_MAX = 1; 
    15     bool mmx()      { return cpuid == 1 && util.cpuid.mmx(); } 
    16     bool sse()      { return cpuid == 2 && util.cpuid.sse(); } 
    17     bool sse2()     { return cpuid == 3 && util.cpuid.sse2(); } 
    18     bool amd3dnow() { return cpuid == 4 && util.cpuid.amd3dnow(); } 
     18    bool mmx()      { return cpuid == 1 && rt.util.cpuid.mmx(); } 
     19    bool sse()      { return cpuid == 2 && rt.util.cpuid.sse(); } 
     20    bool sse2()     { return cpuid == 3 && rt.util.cpuid.sse2(); } 
     21    bool amd3dnow() { return cpuid == 4 && rt.util.cpuid.amd3dnow(); } 
    1922} 
    2023else 
    2124{ 
    22     import util.cpuid; 
    23     alias util.cpuid.mmx mmx; 
    24     alias util.cpuid.sse sse; 
    25     alias util.cpuid.sse2 sse2; 
    26     alias util.cpuid.amd3dnow amd3dnow; 
     25    alias rt.util.cpuid.mmx mmx; 
     26    alias rt.util.cpuid.sse sse; 
     27    alias rt.util.cpuid.sse2 sse2; 
     28    alias rt.util.cpuid.amd3dnow amd3dnow; 
    2729} 
    2830 
  • trunk/lib/compiler/dmd/rt/arrayshort.d

    r4357 r4384  
    1010 */ 
    1111 
    12 import util.cpuid; 
     12module rt.arrayshort; 
     13 
     14private import rt.util.cpuid; 
    1315 
    1416debug(UnitTest) 
    1517{ 
     18    private extern(C) int printf(char*,...); 
    1619    /* This is so unit tests will test every CPU variant 
    1720     */ 
    1821    int cpuid; 
    1922    const int CPUID_MAX = 4; 
    20     bool mmx()      { return cpuid == 1 && util.cpuid.mmx(); } 
    21     bool sse()      { return cpuid == 2 && util.cpuid.sse(); } 
    22     bool sse2()     { return cpuid == 3 && util.cpuid.sse2(); } 
    23     bool amd3dnow() { return cpuid == 4 && util.cpuid.amd3dnow(); } 
     23    bool mmx()      { return cpuid == 1 && rt.util.cpuid.mmx(); } 
     24    bool sse()      { return cpuid == 2 && rt.util.cpuid.sse(); } 
     25    bool sse2()     { return cpuid == 3 && rt.util.cpuid.sse2(); } 
     26    bool amd3dnow() { return cpuid == 4 && rt.util.cpuid.amd3dnow(); } 
    2427} 
    2528else 
    2629{ 
    27     alias util.cpuid.mmx mmx; 
    28     alias util.cpuid.sse sse; 
    29     alias util.cpuid.sse2 sse2; 
    30     alias util.cpuid.sse2 sse2; 
     30    alias rt.util.cpuid.mmx mmx; 
     31    alias rt.util.cpuid.sse sse; 
     32    alias rt.util.cpuid.sse2 sse2; 
     33    alias rt.util.cpuid.sse2 sse2; 
    3134} 
    3235 
  • trunk/lib/compiler/dmd/rt/cast_.d

    r4357 r4384  
    2525 *  Modified by Sean Kelly <sean@f4.ca> for use with Tango. 
    2626 */ 
     27 
     28module rt.cast_; 
    2729 
    2830extern (C): 
  • trunk/lib/compiler/dmd/rt/cmath2.d

    r4357 r4384  
    1010 *  Modified by Sean Kelly <sean@f4.ca> for use with Tango. 
    1111 */ 
     12 
     13module rt.cmath2; 
    1214 
    1315private import tango.stdc.math; 
  • trunk/lib/compiler/dmd/rt/compiler.d

    r4357 r4384  
    55 */ 
    66 
     7module rt.compiler; 
     8 
    79// Identify the compiler used and its various features. 
    8  
    9 module compiler; 
    1010 
    1111const 
  • trunk/lib/compiler/dmd/rt/complex.c

    r4357 r4384  
    2222    if (fabs(y.re) < fabs(y.im)) 
    2323    { 
    24    r = y.re / y.im; 
    25    den = y.im + r * y.re; 
    26    q.re = (x.re * r + x.im) / den; 
    27    q.im = (x.im * r - x.re) / den; 
     24        r = y.re / y.im; 
     25        den = y.im + r * y.re; 
     26        q.re = (x.re * r + x.im) / den; 
     27        q.im = (x.im * r - x.re) / den; 
    2828    } 
    2929    else 
    3030    { 
    31    r = y.im / y.re; 
    32    den = y.re + r * y.im; 
    33    q.re = (x.re + r * x.im) / den; 
    34    q.im = (x.im - r * x.re) / den; 
     31        r = y.im / y.re; 
     32        den = y.re + r * y.im; 
     33        q.re = (x.re + r * x.im) / den; 
     34        q.im = (x.im - r * x.re) / den; 
    3535    } 
    3636    return q; 
     
    5353    y = fabs(z.im); 
    5454    if (x == 0) 
    55    ans = y; 
     55        ans = y; 
    5656    else if (y == 0) 
    57    ans = x; 
     57        ans = x; 
    5858    else if (x > y) 
    5959    { 
    60    temp = y / x; 
    61    ans = x * sqrt(1 + temp * temp); 
     60        temp = y / x; 
     61        ans = x * sqrt(1 + temp * temp); 
    6262    } 
    6363    else 
    6464    { 
    65    temp = x / y; 
    66    ans = y * sqrt(1 + temp * temp); 
     65        temp = x / y; 
     66        ans = y * sqrt(1 + temp * temp); 
    6767    } 
    6868    return ans; 
     
    7676    if (z.re == 0 && z.im == 0) 
    7777    { 
    78    c.re = 0; 
    79    c.im = 0; 
     78        c.re = 0; 
     79        c.im = 0; 
    8080    } 
    8181    else 
    8282    { 
    83    x = fabs(z.re); 
    84    y = fabs(z.im); 
    85    if (x >= y) 
    86    
    87        r = y / x; 
    88        w = sqrt(x) * sqrt(0.5 * (1 + sqrt(1 + r * r))); 
    89    
    90    else 
    91    
    92        r = x / y; 
    93        w = sqrt(y) * sqrt(0.5 * (r + sqrt(1 + r * r))); 
    94    
    95    if (z.re >= 0) 
    96    
    97        c.re = w; 
    98        c.im = z.im / (w + w); 
    99    
    100    else 
    101    
    102        c.im = (z.im >= 0) ? w : -w; 
    103        c.re = z.im / (c.im + c.im); 
    104    
     83        x = fabs(z.re); 
     84        y = fabs(z.im); 
     85        if (x >= y) 
     86       
     87            r = y / x; 
     88            w = sqrt(x) * sqrt(0.5 * (1 + sqrt(1 + r * r))); 
     89       
     90        else 
     91       
     92            r = x / y; 
     93            w = sqrt(y) * sqrt(0.5 * (r + sqrt(1 + r * r))); 
     94       
     95        if (z.re >= 0) 
     96       
     97            c.re = w; 
     98            c.im = z.im / (w + w); 
     99       
     100        else 
     101       
     102            c.im = (z.im >= 0) ? w : -w; 
     103            c.re = z.im / (c.im + c.im); 
     104       
    105105    } 
    106106    return c; 
    107107} 
    108  
  • trunk/lib/compiler/dmd/rt/cover.d

    r4357 r4384  
    1212 * Authors:   Walter Bright, Sean Kelly 
    1313 */ 
     14 
     15module rt.cover; 
     16 
    1417private 
    1518{ 
    1619    version( Win32 ) 
    1720        import tango.sys.win32.UserGdi; 
    18     else version( linux ) 
    19         import tango.sys.linux.linux; 
     21    else version( Posix ) 
     22    { 
     23        import tango.stdc.posix.fcntl; 
     24        import tango.stdc.posix.unistd; 
     25    } 
    2026    import tango.core.BitManip; 
    2127    import tango.stdc.stdio; 
    22     import util.utf; 
     28    import rt.util.utf; 
    2329 
    2430    struct BitArray 
     
    126132        if( merge ) 
    127133        { 
    128             if( !readFile( c.filename ~ ".lst", lstbuf ) ) 
     134            if( !readFile( addExt( baseName( c.filename ), "lst" ), lstbuf ) ) 
    129135                break; 
    130136            splitLines( lstbuf, lstlines ); 
     
    155161        } 
    156162 
    157         FILE* flst = fopen( (c.filename ~ ".lst").ptr, "wb" ); 
     163        FILE* flst = fopen( (addExt( baseName( c.filename ), "lst\0" )).ptr, "wb" ); 
    158164 
    159165        if( !flst ) 
     
    207213        const char sep = '/'; 
    208214 
    209     char[] dest = path; 
     215    auto dest = path; 
    210216 
    211217    if( dest && dest[$ - 1] != sep ) 
     
    213219    dest ~= name; 
    214220    return dest; 
     221} 
     222 
     223 
     224char[] baseName( char[] name, char[] ext = null ) 
     225{ 
     226    auto i = name.length; 
     227    for( ; i > 0; --i ) 
     228    { 
     229        version( Windows ) 
     230        { 
     231            if( name[i - 1] == ':' || name[i - 1] == '\\' ) 
     232                break; 
     233        } 
     234        else version( Posix ) 
     235        { 
     236            if( name[i - 1] == '/' ) 
     237                break; 
     238        } 
     239    } 
     240    return chomp( name[i .. $], ext ? ext : "" ); 
     241} 
     242 
     243 
     244char[] getExt( char[] name ) 
     245{ 
     246    auto i = name.length; 
     247 
     248    while( i > 0 ) 
     249    { 
     250        if( name[i - 1] == '.' ) 
     251            return name[i .. $]; 
     252        --i; 
     253        version( Windows ) 
     254        { 
     255            if( name[i] == ':' || name[i] == '\\' ) 
     256                break; 
     257        } 
     258        else version( Posix ) 
     259        { 
     260            if( name[i] == '/' ) 
     261                break; 
     262        } 
     263    } 
     264    return null; 
     265} 
     266 
     267 
     268char[] addExt( char[] name, char[] ext ) 
     269{ 
     270    auto  existing = getExt( name ); 
     271 
     272    if( existing.length == 0 ) 
     273    { 
     274        if( name.length && name[$ - 1] == '.' ) 
     275            name ~= ext; 
     276        else 
     277            name = name ~ "." ~ ext; 
     278    } 
     279    else 
     280    { 
     281        name = name[0 .. $ - existing.length] ~ ext; 
     282    } 
     283    return name; 
     284} 
     285 
     286 
     287char[] chomp( char[] str, char[] delim = null ) 
     288{ 
     289    if( delim is null ) 
     290    { 
     291        auto len = str.length; 
     292 
     293        if( len ) 
     294        { 
     295            auto c = str[len - 1]; 
     296 
     297            if( c == '\r' ) 
     298                --len; 
     299            else if( c == '\n' && str[--len - 1] == '\r' ) 
     300                --len; 
     301        } 
     302        return str[0 .. len]; 
     303    } 
     304    else if( str.length >= delim.length ) 
     305    { 
     306        if( str[$ - delim.length .. $] == delim ) 
     307            return str[0 .. $ - delim.length]; 
     308    } 
     309    return str; 
    215310} 
    216311 
     
    250345        return true; 
    251346    } 
    252     else version( linux ) 
     347    else version( Posix ) 
    253348    { 
    254349        char[]  namez = new char[name.length + 1]; 
     
    311406 
    312407 
    313 char[] expandTabs( char[] string, int tabsize = 8 ) 
     408char[] expandTabs( char[] str, int tabsize = 8 ) 
    314409{ 
    315410    const dchar LS = '\u2028'; // UTF line separator 
     
    317412 
    318413    bool changes = false; 
    319     char[] result = string
     414    char[] result = str
    320415    int column; 
    321416    int nspaces; 
    322417 
    323     foreach( size_t i, dchar c; string
     418    foreach( size_t i, dchar c; str
    324419    { 
    325420        switch( c ) 
     
    331426                    changes = true; 
    332427                    result = null; 
    333                     result.length = string.length + nspaces - 1; 
     428                    result.length = str.length + nspaces - 1; 
    334429                    result.length = i + nspaces; 
    335                     result[0 .. i] = string[0 .. i]; 
     430                    result[0 .. i] = str[0 .. i]; 
    336431                    result[i .. i + nspaces] = ' '; 
    337432                } 
  • trunk/lib/compiler/dmd/rt/critical.c

    r4357 r4384  
    99#if _WIN32 
    1010 
    11 #include   <windows.h> 
     11#include        <windows.h> 
    1212 
    1313/****************************************** 
     
    3434    if (!dcs->next) 
    3535    { 
    36    EnterCriticalSection(&critical_section.cs); 
    37    if (!dcs->next) // if, in the meantime, another thread didn't set it 
    38    
    39        dcs->next = dcs_list; 
    40        dcs_list = dcs; 
    41        InitializeCriticalSection(&dcs->cs); 
    42    
    43    LeaveCriticalSection(&critical_section.cs); 
     36        EnterCriticalSection(&critical_section.cs); 
     37        if (!dcs->next) // if, in the meantime, another thread didn't set it 
     38       
     39            dcs->next = dcs_list; 
     40            dcs_list = dcs; 
     41            InitializeCriticalSection(&dcs->cs); 
     42       
     43        LeaveCriticalSection(&critical_section.cs); 
    4444    } 
    4545    EnterCriticalSection(&dcs->cs); 
     
    5454{ 
    5555    if (!inited) 
    56     {  InitializeCriticalSection(&critical_section.cs); 
    57    dcs_list = &critical_section; 
    58    inited = 1; 
     56    {   InitializeCriticalSection(&critical_section.cs); 
     57        dcs_list = &critical_section; 
     58        inited = 1; 
    5959    } 
    6060} 
     
    6363{ 
    6464    if (inited) 
    65     {  inited = 0; 
    66    while (dcs_list) 
    67    
    68        DeleteCriticalSection(&dcs_list->cs); 
    69        dcs_list = dcs_list->next; 
    70    
     65    {   inited = 0; 
     66        while (dcs_list) 
     67       
     68            DeleteCriticalSection(&dcs_list->cs); 
     69            dcs_list = dcs_list->next; 
     70       
    7171    } 
    7272} 
     
    7676/* ================================= linux ============================ */ 
    7777 
    78 #if linux 
     78#if linux || __APPLE__ 
    7979 
    80 #include    <stdio.h> 
    81 #include    <stdlib.h> 
    82 #include    <pthread.h> 
     80#include        <stdio.h> 
     81#include        <stdlib.h> 
     82#include        <pthread.h> 
     83 
     84// PTHREAD_MUTEX_RECURSIVE is what posix says should be supported, 
     85// but some versions of glibc have only PTHREAD_MUTEX_RECURSIVE_NP  
     86// (the np stands for non-portable), when they have the same meaning. 
     87#ifndef PTHREAD_MUTEX_RECURSIVE 
     88#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP 
     89#endif 
    8390 
    8491/****************************************** 
     
    107114{ 
    108115    if (!dcs_list) 
    109     {  _STI_critical_init(); 
    110    atexit(_STD_critical_term); 
     116    {   _STI_critical_init(); 
     117        atexit(_STD_critical_term); 
    111118    } 
    112119    //printf("_d_criticalenter(dcs = x%x)\n", dcs); 
    113120    if (!dcs->next) 
    114121    { 
    115    pthread_mutex_lock(&critical_section.cs); 
    116    if (!dcs->next) // if, in the meantime, another thread didn't set it 
    117    
    118        dcs->next = dcs_list; 
    119        dcs_list = dcs; 
    120        pthread_mutex_init(&dcs->cs, &_criticals_attr); 
    121    
    122    pthread_mutex_unlock(&critical_section.cs); 
     122        pthread_mutex_lock(&critical_section.cs); 
     123        if (!dcs->next) // if, in the meantime, another thread didn't set it 
     124       
     125            dcs->next = dcs_list; 
     126            dcs_list = dcs; 
     127            pthread_mutex_init(&dcs->cs, &_criticals_attr); 
     128       
     129        pthread_mutex_unlock(&critical_section.cs); 
    123130    } 
    124131    pthread_mutex_lock(&dcs->cs); 
     
    134141{ 
    135142    if (!dcs_list) 
    136     {  //printf("_STI_critical_init()\n"); 
    137    pthread_mutexattr_init(&_criticals_attr); 
    138    pthread_mutexattr_settype(&_criticals_attr, PTHREAD_MUTEX_RECURSIVE_NP); 
     143    {   //printf("_STI_critical_init()\n"); 
     144        pthread_mutexattr_init(&_criticals_attr); 
     145        pthread_mutexattr_settype(&_criticals_attr, PTHREAD_MUTEX_RECURSIVE); 
    139146 
    140    // The global critical section doesn't need to be recursive 
    141    pthread_mutex_init(&critical_section.cs, 0); 
    142    dcs_list = &critical_section; 
     147        // The global critical section doesn't need to be recursive 
     148        pthread_mutex_init(&critical_section.cs, 0); 
     149        dcs_list = &critical_section; 
    143150    } 
    144151} 
     
    147154{ 
    148155    if (dcs_list) 
    149     {  //printf("_STI_critical_term()\n"); 
    150    while (dcs_list) 
    151    
    152        //printf("\tlooping... %x\n", dcs_list); 
    153        pthread_mutex_destroy(&dcs_list->cs); 
    154        dcs_list = dcs_list->next; 
    155    
     156    {   //printf("_STI_critical_term()\n"); 
     157        while (dcs_list) 
     158       
     159            //printf("\tlooping... %x\n", dcs_list); 
     160            pthread_mutex_destroy(&dcs_list->cs); 
     161            dcs_list = dcs_list->next; 
     162       
    156163    } 
    157164} 
    158165 
    159166#endif 
    160  
  • trunk/lib/compiler/dmd/rt/deh.c

    r4357 r4384  
    156156 
    157157                    if (_d_isbaseof(ci, pcb->type)) 
    158                     {   // Matched the catch type, so we've found the handler. 
     158                    { 
     159                        // Matched the catch type, so we've found the handler. 
    159160                        int regebp; 
    160161 
     
    410411/* ======================== linux =============================== */ 
    411412 
    412 #if linux 
     413#if linux || __APPLE__ 
    413414 
    414415#include        "mars.h" 
  • trunk/lib/compiler/dmd/rt/deh2.d

    r4357 r4384  
    2222 */ 
    2323 
     24module rt.deh2; 
     25 
    2426// Exception handling support for linux 
    2527 
    2628//debug=1; 
     29debug import tango.stdc.stdio: printf; 
     30import tango.stdc.stdio: printf; 
     31import tango.stdc.stdlib: exit; 
    2732 
    2833extern (C) 
     
    188193        {   // if end of call chain 
    189194            debug printf("end of call chain\n"); 
     195            printf("unhandled exception\n"); 
     196            exit(1); 
    190197            break; 
    191198        } 
     
    291298                void *blockaddr = phi.finally_code; 
    292299 
    293                 asm 
     300                version (OSX) 
    294301                { 
    295                     push        EBX             ; 
    296                     mov         EBX,blockaddr   ; 
    297                     push        EBP             ; 
    298                     mov         EBP,regebp      ; 
    299                     call        EBX             ; 
    300                     pop         EBP             ; 
    301                     pop         EBX             ; 
     302                    asm { 
     303                        sub ESP,4       ; 
     304                        push    EBX     ; 
     305                        mov EBX,blockaddr   ; 
     306                        push    EBP     ; 
     307                        mov EBP,regebp  ; 
     308                        call    EBX     ; 
     309                        pop EBP     ; 
     310                        pop EBX     ; 
     311                        add ESP,4       ; 
     312                    } 
     313                } else { 
     314                    asm { 
     315                        push        EBX             ; 
     316                        mov         EBX,blockaddr   ; 
     317                        push        EBP             ; 
     318                        mov         EBP,regebp      ; 
     319                        call        EBX             ; 
     320                        pop         EBP             ; 
     321                        pop         EBX             ; 
     322                    } 
    302323                } 
    303324            } 
     
    305326    } 
    306327} 
    307  
  • trunk/lib/compiler/dmd/rt/dmain2.d

    r4357 r4384  
    99 */ 
    1010 
     11module rt.dmain2; 
     12 
    1113private 
    1214{ 
    13     import util.console; 
     15    import rt.util.console; 
    1416 
    1517    import tango.stdc.stddef; 
    1618    import tango.stdc.stdlib; 
    1719    import tango.stdc.string; 
     20    extern(C) int printf(char*,...); 
    1821} 
    1922 
     
    8689void _d_criticalInit() 
    8790{ 
    88     version (linux) 
     91    version (Posix) 
    8992    { 
    9093        _STI_monitor_staticctor(); 
     
    122125void _d_criticalTerm() 
    123126{ 
    124     version (linux) 
     127    version (Posix) 
    125128    { 
    126129        _STD_critical_term(); 
     
    155158} 
    156159 
     160version (OSX) 
     161{ 
     162    // The bottom of the stack 
     163    extern (C) void* __osx_stack_end = cast(void*)0xC0000000; 
     164} 
     165 
    157166/*********************************** 
    158167 * The D main() function supplied by the user's program 
     
    171180    int result; 
    172181 
    173     version (linux) 
     182    version (OSX) 
     183    {/* OSX does not provide a way to get at the top of the 
     184      * stack, except for the magic value 0xC0000000. 
     185      * But as far as the gc is concerned, argv is at the top 
     186      * of the main thread's stack, so save the address of that. 
     187      */ 
     188    __osx_stack_end = cast(void*)&argv; 
     189    } 
     190    version (Posix) 
    174191    { 
    175192        _STI_monitor_staticctor(); 
     
    203220        wargc = 0; 
    204221    } 
    205     else version (linux) 
     222    else version (Posix) 
    206223    { 
    207224        char[]* am = cast(char[]*) malloc(argc * (char[]).sizeof); 
     
    229246            catch (Exception e) 
    230247            { 
     248                printf("pippoException\n"); 
    231249                while (e) 
    232250                { 
     
    255273            catch (Object o) 
    256274            { 
    257                 // fprintf(stderr, "%.*s\n", o.toString()); 
     275                printf("pippoException\n"); 
     276                //fprintf(stderr, "%.*s\n", o.toString()); 
    258277                console (o.toString)("\n"); 
    259278                result = EXIT_FAILURE; 
     
    296315    tryExec(&runAll); 
    297316 
    298     version (linux) 
     317    version (Posix) 
    299318    { 
    300319        _STD_critical_term(); 
  • trunk/lib/compiler/dmd/rt/lifetime.d

    r4357 r4384  
    2525 * Authors:   Walter Bright, Sean Kelly 
    2626 */ 
    27 module lifetime; 
     27module rt.lifetime; 
    2828 
    2929 
  • trunk/lib/compiler/dmd/rt/llmath.d

    r4357 r4384  
    11// llmath.d 
    2 // Copyright (C) 1993-2003 by Digital Mars, www.digitalmars.com 
     2// Copyright (C) 1993-2008 by Digital Mars, http://www.digitalmars.com 
    33// All Rights Reserved 
    44// Written by Walter Bright 
    55 
    66// Compiler runtime support for 64 bit longs 
     7 
     8module rt.llmath; 
    79 
    810extern (C): 
     
    1214 * Unsigned long divide. 
    1315 * Input: 
    14  * [EDX,EAX],[ECX,EBX] 
     16 *      [EDX,EAX],[ECX,EBX] 
    1517 * Output: 
    16  *  [EDX,EAX] = [EDX,EAX] / [ECX,EBX] 
    17  *  [ECX,EBX] = [EDX,EAX] % [ECX,EBX] 
    18  *  ESI,EDI destroyed 
     18 *      [EDX,EAX] = [EDX,EAX] / [ECX,EBX] 
     19 *      [ECX,EBX] = [EDX,EAX] % [ECX,EBX] 
    1920 */ 
    2021 
     
    2324    asm 
    2425    { 
    25     naked           ; 
    26     test    ECX,ECX     ; 
    27     jz  uldiv       ; 
    28  
    29     push    EBP     ; 
    30  
    31     // left justify [ECX,EBX] and leave count of shifts + 1 in EBP 
    32  
    33     mov EBP,1       ;   // at least 1 shift 
    34     test    ECX,ECX     ;   // left justified? 
    35     js  L1      ;   // yes 
    36     jnz L2      ; 
    37     add EBP,8       ; 
    38     mov CH,CL       ; 
    39     mov CL,BH       ; 
    40     mov BH,BL       ; 
    41     xor BL,BL       ;   // [ECX,EBX] <<= 8 
    42     test    ECX,ECX     ; 
    43     js  L1      ; 
    44     even            ; 
    45 L2: inc EBP     ;   // another shift 
    46     shl EBX,1       ; 
    47     rcl ECX,1       ;   // [ECX,EBX] <<= 1 
    48     jno L2      ;   // not left justified yet 
    49  
    50 L1: mov ESI,ECX     ; 
    51     mov EDI,EBX     ;   // [ESI,EDI] = divisor 
    52  
    53     mov ECX,EDX     ; 
    54     mov EBX,EAX     ;   // [ECX,EBX] = [EDX,EAX] 
    55     xor EAX,EAX     ; 
    56     cdq         ;   // [EDX,EAX] = 0 
    57     even            ; 
    58 L4: cmp ESI,ECX     ;   // is [ECX,EBX] > [ESI,EDI]? 
    59     ja  L3      ;   // yes 
    60     jb  L5      ;   // definitely less than 
    61     cmp EDI,EBX     ;   // check low order word 
    62     ja  L3      ; 
    63 L5: sub EBX,EDI     ; 
    64     sbb ECX,ESI     ;   // [ECX,EBX] -= [ESI,EDI] 
    65     stc         ;   // rotate in a 1 
    66 L3: rcl EAX,1       ; 
    67     rcl EDX,1       ;   // [EDX,EAX] = ([EDX,EAX] << 1) + C 
    68     shr ESI,1       ; 
    69     rcr EDI,1       ;   // [ESI,EDI] >>= 1 
    70     dec EBP     ;   // control count 
    71     jne L4      ; 
    72     pop EBP     ; 
    73     ret         ; 
    74  
    75 div0:   mov EAX,-1      ; 
    76     cwd         ;   // quotient is -1 
    77 //  xor ECX,ECX     ; 
    78 //  mov EBX,ECX     ;   // remainder is 0 (ECX and EBX already 0) 
    79     pop EBP     ; 
    80     ret         ; 
    81  
    82 uldiv:  test    EDX,EDX     ; 
    83     jnz D3      ; 
    84     // Both high words are 0, we can use the DIV instruction 
    85     div EBX     ; 
    86     mov EBX,EDX     ; 
    87     mov EDX,ECX     ;   // EDX = ECX = 0 
    88     ret         ; 
    89  
    90     even            ; 
    91 D3: // Divide [EDX,EAX] by EBX 
    92     mov ECX,EAX     ; 
    93     mov EAX,EDX     ; 
    94     xor EDX,EDX     ; 
    95     div EBX     ; 
    96     xchg    ECX,EAX     ; 
    97     div EBX     ; 
    98     // ECX,EAX = result 
    99     // EDX = remainder 
    100     mov EBX,EDX     ; 
    101     mov EDX,ECX     ; 
    102     xor ECX,ECX     ; 
    103     ret         ; 
     26        naked                   ; 
     27        test    ECX,ECX         ; 
     28        jz      uldiv           ; 
     29 
     30        // if ECX > EDX, then quotient is 0 and remainder is [EDX,EAX] 
     31        cmp     ECX,EDX         ; 
     32        ja      quo0            ; 
     33 
     34        test    ECX,ECX         ; 
     35        js      Lleft           ; 
     36 
     37        /* We have n>d, and know that n/d will fit in 32 bits. 
     38         * d will be left justified if we shift it left s bits. 
     39         * [d1,d0] <<= s 
     40         * [n2,n1,n0] = [n1,n0] << s 
     41         * 
     42         * Use one divide, by this reasoning: 
     43         * ([n2,n1]<<32 + n0)/(d1<<32 + d0) 
     44         * becomes: 
     45         * ([n2,n1]<<32)/(d1<<32 + d0) + n0/(d1<<32 + d0) 
     46         * The second divide is always 0. 
     47         * Ignore the d0 in the first divide, which will yield a quotient 
     48         * that might be too high by 1 (because d1 is left justified). 
     49         * We can tell if it's too big if: 
     50         *  q*[d1,d0] > [n2,n1,n0] 
     51         * which is: 
     52         *  q*[d1,d0] > [[q*[d1,0]+q%[d1,0],n1,n0] 
     53         * If we subtract q*[d1,0] from both sides, we get: 
     54         *  q*d0 > [[n2,n1]%d1,n0] 
     55         * So if it is too big by one, reduce q by one to q'=q-one. 
     56         * Compute remainder as: 
     57         *  r = ([n1,n0] - q'*[d1,d0]) >> s 
     58         * Again, we can subtract q*[d1,0]: 
     59         *  r = ([n1,n0] - q*[d1,0] - (q'*[d1,d0] - q*[d1,0])) >> s 
     60         *  r = ([[n2,n1]%d1,n0] + (q*[d1,0] - (q - one)*[d1,d0])) >> s 
     61         *  r = ([[n2,n1]%d1,n0] + (q*[d1,0] - [d1 *(q-one),d0*(1-q)])) >> s 
     62         *  r = ([[n2,n1]%d1,n0] + [d1 *one,d0*(one-q)])) >> s 
     63         */ 
     64 
     65        push    EBP             ; 
     66        push    ESI             ; 
     67        push    EDI             ; 
     68 
     69        mov     ESI,EDX         ; 
     70        mov     EDI,EAX         ; 
     71        mov     EBP,ECX         ; 
     72 
     73        bsr     EAX,ECX         ;       // EAX is now 30..0 
     74        xor     EAX,0x1F        ;       // EAX is now 1..31 
     75        mov     CH,AL           ; 
     76        neg     EAX             ; 
     77        add     EAX,32          ; 
     78        mov     CL,AL           ; 
     79 
     80        mov     EAX,EBX         ; 
     81        shr     EAX,CL          ; 
     82        xchg    CH,CL           ; 
     83        shl     EBP,CL          ; 
     84        or      EBP,EAX         ; 
     85        shl     EBX,CL          ; 
     86 
     87        mov     EDX,ESI         ; 
     88        xchg    CH,CL           ; 
     89        shr     EDX,CL          ; 
     90 
     91        mov     EAX,EDI         ; 
     92        shr     EAX,CL          ; 
     93        xchg    CH,CL           ; 
     94        shl     EDI,CL          ; 
     95        shl     ESI,CL          ; 
     96        or      EAX,ESI         ; 
     97 
     98        div     EBP             ; 
     99        push    EBP             ; 
     100        mov     EBP,EAX         ; 
     101        mov     ESI,EDX         ; 
     102 
     103        mul     EBX             ; 
     104        cmp     EDX,ESI         ; 
     105        ja      L1              ; 
     106        jb      L2              ; 
     107        cmp     EAX,EDI         ; 
     108        jbe     L2              ; 
     109L1:     dec     EBP             ; 
     110        sub     EAX,EBX         ; 
     111        sbb     EDX,0[ESP]      ; 
     112L2: 
     113        add     ESP,4           ; 
     114        sub     EDI,EAX         ; 
     115        sbb     ESI,EDX         ; 
     116        mov     EAX,ESI         ; 
     117        xchg    CH,CL           ; 
     118        shl     EAX,CL          ; 
     119        xchg    CH,CL           ; 
     120        shr     EDI,CL          ; 
     121        or      EDI,EAX         ; 
     122        shr     ESI,CL          ; 
     123        mov     EBX,EDI         ; 
     124        mov     ECX,ESI         ; 
     125        mov     EAX,EBP         ; 
     126        xor     EDX,EDX         ; 
     127 
     128        pop     EDI             ; 
     129        pop     ESI             ; 
     130        pop     EBP             ; 
     131        ret                     ; 
     132 
     133uldiv:  test    EDX,EDX         ; 
     134        jnz     D3              ; 
     135        // Both high words are 0, we can use the DIV instruction 
     136        div     EBX             ; 
     137        mov     EBX,EDX         ; 
     138        mov     EDX,ECX         ;       // EDX = ECX = 0 
     139        ret                     ; 
     140 
     141        even                    ; 
     142D3:     // Divide [EDX,EAX] by EBX 
     143        mov     ECX,EAX         ; 
     144        mov     EAX,EDX         ; 
     145        xor     EDX,EDX         ; 
     146        div     EBX             ; 
     147        xchg    ECX,EAX         ; 
     148        div     EBX             ; 
     149        // ECX,EAX = result 
     150        // EDX = remainder 
     151        mov     EBX,EDX         ; 
     152        mov     EDX,ECX         ; 
     153        xor     ECX,ECX         ; 
     154        ret                     ; 
     155 
     156quo0:   // Quotient is 0 
     157        // Remainder is [EDX,EAX] 
     158        mov     EBX,EAX         ; 
     159        mov     ECX,EDX         ; 
     160        xor     EAX,EAX         ; 
     161        xor     EDX,EDX         ; 
     162        ret                     ; 
     163 
     164Lleft:  // The quotient is 0 or 1 and EDX >= ECX 
     165        cmp     EDX,ECX         ; 
     166        ja      quo1            ;       // [EDX,EAX] > [ECX,EBX] 
     167        // EDX == ECX 
     168        cmp     EAX,EBX         ; 
     169        jb      quo0            ; 
     170 
     171quo1:   // Quotient is 1 
     172        // Remainder is [EDX,EAX] - [ECX,EBX] 
     173        sub     EAX,EBX         ; 
     174        sbb     EDX,ECX         ; 
     175        mov     EBX,EAX         ; 
     176        mov     ECX,EDX         ; 
     177        mov     EAX,1           ; 
     178        xor     EDX,EDX         ; 
     179        ret                     ; 
    104180    } 
    105181} 
     
    109185 * Signed long divide. 
    110186 * Input: 
    111  * [EDX,EAX],[ECX,EBX] 
     187 *      [EDX,EAX],[ECX,EBX] 
    112188 * Output: 
    113  * [EDX,EAX] = [EDX,EAX] / [ECX,EBX] 
    114  * [ECX,EBX] = [EDX,EAX] % [ECX,EBX] 
    115  * ESI,EDI destroyed 
     189 *      [EDX,EAX] = [EDX,EAX] / [ECX,EBX] 
     190 *      [ECX,EBX] = [EDX,EAX] % [ECX,EBX] 
     191 *      ESI,EDI destroyed 
    116192 */ 
    117193 
     
    120196    asm 
    121197    { 
    122    naked           
    123    test    EDX,EDX     ;   // [EDX,EAX] negative? 
    124    jns L10     ;   // no 
    125    //neg64 EDX,EAX     ;   // [EDX,EAX] = -[EDX,EAX] 
    126      neg   EDX     
    127      neg   EAX     
    128      sbb   EDX,0       
    129    test    ECX,ECX     ;   // [ECX,EBX] negative? 
    130    jns L11     ;   // no 
    131    //neg64 ECX,EBX     
    132      neg   ECX     
    133      neg   EBX     
    134      sbb   ECX,0       
    135    call    __ULDIV__   
    136    //neg64 ECX,EBX     ;   // remainder same sign as dividend 
    137      neg   ECX     
    138      neg   EBX     
    139      sbb   ECX,0       
    140    ret         
    141  
    142 L11:   call    __ULDIV__   
    143    //neg64 ECX,EBX     ;   // remainder same sign as dividend 
    144      neg   ECX     
    145      neg   EBX     
    146      sbb   ECX,0       
    147    //neg64 EDX,EAX     ;   // quotient is negative 
    148      neg   EDX     
    149      neg   EAX     
    150      sbb   EDX,0       
    151    ret         
    152  
    153 L10:   test    ECX,ECX     ;   // [ECX,EBX] negative? 
    154    jns L12     ;   // no (all is positive) 
    155    //neg64 ECX,EBX     
    156      neg   ECX     
    157      neg   EBX     
    158      sbb   ECX,0       
    159    call    __ULDIV__   
    160    //neg64 EDX,EAX     ;   // quotient is negative 
    161      neg   EDX     
    162      neg   EAX     
    163      sbb   EDX,0       
    164    ret         
    165  
    166 L12:   jmp __ULDIV__   
     198        naked                   
     199        test    EDX,EDX         ;       // [EDX,EAX] negative? 
     200        jns     L10             ;       // no 
     201        //neg64 EDX,EAX         ;       // [EDX,EAX] = -[EDX,EAX] 
     202          neg   EDX             
     203          neg   EAX             
     204          sbb   EDX,0           
     205        test    ECX,ECX         ;       // [ECX,EBX] negative? 
     206        jns     L11             ;       // no 
     207        //neg64 ECX,EBX         
     208          neg   ECX             
     209          neg   EBX             
     210          sbb   ECX,0           
     211        call    __ULDIV__       
     212        //neg64 ECX,EBX         ;       // remainder same sign as dividend 
     213          neg   ECX             
     214          neg   EBX             
     215          sbb   ECX,0           
     216        ret                     
     217 
     218L11:    call    __ULDIV__       
     219        //neg64 ECX,EBX         ;       // remainder same sign as dividend 
     220          neg   ECX             
     221          neg   EBX             
     222          sbb   ECX,0           
     223        //neg64 EDX,EAX         ;       // quotient is negative 
     224          neg   EDX             
     225          neg   EAX             
     226          sbb   EDX,0           
     227        ret                     
     228 
     229L10:    test    ECX,ECX         ;       // [ECX,EBX] negative? 
     230        jns     L12             ;       // no (all is positive) 
     231        //neg64 ECX,EBX         
     232          neg   ECX             
     233          neg   EBX             
     234          sbb   ECX,0           
     235        call    __ULDIV__       
     236        //neg64 EDX,EAX         ;       // quotient is negative 
     237          neg   EDX             
     238          neg   EAX             
     239          sbb   EDX,0           
     240        ret                     
     241 
     242L12:    jmp     __ULDIV__       
    167243    } 
    168244} 
     
    179255    asm 
    180256    { 
    181    naked           
    182    cmp EDX,ECX     
    183    jne C1     
    184    push    EDX     
    185    xor EDX,EDX     
    186    cmp EAX,EBX     
    187    jz  C2     
    188    ja  C3     
    189    dec EDX     
    190    pop EDX     
    191    ret         
    192  
    193 C3:    inc EDX     
    194 C2:    pop EDX     
    195 C1:    ret         
     257        naked                   
     258        cmp     EDX,ECX         
     259        jne     C1             
     260        push    EDX             
     261        xor     EDX,EDX         
     262        cmp     EAX,EBX         
     263        jz      C2             
     264        ja      C3             
     265        dec     EDX             
     266        pop     EDX             
     267        ret                     
     268 
     269C3:     inc     EDX             
     270C2:     pop     EDX             
     271C1:     ret                     
    196272    } 
    197273} 
     
    206282real __U64_LDBL() 
    207283{ 
    208     asm 
    209     {   naked                   ; 
    210     push    EDX             ; 
    211     push    EAX             ; 
    212     and dword ptr 4[ESP], 0x7FFFFFFF    ; 
    213     fild    qword ptr [ESP]         ; 
    214     test    EDX,EDX             ; 
    215     jns L1              ; 
    216     fld real ptr adjust         ; 
    217     faddp   ST(1), ST           ; 
    218     L1:                     ; 
    219     add ESP, 8              ; 
    220     ret                 ; 
     284    version (OSX) { 
     285        asm 
     286        {   naked               ; 
     287            push    EDX         ; 
     288            push    EAX         ; 
     289            and     dword ptr 4[ESP], 0x7FFFFFFF    ; 
     290            fild    qword ptr [ESP]     ; 
     291            test    EDX,EDX         ; 
     292            jns     L1          ; 
     293            push    0x0000403e      ; 
     294            push    0x80000000      ; 
     295            push    0           ; 
     296            fld     real ptr [ESP]      ; // adjust 
     297            add     ESP,12          ; 
     298            faddp   ST(1), ST       ; 
     299        L1:                 ; 
     300            add     ESP, 8          ; 
     301            ret                 ; 
     302        } 
     303    } else { 
     304        asm 
     305        {   naked                                   ; 
     306            push    EDX                             ; 
     307            push    EAX                             ; 
     308            and     dword ptr 4[ESP], 0x7FFFFFFF    ; 
     309            fild    qword ptr [ESP]                 ; 
     310            test    EDX,EDX                         ; 
     311            jns     L1                              ; 
     312            fld     real ptr adjust                 ; 
     313            faddp   ST(1), ST                       ; 
     314        L1:                                         ; 
     315            add     ESP, 8                          ; 
     316            ret                                     ; 
     317        } 
    221318    } 
    222319} 
     
    226323{ 
    227324    asm 
    228     {  naked                   
    229    call __U64_LDBL             
    230    sub  ESP,8             
    231    fstp double ptr [ESP]           
    232    pop  EAX               
    233    pop  EDX               
    234    ret                 
     325    {   naked                                   
     326        call __U64_LDBL                         
     327        sub  ESP,8                             
     328        fstp double ptr [ESP]                   
     329        pop  EAX                               
     330        pop  EDX                               
     331        ret                                     
    235332    } 
    236333} 
     
    243340{ 
    244341    // BUG: should handle NAN's and overflows 
     342    version (OSX) { 
     343        asm { 
     344            naked               ; 
     345            push    0xFBF           ; // roundTo0 
     346            push    0x0000403e      ; 
     347            push    0x80000000      ; 
     348            push    0           ; // adjust 
     349            push    EDX         ; 
     350            push    EAX         ; 
     351            fld     double ptr [ESP]    ; 
     352            sub     ESP,8           ; 
     353            fld     real ptr 16[ESP]    ; // adjust 
     354            fcomp               ; 
     355            fstsw   AX          ; 
     356            fstcw   8[ESP]          ; 
     357            fldcw   28[ESP]         ; // roundTo0 
     358            sahf                ; 
     359            jae     L1          ; 
     360            fld     real ptr 16[ESP]    ; // adjust 
     361            fsubp   ST(1), ST       ; 
     362            fistp   qword ptr [ESP]     ; 
     363            pop     EAX         ; 
     364            pop     EDX         ; 
     365            fldcw   [ESP]           ; 
     366            add     ESP,24          ; 
     367            add     EDX,0x8000_0000     ; 
     368            ret                 ; 
     369        L1:                 ; 
     370            fistp   qword ptr [ESP]     ; 
     371            pop     EAX         ; 
     372            pop     EDX         ; 
     373            fldcw   [ESP]           ; 
     374            add     ESP,24          ; 
     375            ret                 ; 
     376        } 
     377    } else { 
     378        asm 
     379        {   naked                                   ; 
     380            push    EDX                             ; 
     381            push    EAX                             ; 
     382            fld     double ptr [ESP]                ; 
     383            sub     ESP,8                           ; 
     384            fld     real ptr adjust                 ; 
     385            fcomp                                   ; 
     386            fstsw   AX                              ; 
     387            fstcw   8[ESP]                          ; 
     388            fldcw   roundTo0                        ; 
     389            sahf                                    ; 
     390            jae     L1                              ; 
     391            fld     real ptr adjust                 ; 
     392            fsubp   ST(1), ST                       ; 
     393            fistp   qword ptr [ESP]                 ; 
     394            pop     EAX                             ; 
     395            pop     EDX                             ; 
     396            fldcw   [ESP]                           ; 
     397            add     ESP,8                           ; 
     398            add     EDX,0x8000_0000                 ; 
     399            ret                                     ; 
     400        L1:                                         ; 
     401            fistp   qword ptr [ESP]                 ; 
     402            pop     EAX                             ; 
     403            pop     EDX                             ; 
     404            fldcw   [ESP]                           ; 
     405            add     ESP,8                           ; 
     406            ret                                     ; 
     407        } 
     408    } 
     409} 
     410 
     411// Convert double in ST0 to uint 
     412 
     413uint __DBLULNG() 
     414{ 
     415    // BUG: should handle NAN's and overflows 
     416    version (OSX) { 
     417        asm { 
     418            naked                   ; 
     419            push    0xFBF           ; // roundTo0 
     420            sub     ESP,12          ; 
     421            fstcw   8[ESP]          ; 
     422            fldcw   12[ESP]         ; // roundTo0 
     423            fistp   qword ptr [ESP] ; 
     424            fldcw   8[ESP]          ; 
     425            pop     EAX             ; 
     426            add     ESP,12          ; 
     427            ret                     ; 
     428        } 
     429    } else { 
     430        asm { 
     431            naked                                   ; 
     432            sub     ESP,16                          ; 
     433            fstcw   8[ESP]                          ; 
     434            fldcw   roundTo0                        ; 
     435            fistp   qword ptr [ESP]                 ; 
     436            fldcw   8[ESP]                          ; 
     437            pop     EAX                             ; 
     438            add     ESP,12                          ; 
     439            ret                                     ; 
     440        } 
     441    } 
     442} 
     443 
     444 
     445// Convert real in ST0 to ulong 
     446 
     447ulong __LDBLULLNG() 
     448{ 
     449    version (OSX) 
     450    { 
    245451    asm 
    246     {   naked                   ; 
    247     push    EDX             ; 
    248     push    EAX             ; 
    249     fld double ptr [ESP]        ; 
    250     sub ESP,8               ; 
    251     fld real ptr adjust         ; 
    252     fcomp                   ; 
    253     fstsw   AX              ; 
    254     fstcw   8[ESP]              ; 
    255     fldcw   roundTo0            ; 
    256     sahf                    ; 
    257     jae L1              ; 
    258     fld real ptr adjust         ; 
    259     fsubp   ST(1), ST           ; 
    260     fistp   qword ptr [ESP]         ; 
    261     pop EAX             ; 
    262     pop EDX             ; 
    263     fldcw   [ESP]               ; 
    264     add ESP,8               ; 
    265     add EDX,0x8000_0000         ; 
    266     ret                 ; 
    267     L1:                     ; 
    268     fistp   qword ptr [ESP]         ; 
    269     pop EAX             ; 
    270     pop EDX             ; 
    271     fldcw   [ESP]               ; 
    272     add ESP,8               ; 
    273     ret                 ; 
    274     } 
    275 
    276  
    277 // Convert double in ST0 to uint 
    278  
    279 uint __DBLULNG() 
    280 
    281     // BUG: should handle NAN's and overflows 
     452    {   naked               ; 
     453        push    0xFBF           ; // roundTo0 
     454        push    0x0000403e      ; 
     455        push    0x80000000      ; 
     456        push    0           ; // adjust 
     457        sub     ESP,16          ; 
     458        fld     real ptr 16[ESP]    ; // adjust 
     459        fcomp               ; 
     460        fstsw   AX          ; 
     461        fstcw   8[ESP]          ; 
     462        fldcw   28[ESP]         ; // roundTo0 
     463        sahf                ; 
     464        jae     L1          ; 
     465        fld     real ptr 16[ESP]    ; // adjust 
     466        fsubp   ST(1), ST       ; 
     467        fistp   qword ptr [ESP]     ; 
     468        pop     EAX         ; 
     469        pop     EDX         ; 
     470        fldcw   [ESP]           ; 
     471        add     ESP,24          ; 
     472        add     EDX,0x8000_0000     ; 
     473        ret                 ; 
     474    L1:                 ; 
     475        fistp   qword ptr [ESP]     ; 
     476        pop     EAX         ; 
     477        pop     EDX         ; 
     478        fldcw   [ESP]           ; 
     479        add     ESP,24          ; 
     480        ret                 ; 
     481    } 
     482    } 
     483    else 
     484    { 
    282485    asm 
    283     {   naked                   ; 
    284     sub ESP,16              ; 
    285     fstcw   8[ESP]              ; 
    286     fldcw   roundTo0            ; 
    287     fistp   qword ptr [ESP]         ; 
    288     fldcw   8[ESP]              ; 
    289     pop EAX             ; 
    290     add ESP,12              ; 
    291     ret                 ; 
    292     } 
    293 
     486    {   naked               ; 
     487        sub     ESP,16          ; 
     488        fld     real ptr adjust     ; 
     489        fcomp               ; 
     490        fstsw   AX          ; 
     491        fstcw   8[ESP]          ; 
     492        fldcw   roundTo0        ; 
     493        sahf                ; 
     494        jae     L1          ; 
     495        fld     real ptr adjust     ; 
     496        fsubp   ST(1), ST       ; 
     497        fistp   qword ptr [ESP]     ; 
     498        pop     EAX         ; 
     499        pop     EDX         ; 
     500        fldcw   [ESP]           ; 
     501        add     ESP,8           ; 
     502        add     EDX,0x8000_0000     ; 
     503        ret                 ; 
     504    L1:                 ; 
     505        fistp   qword ptr [ESP]     ; 
     506        pop     EAX         ; 
     507        pop     EDX         ; 
     508        fldcw   [ESP]           ; 
     509        add     ESP,8           ; 
     510        ret                 ; 
     511    } 
     512    } 
     513
     514 
  • trunk/lib/compiler/dmd/rt/mars.h

    r4357 r4384  
    103103} 
    104104#endif 
    105  
  • trunk/lib/compiler/dmd/rt/memory.d

    r4357 r4384  
    2424 * Authors:   Walter Bright, Sean Kelly 
    2525 */ 
    26 module memory; 
     26module rt.memory; 
    2727 
    2828 
     
    3636        { 
    3737            extern (C) extern void* __libc_stack_end; 
     38        } 
     39    } 
     40    version (OSX) 
     41    { 
     42        extern (C) 
     43        { 
     44        extern void* __osx_stack_end;   // set by D startup code 
    3845        } 
    3946    } 
     
    5764    else version( linux ) 
    5865    { 
    59         version( SimpleLibcStackEnd ) 
    60         { 
     66        version( SimpleLibcStackEnd ) { 
    6167            return __libc_stack_end; 
    62         } 
    63         else 
    64         { 
     68        } else { 
    6569            // See discussion: http://autopackage.org/forums/viewtopic.php?t=22 
    6670                static void** libc_stack_end; 
     
    7478                return *libc_stack_end; 
    7579        } 
    76     } 
    77     else 
    78    
     80    } else version (darwin) { 
     81        return __osx_stack_end; 
     82    } else
    7983        static assert( false, "Operating system not supported." ); 
    8084    } 
     
    149153        scan( &__data_start, &_end ); 
    150154    } 
     155    else version( darwin ){ 
     156        // already ranges already added through osxgc.c functions 
     157    } 
    151158    else 
    152159    { 
  • trunk/lib/compiler/dmd/rt/memset.d

    r4357 r4384  
    2121 *     distribution. 
    2222 */ 
     23module rt.memset; 
    2324 
    2425 
     
    3738 
    3839    for (ptop = &p[count]; p < ptop; p++) 
    39    *p = value; 
     40        *p = value; 
    4041    return pstart; 
    4142} 
     
    4748    asm 
    4849    { 
    49    mov EDI,p       
    50    mov EAX,value   
    51    mov ECX,count   
    52    mov EDX,EDI     
    53    rep         
    54    stosd           
    55    mov EAX,EDX     
     50        mov     EDI,p           
     51        mov     EAX,value       
     52        mov     ECX,count       
     53        mov     EDX,EDI         
     54        rep                     
     55        stosd                   
     56        mov     EAX,EDX         
    5657    } 
    5758} 
     
    6263 
    6364    for (ptop = &p[count]; p < ptop; p++) 
    64    *p = value; 
     65        *p = value; 
    6566    return pstart; 
    6667} 
     
    7374 
    7475    for (ptop = &p[count]; p < ptop; p++) 
    75    *p = value; 
     76        *p = value; 
    7677    return pstart; 
    7778} 
     
    8384 
    8485    for (ptop = &p[count]; p < ptop; p++) 
    85    *p = value; 
     86        *p = value; 
    8687    return pstart; 
    8788} 
     
    9394 
    9495    for (ptop = &p[count]; p < ptop; p++) 
    95    *p = value; 
     96        *p = value; 
    9697    return pstart; 
    9798} 
     
    103104 
    104105    for (ptop = &p[count]; p < ptop; p++) 
    105    *p = value; 
     106        *p = value; 
    106107    return pstart; 
    107108} 
     
    113114    for (i = 0; i < count; i++) 
    114115    { 
    115    memcpy(p, value, sizelem); 
    116    p = cast(void *)(cast(char *)p + sizelem); 
     116        memcpy(p, value, sizelem); 
     117        p = cast(void *)(cast(char *)p + sizelem); 
    117118    } 
    118119    return pstart; 
  • trunk/lib/compiler/dmd/rt/monitor.c

    r4357 r4384  
    1313 
    1414#if _WIN32 
    15 #elif linux 
    16 #define USE_PTHREADS   
     15#elif linux || __APPLE__ 
     16#define USE_PTHREADS   
    1717#else 
    1818#endif 
     
    4343} Monitor; 
    4444 
    45 #define MONPTR(h)  (&((Monitor *)(h)->monitor)->mon) 
     45#define MONPTR(h)       (&((Monitor *)(h)->monitor)->mon) 
    4646 
    4747static volatile int inited; 
     
    5656{ 
    5757    if (!inited) 
    58     {  InitializeCriticalSection(&_monitor_critsec); 
    59    inited = 1; 
     58    {   InitializeCriticalSection(&_monitor_critsec); 
     59        inited = 1; 
    6060    } 
    6161} 
     
    6464{ 
    6565    if (inited) 
    66     {  inited = 0; 
    67    DeleteCriticalSection(&_monitor_critsec); 
     66    {   inited = 0; 
     67        DeleteCriticalSection(&_monitor_critsec); 
    6868    } 
    6969} 
     
    128128#if USE_PTHREADS 
    129129 
     130// PTHREAD_MUTEX_RECURSIVE is what posix says should be supported, 
     131// but some versions of glibc have only PTHREAD_MUTEX_RECURSIVE_NP  
     132// (the np stands for non-portable), when they have the same meaning. 
     133#ifndef PTHREAD_MUTEX_RECURSIVE 
     134#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP 
     135#endif 
     136 
    130137// Includes attribute fixes from David Friedman's GDC port 
    131138 
     
    137144    if (!inited) 
    138145    { 
    139    pthread_mutexattr_init(&_monitors_attr); 
    140    pthread_mutexattr_settype(&_monitors_attr, PTHREAD_MUTEX_RECURSIVE_NP); 
    141    pthread_mutex_init(&_monitor_critsec, 0); 
    142    inited = 1; 
     146        pthread_mutexattr_init(&_monitors_attr); 
     147        pthread_mutexattr_settype(&_monitors_attr, PTHREAD_MUTEX_RECURSIVE); 
     148        pthread_mutex_init(&_monitor_critsec, 0); 
     149        inited = 1; 
    143150    } 
    144151} 
     
    147154{ 
    148155    if (inited) 
    149     {  inited = 0; 
    150    pthread_mutex_destroy(&_monitor_critsec); 
    151    pthread_mutexattr_destroy(&_monitors_attr); 
     156    {   inited = 0; 
     157        pthread_mutex_destroy(&_monitor_critsec); 
     158        pthread_mutexattr_destroy(&_monitors_attr); 
    152159    } 
    153160} 
  • trunk/lib/compiler/dmd/rt/obj.d

    r4357 r4384  
    1  
    2  
    31// Copyright (c) 2002 by Digital Mars 
    42// All Rights Reserved 
    53// written by Walter Bright 
    64// www.digitalmars.com 
     5 
     6module rt.obj; 
    77 
    88extern (C): 
     
    2626    return o1.opCmp(o2); 
    2727} 
    28  
  • trunk/lib/compiler/dmd/rt/qsort.d

    r4357 r4384  
    1414*/ 
    1515 
     16module rt.qsort; 
    1617 
    1718/* 
     
    156157    } 
    157158} 
    158  
  • trunk/lib/compiler/dmd/rt/qsort2.d

    r4357 r4384  
    1313 *  Modified by Sean Kelly <sean@f4.ca> for use with Tango. 
    1414 */ 
     15 
     16module rt.qsort2; 
    1517 
    1618//debug=qsort; 
  • trunk/lib/compiler/dmd/rt/trace.d

    r4357 r4384  
    1212 */ 
    1313 
     14module rt.trace; 
     15 
    1416private 
    1517{ 
     18    import rt.util.string; 
    1619    import tango.stdc.ctype; 
    1720    import tango.stdc.stdio; 
    1821    import tango.stdc.string; 
    1922    import tango.stdc.stdlib; 
    20     import util.string; 
    2123} 
    2224 
     
    149151// Qsort() comparison routine for array of pointers to SymPair's. 
    150152 
    151 static int sympair_cmp(void* e1, void* e2) 
     153static int sympair_cmp(in void* e1, in void* e2) 
    152154{   SymPair** psp1; 
    153155    SymPair** psp2; 
     
    284286// Qsort() comparison routine for array of pointers to Symbol's. 
    285287 
    286 static int symbol_cmp(void* e1, void* e2) 
     288static int symbol_cmp(in void* e1, in void* e2) 
    287289{   Symbol** ps1; 
    288290    Symbol** ps2; 
     
    786788     */ 
    787789 
    788     asm 
    789     {   naked                           ; 
    790         pushad                          ; 
    791         mov     ECX,8*4[ESP]            ; 
    792         xor     EAX,EAX                 ; 
    793         mov     AL,[ECX]                ; 
    794         cmp     AL,0xFF                 ; 
    795         jne     L1                      ; 
    796         cmp     byte ptr 1[ECX],0       ; 
    797         jne     L1                      ; 
    798         mov     AX,2[ECX]               ; 
    799         add     8*4[ESP],3              ; 
    800         add     ECX,3                   ; 
    801     L1: inc     EAX                     ; 
    802         inc     ECX                     ; 
    803         add     8*4[ESP],EAX            ; 
    804         dec     EAX                     ; 
    805         push    ECX                     ; 
    806         push    EAX                     ; 
    807         call    trace_pro               ; 
    808         add     ESP,8                   ; 
    809         popad                           ; 
    810         ret                             ; 
     790    version (OSX) { // 16 byte align stack 
     791        asm { 
     792            naked               ; 
     793            pushad              ; 
     794            mov ECX,8*4[ESP]        ; 
     795            xor EAX,EAX         ; 
     796            mov AL,[ECX]        ; 
     797            cmp AL,0xFF         ; 
     798            jne L1          ; 
     799            cmp byte ptr 1[ECX],0   ; 
     800            jne L1          ; 
     801            mov AX,2[ECX]       ; 
     802            add 8*4[ESP],3      ; 
     803            add ECX,3           ; 
     804               L1:  inc EAX         ; 
     805            inc ECX         ; 
     806            add 8*4[ESP],EAX        ; 
     807            dec EAX         ; 
     808            sub ESP,4           ; 
     809            push    ECX         ; 
     810            push    EAX         ; 
     811            call    trace_pro       ; 
     812            add ESP,12          ; 
     813            popad               ; 
     814            ret             ; 
     815        } 
     816    } else { 
     817        asm { 
     818            naked                           ; 
     819            pushad                          ; 
     820            mov     ECX,8*4[ESP]            ; 
     821            xor     EAX,EAX                 ; 
     822            mov     AL,[ECX]                ; 
     823            cmp     AL,0xFF                 ; 
     824            jne     L1                      ; 
     825            cmp     byte ptr 1[ECX],0       ; 
     826            jne     L1                      ; 
     827            mov     AX,2[ECX]               ; 
     828            add     8*4[ESP],3              ; 
     829            add     ECX,3                   ; 
     830        L1: inc     EAX                     ; 
     831            inc     ECX                     ; 
     832            add     8*4[ESP],EAX            ; 
     833            dec     EAX                     ; 
     834            push    ECX                     ; 
     835            push    EAX                     ; 
     836            call    trace_pro               ; 
     837            add     ESP,8                   ; 
     838            popad                           ; 
     839            ret                             ; 
     840        } 
    811841    } 
    812842} 
     
    818848void _trace_epi_n() 
    819849{ 
    820     asm 
    821     {   naked   ; 
    822         pushad  ; 
    823     } 
    824     trace_epi(); 
    825     asm 
    826     { 
    827         popad   ; 
    828         ret     ; 
     850    version (OSX) { // 16 byte align stack 
     851        asm{ 
     852            naked   ; 
     853            pushad  ; 
     854            sub ESP,12  ; 
     855        } 
     856        trace_epi(); 
     857        asm { 
     858            add ESP,12  ; 
     859            popad   ; 
     860            ret ; 
     861        } 
     862    } 
     863    else { 
     864        asm { 
     865            naked   ; 
     866            pushad  ; 
     867        } 
     868        trace_epi(); 
     869        asm 
     870        { 
     871            popad   ; 
     872            ret     ; 
     873        } 
    829874    } 
    830875} 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_AC.d

    r4357 r4384  
    1 module typeinfo.ti_AC; 
     1module rt.typeinfo.ti_AC; 
    22 
    33// Object[] 
     
    55class TypeInfo_AC : TypeInfo 
    66{ 
    7     hash_t getHash(void *p) 
     7    override hash_t getHash(in void* p) 
    88    {   Object[] s = *cast(Object[]*)p; 
    99        hash_t hash = 0; 
     
    1717    } 
    1818 
    19     int equals(void *p1, void *p2) 
     19    override equals_t equals(in void* p1, in void* p2) 
    2020    { 
    2121        Object[] s1 = *cast(Object[]*)p1; 
     
    3232                    (!(o1 is null) && !(o2 is null) && o1.opEquals(o2))) 
    3333                    continue; 
    34                 return 0
     34                return false
    3535            } 
    36             return 1
     36            return true
    3737        } 
    38         return 0
     38        return false
    3939    } 
    4040 
    41     int compare(void *p1, void *p2) 
     41    override int compare(in void* p1, in void* p2) 
    4242    { 
    4343        Object[] s1 = *cast(Object[]*)p1; 
     
    7979    } 
    8080 
    81     size_t tsize() 
     81    override size_t tsize() 
    8282    { 
    8383        return (Object[]).sizeof; 
    8484    } 
    8585 
    86     uint flags() 
     86    override uint flags() 
    8787    { 
    8888        return 1; 
    8989    } 
    9090 
    91     TypeInfo next() 
     91    override TypeInfo next() 
    9292    { 
    9393        return typeid(Object); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Acdouble.d

    r4357 r4384  
    2222 */ 
    2323 
    24 module typeinfo.ti_Acdouble; 
     24module rt.typeinfo.ti_Acdouble; 
    2525 
    26 private import typeinfo.ti_cdouble; 
     26private import rt.typeinfo.ti_cdouble; 
    2727 
    2828// cdouble[] 
     
    3030class TypeInfo_Ar : TypeInfo 
    3131{ 
    32     char[] toString() { return "cdouble[]"; } 
     32    override char[] toString() { return "cdouble[]"; } 
    3333 
    34     hash_t getHash(void *p) 
     34    override hash_t getHash(in void* p) 
    3535    {   cdouble[] s = *cast(cdouble[]*)p; 
    3636        size_t len = s.length; 
     
    5252    } 
    5353 
    54     int equals(void *p1, void *p2) 
     54    override equals_t equals(in void* p1, in void* p2) 
    5555    { 
    5656        cdouble[] s1 = *cast(cdouble[]*)p1; 
     
    5959 
    6060        if (len != s2.length) 
    61             return 0
     61            return false
    6262        for (size_t u = 0; u < len; u++) 
    6363        { 
    64             int c = TypeInfo_r._equals(s1[u], s2[u]); 
    65             if (c == 0) 
    66                 return 0; 
     64            if (!TypeInfo_r._equals(s1[u], s2[u])) 
     65                return false; 
    6766        } 
    68         return 1
     67        return true
    6968    } 
    7069 
    71     int compare(void *p1, void *p2) 
     70    override int compare(in void* p1, in void* p2) 
    7271    { 
    7372        cdouble[] s1 = *cast(cdouble[]*)p1; 
     
    9089    } 
    9190 
    92     size_t tsize() 
     91    override size_t tsize() 
    9392    { 
    9493        return (cdouble[]).sizeof; 
    9594    } 
    9695 
    97     uint flags() 
     96    override uint flags() 
    9897    { 
    9998        return 1; 
    10099    } 
    101100 
    102     TypeInfo next() 
     101    override TypeInfo next() 
    103102    { 
    104103        return typeid(cdouble); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Acfloat.d

    r4357 r4384  
    2222 */ 
    2323 
    24 module typeinfo.ti_Acfloat; 
     24module rt.typeinfo.ti_Acfloat; 
    2525 
    26 private import typeinfo.ti_cfloat; 
     26private import rt.typeinfo.ti_cfloat; 
    2727 
    2828// cfloat[] 
     
    3030class TypeInfo_Aq : TypeInfo 
    3131{ 
    32     char[] toString() { return "cfloat[]"; } 
     32    override char[] toString() { return "cfloat[]"; } 
    3333 
    34     hash_t getHash(void *p) 
     34    override hash_t getHash(in void* p) 
    3535    {   cfloat[] s = *cast(cfloat[]*)p; 
    3636        size_t len = s.length; 
     
    5050    } 
    5151 
    52     int equals(void *p1, void *p2) 
     52    override equals_t equals(in void* p1, in void* p2) 
    5353    { 
    5454        cfloat[] s1 = *cast(cfloat[]*)p1; 
     
    5757 
    5858        if (len != s2.length) 
    59             return 0
     59            return false
    6060        for (size_t u = 0; u < len; u++) 
    6161        { 
    62             int c = TypeInfo_q._equals(s1[u], s2[u]); 
    63             if (c == 0) 
    64                 return 0; 
     62            if (!TypeInfo_q._equals(s1[u], s2[u])) 
     63                return false; 
    6564        } 
    66         return 1
     65        return true
    6766    } 
    6867 
    69     int compare(void *p1, void *p2) 
     68    override int compare(in void* p1, in void* p2) 
    7069    { 
    7170        cfloat[] s1 = *cast(cfloat[]*)p1; 
     
    8887    } 
    8988 
    90     size_t tsize() 
     89    override size_t tsize() 
    9190    { 
    9291        return (cfloat[]).sizeof; 
    9392    } 
    9493 
    95     uint flags() 
     94    override uint flags() 
    9695    { 
    9796        return 1; 
    9897    } 
    9998 
    100     TypeInfo next() 
     99    override TypeInfo next() 
    101100    { 
    102101        return typeid(cfloat); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Acreal.d

    r4357 r4384  
    2222 */ 
    2323 
    24 module typeinfo.ti_Acreal; 
     24module rt.typeinfo.ti_Acreal; 
    2525 
    26 private import typeinfo.ti_creal; 
     26private import rt.typeinfo.ti_creal; 
    2727 
    2828// creal[] 
     
    3030class TypeInfo_Ac : TypeInfo 
    3131{ 
    32     char[] toString() { return "creal[]"; } 
     32    override char[] toString() { return "creal[]"; } 
    3333 
    34     hash_t getHash(void *p) 
     34    override hash_t getHash(in void* p) 
    3535    {   creal[] s = *cast(creal[]*)p; 
    3636        size_t len = s.length; 
     
    5353    } 
    5454 
    55     int equals(void *p1, void *p2) 
     55    override equals_t equals(in void* p1, in void* p2) 
    5656    { 
    5757        creal[] s1 = *cast(creal[]*)p1; 
     
    6363        for (size_t u = 0; u < len; u++) 
    6464        { 
    65             int c = TypeInfo_c._equals(s1[u], s2[u]); 
    66             if (c == 0) 
    67                 return 0; 
     65            if (!TypeInfo_c._equals(s1[u], s2[u])) 
     66                return false; 
    6867        } 
    69         return 1
     68        return true
    7069    } 
    7170 
    72     int compare(void *p1, void *p2) 
     71    override int compare(in void* p1, in void* p2) 
    7372    { 
    7473        creal[] s1 = *cast(creal[]*)p1; 
     
    9190    } 
    9291 
    93     size_t tsize() 
     92    override size_t tsize() 
    9493    { 
    9594        return (creal[]).sizeof; 
    9695    } 
    9796 
    98     uint flags() 
     97    override uint flags() 
    9998    { 
    10099        return 1; 
    101100    } 
    102101 
    103     TypeInfo next() 
     102    override TypeInfo next() 
    104103    { 
    105104        return typeid(creal); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Adouble.d

    r4357 r4384  
    2222 */ 
    2323 
    24 module typeinfo.ti_Adouble; 
     24module rt.typeinfo.ti_Adouble; 
    2525 
    26 private import typeinfo.ti_double; 
     26private import rt.typeinfo.ti_double; 
    2727 
    2828// double[] 
     
    3030class TypeInfo_Ad : TypeInfo 
    3131{ 
    32     char[] toString() { return "double[]"; } 
     32    override char[] toString() { return "double[]"; } 
    3333 
    34     hash_t getHash(void *p) 
     34    override hash_t getHash(in void* p) 
    3535    {   double[] s = *cast(double[]*)p; 
    3636        size_t len = s.length; 
     
    5050    } 
    5151 
    52     int equals(void *p1, void *p2) 
     52    override equals_t equals(in void* p1, in void* p2) 
    5353    { 
    5454        double[] s1 = *cast(double[]*)p1; 
     
    6060        for (size_t u = 0; u < len; u++) 
    6161        { 
    62             int c = TypeInfo_d._equals(s1[u], s2[u]); 
    63             if (c == 0) 
    64                 return 0; 
     62            if (!TypeInfo_d._equals(s1[u], s2[u])) 
     63                return false; 
    6564        } 
    66         return 1
     65        return true
    6766    } 
    6867 
    69     int compare(void *p1, void *p2) 
     68    override int compare(in void* p1, in void* p2) 
    7069    { 
    7170        double[] s1 = *cast(double[]*)p1; 
     
    8887    } 
    8988 
    90     size_t tsize() 
     89    override size_t tsize() 
    9190    { 
    9291        return (double[]).sizeof; 
    9392    } 
    9493 
    95     uint flags() 
     94    override uint flags() 
    9695    { 
    9796        return 1; 
    9897    } 
    9998 
    100     TypeInfo next() 
     99    override TypeInfo next() 
    101100    { 
    102101        return typeid(double); 
     
    110109    char[] toString() { return "idouble[]"; } 
    111110 
    112     TypeInfo next() 
     111    override TypeInfo next() 
    113112    { 
    114113        return typeid(idouble); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Afloat.d

    r4357 r4384  
    2222 */ 
    2323 
    24 module typeinfo.ti_Afloat; 
     24module rt.typeinfo.ti_Afloat; 
    2525 
    26 private import typeinfo.ti_float; 
     26private import rt.typeinfo.ti_float; 
    2727 
    2828// float[] 
     
    3030class TypeInfo_Af : TypeInfo 
    3131{ 
    32     char[] toString() { return "float[]"; } 
     32    override char[] toString() { return "float[]"; } 
    3333 
    34     hash_t getHash(void *p) 
     34    override hash_t getHash(in void* p) 
    3535    {   float[] s = *cast(float[]*)p; 
    3636        size_t len = s.length; 
     
    4949    } 
    5050 
    51     int equals(void *p1, void *p2) 
     51    override equals_t equals(in void* p1, in void* p2) 
    5252    { 
    5353        float[] s1 = *cast(float[]*)p1; 
     
    5959        for (size_t u = 0; u < len; u++) 
    6060        { 
    61             int c = TypeInfo_f._equals(s1[u], s2[u]); 
    62             if (c == 0) 
    63                 return 0; 
     61            if (!TypeInfo_f._equals(s1[u], s2[u])) 
     62                return false; 
    6463        } 
    65         return 1
     64        return true
    6665    } 
    6766 
    68     int compare(void *p1, void *p2) 
     67    override int compare(in void* p1, in void* p2) 
    6968    { 
    7069        float[] s1 = *cast(float[]*)p1; 
     
    8786    } 
    8887 
    89     size_t tsize() 
     88    override size_t tsize() 
    9089    { 
    9190        return (float[]).sizeof; 
    9291    } 
    9392 
    94     uint flags() 
     93    override uint flags() 
    9594    { 
    9695        return 1; 
    9796    } 
    9897 
    99     TypeInfo next() 
     98    override TypeInfo next() 
    10099    { 
    101100        return typeid(float); 
     
    107106class TypeInfo_Ao : TypeInfo_Af 
    108107{ 
    109     char[] toString() { return "ifloat[]"; } 
     108    override char[] toString() { return "ifloat[]"; } 
    110109 
    111     TypeInfo next() 
     110    override TypeInfo next() 
    112111    { 
    113112        return typeid(ifloat); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Ag.d

    r4357 r4384  
    11 
    2 module typeinfo.ti_Ag; 
     2module rt.typeinfo.ti_Ag; 
    33 
    44private import tango.stdc.string; 
    5 private import util.string; 
     5private import rt.util.string; 
    66 
    77// byte[] 
     
    99class TypeInfo_Ag : TypeInfo 
    1010{ 
    11     char[] toString() { return "byte[]"; } 
    12  
    13     hash_t getHash(void *p) 
     11    override char[] toString() { return "byte[]"; } 
     12 
     13    override hash_t getHash(in void* p) 
    1414    {   byte[] s = *cast(byte[]*)p; 
    1515        size_t len = s.length; 
     
    5252    } 
    5353 
    54     int equals(void *p1, void *p2) 
     54    override equals_t equals(in void* p1, in void* p2) 
    5555    { 
    5656        byte[] s1 = *cast(byte[]*)p1; 
     
    6161    } 
    6262 
    63     int compare(void *p1, void *p2) 
     63    override int compare(in void* p1, in void* p2) 
    6464    { 
    6565        byte[] s1 = *cast(byte[]*)p1; 
     
    8282    } 
    8383 
    84     size_t tsize() 
     84    override size_t tsize() 
    8585    { 
    8686        return (byte[]).sizeof; 
    8787    } 
    8888 
    89     uint flags() 
     89    override uint flags() 
    9090    { 
    9191        return 1; 
    9292    } 
    9393 
    94     TypeInfo next() 
     94    override TypeInfo next() 
    9595    { 
    9696        return typeid(byte); 
     
    103103class TypeInfo_Ah : TypeInfo_Ag 
    104104{ 
    105     char[] toString() { return "ubyte[]"; } 
    106  
    107     int compare(void *p1, void *p2) 
     105    override char[] toString() { return "ubyte[]"; } 
     106 
     107    override int compare(in void* p1, in void* p2) 
    108108    { 
    109109        char[] s1 = *cast(char[]*)p1; 
     
    113113    } 
    114114 
    115     TypeInfo next() 
     115    override TypeInfo next() 
    116116    { 
    117117        return typeid(ubyte); 
     
    123123class TypeInfo_Av : TypeInfo_Ah 
    124124{ 
    125     char[] toString() { return "void[]"; } 
    126  
    127     TypeInfo next() 
     125    override char[] toString() { return "void[]"; } 
     126 
     127    override TypeInfo next() 
    128128    { 
    129129        return typeid(void); 
     
    135135class TypeInfo_Ab : TypeInfo_Ah 
    136136{ 
    137     char[] toString() { return "bool[]"; } 
    138  
    139     TypeInfo next() 
     137    override char[] toString() { return "bool[]"; } 
     138 
     139    override TypeInfo next() 
    140140    { 
    141141        return typeid(bool); 
     
    147147class TypeInfo_Aa : TypeInfo_Ag 
    148148{ 
    149     char[] toString() { return "char[]"; } 
    150  
    151     hash_t getHash(void *p) 
     149    override char[] toString() { return "char[]"; } 
     150 
     151    override hash_t getHash(in void* p) 
    152152    {   char[] s = *cast(char[]*)p; 
    153153        hash_t hash = 0; 
     
    198198    } 
    199199 
    200     TypeInfo next() 
     200    override TypeInfo next() 
    201201    { 
    202202        return typeid(char); 
    203203    } 
    204204} 
    205  
    206  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Aint.d

    r4357 r4384  
    11 
    2 module typeinfo.ti_Aint; 
     2module rt.typeinfo.ti_Aint; 
    33 
    44private import tango.stdc.string; 
     
    88class TypeInfo_Ai : TypeInfo 
    99{ 
    10     char[] toString() { return "int[]"; } 
     10    override char[] toString() { return "int[]"; } 
    1111 
    12     hash_t getHash(void *p) 
     12    override hash_t getHash(in void* p) 
    1313    {   int[] s = *cast(int[]*)p; 
    1414        auto len = s.length; 
     
    2727    } 
    2828 
    29     int equals(void *p1, void *p2) 
     29    override equals_t equals(in void* p1, in void* p2) 
    3030    { 
    3131        int[] s1 = *cast(int[]*)p1; 
     
    3636    } 
    3737 
    38     int compare(void *p1, void *p2) 
     38    override int compare(in void* p1, in void* p2) 
    3939    { 
    4040        int[] s1 = *cast(int[]*)p1; 
     
    5757    } 
    5858 
    59     size_t tsize() 
     59    override size_t tsize() 
    6060    { 
    6161        return (int[]).sizeof; 
    6262    } 
    6363 
    64     uint flags() 
     64    override uint flags() 
    6565    { 
    6666        return 1; 
    6767    } 
    6868 
    69     TypeInfo next() 
     69    override TypeInfo next() 
    7070    { 
    7171        return typeid(int); 
    7272    } 
     73} 
     74 
     75unittest 
     76{ 
     77    int[][] a = [[5,3,8,7], [2,5,3,8,7]]; 
     78    a.sort; 
     79    assert(a == [[2,5,3,8,7], [5,3,8,7]]); 
     80 
     81    a = [[5,3,8,7], [5,3,8]]; 
     82    a.sort; 
     83    assert(a == [[5,3,8], [5,3,8,7]]); 
    7384} 
    7485 
     
    7788class TypeInfo_Ak : TypeInfo_Ai 
    7889{ 
    79     char[] toString() { return "uint[]"; } 
     90    override char[] toString() { return "uint[]"; } 
    8091 
    81     int compare(void *p1, void *p2) 
     92    override int compare(in void* p1, in void* p2) 
    8293    { 
    8394        uint[] s1 = *cast(uint[]*)p1; 
     
    100111    } 
    101112 
    102     TypeInfo next() 
     113    override TypeInfo next() 
    103114    { 
    104115        return typeid(uint); 
     
    110121class TypeInfo_Aw : TypeInfo_Ak 
    111122{ 
    112     char[] toString() { return "dchar[]"; } 
     123    override char[] toString() { return "dchar[]"; } 
    113124 
    114     TypeInfo next() 
     125    override TypeInfo next() 
    115126    { 
    116127        return typeid(dchar); 
    117128    } 
    118129} 
    119  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Along.d

    r4357 r4384  
    11 
    2 module typeinfo.ti_Along; 
     2module rt.typeinfo.ti_Along; 
    33 
    44private import tango.stdc.string; 
     
    88class TypeInfo_Al : TypeInfo 
    99{ 
    10     char[] toString() { return "long[]"; } 
     10    override char[] toString() { return "long[]"; } 
    1111 
    12     hash_t getHash(void *p) 
     12    override hash_t getHash(in void* p) 
    1313    {   long[] s = *cast(long[]*)p; 
    1414        size_t len = s.length; 
     
    2727    } 
    2828 
    29     int equals(void *p1, void *p2) 
     29    override equals_t equals(in void* p1, in void* p2) 
    3030    { 
    3131        long[] s1 = *cast(long[]*)p1; 
     
    3636    } 
    3737 
    38     int compare(void *p1, void *p2) 
     38    override int compare(in void* p1, in void* p2) 
    3939    { 
    4040        long[] s1 = *cast(long[]*)p1; 
     
    5858    } 
    5959 
    60     size_t tsize() 
     60    override size_t tsize() 
    6161    { 
    6262        return (long[]).sizeof; 
    6363    } 
    6464 
    65     uint flags() 
     65    override uint flags() 
    6666    { 
    6767        return 1; 
    6868    } 
    6969 
    70     TypeInfo next() 
     70    override TypeInfo next() 
    7171    { 
    7272        return typeid(long); 
     
    7979class TypeInfo_Am : TypeInfo_Al 
    8080{ 
    81     char[] toString() { return "ulong[]"; } 
     81    override char[] toString() { return "ulong[]"; } 
    8282 
    83     int compare(void *p1, void *p2) 
     83    override int compare(in void* p1, in void* p2) 
    8484    { 
    8585        ulong[] s1 = *cast(ulong[]*)p1; 
     
    103103    } 
    104104 
    105     TypeInfo next() 
     105    override TypeInfo next() 
    106106    { 
    107107        return typeid(ulong); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Areal.d

    r4357 r4384  
    2222 */ 
    2323 
    24 module typeinfo.ti_Areal; 
     24module rt.typeinfo.ti_Areal; 
    2525 
    26 private import typeinfo.ti_real; 
     26private import rt.typeinfo.ti_real; 
    2727 
    2828// real[] 
     
    3030class TypeInfo_Ae : TypeInfo 
    3131{ 
    32     char[] toString() { return "real[]"; } 
     32    override char[] toString() { return "real[]"; } 
    3333 
    34     hash_t getHash(void *p) 
     34    override hash_t getHash(in void* p) 
    3535    {   real[] s = *cast(real[]*)p; 
    3636        size_t len = s.length; 
     
    5151    } 
    5252 
    53     int equals(void *p1, void *p2) 
     53    override equals_t equals(in void* p1, in void* p2) 
    5454    { 
    5555        real[] s1 = *cast(real[]*)p1; 
     
    5858 
    5959        if (len != s2.length) 
    60             return 0
     60            return false
    6161        for (size_t u = 0; u < len; u++) 
    6262        { 
    63             int c = TypeInfo_e._equals(s1[u], s2[u]); 
    64             if (c == 0) 
    65                 return 0; 
     63            if (!TypeInfo_e._equals(s1[u], s2[u])) 
     64                return false; 
    6665        } 
    67         return 1
     66        return true
    6867    } 
    6968 
    70     int compare(void *p1, void *p2) 
     69    override int compare(in void* p1, in void* p2) 
    7170    { 
    7271        real[] s1 = *cast(real[]*)p1; 
     
    8988    } 
    9089 
    91     size_t tsize() 
     90    override size_t tsize() 
    9291    { 
    9392        return (real[]).sizeof; 
    9493    } 
    9594 
    96     uint flags() 
     95    override uint flags() 
    9796    { 
    9897        return 1; 
    9998    } 
    10099 
    101     TypeInfo next() 
     100    override TypeInfo next() 
    102101    { 
    103102        return typeid(real); 
     
    109108class TypeInfo_Aj : TypeInfo_Ae 
    110109{ 
    111     char[] toString() { return "ireal[]"; } 
     110    override char[] toString() { return "ireal[]"; } 
    112111 
    113     TypeInfo next() 
     112    override TypeInfo next() 
    114113    { 
    115114        return typeid(ireal); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_Ashort.d

    r4357 r4384  
    11 
    2 module typeinfo.ti_Ashort; 
     2module rt.typeinfo.ti_Ashort; 
    33 
    44private import tango.stdc.string; 
     
    88class TypeInfo_As : TypeInfo 
    99{ 
    10     char[] toString() { return "short[]"; } 
     10    override char[] toString() { return "short[]"; } 
    1111 
    12     hash_t getHash(void *p) 
     12    override hash_t getHash(in void* p) 
    1313    {   short[] s = *cast(short[]*)p; 
    1414        size_t len = s.length; 
     
    4040    } 
    4141 
    42     int equals(void *p1, void *p2) 
     42    override equals_t equals(in void* p1, in void* p2) 
    4343    { 
    4444        short[] s1 = *cast(short[]*)p1; 
     
    4949    } 
    5050 
    51     int compare(void *p1, void *p2) 
     51    override int compare(in void* p1, in void* p2) 
    5252    { 
    5353        short[] s1 = *cast(short[]*)p1; 
     
    7070    } 
    7171 
    72     size_t tsize() 
     72    override size_t tsize() 
    7373    { 
    7474        return (short[]).sizeof; 
    7575    } 
    7676 
    77     uint flags() 
     77    override uint flags() 
    7878    { 
    7979        return 1; 
    8080    } 
    8181 
    82     TypeInfo next() 
     82    override TypeInfo next() 
    8383    { 
    8484        return typeid(short); 
     
    9191class TypeInfo_At : TypeInfo_As 
    9292{ 
    93     char[] toString() { return "ushort[]"; } 
     93    override char[] toString() { return "ushort[]"; } 
    9494 
    95     int compare(void *p1, void *p2) 
     95    override int compare(in void* p1, in void* p2) 
    9696    { 
    9797        ushort[] s1 = *cast(ushort[]*)p1; 
     
    114114    } 
    115115 
    116     TypeInfo next() 
     116    override TypeInfo next() 
    117117    { 
    118118        return typeid(ushort); 
     
    124124class TypeInfo_Au : TypeInfo_At 
    125125{ 
    126     char[] toString() { return "wchar[]"; } 
     126    override char[] toString() { return "wchar[]"; } 
    127127 
    128     TypeInfo next() 
     128    override TypeInfo next() 
    129129    { 
    130130        return typeid(wchar); 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_C.d

    r4357 r4384  
    2222 */ 
    2323 
    24 module typeinfo.ti_C; 
     24module rt.typeinfo.ti_C; 
    2525 
    2626// Object 
     
    2828class TypeInfo_C : TypeInfo 
    2929{ 
    30     hash_t getHash(void *p) 
     30    override hash_t getHash(in void* p) 
    3131    { 
    3232        Object o = *cast(Object*)p; 
     
    3434    } 
    3535 
    36     int equals(void *p1, void *p2) 
     36    override equals_t equals(in void* p1, in void* p2) 
    3737    { 
    3838        Object o1 = *cast(Object*)p1; 
     
    4242    } 
    4343 
    44     int compare(void *p1, void *p2) 
     44    override int compare(in void* p1, in void* p2) 
    4545    { 
    4646        Object o1 = *cast(Object*)p1; 
     
    6363    } 
    6464 
    65     size_t tsize() 
     65    override size_t tsize() 
    6666    { 
    6767        return Object.sizeof; 
    6868    } 
    6969 
    70     uint flags() 
     70    override uint flags() 
    7171    { 
    7272        return 1; 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_byte.d

    r4357 r4384  
    22// byte 
    33 
    4 module typeinfo.ti_byte; 
     4module rt.typeinfo.ti_byte; 
    55 
    66class TypeInfo_g : TypeInfo 
    77{ 
    8     char[] toString() { return "byte"; } 
     8    override char[] toString() { return "byte"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    12    return *cast(byte *)p; 
     12        return *cast(byte *)p; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    17    return *cast(byte *)p1 == *cast(byte *)p2; 
     17        return *cast(byte *)p1 == *cast(byte *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    22    return *cast(byte *)p1 - *cast(byte *)p2; 
     22        return *cast(byte *)p1 - *cast(byte *)p2; 
    2323    } 
    2424 
    25     size_t tsize() 
     25    override size_t tsize() 
    2626    { 
    27    return byte.sizeof; 
     27        return byte.sizeof; 
    2828    } 
    2929 
    30     void swap(void *p1, void *p2) 
     30    override void swap(void *p1, void *p2) 
    3131    { 
    32    byte t; 
     32        byte t; 
    3333 
    34    t = *cast(byte *)p1; 
    35    *cast(byte *)p1 = *cast(byte *)p2; 
    36    *cast(byte *)p2 = t; 
     34        t = *cast(byte *)p1; 
     35        *cast(byte *)p1 = *cast(byte *)p2; 
     36        *cast(byte *)p2 = t; 
    3737    } 
    3838} 
    39  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_cdouble.d

    r4357 r4384  
    22// cdouble 
    33 
    4 module typeinfo.ti_cdouble; 
     4module rt.typeinfo.ti_cdouble; 
    55 
    66class TypeInfo_r : TypeInfo 
    77{ 
    8     char[] toString() { return "cdouble"; } 
     8    override char[] toString() { return "cdouble"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        return (cast(uint *)p)[0] + (cast(uint *)p)[1] + 
     
    1414    } 
    1515 
    16     static int _equals(cdouble f1, cdouble f2) 
     16    static equals_t _equals(cdouble f1, cdouble f2) 
    1717    { 
    1818        return f1 == f2; 
     
    3535    } 
    3636 
    37     int equals(void *p1, void *p2) 
     37    override equals_t equals(in void* p1, in void* p2) 
    3838    { 
    3939        return _equals(*cast(cdouble *)p1, *cast(cdouble *)p2); 
    4040    } 
    4141 
    42     int compare(void *p1, void *p2) 
     42    override int compare(in void* p1, in void* p2) 
    4343    { 
    4444        return _compare(*cast(cdouble *)p1, *cast(cdouble *)p2); 
    4545    } 
    4646 
    47     size_t tsize() 
     47    override size_t tsize() 
    4848    { 
    4949        return cdouble.sizeof; 
    5050    } 
    5151 
    52     void swap(void *p1, void *p2) 
     52    override void swap(void *p1, void *p2) 
    5353    { 
    5454        cdouble t; 
     
    5959    } 
    6060 
    61     void[] init() 
     61    override void[] init() 
    6262    {   static cdouble r; 
    6363 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_cfloat.d

    r4357 r4384  
    22// cfloat 
    33 
    4 module typeinfo.ti_cfloat; 
     4module rt.typeinfo.ti_cfloat; 
    55 
    66class TypeInfo_q : TypeInfo 
    77{ 
    8     char[] toString() { return "cfloat"; } 
     8    override char[] toString() { return "cfloat"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        return (cast(uint *)p)[0] + (cast(uint *)p)[1]; 
    1313    } 
    1414 
    15     static int _equals(cfloat f1, cfloat f2) 
     15    static equals_t _equals(cfloat f1, cfloat f2) 
    1616    { 
    1717        return f1 == f2; 
     
    3434    } 
    3535 
    36     int equals(void *p1, void *p2) 
     36    override equals_t equals(in void* p1, in void* p2) 
    3737    { 
    3838        return _equals(*cast(cfloat *)p1, *cast(cfloat *)p2); 
    3939    } 
    4040 
    41     int compare(void *p1, void *p2) 
     41    override int compare(in void* p1, in void* p2) 
    4242    { 
    4343        return _compare(*cast(cfloat *)p1, *cast(cfloat *)p2); 
    4444    } 
    4545 
    46     size_t tsize() 
     46    override size_t tsize() 
    4747    { 
    4848        return cfloat.sizeof; 
    4949    } 
    5050 
    51     void swap(void *p1, void *p2) 
     51    override void swap(void *p1, void *p2) 
    5252    { 
    5353        cfloat t; 
     
    5858    } 
    5959 
    60     void[] init() 
     60    override void[] init() 
    6161    {   static cfloat r; 
    6262 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_char.d

    r4357 r4384  
    11 
    2 module typeinfo.ti_char; 
     2module rt.typeinfo.ti_char; 
    33 
    44class TypeInfo_a : TypeInfo 
    55{ 
    6     char[] toString() { return "char"; } 
     6    override char[] toString() { return "char"; } 
    77 
    8     hash_t getHash(void *p) 
     8    override hash_t getHash(in void* p) 
    99    { 
    1010        return *cast(char *)p; 
    1111    } 
    1212 
    13     int equals(void *p1, void *p2) 
     13    override equals_t equals(in void* p1, in void* p2) 
    1414    { 
    1515        return *cast(char *)p1 == *cast(char *)p2; 
    1616    } 
    1717 
    18     int compare(void *p1, void *p2) 
     18    override int compare(in void* p1, in void* p2) 
    1919    { 
    2020        return *cast(char *)p1 - *cast(char *)p2; 
    2121    } 
    2222 
    23     size_t tsize() 
     23    override size_t tsize() 
    2424    { 
    2525        return char.sizeof; 
    2626    } 
    2727 
    28     void swap(void *p1, void *p2) 
     28    override void swap(void *p1, void *p2) 
    2929    { 
    3030        char t; 
     
    3535    } 
    3636 
    37     void[] init() 
     37    override void[] init() 
    3838    {   static char c; 
    3939 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_creal.d

    r4357 r4384  
    22// creal 
    33 
    4 module typeinfo.ti_creal; 
     4module rt.typeinfo.ti_creal; 
    55 
    66class TypeInfo_c : TypeInfo 
    77{ 
    8     char[] toString() { return "creal"; } 
     8    override char[] toString() { return "creal"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        return (cast(uint *)p)[0] + (cast(uint *)p)[1] + 
     
    1515    } 
    1616 
    17     static int _equals(creal f1, creal f2) 
     17    static equals_t _equals(creal f1, creal f2) 
    1818    { 
    1919        return f1 == f2; 
     
    3636    } 
    3737 
    38     int equals(void *p1, void *p2) 
     38    override equals_t equals(in void* p1, in void* p2) 
    3939    { 
    4040        return _equals(*cast(creal *)p1, *cast(creal *)p2); 
    4141    } 
    4242 
    43     int compare(void *p1, void *p2) 
     43    override int compare(in void* p1, in void* p2) 
    4444    { 
    4545        return _compare(*cast(creal *)p1, *cast(creal *)p2); 
    4646    } 
    4747 
    48     size_t tsize() 
     48    override size_t tsize() 
    4949    { 
    5050        return creal.sizeof; 
    5151    } 
    5252 
    53     void swap(void *p1, void *p2) 
     53    override void swap(void *p1, void *p2) 
    5454    { 
    5555        creal t; 
     
    6060    } 
    6161 
    62     void[] init() 
     62    override void[] init() 
    6363    {   static creal r; 
    6464 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_dchar.d

    r4357 r4384  
    22// dchar 
    33 
    4 module typeinfo.ti_dchar; 
     4module rt.typeinfo.ti_dchar; 
    55 
    66class TypeInfo_w : TypeInfo 
    77{ 
    8     char[] toString() { return "dchar"; } 
     8    override char[] toString() { return "dchar"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        return *cast(dchar *)p; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    1717        return *cast(dchar *)p1 == *cast(dchar *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    2222        return *cast(dchar *)p1 - *cast(dchar *)p2; 
    2323    } 
    2424 
    25     size_t tsize() 
     25    override size_t tsize() 
    2626    { 
    2727        return dchar.sizeof; 
    2828    } 
    2929 
    30     void swap(void *p1, void *p2) 
     30    override void swap(void *p1, void *p2) 
    3131    { 
    3232        dchar t; 
     
    3737    } 
    3838 
    39     void[] init() 
     39    override void[] init() 
    4040    {   static dchar c; 
    4141 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_delegate.d

    r4357 r4384  
    22// delegate 
    33 
    4 module typeinfo.ti_delegate; 
     4module rt.typeinfo.ti_delegate; 
    55 
    66alias void delegate(int) dg; 
     
    88class TypeInfo_D : TypeInfo 
    99{ 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    {   long l = *cast(long *)p; 
    1212 
     
    1414    } 
    1515 
    16     int equals(void *p1, void *p2) 
     16    override equals_t equals(in void* p1, in void* p2) 
    1717    { 
    1818        return *cast(dg *)p1 == *cast(dg *)p2; 
    1919    } 
    2020 
    21     size_t tsize() 
     21    override size_t tsize() 
    2222    { 
    2323        return dg.sizeof; 
    2424    } 
    2525 
    26     void swap(void *p1, void *p2) 
     26    override void swap(void *p1, void *p2) 
    2727    { 
    2828        dg t; 
     
    3333    } 
    3434 
    35     uint flags() 
     35    override uint flags() 
    3636    { 
    3737        return 1; 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_double.d

    r4357 r4384  
    22// double 
    33 
    4 module typeinfo.ti_double; 
     4module rt.typeinfo.ti_double; 
    55 
    66class TypeInfo_d : TypeInfo 
    77{ 
    8     char[] toString() { return "double"; } 
     8    override char[] toString() { return "double"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        return (cast(uint *)p)[0] + (cast(uint *)p)[1]; 
    1313    } 
    1414 
    15     static int _equals(double f1, double f2) 
     15    static equals_t _equals(double f1, double f2) 
    1616    { 
    1717        return f1 == f2 || 
     
    3333    } 
    3434 
    35     int equals(void *p1, void *p2) 
     35    override equals_t equals(in void* p1, in void* p2) 
    3636    { 
    3737        return _equals(*cast(double *)p1, *cast(double *)p2); 
    3838    } 
    3939 
    40     int compare(void *p1, void *p2) 
     40    override int compare(in void* p1, in void* p2) 
    4141    { 
    4242        return _compare(*cast(double *)p1, *cast(double *)p2); 
    4343    } 
    4444 
    45     size_t tsize() 
     45    override size_t tsize() 
    4646    { 
    4747        return double.sizeof; 
    4848    } 
    4949 
    50     void swap(void *p1, void *p2) 
     50    override void swap(void *p1, void *p2) 
    5151    { 
    5252        double t; 
     
    5757    } 
    5858 
    59     void[] init() 
     59    override void[] init() 
    6060    {   static double r; 
    6161 
     
    6363    } 
    6464} 
    65  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_float.d

    r4357 r4384  
    22// float 
    33 
    4 module typeinfo.ti_float; 
     4module rt.typeinfo.ti_float; 
    55 
    66class TypeInfo_f : TypeInfo 
    77{ 
    8     char[] toString() { return "float"; } 
     8    override char[] toString() { return "float"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        return *cast(uint *)p; 
    1313    } 
    1414 
    15     static int _equals(float f1, float f2) 
     15    static equals_t _equals(float f1, float f2) 
    1616    { 
    1717        return f1 == f2 || 
     
    3333    } 
    3434 
    35     int equals(void *p1, void *p2) 
     35    override equals_t equals(in void* p1, in void* p2) 
    3636    { 
    3737        return _equals(*cast(float *)p1, *cast(float *)p2); 
    3838    } 
    3939 
    40     int compare(void *p1, void *p2) 
     40    override int compare(in void* p1, in void* p2) 
    4141    { 
    4242        return _compare(*cast(float *)p1, *cast(float *)p2); 
    4343    } 
    4444 
    45     size_t tsize() 
     45    override size_t tsize() 
    4646    { 
    4747        return float.sizeof; 
    4848    } 
    4949 
    50     void swap(void *p1, void *p2) 
     50    override void swap(void *p1, void *p2) 
    5151    { 
    5252        float t; 
     
    5757    } 
    5858 
    59     void[] init() 
     59    override void[] init() 
    6060    {   static float r; 
    6161 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_idouble.d

    r4357 r4384  
    22// idouble 
    33 
    4 module typeinfo.ti_idouble; 
     4module rt.typeinfo.ti_idouble; 
    55 
    6 private import typeinfo.ti_double; 
     6private import rt.typeinfo.ti_double; 
    77 
    88class TypeInfo_p : TypeInfo_d 
    99{ 
    10     char[] toString() { return "idouble"; } 
     10    override char[] toString() { return "idouble"; } 
    1111} 
    12  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_ifloat.d

    r4357 r4384  
    22// ifloat 
    33 
    4 module typeinfo.ti_ifloat; 
     4module rt.typeinfo.ti_ifloat; 
    55 
    6 private import typeinfo.ti_float; 
     6private import rt.typeinfo.ti_float; 
    77 
    88class TypeInfo_o : TypeInfo_f 
    99{ 
    10     char[] toString() { return "ifloat"; } 
     10    override char[] toString() { return "ifloat"; } 
    1111} 
    12  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_int.d

    r4357 r4384  
    22// int 
    33 
    4 module typeinfo.ti_int; 
     4module rt.typeinfo.ti_int; 
    55 
    66class TypeInfo_i : TypeInfo 
    77{ 
    8     char[] toString() { return "int"; } 
     8    override char[] toString() { return "int"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    12    return *cast(uint *)p; 
     12        return *cast(uint *)p; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    17    return *cast(uint *)p1 == *cast(uint *)p2; 
     17        return *cast(uint *)p1 == *cast(uint *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    22    if (*cast(int*) p1 < *cast(int*) p2) 
    23        return -1; 
    24    else if (*cast(int*) p1 > *cast(int*) p2) 
    25        return 1; 
    26    return 0; 
     22        if (*cast(int*) p1 < *cast(int*) p2) 
     23            return -1; 
     24        else if (*cast(int*) p1 > *cast(int*) p2) 
     25            return 1; 
     26        return 0; 
    2727    } 
    2828 
    29     size_t tsize() 
     29    override size_t tsize() 
    3030    { 
    31    return int.sizeof; 
     31        return int.sizeof; 
    3232    } 
    3333 
    34     void swap(void *p1, void *p2) 
     34    override void swap(void *p1, void *p2) 
    3535    { 
    36    int t; 
     36        int t; 
    3737 
    38    t = *cast(int *)p1; 
    39    *cast(int *)p1 = *cast(int *)p2; 
    40    *cast(int *)p2 = t; 
     38        t = *cast(int *)p1; 
     39        *cast(int *)p1 = *cast(int *)p2; 
     40        *cast(int *)p2 = t; 
    4141    } 
    4242} 
    43  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_ireal.d

    r4357 r4384  
    22// ireal 
    33 
    4 module typeinfo.ti_ireal; 
     4module rt.typeinfo.ti_ireal; 
    55 
    6 private import typeinfo.ti_real; 
     6private import rt.typeinfo.ti_real; 
    77 
    88class TypeInfo_j : TypeInfo_e 
    99{ 
    10     char[] toString() { return "ireal"; } 
     10    override char[] toString() { return "ireal"; } 
    1111} 
    12  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_long.d

    r4357 r4384  
    22// long 
    33 
    4 module typeinfo.ti_long; 
     4module rt.typeinfo.ti_long; 
    55 
    66class TypeInfo_l : TypeInfo 
    77{ 
    8     char[] toString() { return "long"; } 
     8    override char[] toString() { return "long"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    12    return *cast(uint *)p + (cast(uint *)p)[1]; 
     12        return *cast(uint *)p + (cast(uint *)p)[1]; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    17    return *cast(long *)p1 == *cast(long *)p2; 
     17        return *cast(long *)p1 == *cast(long *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    22    if (*cast(long *)p1 < *cast(long *)p2) 
    23        return -1; 
    24    else if (*cast(long *)p1 > *cast(long *)p2) 
    25        return 1; 
    26    return 0; 
     22        if (*cast(long *)p1 < *cast(long *)p2) 
     23            return -1; 
     24        else if (*cast(long *)p1 > *cast(long *)p2) 
     25            return 1; 
     26        return 0; 
    2727    } 
    2828 
    29     size_t tsize() 
     29    override size_t tsize() 
    3030    { 
    31    return long.sizeof; 
     31        return long.sizeof; 
    3232    } 
    3333 
    34     void swap(void *p1, void *p2) 
     34    override void swap(void *p1, void *p2) 
    3535    { 
    36    long t; 
     36        long t; 
    3737 
    38    t = *cast(long *)p1; 
    39    *cast(long *)p1 = *cast(long *)p2; 
    40    *cast(long *)p2 = t; 
     38        t = *cast(long *)p1; 
     39        *cast(long *)p1 = *cast(long *)p2; 
     40        *cast(long *)p2 = t; 
    4141    } 
    4242} 
    43  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_ptr.d

    r4357 r4384  
    22// pointer 
    33 
    4 module typeinfo.ti_ptr; 
     4module rt.typeinfo.ti_ptr; 
    55 
    66class TypeInfo_P : TypeInfo 
    77{ 
    8     hash_t getHash(void *p) 
     8    override hash_t getHash(in void* p) 
    99    { 
    1010        return cast(uint)*cast(void* *)p; 
    1111    } 
    1212 
    13     int equals(void *p1, void *p2) 
     13    override equals_t equals(in void* p1, in void* p2) 
    1414    { 
    1515        return *cast(void* *)p1 == *cast(void* *)p2; 
    1616    } 
    1717 
    18     int compare(void *p1, void *p2) 
     18    override int compare(in void* p1, in void* p2) 
    1919    { 
    2020        auto c = *cast(void* *)p1 - *cast(void* *)p2; 
     
    2626    } 
    2727 
    28     size_t tsize() 
     28    override size_t tsize() 
    2929    { 
    3030        return (void*).sizeof; 
    3131    } 
    3232 
    33     void swap(void *p1, void *p2) 
     33    override void swap(void *p1, void *p2) 
    3434    { 
    3535        void* t; 
     
    4040    } 
    4141 
    42     uint flags() 
     42    override uint flags() 
    4343    { 
    4444        return 1; 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_real.d

    r4357 r4384  
    22// real 
    33 
    4 module typeinfo.ti_real; 
     4module rt.typeinfo.ti_real; 
    55 
    66class TypeInfo_e : TypeInfo 
    77{ 
    8     char[] toString() { return "real"; } 
     8    override char[] toString() { return "real"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        return (cast(uint *)p)[0] + (cast(uint *)p)[1] + (cast(ushort *)p)[4]; 
    1313    } 
    1414 
    15     static int _equals(real f1, real f2) 
     15    static equals_t _equals(real f1, real f2) 
    1616    { 
    1717        return f1 == f2 || 
     
    3333    } 
    3434 
    35     int equals(void *p1, void *p2) 
     35    override equals_t equals(in void* p1, in void* p2) 
    3636    { 
    3737        return _equals(*cast(real *)p1, *cast(real *)p2); 
    3838    } 
    3939 
    40     int compare(void *p1, void *p2) 
     40    override int compare(in void* p1, in void* p2) 
    4141    { 
    4242        return _compare(*cast(real *)p1, *cast(real *)p2); 
    4343    } 
    4444 
    45     size_t tsize() 
     45    override size_t tsize() 
    4646    { 
    4747        return real.sizeof; 
    4848    } 
    4949 
    50     void swap(void *p1, void *p2) 
     50    override void swap(void *p1, void *p2) 
    5151    { 
    5252        real t; 
     
    5757    } 
    5858 
    59     void[] init() 
     59    override void[] init() 
    6060    {   static real r; 
    6161 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_short.d

    r4357 r4384  
    22// short 
    33 
    4 module typeinfo.ti_short; 
     4module rt.typeinfo.ti_short; 
    55 
    66class TypeInfo_s : TypeInfo 
    77{ 
    8     char[] toString() { return "short"; } 
     8    override char[] toString() { return "short"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    12    return *cast(short *)p; 
     12        return *cast(short *)p; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    17    return *cast(short *)p1 == *cast(short *)p2; 
     17        return *cast(short *)p1 == *cast(short *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    22    return *cast(short *)p1 - *cast(short *)p2; 
     22        return *cast(short *)p1 - *cast(short *)p2; 
    2323    } 
    2424 
    25     size_t tsize() 
     25    override size_t tsize() 
    2626    { 
    27    return short.sizeof; 
     27        return short.sizeof; 
    2828    } 
    2929 
    30     void swap(void *p1, void *p2) 
     30    override void swap(void *p1, void *p2) 
    3131    { 
    32    short t; 
     32        short t; 
    3333 
    34    t = *cast(short *)p1; 
    35    *cast(short *)p1 = *cast(short *)p2; 
    36    *cast(short *)p2 = t; 
     34        t = *cast(short *)p1; 
     35        *cast(short *)p1 = *cast(short *)p2; 
     36        *cast(short *)p2 = t; 
    3737    } 
    3838} 
    39  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_ubyte.d

    r4357 r4384  
    22// ubyte 
    33 
    4 module typeinfo.ti_ubyte; 
     4module rt.typeinfo.ti_ubyte; 
    55 
    66class TypeInfo_h : TypeInfo 
    77{ 
    8     char[] toString() { return "ubyte"; } 
     8    override char[] toString() { return "ubyte"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        return *cast(ubyte *)p; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    1717        return *cast(ubyte *)p1 == *cast(ubyte *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    2222        return *cast(ubyte *)p1 - *cast(ubyte *)p2; 
    2323    } 
    2424 
    25     size_t tsize() 
     25    override size_t tsize() 
    2626    { 
    2727        return ubyte.sizeof; 
    2828    } 
    2929 
    30     void swap(void *p1, void *p2) 
     30    override void swap(void *p1, void *p2) 
    3131    { 
    3232        ubyte t; 
     
    4040class TypeInfo_b : TypeInfo_h 
    4141{ 
    42     char[] toString() { return "bool"; } 
     42    override char[] toString() { return "bool"; } 
    4343} 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_uint.d

    r4357 r4384  
    22// uint 
    33 
    4 module typeinfo.ti_uint; 
     4module rt.typeinfo.ti_uint; 
    55 
    66class TypeInfo_k : TypeInfo 
    77{ 
    8     char[] toString() { return "uint"; } 
     8    override char[] toString() { return "uint"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    12    return *cast(uint *)p; 
     12        return *cast(uint *)p; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    17    return *cast(uint *)p1 == *cast(uint *)p2; 
     17        return *cast(uint *)p1 == *cast(uint *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    22    if (*cast(uint*) p1 < *cast(uint*) p2) 
    23        return -1; 
    24    else if (*cast(uint*) p1 > *cast(uint*) p2) 
    25        return 1; 
    26    return 0; 
     22        if (*cast(uint*) p1 < *cast(uint*) p2) 
     23            return -1; 
     24        else if (*cast(uint*) p1 > *cast(uint*) p2) 
     25            return 1; 
     26        return 0; 
    2727    } 
    2828 
    29     size_t tsize() 
     29    override size_t tsize() 
    3030    { 
    31    return uint.sizeof; 
     31        return uint.sizeof; 
    3232    } 
    3333 
    34     void swap(void *p1, void *p2) 
     34    override void swap(void *p1, void *p2) 
    3535    { 
    36    int t; 
     36        int t; 
    3737 
    38    t = *cast(uint *)p1; 
    39    *cast(uint *)p1 = *cast(uint *)p2; 
    40    *cast(uint *)p2 = t; 
     38        t = *cast(uint *)p1; 
     39        *cast(uint *)p1 = *cast(uint *)p2; 
     40        *cast(uint *)p2 = t; 
    4141    } 
    4242} 
    43  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_ulong.d

    r4357 r4384  
    22// ulong 
    33 
    4 module typeinfo.ti_ulong; 
     4module rt.typeinfo.ti_ulong; 
    55 
    66class TypeInfo_m : TypeInfo 
    77{ 
    8     char[] toString() { return "ulong"; } 
     8    override char[] toString() { return "ulong"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    12    return *cast(uint *)p + (cast(uint *)p)[1]; 
     12        return *cast(uint *)p + (cast(uint *)p)[1]; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    17    return *cast(ulong *)p1 == *cast(ulong *)p2; 
     17        return *cast(ulong *)p1 == *cast(ulong *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    22    if (*cast(ulong *)p1 < *cast(ulong *)p2) 
    23        return -1; 
    24    else if (*cast(ulong *)p1 > *cast(ulong *)p2) 
    25        return 1; 
    26    return 0; 
     22        if (*cast(ulong *)p1 < *cast(ulong *)p2) 
     23            return -1; 
     24        else if (*cast(ulong *)p1 > *cast(ulong *)p2) 
     25            return 1; 
     26        return 0; 
    2727    } 
    2828 
    29     size_t tsize() 
     29    override size_t tsize() 
    3030    { 
    31    return ulong.sizeof; 
     31        return ulong.sizeof; 
    3232    } 
    3333 
    34     void swap(void *p1, void *p2) 
     34    override void swap(void *p1, void *p2) 
    3535    { 
    36    ulong t; 
     36        ulong t; 
    3737 
    38    t = *cast(ulong *)p1; 
    39    *cast(ulong *)p1 = *cast(ulong *)p2; 
    40    *cast(ulong *)p2 = t; 
     38        t = *cast(ulong *)p1; 
     39        *cast(ulong *)p1 = *cast(ulong *)p2; 
     40        *cast(ulong *)p2 = t; 
    4141    } 
    4242} 
    43  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_ushort.d

    r4357 r4384  
    22// ushort 
    33 
    4 module typeinfo.ti_ushort; 
     4module rt.typeinfo.ti_ushort; 
    55 
    66class TypeInfo_t : TypeInfo 
    77{ 
    8     char[] toString() { return "ushort"; } 
     8    override char[] toString() { return "ushort"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    12    return *cast(ushort *)p; 
     12        return *cast(ushort *)p; 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    17    return *cast(ushort *)p1 == *cast(ushort *)p2; 
     17        return *cast(ushort *)p1 == *cast(ushort *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    22    return *cast(ushort *)p1 - *cast(ushort *)p2; 
     22        return *cast(ushort *)p1 - *cast(ushort *)p2; 
    2323    } 
    2424 
    25     size_t tsize() 
     25    override size_t tsize() 
    2626    { 
    27    return ushort.sizeof; 
     27        return ushort.sizeof; 
    2828    } 
    2929 
    30     void swap(void *p1, void *p2) 
     30    override void swap(void *p1, void *p2) 
    3131    { 
    32    ushort t; 
     32        ushort t; 
    3333 
    34    t = *cast(ushort *)p1; 
    35    *cast(ushort *)p1 = *cast(ushort *)p2; 
    36    *cast(ushort *)p2 = t; 
     34        t = *cast(ushort *)p1; 
     35        *cast(ushort *)p1 = *cast(ushort *)p2; 
     36        *cast(ushort *)p2 = t; 
    3737    } 
    3838} 
    39  
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_void.d

    r4357 r4384  
    22// void 
    33 
    4 module typeinfo.ti_void; 
     4module rt.typeinfo.ti_void; 
    55 
    66class TypeInfo_v : TypeInfo 
    77{ 
    8     char[] toString() { return "void"; } 
     8    override char[] toString() { return "void"; } 
    99 
    10     hash_t getHash(void *p) 
     10    override hash_t getHash(in void* p) 
    1111    { 
    1212        assert(0); 
    1313    } 
    1414 
    15     int equals(void *p1, void *p2) 
     15    override equals_t equals(in void* p1, in void* p2) 
    1616    { 
    1717        return *cast(byte *)p1 == *cast(byte *)p2; 
    1818    } 
    1919 
    20     int compare(void *p1, void *p2) 
     20    override int compare(in void* p1, in void* p2) 
    2121    { 
    2222        return *cast(byte *)p1 - *cast(byte *)p2; 
    2323    } 
    2424 
    25     size_t tsize() 
     25    override size_t tsize() 
    2626    { 
    2727        return void.sizeof; 
    2828    } 
    2929 
    30     void swap(void *p1, void *p2) 
     30    override void swap(void *p1, void *p2) 
    3131    { 
    3232        byte t; 
     
    3737    } 
    3838 
    39     uint flags() 
     39    override uint flags() 
    4040    { 
    4141        return 1; 
  • trunk/lib/compiler/dmd/rt/typeinfo/ti_wchar.d

    r4357 r4384  
    11 
    2 module typeinfo.ti_wchar; 
     2module rt.typeinfo.ti_wchar; 
    33 
    44 
    55class TypeInfo_u : TypeInfo 
    66{ 
    7     char[] toString() { return "wchar"; } 
     7    override char[] toString() { return "wchar"; } 
    88 
    9     hash_t getHash(void *p) 
     9    override hash_t getHash(in void* p) 
    1010    { 
    1111        return *cast(wchar *)p; 
    1212    } 
    1313 
    14     int equals(void *p1, void *p2) 
     14    override equals_t equals(in void* p1, in void* p2) 
    1515    { 
    1616        return *cast(wchar *)p1 == *cast(wchar *)p2; 
    1717    } 
    1818 
    19     int compare(void *p1, void *p2) 
     19    override int compare(in void* p1, in void* p2) 
    2020    { 
    2121        return *cast(wchar *)p1 - *cast(wchar *)p2; 
    2222    } 
    2323 
    24     size_t tsize() 
     24    override size_t tsize() 
    2525    { 
    2626        return wchar.sizeof; 
    2727    } 
    2828 
    29     void swap(void *p1, void *p2) 
     29    override void swap(void *p1, void *p2) 
    3030    { 
    3131        wchar t; 
     
    3636    } 
    3737 
    38     void[] init() 
     38    override void[] init() 
    3939    {   static wchar c; 
    4040 
  • trunk/lib/compiler/dmd/rt/util/console.d

    r4357 r4384  
    1212*******************************************************************************/ 
    1313 
    14 module util.console; 
     14module rt.util.console; 
    1515 
    16 private import util.string; 
     16private import rt.util.string; 
    1717 
    18 version (Win32) 
    19         { 
     18version (Win32) { 
    2019        private extern (Windows) int GetStdHandle (int); 
    2120        private extern (Windows) int WriteFile (int, char*, int, int*, void*); 
    22         } 
    23  
    24 else 
    25  
    26 version (Posix) 
    27         { 
    28         private extern (C) int write (int, void*, int); 
    29         } 
    30  
    31 /+ 
    32 // emit a char[] to the console. Note that Win32 does not handle utf8, but 
    33 // then neither does fprintf (stderr). This will handle redirection though. 
    34 // May need to remedy the utf8 issue 
    35 int console (char[] s) 
    36 
    37         version (Win32) 
    38                 { 
    39                 int count; 
    40                 if (WriteFile (GetStdHandle(0xfffffff5), s.ptr, s.length, &count, null)) 
    41                     return count; 
    42                 return -1; 
    43                 } 
    44         else 
    45         version (Posix) 
    46                 { 
    47                 return write (2, s.ptr, s.length); 
    48                 } 
     21} else version (Posix){ 
     22    import tango.stdc.posix.unistd; 
    4923} 
    50  
    51 // emit an integer to the console 
    52 int console (uint i) 
    53 { 
    54         char[10] tmp = void; 
    55  
    56         return console (intToUtf8 (tmp, i)); 
    57 } 
    58 +/ 
    5924 
    6025struct Console 
  • trunk/lib/compiler/dmd/rt/util/cpuid.d

    r4357 r4384  
    3939 */ 
    4040 
    41 module util.cpuid; 
     41module rt.util.cpuid; 
    4242 
    4343private import tango.stdc.string : strlen; 
  • trunk/lib/compiler/dmd/rt/util/ctype.d

    r4357 r4384  
    2525// Simple ASCII char classification functions 
    2626 
    27 module util.ctype; 
     27module rt.util.ctype; 
    2828 
    2929int isalnum(dchar c)  { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG) : 0; } 
  • trunk/lib/compiler/dmd/rt/util/string.d

    r4357 r4384  
    1212*******************************************************************************/ 
    1313 
    14 module util.string; 
     14module rt.util.string; 
    1515 
    1616private import tango.stdc.string; 
     
    4545 
    4646    if (result == 0) 
    47         result = cast(int)s1.length - cast(int)s2.length
     47        result = (s1.length<s2.length)?-1:((s1.length==s2.length)?0:1)
    4848 
    4949    return result; 
  • trunk/lib/compiler/dmd/rt/util/utf.d

    r4357 r4384  
    1 // utf.d 
     1// Written in the D programming language 
    22 
    33/* 
     
    2323 */ 
    2424 
    25 // Description of UTF-8 at: 
    26 // http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 
    27 // http://anubis.dkuug.dk/JTC1/SC2/WG2/docs/n1335 
    28  
    29  
    30 module util.utf; 
     25/******************************************** 
     26 * Encode and decode UTF-8, UTF-16 and UTF-32 strings. 
     27 * 
     28 * For Win32 systems, the C wchar_t type is UTF-16 and corresponds to the D 
     29 * wchar type. 
     30 * For linux systems, the C wchar_t type is UTF-32 and corresponds to 
     31 * the D utf.dchar type. 
     32 * 
     33 * UTF character support is restricted to (\u0000 &lt;= character &lt;= \U0010FFFF). 
     34 * 
     35 * See_Also: 
     36 *  $(LINK2 http://en.wikipedia.org/wiki/Unicode, Wikipedia)<br> 
     37 *  $(LINK http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8)<br> 
     38 *  $(LINK http://anubis.dkuug.dk/JTC1/SC2/WG2/docs/n1335) 
     39 * Macros: 
     40 *  WIKI = Phobos/StdUtf 
     41 */ 
     42 
     43module rt.util.utf; 
     44 
    3145 
    3246 
    3347extern (C) void onUnicodeError( char[] msg, size_t idx ); 
     48/******************************* 
     49 * Test if c is a valid UTF-32 character. 
     50 * 
     51 * \uFFFE and \uFFFF are considered valid by this function, 
     52 * as they are permitted for internal use by an application, 
     53 * but they are not allowed for interchange by the Unicode standard. 
     54 * 
     55 * Returns: true if it is, false if not. 
     56 */ 
    3457 
    3558 
     
    80103]; 
    81104 
    82 uint stride(char[] s, size_t i) 
     105/** 
     106 * stride() returns the length of a UTF-8 sequence starting at index i 
     107 * in string s. 
     108 * Returns: 
     109 *  The number of bytes in the UTF-8 sequence or 
     110 *  0xFF meaning s[i] is not the start of of UTF-8 sequence. 
     111 */ 
     112uint stride(in char[] s, size_t i) 
    83113{ 
    84114    return UTF8stride[s[i]]; 
    85115} 
    86116 
    87 uint stride(wchar[] s, size_t i) 
     117/** 
     118 * stride() returns the length of a UTF-16 sequence starting at index i 
     119 * in string s. 
     120 */ 
     121uint stride(in wchar[] s, size_t i) 
    88122{   uint u = s[i]; 
    89123    return 1 + (u >= 0xD800 && u <= 0xDBFF); 
    90124} 
    91125 
    92 uint stride(dchar[] s, size_t i) 
     126/** 
     127 * stride() returns the length of a UTF-32 sequence starting at index i 
     128 * in string s. 
     129 * Returns: The return value will always be 1. 
     130 */ 
     131uint stride(in dchar[] s, size_t i) 
    93132{ 
    94133    return 1; 
     
    96135 
    97136/******************************************* 
    98  * Given an index into an array of char's
    99  * and assuming that index is at the start of a UTF character, 
    100  * determine the number of UCS characters up to that index
    101  */ 
    102  
    103 size_t toUCSindex(char[] s, size_t i) 
     137 * Given an index i into an array of characters s[]
     138 * and assuming that index i is at the start of a UTF character, 
     139 * determine the number of UCS characters up to that index i
     140 */ 
     141 
     142size_t toUCSindex(in char[] s, size_t i) 
    104143{ 
    105144    size_t n; 
     
    122161} 
    123162 
    124 size_t toUCSindex(wchar[] s, size_t i) 
     163/** ditto */ 
     164size_t toUCSindex(in wchar[] s, size_t i) 
    125165{ 
    126166    size_t n; 
     
    141181} 
    142182 
    143 size_t toUCSindex(dchar[] s, size_t i) 
     183/** ditto */ 
     184size_t toUCSindex(in dchar[] s, size_t i) 
    144185{ 
    145186    return i; 
     
    147188 
    148189/****************************************** 
    149  * Given a UCS index into an array of characters, return the UTF index. 
    150  */ 
    151  
    152 size_t toUTFindex(char[] s, size_t n) 
     190 * Given a UCS index n into an array of characters s[], return the UTF index. 
     191 */ 
     192 
     193size_t toUTFindex(in char[] s, size_t n) 
    153194{ 
    154195    size_t i; 
     
    164205} 
    165206 
    166 size_t toUTFindex(wchar[] s, size_t n) 
     207/** ditto */ 
     208size_t toUTFindex(in wchar[] s, size_t n) 
    167209{ 
    168210    size_t i; 
     
    176218} 
    177219 
    178 size_t toUTFindex(dchar[] s, size_t n) 
     220/** ditto */ 
     221size_t toUTFindex(in dchar[] s, size_t n) 
    179222{ 
    180223    return n; 
     
    183226/* =================== Decode ======================= */ 
    184227 
    185 dchar decode(char[] s, inout size_t idx) 
     228/*************** 
     229 * Decodes and returns character starting at s[idx]. idx is advanced past the 
     230 * decoded character. If the character is not well formed, a UtfException is 
     231 * thrown and idx remains unchanged. 
     232 */ 
     233dchar decode(in char[] s, inout size_t idx) 
    186234    in 
    187235    { 
     
    276324    debug(utf) printf("utf.decode.unittest\n"); 
    277325 
    278     static char[] s1 = "abcd"
     326    static s1 = "abcd"c
    279327    i = 0; 
    280328    c = decode(s1, i); 
     
    285333    assert(i == 2); 
    286334 
    287     static char[] s2 = "\xC2\xA9"
     335    static s2 = "\xC2\xA9"c
    288336    i = 0; 
    289337    c = decode(s2, i); 
     
    291339    assert(i == 2); 
    292340 
    293     static char[] s3 = "\xE2\x89\xA0"
     341    static s3 = "\xE2\x89\xA0"c
    294342    i = 0; 
    295343    c = decode(s3, i); 
     
    322370} 
    323371 
    324 /********************************************************/ 
    325  
    326 dchar decode(wchar[] s, inout size_t idx) 
     372/** ditto */ 
     373 
     374dchar decode(in wchar[] s, inout size_t idx) 
    327375    in 
    328376    { 
     
    380428    } 
    381429 
    382 /********************************************************/ 
    383  
    384 dchar decode(dchar[] s, inout size_t idx) 
     430/** ditto */ 
     431 
     432dchar decode(in dchar[] s, inout size_t idx) 
    385433    in 
    386434    { 
     
    405453/* =================== Encode ======================= */ 
    406454 
     455/******************************* 
     456 * Encodes character c and appends it to array s[]. 
     457 */ 
    407458void encode(inout char[] s, dchar c) 
    408459    in 
     
    457508    debug(utf) printf("utf.encode.unittest\n"); 
    458509 
    459     char[] s = "abcd"
     510    char[] s = "abcd".dup
    460511    encode(s, cast(dchar)'a'); 
    461512    assert(s.length == 5); 
     
    472523} 
    473524 
    474 /********************************************************/ 
     525/** ditto */ 
    475526 
    476527void encode(inout wchar[] s, dchar c) 
     
    498549    } 
    499550 
     551/** ditto */ 
    500552void encode(inout dchar[] s, dchar c) 
    501553    in 
     
    581633    } 
    582634 
     635/******************* 
     636 * Encodes string s into UTF-8 and returns the encoded string. 
     637 */ 
    583638char[] toUTF8(char[] s) 
    584639    in 
     
    591646    } 
    592647 
    593 char[] toUTF8(wchar[] s) 
     648/** ditto */ 
     649char[] toUTF8(in wchar[] s) 
    594650{ 
    595651    char[] r; 
     
    617673} 
    618674 
    619 char[] toUTF8(dchar[] s) 
     675/** ditto */ 
     676char[] toUTF8(in dchar[] s) 
    620677{ 
    621678    char[] r; 
     
    665722    } 
    666723 
    667 wchar[] toUTF16(char[] s) 
     724/**************** 
     725 * Encodes string s into UTF-16 and returns the encoded string. 
     726 * toUTF16z() is suitable for calling the 'W' functions in the Win32 API that take 
     727 * an LPWSTR or LPCWSTR argument. 
     728 */ 
     729wchar[] toUTF16(in char[] s) 
    668730{ 
    669731    wchar[] r; 
     
    689751} 
    690752 
    691 wchar* toUTF16z(char[] s) 
     753alias wchar* wptr; 
     754/** ditto */ 
     755wptr toUTF16z(in char[] s) 
    692756{ 
    693757    wchar[] r; 
     
    714778} 
    715779 
     780/** ditto */ 
    716781wchar[] toUTF16(wchar[] s) 
    717782    in 
     
    724789    } 
    725790 
    726 wchar[] toUTF16(dchar[] s) 
     791/** ditto */ 
     792wchar[] toUTF16(in dchar[] s) 
    727793{ 
    728794    wchar[] r; 
     
    740806/* =================== Conversion to UTF32 ======================= */ 
    741807 
    742 dchar[] toUTF32(char[] s) 
     808/***** 
     809 * Encodes string s into UTF-32 and returns the encoded string. 
     810 */ 
     811dchar[] toUTF32(in char[] s) 
    743812{ 
    744813    dchar[] r; 
     
    756825    r[j++] = c; 
    757826    } 
    758     return r[0 .. j]; 
    759 
    760  
    761 dchar[] toUTF32(wchar[] s) 
     827    return cast(dchar[])r[0 .. j]; 
     828
     829 
     830/** ditto */ 
     831dchar[] toUTF32(in wchar[] s) 
    762832{ 
    763833    dchar[] r; 
     
    778848} 
    779849 
     850/** ditto */ 
    780851dchar[] toUTF32(dchar[] s) 
    781852    in 
  • trunk/lib/compiler/dmd/win32.mak

    r4359 r4384  
    6868include OBJECTDEFS.inc 
    6969 
    70 OBJ_WIN= \ 
    71     rt/deh.obj 
    72  
    7370ALL_OBJECTS= $(ALL_OBJS) $(OBJ_WIN) 
    7471# $(patsubst %.o,%.obj,$(ALL_OBJS)) $(OBJ_WIN) 
  • trunk/lib/dmd-posix.mak

    r3997 r4384  
    33# Targets: 
    44#   make 
    5 #       Same as make all 
     5#       same as make lib 
     6#   make all 
     7#       make lib-release lib-debug and doc 
    68#   make lib 
    7 #       Build the runtime library 
     9#       Build the compiler runtime library (which version depends on VERSION, name on LIB_BUILD) 
     10#   make lib-release 
     11#       Build the release version of the compiler runtime library 
     12#   make lib-debug 
     13#       Build the debug version of the compiler runtime library 
    814#   make doc 
    915#       Generate documentation 
    1016#   make clean 
    1117#       Delete unneeded files created by build process 
     18#   make clean-all 
     19#       Delete unneeded files created by build process and the libraries 
     20#   make unittest 
     21#       Performs the unittests of the runtime library 
    1222 
    13 LIB_TARGET=libtango-base-dmd.a 
    14 LIB_MASK=libtango-base-dmd*.a 
     23LIB_BASE=libtango-base-dmd 
     24LIB_BUILD= 
     25LIB_TARGET=$(LIB_BASE)$(LIB_BUILD).a 
     26LIB_MASK=$(LIB_BASE)*.a 
    1527 
    1628DIR_CC=./common/tango 
     
    2840ADD_CFLAGS=-m32 
    2941ADD_DFLAGS= 
     42#-g -debug -debug=PRINTF 
     43 
     44.PHONY : lib lib-release lib-debug unittest all doc clean install clean-all targets 
    3045 
    3146targets : lib doc 
    32 all     : lib doc 
     47all     : lib-release lib-debug doc 
    3348 
    3449###################################################### 
     
    4156 
    4257###################################################### 
     58unittest : 
     59    make -fdmd-posix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     60    make -fdmd-posix.mak lib DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" \ 
     61        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS) -unittest -debug=UnitTest" \ 
     62        SYSTEM_VERSION="$(SYSTEM_VERSION)" 
     63lib-release : 
     64    make -fdmd-posix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     65    make -fdmd-posix.mak DC="$(DC)" LIB_BUILD="" VERSION=release lib \ 
     66        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
     67lib-debug : 
     68    make -fdmd-posix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     69    make -fdmd-posix.mak DC="$(DC)" LIB_BUILD="-d" VERSION=debug lib \ 
     70        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
    4371 
    44 lib : $(ALL_OBJS) 
    45     make -C $(DIR_CC) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" 
    46     make -C $(DIR_RT) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" 
    47     make -C $(DIR_GC) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" 
     72lib : $(LIB_TARGET) 
     73$(LIB_TARGET) : $(ALL_OBJS) 
     74    make -C $(DIR_CC) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" \ 
     75        VERSION="$(VERSION)" LIB_BUILD="$(LIB_BUILD)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
     76    make -C $(DIR_RT) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" \ 
     77        VERSION="$(VERSION)" LIB_BUILD="$(LIB_BUILD)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
     78    make -C $(DIR_GC) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" \ 
     79        VERSION="$(VERSION)" LIB_BUILD="$(LIB_BUILD)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
    4880    find . -name "libphobos*.a" | xargs $(RM) 
    49     $(LC) $(LIB_TARGET) `find $(DIR_CC) -name "*.o" | xargs echo` 
    50     $(LC) $(LIB_TARGET) `find $(DIR_RT) -name "*.o" | xargs echo` 
    51     $(LC) $(LIB_TARGET) `find $(DIR_GC) -name "*.o" | xargs echo` 
     81    $(RM) $@ 
     82    $(LC) $@ `find $(DIR_CC) -name "*.o" | xargs echo` 
     83    $(LC) $@ `find $(DIR_RT) -name "*.o" | xargs echo` 
     84    $(LC) $@ `find $(DIR_GC) -name "*.o" | xargs echo` 
     85ifneq ($(RANLIB),) 
     86    $(RANLIB) $@ 
     87endif 
    5288 
    5389doc : $(ALL_DOCS) 
     
    6197clean : 
    6298    $(RM) $(ALL_OBJS) 
    63     $(RM) $(ALL_DOCS) 
    6499    make -C $(DIR_CC) -fposix.mak clean 
    65100    make -C $(DIR_RT) -fposix.mak clean 
    66101    make -C $(DIR_GC) -fposix.mak clean 
    67 #   $(RM) $(LIB_MASK) 
     102 
     103clean-all : clean 
     104    make -C $(DIR_CC) -fposix.mak clean-all 
     105    make -C $(DIR_RT) -fposix.mak clean-all 
     106    make -C $(DIR_GC) -fposix.mak clean-all 
     107    $(RM) $(ALL_DOCS) 
     108    $(RM) $(LIB_MASK) 
    68109 
    69110install : 
  • trunk/lib/dmd-win32.mak

    r2863 r4384  
    5656    make -fwin32.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" 
    5757    cd ..\.. 
    58     $(RM) phobos*.lib 
     58    $(RM) phobos*.lib $(LIB_TARGET) 
    5959    $(LC) -c -n $(LIB_TARGET) $(LIB_CC) $(LIB_RT) $(LIB_GC) 
    6060 
  • trunk/lib/gc/basic/gc.d

    r4097 r4384  
    5454} 
    5555 
     56version (DigitalMars) version(OSX) { 
     57    extern(C) void _d_osx_image_init(); 
     58} 
     59 
    5660extern (C) void thread_init(); 
    5761 
     
    7175    } 
    7276    _gc.initialize(); 
     77    version (DigitalMars) version(OSX) { 
     78        _d_osx_image_init(); 
     79    } 
    7380    // NOTE: The GC must initialize the thread library 
    7481    //       before its first collection. 
  • trunk/lib/gc/basic/gcx.d

    r4172 r4384  
    5454private import cstring = tango.stdc.string : memcpy, memmove, memset; 
    5555debug(THREADINVARIANT) private import tango.stdc.posix.pthread; 
    56 debug private import tango.stdc.stdio; 
     56debug(PRINTF) private import tango.stdc.posix.pthread : pthread_self, pthread_t; 
     57debug private import tango.stdc.stdio : printf; 
    5758 
    5859version (GNU) 
  • trunk/lib/gc/basic/posix.mak

    r4325 r4384  
    1111#       Delete unneeded files created by build process 
    1212 
    13 LIB_TARGET=libtango-gc-basic.a 
    14 LIB_MASK=libtango-gc-basic*.a 
     13LIB_BASE=libtango-gc-basic 
     14LIB_BUILD= 
     15LIB_TARGET=$(LIB_BASE)$(LIB_BUILD).a 
     16LIB_MASK=$(LIB_BASE)*.a 
    1517 
    1618CP=cp -f 
     
    2224SYSTEM_VERSION= 
    2325 
    24 CFLAGS=-O $(ADD_CFLAGS) 
    25 #CFLAGS=-g $(ADD_CFLAGS) 
     26CFLAGS_RELEASE=-O $(ADD_CFLAGS) 
     27CFLAGS_DEBUG=-g $(ADD_CFLAGS) 
     28DFLAGS_RELEASE=-release -O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) -I../../common -I../../.. 
     29DFLAGS_DEBUG=-g -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) -I../../common -I../../.. 
     30TFLAGS_RELEASE=-O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
     31TFLAGS_DEBUG=-g -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
     32DOCFLAGS=-version=DDoc $(SYSTEM_VERSION) 
    2633 
    27 DFLAGS=-release -O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
    28 #DFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
    29  
    30 TFLAGS=-O -inline -w -nofloat $(SYSTEM_VERSION) $(ADD_DFLAGS) 
    31 #TFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
    32  
    33 DOCFLAGS=-version=DDoc $(SYSTEM_VERSION) 
     34ifeq ($(VERSION),debug) 
     35CFLAGS=$(CFLAGS_DEBUG) 
     36DFLAGS=$(DFLAGS_DEBUG) 
     37TFLAGS=$(TFLAGS_DEBUG) 
     38else 
     39CFLAGS=$(CFLAGS_RELEASE) 
     40DFLAGS=$(DFLAGS_RELEASE) 
     41TFLAGS=$(TFLAGS_RELEASE) 
     42endif 
    3443 
    3544CC=gcc 
     
    4049 
    4150.SUFFIXES: .s .S .c .cpp .d .html .o 
     51.PHONY : lib lib-release lib-debug unittest all doc clean install clean-all 
    4252 
    4353.s.o: 
     
    6171 
    6272targets : lib doc 
    63 all     : lib doc 
    64 lib     : basic.lib 
    65 doc     : basic.doc 
     73all     : lib-release lib-debug doc 
    6674 
    6775###################################################### 
     
    7987 
    8088###################################################### 
     89unittest : 
     90    make -fposix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     91    make -fposix.mak lib DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" \ 
     92        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS) -unittest -debug=UnitTest" \ 
     93        SYSTEM_VERSION="$(SYSTEM_VERSION)" 
     94lib-release : 
     95    make -fposix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     96    make -fposix.mak DC="$(DC)" LIB_BUILD="" VERSION=release lib \ 
     97        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
     98lib-debug : 
     99    make -fposix.mak clean DC="$(DC)" LIB_BUILD="" VERSION="$(VERSION)" 
     100    make -fposix.mak DC="$(DC)" LIB_BUILD="-d" VERSION=debug lib \ 
     101        ADD_CFLAGS="$(ADD_CFLAGS)" ADD_DFLAGS="$(ADD_DFLAGS)" SYSTEM_VERSION="$(SYSTEM_VERSION)" 
    81102 
    82 basic.lib : $(LIB_TARGET) 
     103###################################################### 
     104 
     105lib : $(LIB_TARGET) 
    83106 
    84107$(LIB_TARGET) : $(ALL_OBJS) 
     
    86109    $(LC) $@ $(ALL_OBJS) 
    87110 
    88 basic.doc : $(ALL_DOCS) 
     111doc : $(ALL_DOCS) 
    89112    echo No documentation available. 
    90113 
     
    95118    $(RM) $(ALL_OBJS) 
    96119    $(RM) $(ALL_DOCS) 
     120 
     121clean-all : clean 
    97122    $(RM) $(LIB_MASK) 
    98123 
  • trunk/lib/install-dmd.sh

    r3711 r4384  
    5656LIBPREFIX="$PREFIX" 
    5757INCLPREFIX="$PREFIX" 
    58 BASELIB="libtango-base-dmd.a" 
     58BASELIB="libtango-base-dmd*.a" 
    5959 
    6060while [ "$#" != "0" ] 
  • trunk/lib/unittest.sh

    r4341 r4384  
    102102        tango/util/collection/impl/*.d tango/util/log/model/*.d tango/util/log/*.d \ 
    103103        tango/util/container/*.d tango/util/container/model/*.d tango/util/container/more/*.d \ 
    104         tango/time/chrono/*.d tango/time/*.d -dc=$DC-posix-tango 
     104        tango/time/chrono/*.d tango/time/*.d -dc=$DC-darwin-tango 
    105105 
    106106        mv $EXE lib/$EXE