return (void *)pointer;
}
-struct __ecereNameSpace__ecere__com__IteratorPointer * __ecereMethod___ecereNameSpace__ecere__com__LinkList_GetAtPosition(struct __ecereNameSpace__ecere__com__Instance * this, uint64 pos, unsigned int create)
+struct __ecereNameSpace__ecere__com__IteratorPointer * __ecereMethod___ecereNameSpace__ecere__com__LinkList_GetAtPosition(struct __ecereNameSpace__ecere__com__Instance * this, const uint64 pos, unsigned int create)
{
struct __ecereNameSpace__ecere__com__LinkList * __ecerePointer___ecereNameSpace__ecere__com__LinkList = (struct __ecereNameSpace__ecere__com__LinkList *)(this ? (((char *)this) + structSize_Instance) : 0);
int c;
extern char * strncpy(char * , const char * , size_t n);
-extern void ImportModule(char * name, int importType, int importAccess, unsigned int loadDllOnly);
+extern void ImportModule(const char * name, int importType, int importAccess, unsigned int loadDllOnly);
struct External * MkExternalImport(char * name, int importType, int importAccess)
{
return __extension__ ({
struct ClassDef * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassDef);
-__ecereInstance1->type = 3, __ecereInstance1->propertyDef = propertyDef, __ecereInstance1;
+__ecereInstance1->type = 3, __ecereInstance1->propertyDef = propertyDef, __ecereInstance1->loc = yylloc, __ecereInstance1;
});
}
return __extension__ ({
struct ClassDef * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassDef);
-__ecereInstance1->type = 10, __ecereInstance1->propertyDef = propertyDef, __ecereInstance1;
+__ecereInstance1->type = 10, __ecereInstance1->propertyDef = propertyDef, __ecereInstance1->loc = yylloc, __ecereInstance1;
});
}
return __extension__ ({
struct ClassDef * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassDef);
-__ecereInstance1->type = 11, __ecereInstance1->id = id, __ecereInstance1->initializer = initializer, __ecereInstance1;
+__ecereInstance1->type = 11, __ecereInstance1->id = id, __ecereInstance1->initializer = initializer, __ecereInstance1->loc = yylloc, __ecereInstance1;
});
}
struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
+struct __ecereNameSpace__ecere__com__Property * __ecereProp_Type_specConst;
+
struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
struct __ecereNameSpace__ecere__com__Class * __ecereClass_char__PTR_;
extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, const char * name);
-extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_FindMethod(struct __ecereNameSpace__ecere__com__Class * _class, const char * name, struct __ecereNameSpace__ecere__com__Instance * module);
-
extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_FindProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char * name, struct __ecereNameSpace__ecere__com__Instance * module);
+extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_FindMethod(struct __ecereNameSpace__ecere__com__Class * _class, const char * name, struct __ecereNameSpace__ecere__com__Instance * module);
+
extern void __ecereNameSpace__ecere__LoadTranslatedStrings(const char * moduleName, const char * name);
unsigned int __ecereDll_Load_ec(struct __ecereNameSpace__ecere__com__Instance * module)
__ecereClass_TemplateParameter = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "TemplateParameter");
__ecereClass_TemplatedType = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "TemplatedType");
__ecereClass_Type = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "Type");
+__ecereProp_Type_specConst = _property = __ecereNameSpace__ecere__com__eClass_FindProperty(__ecereClass_Type, "specConst", module);
__ecereClass_TypeName = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "TypeName");
__ecereClass_char__PTR_ = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "char *");
_class = __ecereNameSpace__ecere__com__eSystem_FindClass(module, "class");
static struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeKind;
+static struct __ecereNameSpace__ecere__com__Property * __ecereProp_Type_specConst, * __ecerePropM_Type_specConst;
+
extern void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName);
const char * __ecereMethod_Type_OnGetString(struct __ecereNameSpace__ecere__com__Class * class, struct Type * this, char * tempString, void * fieldData, unsigned int * needClass)
{
}
+unsigned int __ecereProp_Type_Get_specConst(struct Type * this)
+{
+struct Type * t = this;
+
+while((t->kind == 13 || t->kind == 12) && t->type)
+t = t->type;
+return t->constant;
+}
+
struct OpTable
{
unsigned int (* Add)(struct Expression *, struct Operand *, struct Operand *);
extern unsigned int __ecereNameSpace__ecere__com__eMember_AddMember(struct __ecereNameSpace__ecere__com__DataMember * addTo, struct __ecereNameSpace__ecere__com__DataMember * dataMember);
+extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_AddProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char * name, const char * dataType, void * setStmt, void * getStmt, int declMode);
+
extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
struct __ecereNameSpace__ecere__com__DefinedExpression;
__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "declaredWithStruct", "bool:1", 4, 4, 1);
__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "typedByReference", "bool:1", 4, 4, 1);
__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "casted", "bool:1", 4, 4, 1);
+__ecerePropM_Type_specConst = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "specConst", "bool", 0, __ecereProp_Type_Get_specConst, 1);
+if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application)
+__ecereProp_Type_specConst = __ecerePropM_Type_specConst, __ecerePropM_Type_specConst = (void *)0;
class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(1, "Operand", 0, sizeof(struct Operand), 0, 0, 0, module, 1, 1);
if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
__ecereClass_Operand = class;
void __ecereUnregisterModule_ecdefs(struct __ecereNameSpace__ecere__com__Instance * module)
{
+__ecerePropM_Type_specConst = (void *)0;
}
MangleClassName(name);
params = MkList();
ListAdd(params, MkTypeName(CopyList(propertyDef->specifiers, CopySpecifier), PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value")))));
+if(propertyDef->isDBProp)
+{
+struct Specifier * spec;
+struct __ecereNameSpace__ecere__sys__OldList * specs = ((struct TypeName *)(*params).last)->qualifiers;
+
+for(spec = (*specs).first; spec; spec = spec->next)
+if(spec->type == 0 && spec->specifier == CONST)
+break;
+if(!spec)
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specs), (((void *)0)), MkSpecifier(CONST));
+}
decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
{
unsigned int isConversion = propertyDef->symbol->_property && propertyDef->symbol->_property->conversion;
struct Statement * compoundStmt;
char * s;
+if(__extension__ ({
+char * __ecTemp1 = (((struct __ecereNameSpace__ecere__com__Instance *)__ecereProp___ecereNameSpace__ecere__com__Iterator_Get_data(&v)));
+
+((struct ClassPropertyValue *)(__ecTemp1 + __ecereClass_ClassPropertyValue->offset));
+})->exp)
+yylloc = __extension__ ({
+char * __ecTemp1 = (((struct __ecereNameSpace__ecere__com__Instance *)__ecereProp___ecereNameSpace__ecere__com__Iterator_Get_data(&v)));
+
+((struct ClassPropertyValue *)(__ecTemp1 + __ecereClass_ClassPropertyValue->offset));
+})->exp->loc;
ListAdd(findClassArgs, MkExpIdentifier(MkIdentifier("module")));
s = QMkString(__extension__ ({
char * __ecTemp1 = (((struct __ecereNameSpace__ecere__com__Instance *)__ecereProp___ecereNameSpace__ecere__com__Iterator_Get_data(&v)));
void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
{
struct Symbol * symbol = prop->symbol;
-char propName[1024];
strcpy(setName, "__ecereProp_");
FullClassNameCat(setName, prop->_class->fullName, 0x0);
strcat(setName, "_Set_");
FullClassNameCat(setName, prop->name, 0x1);
+MangleClassName(setName);
strcpy(getName, "__ecereProp_");
FullClassNameCat(getName, prop->_class->fullName, 0x0);
strcat(getName, "_Get_");
FullClassNameCat(getName, prop->name, 0x1);
-strcpy(propName, "__ecereProp_");
-FullClassNameCat(propName, prop->_class->fullName, 0x0);
-strcat(propName, "_");
-FullClassNameCat(propName, prop->name, 0x1);
MangleClassName(getName);
-MangleClassName(setName);
-MangleClassName(propName);
if(prop->_class->type == 1)
DeclareStruct(prop->_class->fullName, 0x0);
if(!symbol || curExternal->symbol->idCode < symbol->id)
typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
FinishTemplatesContext(context);
}
+if(!strcmp(prop->_class->base->fullName, "eda::Row") || !strcmp(prop->_class->base->fullName, "eda::Id"))
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(CONST));
ListAdd(params, MkTypeName(specifiers, d));
d = MkDeclaratorIdentifier(MkIdentifier(setName));
if(dllImport)
struct Declaration * decl;
struct External * external;
struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
+char propName[1024];
if(imported)
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
else
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
ListAdd(specifiers, MkSpecifierName("Property"));
+strcpy(propName, "__ecereProp_");
+FullClassNameCat(propName, prop->_class->fullName, 0x0);
+strcat(propName, "_");
+FullClassNameCat(propName, prop->name, 0x1);
+MangleClassName(propName);
{
struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
extern void Compiler_Warning(const char * format, ...);
-extern void CopyTypeInto(struct Type * type, struct Type * src);
-
-void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName);
-
-unsigned int MatchTypes(struct Type * source, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, struct __ecereNameSpace__ecere__com__Class * owningClassSource, struct __ecereNameSpace__ecere__com__Class * owningClassDest, unsigned int doConversion, unsigned int enumBaseType, unsigned int acceptReversedParams, unsigned int isConversionExploration, unsigned int warnConst)
-{
-if(source && dest)
+static unsigned int CheckConstCompatibility(struct Type * source, struct Type * dest, unsigned int warn)
{
-if(warnConst && ((source->kind == 8 && source->_class && source->_class->registered) || source->kind == 12 || source->kind == 13) && ((dest->kind == 8 && dest->_class && dest->_class->registered) || dest->kind == 13))
+unsigned int status = 0x1;
+
+if(((source->kind == 8 && source->_class && source->_class->registered) || source->kind == 12 || source->kind == 13) && ((dest->kind == 8 && dest->_class && dest->_class->registered) || dest->kind == 13))
{
struct __ecereNameSpace__ecere__com__Class * sourceClass = source->kind == 8 ? source->_class->registered : (((void *)0));
struct __ecereNameSpace__ecere__com__Class * destClass = dest->kind == 8 ? dest->_class->registered : (((void *)0));
{
struct Type * sourceType = source, * destType = dest;
-while(sourceType->type && (sourceType->kind == 13 || sourceType->kind == 12))
+while((sourceType->kind == 13 || sourceType->kind == 12) && sourceType->type)
sourceType = sourceType->type;
-while(destType->type && (destType->kind == 13 || destType->kind == 12))
+while((destType->kind == 13 || destType->kind == 12) && destType->type)
destType = destType->type;
if(!destType->constant && sourceType->constant)
+{
+status = 0x0;
+if(warn)
Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "discarding const qualifier\n", (((void *)0))));
}
}
+}
+return status;
+}
+
+extern void CopyTypeInto(struct Type * type, struct Type * src);
+
+void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName);
+
+unsigned int MatchTypes(struct Type * source, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, struct __ecereNameSpace__ecere__com__Class * owningClassSource, struct __ecereNameSpace__ecere__com__Class * owningClassDest, unsigned int doConversion, unsigned int enumBaseType, unsigned int acceptReversedParams, unsigned int isConversionExploration, unsigned int warnConst)
+{
+if(source && dest)
+{
+if(warnConst)
+CheckConstCompatibility(source, dest, 0x1);
if(source->kind == 20 && dest->kind != 20)
{
struct Type * type = ProcessTemplateParameterType(source->templateParameter);
if(type)
dest = type;
}
-if(dest->classObjectType == 2)
+if(dest->classObjectType == 2 && dest->kind != 11)
{
if(source->classObjectType != 3)
return 0x1;
}
else
{
-if(source->classObjectType == 3)
+if(source->kind != 11 && source->classObjectType == 3)
return 0x1;
-if(dest->classObjectType == 3 && source->classObjectType != 2)
+if(dest->kind != 11 && dest->classObjectType == 3 && source->classObjectType != 2)
return 0x1;
}
if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible return type for function\n", (((void *)0))));
return 0x0;
}
+else
+CheckConstCompatibility(dest->returnType, source->returnType, 0x1);
for(; paramDest; paramDest = paramDest->next)
{
if(!paramSource)
if(!prop->dataType)
ProcessPropertyType(prop);
exp->expType = prop->dataType;
-if(prop->dataType)
+if(!strcmp(_class->base->fullName, "eda::Row") && !exp->expType->constant && !exp->destType)
+{
+struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
+
+CopyTypeInto(type, exp->expType);
+type->refCount = 1;
+type->constant = 0x1;
+exp->expType = type;
+}
+else if(prop->dataType)
prop->dataType->refCount++;
}
else if(member)
extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
+unsigned int __ecereProp_Type_Get_specConst(struct Type * this);
+
+extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_Type_specConst;
+
static void ProcessExpression(struct Expression * exp)
{
struct Location oldyylloc = yylloc;
{
struct Expression * c;
struct Context * context = PushContext();
+struct __ecereNameSpace__ecere__sys__OldList * specs;
-c = MkExpExtensionCompound(MkCompoundStmt(MkListOne(MkDeclaration(MkListOne(MkSpecifierName("Instance")), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")), MkInitializerAssignment(CopyExpression(memberExp->member.exp)))))), MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_vTbl"))), MkExpPointer(MkExpIdentifier(MkIdentifier(className)), MkIdentifier("_vTbl"))))))));
+c = MkExpExtensionCompound(MkCompoundStmt(MkListOne(MkDeclaration((specs = MkListOne(MkSpecifierName("Instance"))), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")), MkInitializerAssignment(CopyExpression(memberExp->member.exp)))))), MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_vTbl"))), MkExpPointer(MkExpIdentifier(MkIdentifier(className)), MkIdentifier("_vTbl"))))))));
+if(__ecereProp_Type_Get_specConst(type))
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specs), (((void *)0)), MkSpecifier(CONST));
c->loc = exp->loc;
c->compound->compound.context = context;
PopContext(context);
{
struct Expression * c;
struct Context * context = PushContext();
+struct __ecereNameSpace__ecere__sys__OldList * specs;
-c = MkExpExtensionCompound(MkCompoundStmt(MkListOne(MkDeclaration(MkListOne(MkSpecifierName("Instance")), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")), MkInitializerAssignment(memberExpMemberExp))))), MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_class"))), MkExpIdentifier(MkIdentifier(className))))))));
+c = MkExpExtensionCompound(MkCompoundStmt(MkListOne(MkDeclaration((specs = MkListOne(MkSpecifierName("Instance"))), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")), MkInitializerAssignment(memberExpMemberExp))))), MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_class"))), MkExpIdentifier(MkIdentifier(className))))))));
c->compound->compound.context = context;
PopContext(context);
+if(__ecereProp_Type_Get_specConst(type))
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specs), (((void *)0)), MkSpecifier(CONST));
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->call.arguments), (((void *)0)), c);
memberExpMemberExp = (((void *)0));
}
}
else
{
-c = MkExpExtensionCompound(MkCompoundStmt(MkListOne(MkDeclaration(MkListOne(MkSpecifierName("Instance")), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")), MkInitializerAssignment(CopyExpression(e)))))), MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_class"))), MkExpIdentifier(MkIdentifier(className))))))));
+struct __ecereNameSpace__ecere__sys__OldList * specs;
+
+c = MkExpExtensionCompound(MkCompoundStmt(MkListOne(MkDeclaration((specs = MkListOne(MkSpecifierName("Instance"))), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")), MkInitializerAssignment(CopyExpression(e)))))), MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_class"))), MkExpIdentifier(MkIdentifier(className))))))));
c->compound->compound.context = context;
PopContext(context);
+if(__ecereProp_Type_Get_specConst(type))
+__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specs), (((void *)0)), MkSpecifier(CONST));
__ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*exp->call.arguments), e->prev, c);
}
}
ClassDef MkClassDefProperty(PropertyDef propertyDef)
{
- return { type = propertyClassDef, propertyDef = propertyDef };
+ return { type = propertyClassDef, propertyDef = propertyDef, loc = yylloc };
}
ClassDef MkClassDefClassProperty(PropertyDef propertyDef)
{
- return { type = classPropertyClassDef, propertyDef = propertyDef };
+ return { type = classPropertyClassDef, propertyDef = propertyDef, loc = yylloc };
}
ClassDef MkClassDefClassPropertyValue(Identifier id, Initializer initializer)
{
- return { type = classPropertyValueClassDef, id = id, initializer = initializer };
+ return { type = classPropertyValueClassDef, id = id, initializer = initializer, loc = yylloc };
}
int CheckType(const char * text)
{
}
+
+ property bool specConst
+ {
+ get
+ {
+ Type t = this;
+ while((t.kind == pointerType || t.kind == arrayType) && t.type) t = t.type;
+ return t.constant;
+ }
+ }
};
public struct Operand
PlugDeclarator(propertyDef.declarator,
MkDeclaratorIdentifier(MkIdentifier("value")))));
+ // Add const to DB table rows properties Set
+ if(propertyDef.isDBProp)
+ {
+ Specifier spec;
+ OldList * specs = ((TypeName)params->last).qualifiers;
+
+ for(spec = specs->first; spec; spec = spec.next)
+ if(spec.type == baseSpecifier && spec.specifier == CONST)
+ break;
+ if(!spec)
+ specs->Insert(null, MkSpecifier(CONST));
+ }
+
// Take it out here...
//propertyDef.specifiers = null;
Statement compoundStmt;
String s;
+ if(v.exp)
+ yylloc = v.exp.loc;
+
ListAdd(findClassArgs, MkExpIdentifier(MkIdentifier("module")));
s = QMkString(v.regClass.name);
ListAdd(findClassArgs, MkExpString(s));
void DeclareProperty(Property prop, char * setName, char * getName)
{
Symbol symbol = prop.symbol;
- char propName[1024];
strcpy(setName, "__ecereProp_");
FullClassNameCat(setName, prop._class.fullName, false);
strcat(setName, "_Set_");
// strcat(setName, prop.name);
FullClassNameCat(setName, prop.name, true);
+ MangleClassName(setName);
strcpy(getName, "__ecereProp_");
FullClassNameCat(getName, prop._class.fullName, false);
FullClassNameCat(getName, prop.name, true);
// strcat(getName, prop.name);
- strcpy(propName, "__ecereProp_");
- FullClassNameCat(propName, prop._class.fullName, false);
- strcat(propName, "_");
- FullClassNameCat(propName, prop.name, true);
- // strcat(propName, prop.name);
-
// To support "char *" property
MangleClassName(getName);
- MangleClassName(setName);
- MangleClassName(propName);
if(prop._class.type == structClass)
DeclareStruct(prop._class.fullName, false);
{
bool imported = false;
bool dllImport = false;
+
if(!symbol || symbol._import)
{
if(!symbol)
MkDeclaratorIdentifier(MkIdentifier("value")));
FinishTemplatesContext(context);
}
+ if(!strcmp(prop._class.base.fullName, "eda::Row") || !strcmp(prop._class.base.fullName, "eda::Id"))
+ specifiers->Insert(null, MkSpecifier(CONST));
+
ListAdd(params, MkTypeName(specifiers, d));
d = MkDeclaratorIdentifier(MkIdentifier(setName));
Declaration decl;
External external;
OldList * specifiers = MkList();
+ char propName[1024];
if(imported)
specifiers->Insert(null, MkSpecifier(EXTERN));
ListAdd(specifiers, MkSpecifierName("Property"));
+ strcpy(propName, "__ecereProp_");
+ FullClassNameCat(propName, prop._class.fullName, false);
+ strcat(propName, "_");
+ FullClassNameCat(propName, prop.name, true);
+ // strcat(propName, prop.name);
+ MangleClassName(propName);
+
{
OldList * list = MkList();
ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null),
Type resultType;
};
-public bool MatchTypes(Type source, Type dest, OldList conversions, Class owningClassSource, Class owningClassDest, bool doConversion, bool enumBaseType, bool acceptReversedParams,
- bool isConversionExploration, bool warnConst)
+static bool CheckConstCompatibility(Type source, Type dest, bool warn)
{
- if(source && dest)
+ bool status = true;
+ if(((source.kind == classType && source._class && source._class.registered) || source.kind == arrayType || source.kind == pointerType) &&
+ ((dest.kind == classType && dest._class && dest._class.registered) || /*dest.kind == arrayType || */dest.kind == pointerType))
{
- if(warnConst &&
- ((source.kind == classType && source._class && source._class.registered) || source.kind == arrayType || source.kind == pointerType) &&
- ((dest.kind == classType && dest._class && dest._class.registered) || /*dest.kind == arrayType || */dest.kind == pointerType))
- {
- Class sourceClass = source.kind == classType ? source._class.registered : null;
- Class destClass = dest.kind == classType ? dest._class.registered : null;
- if((!sourceClass || (sourceClass && sourceClass.type == normalClass && !sourceClass.structSize)) &&
- (!destClass || (destClass && destClass.type == normalClass && !destClass.structSize)))
- {
- Type sourceType = source, destType = dest;
- while(sourceType.type && (sourceType.kind == pointerType || sourceType.kind == arrayType)) sourceType = sourceType.type;
- while(destType.type && (destType.kind == pointerType || destType.kind == arrayType)) destType = destType.type;
- if(!destType.constant && sourceType.constant)
+ Class sourceClass = source.kind == classType ? source._class.registered : null;
+ Class destClass = dest.kind == classType ? dest._class.registered : null;
+ if((!sourceClass || (sourceClass && sourceClass.type == normalClass && !sourceClass.structSize)) &&
+ (!destClass || (destClass && destClass.type == normalClass && !destClass.structSize)))
+ {
+ Type sourceType = source, destType = dest;
+ while((sourceType.kind == pointerType || sourceType.kind == arrayType) && sourceType.type) sourceType = sourceType.type;
+ while((destType.kind == pointerType || destType.kind == arrayType) && destType.type) destType = destType.type;
+ if(!destType.constant && sourceType.constant)
+ {
+ status = false;
+ if(warn)
Compiler_Warning($"discarding const qualifier\n");
}
}
+ }
+ return status;
+}
+
+public bool MatchTypes(Type source, Type dest, OldList conversions, Class owningClassSource, Class owningClassDest, bool doConversion, bool enumBaseType, bool acceptReversedParams,
+ bool isConversionExploration, bool warnConst)
+{
+ if(source && dest)
+ {
+ if(warnConst)
+ CheckConstCompatibility(source, dest, true);
// Property convert;
if(source.kind == templateType && dest.kind != templateType)
if(type) dest = type;
}
- if(dest.classObjectType == typedObject)
+ if(dest.classObjectType == typedObject && dest.kind != functionType)
{
if(source.classObjectType != anyObject)
return true;
}
else
{
- if(source.classObjectType == anyObject)
+ if(source.kind != functionType && source.classObjectType == anyObject)
return true;
- if(dest.classObjectType == anyObject && source.classObjectType != typedObject)
+ if(dest.kind != functionType && dest.classObjectType == anyObject && source.classObjectType != typedObject)
return true;
}
Compiler_Warning($"incompatible return type for function\n");
return false;
}
+ // The const check is backwards from the MatchTypes above (for derivative classes checks)
+ else
+ CheckConstCompatibility(dest.returnType, source.returnType, true);
// Check parameters
if(!prop.dataType)
ProcessPropertyType(prop);
exp.expType = prop.dataType;
- if(prop.dataType) prop.dataType.refCount++;
+ if(!strcmp(_class.base.fullName, "eda::Row") && !exp.expType.constant && !exp.destType)
+ {
+ Type type { };
+ CopyTypeInto(type, exp.expType);
+ type.refCount = 1;
+ type.constant = true;
+ exp.expType = type;
+ }
+ else if(prop.dataType)
+ prop.dataType.refCount++;
}
else if(member)
{
// ({ Instance __internal_ClassInst = e; __internal_ClassInst ? __internal_ClassInst._vTbl : __ecereClass_...; })
Expression c;
Context context = PushContext();
+ OldList * specs;
c = MkExpExtensionCompound(MkCompoundStmt(
MkListOne(MkDeclaration(
- MkListOne(MkSpecifierName("Instance")),
+ (specs = MkListOne(MkSpecifierName("Instance"))),
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")),
MkInitializerAssignment(CopyExpression(memberExp.member.exp)))))),
MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(
MkExpIdentifier(MkIdentifier("__internal_ClassInst")),
MkListOne(MkExpPointer(MkExpIdentifier(MkIdentifier("__internal_ClassInst")), MkIdentifier("_vTbl"))),
MkExpPointer(MkExpIdentifier(MkIdentifier(className)), MkIdentifier("_vTbl"))))))));
+ if(type.specConst)
+ specs->Insert(null, MkSpecifier(CONST));
c.loc = exp.loc;
c.compound.compound.context = context;
PopContext(context);
// ({ Instance __internal_ClassInst = e; __internal_ClassInst ? __internal_ClassInst._class : __ecereClass_...; })
Expression c;
Context context = PushContext();
+ OldList * specs;
+
c = MkExpExtensionCompound(MkCompoundStmt(
MkListOne(MkDeclaration(
- MkListOne(MkSpecifierName("Instance")),
+ (specs = MkListOne(MkSpecifierName("Instance"))),
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")),
MkInitializerAssignment(memberExpMemberExp))))),
MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(
c.compound.compound.context = context;
PopContext(context);
+ if(type.specConst)
+ specs->Insert(null, MkSpecifier(CONST));
+
exp.call.arguments->Insert(null, c);
memberExpMemberExp = null; // We used this
}
else
{
+ OldList * specs;
c = MkExpExtensionCompound(MkCompoundStmt(
MkListOne(MkDeclaration(
- MkListOne(MkSpecifierName("Instance")),
+ (specs = MkListOne(MkSpecifierName("Instance"))),
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")),
MkInitializerAssignment(CopyExpression(e)))))),
MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(
c.compound.compound.context = context;
PopContext(context);
+ if(type.specConst)
+ specs->Insert(null, MkSpecifier(CONST));
+
exp.call.arguments->Insert(e.prev, c);
}
}
delete name;
}
- String GetName()
+ const String GetName()
{
return name;
}
return result == SQLITE_OK;
}
- String GetName()
+ const String GetName()
{
return name;
}
public class DataSourceDriver
{
- OldList listDB { offset = (uint)&((Database)0).prev };
+ OldList listDB { offset = (uint)(uintptr)&((Database)0).prev };
class_data const char * name;
class_property const char * name
Module module;
char moduleName[MAX_LOCATION];
sprintf(moduleName, "EDA%s", driverName);
- if(module = eModule_Load(__thisModule.application, moduleName, publicAccess))
+ if((module = eModule_Load(__thisModule.application, moduleName, publicAccess)))
driver = FindDataDriverDerivative(eSystem_FindClass(module /*__thisModule.application*/, "DataSourceDriver"), driverName);
}
return driver;
{
Database prev, next;
DataSourceDriver ds;
- OldList listTbl { offset = (uint)&((Table)0).prev };
+ OldList listTbl { offset = (uint)(uintptr)&((Table)0).prev };
public virtual String GetName();
public virtual Array<String> GetTables(); // TODO: make this Container<Table> GetTables(); // if supported, filled with ready to open Tables
EDBIndexOptions indexOptions { saveIndex = true, deleteIndex = false; };
-static void UnusedFunction()
+__attribute__((unused)) static void UnusedFunction()
{
int a;
a.OnGetString(0,0,0);
int temp;
if(!*rowsCountPosition)
{
- int c;
File f = ((EDBArchive)archive).f;
EDBArchiveDir dir = (EDBArchiveDir) archive.OpenDirectory(apath, FileStats { }, readOnlyDir);
uint position;
String apath;
String apathFields;
OldList indexes;
- OldList fields { offset = (uint)&((EDBField)0).prev; };
+ OldList fields { offset = (uint)(uintptr)&((EDBField)0).prev; };
ArchiveDir dir;
uint rowsCountPosition;
dbTbl.rowsCount = dbTbl.allocatedRowsCount - dbTbl.deletedRowsCount;
{
- int c;
File f = ((EDBArchive)archive).f;
EDBArchiveDir dir = (EDBArchiveDir) dbTbl.dir;
uint position;
return true;
}
- String GetName()
+ const String GetName()
{
return dbTable.apath;
}
String apath;
String aname;
- String GetName() { return name; }
+ const String GetName() { return name; }
Class GetType() { return type; }
int GetLength() { return length; }
Field GetNext() { return next; }
bool Select(MoveOptions move)
{
- EDBDatabase edb = tbl.db;
if(tbl.rowsCount)
{
if(index)
bool Find(EDBField field, MoveOptions move, MatchOptions match, typed_object data)
{
- EDBDatabase edb = tbl.db;
if(tbl == field.tbl)
{
if(tbl.rowsCount)
bool FindMultiple(FieldFindData * findData, MoveOptions move, int numFields)
{
- EDBDatabase edb = tbl.db;
int c;
for(c = 0; c<numFields; c++)
if(tbl != ((EDBField)findData[c].field).tbl)
void AddPage(Page page)
{
- int h;
if(pageCount && display)
display.NextPage();
lastPage = page;
page.master = this;
page.parent = this;
page.size = { MAXINT - 10, MAXINT - 10 };
- h = page.size.h;
pageCount++;
page.Create();
}
Array<Grouping> groupings { };
- property String title
+ property const String title
{
set
{
const char * defaultIdField = "Id";
const char * defaultActiveField = "Active";
-public void SetDefaultIdField(char * value) { defaultIdField = value; }
-public void SetDefaultNameField(char * value) { defaultNameField = value; }
+public void SetDefaultIdField(const char * value) { defaultIdField = value; }
+public void SetDefaultNameField(const char * value) { defaultNameField = value; }
public class ButtonStyle : Button
{
virtual void Save()
{
- bool result;
if(field && row)
{
Class type = field.type;
bool result = true;
if(/*row && */row != lastRow)
{
- uint id;
if(editor.modifiedDocument)
{
if(row)
{
if(editor)
{
- editor.btnSave.disabled = !(bool)list.currentRow;
- editor.btnReload.disabled = !(bool)list.currentRow;
- btnDelete.disabled = !(bool)list.currentRow;
- editor.disabled = !(bool)list.firstRow;
+ editor.btnSave.disabled = !list.currentRow;
+ editor.btnReload.disabled = !list.currentRow;
+ btnDelete.disabled = !list.currentRow;
+ editor.disabled = !list.firstRow;
}
}
}
}
- property String searchString
+ property const String searchString
{
set
{
EditClear();
{
- bool active = true;
r.Add();
{
// Patch for SQLite driver which auto-increments IDs
DebugLn("TableEditor::ListSelect");
if(/*-row && -*/row != lastRow)
{
- uint id;
if(modifiedDocument)
{
if(row)
Time lastTime = GetTime();
static int slice = 128;
- static int wordListPrepRowCount = 0, wordListPrepRowNum = 0, ticks = 0;
+ static int ticks = 0;
ticks++;
if(ticks % 10 == 0)
PrintLn("listing... ");
st = sqliteSearchTables[listEnumerationTimer.tablesIndex];
if(st.table && st.idField && st.searchFields && st.searchFields.count)
{
- wordListPrepRowNum = 0;
- wordListPrepRowCount = st.table.rowsCount;
if(st.table && st.idField && st.searchFields && st.searchFields.count &&
st.searchFields[0].field)
//PrintLn("todo: support other field types for string search");
else if(field && field.type)
{
- const char * n = field.name;
char tempString[MAX_F_STRING];
int64 data = 0;
Class type = field.type;
if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass))
((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data);
if(type.type == structClass)
- delete data;
+ delete (void *)data;
}
}
}
DebugLn("TableEditor::ResetListFields");
if(list && listFields && listFields.count)
{
- bool c = list.created;
list.ClearFields();
for(lf : listFields)
{
}
else if(lf.CustomLookup && lf.field.type)
{
- const char * n = lf.field.name;
int64 data = 0;
String s = null;
Class type = lf.field.type;
if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass))
((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data);
if(type.type == structClass)
- delete data;
+ delete (void *)data;
delete s; // ?
}
else if(lf.field.type && eClass_IsDerived(lf.dataField.dataType, class(char*)))
{
- const char * n = lf.field.name;
char tempString[MAX_F_STRING];
int64 data = 0;
Class type = lf.field.type;
if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass))
((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data);
if(type.type == structClass)
- delete data;
+ delete (void *)data;
}
else if(lf.field.type)
{
- const char * n = lf.field.name;
//char tempString[256];
int64 data = 0;
Class type = lf.field.type;
if(!(type.type == systemClass || type.type == unitClass || type.type == bitClass || type.type == enumClass))
((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data);
if(type.type == structClass)
- delete data;
+ delete (void *)data;
}
}
}
{
int c;
int numTokens = 0;
- int len[256];
char * words[256];
WordEntry entries[256];
Array<Id> results = null;
numTokens = TokenizeWith(searchCopy, sizeof(words) / sizeof(char *), words, " ',/-;[]{}", false);
for(c = 0; c<numTokens; c++)
{
- len[c] = strlen(words[c]);
strlwr(words[c]);
entries[c] = (WordEntry)wordTree.FindString(words[c]);
}
File f;
sprintf(filePath, "%s.search", table.name);
- f = filePath ? FileOpenBuffered(filePath, read) : null;
+ f = FileOpenBuffered(filePath, read);
if(f)
{
int a;
for(l = count-s; l>0; l--)
{
- uint wid;
WordEntry start = null, wordEntry;
while(l > 0 && !UTF8_IS_FIRST(subWord[l])) l--;
{
WordEntry node;
uint id;
- uint count = this.count;
DebugLn("WordEntryBinaryTree::OnSerialize");
for(id = 1, node = (WordEntry)root; node;)
{
channel.Unserialize(id);
if(id)
{
- uint count;
WordEntry entry;
// TODO: Fix typed_object issues
entry = btnodes[id - 1] = eInstance_New(class(WordEntry));
virtual void Save()
{
- bool result;
Row row = this.row;
if(visible && row)
{
extern int __ecereVMethodID_class_OnSerialize;
extern int __ecereVMethodID_class_OnFree;
-static void UnusedFunction()
+__attribute__((unused)) static void UnusedFunction()
{
int a;
a.OnGetString(0,0,0);
if(nameField)
{
#ifdef _DEBUG
- const char * fn = nameField->name;
+ //const char * fn = nameField->name;
#endif
// Get name data from row
int64 data = 0;
Window OnEdit(DataBox dataBox, DataBox obsolete, int x, int y, int w, int h, void * userData)
{
// Don't show the editbox right away so that the text is highlighted by default
- const char * string = "";
EditBox editBox
{
dataBox, visible = false,
// if(type.type != normalClass || strcmp(type.dataTypeString, "char *"))
if(type)
{
- void * data = ((type.type == normalClass || type.type == noHeadClass || type.type == structClass) ? row.GetData(null) : *(uint *)row.GetData(null));
+ void * data = ((type.type == normalClass || type.type == noHeadClass || type.type == structClass) ? row.GetData(null) : (void *)(uintptr)*(uint *)row.GetData(null));
if(!data)
{
//if(strcmp(type.dataTypeString, char *"))
}
else
{
- uint i = r.GetData(null);
+ void * i = r.GetData(null);
if(i)
- Add(OldLink { data = (void *)i });
+ Add(OldLink { data = i });
}
}
return true;
if(!class_data(type))
class_data(type) = eSystem_FindClass(__thisModule.application, class_data(typeName));
type = class_data(type);
- while(node = first)
+ while((node = first))
{
// TO STUDY: ONFREE SHOULD BE USED ONLY FOR LISTBOX?
if(type)
import "timeTools"
public enum ColumnType { null = 1, string = 2, number = 4, floater = 8, date = 12 };
-public String columnTypeNames[ColumnType] = { "", "Null", "String", "", "Number", "", "", "", "Float", "", "", "", "Date" };
+public const String columnTypeNames[ColumnType] = { "", "Null", "String", "", "Number", "", "", "", "Float", "", "", "", "Date" };
public class Column : struct
{
OnMessage(buffer);
}
- virtual bool OnMessage(String message)
+ virtual void OnMessage(const String message)
{
::PrintLn(this._class.name, ": ", message,
" lineNum=", info.lineNum,
property int matchCount { get { return matchCount; } }
- char * Match(String string)
+ char * Match(const String string)
{
if(valid)
{
}
if(c == maxMatchCount)
matchCount = maxMatchCount;
- return string + matches[0].rm_so;
+ return (char *)string + matches[0].rm_so;
}
else
matchCount = 0;
int encLen = 0;
while(c < len)
{
- int b;
if(len - c < 3)
{
remaining = len - c;
return encLen;
}
-int Base64Decode(byte * input, int len, byte * decoded)
+int Base64Decode(const byte * input, int len, byte * decoded)
{
uint buffer;
int c = 0;
*ch = Max(*ch, 0);
}
- void PreShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving)
+ void PreShowDecorations(Font captionFont, Surface surface, const char * name, bool active, bool moving)
{
bmps.RenderBack(surface, size, { (byte)(opacity * 255), background });
}
- void ShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving)
+ void ShowDecorations(Font captionFont, Surface surface, const char * name, bool active, bool moving)
{
//if(borderStyle == contour)
bmps.RenderBorder(surface, size, borderColor);
CheckListBoxButton button = buttonMaps[(uintptr)row];
if(button)
{
- bool wasChecked = button.checked;
button.checked = false;
button.buttonState = up;
}
void OnRedraw(Surface surface)
{
- EditLine l;
- int y, x1, x2;
+ char * contents = (char *)this.contents;
char * backup = CopyString(contents);
int len = strlen(backup);
- char * string = new char[len + 1];
// what char / font combination to use for desired blocking char on all platforms?
// memset(string, 'g', len);
- memset(string, 'l', len);
- string[len] = 0;
- GetSelPos(&l, &y, &x1, &l, &y, &x2, false);
- contents = string;
- SetSelPos(l, y, x1, l, y, x2);
+ memset(contents, 'l', len);
EditBox::OnRedraw(surface);
memcpy(contents, backup, len);
- delete string;
delete backup;
}
}
class SimSkin_Window : Window
{
- void ShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving)
+ void ShowDecorations(Font captionFont, Surface surface, const char * name, bool active, bool moving)
{
bool isNormal = (state == normal || state == maximized);
int top = 0, border = 0, bottom = 0;
void SetWindowMinimum(MinMaxValue * mw, MinMaxValue * mh)
{
- bool isNormal = (state == normal || state == maximized);
+ //bool isNormal = (state == normal || state == maximized);
if(nativeDecorations && rootWindow == this) return;
if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
{
extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics;
extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw;
-static void Dummy()
+__attribute__((unused)) static void Dummy()
{
- Window a;
+ Window a = null;
a.OnApplyGraphics();
a.OnRedraw(null);
}
{
ButtonState state = this.buttonState;
Bitmap buttonBitmap = bitmap ? bitmap.bitmap : null;
- char * text = this.text;
+ const char * text = this.text;
int offset = (state == down && this.offset) ? 1 : 0;
- Color backColor = background;
+ //Color backColor = background;
int isDefault = this.isDefault;
Font font;
return { faceName = "Verdana", size = 6.5f };
}
- char * ::CursorsBitmaps(uint id, int *hotSpotX, int *hotSpotY, byte ** paletteShades)
+ const char * ::CursorsBitmaps(uint id, int *hotSpotX, int *hotSpotY, byte ** paletteShades)
{
return null;
}
public enum Trim { no, left = 1, right = 2, ends = 3, middle = 4, all = 7 };
-void TrimChars(char * string, char * output, char * chars, Trim trim, bool squash, char alt)
+void TrimChars(const char * string, char * output, const char * chars, Trim trim, bool squash, char alt)
{
- char * s = string, * o = output;
+ const char * s = string;
+ char * o = output;
char ch;
bool keepChar = (trim & left) != left;
bool keepMiddleChars = (trim & middle) != middle;
*o = '\0';
}
-char * TrimCharsCopy(char * string, char * chars, Trim trim, bool squash, char alt)
+char * TrimCharsCopy(const char * string, const char * chars, Trim trim, bool squash, char alt)
{
int len = strlen(string);
char * output = new char[len+1];
return output;
}
-void TrimTestChars(char * string, char * output, int (*CharTest)(char), Trim trim, bool squash, char alt)
+void TrimTestChars(const char * string, char * output, int (*CharTest)(char), Trim trim, bool squash, char alt)
{
- char * s = string, * o = output;
+ const char * s = string;
+ char * o = output;
char ch;
bool keepChar = (trim & left) != left;
bool keepMiddleChars = (trim & middle) != middle;
*o = '\0';
}
-char * TrimTestCharsCopy(char * string, int (*CharTest)(char), Trim trim, bool squash, char alt)
+char * TrimTestCharsCopy(const char * string, int (*CharTest)(char), Trim trim, bool squash, char alt)
{
int len = strlen(string);
char * output = new char[len+1];
Time QuickTime()
{
- DateTime time, t;
+ DateTime time;
time.GetLocalTime();
return time.hour * 60 * 60 + time.minute * 60 + time.second;
}
extern int __ecereVMethodID_class_OnGetString;
-static String countryNames[CountryCode] =
+static const String countryNames[CountryCode] =
{
"(none)",
"Andorra", // 1974
//static const CountryCode ::first = AD;
//static const CountryCode ::last = ZW;
- char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
{
return name;
}
}
public:
- property char * { get { char * s = OnGetString(null, null, null); return s; } }
- property char * name { get { return countryNames[this]; } }
+ property const char * { get { const char * s = OnGetString(null, null, null); return s; } }
+ property const char * name { get { return countryNames[this]; } }
// ATTENTION: allocated memory must be freed by caller
property char * code
{
}
};
-static String subdivisionCategoryNames[SubdivisionCategory] =
+static const String subdivisionCategoryNames[SubdivisionCategory] =
{
"(none)",
"Administration", "Metropolitan Administration",
territorialUnit, autonomousTerritorialUnit;
public:
- property char * name { get { return subdivisionCategoryNames[this]; } }
+ property const char * name { get { return subdivisionCategoryNames[this]; } }
};
-static String caSubdivisionNames[CASubdivisionCode] =
+static const String caSubdivisionNames[CASubdivisionCode] =
{
"(none)",
"Alberta",
{
none, AB, BC, MB, NB, NL, NS, ON, PE, QC, SK, NT, NU, YT;
- char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
{
return name;
}
public:
- property char * { get { char * s = OnGetString(null, null, null); return s; } }
+ property const char * { get { const char * s = OnGetString(null, null, null); return s; } }
// ATTENTION: allocated memory must be freed by caller
property char * completeCode { get { return PrintString(CountryCode::CA, "-", this); } }
- property char * name { get { return caSubdivisionNames[this]; } }
+ property const char * name { get { return caSubdivisionNames[this]; } }
// ATTENTION: allocated memory must be freed by caller
property char * code
{
// TODO: OnDisplay and flag resources
};
-static String usSubdivisionNames[USSubdivisionCode] =
+static const String usSubdivisionNames[USSubdivisionCode] =
{
"(none)",
"Alaska",
NE, NH, NJ, NM, NV, NY, OH, OK, OR, PA, PR, RI, SC, SD, TN, TX,
UM, UT, VA, VI, VT, WA, WI, WV, WY;
- char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
{
return name;
}
public:
- property char * { get { char * s = OnGetString(null, null, null); return s; } }
+ property const char * { get { const char * s = OnGetString(null, null, null); return s; } }
// ATTENTION: allocated memory must be freed by caller
property char * completeCode { get { return PrintString(CountryCode::US, "-", this); } }
- property char * name { get { return usSubdivisionNames[this]; } }
+ property const char * name { get { return usSubdivisionNames[this]; } }
// ATTENTION: allocated memory must be freed by caller
property char * code
{
default:
-static void _WorkAround()
+__attribute__((unused)) static void _WorkAround()
{
int a;
a.OnGetDataFromString(null);
public class Currency : double
{
- char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
{
char number[256];
int len;
return tempString;
}
- bool OnGetDataFromString(char * string)
+ bool OnGetDataFromString(const char * string)
{
int c;
char ch;
public import "ecere"
#endif
-static Array<String> shortMonths
+static Array<const String> shortMonths
{ [
$"Jan", $"Feb", $"Mar", $"Apr", $"May", $"Jun", $"Jul", $"Aug", $"Sep", $"Oct", $"Nov", $"Dec"
] };
public struct ShortDate : Date
{
- char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
+ const char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
if(day || month || year)
{
virtual uint stdcall AddRef()
{
- return (uint)InterlockedIncrement(&_refCount);
+ return (uint)InterlockedIncrement((void *)&_refCount);
}
virtual uint stdcall Release()
{
- uint cRef = InterlockedDecrement(&_refCount);
+ uint cRef = InterlockedDecrement((void *)&_refCount);
if(cRef == 0)
delete this;
return cRef;
{
IWiaItem *pWiaItem;
- HRESULT DeviceDlg(HWND hWndParent, uint lFlags, uint lIntent, int * count, void * images)
+ HRESULT DeviceDlg(HWND hWndParent, uint lFlags, uint lIntent, LONG * count, void * images)
{
return (HRESULT)IWiaItem_DeviceDlg(pWiaItem, hWndParent, lFlags, lIntent, count, images);
}
{
List<Bitmap> result = null;
IWiaItem ** ppIWiaItem;
- int count;
+ LONG count;
Window window = ((GuiApplication)__thisModule.application).desktop.activeChild;
if(window) window = window.rootWindow;
GET_STIDEVICE_TYPE(nDevType) == StiDeviceTypeScanner)
{
PROPSPEC specDocumentHandlingSelect;
- LONG nDocumentHandlingSelect;
+ uint nDocumentHandlingSelect;
specDocumentHandlingSelect.ulKind = PRSPEC_PROPID;
specDocumentHandlingSelect.propid = WIA_DPS_DOCUMENT_HANDLING_SELECT;
if(scannerProp.ReadLong(&specDocumentHandlingSelect, &nDocumentHandlingSelect) &&
- nDocumentHandlingSelect & FEEDER)
+ (nDocumentHandlingSelect & FEEDER))
{
PROPSPEC specPages;
PROPVARIANT varPages;
{
GUID guidFormat = WiaImgFmt_BMP;
GUID preferredFormat;
- String format = "bmp";
+ const String format = "bmp";
PROPSPEC specPreferredFormat;
specPreferredFormat.ulKind = PRSPEC_PROPID;
}
}
+// Consider merging with PrintType ?
void OutputType(File f, Type type, bool outputName)
{
if(type)
{
+ if(type.kind != pointerType && type.constant)
+ f.Printf("const ");
switch(type.kind)
{
case voidType:
case pointerType:
OutputType(f, type.type, false);
f.Printf(" *");
+ if(type.constant)
+ f.Printf(" const");
break;
case ellipsisType:
f.Printf("...");
bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
{
- char * select = row.string;
+ const char * select = row.string;
if(!strcmp(select, "EDB") || !strcmp(select, "SQLite"))
{
char path[MAX_LOCATION];
void OnRedraw(Surface surface)
{
- int x = clientSize.w - 1, y = clientSize.h - 1;
+ int x = clientSize.w - 1;
surface.HLine(0, x, 5);
}
}
struct ShortDate : Date
{
- char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
+ const char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
static const char months[12][4] =
{