marked all generated bootstrap C source files with 'code generated from eC srouce...
[sdk] / compiler / bootstrap / libec / bootstrap / output.c
index b478ca8..3f00744 100644 (file)
@@ -1,3 +1,4 @@
+/* Code generated from eC source file. */
 #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;
@@ -459,7 +451,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;
@@ -759,25 +751,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;
@@ -836,8 +830,11 @@ 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);
+
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
 
 struct __ecereNameSpace__ecere__com__Instance
@@ -1232,11 +1229,11 @@ break;
 }
 }
 
-static void OutputSpecifier(struct Specifier * spec, struct __ecereNameSpace__ecere__com__Instance * f);
+static void OutputSpecifier(struct Specifier * spec, struct __ecereNameSpace__ecere__com__Instance * f, unsigned int typeName);
 
 static void OutputDeclarator(struct Declarator * decl, struct __ecereNameSpace__ecere__com__Instance * f);
 
-void OutputTypeName(struct TypeName * type, struct __ecereNameSpace__ecere__com__Instance * f)
+void OutputTypeName(struct TypeName * type, struct __ecereNameSpace__ecere__com__Instance * f, unsigned int typeName)
 {
 if(type->qualifiers)
 {
@@ -1244,7 +1241,7 @@ struct Specifier * spec;
 
 for(spec = (*type->qualifiers).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f);
+OutputSpecifier(spec, f, typeName);
 if(spec->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 }
@@ -1278,7 +1275,7 @@ struct Specifier * spec;
 
 for(spec = (*exp->_classExp.specifiers).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f);
+OutputSpecifier(spec, f, 0x0);
 if(spec->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 }
@@ -1298,7 +1295,7 @@ break;
 case 13:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "new ");
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputTypeName(exp->_renew.typeName, f);
+OutputTypeName(exp->_renew.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "[");
 OutputExpression(exp->_renew.size, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -1306,7 +1303,7 @@ break;
 case 28:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "new0 ");
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputTypeName(exp->_renew.typeName, f);
+OutputTypeName(exp->_renew.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "[");
 OutputExpression(exp->_renew.size, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -1315,7 +1312,7 @@ case 14:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "renew ");
 OutputExpression(exp->_renew.exp, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputTypeName(exp->_renew.typeName, f);
+OutputTypeName(exp->_renew.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "[");
 OutputExpression(exp->_renew.size, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -1324,7 +1321,7 @@ case 29:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "renew0 ");
 OutputExpression(exp->_renew.exp, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputTypeName(exp->_renew.typeName, f);
+OutputTypeName(exp->_renew.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "[");
 OutputExpression(exp->_renew.size, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -1431,25 +1428,25 @@ OutputIdentifier(exp->member.member, f);
 break;
 case 10:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "sizeof(");
-OutputTypeName(exp->typeName, f);
+OutputTypeName(exp->typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 break;
 case 38:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "__alignof__(");
-OutputTypeName(exp->typeName, f);
+OutputTypeName(exp->typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 break;
 case 35:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "__extension__ (");
 if(exp->initializer.typeName)
-OutputTypeName(exp->initializer.typeName, f);
+OutputTypeName(exp->initializer.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 if(exp->initializer.initializer)
 OutputInitializer(exp->initializer.initializer, f);
 break;
 case 11:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "(");
-OutputTypeName(exp->cast.typeName, f);
+OutputTypeName(exp->cast.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 if(exp->cast.exp)
 OutputExpression(exp->cast.exp, f);
@@ -1474,7 +1471,7 @@ case 36:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "__builtin_va_arg(");
 OutputExpression(exp->vaArg.exp, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ", ");
-OutputTypeName(exp->vaArg.typeName, f);
+OutputTypeName(exp->vaArg.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 break;
 case 37:
@@ -1506,16 +1503,34 @@ OutputExpression(field->expression, f);
 }
 }
 
-extern unsigned int inCompiler;
+extern char *  strchr(const char * , int);
 
-extern char *  __ecereNameSpace__ecere__sys__PathCat(char *  string, char *  addedPath);
-
-extern char *  GetIncludeFileFromID(int id);
+extern char *  __ecereNameSpace__ecere__sys__StripLastDirectory(char *  string, char *  output);
 
 extern char *  sourceFile;
 
+extern char *  __ecereNameSpace__ecere__sys__PathCat(char *  string, char *  addedPath);
+
 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
 
+static void GetSourceName(char * name, const char * src)
+{
+name[0] = (char)0;
+if(src)
+{
+if(!strchr(src, '/') && !strchr(src, '\\'))
+__ecereNameSpace__ecere__sys__StripLastDirectory(sourceFile, name);
+__ecereNameSpace__ecere__sys__PathCat(name, src);
+}
+else if(sourceFile)
+__ecereNameSpace__ecere__sys__PathCat(name, sourceFile);
+__ecereNameSpace__ecere__sys__ChangeCh(name, '\\', '/');
+}
+
+extern unsigned int inCompiler;
+
+extern char *  GetIncludeFileFromID(int id);
+
 extern char *  outputFile;
 
 extern unsigned int outputLineNumbers;
@@ -1530,7 +1545,7 @@ extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
 
 extern struct Identifier * MkIdentifier(char *  string);
 
-extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
+extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
 
 extern struct Specifier * CopySpecifier(struct Specifier * spec);
 
@@ -1540,7 +1555,7 @@ extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *
 
 extern struct Specifier * MkSpecifierName(char *  name);
 
-extern void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
+extern void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
 
 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
 
@@ -1557,15 +1572,7 @@ char origName[274] = "";
 
 if(inCompiler)
 {
-if(yylloc.start.included)
-{
-__ecereNameSpace__ecere__sys__PathCat(name, GetIncludeFileFromID((unsigned int)yylloc.start.included));
-}
-else if(sourceFile)
-{
-__ecereNameSpace__ecere__sys__PathCat(name, sourceFile);
-}
-__ecereNameSpace__ecere__sys__ChangeCh(name, '\\', '/');
+GetSourceName(name, stmt->loc.start.included ? GetIncludeFileFromID(stmt->loc.start.included) : (((void *)0)));
 __ecereNameSpace__ecere__sys__PathCat(origName, outputFile);
 __ecereNameSpace__ecere__sys__ChangeCh(origName, '\\', '/');
 }
@@ -1576,6 +1583,9 @@ outputLine += 2;
 }
 switch(stmt->type)
 {
+case 14:
+OutputDeclaration(stmt->decl, f);
+break;
 case 0:
 OutputIdentifier(stmt->labeled.id, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ":\n");
@@ -1806,12 +1816,12 @@ decl = MkDeclaratorIdentifier(MkIdentifier("__ecereReturnVal"));
 }
 else
 {
-PrintType(exp->expType, string, 0x1, 0x1);
+PrintTypeNoConst(exp->expType, string, exp->expType->kind == 18 ? 0x1 : 0x0, 0x1);
 decl = SpecDeclFromString(string, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereReturnVal")));
 }
 typeName = MkTypeName(specs, decl);
 InstDeclPassTypeName(typeName, 0x0);
-OutputTypeName(typeName, f);
+OutputTypeName(typeName, f, 0x0);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";");
 FreeTypeName(typeName);
 }
@@ -1854,7 +1864,7 @@ struct AsmField * field;
 
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "__asm__ ");
 if(stmt->asmStmt.spec)
-OutputSpecifier(stmt->asmStmt.spec, f);
+OutputSpecifier(stmt->asmStmt.spec, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "(");
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, stmt->asmStmt.statements);
 if(stmt->asmStmt.inputFields || stmt->asmStmt.outputFields || stmt->asmStmt.clobberedFields)
@@ -1894,6 +1904,7 @@ OutputAsmField(field, f);
 }
 }
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ");\n");
+outputLine++;
 break;
 }
 }
@@ -1914,7 +1925,7 @@ struct Specifier * spec;
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 for(spec = (*ptr->qualifiers).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f);
+OutputSpecifier(spec, f, 0x0);
 if(spec->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 }
@@ -1933,8 +1944,6 @@ extern void ProcessExpressionType(struct Expression * exp);
 
 extern void ComputeExpression(struct Expression * exp);
 
-extern int __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
-
 static void OutputDeclarator(struct Declarator * decl, struct __ecereNameSpace__ecere__com__Instance * f)
 {
 switch(decl->type)
@@ -1998,7 +2007,7 @@ struct Symbol * _class = decl->array.enumClass->symbol;
 
 if(_class && _class->registered)
 {
-__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "%d", __ecereNameSpace__ecere__com__eClass_GetProperty(_class->registered, "enumSize"));
+__ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "%d", (int)__ecereNameSpace__ecere__com__eClass_GetProperty(_class->registered, "enumSize"));
 }
 }
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -2014,7 +2023,7 @@ if(decl->function.parameters && (*decl->function.parameters).first)
 {
 for(param = (*decl->function.parameters).first; param; param = param->next)
 {
-OutputTypeName(param, f);
+OutputTypeName(param, f, 0x0);
 if(param->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ", ");
 }
@@ -2095,7 +2104,7 @@ extern struct Symbol * FindClass(char *  name);
 
 static void OutputClassDef(struct ClassDef * def, struct __ecereNameSpace__ecere__com__Instance * f);
 
-static void OutputSpecifier(struct Specifier * spec, struct __ecereNameSpace__ecere__com__Instance * f)
+static void OutputSpecifier(struct Specifier * spec, struct __ecereNameSpace__ecere__com__Instance * f, unsigned int typeName)
 {
 switch(spec->type)
 {
@@ -2136,10 +2145,10 @@ case INT:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "int");
 break;
 case UINT:
-((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "unsigned int");
+((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, typeName ? "uint" : "unsigned int");
 break;
 case INT64:
-((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "long long");
+((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, typeName ? "int64" : "long long");
 break;
 case VALIST:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "__builtin_va_list");
@@ -2256,7 +2265,7 @@ OutputExpression(spec->expression, f);
 break;
 case 7:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "subclass(");
-OutputSpecifier(spec->_class, f);
+OutputSpecifier(spec->_class, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 break;
 case 8:
@@ -2272,15 +2281,7 @@ char origName[274] = "";
 
 if(inCompiler)
 {
-if(yylloc.start.included)
-{
-__ecereNameSpace__ecere__sys__PathCat(name, GetIncludeFileFromID((unsigned int)yylloc.start.included));
-}
-else if(sourceFile)
-{
-__ecereNameSpace__ecere__sys__PathCat(name, sourceFile);
-}
-__ecereNameSpace__ecere__sys__ChangeCh(name, '\\', '/');
+GetSourceName(name, initializer->loc.start.included ? GetIncludeFileFromID(initializer->loc.start.included) : (((void *)0)));
 __ecereNameSpace__ecere__sys__PathCat(origName, outputFile);
 __ecereNameSpace__ecere__sys__ChangeCh(origName, '\\', '/');
 }
@@ -2352,15 +2353,7 @@ if(d->initializer)
 {
 char name[274] = "";
 
-if(yylloc.start.included)
-{
-__ecereNameSpace__ecere__sys__PathCat(name, GetIncludeFileFromID((unsigned int)yylloc.start.included));
-}
-else if(sourceFile)
-{
-__ecereNameSpace__ecere__sys__PathCat(name, sourceFile);
-}
-__ecereNameSpace__ecere__sys__ChangeCh(name, '\\', '/');
+GetSourceName(name, decl->loc.start.included ? GetIncludeFileFromID(decl->loc.start.included) : (((void *)0)));
 if(inCompiler && outputLineNumbers && decl->loc.start.line)
 {
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "\n#line %d \"%s\"\n", decl->loc.start.line, name);
@@ -2371,9 +2364,13 @@ break;
 }
 if(decl->specifiers)
 {
+unsigned int inTypeDef = 0x0;
+
 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f);
+if(spec->type == 0 && spec->specifier == TYPEDEF)
+inTypeDef = 0x1;
+OutputSpecifier(spec, f, inTypeDef && !spec->next);
 if(spec->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 }
@@ -2396,7 +2393,7 @@ if(decl->specifiers)
 {
 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f);
+OutputSpecifier(spec, f, 0x0);
 if(spec->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 }
@@ -2416,7 +2413,7 @@ if(d->next)
 if(decl->extStorage)
 {
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputSpecifier(decl->extStorage, f);
+OutputSpecifier(decl->extStorage, f, 0x0);
 }
 break;
 }
@@ -2453,7 +2450,7 @@ struct Specifier * spec;
 
 for(spec = (*func->specifiers).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f);
+OutputSpecifier(spec, f, 0x0);
 if(spec->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 }
@@ -2481,15 +2478,7 @@ if(inCompiler && memoryGuard)
 char name[1024] = "";
 struct Identifier * id = GetDeclId(func->declarator);
 
-if(yylloc.start.included)
-{
-__ecereNameSpace__ecere__sys__PathCat(name, GetIncludeFileFromID((unsigned int)yylloc.start.included));
-}
-else if(sourceFile)
-{
-__ecereNameSpace__ecere__sys__PathCat(name, sourceFile);
-}
-__ecereNameSpace__ecere__sys__ChangeCh(name, '\\', '/');
+GetSourceName(name, func->loc.start.included ? GetIncludeFileFromID(func->loc.start.included) : (((void *)0)));
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "{\n");
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "   __ecereNameSpace__ecere__com__MemoryGuard_PushLoc(\"%s:%s\");\n", name, id->string);
 outputLine += 2;
@@ -2560,7 +2549,7 @@ break;
 static void OutputInstance(struct Instantiation * inst, struct __ecereNameSpace__ecere__com__Instance * f)
 {
 if(inst->_class)
-OutputSpecifier(inst->_class, f);
+OutputSpecifier(inst->_class, f, 0x0);
 if(inst->exp)
 {
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
@@ -2603,7 +2592,7 @@ struct Specifier * spec;
 
 for(spec = (*func->specifiers).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f);
+OutputSpecifier(spec, f, 0x0);
 if(spec->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 }
@@ -2674,7 +2663,7 @@ break;
 static void OutputClass(struct ClassDefinition * _class, struct __ecereNameSpace__ecere__com__Instance * f)
 {
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "class ");
-OutputSpecifier(_class->_class, f);
+OutputSpecifier(_class->_class, f, 0x0);
 if(_class->baseSpecs)
 {
 struct Specifier * spec;
@@ -2682,7 +2671,7 @@ struct Specifier * spec;
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " : ");
 for(spec = (*_class->baseSpecs).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f);
+OutputSpecifier(spec, f, 0x0);
 }
 }
 if(_class->definitions)
@@ -2706,7 +2695,7 @@ void OutputTree(struct __ecereNameSpace__ecere__sys__OldList * ast, struct __ece
 {
 struct External * external;
 
-outputLine = 28;
+outputLine = 30;
 for(external = ast->first; external; external = external->next)
 {
 switch(external->type)
@@ -2730,17 +2719,12 @@ break;
 }
 }
 
-extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
-
-struct __ecereNameSpace__ecere__sys__TempFile
-{
-char __ecere_padding[24];
-} __attribute__ ((gcc_struct));
-
 extern char *  __ecereNameSpace__ecere__sys__TrimRSpaces(char *  string, char *  output);
 
 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
 
+extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
+
 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_GetSize;
 
 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
@@ -2758,7 +2742,7 @@ unsigned int size;
 
 typeName->qualifiers = specs;
 typeName->declarator = decl;
-OutputTypeName(typeName, f);
+OutputTypeName(typeName, f, 0x1);
 ((typeName ? (__ecereClass_TypeName->Destructor ? __ecereClass_TypeName->Destructor(typeName) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(typeName)) : 0), typeName = 0);
 size = ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_GetSize])(f);
 string = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (size + 1));
@@ -2782,7 +2766,7 @@ struct __ecereNameSpace__ecere__com__Class * class;
 
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetMemoryGuard", "void SetMemoryGuard(bool b)", SetMemoryGuard, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetMemoryGuard", "bool GetMemoryGuard(void)", GetMemoryGuard, module, 1);
-__ecereNameSpace__ecere__com__eSystem_RegisterFunction("OutputTypeName", "void OutputTypeName(TypeName type, ecere::sys::File f)", OutputTypeName, module, 1);
+__ecereNameSpace__ecere__com__eSystem_RegisterFunction("OutputTypeName", "void OutputTypeName(TypeName type, ecere::sys::File f, bool typeName)", OutputTypeName, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("OutputExpression", "void OutputExpression(Expression exp, ecere::sys::File f)", OutputExpression, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("OutputTree", "void OutputTree(ecere::sys::OldList ast, ecere::sys::File f)", OutputTree, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("StringFromSpecDecl", "char * StringFromSpecDecl(ecere::sys::OldList specs, Declarator decl)", StringFromSpecDecl, module, 1);