compiler: Added (u)intsize to map to size_t; Updated C prototypes to use it; Fixed...
[sdk] / compiler / bootstrap / libec / bootstrap / pass1.c
index a092704..f65c46f 100644 (file)
@@ -1,6 +1,9 @@
 #if defined(__GNUC__)
 typedef long long int64;
 typedef unsigned long long uint64;
+#ifndef _WIN32
+#define __declspec(x)
+#endif
 #elif defined(__TINYC__)
 #include <stdarg.h>
 #define __builtin_va_list va_list
@@ -10,6 +13,8 @@ typedef unsigned long long uint64;
 #define strcasecmp stricmp
 #define strncasecmp strnicmp
 #define __declspec(x) __attribute__((x))
+#else
+#define __declspec(x)
 #endif
 typedef long long int64;
 typedef unsigned long long uint64;
@@ -23,6 +28,7 @@ typedef unsigned __int64 uint64;
 #define __ENDIAN_PAD(x) 0
 #endif
 #include <stdint.h>
+#include <sys/types.h>
 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
 
 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
@@ -89,9 +95,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;
@@ -428,7 +434,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;
@@ -511,6 +517,7 @@ struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
 unsigned int addNameSpace;
 struct Context * ctx;
+struct ExtDecl * extDeclStruct;
 } __attribute__ ((gcc_struct));
 struct Expression * expression;
 struct Specifier * _class;
@@ -812,6 +819,8 @@ struct __ecereNameSpace__ecere__sys__OldList templatized;
 int numParams;
 } __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
@@ -1162,6 +1171,9 @@ symid += 2;
 {
 function = MkFunction(func->specifiers, func->declarator, (((void *)0)));
 function->propSet = func->propSet;
+function->type = func->type;
+if(func->type)
+func->type->refCount++;
 ProcessFunctionBody(function, func->body);
 external = MkExternalFunction(function);
 external->symbol = func->declarator->symbol;
@@ -1491,8 +1503,8 @@ struct __ecereNameSpace__ecere__com__ClassProperty * parent;
 struct __ecereNameSpace__ecere__com__ClassProperty * left;
 struct __ecereNameSpace__ecere__com__ClassProperty * right;
 int depth;
-void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, int);
-int (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
+void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
+long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
 char *  dataTypeString;
 struct Type * dataType;
 unsigned int constant;
@@ -1518,7 +1530,7 @@ unsigned int lastOffset = 0;
 int privateID = 0;
 unsigned int privateMembers = 0x0;
 
-sprintf(dataMemberSize, "%d", sizeof(struct __ecereNameSpace__ecere__com__DataMember *));
+sprintf(dataMemberSize, "%d", (int)sizeof(struct __ecereNameSpace__ecere__com__DataMember *));
 if(!isMember)
 {
 for(prop = regClass->conversions.first; prop; prop = prop->next)
@@ -2016,11 +2028,8 @@ int i;
 unsigned int ui;
 float f;
 double d;
-unsigned char *  p;
 long long i64;
 uint64 ui64;
-intptr_t iptr;
-uintptr_t uiptr;
 } __attribute__ ((gcc_struct));
 struct OpTable ops;
 } __attribute__ ((gcc_struct));
@@ -2081,7 +2090,7 @@ void *  data;
 
 extern char *  StringFromSpecDecl(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
 
-extern int strlen(const char * );
+extern size_t strlen(const char * );
 
 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
 
@@ -2557,7 +2566,7 @@ ListAdd(args, MkExpString(string));
 {
 char temp[1024];
 
-sprintf(temp, "%d", value->data);
+sprintf(temp, "%d", (int)value->data);
 ListAdd(args, MkExpConstant(temp));
 }
 stmt = MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("eEnum_AddFixedValue")), args)));
@@ -2710,7 +2719,7 @@ struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
 
 ListAdd(args, MkExpIdentifier(MkIdentifier("class")));
 ListAdd(args, MkExpString(QMkString(def->id->string)));
-ListAdd(args, MkExpCast(MkTypeName(MkListOne(MkSpecifier(INT)), (((void *)0))), def->initializer->exp));
+ListAdd(args, MkExpCast(MkTypeName(MkListOne(MkSpecifier(INT64)), (((void *)0))), def->initializer->exp));
 def->initializer->exp = (((void *)0));
 stmt = MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eClass_SetProperty")), args)));
 ListAdd(registerModuleBody->compound.statements, stmt);