Changeset 74

Show
Ignore:
Timestamp:
11/15/08 14:03:15 (2 months ago)
Author:
Chris Miller
Message:

Added support for DMD 2.020
Renamed clib's printf to cprintf to avoid conflict between object.printf and std.c.stdio.printf

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/win32/dfl/application.d

    r73 r74  
    265265                                        { 
    266266                                            debug(APP_PRINT) 
    267                                                 printf("CreateActCtxW failed.\n"); 
     267                                                cprintf("CreateActCtxW failed.\n"); 
    268268                                        } 
    269269                                    } 
     
    892892        if(except) 
    893893        { 
    894             printf("Error: %.*s\n", cast(int)getObjectString(e).length, getObjectString(e).ptr); 
     894            cprintf("Error: %.*s\n", cast(int)getObjectString(e).length, getObjectString(e).ptr); 
    895895             
    896896            abort(); 
     
    918918         
    919919        //throw e; 
    920         printf("Error: %.*s\n", cast(int)getObjectString(e).length, getObjectString(e).ptr); 
     920        cprintf("Error: %.*s\n", cast(int)getObjectString(e).length, getObjectString(e).ptr); 
    921921        //exitThread(); 
    922922        Environment.exit(EXIT_FAILURE); 
     
    15081508    Application.gctimer = 0; 
    15091509     
    1510     //printf("Auto-collecting\n"); 
    1511     dfl.internal.dlib.gcGenCollect(); 
     1510    //cprintf("Auto-collecting\n"); 
     1511    dfl.internal.dlib.gcFullCollect(); 
    15121512     
    15131513    Application.gcinfo = GetTickCount() + 4000; 
     
    16941694extern(Windows) LRESULT dflWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) 
    16951695{ 
    1696     //printf("HWND %p; WM %d(0x%X); WPARAM %d(0x%X); LPARAM %d(0x%X);\n", hwnd, msg, msg, wparam, wparam, lparam, lparam); 
     1696    //cprintf("HWND %p; WM %d(0x%X); WPARAM %d(0x%X); LPARAM %d(0x%X);\n", hwnd, msg, msg, wparam, wparam, lparam, lparam); 
    16971697     
    16981698    if(msg == wmDfl) 
     
    17971797        { 
    17981798            debug(APP_PRINT) 
    1799                 printf("Unable to add window 0x%X.\n", hwnd); 
     1799                cprintf("Unable to add window 0x%X.\n", hwnd); 
    18001800            return dm.result; 
    18011801        } 
     
    18051805        ctrl.hwnd = hwnd; 
    18061806        debug(APP_PRINT) 
    1807             printf("Added window 0x%X.\n", hwnd); 
     1807            cprintf("Added window 0x%X.\n", hwnd); 
    18081808         
    18091809        //ctrl.finishCreating(hwnd); 
     
    20622062 
    20632063 
    2064 /+ 
    2065 // GC 1.0 by default. 
    2066 version(Tango) 
    2067 { 
    2068 } 
    2069 else 
    2070 { 
    2071     version(DFL_NO_GC_V1_0) 
    2072     { 
    2073     } 
    2074     else // DFL_GC_V1_0 
    2075     { 
    2076         version = _DFL_STD_GC_V1_0; 
    2077          
    2078         private import std.gc; 
    2079     } 
    2080 } 
    2081 +/ 
    2082 // Not GC 1.0 by default. 
    2083 version(Tango) 
    2084 { 
    2085 } 
    2086 else 
    2087 { 
    2088     version(DFL_GC_V1_0) 
    2089     { 
    2090         version = _DFL_STD_GC_V1_0; 
    2091     } 
    2092 } 
    2093  
    2094  
    20952064static this() 
    20962065{ 
    2097     version(_DFL_STD_GC_V1_0) 
    2098     { 
    2099         static if(is(typeof(&std.gc.setV1_0))) 
    2100         { 
    2101             std.gc.setV1_0(); 
    2102         } 
    2103         else 
    2104         { 
    2105             pragma(msg, "DFL: assuming version=DFL_NO_GC_V1_0"); 
    2106         } 
    2107     } 
    2108      
    21092066    dfl.internal.utf._utfinit(); 
    21102067     
  • trunk/win32/dfl/control.d

    r72 r74  
    10081008        { 
    10091009            debug(APP_PRINT) 
    1010                 printf("Control created due to handle request.\n"); 
     1010                cprintf("Control created due to handle request.\n"); 
    10111011             
    10121012            createHandle(); 
     
    11251125        debug(EVENT_PRINT) 
    11261126        { 
    1127             printf("{ Event: onBackColorChanged - Control %.*s }\n", name); 
     1127            cprintf("{ Event: onBackColorChanged - Control %.*s }\n", name); 
    11281128        } 
    11291129         
     
    14891489        debug(EVENT_PRINT) 
    14901490        { 
    1491             printf("{ Event: onCursorChanged - Control %.*s }\n", name); 
     1491            cprintf("{ Event: onCursorChanged - Control %.*s }\n", name); 
    14921492        } 
    14931493        +/ 
     
    19601960        debug(EVENT_PRINT) 
    19611961        { 
    1962             printf("{ Event: onForeColorChanged - Control %.*s }\n", name); 
     1962            cprintf("{ Event: onForeColorChanged - Control %.*s }\n", name); 
    19631963        } 
    19641964         
     
    21452145        debug(EVENT_PRINT) 
    21462146        { 
    2147             printf("{ Event: onParentChanged - Control %.*s }\n", name); 
     2147            cprintf("{ Event: onParentChanged - Control %.*s }\n", name); 
    21482148        } 
    21492149         
     
    43134313        debug(EVENT_PRINT) 
    43144314        { 
    4315             printf("{ Event: onFontChanged - Control %.*s }\n", name); 
     4315            cprintf("{ Event: onFontChanged - Control %.*s }\n", name); 
    43164316        } 
    43174317         
     
    43254325        debug(EVENT_PRINT) 
    43264326        { 
    4327             printf("{ Event: onRightToLeftChanged - Control %.*s }\n", name); 
     4327            cprintf("{ Event: onRightToLeftChanged - Control %.*s }\n", name); 
    43284328        } 
    43294329         
     
    43664366        debug(EVENT_PRINT) 
    43674367        { 
    4368             printf("{ Event: onHelpRequested - Control %.*s }\n", name); 
     4368            cprintf("{ Event: onHelpRequested - Control %.*s }\n", name); 
    43694369        } 
    43704370         
     
    43784378        debug(EVENT_PRINT) 
    43794379        { 
    4380             printf("{ Event: onSystemColorsChanged - Control %.*s }\n", name); 
     4380            cprintf("{ Event: onSystemColorsChanged - Control %.*s }\n", name); 
    43814381        } 
    43824382         
     
    54055405                    if(msg.msg == wmGetControlName) 
    54065406                    { 
    5407                         //printf("WM_GETCONTROLNAME: %.*s; wparam: %d\n", cast(uint)name.length, name.ptr, msg.wParam); 
     5407                        //cprintf("WM_GETCONTROLNAME: %.*s; wparam: %d\n", cast(uint)name.length, name.ptr, msg.wParam); 
    54085408                        if(msg.wParam && this.name.length) 
    54095409                        { 
     
    60116011    { 
    60126012        debug(APP_PRINT) 
    6013             printf("~Control %p\n", cast(void*)this); 
     6013            cprintf("~Control %p\n", cast(void*)this); 
    60146014         
    60156015        version(DFL_NO_ZOMBIE_FORM) 
     
    63016301            debug(APP_PRINT) 
    63026302            { 
    6303                 printf("Creating Control handle while disposing.\n"); 
     6303                cprintf("Creating Control handle while disposing.\n"); 
    63046304            } 
    63056305             
     
    63586358                debug(APP_PRINT) 
    63596359                { 
    6360                     printf("CreateWindowEx failed." 
     6360                    cprintf("CreateWindowEx failed." 
    63616361                        " (exStyle=0x%X, className=`%.*s`, caption=`%.*s`, style=0x%X, x=%d, y=%d, width=%d, height=%d," 
    63626362                        " parent=0x%X, menu=0x%X, inst=0x%X, param=0x%X)\n", 
     
    64636463    private final void fillRecreationData() 
    64646464    { 
    6465         //printf(" { fillRecreationData %.*s }\n", name); 
     6465        //cprintf(" { fillRecreationData %.*s }\n", name); 
    64666466         
    64676467        if(!(ctrlStyle & ControlStyles.CACHE_TEXT)) 
     
    65616561        if(!_disallowLayout) 
    65626562        { 
    6563             //printf("alayout\n"); 
     6563            //cprintf("alayout\n"); 
    65646564            scope LayoutEventArgs lea = new LayoutEventArgs(ctrl); 
    65656565            onLayout(lea); 
     
    65776577        version(RADIO_GROUP_LAYOUT) 
    65786578        { 
    6579             //printf("vchanged\n"); 
     6579            //cprintf("vchanged\n"); 
    65806580             
    65816581            bool foundRadio = false; 
     
    66406640        debug(EVENT_PRINT) 
    66416641        { 
    6642             printf("{ Event: onLayout - Control %.*s }\n", name); 
     6642            cprintf("{ Event: onLayout - Control %.*s }\n", name); 
    66436643        } 
    66446644         
  • trunk/win32/dfl/data.d

    r54 r74  
    667667        // doConvert ... 
    668668         
    669         //printf("Looking for format '%.*s'.\n", fmt); 
     669        //cprintf("Looking for format '%.*s'.\n", fmt); 
    670670        int i; 
    671671        i = find(fmt); 
     
    10241024            if(!nfetched) 
    10251025                break; 
    1026             //printf("\t\t{getFormats:%d}\n", fmte.cfFormat); 
     1026            //cprintf("\t\t{getFormats:%d}\n", fmte.cfFormat); 
    10271027            result ~= DataFormats.getFormat(fmte.cfFormat).name; 
    10281028        } 
     
    10541054        if(!hmem) 
    10551055        { 
    1056             //printf("Unable to GlobalAlloc().\n"); 
     1056            //cprintf("Unable to GlobalAlloc().\n"); 
    10571057            err_set: 
    10581058            throw new DflException("Unable to set data"); 
     
    10611061        if(!pmem) 
    10621062        { 
    1063             //printf("Unable to GlobalLock().\n"); 
     1063            //cprintf("Unable to GlobalLock().\n"); 
    10641064            GlobalFree(hmem); 
    10651065            goto err_set; 
     
    10821082        if(S_OK != hr) 
    10831083        { 
    1084             //printf("Unable to IDataObject::SetData() = %d (0x%X).\n", hr, hr); 
     1084            //cprintf("Unable to IDataObject::SetData() = %d (0x%X).\n", hr, hr); 
    10851085            // Failed, need to free it.. 
    10861086            GlobalFree(hmem); 
  • trunk/win32/dfl/event.d

    r54 r74  
    249249    /+ 
    250250    private static byte[] buf; 
    251     private import std.gc; 
     251    private import std.gc; // <-- ... 
    252252     
    253253     
  • trunk/win32/dfl/filedialog.d

    r54 r74  
    481481                         
    482482                        default: ; 
    483                             //printf("   nmhdr.code = %d/0x%X\n", nmhdr.code, nmhdr.code); 
     483                            //cprintf("   nmhdr.code = %d/0x%X\n", nmhdr.code, nmhdr.code); 
    484484                    } 
    485485                } 
     
    684684                    foreach(Dstring ext; exts) 
    685685                    { 
    686                         printf("sel ext:  %.*s\n", ext); 
     686                        cprintf("sel ext:  %.*s\n", ext); 
    687687                    } 
    688688                     
     
    987987        } 
    988988         
    989         //printf("hook msg(%d/0x%X) to obj %p\n", msg, msg, fd); 
     989        //cprintf("hook msg(%d/0x%X) to obj %p\n", msg, msg, fd); 
    990990        if(fd) 
    991991        { 
  • trunk/win32/dfl/form.d

    r64 r74  
    373373            debug(APP_PRINT) 
    374374            { 
    375                 printf("Creating Form handle while killing.\n"); 
     375                cprintf("Creating Form handle while killing.\n"); 
    376376            } 
    377377             
     
    31733173                            { 
    31743174                                Control cc = Control.fromHandle(hw); 
    3175                                 //printf("mnemonic for "); 
     3175                                //cprintf("mnemonic for "); 
    31763176                                if(!cc) 
    31773177                                { 
     
    31793179                                    return false; 
    31803180                                } 
    3181                                 //printf("'%.*s' ", cc.name); 
     3181                                //cprintf("'%.*s' ", cc.name); 
    31823182                                return cc._processMnemonic(cast(dchar)m.wParam); 
    31833183                            } 
     
    35143514        { 
    35153515            debug(APP_PRINT) 
    3516                 printf("RegisterClassEx() failed for park class.\n"); 
     3516                cprintf("RegisterClassEx() failed for park class.\n"); 
    35173517             
    35183518            init_err: 
     
    35273527        { 
    35283528            debug(APP_PRINT) 
    3529                 printf("CreateWindowEx() failed for park window.\n"); 
     3529                cprintf("CreateWindowEx() failed for park window.\n"); 
    35303530             
    35313531            goto init_err; 
  • trunk/win32/dfl/internal/clib.d

    r5 r74  
    1111        tango.stdc.stdint, 
    1212        tango.stdc.stdio; 
     13     
     14    alias tango.stdc.stdio.printf cprintf; 
    1315} 
    1416else // Phobos 
     
    1820        std.stdint, // Mostly the same as the C interface. 
    1921        std.c.stdio; 
     22     
     23    alias std.c.stdio.printf cprintf; 
    2024} 
    2125 
  • trunk/win32/dfl/internal/com.d

    r67 r74  
    3333    override ULONG AddRef() 
    3434    { 
    35         //printf("AddRef `%.*s`\n", cast(int)toString().length, toString().ptr); 
     35        //cprintf("AddRef `%.*s`\n", cast(int)toString().length, toString().ptr); 
    3636        return C_refCountInc(cast(void*)this); 
    3737    } 
     
    3939    override ULONG Release() 
    4040    { 
    41         //printf("Release `%.*s`\n", cast(int)toString().length, toString().ptr); 
     41        //cprintf("Release `%.*s`\n", cast(int)toString().length, toString().ptr); 
    4242        return C_refCountDec(cast(void*)this); 
    4343    } 
     
    159159        HRESULT result = S_OK; 
    160160         
    161         //printf("seek move=%u, origin=0x%x\n", cast(uint)dlibMove.QuadPart, dwOrigin); 
     161        //cprintf("seek move=%u, origin=0x%x\n", cast(uint)dlibMove.QuadPart, dwOrigin); 
    162162         
    163163        try 
     
    423423    HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) 
    424424    { 
    425         //printf("seek move=%u, origin=0x%x\n", cast(uint)dlibMove.QuadPart, dwOrigin); 
     425        //cprintf("seek move=%u, origin=0x%x\n", cast(uint)dlibMove.QuadPart, dwOrigin); 
    426426         
    427427        auto toPos = cast(long)dlibMove.QuadPart; 
  • trunk/win32/dfl/internal/dlib.d

    r72 r74  
    3232alias typeof(""d.ptr) Ddstringz; 
    3333alias typeof(" "d[0]) Ddchar; 
     34 
     35 
     36version(DFL_NO_D2_AND_ABOVE) 
     37{ 
     38} 
     39else 
     40{ 
     41    version(D_Version2) 
     42    { 
     43        version = DFL_D2_AND_ABOVE; 
     44    } 
     45    else version(D_Version3) 
     46    { 
     47        version = DFL_D3_AND_ABOVE; 
     48        version = DFL_D2_AND_ABOVE; 
     49    } 
     50} 
     51 
     52 
     53version(DFL_DMD2020) 
     54{ 
     55    version = DFL_USE_CORE_MEMORY; 
     56    version = DFL_USE_CORE_EXCEPTION_OUTOFMEMORY; 
     57} 
     58 
     59 
     60version(DFL_USE_CORE_MEMORY) 
     61{ 
     62    version = DFL_USE_CORE_EXCEPTION_OUTOFMEMORY; 
     63} 
    3464 
    3565 
     
    143173     
    144174     
    145     private import tango.core.Memory; 
    146      
    147     void gcPin(void* p) { } 
    148     void gcUnpin(void* p) { } 
    149      
    150     void gcGenCollect() 
    151     { 
    152         version(DFL_TANGObefore099rc3) 
    153             gc.collect(); 
    154         else 
    155             GC.collect(); 
    156     } 
    157      
    158     void gcFullCollect() 
    159     { 
    160         version(DFL_TANGObefore099rc3) 
    161             gc.collect(); 
    162         else 
    163             GC.collect(); 
     175    version(DFL_USE_CORE_MEMORY) 
     176    { 
     177        private import core.memory; 
     178         
     179        void gcPin(void* p) { } 
     180        void gcUnpin(void* p) { } 
     181         
     182        deprecated void gcGenCollect() 
     183        { 
     184            core.memory.GC.collect(); 
     185        } 
     186         
     187        void gcFullCollect() 
     188        { 
     189            core.memory.GC.collect(); 
     190        } 
     191    } 
     192    else 
     193    { 
     194        private import tango.core.Memory; 
     195         
     196        void gcPin(void* p) { } 
     197        void gcUnpin(void* p) { } 
     198         
     199        deprecated void gcGenCollect() 
     200        { 
     201            version(DFL_TANGObefore099rc3) 
     202                gc.collect(); 
     203            else 
     204                GC.collect(); 
     205        } 
     206         
     207        void gcFullCollect() 
     208        { 
     209            version(DFL_TANGObefore099rc3) 
     210                gc.collect(); 
     211            else 
     212                GC.collect(); 
     213        } 
    164214    } 
    165215     
     
    215265     
    216266     
    217     private import tango.core.Exception; 
    218      
    219     class OomException: tango.core.Exception.OutOfMemoryException 
    220     { 
    221         this() 
    222         { 
    223             super(null, 0); 
     267    version(DFL_USE_CORE_EXCEPTION_OUTOFMEMORY) 
     268    { 
     269        private import core.exception; 
     270         
     271        class OomException: core.exception.OutOfMemoryException 
     272        { 
     273            this() 
     274            { 
     275                super(null, 0); 
     276            } 
     277        } 
     278    } 
     279    else 
     280    { 
     281        private import tango.core.Exception; 
     282         
     283        class OomException: tango.core.Exception.OutOfMemoryException 
     284        { 
     285            this() 
     286            { 
     287                super(null, 0); 
     288            } 
    224289        } 
    225290    } 
     
    418483else // Phobos 
    419484{ 
    420     public import std.thread, std.traits; 
     485    public import std.traits; 
    421486     
    422487     
     
    430495     
    431496     
    432     private import std.gc; 
    433      
    434     void gcPin(void* p) { } 
    435     void gcUnpin(void* p) { } 
    436      
    437     alias std.gc.genCollect gcGenCollect; 
    438      
    439     alias std.gc.fullCollect gcFullCollect; 
     497    version(DFL_USE_CORE_MEMORY) 
     498    { 
     499        private import core.memory; 
     500         
     501        void gcPin(void* p) { } 
     502        void gcUnpin(void* p) { } 
     503         
     504        deprecated void gcGenCollect() 
     505        { 
     506            core.memory.GC.collect(); 
     507        } 
     508         
     509        void gcFullCollect() 
     510        { 
     511            core.memory.GC.collect(); 
     512        } 
     513    } 
     514    else 
     515    { 
     516        private import std.gc; // If you get "module gc cannot read file 'std\gc.d'" then use -version=DFL_USE_CORE_MEMORY <http://wiki.dprogramming.com/Dfl/CompileVersions> 
     517         
     518        void gcPin(void* p) { } 
     519        void gcUnpin(void* p) { } 
     520         
     521        deprecated alias std.gc.genCollect gcGenCollect; 
     522         
     523        alias std.gc.fullCollect gcFullCollect; 
     524    } 
    440525     
    441526     
     
    473558     
    474559     
    475     private import std.outofmemory; 
    476      
    477     alias std.outofmemory.OutOfMemoryException OomException; 
     560    version(DFL_USE_CORE_EXCEPTION_OUTOFMEMORY) 
     561    { 
     562        private import core.exception; 
     563         
     564        class OomException: core.exception.OutOfMemoryException 
     565        { 
     566            this() 
     567            { 
     568                super(null, 0); 
     569            } 
     570        } 
     571    } 
     572    else 
     573    { 
     574        private import std.outofmemory; 
     575         
     576        alias std.outofmemory.OutOfMemoryException OomException; 
     577    } 
    478578     
    479579     
  • trunk/win32/dfl/internal/utf.d

    r54 r74  
    5959    version(D_Version2) 
    6060    { 
     61        version = DFL_D2_AND_ABOVE; 
     62    } 
     63    else version(D_Version3) 
     64    { 
     65        version = DFL_D3_AND_ABOVE; 
    6166        version = DFL_D2_AND_ABOVE; 
    6267    } 
  • trunk/win32/dfl/listview.d

    r72 r74  
    25822582    { 
    25832583        /+ 
    2584         printf("^ Insert item:  index=%d, lparam=0x%X, text='%.*s', subItemIndex=%d\n", 
     2584        cprintf("^ Insert item:  index=%d, lparam=0x%X, text='%.*s', subItemIndex=%d\n", 
    25852585            index, lparam, itemText.length > 20 ? 20 : itemText.length, cast(char*)itemText, subItemIndex); 
    25862586        +/ 
  • trunk/win32/dfl/menu.d

    r72 r74  
    5555             
    5656            debug(APP_PRINT) 
    57                 printf("~ContextMenu\n"); 
     57                cprintf("~ContextMenu\n"); 
    5858        } 
    5959         
     
    515515             
    516516            debug(APP_PRINT) 
    517                 printf("~MenuItem\n"); 
     517                cprintf("~MenuItem\n"); 
    518518        } 
    519519         
  • trunk/win32/dfl/socket.d

    r54 r74  
    739739    { 
    740740        debug(APP_PRINT) 
    741             printf("RegisterClassEx() failed for network event class.\n"); 
     741            cprintf("RegisterClassEx() failed for network event class.\n"); 
    742742         
    743743        init_err: 
     
    754754        { 
    755755            debug(APP_PRINT) 
    756                 printf("CreateWindowEx() failed for network event window.\n"); 
     756                cprintf("CreateWindowEx() failed for network event window.\n"); 
    757757             
    758758            goto init_err; 
  • trunk/win32/dfl/textbox.d

    r64 r74  
    489489            { 
    490490                debug(APP_PRINT) 
    491                     printf("Unable to OpenClipboard().\n"); 
     491                    cprintf("Unable to OpenClipboard().\n"); 
    492492                //throw new DflException("Unable to set clipboard data."); 
    493493                return; 
     
    513513            { 
    514514                debug(APP_PRINT) 
    515                     printf("Unable to OpenClipboard().\n"); 
     515                    cprintf("Unable to OpenClipboard().\n"); 
    516516                //throw new DflException("Unable to set clipboard data."); 
    517517                return; 
  • trunk/win32/dfl/timer.d

    r11 r74  
    172172        { 
    173173            debug(APP_PRINT) 
    174                 printf("Unknown timer 0x%X.\n", idEvent); 
     174                cprintf("Unknown timer 0x%X.\n", idEvent); 
    175175        } 
    176176    } 
  • trunk/win32/dfl/treeview.d

    r72 r74  
    698698    void add(TreeNode node) 
    699699    { 
    700         //printf("Adding node %p '%.*s'\n", cast(void*)node, getObjectString(node)); 
     700        //cprintf("Adding node %p '%.*s'\n", cast(void*)node, getObjectString(node)); 
    701701         
    702702        int i;