Changeset 478

Show
Ignore:
Timestamp:
03/24/08 17:21:38 (7 months ago)
Author:
Mike Wey
Message:

Add overrides to avoid Hidden function errors with D2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wrap/APILookupGLib.txt

    r477 r478  
    877877        } 
    878878         
    879         public int run() 
    880         { 
    881             string line = readLine(file); 
    882             while( line !is null ) 
     879        version(Tango) 
     880        { 
     881            public int run() 
    883882            { 
    884                 ++lineCount; 
    885                 //writefln("Spawn.ReadFile.run line (%s) ========== >>>%s<<<", lineCount, line); 
    886                 //printf("Spawn.ReadFile.run line (%d) ========== >>>%.*s<<<", lineCount, line); 
    887                 if ( read !is null ) 
     883                string line = readLine(file); 
     884                while( line !is null ) 
    888885                { 
    889                     read(line); 
     886                    ++lineCount; 
     887                    if ( read !is null ) 
     888                    { 
     889                        read(line); 
     890                    } 
     891                    line = readLine(file); 
    890892                } 
    891                 line = readLine(file)
     893                return 0
    892894            } 
    893             return 0; 
     895        } 
     896        else 
     897        { 
     898            public override int run() 
     899            { 
     900                string line = readLine(file); 
     901                while( line !is null ) 
     902                { 
     903                    ++lineCount; 
     904                    //writefln("Spawn.ReadFile.run line (%s) ========== >>>%s<<<", lineCount, line); 
     905                    //printf("Spawn.ReadFile.run line (%d) ========== >>>%.*s<<<", lineCount, line); 
     906                    if ( read !is null ) 
     907                    { 
     908                        read(line); 
     909                    } 
     910                    line = readLine(file); 
     911                } 
     912                return 0; 
     913            } 
    894914        } 
    895915    } 
     
    11591179prefix: g_ 
    11601180import: glib.Str 
     1181 
     1182nocode: g_mem_chunk_print 
     1183 
     1184code: start 
     1185    /** 
     1186     * Warning 
     1187     * g_mem_chunk_print has been deprecated since version 2.10 and should not be used in newly-written code. Use the slice 
     1188     *  allocator instead 
     1189     * Outputs debugging information for a GMemChunk. 
     1190     * It outputs the name of the GMemChunk (set with g_mem_chunk_new()), 
     1191     * the number of bytes used, and the number of blocks of memory allocated. 
     1192     */ 
     1193    version(Tango) 
     1194    { 
     1195        public void print() 
     1196        { 
     1197            // void g_mem_chunk_print (GMemChunk *mem_chunk); 
     1198            g_mem_chunk_print(gMemChunk); 
     1199        } 
     1200    } 
     1201    else 
     1202    { 
     1203        public override void print() 
     1204        { 
     1205            // void g_mem_chunk_print (GMemChunk *mem_chunk); 
     1206            g_mem_chunk_print(gMemChunk); 
     1207        } 
     1208    } 
     1209code: end 
    11611210outFile: MemoryChunk 
    11621211 
     
    13001349import: glib.Tuples 
    13011350structWrap: GTuples* Tuples 
     1351 
     1352nocode: g_relation_print 
     1353 
     1354code: start 
     1355    /** 
     1356     * Outputs information about all records in a GRelation, as well as the indexes. 
     1357     * It is for debugging. 
     1358     */ 
     1359    version(Tango) 
     1360    { 
     1361        public void print() 
     1362        { 
     1363            // void g_relation_print (GRelation *relation); 
     1364            g_relation_print(gRelation); 
     1365        } 
     1366    } 
     1367    else 
     1368    { 
     1369        public override void print() 
     1370        { 
     1371            // void g_relation_print (GRelation *relation); 
     1372            g_relation_print(gRelation); 
     1373        } 
     1374    } 
     1375code: end 
    13021376outFile: Relation 
    13031377 
  • trunk/wrap/APILookupGObject.txt

    r474 r478  
    173173        { 
    174174            //writefln("ObjectG.this\n"); 
    175             setDataFull("GObject",cast(void*)this); 
     175            objectGSetDataFull("GObject",cast(void*)this); 
    176176        } 
    177177    } 
     
    183183     *  data = a pointer 
    184184     */ 
    185     public: void setDataFull(string key, gpointer data) 
     185    public: void objectGSetDataFull(string key, gpointer data) 
    186186    { 
    187187        //writefln("setData objectG=%X data=%X type %s",gObject,data,key); 
  • trunk/wrap/APILookupGdk.txt

    r474 r478  
    246246import: pango.PgLayout 
    247247structWrap: PangoLayout* PgLayout 
     248 
     249override: getData 
    248250  
    249251code: start 
     
    560562structWrap: GdkColormap* Colormap 
    561563 
     564override: toString 
     565 
    562566code: start 
    563567 
     
    599603        this(); 
    600604        //printf("Color.this uint %X\n",rgb); 
    601         set( ((rgb&0xFFFF)),((rgb&0xFFFF00000000)>>32),(rgb&0xFFFF0000)>>16); 
     605        set( cast(ushort)((rgb&0xFFFF)),cast(ushort)((rgb&0xFFFF00000000)>>32),cast(ushort)((rgb&0xFFFF0000)>>16)); 
    602606    } 
    603607 
     
    607611        this(); 
    608612        //printf("Color.this int %X\n",rgb); 
    609         set8( cast(byte)((rgb&0xFF0000)>>16),cast(byte)((rgb&0x00FF00)>>8),cast(byte)(rgb&0xFF)); 
     613        set8( cast(ubyte)((rgb&0xFF0000)>>16),cast(ubyte)((rgb&0x00FF00)>>8),cast(ubyte)(rgb&0xFF)); 
    610614    } 
    611615 
     
    654658        //printf("Color.set %X %X %X\n",red,green,blue); 
    655659         
    656         gdkColor.red = red * 257
    657         gdkColor.green = green * 257
    658         gdkColor.blue = blue * 257
     660        gdkColor.red = cast(ushort)(red * 257)
     661        gdkColor.green = cast(ushort)(green * 257)
     662        gdkColor.blue = cast(ushort)(blue * 257)
    659663        gdkColor.pixel = (red << 16) | (green << 8 ) | blue; 
    660664        //printf("set8 pixel = %X\n", gdkColor.pixel); 
  • trunk/wrap/APILookupGtk.txt

    r475 r478  
    783783import: gdk.Screen 
    784784structWrap: GdkScreen* Screen 
     785 
     786override: getScreen 
     787 
    785788outFile: Invisible 
    786789 
     
    10611064import: gtk.Window 
    10621065 
     1066override: getScreen 
     1067 
    10631068code: start 
    10641069    /** 
     
    11681173import: gtk.Window 
    11691174structWrap: GtkWindow* Window 
     1175 
     1176override: getName 
     1177override: setName 
     1178 
    11701179outFile: AboutDialog 
    11711180 
     
    25922601import: glib.Str 
    25932602structWrap: GtkTreePath* TreePath 
     2603 
     2604override: toString 
    25942605 
    25952606nocode: gtk_tree_path_new 
     
    38053816import: gtk.AccelGroup 
    38063817structWrap: GtkWidget* Widget 
     3818 
    38073819# method conflict with parent method 
    38083820nocode: gtk_menu_item_activate 
     
    38113823# replace the method 
    38123824# TODO create a method rename instead of replacing the entire code 
     3825 
     3826override: select 
     3827override: deselect 
     3828 
    38133829code: start 
    38143830     
     
    41734189structWrap: GtkWidget* Widget 
    41744190 
     4191override: setTooltipText 
     4192override: setTooltipMarkup 
     4193 
    41754194code: start 
    41764195    /** 
     
    41814200     *  tipPrivate = a private text 
    41824201     */ 
    4183     void setTooltip(string tipText, string tipPrivate) 
     4202    override void setTooltip(string tipText, string tipPrivate) 
    41844203    { 
    41854204        Tooltips tt = new Tooltips(); 
     
    51485167     * Removes all children and resizes the table to 1,1 
    51495168     */ 
    5150     void removeAll() 
     5169    override void removeAll() 
    51515170    { 
    51525171        super.removeAll(); 
     
    58685887prefix: gtk_ 
    58695888import: glib.Str 
     5889 
     5890override: setData 
     5891override: getData 
    58705892 
    58715893code: star 
     
    60116033import: gtk.BuildableT 
    60126034 
     6035override: unref 
     6036override: destroy 
     6037override: set 
     6038 
    60136039code: start 
    60146040    // add the Buildable capabilities 
  • trunk/wrap/APILookupPango.txt

    r474 r478  
    216216structWrap: PangoFontDescription* PgFontDescription 
    217217 
     218override: toString 
     219 
    218220code: start 
    219221 
     
    333335import: glib.Str 
    334336structWrap: PangoColor* PgColor 
     337override: toString 
    335338outFile: PgColor 
    336339 
  • trunk/wrap/APILookupSourceView.txt

    r474 r478  
    8585     *  a GtkSourceBuffer 
    8686     */ 
    87     public SourceBuffer getBuffer() 
     87    public override SourceBuffer getBuffer() 
    8888    { 
    8989        // GtkSourceBuffer* gtk_text_view_get_buffer (GtkTextView *text_view); 
  • trunk/wrap/utils/GtkWrapper.d

    r474 r478  
    525525        char[] keys = " file text struct realStruct ctorStruct class template interface extend implements prefix strictPrefix" 
    526526                      " openFile mergeFile closeFile outFile" 
    527                       " copy import import(tango) structWrap alias moduleAlias
     527                      " copy import import(tango) structWrap alias moduleAlias override
    528528                      " noprefix nostruct nocode nosignal" 
    529529                      " code interfaceCode" 
     
    561561                case "alias": loadAA(convParms.aliases, defReader, errors); break; 
    562562                case "moduleAlias": loadAA(convParms.mAliases, defReader, errors); break; 
     563                case "override": convParms.overrides ~= defReader.getValue(); break; 
    563564                case "text": 
    564565                    convParms.text ~= loadTextMultiLine("text"); 
  • trunk/wrap/utils/convparms.d

    r386 r478  
    2121//debug = omitCode; 
    2222//debug = omitSignal; 
     23//debug = overrides; 
    2324 
    2425public struct ConvParms 
     
    5152    public char[][char[]] aliases; 
    5253    public char[][char[]] mAliases; 
     54    public char[][] overrides;      /// list of functions that need override for gtkD to work with dmd 2 
    5355    public char[] classCode;        /// any valid D code to be copied to the final GtkD class 
    5456    public char[] interfaceCode;    /// any valid D code to be copied to the final GtkD interface 
     
    8284        aliases = clear(); 
    8385        mAliases = clear(); 
     86        overrides.length = 0; 
    8487        classCode.length = 0; 
    8588        interfaceCode.length = 0; 
     
    169172            text ~= "\n * \t- "~key~" -> "~aliases[key]; 
    170173        } 
     174        text ~= "\n * overrides:"; 
     175        foreach ( char[] over ; overrides ) 
     176        { 
     177            text ~= "\n * \t- "~over; 
     178        } 
    171179        text ~= "\n */\n\n"; 
    172180        return text; 
     
    209217    }    
    210218 
     219    public bool needsOverride(char[] functionName) 
     220    { 
     221        bool needed = false; 
     222        int i=0; 
     223        while ( !needed && i<overrides.length ) 
     224        { 
     225            needed = functionName == overrides[i]; 
     226            debug(overrides)writefln("\t (%s) %s ?= %s", needed, functionName, overrides[i]); 
     227            ++i; 
     228        } 
     229        debug(overrides)writefln("\t (%s) %s %s", i, (needed?"override >>>>>>>":"no override <<<<<"), functionName); 
     230        return needed; 
     231    } 
     232 
    211233    public bool omitCode(char[] codeName) 
    212234    { 
  • trunk/wrap/utils/funct.d

    r474 r478  
    412412                convName ~= convParms.outFile; 
    413413            } 
     414            char[] overr; 
     415            if (convParms.needsOverride(convName)) 
     416            { 
     417                overr = "override "; 
     418            } 
    414419            if ( convParms.strct.length>0  
    415420                && parmsType.length > 0  
     
    417422                ) 
    418423            { 
    419                 dec = "public "~typeWrap~" "~convName~"("; 
    420             } 
    421             else 
    422             { 
    423                 dec = "public static "~typeWrap~" "~convName~"("; 
     424                dec = "public "~overr~typeWrap~" "~convName~"("; 
     425            } 
     426            else 
     427            { 
     428                dec = "public static "~overr~typeWrap~" "~convName~"("; 
    424429            } 
    425430            ctor = false;