wip II
[sdk] / compiler / bootstrap / libec / bootstrap / pass3.c
index ae64cce..20d0fb0 100644 (file)
@@ -1,3 +1,4 @@
+/* Code generated from eC source file: pass3.ec */
 #if defined(__GNUC__)
 typedef long long int64;
 typedef unsigned long long uint64;
@@ -27,17 +28,8 @@ typedef unsigned __int64 uint64;
 #else
 #define __ENDIAN_PAD(x) 0
 #endif
-#ifdef __MINGW32__
-#ifdef _WIN64
-typedef unsigned long long int uintptr_t;
-typedef long long int intptr_t;
-#else
-typedef unsigned int uintptr_t;
-typedef int intptr_t;
-#endif
-#else
 #include <stdint.h>
-#endif
+#include <sys/types.h>
 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
 
 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
@@ -104,9 +96,9 @@ struct __ecereNameSpace__ecere__com__Class * _class;
 char *  dataTypeString;
 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
 struct Type * dataType;
-void (*  Set)();
-int (*  Get)();
-unsigned int (*  IsSet)();
+void (*  Set)(void * , int);
+int (*  Get)(void * );
+unsigned int (*  IsSet)(void * );
 void *  data;
 void *  symbol;
 int vid;
@@ -125,7 +117,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;
@@ -425,7 +417,7 @@ struct TypeName * typeName;
 } __attribute__ ((gcc_struct));
 unsigned int debugValue;
 struct __ecereNameSpace__ecere__com__DataValue val;
-unsigned int address;
+uint64 address;
 unsigned int hasAddress;
 struct Type * expType;
 struct Type * destType;
@@ -718,25 +710,28 @@ 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;
+unsigned int typedByReference : 1;
 } __attribute__ ((gcc_struct));
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
@@ -795,6 +790,8 @@ struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
 struct __ecereNameSpace__ecere__com__Class * templateClass;
 struct __ecereNameSpace__ecere__sys__OldList templatized;
 int numParams;
+unsigned int isInstanceClass;
+unsigned int byValueSystemClass;
 } __attribute__ ((gcc_struct));
 
 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
@@ -1017,7 +1014,7 @@ extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereName
 
 extern struct Specifier * CopySpecifier(struct Specifier * spec);
 
-extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
+extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
 
 extern void FreeSpecifier(struct Specifier * spec);
 
@@ -1142,12 +1139,12 @@ spec->addNameSpace = 0x0;
 }
 else if(_class)
 {
-if((_class->type != 1000 || !strcmp(_class->fullName, "enum") || !strcmp(_class->fullName, "ecere::com::Instance") || (_class->dataTypeString && !strcmp(_class->dataTypeString, "char *")) || !strcmp(_class->fullName, "uint64") || !strcmp(_class->fullName, "uint32") || !strcmp(_class->fullName, "uint16") || !strcmp(_class->fullName, "uintptr") || !strcmp(_class->fullName, "intptr") || !strcmp(_class->fullName, "uint") || !strcmp(_class->fullName, "byte")))
+if((_class->type != 1000 || !strcmp(_class->fullName, "enum") || (_class->dataTypeString && !strcmp(_class->dataTypeString, "char *")) || !strcmp(_class->fullName, "uint64") || !strcmp(_class->fullName, "uint32") || !strcmp(_class->fullName, "uint16") || !strcmp(_class->fullName, "uintptr") || !strcmp(_class->fullName, "intptr") || !strcmp(_class->fullName, "uintsize") || !strcmp(_class->fullName, "intsize") || !strcmp(_class->fullName, "uint") || !strcmp(_class->fullName, "byte")))
 {
 (__ecereNameSpace__ecere__com__eSystem_Delete(spec->name), spec->name = 0);
 if(_class->dataTypeString)
 {
-if(!strcmp(_class->dataTypeString, "uint64") || !strcmp(_class->dataTypeString, "uint32") || !strcmp(_class->dataTypeString, "uint16") || !strcmp(_class->dataTypeString, "uintptr") || !strcmp(_class->dataTypeString, "intptr") || !strcmp(_class->dataTypeString, "uint") || !strcmp(_class->dataTypeString, "byte"))
+if(!strcmp(_class->dataTypeString, "uint64") || !strcmp(_class->dataTypeString, "uint32") || !strcmp(_class->dataTypeString, "uint16") || !strcmp(_class->dataTypeString, "uintptr") || !strcmp(_class->dataTypeString, "intptr") || !strcmp(_class->dataTypeString, "uintsize") || !strcmp(_class->dataTypeString, "intsize") || !strcmp(_class->dataTypeString, "uint") || !strcmp(_class->dataTypeString, "byte"))
 {
 if(!_class->dataType)
 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
@@ -1190,7 +1187,7 @@ spec->addNameSpace = 0x0;
 }
 if(_class && _class->dataTypeString && !strcmp(_class->dataTypeString, "char *"))
 return 0x1;
-if(!_class || _class->type == 0 || _class->type == 5 || !strcmp(_class->fullName, "ecere::com::Instance"))
+if(!_class || _class->type == 0 || _class->type == 5)
 return 0x1;
 else if(param && _class->type == 1)
 return (unsigned int)2;
@@ -1288,7 +1285,9 @@ InstDeclPassIdentifier(spec->id);
 break;
 }
 case 5:
-if(spec->extDecl && spec->extDecl->type == 0 && spec->extDecl->s && !strcmp(spec->extDecl->s, "dllexport"))
+if(spec->extDecl && spec->extDecl->type == 0 && spec->extDecl->s)
+{
+if(!strcmp(spec->extDecl->s, "dllexport"))
 {
 struct Specifier * prevSpec;
 
@@ -1311,6 +1310,15 @@ else
 spec->extDecl->s = __ecereNameSpace__ecere__sys__CopyString("extern __attribute__ ((visibility(\"default\")))");
 }
 }
+else if(!strcmp(spec->extDecl->s, "stdcall") || !strcmp(spec->extDecl->s, "_stdcall") || !strcmp(spec->extDecl->s, "__stdcall") || !strcmp(spec->extDecl->s, "__stdcall__"))
+{
+(__ecereNameSpace__ecere__com__eSystem_Delete(spec->extDecl->s), spec->extDecl->s = 0);
+if(targetPlatform == 1)
+spec->extDecl->s = __ecereNameSpace__ecere__sys__CopyString("__attribute__((__stdcall__))");
+else
+spec->extDecl->s = __ecereNameSpace__ecere__sys__CopyString("");
+}
+}
 break;
 }
 }
@@ -1425,7 +1433,7 @@ else
 {
 struct Symbol * classSym = (spec->type == 1) ? spec->symbol : (((void *)0));
 
-if(type->classObjectType && (!classSym || (classSym && classSym->registered && (classSym->registered->type == 4 || classSym->registered->type == 2 || classSym->registered->type == 3 || (classSym->registered->type == 1000 && strcmp(classSym->string, "ecere::com::Instance") && strcmp(classSym->string, "ecere::com::Class"))))))
+if(type->classObjectType && (!classSym || (classSym && classSym->registered && (classSym->registered->type == 4 || classSym->registered->type == 2 || classSym->registered->type == 3))))
 ReplaceByInstancePtr(spec, &type->declarator, 2);
 }
 InstDeclPassSpecifier(spec);
@@ -1435,11 +1443,11 @@ if(type->declarator)
 InstDeclPassDeclarator(type->declarator);
 }
 
-extern char *  strchr(char * , int);
+extern char *  strchr(const char * , int);
 
 extern char *  strcpy(char * , const char * );
 
-extern int strlen(const char * );
+extern size_t strlen(const char * );
 
 static void InstDeclPassIdentifier(struct Identifier * id)
 {
@@ -1524,11 +1532,13 @@ break;
 }
 case 8:
 {
+if(exp->member.exp)
 InstDeclPassExpression(exp->member.exp);
 break;
 }
 case 9:
 {
+if(exp->member.exp)
 InstDeclPassExpression(exp->member.exp);
 break;
 }
@@ -1692,6 +1702,10 @@ static void InstDeclPassStatement(struct Statement * stmt)
 {
 switch(stmt->type)
 {
+case 14:
+if(stmt->decl)
+InstDeclPassDeclaration(stmt->decl);
+break;
 case 0:
 InstDeclPassStatement(stmt->labeled.stmt);
 break;