if(symbol && symbol->type)
{
+unsigned int isConstant = specType->constant;
struct Type * dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
*dummy = *specType;
FreeType(dummy);
CopyTypeInto(specType, symbol->type);
+specType->constant = isConstant;
specType->typeName = __ecereNameSpace__ecere__sys__CopyString(symbol->type->name);
}
else if(!isTypedef)
extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
+extern char * strcat(char * , const char * );
+
extern char * __ecereNameSpace__ecere__sys__CopyString(char * string);
char * PrintInt(long long result)
{
char temp[100];
-if(result > (((long long)0x7fffffffffffffffLL)))
-sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
+if(result > (((int)0x7fffffff)))
+sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
else
-sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
+sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
+if(result > (((int)0x7fffffff)) || result < (((int)0x80000000)))
+strcat(temp, "LL");
return __ecereNameSpace__ecere__sys__CopyString(temp);
}
}
}
-extern char * strcat(char * , const char * );
-
extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
extern struct ModuleImport * mainModule;
if(type->isSigned)
{
op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
-op.ops = intOps;
+op.ops = int64Ops;
}
else
{
op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
-op.ops = uintOps;
+op.ops = uint64Ops;
}
op.kind = 4;
break;
else
{
unsigned int isSigned = constant[0] == '-';
-long long i64 = strtoll(constant, (((void *)0)), 0);
-uint64 ui64 = strtoull(constant, (((void *)0)), 0);
-unsigned int is64Bit = 0x0;
+char * endP = (((void *)0));
+long long i64 = strtoll(constant, &endP, 0);
+uint64 ui64 = strtoull(constant, &endP, 0);
+unsigned int is64Bit = endP && (!strcmp(endP, "LL") || !strcmp(endP, "ll"));
if(isSigned)
{
Symbol symbol = spec.name ? FindType(curContext, spec.name) : null;
if(symbol && symbol.type)
{
+ // Keep constant qualifier
+ bool isConstant = specType.constant;
// Free Type Contents:
Type dummy { };
*dummy = *specType;
FreeType(dummy);
CopyTypeInto(specType, symbol.type);
+ specType.constant = isConstant;
specType.typeName = CopyString(symbol.type.name);
}
else if(!isTypedef) // !specType.kind) // TESTING THIS FOR enum / typedef problem
public char * PrintInt(int64 result)
{
char temp[100];
- if(result > MAXINT64)
- sprintf(temp, FORMAT64HEXLL /*"0x%I64XLL"*/, result);
+ if(result > MAXINT)
+ sprintf(temp, FORMAT64HEX /*"0x%I64XLL"*/, result);
else
- sprintf(temp, FORMAT64DLL /*"%I64d"*/, result);
+ sprintf(temp, FORMAT64D /*"%I64d"*/, result);
+ if(result > MAXINT || result < MININT)
+ strcat(temp, "LL");
return CopyString(temp);
}
if(type.isSigned)
{
op.i64 = (int64)_strtoi64(exp.constant, null, 0);
- op.ops = intOps;
+ op.ops = int64Ops;
}
else
{
op.ui64 = (uint64)_strtoui64(exp.constant, null, 0);
- op.ops = uintOps;
+ op.ops = uint64Ops;
}
op.kind = int64Type;
break;
case int64Type:
if(op.kind == charType || op.kind == shortType || op.kind == intType || op.kind == int64Type || op.kind == longType || op.kind == floatType || op.kind == doubleType ||
op.kind == pointerType || op.kind == enumType || op.kind == intPtrType || op.kind == intSizeType || op.kind == _BoolType)
- result = isSigned ? GetOpInt64(op, &op.i64) : GetOpUInt64(op, &op.ui64);
+ result = isSigned ? GetOpInt64(op, &op.i64) : GetOpUInt64(op, &op.ui64);
break;
case floatType:
if(op.kind == charType || op.kind == shortType || op.kind == intType || op.kind == int64Type || op.kind == longType ||
op.kind == enumType || op.kind == intPtrType || op.kind == intSizeType || op.kind == _BoolType)
- result = GetOpFloat(op, &op.f);
+ result = GetOpFloat(op, &op.f);
break;
case doubleType:
if(op.kind == charType || op.kind == shortType || op.kind == intType || op.kind == int64Type || op.kind == longType || op.kind == floatType ||
op.kind == enumType || op.kind == intPtrType || op.kind == intSizeType || op.kind == _BoolType)
- result = GetOpDouble(op, &op.d);
+ result = GetOpDouble(op, &op.d);
break;
case pointerType:
if(op.kind == charType || op.kind == shortType || op.kind == intType || op.kind == int64Type || op.kind == longType || op.kind == floatType || op.kind == doubleType ||
else
{
bool isSigned = constant[0] == '-';
- int64 i64 = strtoll(constant, null, 0);
- uint64 ui64 = strtoull(constant, null, 0);
- bool is64Bit = false;
+ char * endP = null;
+ int64 i64 = strtoll(constant, &endP, 0);
+ uint64 ui64 = strtoull(constant, &endP, 0);
+ bool is64Bit = endP && (!strcmp(endP, "LL") || !strcmp(endP, "ll"));
if(isSigned)
{
if(i64 < MININT)