From: Jerome St-Louis Date: Thu, 21 Mar 2013 04:13:36 +0000 (-0400) Subject: ecere/com; gfx: Improvements to cross-compiling to 32 bit X-Git-Tag: 0.44.06~9 X-Git-Url: http://ecere.com/cgi-bin/gitweb.cgi?p=sdk;a=commitdiff_plain;h=bf4024f7c4d63de90c38b61ac89ea3e12a1a4e61 ecere/com; gfx: Improvements to cross-compiling to 32 bit --- diff --git a/compiler/bootstrap/ecere/bootstrap/instance.c b/compiler/bootstrap/ecere/bootstrap/instance.c index a579f56..fbbc412 100644 --- a/compiler/bootstrap/ecere/bootstrap/instance.c +++ b/compiler/bootstrap/ecere/bootstrap/instance.c @@ -1449,7 +1449,17 @@ unsigned int force64Bits = ((unsigned int)((struct __ecereNameSpace__ecere__com_ unsigned int force32Bits = ((unsigned int)((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application + structSize_Module)))->isGUIApp & 4) ? 0x1 : 0x0; unsigned int inCompiler = ((unsigned int)((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application + structSize_Module)))->isGUIApp & 8) ? 0x1 : 0x0; unsigned int crossBits = force32Bits || force64Bits; +unsigned int fixed = 0x0; +if(inCompiler && crossBits) +{ +struct __ecereNameSpace__ecere__com__Class * c = __ecereNameSpace__ecere__com__eSystem_FindClass(((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application, name); + +if(c && c->fixed) +fixed = 0x1; +else if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 24)))->name && !strcmp(((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->name, "ecereCOM")) +fixed = 0x1; +} { nameSpace = (declMode == 1) ? &((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace : &((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->privateNameSpace; if(declMode == 4) @@ -1782,10 +1792,10 @@ id++; } _class->memberID = _class->startMemberID = (base && (type == 0 || type == 5 || type == 1)) ? base->memberID : 0; if(type == 0 || type == 5) -_class->offset = (base && base->structSize && base->type != 1000) ? base->structSize : ((type == 5) ? 0 : (force64Bits ? 24 : (force32Bits && inCompiler) ? 12 : structSize_Instance)); +_class->offset = (base && base->structSize && base->type != 1000) ? base->structSize : ((type == 5) ? 0 : ((force64Bits && inCompiler && fixed) ? 24 : (force32Bits && inCompiler && fixed) ? 12 : structSize_Instance)); if(crossBits) { -if(strstr(name, "ecere::sys::EARHeader") || strstr(name, "AnchorValue") || !strcmp(name, "ecere::com::CustomAVLTree") || !strcmp(name, "ecere::gui::Window") || !strcmp(name, "ecere::sys::Mutex")) +if(strstr(name, "ecere::sys::EARHeader") || strstr(name, "AnchorValue") || !strcmp(name, "ecere::com::CustomAVLTree") || !strcmp(name, "ecere::com::Array") || !strcmp(name, "ecere::gui::Window") || !strcmp(name, "ecere::sys::Mutex")) ; else { @@ -1822,6 +1832,7 @@ else if(!strcmp(name, "ecere::sys::BinaryTree")) size = 0; else if(module != ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application && inCompiler) { +if(fixed || type == 1) size = 0; } } diff --git a/compiler/bootstrap/libec/bootstrap/pass15.c b/compiler/bootstrap/libec/bootstrap/pass15.c index 313b617..e778911 100644 --- a/compiler/bootstrap/libec/bootstrap/pass15.c +++ b/compiler/bootstrap/libec/bootstrap/pass15.c @@ -2776,7 +2776,14 @@ maxSize = _class->structSize; if(_class->type == 1 || _class->type == 5) AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0))); else -maxSize -= _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize; +{ +unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize; + +if(maxSize > baseSize) +maxSize -= baseSize; +else +maxSize = 0; +} } } for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next) diff --git a/compiler/libec/locale/ec.pot b/compiler/libec/locale/ec.pot index 8c341b7..fa6e18a 100644 --- a/compiler/libec/locale/ec.pot +++ b/compiler/libec/locale/ec.pot @@ -10,12 +10,12 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Basepath: ../\n" -#: ./src/pass15.ec:3187 -#: ./src/pass15.ec:3213 +#: ./src/pass15.ec:3193 +#: ./src/pass15.ec:3219 msgid "%s expected to be derived from method class\n" msgstr "%s expected to be derived from method class\n" -#: ./src/pass15.ec:8975 +#: ./src/pass15.ec:8981 msgid "%s undefined; assuming extern returning int\n" msgstr "%s undefined; assuming extern returning int\n" @@ -31,12 +31,12 @@ msgstr ":%d:%d: warning: " msgid "Array size not constant int (%s)\n" msgstr "Array size not constant int (%s)\n" -#: ./src/pass15.ec:10482 +#: ./src/pass15.ec:10488 msgid "Assigning list initializer to non list\n" msgstr "Assigning list initializer to non list\n" -#: ./src/pass15.ec:10146 -#: ./src/pass15.ec:11193 +#: ./src/pass15.ec:10152 +#: ./src/pass15.ec:11199 msgid "Couldn't determine type of array elements\n" msgstr "Couldn't determine type of array elements\n" @@ -52,7 +52,7 @@ msgstr "Couldn't open %s\n" msgid "Expecting class specifier\n" msgstr "Expecting class specifier\n" -#: ./src/pass15.ec:11351 +#: ./src/pass15.ec:11357 msgid "Expression is not a container\n" msgstr "Expression is not a container\n" @@ -64,12 +64,12 @@ msgstr "Includes nested too deeply" msgid "Incompatible virtual function %s\n" msgstr "Incompatible virtual function %s\n" -#: ./src/pass15.ec:11625 -#: ./src/pass15.ec:11700 +#: ./src/pass15.ec:11631 +#: ./src/pass15.ec:11706 msgid "Invalid object specified and not inside a class\n" msgstr "Invalid object specified and not inside a class\n" -#: ./src/pass15.ec:11533 +#: ./src/pass15.ec:11539 msgid "Invalid watched object\n" msgstr "Invalid watched object\n" @@ -94,11 +94,11 @@ msgstr "Multiple field index requires a name\n" msgid "No database table defined in this module or database_open already used.\n" msgstr "No database table defined in this module or database_open already used.\n" -#: ./src/pass15.ec:11546 +#: ./src/pass15.ec:11552 msgid "No observer specified and not inside a _class\n" msgstr "No observer specified and not inside a _class\n" -#: ./src/pass15.ec:11703 +#: ./src/pass15.ec:11709 msgid "No observer specified and not inside a class\n" msgstr "No observer specified and not inside a class\n" @@ -112,9 +112,9 @@ msgid "Non-static %s making use of a static class\n" msgstr "Non-static %s making use of a static class\n" #: ./src/pass1.ec:1037 -#: ./src/pass15.ec:11528 -#: ./src/pass15.ec:11600 -#: ./src/pass15.ec:11689 +#: ./src/pass15.ec:11534 +#: ./src/pass15.ec:11606 +#: ./src/pass15.ec:11695 msgid "Property %s not found in class %s\n" msgstr "Property %s not found in class %s\n" @@ -122,7 +122,7 @@ msgstr "Property %s not found in class %s\n" msgid "Public %s making use of a private class\n" msgstr "Public %s making use of a private class\n" -#: ./src/pass15.ec:7418 +#: ./src/pass15.ec:7424 msgid "Recursion in defined expression %s\n" msgstr "Recursion in defined expression %s\n" @@ -138,30 +138,30 @@ msgstr "Redefinition of %s ignored\n" msgid "Redefinition of method %s in class %s\n" msgstr "Redefinition of method %s in class %s\n" -#: ./src/pass15.ec:4388 -#: ./src/pass15.ec:4495 +#: ./src/pass15.ec:4394 +#: ./src/pass15.ec:4501 msgid "Unhandled type populating instance\n" msgstr "Unhandled type populating instance\n" -#: ./src/pass15.ec:7154 +#: ./src/pass15.ec:7160 msgid "Unspecified type\n" msgstr "Unspecified type\n" -#: ./src/pass15.ec:8990 +#: ./src/pass15.ec:8996 msgid "callable object undefined; extern assuming returning int\n" msgstr "callable object undefined; extern assuming returning int\n" -#: ./src/pass15.ec:8792 +#: ./src/pass15.ec:8798 msgid "called object %s is not a function\n" msgstr "called object %s is not a function\n" -#: ./src/pass15.ec:7874 #: ./src/pass15.ec:7880 -#: ./src/pass15.ec:8044 +#: ./src/pass15.ec:7886 +#: ./src/pass15.ec:8050 msgid "cannot add two pointers\n" msgstr "cannot add two pointers\n" -#: ./src/pass15.ec:1510 +#: ./src/pass15.ec:1516 msgid "cannot dereference type\n" msgstr "cannot dereference type\n" @@ -183,68 +183,68 @@ msgstr "class data member" msgid "class member instance" msgstr "class member instance" -#: ./src/pass15.ec:10221 +#: ./src/pass15.ec:10227 msgid "couldn't determine type of %s; expected %s\n" msgstr "couldn't determine type of %s; expected %s\n" -#: ./src/pass15.ec:8421 -#: ./src/pass15.ec:8433 -#: ./src/pass15.ec:10233 -#: ./src/pass15.ec:10309 +#: ./src/pass15.ec:8427 +#: ./src/pass15.ec:8439 +#: ./src/pass15.ec:10239 +#: ./src/pass15.ec:10315 msgid "couldn't determine type of %s\n" msgstr "couldn't determine type of %s\n" -#: ./src/pass15.ec:1882 -#: ./src/pass15.ec:9455 +#: ./src/pass15.ec:1888 +#: ./src/pass15.ec:9461 msgid "couldn't find member %s in class %s\n" msgstr "couldn't find member %s in class %s\n" -#: ./src/pass15.ec:1878 -#: ./src/pass15.ec:1987 +#: ./src/pass15.ec:1884 +#: ./src/pass15.ec:1993 msgid "couldn't find virtual method %s in class %s\n" msgstr "couldn't find virtual method %s in class %s\n" -#: ./src/pass15.ec:8036 +#: ./src/pass15.ec:8042 msgid "different levels of indirection\n" msgstr "different levels of indirection\n" -#: ./src/pass15.ec:7892 -#: ./src/pass15.ec:10264 +#: ./src/pass15.ec:7898 +#: ./src/pass15.ec:10270 msgid "incompatible expression %s (%s); expected %s\n" msgstr "incompatible expression %s (%s); expected %s\n" -#: ./src/pass15.ec:8153 -#: ./src/pass15.ec:8313 +#: ./src/pass15.ec:8159 +#: ./src/pass15.ec:8319 msgid "incompatible expressions %s (%s) and %s (%s)\n" msgstr "incompatible expressions %s (%s) and %s (%s)\n" -#: ./src/pass15.ec:1834 +#: ./src/pass15.ec:1840 msgid "incompatible instance method %s\n" msgstr "incompatible instance method %s\n" -#: ./src/pass15.ec:3286 +#: ./src/pass15.ec:3292 msgid "incompatible parameter %s (expected %s)\n" msgstr "incompatible parameter %s (expected %s)\n" -#: ./src/pass15.ec:3226 +#: ./src/pass15.ec:3232 msgid "incompatible return type for function\n" msgstr "incompatible return type for function\n" -#: ./src/pass15.ec:9269 +#: ./src/pass15.ec:9275 msgid "invalid class specifier %s for object of class %s\n" msgstr "invalid class specifier %s for object of class %s\n" -#: ./src/pass15.ec:9739 +#: ./src/pass15.ec:9745 msgid "member operator on non-structure type expression %s\n" msgstr "member operator on non-structure type expression %s\n" -#: ./src/pass15.ec:3161 -#: ./src/pass15.ec:3176 -#: ./src/pass15.ec:3202 +#: ./src/pass15.ec:3167 +#: ./src/pass15.ec:3182 +#: ./src/pass15.ec:3208 msgid "method class must be derived from %s\n" msgstr "method class must be derived from %s\n" -#: ./src/pass15.ec:3163 +#: ./src/pass15.ec:3169 msgid "method class should not take an object\n" msgstr "method class should not take an object\n" @@ -257,27 +257,27 @@ msgstr "no get defined for property %s of class %s\n" msgid "no set defined for property %s of class %s\n" msgstr "no set defined for property %s of class %s\n" -#: ./src/pass15.ec:8949 +#: ./src/pass15.ec:8955 msgid "not enough arguments for function %s (%d given, expected %d)\n" msgstr "not enough arguments for function %s (%d given, expected %d)\n" -#: ./src/pass15.ec:8945 +#: ./src/pass15.ec:8951 msgid "not enough arguments for method %s::%s (%d given, expected %d)\n" msgstr "not enough arguments for method %s::%s (%d given, expected %d)\n" -#: ./src/pass15.ec:3237 +#: ./src/pass15.ec:3243 msgid "not enough parameters\n" msgstr "not enough parameters\n" -#: ./src/pass15.ec:7979 +#: ./src/pass15.ec:7985 msgid "operating on %s and %s with an untyped result, assuming %s\n" msgstr "operating on %s and %s with an untyped result, assuming %s\n" -#: ./src/pass15.ec:7804 +#: ./src/pass15.ec:7810 msgid "operator %s illegal on pointer\n" msgstr "operator %s illegal on pointer\n" -#: ./src/pass15.ec:3189 +#: ./src/pass15.ec:3195 msgid "overriding class expected to be derived from method class\n" msgstr "overriding class expected to be derived from method class\n" @@ -309,46 +309,46 @@ msgstr "redefinition of destructor for class %s\n" msgid "syntax error\n" msgstr "syntax error\n" -#: ./src/pass15.ec:8860 +#: ./src/pass15.ec:8866 msgid "too many arguments for function %s (%d given, expected %d)\n" msgstr "too many arguments for function %s (%d given, expected %d)\n" -#: ./src/pass15.ec:8856 +#: ./src/pass15.ec:8862 msgid "too many arguments for method %s::%s (%d given, expected %d)\n" msgstr "too many arguments for method %s::%s (%d given, expected %d)\n" -#: ./src/pass15.ec:1888 +#: ./src/pass15.ec:1894 msgid "too many initializers for instantiation of class %s\n" msgstr "too many initializers for instantiation of class %s\n" -#: ./src/pass15.ec:3300 +#: ./src/pass15.ec:3306 msgid "too many parameters\n" msgstr "too many parameters\n" -#: ./src/pass15.ec:9722 +#: ./src/pass15.ec:9728 msgid "undefined class %s\n" msgstr "undefined class %s\n" -#: ./src/pass15.ec:10300 +#: ./src/pass15.ec:10306 msgid "unresolved identifier %s::%s\n" msgstr "unresolved identifier %s::%s\n" -#: ./src/pass15.ec:10219 +#: ./src/pass15.ec:10225 msgid "unresolved identifier %s; expected %s\n" msgstr "unresolved identifier %s; expected %s\n" -#: ./src/pass15.ec:10231 -#: ./src/pass15.ec:10302 +#: ./src/pass15.ec:10237 +#: ./src/pass15.ec:10308 msgid "unresolved identifier %s\n" msgstr "unresolved identifier %s\n" -#: ./src/pass15.ec:1828 +#: ./src/pass15.ec:1834 msgid "unresolved symbol used as an instance method %s\n" msgstr "unresolved symbol used as an instance method %s\n" -#: ./src/pass15.ec:7865 -#: ./src/pass15.ec:8022 -#: ./src/pass15.ec:8029 +#: ./src/pass15.ec:7871 +#: ./src/pass15.ec:8028 +#: ./src/pass15.ec:8035 msgid "void *: unknown size\n" msgstr "void *: unknown size\n" diff --git a/compiler/libec/src/pass15.ec b/compiler/libec/src/pass15.ec index 1d32137..7ff1b2f 100644 --- a/compiler/libec/src/pass15.ec +++ b/compiler/libec/src/pass15.ec @@ -850,7 +850,13 @@ public int ComputeTypeSize(Type type) if(_class.type == structClass || _class.type == noHeadClass) /*totalSize = */AddMembers(declarations, _class.base, false, &totalSize, topClass, null); else - maxSize -= _class.base.templateClass ? _class.base.templateClass.structSize : _class.base.structSize; + { + uint baseSize = _class.base.templateClass ? _class.base.templateClass.structSize : _class.base.structSize; + if(maxSize > baseSize) + maxSize -= baseSize; + else + maxSize = 0; + } } } diff --git a/ecere/src/com/instance.ec b/ecere/src/com/instance.ec index 21e0c55..c68414b 100644 --- a/ecere/src/com/instance.ec +++ b/ecere/src/com/instance.ec @@ -2188,6 +2188,15 @@ public dllexport Class eSystem_RegisterClass(ClassType type, char * name, char * bool force32Bits = (module.application.isGUIApp & 4) ? true : false; bool inCompiler = (module.application.isGUIApp & 8) ? true : false; bool crossBits = force32Bits || force64Bits; + bool fixed = false; + if(inCompiler && crossBits) + { + Class c = eSystem_FindClass(__thisModule.application, name); + if(c && c.fixed) + fixed = true; + else if(__thisModule.name && !strcmp(__thisModule.name, "ecereCOM")) + fixed = true; + } { nameSpace = (declMode == publicAccess) ? &module.publicNameSpace : &module.privateNameSpace; @@ -2582,7 +2591,7 @@ public dllexport Class eSystem_RegisterClass(ClassType type, char * name, char * } _class.memberID = _class.startMemberID = (base && (type == normalClass || type == noHeadClass || type == structClass)) ? base.memberID : 0; if(type == normalClass || type == noHeadClass) - _class.offset = (base && base.structSize && base.type != systemClass) ? base.structSize : ((type == noHeadClass) ? 0 : (force64Bits ? 24 : (force32Bits && inCompiler) ? 12 : sizeof(class Instance))); + _class.offset = (base && base.structSize && base.type != systemClass) ? base.structSize : ((type == noHeadClass) ? 0 : ((force64Bits && inCompiler && fixed) ? 24 : (force32Bits && inCompiler && fixed) ? 12 : sizeof(class Instance))); // For cross-bitness-compiling if(crossBits) @@ -2618,7 +2627,8 @@ public dllexport Class eSystem_RegisterClass(ClassType type, char * name, char * else if(module != module.application && inCompiler) { // These we only want to recompute inside the compiler - size = 0; + if(fixed || type == structClass) + size = 0; } } } diff --git a/ecere/src/gfx/Display.ec b/ecere/src/gfx/Display.ec index 30faaa4..4640dae 100644 --- a/ecere/src/gfx/Display.ec +++ b/ecere/src/gfx/Display.ec @@ -1118,16 +1118,17 @@ public: property void * systemWindow { get { return window; } }; property DisplaySystem displaySystem { get { return displaySystem; } }; + int width, height; + void * driverData; + private: DisplaySystem displaySystem; void * window; - public int width, height; Mutex mutex { }; int current; - public void * driverData; #if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D) Display3D display3D; #endif diff --git a/ecere/src/gfx/Surface.ec b/ecere/src/gfx/Surface.ec index 0555ff4..cc17b78 100644 --- a/ecere/src/gfx/Surface.ec +++ b/ecere/src/gfx/Surface.ec @@ -111,20 +111,22 @@ public enum AlphaWriteMode public class Surface { - public int width, height; +public: + int width, height; + Point offset; + Box box, unclippedBox; + void * driverData; +private: subclass(DisplayDriver) driver; DisplaySystem displaySystem; Display display; - public Point offset; - public Box box, unclippedBox; // States Font font; ColorAlpha foreground, background; bool textOpacity; - public void * driverData; AlphaWriteMode alphaWrite; bool blend; bool writeColor;