compiler/bootstrap: (#980) Updated for 0.44.08
[sdk] / compiler / bootstrap / ecp / bootstrap / ecp.c
index 7fc71a3..82b096f 100644 (file)
@@ -128,7 +128,7 @@ struct CodePosition
 int line;
 int charPos;
 int pos;
-unsigned int included;
+int included;
 } __attribute__ ((gcc_struct));
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
@@ -661,25 +661,27 @@ struct Symbol * enumClass;
 struct Type * type;
 struct TemplateParameter * templateParameter;
 } __attribute__ ((gcc_struct));
-unsigned int isSigned;
 int kind;
-unsigned int constant;
 unsigned int size;
 char *  name;
 char *  typeName;
-unsigned int count;
-unsigned int truth;
 int classObjectType;
-unsigned int byReference;
-unsigned int extraParam;
 int alignment;
-unsigned int directClassAccess;
-unsigned int computing;
-unsigned int dllExport;
 unsigned int offset;
-unsigned int keepCast;
-unsigned int passAsTemplate;
 int bitFieldCount;
+int count;
+unsigned int isSigned : 1;
+unsigned int constant : 1;
+unsigned int truth : 1;
+unsigned int byReference : 1;
+unsigned int extraParam : 1;
+unsigned int directClassAccess : 1;
+unsigned int computing : 1;
+unsigned int keepCast : 1;
+unsigned int passAsTemplate : 1;
+unsigned int dllExport : 1;
+unsigned int attrStdcall : 1;
+unsigned int declaredWithStruct : 1;
 } __attribute__ ((gcc_struct));
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
@@ -738,6 +740,7 @@ struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
 struct __ecereNameSpace__ecere__com__Class * templateClass;
 struct __ecereNameSpace__ecere__sys__OldList templatized;
 int numParams;
+unsigned int isInstanceClass;
 } __attribute__ ((gcc_struct));
 
 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
@@ -1125,7 +1128,7 @@ static struct __ecereNameSpace__ecere__com__Instance * privateModule;
 
 struct __ecereNameSpace__ecere__sys__OldList _excludedSymbols = 
 {
-0, 0, 0, (unsigned int)&((struct Symbol *)(void *)0)->left, 0
+0, 0, 0, (unsigned int)&((struct Symbol *)(void * )0)->left, 0
 };
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
@@ -1251,9 +1254,10 @@ if(decl->declarators)
 {
 for(d = (*decl->declarators).first; d; d = d->next)
 {
-{
 struct Identifier * declId = GetDeclId(d);
 
+if(declId)
+{
 dataMemberDefine = __extension__ ({
 struct DataMemberDefine * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_DataMemberDefine);
 
@@ -1508,7 +1512,7 @@ __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&parentMemberDefine->dat
 
 extern void FreeType(struct Type * type);
 
-extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (* )(void * ), void (* )(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
+extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
 
 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_AddVirtualMethod(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, char *  type, void *  function, int declMode);
 
@@ -2449,6 +2453,8 @@ extern int strcmp(const char * , const char * );
 
 extern size_t strlen(const char * );
 
+extern char *  PassArg(char *  output, const char *  input);
+
 extern char *  GetOutputFile(void);
 
 extern void SetOutputFile(char *  s);
@@ -2475,24 +2481,24 @@ extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSp
 
 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
 
-extern void SetGlobalContext(struct Context * context);
+extern void SetGlobalData(struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace);
 
-extern void SetTopContext(struct Context * context);
+extern void SetExcludedSymbols(struct __ecereNameSpace__ecere__sys__OldList *  list);
 
-extern void SetCurrentContext(struct Context * context);
+extern void SetGlobalContext(struct Context * context);
 
-extern void SetExcludedSymbols(struct __ecereNameSpace__ecere__sys__OldList *  list);
+extern void SetCurrentContext(struct Context * context);
 
-extern void SetGlobalData(struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace);
+extern void SetTopContext(struct Context * context);
 
 extern void SetDefines(struct __ecereNameSpace__ecere__sys__OldList *  list);
 
 extern void SetImports(struct __ecereNameSpace__ecere__sys__OldList *  list);
 
-extern void SetPrecompDefines(struct __ecereNameSpace__ecere__sys__OldList *  list);
-
 extern void SetInPreCompiler(unsigned int b);
 
+extern void SetPrecompDefines(struct __ecereNameSpace__ecere__sys__OldList *  list);
+
 extern void SetTargetPlatform(int platform);
 
 extern void SetTargetBits(int bits);
@@ -2593,8 +2599,7 @@ if(arg[0] == '-')
 {
 if(!strcmp(arg + 1, "m32") || !strcmp(arg + 1, "m64"))
 {
-int argLen = strlen(arg);
-int newLen = cppOptionsLen + 1 + argLen;
+int newLen = cppOptionsLen + 1 + strlen(arg);
 
 cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (newLen + 1));
 cppOptions[cppOptionsLen] = ' ';
@@ -2602,30 +2607,16 @@ strcpy(cppOptions + cppOptionsLen + 1, arg);
 cppOptionsLen = newLen;
 targetBits = !strcmp(arg + 1, "m32") ? 32 : 64;
 }
-else if(arg[1] == 'D')
+else if(arg[1] == 'D' || arg[1] == 'I')
 {
-int argLen = strlen(arg);
-int newLen = cppOptionsLen + 1 + argLen;
+char * buf;
+int size = cppOptionsLen + 1 + strlen(arg) * 2 + 1;
 
-cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (newLen + 1));
-cppOptions[cppOptionsLen] = ' ';
-strcpy(cppOptions + cppOptionsLen + 1, arg);
-cppOptionsLen = newLen;
-}
-else if(arg[1] == 'I')
-{
-int argLen = strlen(arg);
-int newLen = cppOptionsLen + argLen + 3;
-
-cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (newLen + 1));
-cppOptions[cppOptionsLen] = ' ';
-cppOptions[cppOptionsLen + 1] = '-';
-cppOptions[cppOptionsLen + 2] = 'I';
-cppOptions[cppOptionsLen + 3] = '"';
-strcpy(cppOptions + cppOptionsLen + 4, arg + 2);
-cppOptions[newLen - 1] = '\"';
-cppOptions[newLen] = '\0';
-cppOptionsLen = newLen;
+cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
+buf = cppOptions + cppOptionsLen;
+*buf++ = ' ';
+PassArg(buf, arg);
+cppOptionsLen = cppOptionsLen + 1 + strlen(buf);
 }
 else if(!strcmp(arg + 1, "t"))
 {
@@ -2665,20 +2656,17 @@ else if(!strcmp(arg + 1, "isystem") || !strcmp(arg + 1, "isysroot"))
 {
 if(c + 1 < ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argc)
 {
-int argLen = strlen(arg);
-int arg1Len = strlen(((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[c + 1]);
-int newLen = cppOptionsLen + argLen + arg1Len + 4;
+char * buf;
+char * arg1 = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[++c];
+int size = cppOptionsLen + 1 + strlen(arg) * 2 + strlen(arg1) * 2 + 1;
 
-cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (newLen + 1));
-cppOptions[cppOptionsLen] = ' ';
-strcpy(cppOptions + cppOptionsLen + 1, arg);
-cppOptions[cppOptionsLen + argLen + 1] = ' ';
-cppOptions[cppOptionsLen + argLen + 2] = '"';
-arg = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)this + structSize_Module)))->argv[++c];
-strcpy(cppOptions + cppOptionsLen + argLen + 3, arg);
-cppOptions[newLen - 1] = '\"';
-cppOptions[newLen] = '\0';
-cppOptionsLen = newLen;
+cppOptions = __ecereNameSpace__ecere__com__eSystem_Renew(cppOptions, sizeof(char) * (size));
+buf = cppOptions + cppOptionsLen;
+*buf++ = ' ';
+buf = PassArg(buf, arg);
+*buf++ = ' ';
+buf = PassArg(buf, arg1);
+cppOptionsLen = buf - cppOptions;
 }
 else
 valid = 0x0;
@@ -2726,21 +2714,23 @@ SetOutputFile(defaultSymFile);
 }
 }
 if(!valid)
+{
 printf(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Syntax:\n   ecp [-t <target platform>] [-cpp <c preprocessor>] [-o <output>] [-symbols <outputdir>] [-I<includedir>]* [-isystem <sysincludedir>]* [-D<definition>]* -c <input>\n", (((void *)0))));
+}
 else
 {
-char command[3075LL];
 struct __ecereNameSpace__ecere__com__Instance * cppOutput;
+char command[3075LL];
 
+SetGlobalData(&globalData);
+SetExcludedSymbols(&_excludedSymbols);
 SetGlobalContext(globalContext);
-SetTopContext(globalContext);
 SetCurrentContext(globalContext);
-SetExcludedSymbols(&_excludedSymbols);
-SetGlobalData(&globalData);
+SetTopContext(globalContext);
 SetDefines(&defines);
 SetImports(&imports);
-SetPrecompDefines(&precompDefines);
 SetInPreCompiler(0x1);
+SetPrecompDefines(&precompDefines);
 SetTargetPlatform(targetPlatform);
 SetTargetBits(targetBits);
 SetEchoOn(0x0);