Changeset 66

Show
Ignore:
Timestamp:
08/01/06 12:00:48 (2 years ago)
Author:
Gregor
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bcd.gen/bcd/gen/bcdgen.d

    r64 r66  
    6262/** The class currently being processed */ 
    6363char[] curClass; 
     64/** Is the current class abstract? */ 
     65bool curClassAbstract; 
    6466/** Was a constructor made for the current class? */ 
    6567bool hasConstructor; 
     
    640642    char[] mangled = toStringFree(getMangled(node)); 
    641643    char[] demangled = toStringFree(getDemangled(node)); 
     644    char[] prevCurClass = curClass; 
    642645    char* isabstract = xmlGetProp(node, "abstract"); 
    643646    if (isabstract) free(isabstract); 
    644647    curClass = demangled; 
     648    curClassAbstract = isabstract ? true : false; 
    645649    hasConstructor = false; 
    646650    hasPublicConstructor = false; 
     
    697701        dtail ~= "__C_data_owned = true;\n"; 
    698702        dtail ~= "}\n"; 
    699         cout ~= demangled ~ " *_BCD_new_" ~ mangled ~ "() {\n"; 
    700         cout ~= "return new " ~ demangled ~ "();\n"; 
     703        cout ~= curClass ~ " *_BCD_new_" ~ mangled ~ "() {\n"; 
     704        cout ~= "return new " ~ curClass ~ "();\n"; 
    701705        cout ~= "}\n"; 
    702706    } 
     
    705709     
    706710    // now make the reflected class 
     711    curClass = prevCurClass; 
    707712    if (!outputReflections) return; 
    708713    if (isabstract) return; // not for abstract classes yet 
     714    curClass = demangled; 
    709715    curReflectionCBase = demangled; 
    710716    curReflectionDBase = safeName(name); 
     
    767773    cout ~= "cd->__D_data = dd;\n"; 
    768774    cout ~= "}\n"; 
     775 
     776    curClass = prevCurClass; 
    769777} 
    770778 
     
    808816    char[] mangled = toStringFree(getMangled(node)); 
    809817    char[] demangled = toStringFree(getDemangled(node)); 
     818    char[] prevCurClass = curClass; 
    810819     
    811820    parseMembers(node, true, true); 
     
    822831    parseMembers(node, true, false); 
    823832    dtail ~= "}\n"; 
     833 
     834    curClass = prevCurClass; 
    824835} 
    825836 
     
    10281039                         char[] Dargs, char[] Deargs, char[] Cargs, char[] Dcall, char[] Ccall) 
    10291040{ 
     1041    // make sure it's not already defined (particularly problematic for overrides that aren't overrides in D) 
     1042    static bool[char[]] handledFunctions; 
     1043    char[] fid = curClass ~ "::" ~ demangled ~ "(" ~ Deargs ~ ")"; 
     1044    if (fid in handledFunctions) return; 
     1045    handledFunctions[fid] = true; 
     1046 
    10301047    if (outputC) { 
    10311048        dhead ~= "extern (C) " ~ type.DType ~ " " ~ demangled ~ "(" ~ Deargs ~ ");\n"; 
     
    13491366{ 
    13501367    if (outputC) return; // no constructors in C 
    1351      
     1368    if (curClassAbstract) return; // no constructors for virtual classes 
     1369 
    13521370    char[] name = getNName(node); 
    13531371    char[] mangled = toStringFree(getMangled(node)); 
     
    13711389    parse_Arguments(node, Dargs, Deargs, Cargs, Dcall, Ccall, false); 
    13721390     
     1391    // make sure it's not already defined (particularly problematic for overrides that aren't overrides in D) 
     1392    static bool[char[]] handledCtors; 
     1393    char[] fid = curClass ~ "(" ~ Deargs ~ ")"; 
     1394    if (fid in handledCtors) return; 
     1395    handledCtors[fid] = true; 
     1396 
    13731397    if (reflection) { 
    13741398        // make sure it's not already reflected 
     
    14231447        handledTypedefs[type] = true; 
    14241448         
    1425         cout ~= "typedef " ~ pt.CType ~ " _BCD_" ~ aname ~ ";\n"; 
     1449        cout ~= "typedef " ~ pt.CType ~ " _BCD_" ~ type ~ "_" ~ aname ~ ";\n"; 
    14261450         
    14271451        if (parseThis(node, true)) dhead ~= "alias " ~ pt.DType ~ " " ~ safeName(aname) ~ ";\n"; 
     
    17991823                    parse_Typedef(curNode); 
    18001824                     
    1801                     ParsedType rpt = new ParsedType("_BCD_" ~ aname, pt.DType); 
     1825                    ParsedType rpt = new ParsedType("_BCD_" ~ type ~ "_" ~ aname, pt.DType); 
    18021826                    rpt.isClass = pt.isClass; 
    18031827                    rpt.isFunction = pt.isFunction; 
     
    18111835                    if (nname == "MethodType") { 
    18121836                        base = parseType(toStringFree(xmlGetProp(curNode, "basetype"))).CType; 
    1813                         base[base.length - 2 .. base.length] = "::"; 
     1837                        base = base[0 .. base.length - 2] ~ "::*"; 
    18141838                    } 
    18151839                 
  • trunk/bcd.gen/scripts/fltk2.sh

    r27 r66  
    184184          \ 
    185185          -N"fltk::image_filetypes" \ 
    186           -N"fltk::Menu::get_location(fltk::Widget*, int const*, int, int) const" 
     186          -N"fltk::Menu::get_location(fltk::Widget*, int const*, int, int) const" \ 
     187          \ 
     188          -N"fltk::Window::backbuffer() const" 
    187189done