From: Jerome St-Louis Date: Fri, 1 Mar 2013 06:14:47 +0000 (-0500) Subject: eda, compiler, documentor: Proper prototypes for invoking virtual methods directly X-Git-Tag: 0.44.04~86 X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?p=sdk;a=commitdiff_plain;h=63890f13f739d88160e8f59006a0e0e36c5bdc33 eda, compiler, documentor: Proper prototypes for invoking virtual methods directly --- diff --git a/compiler/bootstrap/ecc/bootstrap/ecc.main.c b/compiler/bootstrap/ecc/bootstrap/ecc.main.c index c0beb67..04f1bab 100644 --- a/compiler/bootstrap/ecc/bootstrap/ecc.main.c +++ b/compiler/bootstrap/ecc/bootstrap/ecc.main.c @@ -633,7 +633,7 @@ _class = __ecereNameSpace__ecere__com__eSystem_FindClass(__currentModule, "Compi __ecereNameSpace__ecere__com__eInstance_Evolve((struct __ecereNameSpace__ecere__com__Instance **)&__currentModule, _class); __thisModule = __currentModule; __ecereCreateModuleInstances_ecc(); -((struct __ecereNameSpace__ecere__com__Instance *)(char *)__currentModule)->_vTbl[12](__currentModule); +((void (*)(void *))(void *)((struct __ecereNameSpace__ecere__com__Instance *)(char *)__currentModule)->_vTbl[12])(__currentModule); __ecereDestroyModuleInstances_ecc(); __ecereNameSpace__ecere__UnloadTranslatedStrings(__currentModule); _class = __ecereNameSpace__ecere__com__eSystem_FindClass(__currentModule, "ecere::com::Application"); diff --git a/compiler/bootstrap/ecp/bootstrap/ecp.main.c b/compiler/bootstrap/ecp/bootstrap/ecp.main.c index 102f025..4624539 100644 --- a/compiler/bootstrap/ecp/bootstrap/ecp.main.c +++ b/compiler/bootstrap/ecp/bootstrap/ecp.main.c @@ -680,7 +680,7 @@ _class = __ecereNameSpace__ecere__com__eSystem_FindClass(__currentModule, "Preco __ecereNameSpace__ecere__com__eInstance_Evolve((struct __ecereNameSpace__ecere__com__Instance **)&__currentModule, _class); __thisModule = __currentModule; __ecereCreateModuleInstances_ecp(); -((struct __ecereNameSpace__ecere__com__Instance *)(char *)__currentModule)->_vTbl[12](__currentModule); +((void (*)(void *))(void *)((struct __ecereNameSpace__ecere__com__Instance *)(char *)__currentModule)->_vTbl[12])(__currentModule); __ecereDestroyModuleInstances_ecp(); __ecereNameSpace__ecere__UnloadTranslatedStrings(__currentModule); _class = __ecereNameSpace__ecere__com__eSystem_FindClass(__currentModule, "ecere::com::Application"); diff --git a/compiler/bootstrap/ecs/bootstrap/ecs.c b/compiler/bootstrap/ecs/bootstrap/ecs.c index b590bd7..bf2ff0d 100644 --- a/compiler/bootstrap/ecs/bootstrap/ecs.c +++ b/compiler/bootstrap/ecs/bootstrap/ecs.c @@ -1268,7 +1268,7 @@ if(isDynamicLibrary) } if(!isDynamicLibrary && thisAppClass) { -__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " __currentModule._vTbl[12](__currentModule);\n"); +__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " ((void(*)(void *))(void *)__currentModule._vTbl[12])(__currentModule);\n"); } if(isDynamicLibrary) { diff --git a/compiler/bootstrap/ecs/bootstrap/ecs.main.c b/compiler/bootstrap/ecs/bootstrap/ecs.main.c index d9936a4..fd8338f 100644 --- a/compiler/bootstrap/ecs/bootstrap/ecs.main.c +++ b/compiler/bootstrap/ecs/bootstrap/ecs.main.c @@ -698,7 +698,7 @@ _class = __ecereNameSpace__ecere__com__eSystem_FindClass(__currentModule, "Symbo __ecereNameSpace__ecere__com__eInstance_Evolve((struct __ecereNameSpace__ecere__com__Instance **)&__currentModule, _class); __thisModule = __currentModule; __ecereCreateModuleInstances_ecs(); -((struct __ecereNameSpace__ecere__com__Instance *)(char *)__currentModule)->_vTbl[12](__currentModule); +((void (*)(void *))(void *)((struct __ecereNameSpace__ecere__com__Instance *)(char *)__currentModule)->_vTbl[12])(__currentModule); __ecereDestroyModuleInstances_ecs(); __ecereNameSpace__ecere__UnloadTranslatedStrings(__currentModule); _class = __ecereNameSpace__ecere__com__eSystem_FindClass(__currentModule, "ecere::com::Application"); diff --git a/compiler/ecs/ecs.ec b/compiler/ecs/ecs.ec index 81a11e8..e4658e3 100644 --- a/compiler/ecs/ecs.ec +++ b/compiler/ecs/ecs.ec @@ -687,7 +687,7 @@ static void WriteMain(char * fileName) } if(!isDynamicLibrary && thisAppClass) { - f.Printf(" __currentModule._vTbl[12](__currentModule);\n"); + f.Printf(" ((void(*)(void *))(void *)__currentModule._vTbl[12])(__currentModule);\n"); } if(isDynamicLibrary) diff --git a/documentor/src/Documentor.ec b/documentor/src/Documentor.ec index 39052ff..337d117 100644 --- a/documentor/src/Documentor.ec +++ b/documentor/src/Documentor.ec @@ -887,6 +887,8 @@ class APIPageClass : APIPage bool needClass = true; Class dataClass; Class base = cl; + char tempString[1024]; + String s; while(base.type == enumClass) base = base.base; if(base.type == systemClass || @@ -915,14 +917,14 @@ class APIPageClass : APIPage if(dataClass.type == systemClass) { needClass = false; - dataClass._vTbl[__ecereVMethodID_class_OnGetString](dataClass, &item.data, string, sizeof(string), &needClass); + s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)dataClass._vTbl[__ecereVMethodID_class_OnGetString])(dataClass, &item.data, tempString, null, &needClass); } else - eSystem_FindClass(componentsApp, "class")._vTbl[__ecereVMethodID_class_OnGetString](dataClass, &item.data, string, sizeof(string), &needClass); + s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)eSystem_FindClass(componentsApp, "class")._vTbl[__ecereVMethodID_class_OnGetString])(dataClass, &item.data, tempString, null, &needClass); if(needClass) - f.Printf("%s { %s }", dataClass.name, string); + f.Printf("%s { %s }", dataClass.name, s); else - f.Printf("%s", string); + f.Printf("%s", s); if(desc) { if(editing) diff --git a/eda/drivers/sqlite/EDASQLite.ec b/eda/drivers/sqlite/EDASQLite.ec index 606b493..2db89f9 100644 --- a/eda/drivers/sqlite/EDASQLite.ec +++ b/eda/drivers/sqlite/EDASQLite.ec @@ -49,10 +49,10 @@ int CollationCompare(Class type, int count1, void * data1, int count2, void * da SerialBuffer buffer1 { size = count1, count = count1, buffer = data1 }; SerialBuffer buffer2 { size = count2, count = count2, buffer = data2 }; - type._vTbl[__ecereVMethodID_class_OnUnserialize](type, &inst1, buffer1); - type._vTbl[__ecereVMethodID_class_OnUnserialize](type, &inst2, buffer2); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, &inst1, buffer1); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, &inst2, buffer2); - result = type._vTbl[__ecereVMethodID_class_OnCompare](type, inst1, inst2); + result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, inst1, inst2); buffer1.buffer = null; buffer2.buffer = null; @@ -71,10 +71,10 @@ int CollationCompare(Class type, int count1, void * data1, int count2, void * da inst1 = new0 byte[type.structSize]; inst2 = new0 byte[type.structSize]; - type._vTbl[__ecereVMethodID_class_OnUnserialize](type, inst1, buffer1); - type._vTbl[__ecereVMethodID_class_OnUnserialize](type, inst2, buffer2); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, inst1, buffer1); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, inst2, buffer2); - result = type._vTbl[__ecereVMethodID_class_OnCompare](type, inst1, inst2); + result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, inst1, inst2); buffer1.buffer = null; buffer2.buffer = null; @@ -85,7 +85,7 @@ int CollationCompare(Class type, int count1, void * data1, int count2, void * da return result; } else - return type._vTbl[__ecereVMethodID_class_OnCompare](type, data1, data2); + return ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, data1, data2); } public class SQLiteStaticLink { } // Until .imp generation is fixed @@ -672,7 +672,7 @@ void SQLiteFunctionProcessor(sqlite3_context* context, int n, sqlite3_value** va buffer._buffer = sqlite3_value_text(values[i]); //buffer._buffer = sqlite3_value_blob(curStatement); buffer.count = buffer._size; - a._vTbl[__ecereVMethodID_class_OnUnserialize](a, data, buffer); + ((void (*)(void *, void *, void *))(void *)a._vTbl[__ecereVMethodID_class_OnUnserialize])(a, data, buffer); buffer._buffer = null; //delete buffer; } @@ -775,12 +775,12 @@ void SQLiteFunctionProcessor(sqlite3_context* context, int n, sqlite3_value** va else { SerialBuffer buffer { }; - r._vTbl[__ecereVMethodID_class_OnSerialize](r, data, buffer); + ((void (*)(void *, void *, void *))(void *)r._vTbl[__ecereVMethodID_class_OnSerialize])(r, data, buffer); sqlite3_result_text(context, buffer._buffer, buffer.count, SQLITE_TRANSIENT); delete buffer; // Avoid destroying Strings for now... (Returning memory owned by the Custom Function) - r._vTbl[__ecereVMethodID_class_OnFree](r, data); + ((void (*)(void *, void *))(void *)r._vTbl[__ecereVMethodID_class_OnFree])(r, data); } if(r.type == structClass) @@ -840,7 +840,7 @@ void SQLiteFunctionProcessor(sqlite3_context* context, int n, sqlite3_value** va { // Free instance void * data = *(void **)arg.data; - type._vTbl[__ecereVMethodID_class_OnFree](type, data); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, data); // Free arg holder data = arg.data; delete data; @@ -1433,7 +1433,7 @@ class SQLiteRow : DriverRow if((void *)data) { buffer = SerialBuffer { }; - dataType._vTbl[__ecereVMethodID_class_OnSerialize](dataType, data, buffer); + ((void (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnSerialize])(dataType, data, buffer); result = sqlite3_bind_text(statement, pos, buffer._buffer, buffer.count, SQLITE_TRANSIENT); } else @@ -1534,7 +1534,7 @@ class SQLiteRow : DriverRow else ((bool (*)())(void *)this.BindData)(this, stmt, (*bindId)++, fld, type, dataPtr, null); - type._vTbl[__ecereVMethodID_class_OnFree](type, dataPtr); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, dataPtr); } // delete dataRow; } @@ -1878,7 +1878,7 @@ class SQLiteRow : DriverRow buffer._buffer = sqlite3_column_text(curStatement, num); buffer.count = buffer._size; - dataType._vTbl[__ecereVMethodID_class_OnUnserialize](dataType, data, buffer); + ((void (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnUnserialize])(dataType, data, buffer); buffer._buffer = null; delete buffer; @@ -1989,7 +1989,7 @@ class SQLiteRow : DriverRow sqlite3_reset(queryStatement); { SerialBuffer buffer { }; - type._vTbl[__ecereVMethodID_class_OnSerialize](type, data, buffer); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnSerialize])(type, data, buffer); result = sqlite3_bind_text(queryStatement, paramID, buffer._buffer, buffer.count, SQLITE_TRANSIENT); delete buffer; } diff --git a/eda/libeda/src/EDA.ec b/eda/libeda/src/EDA.ec index 6fcc36f..453a842 100644 --- a/eda/libeda/src/EDA.ec +++ b/eda/libeda/src/EDA.ec @@ -372,7 +372,7 @@ public: dr.SetData(df, (void *)data); // Is this missing some frees here? strings? Probably not: freeData = true? - // type._vTbl[__ecereVMethodID_class_OnFree](type, data); + // ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, data); if(type.type == structClass) { void * dataPtr = (void *)data; diff --git a/eda/libeda/src/EDB.ec b/eda/libeda/src/EDB.ec index 173f494..7afa2e1 100644 --- a/eda/libeda/src/EDB.ec +++ b/eda/libeda/src/EDB.ec @@ -627,11 +627,11 @@ static int IndexCompareRows(IndexBinaryTree tree, uint r1, uint r2) } ((bool (*)())(void *)row1.GetData)(row1, field, type, (type.type == structClass) ? (void *)data1 : &data1); ((bool (*)())(void *)row2.GetData)(row2, field, type, (type.type == structClass) ? (void *)data2 : &data2); - fieldResult = order * type._vTbl[__ecereVMethodID_class_OnCompare](type, + fieldResult = order * ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &data1 : (void *)data1, (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &data2 : (void *)data2); - type._vTbl[__ecereVMethodID_class_OnFree](type, data1); - type._vTbl[__ecereVMethodID_class_OnFree](type, data2); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data1); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data2); if(field.type.type == structClass) { void * dataPtr = (void *)data1; @@ -1012,7 +1012,7 @@ static class EDBRow : DriverRow if(((field.num < numFields && offsets[field.num-1] && offsets[field.num-1] != offsets[field.num]) || (field.num == numFields && offsets[field.num-1]))) { f.Seek(offsets[field.num-1], start); - field.type._vTbl[__ecereVMethodID_class_OnUnserialize](field.type, data, f); + ((void (*)(void *, void *, void *))(void *)field.type._vTbl[__ecereVMethodID_class_OnUnserialize])(field.type, data, f); result = true; } @@ -1084,7 +1084,7 @@ static class EDBRow : DriverRow // Update the offset of the field we're writing to offsets[field.num-1] = tf.Tell(); // Serialize the data we're writing - field.type._vTbl[__ecereVMethodID_class_OnSerialize](field.type, data, tf); + ((void (*)(void *, void *, void *))(void *)field.type._vTbl[__ecereVMethodID_class_OnSerialize])(field.type, data, tf); if(field.num < numFields) { @@ -1265,14 +1265,14 @@ static class EDBRow : DriverRow f.Seek(offsets[field.num-1], start); if(type.type == structClass) read = (int64)new0 byte[type.structSize]; - type._vTbl[__ecereVMethodID_class_OnUnserialize](type, (type.type == structClass) ? (void *)read : &read, f); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, (type.type == structClass) ? (void *)read : &read, f); } //if(data._class == type) { - result = type._vTbl[__ecereVMethodID_class_OnCompare](type, + result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &read : (void *)read, data); } - type._vTbl[__ecereVMethodID_class_OnFree](type, read); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)read); if(type.type == structClass) { void * dataPtr = (void *)read; @@ -1470,15 +1470,15 @@ static class EDBRow : DriverRow if(type.type == structClass) read = (int64)new0 byte[type.structSize]; - type._vTbl[__ecereVMethodID_class_OnUnserialize](type, (type.type == structClass) ? (void *)read : &read, f); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, (type.type == structClass) ? (void *)read : &read, f); } //if(data._class == type) { - result = order * type._vTbl[__ecereVMethodID_class_OnCompare](type, + result = order * ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &read : (void *)read, (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &findData[c].value.i64 : (void *)findData[c].value.i64); } - type._vTbl[__ecereVMethodID_class_OnFree](type, read); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)read); if(type.type == structClass) { void * dataPtr = (void *)read; diff --git a/eda/libeda/src/gui.ec b/eda/libeda/src/gui.ec index 58382c4..dc6a7f3 100644 --- a/eda/libeda/src/gui.ec +++ b/eda/libeda/src/gui.ec @@ -93,8 +93,8 @@ String GetNameString(Row r, Field nameField) if(type.type == structClass) data = (int64)new0 byte[type.structSize]; ((bool (*)())(void *)r.GetData)(r, nameField, type, (type.type == structClass) ? (void *)data : &data); - s = CopyString((String)type._vTbl[__ecereVMethodID_class_OnGetString](type, (void *)data, tempString, null, null)); - type._vTbl[__ecereVMethodID_class_OnFree](type, data); + s = CopyString(((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, (void *)data, tempString, null, null)); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data); if(type.type == structClass) { void * _data = (void *)data; @@ -387,7 +387,7 @@ public class FieldDataBox : DataBox if(dataHolder) { - type._vTbl[__ecereVMethodID_class_OnFree](type, dataHolder); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)dataHolder); if(type.type == structClass) { void * dataPtr = (void *)dataHolder; @@ -535,7 +535,7 @@ public class FieldDataBox : DataBox if(dataHolder) { - type._vTbl[__ecereVMethodID_class_OnFree](type, dataHolder); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)dataHolder); if(type.type == structClass) { void * dataPtr = (void *)dataHolder; diff --git a/eda/libeda/src/gui/TableEditor.ec b/eda/libeda/src/gui/TableEditor.ec index 79d6186..7641cf1 100644 --- a/eda/libeda/src/gui/TableEditor.ec +++ b/eda/libeda/src/gui/TableEditor.ec @@ -120,7 +120,7 @@ public: buffer.buffer = ptr; buffer.count = MAXINT; buffer.pos = 0; - class(NT)._vTbl[__ecereVMethodID_class_OnUnserialize](class(NT), &pn, buffer); + ((void (*)(void *, void *, void *))(void *)class(NT)._vTbl[__ecereVMethodID_class_OnUnserialize])(class(NT), &pn, buffer); result = NoCaseAccent::function((pn && pn.name) ? pn.name : null); delete pn; buffer.buffer = null; @@ -585,10 +585,10 @@ public: data = &dataHolder; }*/ if(data) - dataType._vTbl[__ecereVMethodID_class_OnGetDataFromString](dataType, data, newText); + ((bool (*)(void *, void *, const char *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetDataFromString])(dataType, data, newText); - /*dataType._vTbl[__ecereVMethodID_class_OnFree](dataType, dataHolder); + /*((void (*)(void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnFree])(dataType, dataHolder); if(dataType.type == structClass) { void * dataPtr = (void *)dataHolder; @@ -1056,7 +1056,7 @@ private: if(strstr(sf.field.type.name, "PersonName")) { void * pn; - sf.field.type._vTbl[__ecereVMethodID_class_OnGetDataFromString](sf.field.type, &pn, searchCI.array); + ((bool (*)(void *, void *, const char *))(void *)sf.field.type._vTbl[__ecereVMethodID_class_OnGetDataFromString])(sf.field.type, &pn, searchCI.array); row.SetQueryParamObject(++bindId, pn, sf.field.type); bindId++; delete pn; @@ -1255,6 +1255,7 @@ private: char tempString[MAX_F_STRING]; int64 data = 0; Class type = field.type; + String s; if(type.type == unitClass && !type.typeSize) { Class dataType = eSystem_FindClass(type.module, type.dataTypeString); @@ -1266,15 +1267,15 @@ private: ((bool (*)())(void *)row.GetData)(row, field, type, (type.type == structClass) ? (void *)data : &data); if(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass) - field.type._vTbl[__ecereVMethodID_class_OnGetString](field.type, &data, tempString, null, null); + s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.type._vTbl[__ecereVMethodID_class_OnGetString])(field.type, &data, tempString, null, null); else - field.type._vTbl[__ecereVMethodID_class_OnGetString](field.type, (void *)data, tempString, null, null); + s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)field.type._vTbl[__ecereVMethodID_class_OnGetString])(field.type, (void *)data, tempString, null, null); - if(tempString[0]) - ProcessWordListString(tempString, method, id); + if(s && s[0]) + ProcessWordListString(s, method, id); if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass)) - type._vTbl[__ecereVMethodID_class_OnFree](type, data); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data); if(type.type == structClass) delete data; } @@ -1571,7 +1572,7 @@ private: s = lf.CustomLookup((int)data); listRow.SetData(lf.dataField, s); if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass)) - type._vTbl[__ecereVMethodID_class_OnFree](type, data); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data); if(type.type == structClass) delete data; delete s; // ? @@ -1582,6 +1583,7 @@ private: char tempString[MAX_F_STRING]; int64 data = 0; Class type = lf.field.type; + String s; if(type.type == unitClass && !type.typeSize) { Class dataType = eSystem_FindClass(type.module, type.dataTypeString); @@ -1592,14 +1594,14 @@ private: data = (int64)new0 byte[type.structSize]; ((bool (*)())(void *)dbRow.GetData)(dbRow, lf.field, type, (type.type == structClass) ? (void *)data : &data); if(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass) - lf.field.type._vTbl[__ecereVMethodID_class_OnGetString](lf.field.type, &data, tempString, null, null); + s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)lf.field.type._vTbl[__ecereVMethodID_class_OnGetString])(lf.field.type, &data, tempString, null, null); else - lf.field.type._vTbl[__ecereVMethodID_class_OnGetString](lf.field.type, (void*)data, tempString, null, null); + s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)lf.field.type._vTbl[__ecereVMethodID_class_OnGetString])(lf.field.type, (void*)data, tempString, null, null); - listRow.SetData(lf.dataField, tempString); + listRow.SetData(lf.dataField, s); if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass)) - type._vTbl[__ecereVMethodID_class_OnFree](type, data); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data); if(type.type == structClass) delete data; } @@ -1623,7 +1625,7 @@ private: else listRow.SetData(lf.dataField, (void *)data); if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass)) - type._vTbl[__ecereVMethodID_class_OnFree](type, data); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data); if(type.type == structClass) delete data; } diff --git a/eda/libeda/src/gui/controls/FieldBox.ec b/eda/libeda/src/gui/controls/FieldBox.ec index 922cb7a..6fc3bc9 100644 --- a/eda/libeda/src/gui/controls/FieldBox.ec +++ b/eda/libeda/src/gui/controls/FieldBox.ec @@ -71,7 +71,7 @@ public class FieldBox : DataBox if(dataHolder) { - type._vTbl[__ecereVMethodID_class_OnFree](type, dataHolder); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)dataHolder); if(type.type == structClass) { void * dataPtr = (void *)dataHolder; @@ -225,7 +225,7 @@ public class FieldBox : DataBox if(dataHolder) { - type._vTbl[__ecereVMethodID_class_OnFree](type, dataHolder); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)dataHolder); if(type.type == structClass) { void * dataPtr = (void *)dataHolder; diff --git a/eda/libeda/src/idList.ec b/eda/libeda/src/idList.ec index f891bce..272fa33 100644 --- a/eda/libeda/src/idList.ec +++ b/eda/libeda/src/idList.ec @@ -209,13 +209,14 @@ public class Id : uint ((bool (*)())(void *)r.GetData)(r, *nameField, type, (type.type == structClass) ? (void *)data : &data); if(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass) - name = (String)type._vTbl[__ecereVMethodID_class_OnGetString](type, (void *)&data, tempString, null, null); + name = ((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, (void *)&data, tempString, null, null); else - name = (String)type._vTbl[__ecereVMethodID_class_OnGetString](type, (void *)data, tempString, null, null); + name = ((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, (void *)data, tempString, null, null); - strcpy(tempString, name ? name : ""); + if(name && name != tempString) + strcpy(tempString, name ? name : ""); if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass)) - type._vTbl[__ecereVMethodID_class_OnFree](type, data); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data); } else { @@ -354,12 +355,13 @@ public: { char tempString[256]; Class type = class_data(type); + String s; if(c) strcat(stringOutput, ", "); if(type) - type._vTbl[__ecereVMethodID_class_OnGetString](type, &ids[c], tempString, null, null); + s = ((char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &ids[c], tempString, null, null); // strcatf(stringOutput, "%d", ids[c]); - strcat(stringOutput, tempString); + strcat(stringOutput, s); } } return stringOutput; @@ -865,7 +867,7 @@ public struct DataList : OldList { if(type.type == structClass) link.data = new0 byte[type.structSize]; - type._vTbl[__ecereVMethodID_class_OnUnserialize](type, (type.type == structClass) ? link.data : &link.data, channel); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, (type.type == structClass) ? link.data : &link.data, channel); } Add(link); } @@ -886,9 +888,9 @@ public struct DataList : OldList { channel.Serialize(truth); if(type.type == bitClass || type.type == unitClass || (type.type == systemClass && type.typeSize)) - type._vTbl[__ecereVMethodID_class_OnSerialize](type, &node.data, channel); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnSerialize])(type, &node.data, channel); else - type._vTbl[__ecereVMethodID_class_OnSerialize](type, node.data, channel); + ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnSerialize])(type, node.data, channel); node = node.next; } else @@ -912,7 +914,7 @@ public struct DataList : OldList else { Class type = class_data(type); - result = type._vTbl[__ecereVMethodID_class_OnCompare](type, + result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &nodeA.data : (void *)nodeA.data, (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &nodeB.data : (void *)nodeB.data); if(result) return result; @@ -1167,7 +1169,7 @@ public struct DataList : OldList else if(type.type == structClass) delete node.data; else - type._vTbl[__ecereVMethodID_class_OnFree](type, node.data); + ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, node.data); } Delete(node); } diff --git a/extras/gui/skins/SimSkin.ec b/extras/gui/skins/SimSkin.ec index 3034e8b..bdd6332 100644 --- a/extras/gui/skins/SimSkin.ec +++ b/extras/gui/skins/SimSkin.ec @@ -519,7 +519,7 @@ static void Button::Close_OnRedraw(Surface surface) } }*/ -#define PUREVTBL(c) ((int (**)())*(void **)((byte *)class(c).data + 4)) +#define PUREVTBL(c) ((int (**)())*(void **)((byte *)class(c).data + sizeof(void *))) extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics; extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw; @@ -543,7 +543,7 @@ class SimSkin_Button : Button void OnRedraw(Surface surface) { int isDefault = (int)this.isDefault; - PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface); + ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface); if(bevel || (bevelOver && (buttonState == down || buttonState == over || checked))) { Color c = steelBlue; @@ -629,7 +629,7 @@ class SimSkin_Button : Button { if(isRadio) { - PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface); + ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface); return; } // if(bevel) @@ -889,7 +889,7 @@ class SimSkin_ScrollBar : ScrollBar { void OnApplyGraphics() { - PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); //background = { skinBackground.r * 9 / 6, skinBackground.g * 9 / 6, skinBackground.b * 9 / 6 }; /* @@ -905,7 +905,7 @@ class SimSkin_ScrollBar : ScrollBar { void OnApplyGraphics() { - PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); button.bitmap = { "<:ecere>elements/arrowDown.png", monochrome = true }; background = skinBackground; foreground = skinForeground; @@ -917,7 +917,7 @@ class SimSkin_ScrollBar : ScrollBar { void OnApplyGraphics() { - PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); background = skinBackground; foreground = skinForeground; selectionColor = skinMainColor; diff --git a/extras/types/Currency.ec b/extras/types/Currency.ec index d30c09c..af81426 100644 --- a/extras/types/Currency.ec +++ b/extras/types/Currency.ec @@ -82,6 +82,6 @@ public class Currency : double } } number[len] = 0; - return class(double)._vTbl[__ecereVMethodID_class_OnGetDataFromString](class(double), &this, number); + return ((bool (*)(void *, void *, const char *))(void *)class(double)._vTbl[__ecereVMethodID_class_OnGetDataFromString])(class(double), &this, number); } } diff --git a/samples/guiAndGfx/skinning/AcovelSkin.ec b/samples/guiAndGfx/skinning/AcovelSkin.ec index d5bef06..5918e86 100644 --- a/samples/guiAndGfx/skinning/AcovelSkin.ec +++ b/samples/guiAndGfx/skinning/AcovelSkin.ec @@ -479,7 +479,7 @@ class AcovelSkin_FileDialog : FileDialog } } -#define PUREVTBL(c) ((int (**)())*(void **)((byte *)class(c).data + 4)) +#define PUREVTBL(c) ((int (**)())*(void **)((byte *)class(c).data + sizeof(void *))) extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics; extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw; @@ -503,7 +503,7 @@ class AcovelSkin_Button : Button void OnRedraw(Surface surface) { int isDefault = (int)this.isDefault; - PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface); + ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface); if(bevel || (bevelOver && (buttonState == down || buttonState == over || checked))) { Color c = steelBlue; @@ -587,7 +587,7 @@ class AcovelSkin_ScrollBar : ScrollBar { void OnApplyGraphics() { - PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); background = { skinBackground.r * 9 / 6, skinBackground.g * 9 / 6, skinBackground.b * 9 / 6 }; @@ -603,7 +603,7 @@ class AcovelSkin_DropBox : DropBox { void OnApplyGraphics() { - PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); button.bitmap = { "<:ecere>elements/arrowDown.png", monochrome = true }; background = skinBackground; foreground = skinForeground; @@ -615,7 +615,7 @@ class AcovelSkin_ListBox : ListBox { void OnApplyGraphics() { - PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); background = skinBackground; foreground = skinForeground; this.selectionColor = ::selectionColor; diff --git a/samples/guiAndGfx/skinning/MySkin.ec b/samples/guiAndGfx/skinning/MySkin.ec index ef7f3b9..a6bd5c7 100644 --- a/samples/guiAndGfx/skinning/MySkin.ec +++ b/samples/guiAndGfx/skinning/MySkin.ec @@ -91,7 +91,7 @@ BitmapResource bmpTopRightBorder { ":topRightBorder.png", alphaBlend = true }; BitmapResource bmpBottomLeftBorder { ":bottomLeftBorder.png", alphaBlend = true }; BitmapResource bmpBottomRightBorder { ":bottomRightBorder.png", alphaBlend = true }; -#define PUREVTBL(c) ((int (**)())*(void **)((byte *)class(c).data + 4)) +#define PUREVTBL(c) ((int (**)())*(void **)((byte *)class(c).data + sizeof(void *))) default: @@ -168,7 +168,7 @@ public class MySkin_ScrollBar : ScrollBar bool OnPostCreate() { - bool result = PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnPostCreate](this); + bool result = ((bool (*)(Window))(void *)PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnPostCreate])(this); AddResource(bmpScrollUp); AddResource(bmpScrollDown); @@ -211,7 +211,7 @@ public class MySkin_Button : Button { bool OnResizing(int *width, int *height) { - bool result = PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnResizing](this, width, height); + bool result = ((bool (*)(Window, int*, int*))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnResizing])(this, width, height); if(!bitmap) { int w; @@ -286,7 +286,7 @@ public class MySkin_Button : Button { if(bitmap) { - return PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface); + ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface); } else { diff --git a/samples/guiAndGfx/skinning/SimSkin.ec b/samples/guiAndGfx/skinning/SimSkin.ec index feea6b2..a86d7cf 100644 --- a/samples/guiAndGfx/skinning/SimSkin.ec +++ b/samples/guiAndGfx/skinning/SimSkin.ec @@ -471,7 +471,7 @@ static void Button::Close_OnRedraw(Surface surface) } }*/ -#define PUREVTBL(c) ((int (**)())*(void **)((byte *)class(c).data + 4)) +#define PUREVTBL(c) ((int (**)())*(void **)((byte *)class(c).data + sizeof(void *))) extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics; extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw; @@ -495,7 +495,7 @@ class SimSkin_Button : Button void OnRedraw(Surface surface) { int isDefault = (int)this.isDefault; - PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface); + ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface); if(bevel || (bevelOver && (buttonState == down || buttonState == over || checked))) { Color c = steelBlue; @@ -581,7 +581,7 @@ class SimSkin_Button : Button { if(isRadio) { - PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface); + ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface); return; } // if(bevel) @@ -841,7 +841,7 @@ class SimSkin_ScrollBar : ScrollBar { void OnApplyGraphics() { - PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); //background = { skinBackground.r * 9 / 6, skinBackground.g * 9 / 6, skinBackground.b * 9 / 6 }; /* @@ -857,7 +857,7 @@ class SimSkin_ScrollBar : ScrollBar { void OnApplyGraphics() { - PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); button.bitmap = { "<:ecere>elements/arrowDown.png", monochrome = true }; background = skinBackground; foreground = skinForeground; @@ -869,7 +869,7 @@ class SimSkin_ScrollBar : ScrollBar { void OnApplyGraphics() { - PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this); + ((void (*)(Window))(void *)PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this); background = skinBackground; foreground = skinForeground; selectionColor = skinMainColor;