static Context globalContext { };
static Module privateModule;
static ModuleImport mainModule;
-static OldList _excludedSymbols { offset = (uint)&((Symbol)0).left };
+static OldList _excludedSymbols { offset = (uint)&((Symbol)0).left };
static OldList defines, imports;
static NameSpace globalData
{
count++, succeeded += TestType("void (*[10])()", null);
count++, succeeded += TestType("void (* converters_table[10])()", null);
count++, succeeded += TestType("int (* f[8])[10]", null);
-
+
count++, succeeded += TestType("int f[8][10]", null);
count++, succeeded += TestType("int f[10]", null);
count++, succeeded += TestType("void *", null);
count++, succeeded += TestType("int * const *", null);
count++, succeeded += TestType("int * const", null);
count++, succeeded += TestType("const int *", null);
-
+
count++, succeeded += TestType("char * const (* (* const bar)[5])(int)", null);
count++, succeeded += TestType("char * const (* (* (* const bar)[5][6])(int))[2]", null);
count++, succeeded += TestType("int * * a", null);
count++, succeeded += TestType("char * const (* bar)()", null);
count++, succeeded += TestType("char * const (* const (* const bar)[5])(int)", null);
-
+
count++, succeeded += TestType("char * (* const (* bar)[5])(int)", null);
count++, succeeded += TestType("void (* * const bar[5])()", null);
count++, succeeded += TestType("void (* * const bar)()", null);
#if 0
// TEMP: UNTIL WE CAN HAVE PER SOURCE FILE PREPROCESSOR DEFINITIONS...
- if(GetBuildingEcereCom() &&
+ if(GetBuildingEcereCom() &&
!(strcmpi(mainModuleName, "instance.ec") && strcmpi(mainModuleName, "BinaryTree.ec") &&
strcmpi(mainModuleName, "dataTypes.ec") && strcmpi(mainModuleName, "OldList.ec") &&
strcmpi(mainModuleName, "String.ec") && strcmpi(mainModuleName, "BTNode.ec") &&
strcmpi(mainModuleName, "List.ec") && strcmpi(mainModuleName, "Map.ec") &&
strcmpi(mainModuleName, "Mutex.ec")))
SetBuildingEcereComModule(true);
- if(GetBuildingEcereCom() &&
+ if(GetBuildingEcereCom() &&
!(strcmpi(mainModuleName, "instance.ec") && strcmpi(mainModuleName, "BinaryTree.ec") &&
/*strcmpi(mainModuleName, "dataTypes.ec") && strcmpi(mainModuleName, "OldList.ec") &&*/
/*strcmpi(mainModuleName, "String.ec") && */strcmpi(mainModuleName, "BTNode.ec") &&
strcmpi(mainModuleName, "Mutex.ec") && strcmpi(mainModuleName, "Thread.ec")))
//if(GetBuildingEcereCom() && !strcmpi(mainModuleName, "instance.ec"))
SetMemoryGuard(false);
-#endif
+#endif
StripExtension(mainModuleName);
module = ImportedModule { name = CopyString(mainModuleName), type = moduleDefinition };
strcpy(symLocation, GetSymbolsDir());
PathCat(symLocation, symFile);
-
+
// LoadSymbols(symLocation, normalImport, true);
LoadSymbols(symLocation, preDeclImport, false);
-
+
for(module = ::defines.first; module; module = next)
{
next = module.next;
// For classes defined in this module...
ComputeModuleClasses(privateModule);
-
+
// *** PASS 1 - Turn the class functions into functions ***
// *** Write the RegisterModule (Register classes) ***
ProcessClassDefinitions();
// #include <stdarg.h>
-// WARNING: PropertyDefine, ClassDefine and DataMemberDefine must remain compatible
+// WARNING: PropertyDefine, ClassDefine and DataMemberDefine must remain compatible
struct ClassDefine : Definition
{
char * base;
bool isVirtual;
};
-// WARNING: PropertyDefine, ClassDefine and DataMemberDefine must remain compatible
+// WARNING: PropertyDefine, ClassDefine and DataMemberDefine must remain compatible
class PropertyDefine : struct
{
PropertyDefine prev, next;
bool hasSet, hasGet;
};
-// WARNING: PropertyDefine, ClassDefine and DataMemberDefine must remain compatible
+// WARNING: PropertyDefine, ClassDefine and DataMemberDefine must remain compatible
class DataMemberDefine : struct
{
DataMemberDefine prev, next;
if(decl.type == structDeclaration)
{
Declarator d;
-
+
if(decl.declarators)
{
for(d = decl.declarators->first; d; d = d.next)
//if(d.type != DeclaratorFunction)
if(declId)
{
- dataMemberDefine = DataMemberDefine
+ dataMemberDefine = DataMemberDefine
{
isProperty = MemberType::dataMember;
memberType = normalMember;
if(posExp.isConstant)
bitPos = strtol(posExp.constant, null, 0);
FreeExpression(posExp);
-
+
}
d.structDecl.exp = null;
PrintType(dataType, typeString, false, true);
if(member)
- dataMember = eMember_AddDataMember(member, declId.string,
+ dataMember = eMember_AddDataMember(member, declId.string,
typeString, /*ComputeTypeSize(dataType)*/ 0, 0, def.memberAccess);
else
- dataMember = eClass_AddDataMember(regClass, declId.string,
+ dataMember = eClass_AddDataMember(regClass, declId.string,
typeString, /*ComputeTypeSize(dataType)*/ 0, 0, def.memberAccess);
if(dataMember)
dataMember.dataType = dataType;
memberType = (spec.type == SpecifierType::unionSpecifier) ? unionMember : structMember;
};
parentMemberDefine.dataMembers.Add(dataMemberDefine);
-
+
AddDefinitions(null, dataMemberDefine, null, dataMember, spec.definitions);
if(member)
PrintType(dataType, typeString, false, true);
if(member)
- dataMember = eMember_AddDataMember(member, id.string,
+ dataMember = eMember_AddDataMember(member, id.string,
typeString, /*ComputeTypeSize(dataType)*/ 0, 0, def.memberAccess);
else
- dataMember = eClass_AddDataMember(regClass, id.string,
+ dataMember = eClass_AddDataMember(regClass, id.string,
typeString, /*ComputeTypeSize(dataType)*/ 0, 0, def.memberAccess);
//delete dataTypeString;
if(prop)
{
prop.symbol = Symbol
- {
+ {
string = CopyString(propertyDef.symbol.string);
id = propertyDef.symbol.id;
type = propertyDef.symbol.type;
member = eClass_AddDataMember(regClass, def.id.string, null, 0, 0, def.memberAccess);
- dataMemberDefine = DataMemberDefine
+ dataMemberDefine = DataMemberDefine
{
isProperty = dataMember;
memberType = normalMember;
}
}
}
- else if(baseType.kind == structType || baseType.kind == unionType)
+ else if(baseType.kind == structType || baseType.kind == unionType)
{
classType = noHeadClass;
baseName[0] = '\0';
}
- else
+ else
unitType = true;
FreeType(baseType);
unionDefine = DataMemberDefine
{
isProperty = dataMember;
- memberType = DataMemberType::unionMember;
+ memberType = DataMemberType::unionMember;
};
classDefine.propertiesAndMembers.Add(unionDefine);
switch(param.type)
{
case type:
- defaultArg.dataTypeString =
+ defaultArg.dataTypeString =
StringFromSpecDecl(param.defaultArgument.templateDatatype.specifiers, param.defaultArgument.templateDatatype.decl);
break;
case identifier:
else
strcpy(memberString, param.defaultArgument.identifier._class.name);
}
-
+
if(memberString[0])
{
strcat(memberString, "::");
char * typeString = param.dataType ? StringFromSpecDecl(param.dataType.specifiers, param.dataType.decl) : null;
eClass_AddTemplateParameter(regClass, param.identifier.string, param.type, typeString, defaultArg);
- /*eClass_AddTemplateParameter(regClass, param.identifier.string, param.type,
+ /*eClass_AddTemplateParameter(regClass, param.identifier.string, param.type,
(param.type == type) ? eSystem_FindClass(regClass.module, typeString) : CopyString(typeString), defaultArg);*/
// delete typeString;
}
refCount = 1;
};
e.exp.destType = destType;
-
+
// Set parsingType to avoid producing errors
SetParsingType(true);
ProcessExpressionType(e.exp);
}
else
// Sort of an error
- eEnum_AddValue(regClass, e.id.string);
+ eEnum_AddValue(regClass, e.id.string);
}
else
eEnum_AddValue(regClass, e.id.string);
Specifier specifier;
for(specifier = declaration.specifiers->first; specifier; specifier = specifier.next)
{
- if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
+ if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
(declaration.declMode || specifier.baseSpecs || (specifier.type == enumSpecifier && specifier.definitions)))
{
Symbol symbol = FindClass(specifier.id.string);
typeString[0] = '\0';
PrintType(function.declarator.symbol.type, typeString, true, true);
functionDefine = FunctionDefine
- {
+ {
type = functionDefinition;
name = CopyString(function.declarator.symbol.string);
dataType = CopyString(typeString);
Specifier specifier;
for(specifier = declaration.specifiers->first; specifier; specifier = specifier.next)
{
- if((specifier.type == enumSpecifier) && specifier.id && specifier.id.string &&
+ if((specifier.type == enumSpecifier) && specifier.id && specifier.id.string &&
(declaration.declMode || specifier.baseSpecs || (specifier.type == enumSpecifier && specifier.definitions)))
{
Symbol symbol = FindClass(specifier.id.string);
}
f.Printf(" .\n");
}
-
+
if(!classDefine.isStatic)
{
if(classDefine.methods.first)
}
f.Printf(" .\n");
delete f;
- }
+ }
}
class PrecompApp : Application
globalContext.types.Add((BTNode)Symbol { string = CopyString("uintptr_t"), type = ProcessTypeString("uintptr", false) });
globalContext.types.Add((BTNode)Symbol { string = CopyString("ssize_t"), type = ProcessTypeString("intsize", false) });
globalContext.types.Add((BTNode)Symbol { string = CopyString("size_t"), type = ProcessTypeString("uintsize", false) });
-
+
{
char * outputFilePath = GetOutputFile();
if(FileExists(outputFilePath))
{
ClassImport _class = null;
FunctionImport function = null;
-
+
if(!strcmp(line, "[This]"))
{
if((mainModule = GetMainModule()))
if(!(_class = module.classes.FindName(line, false)))
{
_class = ClassImport { name = CopyString(line) };
- module.classes.AddName(_class);
+ module.classes.AddName(_class);
}
}
}
static bool SeardchModuleName(Module searchIn, char * name)
{
SubModule subModule;
-
+
if(searchIn.name && !strcmp(searchIn.name, name))
return true;
ModuleInfo defModule;
bool nonInst = false, anyMethod = false, anyProp = false, anyFunction = false;
ImportedModule importedModule;
-
+
GetLastDirectory(fileName, mainModuleName);
StripExtension(mainModuleName);
if(!projectName[0])
else if(module.name && module.importType != staticImport && (!meth || !meth.dataType.dllExport))
{
/*char name[4096];
-
+
Type type
{
kind = TypePointer,
char className[1024] = "";
FullClassNameCat(className, _class.name, true);
MangleClassName(className);
-
+
if(_class.itself)
sprintf(classID, "__ecereClass_%s", className);
else
strcpy(classID, "_class");
-
+
if(isDynamicLibrary && !isStaticLibrary)
f.Printf(" %s = eSystem_FindClass(__currentModule, \"%s\");\n", classID, _class.name);
else
{
if(method.isVirtual || (module.name && module.importType != staticImport))
{
- f.Printf(" method = eClass_FindMethod(%s, \"%s\", module);\n",
+ f.Printf(" method = eClass_FindMethod(%s, \"%s\", module);\n",
classID, method.name);
if(method.isVirtual)
f.Printf(" if(method) __ecereVMethodID_%s_%s = method.vid;\n", className, method.name);
// strcpy(propName, prop.name);
MangleClassName(propName);
- f.Printf(" __ecereProp_%s_%s = _property = eClass_FindProperty(%s, \"%s\", module);\n",
+ f.Printf(" __ecereProp_%s_%s = _property = eClass_FindProperty(%s, \"%s\", module);\n",
className, propName, classID, prop.name);
if(module.name && module.importType != staticImport)
// f.Printf("this.instance.%s(", method.name);
f.Printf("%s(", method.name);
-
+
for(param = method.dataType.params.first; param; param = param.next)
{
if(param.prev)
for(param = method.dataType.params.first; param; param = param.next)
{
- if(param.kind == classType && strcmp(param._class.string, "String") && param._class.registered &&
+ if(param.kind == classType && strcmp(param._class.string, "String") && param._class.registered &&
(param._class.registered.type == normalClass || param._class.registered.type == noHeadClass))
{
f.Printf(" delete %s;\n", param.name);
}
}
- if(method.dataType.returnType.kind == classType && strcmp(method.dataType.returnType._class.string, "String") && method.dataType.returnType._class.registered &&
+ if(method.dataType.returnType.kind == classType && strcmp(method.dataType.returnType._class.string, "String") && method.dataType.returnType._class.registered &&
(method.dataType.returnType._class.registered.type == normalClass || method.dataType.returnType._class.registered.type == noHeadClass))
{
f.Printf(" delete __ecereResult;\n");
f.Printf(" }\n");
f.Printf(" }\n");
f.Printf("\n");
- }
+ }
doVirtual = true;
id = 0;
}
DeclareMethod(
eClass_FindMethod(
- eSystem_FindClass(privateModule, "ecere::net::DCOMClientObject"), "CallMethod", privateModule),
+ eSystem_FindClass(privateModule, "ecere::net::DCOMClientObject"), "CallMethod", privateModule),
"__ecereMethod___ecereNameSpace__ecere__net__DCOMClientObject_CallMethod");
f.Printf(" if(DCOMClientObject::CallMethod(%d))\n", id++);
next = (Method)_class.methods.first;
}
}
-
- if(next)
+
+ if(next)
f.Printf("\n");
}
f.Printf("}\n");
- if(deriv.next)
+ if(deriv.next)
f.Printf("\n");
}
}
// f.Printf("this.instance.%s(", method.name);
f.Printf("((%s)instance).%s(", _class.fullName, method.name);
-
+
for(param = method.dataType.params.first; param; param = param.next)
{
if(param.prev)
for(param = method.dataType.params.first; param; param = param.next)
{
- if(param.kind == classType && strcmp(param._class.string, "String") && param._class.registered &&
+ if(param.kind == classType && strcmp(param._class.string, "String") && param._class.registered &&
(param._class.registered.type == normalClass || param._class.registered.type == noHeadClass))
{
f.Printf(" delete %s;\n", param.name);
}
}
- if(method.dataType.returnType.kind == classType && strcmp(method.dataType.returnType._class.string, "String") && method.dataType.returnType._class.registered &&
+ if(method.dataType.returnType.kind == classType && strcmp(method.dataType.returnType._class.string, "String") && method.dataType.returnType._class.registered &&
(method.dataType.returnType._class.registered.type == normalClass || method.dataType.returnType._class.registered.type == noHeadClass))
{
f.Printf(" delete __ecereResult;\n");
DeclareClass(FindClass("ecere::sys::Mutex"), "__ecereClass___ecereNameSpace__ecere__sys__Mutex");
DeclareMethod(
eClass_FindMethod(
- eSystem_FindClass(privateModule, "ecere::sys::Mutex"), "Wait", privateModule),
+ eSystem_FindClass(privateModule, "ecere::sys::Mutex"), "Wait", privateModule),
"__ecereMethod___ecereNameSpace__ecere__sys__Mutex_Wait");
DeclareMethod(
eClass_FindMethod(
- eSystem_FindClass(privateModule, "ecere::sys::Mutex"), "Release", privateModule),
+ eSystem_FindClass(privateModule, "ecere::sys::Mutex"), "Release", privateModule),
"__ecereMethod___ecereNameSpace__ecere__sys__Mutex_Release");
mutexDeclared = true;
}
f.Printf(" = 0");
f.Printf(";\n\n");
}
-
+
f.Printf(" incref __ecereObject;\n");
f.Printf(" __ecereMethod___ecereNameSpace__ecere__sys__Mutex_Wait(__ecereObject.mutex);\n");
DeclareMethod(
eClass_FindMethod(
- eSystem_FindClass(privateModule, "ecere::net::DCOMServerObject"), "CallVirtualMethod", privateModule),
+ eSystem_FindClass(privateModule, "ecere::net::DCOMServerObject"), "CallVirtualMethod", privateModule),
"__ecereMethod___ecereNameSpace__ecere__net__DCOMServerObject_CallVirtualMethod");
// Check if this method needs to return anything (hasReturnValue)
}
f.Printf(" }\n");
- /*if(vid < _class.vTblSize)
+ /*if(vid < _class.vTblSize)
f.Printf("\n");*/
}
}
}
if(!output)
valid = false;
-
+
if(!valid)
{
printf($"Syntax:\n ecs [-t <target platform>] <input>[, <input>]* -o <output>\n");
char symbolModule[MAX_FILENAME];
GetExtension(output, ext);
GetLastDirectory(output, symbolModule);
-
+
SetDefines(&::_defines);
SetImports(&_imports);
SetGlobalData(&globalData);
GetLastDirectory(file, fileName);
module.name = CopyString(fileName);
-
- StripExtension(module.name);
+
+ StripExtension(module.name);
for(importedModule = ::_defines.first; importedModule; importedModule = importedModule.next)
{
::_defines.Free(FreeModuleDefine);
_imports.Free(FreeModuleImport);
- //precompDefines.Free(FreeDefinition);
+ //precompDefines.Free(FreeDefinition);
FreeTypeData(privateModule);
FreeIncludeFiles();
{
Identifier id { };
int c;
-
+
id._class = null; // Default class...
if(string)
else
id.string = CopyString(string);
}
- }
+ }
}
else if(gotColon)
{
Specifier MkEnum(Identifier id, OldList list)
{
- Specifier spec
+ Specifier spec
{
type = enumSpecifier;
id = id;
{
Declaration decl { type = initDeclaration, declarators = initDeclarators, specifiers = specifiers, loc = yylloc };
bool variable = true;
-
+
if(specifiers != null)
{
bool gotType = false;
if(initDeclarators != null)
{
InitDeclarator d;
-
+
for(d = initDeclarators.first; d; d = d.next)
{
if(GetDeclId(d.declarator).string)
variable = false;
break;
}
- else if(spec.type == baseSpecifier &&
+ else if(spec.type == baseSpecifier &&
(spec.specifier == STRUCT || spec.specifier == UNION))
variable = false;
else
delete id.string;
id.string = CopyString(name);
}
-
+
// Avoid memory leaks on duplicated symbols (BinaryTree::Add Would Fail)
symbol = (Symbol)(curContext.templateTypesOnly ? curContext.parent : curContext).symbols.FindString(id.string);
if(!symbol)
fileInput = backFileInput;
if(fileInput)
{
- fileInput.Seek(yylloc.start.pos, start);
+ fileInput.Seek(yylloc.start.pos, start);
resetScannerPos(&yylloc.start);
yychar = -2;
}
}
}
else if(symbol)
- spec.name = CopyString(symbol.string);
+ spec.name = CopyString(symbol.string);
else
spec.name = CopyString(name);
spec.symbol = symbol;
symbol = Symbol
{
-
+
};
{
}
FreeList(specs, FreeSpecifier);
-
+
if(!spec)
{
Compiler_Error($"Expecting class specifier\n");
for(classContext = curContext; classContext && !classContext.classDef; classContext = classContext.parent);
if(classContext)
{
-
+
}
*/
if(name[0] == ':' && name[1] == ':')
strcpy(name, ((Specifier)baseSpecs.first).name);
tpl = strchr(name, '<');
if(tpl) *tpl = 0;
-
+
baseClass = FindClass(name);
if(baseClass && baseClass.ctx)
{
{
p.param = param = TemplateParameter
{
- identifier = MkIdentifier(p.name), type = p.type,
+ identifier = MkIdentifier(p.name), type = p.type,
dataTypeString = p.dataTypeString /*, dataType = { specs, decl }*/
};
}
bool ModuleAccess(Module searchIn, Module searchFor)
{
SubModule subModule;
-
+
if(searchFor == searchIn)
return true;
break;
if(!module)
{
- module = ModuleImport
- {
+ module = ModuleImport
+ {
name = CopyString(moduleToFind.name), importType = moduleToFind.importType,
importAccess = ModuleAccess(privateModule, moduleToFind) ? publicAccess : privateAccess
};
{
GetFullClassNameSpace(ns->parent, name);
strcat(name, ns->name);
- strcat(name, "::");
+ strcat(name, "::");
}
}
}
*/
if(cl.shortName && !strcmp(cl.shortName, name))
- break;
+ break;
}
#ifdef _TIMINGS
findClassIgnoreNSTotalTime += GetTime() - startTime;
else if(spec.specifier == INT) { if(specType.kind != shortType && specType.kind != longType && !isLong) specType.kind = intType; }
else if(spec.specifier == UINT) { if(specType.kind != shortType && specType.kind != longType) specType.kind = intType; specType.isSigned = false; }
else if(spec.specifier == INT64) specType.kind = int64Type;
- else if(spec.specifier == VALIST)
+ else if(spec.specifier == VALIST)
specType.kind = vaListType;
else if(spec.specifier == SHORT) specType.kind = shortType;
- else if(spec.specifier == LONG)
+ else if(spec.specifier == LONG)
{
if(isLong || (targetBits == 64 && targetPlatform != win32))
specType.kind = int64Type;
else if(spec.specifier == CONST)
specType.constant = true;
else if(spec.specifier == TYPED_OBJECT || spec.specifier == ANY_OBJECT || spec.specifier == CLASS)
- {
+ {
switch(spec.specifier)
{
case TYPED_OBJECT: specType.classObjectType = typedObject; break;
specType.kind = unionType;
if(spec.id)
{
- // TESTING THIS HERE... Had 0 type size
+ // TESTING THIS HERE... Had 0 type size
if(!spec.definitions && !isTypedef)
{
Symbol symbol = spec.id.string ? FindSymbol(spec.id.string, curContext, globalContext, true, false) : null;
}
else if(assumeEllipsis)
specType.kind = ellipsisType;
- return specType;
+ return specType;
}
static Type ProcessTypeDecls(OldList specs, Declarator decl, Type parentType)
{
type = { refCount = 1, kind = arrayType, arraySizeExp = CopyExpression(decl.array.exp), freeExp = true, type = type, dllExport = type.dllExport, attrStdcall = type.attrStdcall };
if(decl.array.enumClass)
- type.enumClass = decl.array.enumClass.symbol;
+ type.enumClass = decl.array.enumClass.symbol;
break;
}
case pointerDeclarator:
Statement MkAsmStmt(Specifier spec, char * statements, OldList inputFields, OldList outputFields, OldList clobberedFields)
{
- return { type = asmStmt, asmStmt.spec = spec, asmStmt.statements = statements,
- asmStmt.inputFields = inputFields, asmStmt.outputFields = outputFields,
+ return { type = asmStmt, asmStmt.spec = spec, asmStmt.statements = statements,
+ asmStmt.inputFields = inputFields, asmStmt.outputFields = outputFields,
asmStmt.clobberedFields = clobberedFields };
}
char idString[32];
char className[1024];
Expression classExp;
-
+
sprintf(idString, "%d", id);
strcpy(className, "__ecereClass_");
FullClassNameCat(className, _class.fullName, true);
DeclareClass(FindClass(_class.fullName), className);
argExp = MkExpIndex((/*pointer ? MkExpPointer : */MkExpMember)
- (MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class")) /*MkExpIdentifier(MkIdentifier(className))*/,
+ (MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class")) /*MkExpIdentifier(MkIdentifier(className))*/,
MkIdentifier("templateArgs")), MkListOne(MkExpConstant(idString)));
}
}
- return argExp;
+ return argExp;
}
Expression GetTemplateArgExp(TemplateParameter param, Class curClass, bool pointer)
for(member = members.dataMembers->first; member; member = member.next)
ListAdd(list, CopyMemberInit(member));
-
+
}
}
}
break;
}
case memberExp:
- result = MkExpMember(CopyExpression(exp.member.exp),
+ result = MkExpMember(CopyExpression(exp.member.exp),
CopyIdentifier(exp.member.member));
result.member.memberType = exp.member.memberType;
result.member.thisPtr = exp.member.thisPtr;
break;
case pointerExp:
- result = MkExpPointer(CopyExpression(exp.member.exp),
+ result = MkExpPointer(CopyExpression(exp.member.exp),
CopyIdentifier(exp.member.member));
break;
case typeSizeExp:
Expression e;
for(e = exp.cond.exp->first; e; e = e.next)
ListAdd(list, CopyExpression(e));
- result = MkExpCondition(CopyExpression(exp.cond.cond), list,
+ result = MkExpCondition(CopyExpression(exp.cond.cond), list,
CopyExpression(exp.cond.elseExp));
break;
}
result.isConstant = exp.isConstant;
result.byReference = exp.byReference;
}
-
+
return result;
}
static Statement CopyStatement(Statement stmt)
{
Statement result = null;
- if(stmt)
+ if(stmt)
{
switch(stmt.type)
{
case functionClassDef:
return null; //return MkClassDefFunction(CopyClassFunction(def.function));
case defaultPropertiesClassDef:
- return null; //return MkClassDefDefaultProperty(CopyList(def.defProperties, CopyDefaultProperty));
+ return null; //return MkClassDefDefaultProperty(CopyList(def.defProperties, CopyDefaultProperty));
case declarationClassDef:
return MkClassDefDeclaration(CopyDeclaration(def.decl));
case propertyClassDef:
{
OldList * list = null;
TypeName copy;
-
+
if(typeName.qualifiers)
{
Specifier spec;
{
case structDeclarator:
{
- Declarator decl = MkStructDeclarator(CopyDeclarator(declarator.declarator),
+ Declarator decl = MkStructDeclarator(CopyDeclarator(declarator.declarator),
CopyExpression(declarator.structDecl.exp));
if(declarator.structDecl.attrib)
decl.structDecl.attrib = CopyAttrib(declarator.structDecl.attrib);
return MkDeclaratorBrackets(CopyDeclarator(declarator.declarator));
case arrayDeclarator:
if(declarator.array.enumClass)
- return MkDeclaratorEnumArray(CopyDeclarator(declarator.declarator),
+ return MkDeclaratorEnumArray(CopyDeclarator(declarator.declarator),
CopySpecifier(declarator.array.enumClass));
else
- return MkDeclaratorArray(CopyDeclarator(declarator.declarator),
+ return MkDeclaratorArray(CopyDeclarator(declarator.declarator),
CopyExpression(declarator.array.exp));
case functionDeclarator:
{
{
Expression expression;
ProcessExpression(exp.index.exp);
-
+
for(expression = exp.index.index->first; expression; expression = expression.next)
{
ProcessExpression(expression);
case callExp:
{
ProcessExpression(exp.call.exp);
-
+
if(exp.call.arguments)
{
Expression expression;
sprintf(name, "__ecereDBField_%s_%s", tableName, exp.db.id.string);
FreeExpContents(exp);
exp.type = identifierExp;
- exp.identifier = MkIdentifier(name);
+ exp.identifier = MkIdentifier(name);
break;
}
case dbtableExp:
sprintf(name, "__ecereDBTable_%s", tableName);
FreeExpContents(exp);
exp.type = identifierExp;
- exp.identifier = MkIdentifier(name);
+ exp.identifier = MkIdentifier(name);
break;
}
case dbindexExp:
sprintf(name, "__ecereDBIndex_%s_%s", tableName, exp.db.id.string);
FreeExpContents(exp);
exp.type = identifierExp;
- exp.identifier = MkIdentifier(name);
+ exp.identifier = MkIdentifier(name);
break;
}
case dbopenExp:
databaseOpenStmt.compound.context = Context { parent = curContext };
- databaseOpenStmt.compound.declarations->Add(MkDeclaration(MkListOne(MkSpecifierName("Database")),
+ databaseOpenStmt.compound.declarations->Add(MkDeclaration(MkListOne(MkSpecifierName("Database")),
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("db")), null))));
// bool createNow = false;
- databaseOpenStmt.compound.declarations->Add(MkDeclaration(MkListOne(MkSpecifierName("bool")),
+ databaseOpenStmt.compound.declarations->Add(MkDeclaration(MkListOne(MkSpecifierName("bool")),
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("createNow")), MkInitializerAssignment(MkExpIdentifier(MkIdentifier("false")))))));
// static bool initialized = false;
args = MkList();
args->Add(MkSpecifier(STATIC));
args->Add(MkSpecifierName("bool"));
- databaseOpenStmt.compound.declarations->Add(MkDeclaration(args,
+ databaseOpenStmt.compound.declarations->Add(MkDeclaration(args,
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("initialized")), MkInitializerAssignment(MkExpIdentifier(MkIdentifier("false")))))));
// Assuming we're in a function where we can return 0 (Typically a DataBase InitSchema() or an Application constructor)
args = MkList();
args->Add(CopyExpression(exp.dbopen.name));
args->Add(MkExpIdentifier(MkIdentifier("no")));
- databaseOpenStmt.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("db")), '=',
+ databaseOpenStmt.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("db")), '=',
MkExpCall(MkExpMember(CopyExpression(exp.dbopen.ds), MkIdentifier("OpenDatabase")), args)))));
-
+
/*if(!db)
{
db = ds.OpenDatabase("med", create);
createNow = true;
}
*/
- databaseOpenStmt.compound.statements->Add(MkIfStmt(MkListOne(MkExpOp(null, '!', MkExpIdentifier(MkIdentifier("db")))),
+ databaseOpenStmt.compound.statements->Add(MkIfStmt(MkListOne(MkExpOp(null, '!', MkExpIdentifier(MkIdentifier("db")))),
compound = MkCompoundStmt(null, MkList()), null));
compound.compound.context = Context { parent = databaseOpenStmt.compound.context };
-
+
args = MkList();
args->Add(exp.dbopen.name);
args->Add(MkExpIdentifier(MkIdentifier("create")));
- compound.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("db")), '=',
+ compound.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("db")), '=',
MkExpCall(MkExpMember(exp.dbopen.ds, MkIdentifier("OpenDatabase")), args)))));
- compound.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("createNow")), '=',
+ compound.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("createNow")), '=',
MkExpIdentifier(MkIdentifier("true"))))));
exp.dbopen.name = null;
exp.dbopen.ds = null;
// if(db)
- databaseOpenStmt.compound.statements->Add(MkIfStmt(MkListOne(MkExpIdentifier(MkIdentifier("db"))),
+ databaseOpenStmt.compound.statements->Add(MkIfStmt(MkListOne(MkExpIdentifier(MkIdentifier("db"))),
ifDBStmt = MkCompoundStmt(MkList(), MkList()), null));
ifDBStmt.compound.context = Context { parent = databaseOpenStmt.compound.context };
// FieldIndex indexes[numIndexes] = { null };
sprintf(numIndexesString, "%d", numIndexes);
- ifDBStmt.compound.declarations->Add(MkDeclaration(MkListOne(MkSpecifierName("FieldIndex")), MkListOne(MkInitDeclarator(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("indexes")),
+ ifDBStmt.compound.declarations->Add(MkDeclaration(MkListOne(MkSpecifierName("FieldIndex")), MkListOne(MkInitDeclarator(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("indexes")),
MkExpConstant(numIndexesString)), MkInitializerList(MkListOne(MkInitializerList(MkListOne(MkInitializerAssignment(MkExpIdentifier(MkIdentifier("null")))))))))));
-
+
// db.Begin();
ifDBStmt.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("db")), MkIdentifier("Begin")), MkList()))));
ifDBStmt.compound.statements->Add(compound = MkCompoundStmt(null, tableStatements));
compound.compound.context = Context { parent = ifDBStmt.compound.context };
/*
- ifDBStmt.compound.statements->Add(MkIfStmt(MkListOne(MkExpIdentifier(MkIdentifier("createNow"))),
- (compound = MkCompoundStmt(null, addFieldStatements), compound.compound.context = Context { parent = ifDBStmt.compound.context }, compound),
+ ifDBStmt.compound.statements->Add(MkIfStmt(MkListOne(MkExpIdentifier(MkIdentifier("createNow"))),
+ (compound = MkCompoundStmt(null, addFieldStatements), compound.compound.context = Context { parent = ifDBStmt.compound.context }, compound),
(compound2 = MkCompoundStmt(null, findFieldStatements), compound2.compound.context = Context { parent = ifDBStmt.compound.context }, compound2)));
*/
ifDBStmt.compound.statements->Add(
{
ProcessStatement(stmt.forStmt.init);
}
-
+
if(stmt.forStmt.check)
{
ProcessStatement(stmt.forStmt.check);
}
-
+
if(stmt.forStmt.increment)
{
for(exp = stmt.forStmt.increment->first; exp; exp = exp.next)
if(stmt.expressions)
{
Expression exp;
-
+
for(exp = stmt.expressions->first; exp; exp = exp.next)
{
ProcessExpression(exp);
case listInitializer:
{
Initializer init;
-
+
for(init = initializer.list->first; init; init = init.next)
{
ProcessInitializer(init);
for(d = decl.declarators->first; d; d = d.next)
{
ProcessInitDeclarator(d);
- }
+ }
}
break;
}
MembersInit init;
MemberInit memberInit;
for(init = inst.members->first; init; init = init.next)
- {
+ {
if(init.type == dataMembersInit && init.dataMembers)
{
for(memberInit = init.dataMembers->first; memberInit; memberInit = memberInit.next)
sprintf(rowClassName, "Row%s", tableName);
ChangeCh(rowClassName, ' ', '_');
-
+
if(!tableStatements)
{
tableStatements = MkList();
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(tableID)), null))));
external.declaration.declMode = table.declMode;
ast->Insert(addAfter, external);
-
+
// tClasses = db.OpenTable("Classes", { tableRows, create });
args = MkList();
tableStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(tableID)), '=', MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("db")), MkIdentifier("OpenTable")),
curContext = rowSet.compound.context = Context { parent = globalContext };
// Find(fieldSECid, middle, nil, value);
- rowSet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("Find")),
+ rowSet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("Find")),
args = MkList()))));
args->Add(MkExpIdentifier(MkIdentifier(fieldID)));
args->Add(MkExpIdentifier(MkIdentifier("middle")));
curContext = globalContext;
def = MkClassDefProperty(MkProperty(
- CopyList(entry.dataType.qualifiers, CopySpecifier), CopyDeclarator(entry.dataType.declarator),
+ CopyList(entry.dataType.qualifiers, CopySpecifier), CopyDeclarator(entry.dataType.declarator),
MkIdentifier(name), rowSet, null));
def.propertyDef.symbol.id = def.propertyDef.symbol.idCode = symbolID;
def.memberAccess = publicAccess;
{
Statement rowSet = MkCompoundStmt(MkList(), MkList()), rowGet = MkCompoundStmt(MkList(), MkList());
ClassDef def;
-
+
curContext = rowGet.compound.context = Context { parent = globalContext };
// *** GET ***
else
{
Expression exp;
- rowGet.compound.declarations->Add(MkDeclaration(CopyList(entry.dataType.qualifiers, CopySpecifier),
+ rowGet.compound.declarations->Add(MkDeclaration(CopyList(entry.dataType.qualifiers, CopySpecifier),
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("d")), MkInitializerAssignment(exp = MkExpConstant("0"))))));
exp.destType = Type { kind = intType, refCount = 1 };
}
// GetData(fieldCNTid, d);
- rowGet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("GetData")),
+ rowGet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("GetData")),
args = MkList()))));
args->Add(MkExpIdentifier(MkIdentifier(fieldID)));
/*if(spec.type == nameSpecifier && spec.symbol && spec.symbol.registered && spec.symbol.registered.type == structClass)
// return d;
if(spec.type == nameSpecifier && spec.symbol && spec.symbol.registered && spec.symbol.registered.type == structClass)
{
- rowGet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("value")), '=',
+ rowGet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("value")), '=',
MkExpIdentifier(MkIdentifier("d"))))));
}
else
// *** SET ***
curContext = rowSet.compound.context = Context { parent = globalContext };
-
+
// SetData(fieldCNTid, value);
- rowSet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("SetData")),
+ rowSet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("SetData")),
args = MkList()))));
args->Add(MkExpIdentifier(MkIdentifier(fieldID)));
args->Add(MkExpIdentifier(MkIdentifier("value")));
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(fieldID)), null))));
ast->Add(external);
external.declaration.declMode = table.declMode;
-
+
// fieldCLSname = tClasses.AddField("name", class(String), 0 );
args = MkList();
addFieldStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(fieldID)), '=', MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier(tableID)), MkIdentifier("FindField")),
args = MkList();
addFieldStatements->Add(
- MkIfStmt(MkListOne(MkExpOp(null, '!', MkExpIdentifier(MkIdentifier(fieldID)))),
+ MkIfStmt(MkListOne(MkExpOp(null, '!', MkExpIdentifier(MkIdentifier(fieldID)))),
MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(fieldID)), '=', MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier(tableID)), MkIdentifier("AddField")),
args)))), null));
args->Add(MkExpString(entry.name));
if(isIndex)
{
// indexes[0].field = fieldCLSid;
- indexStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIndex(MkExpIdentifier(MkIdentifier("indexes")),
+ indexStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIndex(MkExpIdentifier(MkIdentifier("indexes")),
MkListOne(MkExpConstant("0"))), MkIdentifier("field")), '=', MkExpIdentifier(MkIdentifier(fieldID))))));
// indexes[0].order = ascending;
- indexStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIndex(MkExpIdentifier(MkIdentifier("indexes")),
+ indexStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIndex(MkExpIdentifier(MkIdentifier("indexes")),
MkListOne(MkExpConstant("0"))), MkIdentifier("order")), '=', MkExpIdentifier(MkIdentifier("ascending"))))));
// tClasses.Index(1, indexes);
def = MkClassDefClassPropertyValue(MkIdentifier("nameField"), MkInitializerAssignment(exp = MkExpOp(null, '&', MkExpDBField(CopyString(table.name), MkIdentifier(nameField)))));
ProcessExpression(exp);
idClassDefs->Add(def);
- }
+ }
// indexed = true;
}
// *** GET ***
// RowContacts r { this };
- idGet.compound.declarations->Add(MkDeclarationInst(MkInstantiation(MkSpecifierName(rowClassName), MkExpIdentifier(MkIdentifier("r")),
+ idGet.compound.declarations->Add(MkDeclarationInst(MkInstantiation(MkSpecifierName(rowClassName), MkExpIdentifier(MkIdentifier("r")),
MkListOne(MkMembersInitList(MkListOne(MkMemberInit(null, MkInitializerAssignment(MkExpIdentifier(MkIdentifier("this"))))))))));
-
+
// Contact d = null;
if(spec.type == nameSpecifier && spec.symbol && spec.symbol.registered && spec.symbol.registered.type == structClass)
{
else
{
Expression exp;
- idGet.compound.declarations->Add(MkDeclaration(CopyList(entry.dataType.qualifiers, CopySpecifier),
+ idGet.compound.declarations->Add(MkDeclaration(CopyList(entry.dataType.qualifiers, CopySpecifier),
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("d")), MkInitializerAssignment(exp = MkExpConstant("0"))))));
exp.destType = Type { kind = intType, refCount = 1 };
}
// r.GetData(fieldCNTid, d);
- idGet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("r")), MkIdentifier("GetData")),
+ idGet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("r")), MkIdentifier("GetData")),
args = MkList()))));
args->Add(MkExpIdentifier(MkIdentifier(fieldID)));
/*if(spec.type == nameSpecifier && spec.symbol && spec.symbol.registered && spec.symbol.registered.type == structClass)
// return d;
if(spec.type == nameSpecifier && spec.symbol && spec.symbol.registered && spec.symbol.registered.type == structClass)
{
- idGet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("value")), '=',
+ idGet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier("value")), '=',
MkExpIdentifier(MkIdentifier("d"))))));
}
else
// *** SET ***
curContext = idSet.compound.context = Context { parent = globalContext };
-
+
// RowContacts r { this };
- idSet.compound.declarations->Add(MkDeclarationInst(MkInstantiation(MkSpecifierName(rowClassName), MkExpIdentifier(MkIdentifier("r")),
+ idSet.compound.declarations->Add(MkDeclarationInst(MkInstantiation(MkSpecifierName(rowClassName), MkExpIdentifier(MkIdentifier("r")),
MkListOne(MkMembersInitList(MkListOne(MkMemberInit(null, MkInitializerAssignment(MkExpIdentifier(MkIdentifier("this"))))))))));
// r.SetData(fieldCNTid, value);
- idSet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("r")), MkIdentifier("SetData")),
+ idSet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("r")), MkIdentifier("SetData")),
args = MkList()))));
args->Add(MkExpIdentifier(MkIdentifier(fieldID)));
args->Add(MkExpIdentifier(MkIdentifier("value")));
idSet.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpOp(null, DELETE, MkExpIdentifier(MkIdentifier("r"))))));
curContext = globalContext;
-
+
def = MkClassDefProperty(MkProperty(
- CopyList(entry.dataType.qualifiers, CopySpecifier), CopyDeclarator(entry.dataType.declarator),
+ CopyList(entry.dataType.qualifiers, CopySpecifier), CopyDeclarator(entry.dataType.declarator),
CopyIdentifier(entry.id), idSet, idGet));
def.propertyDef.symbol.id = def.propertyDef.symbol.idCode = symbolID;
def.memberAccess = publicAccess;
sprintf(num, "%d", c);
sprintf(fieldID, "__ecereDBField_%s_%s", tableName, item.id.string);
- indexStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIndex(MkExpIdentifier(MkIdentifier("indexes")),
+ indexStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIndex(MkExpIdentifier(MkIdentifier("indexes")),
MkListOne(MkExpConstant(num))), MkIdentifier("field")), '=', MkExpIdentifier(MkIdentifier(fieldID))))));
- indexStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIndex(MkExpIdentifier(MkIdentifier("indexes")),
+ indexStatements->Add(MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIndex(MkExpIdentifier(MkIdentifier("indexes")),
MkListOne(MkExpConstant(num))), MkIdentifier("order")), '=', MkExpIdentifier(MkIdentifier((item.order == ascending) ? "ascending" : "descending"))))));
}
sprintf(num, "%d", c);
switch(external.type)
{
- case functionExternal:
+ case functionExternal:
ProcessFunction(external.function);
break;
- case declarationExternal:
+ case declarationExternal:
ProcessDeclaration(external.declaration);
break;
- case classExternal:
+ case classExternal:
ProcessClass(external._class);
break;
}
public:
char * name;
Symbol symbol;
- OldList * definitions;
+ OldList * definitions;
AccessMode declMode;
}
File fileInput;
public void SetFileInput(File file) { fileInput = file; }
char * symbolsDir = null;
-public void SetSymbolsDir(char * s) {
+public void SetSymbolsDir(char * s) {
delete symbolsDir;
symbolsDir = CopyString(s);
} public char * GetSymbolsDir() { return symbolsDir ? symbolsDir : ""; }
if(line - 1 > end.y)
line -= end.y - start.y;
// Location is the last touched line
- else
+ else
{
if(charPos - 1 >= end.x)
{
if(charPos - 1 > start.x || (charPos - 1 == start.x /*&& (numLines ? true : false)*/))
{
line += numLines;
- //charPos - 1 += numLines ? end.x : (end.x - start.x);
+ //charPos - 1 += numLines ? end.x : (end.x - start.x);
charPos += end.x - start.x;
}
}
bool Inside(int line, int charPos)
{
- return (start.line < line || (start.line == line && start.charPos <= charPos)) &&
+ return (start.line < line || (start.line == line && start.charPos <= charPos)) &&
(end.line > line || (end.line == line && end.charPos >= charPos));
}
};
};
public enum ExpressionType
-{
+{
identifierExp, instanceExp, constantExp, stringExp, opExp,
bracketsExp, indexExp, callExp, memberExp, pointerExp, typeSizeExp,
castExp, conditionExp, newExp, renewExp, classSizeExp,
public:
TemplateParameter prev, next;
Location loc;
-
+
TemplateParameterType type;
Identifier identifier;
union
TemplateMemberType memberType; // For identifier
};
TemplateArgument defaultArgument;
-
+
// For type parameters
char * dataTypeString;
Type baseType;
public:
TemplateArgument prev, next;
Location loc;
-
+
Identifier name;
TemplateParameterType type;
union
public enum DeclaratorType
{
- structDeclarator, identifierDeclarator, bracketsDeclarator, arrayDeclarator,
+ structDeclarator, identifierDeclarator, bracketsDeclarator, arrayDeclarator,
functionDeclarator, pointerDeclarator, extendedDeclarator, extendedDeclaratorEnd
};
};
public enum StmtType { labeledStmt, caseStmt, compoundStmt,
- expressionStmt, ifStmt, switchStmt, whileStmt, doWhileStmt,
+ expressionStmt, ifStmt, switchStmt, whileStmt, doWhileStmt,
forStmt, gotoStmt, continueStmt, breakStmt, returnStmt, asmStmt, badDeclarationStmt,
fireWatchersStmt, stopWatchingStmt, watchStmt, forEachStmt
};
{
OldList * exp;
Statement stmt;
- Statement elseStmt;
+ Statement elseStmt;
} ifStmt;
struct
{
Class _class;
OldList attached; // For IDE
AccessMode declMode;
-
+
// COMPILING DATA
Type type;
Symbol propSet;
};
public enum ClassDefType
-{
+{
functionClassDef, defaultPropertiesClassDef, declarationClassDef, propertyClassDef,
propertyWatchClassDef, classDesignerClassDef, classNoExpansionClassDef, classFixedClassDef,
designerDefaultPropertyClassDef, classDataClassDef, classPropertyClassDef, classPropertyValueClassDef,
char * constructorName, * structName, * className, * destructorName;
ModuleImport module;
- ClassImport _import;
+ ClassImport _import;
Location nameLoc;
bool isParam;
bool isRemote;
// For the .sym file:
public enum TypeKind
-{
+{
voidType, charType, shortType, intType, int64Type, longType, floatType,
doubleType, classType, structType, unionType, functionType, arrayType, pointerType,
ellipsisType, enumType, methodType, vaListType, /*typedObjectType, anyObjectType, classPointerType, */ dummyType,
void OnFree()
{
-
+
}
-};
+};
public struct Operand
{
bool (* Mul)(Expression, Operand, Operand);
bool (* Div)(Expression, Operand, Operand);
bool (* Mod)(Expression, Operand, Operand);
-
+
// unary arithmetic
bool (* Neg)(Expression, Operand);
-
+
// unary arithmetic increment and decrement
bool (* Inc)(Expression, Operand);
bool (* Dec)(Expression, Operand);
-
+
// binary arithmetic assignment
bool (* Asign)(Expression, Operand, Operand);
bool (* AddAsign)(Expression, Operand, Operand);
bool (* MulAsign)(Expression, Operand, Operand);
bool (* DivAsign)(Expression, Operand, Operand);
bool (* ModAsign)(Expression, Operand, Operand);
-
+
// binary bitwise
bool (* BitAnd)(Expression, Operand, Operand);
bool (* BitOr)(Expression, Operand, Operand);
bool (* LShift)(Expression, Operand, Operand);
bool (* RShift)(Expression, Operand, Operand);
bool (* BitNot)(Expression, Operand);
-
+
// binary bitwise assignment
bool (* AndAsign)(Expression, Operand, Operand);
bool (* OrAsign)(Expression, Operand, Operand);
bool (* XorAsign)(Expression, Operand, Operand);
bool (* LShiftAsign)(Expression, Operand, Operand);
bool (* RShiftAsign)(Expression, Operand, Operand);
-
+
// unary logical negation
bool (* Not)(Expression, Operand);
-
+
// binary logical equality
bool (* Equ)(Expression, Operand, Operand);
bool (* Nqu)(Expression, Operand, Operand);
-
+
// binary logical
bool (* And)(Expression, Operand, Operand);
bool (* Or)(Expression, Operand, Operand);
-
+
// binary logical relational
bool (* Grt)(Expression, Operand, Operand);
bool (* Sma)(Expression, Operand, Operand);
bool (* GrtEqu)(Expression, Operand, Operand);
bool (* SmaEqu)(Expression, Operand, Operand);
-
+
bool (* Cond)(Expression, Operand, Operand, Operand);
};
GetWorkingDir(string, sizeof(string));
PathCat(string, sourceFile);
}
-
+
printf(string);
//printf("(%d, %d) : warning: ", yylloc.start.line, yylloc.start.charPos);
/* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
-
+
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Foundation, Inc.
-
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
# define YYMAXDEPTH 10000
#endif
-\f
+
#if YYERROR_VERBOSE
}
}
#endif /* YYERROR_VERBOSE */
-\f
+
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
/* Line 1464 of yacc.c */
#line 954 "expression.y"
- {
- (yyval.initializer) = MkInitializerList((yyvsp[(2) - (4)].list));
- (yyval.initializer).loc = (yyloc);
+ {
+ (yyval.initializer) = MkInitializerList((yyvsp[(2) - (4)].list));
+ (yyval.initializer).loc = (yyloc);
{
Expression exp = MkExpDummy();
Initializer init = MkInitializerAssignment(exp);
init.loc = (yylsp[(3) - (4)]);
exp.loc = (yylsp[(3) - (4)]);
- ListAdd((yyvsp[(2) - (4)].list), init);
+ ListAdd((yyvsp[(2) - (4)].list), init);
}
;}
break;
/* Line 1464 of yacc.c */
#line 1040 "expression.y"
- {
- (yyval.stmt) = MkCompoundStmt(null, null);
- (yyval.stmt).compound.context = PushContext();
+ {
+ (yyval.stmt) = MkCompoundStmt(null, null);
+ (yyval.stmt).compound.context = PushContext();
PopContext((yyval.stmt).compound.context);
- (yyval.stmt).loc = (yyloc);
+ (yyval.stmt).loc = (yyloc);
;}
break;
Expression posExp = (d.type == structDeclarator) ? d.structDecl.posExp : null;
int bitSize = 0, bitPos = -1;
char dataTypeString[1024] = "";
-
+
if(sizeExp)
{
// Should this be processed/computed later?
if(member)
{
- dataMember = eMember_AddDataMember(member, declId.string,
+ dataMember = eMember_AddDataMember(member, declId.string,
typeString, 0, 0 /*ComputeTypeSize(dataType)*/, def.memberAccess);
if(!dataMember)
Compiler_Error($"Member with same name already exists %s in member %s\n", declId.string, member.name);
}
else if(regClass)
{
- dataMember = eClass_AddDataMember(regClass, declId.string,
+ dataMember = eClass_AddDataMember(regClass, declId.string,
typeString, 0, 0 /*ComputeTypeSize(dataType)*/, def.memberAccess);
if(!dataMember)
Compiler_Error($"Member with same name already exists %s in class %s\n", declId.string, regClass.name);
if(spec.definitions && !spec.id)
{
DataMember dataMember = eMember_New((spec.type == unionSpecifier) ? unionMember : structMember, def.memberAccess);
-
+
AddDefinitions(null, dataMember, spec.definitions);
if(member)
if(member)
{
- dataMember = eMember_AddDataMember(member, id.string,
+ dataMember = eMember_AddDataMember(member, id.string,
typeString, 0, 0 /*ComputeTypeSize(dataType)*/, def.memberAccess);
if(!dataMember)
Compiler_Error($"Member with same name already exists %s in member %s\n", id.string, member.name);
}
else
{
- dataMember = eClass_AddDataMember(regClass, id.string,
+ dataMember = eClass_AddDataMember(regClass, id.string,
typeString, 0, 0 /*ComputeTypeSize(dataType)*/, def.memberAccess);
if(!dataMember)
Compiler_Error($"Member with same name already exists %s in class %s\n", id.string, regClass.name);
// Register the property in the list
// MOVED THIS UP HERE BEFORE NEXT BLOCK BECAUSE WE NULL OUT SPECIFIERS/DECLARATORS... OK?
-
+
char * dataTypeString = StringFromSpecDecl(propertyDef.specifiers, propertyDef.declarator);
prop = eClass_AddProperty(regClass, propertyDef.conversion ? null : propertyDef.id.string,
dataTypeString,
if(inCompiler) prop.IsSet = (void *)propertyDef.issetStmt;
prop.compiled = false;
-
+
// prop.symbol = propertyDef.symbol;
prop.symbol = Symbol
{
type = propertyDef.symbol.type;
};
- /*if(propertyDef.category)
+ /*if(propertyDef.category)
{
char temp[1024];
ReadString(temp, propertyDef.category);
// Register the property in the list
// MOVED THIS UP HERE BEFORE NEXT BLOCK BECAUSE WE NULL OUT SPECIFIERS/DECLARATORS... OK?
-
+
char * dataTypeString = StringFromSpecDecl(propertyDef.specifiers, propertyDef.declarator);
prop = eClass_AddClassProperty(regClass, propertyDef.id.string, dataTypeString,
inCompiler ? propertyDef.setStmt : null, inCompiler ? propertyDef.getStmt : null);
}
}
}
- else if(baseType.kind == structType || baseType.kind == unionType)
+ else if(baseType.kind == structType || baseType.kind == unionType)
{
classType = noHeadClass;
baseName[0] = '\0';
}
- else
+ else
unitType = true;
FreeType(baseType);
Declarator funcDecl = GetFuncDecl(func.declarator);
Identifier id = GetDeclId(funcDecl);
Method method;
-
+
if(func.isVirtual)
{
char * typeString = StringFromSpecDecl(func.specifiers, func.declarator);
else
{
char * typeString = StringFromSpecDecl(func.specifiers, func.declarator);
- method = eClass_AddMethod(regClass, id.string, typeString,
+ method = eClass_AddMethod(regClass, id.string, typeString,
inCompiler ? func.declarator.symbol : null, def.memberAccess);
if(!method)
Compiler_Error($"Redefinition of method %s in class %s\n", id.string, regClass.name);
switch(param.type)
{
case type:
- defaultArg.dataTypeString =
+ defaultArg.dataTypeString =
StringFromSpecDecl(param.defaultArgument.templateDatatype.specifiers, param.defaultArgument.templateDatatype.decl);
break;
case identifier:
strcpy(memberString, param.defaultArgument.identifier._class.name);
}
}
-
+
if(memberString[0])
{
strcat(memberString, "::");
Specifier specifier;
for(specifier = declaration.specifiers->first; specifier; specifier = specifier.next)
{
- if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
+ if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
(declaration.declMode || specifier.baseSpecs || (specifier.type == enumSpecifier && specifier.definitions)))
{
Symbol type = FindType(globalContext, specifier.id.string);
Specifier specifier;
for(specifier = declaration.specifiers->first; specifier; specifier = specifier.next)
{
- if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
+ if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
(declaration.declMode || specifier.baseSpecs || (specifier.type == enumSpecifier && specifier.definitions)))
{
Symbol type = FindType(globalContext, specifier.id.string);
}
}
}
- }
+ }
}
}
}
{
if(exp.index.exp)
FreeExpression(exp.index.exp);
- if(exp.index.index)
+ if(exp.index.index)
FreeList(exp.index.index, FreeExpression);
break;
}
{
if(stmt.forStmt.init)
FreeStatement(stmt.forStmt.init);
-
+
if(stmt.forStmt.check)
FreeStatement(stmt.forStmt.check);
-
+
if(stmt.forStmt.increment)
FreeList(stmt.forStmt.increment, FreeExpression);
if(stmt.forStmt.stmt)
if(inst._class)
FreeSpecifier(inst._class);
-
+
// Free symbol?
// Free data;
FreeStatement(def.issetStmt);
if(def.category)
FreeExpression(def.category);
-
+
/*
if(def.getFunction)
FreeFunction(def.getFunction);
{
switch(external.type)
{
- case functionExternal:
+ case functionExternal:
if(external.function)
FreeFunction(external.function);
break;
- case declarationExternal:
+ case declarationExternal:
if(external.declaration)
FreeDeclaration(external.declaration);
break;
- case classExternal:
+ case classExternal:
if(external._class)
FreeClass(external._class);
break;
{
Class _class;
GlobalFunction function;
-
+
// Unload classes
for(_class = module.classes.first; _class; _class = _class.next)
{
}
}
}
-
+
for(function = module.functions.first; function; function = function.next)
{
- if(function.dataType)
+ if(function.dataType)
FreeType(function.dataType);
- if(function.symbol)
+ if(function.symbol)
FreeSymbol(function.symbol);
}
/* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
-
+
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Foundation, Inc.
-
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
TemplateParameter templateParameter;
TemplateArgument templateArgument;
TemplateDatatype templateDatatype;
-
+
DBTableEntry dbtableEntry;
DBIndexItem dbindexItem;
DBTableDef dbtableDef;
# define YYMAXDEPTH 10000
#endif
-\f
+
#if YYERROR_VERBOSE
}
}
#endif /* YYERROR_VERBOSE */
-\f
+
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
FreeIdentifier((yyvsp[(1) - (2)].id));
- fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
+ fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
resetScannerPos(&(yylsp[(1) - (2)]).start);
yyclearin;
FreeIdentifier((yyvsp[(1) - (2)].id));
- fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
+ fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
resetScannerPos(&(yylsp[(1) - (2)]).start);
yyclearin;
FreeIdentifier((yyvsp[(1) - (2)].id));
FreeIdentifier((yyvsp[(2) - (2)].id));
- fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
+ fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
resetScannerPos(&(yylsp[(1) - (2)]).start);
yyclearin;
YY_STACK_PRINT (yyss, yyssp);
goto yysetstate;
#else
- Location tmpLoc = yylloc; (yyval.specifier) = (yyvsp[(2) - (2)].id); yylloc = (yylsp[(1) - (2)]);
- Compiler_Error($"Not a type: %s\n", (yyvsp[(1) - (2)].id).string);
+ Location tmpLoc = yylloc; (yyval.specifier) = (yyvsp[(2) - (2)].id); yylloc = (yylsp[(1) - (2)]);
+ Compiler_Error($"Not a type: %s\n", (yyvsp[(1) - (2)].id).string);
yylloc = tmpLoc; (yyvsp[(2) - (2)].id).badID = (yyvsp[(1) - (2)].id);
#endif
;}
(yyval.specifier).loc = (yyloc);
(yylsp[(4) - (4)]).end.pos--;
- fileInput.Seek((yylsp[(4) - (4)]).end.pos, start);
+ fileInput.Seek((yylsp[(4) - (4)]).end.pos, start);
resetScannerPos(&(yylsp[(4) - (4)]).end);
yyclearin;
;}
/* Line 1464 of yacc.c */
#line 627 "grammar.y"
- {
+ {
(yyval.memberInit) = MkMemberInitExp((yyvsp[(1) - (3)].exp), MkInitializerAssignment(MkExpDummy()));
- (yyval.memberInit).loc = (yyloc); (yyval.memberInit).realLoc = (yyloc); (yyval.memberInit).initializer.loc.start = (yyval.memberInit).initializer.loc.end = (yylsp[(2) - (3)]).end;
+ (yyval.memberInit).loc = (yyloc); (yyval.memberInit).realLoc = (yyloc); (yyval.memberInit).initializer.loc.start = (yyval.memberInit).initializer.loc.end = (yylsp[(2) - (3)]).end;
- fileInput.Seek((yylsp[(2) - (3)]).end.pos, start);
+ fileInput.Seek((yylsp[(2) - (3)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(2) - (3)]).end);
(yyloc).start = (yylsp[(1) - (3)]).start;
/* Line 1464 of yacc.c */
#line 656 "grammar.y"
- { ((MemberInit)(yyvsp[(1) - (3)].list)->last).loc.end = (yylsp[(2) - (3)]).end;
- {
- Initializer dummy = MkInitializerAssignment(MkExpDummy());
- MemberInit memberInit = MkMemberInit(null, dummy);
- memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = (yylsp[(2) - (3)]).end;
- memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = (yylsp[(2) - (3)]).end;
- ListAdd((yyvsp[(1) - (3)].list), memberInit);
+ { ((MemberInit)(yyvsp[(1) - (3)].list)->last).loc.end = (yylsp[(2) - (3)]).end;
+ {
+ Initializer dummy = MkInitializerAssignment(MkExpDummy());
+ MemberInit memberInit = MkMemberInit(null, dummy);
+ memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = (yylsp[(2) - (3)]).end;
+ memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = (yylsp[(2) - (3)]).end;
+ ListAdd((yyvsp[(1) - (3)].list), memberInit);
}
(yyval.list) = (yyvsp[(1) - (3)].list);
;}
/* Line 1464 of yacc.c */
#line 668 "grammar.y"
- { ((MemberInit)(yyvsp[(1) - (3)].list)->last).loc.end = (yylsp[(2) - (3)]).end;
- {
- Initializer dummy = MkInitializerAssignment(MkExpDummy());
- MemberInit memberInit = MkMemberInit(null, dummy);
- memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = (yylsp[(2) - (3)]).end;
- memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = (yylsp[(2) - (3)]).end;
- ListAdd((yyvsp[(1) - (3)].list), memberInit);
+ { ((MemberInit)(yyvsp[(1) - (3)].list)->last).loc.end = (yylsp[(2) - (3)]).end;
+ {
+ Initializer dummy = MkInitializerAssignment(MkExpDummy());
+ MemberInit memberInit = MkMemberInit(null, dummy);
+ memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = (yylsp[(2) - (3)]).end;
+ memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = (yylsp[(2) - (3)]).end;
+ ListAdd((yyvsp[(1) - (3)].list), memberInit);
}
(yyval.list) = (yyvsp[(1) - (3)].list);
;}
#line 679 "grammar.y"
{
Initializer dummy = MkInitializerAssignment(MkExpDummy());
- MemberInit memberInit = MkMemberInit(null, dummy);
- memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = (yylsp[(1) - (1)]).start;
- memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = (yylsp[(1) - (1)]).start;
+ MemberInit memberInit = MkMemberInit(null, dummy);
+ memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = (yylsp[(1) - (1)]).start;
+ memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = (yylsp[(1) - (1)]).start;
(yyval.list) = MkList();
- ListAdd((yyval.list), memberInit);
+ ListAdd((yyval.list), memberInit);
- dummy = MkInitializerAssignment(MkExpDummy());
- memberInit = MkMemberInit(null, dummy);
- memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = (yylsp[(1) - (1)]).end;
- memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = (yylsp[(1) - (1)]).end;
- ListAdd((yyval.list), memberInit);
+ dummy = MkInitializerAssignment(MkExpDummy());
+ memberInit = MkMemberInit(null, dummy);
+ memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = (yylsp[(1) - (1)]).end;
+ memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = (yylsp[(1) - (1)]).end;
+ ListAdd((yyval.list), memberInit);
;}
break;
/* Line 1464 of yacc.c */
#line 841 "grammar.y"
- { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (3)]);
+ { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (3)]);
yylloc = tmpLoc; (yyval.instance) = MkInstantiation(MkSpecifierName((yyvsp[(1) - (3)].id).string), null, (yyvsp[(3) - (3)].list)); (yyval.instance).loc = (yyloc); (yyval.instance).insideLoc.start = (yylsp[(2) - (3)]).end; (yyval.instance).insideLoc.end = (yylsp[(3) - (3)]).end; FreeIdentifier((yyvsp[(1) - (3)].id)); ;}
break;
/* Line 1464 of yacc.c */
#line 856 "grammar.y"
- { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (3)]);
+ { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (3)]);
yylloc = tmpLoc; (yyval.instance) = MkInstantiation(MkSpecifierName((yyvsp[(1) - (3)].id).string), null, (yyvsp[(3) - (3)].list)); (yyval.instance).loc = (yyloc); (yyval.instance).insideLoc.start = (yylsp[(2) - (3)]).end; (yyval.instance).insideLoc.end = (yylsp[(3) - (3)]).end; (yyval.instance).loc.end.charPos++; (yyval.instance).loc.end.pos++; FreeIdentifier((yyvsp[(1) - (3)].id)); ;}
break;
/* Line 1464 of yacc.c */
#line 859 "grammar.y"
- { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (2)]);
+ { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (2)]);
yylloc = tmpLoc; (yyval.instance) = MkInstantiation(MkSpecifierName((yyvsp[(1) - (2)].id).string), null, null); (yyval.instance).loc = (yyloc); (yyval.instance).insideLoc.start = (yylsp[(2) - (2)]).end; (yyval.instance).insideLoc.end = (yylsp[(2) - (2)]).end; (yyval.instance).loc.end.charPos++; (yyval.instance).loc.end.pos++; FreeIdentifier((yyvsp[(1) - (2)].id)); ;}
break;
/* Line 1464 of yacc.c */
#line 862 "grammar.y"
- { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (4)]);
+ { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (4)]);
yylloc = tmpLoc; (yyval.instance) = MkInstantiation(MkSpecifierName((yyvsp[(1) - (4)].id).string), null, (yyvsp[(3) - (4)].list)); (yyval.instance).loc = (yyloc); (yyval.instance).insideLoc.start = (yylsp[(2) - (4)]).end; (yyval.instance).insideLoc.end = (yylsp[(3) - (4)]).end; (yyval.instance).loc.end.charPos++; (yyval.instance).loc.end.pos++; FreeIdentifier((yyvsp[(1) - (4)].id)); ;}
break;
/* Line 1464 of yacc.c */
#line 865 "grammar.y"
- { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (3)]);
+ { Location tmpLoc = yylloc; yylloc = (yylsp[(1) - (3)]);
yylloc = tmpLoc; (yyval.instance) = MkInstantiation(MkSpecifierName((yyvsp[(1) - (3)].id).string), null, null); (yyval.instance).loc = (yyloc); (yyval.instance).insideLoc.start = (yylsp[(2) - (3)]).end; (yyval.instance).insideLoc.end = (yylsp[(2) - (3)]).end; (yyval.instance).loc.end.charPos++; (yyval.instance).loc.end.pos++; FreeIdentifier((yyvsp[(1) - (3)].id)); ;}
break;
/* Line 1464 of yacc.c */
#line 1305 "grammar.y"
- {
- (yyvsp[(1) - (2)].context); (yyval.symbol) = DeclClass(globalContext.nextID++, (yyvsp[(2) - (2)].specifier).name);
- (yyval.symbol).nameLoc = (yylsp[(2) - (2)]);
- FreeSpecifier((yyvsp[(2) - (2)].specifier));
+ {
+ (yyvsp[(1) - (2)].context); (yyval.symbol) = DeclClass(globalContext.nextID++, (yyvsp[(2) - (2)].specifier).name);
+ (yyval.symbol).nameLoc = (yylsp[(2) - (2)]);
+ FreeSpecifier((yyvsp[(2) - (2)].specifier));
++defaultMemberAccess;
memberAccessStack[defaultMemberAccess] = privateAccess;
;}
/* Line 1464 of yacc.c */
#line 1317 "grammar.y"
- {
+ {
(yyvsp[(1) - (5)].context); (yyval.symbol) = DeclClass(globalContext.nextID++, (yyvsp[(2) - (5)].specifier).name);
- (yyval.symbol).templateParams = (yyvsp[(4) - (5)].list);
- (yyval.symbol).nameLoc = (yylsp[(2) - (5)]);
- FreeSpecifier((yyvsp[(2) - (5)].specifier));
+ (yyval.symbol).templateParams = (yyvsp[(4) - (5)].list);
+ (yyval.symbol).nameLoc = (yylsp[(2) - (5)]);
+ FreeSpecifier((yyvsp[(2) - (5)].specifier));
++defaultMemberAccess;
memberAccessStack[defaultMemberAccess] = privateAccess;
;}
#line 1332 "grammar.y"
{
(yyval._class).loc = (yyloc);
- (yyval._class) = (yyvsp[(1) - (2)]._class);
+ (yyval._class) = (yyvsp[(1) - (2)]._class);
;}
break;
FreeExpression((yyvsp[(1) - (2)].exp));
FreeExpression((yyvsp[(2) - (2)].exp));
-
- fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
+
+ fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
resetScannerPos(&(yylsp[(1) - (2)]).start);
yyclearin;
YYPOPSTACK(1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
-/*
+/*
YYPOPSTACK(1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
{
(yyval.exp) = MkExpOp((yyvsp[(1) - (2)].exp), '<', (yyvsp[(2) - (2)].exp));
(yyval.exp).loc = (yyloc);
- }
+ }
skipErrors = false;
;}
break;
/* Line 1464 of yacc.c */
#line 2022 "grammar.y"
- {
- (yyval.exp) = MkExpCondition((yyvsp[(1) - (3)].exp), MkListOne(MkExpDummy()), MkExpDummy());
- (yyval.exp).loc = (yyloc);
- ((Expression)(yyval.exp).cond.exp->last).loc = (yylsp[(2) - (3)]);
- (yyval.exp).cond.elseExp.loc = (yylsp[(3) - (3)]);
+ {
+ (yyval.exp) = MkExpCondition((yyvsp[(1) - (3)].exp), MkListOne(MkExpDummy()), MkExpDummy());
+ (yyval.exp).loc = (yyloc);
+ ((Expression)(yyval.exp).cond.exp->last).loc = (yylsp[(2) - (3)]);
+ (yyval.exp).cond.elseExp.loc = (yylsp[(3) - (3)]);
;}
break;
/* Line 1464 of yacc.c */
#line 2783 "grammar.y"
{
- (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (2)].declarator), (yyvsp[(2) - (2)].list));
- fileInput.Seek((yylsp[(1) - (2)]).end.pos, start);
+ (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (2)].declarator), (yyvsp[(2) - (2)].list));
+ fileInput.Seek((yylsp[(1) - (2)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(1) - (2)]).end);
(yyloc).start = (yylsp[(1) - (2)]).start;
/* Line 1464 of yacc.c */
#line 2792 "grammar.y"
- {
- (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (2)].declarator), null);
- fileInput.Seek((yylsp[(1) - (2)]).end.pos, start);
+ {
+ (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (2)].declarator), null);
+ fileInput.Seek((yylsp[(1) - (2)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(1) - (2)]).end);
(yyloc).start = (yylsp[(1) - (2)]).start;
/* Line 1464 of yacc.c */
#line 2801 "grammar.y"
- {
- (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (3)].declarator), (yyvsp[(2) - (3)].list));
- fileInput.Seek((yylsp[(1) - (3)]).end.pos, start);
+ {
+ (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (3)].declarator), (yyvsp[(2) - (3)].list));
+ fileInput.Seek((yylsp[(1) - (3)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(1) - (3)]).end);
(yyloc).start = (yylsp[(1) - (3)]).start;
/* Line 1464 of yacc.c */
#line 2810 "grammar.y"
- {
- (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (4)].declarator), null);
- fileInput.Seek((yylsp[(1) - (4)]).end.pos, start);
+ {
+ (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (4)].declarator), null);
+ fileInput.Seek((yylsp[(1) - (4)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(1) - (4)]).end);
(yyloc).start = (yylsp[(1) - (4)]).start;
/* Line 1464 of yacc.c */
#line 2843 "grammar.y"
{
- (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (2)].declarator), (yyvsp[(2) - (2)].list));
- fileInput.Seek((yylsp[(1) - (2)]).end.pos, start);
+ (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (2)].declarator), (yyvsp[(2) - (2)].list));
+ fileInput.Seek((yylsp[(1) - (2)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(1) - (2)]).end);
(yyloc).start = (yylsp[(1) - (2)]).start;
/* Line 1464 of yacc.c */
#line 2852 "grammar.y"
- {
- (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (2)].declarator), null);
- fileInput.Seek((yylsp[(1) - (2)]).end.pos, start);
+ {
+ (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (2)].declarator), null);
+ fileInput.Seek((yylsp[(1) - (2)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(1) - (2)]).end);
(yyloc).start = (yylsp[(1) - (2)]).start;
/* Line 1464 of yacc.c */
#line 2861 "grammar.y"
- {
- (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (3)].declarator), (yyvsp[(2) - (3)].list));
- fileInput.Seek((yylsp[(1) - (3)]).end.pos, start);
+ {
+ (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (3)].declarator), (yyvsp[(2) - (3)].list));
+ fileInput.Seek((yylsp[(1) - (3)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(1) - (3)]).end);
(yyloc).start = (yylsp[(1) - (3)]).start;
/* Line 1464 of yacc.c */
#line 2870 "grammar.y"
- {
- (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (4)].declarator), null);
- fileInput.Seek((yylsp[(1) - (4)]).end.pos, start);
+ {
+ (yyval.declarator) = MkDeclaratorFunction((yyvsp[(1) - (4)].declarator), null);
+ fileInput.Seek((yylsp[(1) - (4)]).end.pos, start);
yyclearin;
resetScannerPos(&(yylsp[(1) - (4)]).end);
(yyloc).start = (yylsp[(1) - (4)]).start;
/* Line 1464 of yacc.c */
#line 3092 "grammar.y"
- {
- (yyval.initializer) = MkInitializerList((yyvsp[(2) - (4)].list));
- (yyval.initializer).loc = (yyloc);
+ {
+ (yyval.initializer) = MkInitializerList((yyvsp[(2) - (4)].list));
+ (yyval.initializer).loc = (yyloc);
{
Expression exp = MkExpDummy();
Initializer init = MkInitializerAssignment(exp);
init.loc = (yylsp[(3) - (4)]);
exp.loc = (yylsp[(3) - (4)]);
- ListAdd((yyvsp[(2) - (4)].list), init);
+ ListAdd((yyvsp[(2) - (4)].list), init);
}
;}
break;
/* Line 1464 of yacc.c */
#line 3111 "grammar.y"
- {
- (yyval.initializer) = MkInitializerList((yyvsp[(2) - (5)].list));
+ {
+ (yyval.initializer) = MkInitializerList((yyvsp[(2) - (5)].list));
(yyval.initializer).loc = (yyloc);
{
Initializer init = MkInitializerAssignment(exp);
init.loc = (yylsp[(3) - (5)]);
exp.loc = (yylsp[(3) - (5)]);
- ListAdd((yyvsp[(2) - (5)].list), init);
+ ListAdd((yyvsp[(2) - (5)].list), init);
}
;}
break;
/* Line 1464 of yacc.c */
#line 3124 "grammar.y"
- {
- (yyval.initializer) = MkInitializerList((yyvsp[(2) - (3)].list));
+ {
+ (yyval.initializer) = MkInitializerList((yyvsp[(2) - (3)].list));
(yyval.initializer).loc = (yyloc);
{
Initializer init = MkInitializerAssignment(exp);
init.loc = (yylsp[(3) - (3)]);
exp.loc = (yylsp[(3) - (3)]);
- ListAdd((yyvsp[(2) - (3)].list), init);
+ ListAdd((yyvsp[(2) - (3)].list), init);
}
;}
break;
/* Line 1464 of yacc.c */
#line 3578 "grammar.y"
- {
+ {
int len1 = strlen((yyvsp[(1) - (2)].string));
int len2 = strlen(yytext);
(yyval.string) = new byte[len1-1 + len2-1 + 1];
#line 3601 "grammar.y"
{
bool isRemote = !strcmp((yyvsp[(2) - (3)].id).string, "remote");
- (yyval.external) = MkExternalImport((yyvsp[(3) - (3)].string), isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
+ (yyval.external) = MkExternalImport((yyvsp[(3) - (3)].string), isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
(yyval.external).loc = (yyloc);
FreeIdentifier((yyvsp[(2) - (3)].id));
if(!isRemote)
- yyerror();
+ yyerror();
;}
break;
FreeIdentifier((yyvsp[(3) - (4)].id));
declMode = defaultDeclMode;
if(!isRemote)
- yyerror();
+ yyerror();
;}
break;
- yylloc.start = yylloc.end;
- type_yylloc.start = type_yylloc.end;
- expression_yylloc.start = expression_yylloc.end;
+ yylloc.start = yylloc.end;
+ type_yylloc.start = type_yylloc.end;
+ expression_yylloc.start = expression_yylloc.end;
#line 1290 "lexer.ec"
*/
/*
[__attribute__] [spaces]
- [((] [spaces]
+ [((] [spaces]
[digits | letters] [spaces]
( [(] [digits or letters or "] ( [spaces] [,] [spaces] [digits or letters or "] )* [spaces] [)] )?
[spaces]
( [,] [spaces] [digits or letters] [spaces]
( [(] [digits or letters or "]
( [spaces] [,] [spaces] [digits or letters or "] )* [spaces] [)]
- )? [spaces]
+ )? [spaces]
)*
[))]
*/
case 163:
YY_RULE_SETUP
#line 295 "lexer.l"
-{
- yylloc.end.charPos = 1; yylloc.end.line += yyleng; yylloc.start = yylloc.end;
- type_yylloc.end.charPos = 1; type_yylloc.end.line += yyleng; type_yylloc.start = type_yylloc.end;
- expression_yylloc.end.charPos = 1; expression_yylloc.end.line += yyleng; expression_yylloc.start = expression_yylloc.end;
+{
+ yylloc.end.charPos = 1; yylloc.end.line += yyleng; yylloc.start = yylloc.end;
+ type_yylloc.end.charPos = 1; type_yylloc.end.line += yyleng; type_yylloc.start = type_yylloc.end;
+ expression_yylloc.end.charPos = 1; expression_yylloc.end.line += yyleng; expression_yylloc.start = expression_yylloc.end;
}
YY_BREAK
case 164:
YY_RULE_SETUP
#line 300 "lexer.l"
-{
- yylloc.start.charPos++ /*= 3 - (yylloc.start.col % 3)*/; yylloc.end.charPos = yylloc.start.charPos; yylloc.start.pos = yylloc.end.pos;
- expression_yylloc.start.charPos++ /*= 3 - (expression_yylloc.start.col % 3)*/; expression_yylloc.end.charPos = expression_yylloc.start.charPos; expression_yylloc.start.pos = expression_yylloc.end.pos;
- type_yylloc.start.charPos++ /*= 3 - (type_yylloc.start.col % 3)*/; type_yylloc.end.charPos = type_yylloc.start.charPos; type_yylloc.start.pos = type_yylloc.end.pos;
+{
+ yylloc.start.charPos++ /*= 3 - (yylloc.start.col % 3)*/; yylloc.end.charPos = yylloc.start.charPos; yylloc.start.pos = yylloc.end.pos;
+ expression_yylloc.start.charPos++ /*= 3 - (expression_yylloc.start.col % 3)*/; expression_yylloc.end.charPos = expression_yylloc.start.charPos; expression_yylloc.start.pos = expression_yylloc.end.pos;
+ type_yylloc.start.charPos++ /*= 3 - (type_yylloc.start.col % 3)*/; type_yylloc.end.charPos = type_yylloc.start.charPos; type_yylloc.start.pos = type_yylloc.end.pos;
}
YY_BREAK
case 165:
if(lineNumber)
{
char fileName[MAX_LOCATION];
-
+
int inOut;
fileName[0] = 0;
GetString(&pointer, fileName, MAX_LOCATION);
inOut = GetValue(&pointer);
-
+
if(inOut == 1)
{
char extension[MAX_EXTENSION];
}
}
last = c;
- }
+ }
yylloc.start = yylloc.end;
line[count] = 0;
for(;;)
{
char * equal;
-
+
if(!f.GetLine(line, sizeof(line))) break;
TrimLSpaces(line, line);
if(!strcmp(line, ".")) break;
}
else
{
- strcpy(name, line);
+ strcpy(name, line);
isVirtual = false;
memberAccess = publicAccess;
}
if(type == TemplateParameterType::type || type == TemplateParameterType::expression)
delete info;
if(type == TemplateParameterType::type || type == TemplateParameterType::identifier)
- delete defaultArg.dataTypeString;
+ delete defaultArg.dataTypeString;
}
if(regClass)
eClass_DoneAddingTemplateParameters(regClass);
if(!f.GetLine(line, sizeof(line))) break;
TrimLSpaces(line, line);
if(!strcmp(line, ".")) break;
- if(!strcmp(line, "[Value]"))
+ if(!strcmp(line, "[Value]"))
{
f.GetLine(line, sizeof(line));
TrimLSpaces(line, line);
if(!f.GetLine(line, sizeof(line))) break;
TrimLSpaces(line, line);
if(!strcmp(line, ".")) break;
- if(!strcmp(line, "[Type]"))
+ if(!strcmp(line, "[Type]"))
{
f.GetLine(line, sizeof(line));
TrimLSpaces(line, line);
if(!f.GetLine(line, sizeof(line))) break;
TrimLSpaces(line, line);
if(!strcmp(line, ".")) break;
- if(!strcmp(line, "[Type]"))
+ if(!strcmp(line, "[Type]"))
{
f.GetLine(line, sizeof(line));
TrimLSpaces(line, line);
delete spaceName;
nameSpace = newSpace;
if(name[c] == ':') c++;
- start = c+1;
+ start = c+1;
}
}
if(c - start)
strcpy(file, name);
StripExtension(file);
- // Load an extra instance of any shared module to ensure freeing up a
+ // Load an extra instance of any shared module to ensure freeing up a
// module loaded in another file will not invalidate our objects.
if(!inCompiler && !inPreCompiler && !inSymbolGen)
{
int GetIncludeFileID(char * includeFile)
{
int found = FindIncludeFileID(includeFile);
- if(found)
+ if(found)
return found;
includes = renew includes char *[numIncludes+1];
public void OutputTypeName(TypeName type, File f, bool typeName)
{
- /*if(type.typedObject)
+ /*if(type.typedObject)
{
//f.Puts("Class * class, void *");
f.Puts("class");
if(spec.next) f.Puts(" ");
}
}
- if(type.declarator)
+ if(type.declarator)
{
f.Puts(" ");
OutputDeclarator(type.declarator, f);
OutputSpecifier(spec, f, false);
if(spec.next) f.Puts(" ");
}
- if(exp._classExp.decl)
+ if(exp._classExp.decl)
{
f.Puts(" ");
OutputDeclarator(exp._classExp.decl, f);
OutputExpression(exp.op.exp2, f);
}
break;
- case extensionExpressionExp:
+ case extensionExpressionExp:
case bracketsExp:
{
Expression expression;
}
- if(inCompiler && outputLineNumbers && stmt.loc.start.line)
+ if(inCompiler && outputLineNumbers && stmt.loc.start.line)
{
/*if(stmt.loc.start.line == 1)
printf("bug");*/
outputLine ++;
}
}
- if(inCompiler && outputLineNumbers && stmt.loc.end.line)
+ if(inCompiler && outputLineNumbers && stmt.loc.end.line)
{
/*if(stmt.loc.end.line == 1)
printf("bug");*/
if(stmt.forStmt.increment)
{
// TESTING THIS HERE FOR FOR INCREMENT
- if(inCompiler && outputLineNumbers && stmt.loc.end.line)
+ if(inCompiler && outputLineNumbers && stmt.loc.end.line)
{
/*if(stmt.loc.end.line == 1)
printf("bug");*/
f.Printf("{ ");
if(exp && exp.expType)
{
-
+
char string[1024] = "";
OldList * specs = MkList();
Declarator decl;
{
delete specs;
specs = CopyList(exp.expType.templateParameter.dataType.specifiers, CopySpecifier);
- decl = PlugDeclarator(/*CopyDeclarator(*/exp.expType.templateParameter.dataType.decl/*)*/,
+ decl = PlugDeclarator(/*CopyDeclarator(*/exp.expType.templateParameter.dataType.decl/*)*/,
MkDeclaratorIdentifier(MkIdentifier("__ecereReturnVal")));
}
else
}
if(!memoryGuard)
f.Puts("return ");
- else
+ else
{
Expression exp = stmt.expressions ? stmt.expressions->last : null;
if(exp && exp.expType)
}
}
- if(inCompiler && outputLineNumbers && stmt.loc.start.line)
+ if(inCompiler && outputLineNumbers && stmt.loc.start.line)
{
f.Printf("\n#line %d \"%s\"\n", outputLine+2, origName);
outputLine += 2;
if(_class && _class.registered)
{
f.Printf("%d", (int)eClass_GetProperty(_class.registered, "enumSize"));
- }
+ }
}
f.Puts("]");
break;
}
case pointerDeclarator:
if(decl.pointer.pointer) OutputPointer(decl.pointer.pointer, f);
- if(decl.declarator)
+ if(decl.declarator)
{
f.Puts(" ");
OutputDeclarator(decl.declarator, f);
case __ATTRIB: f.Puts("__attribute(("); break;
case ATTRIB_DEP: f.Puts("__attribute_deprecated__(("); break;
}
-
+
if(attr.attribs)
{
Attribute attrib;
OutputAttribute(attrib, f);
}
}
- f.Puts("))");
+ f.Puts("))");
}
static void OutputExtDecl(ExtDecl extDecl, File f)
case typeOfSpecifier:
f.Puts("__typeof(");
OutputExpression(spec.expression, f);
- f.Puts(")");
+ f.Puts(")");
break;
case subClassSpecifier:
f.Puts("subclass(");
OutputSpecifier(spec._class, f, false);
- f.Puts(")");
+ f.Puts(")");
break;
case templateTypeSpecifier:
OutputIdentifier(spec.templateParameter.identifier, f);
f.Puts("\n{\n");
outputLine += 2;
- if(inCompiler && outputLineNumbers && initializer.loc.start.line)
+ if(inCompiler && outputLineNumbers && initializer.loc.start.line)
{
/*if(initializer.loc.start.line == 1)
printf("bug");*/
}
f.Puts("\n}");
- if(inCompiler && outputLineNumbers && initializer.loc.start.line)
+ if(inCompiler && outputLineNumbers && initializer.loc.start.line)
{
/*if(initializer.loc.start.line == 1)
printf("bug");*/
GetSourceName(name, decl.loc.start.included ? GetIncludeFileFromID(decl.loc.start.included) : null);
- if(inCompiler && outputLineNumbers && decl.loc.start.line)
+ if(inCompiler && outputLineNumbers && decl.loc.start.line)
{
/*if(decl.loc.start.line == 1)
printf("bug");*/
{
OutputInitDeclarator(d, f);
if(d.next) f.Puts(", ");
- }
+ }
}
break;
}
{
OutputDeclarator(d, f);
if(d.next) f.Puts(", ");
- }
+ }
}
if(decl.extStorage)
{
}
f.Puts(";\n");
outputLine ++;
- if(inCompiler && outputLineNumbers && decl.loc.start.line && decl.type == initDeclaration)
+ if(inCompiler && outputLineNumbers && decl.loc.start.line && decl.type == initDeclaration)
{
f.Printf("\n#line %d \"%s\"\n", outputLine+2, origName);
outputLine += 2;
{
FunctionDefinition oldFunc = curFunction;
curFunction = func;
- if(func.specifiers)
+ if(func.specifiers)
{
Specifier spec;
for(spec = func.specifiers->first; spec; spec = spec.next)
static void OutputClassFunction(ClassFunction func, File f)
{
- if(func.specifiers)
+ if(func.specifiers)
{
Specifier spec;
for(spec = func.specifiers->first; spec; spec = spec.next)
{
switch(external.type)
{
- case functionExternal:
- OutputFunction(external.function, f);
+ case functionExternal:
+ OutputFunction(external.function, f);
f.Puts("\n");
outputLine ++;
break;
- case declarationExternal:
+ case declarationExternal:
OutputDeclaration(external.declaration, f);
- f.Puts("\n");
+ f.Puts("\n");
outputLine ++;
break;
- case classExternal:
+ case classExternal:
OutputClass(external._class, f);
- f.Puts("\n");
+ f.Puts("\n");
outputLine ++;
break;
}
break;
}
}
-
+
len = strlen(output);
for(c = 0; (ch = className[c]); c++)
{
break;
}
}
- }
+ }
}
static void CheckPublicDataType(Type type, AccessMode access, char * word)
if(member)
{
BTNamedLink link = (BTNamedLink)member.membersAlpha.FindString(spec.id.string);
- dataMember = link ? link.data : null;
+ dataMember = link ? link.data : null;
}
else
dataMember = eClass_FindDataMember(regClass, spec.id.string, privateModule, null, null);
if(inCompiler)
{
yylloc = loc;
-
+
if(!NameSpaceContained(regClass.nameSpace, ®Class.module.privateNameSpace) && regClass.inheritanceAccess == publicAccess)
{
if(!regClass.base.symbol)
/*
if(NameSpaceContained(regClass.nameSpace, ®Class.module.privateNameSpace))
{
- if(regClass.inheritanceAccess == publicAccess &&
+ if(regClass.inheritanceAccess == publicAccess &&
(regClass.base.nameSpace == ®Class.base.module.privateNameSpace || !ModuleAccess(privateModule, regClass.base.module)))
Compiler_Error($"Public class publicly inheriting off private base class\n");
}
}
else
// Sort of an error
- eEnum_AddValue(regClass, e.id.string);
+ eEnum_AddValue(regClass, e.id.string);
}
else
eEnum_AddValue(regClass, e.id.string);
if((prop = eClass_FindProperty(regClass, def.id.string, privateModule)))
{
eClass_AddProperty(regClass, def.id.string, null, null, null, def.memberAccess);
- }
+ }
else if((member = eClass_FindDataMember(regClass, def.id.string, privateModule, null, null)))
{
eClass_AddDataMember(regClass, def.id.string, null, 0, 0, def.memberAccess);
}
else if((method = eClass_FindMethod(regClass, def.id.string, privateModule)))
{
- eClass_AddMethod(regClass, def.id.string, null, null, def.memberAccess);
+ eClass_AddMethod(regClass, def.id.string, null, null, def.memberAccess);
}
else
{
}
}
}
-
+
if(inCompiler)
{
external = MkExternalDeclaration(null);
ListAdd(specifiers, MkSpecifierName/*MkClassName*/(inst._class.name));
d = MkDeclaratorIdentifier(MkIdentifier(exp.identifier.string));
-
+
if(inCompiler)
{
OldList * declarators = MkList();
// If it is, we only need a constructor if there is data set,
// and we don't need a destructor
classSym = inst._class.symbol; // FindClass(inst._class.name);
- if(classSym && classSym.registered &&
- (classSym.registered.type == structClass ||
+ if(classSym && classSym.registered &&
+ (classSym.registered.type == structClass ||
classSym.registered.type == bitClass ||
classSym.registered.type == unitClass))
{
else if(def.type == functionClassDef)
{
ClassFunction func = def.function;
- if(func.isDestructor)
+ if(func.isDestructor)
{
if(destructor)
{
}
}
}
- if(func.isConstructor)
+ if(func.isConstructor)
{
if(constructor)
{
}
else
{
- symbol.needConstructor = true;
+ symbol.needConstructor = true;
constructor = func;
if(!inCompiler && func.body)
symbol.structName = CopyString(structName);
{
- Specifier spec = MkStructOrUnion(structSpecifier, MkIdentifier(structName),
+ Specifier spec = MkStructOrUnion(structSpecifier, MkIdentifier(structName),
isUnion ? MkListOne(MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkStructOrUnion(unionSpecifier, null, list)), null, null))) : list);
spec.extDeclStruct = extDecl;
ListAdd(specs, spec);
external.declaration = MkDeclaration(specs, declarators);
after = external;
-
+
symbol.declaredStruct = true;
}
else
char classDataStructName[1024];
OldList * specs = MkList();
External external;
-
+
strcpy(classDataStructName, "__ecereClassData_");
FullClassNameCat(classDataStructName, symbol.string, false);
MangleClassName(className);
symbol.className = CopyString(className);
-
+
if(!strstr(sourceFile, ".main.ec"))
ListAdd(specs, MkSpecifier(STATIC));
ListAdd(specs, MkStructOrUnion(structSpecifier, MkIdentifier("__ecereNameSpace__ecere__com__Class"), null));
{
/* FIX a DecRef declaration problem...
// Decrement counter if it isn't a simple class
- ListAdd(statements,
+ ListAdd(statements,
MkExpressionStmt(MkListOne(MkExpCall(
- MkExpIdentifier(MkIdentifier("ecere::com::eInstance_DecRef")),
+ MkExpIdentifier(MkIdentifier("ecere::com::eInstance_DecRef")),
MkListOne(CopyExpression(inst.exp))))));
*/
Expression exp = MkExpOp(null, DELETE, CopyExpression(inst.exp));
body = MkCompoundStmt(declarations, statements);
PopContext(context);
body.compound.context = context;
-
+
decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(destructorName)), null);
// Destructor will have same Symbol ID as class
//id = symbol.endid;
};
excludedSymbols->Add(decl.symbol);
-
+
function = MkClassFunction(specs, null, decl, null);
ProcessClassFunctionBody(function, body);
function.id = symbol.id;
newInst.exp = CopyExpression(inst.exp);
newInst._class = CopySpecifier(inst._class);
- ListAdd(statements,
+ ListAdd(statements,
MkExpressionStmt(MkListOne(MkExpInstance(newInst))));
inst.built = true;
}
// Increment counter if it isn't a simple class
if(inst.exp && (!classSym || !classSym.registered || classSym.registered.type == normalClass))
{
- ListAdd(statements,
+ ListAdd(statements,
MkExpressionStmt(MkListOne(MkExpCall(
MkExpIdentifier(MkIdentifier("ecere::com::eInstance_IncRef")),
MkListOne(CopyExpression(inst.exp))))));
memberExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), id);
for(id = id.next; id; id = id.next)
memberExp = MkExpMember(memberExp, id);
-
+
// ASSUME: No list initializers here
- ListAdd(statements,
- MkExpressionStmt(MkListOne(MkExpOp(memberExp, '=',
+ ListAdd(statements,
+ MkExpressionStmt(MkListOne(MkExpOp(memberExp, '=',
(propertyDef.initializer && propertyDef.initializer.type == expInitializer ? propertyDef.initializer.exp : null)))));
}
// Is it safe to take it out here?
def.decl.inst = null;
- ListAdd(statements,
+ ListAdd(statements,
MkExpressionStmt(MkListOne(MkExpInstance(inst))));
}
}
{
/*
declarations = constructor.body.compound.declarations;
-
+
if(constructor.body.compound.declarations)
{
Declaration decl;
body = MkCompoundStmt(declarations, statements);
PopContext(context);
body.compound.context = context;
-
+
decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(constructorName)), null);
// Constructor will have same Symbol ID as class
decl.symbol.id = symbol.id;
decl.symbol.idCode = symbol.idCode;
//decl.symbol.id = symbol.endid;
-
+
function = MkClassFunction(specs, null, decl, null);
ProcessClassFunctionBody(function, body);
function.id = symbol.id;
else if(!symbol.isStatic)
CheckPublicDataType(propertyDef.symbol.type, privateAccess, "class property");
}
-
+
{
// Commented this out... Why exactly?
//if(inCompiler)
params = MkList();
// decl = MkDeclaratorFunction(PlugDeclarator(propertyDef.declarator, MkDeclaratorIdentifier(MkIdentifier(name))), params);
-
- if(propertyDef.symbol.type && propertyDef.symbol.type.kind == TypeKind::classType && propertyDef.symbol.type._class && propertyDef.symbol.type._class.registered &&
+
+ if(propertyDef.symbol.type && propertyDef.symbol.type.kind == TypeKind::classType && propertyDef.symbol.type._class && propertyDef.symbol.type._class.registered &&
propertyDef.symbol.type._class.registered.type == structClass)
{
ListAdd(params, MkTypeName(CopyList(propertyDef.specifiers, CopySpecifier), MkDeclaratorIdentifier(MkIdentifier("value"))));
{
decl = PlugDeclarator(propertyDef.declarator, MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params));
- func = MkClassFunction(CopyList(propertyDef.specifiers, CopySpecifier),
+ func = MkClassFunction(CopyList(propertyDef.specifiers, CopySpecifier),
null, decl, null);
}
-
+
ProcessClassFunctionBody(func, propertyDef.getStmt);
func.declarator.symbol = propertyDef.symbol;
//func.declarator.propSymbol = propertyDef.symbol;
propertyDef.symbol.externalGet = (External)func;
-
+
func.dontMangle = true;
newDef = MkClassDefFunction(func);
definitions.Insert(after, newDef);
after = newDef;
- if(inCompiler)
+ if(inCompiler)
propertyDef.getStmt = null;
else
func.body = null;
params = MkList();
- ListAdd(params, MkTypeName(CopyList(propertyDef.specifiers, CopySpecifier),
- PlugDeclarator(propertyDef.declarator,
+ ListAdd(params, MkTypeName(CopyList(propertyDef.specifiers, CopySpecifier),
+ PlugDeclarator(propertyDef.declarator,
MkDeclaratorIdentifier(MkIdentifier("value")))));
// Take it out here...
definitions.Insert(after, newDef);
after = newDef;
- if(inCompiler)
+ if(inCompiler)
propertyDef.setStmt = null;
else
func.body = null;
definitions.Insert(after, newDef);
after = newDef;
- if(inCompiler)
+ if(inCompiler)
propertyDef.issetStmt = null;
else
func.body = null;
external = MkExternalDeclaration(decl);
ast->Insert(curExternal ? curExternal.prev : null, external);
external.symbol = propertyDef.symbol;
-
+
// Setting it in the Property as well here to prevent DeclareProperty to declare it a second time...
propertyDef.symbol.externalPtr = external;
-
+
if(inCompiler && prop && prop.symbol)
((Symbol)prop.symbol).externalPtr = external;
}
if(inCompiler)
{
yylloc = propertyDef.loc;
-
+
if(!NameSpaceContained(regClass.nameSpace, ®Class.module.privateNameSpace))
CheckPublicDataType(propertyDef.symbol.type, publicAccess, "classwide property");
else if(!symbol.isStatic)
params = MkList();
declId = MkDeclaratorIdentifier(MkIdentifier(name));
-
+
// Class properties returns a uint64 even for struct types
- /*if(propertyDef.symbol.type && propertyDef.symbol.type.kind == TypeKind::classType && propertyDef.symbol.type._class && propertyDef.symbol.type._class.registered &&
+ /*if(propertyDef.symbol.type && propertyDef.symbol.type.kind == TypeKind::classType && propertyDef.symbol.type._class && propertyDef.symbol.type._class.registered &&
propertyDef.symbol.type._class.registered.type == structClass)
{
// ListAdd(params, MkTypeName(CopyList(propertyDef.specifiers, CopySpecifier), MkDeclaratorIdentifier(MkIdentifier("value"))));
body.compound.declarations = MkList();
ListAdd(body.compound.declarations,
MkDeclaration(CopyList(propertyDef.specifiers, CopySpecifier), MkListOne(MkInitDeclarator(
- ptrDecl = MkDeclaratorPointer(MkPointer(null, null), MkDeclaratorIdentifier(MkIdentifier("value"))), MkInitializerAssignment(MkExpCast(MkTypeName(CopyList(propertyDef.specifiers, CopySpecifier), CopyDeclarator(propertyDef.declarator)),
+ ptrDecl = MkDeclaratorPointer(MkPointer(null, null), MkDeclaratorIdentifier(MkIdentifier("value"))), MkInitializerAssignment(MkExpCast(MkTypeName(CopyList(propertyDef.specifiers, CopySpecifier), CopyDeclarator(propertyDef.declarator)),
MkExpIdentifier(MkIdentifier("_value"))))))));
{
Symbol sym = ptrDecl.symbol;
if(func.type.returnType.kind == TypeKind::classType && func.type.returnType._class && func.type.returnType._class.registered && func.type.returnType._class.registered.type == structClass)
func.type.returnType.byReference = true;
- if(inCompiler)
+ if(inCompiler)
propertyDef.getStmt = null;
else
func.body = null;
params = MkList();
/*
- ListAdd(params, MkTypeName(CopyList(propertyDef.specifiers, CopySpecifier),
- PlugDeclarator(propertyDef.declarator,
+ ListAdd(params, MkTypeName(CopyList(propertyDef.specifiers, CopySpecifier),
+ PlugDeclarator(propertyDef.declarator,
MkDeclaratorIdentifier(MkIdentifier("value")))));
*/
definitions.Insert(after, newDef);
after = newDef;
- if(inCompiler)
+ if(inCompiler)
propertyDef.setStmt = null;
else
func.body = null;
{
Declarator funcDecl = GetFuncDecl(func.declarator);
Identifier id = GetDeclId(funcDecl);
- Method method;
-
+ Method method;
+
if(!funcDecl.function.parameters || !funcDecl.function.parameters->first)
{
if(!funcDecl.function.parameters)
Specifier specifier;
for(specifier = declaration.specifiers->first; specifier; specifier = specifier.next)
{
- if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
+ if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
(declaration.declMode || specifier.baseSpecs || (specifier.type == enumSpecifier && specifier.definitions)))
{
Symbol symbol = FindClass(specifier.id.string);
if(func.type) func.type.refCount++;
ProcessFunctionBody(function, func.body);
external = MkExternalFunction(function);
-
+
external.symbol = func.declarator.symbol;
external.function._class = func._class;
}
//symbol.id = func.id; //symid;
symbol.id = symid;
symbol.idCode = symidCode;
-
+
if(!func.dontMangle)
{
// Normal method
Method method = func.declarator.symbol.method;
func.declarator.symbol.methodExternal = external;
- // DANGER: Added this one...
+ // DANGER: Added this one...
if(method && method.symbol)
//((Symbol)method.symbol).methodExternal = external;
{
Type methodDataType;
ProcessMethodType(method);
-
+
methodDataType = method.dataType;
// Do type checking here of type against method.dataType
{
propSymbol.externalIsSet = external;
}
- else
+ else
{
// Constructor destructor
//symbol.type = Type { };
{
globalContext /*curContext*/.symbols.Remove((BTNode)symbol);
excludedSymbols->Add(symbol);
-
+
// Testing this...
defs.Insert(after, external);
registerModuleBody.compound.context = Context { parent = globalContext };
#if 0
- ListAdd(registerModuleBody.compound.declarations,
+ ListAdd(registerModuleBody.compound.declarations,
MkDeclaration(MkListOne(MkStructOrUnion(structSpecifier, MkIdentifier("__ecereNameSpace__ecere__com__Class"), null) /*MkSpecifierName("ecere::com::Class")*/ /*MkStructOrUnion(SpecifierStruct, MkIdentifier("Class"), null)*/),
MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer(null,null), MkDeclaratorIdentifier(MkIdentifier("class"))), null))));
#endif
- ListAdd(registerModuleBody.compound.declarations,
+ ListAdd(registerModuleBody.compound.declarations,
MkDeclaration(MkListOne(MkSpecifierName("ecere::com::Class")),
MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("class")), null))));
specifiers = MkList();
ListAdd(specifiers, MkSpecifier(VOID));
- moduleParam = MkTypeName(MkListOne(/*MkSpecifier(VOID)*/MkSpecifierName("Module")),
- //MkDeclaratorPointer(MkPointer(null, null),
+ moduleParam = MkTypeName(MkListOne(/*MkSpecifier(VOID)*/MkSpecifierName("Module")),
+ //MkDeclaratorPointer(MkPointer(null, null),
MkDeclaratorIdentifier(MkIdentifier("module")));
GetLastDirectory(outputFile, moduleName);
// Unregister Module
if(!unregisterModuleBody && inCompiler)
- {
+ {
char registerName[1024], moduleName[MAX_FILENAME];
OldList * specifiers;
Declarator declarator;
specifiers = MkList();
ListAdd(specifiers, MkSpecifier(VOID));
- moduleParam = MkTypeName(MkListOne(/*MkSpecifier(VOID)*/ MkSpecifierName("Module")),
- //MkDeclaratorPointer(MkPointer(null, null),
+ moduleParam = MkTypeName(MkListOne(/*MkSpecifier(VOID)*/ MkSpecifierName("Module")),
+ //MkDeclaratorPointer(MkPointer(null, null),
MkDeclaratorIdentifier(MkIdentifier("module")));
GetLastDirectory(outputFile, moduleName);
ListAdd(list, MkExpOp(MkExpIdentifier(MkIdentifier(nameM)), '=', MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null,null), null)), MkExpConstant("0"))));
// stmt = MkIfStmt(MkListOne(MkExpOp(null, '!', MkExpIdentifier(MkIdentifier(name)))), MkExpressionStmt(list), null);
stmt = MkIfStmt(MkListOne(MkExpOp(
- MkExpMember(MkExpIdentifier(MkIdentifier("module")), MkIdentifier("application")), EQ_OP,
+ MkExpMember(MkExpIdentifier(MkIdentifier("module")), MkIdentifier("application")), EQ_OP,
MkExpMember(MkExpIdentifier(MkIdentifier("__thisModule")), MkIdentifier("application")))), MkExpressionStmt(list), null);
ListAdd(registerModuleBody.compound.statements, stmt);
// Unregister 2nd property
- stmt = MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(nameM)), '=',
+ stmt = MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(nameM)), '=',
MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null,null), null)), MkExpConstant("0")))));
ListAdd(unregisterModuleBody.compound.statements, stmt);
}
// Declaration Mode
ListAdd(args, MkExpIdentifier(MkIdentifier("privateAccess")));
-
+
stmt = MkExpressionStmt(MkListOne(
MkExpCall(MkExpIdentifier(MkIdentifier(isMember ? "eMember_AddDataMember" : "eClass_AddDataMember")), args)));
ListAdd(args, MkExpIdentifier(MkIdentifier("publicAccess")));
break;
}
-
+
stmt = MkExpressionStmt(MkListOne(
MkExpCall(MkExpIdentifier(MkIdentifier(isMember ? "eMember_AddDataMember" : "eClass_AddDataMember")), args)));
curContext = statement.compound.context;
context = PushContext();
-
+
args = MkListOne(MkExpIdentifier(MkIdentifier((member.type == unionMember) ? "unionMember" : "structMember")));
-
+
// Declaration Mode
switch(member.memberAccess)
{
ListAdd(args, MkExpIdentifier(MkIdentifier("publicAccess")));
break;
}
-
- compound = MkCompoundStmt(MkListOne(MkDeclaration(MkListOne(MkSpecifierName("DataMember")),
- MkListOne(MkInitDeclarator(/*MkDeclaratorPointer(MkPointer(null, null), */MkDeclaratorIdentifier(MkIdentifier(memberName))/*)*/,
+
+ compound = MkCompoundStmt(MkListOne(MkDeclaration(MkListOne(MkSpecifierName("DataMember")),
+ MkListOne(MkInitDeclarator(/*MkDeclaratorPointer(MkPointer(null, null), */MkDeclaratorIdentifier(MkIdentifier(memberName))/*)*/,
MkInitializerAssignment(MkExpCall(MkExpIdentifier(MkIdentifier("eMember_New")), args)))))), MkList());
compound.compound.context = context;
-
+
args = MkList();
// Class class / DataMember member
{
ClassDef def;
Class regClass = symbol.registered;
-
+
if(regClass)
{
classType = regClass.type;
refCount = 1;
};
e.exp.destType = destType;
-
+
// Set parsingType to avoid producing errors
parsingType = true;
ProcessExpressionType(e.exp);
}
else
// Sort of an error
- eEnum_AddValue(regClass, e.id.string);
+ eEnum_AddValue(regClass, e.id.string);
}
else
eEnum_AddValue(regClass, e.id.string);
ListAdd(specifiers, MkSpecifier(VOID));
ast->Insert(curExternal.prev, externalDecl);
-
- decl = MkDeclaration(specifiers,
- MkListOne(MkInitDeclarator(MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)),
+
+ decl = MkDeclaration(specifiers,
+ MkListOne(MkInitDeclarator(MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)),
MkListOne(MkTypeName(MkListOne(MkSpecifierName(regClass.fullName)), null))), null)));
externalDecl.declaration = decl;
if(decl.symbol && !decl.symbol.methodExternal)
decl.symbol.idCode = symbol.idCode;
}
}
-
+
propWatch.compound = null;
definitions.Insert(null, MkClassDefFunction(func));
//ListAdd(args, class.declaredStruct ? MkExpTypeSize(MkTypeName(MkListOne(
//MkSpecifierName(class.structName)), null)) : MkExpConstant("0"));
-
+
if(regClass.type == structClass || regClass.type == normalClass || regClass.type == noHeadClass)
{
// Check if we have a data member in this class
if(regClass.type == normalClass || regClass.type == noHeadClass)
{
// Constructor
- ListAdd(args, symbol.needConstructor ?
+ ListAdd(args, symbol.needConstructor ?
MkExpIdentifier(MkIdentifier(symbol.constructorName)) :
MkExpConstant("0"));
// Destructor
- ListAdd(args, symbol.needDestructor ?
+ ListAdd(args, symbol.needDestructor ?
MkExpIdentifier(MkIdentifier(symbol.destructorName)) :
MkExpConstant("0"));
}
ListAdd(args, MkExpIdentifier(MkIdentifier(buildingECERECOMModule ? "baseSystemAccess" : "publicAccess")));
break;
}
-
+
// Declaration Mode
switch(inheritanceAccess)
{
stmt = MkIfStmt(MkListOne(
MkExpOp(MkExpOp(
- MkExpMember(MkExpIdentifier(MkIdentifier("module")), MkIdentifier("application")), EQ_OP,
+ MkExpMember(MkExpIdentifier(MkIdentifier("module")), MkIdentifier("application")), EQ_OP,
MkExpMember(MkExpIdentifier(MkIdentifier("__thisModule")), MkIdentifier("application"))), AND_OP, MkExpIdentifier(MkIdentifier("class")))),
MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(symbol.className)), '=',
MkExpIdentifier(MkIdentifier("class"))))), null);
External external = method.methodExternal;
OldList * args = MkList();
Identifier id = external.function ? GetDeclId(external.function.declarator) : null;
-
+
// Class class
ListAdd(args, MkExpIdentifier(MkIdentifier("class")));
// char * name
{
char memberTypeString[132] = "TemplateMemberType::";
bool needClass = true;
-
+
param.memberType.OnGetString(memberTypeString + strlen(memberTypeString), null, &needClass);
- ListAdd(args,
- MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, null), null)),
+ ListAdd(args,
+ MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, null), null)),
MkExpIdentifier(MkIdentifier(memberTypeString))));
break;
}
{
case type:
{
- char * typeString = param.defaultArgument.templateDatatype ?
+ char * typeString = param.defaultArgument.templateDatatype ?
StringFromSpecDecl(param.defaultArgument.templateDatatype.specifiers, param.defaultArgument.templateDatatype.decl) : null;
char * string = QMkString(typeString);
// TOFIX: UNIONS ARE BROKEN FOR ASSIGNMENTS, USING dataTypeString INSTEAD
// members->Add(MkMemberInit(MkListOne(MkIdentifier("memberString")), MkInitializerAssignment(MkExpString(string))));
- members->Add(MkMemberInit(MkListOne(MkIdentifier("dataTypeString")), MkInitializerAssignment(MkExpString(string))));
+ members->Add(MkMemberInit(MkListOne(MkIdentifier("dataTypeString")), MkInitializerAssignment(MkExpString(string))));
delete string;
break;
//string = QMkString(ui64String);
members->Add(MkMemberInit(ids, MkInitializerAssignment(MkExpConstant(ui64String))));
-
+
delete string;
delete ui64String;
break;
ListAdd(registerModuleBody.compound.statements, stmt);
}
stmt = MkExpressionStmt(MkListOne(
- MkExpCall(MkExpIdentifier(MkIdentifier("eClass_DoneAddingTemplateParameters")),
+ MkExpCall(MkExpIdentifier(MkIdentifier("eClass_DoneAddingTemplateParameters")),
MkListOne(MkExpIdentifier(MkIdentifier("class"))))));
ListAdd(registerModuleBody.compound.statements, stmt);
}
{
Specifier specifier;
bool removeExternal = false;
-
+
for(specifier = declaration.specifiers->first; specifier; specifier = specifier.next)
{
- if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
+ if((specifier.type == enumSpecifier || specifier.type == structSpecifier || specifier.type == unionSpecifier) && specifier.id && specifier.id.string &&
(declaration.declMode || specifier.baseSpecs || (specifier.type == enumSpecifier && specifier.definitions)))
{
Symbol symbol = FindClass(specifier.id.string);
ClassType classType;
if(specifier.type == enumSpecifier)
classType = enumClass;
- else
+ else
classType = structClass;
removeExternal = true;
ProcessClass(classType, specifier.definitions, symbol, specifier.baseSpecs, specifier.list,ast, external, declaration.declMode);
}
}
- }
+ }
if(inCompiler && removeExternal)
{
ast->Remove(external);
{
DataMember member = isMember ? (DataMember) _class : null;
Context context = isMember ? null : SetupTemplatesContext(_class);
- if(member || ((_class.type == bitClass || _class.type == normalClass || _class.type == structClass || _class.type == noHeadClass) &&
+ if(member || ((_class.type == bitClass || _class.type == normalClass || _class.type == structClass || _class.type == noHeadClass) &&
(_class.type == bitClass || (!_class.structSize || _class.structSize == _class.offset)) && _class.computeSize))
{
int c;
int alignment = 0;
// Prevent infinite recursion
- if(dataMember.dataType.kind != classType ||
+ if(dataMember.dataType.kind != classType ||
((!dataMember.dataType._class || !dataMember.dataType._class.registered || dataMember.dataType._class.registered != _class ||
_class.type != structClass)))
ComputeTypeSize(dataMember.dataType);
{
member.memberOffset = unionMemberOffset;
}
-
+
if(!isMember)
{
/*if(_class.type == structClass)
{
Class _class;
OldLink subModule;
-
+
for(subModule = module.modules.first; subModule; subModule = subModule.next)
ComputeModuleClasses(subModule.data);
for(_class = module.classes.first; _class; _class = _class.next)
size += type.alignment - (size % type.alignment);
}
- else if(_class && (_class.type == unitClass ||
- _class.type == enumClass ||
+ else if(_class && (_class.type == unitClass ||
+ _class.type == enumClass ||
_class.type == bitClass))
{
if(!_class.dataType)
break;
}
case pointerType: case subClassType: size = type.alignment = targetBits / 8; /*sizeof(void *); */break;
- case arrayType:
+ case arrayType:
if(type.arraySizeExp)
{
ProcessExpressionType(type.arraySizeExp);
ComputeExpression(type.arraySizeExp);
- if(!type.arraySizeExp.isConstant || (type.arraySizeExp.expType.kind != intType && type.arraySizeExp.expType.kind != enumType &&
+ if(!type.arraySizeExp.isConstant || (type.arraySizeExp.expType.kind != intType && type.arraySizeExp.expType.kind != enumType &&
(type.arraySizeExp.expType.kind != classType || !type.arraySizeExp.expType._class.registered || type.arraySizeExp.expType._class.registered.type != enumClass)))
{
Location oldLoc = yylloc;
size = ComputeTypeSize(type.type) * type.arraySize;
if(type.type)
type.alignment = type.type.alignment;
-
+
break;
case structType:
{
for(member = type.members.first; member; member = member.next)
{
uint addSize = ComputeTypeSize(member);
-
+
member.offset = size;
if(member.alignment && size % member.alignment)
member.offset += member.alignment - (size % member.alignment);
OldList * specs = MkList(), * decls = MkList();
Declarator decl;
- decl = SpecDeclFromString(member.dataTypeString, specs,
+ decl = SpecDeclFromString(member.dataTypeString, specs,
MkDeclaratorIdentifier(MkIdentifier(member.name)));
ListAdd(decls, MkStructDeclarator(decl, null));
ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, null)));
case structMember:
{
OldList * specs = MkList(), * list = MkList();
-
+
size = 0;
AddMembers(list, (Class)member, true, &size, topClass, null);
- ListAdd(specs,
+ ListAdd(specs,
MkStructOrUnion((member.type == unionMember)?unionSpecifier:structSpecifier, null, list));
ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, null, null)));
alignment = member.structAlignment;
{
char sizeString[50];
sprintf(sizeString, "%d", maxSize - totalSize);
- ListAdd(declarations,
- MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)),
+ ListAdd(declarations,
+ MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)),
MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), null)));
if(addedPadding)
*addedPadding = true;
uint totalSize = 0;
DataMember member;
Context context = isMember ? null : SetupTemplatesContext(_class);
-
+
if(!isMember && (_class.type == structClass || _class.type == noHeadClass) && _class.base.type != systemClass)
DeclareMembers(_class.base, false);
if(!inCompiler || !classSym) return;
// We don't need any declaration for bit classes...
- if(classSym.registered &&
+ if(classSym.registered &&
(classSym.registered.type == bitClass || classSym.registered.type == unitClass || classSym.registered.type == enumClass))
return;
OldList * specifiers, * declarators;
OldList * declarations = null;
char structName[1024];
- external = (classSym.registered && classSym.registered.type == structClass) ?
+ external = (classSym.registered && classSym.registered.type == structClass) ?
classSym.pointerExternal : classSym.structExternal;
// TEMPORARY HACK: Pass 3 will move up struct declarations without moving members
}
return;
}
-
+
//if(!skipNoHead)
DeclareMembers(classSym.registered, false);
structName[0] = 0;
FullClassNameCat(structName, name, false);
- /*if(!external)
+ /*if(!external)
external = MkExternalDeclaration(null);*/
if(!skipNoHead)
}
else
{
- if(!external)
+ if(!external)
external = MkExternalDeclaration(null);
specifiers = MkList();
declarators = MkList();
params = MkList();
- ListAdd(params, MkTypeName(MkListOne(MkSpecifierName /*MkClassName*/(prop._class.fullName)),
+ ListAdd(params, MkTypeName(MkListOne(MkSpecifierName /*MkClassName*/(prop._class.fullName)),
MkDeclaratorIdentifier(MkIdentifier("this"))));
d = MkDeclaratorIdentifier(MkIdentifier(getName));
d = PlugDeclarator(typeDecl, d);
else
{
- ListAdd(params, MkTypeName(specifiers,
+ ListAdd(params, MkTypeName(specifiers,
PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
specifiers = MkList();
}
d = MkDeclaratorFunction(d, params);
-
+
//if(imported)
if(dllImport)
specifiers->Insert(null, MkSpecifier(EXTERN));
// TESTING COMMENTING THIS FIRST LINE OUT, what was the problem? Trying to add noHeadClass here ...
if(!prop.conversion || prop._class.type == structClass)
{
- ListAdd(params, MkTypeName(MkListOne(MkSpecifierName/*MkClassName*/(prop._class.fullName)),
+ ListAdd(params, MkTypeName(MkListOne(MkSpecifierName/*MkClassName*/(prop._class.fullName)),
MkDeclaratorIdentifier(MkIdentifier("this"))));
}
{
OldList * list = MkList();
- ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null),
+ ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null),
MkDeclaratorIdentifier(MkIdentifier(propName))), null));
if(!imported)
MangleClassName(propName);
- ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null),
+ ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null),
MkDeclaratorIdentifier(MkIdentifier(propName))), null));
}
decl = MkDeclaration(specifiers, list);
int c;
int paramCount = 0;
int lastParam = -1;
-
+
char templateString[1024];
ClassTemplateParameter param;
sprintf(templateString, "%s<", expClass.templateClass.fullName);
int id = p;
Class sClass;
ClassTemplateArgument arg;
- for(sClass = cClass.base; sClass; sClass = sClass.base)
+ for(sClass = cClass.base; sClass; sClass = sClass.base)
{
if(sClass.templateClass) sClass = sClass.templateClass;
id += sClass.templateParams.count;
Class nextClass;
if(sClass.templateClass) sClass = sClass.templateClass;
- for(nextClass = sClass.base; nextClass; nextClass = nextClass.base)
+ for(nextClass = sClass.base; nextClass; nextClass = nextClass.base)
{
if(nextClass.templateClass) nextClass = nextClass.templateClass;
p += nextClass.templateParams.count;
}
-
+
for(cParam = sClass.templateParams.first; cParam; cParam = cParam.next, p++)
{
if(cParam.type == TemplateParameterType::type && arg.dataTypeString && !strcmp(cParam.name, arg.dataTypeString))
lastParam = p;
}
p++;
- }
+ }
}
}
{
MembersInit members;
Symbol classSym; // = inst._class.symbol; // FindClass(inst._class.name);
Class _class;
-
+
/*if(!inst._class.symbol)
inst._class.symbol = FindClass(inst._class.name);*/
classSym = inst._class.symbol;
strcat(name, nameID.string);
strcat(name, "_");
sprintf(number, "_%08d", instMethodID++);
- strcat(name, number);
+ strcat(name, number);
nameID.string = CopyString(name);
}
{
Symbol symbol = declarator.symbol;
Method method = eClass_FindMethod(_class, unmangled, privateModule);
-
+
if(method && method.type == virtualMethod)
{
symbol.method = method;
if(!symbol.type.thisClass)
{
- if(method.dataType.thisClass && currentClass &&
+ if(method.dataType.thisClass && currentClass &&
eClass_IsDerived(currentClass, method.dataType.thisClass.registered))
{
if(!currentClass.symbol)
delete declarator.symbol.string;
declarator.symbol.string = CopyString(name);
}
-
+
if(!declarator.symbol.parent && globalContext.symbols.root != (BTNode)declarator.symbol)
{
printf("TOCHECK: Will this ever be in a list? Yes.\n");
}
*/
-
+
//curExternal = curExternal.prev;
//afterExternal = afterExternal->next;
{
//Declaration decl = MkDeclaration(members.function.specifiers, MkListOne(MkInitDeclarator(CopyDeclarator(declarator), null)));
- Declaration decl = MkDeclaration(CopyList(createdExternal.function.specifiers, CopySpecifier),
+ Declaration decl = MkDeclaration(CopyList(createdExternal.function.specifiers, CopySpecifier),
MkListOne(MkInitDeclarator(CopyDeclarator(declarator), null)));
-
+
//externalDecl = MkExternalDeclaration(decl);
-
+
//***** ast->Insert(external.prev, externalDecl);
//ast->Insert(curExternal.prev, externalDecl);
externalDecl.declaration = decl;
// ADD DATA TYPE HERE...
p.param = param = TemplateParameter
{
- identifier = MkIdentifier(p.name), type = p.type,
+ identifier = MkIdentifier(p.name), type = p.type,
dataTypeString = p.dataTypeString /*, dataType = { specs, decl }*/
};
}
if(!classSym._import)
{
ModuleImport module;
-
+
if(method._class.module && method._class.module.name)
module = FindModule(method._class.module);
else
}
/*
if(!method.thisClass || strcmp(method.thisClass, "void"))
- symbol.type.params.Insert(null,
+ symbol.type.params.Insert(null,
MkClassType(method.thisClass ? method.thisClass : method._class.fullName));
*/
}
{
Class _class = method.dataType.thisClass ? method.dataType.thisClass.registered : method._class;
TypeName thisParam = MkTypeName(MkListOne(
- MkSpecifierName/*MkClassName*/(method.dataType.thisClass ? method.dataType.thisClass.string : method._class.fullName)),
+ MkSpecifierName/*MkClassName*/(method.dataType.thisClass ? method.dataType.thisClass.string : method._class.fullName)),
(_class && _class.type == systemClass) ? MkDeclaratorPointer(MkPointer(null,null), MkDeclaratorIdentifier(MkIdentifier("this"))) : MkDeclaratorIdentifier(MkIdentifier("this")));
TypeName firstParam = ((TypeName)funcDecl.function.parameters->first);
Specifier firstSpec = firstParam.qualifiers ? firstParam.qualifiers->first : null;
else if(!funcDecl.function.parameters)
{
funcDecl.function.parameters = MkList();
- funcDecl.function.parameters->Insert(null,
+ funcDecl.function.parameters->Insert(null,
MkTypeName(MkListOne(MkSpecifier(VOID)),null));
}*/
}
int p = 0;
ClassTemplateParameter param;
int lastParam = -1;
-
+
char className[1024];
strcpy(className, _class.fullName);
for(param = _class.templateParams.first; param; param = param.next)
return CopyString(className);
}
else
- return CopyString(_class.fullName);
+ return CopyString(_class.fullName);
}
Type ReplaceThisClassType(Class _class)
int lastParam = -1;
char className[1024];
strcpy(className, _class.fullName);
-
+
for(param = _class.templateParams.first; param; param = param.next)
{
// if((!param.defaultArg.dataTypeString && !param.defaultArg.expression.ui64))
if(funcDecl && !funcDecl.function.parameters)
{
funcDecl.function.parameters = MkList();
- funcDecl.function.parameters->Insert(null,
+ funcDecl.function.parameters->Insert(null,
MkTypeName(MkListOne(MkSpecifier(VOID)),null));
}
if(dest.classObjectType == anyObject && source.classObjectType != typedObject)
return true;
}
-
+
if((dest.kind == structType && source.kind == structType) ||
(dest.kind == unionType && source.kind == unionType))
{
|| source.kind == subClassType || source.kind == pointerType || source.kind == arrayType || source.kind == functionType || source.kind == thisClassType)
/*source.kind != voidType && source.kind != structType && source.kind != unionType */
-
+
/*&& (source.kind != classType /-*|| source._class.registered.type != structClass)*/)
return true;
if(!isConversionExploration && source.kind == pointerType && source.type.kind == voidType &&
// Don't match enum inheriting from other enum if resolving enumeration values
// TESTING: !dest.classObjectType
else if(source._class && dest._class && (dest.classObjectType == source.classObjectType || !dest.classObjectType) &&
- (enumBaseType ||
- (!source._class.registered || source._class.registered.type != enumClass) ||
+ (enumBaseType ||
+ (!source._class.registered || source._class.registered.type != enumClass) ||
(!dest._class.registered || dest._class.registered.type != enumClass)) && eClass_IsDerived(source._class.registered, dest._class.registered))
return true;
else
{
// Added this so that DefinedColor = Color doesn't go through ColorRGB property
- if(enumBaseType &&
+ if(enumBaseType &&
dest._class && dest._class.registered && dest._class.registered.type == enumClass &&
((source._class && source._class.registered && source._class.registered.type != enumClass) || source.kind == classType)) // Added this here for a base enum to be acceptable for a derived enum (#139)
{
return true;
else if(conversions != null)
{
- if(_class.type == unitClass && convert.dataType.kind == classType && convert.dataType._class &&
- convert.dataType._class.registered && _class.base == convert.dataType._class.registered.base &&
+ if(_class.type == unitClass && convert.dataType.kind == classType && convert.dataType._class &&
+ convert.dataType._class.registered && _class.base == convert.dataType._class.registered.base &&
(dest.kind != classType || dest._class.registered != _class.base))
return true;
else
return true;
else if(conversions != null)
{
- if(_class.type == unitClass && convert.dataType.kind == classType && convert.dataType._class &&
- convert.dataType._class.registered && _class.base == convert.dataType._class.registered.base &&
+ if(_class.type == unitClass && convert.dataType.kind == classType && convert.dataType._class &&
+ convert.dataType._class.registered && _class.base == convert.dataType._class.registered.base &&
(source.kind != classType || source._class.registered != _class.base))
return true;
else
}
/*if(dest._class.registered && !strcmp(dest._class.registered.name, "bool"))
{
- if(source.kind != voidType && source.kind != structType && source.kind != unionType &&
+ if(source.kind != voidType && source.kind != structType && source.kind != unionType &&
(source.kind != classType || source._class.registered.type != structClass))
return true;
}*/
return true;
else if(conversions != null)
{
- if(_class.type == unitClass && convert.dataType.kind == classType && convert.dataType._class &&
- convert.dataType._class.registered && _class.base == convert.dataType._class.registered.base &&
+ if(_class.type == unitClass && convert.dataType.kind == classType && convert.dataType._class &&
+ convert.dataType._class.registered && _class.base == convert.dataType._class.registered.base &&
(dest.kind != classType || dest._class.registered != _class.base))
return true;
else
if(source.kind == classType || source.kind == subClassType)
;
- else if(dest.kind == source.kind &&
+ else if(dest.kind == source.kind &&
(dest.kind != structType && dest.kind != unionType &&
dest.kind != functionType && dest.kind != arrayType && dest.kind != pointerType && dest.kind != methodType))
return true;
else if(dest.kind == enumType &&
(source.kind == intType || source.kind == shortType || source.kind == charType || source.kind == longType || source.kind == int64Type || source.kind == intPtrType || source.kind == intSizeType))
return true;
- else if((dest.kind == functionType || (dest.kind == pointerType && dest.type.kind == functionType) || dest.kind == methodType) &&
+ else if((dest.kind == functionType || (dest.kind == pointerType && dest.type.kind == functionType) || dest.kind == methodType) &&
((source.kind == functionType || (source.kind == pointerType && source.type.kind == functionType) || source.kind == methodType)))
{
Type paramSource, paramDest;
- if(dest.kind == methodType)
+ if(dest.kind == methodType)
owningClassDest = dest.methodClass ? dest.methodClass : dest.method._class;
- if(source.kind == methodType)
+ if(source.kind == methodType)
owningClassSource = source.methodClass ? source.methodClass : source.method._class;
if(dest.kind == pointerType && dest.type.kind == functionType) dest = dest.type;
if(source.kind == pointerType && source.type.kind == functionType) source = source.type;
- if(dest.kind == methodType)
+ if(dest.kind == methodType)
dest = dest.method.dataType;
- if(source.kind == methodType)
+ if(source.kind == methodType)
source = source.method.dataType;
paramSource = source.params.first;
paramDest = dest.params.first;
if(paramDest && paramDest.kind == voidType) paramDest = null;
-
- if((dest.staticMethod || (!dest.thisClass && !owningClassDest)) &&
+
+ if((dest.staticMethod || (!dest.thisClass && !owningClassDest)) &&
!(source.staticMethod || (!source.thisClass && !owningClassSource)))
{
// Source thisClass must be derived from destination thisClass
if(owningClassDest)
Compiler_Error($"%s expected to be derived from method class\n", owningClassDest.fullName);
else
- Compiler_Error($"overriding class expected to be derived from method class\n");
+ Compiler_Error($"overriding class expected to be derived from method class\n");
return false;
}
}
//if(owningClass)
Compiler_Error($"%s expected to be derived from method class\n", /*owningClass.name*/ source.thisClass.registered.fullName);
//else
- //Compiler_Error($"overriding class expected to be derived from method class\n");
+ //Compiler_Error($"overriding class expected to be derived from method class\n");
return false;
}
}
}
// Check parameters
-
+
for(; paramDest; paramDest = paramDest.next)
{
if(!paramSource)
}
// paramDest must be derived from paramSource
- if(!MatchTypes(paramDestType, paramSourceType, null, null, null, true, true, false, false) &&
+ if(!MatchTypes(paramDestType, paramSourceType, null, null, null, true, true, false, false) &&
(!acceptReversedParams || !MatchTypes(paramSourceType, paramDestType, null, null, null, true, true, false, false)))
{
char type[1024];
type[0] = 0;
PrintType(paramDest, type, false, true);
Compiler_Warning($"incompatible parameter %s (expected %s)\n", paramSource.name, type);
-
+
if(paramDestType != paramDest)
FreeType(paramDestType);
return false;
if(paramDestType != paramDest)
FreeType(paramDestType);
}
-
+
paramSource = paramSource.next;
}
if(paramSource)
{
return true;
}
- else if((dest.kind == pointerType || dest.kind == arrayType) &&
+ else if((dest.kind == pointerType || dest.kind == arrayType) &&
(source.kind == arrayType || source.kind == pointerType))
{
if(MatchTypes(source.type, dest.type, null, null, null, true, true, false, false))
FreeType(convert.resultType);
}
-bool MatchWithEnums_NameSpace(NameSpace nameSpace, Expression sourceExp, Type dest,
+bool MatchWithEnums_NameSpace(NameSpace nameSpace, Expression sourceExp, Type dest,
char * string, OldList conversions)
{
BTNamedLink link;
sourceExp.constant = CopyString(constant);
//for(;baseClass.base && baseClass.base.type != systemClass; baseClass = baseClass.base);
}
-
+
while(converts.first)
{
Conversion convert = converts.first;
public bool ModuleVisibility(Module searchIn, Module searchFor)
{
SubModule subModule;
-
+
if(searchFor == searchIn)
return true;
if(source._class && source._class.registered && source._class.registered.type == unitClass)
{
Class sourceBase, destBase;
- for(sourceBase = source._class.registered;
+ for(sourceBase = source._class.registered;
sourceBase && sourceBase.base && sourceBase.base.type != systemClass;
sourceBase = sourceBase.base);
- for(destBase = dest._class.registered;
+ for(destBase = dest._class.registered;
destBase && destBase.base && destBase.base.type != systemClass;
destBase = destBase.base);
//if(source._class.registered == dest._class.registered)
value = -strtoull(sourceExp.op.exp2.constant, null, 0);
}
- if(dest.kind != classType && source.kind == classType && source._class && source._class.registered &&
+ if(dest.kind != classType && source.kind == classType && source._class && source._class.registered &&
!strcmp(source._class.registered.fullName, "ecere::com::unichar"))
{
FreeType(source);
backupSourceExpType = sourceExp.expType;
sourceExp.expType = dest; dest.refCount++;
//sourceExp.expType = MkClassType(_class.fullName);
- flag = true;
+ flag = true;
delete tempType;
}
FreeType(sourceExp.expType);
source = sourceExp.expType = MkClassType(dest._class.string);
source.refCount++;
-
+
//source.kind = classType;
//source._class = dest._class;
}
FreeType(source);
source = sourceExp.expType = MkClassType(dest._class.string);
source.refCount++;
-
+
//source.kind = classType;
//source._class = dest._class;
}
// Testing this simpler piece of code... (Broke Units Conversion to no unit Logic)
if(!source._class.registered.dataType)
source._class.registered.dataType = ProcessTypeString(source._class.registered.dataTypeString, false);
-
+
FreeType(dest);
dest = MkClassType(source._class.string);
//if(MatchTypes(source._class.registered.dataType, dest, conversions, null, null, true, false, false))
// dest = MkClassType(source._class.string);
}
*/
-
+
if(dest.kind != classType)
{
Type tempType { };
if(tempType._class)
MatchTypes(tempSource, tempDest, conversions, null, null, true, true, false, false);
-
+
// PUT THIS BACK TESTING UNITS?
if(conversions.last)
{
((Conversion)(conversions.last)).resultType = dest;
dest.refCount++;
}
-
+
FreeType(sourceExp.expType);
sourceExp.expType = MkClassType(_class.fullName);
sourceExp.expType.truth = source.truth;
dest = MkClassType(source._class.string);
dest.truth = source.truth;
dest.classObjectType = source.classObjectType;
-
+
FreeType(source);
source = _class.dataType;
source.refCount++;
if(dest.kind == classType)
{
Class _class = dest._class ? dest._class.registered : null;
- if(_class && !dest.truth && (_class.type == unitClass || !strcmp(_class.fullName, "bool") ||
+ if(_class && !dest.truth && (_class.type == unitClass || !strcmp(_class.fullName, "bool") ||
(/*_class.type == enumClass*/_class.type != structClass && !value && source.kind == intType) || _class.type == bitClass)) // TOCHECK: enumClass, bitClass is new here...
{
if(_class.type == normalClass || _class.type == noHeadClass)
}
// Accept lower precision types for units, since we want to keep the unit type
- if(dest.kind == doubleType &&
+ if(dest.kind == doubleType &&
(source.kind == doubleType || source.kind == floatType || dest.kind == int64Type || source.kind == intType || source.kind == shortType ||
source.kind == charType))
{
specs = MkListOne(MkSpecifier(DOUBLE));
}
- else if(dest.kind == floatType &&
+ else if(dest.kind == floatType &&
(source.kind == floatType || dest.kind == int64Type || source.kind == intType || source.kind == shortType || source.kind == charType ||
source.kind == doubleType))
{
return false;
}
}
- else if(dest.kind == doubleType &&
+ else if(dest.kind == doubleType &&
(source.kind == doubleType || source.kind == floatType || source.kind == int64Type || source.kind == intType || source.kind == enumType || source.kind == shortType ||
source.kind == charType))
{
specs = MkListOne(MkSpecifier(DOUBLE));
}
- else if(dest.kind == floatType &&
+ else if(dest.kind == floatType &&
(source.kind == floatType || source.kind == enumType || source.kind == int64Type || source.kind == intType || source.kind == shortType || source.kind == charType))
{
specs = MkListOne(MkSpecifier(FLOAT));
}
- else if(dest.kind == charType && (source.kind == charType || source.kind == enumType || source.kind == shortType || source.kind == intType) &&
+ else if(dest.kind == charType && (source.kind == charType || source.kind == enumType || source.kind == shortType || source.kind == intType) &&
(dest.isSigned ? (value >= -128 && value <= 127) : (value >= 0 && value <= 255)))
{
specs = MkList();
if(!dest.isSigned) ListAdd(specs, MkSpecifier(UNSIGNED));
ListAdd(specs, MkSpecifier(CHAR));
}
- else if(dest.kind == shortType && (source.kind == enumType || source.kind == charType || source.kind == shortType ||
+ else if(dest.kind == shortType && (source.kind == enumType || source.kind == charType || source.kind == shortType ||
(source.kind == intType && (dest.isSigned ? (value >= -32768 && value <= 32767) : (value >= 0 && value <= 65535)))))
{
specs = MkList();
if(!dest.isSigned) ListAdd(specs, MkSpecifier(UNSIGNED));
ListAdd(specs, MkSpecifier(INT64));
}
- else if(dest.kind == enumType &&
+ else if(dest.kind == enumType &&
(source.kind == int64Type || source.kind == intType || source.kind == shortType || source.kind == charType))
{
specs = MkListOne(MkEnum(MkIdentifier(dest.enumName), null));
}
else
sourceExp.cast.exp = newExp;
-
+
FreeType(sourceExp.expType);
sourceExp.expType = null;
ProcessExpressionType(sourceExp);
d++;
escaped = false;
}
- else
+ else
{
- if(ch == '\"')
+ if(ch == '\"')
quoted ^= true;
else if(quoted)
{
Type type = exp.expType;
if(type)
{
- while(type.kind == classType &&
+ while(type.kind == classType &&
type._class.registered && (type._class.registered.type == bitClass || type._class.registered.type == unitClass || type._class.registered.type == enumClass))
{
if(!type._class.registered.dataType)
type._class.registered.dataType = ProcessTypeString(type._class.registered.dataTypeString, false);
type = type._class.registered.dataType;
-
+
}
op.kind = type.kind;
op.type = exp.expType;
op.ui64 = _strtoui64(exp.constant, null, 0);
op.kind = pointerType;
op.ops = uintOps;
- // op.ptrSize =
+ // op.ptrSize =
break;
}
}
exp.type = identifierExp;
exp.destType = MkClassType(_class.fullName);
ProcessExpressionType(exp);
- }
+ }
}
if(_class.type == enumClass || _class.type == unitClass || _class.type == bitClass)
{
if(_class && (_class.type == structClass || _class.type == normalClass || _class.type == noHeadClass ))
{
- // Don't recompute the instantiation...
+ // Don't recompute the instantiation...
// Non Simple classes will have become constants by now
- if(inst.data)
+ if(inst.data)
return;
if(_class.type == normalClass || _class.type == noHeadClass)
else
{
dataMember = curMember;
-
+
// CHANGED THIS HERE
eClass_FindDataMemberAndOffset(_class, dataMember.name, &dataMemberOffset, privateModule, null, null);
{
if(!dataMember.dataType)
dataMember.dataType = ProcessTypeString(dataMember.dataTypeString, false);
-
+
type = dataMember.dataType;
}
type = prop.dataType;
else
{
- dataMember = eClass_FindDataMemberAndOffset(type._class.registered,
+ dataMember = eClass_FindDataMemberAndOffset(type._class.registered,
ident.string, &dataMemberOffset, privateModule, null, null);
if(dataMember)
type = dataMember.dataType;
if(dataMember)
{
void * ptr = inst.data + dataMemberOffset;
-
+
if(value.type == constantExp)
{
switch(type.kind)
if(type.kind == classType && type._class && type._class.registered)
{
if(!type._class.registered.dataType)
- type._class.registered.dataType = ProcessTypeString(type._class.registered.dataTypeString, false);
+ type._class.registered.dataType = ProcessTypeString(type._class.registered.dataTypeString, false);
type = type._class.registered.dataType;
}
ComputeExpression(member.initializer.exp);
exp.constant = member.initializer.exp.constant;
exp.type = constantExp;
-
+
member.initializer.exp.constant = null;
}
}
if(op2.type) op2.type.refCount++;
}
}
- else
+ else
{
exp1 = exp.op.exp2;
op1 = GetOperand(exp1);
case '-':
if(exp.op.exp1)
{
- if(op1.ops.Sub)
+ if(op1.ops.Sub)
{
FreeExpContents(exp);
op1.ops.Sub(exp, op1, op2);
}
else
{
- if(op1.ops.Neg)
+ if(op1.ops.Neg)
{
FreeExpContents(exp);
op1.ops.Neg(exp, op1);
break;
// Binary only operators
case '/':
- if(op1.ops.Div)
+ if(op1.ops.Div)
{
FreeExpContents(exp);
op1.ops.Div(exp, op1, op2);
}
break;
case '|':
- if(op1.ops.BitOr)
+ if(op1.ops.BitOr)
{
FreeExpContents(exp);
op1.ops.BitOr(exp, op1, op2);
}
break;
case '^':
- if(op1.ops.BitXor)
+ if(op1.ops.BitXor)
{
FreeExpContents(exp);
op1.ops.BitXor(exp, op1, op2);
_class = classSym ? classSym.registered : null;
prop = eClass_FindProperty(_class, convertTo.fullName, privateModule);
}
-
+
if(prop)
{
if(prop.compiled)
double value;
double (*Get)(double);
GetDouble(exp.member.exp, &value);
-
+
if(convertTo)
Get = (void *)prop.Set;
else
exp.instance._class = MkSpecifierName/*MkClassName*/(_class.fullName);
exp.instance.loc = exp.loc;
exp.type = instanceExp;
-
+
GetInt(value, &intValue);
Set(exp.instance.data, intValue);
exp.instance._class = MkSpecifierName/*MkClassName*/(_class.fullName);
exp.instance.loc = exp.loc;
exp.type = instanceExp;
-
+
GetInt64(value, &intValue);
Set(exp.instance.data, intValue);
exp.instance._class = MkSpecifierName/*MkClassName*/(_class.fullName);
exp.instance.loc = exp.loc;
exp.type = instanceExp;
-
+
GetIntPtr(value, &intValue);
Set(exp.instance.data, intValue);
exp.instance._class = MkSpecifierName/*MkClassName*/(_class.fullName);
exp.instance.loc = exp.loc;
exp.type = instanceExp;
-
+
GetDouble(value, &doubleValue);
Set(exp.instance.data, doubleValue);
Type type = ProcessType(exp.typeName.qualifiers, exp.typeName.declarator);
FreeExpContents(exp);
exp.constant = PrintUInt(ComputeTypeSize(type));
- exp.type = constantExp;
+ exp.type = constantExp;
FreeType(type);
break;
}
type = _class.dataType;
}
}
-
+
switch(type.kind)
{
case charType:
break;
}
case doubleType:
- {
+ {
double value;
GetDouble(e, &value);
FreeExpContents(exp);
if(op2.type) FreeType(op2.type);
if(op3.type) FreeType(op3.type);
break;
- }
+ }
}
}
}
else
{
-
+
/*if(exp.isConstant)
{
// Color { ColorRGB = [exp] };
}
if(!result && exp.expType && exp.destType)
{
- if((exp.destType.kind == classType && exp.expType.kind == pointerType &&
+ if((exp.destType.kind == classType && exp.expType.kind == pointerType &&
exp.expType.type.kind == classType && exp.expType.type._class == exp.destType._class && exp.destType._class.registered && exp.destType._class.registered.type == structClass) ||
- (exp.expType.kind == classType && exp.destType.kind == pointerType &&
+ (exp.expType.kind == classType && exp.destType.kind == pointerType &&
exp.destType.type.kind == classType && exp.destType.type._class == exp.expType._class && exp.expType._class.registered && exp.expType._class.registered.type == structClass))
result = true;
}
OldList * unionDefs = MkList();
OldList * statements = MkList();
context = PushContext();
- ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), null)));
+ ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), null)));
ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), null)));
specs = MkListOne(MkStructOrUnion(unionSpecifier, null, unionDefs ));
exp.type = extensionCompoundExp;
OldList * unionDefs = MkList();
OldList * statements = MkList();
context = PushContext();
- ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), null)));
+ ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), null)));
ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), null)));
specs = MkListOne(MkStructOrUnion(unionSpecifier, null, unionDefs ));
exp.type = extensionCompoundExp;
typeString[0] = '\0';
PrintType(exp.expType, typeString, false, false);
decl = SpecDeclFromString(typeString, specs, null);
-
+
exp.type = castExp;
//exp.cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), null);
exp.cast.typeName = MkTypeName(specs, decl);
// Modified this recently...
Context tmpContext = curContext;
- curContext = null;
+ curContext = null;
symbol.pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function.specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function.declarator), null))));
curContext = tmpContext;
if(!type.isSigned && type.kind != intPtrType && type.kind != intSizeType) ListAdd(specs, MkSpecifier(UNSIGNED));
switch(type.kind)
{
- case classType:
+ case classType:
{
if(type._class.registered)
{
case int64Type: ListAdd(specs, MkSpecifier(INT64)); break;
case intPtrType: ListAdd(specs, MkSpecifierName(type.isSigned ? "intptr" : "uintptr")); break;
case intSizeType: ListAdd(specs, MkSpecifierName(type.isSigned ? "intsize" : "uintsize")); break;
- case intType:
+ case intType:
default:
ListAdd(specs, MkSpecifier(INT)); break;
}
case subClassType:
strcat(string, "subclass(");
strcat(string, type._class ? type._class.string : "int");
- strcat(string, ")");
+ strcat(string, ")");
break;
case templateType:
strcat(string, type.templateParameter.identifier.string);
newExp = checkedExp.op.exp2;
checkedExp.op.exp2 = null;
FreeExpContents(checkedExp);
-
+
if(e.expType && e.expType.passAsTemplate)
{
char size[100];
/*
e.compound = MkCompoundStmt(
MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(
- MkDeclaratorIdentifier(MkIdentifier("__internalValue")), MkInitializerAssignment(newExp))))),
+ MkDeclaratorIdentifier(MkIdentifier("__internalValue")), MkInitializerAssignment(newExp))))),
MkListOne(MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier("__internalValue"))))));
*/
-
+
{
Type type = e.destType;
e.destType = { };
// FixReference(e, true);
}
//#if 0
- if((!destType || destType.kind == ellipsisType || destType.kind == voidType) && e.expType && (e.expType.classObjectType == anyObject || e.expType.classObjectType == typedObject) &&
+ if((!destType || destType.kind == ellipsisType || destType.kind == voidType) && e.expType && (e.expType.classObjectType == anyObject || e.expType.classObjectType == typedObject) &&
(e.expType.byReference || (e.expType.kind == classType && e.expType._class && e.expType._class.registered &&
(e.expType._class.registered.type == bitClass || e.expType._class.registered.type == enumClass || e.expType._class.registered.type == unitClass ) )))
{
// TOFIX: Try this for a nice IDE crash!
//#endif
// The other way around
- else
+ else
//#endif
- if(destType && e.expType &&
+ if(destType && e.expType &&
//e.expType.kind == classType && e.expType._class && e.expType._class.registered && !strcmp(e.expType._class.registered.name, "class") &&
- (e.expType.classObjectType == anyObject || e.expType.classObjectType == typedObject) &&
+ (e.expType.classObjectType == anyObject || e.expType.classObjectType == typedObject) &&
!destType.classObjectType && /*(destType.kind != pointerType || !destType.type || destType.type.kind != voidType) &&*/ destType.kind != voidType)
{
if(destType.kind == ellipsisType)
if(e.expType.kind == classType && e.expType._class && e.expType._class.registered && strcmp(e.expType._class.registered.name, "class"))
type = e.expType;
else
- type = destType;
+ type = destType;
backupClassObjectType = type.classObjectType;
backupByReference = type.byReference;
thisExp.next = null;
e.Clear();
- if( ( type.kind == classType && type._class && type._class.registered &&
- (type._class.registered.type == systemClass || type._class.registered.type == bitClass ||
+ if( ( type.kind == classType && type._class && type._class.registered &&
+ (type._class.registered.type == systemClass || type._class.registered.type == bitClass ||
type._class.registered.type == enumClass || type._class.registered.type == unitClass) ) ||
(type.kind != pointerType && type.kind != intPtrType && type.kind != arrayType && type.kind != classType) ||
(!destType.byReference && byReference && (destType.kind != pointerType || type.kind != pointerType)))
bool unresolved = false;
Location oldyylloc = yylloc;
bool notByReference = false;
-#ifdef _DEBUG
+#ifdef _DEBUG
char debugExpString[4096];
debugExpString[0] = '\0';
PrintExpression(exp, debugExpString);
#endif
- if(!exp || exp.expType)
+ if(!exp || exp.expType)
return;
//eSystem_Logf("%s\n", expString);
-
+
// Testing this here
yylloc = exp.loc;
switch(exp.type)
{
if(_class && _class.type == structClass && !type.declaredWithStruct)
exp.byReference = true;
-
+
//TESTING COMMENTING THIS OUT IN FAVOR OF ApplyAnyObjectLogic
- /*if(type && _class && (type.classObjectType == typedObject || type.classObjectType == anyObject) &&
- ((_class.type == unitClass || _class.type == enumClass || _class.type == bitClass) ||
+ /*if(type && _class && (type.classObjectType == typedObject || type.classObjectType == anyObject) &&
+ ((_class.type == unitClass || _class.type == enumClass || _class.type == bitClass) ||
(type.byReference && (_class.type == normalClass || _class.type == noHeadClass))))
{
Identifier id = exp.identifier;
exp.list = MkListOne(MkExpOp(null, '*', MkExpIdentifier(exp.identifier)));
((Expression)exp.list->first).op.exp2.expType = exp.expType;
exp.expType = null;
- ProcessExpressionType(exp);
+ ProcessExpressionType(exp);
}
else if(symbol.isIterator != 4)
{
if(exp.instance._class)
{
exp.expType = MkClassType(exp.instance._class.name);
- /*if(exp.expType._class && exp.expType._class.registered &&
+ /*if(exp.expType._class && exp.expType._class.registered &&
(exp.expType._class.registered.type == normalClass || exp.expType._class.registered.type == noHeadClass))
exp.expType.byReference = true;*/
- }
+ }
break;
}
case constantExp:
switch(exp.op.op)
{
// Assignment Operators
- case '=':
+ case '=':
case MUL_ASSIGN:
case DIV_ASSIGN:
case MOD_ASSIGN:
case '/':
case '%':
case '*':
-
+
if(exp.op.op != '*' || exp.op.exp1)
{
useSideType = true;
{
if(exp.destType && exp.destType.kind == classType &&
exp.destType._class && exp.destType._class.registered && useDestType &&
-
- ((exp.destType._class.registered.type == unitClass && useSideUnit) ||
+
+ ((exp.destType._class.registered.type == unitClass && useSideUnit) ||
exp.destType._class.registered.type == enumClass ||
exp.destType._class.registered.type == bitClass
- ))
+ ))
//(exp.destType._class.registered.type == unitClass || exp.destType._class.registered.type == enumClass) && useDestType)
{
{
if(exp.op.exp1.destType) FreeType(exp.op.exp1.destType);
exp.op.exp1.destType = dummy;
- dummy.refCount++;
+ dummy.refCount++;
}
// TESTING THIS HERE...
}
else
{
- // Don't convert to the type for those... (e.g.: Degrees a; a /= 2;)
+ // Don't convert to the type for those... (e.g.: Degrees a; a /= 2;)
if(exp.op.op == MUL_ASSIGN || exp.op.op == DIV_ASSIGN ||exp.op.op == MOD_ASSIGN ||exp.op.op == LEFT_ASSIGN ||exp.op.op == RIGHT_ASSIGN/* ||
exp.op.op == AND_ASSIGN || exp.op.op == OR_ASSIGN*/);
else
exp.expType = type1;
}
else if(exp.destType && exp.destType.kind == classType &&
- exp.destType._class && exp.destType._class.registered &&
-
- ((exp.destType._class.registered.type == unitClass && useDestType && useSideUnit) ||
- (exp.destType._class.registered.type == enumClass && useDestType))
+ exp.destType._class && exp.destType._class.registered &&
+
+ ((exp.destType._class.registered.type == unitClass && useDestType && useSideUnit) ||
+ (exp.destType._class.registered.type == enumClass && useDestType))
)
{
if(exp.op.exp2.destType) FreeType(exp.op.exp2.destType);
}
// TESTING THIS HERE... (DANGEROUS)
- if(type1 && boolResult && useSideType && type1.kind == classType && type1._class && type1._class.registered &&
+ if(type1 && boolResult && useSideType && type1.kind == classType && type1._class && type1._class.registered &&
(type1._class.registered.type == bitClass || type1._class.registered.type == enumClass))
{
FreeType(exp.op.exp2.destType);
{
if(exp.op.exp2.expType.kind == intSizeType || exp.op.exp2.expType.kind == intPtrType || exp.op.exp2.expType.kind == int64Type || exp.op.exp2.expType.kind == intType || exp.op.exp2.expType.kind == shortType || exp.op.exp2.expType.kind == charType)
{
- if(exp.op.op != '=' && type1.type.kind == voidType)
+ if(exp.op.op != '=' && type1.type.kind == voidType)
Compiler_Error($"void *: unknown size\n");
}
- else if(exp.op.exp2.expType.kind == pointerType || exp.op.exp2.expType.kind == arrayType || exp.op.exp2.expType.kind == functionType || exp.op.exp2.expType.kind == methodType||
+ else if(exp.op.exp2.expType.kind == pointerType || exp.op.exp2.expType.kind == arrayType || exp.op.exp2.expType.kind == functionType || exp.op.exp2.expType.kind == methodType||
(type1.type.kind == voidType && exp.op.exp2.expType.kind == classType && exp.op.exp2.expType._class.registered &&
- (exp.op.exp2.expType._class.registered.type == normalClass ||
+ (exp.op.exp2.expType._class.registered.type == normalClass ||
exp.op.exp2.expType._class.registered.type == structClass ||
exp.op.exp2.expType._class.registered.type == noHeadClass)))
{
if(exp.op.op == ADD_ASSIGN)
- Compiler_Error($"cannot add two pointers\n");
+ Compiler_Error($"cannot add two pointers\n");
}
- else if((exp.op.exp2.expType.kind == classType && type1.kind == pointerType && type1.type.kind == classType &&
+ else if((exp.op.exp2.expType.kind == classType && type1.kind == pointerType && type1.type.kind == classType &&
type1.type._class == exp.op.exp2.expType._class && exp.op.exp2.expType._class.registered && exp.op.exp2.expType._class.registered.type == structClass))
{
if(exp.op.op == ADD_ASSIGN)
- Compiler_Error($"cannot add two pointers\n");
+ Compiler_Error($"cannot add two pointers\n");
}
else if(inCompiler)
{
char type2String[1024];
type1String[0] = '\0';
type2String[0] = '\0';
-
+
PrintType(exp.op.exp2.expType, type1String, false, true);
PrintType(type1, type2String, false, true);
ChangeCh(expString, '\n', ' ');
{
if(boolOps)
{
- if(exp.op.exp1)
+ if(exp.op.exp1)
{
if(exp.op.exp1.destType) FreeType(exp.op.exp1.destType);
exp.op.exp1.destType = MkClassType("bool");
exp.op.exp1.expType = MkClassType("bool");
exp.op.exp1.expType.truth = true;
}
- if(exp.op.exp2)
+ if(exp.op.exp2)
{
if(exp.op.exp2.destType) FreeType(exp.op.exp2.destType);
exp.op.exp2.destType = MkClassType("bool");
exp.op.exp2.expType.truth = true;
}
}
- else if(exp.op.exp1 && exp.op.exp2 &&
- ((useSideType /*&&
- (useSideUnit ||
+ else if(exp.op.exp1 && exp.op.exp2 &&
+ ((useSideType /*&&
+ (useSideUnit ||
((!type1 || type1.kind != classType || type1._class.registered.type != unitClass) &&
(!type2 || type2.kind != classType || type2._class.registered.type != unitClass)))*/) ||
- ((!type1 || type1.kind != classType || !strcmp(type1._class.string, "String")) &&
+ ((!type1 || type1.kind != classType || !strcmp(type1._class.string, "String")) &&
(!type2 || type2.kind != classType || !strcmp(type2._class.string, "String")))))
{
if(type1 && type2 &&
exp.op.exp1.destType = type2;
type2.refCount++;
// Warning here for adding Radians + Degrees with no destination type
- if(!boolResult && type1.kind == classType && (!exp.destType || exp.destType.kind != classType) &&
- type1._class.registered && type1._class.registered.type == unitClass &&
- type2._class.registered && type2._class.registered.type == unitClass &&
+ if(!boolResult && type1.kind == classType && (!exp.destType || exp.destType.kind != classType) &&
+ type1._class.registered && type1._class.registered.type == unitClass &&
+ type2._class.registered && type2._class.registered.type == unitClass &&
type1._class.registered != type2._class.registered)
Compiler_Warning($"operating on %s and %s with an untyped result, assuming %s\n",
type1._class.string, type2._class.string, type1._class.string);
Expression classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
exp.op.exp1 = MkExpBrackets(MkListOne(MkExpCast(
- MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer(null, null), null)),
+ MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer(null, null), null)),
exp.op.exp1)));
ProcessExpressionType(exp.op.exp1);
{
ProcessExpressionType(classExp);
- exp.op.exp2 = MkExpBrackets(MkListOne(MkExpOp(exp.op.exp2, '*',
+ exp.op.exp2 = MkExpBrackets(MkListOne(MkExpOp(exp.op.exp2, '*',
// ((_class.type == noHeadClass || _class.type == normalClass) ? sizeof(void *) : type.size)
MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(
// noHeadClass
MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpConstant("5")),
- OR_OP,
+ OR_OP,
// normalClass
MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpConstant("0"))))),
MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(
- MkPointer(null, null), null)))),
+ MkPointer(null, null), null)))),
MkExpMember(classExp, MkIdentifier("typeSize"))))))));
if(!exp.op.exp2.expType)
}
}
}
-
+
if(!boolResult && ((type1.kind == pointerType || type1.kind == arrayType || (type1.kind == classType && !strcmp(type1._class.string, "String"))) && (type2.kind == intSizeType || type2.kind == intPtrType || type2.kind == int64Type || type2.kind == intType || type2.kind == shortType || type2.kind == charType)))
{
- if(type1.kind != classType && type1.type.kind == voidType)
+ if(type1.kind != classType && type1.type.kind == voidType)
Compiler_Error($"void *: unknown size\n");
exp.expType = type1;
if(type1) type1.refCount++;
}
else if(!boolResult && ((type2.kind == pointerType || type2.kind == arrayType || (type2.kind == classType && !strcmp(type2._class.string, "String"))) && (type1.kind == intSizeType || type1.kind == intPtrType || type1.kind == int64Type || type1.kind == intType || type1.kind == shortType || type1.kind == charType)))
{
- if(type2.kind != classType && type2.type.kind == voidType)
+ if(type2.kind != classType && type2.type.kind == voidType)
Compiler_Error($"void *: unknown size\n");
exp.expType = type2;
if(type2) type2.refCount++;
{
Compiler_Warning($"different levels of indirection\n");
}
- else
+ else
{
bool success = false;
if(type1.kind == pointerType && type2.kind == pointerType)
exp.list = MkListOne(MkExpOp(
MkExpBrackets(MkListOne(MkExpOp(
MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer(null, null), null)), MkExpBrackets(MkListOne(exp.op.exp1)))
- , exp.op.op,
- MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer(null, null), null)), MkExpBrackets(MkListOne(exp.op.exp2)))))), '/',
-
+ , exp.op.op,
+ MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer(null, null), null)), MkExpBrackets(MkListOne(exp.op.exp2)))))), '/',
+
//MkExpMember(classExp, MkIdentifier("typeSize"))
// ((_class.type == noHeadClass || _class.type == normalClass) ? sizeof(void *) : type.size)
MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(
// noHeadClass
MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("noHeadClass"))),
- OR_OP,
+ OR_OP,
// normalClass
MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass")))))),
MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(
- MkPointer(null, null), null)))),
+ MkPointer(null, null), null)))),
MkExpMember(classExp, MkIdentifier("typeSize")))))
-
+
));
-
+
ProcessExpressionType(((Expression)exp.list->first).op.exp2);
FreeType(dummy);
- return;
+ return;
}
}
}
exp.expType = type2;
type2.refCount++;
}
-
+
if(!boolResult && useSideUnit && type2 && type2.kind == classType && type2._class.registered && type2._class.registered.type == unitClass && type1 && type1.kind != classType)
{
if(exp.op.exp1.destType) FreeType(exp.op.exp1.destType);
if(type2._class.registered.dataType)
type2._class.registered.dataType.refCount++;
CheckExpressionType(exp.op.exp2, exp.op.exp2.destType, false);
-
+
//exp.expType = type2._class.registered.dataType; //type2;
//if(type2) type2.refCount++;
}
if(type1) type1.refCount++;
}
}
-
+
yylloc = exp.loc;
if(exp.op.exp1 && !exp.op.exp1.expType)
{
FreeType(exp.expType);
FreeType(exp.destType);
delete exp.list;
-
+
*exp = *e;
exp.prev = prev;
a = exp.call.arguments->first;
tempExp1 = a;
}
-
+
if(a)
{
exp.call.arguments->Clear();
if(b.expType)
b.expType.refCount++;
ListAdd(exp.list, MkExpOp(CopyExpression(tempExp2), '=', b));
- }
+ }
decl = MkDeclaration(specs, decls);
if(!curCompound.compound.declarations)
if(!strcmp(id.string, "Max") || !strcmp(id.string, "Min"))
{
int op = (!strcmp(id.string, "Max")) ? '>' : '<';
- ListAdd(exp.list,
+ ListAdd(exp.list,
MkExpCondition(MkExpBrackets(MkListOne(
MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))),
MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
}
else if(!strcmp(id.string, "Abs"))
{
- ListAdd(exp.list,
+ ListAdd(exp.list,
MkExpCondition(MkExpBrackets(MkListOne(
MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))),
MkListOne(MkExpOp(null, '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
else if(!strcmp(id.string, "Sgn"))
{
// ((!(a))?(0):(((a)<0)?(-1):(1)))
- ListAdd(exp.list,
+ ListAdd(exp.list,
MkExpCondition(MkExpBrackets(MkListOne(
MkExpOp(null, '!', CopyExpression(tempExp1)))), MkListOne(MkExpConstant("0")),
MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(
{
methodType = functionType;
functionType = methodType.method.dataType;
-
+
//if(functionType.returnType && functionType.returnType.kind == thisClassType)
// TOCHECK: Instead of doing this here could this be done per param?
if(exp.call.exp.expType.usedClass)
Context context = SetupTemplatesContext(exp.call.exp.expType.usedClass);
decl = SpecDeclFromString(typeString, specs, null);
-
+
// SET THIS TO FALSE WHEN PROCESSING THISCLASS OUTSIDE THE CLASS
if(thisClass != (exp.call.exp.expType.usedClass.templateClass ? exp.call.exp.expType.usedClass.templateClass :
exp.call.exp.expType.usedClass))
thisClassParams = false;
-
+
ReplaceThisClassSpecifiers(specs, exp.call.exp.expType.usedClass);
{
Class backupThisClass = thisClass;
// Fixed #141 by adding '&& !functionType.extraParam'
if(!functionType.staticMethod && !functionType.extraParam)
{
- if(memberExp && memberExp.member.exp && memberExp.member.exp.expType && memberExp.member.exp.expType.kind == subClassType &&
+ if(memberExp && memberExp.member.exp && memberExp.member.exp.expType && memberExp.member.exp.expType.kind == subClassType &&
memberExp.member.exp.expType._class)
{
type = MkClassType(memberExp.member.exp.expType._class.string);
ClassTemplateArgument arg = _class.templateArgs[id];
{
Context context = SetupTemplatesContext(_class);
-
+
/*if(!arg.dataType)
arg.dataType = ProcessTypeString(arg.dataTypeString, false);*/
templatedType = ProcessTypeString(arg.dataTypeString, false);
}
ProcessExpressionType(exp.member.exp);
- if(exp.member.exp.expType && exp.member.exp.expType.kind == classType && exp.member.exp.expType._class &&
+ if(exp.member.exp.expType && exp.member.exp.expType.kind == classType && exp.member.exp.expType._class &&
exp.member.exp.expType._class.registered && exp.member.exp.expType._class.registered.type == normalClass)
{
exp.isConstant = false;
int c;
int paramCount = 0;
int lastParam = -1;
-
+
char templateString[1024];
ClassTemplateParameter param;
sprintf(templateString, "%s<", expClass.templateClass.fullName);
int p = 0;
Class nextClass;
for(nextClass = sClass.base; nextClass; nextClass = nextClass.base) p += nextClass.templateParams.count;
-
+
for(cParam = sClass.templateParams.first; cParam; cParam = cParam.next, p++)
{
if(cParam.type == TemplateParameterType::type && arg.dataTypeString && !strcmp(cParam.name, arg.dataTypeString))
lastParam = p;
}
p++;
- }
+ }
}
}
{
FreeType(exp.expType);
exp.expType = ProcessTypeString(templateString, false);
FinishTemplatesContext(context);
- }
+ }
}
// *([expType] *)(((byte *)[exp.member.exp]) + [argExp].member.offset)
MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer(null, null), decl)), MkExpBrackets(MkListOne(MkExpOp(
MkExpBrackets(MkListOne(
MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer(null, null), null)), expMember))),
- '+',
- MkExpOp(MkExpMember(MkExpMember(argExp, MkIdentifier("member")), MkIdentifier("offset")),
+ '+',
+ MkExpOp(MkExpMember(MkExpMember(argExp, MkIdentifier("member")), MkIdentifier("offset")),
'+',
MkExpMember(MkExpMember(MkExpMember(CopyExpression(argExp), MkIdentifier("member")), MkIdentifier("_class")), MkIdentifier("offset")))))))
-
+
));
}
}
- else if(type.templateParameter && type.templateParameter.type == TemplateParameterType::type &&
+ else if(type.templateParameter && type.templateParameter.type == TemplateParameterType::type &&
(type.templateParameter.dataType || type.templateParameter.dataTypeString))
{
type = ProcessTemplateParameterType(type.templateParameter);
if(_class && id)
{
- /*bool thisPtr =
- (exp.member.exp.type == identifierExp &&
+ /*bool thisPtr =
+ (exp.member.exp.type == identifierExp &&
!strcmp(exp.member.exp.identifier.string, "this"));*/
Property prop = null;
Method method = null;
FreeType(classExp.expType);
classExp.expType = ProcessTypeString("ecere::com::Class", false);
-
+
strcpy(structName, "__ecereClassData_");
FullClassNameCat(structName, type._class.string, false);
exp.type = pointerExp;
exp.member.member = id;
exp.member.exp = MkExpBrackets(MkListOne(MkExpCast(
- MkTypeName(MkListOne(MkStructOrUnion(structSpecifier, MkIdentifier(structName), null)), MkDeclaratorPointer(MkPointer(null, null), null)),
+ MkTypeName(MkListOne(MkStructOrUnion(structSpecifier, MkIdentifier(structName), null)), MkDeclaratorPointer(MkPointer(null, null), null)),
MkExpBrackets(MkListOne(MkExpOp(
- MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null,null), null)),
+ MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null,null), null)),
MkExpMember(classExp, MkIdentifier("data"))), '+',
MkExpMember(MkExpClass(MkListOne(MkSpecifierName(type._class.string)), null), MkIdentifier("offsetClass")))))
)));
}
}
}
-
+
if(prop)
{
exp.member.memberType = propertyMember;
if(!prop.dataType)
ProcessPropertyType(prop);
- exp.expType = prop.dataType;
+ exp.expType = prop.dataType;
if(prop.dataType) prop.dataType.refCount++;
}
else if(member)
if(sClass.templateClass) sClass = sClass.templateClass;
for(curParam = sClass.templateParams.first; curParam; curParam = curParam.next)
{
- if(curParam.type == TemplateParameterType::type &&
+ if(curParam.type == TemplateParameterType::type &&
!strcmp(exp.expType.type.templateParameter.identifier.string, curParam.name))
{
for(sClass = sClass.base; sClass; sClass = sClass.base)
Type basicType;
/*if(!arg.dataType)
arg.dataType = ProcessTypeString(arg.dataTypeString, false);*/
-
+
basicType = ProcessTypeString(arg.dataTypeString, false);
if(basicType)
{
if(tClass.templateClass)
basicType.passAsTemplate = true;
*/
-
+
FreeType(exp.expType);
exp.expType = Type { refCount = 1, kind = pointerType, type = basicType };
{
if(!strcmp(paramCur.name, param.name))
{
-
+
break;
}
cp++;
{
strcat(templateString, param.name);
strcat(templateString, " = ");
- }
+ }
strcat(templateString, argument);
paramCount++;
lastParam = p;
memberType.refCount++;
}
}
- else
+ else
{
char expString[10240];
expString[0] = '\0';
exp.expType = ReplaceThisClassType(_class);
}
}
- }
+ }
yylloc = oldyylloc;
break;
}
type.count = 0;
exp.expType = type;
//type.refCount++;
-
+
// if(!NeedCast(exp.cast.exp.expType, exp.cast.exp.destType))
if(!exp.cast.exp.needCast && !NeedCast(exp.cast.exp.expType, type))
{
//FreeType(exp.destType);
FreeType(exp.expType);
FreeTypeName(exp.cast.typeName);
-
+
*exp = *castExp;
FreeType(exp.expType);
FreeType(exp.destType);
classExp = MkExpIdentifier(MkIdentifier("class"));
exp.member.exp = MkExpBrackets(MkListOne(MkExpCast(
- MkTypeName(MkListOne(MkStructOrUnion(structSpecifier, MkIdentifier(structName), null)), MkDeclaratorPointer(MkPointer(null, null), null)),
+ MkTypeName(MkListOne(MkStructOrUnion(structSpecifier, MkIdentifier(structName), null)), MkDeclaratorPointer(MkPointer(null, null), null)),
MkExpBrackets(MkListOne(MkExpOp(
- MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null,null), null)),
+ MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null,null), null)),
MkExpMember(classExp, MkIdentifier("data"))), '+',
MkExpMember(MkExpClass(MkListOne(MkSpecifierName(_class.fullName)), null), MkIdentifier("offsetClass")))))
)));
FreeType(type);
type = e.expType;
e.expType = null;
-
+
e = exp.list->first;
ProcessExpressionType(e);
if(e.expType)
FreeType(type);
type = null;
break;
- }
+ }
}
}
}
FreeType(type);
delete exp.list;
}
-
+
DeclareStruct("ecere::com::BuiltInContainer", false);
ListAdd(structInitializers, /*MkIdentifier("_vTbl")*/ MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), null), MkIdentifier("_vTbl"))));
//CheckExpressionType(exp, exp.destType, false);
if(exp.destType.truth && exp.destType._class && exp.destType._class.registered && !strcmp(exp.destType._class.registered.name, "bool") &&
- exp.expType.kind != voidType && exp.expType.kind != structType && exp.expType.kind != unionType &&
+ exp.expType.kind != voidType && exp.expType.kind != structType && exp.expType.kind != unionType &&
(exp.expType.kind != classType || exp.expType.classObjectType || (exp.expType._class && exp.expType._class.registered && exp.expType._class.registered.type != structClass)));
else
{
PrintType(exp.expType, typeString, false, false);
decl = SpecDeclFromString(typeString, specs, null);
-
+
exp.cast.typeName = MkTypeName(specs, decl);
exp.cast.exp = newExp;
}
// Mark nohead classes as by reference, unless we're casting them to an integral type
if(!notByReference && exp.expType && exp.expType.kind == classType && exp.expType._class && exp.expType._class.registered &&
- exp.expType._class.registered.type == noHeadClass && (!exp.destType ||
- (exp.destType.kind != intType && exp.destType.kind != int64Type && exp.destType.kind != intPtrType && exp.destType.kind != intSizeType &&
+ exp.expType._class.registered.type == noHeadClass && (!exp.destType ||
+ (exp.destType.kind != intType && exp.destType.kind != int64Type && exp.destType.kind != intPtrType && exp.destType.kind != intSizeType &&
exp.destType.kind != longType && exp.destType.kind != shortType && exp.destType.kind != charType)))
{
exp.byReference = true;
static void FindNextDataMember(Class _class, Class * curClass, DataMember * curMember, DataMember * subMemberStack, int * subMemberStackPos)
{
// THIS CODE WILL FIND NEXT MEMBER...
- if(*curMember)
+ if(*curMember)
{
*curMember = (*curMember).next;
*curMember = (*curMember).members.first;
while(*curMember && (*curMember).isProperty)
- *curMember = (*curMember).next;
+ *curMember = (*curMember).next;
}
}
}
*curMember = (*curMember).members.first;
while(*curMember && (*curMember).isProperty)
- *curMember = (*curMember).next;
+ *curMember = (*curMember).next;
}
}
}
declarator = null;
};
if(!decl.function.parameters)
- decl.function.parameters = MkList();
+ decl.function.parameters = MkList();
decl.function.parameters->Insert(null, param);
id._class = null;
}
if(decl.function.parameters)
{
TypeName param;
-
+
for(param = decl.function.parameters->first; param; param = param.next)
{
if(param.qualifiers && param.qualifiers->first)
qualifiers = MkListOne(MkSpecifier(VOID));
declarator = MkDeclaratorPointer(MkPointer(null,null), d);
};
-
+
FreeList(param.qualifiers, FreeSpecifier);
param.qualifiers = MkListOne(MkStructOrUnion(structSpecifier, MkIdentifier("__ecereNameSpace__ecere__com__Class"), null));
else if(spec && spec.specifier == ANY_OBJECT)
{
Declarator d = param.declarator;
-
+
FreeList(param.qualifiers, FreeSpecifier);
param.qualifiers = MkListOne(MkSpecifier(VOID));
- param.declarator = MkDeclaratorPointer(MkPointer(null,null), d);
+ param.declarator = MkDeclaratorPointer(MkPointer(null,null), d);
}
else if(spec.specifier == THISCLASS)
{
if(decl.declarators)
{
InitDeclarator d;
-
+
for(d = decl.declarators->first; d; d = d.next)
{
Type type, subType;
{
ProcessInitializer(d.initializer, type);
- // Change "ColorRGB a = ColorRGB { 1,2,3 } => ColorRGB a { 1,2,3 }
-
+ // Change "ColorRGB a = ColorRGB { 1,2,3 } => ColorRGB a { 1,2,3 }
+
if(decl.declarators->count == 1 && d.initializer.type == expInitializer &&
d.initializer.exp.type == instanceExp)
{
- if(type.kind == classType && type._class ==
+ if(type.kind == classType && type._class ==
d.initializer.exp.expType._class)
{
Instantiation inst = d.initializer.exp.instance;
inst.exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d.declarator)));
-
+
d.initializer.exp.instance = null;
if(decl.specifiers)
FreeList(decl.specifiers, FreeSpecifier);
ListAdd(stmt.expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
}
-
+
{
args = MkList();
ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
ListAdd(stmt.expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
}
-
- if(curFunction.propSet && !strcmp(curFunction.propSet.string, prop.name) &&
+
+ if(curFunction.propSet && !strcmp(curFunction.propSet.string, prop.name) &&
(!object || (object.type == identifierExp && !strcmp(object.identifier.string, "this"))))
curFunction.propSet.fireWatchersDone = true;
}
char iteratorType[1024];
Type source;
Expression e;
- bool isBuiltin = exp && exp->last &&
- (((Expression)exp->last).type == ExpressionType::arrayExp ||
+ bool isBuiltin = exp && exp->last &&
+ (((Expression)exp->last).type == ExpressionType::arrayExp ||
(((Expression)exp->last).type == castExp && ((Expression)exp->last).cast.exp.type == ExpressionType::arrayExp));
Expression arrayExp;
char * typeString = null;
Class linkListClass = eSystem_FindClass(privateModule, "LinkList");
Class customAVLTreeClass = eSystem_FindClass(privateModule, "CustomAVLTree");
stmt.type = compoundStmt;
-
+
stmt.compound.context = Context { };
stmt.compound.context.parent = curContext;
curContext = stmt.compound.context;
isMap = true;
}
else if(source && eClass_IsDerived(source._class.registered, arrayClass)) isArray = true;
- else if(source && eClass_IsDerived(source._class.registered, linkListClass))
+ else if(source && eClass_IsDerived(source._class.registered, linkListClass))
{
Class listClass = eSystem_FindClass(privateModule, "List");
isLinkList = true;
{
Declarator decl;
OldList * specs = MkList();
- decl = SpecDeclFromString(_class.templateArgs[2].dataTypeString, specs,
+ decl = SpecDeclFromString(_class.templateArgs[2].dataTypeString, specs,
MkDeclaratorPointer(MkPointer(null, null), MkDeclaratorIdentifier(id)));
stmt.compound.declarations = MkListOne(
MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, null))));
ListAdd(stmt.compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source._class.registered.fullName)),
- MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")),
+ MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")),
MkInitializerAssignment(MkExpBrackets(exp))))));
}
else if(isBuiltin)
{
Type type = null;
char typeStringBuf[1024];
-
+
// TODO: Merge this code?
arrayExp = (((Expression)exp->last).type == ExpressionType::arrayExp) ? (Expression)exp->last : ((Expression)exp->last).cast.exp;
if(((Expression)exp->last).type == castExp)
FreeType(type);
type = e.expType;
e.expType = null;
-
+
e = arrayExp.list->first;
ProcessExpressionType(e);
if(e.expType)
FreeType(type);
type = null;
break;
- }
+ }
}
}
}
delete arrayExp.list;
}
decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
- stmt.compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier),
+ stmt.compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier),
MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null), /*CopyDeclarator(*/decl/*)*/), null))));
ListAdd(stmt.compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(
Declarator decl;
OldList * specs = MkList();
- decl = SpecDeclFromString(_class.templateArgs[2].dataTypeString, specs,
+ decl = SpecDeclFromString(_class.templateArgs[2].dataTypeString, specs,
MkDeclaratorPointer(MkPointer(null, null), MkDeclaratorIdentifier(id)));
stmt.compound.declarations = MkListOne(
MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, null))));
ListAdd(stmt.compound.declarations, MkDeclaration(MkListOne(MkSpecifierName("BuiltInContainer")),
- MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null), MkDeclaratorIdentifier(MkIdentifier("__internalArray"))),
+ MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null), MkDeclaratorIdentifier(MkIdentifier("__internalArray"))),
MkInitializerAssignment(MkExpBrackets(exp))))));
*/
}
decl = SpecDeclFromString(_class.templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
stmt.compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, null))));
ListAdd(stmt.compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source._class.registered.fullName)),
- MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")),
+ MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")),
MkInitializerAssignment(MkExpBrackets(exp))))));
}
/*else if(isCustomAVLTree)
decl = SpecDeclFromString(_class.templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
stmt.compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, null))));
ListAdd(stmt.compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source._class.registered.fullName)),
- MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalTree")),
+ MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalTree")),
MkInitializerAssignment(MkExpBrackets(exp))))));
}*/
else if(_class.templateArgs)
stmt.compound.declarations = MkListOne(
MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)),
- MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : null,
+ MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : null,
MkInitializerAssignment(MkExpBrackets(exp)))))))));
}
symbol = FindSymbol(id.string, curContext, curContext, false, false);
{
stmt.compound.statements = MkListOne(MkForStmt(
MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("array"))))),
- MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<',
+ MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<',
MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("array")), '+', MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("count")))))),
MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), INC_OP, null)),
block));
stmt.compound.statements = MkListOne(MkForStmt(
MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpIdentifier(MkIdentifier("__internalArray"))))),
- MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<',
+ MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<',
MkExpOp(MkExpIdentifier(MkIdentifier("__internalArray")), '+', MkExpConstant(count))))),
MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), INC_OP, null)),
block));
Declarator decl = SpecDeclFromString(_class.templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer(null, null), null));
stmt.compound.statements = MkListOne(MkForStmt(
MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpPointer(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("data"))))),
- MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<',
+ MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<',
MkExpOp(MkExpCast(MkTypeName(specs, decl), MkExpPointer(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("data"))), '+', MkExpPointer(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("count")))))),
MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), INC_OP, null)),
block));
{
Class typeClass = eSystem_FindClass(_class.module, _class.templateArgs[3].dataTypeString);
Class listItemClass = eSystem_FindClass(_class.module, "ListItem");
- if(typeClass && eClass_IsDerived(typeClass, listItemClass) && _class.templateArgs[5].dataTypeString &&
+ if(typeClass && eClass_IsDerived(typeClass, listItemClass) && _class.templateArgs[5].dataTypeString &&
!strcmp(_class.templateArgs[5].dataTypeString, "LT::link"))
{
stmt.compound.statements = MkListOne(MkForStmt(
if(stmt.compound.declarations->first)
ProcessDeclaration(stmt.compound.declarations->first);
- if(symbol)
+ if(symbol)
symbol.isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
ProcessStatement(stmt);
{
ClassFunction func;
char watcherName[1024];
- Class watcherClass = watcher ?
+ Class watcherClass = watcher ?
((watcher.expType && watcher.expType.kind == classType && watcher.expType._class) ? watcher.expType._class.registered : null) : thisClass;
External createdExternal;
// Create a declaration above
{
- Declaration decl = MkDeclaration(CopyList(createdExternal.function.specifiers, CopySpecifier),
+ Declaration decl = MkDeclaration(CopyList(createdExternal.function.specifiers, CopySpecifier),
MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal.function.declarator), null)));
externalDecl.declaration = decl;
if(decl.symbol && !decl.symbol.pointerExternal)
char getName[1024], setName[1024];
OldList * args = MkList();
- DeclareProperty(prop, setName, getName);
-
+ DeclareProperty(prop, setName, getName);
+
// eInstance_Watch(stmt.watch.object, prop, stmt.watch.watcher, callback);
strcpy(propName, "__ecereProp_");
FullClassNameCat(propName, prop._class.fullName, false);
if(inCompiler)
{
- _class = object ?
+ _class = object ?
((object.expType && object.expType.kind == classType && object.expType._class) ? object.expType._class.registered : null) : thisClass;
if(_class)
if(!watches)
{
OldList * args;
- // eInstance_StopWatching(object, null, watcher);
+ // eInstance_StopWatching(object, null, watcher);
args = MkList();
ListAdd(args, CopyExpression(object));
ListAdd(args, MkExpConstant("0"));
OldList * args = MkList();
DeclareProperty(prop, setName, getName);
-
- // eInstance_StopWatching(object, prop, watcher);
+
+ // eInstance_StopWatching(object, prop, watcher);
strcpy(propName, "__ecereProp_");
FullClassNameCat(propName, prop._class.fullName, false);
strcat(propName, "_");
yylloc = function.loc;
// Process thisClass
-
+
if(type && type.thisClass)
{
Symbol classSym = type.thisClass;
FullClassNameCat(structName, _class.fullName, false);
// [class] this
-
+
funcDecl = GetFuncDecl(function.declarator);
if(funcDecl)
// DANGER: Watch for this... Check if it's a Conversion?
// if((_class.type != bitClass && _class.type != unitClass && _class.type != enumClass) || function != (FunctionDefinition)symbol.externalSet)
-
+
// WAS TRYING THIS FOR CONVERSION PROPERTIES ON NOHEAD CLASSES: if((_class.type == structClass) || function != (FunctionDefinition)symbol.externalSet)
if(!function.propertyNoThis)
{
TypeName thisParam;
-
+
if(type.classObjectType != classPointer)
{
thisParam = QMkClass(_class.fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
funcDecl.function.parameters->Insert(null, thisParam);
}
}
- }
+ }
}
}
-
+
// Add this to the context
if(function.body)
{
}
// Pointer to class data
-
+
if(inCompiler && _class && (_class.type == normalClass /*|| _class.type == noHeadClass*/) && type.classObjectType != classPointer)
{
DataMember member = null;
if(member)
{
char pointerName[1024];
-
+
Declaration decl;
Initializer initializer;
Expression exp, bytePtr;
-
+
strcpy(pointerName, "__ecerePointer_");
FullClassNameCat(pointerName, _class.fullName, false);
{
kind = pointerType;
type = Type { refCount = 1, kind = voidType };
};
-
+
if(function.body)
{
yylloc = function.body.loc;
}
}
}
-
+
// Loop through the function and replace undeclared identifiers
// which are a member of the class (methods, properties or data)
type = regClass ? MkClassType(regClass.fullName) : null;
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
for(defProperty = def.defProperties->first; defProperty; defProperty = defProperty.next)
{
thisClass = regClass;
Symbol thisSymbol = Symbol { string = CopyString("this"), type = MkClassType(regClass.fullName) };
globalContext.symbols.Add(thisSymbol);
*/
-
+
thisClass = regClass;
if(prop.setStmt)
{
else if(def.type == propertyWatchClassDef && def.propertyWatch)
{
PropertyWatch propertyWatch = def.propertyWatch;
-
+
thisClass = regClass;
if(propertyWatch.compound)
{
MkTypeName(specs, decl), MkExpBrackets(MkListOne(member.initializer.exp))))), LEFT_OP, MkExpConstant(pos))));
}
else
- part = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(specs, decl),
+ part = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(specs, decl),
MkExpBrackets(MkListOne(member.initializer.exp)))));
// Take it out
member.initializer.exp = null;
subMemberStackPos = _subMemberStackPos;
}
if(!firstID.next && curMember == dataMember)
- {
+ {
memberFilled = true;
break;
}
// TODO: Set the member types for those
memberExp = MkExpMember(instExpCopy, id);
for(id = id.next; id; id = id.next)
- memberExp = MkExpMember(memberExp, id);
+ memberExp = MkExpMember(memberExp, id);
}
else
memberExp = MkExpMember(instExpCopy, ident);
ListAdd(specifiers, MkStructOrUnion(structSpecifier, MkIdentifier("__ecereNameSpace__ecere__com__Class"), null));
d = MkDeclaratorPointer(MkPointer(null, null),
- MkDeclaratorIdentifier(MkIdentifier(className)));
+ MkDeclaratorIdentifier(MkIdentifier(className)));
ListAdd(declarators, MkInitDeclarator(d, null));
OldList list = { 0 };
ProcessInstMembers(inst, null, &list, false);
-
+
ProcessExpression(inst.exp);
//Why was this here twice? ProcessInstMembers(inst, null, &list);
Expression e;
ProcessInstMembers(inst, null, &list, false);
-
+
ProcessExpression(inst.exp);
//Why was this here twice? ProcessInstMembers(inst, null, &list);
exp.list = MkList();
ProcessInstMembers(inst, inst.exp, exp.list, false);
-
+
ProcessExpression(inst.exp);
if(!exp.list->count)
{
Expression newCall;
- if(classSym && classSym.registered && classSym.registered.type == noHeadClass &&
+ if(classSym && classSym.registered && classSym.registered.type == noHeadClass &&
(classSym.registered.templateClass ? classSym.registered.templateClass.fixed : classSym.registered.fixed))
{
char size[256];
MembersInit members;
int tempCount = exp.tempCount;
OldList * expList;
-
+
// Check if members use temp count...
for(members = inst.members->first; members; members = members.next)
{
}
if(curDecl)
tempCount = Max(tempCount, declTempCount);
-
+
tempCount++;
curExternal.function.tempCount = Max(curExternal.function.tempCount, tempCount);
sprintf(ecereTemp, "__ecereInstance%d", tempCount);
exp.compound = MkCompoundStmt(null, null);
exp.compound.compound.context = PushContext();
exp.compound.compound.context.simpleID = exp.compound.compound.context.parent.simpleID;
- exp.compound.compound.declarations = MkListOne(QMkDeclaration(inst._class.name, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(ecereTemp)),
+ exp.compound.compound.declarations = MkListOne(QMkDeclaration(inst._class.name, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(ecereTemp)),
MkInitializerAssignment(newCall))));
exp.compound.compound.statements = MkListOne(MkExpressionStmt((expList = MkList())));
switch(exp.op.op)
{
// Assignment Operators
- case '=':
+ case '=':
if(exp.op.exp2)
exp.op.exp2.usage.usageGet = true;
if(exp.op.exp1)
case '|':
case '^':
case AND_OP:
- case OR_OP:
+ case OR_OP:
if(exp.op.exp1)
exp.op.exp1.usage.usageGet = true;
if(exp.op.exp2)
Context context = PushContext();
sprintf(iteratorType, "Iterator<%s, %s >", _class.templateArgs[2].dataTypeString, _class.templateArgs[1].dataTypeString);
-
+
ListAdd(instMembers, MkMemberInit(null, MkInitializerAssignment(exp.index.exp)));
-
+
ListAdd(declarations, MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)),
MkExpIdentifier(MkIdentifier("__internalIterator")), MkListOne(MkMembersInitList(instMembers)))));
ListAdd(args, MkExpBrackets(exp.index.index));
ListAdd(args, exp.usage.usageSet ? MkExpIdentifier(MkIdentifier("true")) : MkExpIdentifier(MkIdentifier("false")));
-
- ListAdd(statements, MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("__internalIterator")),
+
+ ListAdd(statements, MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("__internalIterator")),
MkIdentifier("Index")), args))));
ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(null, '&', MkExpIdentifier(MkIdentifier("__internalIterator"))))));
revConvert = eClass_FindProperty(convertClass, _class.fullName, privateModule);
}
}
-
+
if(prop)
{
exp.member.memberType = propertyMember;
if(!method.dataType)
//method.dataType = ((Symbol)method.symbol).type;
ProcessMethodType(method);
-
+
FreeType(exp.expType);
exp.expType = method.dataType;
if(method.dataType) method.dataType.refCount++;
exp.expType = MkClassType(revConvert._class.fullName);
}/*
else
- printf($"Error: Couldn't find member %s in class %s\n",
+ printf($"Error: Couldn't find member %s in class %s\n",
exp.member.member.string, _class.name);*/
}
}
case extensionCompoundExp:
{
if(exp.compound.compound.statements &&
- ((Statement)exp.compound.compound.statements->last).type == expressionStmt &&
+ ((Statement)exp.compound.compound.statements->last).type == expressionStmt &&
((Statement)exp.compound.compound.statements->last).expressions &&
((Statement)exp.compound.compound.statements->last).expressions->last)
{
if(!ProcessBracketInst_DataMember(dataMember, inst, list))
return false;
}
- else
+ else
{
Class curClass = null;
DataMember curMember = null;
// *** THE IDENTIFIERS WERE BEING REUSED, CAUSING A CRASH WITH EXPRESSION TEMPLATE CODE IN pass1.ec ***
// members->Add(MkMemberInit(ids, MkInitializerAssignment(MkExpConstant(ui64String))));
/*member.identifiers->Remove(firstID);*/
- ListAdd(partList,
+ ListAdd(partList,
MkMemberInit(/*member.identifiers*/identifiers, MkInitializerAssignment(member.initializer.exp)));
}
-
+
for(nextMembers = members; nextMembers; nextMembers = nextMembers.next)
{
if(!nextMembers.dataMembers)
nextMember = next, next = nextMember ? nextMember.next : null)
{
Identifier nextID = nextMember.identifiers->first;
- if(nextMember.identifiers &&
+ if(nextMember.identifiers &&
nextMember.identifiers->count > 1 &&
!strcmp(firstID.string, nextID.string))
{
}
}
- member.initializer.exp = MkExpInstance(MkInstantiation(spec, null,
+ member.initializer.exp = MkExpInstance(MkInstantiation(spec, null,
MkListOne(MkMembersInitList(partList))));
}
found = true;
if(classSym && classSym.registered && classSym.registered.type == structClass)
{
OldList * subList = MkList();
- Specifier spec = _MkSpecifierName/*MkClassName*/(dataMember.dataTypeString, classSym, null);
+ Specifier spec = _MkSpecifierName/*MkClassName*/(dataMember.dataTypeString, classSym, null);
Instantiation inst = MkInstantiation(spec, null, null);
ProcessBracketInst(inst, subList);
FreeInstance(inst);
if(classSym && classSym.registered && classSym.registered.type == structClass)
{
OldList * subList = MkList();
- Specifier spec = _MkSpecifierName/*MkClassName*/(dataMember.dataTypeString, classSym, null);
+ Specifier spec = _MkSpecifierName/*MkClassName*/(dataMember.dataTypeString, classSym, null);
Instantiation inst = MkInstantiation(spec, null, null);
ProcessBracketInst(inst, subList);
FreeInstance(inst);
return false;
}
}
- else
+ else
{
MembersInit members;
MemberInit member = null;
{
if(dataMember.isProperty)
{
- if(!((Property)dataMember).Set)
+ if(!((Property)dataMember).Set)
{
Compiler_Error($"No set defined for property %s\n", dataMember.name);
continue;
if(!dataMember.dataType)
dataMember.dataType = ProcessTypeString(dataMember.dataTypeString, false);
symbol = (dataMember.dataType && dataMember.dataType.kind == classType) ? dataMember.dataType._class : null;
- spec = _MkSpecifierName/*MkClassName*/(dataMember.dataTypeString, symbol, null);
+ spec = _MkSpecifierName/*MkClassName*/(dataMember.dataTypeString, symbol, null);
member.identifiers->Remove(firstID);
- ListAdd(partList,
+ ListAdd(partList,
MkMemberInit(member.identifiers, MkInitializerAssignment(member.initializer.exp)));
for(nextMembers = members; nextMembers; nextMembers = nextMembers.next)
nextMember = next, next = nextMember ? nextMember.next : null)
{
Identifier nextID = nextMember.identifiers->first;
- if(nextMember.identifiers &&
+ if(nextMember.identifiers &&
nextMember.identifiers->count > 1 &&
!strcmp(firstID.string, nextID.string))
{
}
}
- member.initializer.exp = MkExpInstance(MkInstantiation(spec, null,
+ member.initializer.exp = MkExpInstance(MkInstantiation(spec, null,
MkListOne(MkMembersInitList(partList))));
// TESTING THIS
{
if(dataMember.isProperty)
{
- if(!((Property)dataMember).Set)
+ if(!((Property)dataMember).Set)
{
Compiler_Error($"No set defined for property %s\n", dataMember.name);
continue;
if(classSym && classSym.registered && classSym.registered.type == structClass)
{
OldList * subList = MkList();
- Specifier spec = _MkSpecifierName/*MkClassName*/(dataMember.dataTypeString, classSym, null);
+ Specifier spec = _MkSpecifierName/*MkClassName*/(dataMember.dataTypeString, classSym, null);
Instantiation inst = MkInstantiation(spec, null, null);
ProcessBracketInst(inst, subList);
FreeInstance(inst);
case instDeclaration:
{
Instantiation inst = decl.inst;
-
+
if(inCompiler)
{
Symbol classSym = inst._class.symbol; // FindClass(inst._class.name);
if(classSym && classSym.registered && (classSym.registered.type == normalClass))
{
- ListAdd(createInstancesBody.compound.statements,
+ ListAdd(createInstancesBody.compound.statements,
MkExpressionStmt(MkListOne(MkExpCall(
MkExpIdentifier(MkIdentifier("ecere::com::eInstance_IncRef")),
MkListOne(CopyExpression(inst.exp))))));
CreateInstancesBody();
}
}
-
+
{
char className[1024];
-
+
decl.type = initDeclaration;
decl.specifiers = MkList();
decl.declarators = MkList();
-
+
// Replace instantiation here
if(classSym && classSym.registered && classSym.registered.type == bitClass)
{
if(inst.fullSet)
{
ListAdd(decl.specifiers, MkSpecifierName/*MkClassName*/(inst._class.name));
- ListAdd(decl.declarators,
+ ListAdd(decl.declarators,
MkInitDeclarator(MkDeclaratorIdentifier(inst.exp.identifier), null));
inst.exp.identifier = null;
}
- else
+ else
{
OldList * list = MkList();
if(ProcessBracketInst(inst, list))
{
Expression newCall;
- if(classSym && classSym.registered && classSym.registered.type == noHeadClass &&
+ if(classSym && classSym.registered && classSym.registered.type == noHeadClass &&
(classSym.registered.templateClass ? classSym.registered.templateClass.fixed : classSym.registered.fixed))
{
char size[256];
External external;
// Is this still needed?
//CreateInstancesBody();
-
+
for(external = ast->first; external; external = external.next)
{
curExternal = external;
type = MkClassTypeSymbol(_class.symbol); //regClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
for(defProperty = def.defProperties->first; defProperty; defProperty = defProperty.next)
{
//thisClass = regClass;
type = MkClassTypeSymbol(_class.symbol); //regClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
//thisClass = regClass;
if(prop.setStmt)
{
else if(def.type == propertyWatchClassDef && def.propertyWatch)
{
PropertyWatch propertyWatch = def.propertyWatch;
-
+
// Add this to the context
Symbol thisSymbol
{
type = MkClassTypeSymbol(_class.symbol); //regClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
//thisClass = regClass;
if(propertyWatch.compound)
{
static void _FixRefExp(Expression * expPtr, Expression * memberExpPtr)
{
-
+
Expression memberExp = *memberExpPtr;
if(memberExp && memberExp.type == ExpressionType::memberExp &&
memberExp.member.exp && (memberExp.member.exp.type == bracketsExp || memberExp.member.exp.type == extensionExpressionExp))
*(Expression *)((byte *)newExp + (uint)((byte *)memberExpPtr - (byte *)exp)) = memberExp;
memberExp.member.exp = idExp;
-
+
exp.type = bracketsExp;
exp.list = bracketExp.list;
bracketExp.list = null;
*memberExpPtr = null;
newExp = CopyExpression(exp);
*(Expression *)((byte *)newExp + (uint)((byte *)memberExpPtr - (byte *)exp)) = memberExp.list->last;
-
+
exp.type = bracketsExp;
exp.list = memberExp.list;
memberExp.list = null;
Class _class = type._class ? type._class.registered : null;
// TOLOOKINTO: What was systemClass used for here? Exclude "typed_object"...
// TOFIX: In which case with systemClass do we actually want this to come here? Can't think of any!
- if(_class && ((_class.type == structClass && !type.declaredWithStruct) || _class.type == noHeadClass ||
- (_class.type == systemClass && _class.base &&
- strcmp(_class.fullName, "uintptr") &&
- strcmp(_class.fullName, "intptr") &&
- strcmp(_class.fullName, "uintsize") &&
+ if(_class && ((_class.type == structClass && !type.declaredWithStruct) || _class.type == noHeadClass ||
+ (_class.type == systemClass && _class.base &&
+ strcmp(_class.fullName, "uintptr") &&
+ strcmp(_class.fullName, "intptr") &&
+ strcmp(_class.fullName, "uintsize") &&
strcmp(_class.fullName, "intsize"))))
{
// if(wantReference != ((_class.type == systemClass) ? false : e.byReference))
exp.op.op = '&';
else
exp.op.op = '*';
-
+
e.byReference = wantReference;
exp.byReference = wantReference;
}
switch(exp.op.op)
{
// Assignment Operators
- case '=':
+ case '=':
if(exp.op.exp2)
exp.op.exp2.usage.usageGet = true;
break;
case '|':
case '^':
case AND_OP:
- case OR_OP:
+ case OR_OP:
if(exp.op.exp1)
exp.op.exp1.usage.usageGet = true;
if(exp.op.exp2)
Expression lastExp = exp.op.exp1, parentExp = null;
Property lastProperty = null;
Class propertyClass;
-
+
char setName[1024], getName[1024];
testExp = exp.op.exp1.member.exp;
while(true)
}
if(!testExp) break;
- if(testExp.member.memberType == propertyMember ||
+ if(testExp.member.memberType == propertyMember ||
testExp.member.memberType == reverseConversionMember)
{
Type type = testExp.member.exp.expType;
_class = FindClass(testExp.member.member.string).registered;
// lastProperty = eClass_FindProperty(_class, convertTo.name, privateModule);
lastProperty = eClass_FindProperty(_class, convertTo.fullName, privateModule);
- }
+ }
else
{
lastProperty = eClass_FindProperty(_class, testExp.member.member.string, privateModule);
{
DeclareProperty(lastProperty, setName, getName);
// propertyClass = convertTo ? _class : ((Symbol)lastProperty.symbol)._class;
- propertyClass = convertTo ? _class :
- ((((Symbol)lastProperty.symbol).type &&
+ propertyClass = convertTo ? _class :
+ ((((Symbol)lastProperty.symbol).type &&
((Symbol)lastProperty.symbol).type.kind == classType) ? ((Symbol)lastProperty.symbol).type._class.registered : ((Symbol)lastProperty.symbol)._class);
// TODO: Handle this kind of things with bit classes?
if(propertyClass && propertyClass.type == structClass)
parentExp = lastExp;
}
}
-
+
}
}
}
Expression value;
char className[1024];
Expression tempExp;
-
+
sprintf(className, "__simpleStruct%d", curContext.simpleID); //++);
tempExp = QMkExpId(className);
tempExp.expType = MkClassType(propertyClass.fullName);
tempExp.expType.refCount++;
// Go on as usual with these new values:
- exp.op.exp1 = topExp;
+ exp.op.exp1 = topExp;
exp.op.exp2 = value;
exp.op.op = '=';
Expression value;
char className[1024];
Expression tempExp;
-
+
sprintf(className, "__simpleStruct%d", curContext.simpleID); //++);
tempExp = QMkExpId(className);
tempExp.expType = MkClassType(propertyClass.fullName);
//value = MkExpOp(exp.op.exp1, exp.op.op, exp.op.exp2);
// Go on as usual with these new values:
- exp.op.exp1 = topExp;
+ exp.op.exp1 = topExp;
exp.op.exp2 = value;
exp.op.op = '=';
memberExp = exp.op.exp1;
- while(memberExp && ((memberExp.type == bracketsExp && memberExp.list->count == 1) ||
+ while(memberExp && ((memberExp.type == bracketsExp && memberExp.list->count == 1) ||
memberExp.type == extensionExpressionExp || memberExp.type == extensionCompoundExp))
{
parentExp = memberExp;
memberExp = memberExp.list->last;
}
- if(memberExp && memberExp.type == indexExp && memberExp.index.exp && memberExp.index.exp.expType &&
+ if(memberExp && memberExp.type == indexExp && memberExp.index.exp && memberExp.index.exp.expType &&
memberExp.index.exp.expType.kind == classType && memberExp.index.exp.expType._class && memberExp.index.exp.expType._class.registered &&
memberExp.index.exp.expType._class.registered != containerClass && eClass_IsDerived(memberExp.index.exp.expType._class.registered, containerClass))
{
ProcessExpression(memberExp);
- while(memberExp && ((memberExp.type == bracketsExp && memberExp.list->count == 1) ||
+ while(memberExp && ((memberExp.type == bracketsExp && memberExp.list->count == 1) ||
memberExp.type == extensionExpressionExp || memberExp.type == extensionCompoundExp))
{
parentExp = memberExp;
if(_class && _class.type == bitClass && memberExp.member.memberType == dataMember)
{
- BitMember bitMember =
- (BitMember)eClass_FindDataMember(_class,
+ BitMember bitMember =
+ (BitMember)eClass_FindDataMember(_class,
memberExp.member.member.string, privateModule, null, null);
char mask[32], shift[10];
OldList * specs = MkList();
//Declarator decl = SpecDeclFromString(bitMember.dataTypeString, specs, null);
- Declarator decl = SpecDeclFromString(_class.dataTypeString, specs, null);
+ Declarator decl = SpecDeclFromString(_class.dataTypeString, specs, null);
TypeName type = MkTypeName(specs, decl);
if(bitMember.mask > MAXDWORD)
sprintf(mask, FORMAT64HEXLL, bitMember.mask);
else
sprintf(mask, FORMAT64HEX, bitMember.mask);
- sprintf(shift, "%d", bitMember.pos);
+ sprintf(shift, "%d", bitMember.pos);
// color = (color & ~0xFF0000) | (((unsigned char)200) << 16)
exp.op.exp1 = memberExp.member.exp;
else
{
exp.op.exp2 = MkExpOp(
- MkExpBrackets(MkListOne(MkExpOp(CopyExpression(memberExp.member.exp), '&',
+ MkExpBrackets(MkListOne(MkExpOp(CopyExpression(memberExp.member.exp), '&',
MkExpOp(null, '~', MkExpConstant(mask))))), '|',
MkExpBrackets(MkListOne(MkExpOp(MkExpBrackets(
MkListOne(MkExpCast(type, exp.op.exp2))), LEFT_OP, MkExpConstant(shift)))));
if(memberExp.member.memberType == classPropertyMember)
classProperty = eClass_FindClassProperty(_class, memberExp.member.member.string);
-
+
exp.tempCount = memberExp.member.exp.tempCount;
if(classProperty)
if(operator != '=')
{
if(operator == INC_OP)
- value = MkExpOp(CopyExpression(memberExp),
+ value = MkExpOp(CopyExpression(memberExp),
'+', MkExpConstant("1"));
else if(operator == DEC_OP)
- value = MkExpOp(CopyExpression(memberExp),
+ value = MkExpOp(CopyExpression(memberExp),
'-', MkExpConstant("1"));
else
{
- value = MkExpOp(CopyExpression(memberExp),
+ value = MkExpOp(CopyExpression(memberExp),
operator, value);
exp2 = null;
}
else if(value)
{
// Dont free exp2, we're using it
- exp2 = null;
+ exp2 = null;
}
-
+
if(value)
value.usage.usageArg = true;
ProcessExpression(memberExp.member.exp);
// If get flag present
- if(exp.usage.usageGet &&
+ if(exp.usage.usageGet &&
((!convertTo && prop.Get) || (convertTo && prop.Set)))
{
OldList * list = MkList();
char ecereTemp[100];
Context context = PushContext();
exp.tempCount++;
-
+
curExternal.function.tempCount = Max(curExternal.function.tempCount, exp.tempCount);
sprintf(ecereTemp, "__ecTemp%d", exp.tempCount);
exp.compound = MkCompoundStmt(
MkListOne(MkDeclaration(MkListOne(MkSpecifier(VOID)), MkListOne(MkInitDeclarator(
MkDeclaratorPointer(MkPointer(null, null), MkDeclaratorIdentifier(MkIdentifier(ecereTemp))),
- MkInitializerAssignment(QBrackets(memberExp.member.exp)))))),
+ MkInitializerAssignment(QBrackets(memberExp.member.exp)))))),
list);
// Add the set
ListAdd(args, value);
ListAdd(list, MkExpressionStmt(MkListOne(MkExpCall(QMkExpId(setName), args))));
}
-
+
// Add the get
args = MkList();
if(convertTo)
{
OldList * list = MkList();
OldList * args;
-
+
// Set the method
args = MkList();
ListAdd(args, memberExp.member.exp);
{
Expression object = exp.op.exp2;
OldList * args = MkList();
-
+
exp.type = bracketsExp;
exp.list = MkList();
// TOFIX: Same time as when we fix for = 0
- if(exp.expType && exp.expType.kind == classType && exp.expType._class && exp.expType._class.registered &&
+ if(exp.expType && exp.expType.kind == classType && exp.expType._class && exp.expType._class.registered &&
exp.expType._class.registered.type == normalClass &&
strcmp(exp.expType._class.registered.dataTypeString, "char *"))
{
MangleClassName(className);
DeclareClass(exp.expType._class, className);
-
+
// Call the non virtual destructor
ListAdd(list, MkExpCall(MkExpPointer(QMkExpId(className), MkIdentifier("Destructor")), CopyList(args, CopyExpression)));
ListAdd(list, MkExpCall(QMkExpId("ecere::com::eSystem_Delete"), args));
ListAdd(exp.list, MkExpBrackets(MkListOne(MkExpCondition(CopyExpression(object), MkListOne(
-
- MkExpBrackets(MkListOne(MkExpCondition(
+
+ MkExpBrackets(MkListOne(MkExpCondition(
MkExpPointer(QMkExpId(className), MkIdentifier("Destructor")),
MkListOne(MkExpBrackets(list)), MkExpCall(QMkExpId("ecere::com::eSystem_Delete"), CopyList(args, CopyExpression)))))), MkExpConstant("0"))))
-
+
);
*/
ListAdd(list,
MkExpCondition(
MkExpPointer(
- QMkExpId(className),
+ QMkExpId(className),
MkIdentifier("Destructor")
),
MkListOne(
MkExpCall(
MkExpPointer(
- QMkExpId(className),
+ QMkExpId(className),
MkIdentifier("Destructor")
- ),
+ ),
CopyList(args, CopyExpression)
)
),
);
}
ListAdd(list, MkExpCall(QMkExpId("ecere::com::eSystem_Delete"), args));
- ListAdd(exp.list,
+ ListAdd(exp.list,
MkExpBrackets(
MkListOne(
MkExpCondition(
- CopyExpression(object),
+ CopyExpression(object),
MkListOne(
MkExpBrackets(list)
),
MkExpBrackets(MkListOne(MkExpCast(typeName,
MkExpIndex(MkExpPointer(classExp, MkIdentifier("_vTbl")),
MkListOne(MkExpIdentifier(MkIdentifier("__ecereVMethodID_class_OnFree"))))))), args));
- //ProcessExpression(exp.list->last);
+ //ProcessExpression(exp.list->last);
}
}
else
if(exp.type == opExp)
{
// Handle assigment of template structures
- if(exp.op.op == '=' && exp.op.exp1 && exp.op.exp1.expType && exp.op.exp1.expType.kind == templateType &&
+ if(exp.op.op == '=' && exp.op.exp1 && exp.op.exp1.expType && exp.op.exp1.expType.kind == templateType &&
(exp.op.exp1.type == indexExp || (exp.op.exp1.type == opExp && exp.op.exp1.op.op == '*' && !exp.op.exp1.op.exp1)))
{
Expression argExp = GetTemplateArgExp(exp.op.exp1.expType.templateParameter, thisClass, false);
Expression derefExp = exp.op.exp1;
Expression sizeExp = MkExpCondition(MkExpBrackets(MkListOne(
MkExpOp(
- MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass"))),
+ MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass"))),
OR_OP,
MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("noHeadClass")))))),
MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, null), null)))),
MkExpMember(CopyExpression(classExp), MkIdentifier("typeSize")));
-
+
if(exp.op.exp1.type == indexExp)
{
Expression indexExp = derefExp.index.exp;
OldList * indexExpIndex = derefExp.index.index;
-
+
derefExp.index.index = null;
derefExp.index.exp = null;
FreeExpression(derefExp);
- derefExp = MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null, null), null)), indexExp), '+',
+ derefExp = MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null, null), null)), indexExp), '+',
MkExpBrackets(MkListOne(MkExpOp(MkExpBrackets(indexExpIndex), '*', MkExpBrackets(MkListOne(CopyExpression(sizeExp)))))));
}
else
FreeExpression(derefExp);
derefExp = indexExp;
}
-
+
args->Add(derefExp);
ProcessExpressionType(args->last);
ProcessExpression(args->last);
- args->Add(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null, null), null)),
- MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpMember(classExp, MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("structClass"))))),
+ args->Add(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null, null), null)),
+ MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpMember(classExp, MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("structClass"))))),
MkListOne(exp.op.exp2), MkExpOp(null, '&', CopyExpression(exp.op.exp2)))));
thisClass = curExternal.function ? curExternal.function._class : null;
type = MkClassType(thisClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
ProcessExpressionType(args->last);
ProcessExpression(args->last);
args->Add(sizeExp);
ProcessExpressionType(args->last);
ProcessExpression(args->last);
-
+
exp.list = MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("memcpy")), args));
exp.type = bracketsExp;
-
+
//globalContext.symbols.Delete((BTNode)thisSymbol);
globalContext.symbols.Remove((BTNode)thisSymbol);
FreeSymbol(thisSymbol);
return;
}
}
- else if(exp.op.op == '*' && !exp.op.exp1 && exp.op.exp2 && exp.op.exp2.expType && exp.op.exp2.expType.kind == pointerType &&
+ else if(exp.op.op == '*' && !exp.op.exp1 && exp.op.exp2 && exp.op.exp2.expType && exp.op.exp2.expType.kind == pointerType &&
exp.op.exp2.expType.type && exp.op.exp2.expType.type.kind == templateType)
{
Expression argExp = GetTemplateArgExp(exp.op.exp2.expType.type.templateParameter, thisClass, false);
{
Expression classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
Expression sizeExp = MkExpMember(CopyExpression(classExp), MkIdentifier("typeSize"));
-
+
exp.type = bracketsExp;
exp.list = MkListOne(
// (uint64)
- MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null),
+ MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null),
// ((class.type == structClass) ?
MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("structClass"))))),
// ((class.type == normalClass || class.type == noHeadClass) ?
MkExpCondition(MkExpBrackets(MkListOne(
MkExpOp(
- MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass"))),
+ MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass"))),
OR_OP,
MkExpOp(MkExpMember(classExp, MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("noHeadClass")))))),
// *((void **)array)
- MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null), MkExpOp(null, '*', MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, MkPointer(null, null)), null)),
+ MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null), MkExpOp(null, '*', MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, MkPointer(null, null)), null)),
CopyExpression(exp.op.exp2))))))),
// ((class.size == 1) ?
CopyExpression(exp.op.exp2)))))),
// *((uint64 *)array)
- MkExpOp(null, '*', MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer(null, null), null)),
+ MkExpOp(null, '*', MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer(null, null), null)),
exp.op.exp2)))))))))))))))))))));
-
+
// Add this to the context
thisClass = curExternal.function ? curExternal.function._class : null;
{
type = MkClassType(thisClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
ProcessExpressionType(exp.list->first);
ProcessExpression(exp.list->first);
-
+
//globalContext.symbols.Delete((BTNode)thisSymbol);
globalContext.symbols.Remove((BTNode)thisSymbol);
FreeSymbol(thisSymbol);
ProcessExpression(exp.op.exp1);
// TESTING THIS...
- if(exp.op.op == '=' && exp.op.exp2 && (!exp.op.exp2.byReference ||
- (exp.op.exp2.expType && exp.op.exp2.expType.kind == classType && exp.op.exp2.expType._class &&
- exp.op.exp2.expType._class.registered && exp.op.exp2.expType._class.registered.type == structClass)) &&
+ if(exp.op.op == '=' && exp.op.exp2 && (!exp.op.exp2.byReference ||
+ (exp.op.exp2.expType && exp.op.exp2.expType.kind == classType && exp.op.exp2.expType._class &&
+ exp.op.exp2.expType._class.registered && exp.op.exp2.expType._class.registered.type == structClass)) &&
exp.op.exp2.expType && (exp.op.exp2.expType.kind != pointerType && exp.op.exp2.expType.kind != templateType /*|| !exp.op.exp2.expType.type || exp.op.exp2.expType.type.kind != voidType*/))
FixReference(exp.op.exp1, false);
// TEST: exp.tempCount = Max(exp.op.exp1.tempCount, exp.tempCount);
if(exp.op.exp1 || (exp.op.op != '*' && exp.op.op != '&'))
{
// TESTING THIS IF:
- if((!exp.op.exp1 &&
- (!exp.op.exp2 || !exp.op.exp2.expType || exp.op.exp2.expType.kind != classType || !exp.op.exp2.expType._class || !exp.op.exp2.expType._class.registered ||
- (exp.op.exp2.expType._class.registered.type != normalClass &&
- exp.op.exp2.expType._class.registered.type != structClass &&
- exp.op.exp2.expType._class.registered.type != noHeadClass)))
+ if((!exp.op.exp1 &&
+ (!exp.op.exp2 || !exp.op.exp2.expType || exp.op.exp2.expType.kind != classType || !exp.op.exp2.expType._class || !exp.op.exp2.expType._class.registered ||
+ (exp.op.exp2.expType._class.registered.type != normalClass &&
+ exp.op.exp2.expType._class.registered.type != structClass &&
+ exp.op.exp2.expType._class.registered.type != noHeadClass)))
// TESTING THIS TEMPLATE TYPE CHECK HERE
|| (exp.op.exp1 && exp.op.exp1.expType && exp.op.exp1.expType.kind != pointerType && exp.op.exp1.expType.kind != templateType))
Expression classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
Expression e;
exp.type = bracketsExp;
- exp.list = MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null, null), null)),
- MkExpOp(null, '&', exp2)), '+',
- MkExpCall(MkExpIdentifier(MkIdentifier("__ENDIAN_PAD")),
+ exp.list = MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer(null, null), null)),
+ MkExpOp(null, '&', exp2)), '+',
+ MkExpCall(MkExpIdentifier(MkIdentifier("__ENDIAN_PAD")),
MkListOne((e = MkExpCondition(MkExpBrackets(MkListOne(
-
+
MkExpOp(
MkExpOp(
- MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("structClass"))),
+ MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("structClass"))),
OR_OP,
- MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass")))),
+ MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass")))),
OR_OP,
MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("noHeadClass"))))
)),
case indexExp:
{
Expression e;
- /*bool isBuiltin = exp && exp.index.exp &&
- (exp.index.exp.type == ExpressionType::arrayExp ||
+ /*bool isBuiltin = exp && exp.index.exp &&
+ (exp.index.exp.type == ExpressionType::arrayExp ||
(exp.index.exp.type == castExp && exp.index.exp.cast.exp.type == ExpressionType::arrayExp));
*/
Expression checkedExp = exp.index.exp;
exp.index.exp.usage.usageGet = true;
ProcessExpression(exp.index.exp);
- if(exp.index.exp.expType && exp.index.exp.expType.kind == pointerType &&
+ if(exp.index.exp.expType && exp.index.exp.expType.kind == pointerType &&
exp.index.exp.expType.type && exp.index.exp.expType.type.kind == templateType)
{
Expression argExp = GetTemplateArgExp(exp.index.exp.expType.type.templateParameter, thisClass, false);
{
Expression classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
Expression sizeExp = MkExpMember(CopyExpression(classExp), MkIdentifier("typeSize"));
-
+
exp.type = bracketsExp;
exp.list = MkListOne(
// (uint64)
- MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null),
+ MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null),
// ((class.type == structClass) ?
MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("structClass"))))),
// ((byte *)array) + (i) * class.size
MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null), MkExpBrackets(MkListOne(MkExpOp(
- MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer(null, null), null)), CopyExpression(exp.index.exp)))), '+',
+ MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer(null, null), null)), CopyExpression(exp.index.exp)))), '+',
MkExpOp(MkExpBrackets(CopyList(exp.index.index, CopyExpression)), '*', CopyExpression(sizeExp))))))),
// ((class.type == normalClass || class.type == noHeadClass) ?
MkExpCondition(MkExpBrackets(MkListOne(
MkExpOp(
- MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass"))),
+ MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass"))),
OR_OP,
MkExpOp(MkExpMember(classExp, MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("noHeadClass")))))),
// ((void **)array)[i]
- MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null), MkExpIndex(MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, MkPointer(null, null)), null)),
+ MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), null), MkExpIndex(MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, MkPointer(null, null)), null)),
CopyExpression(exp.index.exp)))), CopyList(exp.index.index, CopyExpression)))),
// ((class.size == 1) ?
CopyExpression(exp.index.exp)))), CopyList(exp.index.index, CopyExpression))),
// ((uint64 *)array)[i]
- MkExpIndex(MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer(null, null), null)),
+ MkExpIndex(MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer(null, null), null)),
exp.index.exp))), exp.index.index))))))))))))))))));
-
+
// Add this to the context
thisClass = curExternal.function ? curExternal.function._class : null;
{
type = MkClassType(thisClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
ProcessExpressionType(exp.list->first);
ProcessExpression(exp.list->first);
-
+
//globalContext.symbols.Delete((BTNode)thisSymbol);
globalContext.symbols.Remove((BTNode)thisSymbol);
FreeSymbol(thisSymbol);
OldList * specs = MkList();
Declarator decl = SpecDeclFromString(_class.templateArgs[2].dataTypeString, specs, null);
TypeName typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer(null, null), decl);
- exp.index.exp = MkExpBrackets(MkListOne(MkExpCast(typeName,
+ exp.index.exp = MkExpBrackets(MkListOne(MkExpCast(typeName,
MkExpPointer(MkExpCast(QMkType("BuiltInContainer", QMkPtrDecl(null)), exp.index.exp), MkIdentifier("data")))));
ProcessExpressionType(exp.index.exp);
ProcessExpression(exp);
Context context = PushContext();
sprintf(iteratorType, "Iterator<%s, %s >", _class.templateArgs[2].dataTypeString, _class.templateArgs[1].dataTypeString);
-
+
ListAdd(instMembers, MkMemberInit(null, MkInitializerAssignment(exp.index.exp)));
-
+
ListAdd(declarations, MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)),
MkExpIdentifier(MkIdentifier("__internalIterator")), MkListOne(MkMembersInitList(instMembers)))));
ListAdd(args, MkExpBrackets(exp.index.index));
ListAdd(args, exp.usage.usageSet ? MkExpIdentifier(MkIdentifier("true")) : MkExpIdentifier(MkIdentifier("false")));
-
- ListAdd(statements, MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("__internalIterator")),
+
+ ListAdd(statements, MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("__internalIterator")),
MkIdentifier("Index")), args))));
// ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(null, '&', MkExpIdentifier(MkIdentifier("__internalIterator"))))));
// Cast function to its type
{
Context context = SetupTemplatesContext(method._class);
-
+
decl = SpecDeclFromString(method.dataTypeString, specs, MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer(null, null), null)));
-
+
FinishTemplatesContext(context);
}
curContext = back;
// Testing this (COMMENTED OUT TESTING, CALLING METHODS ON ENUM/UNIT ADDED & IN FRONT OF VARIABLES
/*
- if(memberExp.member.exp.expType.kind != classType ||
+ if(memberExp.member.exp.expType.kind != classType ||
memberExp.member.exp.expType._class.registered.type == enumClass ||
memberExp.member.exp.expType._class.registered.type == unitClass)
{
// THIS WAS NASTY:
// memberExp.member.exp.expType.kind = classType;
// memberExp.member.exp.expType._class = FindClass(typeString);
-
+
FreeType(memberExp.member.exp.expType);
memberExp.member.exp.expType = Type
{
}
}
*/
-
+
if(typedObject && memberExp.member.exp && memberExp.member.exp.expType)
{
bool changeReference = false;
Expression memberExpMemberExp = CopyExpression(memberExp.member.exp);
// Patched so that class isn't considered SYSTEM...
- if(argClass && (argClass.type == enumClass || argClass.type == unitClass || argClass.type == bitClass || argClass.type == systemClass) && strcmp(argClass.fullName, "class") &&
+ if(argClass && (argClass.type == enumClass || argClass.type == unitClass || argClass.type == bitClass || argClass.type == systemClass) && strcmp(argClass.fullName, "class") &&
strcmp(argClass.fullName, "uintptr") && strcmp(argClass.fullName, "intptr"))
changeReference = true;
- if(!memberExp.member.exp.expType.classObjectType &&
+ if(!memberExp.member.exp.expType.classObjectType &&
(((
- (memberExp.member.exp.expType.kind != pointerType &&
- (memberExp.member.exp.expType.kind != classType || !memberExp.member.exp.expType._class ||
+ (memberExp.member.exp.expType.kind != pointerType &&
+ (memberExp.member.exp.expType.kind != classType || !memberExp.member.exp.expType._class ||
!memberExp.member.exp.expType._class.registered || memberExp.member.exp.expType._class.registered.type == structClass)))) ||
method.dataType.byReference)) // ADDED THIS FOR OnGetDataFromString
changeReference = true;
changeReference = true;
if(changeReference)
{
- if(memberExp.member.exp.type == bracketsExp && memberExp.member.exp.list && memberExp.member.exp.list->count == 1 &&
+ if(memberExp.member.exp.type == bracketsExp && memberExp.member.exp.list && memberExp.member.exp.list->count == 1 &&
((Expression)memberExp.member.exp.list->first).type == opExp && ((Expression)memberExp.member.exp.list->first).op.op == '*' && !((Expression)memberExp.member.exp.list->first).op.exp1)
{
exp.call.arguments->Insert(null, ((Expression)memberExp.member.exp.list->first).op.exp2);
if(memberExp.member.exp && memberExp.member.exp.expType && memberExp.member.exp.expType.classObjectType == ClassObjectType::typedObject)
strcpy(className, "class");
else if(cl)
- {
+ {
// Need the class itself here...
strcpy(className, "__ecereClass_");
FullClassNameCat(className, cl.fullName, true);
newExp = checkedExp.op.exp2;
checkedExp.op.exp2 = null;
FreeExpContents(checkedExp);
-
+
if(e.expType && e.expType.passAsTemplate)
{
char size[100];
}
if(parentExp.type == callExp)
- {
+ {
exp.call.arguments->Insert(e.prev, newExp);
exp.call.arguments->Remove(e);
e = newExp;
/*
e.compound = MkCompoundStmt(
- MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalValue")), MkInitializerAssignment(newExp))))),
+ MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalValue")), MkInitializerAssignment(newExp))))),
MkListOne(MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier("__internalValue"))))));
*/
-
+
e.compound.compound.context = context;
PopContext(context);
curContext = context.parent;
newExp = MkExpOp(null, '&', checkedExp);
newExp.byReference = true;
if(parentExp.type == callExp)
- {
+ {
exp.call.arguments->Insert(e.prev, newExp);
exp.call.arguments->Remove(e);
e = newExp;
}
}
}
-
+
if(destType.classObjectType == ClassObjectType::typedObject)
{
char className[1024];
c = MkExpExtensionCompound(MkCompoundStmt(
MkListOne(MkDeclaration(
MkListOne(MkSpecifierName("Instance")),
- MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")),
+ MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_ClassInst")),
MkInitializerAssignment(CopyExpression(e)))))),
MkListOne(MkExpressionStmt(MkListOne(MkExpCondition(
MkExpIdentifier(MkIdentifier("__internal_ClassInst")),
}
if(ellipsisDestType)
{
- if(usedEllipsis ||
- (exp.call.exp.expType && exp.call.exp.expType.kind == functionType && exp.call.exp.expType.params.last &&
+ if(usedEllipsis ||
+ (exp.call.exp.expType && exp.call.exp.expType.kind == functionType && exp.call.exp.expType.params.last &&
((Type)exp.call.exp.expType.params.last).kind == ellipsisType))
{
exp.call.arguments->Insert(exp.call.arguments->last, MkExpCast(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, null),null)),MkExpConstant("0")));
prop = eClass_FindProperty(_class, exp.member.member.string, null);
if(!prop)
prop = eClass_FindProperty(_class, exp.member.member.string, privateModule);
- if(prop && (exp.usage.usageRef ||
+ if(prop && (exp.usage.usageRef ||
(exp.usage.usageGet && !prop.Get && !prop.conversion) ||
(exp.usage.usageDelete && !prop.Set && !prop.conversion)))
{
exp.member.memberType = dataMember;
prop = null;
}
- else
+ else
{
if(exp.usage.usageRef)
Compiler_Error($"cannot obtain address of property\n");
DeclareProperty(prop, setName, getName);
//propertyClass = convertTo ? _class : ((Symbol)prop.symbol)._class;
- propertyClass = convertTo ? _class :
+ propertyClass = convertTo ? _class :
((((Symbol)prop.symbol).type && ((Symbol)prop.symbol).type.kind == classType) ? ((Symbol)prop.symbol).type._class.registered : ((Symbol)prop.symbol)._class);
// Make a declaration in the closest compound statement
// (Do not reuse (since using address for function calls)...)
sprintf(className, "__simpleStruct%d", curContext.simpleID++);
- declarator =
- SpecDeclFromString(propertyClass.dataTypeString, specs,
+ declarator =
+ SpecDeclFromString(propertyClass.dataTypeString, specs,
MkDeclaratorIdentifier(MkIdentifier(className)));
ListAdd(decls, MkInitDeclarator(declarator, null));
else
sprintf(mask, FORMAT64HEX, bitMember.mask);
sprintf(shift, "%d", bitMember.pos);
-
+
FreeIdentifier(exp.member.member);
-
+
// ((type) ((color & mask) >> bitPos))
ListAdd(list, MkExpCast(type, MkExpBrackets(MkListOne(MkExpOp(MkExpBrackets(MkListOne(
- MkExpOp(exp.member.exp, '&', MkExpConstant(mask)))), RIGHT_OP,
+ MkExpOp(exp.member.exp, '&', MkExpConstant(mask)))), RIGHT_OP,
MkExpConstant(shift))))));
exp.type = bracketsExp;
}
else
{
- e = QBrackets(MkExpOp(QMkExpId(ecereTemp), '+',
+ e = QBrackets(MkExpOp(QMkExpId(ecereTemp), '+',
MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
}
compound.compound.context = context;
compound.compound.statements = MkListOne(MkExpressionStmt(MkListOne(
- QBrackets(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(structSpecifier, MkIdentifier(structName), null)),
+ QBrackets(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(structSpecifier, MkIdentifier(structName), null)),
MkDeclaratorPointer(MkPointer(null, null), null)), e)))));
exp.member.exp = MkExpExtensionCompound(compound);
bytePtr = MkExpCast(QMkType("char", QMkPtrDecl(null)), /*CopyExpression(*/exp.member.exp/*)*/);
// DISABLED BECAUSE PREVENTS GETTING ADDRESS OF MEMBERS WITH ADDRESS 0
/*
- e = QBrackets(QMkExpCond(exp.member.exp,
+ e = QBrackets(QMkExpCond(exp.member.exp,
QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(classExp, MkIdentifier("offset")))),
MkExpConstant("0")));
*/
-
+
// if(class.fixed)
if(member._class.fixed)
{
if(argExp)
{
Expression classExp;
-
+
FreeTypeName(exp.typeName);
classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
MkExpCondition(MkExpBrackets(MkListOne(
MkExpOp(
MkExpOp(
- MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP,
- MkExpIdentifier(MkIdentifier("normalClass"))),
+ MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP,
+ MkExpIdentifier(MkIdentifier("normalClass"))),
OR_OP,
MkExpOp(
- MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP,
+ MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP,
MkExpIdentifier(MkIdentifier("noHeadClass"))
)))),
MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer(null, null), null)))),
MkExpMember(classExp, MkIdentifier("typeSize")))
- );
+ );
ProcessExpressionType(exp);
ProcessExpression(exp);
exp.byReference = exp.cast.exp.byReference;
if(exp.expType && exp.expType.kind == classType && exp.expType._class && exp.expType._class.registered && exp.expType._class.registered.type == structClass &&
exp.cast.exp.expType && (exp.cast.exp.expType.kind == pointerType || exp.cast.exp.expType.kind == arrayType || (
- exp.cast.exp.expType.kind == classType && exp.cast.exp.expType._class && exp.cast.exp.expType._class.registered &&
+ exp.cast.exp.expType.kind == classType && exp.cast.exp.expType._class && exp.cast.exp.expType._class.registered &&
!strcmp(exp.cast.exp.expType._class.registered.dataTypeString, "char *")) ) )
exp.byReference = true;
}
char className[1024];
char * string = StringFromSpecDecl(exp._classExp.specifiers, exp._classExp.decl);
Symbol classSym = FindClass(string);
-
+
strcpy(className, "__ecereClass_");
FullClassNameCat(className, string, true); // TODO: Verify this
MangleClassName(className);
if(decl.declarators)
{
InitDeclarator d;
-
+
for(d = decl.declarators->first; d; d = d.next)
{
if(d.initializer)
ProcessStatement(stmt.forStmt.check);
}
if(stmt.forStmt.increment)
- {
+ {
for(exp = stmt.forStmt.increment->first; exp; exp = exp.next)
{
ProcessExpression(exp);
ProcessDeclaration(external.declaration);
}
}
-
+
for(external = ast->first; external; external = external.next)
{
curExternal = external;
type = MkClassType(regClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
for(defProperty = def.defProperties->first; defProperty; defProperty = defProperty.next)
{
//thisClass = regClass;
type = MkClassType(regClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
//thisClass = regClass;
if(prop.setStmt)
{
else if(def.type == propertyWatchClassDef && def.propertyWatch)
{
PropertyWatch propertyWatch = def.propertyWatch;
-
+
// Add this to the context
Symbol thisSymbol
{
type = MkClassType(regClass.fullName);
};
globalContext.symbols.Add((BTNode)thisSymbol);
-
+
//thisClass = regClass;
if(propertyWatch.compound)
{
if(spec.type == templateTypeSpecifier)
{
TemplateParameter parameter = spec.templateParameter;
-
+
if(!param && parameter.dataTypeString)
{
OldList * newSpecs = MkList();
delete newSpec;
}
FreeList(newSpecs, FreeSpecifier);
-
+
if(decl)
{
bool isPointer = decl.type == pointerDeclarator;
*spec = *newSpec;
delete newSpec;
}
-
+
if(decl)
{
bool isPointer = decl.type == pointerDeclarator;
{
if(!_class.dataType)
_class.dataType = ProcessTypeString(_class.dataTypeString, false);
- if(_class.dataType && _class.dataType.kind == classType)
+ if(_class.dataType && _class.dataType.kind == classType)
classSym = _class.dataType._class;
else
classSym = FindClass(_class.dataTypeString);
else
decl = newDecl;
decl.type = pointerDeclarator;
- decl.pointer.pointer = MkPointer(null, null);
+ decl.pointer.pointer = MkPointer(null, null);
*declPtr = decl;
}
}
{
for(e = spec.list->first; e; e = e.next)
{
-
+
}
}
break;
spec.extDecl.s = CopyString("extern __attribute__ ((visibility(\"default\")))");
}
}
- else if(!strcmp(spec.extDecl.s, "stdcall") || !strcmp(spec.extDecl.s, "_stdcall") ||
+ else if(!strcmp(spec.extDecl.s, "stdcall") || !strcmp(spec.extDecl.s, "_stdcall") ||
!strcmp(spec.extDecl.s, "__stdcall") || !strcmp(spec.extDecl.s, "__stdcall__"))
{
delete spec.extDecl.s;
decl.extended.extended.s = CopyString("extern __attribute__ ((visibility(\"default\")))");
}
else if(decl.extended.extended.type == extDeclString && decl.extended.extended.s &&
- (!strcmp(decl.extended.extended.s, "stdcall") || !strcmp(decl.extended.extended.s, "_stdcall") ||
+ (!strcmp(decl.extended.extended.s, "stdcall") || !strcmp(decl.extended.extended.s, "_stdcall") ||
!strcmp(decl.extended.extended.s, "__stdcall") || !strcmp(decl.extended.extended.s, "__stdcall__")))
{
delete decl.extended.extended.s;
else
{
Symbol classSym = (spec.type == nameSpecifier) ? spec.symbol /*FindClass(spec.name)*/ : null;
- if(type.classObjectType && (!classSym || (classSym && classSym.registered &&
+ if(type.classObjectType && (!classSym || (classSym && classSym.registered &&
(classSym.registered.type == enumClass || classSym.registered.type == bitClass || classSym.registered.type == unitClass))))
ReplaceByInstancePtr(spec, &type.declarator, 2);
}
if(!stmt.compound.isSwitch)
curContext = stmt.compound.context;
-
+
if(stmt.compound.declarations)
{
for(decl = stmt.compound.declarations->first; decl; decl = decl.next)
else if(external.type == declarationExternal)
{
if(external.declaration)
- InstDeclPassDeclaration(external.declaration);
+ InstDeclPassDeclaration(external.declaration);
}
}
}
}
if(baseDecl)
{
- if(base.declarator)
+ if(base.declarator)
FreeDeclarator(base.declarator);
base.declarator = baseDecl;
}
for(i = 0; (ch = source[i]); i++)
{
len++;
- if(ch == '\"' || ch == '\\')
+ if(ch == '\"' || ch == '\\')
len++;
}
/* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
-
+
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Foundation, Inc.
-
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
# define YYMAXDEPTH 10000
#endif
-\f
+
#if YYERROR_VERBOSE
}
}
#endif /* YYERROR_VERBOSE */
-\f
+
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
{
(yyval.specifier) = null;
DeclClass(0, (yyvsp[(1) - (2)].id).string);
- fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
+ fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
resetScannerPos(&(yylsp[(1) - (2)]).start);
yyclearin;
-
+
FreeIdentifier((yyvsp[(1) - (2)].id));
YYPOPSTACK(1);
FreeIdentifier((yyvsp[(1) - (2)].id));
- fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
+ fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
resetScannerPos(&(yylsp[(1) - (2)]).start);
yyclearin;
#line 278 "type.y"
{
DeclClass(0, (yyvsp[(1) - (2)].id).string);
- fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
+ fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
parseTypeError = 0;
resetScannerPos(&(yylsp[(1) - (2)]).start);
yyclearin;
{
#ifdef PRECOMPILER
DeclClass(0, (yyvsp[(1) - (2)].id).string);
- fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
+ fileInput.Seek((yylsp[(1) - (2)]).start.pos, start);
resetScannerPos(&(yylsp[(1) - (2)]).start);
yyclearin;
YY_STACK_PRINT (yyss, yyssp);
goto yysetstate;
#else
- Location tmpLoc = yylloc; (yyval.specifier) = (yyvsp[(2) - (2)].id); yylloc = (yylsp[(1) - (2)]);
- Compiler_Error($"Not a type: %s\n", (yyvsp[(1) - (2)].id).string);
+ Location tmpLoc = yylloc; (yyval.specifier) = (yyvsp[(2) - (2)].id); yylloc = (yylsp[(1) - (2)]);
+ Compiler_Error($"Not a type: %s\n", (yyvsp[(1) - (2)].id).string);
yylloc = tmpLoc; (yyvsp[(2) - (2)].id).badID = (yyvsp[(1) - (2)].id); // FreeIdentifier($1);
#endif
;}
(yyval.specifier).loc = (yyloc);
(yylsp[(4) - (4)]).end.pos--;
- fileInput.Seek((yylsp[(4) - (4)]).end.pos, start);
+ fileInput.Seek((yylsp[(4) - (4)]).end.pos, start);
resetScannerPos(&(yylsp[(4) - (4)]).end);
yyclearin;
;}
/* Line 1464 of yacc.c */
#line 934 "type.y"
{
- (yyval.templateArgument) = (yyvsp[(3) - (3)].templateArgument);
+ (yyval.templateArgument) = (yyvsp[(3) - (3)].templateArgument);
if((yyvsp[(1) - (3)].templateDatatype).specifiers && (yyvsp[(1) - (3)].templateDatatype).specifiers->first)
{
Specifier spec = (yyvsp[(1) - (3)].templateDatatype).specifiers->first;
/* Line 1464 of yacc.c */
#line 958 "type.y"
{
- (yyval.templateArgument) = (yyvsp[(3) - (3)].templateArgument);
+ (yyval.templateArgument) = (yyvsp[(3) - (3)].templateArgument);
if((yyvsp[(1) - (3)].templateDatatype).specifiers && (yyvsp[(1) - (3)].templateDatatype).specifiers->first)
{
Specifier spec = (yyvsp[(1) - (3)].templateDatatype).specifiers->first;
/* Line 1464 of yacc.c */
#line 1349 "type.y"
- {
- (yyval.initializer) = MkInitializerList((yyvsp[(2) - (4)].list));
- (yyval.initializer).loc = (yyloc);
+ {
+ (yyval.initializer) = MkInitializerList((yyvsp[(2) - (4)].list));
+ (yyval.initializer).loc = (yyloc);
{
Expression exp = MkExpDummy();
Initializer init = MkInitializerAssignment(exp);
init.loc = (yylsp[(3) - (4)]);
exp.loc = (yylsp[(3) - (4)]);
- ListAdd((yyvsp[(2) - (4)].list), init);
+ ListAdd((yyvsp[(2) - (4)].list), init);
}
;}
break;
/* Line 1464 of yacc.c */
#line 1437 "type.y"
- {
- (yyval.stmt) = MkCompoundStmt(null, null);
- (yyval.stmt).compound.context = PushContext();
+ {
+ (yyval.stmt) = MkCompoundStmt(null, null);
+ (yyval.stmt).compound.context = PushContext();
PopContext((yyval.stmt).compound.context);
- (yyval.stmt).loc = (yyloc);
+ (yyval.stmt).loc = (yyloc);
;}
break;
enum CodeObjectType { typeClass, typeData, typeMethod, typeEvent, typeProperty, typeNameSpace, typeDataType, typeEnumValue, typeDataPrivate, typeMethodPrivate, typePropertyPrivate };
-static char * iconNames[CodeObjectType] =
+static char * iconNames[CodeObjectType] =
{
"<:ecere>constructs/class.png",
"<:ecere>constructs/data.png",
DocPrintType(type.returnType, string, false, fullName);
strcat(string, " ");
}
-
+
// DANGER: Testing This
if(printName)
{
strcat(size, arrayType.enumClass.string);
else if(arrayType.arraySizeExp)
PrintExpression(arrayType.arraySizeExp, size);
- //sprintf(string, "%s[%s]", baseType, size);
+ //sprintf(string, "%s[%s]", baseType, size);
strcat(size, "]");
arrayType = arrayType.arrayType;
strcpy(size, type.enumClass.string);
else if(type.arraySizeExp)
PrintExpression(type.arraySizeExp, size);
- //sprintf(string, "%s[%s]", baseType, size);
+ //sprintf(string, "%s[%s]", baseType, size);
strcat(string, baseType);
strcat(string, "[");
- strcat(string, size);
+ strcat(string, size);
strcat(string, "]");
*/
case example: strcat(fileName, "example"); break;
case seeAlso: strcat(fileName, "seeAlso"); break;
case returnValue: strcat(fileName, "returnValue"); break;
- case enumerationValue:
+ case enumerationValue:
strcat(fileName, "enumeration values/");
strcat(fileName, ((NamedLink)data).name);
break;
{
return module;
}
-
+
NameSpace * GetNameSpace()
{
return nameSpace;
strcpy(nsName, temp);
ns = ns->parent;
}
- if(nsName[0])
+ if(nsName[0])
f.Printf($"Parent namespace: <a href=\"api://%p\" style=\"text-decoration: none;\">%s</a><br>\n", nameSpace->parent, nsName);
f.Printf("<br>");
f.Printf("<FONT FACE=\"Arial\" SIZE=\"6\">%s</FONT><br><br>\n", name);
f.Printf($"Module: <a href=\"api://%p\" style=\"text-decoration: none;\">%s</a><br>\n", (module && module.name) ? module : null, (!module || !module.name || !strcmp(nsName, "ecere::com")) ? "ecereCOM" : module.name);
- if(nsName[0])
+ if(nsName[0])
f.Printf($"Namespace: <a href=\"api://%p\" style=\"text-decoration: none;\">%s</a><br>\n", cl.nameSpace, nsName);
{
}
f.Printf($"Type: %s<br>\n", classType);
}
-
+
if(cl.type != systemClass && cl.base)
{
f.Printf($"Base Class: ");
if(enumeration.values.first)
{
NamedLink item;
-
+
f.Printf($"<a name=EnumerationValues></a><H3>Enumeration Values</H3><br><br>\n");
f.Printf("<TABLE>\n");
}
else
dataClass = base;
-
+
f.Printf("<TR>");
f.Printf("<TD valign=top height=22 nowrap=1><a name=%p></a><img valign=center src=\"%s\"> %s</TD>", item, iconNames[typeEnumValue], item.name);
if(dataClass.type == systemClass)
if(name) name += 2; else name = prop.name;
f.Printf("<TR>");
-
+
string[0] = 0;
DocPrintType(type, string, true, false);
-
+
f.Printf("<TD valign=top height=22 nowrap=1><a name=%p></a><img valign=center src=\"%s\"> %s</TD>", prop, iconNames[typeDataType], string);
if(desc)
{
f.Printf("<TD valign=top height=22>%s</TD>", desc);
delete desc;
}
-
+
f.Printf("</TR>\n");
-
+
FreeType(type);
}
}
f.Printf("<TD valign=top height=22>%s</TD>", desc);
delete desc;
}
-
+
f.Printf("</TR><br>\n");
}
}
delete remarksDoc;
}
}
-
+
if(cl.type != systemClass)
{
bool first = true;
f.Printf("<TD valign=top height=22>%s </TD>\n", desc);
delete desc;
}
-
+
f.Printf("</TR>\n");
}
}
}
else
f.Printf("<br>%s\n", method, seeAlsoDoc);
-
+
f.Printf("<br><br>\n");
delete seeAlsoDoc;
}
APIPage page;
char fileName[MAX_LOCATION];
-
+
strcpy(nsName, parentName ? parentName : "");
if(nameSpace->name)
{
{
for(nameSpace = mainNameSpace ; nameSpace; nameSpace = (nameSpace == mainNameSpace) ? comNameSpace : null)
{
- if(nameSpace->functions.first)
+ if(nameSpace->functions.first)
{
BTNamedLink link;
GlobalFunction fn;
}
}
}
-
+
if(mainNameSpace.defines.first || (comNameSpace && comNameSpace.defines.first))
{
for(nameSpace = mainNameSpace ; nameSpace; nameSpace = (nameSpace == mainNameSpace) ? comNameSpace : null)
}
else
f.Printf("<TD valign=top height=22></TD>");
-
+
if(member.type != normalMember)
{
DataMember subMember;
FreeExcludedSymbols(excludedSymbols);
::defines.Free(FreeModuleDefine);
imports.Free(FreeModuleImport);
-
+
FreeGlobalData(globalData);
FreeTypeData(componentsApp);
FreeIncludeFiles();
if(extension[0] && strcmpi(extension, "so") && strcmpi(extension, "dll"))
componentsApp.name = CopyString(filePath);
-
+
for(module = componentsApp.allModules.first; module; module = module.next)
{
if(module.name && (!strcmp(module.name, "ecere") || !strcmp(module.name, "ecereCOM")))
}
else if(!view.created)
view.Create();
-
+
{
page = row.GetData(null);
if(page && page.page)
len = (nextSpace - (text + textPos)) + 1;
else
len = textBlock.textLen - textPos;
-
+
display.FontExtent(textBlock.font.font, text + textPos, len, &w, &th);
if(x + width + w > maxW && x > 0)
len = (nextSpace - (text + textPos)) + 1;
else
len = textBlock.textLen - textPos;
-
+
display.FontExtent(textBlock.font.font, text + textPos, len, &w, &th);
if(x + width + w > maxW && x > 0)
Update(null);
PositionCaret(false);
return false;
- }
+ }
else if(textPos == textBlock.textLen && textBlock.next && textBlock.next.next)
{
startPos = 0;
sx = textBlock.startX;
}
}
-
+
/*if(textBlock.next && textBlock.next.next)
{
textBlock = textBlock.next.next;
break;
}
}
- // No next word found,
+ // No next word found,
if(!found && (c != curPosition || line != textBlock))
{
found = true;
}
}
}
- // No next word found,
+ // No next word found,
if(!found && curPosition > 0)
{
foundAlpha = true;
textBlock.text = renew textBlock.text char[textBlock.textLen + len + 1];
memmove(textBlock.text + curPosition + len, textBlock.text + curPosition, textBlock.textLen - curPosition + 1);
-
+
for(c = 0; c<len; c++)
{
textBlock.text[curPosition] = string[c];
}
selPosition = curPosition;
selBlock = textBlock;
-
+
{
//Clear(html.block);
//CreateForms(html.block);
}
else
maxW = clientSize.w - 10 - sx;
-
+
display.FontExtent(textBlock.font.font, " ", 1, null, &th);
while(textPos < textBlock.textLen)
len = (nextSpace - (text + textPos)) + 1;
else
len = textBlock.textLen - textPos;
-
+
display.FontExtent(textBlock.font.font, text + textPos, len, &w, &th);
if(x + width + w > maxW && x > 0)
}
else
maxW = clientSize.w - 10 - sx;
-
+
display.FontExtent(textBlock.font.font, " ", 1, &space, &th);
//space = space/2+2;
space = 2;
len = (nextSpace - (text + textPos)) + 1;
else
len = textBlock.textLen - textPos;
-
+
display.FontExtent(textBlock.font.font, text + textPos, len, &w, &th);
sx = x + textBlock.startX;
if(os == win32) // if Windows OS then
{
char programFilesDir[MAX_LOCATION];
- char appData[MAX_LOCATION];
+ char appData[MAX_LOCATION];
char homeDrive[MAX_LOCATION];
char winDir[MAX_LOCATION];
GetEnvironment("APPDATA", appData, sizeof(appData));
tabCycle = true;
size = { 436, 120 };
anchor = { horz = -83, vert = -104 };
-
+
Label docLabel { this, text = $"Documentation Path:", anchor = { left = 16, top = 16 }, labeledWindow = pathEditBox };
- Button browseBtn
- {
+ Button browseBtn
+ {
this, text = "...", font = { $"Tahoma", 8.25f, bold = true }, hotKey = f2;
anchor = { right = 20, top = 16 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
pathEditBox.contents = settingsFileDialog.filePath; // display the selected directory in the edit box
}
return true;
- }
+ }
};
FileDialog settingsFileDialog
type = selectDir, text = $"Select a path"; // set the file dialog box to choose a directory instead of a file.
};
- Button saveBtn
- {
+ Button saveBtn
+ {
this, text = $"Save", size = { 68, 21 }, position = { 224, 56 }, isDefault = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
settingsContainer.Save(); // write that path to the ini file
Destroy(DialogResult::ok); // close the window
return true;
- }
+ }
};
- Button cancelBtn
- {
+ Button cancelBtn
+ {
this, text = $"Cancel", size = { 68, 21 }, position = { 304, 56 }, hotKey = escape;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
strcat(string, "\n");
Log(string);
}
-
+
while(listing.Find())
{
char timeString[100]; //28]; I18n strings take up more characters
strcat(string, $"\n Modified: ");
strcat(string, timeString);
strcat(string, "\n");
-
+
if(listing.stats.attribs.isDirectory)
ViewArchive(listing.path);
else
bool doMove = false;
SplitArchivePath(sourcePath, archiveName, &source);
-
+
GetLastDirectory(source, sourceFileName);
StripLastDirectory(source, sourceDirectory);
{
// If directory exists in destination directory, move files and then delete
outputExists = FileExists(existingFilePath);
-
+
// If source is a directory
if(exists.isDirectory)
{
bool within = true;
char outputPart[MAX_FILENAME], outputRest[MAX_LOCATION];
char sourcePart[MAX_FILENAME], sourceRest[MAX_LOCATION];
-
+
strcpy(outputRest, outputDirectory);
strcpy(sourceRest, source);
{
ArchiveDir input;
FileListing listing { sourcePath };
-
+
if(!source[0])
{
ArchiveDir dir;
}
}
else if(!rootMoving)
- Logf($"Merging directory %s in %s with %s in %s.\n",
- sourceFileName,
+ Logf($"Merging directory %s in %s with %s in %s.\n",
+ sourceFileName,
sourceDirectory[0] ? sourceDirectory : "root",
sourceFileName,
outputDirectory[0] ? outputDirectory : "root");
-
+
while(listing.Find())
{
if(strcmp(listing.path, existingFilePath))
if(outputExists.isFile)
output.Delete(sourceFileName);
- Logf($"Moving file %s in directory %s to %s.\n", sourceFileName,
- sourceDirectory[0] ? sourceDirectory : "root",
+ Logf($"Moving file %s in directory %s to %s.\n", sourceFileName,
+ sourceDirectory[0] ? sourceDirectory : "root",
outputDirectory[0] ? outputDirectory : "root");
// Perform operation
int c;
quiet = false;
-
+
DumpErrors(false);
SetLoggingMode(stdOut, null);
{
// First validate command / options
char ch;
-
+
valid = true;
for(c = 0; (ch = (char)tolower(argv[1][c])) && valid; c++)
{
numFiles = argc - 3;
firstFileArg = 3;
break;
- case ARCHIVE_ACTION_EXTRACT:
+ case ARCHIVE_ACTION_EXTRACT:
firstFileArg = 3;
if(extractWhere)
numFiles = argc - 4;
Logf($"Archive file is empty: %s\n", argv[2]);
action = 0;
}
- else
+ else
{
Archive archive = ArchiveOpen(argv[2], { false });
if(archive)
switch(action)
{
case ARCHIVE_ACTION_VIEW:
- {
+ {
if(!numFiles)
ViewArchive(archivePath);
else
strcpy(outputFile, DIR_SEPS);
StripLastDirectory(outputFile, directory);
-
+
MakeDir(directory);
ExtractFileFromArchive(fileName, outputFile);
}
else
StripLastDirectory(argv[c], directory);
-
+
dir = archive.OpenDirectory(directory, extractWhere ? &stats : null, addMode);
if(dir)
{
if(archive)
{
char fileName[MAX_LOCATION];
-
+
for(c = firstFileArg; c<firstFileArg + numFiles; c++)
{
strcpy(fileName, archivePath);
FileGetSize(path, &dataSize);
GetLastDirectory(outputFile, fileName);
progressBar.statusBar.SetText($"Extracting %s...", fileName);
-
+
app.UpdateDisplay();
for(c = 0; c<dataSize; c += BUFFERSIZE)
row.SetData(cField, c);//(void *)stats.created.local);
}
}
-
+
while(listing.Find())
{
if(strcmp(listing.path, "<:>ecere"))
SetLoggingMode(stdOut, null);
SelfExtract { text = title };
-
+
GuiApplication::Main();
}
}
private:
void Free(void (*FreeKey)(void * key))
- {
+ {
if (left) left.Free(FreeKey);
if (right) right.Free(FreeKey);
if(FreeKey) FreeKey((void *)key);
}
}
- //if(!swap.left)
+ //if(!swap.left)
{
swap.left = left;
if(left)
left.parent = swap;
}
- //if(!swap.right)
+ //if(!swap.right)
{
swap.right = right;
if (right)
return parent.Rebalance();
else
return null;
- }
+ }
BTNode RemoveSwapRight()
{
#define NUMSIZE 4
- char * Print(char * output, TreePrintStyle tps)
+ char * Print(char * output, TreePrintStyle tps)
{
switch(tps)
{
if(tps == postOrder) strcatf(output, "%d ", key);
- return output;
+ return output;
}
case depthOrder:
{
return null;
}
- void PrintDepth(char * output, int wantedDepth, int curDepth, int maxDepth, bool last)
+ void PrintDepth(char * output, int wantedDepth, int curDepth, int maxDepth, bool last)
{
int c;
if(wantedDepth == curDepth)
int (*CompareKey)(BinaryTree tree, uintptr a, uintptr b);
void (*FreeKey)(void * key);
-
+
void Free()
{
if(root)
root = null;
count = 0;
}
-
+
bool Add(BTNode node)
{
if(!CompareKey) CompareKey = CompareInt;
delete voidNode;
}
- char * Print(char * output, TreePrintStyle tps)
+ char * Print(char * output, TreePrintStyle tps)
{
output[0] = 0;
if(root) root.Print(output, tps);
char * name;
};
public class OldLink : struct
-{
+{
public:
OldLink prev, next;
void * data;
#endif
link.prev = last;
- if(link.prev)
+ if(link.prev)
((Item) ((byte *)link.prev + offset)).next = item;
if(!first) first = item;
last = item;
if(link.prev)
((Item) ((byte *)link.prev + offset)).next = link.next;
- if(link.next)
+ if(link.next)
((Item) ((byte *)link.next + offset)).prev = link.prev;
if(circ && last == first)
last = first = null;
Item link = (Item) ((byte *)item + offset);
next = link.next;
- if(freeFn)
+ if(freeFn)
freeFn(item);
delete item;
Item link = (Item) ((byte *)item + offset);
next = link.next;
- if(freeFn)
+ if(freeFn)
freeFn(item);
// Handle list->circular linked lists
Item link = (Item) ((byte *)item + offset);
Item prevLink = (Item) ((byte *)prevItem + offset);
- if(prevItem != item && (first != item || prevItem))
+ if(prevItem != item && (first != item || prevItem))
{
- if(link.prev)
+ if(link.prev)
((Item)((byte *)link.prev + offset)).next = link.next;
- if(link.next)
+ if(link.next)
((Item)((byte *)link.next + offset)).prev = link.prev;
if(item == first) first = link.next;
if(item == last) last = link.prev;
-
- if(prevItem == last)
+
+ if(prevItem == last)
last = item;
-
+
link.prev = prevItem ? prevItem : (circ ? last : null);
if(prevItem)
{
link.next = item;
}
}
- if(link.next)
+ if(link.next)
((Item) ((byte *)link.next + offset)).prev = item;
}
}
link1.next = link2.next;
link2.prev = prev1;
link2.next = next1;
-
+
if(first == tmp1) first = item2;
else if(first == tmp2) first = item1;
list2.offset = offset;
list1.circ = circ;
list2.circ = circ;
-
+
list1.first = first;
list1.last = middle;
list2.first = ((Item)((byte *)middle + offset)).next;
for(;(ch = string[c]) && (ch != '/' && ch != '\\'); c++)
{
if(len < MAX_FILENAME)
- part[len++] = ch;
+ part[len++] = ch;
}
}
for(;(ch = string[c]) && (ch == '/' || ch == '\\'); c++);
memmove(rest, string + c, strlen(string + c) + 1);
for(c = strlen(rest); c >= 0; c--)
- if(ch != '/' && ch != '\\')
+ if(ch != '/' && ch != '\\')
break;
if(c > 0)
rest[c] = '\0';
len = strlen(output);
if(len > 1 && (output[len-1] == '\\' || output[len-1] == '/'))
- output[len-1] = '\0';
+ output[len-1] = '\0';
return output;
}
int len = 0;
char ch;
int count;
-
+
for(;(ch = addedPath[c]) && (ch == '/' || ch == '\\'); c++);
for(;(ch = addedPath[c]) && (ch != '/' && ch != '\\'); c++)
{
break;
}
if(len < MAX_FILENAME)
- directory[len++] = ch;
+ directory[len++] = ch;
}
directory[len] = '\0';
int len = 0;
char ch;
int count;
-
+
for(;(ch = addedPath[c]) && (ch == '/' || ch == '\\'); c++);
for(;(ch = addedPath[c]) && (ch != '/' && ch != '\\'); c++)
{
break;
}
if(len < MAX_FILENAME)
- directory[len++] = ch;
+ directory[len++] = ch;
}
directory[len] = '\0';
destination[0] = '\0';
for(;toRest[0];)
{
- SplitDirectory(toRest, toPart, toRest);
+ SplitDirectory(toRest, toPart, toRest);
if(!different)
SplitDirectory(pathRest, pathPart, pathRest);
{
if(matchWord)
{
- if(!strcompare(ptr,subStr,subLen) &&
+ if(!strcompare(ptr,subStr,subLen) &&
/*
- !IS_ALUNDER(ptr[subLen]) &&
+ !IS_ALUNDER(ptr[subLen]) &&
!IS_ALUNDER(beforeChar))
*/
- (!IS_ALUNDER(subStr[subLen-1]) || !IS_ALUNDER(ptr[subLen])) &&
+ (!IS_ALUNDER(subStr[subLen-1]) || !IS_ALUNDER(ptr[subLen])) &&
(!IS_ALUNDER(subStr[0]) || !IS_ALUNDER(beforeChar)))
return ptr;
}
return ptr;
}
}
- beforeChar = ptr[0];
+ beforeChar = ptr[0];
}
}
return null;
{
if(matchWord)
{
- if(!strcompare(ptr1,subStr,subLen) &&
+ if(!strcompare(ptr1,subStr,subLen) &&
//!IS_ALUNDER(ptr1[subLen]) && !IS_ALUNDER(*ptr2))
- (!IS_ALUNDER(subStr[subLen-1]) || !IS_ALUNDER(ptr1[subLen])) &&
+ (!IS_ALUNDER(subStr[subLen-1]) || !IS_ALUNDER(ptr1[subLen])) &&
(!IS_ALUNDER(subStr[0]) || !IS_ALUNDER(*ptr2)))
return ptr1;
{
c++;
//result = false;
- break;
+ break;
}
(*buffer)++;
}
array = renew array T[count];
// TOFIX: Precomp fails on (BuiltInContainer *)
- if((source._class == class(BuiltInContainer) && ((struct BuiltInContainer *)source)->type.type != structClass ) ||
+ if((source._class == class(BuiltInContainer) && ((struct BuiltInContainer *)source)->type.type != structClass ) ||
eClass_IsDerived(source._class, class(Array)))
{
memcpy(array, ((Array)source).array, count * Tsize);
{
T data = *(T*)item;
delete data;
- Remove(item);
+ Remove(item);
}
};
virtual IteratorPointer GetLast() { return (IteratorPointer)(data ? ((byte *)data + (count * type.typeSize) - 1) : null); }
virtual IteratorPointer GetPrev(IteratorPointer pointer)
{
- return (IteratorPointer)((pointer && (byte *)pointer > (byte *)data) ?
+ return (IteratorPointer)((pointer && (byte *)pointer > (byte *)data) ?
((byte *)pointer - ((type.type == noHeadClass || type.type == normalClass) ? sizeof(void *) : type.typeSize)) : null);
}
virtual IteratorPointer GetNext(IteratorPointer pointer)
{
- return (IteratorPointer)((pointer && (byte *)pointer < (byte *)data + (count - 1) *
- ((type.type == noHeadClass || type.type == normalClass) ? sizeof(void *) : type.typeSize) ?
+ return (IteratorPointer)((pointer && (byte *)pointer < (byte *)data + (count - 1) *
+ ((type.type == noHeadClass || type.type == normalClass) ? sizeof(void *) : type.typeSize) ?
((byte *)pointer + ((type.type == noHeadClass || type.type == normalClass) ? sizeof(void *) : type.typeSize)) : null);
}
virtual uint64 GetData(IteratorPointer pointer)
{
uint64 * item = (uint64 *)pointer;
- return ((((type.type == structClass) ? ((uint64)item) :
- (type.type == normalClass || type.type == noHeadClass) ? (uint64)*((void **)item) :
- ((type.typeSize == 1) ? *((unsigned char *)item) :
- ((type.typeSize == 2) ? *((unsigned short *)item) :
+ return ((((type.type == structClass) ? ((uint64)item) :
+ (type.type == normalClass || type.type == noHeadClass) ? (uint64)*((void **)item) :
+ ((type.typeSize == 1) ? *((unsigned char *)item) :
+ ((type.typeSize == 2) ? *((unsigned short *)item) :
((type.typeSize == 4) ? *((unsigned int *)item) : *((uint64 *)item)))))));
}
virtual bool SetData(IteratorPointer pointer, uint64 data)
}
virtual IteratorPointer GetAtPosition(uint64 pos, bool create)
{
- return data ? (IteratorPointer)((byte *)data +
+ return data ? (IteratorPointer)((byte *)data +
((type.type == noHeadClass || type.type == normalClass) ? sizeof(void *) : type.typeSize)) : null;
}
virtual IteratorPointer Insert(IteratorPointer after, uint64 value)
{
uint64 data = GetData(i);
Class Dclass = type;
- int result = ((int (*)(void *, void *, void *))(void *)Dclass._vTbl[__ecereVMethodID_class_OnCompare])(Dclass,
+ int result = ((int (*)(void *, void *, void *))(void *)Dclass._vTbl[__ecereVMethodID_class_OnCompare])(Dclass,
((Dclass.type == systemClass && !Dclass.byValueSystemClass) || Dclass.type == bitClass || Dclass.type == enumClass || Dclass.type == unitClass) ? &value : (void *)value,
((Dclass.type == systemClass && !Dclass.byValueSystemClass) || Dclass.type == bitClass || Dclass.type == enumClass || Dclass.type == unitClass) ? &data : (void *)data);
if(!result)
}
return null;
}
-
+
virtual void FreeIterator(IteratorPointer it);
virtual int GetCount() { return count; }
delete this;
}
}
-
+
void OnCopy(Container<T> source)
{
if(source)
}
virtual void FreeIterator(IteratorPointer it);
-
+
virtual int GetCount()
{
int count = 0;
char * result;
itemString[0] = '\0';
-
+
result = ((char *(*)(void *, void *, char *, void *, bool *))(void *)Dclass._vTbl[__ecereVMethodID_class_OnGetString])(Dclass,
((Dclass.type == systemClass && !Dclass.byValueSystemClass) || Dclass.type == bitClass || Dclass.type == enumClass || Dclass.type == unitClass) ? &data : (void *)data, itemString, null, null);
if(!first) strcat(tempString, ", ");
- strcat(tempString, result);
+ strcat(tempString, result);
first = false;
}
}
{
D data = GetData(i);
Class Eclass = isNormalClass ? ((Instance)data)._class : Dclass;
- ((void (*)(void *, void *, void *))(void *)Eclass._vTbl[__ecereVMethodID_class_OnSerialize])(Eclass,
+ ((void (*)(void *, void *, void *))(void *)Eclass._vTbl[__ecereVMethodID_class_OnSerialize])(Eclass,
((Dclass.type == systemClass && !Dclass.byValueSystemClass) || Dclass.type == bitClass || Dclass.type == enumClass || Dclass.type == unitClass) ? &data : (void *)data, channel);
}
}
private:
void Free()
- {
+ {
if (left) left.Free();
if (right) right.Free();
delete this;
while(true)
{
// *** NEED COMPARISON OPERATOR SUPPORT HERE INVOKING OnCompare, AS WELL AS TYPE INFORMATION PASSED ***
- int result = ((int (*)(void *, void *, void *))(void *)Tclass._vTbl[__ecereVMethodID_class_OnCompare])(Tclass,
+ int result = ((int (*)(void *, void *, void *))(void *)Tclass._vTbl[__ecereVMethodID_class_OnCompare])(Tclass,
((Tclass.type == systemClass && !Tclass.byValueSystemClass) || Tclass.type == bitClass || Tclass.type == enumClass || Tclass.type == unitClass || Tclass.type == structClass) ? (((byte *)&(uint64)node.key) + __ENDIAN_PAD((Tclass.type == structClass) ? sizeof(void *) : Tclass.typeSize)) : (void *)node.key,
((Tclass.type == systemClass && !Tclass.byValueSystemClass) || Tclass.type == bitClass || Tclass.type == enumClass || Tclass.type == unitClass || Tclass.type == structClass) ? (((byte *)&(uint64)key) + __ENDIAN_PAD((Tclass.type == structClass) ? sizeof(void *) : Tclass.typeSize)) : (void *)key);
if(!result)
while(this)
{
// *** NEED COMPARISON OPERATOR SUPPORT HERE INVOKING OnCompare, AS WELL AS TYPE INFORMATION PASSED ***
- int result = ((int (*)(void *, void *, void *))(void *)Tclass._vTbl[__ecereVMethodID_class_OnCompare])(Tclass,
+ int result = ((int (*)(void *, void *, void *))(void *)Tclass._vTbl[__ecereVMethodID_class_OnCompare])(Tclass,
((Tclass.type == systemClass && !Tclass.byValueSystemClass) || Tclass.type == bitClass || Tclass.type == enumClass || Tclass.type == unitClass) ? (((byte *)&(uint64)key) + __ENDIAN_PAD(Tclass.typeSize)) : (void *)key,
((Tclass.type == systemClass && !Tclass.byValueSystemClass) || Tclass.type == bitClass || Tclass.type == enumClass || Tclass.type == unitClass || Tclass.type == structClass) ? (((byte *)&(uint64)this.key) + __ENDIAN_PAD((Tclass.type == structClass) ? sizeof(void *) : Tclass.typeSize)) : (void *)this.key);
if(result < 0)
return parent.Rebalance();
else
return null;
- }
+ }
thisclass RemoveSwapRight()
{
Class Tclass = class(BT).templateArgs[0].dataTypeClass;
if(!Tclass)
{
- Tclass = class(BT).templateArgs[0].dataTypeClass =
+ Tclass = class(BT).templateArgs[0].dataTypeClass =
eSystem_FindClass(__thisModule.application, class(BT).templateArgs[0].dataTypeString);
}
if(root.Add(Tclass /*class(BT).templateArgs[0].dataTypeClass*/, node))
if(item)
{
item.link.prev = last;
- if(item.link.prev)
+ if(item.link.prev)
item.link.prev.link.next = item;
if(!first) first = item;
last = item;
item.link.prev.link.next = item;
else
item.link.next = item;
- }
+ }
}
if(prevItem == last) last = item;
if(item.link.next)
{
if(item.link.prev)
item.link.prev.link.next = item.link.next;
- if(item.link.next)
+ if(item.link.next)
item.link.next.link.prev = item.link.prev;
if(circ && last == first)
last = first = null;
LT prevItem = (LT)_prevItem;
if(item)
{
- if(prevItem != item && (first != item || prevItem))
+ if(prevItem != item && (first != item || prevItem))
{
- if(item.link.prev)
+ if(item.link.prev)
item.link.prev.link.next = item.link.next;
- if(item.link.next)
+ if(item.link.next)
item.link.next.link.prev = item.link.prev;
if(item == first) first = item.link.next;
if(item == last) last = item.link.prev;
-
- if(prevItem == last)
+
+ if(prevItem == last)
last = item;
-
+
item.link.prev = prevItem ? prevItem : (circ ? last : null);
if(prevItem)
{
item.link.next = item;
}
}
- if(item.link.next)
+ if(item.link.next)
item.link.next.link.prev = item;
}
}
void Delete(Link link)
{
D data = GetData(link);
- delete data;
+ delete data;
Remove(link);
}
while(item = first)
{
D data = GetData(item);
- delete data;
+ delete data;
Remove(item);
}
}
}
property V value
{
- get { return container.GetData(pointer); }
+ get { return container.GetData(pointer); }
set { container.SetData(pointer, value); }
}
};
if(class(MT).type == structClass || class(V).type == structClass)
{
uint size = sizeof(class MapNode<MT, V>);
-
+
if(class(MT).type == structClass) size += class(MT).typeSize - sizeof(node.AVLNode::key);
if(class(V).type == structClass) size += class(V).typeSize - sizeof(*&node.value);
node = (MapNode<MT, V>)new0 byte[size];
if(memberType.type == structClass || memberType.type == normalClass || memberType.type == noHeadClass)
{
- memberResult = ((int (*)(void *, void *, void *))(void *)memberType._vTbl[__ecereVMethodID_class_OnCompare])(memberType,
- (byte *)data1 + member.offset,
+ memberResult = ((int (*)(void *, void *, void *))(void *)memberType._vTbl[__ecereVMethodID_class_OnCompare])(memberType,
+ (byte *)data1 + member.offset,
(byte *)data2 + member.offset);
if(memberResult)
return memberResult;
}
else
{
- memberResult = DataMember_OnCompare(member,
- (byte *)data1 + member.offset,
+ memberResult = DataMember_OnCompare(member,
+ (byte *)data1 + member.offset,
(byte *)data2 + member.offset);
if(memberResult)
return memberResult;
if(member.isProperty || member.type == normalMember)
{
Class memberType = member.dataTypeClass;
-
+
if(!memberType)
memberType = member.dataTypeClass = eSystem_FindClass(module, member.dataTypeString);
/*
if(memberType.type == normalClass || memberType.type == noHeadClass)
{
// TESTING THIS!
- memberResult = ((int (*)(void *, void *, void *))(void *)memberType._vTbl[__ecereVMethodID_class_OnCompare])(memberType,
- *(void **)((byte *)data1 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset)),
+ memberResult = ((int (*)(void *, void *, void *))(void *)memberType._vTbl[__ecereVMethodID_class_OnCompare])(memberType,
+ *(void **)((byte *)data1 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset)),
*(void **)((byte *)data2 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset)));
}
else
{
- memberResult = ((int (*)(void *, void *, void *))(void *)memberType._vTbl[__ecereVMethodID_class_OnCompare])(memberType,
- (byte *)data1 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset),
+ memberResult = ((int (*)(void *, void *, void *))(void *)memberType._vTbl[__ecereVMethodID_class_OnCompare])(memberType,
+ (byte *)data1 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset),
(byte *)data2 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset));
}
}
}
else
{
- memberResult = DataMember_OnCompare(member,
- (byte *)data1 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset),
+ memberResult = DataMember_OnCompare(member,
+ (byte *)data1 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset),
(byte *)data2 + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset));
}
if(memberResult)
Class memberType = member.dataTypeClass;
char * name = member.name;
if(member.id < 0) continue;
-
+
memberString[0] = 0;
if(!memberType)
if(value.p || prop.IsSet)
{
bool needClass = true;
- char * result = ((char *(*)(void *, void *, char *, void *, bool *))(void *)memberType._vTbl[__ecereVMethodID_class_OnGetString])(memberType,
+ char * result = ((char *(*)(void *, void *, char *, void *, bool *))(void *)memberType._vTbl[__ecereVMethodID_class_OnGetString])(memberType,
(memberType.type == normalClass) ? value.p : &value, memberString, null, &needClass);
if(result && result != memberString)
strcpy(memberString, result);
tempString[len++] = memberString[c];
tempString[len] = 0;
}
- }
+ }
strcat(tempString, "\"");
}
else
result = true;
- if(_class.type == noHeadClass || _class.type == normalClass)
+ if(_class.type == noHeadClass || _class.type == normalClass)
{
data = *data = eInstance_New(_class);
- if(_class.type == normalClass)
+ if(_class.type == normalClass)
((Instance)data)._refCount++;
}
- else if(/*_class.type == noHeadClass || */_class.type == structClass)
+ else if(/*_class.type == noHeadClass || */_class.type == structClass)
memset(data, 0, _class.structSize);
// Bit classes cleared outside?
// Is it used by the compiler?
else if(ch == ' ') // || ch == '\n' || ch == '\t' || ch == '\r')
{
- if(gotChar)
+ if(gotChar)
memberString[count++] = ch;
}
else if(ch == ',')
else if(ch == '{')
{
// If bracket is not initialization
- if(gotChar && !brackets)
+ if(gotChar && !brackets)
{
count = 0;
gotChar = false;
//TrimLSpaces(memberString, memberName);
//TrimRSpaces(memberName, memberString);
//strcpy(memberName, memberString);
-
+
TrimRSpaces(memberString, memberName);
count = 0;
gotChar = false;
if(found)
{
Class memberType = thisMember.dataTypeClass;
-
+
if(!memberType)
memberType = thisMember.dataTypeClass = eSystem_FindClass(module, thisMember.dataTypeString);
if(!memberType)
{
if(thisMember)
{
- if(!((bool (*)(void *, void *, const char *))(void *)memberType._vTbl[__ecereVMethodID_class_OnGetDataFromString])(memberType,
+ if(!((bool (*)(void *, void *, const char *))(void *)memberType._vTbl[__ecereVMethodID_class_OnGetDataFromString])(memberType,
(byte *)data + (((thisMember._class.type == normalClass) ? thisMember._class.offset : 0) + memberOffset), memberString))
result = false;
}
}
else
result = false;
-
+
count = 0;
memberName[0] = '\0';
}
if(member.isProperty || member.type == normalMember)
{
Class memberType = member.dataTypeClass;
-
+
if(!memberType)
memberType = member.dataTypeClass = eSystem_FindClass(module, member.dataTypeString);
if(memberType)
}
return 0;
}
-
+
static void OnUnserialize(Class _class, void ** data, IOChannel channel)
{
Module module = _class.module;
{
// TOFIX: Seriously!?!?? Fix me!
data = *data = eInstance_New(_class);
- if(_class.type == normalClass)
+ if(_class.type == normalClass)
((Instance)data)._refCount++;
}
- else if(/*_class.type == noHeadClass || */_class.type == structClass)
+ else if(/*_class.type == noHeadClass || */_class.type == structClass)
memset(data, 0, _class.structSize);
while(lastClass != _class)
if(member.isProperty || member.type == normalMember)
{
Class memberType = member.dataTypeClass;
-
+
if(!memberType)
memberType = member.dataTypeClass = eSystem_FindClass(module, member.dataTypeString);
if(memberType)
}*/
}
else
- ((void (*)(void *, void *, void *))(void *)memberType._vTbl[__ecereVMethodID_class_OnUnserialize])(memberType,
+ ((void (*)(void *, void *, void *))(void *)memberType._vTbl[__ecereVMethodID_class_OnUnserialize])(memberType,
(byte *)data + (((member._class.type == normalClass) ? member._class.offset : 0) + member.offset), channel);
}
else
{
byte bytes[4];
if(channel.ReadData(bytes, 4) == 4)
- *data = GETXDWORD(bytes);
+ *data = GETXDWORD(bytes);
else
*data = 0;
}
{
byte bytes[8];
if(channel.ReadData(bytes, 8) == 8)
- *data = GETXQWORD(bytes);
+ *data = GETXQWORD(bytes);
else
*data = 0;
}
{
byte bytes[2];
if(channel.ReadData(bytes, 2) == 2)
- *data = GETXWORD(bytes);
+ *data = GETXWORD(bytes);
else
*data = 0;
}
integerClass.dataTypeString = CopyString("int");
integerClass.structSize = 0;
integerClass.typeSize = sizeof(int);
-
+
eClass_AddMethod(integerClass, "OnCompare", null, Integer_OnCompare, publicAccess);
eClass_AddMethod(integerClass, "OnGetString", null, Integer_OnGetString, publicAccess);
eClass_AddMethod(integerClass, "OnGetDataFromString", null, Integer_OnGetDataFromString, publicAccess);
c = strlen(string)-1;
for( ; c >= 0; c--)
{
- if(string[c] != '0')
+ if(string[c] != '0')
last = Max(last, c);
if(string[c] == '.')
{
{
byte bytes[4];
if(channel.ReadData(bytes, 4) == 4)
- *(uint *)data = GETXDWORD(bytes);
+ *(uint *)data = GETXDWORD(bytes);
else
*data = 0;
}
c = strlen(string)-1;
for( ; c >= 0; c--)
{
- if(string[c] != '0')
+ if(string[c] != '0')
last = Max(last, c);
if(string[c] == '.')
{
{
*data = result;
return true;
-
+
}
return false;
}
}
return true;
}
-
+
/*static */int String_OnCompare(Class _class, char * string1, char * string2)
{
int result = 0;
static void String_OnFree(Class _class, char * string)
{
- if(string)
+ if(string)
{
eSystem_Delete(string);
}
delete stringClass.dataTypeString;
stringClass.dataTypeString = CopyString("char *");
stringClass.structSize = 0;
-
+
eClass_AddMethod(stringClass, "OnCompare", null, String_OnCompare, publicAccess);
eClass_AddMethod(stringClass, "OnCopy", null, String_OnCopy, publicAccess);
eClass_AddMethod(stringClass, "OnFree", null, String_OnFree, publicAccess);
eClass_AddMethod(stringClass, "OnGetString", null, String_OnGetString, publicAccess);
eClass_AddMethod(stringClass, "OnGetDataFromString", null, String_OnGetDataFromString, publicAccess);
eClass_AddMethod(stringClass, "OnSerialize", null, String_OnSerialize, publicAccess);
- eClass_AddMethod(stringClass, "OnUnserialize", null, String_OnUnserialize, publicAccess);
+ eClass_AddMethod(stringClass, "OnUnserialize", null, String_OnUnserialize, publicAccess);
// eClass_AddProperty(stringClass, null, "Class", null, String_GetClass, publicAccess);
stringClass = eSystem_RegisterClass(normalClass, "String", "char *", 0, 0, null, null, module, baseSystemAccess, publicAccess);
if(len + newLen >= maxLen) newLen = maxLen-1-len;
if(result != buffer + len)
memcpy(buffer + len, result, newLen);
- len += newLen;
+ len += newLen;
}
}
}
FILE * fStdIn, * fStdOut;
#endif
-FILE *eC_stdin(void) {
+FILE *eC_stdin(void) {
#if defined(__WIN32__)
if(!fStdIn)
{
result = false;
break;
}
- if(ch =='\n')
+ if(ch =='\n')
break;
if(ch !='\r')
s[c++]=(char)ch;
sysctl(mib, 4, fileName, &cb, null, 0);
if(fileName[0])
return true;
- }
+ }
#endif
#if !defined(__linux__)
{
if(returnCode == NSObjectFileImageSuccess)
{
printf("NSObjectFileImageSuccess!\n");
- library = NSLinkModule(fileImage,fileName,
+ library = NSLinkModule(fileImage,fileName,
NSLINKMODULE_OPTION_RETURN_ON_ERROR
| NSLINKMODULE_OPTION_PRIVATE);
// NSDestroyObjectFileImage(fileImage);
if(library)
{
- *Load = NSAddressOfSymbol(NSLookupSymbolInModule(library, "__ecereDll_Load"));
+ *Load = NSAddressOfSymbol(NSLookupSymbolInModule(library, "__ecereDll_Load"));
*Unload = NSAddressOfSymbol(NSLookupSymbolInModule(library, "__ecereDll_Unload"));
if(!*Load)
{
};
public enum AccessMode
-{
+{
defaultAccess,
publicAccess,
privateAccess,
public:
SubModule prev, next;
Module module;
- AccessMode importMode;
+ AccessMode importMode;
};
public enum DataMemberType { normalMember, unionMember, structMember };
{
get { return name; }
set
- {
+ {
Class theClass = eSystem_FindClass(__thisModule, value);
/*
if(!theClass)
void * symbol;
};
-public class EnumClassData : struct
+public class EnumClassData : struct
{
public:
class_fixed
{
BlockPool * pool = &pools[c];
printf("[%d %s (%d)]: available: %d, allocated: %d, free: %d, used: %d k, wasted: %d k, free: %d k\n", c, (&pools[c] == this) ? "*" : " ",
- pools[c].blockSize, pools[c].totalSize, pools[c].numBlocks,
+ pools[c].blockSize, pools[c].totalSize, pools[c].numBlocks,
pools[c].totalSize - pools[c].numBlocks, pools[c].usedSpace / 1024, ((pools[c].numBlocks * pools[c].blockSize) - pools[c].usedSpace) / 1024,
(pools[c].totalSize - pools[c].numBlocks) * pools[c].blockSize / 1024);
totalAvailable += pools[c].totalSize * pools[c].blockSize;
last = block;
free = block.next;
/*if(blockSize == 28)
- printf("Free: %x, free.part: %x, free.part.size: %d, free.part.pool: %x (this = %x), next = %x (part = %x)\n", free, free ? free.part : null,
- (free && free.part) ? free.part.size : 0, (free && free.part) ? free.part.pool : 0, this,
+ printf("Free: %x, free.part: %x, free.part.size: %d, free.part.pool: %x (this = %x), next = %x (part = %x)\n", free, free ? free.part : null,
+ (free && free.part) ? free.part.size : 0, (free && free.part) ? free.part.pool : 0, this,
(free ? free.next : 0), (free && free.next) ? free.next.part : 0);
if(free && free.part && (free.part.size < 0 || free.part.pool == (void *)-1))
printf("WARNING! Bad next free block!\n");*/
first = block.next;
if(last == block)
last = block.prev;
-
+
// block.prev = null;
block.next = free;
free = block;
};
if(prev)
prev.next = null;
-
+
TOTAL_MEM -= part.size * blockSpace;
TOTAL_MEM -= sizeof(class MemPart);
numParts--;
uint pos;
uint last = 1, prev = 0;
uint current = 1;
-
+
for(pos=0; ; pos++)
{
current += prev;
uint pos;
uint last = 1, prev = 0;
uint current = 1;
-
+
for(pos=0; pos <= number; pos++)
{
current += prev;
uint pos;
uint last = 1, prev = 0;
uint current = 1;
-
+
for(pos=0; ; pos++)
{
current += prev;
{
uint pos;
uint64 current = sizeof(void *);
-
+
for(pos=0; pos < NUM_POOLS; pos++)
{
if(current >= number)
{
uint pos;
uint64 current = sizeof(void *);
-
+
for(pos=0; pos < NUM_POOLS; pos++)
{
if(current >= number)
if(current == 1) current = 2;
}
return (uint)current;
-}
+}
// -- Math Helpers ---
public uint log2i(uint number)
for(c = 0; c<NUM_POOLS; c++)
{
int expansion;
-
+
pools[c].blockSize = NTH_SIZE(c);
if(pools[c].blockSize % sizeof(void *))
pools[c].blockSize += sizeof(void *) - (pools[c].blockSize % sizeof(void *));
pools[c].blockSpace = pools[c].blockSize;
- pools[c].blockSpace += sizeof(class MemBlock);
+ pools[c].blockSpace += sizeof(class MemBlock);
// pools[c].Expand(initNumBlocks[c]);
-
+
expansion = (pools[c].blockSize < 128) ? 1024 : (131072 / pools[c].blockSize);
if(c < 12)
block.OutputStacks(true);
}
}
-
+
pointer = malloc(size + REDZONE * 2);
if(!pointer)
{
block.OutputStacks(true);
}
}
-
+
pointer = calloc(1, size + REDZONE * 2);
if(!pointer)
{
block.OutputStacks(true);
}
}
-
+
address = (byte *)block.key;
for(c = 0; c<REDZONE; c++)
{
block.OutputStacks(block.freed);
}
}
-
+
memBlocks.Delete(block);
}
if(leaksCount)
dataTypeString = enumBase ? enumBase.dataTypeString : base.dataTypeString;
/////////////////////
-
+
offsetClass = base ? (base.templateClass ? base.templateClass.sizeClass : base.sizeClass) : (type == noHeadClass ? 0 : 0 /*sizeof(class Class)*/);
totalSizeClass = offsetClass + sizeClass;
_class.typeSize = _class.structSize = _class.memberOffset + size;
}
else if(type == bitClass || type == enumClass || type == unitClass)
- {
+ {
Class dataTypeClass = eSystem_FindClass(_class.module, dataTypeString);
if(dataTypeClass)
_class.typeSize = dataTypeClass.typeSize;
}
// _class.defaultAlignment = base ? base.defaultAlignment : 0;
-
+
if(type == normalClass || type == noHeadClass || type == structClass)
{
Property prop;
}
}
}
-
+
{
OldLink templateLink;
for(templateLink = base.templatized.first; templateLink; templateLink = templateLink.next)
template.sizeClass = base.sizeClass;
template.structSize = base.structSize;
template.vTblSize = base.vTblSize;
-
+
FixDerivativesBase(template, mod);
}
}
if(c - start)
{
- int offsetClass;
+ int offsetClass;
int totalSizeClass;
BTNamedLink classLink = null;
Class _class = null;
bool refine = false;
Class prevBase = null;
- if(base && !base.internalDecl && (base.type == noHeadClass || base.type == structClass || base.type == normalClass))
+ if(base && !base.internalDecl && (base.type == noHeadClass || base.type == structClass || base.type == normalClass))
{
// Normal classes inheriting off simple classes should become no head classes
if(base.type == structClass && type == normalClass)
else
type = base.type;
}
- if(base && (type == normalClass || type == noHeadClass || type == structClass) &&
+ if(base && (type == normalClass || type == noHeadClass || type == structClass) &&
(base.type == unitClass || base.type == bitClass || base.type == enumClass))
{
type = base.type;
{
// TO IMPROVE:
if(base || !baseName || !baseName[0] ||
- !strcmp(baseName, "unsigned int") ||
- !strcmp(baseName, "uint") ||
- !strcmp(baseName, "unsigned int64") ||
- !strcmp(baseName, "uint64") ||
- !strcmp(baseName, "int64") ||
- !strcmp(baseName, "unsigned short") ||
- !strcmp(baseName, "short") ||
- !strcmp(baseName, "unsigned char") ||
- !strcmp(baseName, "byte") ||
- !strcmp(baseName, "char") ||
- !strcmp(baseName, "uint32") ||
+ !strcmp(baseName, "unsigned int") ||
+ !strcmp(baseName, "uint") ||
+ !strcmp(baseName, "unsigned int64") ||
+ !strcmp(baseName, "uint64") ||
+ !strcmp(baseName, "int64") ||
+ !strcmp(baseName, "unsigned short") ||
+ !strcmp(baseName, "short") ||
+ !strcmp(baseName, "unsigned char") ||
+ !strcmp(baseName, "byte") ||
+ !strcmp(baseName, "char") ||
+ !strcmp(baseName, "uint32") ||
!strcmp(baseName, "uint16"))
{
base = eSystem_FindClass(module, "enum");
base = eSystem_FindClass(module, "struct");
dataTypeString = name + start;
}
- else
+ else
{
if(type == normalClass)
// dataTypeString = "struct Instance";
// DANGEROUSLY TESTING THIS... PUT IT BACK
//if(!base)
if(base || !baseName || !baseName[0] ||
- !strcmp(baseName, "unsigned int") ||
- !strcmp(baseName, "uint") ||
- !strcmp(baseName, "unsigned int64") ||
- !strcmp(baseName, "uint64") ||
- !strcmp(baseName, "int64") ||
- !strcmp(baseName, "unsigned short") ||
- !strcmp(baseName, "short") ||
- !strcmp(baseName, "unsigned char") ||
- !strcmp(baseName, "byte") ||
- !strcmp(baseName, "char") ||
- !strcmp(baseName, "uint32") ||
+ !strcmp(baseName, "unsigned int") ||
+ !strcmp(baseName, "uint") ||
+ !strcmp(baseName, "unsigned int64") ||
+ !strcmp(baseName, "uint64") ||
+ !strcmp(baseName, "int64") ||
+ !strcmp(baseName, "unsigned short") ||
+ !strcmp(baseName, "short") ||
+ !strcmp(baseName, "unsigned char") ||
+ !strcmp(baseName, "byte") ||
+ !strcmp(baseName, "char") ||
+ !strcmp(baseName, "uint32") ||
!strcmp(baseName, "uint16"))
{
if(type == normalClass && strcmp(name, "ecere::com::Instance") && strcmp(name, "enum") && strcmp(name, "struct"))
offsetClass = base ? base.sizeClass : (type == noHeadClass ? 0 : 0 /*sizeof(class Class)*/);
totalSizeClass = offsetClass + sizeClass;
-
+
if((_class = eSystem_FindClass(module, name)))
{
if(!_class.internalDecl)
}
{
NameSpace * ns = _class.nameSpace;
- while(ns->parent &&
- !ns->classes.first &&
+ while(ns->parent &&
+ !ns->classes.first &&
!ns->functions.first &&
!ns->defines.first &&
!ns->nameSpaces.first)
_class.typeSize = _class.structSize = _class.memberOffset + size;
}
else if(type == bitClass || type == enumClass || type == unitClass)
- {
+ {
Class dataTypeClass = eSystem_FindClass(_class.module, dataTypeString);
if(dataTypeClass)
_class.typeSize = dataTypeClass.typeSize;
delete template.templateArgs[id].memberString;
break;
case expression:
-
+
break;
}
}
ClassTemplateParameter param;
int id = 0;
if(_class.templateClass) _class = _class.templateClass;
- for(prevClass = _class.base; prevClass; prevClass = prevClass.base)
+ for(prevClass = _class.base; prevClass; prevClass = prevClass.base)
{
if(prevClass.templateClass) prevClass = prevClass.templateClass;
id += prevClass.templateParams.count;
delete _class._vTbl;
FreeTemplates(_class);
-
+
FreeTemplateArgs(_class);
delete _class.templateArgs;
_class.delayedCPValues.Free(null);
_class.selfWatchers.Free(null);
-
+
if(_class.base)
{
// Class base = _class.base.templateClass ? _class.base.templateClass : _class.base;
delete _class.name;
delete _class.fullName;
-
+
delete _class.dataTypeString;
delete _class.data;
delete param.defaultArg.memberString;
break;
case expression:
-
+
break;
}
if(param.type != identifier) delete param.dataTypeString;
{
if(ch >= '0' && ch <= '9')
ch -= '0';
- else if(ch >= 'a' && ch <= 'z')
- ch -= ('a' - 10);
- else if(ch >= 'A' && ch <= 'Z')
+ else if(ch >= 'a' && ch <= 'z')
+ ch -= ('a' - 10);
+ else if(ch >= 'A' && ch <= 'Z')
ch -= ('A'- 10);
else
{
{
if(ch >= '0' && ch <= '9')
ch -= '0';
- else if(ch >= 'a' && ch <= 'z')
- ch -= ('a' - 10);
- else if(ch >= 'A' && ch <= 'Z')
+ else if(ch >= 'a' && ch <= 'z')
+ ch -= ('a' - 10);
+ else if(ch >= 'A' && ch <= 'Z')
ch -= ('A' - 10);
else
{
link = SearchModule(module, name, &((NameSpace *)0)->classes, true);
if(link) return link.data;
-
+
{
char noTemplateName[1024];
char * templateParams = strchr(name, '<');
arg.dataTypeString = CopyString(arg.dataTypeString);
break;
case expression:
-
+
break;
case identifier:
arg.memberString = CopyString(arg.memberString);
if(sClass.templateClass) sClass = sClass.templateClass;
numParams += sClass.templateParams.count;
}
-
+
if(templatedClass.templateArgs)
FreeTemplateArgs(templatedClass);
delete templatedClass.templateArgs;
CopyTemplateArg(param, templatedClass.templateArgs[id++]);
}*/
}
-
+
if(templatedClass.base && templatedClass.base.templateArgs && _class == templatedClass)
{
Class sClass;
- memcpy(templatedClass.templateArgs, templatedClass.base.templateArgs,
+ memcpy(templatedClass.templateArgs, templatedClass.base.templateArgs,
sizeof(ClassTemplateArgument) * (numParams - templatedClass.templateParams.count));
for(sClass = templatedClass.base; sClass; sClass = sClass.base)
{
CopyTemplateArg(param, templatedClass.templateArgs[id++]);
}
}
-
+
while(nextParamStart)
{
char * paramStart = nextParamStart;
int level = 0;
while(*paramStart == ' ') paramStart++;
paramEnd = paramStart;
- while((ch = *paramEnd, ch && (level > 0 || (ch != '>' && ch != ','))))
+ while((ch = *paramEnd, ch && (level > 0 || (ch != '>' && ch != ','))))
{
if(ch == '<') level++;
if(ch == '>') level--;
{
char * end = equal - 1;
char ident[1024];
-
+
while(*end == ' ') end--;
strncpy(ident, paramStart, end + 1 - paramStart);
ident[end + 1 - paramStart] = 0;
-
+
for(sClass = _class; sClass; sClass = sClass.base)
{
if(sClass.templateClass) sClass = sClass.templateClass;
curParam = param;
break;
}
- if(curParam)
+ if(curParam)
{
Class nextClass;
for(nextClass = sClass.base; nextClass; nextClass = nextClass.base)
{
curParamID += nextClass.templateParams.count;
break;
- }
+ }
break;
}
}
{
ClassTemplateArgument argument { };
char value[1024];
- if(equal)
+ if(equal)
{
equal++;
while(*equal == ' ') equal++;
if(!expClass) expClass = eSystem_FindClass(_class.module.application, curParam.dataTypeString);
if(expClass)
{
- //if(expClass.type ==
+ //if(expClass.type ==
((bool (*)(void *, void *, const char *))(void *)expClass._vTbl[__ecereVMethodID_class_OnGetDataFromString])(expClass, &argument.expression, value);
}
// Expression should be pre simplified here
argument.expression.i = (int)strtol(value, null, 0);
}
break;
- }
+ }
case identifier:
argument.memberString = CopyString(value);
break;
if(param.type == type && param.defaultArg.dataTypeString)
{
templatedClass.templateArgs[curParamID].dataTypeClass = eSystem_FindClass(templatedClass.module, param.defaultArg.dataTypeString);
- if(!templatedClass.templateArgs[curParamID].dataTypeClass)
+ if(!templatedClass.templateArgs[curParamID].dataTypeClass)
templatedClass.templateArgs[curParamID].dataTypeClass = eSystem_FindClass(templatedClass.module.application, param.defaultArg.dataTypeString);
- if(!templatedClass.templateArgs[curParamID].dataTypeClass)
+ if(!templatedClass.templateArgs[curParamID].dataTypeClass)
templatedClass.templateArgs[curParamID].dataTypeClass = eSystem_FindClass(findModule, param.defaultArg.dataTypeString);
}
}
Class cClass = null;
int paramCount = 0;
int lastParam = -1;
-
+
char templateString[1024];
sprintf(templateString, "%s<", expClass.templateClass.fullName);
for(cClass = expClass; cClass; cClass = cClass.base)
}
}
}
- c--;
+ c--;
}
}
}
Class nextClass;
ClassTemplateParameter param;
if(sClass.templateClass) sClass = sClass.templateClass;
-
- for(nextClass = sClass.base; nextClass; nextClass = nextClass.base)
+
+ for(nextClass = sClass.base; nextClass; nextClass = nextClass.base)
{
if(nextClass.templateClass) nextClass = nextClass.templateClass;
curParamID += nextClass.templateParams.count;
Class dClass;
int p = numParams - 1;
for(dClass = _class; dClass; dClass = dClass.base)
- {
+ {
if(dClass.templateClass) dClass = dClass.templateClass;
for(cParam = dClass.templateParams.last; cParam; cParam = cParam.prev, p--)
{
memcpy(className, memberString, colon - memberString);
className[colon - memberString] = '\0';
-
+
for(sClass = _class; sClass; sClass = sClass.base)
{
ClassTemplateParameter cParam;
int id = 0;
if(sClass.templateClass) sClass = sClass.templateClass;
- for(nextClass = sClass.base; nextClass; nextClass = nextClass.base)
+ for(nextClass = sClass.base; nextClass; nextClass = nextClass.base)
{
if(nextClass.templateClass) nextClass = nextClass.templateClass;
id += nextClass.templateParams.count;
strcpy(className, templatedClass.templateArgs[id].dataTypeString);
}
id++;
- }
+ }
}
memberClass = eSystem_FindClass(templatedClass.module, className);
// TESTING: Added this here...
ClassTemplateParameter param;
Class nextClass;
int p = 0;
- for(nextClass = sClass.base; nextClass; nextClass = nextClass.base) p += nextClass.templateParams.count;
+ for(nextClass = sClass.base; nextClass; nextClass = nextClass.base) p += nextClass.templateParams.count;
for(param = sClass.templateParams.first; param; param = param.next, p++)
{
ClassTemplateArgument * arg = &_class.templateArgs[p];
public dllexport ClassProperty eClass_AddClassProperty(Class _class, char * name, char * dataType, void * setStmt, void * getStmt)
{
- if(name && !_class.classProperties.FindString(name))
+ if(name && !_class.classProperties.FindString(name))
{
ClassProperty _property
{
Instance instance = null;
if(_class)
{
- // instance = _malloc(_class.size);
+ // instance = _malloc(_class.size);
#ifdef MEMINFO
#undef malloc
for(nameSpace = (NameSpace *)app.systemNameSpace.nameSpaces.first; nameSpace; nameSpace = (NameSpace *)((BTNode)nameSpace).next)
nameSpace->parent = &app.systemNameSpace;
// --------------------------------------------------
-
+
for(_class = app.classes.first; _class; _class = _class.next)
{
OldLink templateLink;
_class.module = (Module) app;
for(templateLink = _class.templatized.first; templateLink; templateLink = templateLink.next)
- {
+ {
Class template = templateLink.data;
template.module = _class.module;
}
OldList * watchers = (OldList *)((byte *)instance + _property.watcherOffset);
Watcher watcher, next;
for(watcher = watchers->first; watcher; watcher = next)
- {
+ {
next = watcher.next;
watchers->Delete(watcher);
}
}
}
}*/
-
+
base = _class.base;
if(base && (base.type == systemClass || base.isInstanceClass)) base = null;
public dllexport void eClass_FindNextMember(Class _class, Class * curClass, DataMember * curMember, DataMember * subMemberStack, int * subMemberStackPos)
{
// THIS CODE WILL FIND NEXT MEMBER... (PUBLIC MEMBERS ONLY)
- if(*curMember)
+ if(*curMember)
{
*curMember = (*curMember).next;
*curMember = (*curMember).members.first;
while(*curMember && ((*curMember).memberAccess == privateAccess))
- *curMember = (*curMember).next;
+ *curMember = (*curMember).next;
}
}
}
*curMember = (*curMember).members.first;
while(*curMember && (*curMember).memberAccess == privateAccess)
- *curMember = (*curMember).next;
+ *curMember = (*curMember).next;
}
}
}
{
instance._vTbl = _malloc(sizeof(void *) * instance._class.vTblSize);
memcpy(instance._vTbl, instance._class._vTbl,
- sizeof(int(*)()) * instance._class.vTblSize);
+ sizeof(int(*)()) * instance._class.vTblSize);
}
instance._vTbl[method.vid] = function ? function : DefaultFunction;
}
OldLink deriv;
_class.structSize += _class.base.structSize - _class.offset;
- _class.offset = _class.base.structSize;
+ _class.offset = _class.base.structSize;
for(deriv = _class.derivatives.first; deriv; deriv = deriv.next)
FixOffsets(deriv.data);
{
if(_class && name)
{
- if(!_class.members.FindString(name))
+ if(!_class.members.FindString(name))
{
DataMember dataMember;
if(_class.memberOffset % alignment)
_class.memberOffset += alignment - (_class.memberOffset % alignment);
}
-
+
dataMember = DataMember {
name = CopyString(name);
dataTypeString = CopyString(type);
public dllexport DataMember eMember_AddDataMember(DataMember member, char * name, char * type, unsigned int size, unsigned int alignment, AccessMode declMode)
{
- if(name && !member.membersAlpha.FindString(name))
+ if(name && !member.membersAlpha.FindString(name))
{
DataMember dataMember;
DataMember dataMember;
member._class = _class;
for(dataMember = member.members.first; dataMember; dataMember = dataMember.next)
- SetMemberClass(dataMember, _class);
+ SetMemberClass(dataMember, _class);
}
public dllexport bool eMember_AddMember(DataMember addTo, DataMember dataMember)
public dllexport BitMember eClass_AddBitMember(Class _class, char * name, char * type, int bitSize, int bitPos, AccessMode declMode)
{
- if(_class && name && !_class.members.FindString(name))
+ if(_class && name && !_class.members.FindString(name))
{
uint64 mask = 0;
int c;
if(ensureCOM && !strcmp(name, "ecere") && module)
{
name = !strcmp(module.name, "ecereCOM") ? "ecere" : "ecereCOM";
- if((!Load && !strcmp(module.name, "ecereCOM")) ||
+ if((!Load && !strcmp(module.name, "ecereCOM")) ||
(Load && (!__thisModule || !__thisModule.name || !strcmp(__thisModule.name, "ecereCOM")) && Load != COM_LOAD_FUNCTION))
{
Module module;
{
EnumClassData data = (EnumClassData)_class.data;
NamedLink item;
-
+
for(item = data.values.first; item; item = item.next)
- if(!strcmp(item.name, string))
+ if(!strcmp(item.name, string))
break;
if(!item)
{
int value = ((int) data.largest) + 1;
NamedLink item;
for(item = data.values.first; item; item = item.next)
- if(!strcmp(item.name, string))
+ if(!strcmp(item.name, string))
break;
if(!item)
{
while((handle = module.modules.last)) // STARTING WITH LAST SO THAT ecereCOM IS UNLOADED LAST...
{
Module depModule = handle.module;
- if(depModule == ourWorld)
+ if(depModule == ourWorld)
{
module.modules.Remove(handle);
ourHandle = handle;
{
module.modules.Delete(handle);
delete depModule;
- }
+ }
}
if(ourHandle)
{
public dllexport DefinedExpression eSystem_RegisterDefine(char * name, char * value, Module module, AccessMode declMode)
{
NameSpace * nameSpace = null;
-
+
int start = 0, c;
nameSpace = (declMode == publicAccess) ? &module.publicNameSpace : &module.privateNameSpace;
delete spaceName;
nameSpace = newSpace;
if(name[c] == ':') c++;
- start = c+1;
+ start = c+1;
}
}
}
delete spaceName;
nameSpace = newSpace;
if(name[c] == ':') c++;
- start = c+1;
+ start = c+1;
}
}
}
if(_class)
{
Property _property = eClass_FindProperty(_class, name, _class.module);
-
+
if(!_property)
_property = eClass_AddProperty(_class, name, null, null, null, baseSystemAccess /*privateAccess*/);
_class.selfWatchers.Add(SelfWatcher { _property = _property, callback = callback });
enumClass = eSystem_RegisterClass(normalClass, "enum", null, 0, force64Bits ? 40 : sizeof(class EnumClassData), null, null, module, baseSystemAccess, publicAccess);
eClass_AddClassProperty(enumClass, "enumSize", "int", null, GetEnumSize).constant = true;
enumClass.type = systemClass;
-
+
delete enumClass.dataTypeString;
enumClass.dataTypeString = CopyString(/*"unsigned int"*/"int");
moduleClass.count++;
if(inCompiler && force32Bits)
moduleClass.structSize = 12 + 4 + 20 + 20 + 20 + 20 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + (16 + 4 + 4 + 4*16) + (16 + 4 + 4 + 4*16);
-
+
// Create Application class
applicationClass = eSystem_RegisterClass(normalClass, "ecere::com::Application", "Module", force64Bits ? (8+8+4+4 + 32 + 8 + 176) : sizeof(struct Application), 0, null, (void *)Application_Destructor, module, baseSystemAccess, publicAccess);
if(inCompiler && force32Bits)
type = type;
(type == identifier) ? info : CopyString(info);
};
- if(defaultArg != null)
+ if(defaultArg != null)
{
param.defaultArg = defaultArg;
CopyTemplateArg(param, param.defaultArg);
}
}
}
- }
+ }
//ComputeClassParameters(base, null, null);
{
get { return OnGetString(null, null, null); }
set
- {
+ {
if(value)
{
Platform c;
tempString[0] = '\0';
return null;
}
-
+
bool OnGetDataFromString(char * string)
{
this = string;
// FIX THIS WITH PUBLIC:
property ClassDesignerBase classDesigner
- {
+ {
get { return classDesigner; }
set { classDesigner = value; }
};
property char * objectClass
- {
+ {
get { return objectClass; }
set { objectClass = value; }
};
property bool isDragging
- {
+ {
get { return isDragging; }
set { isDragging = value; }
};
}
-
+
public class ClassDesignerBase : Window
{
public:
}
if(i < numBytes) return false;
- if(codePoint > 0x10FFFF || (codePoint >= 0xD800 && codePoint <= 0xDFFF) ||
- (codePoint < 0x80 && numBytes > 1) ||
- (codePoint < 0x800 && numBytes > 2) ||
+ if(codePoint > 0x10FFFF || (codePoint >= 0xD800 && codePoint <= 0xDFFF) ||
+ (codePoint < 0x80 && numBytes > 1) ||
+ (codePoint < 0x800 && numBytes > 2) ||
(codePoint < 0x10000 && numBytes > 3))
return false;
}
continue;
}
if(invert) { u16 = ((u16 & 0xFF00) >> 8) | ((u16 & 0x00FF) << 8); }
-
+
if(u16 < 0xD800 || u16 > 0xDBFF)
- ch = (unichar)u16;
+ ch = (unichar)u16;
else
ch = ((unichar)u16 << 10) + source[c++] + SURROGATE_OFFSET;
-
+
if(ch < 0x80)
{
dest[d++] = (char)ch;
{
unichar ch;
if(u16 < 0xD800 || u16 > 0xDBFF)
- ch = (unichar)u16;
+ ch = (unichar)u16;
else
ch = ((unichar)u16 << 10) + source[c++] + SURROGATE_OFFSET;
}
}
- if(i < nb ||
- ch > 0x10FFFF || (ch >= 0xD800 && ch <= 0xDFFF) ||
- (ch < 0x80 && nb > 1) ||
- (ch < 0x800 && nb > 2) ||
+ if(i < nb ||
+ ch > 0x10FFFF || (ch >= 0xD800 && ch <= 0xDFFF) ||
+ (ch < 0x80 && nb > 1) ||
+ (ch < 0x800 && nb > 2) ||
(ch < 0x10000 && nb > 3))
{
ch = 0;
dest[d] = 0;
return d;
}
- return 0;
+ return 0;
}
public int UTF32toUTF8Len(unichar * source, int count, byte * dest, int max)
// Compute Clipping Planes
{
Vector3D normal, point = {0,0,0};
-
+
// --- Left ---
quat.Yaw(fovLeft - Pi/2);
quat.ToDirection(normal);
void AdjustAngle(Quaternion angle)
{
cAngle = angle;
-
+
inverseMatrix.RotationQuaternion(angle);
viewMatrix.Transpose(inverseMatrix);
toAngle = euler;
}
else if(type == attachedQuaternion)*/
- toAngle.Multiply(orientation, target->orientation);
+ toAngle.Multiply(orientation, target->orientation);
}
else
toAngle = orientation;
}
}
- if(cAngle.w != toAngle.w || cAngle.x != toAngle.x ||
+ if(cAngle.w != toAngle.w || cAngle.x != toAngle.x ||
cAngle.y != toAngle.y || cAngle.z != toAngle.z ||
needUpdate)
{
Plane * plane = &worldClippingPlanes[p];
for(c = 0; c<numPoints; c++)
{
- double dot =
- plane->a * points[c].x +
+ double dot =
+ plane->a * points[c].x +
plane->b * points[c].y +
plane->c * points[c].z;
if(dot + plane->d > 0)
plane = &worldClippingPlanes[p+1];
for(c = 0; c<numPoints; c++)
{
- double dot =
- plane->a * points[c].x +
- plane->b * points[c].y +
+ double dot =
+ plane->a * points[c].x +
+ plane->b * points[c].y +
plane->c * points[c].z;
if(dot + plane->d > 0)
{
for(c = 0; c<numPoints; c++)
points[c] = origPoints[c];
- for(p = 0; p < 6; p++)
+ for(p = 0; p < 6; p++)
{
Plane * plane = &planes[p];
int i;
int numGoodPoints = 0;
-
+
memset(goodPoints, 0, n);
- for(i = 0; i < n; i++)
+ for(i = 0; i < n; i++)
{
double dot = plane->normal.DotProduct(points[i]);
double distance = dot + plane->d;
outside = true;
break;
}
-
+
if(numGoodPoints < n)
{
// Clip the polygon
}
else
{
- Line edge;
+ Line edge;
int next;
if(lastGood == -1)
{
euler.pitch = Min(euler.pitch, max);
euler.pitch = Max(euler.pitch, min);
- }
+ }
orientation = euler;
}
}
{
euler.yaw = Min(euler.yaw, max);
euler.yaw = Max(euler.yaw, min);
- }
+ }
orientation = euler;
}
}
{
euler.roll = Min(euler.roll, max);
euler.roll = Max(euler.roll, min);
- }
+ }
orientation = euler;
}
}
floatZ = ((((float)zMax * (float)zMin / -(float)vector.z) + (float)zMax) / ((float)zMax - (float)zMin));
point.x += origin.x;
point.y += origin.y;
- return (point.x >= 0 && point.y >= 0 &&
+ return (point.x >= 0 && point.y >= 0 &&
point.x < width && point.y < height);
}
return false;
double xy = quat.x*quat.y, xz = quat.x*quat.z, yz = quat.y*quat.z;
double wx = quat.w*quat.x, wy = quat.w*quat.y, wz = quat.w*quat.z;
- m[0][0] = (double) (1 - 2 * ( yy + zz ));
+ m[0][0] = (double) (1 - 2 * ( yy + zz ));
m[0][1] = (double) ( 2 * ( xy - wz ));
m[0][2] = (double) ( 2 * ( xz + wy ));
double msub3[3][3];
int di, dj;
- for(di = 0; di < 3; di++)
+ for(di = 0; di < 3; di++)
{
- for(dj = 0; dj < 3; dj++)
+ for(dj = 0; dj < 3; dj++)
{
int si = di + ( ( di >= 0 ) ? 1 : 0 );
int sj = dj + ( ( dj >= n ) ? 1 : 0 );
Identity();
else
{
- int i, j, sign;
+ int i, j, sign;
for ( i = 0; i < 4; i++ )
for ( j = 0; j < 4; j++ )
{
sign = 1 - ( (i+j) % 2 ) * 2;
- for(di = 0; di < 3; di++)
+ for(di = 0; di < 3; di++)
{
- for(dj = 0; dj < 3; dj++)
+ for(dj = 0; dj < 3; dj++)
{
int si = di + ( ( di >= i ) ? 1 : 0 );
int sj = dj + ( ( dj >= j ) ? 1 : 0 );
Material material;
private:
void * data;
-};
+};
public struct PrimitiveSingle
{
if(group.type.primitiveType == triFan)
{
- plane.FromPointsf(vertices[group.indices[0]],
- vertices[group.indices[c]],
+ plane.FromPointsf(vertices[group.indices[0]],
+ vertices[group.indices[c]],
vertices[group.indices[c-1]]);
- planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
+ planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
normals[group.indices[0]].Add(normals[group.indices[0]], planeNormal);
numShared[group.indices[0]]++;
}
else if(group.type.primitiveType == triStrip || group.type.primitiveType == quadStrip)
{
- plane.FromPointsf(vertices[group.indices[c-1-strip]],
- vertices[group.indices[c-2+strip]],
+ plane.FromPointsf(vertices[group.indices[c-1-strip]],
+ vertices[group.indices[c-2+strip]],
vertices[group.indices[c]]);
- planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
+ planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
normals[group.indices[c-1-strip]].Add(normals[group.indices[c-1-strip]], planeNormal);
numShared[group.indices[c-1-strip]]++;
{
if(group.type.vertexRange)
{
- plane.FromPointsf(vertices[c+2],
- vertices[c+1],
+ plane.FromPointsf(vertices[c+2],
+ vertices[c+1],
vertices[c]);
- planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
+ planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
for(i = c; i<c+nIndex; i++)
{
}
else
{
- plane.FromPointsf(vertices[i32bit ? indices32[c+2] : indices16[c+2]],
- vertices[i32bit ? indices32[c+1] : indices16[c+1]],
+ plane.FromPointsf(vertices[i32bit ? indices32[c+2] : indices16[c+2]],
+ vertices[i32bit ? indices32[c+1] : indices16[c+1]],
vertices[i32bit ? indices32[c] : indices16[c]]);
- planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
+ planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
for(i = c; i<c+nIndex; i++)
{
Plane plane;
Vector3Df planeNormal;
- plane.FromPointsf(vertices[primitive->indices[2]],
- vertices[primitive->indices[1]],
+ plane.FromPointsf(vertices[primitive->indices[2]],
+ vertices[primitive->indices[1]],
vertices[primitive->indices[0]]);
- planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
+ planeNormal = { (float) plane.normal.x, (float) plane.normal.y, (float) plane.normal.z };
if(primitive->material.flags.doubleSided && plane.d < 0)
{
Vector3Df scaling;
};
-/*static float ease(float t, float a, float b)
+/*static float ease(float t, float a, float b)
{
float k;
float s = a + b;
if (s == 0.0f) return t;
- if (s > 1.0f)
+ if (s > 1.0f)
{
a /= s;
b /= s;
value = pn;
else
{
- if(n == 0)
+ if(n == 0)
{
kn1 = &keys[1];
pn1 = kn1->roll;
- if(numKeys == 2)
+ if(numKeys == 2)
{
value = pn1 - pn;
value *= 1.0f - kn->tension;
return value;
}
- if(type.loop)
+ if(type.loop)
{
kn_1 = &keys[numKeys-2];
d1 = keys[numKeys-1].frame - kn_1->frame;
return value;
}
}
- else if(n == numKeys-1)
+ else if(n == numKeys-1)
{
kn_1 = &keys[n-1];
pn_1 = kn_1->roll;
- if(numKeys == 2)
+ if(numKeys == 2)
{
value = pn - pn_1;
value *= 1.0f - kn->tension;
return value;
}
- if(type.loop)
+ if(type.loop)
{
kn1 = &keys[1];
d1 = kn->frame - kn_1->frame;
d2 = kn1->frame - keys[0].frame;
- }
- else
+ }
+ else
{
float bn_1;
value = pn - pn_1;
value *= 1.0f - kn->tension;
return value;
}
- }
- else
+ }
+ else
{
kn_1 = &keys[n-1];
kn1 = &keys[n+1];
{
C = kn->continuity;
adjust = (float)d1;
- }
- else
+ }
+ else
{
C = -kn->continuity;
adjust = (float)d2;
vector = *pn;
else
{
- if(n == 0)
+ if(n == 0)
{
kn1 = &keys[1];
pn1 = &kn1->position;
- if(numKeys == 2)
+ if(numKeys == 2)
{
vector.Subtract(pn1, pn);
vector.Scale(vector, 1.0f - kn->tension);
return;
}
- if(type.loop)
+ if(type.loop)
{
kn_1 = &keys[numKeys-2];
d1 = keys[numKeys-1].frame - kn_1->frame;
return;
}
}
- else if(n == numKeys-1)
+ else if(n == numKeys-1)
{
kn_1 = &keys[n-1];
pn_1 = &kn_1->position;
- if(numKeys == 2)
+ if(numKeys == 2)
{
vector.Subtract(pn, pn_1);
vector.Scale(vector, 1.0f - kn->tension);
return;
}
- if(type.loop)
+ if(type.loop)
{
kn1 = &keys[1];
d1 = kn->frame - kn_1->frame;
d2 = kn1->frame - keys[0].frame;
- }
- else
+ }
+ else
{
Vector3Df bn_1;
vector.Subtract(pn, pn_1);
vector.Scale(vector, 1.0f - kn->tension);
return;
}
- }
- else
+ }
+ else
{
kn_1 = &keys[n-1];
kn1 = &keys[n+1];
{
C = kn->continuity;
adjust = (float)d1;
- }
- else
+ }
+ else
{
C = -kn->continuity;
adjust = (float)d2;
quat = *qn;
else
{
- if(n == 0)
+ if(n == 0)
{
kn1 = &keys[1];
- if (!(type.loop) || numKeys <= 2)
+ if (!(type.loop) || numKeys <= 2)
{
qn1 = &kn1->orientation;
quat.Slerp(qn, qn1, (1.0f - kn->tension)*(1.0f + kn->continuity*kn->bias)/3.0f);
return;
- }
- else
+ }
+ else
{
kn_1= &keys[numKeys-2];
d1 = keys[numKeys-1].frame - kn_1->frame;
d2 = kn1->frame - kn->frame;
}
- }
- else if (n == numKeys-1)
+ }
+ else if (n == numKeys-1)
{
kn_1 = &keys[n-1];
- if (!(type.loop) || numKeys <= 2)
+ if (!(type.loop) || numKeys <= 2)
{
qn_1 = &kn_1->orientation;
quat.Slerp(qn, qn_1, (1.0f - kn->tension)*(1.0f - kn->continuity*kn->bias)/3.0f);
return;
- }
- else
+ }
+ else
{
kn1 = &keys[1];
d1 = kn->frame - kn_1->frame;
d2 = kn1->frame - keys[0].frame;
}
- }
- else
+ }
+ else
{
kn_1 = &keys[n-1];
kn1 = &keys[n+1];
qn_1 = &kn_1->orientation;
qn1 = &kn1->orientation;
- if (what == splineA)
+ if (what == splineA)
{
f = 1.0f;
adjust = (float)d1;
}
- else
+ else
{
f = -1.0f;
adjust = (float)d2;
}
tracks.Free(FrameTrack::Free);
-
+
delete name;
}
}
OldLink link;
bool result = false;
- if(!type && fileName)
+ if(!type && fileName)
{
type = GetExtension(fileName, ext);
strlwr(type);
for(child = children.first; child; child = child.next)
{
Object result = child.Find(name);
- if(result)
+ if(result)
return result;
}
}
if(this)
{
flags.mesh = true;
- if(!mesh)
+ if(!mesh)
{
mesh = Mesh { };
flags.ownMesh = true;
for(c = 0; c<objectMesh.nVertices; c++)
{
mesh.vertices[nVertices] = objectMesh.vertices[c];
-
+
if(objectMesh.normals)
mesh.normals[nVertices] = objectMesh.normals[c];
if(objectMesh.texCoords)
}
}
- // Merge Indexed Primitive Groups
+ // Merge Indexed Primitive Groups
while(true)
{
int nIndices = 0;
PrimitiveGroupType type;
Material material = null;
bool foundGroup = false;
-
+
// Find first group type/material to process and determine how many indices are required
if(objectMesh)
{
nIndices = 0;
vertexOffset = 0;
-
+
if(objectMesh)
{
for(group = objectMesh.groups.first; group; group = group.next)
{
for(group = child.mesh.groups.first; group; group = group.next)
{
- if(newGroup.material == (group.material ? group.material : child.material) &&
+ if(newGroup.material == (group.material ? group.material : child.material) &&
newGroup.type == group.type)
{
int c;
}
}
else
- break;
+ break;
}
- // Merge Non-Indexed Primitive Groups
+ // Merge Non-Indexed Primitive Groups
vertexOffset = 0;
-
+
if(objectMesh)
{
for(group = objectMesh.groups.first; group; group = group.next)
vertexOffset += child.mesh.nVertices;
}
}
-
+
// Merge Triangles
if(objectMesh)
nTriangles = objectMesh.nPrimitives;
-
+
for(child = children.first; child; child = child.next)
{
if(child.mesh)
{
int i;
PrimitiveSingle * triangle = &mesh.primitives[mesh.nPrimitives++];
-
+
mesh.AllocatePrimitive(triangle, objectMesh.primitives[c].type, objectMesh.primitives[c].nIndices);
triangle->material = objectMesh.primitives[c].material;
triangle->middle = objectMesh.primitives[c].middle;
triangle->plane = objectMesh.primitives[c].plane;
memcpy(triangle->indices, objectMesh.primitives[c].indices, objectMesh.primitives[c].nIndices * sizeof(uint16));
-
+
/*
*triangle = objectMesh.primitives[c];
objectMesh.primitives[c].indices = null;
bool IntersectsGroundPolygon(int count, Pointf * pointfs)
{
bool result = false;
-
+
Pointf * p1;
Pointf * p2;
double minX = wmin.x, maxX = wmax.x;
else
{
float a, b, dy, dx;
-
+
a = p2->y - p1->y;
b = p1->x - p2->x;
dy = a;
if (a < 0) a = -a;
if (b < 0) b = -b;
if (d < 0) d = -d;
-
+
if(d < a * delta)
return true;
else if (d < b * delta)
else if( ( (p1->y <= y) && (p2->y > y) ) || ( (p1->y > y) && (p2->y <= y) ) )
{
double xdy;
-
+
xdy = (dx * (y - p1->y)) + (dy * p1->x);
if(dy < 0)
{
for(track = tracks.first; track; track = track.next)
{
unsigned int c;
-
+
if(track.numKeys)
{
unsigned int prev = 0, next = track.numKeys - 1;
switch(track.type.type)
{
- case position:
+ case position:
{
Vector3Df position;
track.Interpolate(position, prevKey->position, nextKey->position, prev, next, t);
// Lights
case colorChange:
{
- track.Interpolate((Vector3Df *)&light.diffuse,
+ track.Interpolate((Vector3Df *)&light.diffuse,
(Vector3Df *)&prevKey->color, (Vector3Df *)&nextKey->color, prev, next, t);
light.specular = light.diffuse;
break;
{ wmax.x, wmax.y, wmax.z }
};
int numPlanesAllIn = 0;
- for(p = 0; p < 6; p++)
+ for(p = 0; p < 6; p++)
{
Plane * plane = &planes[p];
int i;
int numGoodPoints = 0;
- for(i = 0; i < 8; ++i)
+ for(i = 0; i < 8; ++i)
{
double dot = plane->normal.DotProduct(box[i]);
double distance = dot + plane->d;
void MultMatrix(Plane source, Matrix inverseTranspose)
{
- a = source.a * inverseTranspose.m[0][0] +
+ a = source.a * inverseTranspose.m[0][0] +
source.b * inverseTranspose.m[1][0] +
- source.c * inverseTranspose.m[2][0] +
+ source.c * inverseTranspose.m[2][0] +
source.d * inverseTranspose.m[3][0];
- b = source.a * inverseTranspose.m[0][1] +
+ b = source.a * inverseTranspose.m[0][1] +
source.b * inverseTranspose.m[1][1] +
- source.c * inverseTranspose.m[2][1] +
+ source.c * inverseTranspose.m[2][1] +
source.d * inverseTranspose.m[3][1];
- c = source.a * inverseTranspose.m[0][2] +
+ c = source.a * inverseTranspose.m[0][2] +
source.b * inverseTranspose.m[1][2] +
- source.c * inverseTranspose.m[2][2] +
+ source.c * inverseTranspose.m[2][2] +
source.d * inverseTranspose.m[3][2];
- d = source.a * inverseTranspose.m[0][3] +
+ d = source.a * inverseTranspose.m[0][3] +
source.b * inverseTranspose.m[1][3] +
- source.c * inverseTranspose.m[2][3] +
+ source.c * inverseTranspose.m[2][3] +
source.d * inverseTranspose.m[3][3];
}
{
double divisor = a * line.delta.x + b * line.delta.y + c * line.delta.z;
- result.x = (b * line.delta.y * line.p0.x - b * line.delta.x * line.p0.y +
+ result.x = (b * line.delta.y * line.p0.x - b * line.delta.x * line.p0.y +
c * line.delta.z * line.p0.x - c * line.delta.x * line.p0.z -
d * line.delta.x ) / divisor;
- result.y = (a * line.delta.x * line.p0.y - a * line.delta.y * line.p0.x +
- c * line.delta.z * line.p0.y - c * line.delta.y * line.p0.z -
+ result.y = (a * line.delta.x * line.p0.y - a * line.delta.y * line.p0.x +
+ c * line.delta.z * line.p0.y - c * line.delta.y * line.p0.z -
d * line.delta.y ) / divisor;
- result.z = (a * line.delta.x * line.p0.z - a * line.delta.z * line.p0.x +
+ result.z = (a * line.delta.x * line.p0.z - a * line.delta.z * line.p0.x +
b * line.delta.y * line.p0.z - b * line.delta.z * line.p0.y -
d * line.delta.z ) / divisor;
}
{
double divisor = a * line.delta.x + b * line.delta.y + c * line.delta.z;
- result.x = (float)((b * line.delta.y * line.p0.x - b * line.delta.x * line.p0.y +
+ result.x = (float)((b * line.delta.y * line.p0.x - b * line.delta.x * line.p0.y +
c * line.delta.z * line.p0.x - c * line.delta.x * line.p0.z -
d * line.delta.x ) / divisor);
- result.y = (float)((a * line.delta.x * line.p0.y - a * line.delta.y * line.p0.x +
- c * line.delta.z * line.p0.y - c * line.delta.y * line.p0.z -
+ result.y = (float)((a * line.delta.x * line.p0.y - a * line.delta.y * line.p0.x +
+ c * line.delta.z * line.p0.y - c * line.delta.y * line.p0.z -
d * line.delta.y ) / divisor);
- result.z = (float)((a * line.delta.x * line.p0.z - a * line.delta.z * line.p0.x +
+ result.z = (float)((a * line.delta.x * line.p0.z - a * line.delta.z * line.p0.x +
b * line.delta.y * line.p0.z - b * line.delta.z * line.p0.y -
d * line.delta.z ) / divisor);
}
if ( cosom < 0.0 )
{
- cosom = -cosom;
+ cosom = -cosom;
to1[0] = -to.x;
to1[1] = -to.y;
to1[2] = -to.z;
to1[3] = -to.w;
- }
- else
+ }
+ else
{
to1[0] = to.x;
to1[1] = to.y;
to1[3] = to.w;
}
- if ( (1.0 - cosom) > DELTA )
+ if ( (1.0 - cosom) > DELTA )
{
omega = acos(cosom);
sinom = sin(omega);
scale0 = sin((1.0 - t) * omega) / sinom;
scale1 = sin(t * omega) / sinom;
- }
- else
- {
+ }
+ else
+ {
scale0 = 1.0 - t;
scale1 = t;
}
}, { sourceX, sourceY, sourceZ });
*/
- double var1 =
+ double var1 =
matrix.m[2][0] * matrix.m[0][2] * matrix.m[1][1]
- matrix.m[0][2] * matrix.m[2][1] * matrix.m[1][0]
- matrix.m[2][2] * matrix.m[0][0] * matrix.m[1][1]
- matrix.m[0][2] * matrix.m[0][1] * matrix.m[1][0]
+ matrix.m[2][1] * matrix.m[0][0] * matrix.m[1][2]
+ matrix.m[0][1] * matrix.m[0][0] * matrix.m[1][2];
-
+
x = (
- matrix.m[2][2] * source.x * matrix.m[1][1]
+ matrix.m[2][2] * matrix.m[1][0] * source.y
- matrix.m[2][2] * matrix.m[1][0] * matrix.m[3][1]
- + matrix.m[2][2] * matrix.m[3][0] * matrix.m[1][1]
+ + matrix.m[2][2] * matrix.m[3][0] * matrix.m[1][1]
- matrix.m[2][0] * matrix.m[3][2] * matrix.m[1][1]
+ source.x * matrix.m[2][1] * matrix.m[1][2]
+ source.x * matrix.m[0][1] * matrix.m[1][2]
property double lengthApprox
{
get
- {
+ {
double ix = Abs(x), iy = Abs(y), iz = Abs(z);
double tmp;
if(ix < iy) { tmp = ix; ix = iy; iy = tmp; }
public struct Vector3Df
{
float x, y, z;
-
+
void Add(Vector3Df vector1, Vector3Df vector2)
{
x = vector1.x + vector2.x;
- matrix.m[0][2] * matrix.m[0][1] * matrix.m[1][0]
+ matrix.m[2][1] * matrix.m[0][0] * matrix.m[1][2]
+ matrix.m[0][1] * matrix.m[0][0] * matrix.m[1][2]);
-
+
x = (float)(
- matrix.m[2][2] * source.x * matrix.m[1][1]
+ matrix.m[2][2] * matrix.m[1][0] * source.y
- matrix.m[2][2] * matrix.m[1][0] * matrix.m[3][1]
- + matrix.m[2][2] * matrix.m[3][0] * matrix.m[1][1]
+ + matrix.m[2][2] * matrix.m[3][0] * matrix.m[1][1]
- matrix.m[2][0] * matrix.m[3][2] * matrix.m[1][1]
+ source.x * matrix.m[2][1] * matrix.m[1][2]
+ source.x * matrix.m[0][1] * matrix.m[1][2]
+ matrix.m[2][0] * source.z * matrix.m[1][1]
- matrix.m[3][0] * matrix.m[0][1] * matrix.m[1][2]
) / var1;
-
+
y = - (float)(
- matrix.m[2][0] * matrix.m[0][2] * source.y
+ matrix.m[2][1] * matrix.m[0][0] * matrix.m[3][2]
property float lengthApprox
{
get
- {
+ {
float ix = Abs(x), iy = Abs(y), iz = Abs(z);
float tmp;
if(ix < iy) { tmp = ix; ix = iy; iy = tmp; }
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
cube.ec - Translucent Cube 3D Model
****************************************************************************/
import "Display"
uint16 indices[6][4] =
{
// up, front, down, back, right, left
- { 17,21,20,16 },
- { 0,3,2,1 },
- { 22,18,19,23 },
- { 5,6,7,4 },
- { 9,10,14,13 },
+ { 17,21,20,16 },
+ { 0,3,2,1 },
+ { 22,18,19,23 },
+ { 5,6,7,4 },
+ { 9,10,14,13 },
{ 12,15,11,8 }
};
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
skybox.ec - SkyBox 3D Model
****************************************************************************/
import "Display"
// up, front, down, back, right, left
/*
{ 20,21,16,17 },
- { 7,6,4,5 },
- { 19,18,23,22 },
- { 2,3,1,0 },
+ { 7,6,4,5 },
+ { 19,18,23,22 },
+ { 2,3,1,0 },
{ 14,10,13,9 },
{ 11,15,8,12 }
*/
{ 20,21,17,16 },
- { 7,6,5,4 },
- { 19,18,22,23 },
- { 2,3,0,1 },
+ { 7,6,5,4 },
+ { 19,18,22,23 },
+ { 2,3,0,1 },
{ 14,10,9,13 },
{ 11,15,12,8 }
};
Quaternion iquat;
iquat.Inverse(camera.cOrientation);
transform.orientation = iquat;
- }
+ }
UpdateTransform();
display.DrawObject(this);
{
size = { 10000,10000,10000 };
folder = ":skycube";
- extension = "pcx";
+ extension = "pcx";
}
Vector3Df size;
for(lon = 0; lon < numLon; lon++)
{
Angle theta, omega, cosOmega;
-
+
theta = lon * 2 * Pi / (numLon - 1);
omega = (lat + 1) * Pi / (numLat - 1) - Pi / 2;
pVertices[index].y = (float) sin(omega);
pVertices[index].z = (float) (cos(theta) * cos(omega));
pNormals[index] = pVertices[index];
-
+
omega = (numLat - 2) * Pi / (numLat - 1) - Pi / 2;
cosOmega = cos(omega);
index += numLon+2;
#define TRI_VERTEXL 0x4110
#define TRI_FACEL1 0x4120
#define TRI_MATERIAL 0x4130
-#define TRI_MAPPINGCOORS 0x4140
-#define TRI_SMOOTHING 0x4150
+#define TRI_MAPPINGCOORS 0x4140
+#define TRI_SMOOTHING 0x4150
#define TRI_LOCAL 0x4160
// Light Chunks
info->f.Seek(info->pos, start);
childInfo.chunkId = ReadWORD(info->f);
length = ReadDWORD(info->f);
-
+
childInfo.pos += sizeof(uint16) + sizeof(uint);
childInfo.end = info->pos + length;
int * numShared;
VertexConfigList * configLists = new0 VertexConfigList[nVertices];
-
+
nNewVertices = nVertices;
for(c = 0; c<info->nFaces; c++)
{
int v;
VertexConfigList * configList = &configLists[index];
VertexConfig * config = null;
- for(v = 0; v<configList->numConfig; v++)
+ for(v = 0; v<configList->numConfig; v++)
{
uint smoothGroups = configList->config[v].smoothGroups;
if(smoothGroups == face->smoothGroups)
configList->config = renew configList->config VertexConfig[configList->numConfig + 1];
config = &configList->config[configList->numConfig++];
config->index = index;
- config->smoothGroups = face->smoothGroups;
+ config->smoothGroups = face->smoothGroups;
}
}
else
*normal = { 0,0,0 };
}
}
-
+
delete oldVertices;
delete oldTexCoords;
}
int i;
Plane plane;
Vector3Df planeNormal;
- plane.FromPointsf(mesh.vertices[face->oldIndices[2]],
- mesh.vertices[face->oldIndices[1]],
+ plane.FromPointsf(mesh.vertices[face->oldIndices[2]],
+ mesh.vertices[face->oldIndices[1]],
mesh.vertices[face->oldIndices[0]]);
planeNormal = { (float)plane.normal.x, (float)plane.normal.y, (float)plane.normal.z };
if(face->smoothGroups)
{
int c;
uint16 count = ReadWORD(info->f);
- mesh.primitives = renew mesh.primitives PrimitiveSingle[mesh.nPrimitives + count];
+ mesh.primitives = renew mesh.primitives PrimitiveSingle[mesh.nPrimitives + count];
for(c = 0; c<count; c++)
{
uint16 face = ReadWORD(info->f);
triangle->material = mat;
- info->faces[face].done = (byte)bool::true;
+ info->faces[face].done = (byte)bool::true;
}
object.flags.translucent = true;
}
group.indices[c*3+1] = info->faces[face].indices[1];
group.indices[c*3+2] = info->faces[face].indices[2];
}
- info->faces[face].done = (byte)bool::true;
+ info->faces[face].done = (byte)bool::true;
}
mesh.UnlockPrimitiveGroup(group);
}
int i;
for(i = 0; i<3; i++)
{
- info->faces[c].oldIndices[i] =
+ info->faces[c].oldIndices[i] =
info->faces[c].indices[i] = ReadWORD(info->f);
}
ReadWORD(info->f);
// Add faces without a material all together
count = 0;
for(c = 0; c<nFaces; c++)
- if(!info->faces[c].done)
+ if(!info->faces[c].done)
count++;
if(count)
{
zAxis.Normalize(zAxis);
orth.CrossProduct(yAxis, zAxis);
- if((Abs(orth.x) > 0.00001 && Sgn(orth.x) != Sgn(xAxis.x)) ||
- (Abs(orth.y) > 0.00001 && Sgn(orth.y) != Sgn(xAxis.y)) ||
+ if((Abs(orth.x) > 0.00001 && Sgn(orth.x) != Sgn(xAxis.x)) ||
+ (Abs(orth.y) > 0.00001 && Sgn(orth.y) != Sgn(xAxis.y)) ||
(Abs(orth.z) > 0.00001 && Sgn(orth.z) != Sgn(xAxis.z)))
{
object.flags.flipWindings ^= true;
}
orth.CrossProduct(zAxis, xAxis);
- if((Abs(orth.x) > 0.00001 && Sgn(orth.x) != Sgn(yAxis.x)) ||
- (Abs(orth.y) > 0.00001 && Sgn(orth.y) != Sgn(yAxis.y)) ||
+ if((Abs(orth.x) > 0.00001 && Sgn(orth.x) != Sgn(yAxis.x)) ||
+ (Abs(orth.y) > 0.00001 && Sgn(orth.y) != Sgn(yAxis.y)) ||
(Abs(orth.z) > 0.00001 && Sgn(orth.z) != Sgn(yAxis.z)))
{
object.flags.flipWindings ^= true;
}
orth.CrossProduct(xAxis, yAxis);
- if((Abs(orth.x) > 0.00001 && Sgn(orth.x) != Sgn(zAxis.x)) ||
- (Abs(orth.y) > 0.00001 && Sgn(orth.y) != Sgn(zAxis.y)) ||
+ if((Abs(orth.x) > 0.00001 && Sgn(orth.x) != Sgn(zAxis.x)) ||
+ (Abs(orth.y) > 0.00001 && Sgn(orth.y) != Sgn(zAxis.y)) ||
(Abs(orth.z) > 0.00001 && Sgn(orth.z) != Sgn(zAxis.z)))
{
object.flags.flipWindings ^= true;
for(c = 0; c<mesh.nVertices; c++)
{
Vector3Df vertex = mesh.vertices[c];
-
+
mesh.vertices[c].MultMatrix(vertex, inverse);
mesh.vertices[c].x -= object.pivot.x;
delete opacityMap;
}
}
-
+
if(mat.baseMap)
{
if(!mat.baseMap.displaySystem && info->parent->chunkId == MAT_MAPOPACITY && opacityMap)
for(c = 0; c < opacityMap.width * opacityMap.height; c++)
picture[c] = ColorAlpha { ((ColorAlpha *)opacityMap.picture)[c].color.r, picture[c].color };
}
- mat.diffuse.r = mat.diffuse.g = mat.diffuse.b =
+ mat.diffuse.r = mat.diffuse.g = mat.diffuse.b =
mat.ambient.r = mat.ambient.g = mat.ambient.b = 1.0f;
}
if(opacityMap != mat.baseMap)
}
case LIT_ATTENUATION:
{
- /* solve (
- {
- d = 300, small = 0.001,
- Kl = 0, Kc = 0,
+ /* solve (
+ {
+ d = 300, small = 0.001,
+ Kl = 0, Kc = 0,
d * (Kl + Kq * d) = (1 / small) - Kc
- },
+ },
{ Kc, Kl, Kq, small, d });
*/
key->frame = ReadDWORD(info->f);
accelerationFlags = ReadWORD(info->f);
-
+
if(accelerationFlags & ACCFLAG_TENSION)
key->tension = ReadFloat(info->f);
if(accelerationFlags & ACCFLAG_CONTINUITY)
Vector3Df axis;
Angle angle = ReadFloat(info->f);
Vector3Df fixedAxis;
-
+
Read3DVertex(info->f, axis);
fixedAxis.x = axis.x;
fixedAxis.y = -axis.z;
object = Object { };
object.name = block.dummyName;
info->rootObject.children.AddName(object);
- object.transform.scaling = { 1,1,1 };
+ object.transform.scaling = { 1,1,1 };
}
else
{
object = Object { };
object.name = block.dummyName;
info->rootObject.children.AddName(object);
- object.transform.scaling = { 1, 1, 1 };
+ object.transform.scaling = { 1, 1, 1 };
object.flags.camera = true;
}
else
object = Object { };
object.name = block.dummyName;
info->rootObject.children.AddName(object);
- object.transform.scaling = { 1,1,1 };
+ object.transform.scaling = { 1,1,1 };
}
else
{
object = Object { };
object.name = block.dummyName;
info->rootObject.children.AddName(object);
- object.transform.scaling = { 1, 1, 1 };
+ object.transform.scaling = { 1, 1, 1 };
object.flags.light = true;
}
else
info->rootObject.startFrame = ReadDWORD(info->f);
info->rootObject.endFrame = ReadDWORD(info->f);
*&(info->rootObject.frame) = info->rootObject.startFrame;
- break;
+ break;
}
}
return true;
result = true;
}
delete info.f;
- }
+ }
}
if(!result)
object.Free(displaySystem);
int typeToTry = -1;
Bitmap bitmap { };
- if(!type)
+ if(!type)
{
type = GetExtension(fileName, ext);
strlwr(type);
}
if(!palette)
{
-
+
if(bitmap.Load(fileName, type, null))
{
palette = bitmap.Quantize(0, 255);
int acrossY = height / size;
for(cy = 0; cy < acrossY; cy++)
- for(cx = 0; cx < acrossX; cx++)
+ for(cx = 0; cx < acrossX; cx++)
{
int x,y;
Color in1, in2, res;
int typeToTry = -1;
if(!fileName) return false;
- if(!type)
+ if(!type)
{
type = GetExtension(fileName, ext);
strlwr(type);
break;
}
delete f;
- }
+ }
}
if(typeToTry == -1) break;
}
Bitmap grayed { };
grayed.Allocate(null, width, height, 0, pixelFormat888, false);
-
+
for(y = 0; y <height - 1; y++)
{
for(x = 0; x < width - 1; x++)
if(/*b.a > 128 && */(b.r + b.g + b.b) < TRESHOLD)
{
// TODO: Precomp syntax error here without brackets
- ((ColorAlpha *)grayed.picture)[(y + 1) * grayed.stride + (x + 1)] =
+ ((ColorAlpha *)grayed.picture)[(y + 1) * grayed.stride + (x + 1)] =
ColorAlpha { b.a, white };
}
}
}
-
+
for(c = 0; c<size; c++)
{
ColorRGBA b = ((ColorRGBA *)picture)[c];
//if(b.a > 128)
{
- ((ColorAlpha *)grayed.picture)[c] =
- (/*b.a > 128 && */b.r + b.g + b.b < TRESHOLD) ?
+ ((ColorAlpha *)grayed.picture)[c] =
+ (/*b.a > 128 && */b.r + b.g + b.b < TRESHOLD) ?
ColorAlpha { b.a, { 128, 128, 128 } } : ColorAlpha { b.a, { 212, 208, 200 } };
}
}
-
+
Free();
pixelFormat = grayed.pixelFormat;
Bitmap grayed { };
grayed.Allocate(null, width, height, 0, pixelFormat888, false);
-
-
+
+
for(y = 0; y <height - 1; y++)
{
for(x = 0; x < width - 1; x++)
if(b && (palette[b].color.r + palette[b].color.g + palette[b].color.b) < TRESHOLD)
{
// TODO: Precomp syntax error here without brackets
- ((ColorAlpha *)grayed.picture)[(y + 1) * grayed.stride + (x + 1)] =
+ ((ColorAlpha *)grayed.picture)[(y + 1) * grayed.stride + (x + 1)] =
ColorAlpha { 255, white };
}
}
}
-
+
for(c = 0; c<size; c++)
{
byte b = picture[c];
if(b)
{
- ((ColorAlpha *)grayed.picture)[c] =
+ ((ColorAlpha *)grayed.picture)[c] =
//(bitmap.palette[b].color) ? Color { 212, 208, 200 } : Color { 128,128,128 };
- (palette[b].color.r + palette[b].color.g + palette[b].color.b < TRESHOLD) ?
+ (palette[b].color.r + palette[b].color.g + palette[b].color.b < TRESHOLD) ?
ColorAlpha { 255, { 128, 128, 128 } } : ColorAlpha { 255, { 212, 208, 200 } };
}
}
-
+
Free();
pixelFormat = grayed.pixelFormat;
{
int x, y;
Bitmap grayed { };
-
+
grayed.Allocate(null, width, height, 0, pixelFormat888, false);
-
+
for(y = 0; y<height - 1; y++)
{
for(x = 0; x<width - 1; x++)
char ext[MAX_EXTENSION];
subclass(BitmapFormat) format;
- if(!type)
+ if(!type)
{
type = GetExtension(fileName, ext);
strlwr(type);
c = 0;
mainNode.AddNodeToColorTable(palette + start, &c);
-
+
{
Bitmap newBitmap { };
if(newBitmap.Allocate(null, width, height, 0, pixelFormat8, false))
int y, x;
ColorAlpha * picture = (ColorAlpha *)this.picture;
byte * newPicture = newBitmap.picture;
-
+
for(y = 0; y < height; y++)
for(x = 0; x < width; x++, picture++, newPicture++)
{
byte color;
-
+
if(transparent && start > 0 && !picture->a)
color = 0;
else
if(fileName)
{
DisplaySystem ds = displaySystem;
-
+
bitmap = Bitmap { alphaBlend = (alphaBlend && displaySystem.pixelFormat != pixelFormat8), keepData = keepData };
#if defined(__WIN32__)
// if(bitmap.alphaBlend) ds = null;
{
Window editData = class::OnEdit(window, master, x + 24, y, w - 48, h, userData);
Button browse
- {
+ {
window, master = editData, inactive = true, text = "...", hotKey = f2,
position = { Max(x + 24, x + w - 24), y }, size = { 24, h };
// TOCHECK: Why do we need to Refresh here?
master.Refresh();
- // TODO: This is a Button?
+ // TODO: This is a Button?
// contents = filePath;
}
return true;
set
{
mono = value;
- }
+ }
get { return this ? mono : false; }
};
property bool transparent { set { transparent = value; } get { return this ? transparent : false; } isset { return (this && !transparent) ? true : false; } };
{
Size size = { 0 };
char * string = "";
- ColorDropBox colorDropBox
+ ColorDropBox colorDropBox
{
dataBox, master = master, editText = true, //position = Point { x + 24, y }, /*clientSize.h = */size.h = h, size.w = w - 24,
anchor = { left = 24, top = 0, right = 0, bottom = 0 },
char tempString[MAX_F_STRING];
char * result;
bool needClass = false;
- tempString[0] = 0;
+ tempString[0] = 0;
result = OnGetString(tempString, null, &needClass);
if(result) string = result;
}
}
bool OnGetDataFromString(char * string)
- {
+ {
if(!atoi(string) && (((DefinedColor)this).class::OnGetDataFromString(string) ||
((SystemColor)this).class::OnGetDataFromString(string)))
return true;
surface.Area(x - 4, y, x + 20, y + 15);
surface.SetBackground(this);
- surface.Area(x, y + 2, x+17, y+13);
+ surface.Area(x, y + 2, x+17, y+13);
surface.SetForeground(black);
surface.Rectangle(x-1, y + 1, x + 18, y + 14);
}
float minV, maxV, diff,dr,dg,db;
float h, s, v;
-
+
minV = Min(r, g);
minV = Min(minV, b);
db = (maxV - b)/diff;
/*
- if R=V then -- between yellow and magenta [degrees]
- H=60.0*(G-B)/Delta
- else if G=V then -- between cyan and yellow
- H=120.0+60.0*(B-R)/Delta
- else -- between magenta and cyan
- H=240.0+60.0*(R-G)/Delta
+ if R=V then -- between yellow and magenta [degrees]
+ H=60.0*(G-B)/Delta
+ else if G=V then -- between cyan and yellow
+ H=120.0+60.0*(B-R)/Delta
+ else -- between magenta and cyan
+ H=240.0+60.0*(R-G)/Delta
*/
- if(r == maxV)
+ if(r == maxV)
h = db - dg;
else if(g == maxV)
h = 2 + dr - db;
float q = v*(1-(s*f));
float t = v*(1-s*(1-f));
float r,g,b;
- switch(i)
+ switch(i)
{
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
float x = r * 0.412453f + g * 0.357580f + b * 0.180423f;
float y = r * 0.212671f + g * 0.715160f + b * 0.072169f;
float z = r * 0.019334f + g * 0.119193f + b * 0.950227f;
-
+
x /= 0.950456f;
y /= 1;
z /= 1.088754f;
float x,y,z,r,g,b, P;
P = (l + 16)/116;
-
+
if(l > 903.3f * 0.008856f)
{
y = (l + 16) / 116;
x = a / 500 + P;
- if(x > 0.206893f)
+ if(x > 0.206893f)
x = x*x*x;
else
x = (116 * x - 16) / 903.3f;
z = P - this.b / 200;
- if(z > 0.206893f)
+ if(z > 0.206893f)
z = z*z*z;
else
z = (116 * z - 16) / 903.3f;
-
+
x *= 0.950456f;
y *= 1;
{
// surface.WriteTextDots(alignment, x + 24, y + 1, width - 24, string, strlen(string));
surface.SetBackground(this);
- surface.Area(x, y + 4, x+19, y+11);
+ surface.Area(x, y + 4, x+19, y+11);
surface.SetForeground(black);
surface.Rectangle(x-1, y + 3, x + 20, y + 12);
Window pullDown
{
- master = this, interim = true, autoCreate = false, minSize = { 204, 222 },
+ master = this, interim = true, autoCreate = false, minSize = { 204, 222 },
background = formColor, borderStyle = contour|bevel;
bool OnKeyDown(Key key, unichar ch)
position = Point { 136, 0 },
isRadio = true,
bevelOver = true,
- inactive = true,
+ inactive = true,
bitmap = null;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
virtual void ::Scroll(Display, Box, int, int, Extent);
virtual void ::Update(Display, Box);
virtual void ::EndUpdate(Display);
-
+
// Allocate/free a bitmap
virtual bool ::AllocateBitmap(DisplaySystem, Bitmap, int, int, int, PixelFormat, bool);
virtual void ::FreeBitmap(DisplaySystem, Bitmap);
// Grab from the screen
virtual bool ::GrabScreen(Display, Bitmap, int, int, unsigned int, unsigned int);
-
+
// Converts a bitmap format
virtual bool ::ConvertBitmap(DisplaySystem, Bitmap, PixelFormat, ColorAlpha *);
};
public enum Resolution : int
{
- resText80x25, res320x200, res320x240, res320x400, res360x480, res400x256, res400x300, res512x256, res512x384,
+ resText80x25, res320x200, res320x240, res320x400, res360x480, res400x256, res400x300, res512x256, res512x384,
res640x200, res640x350, res640x400, res640x480, res720x348, res800x600, res856x480, res960x720, res1024x768,
res1152x864, res1280x1024, res1600x1200, res768x480
};
d = - (a * poly2.middle.x + b * poly2.middle.y + c * poly2.middle.z);
}
- for(v = 0; v < primitive->nIndices; v++)
+ for(v = 0; v < primitive->nIndices; v++)
{
double surface;
Vector3Df * local = &mesh.vertices[primitive->indices[v]];
surface = a * vertex.x + b * vertex.y + c * vertex.z + d;
- if(surface < EPSILON)
+ if(surface < EPSILON)
{
result = false;
break;
c*=-1;
d = - (a * middle.x + b * middle.y + c * middle.z);
}
-
- for(v = 0; v < primitive->nIndices; v++)
+
+ for(v = 0; v < primitive->nIndices; v++)
{
double surface;
Vector3Df * local = &mesh.vertices[primitive->indices[v]];
{
// Fix for OnLoadGraphics time alpha blended window text extent on GDI
#if defined(__WIN32__) && !defined(ECERE_NOTRUETYPE)
- if(this && alphaBlend && pixelFormat == pixelFormat888 &&
+ if(this && alphaBlend && pixelFormat == pixelFormat888 &&
displaySystem.driver == class(GDIDisplayDriver))
{
Surface s = GetSurface(0,0,null);
{
displaySystem.driver.SetPalette(this, palette, colorMatch);
}
-
+
void RestorePalette(void)
{
- displaySystem.driver.RestorePalette(this);
+ displaySystem.driver.RestorePalette(this);
}
bool Lock(bool render)
Log(" ");
Logf("Locking (%d)\n", current+1);
*/
-
+
// TOCHECK: Why is displaySystem null with GISDesigner?
result = displaySystem && displaySystem.Lock();
if(result && render)
current--;
/*{
int c;
-
+
for(c = 0; c<current; c++)
Log(" ");
Logf("Unlocking (%d)\n", current);
{
if(!display3D.selection)
displaySystem.driver.SelectMesh(this, null);
-
+
display3D.material = null;
display3D.mesh = null;
}
double r = camera.origin.x - (display3D.pickX + display3D.pickWidth/2.0f);
double t = (display3D.pickY - display3D.pickHeight/2.0f) - camera.origin.y;
double b = (display3D.pickY + display3D.pickHeight/2.0f) - camera.origin.y;
-
+
fovLeft = atan(l / camera.focalX);
fovRight = atan(r / camera.focalX);
fovTop = atan(t / camera.focalY);
fovBottom = atan(b / camera.focalY);
-
+
// --- Left ---
quat.Yaw(fovLeft - Pi/2);
quat.ToDirection(normal);
Matrix matrix;
Matrix inverse, inverseTranspose;
int c;
-
+
if(object.flags.viewSpace)
matrix = object.matrix;
else
- {
+ {
Camera camera = display3D.camera;
Matrix temp = object.matrix;
temp.m[3][0] -= camera.cPosition.x;
sort->middle.MultMatrix(triangle->middle, matrix);
sort->middle.z *= -1;
// sort->plane.MultMatrix(triangle->plane, inverseTranspose);
- sort->plane.d = plane->a * inverseTranspose.m[0][3] +
+ sort->plane.d = plane->a * inverseTranspose.m[0][3] +
plane->b * inverseTranspose.m[1][3] +
- plane->c * inverseTranspose.m[2][3] +
+ plane->c * inverseTranspose.m[2][3] +
plane->d * inverseTranspose.m[3][3];
}
}
planes = object.flags.viewSpace ? display3D.viewPickingPlanes : display3D.worldPickingPlanes;
else
planes = object.flags.viewSpace ? camera.viewClippingPlanes : camera.worldClippingPlanes;
-
+
visible = object.InsideFrustum(planes);
if(visible || display3D.pickingPlanes)
if(object.flags.light && !object.light.flags.off)
display.SetLight(id++, object.light);
-
+
for(child = object.children.first; child; child = child.next)
{
id = _SetLights(display, child, id);
- }
+ }
}
return id;
}
int c = 0;
int nIndex = 1, nPoints = 1;
int offset = 0;
- bool result = false;
+ bool result = false;
Vector3D * points = this.points;
Vector3D * newPoints = this.newPoints;
byte * goodPoints = this.goodPoints;
bool i32bit = primitive.type.indices32bit;
uint32 * indices32 = primitive.indices;
uint16 * indices16 = primitive.indices;
-
+
switch(primitive.type.primitiveType)
{
case triangles: nIndex = 3; nPoints = 3; break;
points[1] = { (double)tmp.x, (double)tmp.y, (double)tmp.z };
break;
}
-
+
for(c = offset; c<nVertices; c += nIndex)
{
bool outside = false;
}
}
- for(p = 0; p < 6; p++)
+ for(p = 0; p < 6; p++)
{
Plane * plane = &planes[p];
int i;
int numGoodPoints = 0;
-
+
memset(goodPoints, 0, n);
- for(i = 0; i < n; i++)
+ for(i = 0; i < n; i++)
{
double dot = plane->normal.DotProduct(points[i]);
double distance = dot + plane->d;
}
else
{
- Line edge;
+ Line edge;
int next;
if(lastGood == -1)
if(object.flags.viewSpace)
matrix = object.matrix;
else
- {
+ {
Camera camera = this.camera;
Matrix temp = object.matrix;
temp.m[3][0] -= camera.cPosition.x;
}
}
- for(v = 0; v<primitive->nIndices; v++)
+ for(v = 0; v<primitive->nIndices; v++)
{
Vector3Df * local = &mesh.vertices[primitive->indices[v]];
Vector3Df vertex;
Logf("Triangle %d (%s):\n", c, primitive->material->name);
- for(v = 0; v<primitive->nIndices; v++)
+ for(v = 0; v<primitive->nIndices; v++)
{
Vector3Df * local = &mesh.vertices[primitive->indices[v]];
Vector3Df vertex;
Logf("Triangle %d (%s):\n", c, primitive->material->name);
- for(v = 0; v<primitive->nIndices; v++)
+ for(v = 0; v<primitive->nIndices; v++)
{
Vector3Df * local = &mesh.vertices[primitive->indices[v]];
Vector3Df vertex;
//exit(0);
/*
- If all five tests fail for a particular Q,
- then P might obscure Q. Now Q must be tested.
- First, the algorithm checks if Q has been "marked."
- If Q is marked, then Q was "moved around" in the list
- during a previous iteration of the loop. The algorithm
- only allows a polygon to be moved once, to avoid the possibility
- of infinite loops. If Q is not marked, it is tested to see
- if it might obscure P. If Q cannot obscure P, then Q is possibly
- behind P and so it is good candidate to be drawn next.
- Therefore, the algorithm "abandons" the current P (that is, it
- stops testing Q's against the current P) and moves the current
+ If all five tests fail for a particular Q,
+ then P might obscure Q. Now Q must be tested.
+ First, the algorithm checks if Q has been "marked."
+ If Q is marked, then Q was "moved around" in the list
+ during a previous iteration of the loop. The algorithm
+ only allows a polygon to be moved once, to avoid the possibility
+ of infinite loops. If Q is not marked, it is tested to see
+ if it might obscure P. If Q cannot obscure P, then Q is possibly
+ behind P and so it is good candidate to be drawn next.
+ Therefore, the algorithm "abandons" the current P (that is, it
+ stops testing Q's against the current P) and moves the current
Q to the end of the list to become the next P.
*/
/*
/*
{
- for(c=0; c<nTriangles; c++)
+ for(c=0; c<nTriangles; c++)
{
int b;
SortPrimitive * poly1 = &triangles[c];
- // for(b=0; b<nTriangles; b++)
- //for(b=c+1; b<nTriangles; b++)
+ // for(b=0; b<nTriangles; b++)
+ //for(b=c+1; b<nTriangles; b++)
b = c+1;
if(b<this.nTriangles)
{
current--;
if(!current)
driver.UnlockSystem(this);
-
+
mutex.Release();
}
#if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D)
materials.AddName(material);
else
materials.Add(material);
- return true;
+ return true;
}
Material GetMaterial(char * name)
while(nextKey && percent > nextKey->percent)
{
- key = nextKey; keyNum = nextKeyNum;
-
- if(keyNum < numKeys - 1)
- {
+ key = nextKey; keyNum = nextKeyNum;
+
+ if(keyNum < numKeys - 1)
+ {
nextKey = key + 1;
- nextKeyNum = keyNum + 1;
+ nextKeyNum = keyNum + 1;
}
else
break;
if(nextKey && nextKey->percent != key->percent)
{
- float scale = ease((percent - key->percent) / (nextKey->percent - key->percent),
+ float scale = ease((percent - key->percent) / (nextKey->percent - key->percent),
smoothness, smoothness);
int cr = key->color.color.r;
int cg = key->color.color.g;
}
}
-float ease(float t, float a, float b)
+float ease(float t, float a, float b)
{
float k;
float s = a + b;
if (s == 0.0f) return t;
- if (s > 1.0f)
+ if (s > 1.0f)
{
a /= s;
b /= s;
get
{
return ((LFBSurface)driverData).bitmap;
- }
+ }
}
ColorAlpha GetPixel(int x, int y)
va_end(args);
}
}
-
+
void Bevel(bool inner, int x, int y, int w, int h)
{
ColorAlpha foreground = this.foreground;
if(boxLeft > firstPixel)
{
percent = (boxLeft - firstPixel) * inc;
- firstPixel = boxLeft;
+ firstPixel = boxLeft;
}
if(boxRight < lastPixel)
lastPixel = boxRight;
while(nextKey && percent > nextKey->percent)
{
- key = nextKey; keyNum = nextKeyNum;
-
- if(keyNum < numKeys - 1)
- {
+ key = nextKey; keyNum = nextKeyNum;
+
+ if(keyNum < numKeys - 1)
+ {
nextKey = key + 1;
- nextKeyNum = keyNum + 1;
+ nextKeyNum = keyNum + 1;
}
else
break;
if(nextKey && nextKey->percent != key->percent)
{
- float scale = ease((percent - key->percent) / (nextKey->percent - key->percent),
+ float scale = ease((percent - key->percent) / (nextKey->percent - key->percent),
smoothness, smoothness);
int cr = key->color.color.r;
int cg = key->color.color.g;
if(info.bitCount == 1)
{
- // Bitmap
+ // Bitmap
byte * buffer = new byte[info.width >> 3];
ColorAlpha * dest24=(ColorAlpha *)bitmap.picture + (flip ? 0 : (info.height-1)) * bitmap.stride;
f.Read(buffer, 1, 8); // TOCHECK: What are these 8 bytes?
{
if(f.Read(buffer, 1, info.width >> 3) != info.width >> 3)
{
- errorReading = true;
+ errorReading = true;
break;
}
for(x = 0; x < info.width; x++)
{
div = (byte)((info.width>>3) % 4);
if(div)
- for(x=0; x<4-div; x++)
+ for(x=0; x<4-div; x++)
if(!f.Getc(null)) { errorReading = true; break; }
if(flip)
dest24 += (bitmap.stride - info.width);
}
// bitmap.height = y;
delete buffer;
- if(!errorReading)
+ if(!errorReading)
result = true;
}
else if(info.bitCount == 24)
{
- // Bitmap
+ // Bitmap
byte * buffer = new byte[info.width * sizeof(Color)];
ColorAlpha * dest24=(ColorAlpha *)bitmap.picture + (flip ? 0 : (info.height-1)) * bitmap.stride;
for(y=0; y<info.height && !errorReading; y++)
{
if(f.Read( buffer, 3, info.width) != info.width)
{
- errorReading = true;
+ errorReading = true;
break;
}
for(x = 0; x < info.width; x++)
{
div = (byte)((info.width * 3) % 4);
if(div)
- for(x=0; x<4-div; x++)
+ for(x=0; x<4-div; x++)
if(!f.Getc(null)) { errorReading = true; break; }
if(flip)
dest24 += (bitmap.stride - info.width);
}
// bitmap.height = y;
delete buffer;
- if(!errorReading)
+ if(!errorReading)
result = true;
}
else if(info.bitCount == 8)
if(!f.Getc(dest256 ++))
{ errorReading = true; break; }
if(!errorReading)
- if(count & 0x01)
+ if(count & 0x01)
if(!f.Getc(null))
{ errorReading = true; break; }
}
break;
div = (byte)(info.width % 4);
if(div)
- for(x=0; x<4-div; x++)
- if(!f.Getc(null))
+ for(x=0; x<4-div; x++)
+ if(!f.Getc(null))
break;
if(flip)
if(f.Read(info, sizeof(info), 1))
{
BMPHead header;
-
+
info.Swap();
header.type[0] = 'B';
header.type[1] = 'M';
bool Load(Bitmap bitmap, File f)
{
bool result = false;
-
+
BMPHead header;
BMPInfo info;
// if(f.Read(&header, sizeof(header), 1) && header.type[0] == 'B' && header.type[1] == 'M' && f.Read(info, sizeof(info), 1))
if(bitmap.pixelFormat == pixelFormat8 || bitmap.pixelFormat == pixelFormat888)
{
File f = FileOpen(filename, write);
- if(f)
+ if(f)
{
BMPHead header;
f.buffered = true;
-
+
header.type[0] = 'B';
header.type[1] = 'M';
header.size=0;
//if(f.Write(&header,sizeof(header),1))
if(f.Write(&header.type, 2, 1) && f.Write(&header.size,sizeof(header) - (uint)&((BMPHead *)0)->size,1))
{
- BMPInfo info;
+ BMPInfo info;
info.bitCount = (bitmap.pixelFormat == pixelFormat8) ? 8 : 24;
info.size = sizeof(BMPInfo);
{
ColorAlpha * dest24;
- // Bitmap
+ // Bitmap
dest24 = (ColorAlpha *)bitmap.picture + (info.height-1) * bitmap.stride;
for(y=0; y<info.height && !errorWriting; y++)
{
{
div = (byte)((info.width * 3) % 4);
if(div)
- for(x=0; x<4-div; x++)
+ for(x=0; x<4-div; x++)
if(!f.Putc(0)) { errorWriting = true; break; }
dest24-=info.width;
- dest24-=bitmap.stride;
+ dest24-=bitmap.stride;
}
}
if(!errorWriting)
delete f;
}
}
- return result;
+ return result;
}
ColorAlpha * LoadPalette(char * fileName, char * type)
}
}
delete f;
- }
+ }
return result;
}
}
for(y = 0; y < gifFile->SHeight; y++)
{
uint x;
- for(x = 0; x < gifFile->SWidth; x++)
+ for(x = 0; x < gifFile->SWidth; x++)
{
byte index = image->RasterBits[y*gifFile->SWidth+x];
if(index == transparent || index >= colorCount)
bool Save(Bitmap bitmap, char * filename, void * options)
{
bool result = false;
- return result;
+ return result;
}
ColorAlpha * LoadPalette(char * fileName, char * type)
typedef struct
{
struct jpeg_source_mgr pub;
-
+
File infile;
byte * buffer;
boolean startOfFile;
if(src->startOfFile)
ERREXIT(cinfo, JERR_INPUT_EMPTY);
WARNMS(cinfo, JWRN_JPEG_EOF);
-
+
src->buffer[0] = (byte) 0xFF;
src->buffer[1] = (byte) JPEG_EOI;
nbytes = 2;
}
-
+
src->pub.next_input_byte = src->buffer;
src->pub.bytes_in_buffer = nbytes;
src->startOfFile = FALSE;
-
+
return TRUE;
}
static void JPEG_SkipInputData (j_decompress_ptr cinfo, long num_bytes)
{
SourceManager * src = (SourceManager *) cinfo->src;
-
- if (num_bytes > 0)
+
+ if (num_bytes > 0)
{
while (num_bytes > (long) src->pub.bytes_in_buffer)
{
static void JPEG_TermSource(j_decompress_ptr cinfo)
{
-
+
}
static void JPEG_SetSource(j_decompress_ptr cinfo, File infile)
{
SourceManager * src;
-
+
if (!cinfo->src)
{
cinfo->src = (struct jpeg_source_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
INPUT_BUF_SIZE * sizeof(byte));
}
-
+
src = (SourceManager *) cinfo->src;
src->pub.init_source = JPEG_InitSource;
src->pub.fill_input_buffer = JPEG_FillInputBuffer;
typedef struct
{
struct jpeg_destination_mgr pub;
-
+
File outfile;
byte * buffer;
} DestinationManager;
static void JPEG_InitDestination(j_compress_ptr cinfo)
{
DestinationManager * dest = (DestinationManager * ) cinfo->dest;
-
+
dest->buffer = (byte *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
OUTPUT_BUF_SIZE * sizeof(byte));
-
+
dest->pub.next_output_byte = dest->buffer;
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
}
static boolean JPEG_EmptyOutputBuffer(j_compress_ptr cinfo)
{
DestinationManager * dest = (DestinationManager *) cinfo->dest;
-
+
if (dest->outfile.Write(dest->buffer, sizeof(byte), OUTPUT_BUF_SIZE) !=
(uint) OUTPUT_BUF_SIZE)
ERREXIT(cinfo, JERR_FILE_WRITE);
-
+
dest->pub.next_output_byte = dest->buffer;
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
-
+
return TRUE;
}
{
DestinationManager * dest = (DestinationManager *) cinfo->dest;
uint datacount = (uint)(OUTPUT_BUF_SIZE - dest->pub.free_in_buffer);
-
+
if (datacount > 0)
{
if (dest->outfile.Write(dest->buffer, sizeof(byte), datacount) != datacount)
static void JPEG_SetDestination(j_compress_ptr cinfo, File outfile)
{
DestinationManager * dest;
-
- if(!cinfo->dest)
+
+ if(!cinfo->dest)
{
cinfo->dest = (struct jpeg_destination_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
sizeof(DestinationManager));
}
-
+
dest = (DestinationManager *) cinfo->dest;
dest->pub.init_destination = JPEG_InitDestination;
dest->pub.empty_output_buffer = JPEG_EmptyOutputBuffer;
jpeg_start_decompress(&cinfo);
buffer = (*cinfo.mem->alloc_sarray) ((j_common_ptr) &cinfo, JPOOL_IMAGE, cinfo.output_width * cinfo.output_components, 1);
- for(picture = (ColorAlpha *)bitmap.picture; cinfo.output_scanline < cinfo.output_height; picture += bitmap.stride)
+ for(picture = (ColorAlpha *)bitmap.picture; cinfo.output_scanline < cinfo.output_height; picture += bitmap.stride)
{
int c;
jpeg_read_scanlines(&cinfo, buffer, 1);
if(bitmap.pixelFormat == pixelFormat888)
{
File f = FileOpen(filename, write);
- if(f)
+ if(f)
{
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
-
+
jpeg_set_quality(&cinfo, 100, TRUE);
jpeg_start_compress(&cinfo, TRUE);
delete f;
result = true;
- }
+ }
}
- return result;
+ return result;
}
ColorAlpha * LoadPalette(char * fileName, char * type)
{
switch(colorPlane)
{
- case 0:
+ case 0:
((RGBA32*)bitmap.picture)[iptr].a = 255;
- ((RGBA32*)bitmap.picture)[iptr].r = b;
+ ((RGBA32*)bitmap.picture)[iptr].r = b;
break;
case 1: ((RGBA32*)bitmap.picture)[iptr].g = b; break;
case 2: ((RGBA32*)bitmap.picture)[iptr].b = b; break;
x++;
iptr++;
if(x == header.bytesPerLine)
- {
+ {
iptr+= bitmap.stride - x;
x = 0;
y++;
case 0: b = ((RGBA32*)bitmap.picture)[iptr].r; break;
case 1: b = ((RGBA32*)bitmap.picture)[iptr].g; break;
case 2: b = ((RGBA32*)bitmap.picture)[iptr].b; break;
- }
+ }
}
else
b = bitmap.picture[iptr];
last = b;
}
count++,x++;iptr++;
-
+
if(x==bitmap.width)
{
x = 0;
if(bitmap.pixelFormat == pixelFormat888)
{
colorPlane ++;
- if(colorPlane == 3)
- {
- colorPlane = 0;
+ if(colorPlane == 3)
+ {
+ colorPlane = 0;
y++;
}
}
iptr = y*bitmap.stride;
if(div)
{
- if(last == padder && count <= 63-div &&
+ if(last == padder && count <= 63-div &&
(colorPlane || bitmap.pixelFormat == pixelFormat8))
count += div;
else
if(!colorPlane)
break;
}
- if(count >= 63)
+ if(count >= 63)
break;
}
if((count>1)||(last>=192))
}
}
delete f;
- }
+ }
}
return result;
}
}
}
delete f;
- }
+ }
return result;
}
}
png_read_info(png_ptr, info_ptr);
channels = png_get_channels(png_ptr, info_ptr);
if(channels == 3 || channels == 4 || channels == 1 || channels == 2)
- {
+ {
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, null, null);
numPasses = png_set_interlace_handling(png_ptr);
if(bitmap)
{
File f = FileOpen(filename, write);
- if(f)
+ if(f)
{
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, null, null, null);
if(png_ptr)
void CocoaGlAssert()
{
GLenum error = glGetError();
-
+
if(error) {
printf("**** glGetError():%i ****\n", error);
exit(1);
bool CreateDisplaySystem(DisplaySystem displaySystem)
{
bool result = true;
-
+
SystemData system = SystemData { };
displaySystem.driverData = system;
DisplayData displayData = display.driverData;
SystemData systemData = display.displaySystem.driverData;
-
+
displayData = display.driverData = DisplayData { };
-
+
CocoaOpenGLMakeCurrentContext(display.window);
-
+
CocoaGlAssert();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
CocoaGlAssert();
CocoaGlAssert();
glDisable(GL_MULTISAMPLE_ARB);
CocoaGlAssert();
-
+
#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA)
display.ambient = Color { 50,50,50 };
#endif
printf("CocoaOpenGLDisplayDriver:DisplaySize(%i,%i) %s:%i\n", width, height, __FILE__, __LINE__);
CocoaOpenGLMakeCurrentContext(display.window);
-
+
glViewport(0,0,width,height);
CocoaGlAssert();
glLoadIdentity();
}
if(displayData.flippingBuffer)
result = true;
-
+
return result;
}
bool result = false;
Bitmap mipMap { };
int glBitmap = -1;
-
+
uint w = pow2i(Min(width, 1024)), h = pow2i(Min(height, 1024));
printf("CocoaOpenGLDisplayDriver:AllocateBitmap %s:%i\n", __FILE__, __LINE__);
{
for(c=0; c<bitmap.size; c++)
{
- // TODO:
+ // TODO:
ColorAlpha color = ((ColorAlpha *)bitmap.picture)[c];
((ColorRGBA *)bitmap.picture)[c] = ColorRGBA { color.color.r, color.color.g, color.color.b, color.a };
}
delete mipMap;
}
}
- else
+ else
mipMap = bitmap;
if(result)
result = false;
}
}
- if(mipMap != bitmap)
+ if(mipMap != bitmap)
delete mipMap;
if(!mipMaps) break;
}
void ReleaseSurface(Display display, Surface surface)
{
printf("CocoaOpenGLDisplayDriver:ReleaseSurface %s:%i\n", __FILE__, __LINE__);
-
+
glDisable(GL_SCISSOR_TEST);
CocoaGlAssert();
delete surface.driverData;
bool GetSurface(Display display, Surface surface, int x,int y, Box clip)
{
bool result = true;
-
+
SurfaceData surfaceData = SurfaceData { };
surface.driverData = surfaceData;
CocoaGlAssert();
result = true;
}
-
+
return result;
}
{
box = surface.box = surface.unclippedBox;
}
-
+
box.left += surface.offset.x;
box.top += surface.offset.y;
box.right+= surface.offset.x;
glColor4fv(surfaceData.foreground);
glBegin(GL_LINES);
-
+
glVertex2f(x1+surface.offset.x + 0.5f, y1+surface.offset.y + 0.5f);
glVertex2f(x2+surface.offset.x + 0.5f, y2+surface.offset.y + 0.5f);
-
+
glEnd();
CocoaGlAssert();
}
glVertex2f(x1+surface.offset.x + 0.5f, y2+surface.offset.y + 0.5f);
glVertex2f(x2+surface.offset.x + 0.5f, y2+surface.offset.y + 0.5f);
glVertex2f(x2+surface.offset.x + 0.5f, y1+surface.offset.y + 0.5f);
-
+
glEnd();
CocoaGlAssert();
}
SurfaceData surfaceData = surface.driverData;
printf("CocoaOpenGLDisplayDriver:Area %s:%i\n", __FILE__, __LINE__);
-
+
CocoaGlAssert();
glColor4fv(surfaceData.background);
glClear(((type != depthBuffer) ? GL_COLOR_BUFFER_BIT : 0) |
((type != colorBuffer) ? GL_DEPTH_BUFFER_BIT : 0));
CocoaGlAssert();
-
+
if(type != colorBuffer && !displayData.depthWrite)
{
glDepthMask((byte)bool::false);
CocoaGlAssert();
}
- if(type != depthBuffer)
+ if(type != depthBuffer)
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
CocoaGlAssert();
glDepthMask((byte)bool::true);
CocoaGlAssert();
}
-
+
glClear(((type != depthBuffer) ? GL_COLOR_BUFFER_BIT : 0) |
((type != colorBuffer) ? GL_DEPTH_BUFFER_BIT : 0));
CocoaGlAssert();
-
+
if(type != colorBuffer)
{
glDepthMask((byte)bool::false);
bool result = false;
printf("CocoaOpenGLDisplayDriver:ConvertBitmap %s:%i\n", __FILE__, __LINE__);
-
+
return result;
}
{
printf("CocoaOpenGLDisplayDriver:Blit %s:%i\n", __FILE__, __LINE__);
printf("--BLIT(dx:%i, dy:%i, sx:%i, sy:%i, w:%i, h:%i)\n", dx, dy, sx, sy, w, h);
-
+
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, (uint)bitmap.driverData);
glBegin(GL_QUADS);
CocoaGlAssert();
glVertex2i(dx+surface.offset.x, dy+surface.offset.y);
CocoaGlAssert();
-
+
glTexCoord2f((float)(sx+sw) / bitmap.width, (float)(sy+sh)/ bitmap.height);
CocoaGlAssert();
glVertex2i(dx+w+surface.offset.x, dy+surface.offset.y);
CocoaGlAssert();
-
+
glTexCoord2f((float)(sx+sw)/ bitmap.width, (float)(sy)/ bitmap.height);
CocoaGlAssert();
glVertex2i(dx+w+surface.offset.x, dy-h+surface.offset.y);
CocoaGlAssert();
-
+
glTexCoord2f((float)(sx) / bitmap.width, (float)(sy)/ bitmap.height);
CocoaGlAssert();
glVertex2i(dx+surface.offset.x, dy-h+surface.offset.y);
CocoaGlAssert();
glVertex2i(dx+surface.offset.x, dy+surface.offset.y);
CocoaGlAssert();
-
+
glTexCoord2f((float)(sx+sw)/ bitmap.width, (float)(sy)/ bitmap.height);
CocoaGlAssert();
glVertex2i(dx+w+surface.offset.x, dy+surface.offset.y);
CocoaGlAssert();
-
+
glTexCoord2f((float)(sx+sw) / bitmap.width, (float)(sy+sh)/ bitmap.height);
CocoaGlAssert();
glVertex2i(dx+w+surface.offset.x, dy+h+surface.offset.y);
CocoaGlAssert();
-
+
glTexCoord2f((float)(sx)/ bitmap.width, (float)(sy+sh)/ bitmap.height);
CocoaGlAssert();
glVertex2i(dx+surface.offset.x, dy+h+surface.offset.y);
{
w = Abs(w);
sw = Abs(sw);
- flipX = true;
+ flipX = true;
}
if(Sgn(h) != Sgn(sh))
{
h = Abs(h);
sh = Abs(sh);
- flipY = true;
+ flipY = true;
}
s2dw=(float)w / sw;
//Clip against the edges of the surfaceination
if(dx<surface.box.left)
{
- //if(!flip)
+ //if(!flip)
sx+=(int)((surface.box.left-dx)*d2sw);
sw-=(int)((surface.box.left-dx)*d2sw);
w-=surface.box.left-dx;
//Clip against the edges of the surfaceination
if(dx<surface.box.left)
{
- //if(!flip)
+ //if(!flip)
sx+=surface.box.left-dx;
w-=surface.box.left-dx;
dx=surface.box.left;
color[1] = light.diffuse.g * light.multiplier;
color[2] = light.diffuse.b * light.multiplier;
glLightfv(GL_LIGHT0 + id, GL_DIFFUSE, color);
-
+
color[0] = light.ambient.r * light.multiplier;
color[1] = light.ambient.g * light.multiplier;
color[2] = light.ambient.b * light.multiplier;
color[1] = light.specular.g * light.multiplier;
color[2] = light.specular.b * light.multiplier;
glLightfv(GL_LIGHT0 + id, GL_SPECULAR,color);
-
+
if(lightObject)
{
Vector3D positionVector;
position[0] = (float)positionVector.x;
position[1] = (float)positionVector.y;
position[2] = (float)positionVector.z;
-
+
glLightfv(GL_LIGHT0 + id, GL_POSITION, position);
CocoaGlAssert();
{
float pickX = display.display3D.pickX + surface.offset.x;
float pickY = display.height - (display.display3D.pickY + surface.offset.y) - 1;
- Matrix pickMatrix =
+ Matrix pickMatrix =
{
{
w / display.display3D.pickWidth, 0, 0, 0,
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
}
}
- {
+ {
float color[4] = { material.specular.r, material.specular.g, material.specular.b, 0 };
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color);
}
float color[4] = { material.emissive.r, material.emissive.g, material.emissive.b, 0 };
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, color);
}
-
+
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, &material.power);
}
if(!mesh.data)
mesh.data = MeshData { };
-
+
if(mesh.data)
{
MeshData meshData = mesh.data;
printf("CocoaOpenGLDisplayDriver: STUB! %s:%i\n", __FILE__, __LINE__);
if(!flags) flags = mesh.flags;
-
+
if(glGenBuffersARB)
{
if(!(flags.vertices) || meshData.vertices)
void FreeIndices(DisplaySystem displaySystem, IndexData indexData)
{
printf("CocoaOpenGLDisplayDriver: STUB! %s:%i\n", __FILE__, __LINE__);
-
+
if(indexData)
{
- if(indexData.buffer)
+ if(indexData.buffer)
glDeleteBuffersARB(1, &indexData.buffer);
delete indexData.indices;
delete indexData;
if(glGenBuffersARB)
{
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, indexData.buffer);
- glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, nIndices * (indices32bit ? sizeof(uint32) : sizeof(uint16)),
+ glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, nIndices * (indices32bit ? sizeof(uint32) : sizeof(uint16)),
indexData.indices, GL_STATIC_DRAW_ARB);
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
uint16 * LockIndices(DisplaySystem displaySystem, IndexData indexData)
{
printf("CocoaOpenGLDisplayDriver: STUB! %s:%i\n", __FILE__, __LINE__);
-
+
return indexData.indices;
}
/*if(display.display3D.mesh && glUnlockArraysEXT)
glUnlockArraysEXT();*/
-
+
if(mesh)
{
DisplayData displayData = display.driverData;
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
-
+
// *** Color Stream ***
if(mesh.colors)
{
glDrawArrays(primitiveTypes[primitive->type.primitiveType], primitive->first, primitive->nVertices);
else
{
- // *** Hoping the data won't be uploaded at all (Won't really work if another group of the mesh is using the mesh ) ***
+ // *** Hoping the data won't be uploaded at all (Won't really work if another group of the mesh is using the mesh ) ***
// HACK TO SPEED THINGS UP...
if(primitive->nIndices < (mesh.nVertices >> 2) && !primitive->type.indices32bit)
{
if(!display.display3D.collectingHits && glBindBufferARB && indexData)
{
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexData.buffer);
- glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
+ glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
primitive->type.indices32bit ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
else if(indexData)
- glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
+ glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
primitive->type.indices32bit ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, indexData.indices);
else
- glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
+ glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
primitive->type.indices32bit ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, primitive->indices);
}
}
DisplaySystem displaySystem = display.displaySystem;
D3D8System d3dSystem = displaySystem.driverData;
D3D8Display d3dDisplay = display.driverData;
-
+
//if(!IDirect3DDevice8_GetBackBuffer(d3dSystem.d3dDevice, 0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dDisplay.backBuffer))
{
D3DLOCKED_RECT lockedRect;
lfbBitmap.stride = lockedRect.Pitch >> GetColorDepthShifts(lfbBitmap.pixelFormat);
lfbBitmap.width = display.width;
lfbBitmap.height = display.height;
-
+
*lfbSurface = lfbBitmap.GetSurface(surface ? surface.offset.x : 0, surface ? surface.offset.y : 0, surface ? &surface.box : null);
result = true;
}
{
displaySystem.flags.alpha = true;
//if(displaySystem.flags.fullScreen)
- displaySystem.flags.flipping = true;
+ displaySystem.flags.flipping = true;
displaySystem.pixelFormat = pixelFormat888;
d3dSystem.d3dDll = LoadLibrary("d3d8.dll");
}
else
{
- d3dSystem.d3dpp.hDeviceWindow = d3dSystem.hwnd =
+ d3dSystem.d3dpp.hDeviceWindow = d3dSystem.hwnd =
CreateWindow("static", null, 0,0,0,0,0,null,null,null,null);
d3dSystem.d3dpp.Windowed = TRUE;
}
d3dSystem.format = d3dSystem.d3dpp.BackBufferFormat = d3ddm.Format;
d3dSystem.d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
- if(!IDirect3D8_CreateDevice(d3dSystem.direct3D, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ if(!IDirect3D8_CreateDevice(d3dSystem.direct3D, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
d3dSystem.d3dpp.hDeviceWindow,
D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE|D3DCREATE_FPU_PRESERVE,
&d3dSystem.d3dpp, &d3dSystem.d3dDevice))
else
{
d3dSystem.usage = D3DUSAGE_SOFTWAREPROCESSING;
- if(!IDirect3D8_CreateDevice(d3dSystem.direct3D, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ if(!IDirect3D8_CreateDevice(d3dSystem.direct3D, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
d3dSystem.d3dpp.hDeviceWindow,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE,
&d3dSystem.d3dpp, &d3dSystem.d3dDevice))
DWORD vertexShaders[NUM_VERTEX_SHADERS][7] =
{
{
- D3DVSD_STREAM(0),
+ D3DVSD_STREAM(0),
D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3),
D3DVSD_END()
},
{
- D3DVSD_STREAM(0),
+ D3DVSD_STREAM(0),
D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3),
D3DVSD_STREAM(1),
D3DVSD_REG(D3DVSDE_NORMAL, D3DVSDT_FLOAT3),
D3DVSD_END()
},
{
- D3DVSD_STREAM(0),
+ D3DVSD_STREAM(0),
D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3),
D3DVSD_STREAM(2),
D3DVSD_REG(D3DVSDE_TEXCOORD0, D3DVSDT_FLOAT2),
D3DVSD_END()
},
{
- D3DVSD_STREAM(0),
+ D3DVSD_STREAM(0),
D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3),
D3DVSD_STREAM(1),
D3DVSD_REG(D3DVSDE_NORMAL, D3DVSDT_FLOAT3),
//d3dDisplay.d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
//d3dDisplay.d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- result = !IDirect3DDevice8_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
+ result = !IDirect3DDevice8_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
&d3dDisplay.d3dpp, &d3dDisplay.swapChain);
if(!result)
{
d3dDisplay.d3dpp.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;
- result = !IDirect3DDevice8_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
+ result = !IDirect3DDevice8_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
&d3dDisplay.d3dpp, &d3dDisplay.swapChain);
}
if(!result)
{
d3dDisplay.d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
- result = !IDirect3DDevice8_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
+ result = !IDirect3DDevice8_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
&d3dDisplay.d3dpp, &d3dDisplay.swapChain);
}
}
if(result)
{
if(d3dDisplay.swapChain)
- result = !IDirect3DSwapChain8_GetBackBuffer(d3dDisplay.swapChain,
+ result = !IDirect3DSwapChain8_GetBackBuffer(d3dDisplay.swapChain,
0, D3DBACKBUFFER_TYPE_MONO, &d3dDisplay.backBuffer);
else
- result = !IDirect3DDevice8_GetBackBuffer(d3dSystem.d3dDevice,
+ result = !IDirect3DDevice8_GetBackBuffer(d3dSystem.d3dDevice,
0, D3DBACKBUFFER_TYPE_MONO, &d3dDisplay.backBuffer);
if(result)
{
d3dSystem.ready = true;
}
}
-
+
if(d3dSystem.ready)
{
float fogDensity = 0;
{
//eSystem_Sleep(0.05);
IDirect3DDevice8_EndScene(d3dSystem.d3dDevice);
-
+
if(display.displaySystem.flags.flipping)
{
if(d3dDisplay.swapChain)
IDirect3DTexture8 * texture;
uint w = pow2i(Min(bitmap.width, 512)), h = pow2i(Min(bitmap.height, 512));
- if(!IDirect3DDevice8_CreateTexture(d3dSystem.d3dDevice, w, h, mipMaps ? log2i(Max(w+1, h+1)) : 1, 0,
+ if(!IDirect3DDevice8_CreateTexture(d3dSystem.d3dDevice, w, h, mipMaps ? log2i(Max(w+1, h+1)) : 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture))
{
int level;
case D3DFMT_A1R5G5B5: mipMap.pixelFormat = pixelFormat555; break;
}
mipMap.stride = lockedRect.Pitch >> GetColorDepthShifts(mipMap.pixelFormat);
-
+
mipSurface = mipMap.GetSurface(0,0,null);
if(mipSurface)
{
mipMap.picture = null;
delete mipMap;
- IDirect3DTexture8_UnlockRect(texture, level);
+ IDirect3DTexture8_UnlockRect(texture, level);
}
if(!mipMaps) break;
}
void SetBackground(Display display, Surface surface, ColorAlpha color)
{
- D3D8Surface d3dSurface = surface.driverData;
+ D3D8Surface d3dSurface = surface.driverData;
d3dSurface.background = color;
}
{ (float)x1, (float)y1, 1.0f, surface.foreground, 0, 0 }
};
- IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_LINESTRIP, 4,
+ IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_LINESTRIP, 4,
vertex, sizeof(D3D8Vertex));
}
{ (float)x2 + 1.0f, (float)y2 + 1.0f, 1.0f, d3dSurface.background, 0, 0 }
};
- IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
+ IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
vertex, sizeof(D3D8Vertex));
}
D3D8Display d3dDisplay = display.driverData;
IDirect3DDevice8_Clear(d3dSystem.d3dDevice, 0, null,
((type == depthBuffer) ? 0 : D3DCLEAR_TARGET) |
- ((type == colorBuffer) ? 0 : D3DCLEAR_ZBUFFER),
+ ((type == colorBuffer) ? 0 : D3DCLEAR_ZBUFFER),
d3dSurface.background, 1,0);
}
Color foreground = d3dSurface.writingText ? surface.foreground : white;
D3D8Vertex vertex[4] =
{
- { (float)dx, (float)dy, 1.0f, foreground,
+ { (float)dx, (float)dy, 1.0f, foreground,
(float)sx / (src.width-1), (float)sy/ (src.height-1) },
- { (float)(dx+w), (float)dy, 1.0f, foreground,
+ { (float)(dx+w), (float)dy, 1.0f, foreground,
(float)(sx+w)/ (src.width-1), (float)sy/ (src.height-1) },
- { (float)dx, (float)(dy+h), 1.0f, foreground,
+ { (float)dx, (float)(dy+h), 1.0f, foreground,
(float)sx/ (src.width-1), (float)(sy+h)/ (src.height-1) },
- { (float)(dx+w), (float)(dy+h), 1.0f, foreground,
+ { (float)(dx+w), (float)(dy+h), 1.0f, foreground,
(float)(sx+w) / (src.width-1), (float)(sy+h)/ (src.height-1) }
};
IDirect3DDevice8_SetTexture(d3dSystem.d3dDevice, 0, (IDirect3DBaseTexture8 *)src.picture);
- IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
+ IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
vertex, sizeof(D3D8Vertex));
IDirect3DDevice8_SetTexture(d3dSystem.d3dDevice, 0, null);
}
D3D8Display d3dDisplay = display.driverData;
D3D8Vertex vertex[4] =
{
- { (float)dx, (float)dy, 1.0f, surface.foreground,
+ { (float)dx, (float)dy, 1.0f, surface.foreground,
(float)sx / (src.width-1), (float)sy/ (src.height-1) },
- { (float)(dx+w), (float)dy, 1.0f, surface.foreground,
+ { (float)(dx+w), (float)dy, 1.0f, surface.foreground,
(float)(sx+sw)/ (src.width-1), (float)sy/ (src.height-1) },
- { (float)dx, (float)(dy+h), 1.0f, surface.foreground,
+ { (float)dx, (float)(dy+h), 1.0f, surface.foreground,
(float)sx/ (src.width-1), (float)(sy+sh)/ (src.height-1) },
- { (float)(dx+w), (float)(dy+h), 1.0f, surface.foreground,
+ { (float)(dx+w), (float)(dy+h), 1.0f, surface.foreground,
(float)(sx+sw) / (src.width-1), (float)(sy+sh)/ (src.height-1) }
};
IDirect3DDevice8_SetTexture(d3dSystem.d3dDevice, 0, (IDirect3DBaseTexture8 *)src.picture);
- IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
+ IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
vertex, sizeof(D3D8Vertex));
IDirect3DDevice8_SetTexture(d3dSystem.d3dDevice, 0, null);
}
{ (float)x2 + 1.0f, (float)y2 /*+ 1.5f*/, 1.0f, d3dSurface.background, 0, 0 }
};
- IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
+ IDirect3DDevice8_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
vertex, sizeof(D3D8Vertex));
}
//display.displaySystem.driver.Area(display, surface, x, y, x+w-1, y+h-1);
{
D3D8Display d3dDisplay = display.driverData;
/*
- IDirect3DDevice8_SetRenderState(d3dSystem.d3dDevice, D3DRS_LINEPATTERN,
+ IDirect3DDevice8_SetRenderState(d3dSystem.d3dDevice, D3DRS_LINEPATTERN,
stipple?MDWORD(1,stipple):0);
*/
}
IDirect3DDevice8_SetRenderState(d3dSystem.d3dDevice, D3DRS_MULTISAMPLEANTIALIAS, value ? TRUE : FALSE);
break;
case fillMode:
- IDirect3DDevice8_SetRenderState(d3dSystem.d3dDevice, D3DRS_FILLMODE,
+ IDirect3DDevice8_SetRenderState(d3dSystem.d3dDevice, D3DRS_FILLMODE,
((FillModeValue)value == solid) ? D3DFILL_SOLID : D3DFILL_WIREFRAME);
break;
case depthTest:
D3D8Display d3dDisplay = display.driverData;
if(light != null)
{
- D3DLIGHT8 d3dLight =
+ D3DLIGHT8 d3dLight =
{
- D3DLIGHT_DIRECTIONAL,
+ D3DLIGHT_DIRECTIONAL,
// Opacity on the light?
{ light.diffuse.r, light.diffuse.g, light.diffuse.b, 1.0f },
{ light.specular.r, light.specular.g, light.specular.b, 1.0f },
}
d3dDisplay.lights[id] = d3dLight;
-
+
IDirect3DDevice8_LightEnable(d3dSystem.d3dDevice, id, TRUE);
IDirect3DDevice8_SetLight(d3dSystem.d3dDevice, id, &d3dDisplay.lights[id]);
D3D8System d3dSystem = displaySystem.driverData;
bool result = false;
IDirect3DDevice8 * d3dDevice = d3dSystem.d3dDevice;
-
+
if(!mesh.data)
mesh.data = D3D8Mesh { };
if(mesh.data)
if((mesh.flags .vertices) && !d3dMesh.vertices)
{
mesh.vertices = new Vector3Df[mesh.nVertices];
- if(IDirect3DDevice8_CreateVertexBuffer(d3dDevice, sizeof(Vector3Df) * mesh.nVertices,
+ if(IDirect3DDevice8_CreateVertexBuffer(d3dDevice, sizeof(Vector3Df) * mesh.nVertices,
d3dSystem.usage, 0, D3DPOOL_MANAGED, &d3dMesh.vertices))
result = false;
}
if((mesh.flags.normals) && !d3dMesh.normals)
{
mesh.normals = new Vector3Df[mesh.nVertices];
- if(IDirect3DDevice8_CreateVertexBuffer(d3dDevice, sizeof(Vector3Df) * mesh.nVertices,
+ if(IDirect3DDevice8_CreateVertexBuffer(d3dDevice, sizeof(Vector3Df) * mesh.nVertices,
d3dSystem.usage, 0, D3DPOOL_MANAGED, &d3dMesh.normals))
result = false;
}
if((mesh.flags.texCoords1) && !d3dMesh.texCoords)
{
mesh.texCoords = new Pointf[mesh.nVertices];
- if(IDirect3DDevice8_CreateVertexBuffer(d3dDevice, sizeof(Pointf) * mesh.nVertices,
+ if(IDirect3DDevice8_CreateVertexBuffer(d3dDevice, sizeof(Pointf) * mesh.nVertices,
d3dSystem.usage, 0, D3DPOOL_MANAGED, &d3dMesh.texCoords))
result = false;
}
{
memcpy(normals, mesh.normals, mesh.nVertices * sizeof(Vector3Df));
IDirect3DVertexBuffer8_Unlock(d3dMesh.normals);
- }
+ }
}
if(flags.texCoords1 && mesh.texCoords)
{
{
memcpy(texCoords, mesh.texCoords, mesh.nVertices * sizeof(Pointf));
IDirect3DVertexBuffer8_Unlock(d3dMesh.texCoords);
- }
+ }
}
}
if(d3dIndices && nIndices)
{
d3dIndices.indices = (void *)(indices32bit ? new uint32[nIndices] : new uint16[nIndices]);
- IDirect3DDevice8_CreateIndexBuffer(d3dDevice, (indices32bit ? sizeof(uint32) : sizeof(uint16)) * nIndices, 0, indices32bit ? D3DFMT_INDEX32 : D3DFMT_INDEX16,
+ IDirect3DDevice8_CreateIndexBuffer(d3dDevice, (indices32bit ? sizeof(uint32) : sizeof(uint16)) * nIndices, 0, indices32bit ? D3DFMT_INDEX32 : D3DFMT_INDEX16,
D3DPOOL_MANAGED, &d3dIndices.buffer);
d3dIndices.nIndices = nIndices;
}
{
case lines: numPrimitives /= 2; break;
case triangles: numPrimitives /= 3; break;
- case triStrip:
+ case triStrip:
case triFan:
- numPrimitives -= 2;
+ numPrimitives -= 2;
break;
case lineStrip:
- numPrimitives --;
+ numPrimitives --;
break;
case quads:
numPrimitives /= 4;
D3D8Display d3dDisplay = display.driverData;
DisplaySystem displaySystem = display.displaySystem;
D3D8System d3dSystem = displaySystem.driverData;
-
+
d3dDisplay.worldMatrix--;
if(setMatrix)
SetTransformMatrix(d3dSystem.d3dDevice, d3dDisplay.worldMatrix);
else
{
if(camera)
- matrix.Translate(
+ matrix.Translate(
- camera.cPosition.x,
- camera.cPosition.y,
- camera.cPosition.z);
IDirect3D9 * (WINAPI * direct3DCreate9)(UINT);
uint usage;
D3DPRESENT_PARAMETERS d3dpp;
-
+
IDirect3DVertexDeclaration9 * decls[NUM_VERTEX_DECLS], * decl2D;
bool ready;
HWND hwnd;
DisplaySystem displaySystem = display.displaySystem;
D3DSystem d3dSystem = displaySystem.driverData;
D3DDisplay d3dDisplay = display.driverData;
-
+
//if(!IDirect3DDevice9_GetBackBuffer(d3dSystem.d3dDevice, 0, 0, D3DBACKBUFFER_TYPE_MONO, &d3dDisplay.backBuffer))
{
D3DLOCKED_RECT lockedRect;
lfbBitmap.stride = lockedRect.Pitch >> GetColorDepthShifts(lfbBitmap.pixelFormat);
lfbBitmap.width = display.width;
lfbBitmap.height = display.height;
-
+
*lfbSurface = lfbBitmap.GetSurface(surface ? surface.offset.x : 0, surface ? surface.offset.y : 0, surface ? surface.box : null);
result = true;
}
}
else
{
- d3dSystem.d3dpp.hDeviceWindow = d3dSystem.hwnd =
+ d3dSystem.d3dpp.hDeviceWindow = d3dSystem.hwnd =
CreateWindow("static", null, 0,0,0,0,0,null,null,null,null);
d3dSystem.d3dpp.Windowed = TRUE;
}
d3dSystem.format = d3dSystem.d3dpp.BackBufferFormat = d3ddm.Format;
d3dSystem.d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
- if(!IDirect3D9_CreateDevice(d3dSystem.direct3D, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ if(!IDirect3D9_CreateDevice(d3dSystem.direct3D, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
d3dSystem.d3dpp.hDeviceWindow,
D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE|D3DCREATE_FPU_PRESERVE,
&d3dSystem.d3dpp, &d3dSystem.d3dDevice))
else
{
d3dSystem.usage = D3DUSAGE_SOFTWAREPROCESSING;
- if(!IDirect3D9_CreateDevice(d3dSystem.direct3D, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ if(!IDirect3D9_CreateDevice(d3dSystem.direct3D, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
d3dSystem.d3dpp.hDeviceWindow,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE,
&d3dSystem.d3dpp, &d3dSystem.d3dDevice))
//d3dDisplay.d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
//d3dDisplay.d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- result = !IDirect3DDevice9_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
+ result = !IDirect3DDevice9_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
&d3dDisplay.d3dpp, &d3dDisplay.swapChain);
if(!result)
{
d3dDisplay.d3dpp.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;
- result = !IDirect3DDevice9_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
+ result = !IDirect3DDevice9_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
&d3dDisplay.d3dpp, &d3dDisplay.swapChain);
}
if(!result)
{
d3dDisplay.d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
- result = !IDirect3DDevice9_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
+ result = !IDirect3DDevice9_CreateAdditionalSwapChain(d3dSystem.d3dDevice,
&d3dDisplay.d3dpp, &d3dDisplay.swapChain);
}
}
if(result)
{
- if(!IDirect3DSwapChain9_GetBackBuffer(d3dDisplay.swapChain,
+ if(!IDirect3DSwapChain9_GetBackBuffer(d3dDisplay.swapChain,
0, D3DBACKBUFFER_TYPE_MONO, &d3dDisplay.backBuffer))
{
if(!IDirect3DDevice9_CreateDepthStencilSurface(d3dSystem.d3dDevice, width, height,
}
}
}
-
+
if(d3dSystem.ready)
{
float fogDensity = 0;
{
//eSystem_Sleep(0.05);
IDirect3DDevice9_EndScene(d3dSystem.d3dDevice);
-
+
if(display.displaySystem.flags.flipping)
{
// IDirect3DDevice9_Present(d3dSystem.d3dDevice, null, null, null, null);
IDirect3DTexture9 * texture;
uint w = pow2i(Min(bitmap.width, 512)), h = pow2i(Min(bitmap.height, 512));
- if(!IDirect3DDevice9_CreateTexture(d3dSystem.d3dDevice, w, h, mipMaps ? log2i(Max(w+1, h+1)) : 1, 0,
+ if(!IDirect3DDevice9_CreateTexture(d3dSystem.d3dDevice, w, h, mipMaps ? log2i(Max(w+1, h+1)) : 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture, null))
{
int level;
case D3DFMT_A1R5G5B5: mipMap.pixelFormat = pixelFormat555; break;
}
mipMap.stride = lockedRect.Pitch >> GetColorDepthShifts(mipMap.pixelFormat);
-
+
mipSurface = mipMap.GetSurface(0,0,null);
if(mipSurface)
{
delete mipSurface;
}
- IDirect3DTexture9_UnlockRect(texture, level);
+ IDirect3DTexture9_UnlockRect(texture, level);
mipMap.picture = null;
delete mipMap;
void SetBackground(Display display, Surface surface, ColorAlpha color)
{
- D3DSurface d3dSurface = surface.driverData;
+ D3DSurface d3dSurface = surface.driverData;
d3dSurface.background = color;
}
{ (float)x2, (float)y2, 1.0f, surface.foreground, 0, 0 }
};
- if(x1 == x2)
+ if(x1 == x2)
{
/*
vertex[0].y-= 0.5f;
*/
vertex[1].y+= 1.0f;
}
- else if(y1 == y2)
+ else if(y1 == y2)
{
/*
vertex[0].x-= 0.5f;
{ (float)x1, (float)y1, 1.0f, surface.foreground, 0, 0 }
};
- IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_LINESTRIP, 4,
+ IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_LINESTRIP, 4,
vertex, sizeof(Vertex));
}
{ (float)x2 + 1.0f, (float)y2 + 1.5f, 1.0f, d3dSurface.background, 0, 0 }
};
- IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
+ IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
vertex, sizeof(Vertex));
}
D3DDisplay d3dDisplay = display.driverData;
IDirect3DDevice9_Clear(d3dSystem.d3dDevice, 0, null,
((type == depthBuffer) ? 0 : D3DCLEAR_TARGET) |
- ((type == colorBuffer) ? 0 : D3DCLEAR_ZBUFFER),
+ ((type == colorBuffer) ? 0 : D3DCLEAR_ZBUFFER),
d3dSurface.background, 1,0);
}
Color foreground = d3dSurface.writingText ? surface.foreground : white;
Vertex vertex[4] =
{
- { (float)dx, (float)dy, 1.0f, foreground,
+ { (float)dx, (float)dy, 1.0f, foreground,
(float)sx / (src.width-1), (float)sy/ (src.height-1) },
- { (float)(dx+w), (float)dy, 1.0f, foreground,
+ { (float)(dx+w), (float)dy, 1.0f, foreground,
(float)(sx+w)/ (src.width-1), (float)sy/ (src.height-1) },
- { (float)dx, (float)(dy+h), 1.0f, foreground,
+ { (float)dx, (float)(dy+h), 1.0f, foreground,
(float)sx/ (src.width-1), (float)(sy+h)/ (src.height-1) },
- { (float)(dx+w), (float)(dy+h), 1.0f, foreground,
+ { (float)(dx+w), (float)(dy+h), 1.0f, foreground,
(float)(sx+w) / (src.width-1), (float)(sy+h)/ (src.height-1) }
};
IDirect3DDevice9_SetTexture(d3dSystem.d3dDevice, 0, (IDirect3DBaseTexture9 *)src.picture);
- IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
+ IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
vertex, sizeof(Vertex));
IDirect3DDevice9_SetTexture(d3dSystem.d3dDevice, 0, null);
}
D3DDisplay d3dDisplay = display.driverData;
Vertex vertex[4] =
{
- { (float)dx, (float)dy, 1.0f, surface.foreground,
+ { (float)dx, (float)dy, 1.0f, surface.foreground,
(float)sx / (src.width-1), (float)sy/ (src.height-1) },
- { (float)(dx+w), (float)dy, 1.0f, surface.foreground,
+ { (float)(dx+w), (float)dy, 1.0f, surface.foreground,
(float)(sx+sw)/ (src.width-1), (float)sy/ (src.height-1) },
- { (float)dx, (float)(dy+h), 1.0f, surface.foreground,
+ { (float)dx, (float)(dy+h), 1.0f, surface.foreground,
(float)sx/ (src.width-1), (float)(sy+sh)/ (src.height-1) },
- { (float)(dx+w), (float)(dy+h), 1.0f, surface.foreground,
+ { (float)(dx+w), (float)(dy+h), 1.0f, surface.foreground,
(float)(sx+sw) / (src.width-1), (float)(sy+sh)/ (src.height-1) }
};
IDirect3DDevice9_SetTexture(d3dSystem.d3dDevice, 0, (IDirect3DBaseTexture9 *)src.picture);
- IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
+ IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
vertex, sizeof(Vertex));
IDirect3DDevice9_SetTexture(d3dSystem.d3dDevice, 0, null);
}
{ (float)x2 + 1.0f, (float)y2 /*+ 1.5f*/, 1.0f, d3dSurface.background, 0, 0 }
};
- IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
+ IDirect3DDevice9_DrawPrimitiveUP(d3dSystem.d3dDevice, D3DPT_TRIANGLESTRIP, 2,
vertex, sizeof(Vertex));
}
//display.displaySystem.driver.Area(display, surface, x, y, x+w-1, y+h-1);
{
D3DDisplay d3dDisplay = display.driverData;
/*
- IDirect3DDevice9_SetRenderState(d3dSystem.d3dDevice, D3DRS_LINEPATTERN,
+ IDirect3DDevice9_SetRenderState(d3dSystem.d3dDevice, D3DRS_LINEPATTERN,
stipple?Muint(1,stipple):0);
*/
}
IDirect3DDevice9_SetRenderState(d3dSystem.d3dDevice, D3DRS_MULTISAMPLEANTIALIAS, value ? TRUE : FALSE);
break;
case fillMode:
- IDirect3DDevice9_SetRenderState(d3dSystem.d3dDevice, D3DRS_FILLMODE,
+ IDirect3DDevice9_SetRenderState(d3dSystem.d3dDevice, D3DRS_FILLMODE,
((FillModeValue)value == solid) ? D3DFILL_SOLID : D3DFILL_WIREFRAME);
break;
case depthTest:
D3DDisplay d3dDisplay = display.driverData;
if(light != null)
{
- D3DLIGHT9 d3dLight =
+ D3DLIGHT9 d3dLight =
{
// Opacity on the light?
- D3DLIGHT_DIRECTIONAL,
+ D3DLIGHT_DIRECTIONAL,
{ light.diffuse.r, light.diffuse.g, light.diffuse.b, 1.0f },
{ light.specular.r, light.specular.g, light.specular.b, 1.0f },
{ light.ambient.r, light.ambient.g, light.ambient.b, 1.0f },
}
d3dDisplay.lights[id] = d3dLight;
-
+
IDirect3DDevice9_LightEnable(d3dSystem.d3dDevice, id, TRUE);
IDirect3DDevice9_SetLight(d3dSystem.d3dDevice, id, &d3dDisplay.lights[id] /*d3dLight*/);
if((mesh.flags.vertices) && !d3dMesh.vertices)
{
mesh.vertices = new Vector3Df[mesh.nVertices];
- if(IDirect3DDevice9_CreateVertexBuffer(d3dDevice, sizeof(Vector3Df) * mesh.nVertices,
+ if(IDirect3DDevice9_CreateVertexBuffer(d3dDevice, sizeof(Vector3Df) * mesh.nVertices,
d3dSystem.usage, 0, D3DPOOL_MANAGED, &d3dMesh.vertices, null))
result = false;
}
if((mesh.flags.normals) && !d3dMesh.normals)
{
mesh.normals = new Vector3Df[mesh.nVertices];
- if(IDirect3DDevice9_CreateVertexBuffer(d3dDevice, sizeof(Vector3Df) * mesh.nVertices,
+ if(IDirect3DDevice9_CreateVertexBuffer(d3dDevice, sizeof(Vector3Df) * mesh.nVertices,
d3dSystem.usage, 0, D3DPOOL_MANAGED, &d3dMesh.normals, null))
result = false;
}
if((mesh.flags.texCoords1) && !d3dMesh.texCoords)
{
mesh.texCoords = new Pointf[mesh.nVertices];
- if(IDirect3DDevice9_CreateVertexBuffer(d3dDevice, sizeof(Pointf) * mesh.nVertices,
+ if(IDirect3DDevice9_CreateVertexBuffer(d3dDevice, sizeof(Pointf) * mesh.nVertices,
d3dSystem.usage, 0, D3DPOOL_MANAGED, &d3dMesh.texCoords, null))
result = false;
}
{
memcpy(normals, mesh.normals, mesh.nVertices * sizeof(Vector3Df));
IDirect3DVertexBuffer9_Unlock(d3dMesh.normals);
- }
+ }
}
if(flags.texCoords1 && mesh.texCoords)
{
{
memcpy(texCoords, mesh.texCoords, mesh.nVertices * sizeof(Pointf));
IDirect3DVertexBuffer9_Unlock(d3dMesh.texCoords);
- }
+ }
}
}
if(d3dIndices && nIndices)
{
d3dIndices.indices = (void *)(indices32bit ? new uint32[nIndices] : new uint16[nIndices]);
- IDirect3DDevice9_CreateIndexBuffer(d3dDevice, (indices32bit ? sizeof(uint32) : sizeof(uint16)) * nIndices, 0, indices32bit ? D3DFMT_INDEX32 : D3DFMT_INDEX16,
+ IDirect3DDevice9_CreateIndexBuffer(d3dDevice, (indices32bit ? sizeof(uint32) : sizeof(uint16)) * nIndices, 0, indices32bit ? D3DFMT_INDEX32 : D3DFMT_INDEX16,
D3DPOOL_MANAGED, &d3dIndices.buffer, null);
d3dIndices.nIndices = nIndices;
}
D3DSystem d3dSystem = displaySystem.driverData;
D3DDisplay d3dDisplay = display.driverData;
IDirect3DDevice9 * d3dDevice = d3dSystem.d3dDevice;
-
+
if(primitiveTypes[primitive->type.primitiveType])
{
int numPrimitives = (primitive->type.vertexRange) ? primitive->nVertices : primitive->nIndices;
{
case lines: numPrimitives /= 2; break;
case triangles: numPrimitives /= 3; break;
- case triStrip:
+ case triStrip:
case triFan:
- numPrimitives -= 2;
+ numPrimitives -= 2;
break;
case lineStrip:
- numPrimitives --;
+ numPrimitives --;
break;
case quads:
numPrimitives /= 4;
break;
- }
+ }
if(primitive->type.vertexRange)
{
if(primitive->type.primitiveType == quads)
uint ddrawResult = IDirectDrawSurface_Lock(back, null, &backDesc, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, null);
if(ddrawResult == DDERR_SURFACELOST) // !display.full_screen
{
-
+
IDirectDrawSurface_Restore(back);
ddrawResult = IDirectDrawSurface_Lock(back, null, &backDesc, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, null);
}
- if(!ddrawResult)
+ if(!ddrawResult)
{
bool validFormat = true;
switch(backDesc.ddpfPixelFormat.dwRGBBitCount)
{
case 8: bitmap.pixelFormat = pixelFormat8; break;
case 15: bitmap.pixelFormat = pixelFormat555; break;
- case 16:
+ case 16:
if(backDesc.ddpfPixelFormat.dwGBitMask == 0x3E0)
bitmap.pixelFormat = pixelFormat555;
else
bitmap.pixelFormat = pixelFormat565;
break;
- case 32:
+ case 32:
bitmap.pixelFormat = pixelFormat888; break;
default:
validFormat = false;
for(c=0; c<256; c++)
realPalette[c] = ColorAlpha { 255, { realPalette[c].color.b, realPalette[c].color.g, realPalette[c].color.r } };
ReleaseDC(display.window,hdc);
-
+
// *** Reserved Palette Handling ***
if(!palette)
{
{
ddrawDisplay.frontDesc.dwSize = ddrawDisplay.backDesc.dwSize = sizeof(DDSURFACEDESC);
- if(!IDirectDraw_SetCooperativeLevel( directDraw, display.window,
+ if(!IDirectDraw_SetCooperativeLevel( directDraw, display.window,
(display.displaySystem.flags.fullScreen) ? (DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) : DDSCL_NORMAL))
{
ddrawDisplay.frontDesc.dwFlags = DDSD_CAPS;
#ifdef USE_GDI_FONT
DDrawDisplay ddrawDisplay = display.driverData;
COLORREF rgb;
-
+
if(ddrawDisplay.bitmap.pixelFormat == pixelFormat8)
color = ddrawDisplay.bitmap.palette[ddrawDisplay.rgbLookup[(uint16)(Color555) color]];
rgb = RGB(color.color.r, color.color.g, color.color.b);
{
if(!gdiFont.font)
{
- gdiFont.font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(display.displaySystem,
- gdiFont.faceName, gdiFont.size, gdiFont.flags);
+ gdiFont.font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(display.displaySystem,
+ gdiFont.faceName, gdiFont.size, gdiFont.flags);
}
- ((subclass(DisplayDriver))class(LFBDisplayDriver)).TextFont(display, surface, gdiFont.font);
- }
+ ((subclass(DisplayDriver))class(LFBDisplayDriver)).TextFont(display, surface, gdiFont.font);
+ }
else */
SelectObject(ddrawDisplay.hdc, font);
#else
GDIFont gdiFont = (GDIFont)surface.font;
if(!gdiFont.font)
{
- gdiFont.font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(display.displaySystem,
- gdiFont.faceName, gdiFont.size, gdiFont.flags);
+ gdiFont.font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(display.displaySystem,
+ gdiFont.faceName, gdiFont.size, gdiFont.flags);
}
if(surface.textOpacity)
{
if(width) *width = 0;
if(height) *height = 0;
}
- }
+ }
/*
HDC hdc = tmpDC;
SIZE space, size;
GetTextExtentPoint32(hdc,text,realLen,&size);
if(width) *width = size.cx + (len - realLen) * space.cx;
- if(height)
+ if(height)
{
if(realLen)
*height = size.cy;
/*if(display && display.alphaBlend)
((subclass(DisplayDriver))class(LFBDisplayDriver)).TextExtent(display, surface, text, len, width, height);
else*/
-
+
{
DDrawDisplay ddrawDisplay = display ? display.driverData : null;
HDC hdc = ddrawDisplay ? ddrawDisplay.hdc : tmpDC;
// UNICODE FIX: proper space computation
if(width) *width = size.cx + (wordCount - realLen) * space.cx;
- if(height)
+ if(height)
{
if(realLen)
*height = size.cy;
HDC hdc = ddrawDisplay.hdc;
SIZE space, size;
uint realLen;
-
+
for(realLen = 0; realLen<len && text[realLen]; realLen++);
GetTextExtentPoint32(hdc," ",1,&space);
GetTextExtentPoint32(hdc,text,realLen,&size);
if(width) *width = size.cx + (len - realLen) * space.cx;
- if(height)
+ if(height)
{
if(realLen)
*height = size.cy;
~GDIDisplay()
{
if(memDC) DeleteDC(memDC);
- if(memBitmap) DeleteObject(memBitmap);
+ if(memBitmap) DeleteObject(memBitmap);
if(palette) DeleteObject(palette);
delete logPalette;
}
~GDISystem()
{
- if(tmpDC)
+ if(tmpDC)
ReleaseDC(0, tmpDC);
}
};
static PixelFormat GetColorFormat(int depth)
{
- if(depth == 8)
+ if(depth == 8)
return pixelFormat8;
- else if(depth == 16)
+ else if(depth == 16)
return pixelFormat555;
- else
+ else
return pixelFormat888;
}
info->bmiHeader.biBitCount = (uint16)gdiSystem.depth;
info->bmiHeader.biWidth = gdiDisplay.bitmap.stride;
info->bmiHeader.biHeight = -height;
-
+
for(c=0; c<256; c++)
{
info->bmiColors[c].rgbReserved = 0;
ScrollDC(gdiDisplay.hdc, -x, -y, (RECT *)&box, (RECT *)&box, gdiDisplay.rgn, null);
}
ScrollDC(gdiDisplay.memDC, -x, -y, (RECT *)&box, (RECT *)&box, null, null);
-
+
numBytes = GetRegionData(gdiDisplay.rgn, 0, null);
gdiDisplay.data = (RGNDATA *) new0 byte[numBytes];
GetRegionData(gdiDisplay.rgn, numBytes, gdiDisplay.data);
}
else
{
- BitBlt(gdiDisplay.hdc,
- updateBox.left,updateBox.top,
+ BitBlt(gdiDisplay.hdc,
+ updateBox.left,updateBox.top,
updateBox.right - updateBox.left + 1, updateBox.bottom - updateBox.top + 1,
gdiDisplay.memDC, updateBox.left, updateBox.top, SRCCOPY);
}
surface.offset.x = x;
surface.offset.y = y;
surface.unclippedBox = surface.box = clip;
-
+
result = true;
}
}
surface.offset.x = x;
surface.offset.y = y;
surface.unclippedBox = surface.box = clip;
-
+
SetDCBrushColor(gdiSurface.hdc, RGB(0,0,0));
SetDCPenColor(gdiSurface.hdc, RGB(255,255,255));
void Clip(Display display, Surface surface, Box clip)
{
GDISurface gdiSurface = surface.driverData;
- HRGN clippedRgn = null;
+ HRGN clippedRgn = null;
if(clip != null)
{
Box box = clip;
}
else
clippedRgn = CreateRectRgn(0, 0, 0, 0);
-
+
if(clippedRgn)
SelectClipRgn(gdiSurface.hdc,clippedRgn);
}
HBITMAP screenBmp = CreateCompatibleBitmap(hdc, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
HBITMAP back = SelectObject(memDC, screenBmp);
uint16 depth;
-
+
switch(format)
{
case pixelFormat8: depth = 8; break;
DeleteDC(memDC);
result = true;
- }
+ }
}
return result;
}
GDISurface gdiSurface = surface.driverData;
GDIDisplay gdiDisplay = display ? display.driverData : null;
COLORREF rgb = RGB(color.color.r, color.color.g, color.color.b);
-
+
SetTextColor(gdiSurface.hdc, rgb);
gdiSurface.color = rgb;
}
((subclass(DisplayDriver))class(LFBDisplayDriver)).SetBackground(display, surface, color);
if(display && (!display.alphaBlend || display.pixelFormat != pixelFormat888))
- {
+ {
GDISurface gdiSurface = surface.driverData;
GDIDisplay gdiDisplay = display ? display.driverData : null;
COLORREF rgb;
-
+
if(gdiSurface.bitmap.pixelFormat == pixelFormat8 && display)
color = gdiSurface.bitmap.palette[gdiDisplay.rgbLookup[(uint16)(Color555) color]];
rgb = RGB(color.color.r, color.color.g, color.color.b);
else
{
return ((subclass(DisplayDriver))class(LFBDisplayDriver)).ConvertBitmap(displaySystem, src, format, palette);
- }
+ }
}
bool AllocateBitmap(DisplaySystem displaySystem, Bitmap bitmap, int width, int height, int stride, PixelFormat format, bool allocatePalette)
}
}
- bitmap.stride=stride;
+ bitmap.stride=stride;
bitmap.width=width;
bitmap.height=height;
bitmap.size=(uint)stride*(uint)height;
info->bmiHeader.biBitCount = depth;
info->bmiHeader.biWidth = bitmap.stride;
info->bmiHeader.biHeight = -height;
-
+
for(c=0; c<256; c++)
{
info->bmiColors[c].rgbReserved = 0;
{
if(gdiFont.gdiFont)
DeleteObject(gdiFont.gdiFont);
- if(gdiFont.font)
+ if(gdiFont.font)
((subclass(DisplayDriver))class(LFBDisplayDriver)).UnloadFont(displaySystem, gdiFont.font);
- delete gdiFont;
+ delete gdiFont;
}
}
{
if(!gdiFont.font)
{
- gdiFont.font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(display.displaySystem,
- gdiFont.faceName, gdiFont.size, gdiFont.flags);
+ gdiFont.font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(display.displaySystem,
+ gdiFont.faceName, gdiFont.size, gdiFont.flags);
}
- ((subclass(DisplayDriver))class(LFBDisplayDriver)).TextFont(display, surface, gdiFont.font);
- }
- else
+ ((subclass(DisplayDriver))class(LFBDisplayDriver)).TextFont(display, surface, gdiFont.font);
+ }
+ else
{
GDISurface gdiSurface = surface.driverData;
SelectObject(gdiSurface.hdc, gdiFont.gdiFont);
- }
+ }
}
void TextOpacity(Display display, Surface surface, bool opaque)
{
GDISurface gdiSurface = surface.driverData;
SetBkMode(gdiSurface.hdc, opaque ? OPAQUE : TRANSPARENT);
- }
+ }
}
void WriteText(Display display, Surface surface, int x, int y, char * text, int len)
GDIFont gdiFont = (GDIFont)surface.font;
if(!gdiFont.font)
{
- gdiFont.font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(display.displaySystem,
- gdiFont.faceName, gdiFont.size, gdiFont.flags);
+ gdiFont.font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(display.displaySystem,
+ gdiFont.faceName, gdiFont.size, gdiFont.flags);
}
if(surface.textOpacity)
{
// UNICODE FIX: proper space computation
if(width) *width = size.cx + (wordCount - realLen) * space.cx;
- if(height)
+ if(height)
{
if(realLen)
*height = size.cy;
else
*height = wordCount ? space.cy : 0;
}
- }
+ }
}
void FontExtent(DisplaySystem displaySystem, Font font, char * text, int len, int * width, int * height)
if(width) *width = 0;
if(height) *height = 0;
}
- }
+ }
}
void DrawingChar(Display display, Surface surface, byte character)
#undef CompareString
static BinaryTree loadedFonts
{
- CompareKey = (void *)BinaryTree::CompareString
+ CompareKey = (void *)BinaryTree::CompareString
};
class FontEntry : BTNode
int used;
byte * buffer;
-
+
//If we don't save the FT_Stream before sacrificing it to FreeType, the garbage collector (if one is used) will destroy it prematurely
FT_Stream stream;
Font font;
// printf("\nRendering arabic in %s (%d)\n", font.faceName, key & 0xFFFFFF);
break;
case HB_Script_Devanagari:
- testChar = 0x905;
+ testChar = 0x905;
break;
case 60: testChar = 'あ'; break;
case 61: testChar = 0x3400; break;
FT_Set_Char_Size( fontEntry.face, (int)(font.size * 64), (int)(font.size * 64), 96, 96);
*/
- maxWidth = 0;
+ maxWidth = 0;
maxHeight = 0;
for(c = 0; c < MAX_FONT_LINK_ENTRIES; c++)
{
FT_Matrix matrix;
FT_Vector pen = { 0, 0 };
-
+
if(font.fakeItalic)
{
matrix.xx = (FT_Fixed)( 1.0 * 0x10000L );
int glyphNo = isGlyph ? (((uint)key | c) & 0x00FFFFFF) : FT_Get_Char_Index(faces[c], (uint)key | c);
FT_Load_Glyph(faces[c], glyphNo, /*FT_LOAD_DEFAULT | FT_LOAD_FORCE_AUTOHINT*/ FT_LOAD_DEFAULT /*FT_LOAD_NO_HINTING*/); // FT_LOAD_RENDER // FT_LOAD_NO_HINTING
-
+
FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL);
x = sx;
y = sy;
//printf("%d, %d\n", maxHeight, faces[c]->size->metrics.height >> 6);
-
+
glyph->left = slot->bitmap_left;
// glyph->top = ((64 + (64 - faces[c]->glyph->metrics.height & 0x3F)) >> 6) + (int)(ascender - slot->bitmap_top) + font.height - (faces[c]->size->metrics.height >> 6);
// glyph->top = (int)(ascender - slot->bitmap_top) + 2 * (font.height - maxHeight);
//glyph->top = (int)(ascender - slot->bitmap_top); // + ((faces[c]->size->metrics.height >> 6) - (faces[0]->size->metrics.height >> 6)) + (font.height - (faces[c]->size->metrics.height >> 6));
//glyph->top = (int)(ascender - slot->bitmap_top); // + ((faces[c]->size->metrics.height >> 6) - (faces[0]->size->metrics.height >> 6)) + (font.height - (faces[c]->size->metrics.height >> 6));
-
+
//glyph->top = (int)(ascender - slot->bitmap_top);// + (font.height - maxHeight);
glyph->top = (int)(ascender - slot->bitmap_top) + (int)(font.height - (faces[c]->size->metrics.height >> 6)) / 2;
{
picture[j * bitmap.stride + i] = (slot->bitmap.buffer[q + p] & bit) ? 255 : 0;
bit >>= 1;
- if(!bit) { bit = 0x80; p++; }
+ if(!bit) { bit = 0x80; p++; }
}
else
{
for(c = 0; c<256; c++)
bitmap.palette[c] = ColorAlpha { 255, { (byte)c,(byte)c,(byte)c } };
bitmap.pixelFormat = pixelFormat8;
-
+
/*
//strcpy(fileName, faceName);
if(flags)
shaper_item.num_glyphs = shaper_item.item.length;
shaper_item.glyphIndicesPresent = 0;
shaper_item.initialGlyphCount = 0;
- shaper_item.num_glyphs = 0;
- shaper_item.glyphs = null;
+ shaper_item.num_glyphs = 0;
+ shaper_item.glyphs = null;
while(!HB_ShapeItem(&shaper_item))
{
if(shaper_item.num_glyphs > maxGlyphs)
{
- maxGlyphs = shaper_item.num_glyphs;
+ maxGlyphs = shaper_item.num_glyphs;
glyphs = shaper_item.glyphs = renew0 glyphs HB_Glyph[maxGlyphs];
shaper_item.attributes = renew0 shaper_item.attributes HB_GlyphAttributes[maxGlyphs];
shaper_item.advances = renew0 shaper_item.advances HB_Fixed[maxGlyphs];
{
shaper_item.glyphs = glyphs;
shaper_item.num_glyphs = maxGlyphs;
- }
+ }
}
*numGlyphs = shaper_item.num_glyphs;
{
if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts",0,KEY_READ,&key) ||
!RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts",0,KEY_READ,&key))
- {
+ {
int value = 0;
while(true)
{
strcpy(fileName, fontFileName);
RegCloseKey(key);
return 0;
- }
+ }
}
RegCloseKey(key);
return 1;
}
}
}
- return 1;
+ return 1;
}
#endif
case 2: stride = width; break;
}
}
- bitmap.stride = stride;
+ bitmap.stride = stride;
bitmap.width = width;
bitmap.height = height;
bitmap.size = (uint32) stride * (uint32)height;
}
bool ConvertBitmap(DisplaySystem displaySystem, Bitmap src, PixelFormat format, ColorAlpha * palette)
- {
+ {
bool result = false;
LFBSystem lfbSystem = displaySystem ? displaySystem.driverData : null;
/*
DWORD c;
DWORD * picture = (DWORD *)src.picture;
-
+
for(c = 0; c<src.size; c++, picture++)
{
if(*picture & 0xFFFFFF)
case pixelFormat565: lfbSurface.foreground = (Color565)color; break;
case pixelFormat888: lfbSurface.foreground = color; break;
case pixelFormatRGBA: lfbSurface.foreground = (ColorRGBA)color; break;
- case pixelFormatText:
+ case pixelFormatText:
if(display)
lfbSurface.foreground = BestColorMatch(lfbDisplay.bitmap.palette,0,15,color) << 8;
else
case pixelFormat565: lfbSurface.background = (Color565)color; break;
case pixelFormat888: lfbSurface.background = color; break;
case pixelFormatRGBA: lfbSurface.background = (ColorRGBA)color; break;
- case pixelFormatText:
+ case pixelFormatText:
if(display)
lfbSurface.background = BestColorMatch(lfbDisplay.bitmap.palette,0,15,color) << 12;
else
((uint16 *)lfbSurface.bitmap.picture)[offset]=(uint16)color;
else
{
- ((uint16 *)lfbSurface.bitmap.picture)[offset] =
+ ((uint16 *)lfbSurface.bitmap.picture)[offset] =
(((uint16 *)lfbSurface.bitmap.picture)[offset] & 0xF000) | (uint16)color;
}
}
break;
}
}
- else
+ else
{
if(x2 >= x1)
{
void memset_32_aligned(void *buf, int val, int dwords)
{
// Qword align
- if ((int)(buf) & 4)
+ if ((int)(buf) & 4)
{
*((uint32 *)(buf)) = val;
buf = ((uint32 *)(buf))+1;
dwords--;
}
-
- if (dwords > 1)
+
+ if (dwords > 1)
{
__asm {
cld
emms
};
}
-
+
// Final dword
if (dwords & 1) *((int*)(buf)) = val;
}*/
void memset_32(void *buf, uint32 val, uint32 dwords)
{
int align = 0;
- if ((uint32)(buf) & 3)
+ if ((uint32)(buf) & 3)
{
align = 4;
dwords--;
-
+
if (((uint32)(buf) & 1))
{
- *(byte *)(buf) = (byte)(val&0xFF);
+ *(byte *)(buf) = (byte)(val&0xFF);
buf = ((byte *)(buf))+1;
val = ((val& 0xFF) << 24) || ((val& 0xFFFFFF00) >> 8);
align --;
}
if (((uint32)(buf) & 2))
{
- *(uint16 *)(buf) = (uint16)(val&0xFFFF);
+ *(uint16 *)(buf) = (uint16)(val&0xFFFF);
buf = ((uint16 *)(buf))+1;
val = ((val& 0xFFFF) << 16) || ((val& 0xFFFF0000) >> 16);
align-=2;
{
if (align == 1)
{
- *(byte *)(buf) = (byte)(val&0xFF);
+ *(byte *)(buf) = (byte)(val&0xFF);
}
else
{
- *(uint16 *)(buf) = (uint16)(val&0xFFFF);
- if (align & 1) *((byte *)(buf)+2) = (byte)((val>>16)&0xFF);
+ *(uint16 *)(buf) = (uint16)(val&0xFFFF);
+ if (align & 1) *((byte *)(buf)+2) = (byte)((val>>16)&0xFF);
}
}
}
{
int w,y;
byte * theOffset;
-
+
w = x2-x1+1;
if(w<1) return;
mov eax,color
mov edx,y
mov ecx,w
-
+
start:
push ecx
-
+
rep stosd
add edi,ebx
pop ecx
- dec edx
+ dec edx
jnz start
pop edx
pop ebx
{
int c;
for(c = 0; c < w; c++, dest++)
- {
+ {
Color destColor;
if(pixelFormat == pixelFormat565) { destColor = (Color)*(Color565 *)dest; }
else if(pixelFormat == pixelFormat555) { destColor = (Color)*(Color555 *)dest; }
{
int c;
for(c = 0; c < w; c++, dest++)
- {
+ {
int dr = dest->color.r;
int dg = dest->color.g;
int db = dest->color.b;
if(bitmap.pixelFormat != lfbDisplay.bitmap.pixelFormat || bitmap.width < w || bitmap.height < h)
{
bitmap.Free();
- bitmap.Allocate(null, w,h,w, lfbDisplay.bitmap.pixelFormat,
+ bitmap.Allocate(null, w,h,w, lfbDisplay.bitmap.pixelFormat,
(lfbDisplay.bitmap.pixelFormat == pixelFormat8)?true:false);
}
if(bitmap)
{
w = Abs(w);
sw = Abs(sw);
- flip = true;
+ flip = true;
}
s2dw=(float)w / sw;
{
w = Abs(w);
sw = Abs(sw);
- flip = true;
+ flip = true;
}
s2dw=(float)w / sw;
else if(alphaWrite)
dest->a = (byte)a;
}
- }
+ }
dest += adddest;
}
}
- else
- {
+ else
+ {
int y;
for (y = 0; y < h; y++)
{
g += pixel.color.g;
b += pixel.color.b;
numPixels++;
- }
+ }
a /= numPixels;
r /= numPixels;
g /= numPixels;
}
}
dest += adddest;
- }
+ }
}
}
else if(!src.paletteShades && src.pixelFormat == lfbSurface.bitmap.pixelFormat)
delete fontEntry;
}
}
- }
+ }
#endif
delete font;
}
FontData fontData = { { 0 } };
LOGFONT logFont = { 0 };
HDC hdc = GetDC(0);
-
+
fakeItalic = false;
-
+
logFont.lfCharSet = DEFAULT_CHARSET;
strcpy(logFont.lfFaceName, faceName);
fontData.flags = flags;
-
+
EnumFontFamiliesEx(hdc, &logFont, (void *)MyFontProc, (DWORD)&fontData, 0);
if(!fontData.fileName[0] && flags.bold)
{
EnumFontFamiliesEx(hdc, &logFont, (void *)MyFontProc, (DWORD)&fontData, 0);
fakeItalic = true;
}
-
+
if(fontData.fileName[0])
{
GetWindowsDirectory(fileName, MAX_LOCATION);
PathCat(fileName, fontData.fileName);
}
ReleaseDC(0, hdc);
- }
+ }
#elif !defined(ECERE_NOFONTCONFIG)
{
char * fileName2;
if(testChar)
FcCharSetAddChar(charSet, testChar);
-
+
pattern = FcPatternBuild(null,
//FC_SOURCE, FcTypeString, "freetype",
FC_FAMILY, FcTypeString, faceName,
links[0] = 0;
if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontLink\\SystemLink",0,KEY_READ,&key) ||
!RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\FontLink\\SystemLink",0,KEY_READ,&key))
- {
+ {
// int value = 0;
uint32 type;
int size = 1024;
FT_Open_Args args = { 0 };
FT_Parameter param = { FT_PARAM_TAG_UNPATENTED_HINTING };
FT_Stream stream = new0 FT_StreamRec[1];
-
+
if(!ftLibrary)
FT_Init_FreeType( &ftLibrary );
}
}
#endif
-
+
}
linksPos += c;
while(links[linksPos] && links[linksPos] != ',') linksPos++;
}
}
}
-
+
if(!result)
UnloadFont(displaySystem, font);
else
}
#if !defined(ECERE_NOTRUETYPE)
- void ::ProcessString(Font font, DisplaySystem displaySystem, byte * text, int len,
+ void ::ProcessString(Font font, DisplaySystem displaySystem, byte * text, int len,
void (* callback)(Surface surface, Display display, int x, int y, GlyphInfo * glyph, Bitmap bitmap),
Surface surface, Display display, int * x, int y)
{
int fontEntryNum = 0;
int glyphScript = 0;
FontEntry curFontEntry;
-
+
pack.bitmap.alphaBlend = true;
for(c = 0; c < len || (numGlyphs && (rightToLeft ? (glyphIndex >= 0) : (glyphIndex < numGlyphs)));)
unichar ahead = 0;
unichar testChar = 0;
char * testLang = null;
-
+
while(true)
{
HB_Script script = HB_Script_Common;
int nb;
unichar ahead = UTF8GetChar((char *)text + a, &nb);
if((ahead >= 0x590 && ahead <= 0x7C0) || (ahead >= 0xFB1D && ahead <= 0xFB4F) || (ahead >= 0xFB50 && ahead <= 0xFDFF))
- script = curScript;
+ script = curScript;
}
else
script = curScript;
if(c >= len)
break;
}
- else
+ else
{
if(!script || script > HB_ScriptCount) { c += nb; if(script > HB_ScriptCount) curScript = script; break; }
if(!script) { c += nb; break; }
case HB_Script_Arabic: testChar = 0x621; /*testLang = "ar"; */
//printf("Arabic ");
break;
- case HB_Script_Devanagari: testChar = 0x905; testLang = "sa";
+ case HB_Script_Devanagari: testChar = 0x905; testLang = "sa";
//printf("Devanagari ");
break;
case HB_Script_Hebrew: testChar = 0x05EA /*'ת'*/; /*testLang = "he"; */
printf("Not found in %s\n", (char *)font.fontEntries[fontEntryNum].key);*/
}
}
-
- if(fontEntryNum == MAX_FONT_LINK_ENTRIES)
+
+ if(fontEntryNum == MAX_FONT_LINK_ENTRIES)
{
#if !defined(__WIN32__) && !defined(ECERE_NOFONTCONFIG)
int fontID = 0;
if(fontEntryNum == MAX_FONT_LINK_ENTRIES)
#endif
continue;
-
+
#if !defined(__WIN32__) && !defined(ECERE_NOFONTCONFIG)
{
charSet = FcCharSetCreate();
if(file)
{
FileSize fileSize = file.GetSize();
- FT_Open_Args args = { 0 };
+ FT_Open_Args args = { 0 };
FT_Parameter param = { FT_PARAM_TAG_UNPATENTED_HINTING };
FT_Stream stream = new0 FT_StreamRec[1];
-
+
if(!ftLibrary)
FT_Init_FreeType( &ftLibrary );
fontEntry = FontEntry { key = (uintptr)CopyString(fileName) };
fontEntry.stream = stream;
-
+
//args.num_params = 1;
args.params = ¶m;
// delete file;
if(fontEntry.face)
{
- fontEntry.hbFace = HB_NewFace(fontEntry.face, hb_getSFntTable);
+ fontEntry.hbFace = HB_NewFace(fontEntry.face, hb_getSFntTable);
fontEntry.hbFont.klass = &hb_fontClass;
fontEntry.hbFont.userData = fontEntry; //.face;
fontEntry.used++;
}
}
- if(pattern) FcPatternDestroy(pattern);
+ if(pattern) FcPatternDestroy(pattern);
if(matched) FcPatternDestroy(matched);
if(charSet) FcCharSetDestroy(charSet);
#endif
if(packNo != lastPack)
{
- if(glyphNo < 128)
+ if(glyphNo < 128)
pack = font.asciiPack;
else
{
{
if(displaySystem && displaySystem.flags.text && len)
{
- if(width)
+ if(width)
{
int num = len;
*width = num * textCellW;
x /= textCellW;
y /= textCellH;
- if(y > surface.box.bottom || y < surface.box.top)
+ if(y > surface.box.bottom || y < surface.box.top)
return;
coffset += (y+surface.offset.y) * lfbSurface.bitmap.stride + x + surface.offset.x;
for(c=0; (c<len && x < surface.box.left); c++, x++,coffset++);
*coffset = (uint16) (((*coffset)&0xF000)|lfbSurface.foreground|text[c]);
}
}
- else
+ else
{
lfbSurface.writingText = true;
#if !defined(ECERE_NOTRUETYPE)
lfbSurface.writingText = false;
}
}
-
+
void TextFont(Display display, Surface surface, Font font)
{
LFBSurface lfbSurface = surface.driverData;
character == 141 || character == 142 || character == 143 || character == 155 ||
character == 156)
character = 32;
- else if(character < 32)
+ else if(character < 32)
{
character += 95;
result |= A_ALTCHARSET;
}
if(color == 0x0800)
- result |= A_DIM;
- else if(color & 0x0800)
+ result |= A_DIM;
+ else if(color & 0x0800)
result |= A_BOLD;
- if(color & 0x8000)
+ if(color & 0x8000)
result |= A_BLINK;
result |= character;
return result;
cursesDisplay.bitmap.picture = new0 byte[2 * width / textCellW * height / textCellW];
if(cursesDisplay.bitmap.picture)
- {
+ {
cursesDisplay.bitmap.stride = width / textCellW;
cursesDisplay.bitmap.pixelFormat = pixelFormatText;
cursesDisplay.bitmap.size = width / textCellW * height / textCellH;
if(lfbSurface.opaqueText)
{
- mvaddch((y+surface.offset.y),x+surface.offset.x,
+ mvaddch((y+surface.offset.y),x+surface.offset.x,
CC(lfbSurface.background|lfbSurface.foreground|lfbSurface.drawingChar));
}
else
{
- mvaddch((y+surface.offset.y),x+surface.offset.x,
+ mvaddch((y+surface.offset.y),x+surface.offset.x,
CC(lfbSurface.background|lfbSurface.foreground|lfbSurface.drawingChar));
}
}
}
else
{
- uint16 * lfbPtr = ((uint16 *)lfbSurface.bitmap.picture) +
+ uint16 * lfbPtr = ((uint16 *)lfbSurface.bitmap.picture) +
(y1+surface.offset.y)*lfbSurface.bitmap.stride+x1+surface.offset.x;
int y;
for(y=y1;y<=y2; y++, lfbPtr += lfbSurface.bitmap.stride)
}
else
{
- uint16 * lfbPtr = ((uint16 *)lfbSurface.bitmap.picture) +
+ uint16 * lfbPtr = ((uint16 *)lfbSurface.bitmap.picture) +
(y1+surface.offset.y)*display.width / textCellW+x1+surface.offset.x;
int x;
for(x=x1;x<=x2; x++, lfbPtr++)
for(y=y1;y<=y2; y++)
{
mvhline(y+surface.offset.y,x1+surface.offset.x,
- CC(lfbSurface.background | lfbSurface.foreground | lfbSurface.drawingChar),x2-x1+1);
+ CC(lfbSurface.background | lfbSurface.foreground | lfbSurface.drawingChar),x2-x1+1);
}
}
}
x /= textCellW;
y /= textCellH;
- if(y > surface.box.bottom || y < surface.box.top)
+ if(y > surface.box.bottom || y < surface.box.top)
return;
y += surface.offset.y;
lfbPtr = ((uint16 *)lfbSurface.bitmap.picture) + y * lfbSurface.bitmap.stride + x + surface.offset.x;
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
-#define WGL_WGLEXT_VERSION 1
-#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
-#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
-#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
-#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
-#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
-#define WGL_DRAW_TO_WINDOW_ARB 0x2001
-#define WGL_DRAW_TO_BITMAP_ARB 0x2002
-#define WGL_ACCELERATION_ARB 0x2003
-#define WGL_NEED_PALETTE_ARB 0x2004
-#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
-#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
-#define WGL_SWAP_METHOD_ARB 0x2007
-#define WGL_NUMBER_OVERLAYS_ARB 0x2008
-#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
-#define WGL_TRANSPARENT_ARB 0x200A
-#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
-#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
-#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
-#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
-#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
-#define WGL_SHARE_DEPTH_ARB 0x200C
-#define WGL_SHARE_STENCIL_ARB 0x200D
-#define WGL_SHARE_ACCUM_ARB 0x200E
-#define WGL_SUPPORT_GDI_ARB 0x200F
-#define WGL_SUPPORT_OPENGL_ARB 0x2010
-#define WGL_DOUBLE_BUFFER_ARB 0x2011
-#define WGL_STEREO_ARB 0x2012
-#define WGL_PIXEL_TYPE_ARB 0x2013
-#define WGL_COLOR_BITS_ARB 0x2014
-#define WGL_RED_BITS_ARB 0x2015
-#define WGL_RED_SHIFT_ARB 0x2016
-#define WGL_GREEN_BITS_ARB 0x2017
-#define WGL_GREEN_SHIFT_ARB 0x2018
-#define WGL_BLUE_BITS_ARB 0x2019
-#define WGL_BLUE_SHIFT_ARB 0x201A
-#define WGL_ALPHA_BITS_ARB 0x201B
-#define WGL_ALPHA_SHIFT_ARB 0x201C
-#define WGL_ACCUM_BITS_ARB 0x201D
-#define WGL_ACCUM_RED_BITS_ARB 0x201E
-#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
-#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
-#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
-#define WGL_DEPTH_BITS_ARB 0x2022
-#define WGL_STENCIL_BITS_ARB 0x2023
-#define WGL_AUX_BUFFERS_ARB 0x2024
-#define WGL_NO_ACCELERATION_ARB 0x2025
-#define WGL_GENERIC_ACCELERATION_ARB 0x2026
-#define WGL_FULL_ACCELERATION_ARB 0x2027
-#define WGL_SWAP_EXCHANGE_ARB 0x2028
-#define WGL_SWAP_COPY_ARB 0x2029
-#define WGL_SWAP_UNDEFINED_ARB 0x202A
-#define WGL_TYPE_RGBA_ARB 0x202B
-#define WGL_TYPE_COLORINDEX_ARB 0x202C
-#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
-#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
-#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
-#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
-#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
-#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
-#define WGL_PBUFFER_LARGEST_ARB 0x2033
-#define WGL_PBUFFER_WIDTH_ARB 0x2034
-#define WGL_PBUFFER_HEIGHT_ARB 0x2035
-#define WGL_PBUFFER_LOST_ARB 0x2036
-#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
-#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
-#define WGL_DRAW_TO_WINDOW_EXT 0x2001
-#define WGL_DRAW_TO_BITMAP_EXT 0x2002
-#define WGL_ACCELERATION_EXT 0x2003
-#define WGL_NEED_PALETTE_EXT 0x2004
-#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
-#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
-#define WGL_SWAP_METHOD_EXT 0x2007
-#define WGL_NUMBER_OVERLAYS_EXT 0x2008
-#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
-#define WGL_TRANSPARENT_EXT 0x200A
-#define WGL_TRANSPARENT_VALUE_EXT 0x200B
-#define WGL_SHARE_DEPTH_EXT 0x200C
-#define WGL_SHARE_STENCIL_EXT 0x200D
-#define WGL_SHARE_ACCUM_EXT 0x200E
-#define WGL_SUPPORT_GDI_EXT 0x200F
-#define WGL_SUPPORT_OPENGL_EXT 0x2010
-#define WGL_DOUBLE_BUFFER_EXT 0x2011
-#define WGL_STEREO_EXT 0x2012
-#define WGL_PIXEL_TYPE_EXT 0x2013
-#define WGL_COLOR_BITS_EXT 0x2014
-#define WGL_RED_BITS_EXT 0x2015
-#define WGL_RED_SHIFT_EXT 0x2016
-#define WGL_GREEN_BITS_EXT 0x2017
-#define WGL_GREEN_SHIFT_EXT 0x2018
-#define WGL_BLUE_BITS_EXT 0x2019
-#define WGL_BLUE_SHIFT_EXT 0x201A
-#define WGL_ALPHA_BITS_EXT 0x201B
-#define WGL_ALPHA_SHIFT_EXT 0x201C
-#define WGL_ACCUM_BITS_EXT 0x201D
-#define WGL_ACCUM_RED_BITS_EXT 0x201E
-#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
-#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
-#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
-#define WGL_DEPTH_BITS_EXT 0x2022
-#define WGL_STENCIL_BITS_EXT 0x2023
-#define WGL_AUX_BUFFERS_EXT 0x2024
-#define WGL_NO_ACCELERATION_EXT 0x2025
-#define WGL_GENERIC_ACCELERATION_EXT 0x2026
-#define WGL_FULL_ACCELERATION_EXT 0x2027
-#define WGL_SWAP_EXCHANGE_EXT 0x2028
-#define WGL_SWAP_COPY_EXT 0x2029
-#define WGL_SWAP_UNDEFINED_EXT 0x202A
-#define WGL_TYPE_RGBA_EXT 0x202B
-#define WGL_TYPE_COLORINDEX_EXT 0x202C
-#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
-#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
-#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
-#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
-#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
-#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
-#define WGL_PBUFFER_LARGEST_EXT 0x2033
-#define WGL_PBUFFER_WIDTH_EXT 0x2034
-#define WGL_PBUFFER_HEIGHT_EXT 0x2035
-#define WGL_DEPTH_FLOAT_EXT 0x2040
-#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
-#define WGL_SAMPLES_3DFX 0x2061
-#define WGL_SAMPLE_BUFFERS_EXT 0x2041
-#define WGL_SAMPLES_EXT 0x2042
-#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
-#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
-#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
-#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
-#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
-#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
-#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
-#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
-#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
-#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
-#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
-#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
-#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
-#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
-#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
-#define WGL_ARB_buffer_region 1
-#define WGL_ARB_extensions_string 1
-#define WGL_ARB_pixel_format 1
-#define WGL_ARB_make_current_read 1
-#define WGL_ARB_pbuffer 1
-#define WGL_EXT_display_color_table 1
-#define WGL_EXT_extensions_string 1
-#define WGL_EXT_make_current_read 1
-#define WGL_EXT_pbuffer 1
-#define WGL_EXT_pixel_format 1
-#define WGL_EXT_swap_control 1
-#define WGL_WGL_EXT_depth_float 1
-#define WGL_WGL_3DFX_multisample 1
-#define WGL_WGL_EXT_multisample 1
-#define WGL_NV_allocate_memory 1
+#define WGL_WGLEXT_VERSION 1
+#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
+#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
+#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
+#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
+#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+#define WGL_DRAW_TO_BITMAP_ARB 0x2002
+#define WGL_ACCELERATION_ARB 0x2003
+#define WGL_NEED_PALETTE_ARB 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
+#define WGL_SWAP_METHOD_ARB 0x2007
+#define WGL_NUMBER_OVERLAYS_ARB 0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
+#define WGL_TRANSPARENT_ARB 0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
+#define WGL_SHARE_DEPTH_ARB 0x200C
+#define WGL_SHARE_STENCIL_ARB 0x200D
+#define WGL_SHARE_ACCUM_ARB 0x200E
+#define WGL_SUPPORT_GDI_ARB 0x200F
+#define WGL_SUPPORT_OPENGL_ARB 0x2010
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+#define WGL_STEREO_ARB 0x2012
+#define WGL_PIXEL_TYPE_ARB 0x2013
+#define WGL_COLOR_BITS_ARB 0x2014
+#define WGL_RED_BITS_ARB 0x2015
+#define WGL_RED_SHIFT_ARB 0x2016
+#define WGL_GREEN_BITS_ARB 0x2017
+#define WGL_GREEN_SHIFT_ARB 0x2018
+#define WGL_BLUE_BITS_ARB 0x2019
+#define WGL_BLUE_SHIFT_ARB 0x201A
+#define WGL_ALPHA_BITS_ARB 0x201B
+#define WGL_ALPHA_SHIFT_ARB 0x201C
+#define WGL_ACCUM_BITS_ARB 0x201D
+#define WGL_ACCUM_RED_BITS_ARB 0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
+#define WGL_DEPTH_BITS_ARB 0x2022
+#define WGL_STENCIL_BITS_ARB 0x2023
+#define WGL_AUX_BUFFERS_ARB 0x2024
+#define WGL_NO_ACCELERATION_ARB 0x2025
+#define WGL_GENERIC_ACCELERATION_ARB 0x2026
+#define WGL_FULL_ACCELERATION_ARB 0x2027
+#define WGL_SWAP_EXCHANGE_ARB 0x2028
+#define WGL_SWAP_COPY_ARB 0x2029
+#define WGL_SWAP_UNDEFINED_ARB 0x202A
+#define WGL_TYPE_RGBA_ARB 0x202B
+#define WGL_TYPE_COLORINDEX_ARB 0x202C
+#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
+#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
+#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
+#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
+#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
+#define WGL_PBUFFER_LARGEST_ARB 0x2033
+#define WGL_PBUFFER_WIDTH_ARB 0x2034
+#define WGL_PBUFFER_HEIGHT_ARB 0x2035
+#define WGL_PBUFFER_LOST_ARB 0x2036
+#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
+#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
+#define WGL_DRAW_TO_WINDOW_EXT 0x2001
+#define WGL_DRAW_TO_BITMAP_EXT 0x2002
+#define WGL_ACCELERATION_EXT 0x2003
+#define WGL_NEED_PALETTE_EXT 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
+#define WGL_SWAP_METHOD_EXT 0x2007
+#define WGL_NUMBER_OVERLAYS_EXT 0x2008
+#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
+#define WGL_TRANSPARENT_EXT 0x200A
+#define WGL_TRANSPARENT_VALUE_EXT 0x200B
+#define WGL_SHARE_DEPTH_EXT 0x200C
+#define WGL_SHARE_STENCIL_EXT 0x200D
+#define WGL_SHARE_ACCUM_EXT 0x200E
+#define WGL_SUPPORT_GDI_EXT 0x200F
+#define WGL_SUPPORT_OPENGL_EXT 0x2010
+#define WGL_DOUBLE_BUFFER_EXT 0x2011
+#define WGL_STEREO_EXT 0x2012
+#define WGL_PIXEL_TYPE_EXT 0x2013
+#define WGL_COLOR_BITS_EXT 0x2014
+#define WGL_RED_BITS_EXT 0x2015
+#define WGL_RED_SHIFT_EXT 0x2016
+#define WGL_GREEN_BITS_EXT 0x2017
+#define WGL_GREEN_SHIFT_EXT 0x2018
+#define WGL_BLUE_BITS_EXT 0x2019
+#define WGL_BLUE_SHIFT_EXT 0x201A
+#define WGL_ALPHA_BITS_EXT 0x201B
+#define WGL_ALPHA_SHIFT_EXT 0x201C
+#define WGL_ACCUM_BITS_EXT 0x201D
+#define WGL_ACCUM_RED_BITS_EXT 0x201E
+#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
+#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
+#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
+#define WGL_DEPTH_BITS_EXT 0x2022
+#define WGL_STENCIL_BITS_EXT 0x2023
+#define WGL_AUX_BUFFERS_EXT 0x2024
+#define WGL_NO_ACCELERATION_EXT 0x2025
+#define WGL_GENERIC_ACCELERATION_EXT 0x2026
+#define WGL_FULL_ACCELERATION_EXT 0x2027
+#define WGL_SWAP_EXCHANGE_EXT 0x2028
+#define WGL_SWAP_COPY_EXT 0x2029
+#define WGL_SWAP_UNDEFINED_EXT 0x202A
+#define WGL_TYPE_RGBA_EXT 0x202B
+#define WGL_TYPE_COLORINDEX_EXT 0x202C
+#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
+#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
+#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
+#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
+#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
+#define WGL_PBUFFER_LARGEST_EXT 0x2033
+#define WGL_PBUFFER_WIDTH_EXT 0x2034
+#define WGL_PBUFFER_HEIGHT_EXT 0x2035
+#define WGL_DEPTH_FLOAT_EXT 0x2040
+#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
+#define WGL_SAMPLES_3DFX 0x2061
+#define WGL_SAMPLE_BUFFERS_EXT 0x2041
+#define WGL_SAMPLES_EXT 0x2042
+#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
+#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
+#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
+#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
+#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
+#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
+#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
+#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
+#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
+#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
+#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
+#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
+#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
+#define WGL_ARB_buffer_region 1
+#define WGL_ARB_extensions_string 1
+#define WGL_ARB_pixel_format 1
+#define WGL_ARB_make_current_read 1
+#define WGL_ARB_pbuffer 1
+#define WGL_EXT_display_color_table 1
+#define WGL_EXT_extensions_string 1
+#define WGL_EXT_make_current_read 1
+#define WGL_EXT_pbuffer 1
+#define WGL_EXT_pixel_format 1
+#define WGL_EXT_swap_control 1
+#define WGL_WGL_EXT_depth_float 1
+#define WGL_WGL_3DFX_multisample 1
+#define WGL_WGL_EXT_multisample 1
+#define WGL_NV_allocate_memory 1
/*
typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
currentVertexBuffer = 0;
return true;
-}
+}
static void egl_term_display()
{
vertexPointer[count*(2+numVertexCoords)+1] = vertexPointer[(count-3)*(2+numVertexCoords)+1];
count++;
}
-}
+}
void glesTexCoord2i(int x, int y) { glesTexCoord2f((float)x, (float)y); }
void glesTexCoord2d(double x, double y) { glesTexCoord2f((float)x, (float)y); }
void glesTexCoord2fv(float * a) { glesTexCoord2f(a[0], a[1]); }
{
float matrix[4][4] =
{
- { (float)(2 / (r - l)), 0, 0, 0 },
+ { (float)(2 / (r - l)), 0, 0, 0 },
{ 0, (float)(2 / (t - b)), 0, 0 },
{ 0, 0, (float)(-2 / (f - n)), 0 },
{ (float)(-(r + l) / (r - l)), (float)(-(t + b) / (t - b)), (float)(-(f + n) / (f - n)), 1 }
#if defined(__WIN32__)
wglMakeCurrent( null, null );
- if(oglDisplay.glrc)
+ if(oglDisplay.glrc)
wglDeleteContext(oglDisplay.glrc);
-
+
if(oglDisplay.hdc && oglDisplay.pBuffer)
wglReleasePbufferDCARB(oglDisplay.pBuffer, oglDisplay.hdc);
if(oglDisplay.pBuffer)
wglDestroyPbufferARB(oglDisplay.pBuffer);
- if(oglDisplay.hdc)
+ if(oglDisplay.hdc)
ReleaseDC(display.window, oglDisplay.hdc);
if(oglDisplay.memDC) DeleteDC(oglDisplay.memDC);
- if(oglDisplay.memBitmap) DeleteObject(oglDisplay.memBitmap);
+ if(oglDisplay.memBitmap) DeleteObject(oglDisplay.memBitmap);
#elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
if(oglDisplay.shminfoShape.shmaddr != (void *)-1)
shmdt(oglDisplay.shminfoShape.shmaddr);
shmctl(oglDisplay.shminfoShape.shmid, IPC_RMID, 0);
- }
+ }
XDestroyImage(oglDisplay.shapeImage);
oglDisplay.shapeImage = None;
}
glXMakeCurrent(xGlobalDisplay, None, null);
-
- if(oglDisplay.glContext)
+
+ if(oglDisplay.glContext)
glXDestroyContext(xGlobalDisplay, oglDisplay.glContext);
#endif
#endif
oglSystem.hdc = GetDC(oglSystem.hwnd);
if(oglSystem.hdc)
{
-
+
oglSystem.pfd.nSize = (short)sizeof(oglSystem.pfd);
oglSystem.pfd.nVersion = 1;
oglSystem.pfd.dwFlags = PFD_DRAW_TO_WINDOW /*PFD_DRAW_TO_BITMAP*/ | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
int numFormats;
float fAttributes[] = {0,0};
int iAttributes[] =
- {
+ {
WGL_DRAW_TO_WINDOW_ARB,GL_TRUE,
WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
#if defined(__WIN32__)
wglMakeCurrent( null, null );
- if(oglSystem.glrc)
+ if(oglSystem.glrc)
wglDeleteContext(oglSystem.glrc);
-
- if(oglSystem.hdc)
+
+ if(oglSystem.hdc)
ReleaseDC(oglSystem.hwnd, oglSystem.hdc);
DestroyWindow(oglSystem.hwnd);
{
/*WGL_TEXTURE_FORMAT_ARB, WGL_TEXTURE_RGBA_ARB,
WGL_TEXTURE_TARGET_ARB, WGL_TEXTURE_2D_ARB, */0
- };
+ };
int pixelFormat = 0;
if(wglChoosePixelFormatARB)
{
int numFormats;
float fAttributes[] = {0,0};
int iAttributes[] =
- {
+ {
//WGL_DRAW_TO_BITMAP_ARB, GL_TRUE,
WGL_DRAW_TO_PBUFFER_ARB,GL_TRUE,
WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
WGL_SAMPLES_ARB, 4, // Check For 4x Multisampling
0,0
};
-
+
//Log("Found wglChoosePixelFormatARB\n");
valid = wglChoosePixelFormatARB(oglSystem.hdc,iAttributes,fAttributes,1,&pixelFormat,&numFormats);
{
wglMakeCurrent(null, null);
}
- }
+ }
wglMakeCurrent( null, null );
wglMakeCurrent( oglDisplay.hdc, oglDisplay.glrc );
if(!useSingleGLContext)
wglMakeCurrent( null, null );
-
- if(oglDisplay.glrc)
+
+ if(oglDisplay.glrc)
wglDeleteContext(oglDisplay.glrc);
oglDisplay.pBuffer = wglCreatePbufferARB(oglSystem.hdc, pixelFormat, width, height, attributes);
wglMakeCurrent(oglDisplay.hdc, oglDisplay.glrc);
//wglQueryPbufferARB(pBuffer, WGL_PBUFFER_WIDTH_ARB, &width);
- //wglQueryPbufferARB(pBuffer, WGL_PBUFFER_HEIGHT_ARB, &height);
-
+ //wglQueryPbufferARB(pBuffer, WGL_PBUFFER_HEIGHT_ARB, &height);
+
// glDeleteBuffersARB(2, oglDisplay.imageBuffers);
if((info = (BITMAPINFO *)new0 byte[sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)*256]))
if(oglDisplay.shminfoShape.shmaddr != (void *)-1)
shmdt(oglDisplay.shminfoShape.shmaddr);
shmctl(oglDisplay.shminfoShape.shmid, IPC_RMID, 0);
- }
+ }
XDestroyImage(oglDisplay.shapeImage);
oglDisplay.shapeImage = None;
}
glXMakeCurrent(xGlobalDisplay, (int)display.window, oglDisplay.glContext);
// Initialize Shared Memory Pixmap
- oglDisplay.image = XShmCreateImage(xGlobalDisplay, DefaultVisual(xGlobalDisplay, DefaultScreen(xGlobalDisplay)), 32,
+ oglDisplay.image = XShmCreateImage(xGlobalDisplay, DefaultVisual(xGlobalDisplay, DefaultScreen(xGlobalDisplay)), 32,
ZPixmap, null, &oglDisplay.shminfo, width, height);
if(oglDisplay.image)
{
- oglDisplay.shminfo.shmid = shmget(IPC_PRIVATE,
+ oglDisplay.shminfo.shmid = shmget(IPC_PRIVATE,
oglDisplay.image->bytes_per_line * oglDisplay.image->height, IPC_CREAT|0777);
if(oglDisplay.shminfo.shmid != -1)
{
oglDisplay.shminfo.readOnly = False;
if(XShmAttach(xGlobalDisplay, &oglDisplay.shminfo))
{
- oglDisplay.pixmap = XShmCreatePixmap(xGlobalDisplay, (X11Window)display.window, oglDisplay.shminfo.shmaddr,
+ oglDisplay.pixmap = XShmCreatePixmap(xGlobalDisplay, (X11Window)display.window, oglDisplay.shminfo.shmaddr,
&oglDisplay.shminfo, width, height, 32);
// Initialize Shared Memory Shape Pixmap
- oglDisplay.shapeImage = XShmCreateImage(xGlobalDisplay, DefaultVisual(xGlobalDisplay, DefaultScreen(xGlobalDisplay)), 1,
+ oglDisplay.shapeImage = XShmCreateImage(xGlobalDisplay, DefaultVisual(xGlobalDisplay, DefaultScreen(xGlobalDisplay)), 1,
ZPixmap, null, &oglDisplay.shminfoShape, width, height);
if(oglDisplay.shapeImage)
{
- oglDisplay.shminfoShape.shmid = shmget(IPC_PRIVATE,
+ oglDisplay.shminfoShape.shmid = shmget(IPC_PRIVATE,
oglDisplay.shapeImage->bytes_per_line * oglDisplay.shapeImage->height, IPC_CREAT|0777);
if(oglDisplay.shminfoShape.shmid != -1)
{
oglDisplay.shminfoShape.readOnly = False;
if(XShmAttach(xGlobalDisplay, &oglDisplay.shminfoShape))
{
- oglDisplay.shapePixmap = XShmCreatePixmap(xGlobalDisplay, (X11Window)display.window, oglDisplay.shminfoShape.shmaddr,
+ oglDisplay.shapePixmap = XShmCreatePixmap(xGlobalDisplay, (X11Window)display.window, oglDisplay.shminfoShape.shmaddr,
&oglDisplay.shminfoShape, width, height, 1);
//oglDisplay.shapePixmap = XCreatePixmap(xGlobalDisplay, (X11Window)display.window, width, height, 1);
#endif
oglDisplay.pixmapPicture = XRenderCreatePicture(xGlobalDisplay, oglDisplay.pixmap, format, CPRepeat, &attributes);
oglDisplay.windowPicture = XRenderCreatePicture(xGlobalDisplay, (X11Window)display.window, format, 0, &attributes);
- oglDisplay.shapePicture = XRenderCreatePicture(xGlobalDisplay, oglDisplay.shapePixmap,
+ oglDisplay.shapePicture = XRenderCreatePicture(xGlobalDisplay, oglDisplay.shapePixmap,
XRenderFindStandardFormat(xGlobalDisplay, PictStandardA1), 0, &attributes);
- }
+ }
oglDisplay.picture = oglDisplay.shminfo.shmaddr;
oglDisplay.stride = oglDisplay.image->bytes_per_line / 4;
}
if(!result)
return false;
-
+
result = false;
glViewport(0,0,width,height);
}
if(oglDisplay.flippingBuffer || !width || !height)
result = true;
-
+
return result;
}
// outstanding DMA transfers into the buffer to finish.
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, oglDisplay.imageBuffers[0]);
oglDisplay.pboMemory1 = (byte *)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY);
-
+
// glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, oglDisplay.imageBuffers[1]);
// oglDisplay.pboMemory2 = (byte *)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB,GL_READ_ONLY);
-
+
memcpy(oglDisplay.picture, oglDisplay.pboMemory1, display.width * display.height * 4);
//memcpy(oglDisplay.picture + display.width * display.height * 4 / 2, oglDisplay.pboMemory2, display.width * display.height * 4/ 2);
*/
-
+
UpdateLayeredWindow(display.window, hdc, &point, &size, oglDisplay.memDC, &srcPoint, 0, &blend, ULW_ALPHA);
/*
// glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, oglDisplay.imageBuffers[1]);
// glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
-
+
// Bind two different buffer objects and start the glReadPixels
// asynchronously. Each call will return directly after
// starting the DMA transfer.
#elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
#else
- XTransform transform =
+ XTransform transform =
{
{
{ (int)(1.0f * (1<<16)), (int)(0.0f * (1<<16)), (int)(0 * (1 << 16)) },
#endif
#endif
}
- }
+ }
else
#endif
{
#if defined(__WIN32__)
- //wglSwapLayerBuffers(oglDisplay.hdc,WGL_SWAP_MAIN_PLANE);
+ //wglSwapLayerBuffers(oglDisplay.hdc,WGL_SWAP_MAIN_PLANE);
SwapBuffers(oglDisplay.hdc);
#elif defined(__unix__) || defined(__APPLE__)
#if defined(__ANDROID__)
bool result = false;
Bitmap mipMap { };
int glBitmap = -1;
-
+
uint w = width, h = height;
if(oglSystem.pow2textures)
{
for(c=0; c<bitmap.size; c++)
{
// ((ColorRGBA *)bitmap.picture)[c] = ((ColorAlpha *)bitmap.picture)[c];
- // TODO:
+ // TODO:
ColorAlpha color = ((ColorAlpha *)bitmap.picture)[c];
((ColorRGBA *)bitmap.picture)[c] = ColorRGBA { color.color.r, color.color.g, color.color.b, color.a };
}
delete mipMap;
}
}
- else
+ else
mipMap = bitmap;
if(result)
result = false;
}
}
- if(mipMap != bitmap)
+ if(mipMap != bitmap)
delete mipMap;
if(!mipMaps) break;
}
bool result = false;
OGLDisplay oglDisplay = display.driverData;
ColorAlpha * flippingBuffer = oglDisplay.flippingBuffer;
-
+
if(oglDisplay.flippingBuffer)
{
if(bitmap.pixelFormat != pixelFormat888 || bitmap.width < w || bitmap.height < h)
glBegin(GL_POINTS);
// glVertex2i(x+surface.offset.x, y+surface.offset.y);
glVertex2f(x+surface.offset.x + 0.5f, y+surface.offset.y + 0.5f);
-
+
glEnd();
}
glVertex2f(x1 + 0.5f, y1 + 0.5f);
glVertex2f(x2 + 0.5f, y2 + 0.5f);
}
-
+
glEnd();
}
glColor4fv(oglSurface.background);
glRecti(x1+surface.offset.x, y1+surface.offset.y,
x2+surface.offset.x + 1, y2+surface.offset.y + 1);
-
+
/*
glRectf(x1+surface.offset.x, y1+surface.offset.y,
x2+surface.offset.x + 1, y2+surface.offset.y + 1);
}
else if(oglSurface.xOffset)
glTranslated(oglSurface.xOffset / 64.0/*-0.375*/, 0.0, 0.0);
-
+
glBindTexture(GL_TEXTURE_2D, (uint)bitmap.driverData);
glBegin(GL_QUADS);
{
glTexCoord2f((float)(sx)/ bitmap.width, (float)(sy+sh)/ bitmap.height);
glVertex2i(dx+surface.offset.x, dy+surface.offset.y);
-
+
glTexCoord2f((float)(sx+sw) / bitmap.width, (float)(sy+sh)/ bitmap.height);
glVertex2i(dx+w+surface.offset.x, dy+surface.offset.y);
-
+
glTexCoord2f((float)(sx+sw)/ bitmap.width, (float)(sy)/ bitmap.height);
glVertex2i(dx+w+surface.offset.x, dy-h+surface.offset.y);
-
+
glTexCoord2f((float)(sx) / bitmap.width, (float)(sy)/ bitmap.height);
glVertex2i(dx+surface.offset.x, dy-h+surface.offset.y);
}
{
glTexCoord2f((float)(sx) / bitmap.width, (float)(sy)/ bitmap.height);
glVertex2i(dx+surface.offset.x, dy+surface.offset.y);
-
+
glTexCoord2f((float)(sx+sw)/ bitmap.width, (float)(sy)/ bitmap.height);
glVertex2i(dx+w+surface.offset.x, dy+surface.offset.y);
-
+
glTexCoord2f((float)(sx+sw) / bitmap.width, (float)(sy+sh)/ bitmap.height);
glVertex2i(dx+w+surface.offset.x, dy+h+surface.offset.y);
-
+
glTexCoord2f((float)(sx)/ bitmap.width, (float)(sy+sh)/ bitmap.height);
glVertex2i(dx+surface.offset.x, dy+h+surface.offset.y);
}
{
w = Abs(w);
sw = Abs(sw);
- flipX = true;
+ flipX = true;
}
if(Sgn(h) != Sgn(sh))
{
h = Abs(h);
sh = Abs(sh);
- flipY = true;
+ flipY = true;
}
s2dw=(float)w / sw;
//Clip against the edges of the surfaceination
if(dx<surface.box.left)
{
- //if(!flip)
+ //if(!flip)
sx+=(int)((surface.box.left-dx)*d2sw);
sw-=(int)((surface.box.left-dx)*d2sw);
w-=surface.box.left-dx;
//Clip against the edges of the surfaceination
if(dx<surface.box.left)
{
- //if(!flip)
+ //if(!flip)
sx+=surface.box.left-dx;
w-=surface.box.left-dx;
dx=surface.box.left;
color[1] = light.diffuse.g * light.multiplier;
color[2] = light.diffuse.b * light.multiplier;
glLightfv(GL_LIGHT0 + id, GL_DIFFUSE, color);
-
+
color[0] = light.ambient.r * light.multiplier;
color[1] = light.ambient.g * light.multiplier;
color[2] = light.ambient.b * light.multiplier;
color[1] = light.specular.g * light.multiplier;
color[2] = light.specular.b * light.multiplier;
glLightfv(GL_LIGHT0 + id, GL_SPECULAR,color);
-
+
if(lightObject)
{
Vector3D positionVector;
position[0] = (float)positionVector.x;
position[1] = (float)positionVector.y;
position[2] = (float)positionVector.z;
-
+
glLightfv(GL_LIGHT0 + id, GL_POSITION, position);
/*
glEnd();
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
-
+
// Display Target
if(lightObject.flags.root || !lightObject.parent)
}
else
{
- positionVector.MultMatrix(light.target.transform.position,
+ positionVector.MultMatrix(light.target.transform.position,
lightObject.light.target.parent.matrix);
positionVector.Subtract(positionVector, display.camera.cPosition);
}
}
else
{
-
+
Vector3Df vector { 0,0,-1 };
Vector3Df direction;
Matrix mat;
{
float pickX = display.display3D.pickX + surface.offset.x;
float pickY = display.height - (display.display3D.pickY + surface.offset.y) - 1;
- Matrix pickMatrix =
+ Matrix pickMatrix =
{
{
w / display.display3D.pickWidth, 0, 0, 0,
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
}
}
- {
+ {
float color[4] = { material.specular.r, material.specular.g, material.specular.b, 0 };
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color);
}
float color[4] = { material.emissive.r, material.emissive.g, material.emissive.b, 0 };
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, color);
}
-
+
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, &material.power);
}
{
OGLMesh oglMesh = mesh.data;
if(!flags) flags = mesh.flags;
-
+
if(vboAvailable)
{
if(!(flags.vertices) || oglMesh.vertices)
{
if(oglIndices)
{
- if(oglIndices.buffer)
+ if(oglIndices.buffer)
GLDeleteBuffers(1, &oglIndices.buffer);
delete oglIndices.indices;
delete oglIndices;
if(vboAvailable)
{
GLBindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, oglIndices.buffer);
- GLBufferData( indices32bit ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, GL_ELEMENT_ARRAY_BUFFER_ARB, nIndices * (indices32bit ? sizeof(uint32) : sizeof(uint16)),
+ GLBufferData( indices32bit ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, GL_ELEMENT_ARRAY_BUFFER_ARB, nIndices * (indices32bit ? sizeof(uint32) : sizeof(uint16)),
oglIndices.indices, GL_STATIC_DRAW_ARB);
GLBindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
uint16 * LockIndices(DisplaySystem displaySystem, OGLIndices oglIndices)
{
-
+
return oglIndices.indices;
}
//Logf("SelectMesh\n");
#if !defined( __ANDROID__) && !defined(__APPLE__)
- if(display.display3D.mesh && glUnlockArraysEXT)
+ if(display.display3D.mesh && glUnlockArraysEXT)
glUnlockArraysEXT();
#endif
if(mesh)
glDrawArrays(primitiveTypes[primitive->type.primitiveType], primitive->first, primitive->nVertices);
else
{
- // *** Hoping the data won't be uploaded at all (Won't really work if another group of the mesh is using the mesh ) ***
+ // *** Hoping the data won't be uploaded at all (Won't really work if another group of the mesh is using the mesh ) ***
// HACK TO SPEED THINGS UP...
#ifndef __ANDROID__
GLBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
if(!display.display3D.collectingHits && vboAvailable && oglIndices)
{
GLBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, oglIndices.buffer);
- glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
+ glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
primitive->type.indices32bit ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0);
GLBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
else
- glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
+ glDrawElements(primitiveTypes[primitive->type.primitiveType], primitive->nIndices,
primitive->type.indices32bit ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, oglIndices ? oglIndices.indices : primitive->indices);
}
}
~Win32BitmapPrinterDisplay()
{
if(memDC) DeleteDC(memDC);
- if(memBitmap) DeleteObject(memBitmap);
+ if(memBitmap) DeleteObject(memBitmap);
if(palette) DeleteObject(palette);
delete logPalette;
}
~Win32BitmapPrinterSystem()
{
- if(hdc)
+ if(hdc)
ReleaseDC(0, tmpDC);
}
};
static PixelFormat GetColorFormat(int depth)
{
- if(depth == 8)
+ if(depth == 8)
return pixelFormat8;
- else if(depth == 16)
+ else if(depth == 16)
return pixelFormat555;
- else
+ else
return pixelFormat888;
}
info->bmiHeader.biBitCount = (uint16)gdiSystem.depth;
info->bmiHeader.biWidth = gdiDisplay.bitmap.stride;
info->bmiHeader.biHeight = -gdiDisplay.height;
-
+
for(c=0; c<256; c++)
{
info->bmiColors[c].rgbReserved = 0;
{
Win32BitmapPrinterDisplay gdiDisplay = display.driverData;
/*
- BitBlt(gdiDisplay.hdc,
- updateBox.left,updateBox.top,
+ BitBlt(gdiDisplay.hdc,
+ updateBox.left,updateBox.top,
updateBox.right - updateBox.left + 1, updateBox.bottom - updateBox.top + 1,
gdiDisplay.memDC, updateBox.left, updateBox.top, SRCCOPY);
*/
Win32BitmapPrinterDisplay gdiDisplay = display.driverData;
gdiDisplay.completed = false;
EndPage(gdiDisplay.hdc);
- StartPage(gdiDisplay.hdc);
+ StartPage(gdiDisplay.hdc);
}
void FreeBitmap(DisplaySystem displaySystem, Bitmap bitmap)
surface.height = gdiDisplay.height - y + 1;
surface.offset.x = x * gdiDisplay.width / display.width;
surface.offset.y = y * gdiDisplay.height / display.height;
- surface.unclippedBox = surface.box =
+ surface.unclippedBox = surface.box =
{
left = clip.left * gdiDisplay.width / display.width,
top = clip.top * gdiDisplay.height / display.height,
right = (clip.right+1) * gdiDisplay.width / display.width-1,
bottom = (clip.bottom+1) * gdiDisplay.height / display.height-1
};
-
+
gdiSurface.rgn = CreateRectRgn(
surface.offset.x + surface.box.left,
surface.offset.y + surface.box.top,
{
Win32BitmapPrinterDisplay gdiDisplay = display.driverData;
Win32BitmapPrinterSurface gdiSurface = surface.driverData;
- HRGN clippedRgn = null;
+ HRGN clippedRgn = null;
if(clip != null)
{
Box box = clip;
box.Clip(gdiSurface.unclippedBox);
gdiSurface.box = box;
- surface.box =
+ surface.box =
{
left = box.left * gdiDisplay.width / display.width,
top = box.top * gdiDisplay.height / display.height,
}
else
clippedRgn = CreateRectRgn(0, 0, 0, 0);
-
+
if(clippedRgn)
SelectClipRgn(gdiSurface.hdc, clippedRgn);
}
Color back = surface.background;
surface.background = surface.foreground;
//SetPixel(gdiSurface.hdc, x + gdiSurface.offset.x, y + gdiSurface.offset.y, gdiSurface.color);
-
- ((subclass(DisplayDriver))class(LFBDisplayDriver)).Area(display, surface,
- (int)((float)x * gdiDisplay.width / display.width),
+
+ ((subclass(DisplayDriver))class(LFBDisplayDriver)).Area(display, surface,
+ (int)((float)x * gdiDisplay.width / display.width),
(int)((float)y * gdiDisplay.height / display.height),
- (int)((float)(x+1) * gdiDisplay.width / display.width)-1,
+ (int)((float)(x+1) * gdiDisplay.width / display.width)-1,
(int)((float)(y+1) * gdiDisplay.height / display.height)-1
);
surface.background = back;
MoveToEx(gdiSurface.hdc, x1, y1, null);
LineTo(gdiSurface.hdc, x2, y2);
*/
-
+
if(x1 == x2)
{
((subclass(DisplayDriver))class(LFBDisplayDriver)).DrawLine(display, surface, x1,y1,x2,y2+(int)((float)gdiDisplay.width / display.width + 0.5));
Win32BitmapPrinterSurface gdiSurface = surface.driverData;
Win32BitmapPrinterDisplay gdiDisplay = display ? display.driverData : null;
/*
- ((subclass(DisplayDriver))class(LFBDisplayDriver)).Rectangle(display, surface,
- ((float)x1 * gdiDisplay.width / display.width) + 0.5,
+ ((subclass(DisplayDriver))class(LFBDisplayDriver)).Rectangle(display, surface,
+ ((float)x1 * gdiDisplay.width / display.width) + 0.5,
((float)y1 * gdiDisplay.height / display.height) + 0.5,
((float)x2 * gdiDisplay.width / display.width) + 0.5,
((float)y2 * gdiDisplay.height / display.height) + 0.5);
{
Win32BitmapPrinterDisplay gdiDisplay = display ? display.driverData : null;
Win32BitmapPrinterSurface gdiSurface = surface.driverData;
-
- ((subclass(DisplayDriver))class(LFBDisplayDriver)).Area(display, surface,
- (int)((float)x1 * gdiDisplay.width / display.width),
+
+ ((subclass(DisplayDriver))class(LFBDisplayDriver)).Area(display, surface,
+ (int)((float)x1 * gdiDisplay.width / display.width),
(int)((float)y1 * gdiDisplay.height / display.height),
(int)(((float)(x2+1) * gdiDisplay.width / display.width) + 0.5),
(int)(((float)(y2+1) * gdiDisplay.height / display.height) + 0.5));
-
- /*
+
+ /*
x1 += gdiSurface.offset.x;
x2 += gdiSurface.offset.x;
y1 += gdiSurface.offset.y;
{
Win32BitmapPrinterDisplay gdiDisplay = display ? display.driverData : null;
((subclass(DisplayDriver))class(LFBDisplayDriver)).Filter(display, surface, src,
- dx * gdiDisplay.width / display.width,
+ dx * gdiDisplay.width / display.width,
dy * gdiDisplay.height / display.height,
sx, sy,
(w+1) * gdiDisplay.width / display.width-1,
// UNICODE FIX: proper space computation
if(width) *width = size.cx + (wordCount - realLen) * space.cx;
- if(height)
+ if(height)
{
if(realLen)
*height = size.cy;
{
if(((subclass(DisplayDriver))class(LFBDisplayDriver)).CreateDisplay(display))
{
-
+
conDisplay.bitmap.pixelFormat = pixelFormatText;
result = true;
}
if(y2>surface.box.bottom)y2=surface.box.bottom;
if(y2 < y1) return;
- lfbPtr = conDisplay.charInfo +
+ lfbPtr = conDisplay.charInfo +
(y1+surface.offset.y)*display.width / textCellW+x1+surface.offset.x;
for(y = y1; y <= y2; y++)
{
if(x2>surface.box.right)x2=surface.box.right;
if(x2 < x1) return;
- lfbPtr = conDisplay.charInfo +
+ lfbPtr = conDisplay.charInfo +
(y1+surface.offset.y)*display.width / textCellW+x1+surface.offset.x;
if(conSurface.opaqueText)
x /= textCellW;
y /= textCellH;
- if(y > surface.box.bottom || y < surface.box.top)
+ if(y > surface.box.bottom || y < surface.box.top)
return;
lfbPtr += (y+surface.offset.y) * display.width / textCellW + x + surface.offset.x;
for(c=0; (c<len && x < surface.box.left); c++, x++,lfbPtr++);
~Win32PrinterDisplay()
{
//if(memDC) DeleteDC(memDC);
- //if(memBitmap) DeleteObject(memBitmap);
+ //if(memBitmap) DeleteObject(memBitmap);
if(palette) DeleteObject(palette);
delete logPalette;
}
static PixelFormat GetColorFormat(int depth)
{
- if(depth == 8)
+ if(depth == 8)
return pixelFormat8;
- else if(depth == 16)
+ else if(depth == 16)
return pixelFormat555;
- else
+ else
return pixelFormat888;
}
Win32PrinterDisplay gdiDisplay = display.driverData;
gdiDisplay.completed = false;
EndPage(gdiDisplay.hdc);
- StartPage(gdiDisplay.hdc);
+ StartPage(gdiDisplay.hdc);
}
void FreeBitmap(DisplaySystem displaySystem, Bitmap bitmap)
SetBkColor(gdiSystem.bmpDC, RGB(0,0,0));
BitBlt(gdiSystem.bmpDC, 0, 0, bitmap.width, bitmap.height, gdiSystem.tmpDC, 0, 0, SRCAND);
SelectObject(gdiSystem.tmpDC, prevDC2);
- SelectObject(gdiSystem.bmpDC, prevDC);
+ SelectObject(gdiSystem.bmpDC, prevDC);
SetTextColor(gdiSystem.bmpDC, RGB(0,0,0));
SetBkColor(gdiSystem.bmpDC, RGB(255,255,255));
SetBkColor(gdiSystem.tmpDC, RGB(255,255,255));
{
gdiBitmap.bmp = CreateDIBitmap(gdiSystem.hdc, (LPBITMAPINFOHEADER)info, CBM_INIT, bitmap.picture, info, DIB_RGB_COLORS);
}
-
+
delete bitmap.picture;
delete info;
surface.height = gdiDisplay.height - y + 1;
surface.offset.x = x * gdiDisplay.width / display.width;
surface.offset.y = y * gdiDisplay.height / display.height;
- surface.unclippedBox = surface.box =
+ surface.unclippedBox = surface.box =
{
left = clip.left * gdiDisplay.width / display.width,
top = clip.top * gdiDisplay.height / display.height,
right = (clip.right+1) * gdiDisplay.width / display.width-1,
bottom = (clip.bottom+1) * gdiDisplay.height / display.height-1
};
-
+
gdiSurface.rgn = CreateRectRgn(
surface.offset.x + surface.box.left,
surface.offset.y + surface.box.top,
{
Win32PrinterDisplay gdiDisplay = display.driverData;
Win32PrinterSurface gdiSurface = surface.driverData;
- HRGN clippedRgn = null;
+ HRGN clippedRgn = null;
if(clip != null)
{
Box box = clip;
box.Clip(gdiSurface.unclippedBox);
gdiSurface.box = box;
- surface.box =
+ surface.box =
{
left = box.left * gdiDisplay.width / display.width,
top = box.top * gdiDisplay.height / display.height,
}
else
clippedRgn = CreateRectRgn(0, 0, 0, 0);
-
+
if(clippedRgn)
SelectClipRgn(gdiSurface.hdc, clippedRgn);
}
PatBlt(gdiSurface.hdc,
(int)((float)x * gdiDisplay.width / display.width) + surface.offset.x,
(int)((float)y * gdiDisplay.height / display.height) + surface.offset.y,
- (int)((float)(x+1) * gdiDisplay.width / display.width)-1 + surface.offset.x+1,
+ (int)((float)(x+1) * gdiDisplay.width / display.width)-1 + surface.offset.x+1,
(int)((float)(y+1) * gdiDisplay.height / display.height)-1 + surface.offset.y+1,
PATCOPY);
SetBkColor(gdiSurface.hdc, gdiSurface.backColor);
{
Win32PrinterDisplay gdiDisplay = display ? display.driverData : null;
Win32PrinterSurface gdiSurface = surface.driverData;
-
+
x1 = (int)((float)x1 * gdiDisplay.width / display.width) + surface.offset.x;
y1 = (int)((float)y1 * gdiDisplay.height / display.height) + surface.offset.y;
x2 = (int)(((float)(x2+1) * gdiDisplay.width / display.width) + 0.5) + surface.offset.x;
SelectObject(gdiSystem.tmpDC, gdiBitmap.mask);
SetStretchBltMode(gdiSurface.hdc, HALFTONE); //COLORONCOLOR);
-
+
SetBkColor(gdiSurface.hdc, 0xFFFFFF);
SetTextColor(gdiSurface.hdc, 0);
- StretchBlt(gdiSurface.hdc,
- dx * gdiDisplay.width / display.width + surface.offset.x,
+ StretchBlt(gdiSurface.hdc,
+ dx * gdiDisplay.width / display.width + surface.offset.x,
dy * gdiDisplay.height / display.height + surface.offset.y,
(w) * gdiDisplay.width / display.width,
(h) * gdiDisplay.height / display.height,
gdiSystem.tmpDC, sx, sy,sw,sh, SRCAND);
- StretchBlt(gdiSurface.hdc,
- dx * gdiDisplay.width / display.width + surface.offset.x,
+ StretchBlt(gdiSurface.hdc,
+ dx * gdiDisplay.width / display.width + surface.offset.x,
dy * gdiDisplay.height / display.height + surface.offset.y,
(w) * gdiDisplay.width / display.width,
(h) * gdiDisplay.height / display.height,
gdiSystem.bmpDC, sx, sy,sw,sh, SRCPAINT);
/*
- StretchBlt(gdiSurface.hdc,
- dx * gdiDisplay.width / display.width + surface.offset.x,
+ StretchBlt(gdiSurface.hdc,
+ dx * gdiDisplay.width / display.width + surface.offset.x,
dy * gdiDisplay.height / display.height + surface.offset.y,
(w+1) * gdiDisplay.width / display.width-1,
(h+1) * gdiDisplay.height / display.height-1,
gdiSystem.tmpDC, sx, sy,sw,sh, SRCAND);
- StretchBlt(gdiSurface.hdc,
- dx * gdiDisplay.width / display.width + surface.offset.x,
+ StretchBlt(gdiSurface.hdc,
+ dx * gdiDisplay.width / display.width + surface.offset.x,
dy * gdiDisplay.height / display.height + surface.offset.y,
(w+1) * gdiDisplay.width / display.width-1,
(h+1) * gdiDisplay.height / display.height-1,
{
SetStretchBltMode(gdiSurface.hdc, HALFTONE); //COLORONCOLOR);
SelectObject(gdiSystem.bmpDC, gdiBitmap.bmp);
- StretchBlt(gdiSurface.hdc,
- dx * gdiDisplay.width / display.width + surface.offset.x,
+ StretchBlt(gdiSurface.hdc,
+ dx * gdiDisplay.width / display.width + surface.offset.x,
dy * gdiDisplay.height / display.height + surface.offset.y,
(w+1) * gdiDisplay.width / display.width-1,
(h+1) * gdiDisplay.height / display.height-1,
*width = size.cx + (wordCount - realLen) * space.cx;
*width = *width * resX / GetDeviceCaps(hdc, HORZRES);
}
- if(height)
+ if(height)
{
if(realLen)
*height = size.cy;
*height = *height * resY / GetDeviceCaps(hdc, VERTRES);
}
}
-
+
void TextExtent(Display display, Surface surface, char * text, int len, int * width, int * height)
{
Win32PrinterDisplay gdiDisplay = display ? display.driverData : null;
break;
case pixelFormat888:
format = XRenderFindStandardFormat(xGlobalDisplay, alphaBlend ? PictStandardARGB32 : PictStandardRGB24);
- // printf("R: %d G: %d B: %d\n", format->direct.red, format->direct.green, format->direct.blue);
+ // printf("R: %d G: %d B: %d\n", format->direct.red, format->direct.green, format->direct.blue);
break;
case pixelFormat555:
{
XRenderPictFormat info = { 0 };
-
+
info.depth = 16;
info.type = PictTypeDirect;
info.direct.red = 10;
info.direct.redMask = 0x1F;
info.direct.greenMask = 0x1F;
info.direct.blueMask = 0x1F;
-
+
format = XRenderFindFormat(xGlobalDisplay,
/*PictFormatDepth|*/PictFormatType| PictFormatAlpha|PictFormatRed|PictFormatGreen|PictFormatBlue|
PictFormatRedMask|PictFormatGreenMask|PictFormatBlueMask|PictFormatAlphaMask, &info, 0);
info.direct.blueMask = 0x1F;
info.direct.alphaMask = 0;
info.id = 0xba;
-
- format = XRenderFindFormat(xGlobalDisplay,
+
+ format = XRenderFindFormat(xGlobalDisplay,
/*PictFormatDepth|*/PictFormatType|PictFormatAlpha|PictFormatRed|PictFormatGreen|PictFormatBlue|
PictFormatRedMask|PictFormatGreenMask|PictFormatBlueMask|PictFormatAlphaMask, &info, 0);
break;
{
*w = Abs(*w);
*sw = Abs(*sw);
- *flip = true;
+ *flip = true;
}
s2dw=(float)*w / *sw;
XImage image = {0};
GC maskGC = XCreateGC(xGlobalDisplay, mask, 0, null);
uint wordWidth = (bitmap.width+31) >> 5;
-
+
uint x,y;
uint32 *b = new0 uint32[wordWidth * bitmap.height];
uint32 f = 1;
-
+
XSetGraphicsExposures(xGlobalDisplay, maskGC, False);
-
+
image.width = bitmap.width;
image.height = bitmap.height;
-
+
image.format = XYBitmap;
#ifdef __BIG_ENDIAN__
image.byte_order = MSBFirst;
image.bitmap_pad = 32;
image.depth = 1;
image.bytes_per_line = wordWidth << 2;
-
+
image.data = (char*)b;
-
+
XInitImage(&image);
-
+
switch(bitmap.pixelFormat) {
case pixelFormat4: {
-
+
} break;
case pixelFormat8: {
byte *p = (byte*)bitmap.picture;
-
+
for(y = 0; y<bitmap.height; y++, p+=bitmap.stride) {
for(x = 0; x<bitmap.width; x++) {
if(p[x])
}
} break;
case pixelFormatAlpha: {
-
+
} break;
case pixelFormatText: {
-
+
} break;
case pixelFormatRGBA: {
-
+
} break;
}
-
+
XSetForeground(xGlobalDisplay, maskGC, 1);
XSetBackground(xGlobalDisplay, maskGC, 0);
-
+
XPutImage(xGlobalDisplay, mask, maskGC, &image,
0, 0, 0, 0, //coordinates
bitmap.width, bitmap.height);
-
+
XFreeGC(xGlobalDisplay, maskGC);
delete image.data;
}
if(xDisplay.shminfoShape.shmaddr != (void *)-1)
shmdt(xDisplay.shminfoShape.shmaddr);
shmctl(xDisplay.shminfoShape.shmid, IPC_RMID, 0);
- }
+ }
XDestroyImage(xDisplay.shapeImage);
xDisplay.shapeImage = None;
}
if(xDisplay.shminfoShape.shmaddr != (void *)-1)
shmdt(xDisplay.shminfoShape.shmaddr);
shmctl(xDisplay.shminfoShape.shmid, IPC_RMID, 0);
- }
+ }
XDestroyImage(xDisplay.shapeImage);
xDisplay.shapeImage = None;
}
if(xDisplay.shminfo.shmaddr != (void *)-1)
shmdt(xDisplay.shminfo.shmaddr);
shmctl(xDisplay.shminfo.shmid, IPC_RMID, 0);
- }
+ }
XDestroyImage(xDisplay.image);
xDisplay.image = None;
}
if(xDisplay.shminfoShape.shmaddr != (void *)-1)
shmdt(xDisplay.shminfoShape.shmaddr);
shmctl(xDisplay.shminfoShape.shmid, IPC_RMID, 0);
- }
+ }
XDestroyImage(xDisplay.shapeImage);
xDisplay.shapeImage = None;
}
//bitmap.Convert(null, pixelFormatRGBA, null);
//bitmap.Convert(null, pixelFormat888, null);
- xBitmap.pixmap =
- XCreatePixmap(xGlobalDisplay, confineWindow /*(X11Window)display.window*/, bitmap.width, bitmap.height,
+ xBitmap.pixmap =
+ XCreatePixmap(xGlobalDisplay, confineWindow /*(X11Window)display.window*/, bitmap.width, bitmap.height,
(bitmap.pixelFormat == pixelFormatAlpha) ? 8 : (bitmap.alphaBlend ? 32 : ((bitmap.pixelFormat == pixelFormat888) ? 24 : xSystemDepth)));
if(bitmap.transparent)
- xBitmap.mask =
+ xBitmap.mask =
XCreatePixmap(xGlobalDisplay, confineWindow /*(X11Window)display.window*/, bitmap.width, bitmap.height, 1);
{
image.width = bitmap.width;
image.height = bitmap.height;
-
+
if(bitmap.pixelFormat == pixelFormatAlpha)
{
image.depth = 8;
image.green_mask = 0x7E0;
image.blue_mask = 0x1F;
*/
-
+
/*
image.red_mask = 0x0000FF;
image.green_mask = 0x00FF00;
}
}
- XPutImage(xGlobalDisplay, (Pixmap)xBitmap.pixmap, gc, &image,
+ XPutImage(xGlobalDisplay, (Pixmap)xBitmap.pixmap, gc, &image,
0, 0, 0, 0, bitmap.width,bitmap.height);
if(bitmap.transparent && !bitmap.alphaBlend && bitmap.pixelFormat != pixelFormatAlpha)
PutBitmapMask(xBitmap.mask, bitmap);
-
+
XFreeGC(xGlobalDisplay, gc);
if(!bitmap.keepData)
surface.unclippedBox = surface.box = clip;
xSurface.pixmap = xBitmap.pixmap;
-
+
result = true;
}
return result;
}
if(changed)
{
- XRectangle rectangle =
+ XRectangle rectangle =
{
(short)(surface.box.left + surface.offset.x),
(short)(surface.box.top + surface.offset.y),
(short)(surface.box.right - surface.box.left + 1),
(short)(surface.box.bottom - surface.box.top + 1)
};
- XSetClipRectangles(xGlobalDisplay, xDisplay.gc,
+ XSetClipRectangles(xGlobalDisplay, xDisplay.gc,
0,0, &rectangle, 1, YXBanded);
}
}
if(display)
xImage = XGetImage(xGlobalDisplay, xDisplay.pixmap, sx, sy, sw, sh, MAXDWORD, ZPixmap);
- else
+ else
xImage = XGetImage(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay), sx, sy, sw, sh, MAXDWORD, ZPixmap);
source.pixelFormat = format;
// xSurface.foreground = ARGB(A(color),B(color),G(color),R(color));
xSurface.foreground = color;
- XSetForeground(xGlobalDisplay, xDisplay.gc, (xSystemPixelFormat == pixelFormat888) ? xSurface.foreground :
+ XSetForeground(xGlobalDisplay, xDisplay.gc, (xSystemPixelFormat == pixelFormat888) ? xSurface.foreground :
((xSystemPixelFormat == pixelFormat565) ? ((Color565)xSurface.foreground) : ((Color555)xSurface.foreground)));
}
// xSurface.background = ARGB(A(color),B(color),G(color),R(color));
xSurface.background = color;
- XSetBackground(xGlobalDisplay, xDisplay.gc, (xSystemPixelFormat == pixelFormat888) ? xSurface.background :
+ XSetBackground(xGlobalDisplay, xDisplay.gc, (xSystemPixelFormat == pixelFormat888) ? xSurface.background :
((xSystemPixelFormat == pixelFormat565) ? ((Color565)xSurface.background) : ((Color555)xSurface.background)));
}
ColorAlpha GetPixel(Display display, Surface surface, int x, int y)
- {
+ {
return 0;
}
traps[1] = trap2;
traps[2] = trap3;
nTraps = 3;
- }
+ }
}
else
{
traps[1] = trap2;
traps[2] = trap3;
nTraps = 3;
- }
+ }
}
/*
printf("Line: (%d, %d)-(%d, %d)\n", x1,y1, x2,y2);
printf("Line: A = (%.2f, %.2f), B = (%.2f, %.2f), C = (%.2f, %.2f)\n", A.x,A.y, B.x,B.y, C.x,C.y);
printf("Line: D = (%.2f, %.2f), E = (%.2f, %.2f), F = (%.2f, %.2f)\n", D.x,D.y, E.x,E.y, F.x,F.y);
- printf("Trap1: top = %.2f, bottom = %.2f, left = (%.2f, %.2f)-(%.2f, %.2f), right = (%.2f, %.2f)-(%.2f, %.2f)\n",
+ printf("Trap1: top = %.2f, bottom = %.2f, left = (%.2f, %.2f)-(%.2f, %.2f), right = (%.2f, %.2f)-(%.2f, %.2f)\n",
traps[0].top / 65536.0, traps[0].bottom / 65536.0,
traps[0].left.p1.x / 65536.0, traps[0].left.p1.y / 65536.0, traps[0].left.p2.x / 65536.0, traps[0].left.p2.y / 65536.0,
traps[0].right.p1.x / 65536.0, traps[0].right.p1.y / 65536.0, traps[0].right.p2.x / 65536.0, traps[0].right.p2.y / 65536.0);
- printf("Trap2: top = %.2f, bottom = %.2f, left = (%.2f, %.2f)-(%.2f, %.2f), right = (%.2f, %.2f)-(%.2f, %.2f)\n",
+ printf("Trap2: top = %.2f, bottom = %.2f, left = (%.2f, %.2f)-(%.2f, %.2f), right = (%.2f, %.2f)-(%.2f, %.2f)\n",
traps[1].top / 65536.0, traps[1].bottom / 65536.0,
traps[1].left.p1.x / 65536.0, traps[1].left.p1.y / 65536.0, traps[1].left.p2.x / 65536.0, traps[1].left.p2.y / 65536.0,
traps[1].right.p1.x / 65536.0, traps[1].right.p1.y / 65536.0, traps[1].right.p2.x / 65536.0, traps[1].right.p2.y / 65536.0);
- printf("Trap3: top = %.2f, bottom = %.2f, left = (%.2f, %.2f)-(%.2f, %.2f), right = (%.2f, %.2f)-(%.2f, %.2f)\n",
+ printf("Trap3: top = %.2f, bottom = %.2f, left = (%.2f, %.2f)-(%.2f, %.2f), right = (%.2f, %.2f)-(%.2f, %.2f)\n",
traps[2].top / 65536.0, traps[2].bottom / 65536.0,
traps[2].left.p1.x / 65536.0, traps[2].left.p1.y / 65536.0, traps[2].left.p2.x / 65536.0, traps[2].left.p2.y / 65536.0,
traps[2].right.p1.x / 65536.0, traps[2].right.p1.y / 65536.0, traps[2].right.p2.x / 65536.0, traps[2].right.p2.y / 65536.0);
{
XDisplay xDisplay = display.driverData;
XSurface xSurface = surface.driverData;
-
+
if(xSurface.foreground.a < 255)
{
DrawLine(display, surface,x1,y1,x2-1,y1);
}
else
{
- XSetForeground(xGlobalDisplay, xDisplay.gc, (xSystemPixelFormat == pixelFormat888) ? xSurface.background :
+ XSetForeground(xGlobalDisplay, xDisplay.gc, (xSystemPixelFormat == pixelFormat888) ? xSurface.background :
((xSystemPixelFormat == pixelFormat565) ? ((Color565)xSurface.background) : ((Color555)xSurface.background)));
XFillRectangle(xGlobalDisplay, (Pixmap) xDisplay.pixmap, xDisplay.gc,
x1 + surface.offset.x,
y1 + surface.offset.y,
x2 - x1 + 1, y2 - y1 + 1);
- XSetForeground(xGlobalDisplay, xDisplay.gc, (xSystemPixelFormat == pixelFormat888) ? xSurface.foreground :
+ XSetForeground(xGlobalDisplay, xDisplay.gc, (xSystemPixelFormat == pixelFormat888) ? xSurface.foreground :
((xSystemPixelFormat == pixelFormat565) ? ((Color565)xSurface.foreground) : ((Color555)xSurface.foreground)));
}
}
-
+
void Clear(Display display, Surface surface, ClearType flags)
{
if(flags != depthBuffer)
}
else
Area(display, surface,surface.box.left,surface.box.top,surface.box.right,surface.box.bottom);
- }
+ }
}
bool ConvertBitmap(DisplaySystem displaySystem, Bitmap src, PixelFormat format, ColorAlpha * palette)
}
}
- bitmap.stride = stride;
+ bitmap.stride = stride;
bitmap.width = width;
bitmap.height = height;
bitmap.size = (uint)stride * (uint)height;
}
if(xSurface.xOffset)
{
- XTransform transform =
+ XTransform transform =
{
{
{ (int)(1.0f * (1<<16)), (int)(0.0f * (1<<16)), -(xSurface.xOffset << 10) },
}
};
// printf("XOffset: %d\n", xSurface.xOffset);
- XRenderSetPictureTransform(xGlobalDisplay, xBitmap.picture, &transform);
+ XRenderSetPictureTransform(xGlobalDisplay, xBitmap.picture, &transform);
}
if(src.alphaBlend || display.alphaBlend)
XRenderComposite(xGlobalDisplay, PictOpOver, xBitmap.picture, xBitmap.maskPicture, xSurface.picture, sx, sy, sx, sy, dx, dy, w, h);
}
else
- XCopyArea(xGlobalDisplay, (Pixmap)xBitmap.pixmap, (Pixmap)xSurface.pixmap, xDisplay.gc,
+ XCopyArea(xGlobalDisplay, (Pixmap)xBitmap.pixmap, (Pixmap)xSurface.pixmap, xDisplay.gc,
sx, sy, w, h, dx, dy);
if(xSurface.xOffset)
XBitmap xBitmap = src.driverData;
if(xBitmap)
{
- XTransform transform =
+ XTransform transform =
{
{
{ (int)((float)sw / w * (1<<16)), (int)(0.0f * (1<<16)), (int)(0.0f * (1<<16)) },
image.data = src.picture;
XInitImage(&image);
- XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
+ XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
sx, sy, dx + surface.offset.x, dy + surface.offset.y, w,h);
}
else
if(!src.transparent)
{
// printf("Stride: %d, dx: %d, dy: %d, w: %d, h: %d, %d\n", temp.stride, dx + surface.offset.x, dy + surface.offset.y, w,h, xSystemDepth);
- XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
+ XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
0, 0, dx + surface.offset.x, dy + surface.offset.y, w,h);
}
else
}
}
}
-
+
XFreeGC(xGlobalDisplay, maskGC);
#else
GC gc = 0;
XSetGraphicsExposures(xGlobalDisplay, gc, False);
XPutImage(xGlobalDisplay, pixmap, gc, &image, 0, 0, 0, 0, w,h);
-
+
PutBitmapMask(mask, temp);
#endif
image.data = temp.picture;
XInitImage(&image);
-
+
// printf("Blitting DI\n");
- XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
+ XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
0, 0, dx + surface.offset.x, dy + surface.offset.y, w,h);
delete s;
image.data = temp.picture;
XInitImage(&image);
-
+
// printf("Blitting DI\n");
- XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
+ XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
0, 0, dx + surface.offset.x, dy + surface.offset.y, w,h);
delete s;
XSurface xSurface = surface.driverData;
XDisplay xDisplay = display.driverData;
int tw, th;
-
+
((subclass(DisplayDriver))class(LFBDisplayDriver)).TextExtent(display, surface, text, len, &tw, &th);
if(xSurface.opaque)
{
(uint16)xSurface.background.a
};
//printf("Filling rectangle\n");
- XRenderFillRectangle(xGlobalDisplay, PictOpSrc /*PictOpOver*/, xSurface.picture, &renderColor,
+ XRenderFillRectangle(xGlobalDisplay, PictOpSrc /*PictOpOver*/, xSurface.picture, &renderColor,
x + surface.offset.x, y + surface.offset.y, tw, th);
}
/*
- XDrawString(xGlobalDisplay, (Pixmap)xDisplay.pixmap, xDisplay.gc,
+ XDrawString(xGlobalDisplay, (Pixmap)xDisplay.pixmap, xDisplay.gc,
x + surface.offset.x, y + surface.offset.y + 12, text, len);
*/
XSetClipRectangles(xGlobalDisplay, xDisplay.gc, 0,0, &rectangle, 1, YXBanded);
}
/*if(display.alphaBlend)
- XRenderComposite(xGlobalDisplay, PictOpSrc, xDisplay.picture, None, xDisplay.windowPicture, box->left, box->top, 0, 0, box->left, box->top,
+ XRenderComposite(xGlobalDisplay, PictOpSrc, xDisplay.picture, None, xDisplay.windowPicture, box->left, box->top, 0, 0, box->left, box->top,
box->right - box->left + 1, box->bottom - box->top + 1);
else*/
- XCopyArea(xGlobalDisplay, (Pixmap)xDisplay.pixmap, (X11Window)display.window, xDisplay.gc /*windowGC*/,
- box->left, box->top,
- box->right - box->left + 1,
+ XCopyArea(xGlobalDisplay, (Pixmap)xDisplay.pixmap, (X11Window)display.window, xDisplay.gc /*windowGC*/,
+ box->left, box->top,
+ box->right - box->left + 1,
box->bottom - box->top + 1,
box->left, box->top);
if(display.alphaBlend)
{
Box * box = &xDisplay.updateBox;
- XRenderComposite(xGlobalDisplay, PictOpSrc, xDisplay.picture, None, xDisplay.shapePicture, box->left, box->top, 0, 0, box->left, box->top,
+ XRenderComposite(xGlobalDisplay, PictOpSrc, xDisplay.picture, None, xDisplay.shapePicture, box->left, box->top, 0, 0, box->left, box->top,
box->right - box->left + 1, box->bottom - box->top + 1);
#if !defined(__APPLE__) && !defined(__OLDX__)
XShapeCombineMask(xGlobalDisplay, (X11Window)display.window, ShapeInput, 0, 0, xDisplay.shapePixmap, ShapeSet);
init \
for(y=0; y<h; y++) { xloop; source+=addsource; dest+=adddest; } \
}
-
+
#define BLIT_INIT_DEC \
int x; \
dest += w-1; \
int x; \
adddest -= w; \
addsource -= w;
-
+
#define FLIP(copy) for(x=0; x<w; x++) { copy source++; dest--; }
#define NOFLIP(copy) for(x=0; x<w; x++) { copy source++; dest++; }
#define TRANSPUT(result) if(*source) *dest=(result);
static void BLIT_BRGBA(Bitmap src, Bitmap dst, int dx, int dy, int sx, int sy, int w, int h)
{
- int y;
- uint32 adddest = dst.stride, addsource = src.stride;
- byte * source = (byte *) src.picture + sy * addsource + sx;
- ColorRGBA * dest = (ColorRGBA *) dst.picture + dy * adddest + dx;
+ int y;
+ uint32 adddest = dst.stride, addsource = src.stride;
+ byte * source = (byte *) src.picture + sy * addsource + sx;
+ ColorRGBA * dest = (ColorRGBA *) dst.picture + dy * adddest + dx;
ColorAlpha * palette = src.palette;
- int x;
- adddest -= w;
+ int x;
+ adddest -= w;
addsource -= w;
- for(y=0; y<h; y++)
- {
- for(x=0; x<w; x++)
- {
+ for(y=0; y<h; y++)
+ {
+ for(x=0; x<w; x++)
+ {
ColorAlpha value = palette[*source];
ColorRGBA color = (ColorRGBA)(value);
*dest=color;
- source++;
- dest++;
+ source++;
+ dest++;
}
- source+=addsource;
- dest+=adddest;
+ source+=addsource;
+ dest+=adddest;
}
}
BLIT(BRGBAT, byte, ColorRGBA,PALINIT BLIT_INIT_INC, NOFLIP(TRANSPUT((ColorRGBA)(palette[*source]))))
BLIT(BRGBATF,byte, ColorRGBA,PALINIT BLIT_INIT_DEC, FLIP(TRANSPUT((ColorRGBA)(palette[*source]))))
-void (* blits_8bit_table[PixelFormat][2][2]) (BLIT_ARGS) =
+void (* blits_8bit_table[PixelFormat][2][2]) (BLIT_ARGS) =
{
{ { null, null }, { null, null } },
{ { BLIT_B8, BLIT_B8F }, { BLIT_B8T, BLIT_B8TF } },
BLIT(BIRGBA, byte, ColorRGBA, PALSHADEINIT PALINIT BLIT_INIT_INC, NOFLIP(TRANSPUT((ColorRGBA)(palette[SHADESRC]))))
BLIT(BIRGBAF,byte, ColorRGBA, PALSHADEINIT PALINIT BLIT_INIT_DEC, FLIP(TRANSPUT((ColorRGBA)(palette[SHADESRC]))))
-void (* shades_blit_table[PixelFormat][2]) (BLIT_ARGS) =
+void (* shades_blit_table[PixelFormat][2]) (BLIT_ARGS) =
{
{ null, null },
{ BLIT_BI8, BLIT_BI8F },
FILTER(AF, byte, byte,-1, 1, color, (byte)color)
void (* filters_table[PixelFormat][2][2]) (FILTER_ARGS) =
-{
+{
{ { null, null }, { null, null} },
{ { FILTER_8, FILTER_8F }, { FILTER_8T, FILTER_8TF } },
{ { FILTER_444, FILTER_444F }, { FILTER_444T, FILTER_444TF } },
{
if(lfbSystem && lfbSystem.palette == dst.palette)
CONVERT(
- pixel ?
- ( (pixel = lfbSystem.rgbLookup[(uint16)(Color555)(src.palette[pixel])]) ?
+ pixel ?
+ ( (pixel = lfbSystem.rgbLookup[(uint16)(Color555)(src.palette[pixel])]) ?
pixel
- :
- lfbSystem.rgbLookup[0x421])
- :
+ :
+ lfbSystem.rgbLookup[0x421])
+ :
0,
byte,byte)
else
{
if(lfbSystem && lfbSystem.palette == dst.palette)
CONVERT(
- pixel ?
- ( (pixel = lfbSystem.rgbLookup[(uint16)(Color555)(pixel)]) ?
- pixel
- :
- lfbSystem.rgbLookup[0x421])
+ pixel ?
+ ( (pixel = lfbSystem.rgbLookup[(uint16)(Color555)(pixel)]) ?
+ pixel
+ :
+ lfbSystem.rgbLookup[0x421])
:
0,
Color444, byte)
{
if(lfbSystem && lfbSystem.palette == dst.palette)
CONVERT(
- pixel ?
- ( (pixel = lfbSystem.rgbLookup[pixel]) ?
- pixel
- :
- lfbSystem.rgbLookup[0x421])
+ pixel ?
+ ( (pixel = lfbSystem.rgbLookup[pixel]) ?
+ pixel
+ :
+ lfbSystem.rgbLookup[0x421])
:
0,
Color555, byte)
{
if(lfbSystem && lfbSystem.palette == dst.palette)
CONVERT(
- pixel ?
- ( (pixel = lfbSystem.rgbLookup[(uint16)(Color555)(pixel)]) ?
- pixel
- :
- lfbSystem.rgbLookup[0x421])
+ pixel ?
+ ( (pixel = lfbSystem.rgbLookup[(uint16)(Color555)(pixel)]) ?
+ pixel
+ :
+ lfbSystem.rgbLookup[0x421])
:
0,
Color565, byte)
{
if(lfbSystem && lfbSystem.palette == dst.palette)
CONVERT(
- (pixel & 0xFFFFFF) ?
- ( (pixel = lfbSystem.rgbLookup[(Color555)(pixel)]) ?
- pixel
- :
- lfbSystem.rgbLookup[0x421])
+ (pixel & 0xFFFFFF) ?
+ ( (pixel = lfbSystem.rgbLookup[(Color555)(pixel)]) ?
+ pixel
+ :
+ lfbSystem.rgbLookup[0x421])
:
0,
ColorAlpha,byte)
{
if(lfbSystem && lfbSystem.palette == dst.palette)
CONVERT(
- //(pixel & 0xFF000000) ?
- (pixel.a) ?
- ( (pixel = lfbSystem.rgbLookup[(uint16)(Color555)(pixel)]) ?
+ //(pixel & 0xFF000000) ?
+ (pixel.a) ?
+ ( (pixel = lfbSystem.rgbLookup[(uint16)(Color555)(pixel)]) ?
pixel
- :
- lfbSystem.rgbLookup[0x421])
+ :
+ lfbSystem.rgbLookup[0x421])
:
0,
ColorRGBA, byte)
else
{
- //CONVERT((pixel & 0xFF000000) ?
- CONVERT((pixel.a > 192) ?
+ //CONVERT((pixel & 0xFF000000) ?
+ CONVERT((pixel.a > 192) ?
(BestColorMatch(dst.palette,1,255, (ColorAlpha)(pixel))) : 0, ColorRGBA, byte)
}
}
union
{
int distance;
- float percent;
+ float percent;
};
property int
{
c = strlen(stringOutput)-1;
for( ; c >= 0; c--)
{
- if(stringOutput[c] != '0')
+ if(stringOutput[c] != '0')
last = Max(last, c);
if(stringOutput[c] == '.')
{
if(strchr(stringOutput, '.'))
{
float percent = (float)strtod(stringOutput, &end);
-
+
if(end != stringOutput)
{
this.percent = percent;
union
{
int distance;
- float percent;
+ float percent;
};
property int
{
c = strlen(stringOutput)-1;
for( ; c >= 0; c--)
{
- if(stringOutput[c] != '0')
+ if(stringOutput[c] != '0')
last = Max(last, c);
if(stringOutput[c] == '.')
{
{
union { AnchorValue left; MiddleAnchorValue horz; };
union { AnchorValue top; MiddleAnchorValue vert; };
- AnchorValue right, bottom;
+ AnchorValue right, bottom;
char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
tempString[0] = '\0';
anchorValue = left.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "left = "); strcat(stringOutput, anchorValue); }
-
+
//if(((!left.type && !right.type) && horz.distance) || horz.type == middleRelative)
if(!right.type && ((!left.type && horz.distance) || horz.type == middleRelative))
{
anchorValue = horz.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "horz = "); strcat(stringOutput, anchorValue); }
}
-
+
tempString[0] = '\0';
anchorValue = top.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "top = "); strcat(stringOutput, anchorValue); }
-
+
tempString[0] = '\0';
anchorValue = right.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "right = "); strcat(stringOutput, anchorValue); }
anchorValue = vert.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "vert = "); strcat(stringOutput, anchorValue); }
}
-
+
tempString[0] = '\0';
anchorValue = bottom.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "bottom = "); strcat(stringOutput, anchorValue); }
-
+
return stringOutput;
}
control = control;
borderStyle = 0;
};
-
+
comboBox.Create();
{
{
int cw = clientSize.w;
int ch = clientSize.h;
-
+
if(checked)
{
surface.SetForeground(black);
//anchor.horz.type = anchor.horz.distance ? offset : none;
}
else if(anchor.horz.type == middleRelative) anchor.horz.percent = (float) ((x + w / 2) - (vpw / 2)) / vpw;
- if(!anchor.top.type && !anchor.bottom.type)
+ if(!anchor.top.type && !anchor.bottom.type)
{
anchor.vert.distance = (y + h / 2) - (vph / 2);
//anchor.vert.type = anchor.vert.distance ? offset : none;
};
for(c = 0; c<4; c++)
{
- Button button = buttons[c] = AnchorButton
- {
+ Button button = buttons[c] = AnchorButton
+ {
anchorEditor, id = c,
size = Size { (c%2)?10:28, (c%2)?28:10 }
};
case 0:
if(anchorValue.left.type && anchorValue.left.type != middleRelative) button.checked = true;
if(anchorValue.left.type == relative || anchorValue.horz.type == middleRelative) relButton.checked = true;
-
+
button.anchor = Anchor { left = 0 };
relButton.anchor = Anchor { left = 5, vert = 16 };
break;
button.anchor = Anchor { top = 0 };
relButton.anchor = Anchor { top = 5, horz = 16 };
break;
- case 2:
+ case 2:
if(anchorValue.right.type && anchorValue.right.type != middleRelative) button.checked = true;
if(anchorValue.right.type == relative || anchorValue.horz.type == middleRelative) relButton.checked = true;
-
+
button.anchor = Anchor { right = 0 };
relButton.anchor = Anchor { right = 5, vert = 16 };
break;
- case 3:
+ case 3:
if(anchorValue.bottom.type && anchorValue.bottom.type != middleRelative) button.checked = true;
if(anchorValue.bottom.type == relative || anchorValue.vert.type == middleRelative) relButton.checked = true;
anchorEditor.Create();
return anchorEditor;
}
-
+
void OnCloseDropDown(Window anchorEditor)
{
// TOFIX: Patch for update bug
for(child = window.children.first; child; child = child.next)
{
if(!Window3D_Setup(child, false))
- result = false;
+ result = false;
}
return result;
}
}
}
}
-
+
// Comment out fullScreen check here and dirty = true up there for ITV update
if(/*!fullScreenWindow && */(virtualDesktopDirty || virtualDesktop.dirty))
{
if(virtualDesktopDirty)
- virtualDesktop.Update(null);
+ virtualDesktop.Update(null);
virtualDesktop.UpdateDisplay();
virtualDesktopDirty = false;
}
}
}
-public void Desktop3DInitialize(Window window,
+public void Desktop3DInitialize(Window window,
void * (* setup)(Window window, int w, int h),
void (* update)(Window window, Box box))
{
if(form)
form.visible = true;
}
-
+
selected = control;
Update(null);
//activeDesigner.Update(null);
else
{
// instance.parent = _class;
- }
+ }
}
void ::PostCreateObject(Window instance, ObjectInfo object, bool isClass, Window _class)
void ::FixProperty(Property prop, Window object)
{
FormDesigner designer = (FormDesigner)activeDesigner.classDesigner;
-
+
if(!strcmp(prop.name, "parent"))
{
if(object.parent == guiApp.desktop)
object.parent = designer.form;
if(object.parent == designer.form)
- {
+ {
ObjectInfo previous = object.object;
while((previous = previous.prev) && ((Window)previous.instance).parent != designer.form);
if(previous)
object.parent.children.Move(object, (Window)previous.instance);
}
}
-
+
if(!strcmp(prop.name, "master") && !object.master)
object.master = designer.form;
editBox.Printf("import \"ecere\"\n\n");
editBox.Printf("class %s : %s\n", name, inherit);
editBox.Printf("{\n");
-
+
editBox.Printf(" caption = \"%s\";\n", name);
//editBox.Printf(" background = Color { 212, 208, 200 };\n");
-
+
editBox.Printf(" background = formColor;\n");
editBox.Printf(" borderStyle = sizable;\n");
editBox.Printf(" hasMaximize = true;\n");
editBox.Printf(" hasClose = true;\n");
//editBox.Printf(" position = { 20, 20 };\n");
editBox.Printf(" clientSize = { %d, %d };\n", w, h);
-
-
+
+
//editBox.Printf(" Button ok { parent = this, position = { 100, 100 }, size = { 80, 20 } };\n");
//editBox.Printf("\n Button ok\n {\n parent = this;\n\n bool NotifyClicked()\n {\n }\n };\n");
int h = moved.size.h;
Box box;
Anchor anchor = moved.anchor;
-
+
x = xBefore + parentBefore.absPosition.x - curParent.absPosition.x + parentBefore.clientStart.x - curParent.clientStart.x;
y = yBefore + parentBefore.absPosition.y - curParent.absPosition.y + parentBefore.clientStart.y - curParent.clientStart.y;
}
else if(resizeX > 0)
{
- w += dx;
+ w += dx;
}
-
+
if(resizeY < 0)
{
y += dy;
{
h += dy;
}
- if(resizeX)
+ if(resizeX)
{
w = Max(w, GridSnap);
moved.size.w = w;
}
- if(resizeY)
+ if(resizeY)
{
h = Max(h, GridSnap);
moved.size.h = h;
moved.parent = parent;
if(parent == form)
- {
+ {
ObjectInfo previous = moved.object;
while((previous = previous.prev) && ((Window)previous.instance).parent != form);
if(previous)
x -= x % GridSnap;
y -= y % GridSnap;
}
-
+
activeDesigner.ModifyCode();
moved.Move(x, y, w, h);
{
int vpw, vph;
-
+
// Fix Anchor
x = moved.position.x;
y = moved.position.y;
//anchor.horz.type = anchor.horz.distance ? offset : 0;
}
else if(anchor.horz.type == middleRelative) anchor.horz.percent = (float) ((x + w / 2) - (vpw / 2)) / vpw;
- if(!anchor.top.type && !anchor.bottom.type)
+ if(!anchor.top.type && !anchor.bottom.type)
{
anchor.vert.distance = (y + h / 2) - (vph / 2);
//anchor.vert.type = anchor.vert.distance ? offset : 0;
box.top -= 7;
box.right += 7;
box.bottom += 7;
-
+
Update(box);
//activeDesigner.Update(box);
((control == form) ? (Window)this : form).SetMouseRangeToWindow();
else
((control == form) ? (Window)this : form).SetMouseRangeToClient();
-
+
xClicked = x;
yClicked = y;
activeDesigner.CodeAddObject(control, &object);
- while(!parent.name)
+ while(!parent.name)
{
x += parent.position.x + parent.clientStart.x;
y += parent.position.y + parent.clientStart.y;
control.Create();
if(parent == form)
- {
+ {
ObjectInfo previous = control.object;
while((previous = previous.prev) && ((Window)previous.instance).parent != form);
if(previous)
window.OnSysKeyDown = ecere::gui::OnSysKey;
window.OnSysKeyHit = ecere::gui::OnSysKey;
window.OnSysKeyUp = ecere::gui::OnSysKey;
-
+
if(object != object.oClass)
{
window.OnActivate = Control_OnActivate;
if(!confirmation)
{
activeDesigner.ModifyCode();
-
+
designer.selected.Destroy(0);
//activeDesigner.Update(null);
designer.Update(null);
char appName[1024];
uint timerResolution;
- Size virtualScreen;
+ Size virtualScreen;
Point virtualScreenPos;
int64 mainThread;
GuiApplication()
{
SystemCursor c;
-
+
mainThread = GetCurrentThreadID();
if(!guiApp)
guiApp = this;
bool IsModeSwitching()
{
return modeSwitching;
- }
+ }
public bool SetDesktopPosition(int x, int y, int w, int h, bool moveChildren)
{
{
child.x = desktop.x;
child.y = desktop.y;
- child.ComputeAnchors(,
- A_LEFT,A_LEFT,A_OFFSET,A_OFFSET,
+ child.ComputeAnchors(,
+ A_LEFT,A_LEFT,A_OFFSET,A_OFFSET,
&x, &y, &w, &h);
child.Position(, x, y, w, h, false, true, true, true, false);
- }
+ }
}
}*/
if(desktop.display)
}
void SetAppFocus(bool state)
- {
+ {
// Shouldn't be property here
desktop.active = state;
}
bool result = false;
subclass(Skin) skin;
OldLink link;
-
+
for(link = class(Skin).derivatives.first; link; link = link.next)
{
skin = link.data;
break;
}
if(!link) skin = null;
-
+
if(skin)
{
if(skin != currentSkin || !currentSkin)
}
UnapplySkin(class(Window));
-
+
currentSkin = skin;
ApplySkin(class(Window), skin.name, null);
if(!Cycle(wait))
wait = false;
- if(wait)
+ if(wait)
Wait();
else
{
result |= UpdateTimers();
result |= ProcessFileNotifications();
*/
-
+
result |= ProcessFileNotifications();
result |= UpdateTimers();
result |= interfaceDriver.ProcessInput(useProcessAll && processAll);
#if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D)
if(Desktop3DUpdateDisplay()) return;
#endif
-
+
if(interfaceDriver)
{
if(fullScreenMode && desktop.display)
PauseNetworkEvents();
network.mutex.Wait();
-
+
#ifdef DEBUG_SOCKETS
if(network.connectEvent || network.networkEvent)
Log("[P] [NProcess]\n");
FD_SET(socket.s, &network.readSet);
FD_SET(socket.s, &network.exceptSet);
network.mutex.Release();
-
+
// printf("Calling OnConnect on %s\n", socket._class.name);
socket.OnConnect();
network.mutex.Wait();
if(skinName)
{
OldLink link;
-
+
for(link = class(Skin).derivatives.first; link; link = link.next)
{
skin = link.data;
break;
}
if(!link)
- inter = null;
+ inter = null;
}
-
+
/*
if(driverName)
- {
+ {
#if defined(__WIN32__)
#if !defined(ECERE_VANILLA)
if(!strcmp(driverName, "Win32Console")) inter = (subclass(Interface))class(Win32ConsoleInterface); else
}
*/
- if(interfaceDriver && (!driverName || (fbDriver && !strcmp(fbDriver, driverName))) &&
+ if(interfaceDriver && (!driverName || (fbDriver && !strcmp(fbDriver, driverName))) &&
fullScreen == fbFullScreen &&
(!resolution || resolution == fbResolution) &&
(!colorDepth || colorDepth == fbColorDepth) &&
{
if(!fbDriver || (driverName && strcmp(fbDriver, driverName)))
defaultDisplayDriver = driverName;
-
+
if(!skinName || !SelectSkin(skinName))
{
if(!currentSkin || currentSkin.textMode != textMode ||
{
OldLink link;
subclass(Skin) skin = null;
-
+
for(link = class(Skin).derivatives.first; link; link = link.next)
{
skin = link.data;
if(currentSkin && desktop.SetupDisplay())
{
desktop.active = true;
-
+
if(fullScreen)
{
desktop.display.Lock(false);
bool activity = false;
FileMonitor monitor, next;
static int reentrant = 0;
-
+
// Reentrant FileNotification is asking for trouble since each monitor is spawning a Modal() MessageBox
if(reentrant) return false;
// printf("[%d] Waiting in ProcessFileNotifications for fileMonitor Mutex %x...\n", (int)GetCurrentThreadID(), globalSystem.fileMonitorMutex);
incref monitor;
if(next)
incref next;
-
+
if(!monitor.reentrant && !monitor.toBeFreed)
{
monitor.reentrant = true;
{
return interfaceDriver.GetMouseState(buttons, x, y);
}
-
+
// Properties
property char * appName
{
{
set
{
- SwitchMode(value, defaultDisplayDriver, resolution,
+ SwitchMode(value, defaultDisplayDriver, resolution,
pixelFormat, refreshRate, currentSkin ? currentSkin.name : null, true);
}
get { return this ? fullScreen : false; }
{
set
{
- SwitchMode( fullScreen, value, resolution, pixelFormat, refreshRate,
+ SwitchMode( fullScreen, value, resolution, pixelFormat, refreshRate,
currentSkin ? currentSkin.name : null, true);
- }
+ }
get { return this ? defaultDisplayDriver : null; }
};
property Resolution resolution
{
set
{
- SwitchMode(fullScreen, defaultDisplayDriver, value, pixelFormat, refreshRate,
+ SwitchMode(fullScreen, defaultDisplayDriver, value, pixelFormat, refreshRate,
currentSkin ? currentSkin.name : null, true);
}
get { return this ? resolution : 0; }
{
set
{
- SwitchMode(fullScreen, defaultDisplayDriver, resolution,
+ SwitchMode(fullScreen, defaultDisplayDriver, resolution,
pixelFormat, refreshRate, currentSkin ? currentSkin.name : null, true);
}
get { return this ? pixelFormat : 0; }
{
set
{
- SwitchMode(fullScreen, defaultDisplayDriver, resolution,
+ SwitchMode(fullScreen, defaultDisplayDriver, resolution,
pixelFormat, refreshRate, currentSkin ? currentSkin.name : null, true);
}
get { return this ? refreshRate : 0; }
property int numSkins { get { return 0; } };
property uint timerResolution
{
- set { timerResolution = value; if(interfaceDriver) interfaceDriver.SetTimerResolution(value); }
+ set { timerResolution = value; if(interfaceDriver) interfaceDriver.SetTimerResolution(value); }
};
};
surface.WriteText(x+1,y+1, text,tab-text);
surface.WriteText(surface.width - 3 - tw - 12 + 1, y + 1,tab+1,len);
surface.SetForeground(guiApp.currentSkin.disabledFrontColor );
-
+
surface.TextOpacity(false);
}
surface.TextOpacity(false);
int c;
bool firstLetter;
char * tab = strchr(text, '\t');
-
+
// Look for an uppercase letter starting a word
firstLetter = true;
ch = isalpha(characters[1][hotKey.code]) ? characters[1][hotKey.code] : characters[0][hotKey.code];
SmartKey result = SmartKey { modifiers = modifiers };
switch(code)
{
- case keyPadEnter:
+ case keyPadEnter:
return enter | result;
case keyPadLeft: return left | result;
case keyPadRight: return right | result;
}
bool OnGetDataFromString(char * string)
- {
+ {
if(((PredefinedKey)this).class::OnGetDataFromString(string))
return true;
else
capsLock = 0x3A,
- // Function keys 1-10
+ // Function keys 1-10
f1 = 0x3B,
f2 = 0x3C,
f3 = 0x3D,
ctrlPageDown = Key { pageDown, ctrl = true },
ctrlInsert = Key { insert, ctrl = true },
ctrlSpace = Key { space, ctrl = true },
-
+
shiftTab = Key { tab, shift = true },
shiftF1 = Key { f1, shift = true },
shiftF2 = Key { f2, shift = true },
{
int c;
int newSize;
-
+
if(size)
{
newSize = (size + (size >> 1));
temp.Copy(this);
Empty();
-
+
for(extentBox = (BoxItem)temp.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
- if(extentBox.box.left < box.right && extentBox.box.right > box.left &&
+ if(extentBox.box.left < box.right && extentBox.box.right > box.left &&
extentBox.box.top < box.bottom && extentBox.box.bottom > box.top)
{
// Top box
{
Box newBox
{
- extentBox.box.left, extentBox.box.top,
+ extentBox.box.left, extentBox.box.top,
extentBox.box.right, Min(extentBox.box.bottom, box.top -1)
};
AddBox(newBox);
// First pass: check if this box is not already covered by one of the extent's box
for(extentBox = (BoxItem)this.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
- if(extentBox.box.left <= box.left && extentBox.box.right >= box.right &&
+ if(extentBox.box.left <= box.left && extentBox.box.right >= box.right &&
extentBox.box.top <= box.top && extentBox.box.bottom >= box.bottom)
{
// No change
return;
}
}
-
+
// Second pass: only keep boxes not completely covered in the new box
for(extentBox = (BoxItem)this.first; extentBox; extentBox = next)
{
}
}
}
-
+
// Else, add it
if(!extentBox)
AddBox(box);
void Exclusion(Extent b, Extent temp)
{
- BoxItem extentBox;
+ BoxItem extentBox;
for(extentBox = (BoxItem)b.first; extentBox; extentBox = (BoxItem)extentBox.next)
ExcludeBox(extentBox.box, temp);
}
private class ScrollFlags
{
- bool snapX:1, snapY:1, dontHide:1;
+ bool snapX:1, snapY:1, dontHide:1;
};
public class BorderBits { public: bool contour:1, fixed:1, sizable:1, deep:1, bevel:1, thin:1; };
}
}
}
-
+
//tempExtents[0] = { /*first = -1, last = -1, free = -1*/ };
//tempExtents[1] = { /*first = -1, last = -1, free = -1*/ };
//tempExtents[2] = { /*first = -1, last = -1, free = -1*/ };
maxSize = Size { MAXINT, MAXINT };
background = white;
foreground = black;
-
+
//style.isActiveClient = true;
mergeMenus = true;
autoCreate = true;
}
if(!destroyed)
- {
+ {
// Prevent destructor from being called again...
incref this;
incref this;
{
if(this == activeDesigner)
return "(Desktop)";
- else
+ else
{
char * name = property::name;
return name ? name : "";
ph = vph = box.bottom - box.top + 1;
}
}
-
+
if(!parent)
{
*ow = w;
if(anchor.top.type)
{
- SNAPUP(y, textCellH);
+ SNAPUP(y, textCellH);
}
else if(anchor.bottom.type)
{
pw = hiX - loX;
ph = hiY - loY;
- if(parent.sbv && !parent.sbv.style.hidden)
+ if(parent.sbv && !parent.sbv.style.hidden)
pw += guiApp.currentSkin.VerticalSBW();
if(parent.sbh && !parent.sbh.style.hidden)
ph += guiApp.currentSkin.HorizontalSBH();
{
if(sizeAnchor.isClientW) w += ew;
if(sizeAnchor.isClientH) h += eh;
-
+
if(anchor.left.type == offset)
x = anchor.left.distance;
else if(anchor.left.type == relative)
{
switch(anchor.right.type)
{
- case relative:
- ex = pw * (1.0f-anchor.right.percent);
+ case relative:
+ ex = pw * (1.0f-anchor.right.percent);
w = Max((int)(ex + 0.5) - x, 0);
break;
case offset:
}
w -= ew;
- h -= eh;
+ h -= eh;
if(state == normal /*|| state == Hidden*/)
{
w = Min(w, maxSize.w);
h = Min(h, maxSize.h);
- if((sizeAnchor.isClientW || !w || (anchor.left.type && anchor.right.type)) && reqScrollArea.h > h /*&& w*/ && sbv)
+ if((sizeAnchor.isClientW || !w || (anchor.left.type && anchor.right.type)) && reqScrollArea.h > h /*&& w*/ && sbv)
{
if(w) w -= guiApp.currentSkin.VerticalSBW();
addSbV = true;
}
- if((sizeAnchor.isClientH || !h || (anchor.top.type && anchor.bottom.type)) && reqScrollArea.w > w /*&& h*/ && sbh)
+ if((sizeAnchor.isClientH || !h || (anchor.top.type && anchor.bottom.type)) && reqScrollArea.w > w /*&& h*/ && sbh)
{
if(h) h -= guiApp.currentSkin.HorizontalSBH();
addSbH = true;
h = clientSize.h;
}
- if((addSbV)) // || reqScrollArea.h > h) && sbv)
+ if((addSbV)) // || reqScrollArea.h > h) && sbv)
w += guiApp.currentSkin.VerticalSBW();
if((addSbH)) // || reqScrollArea.w > w) && sbh)
h += guiApp.currentSkin.HorizontalSBH();
}
w += ew;
- h += eh;
+ h += eh;
if(guiApp.textMode)
{
if(parent.numIcons) ph -= guiApp.textMode ? 16 : 24;
numCascade = Min(
- (pw - w) / CASCADE_SPACE,
+ (pw - w) / CASCADE_SPACE,
(ph - h) / CASCADE_SPACE);
-
+
if(guiApp.textMode)
{
int cascW, cascH;
if(anchor.vert.type == middleRelative)
y = (int)(vph * (0.5 + anchor.vert.percent) - h / 2);
else
- y = vph / 2 + anchor.vert.distance - h / 2;
+ y = vph / 2 + anchor.vert.distance - h / 2;
}
else
y = (int)(ey - h);
int y = caretPos.y - scroll.y;
if((erase || this.caretSize) &&
- x >= clientArea.left && x <= clientArea.right &&
+ x >= clientArea.left && x <= clientArea.right &&
y >= clientArea.top && y <= clientArea.bottom)
{
if(!erase)
{
guiApp.interfaceDriver.SetCaret(
- x + absPosition.x + clientStart.x,
+ x + absPosition.x + clientStart.x,
y + absPosition.y + clientStart.y, this.caretSize);
guiApp.caretEnabled = true;
}
//if((w > reqScrollArea.w) || (h > reqScrollArea.w))
{
int stepX = sbStep.x, stepY = sbStep.y;
- // Needed to make snapped down position match the skin's check of client area
+ // Needed to make snapped down position match the skin's check of client area
// against realvirtual
if(guiApp.textMode)
{
// Automatic MDI Client Scrolling Area Adjustment
if(parent && !parent.noAutoScrollArea)
{
- if(modifyArea && modifyVirtArea /*&& !anchored*/ && (parent.sbv || parent.sbh) &&
+ if(modifyArea && modifyVirtArea /*&& !anchored*/ && (parent.sbv || parent.sbh) &&
!style.dontScrollHorz && !style.dontScrollVert && !style.nonClient)
{
Window parent = this.parent;
else if(stateAnchor.bottom.type == none && stateAnchor.top.type == none)
h = Max(h, Max(position.y, 0) + size.h);
- if((w > parent.clientSize.w && w > parent.reqScrollArea.w) ||
+ if((w > parent.clientSize.w && w > parent.reqScrollArea.w) ||
(h > parent.clientSize.h && h > parent.reqScrollArea.h))
{
/*bool resize = false;
int stepX = parent.sbStep.x, stepY = parent.sbStep.y;
- // Needed to make snapped down position match the skin's check of client area
+ // Needed to make snapped down position match the skin's check of client area
// against realvirtual
if(guiApp.textMode)
{
parent.reqScrollArea.h = h;*/
// parent.UpdateScrollBars(true, true);
- parent.Position(parent.position.x, parent.position.y, parent.size.w, parent.size.h,
+ parent.Position(parent.position.x, parent.position.y, parent.size.w, parent.size.h,
false, true, true, true, false, false);
return;
//}
}
- else
+ else
GetRidOfVirtualArea();
}
}
{
Window parent = this.parent;
parent.Position(
- parent.position.x, parent.position.y, parent.size.w, parent.size.h,
+ parent.position.x, parent.position.y, parent.size.w, parent.size.h,
false, true, true, true, false, false);
/*
parent.SetScrollArea(0,0,true);
// windowResized = realResized || force;
windowResized = size.w != w || size.h != h || force;
-
+
if(rootWindow != this && display && !display.flags.flipping && scrolledPos.x != MININT)
{
if(style.nonClient)
{
Box box
- {
- scrolledPos.x - parent.clientStart.x + this.box.left, scrolledPos.y - parent.clientStart.y + this.box.top,
+ {
+ scrolledPos.x - parent.clientStart.x + this.box.left, scrolledPos.y - parent.clientStart.y + this.box.top,
scrolledPos.x - parent.clientStart.x + this.box.right,
- scrolledPos.y - parent.clientStart.y + this.box.bottom
+ scrolledPos.y - parent.clientStart.y + this.box.bottom
};
parent.Update(box);
}
int x,y,w,h;
for(child = children.first; child; child = child.next)
{
- if(child.created &&
+ if(child.created &&
((child.stateAnchor.left.type != offset ||
child.stateAnchor.top.type != offset ||
child.stateAnchor.right.type != none ||
else if(clientResized)
Update(clientArea);
// --- Major Slow Down / Fix OpenGL Resizing Main Window Lag
-
+
/*
if(!guiApp.fullScreenMode && !guiApp.modeSwitching && this == rootWindow)
UpdateDisplay();
*/
-
+
if(windowMoved || windowResized)
{
display.Unlock();
{
if(windowResized || windowMoved)
if(!display || display.flags.memBackBuffer)
- guiApp.interfaceDriver.PositionRootWindow(this,
+ guiApp.interfaceDriver.PositionRootWindow(this,
x, y, w, h, windowMoved, windowResized);
guiApp.interfaceDriver.UpdateRootWindow(this);
}
if(flag && (resizeH || resizeV) && fullThing)
{
Position(position.x, position.y, size.w, size.h, false, true, false, false, false, false);
-
+
if(!positioned)
{
positioned = true;
positioned = false;
}
}
-
+
if(resizeH && sbh)
sbh.visible = sbhVisible;
if(resizeV && sbv)
Update(null);
break;
}
- }
+ }
}
}
{
if(!sysButtons[2])
{
- sysButtons[2] =
+ sysButtons[2] =
Button
{
parent, master = this,
sysButtons[2].hotKey = ctrlF4;
sysButtons[2].Create();
}
-
+
sysButtons[2].symbol = 'X';
sysButtons[2].disabled = !style.hasClose;
}
SkinBitmap skin;
unichar symbol;
bool (* method)(Window window, Button button, int x, int y, Modifiers mods);
- if(state == maximized)
+ if(state == maximized)
{
skin = restore;
method = RestoreButtonClicked;
SkinBitmap skin;
unichar symbol;
bool (* method)(Window window, Button button, int x, int y, Modifiers mods);
- if (state == minimized)
+ if (state == minimized)
{
skin = restore;
method = RestoreButtonClicked;
}
if(scrollBarChanged)
{
- SetScrollLineStep(sbStep.x, sbStep.y);
+ SetScrollLineStep(sbStep.x, sbStep.y);
UpdateScrollBars(true, true);
- }
+ }
UpdateNonClient();
if(scrollBarChanged)
char name[2048], caption[2048];
document.FigureCaption(caption);
sprintf(name, "%d %s", id+1, caption);
- windowMenu.AddDynamic(MenuItem
- {
- copyText = true, text = name, hotKey = Key { k1 + id }, id = id++,
- NotifySelect = MenuWindowSelectWindow
+ windowMenu.AddDynamic(MenuItem
+ {
+ copyText = true, text = name, hotKey = Key { k1 + id }, id = id++,
+ NotifySelect = MenuWindowSelectWindow
}, this, false);
}
cycle = cycle.next;
}
}
}
-
+
if((!previous && activeClient) || !activeClient)
{
if(!activeClient)
if(item) item.disabled = false;
item = menu.FindItem(MenuWindowWindows, 0);
if(item) item.disabled = false;
- }
+ }
item = menu.FindItem(MenuFileClose, 0);
if(item) item.disabled = !activeClient || !activeClient.style.hasClose;
{
char caption[2048];
FigureCaption(caption);
-
+
if(post)
ShowDecorations(captionFont.font,
surface,
caption,
active, //parent.activeClient == this
guiApp.windowMoving == this);
-
+
delete surface;
}
}
if(!manageDisplay) { OnRedraw(null);return; }
_ShowDecorations(refresh, false);
- surface = Redraw(refresh);
+ surface = Redraw(refresh);
// Opaque background: just fill before EW_REDRAW (clear?)
- if(surface)
+ if(surface)
{
surface.SetBackground(background);
surface.SetForeground(foreground);
void DrawOverChildren(Box refresh)
{
- Surface surface = Redraw(refresh);
- if(surface)
+ Surface surface = Redraw(refresh);
+ if(surface)
{
// Default Settings
surface.DrawingChar(' ');
Extent clipExtent { /*first = -1, last = -1, free = -1*/ };
clipExtent.Copy(this.clipExtent);
-
+
for(child = children.last; child; child = child.prev)
{
if(!child.style.hidden && child.created && !child.is3D && child.rootWindow)
{
- bool opaque = child.IsOpaque(); // TODO: acess background directly
+ bool opaque = child.IsOpaque(); // TODO: acess background directly
int dx = child.absPosition.x - absPosition.x, dy = child.absPosition.y - absPosition.y;
child.clipExtent.Copy(clipExtent);
Box box { child.box.left + dx, child.box.top + dy, child.box.right + dx, child.box.bottom + dy };
clipExtent.ExcludeBox(box, rootWindow.tempExtents[0]);
}
-
+
}
}
// ??? Only do this for overlapped window or if parent has with clip children flag
/*
Extent childRenderArea;
-
+
if(backBufferUpdate != null)
{
childRenderArea.Copy(backBufferUpdate);
{
renderArea.Copy(backBufferUpdate);
renderArea.Offset(-offsetX, -offsetY);
-
+
overRenderArea.Copy(backBufferUpdate);
overRenderArea.Offset(-offsetX, -offsetY);
-
-
+
+
}
else
{
renderArea.Copy(dirtyArea);
-
+
overRenderArea.Copy(dirtyArea);
}
FASTLIST_LOOP(renderArea, extentBox)
{
#ifdef _DEBUG
- printf("(%d, %d) - (%d, %d)\n",
- extentBox.box.left, extentBox.box.top,
+ printf("(%d, %d) - (%d, %d)\n",
+ extentBox.box.left, extentBox.box.top,
extentBox.box.right, extentBox.box.bottom);
#endif
}
}
}
*/
-
+
// WHY WAS THIS COMMENTED ??
// Add extent forced by DrawOverChildren to the dirty area, adjusting dirty extent to the window
// Intersect with the clip extent
overRenderArea.Intersection(clipExtent, rootWindow.tempExtents[0], rootWindow.tempExtents[1], rootWindow.tempExtents[2]);
-
+
if(opaque)
{
dirtyExtent.Union(renderArea);
renderArea.Free();
}*/
-
-
+
+
{
Extent renderArea { };
-
+
renderArea.Copy(overRenderArea);
renderArea.Offset(offsetX, offsetY);
overDirtyExtent.Union(renderArea, rootWindow.tempExtents[0]);
renderArea.Empty();
}
-
+
if(backBufferUpdate != null)
{
foreground = (background.color.r > 128 || background.color.g > 128) ? black : white;
*/
#endif
-
+
#ifdef _DEBUG
/*if(renderArea.count)
printf("\n\nRendering %s (%x):\n------------------------------------------\n", _class.name, this);*/
#endif
-
+
for(extentBox = (BoxItem)renderArea.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
Box box = extentBox.box;
#ifdef _DEBUG
- /*printf("(%d, %d) - (%d, %d)\n",
- extentBox.box.left, extentBox.box.top,
+ /*printf("(%d, %d) - (%d, %d)\n",
+ extentBox.box.left, extentBox.box.top,
extentBox.box.right, extentBox.box.bottom);*/
#endif
-
+
UpdateExtent(box);
box.left += offsetX;
public void UpdateDisplay(void)
{
if(!manageDisplay) { OnRedraw(null);return; }
- if(rootWindow && this != rootWindow)
+ if(rootWindow && this != rootWindow)
rootWindow.UpdateDisplay();
else if(display)
{
ComputeRenderArea(dirtyExtent, overExtent, null);
}
else
- clipExtent.Free(null);
+ clipExtent.Free(null);
dirtyExtent.Free(null);
overExtent.Free(null);
Render(updateExtent);
if(fullRender)
updateExtent.UnionBox(this.box, tempExtents[0]);
-
+
#ifdef _DEBUG
//printf("\n\nUpdate:\n------------------------------------------\n");
#endif
-
+
//FASTLIST_LOOP(updateExtent, extentBox)
for(extentBox = (BoxItem)updateExtent.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
#ifdef _DEBUG
- /*printf("Updating (%d, %d) - (%d, %d)\n",
- extentBox.box.left, extentBox.box.top,
+ /*printf("Updating (%d, %d) - (%d, %d)\n",
+ extentBox.box.left, extentBox.box.top,
extentBox.box.right, extentBox.box.bottom);*/
#endif
-
+
display.Update(extentBox.box);
-
+
}
updateExtent.Free(null);
}
{
intersection.Copy(dirtyBack);
intersection.IntersectBox(box);
-
+
dirtyExtent.Clear();
overExtent.Clear();
clipExtent.AddBox(box);
-
+
if(!rootWindow.fullRender)
{
ComputeClipExtents();
if(child != statusBar && child.rootWindow == rootWindow)
{
Window childResult = child.GetAtPosition(x, y, clickThru, acceptDisabled, last);
- if(childResult)
+ if(childResult)
return childResult;
}
}
bool AcquireInputEx(bool state)
{
bool result;
- if(state)
+ if(state)
{
guiApp.interfaceDriver.GetMousePosition(&guiApp.acquiredMouseX, &guiApp.acquiredMouseY);
guiApp.interfaceDriver.SetMousePosition(clientSize.w/2 + absPosition.x, clientSize.h/2 + absPosition.y);
{
if(guiApp.caretOwner)
{
- Box extent
+ Box extent
{
- guiApp.caretOwner.caretPos.x - guiApp.caretOwner.scroll.x + 1,
+ guiApp.caretOwner.caretPos.x - guiApp.caretOwner.scroll.x + 1,
guiApp.caretOwner.caretPos.y - guiApp.caretOwner.scroll.y + 1,
- guiApp.caretOwner.caretPos.x - guiApp.caretOwner.scroll.x + 2,
+ guiApp.caretOwner.caretPos.x - guiApp.caretOwner.scroll.x + 2,
guiApp.caretOwner.caretPos.y - guiApp.caretOwner.scroll.y + guiApp.caretOwner.caretSize - 1
};
guiApp.caretOwner.Update(extent);
{
if(!active)
StopMoving();
- if(activateParent &&
- (parent.activeChild != this ||
+ if(activateParent &&
+ (parent.activeChild != this ||
(guiApp.interimWindow && !IsDescendantOf(guiApp.interimWindow))) &&
active && _isModal &&
parent != master && master)
bool real = parent.activeChild != this;
// TEST THIS: New activateParent check here!!! CAUSED MENUS NOT GOING AWAY
- if(!style.inactive && /*activateParent && */guiApp.interimWindow &&
- !IsDescendantOf(guiApp.interimWindow) &&
+ if(!style.inactive && /*activateParent && */guiApp.interimWindow &&
+ !IsDescendantOf(guiApp.interimWindow) &&
!IsSlaveOf(guiApp.interimWindow))
{
Window interimWindow = guiApp.interimWindow;
{
bool goOn = true;
result = PropagateActive(true, swap, &goOn, true);
- if(!result && !goOn)
+ if(!result && !goOn)
{
delete this;
return false;
}
}
}
-
+
if(result && real && (!style.inactive || moveInactive) && parent)
{
Window last = parent.children.last;
if(!style.stayOnTop)
for(; last && last.style.stayOnTop; last = last.prev);
-
+
parent.children.Move(this, last);
// Definitely don't want that: why not?
}
}
}
- else
+ else
{
if(!parent || style.interim || (parent.activeChild == this && !style.inactive))
{
if(guiApp.windowScrolling && !consequential)
{
guiApp.windowScrolling.SetScrollPosition(
- (guiApp.windowScrolling.sbh) ?
+ (guiApp.windowScrolling.sbh) ?
(guiApp.windowScrollingBefore.x - mouseX + guiApp.windowScrollingStart.x) : 0,
- (guiApp.windowScrolling.sbv) ?
+ (guiApp.windowScrolling.sbv) ?
(guiApp.windowScrollingBefore.y - mouseY + guiApp.windowScrollingStart.y) : 0);
}
if(guiApp.windowMoving)
h = guiApp.windowResizingBefore.h - ry;
}
}
-
+
// Position
if(!guiApp.windowIsResizing || guiApp.resizeX)
x = guiApp.windowMovingBefore.x + rx;
// Break the anchors for moveable/resizable windows
// Will probably cause problem with IDE windows... Will probably need a way to specify if anchors should break
- if(window.style.fixed)
+ if(window.style.fixed)
{
if(window.state == normal)
{
w = msgWindow;
if(w) incref w;
window = (w && !w.disabled) ? w : null;
-
+
if(trueWindow) incref trueWindow;
if(consequential) mods->isSideEffect = true;
{
Window moved = trueWindow;
for(moved = trueWindow; moved; moved = moved.parent)
- if(method == __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonDown || ((moved.style.fixed || moved.moveable) && moved.state != maximized))
+ if(method == __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonDown || ((moved.style.fixed || moved.moveable) && moved.state != maximized))
break;
- if(moved)
+ if(moved)
{
window = moved;
windowDragged = true;
{
Window moved = window;
for(moved = window; moved; moved = moved.parent)
- if(method == OnRightButtonDown || ((moved.style.fixed || moved.moveable) && moved.state != maximized))
+ if(method == OnRightButtonDown || ((moved.style.fixed || moved.moveable) && moved.state != maximized))
break;
- if(moved)
+ if(moved)
{
window = moved;
windowDragged = true;
doActivation = false;
*/
- if((doActivation && (activateWindow.parent != guiApp.desktop || guiApp.fullScreen)) ||
+ if((doActivation && (activateWindow.parent != guiApp.desktop || guiApp.fullScreen)) ||
(guiApp.interimWindow && !window.IsDescendantOf(guiApp.interimWindow)))
{
// Let the OnLeftButtonDown do the activating instead
else if(method == __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonDown)
{
if(window.style.fixed &&
- (windowDragged ||
+ (windowDragged ||
window.IsMouseMoving(
x - window.absPosition.x, y - window.absPosition.y, window.size.w, window.size.h)))
{
}
else if(method == __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftDoubleClick)
{
- if(window.style.hasMaximize &&
- window.IsMouseMoving(
+ if(window.style.hasMaximize &&
+ window.IsMouseMoving(
x - window.absPosition.x, y - window.absPosition.y, window.size.w, window.size.h))
{
window.SetState(
}
else
window = null;
- if(guiApp.windowMoving)
+ if(guiApp.windowMoving)
{
if(guiApp.windowMoving.parent)
{
if(trueWindow && trueWindow.FindModal())
delete trueWindow;
-
+
/*if(trueWindow)
incref trueWindow;
*/
if(status && !destroyed && menuBar && state != minimized)
{
// Disable the ALT
- if((SmartKey)key != alt)
+ if((SmartKey)key != alt)
menuBar.KeyMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyDown, 0, 0);
if(menuBar.focus)
{
if(!guiApp.windowIsResizing || guiApp.resizeY)
y = (y - guiApp.windowMovingBefore.y) + guiApp.windowMovingStart.y;
- else
+ else
y = (h - guiApp.windowResizingBefore.h) + guiApp.windowMovingStart.y;
guiApp.interfaceDriver.SetMousePosition(x, y);
{
guiApp.windowMoving.StopMoving();
ConsequentialMouseMove(false);
-
+
status = false;
}
break;
if((defaultControl.active ||
defaultControl.ActivateEx(true, true, false, true, null, null)) && !defaultControl.disabled)
defaultControl.KeyMessage(method, defaultKey, character);
- status = false;
+ status = false;
}
}
}
Window cycleParent = this;
if(this == guiApp.interimWindow && master && !master.style.interim && !cycleParent.style.tabCycle && master.parent)
cycleParent = master.parent;
-
+
if(!guiApp.windowCaptured && cycleParent.style.tabCycle)
{
if(cycleParent.CycleChildren(!key.shift, false, false, true))
if(cycleParent.sbh && !child.style.dontScrollHorz)
{
if(child.scrolledPos.x < 0)
- cycleParent.sbh.Action(Position,
+ cycleParent.sbh.Action(Position,
cycleParent.scroll.x + child.scrolledPos.x, 0);
else if(child.scrolledPos.x + child.size.w > cycleParent.clientSize.w)
cycleParent.sbh.Action(Position,
if(cycleParent.sbv && !child.style.dontScrollVert)
{
if(child.scrolledPos.y < 0)
- cycleParent.sbv.Action(Position,
+ cycleParent.sbv.Action(Position,
cycleParent.scroll.y + child.scrolledPos.y, 0);
else if(child.scrolledPos.y + child.size.w > window.clientSize.h)
cycleParent.sbv.Action(Position,
}
}
}
- break;
+ break;
}
*/
}
Window child;
// Setup relationship with outside world (bb root || !bb)
- if((!guiApp.fullScreenMode && parent == guiApp.desktop) || this == guiApp.desktop ||
+ if((!guiApp.fullScreenMode && parent == guiApp.desktop) || this == guiApp.desktop ||
(_displayDriver && parent.dispDriver && dispDriver != parent.dispDriver))
{
rootWindow = this;
for(child = children.first; child; child = child.next)
{
if(child.created && !child.Setup(false))
- result = false;
+ result = false;
}
return result;
}
bool SetupDisplay(void)
{
#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA)
- if(is3D) return Window3D_SetupDisplay(this); else
-#endif
+ if(is3D) return Window3D_SetupDisplay(this); else
+#endif
if(SetupRoot())
return Setup(true);
return false;
}
}
}
-
+
if(guiApp.fullScreenMode || this != guiApp.desktop)
{
SetWindowMinimum(&skinMinSize.w, &skinMinSize.h);
}
for(cursor = guiApp.customCursors.first; cursor; cursor = cursor.next)
{
- cursor.bitmap = eBitmap_LoadT(cursor.bitmapName, null,
+ cursor.bitmap = eBitmap_LoadT(cursor.bitmapName, null,
cursor.paletteShades ? null : guiApp.desktop.display.displaySystem);
if(cursor.bitmap)
cursor.bitmap.paletteShades = cursor.paletteShades;
}
// Load Window Graphic Resources
-
+
/*
if(usedFont == setFont || usedFont == window.systemFont)
RemoveResource(usedFont);
if(systemFont)
RemoveResource(systemFont);
-
+
if(captionFont)
RemoveResource(captionFont);
display.Unlock();
//SetScrollLineStep(sbStep.x, sbStep.y);
-
+
if(this != guiApp.desktop)
{
if(resetAnchors)
switch(state)
{
case maximized:
-
+
stateAnchor = Anchor { left = 0, top = 0, right = 0, bottom = 0 };
stateSizeAnchor = SizeAnchor {};
break;
-
+
case minimized:
{
int maxIcons = parent.clientSize.w / MINIMIZED_WIDTH;
- stateAnchor =
- Anchor
+ stateAnchor =
+ Anchor
{
left = (iconID % maxIcons) * MINIMIZED_WIDTH,
bottom = (iconID / maxIcons) * (guiApp.textMode ? 16 : 24)
};
-
+
stateSizeAnchor = SizeAnchor { size.w = MINIMIZED_WIDTH };
break;
}
/* WTH is this doing here?
while(swap && swap.activeChild)
{
- swap = swap.activeChild;
+ swap = swap.activeChild;
}
*/
// TESTING THIS BEFORE...
OldLink prevOrder = null;
Window client = null;
- if(parent) stopwatching(parent, font);
+ if(parent) stopwatching(parent, font);
// if(window.modalSlave) return false;
if(destroyed || !created)
guiApp.prevWindow = null;
OnMouseLeave(0);
}
- if(guiApp.caretOwner == this)
+ if(guiApp.caretOwner == this)
{
guiApp.interfaceDriver.SetCaret(0,0,0);
UpdateCaret(false, true);
if(client == this) { client = null; break; }
if(client && (client.style.nonClient || !client.style.isActiveClient || client.style.hidden || client.destroyed || !client.created))
tmpPrev = client.order.prev;
- else
+ else
{
if(client)
prevOrder = tmpPrev;
parent.UpdateActiveDocument(null);
}
}
- else
+ else
{
if(guiApp.interimWindow == this)
{
{
guiApp.desktop.mutex.Wait();
guiApp.desktop.display.Lock(true);
-
+
Update(extent);
if(guiApp.desktop.active)
{
guiApp.RestoreCursorBackground();
}
}
-
+
guiApp.desktop.display.Unlock();
guiApp.desktop.mutex.Release();
}
Window rootWindow = this.rootWindow;
rootWindow.mutex.Wait();
display.Lock(true);
-
+
Update(extent);
if(guiApp.waiting)
guiApp.SignalEvent();
isForegroundWindow = true;
ActivateEx(active, active, false, false, null, null);
isForegroundWindow = false;
- }
+ }
}
*/
guiApp.windowMovingBefore = scrolledPos;
guiApp.windowResizingBefore = size;
guiApp.windowMoving.UpdateDecorations();
- if(guiApp.windowIsResizing)
+ if(guiApp.windowIsResizing)
guiApp.resizeEndX = guiApp.resizeEndY = true;
if(setCursorPosition)
guiApp.interfaceDriver.GetMousePosition(&x, &y);
guiApp.windowMovingStart.x += x - absPosition.x;
guiApp.windowMovingStart.y += y - absPosition.y;
- }
+ }
if(guiApp.windowMoving)
{
Window last;
bool visible = !style.hidden;
- if(style.embedded)
+ if(style.embedded)
{
systemParent = parent;
parent = guiApp.desktop;
this.visible = false;
style.hidden = true;
-
+
//created = true;
// autoCreate = true;
wasCreated = true;
if(style.hasMenuBar /*&& menu*/)
{
- menuBar =
+ menuBar =
PopupMenu
{
this,
if(statusBar)
statusBar.Create();
-
+
// Create the system buttons
CreateSystemChildren();
{
Window child;
Box realBox;
-
+
// Testing this to avoid repetitve full update to take time...
if(dirtyArea.count == 1)
{
return;
}
}
-
+
rootWindow.dirty = true;
if(region != null)
else
realBox = box;
- if(realBox.right >= realBox.left &&
+ if(realBox.right >= realBox.left &&
realBox.bottom >= realBox.top)
{
// if(!rootWindow.fullRender)
childBox.top -= window.absPosition.y - guiApp.desktop.absPosition.y;
childBox.right -= window.absPosition.x - guiApp.desktop.absPosition.x;
childBox.bottom -= window.absPosition.y - guiApp.desktop.absPosition.y;
-
+
window.Update(childBox);
}
else
if(snapToStep)
{
int stepX = sbStep.x, stepY = sbStep.y;
- // Needed to make snapped down position match the skin's check of client area
+ // Needed to make snapped down position match the skin's check of client area
// against realvirtual
if(guiApp.textMode)
{
// This has the effect of activating the window through the system...
if(rootWindow == this)
guiApp.interfaceDriver.SetRootWindowState(this, newState, !style.hidden);
-
+
SetStateEx(newState, activate);
if(rootWindow == this && !rootWindow.nativeDecorations)
parent.UpdateScrollBars(true, true);
/*
- // Do we really need this stuff here?
- // Shouldn't the Activate stuff take care of it?
+ // Do we really need this stuff here?
+ // Shouldn't the Activate stuff take care of it?
if(parent.rootWindow == parent && style)
{
char caption[2048];
parent.FigureCaption(caption);
guiApp.interfaceDriver.SetRootWindowCaption(parent, caption);
parent.UpdateDecorations();
- }
+ }
*/
rootWindow.ConsequentialMouseMove(false);
PopupMenu windowMenu { master = this, interim = true, position = { x + 1 - guiApp.desktop.position.x, y + 1 - guiApp.desktop.position.y }, menu = menu };
MenuItem
{
- menu, $"Restore", r, NotifySelect = MenuWindowRestore,
+ menu, $"Restore", r, NotifySelect = MenuWindowRestore,
disabled = (!style.hasMaximize && !style.hasMinimize) || state == normal, bitmap = guiApp.currentSkin.GetBitmap(restore)
};
MenuItem
{
- menu, $"Move", m, NotifySelect = MenuWindowMove,
+ menu, $"Move", m, NotifySelect = MenuWindowMove,
disabled = !style.fixed || state == maximized
};
MenuItem
{
- menu, $"Size", s, NotifySelect = MenuWindowSize,
+ menu, $"Size", s, NotifySelect = MenuWindowSize,
disabled = !style.sizable || state != normal
};
MenuItem
{
- menu, $"Minimize", n, NotifySelect = MenuWindowMinimize,
+ menu, $"Minimize", n, NotifySelect = MenuWindowMinimize,
disabled = !style.hasMinimize || state == minimized, bitmap = guiApp.currentSkin.GetBitmap(minimize)
};
MenuItem
{
- menu, $"Maximize", KeyCode::x, NotifySelect = MenuWindowMaximize,
+ menu, $"Maximize", KeyCode::x, NotifySelect = MenuWindowMaximize,
disabled = !style.hasMaximize || state == maximized, bitmap = guiApp.currentSkin.GetBitmap(maximize)
};
MenuItem
{
- menu, $"Stay On Top", t, NotifySelect = MenuWindowStayOnTop,
+ menu, $"Stay On Top", t, NotifySelect = MenuWindowStayOnTop,
disabled = !style.fixed, checkable = true, checked = style.stayOnTop
};
MenuDivider { menu };
}
}
/*
- if(!clientOnly && child.cycle == (backward ? childrenCycle.first : childrenCycle.last) &&
+ if(!clientOnly && child.cycle == (backward ? childrenCycle.first : childrenCycle.last) &&
parent.tabCycle && parent.CycleChildren(backward, false, false))
return true;
*/
{
Window window { };
window.Create();
- result = window.display.displaySystem.driver.GrabScreen(null, bitmap, clip.left, clip.top,
+ result = window.display.displaySystem.driver.GrabScreen(null, bitmap, clip.left, clip.top,
clip.right - clip.left + 1, clip.bottom - clip.top + 1);
delete window;
}
else
- result = display.Grab(bitmap, clip.left, clip.top,
+ result = display.Grab(bitmap, clip.left, clip.top,
clip.right - clip.left + 1, clip.bottom - clip.top + 1);
if(bitmap.pixelFormat != pixelFormat888 && bitmap.pixelFormat != pixelFormat8)
return false;
if(terminateX > 1)
return true;
-
+
closing = true;
if(!OnClose(parentClosing))
MessageBox dialog { master = master.parent ? master : this, type = yesNoCancel, text = $"Error writing file", contents = $"Save as a different file?" };
DialogResult answer = dialog.Modal();
saving = false;
- if(answer != yes)
+ if(answer != yes)
{
result = answer;
break;
}
document = cycle.data;
document.Activate();
-
+
//if(activeChild.state == maximized)
// document.SetState(maximized, false, mods);
//else if(document.state == minimized)
virtual void SetWindowArea(int * x, int * y, MinMaxValue * w, MinMaxValue * h, MinMaxValue * cw, MinMaxValue * ch)
{
*cw = *w;
- *ch = *h;
+ *ch = *h;
}
virtual void ShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving);
virtual void PreShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving);
if(!master || (master == this.parent && master == guiApp.desktop))
property::master = value;
-
+
if(parent)
{
parent.children.Remove(this);
if(created)
{
int x = position.x, y = position.y, w = size.w, h = size.h;
-
+
int vpw, vph;
x += parent.absPosition.x - value.absPosition.x + parent.clientStart.x - value.clientStart.x;
y += parent.absPosition.y - value.absPosition.y + parent.clientStart.y - value.clientStart.y;
-
+
vpw = value.clientSize.w;
vph = value.clientSize.h;
if(style.nonClient)
if(!style.noCycle)
parent.childrenCycle.Insert(
// Note: changed to 'null' to fix broken tab cycling in WSMS custom reports
- //(parent.activeChild && parent.activeChild.cycle) ? parent.activeChild.cycle.prev : null,
+ //(parent.activeChild && parent.activeChild.cycle) ? parent.activeChild.cycle.prev : null,
null,
cycle = OldLink { data = this });
parent.childrenOrder.Insert(
- (parent.activeChild && parent.activeChild.order) ? parent.activeChild.order.prev : parent.childrenOrder.last,
+ (parent.activeChild && parent.activeChild.order) ? parent.activeChild.order.prev : parent.childrenOrder.last,
order = OldLink { data = this });
}
}
// *** FONT INHERITANCE ***
- if(!setFont && oldParent)
+ if(!setFont && oldParent)
stopwatching(oldParent, font);
if(systemFont)
Update(null);
}
};
-
+
firewatchers font;
if(value.rootWindow && value.rootWindow.display && rootWindow)
{
- bool reloadGraphics = (oldParent.rootWindow == oldParent && value.rootWindow) || (!value.rootWindow && rootWindow == this) ||
+ bool reloadGraphics = (oldParent.rootWindow == oldParent && value.rootWindow) || (!value.rootWindow && rootWindow == this) ||
(value.rootWindow.display && value.rootWindow.display.displaySystem != rootWindow.display.displaySystem);
-
+
if(reloadGraphics)
UnloadGraphics(false);
SetupDisplay();
if(reloadGraphics)
LoadGraphics(false, false);
-
+
/*
if(value.rootWindow != rootWindow)
DisplayModeChanged();
CreateSystemChildren();
}
}
- get { return (BorderStyle)style.borderBits; }
+ get { return (BorderStyle)style.borderBits; }
};
property Size minClientSize
}
get { return style.hasClose; }
};
-
+
property bool nonClient
{
property_category $"Layout"
property_category $"Behavior"
set
{
- if(value)
+ if(value)
{
// *** NEW HERE: ***
if(!style.inactive)
{
parent.childrenCycle.Insert(
// Note: changed to 'null' to fix broken tab cycling in WSMS custom reports
- //(parent.activeChild && parent.activeChild.cycle) ? parent.activeChild.cycle.prev : null,
+ //(parent.activeChild && parent.activeChild.cycle) ? parent.activeChild.cycle.prev : null,
null,
cycle = OldLink { data = this });
}
set { style.tabCycle = value; }
get { return style.tabCycle; }
};
-
+
property bool isDefault
{
property_category $"Behavior"
property_category $"Window Style"
set
{
- if(value)
+ if(value)
{
if(!menu)
{
if(created && !menuBar)
{
menuBar =
- PopupMenu
+ PopupMenu
{
this, menu = menu,
isMenuBar = true,
anchor = Anchor { top = 23, left = 1, right = 1 },
size.h = 24,
- inactive = true, nonClient = true
+ inactive = true, nonClient = true
};
menuBar.Create();
}
if(order)
{
OldLink order;
- for(order = (this.order == parent.childrenOrder.first) ? null : this.order.prev;
+ for(order = (this.order == parent.childrenOrder.first) ? null : this.order.prev;
order && ((Window)order.data).style.stayOnTop;
order = (order == parent.childrenOrder.first) ? null : order.prev);
last = order ? order.data : null;
}
else
{
- for(last = parent.children.last;
+ for(last = parent.children.last;
last && last.style.stayOnTop;
last = last.prev);
}
if(!menuBar && style.hasMenuBar && value)
{
menuBar = PopupMenu
- {
- this, menu = value, isMenuBar = true,
- anchor = Anchor { left = 1, top = 23, right = 1 }, size.h = 24,
+ {
+ this, menu = value, isMenuBar = true,
+ anchor = Anchor { left = 1, top = 23, right = 1 }, size.h = 24,
inactive = true, nonClient = true
};
menuBar.Create();
property_category $"Layout"
isset
{
- return ((anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none) ||
+ return ((anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none) ||
(anchor.top.type == none || anchor.top.type == middleRelative || anchor.bottom.type == none)) &&
sizeAnchor.isClientW != sizeAnchor.isClientH;
}
bool leftRight = (anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none);
bool topBottom = (anchor.top.type == none || anchor.top.type == middleRelative || anchor.bottom.type == none);
bool isClient = !sizeAnchor.isClientW && !sizeAnchor.isClientH;
- return ((anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none) ||
+ return ((anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none) ||
(anchor.top.type == none || anchor.top.type == middleRelative || anchor.bottom.type == none)) &&
!sizeAnchor.isClientW && !sizeAnchor.isClientH && sizeAnchor.size.w && sizeAnchor.size.h;
}
property_category $"Layout"
isset
{
- return ((anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none) ||
+ return ((anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none) ||
(anchor.top.type == none || anchor.top.type == middleRelative || anchor.bottom.type == none)) &&
sizeAnchor.isClientW && sizeAnchor.isClientH && sizeAnchor.size.w && sizeAnchor.size.h;
}
}
anchor = value;
- if(anchor.right.type && (anchor.horz.type == middleRelative || !anchor.left.type))
+ if(anchor.right.type && (anchor.horz.type == middleRelative || !anchor.left.type))
{
anchor.left.distance = 0;
anchor.horz.type = 0;
int x, y, w, h;
normalAnchor = anchor;
-
+
// Break the anchors for moveable/resizable windows
/*if(style.fixed ) //&& value.left.type == cascade)
{
{
tmpPrev = client.order.prev;
}
- else
+ else
{
if(client)
prevOrder = tmpPrev;
cycle = null;
order = null;
*/
-
+
SetVisibility(!parent.style.hidden && (style.hidden ? false : true));
}
if(!(style.noCycle))
{
cycle = parent.childrenCycle.AddAfter(
- (parent.activeChild && parent.activeChild.cycle) ?
+ (parent.activeChild && parent.activeChild.cycle) ?
parent.activeChild.cycle.prev : null, sizeof(OldLink));
cycle.data = this;
}
order.data = this;
}
*/
-
+
/*
if(true || !parent.activeChild)
ActivateEx(true, false, true, true, null, null);
if(creationActivation == activate)
ActivateEx(true, false, true, true, null, null);
else if(creationActivation == flash && !object)
- Flash();
+ Flash();
//SetVisibility(!parent.style.hidden && (style.hidden ? false : true));
Update(null);
get { return (style.hidden || !setVisible) ? false : true; }
};
-
+
property bool isDocument
{
property_category $"Document"
{
if(!style.hasHorzScroll && created)
{
- CreateSystemChildren();
+ CreateSystemChildren();
Position(position.x, position.y, size.w, size.h, false, true, false, false, false, true);
}
}
SelectMouseCursor();
}
get { return cursor; }
- };
+ };
//#if !defined(ECERE_VANILLA)
property char * name
};
// Runtime Only Properties (No Set, can display the displayable ones depending on the type?)
-
+
// Will be merged with font later
property Font fontObject { get { return usedFont ? usedFont.font : null; } };
property Point clientStart { get { value = clientStart; } };
property bool created { get { return (bool)created; } };
property bool destroyed { get { return (bool)destroyed; } };
property Window firstSlave { get { return slaves.first ? ((OldLink)slaves.first).data : null; } };
- property Window firstChild { get { return children.first; } };
- property Window lastChild { get { return children.last; } };
+ property Window firstChild { get { return children.first; } };
+ property Window lastChild { get { return children.last; } };
property Window activeClient { get { return activeClient; } };
property Window activeChild { get { return activeChild; } };
property Display display { get { return display ? display : ((parent && parent.rootWindow) ? parent.rootWindow.display : null); } };
property ScrollBar horzScroll { get { return sbh; } };
property ScrollBar vertScroll { get { return sbv; } };
property StatusBar statusBar { get { return statusBar; } };
- property Window rootWindow { get { return rootWindow; } };
+ property Window rootWindow { get { return rootWindow; } };
property bool closing { get { return (bool)closing; } set { closing = value; } };
property int documentID { get { return documentID; } };
property Window previous { get { return prev; } }
property bool fullRender { set { fullRender = value; } get { return (bool)fullRender; } }
property void * systemHandle { get { return windowHandle; } }
property Button minimizeButton { get { return sysButtons[0]; } };
- property Button maximizeButton { get { return sysButtons[1]; } };
+ property Button maximizeButton { get { return sysButtons[1]; } };
property Button closeButton { get { return sysButtons[2]; } };
property BitmapResource icon
{
void * windowHandle; // System window handle
DialogResult returnCode;// Return code for modal windows
-
+
Point sbStep; // Scrollbar line scrolling steps
Anchor stateAnchor;
bool nativeDecorations:1;
bool manageDisplay:1;
bool formDesigner:1; // True if we this is running in the form editor
- };
+ };
// Checks used internally for them not to take effect in FormDesigner
property bool _isModal { get { return !formDesigner ? style.modal : false; } }
c = strlen(string)-1;
for( ; c >= 0; c--)
{
- if(string[c] != '0')
+ if(string[c] != '0')
last = Max(last, c);
if(string[c] == '.')
{
c._vTbl = new void *[c.vTblSize];
memcpy(c._vTbl, wc.pureVTbl, c.vTblSize * sizeof(void *));
sc = eSystem_FindClass(c.module.application, className);
-
+
if(vTbl)
{
for(m = 0; m < c.base.vTblSize; m++)
c._vTbl[m] = sc._vTbl[m];
}
}
-
+
for(d = c.derivatives.first; d; d = d.next)
{
ApplySkin(d.data, name, c._vTbl);
virtual void V::OnUnloadGraphics(WindowController controller);
private:
- int (** windowVTbl)();
+ int (** windowVTbl)();
V controlled;
Window window;
buttonStyle.offset = true;
// SetCursor(eInterface_GetCursor(__ecereModule->app, CUR_ARROW));
-
+
alignment = center;
state = up;
hint = false;
int isDefault = this.isDefault;
int tw = 0, th = 0;
int bw = 0, bh = 0;
-
+
if(!backColor) backColor = colors[up];
-
+
font = fontObject;
surface.TextFont(font);
if(text)
x, y,
0,0,buttonBitmap.width,buttonBitmap.height);
}
- else
+ else
{
// Push Buttons
if(buttonStyle.scale)
{
if(buttonStyle.bevel || buttonStyle.offset)
- surface.Stretch(buttonBitmap,
+ surface.Stretch(buttonBitmap,
1 + offset, 1 + offset,0,0,
clientSize.w-3,clientSize.h-3,buttonBitmap.width,buttonBitmap.height);
else
int x, y;
bw = buttonBitmap.width;
bh = buttonBitmap.height;
-
+
if(bitmapAlignment == left || bitmapAlignment == right)
{
if(bitmapAlignment == left)
}
// Shadows
- if(buttonStyle.bevel ||
- (buttonStyle.bevelOver &&
+ if(buttonStyle.bevel ||
+ (buttonStyle.bevelOver &&
(state == down || state == over || checked)))
{
if(state == down || checked)
if(text)
{
if((buttonStyle.radio || buttonStyle.checkBox) && !(buttonStyle.bevelOver))
- WriteCaption(surface, /*clientSize.h +*/ CAPTION_DISTANCE + 3,
+ WriteCaption(surface, /*clientSize.h +*/ CAPTION_DISTANCE + 3,
(clientSize.h - th - 4)/2);
- else
+ else
{
int x, y;
{
if(symbol)
{
- tw = textCellW; th = textCellH;
+ tw = textCellW; th = textCellH;
surface.WriteTextf((clientSize.w - tw)/2 + offset, (clientSize.h - th - 2)/2 + offset.%c = symbol);
}
}
{
if(!key)
{
- if( (!buttonStyle.stayDown || !hint) /*&& !buttonStyle.toggle */)
+ if( (!buttonStyle.stayDown || !hint) /*&& !buttonStyle.toggle */)
{
if(!(buttonStyle.toggle) || state == over)
state = up;
// Properties
property bool isRadio
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
if(value)
};
property bool isCheckbox
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
if(value)
};
property bool bevel
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
if(value)
};
property bool bevelOver
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
if(value)
property bool toggle { property_category $"Behavior" set { buttonStyle.toggle = value; } get { return buttonStyle.toggle; } };
property bool checked
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
if(buttonStyle.toggle)
{
state = value ? down : up;
}
- else
+ else
{
if(buttonStyle.radio && value)
{
property Alignment alignment { property_category $"Appearance" set { alignment = value; } get { return alignment; } };
property BitmapResource bitmap
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
AddResource(value);
RemoveResource(bitmaps[overChecked]);
RemoveResource(bitmaps[downChecked]);
RemoveResource(bitmaps[disabledChecked]);
-
+
bitmaps[over] = null;
bitmaps[down] = null;
bitmaps[disabled] = null;
class_property(icon) = "<:ecere>controls/calendar.png";
public:
- virtual void Window::NotifyChanged(bool close);
+ virtual void Window::NotifyChanged(bool close);
Date dateValue;
Month shownMonth;
int shownYear;
dateValue.day = now.day;
dateValue.month = now.month;
shownYear = dateValue.year = now.year;
- shownMonth = dateValue.month;
+ shownMonth = dateValue.month;
}
return true;
}
-
+
RepButton leftArrow
{
- this,
+ this,
position = { 3, 8 };
size = { 16, 16 };
bevel = false;
offset = false;
text = "«";
hotKey = pageUp;
-
+
bool NotifyClicked(Button button, int x, int y, ecere::gui::Modifiers mods)
{
shownMonth--;
if(shownMonth < january) { shownMonth = december; shownYear--; yearBox.Refresh(); }
- monthBox.Refresh();
+ monthBox.Refresh();
Update(null);
dateBox.Activate();
return true;
};
RepButton rightArrow
{
- this,
+ this,
anchor = { right = 8, top = 8 };
size = { 16, 16 };
bevel = false;
dateBox.Activate();
return true;
}
- };
+ };
DataBox monthBox
{
}
return true;
}
-
+
bool OnPostCreate()
{
DataBox::OnPostCreate();
shownYear += (time.year / 100) * 100;
if(Abs(shownYear - time.year) >= 50)
shownYear -= 100;
- yearBox.Refresh();
+ yearBox.Refresh();
}
Update(null);
dateBox.Activate();
{
if(mods.left && !mods.isSideEffect)
((CalendarControl)master).FindDate(x, y, false, false);
- return true;
+ return true;
}
bool OnLeftButtonDown(int x, int y, Modifiers mods)
{
surface.SetBackground(Color { 238, 238, 238 } /*whiteSmoke*/);
surface.Area(0, Height, Width, clientSize.h);
surface.Area(6 * Width, Height, 7*Width, clientSize.h);
-
+
surface.SetForeground(lightGray);
surface.DrawLine(0, Height, clientSize.w, Height);
surface.DrawLine(0, Height, 0, clientSize.h);
}
}
}
- }
+ }
}
};
(type.type == normalClass || type.type == noHeadClass || data))
{
// IMPORTANT FIX: If keepEditor is true, we were passing editor rather than the editor's current master
- editor = ((Window (*)(void *, void *, DataBox, void *, int, int, int, int, void*))(void *)type._vTbl[__ecereVMethodID_class_OnEdit])(type,
- (type.type == normalClass || type.type == noHeadClass) ? (data ? (*(void **)data) : null) : data,
+ editor = ((Window (*)(void *, void *, DataBox, void *, int, int, int, int, void*))(void *)type._vTbl[__ecereVMethodID_class_OnEdit])(type,
+ (type.type == normalClass || type.type == noHeadClass) ? (data ? (*(void **)data) : null) : data,
this, (keepEditor && editor) ? editor.master : this, 0, 0, clientSize.w, clientSize.h, fieldData);// null);
if(editor)
{
public:
property bool activeStipple
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
style.noStipple = !value;
};
property bool showButton
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
button.visible = value;
};
property Alignment alignment
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
alignment = value;
};
property bool noHighlight
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
if(this)
};
property bool activeColor
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
if(this)
};
property DataRow currentRow
{
- property_category $"Private"
+ property_category $"Private"
set
{
if(this)
editBox.contents = ((char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
else
editBox.contents = "";
- }
+ }
Update(null);
if(style.editText)
{
property char * contents { property_category $"Data" set { if(editBox) editBox.contents = value; } get { return editBox ? editBox.contents : null; } };
property bool editText
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
if(this)
incref editBox;
editBox.Create();
button.inactive = false;
- }
+ }
style.editText = true;
tabCycle = false;
}
property int rowHeight { property_category $"Appearance" set { listBox.rowHeight = value; } get { return listBox.rowHeight; } };
property int maxShown
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
listBoxMaxShown = value;
ResizeListbox();
// listBox.visible = true;
- return listBox;
+ return listBox;
}
virtual void OnCloseDropDown(Window pullDown)
{
if(!field)
field = DataField { alignment = alignment };
-
+
listBox.AddField(field);
this.field = listBox.firstField;
dataType = this.field.dataType;
editBox.contents = ((char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
else
editBox.contents = "";
- }
+ }
listBox.SelectRow(currentRow ? currentRow : (style.showNone ? noneRow : null));
Update(null);
if(ly + height > availHeight)
height = ((availHeight - ly) / ROW_HEIGHT) * ROW_HEIGHT;
}
-
+
if(!pulledWindow.initSize.w)
pulledWindow.size.w = size.w;
else
OnPosition(position.x, position.y, clientSize.w, clientSize.h);
if(pulledWindow) pulledWindow.visible = true;
button.checked = true;
- }
- Update(null);
+ }
+ Update(null);
return false;
case enter:
case keyPadEnter:
pulledWindow = null;
button.checked = false;
Update(null);
-
+
if(!NotifyClose(master, this))
{
delete this;
editBox.contents = ((char *(*)(void *, void *, char *, void *, bool *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, currentRow.GetData(null), tempString, null, null);
else
editBox.contents = "";
- }
+ }
NotifySelect(master, this, currentRow, key.modifiers | { closingDropDown = true });
-
- delete this;
+
+ delete this;
return false;
}
return false;
button.anchor = { right = 0, top = 0, bottom = 0 };
button.size = { guiApp.textMode ? 8 : BTN_WIDTH, 0 };
}
-
+
/*Timer timer
{
window = this, delay = 0.01;
if(currentRow)
{
DataDisplayFlags displayFlags { active = active, current = true, dropBox = true, selected = true, fullRow = true };
- ((void (*)(void *, void *, void *, int, int, int, void *, uint, uint))(void *)dataType._vTbl[__ecereVMethodID_class_OnDisplay])(dataType, currentRow.GetData(null), surface, 3,
- 1+(clientSize.h - listBox.rowHeight) / 2, clientSize.w - (button.visible ? button.size.w : 0) - 3,
+ ((void (*)(void *, void *, void *, int, int, int, void *, uint, uint))(void *)dataType._vTbl[__ecereVMethodID_class_OnDisplay])(dataType, currentRow.GetData(null), surface, 3,
+ 1+(clientSize.h - listBox.rowHeight) / 2, clientSize.w - (button.visible ? button.size.w : 0) - 3,
field.userData, alignment, displayFlags);
}
else
{
int rowHeight = 0;
- display.FontExtent(fontObject, "W", 1, null, &rowHeight);
+ display.FontExtent(fontObject, "W", 1, null, &rowHeight);
rowHeight = Max(rowHeight, 16);
if(!*width) *width = Max(*width, rowHeight * 100 / 16);
OnCloseDropDown(pulledWindow);
button.checked = false;
pulledWindow = null;
-
+
if(!NotifyClose(master, this))
return false;
}
bool OnKeyHit(Key key, unichar ch)
{
DataRow currentRow = this.currentRow;
-
+
if(!pulledWindow /*listBox.visible*/)
{
int c;
editBox.contents = "";
if(active)
editBox.SelectAll();
- }
+ }
button.Deactivate();
return NotifySelect(master, this, currentRow, mods);
}
bool recomputeSyntax:1;
bool cursorFollowsView:1;
-
+
// bool lineNumbers:1;
bool autoSize:1;
};
delete ((ArrayImpl)this).array;
}
-public:
+public:
Class type;
property uint size
{
{
if(((ArrayImpl)this).array)
{
- if(value == size)
+ if(value == size)
return;
((ArrayImpl)this).array = renew0 ((ArrayImpl)this).array byte[type.typeSize * value];
}
{
actions.Free();
}
-
+
void Undo()
{
dontRecord++;
#ifdef _DEBUG
void Print(EditBox editBox)
{
- PrintLn("DelText: y1 = ", y1, "x1 = ", x1, ", y2 = ", y2, ", x2 = ", x2, ", string = ", string, ", addedSpaces = ", addedSpaces, ", placeAfter = ", placeAfter);
+ PrintLn("DelText: y1 = ", y1, "x1 = ", x1, ", y2 = ", y2, ", x2 = ", x2, ", string = ", string, ", addedSpaces = ", addedSpaces, ", placeAfter = ", placeAfter);
}
#endif
void Undo(EditBox editBox)
editBox.DelCh(editBox.line, y1, x1 - addedSpaces, editBox.line, y1, x1, false);
}
else
- {
+ {
editBox.selY = y1;
editBox.selX = x1;
- { int c; editBox.selLine = editBox.lines.first; for(c = 0; c < editBox.selY && editBox.selLine; c++, editBox.selLine = editBox.selLine.next); }
+ { int c; editBox.selLine = editBox.lines.first; for(c = 0; c < editBox.selY && editBox.selLine; c++, editBox.selLine = editBox.selLine.next); }
//editBox.SetViewToCursor(true);
if(addedSpaces)
#ifdef _DEBUG
void Print(EditBox editBox)
{
- PrintLn("ReplaceText: y1 = ", y1, "x1 = ", x1, ", y2 = ", y2, ", x2 = ", x2, ", y3 = ", y3, ", x3 = ", x3, ", oldString = ", oldString, ", newString = ", newString, ", addedSpaces = ", addedSpaces, ", addedTabs = ", addedTabs, ", placeAfter = ", placeAfter);
+ PrintLn("ReplaceText: y1 = ", y1, "x1 = ", x1, ", y2 = ", y2, ", x2 = ", x2, ", y3 = ", y3, ", x3 = ", x3, ", oldString = ", oldString, ", newString = ", newString, ", addedSpaces = ", addedSpaces, ", addedTabs = ", addedTabs, ", placeAfter = ", placeAfter);
}
#endif
void Undo(EditBox editBox)
/*
static class MoveTextAction : UndoAction
{
- int fy1, fx1, fy2, fx2;
+ int fy1, fx1, fy2, fx2;
int ty, tx;
type = class(MoveTextAction);
{
char * buffer;
int newSize;
-
+
// Adds '\0' byte
count = count+1;
if(y > end.y)
y -= end.y - start.y;
// Location is the last touched line
- else
+ else
{
if(x >= end.x)
{
for(c = 0, line = start.line; c<numLines; c++)
line = line.next;
y += numLines;
- //x += numLines ? end.x : (end.x - start.x);
+ //x += numLines ? end.x : (end.x - start.x);
x += end.x - start.x;
}
}
property bool textVertScroll { property_category $"Behavior" set { style.vScroll = value; } get { return style.vScroll; } };
property bool readOnly
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
style.readOnly = value;
property EditLine line { get { return this.line; } }; // TODO: Add Set this.line = this.lines[10]
property char * contents
{
- property_category $"Data"
+ property_category $"Data"
set
{
if(this)
/* Can't implement this right now because of memory leak... Need string reference counting...
if(style.multiLine)
{
-
+
EditLine line;
int len = 0;
char * buffer = null;
if(style.multiLine)
{
-
+
EditLine line;
int len = 0;
len += lineLen;
if(line.next) buffer[len++] = '\n';
}
- buffer[len] = '\0';
+ buffer[len] = '\0';
}
return buffer;
}
int lineCount;
// Font Space size
Size space, large;
-
+
// Position of Caret (Not necessarily displayed position)
int x,y;
int col;
// ViewX is x offset in pixels, ViewY is y offset in lines
int viewX, viewY;
// viewLine is first displayed line
- EditLine viewLine;
+ EditLine viewLine;
// start and end of area to redraw
int startY, endY;
MenuItem itemEditPaste
{
editMenu, $"Paste\tCtrl+V", p;
-
+
bool NotifySelect(MenuItem item, Modifiers mods)
{
if(!(style.readOnly))
{
ReplaceDialog dialog
{
- master = master,
+ master = master,
isModal = true,
searchString = searchString,
replaceString = replaceString,
EditBox()
{
static bool syntaxInit = false;
- if(!syntaxInit)
+ if(!syntaxInit)
{
int g,c;
syntaxInit = true;
maxLineSize = MAXINT;
tabSize = 3;
-
+
overwrite = false;
mouseSelect = this.mouseMove = false;
line = null;
col = 0;
y = -1;
line = selLine = null;
- viewX = 0;
+ viewX = 0;
viewY = 0;
maxLength = 0;
maxLine = null;
surface.Area(XOFFSET + *x - 1, y, XOFFSET + *x + w, y + space.h-1);
// WHATS UP WITH THIS... surface.Area(XOFFSET + *x, y, XOFFSET + *x + w, y + space.h-1);
*x += w;
- }
+ }
}
*renderStart = wc;
}
}
- int CheckColors(EditLine line, int wc, bool selection, int selX, int editX, bool *selected,
+ int CheckColors(EditLine line, int wc, bool selection, int selX, int editX, bool *selected,
Color selectionForeground, Color selectionBackground, Color textColor, Color *foreground, Color *background, bool *opacity, bool *overwrite)
{
bool flush = false;
}
continuedSingleLineComment = inSingleLineComment && (line.count && line.text[line.count - 1] == '\\');
}
-
+
style.continuedSingleLineComment = continuedSingleLineComment;
style.inMultiLineComment = inMultiLineComment;
style.wasInMultiLine = wasInMultiLine;
style.escaped = escaped;
}
}
-
+
/*void OnDrawOverChildren(Surface surface)
{
if(style.lineNumbers)
else
surface.SetBackground(Color{230, 230, 230});
surface.textOpacity = true;
-
+
sprintf(lineText,"%5u ", currentLineNumber % 100000);
if(currentLineNumber > this.lineCount)
surface.WriteText(0,i*space.h+1," ",6);
else
surface.WriteText(0,i*space.h+1,lineText,6);
-
+
currentLineNumber++;
}
}
Color textColor;
Box box;
int maxW = clientSize.w;
-
+
Color foreground, background;
bool opacity;
textColor = defaultTextColor;
if(
- Abs(selectionBackground.r - property::background.r) +
- Abs(selectionBackground.g - property::background.g) +
+ Abs(selectionBackground.r - property::background.r) +
+ Abs(selectionBackground.g - property::background.g) +
Abs(selectionBackground.b - property::background.b) < 92)
{
selectionBackground = formColor;
selX = this.selX;
}
else
- {
+ {
editX = Min(this.x,this.line.count);
selX = Min(this.selX,this.selLine.count);
}
int start = 0;
Color newTextColor = textColor = defaultTextColor;
bool lineComplete = false;
-
+
// ****** SYNTAX HIGHLIGHTING ******
bool lastWasStar = false;
surface.SetBackground(selected ? SELECTION_COLOR|0xFF000000 : BLACK|0xFF000000);
}
*/
-
+
if(line == this.selLine && line == this.line)
{
end = Max(line.count, this.x);
y += space.h;
lineComplete = false;
}
-
+
textColor = newTextColor;
if(!selected)
{
unichar bf = (wordLen == 1) ? line.buffer[c-1] : 0;
//if(ch == ' ' || ch == '\t' || (wordLen && (ch == '(' || ch == ')' || ch == ';' || ch == ':')) || (wordLen == 1 && line.buffer[c-1] == '('))
if(CharMatchCategories(ch, separators) || /*ch == ' ' ||*/ ch == '\t' ||
- (wordLen && !CharMatchCategories(ch, numbers|letters|marks|connector) && ch != '#' /*&& ch != '_'*/) ||
+ (wordLen && !CharMatchCategories(ch, numbers|letters|marks|connector) && ch != '#' /*&& ch != '_'*/) ||
(bf && !CharMatchCategories(bf, numbers|letters|separators|marks|connector) && bf != '#' && bf != '\t' /*&& bf != '_' && bf != ' '*/))
break;
wordLen++;
if(!wordLen)
{
-
+
for(; c<line.count; c++)
{
unichar ch = line.buffer[c];
if(firstWord)
{
inPrep = true;
- newTextColor = colorScheme.preprocessorColor;
+ newTextColor = colorScheme.preprocessorColor;
}
}
if(!inQuotes && !inString && !inMultiLineComment && !inSingleLineComment)
}
}
}
-
+
// If we're not breaking, this can't be rendered as spacing anymore
spacing = false;
surface.Area(x + XOFFSET - 1,y,clientSize.w-1,y+this.space.h-1);
}
*/
-
+
continuedSingleLineComment = inSingleLineComment && (line.count && line.text[line.count - 1] == '\\');
y+=this.space.h;
- if(y > box.bottom) // >=clientSize.h)
+ if(y > box.bottom) // >=clientSize.h)
break;
}
len = 1;
}
else
- FontExtent(display, font, line.buffer + start, len, &w, null);
+ FontExtent(display, font, line.buffer + start, len, &w, null);
}
else
{
c++;
}
x += w;
- }
+ }
line.length = x;
if(line.length > this.maxLength)
{
if(this.selY != this.y)
DirtyAll();
- else if(this.selX != this.x) // commented out to erase caret: if(this.selX != this.x)
+ else if(this.selX != this.x) // commented out to erase caret: if(this.selX != this.x)
DirtyLine(this.y);
}
{
return _DelCh(l1, y1, c1, l2, y2, c2, placeAfter, null);
}
-
+
bool HasCommentOrEscape(EditLine line)
{
bool hadComment = strstr(line.buffer, "/*") || strstr(line.buffer, "*/");
int c;
-
+
if(!hadComment)
{
for(c = line.count-1; c >= 0; c--)
}
return hadComment;
}
-
+
int _DelCh(EditLine l1, int y1, int c1, EditLine l2, int y2, int c2, bool placeAfter, int * addedSpacesPtr)
{
EditLine line = l1, next;
{
byte ch = buffer[c1];
if(UTF8_IS_FIRST(ch)) break;
- c1--;
+ c1--;
extras++;
}
oldCount2 = l2.count;
{
int len;
char * string;
-
+
len = GetText(null, l1, y1, start, l2, y2, c2, false, false);
string = new char[len];
action = DelTextAction { y1 = y1, x1 = start, y2 = y2, x2 = c2, string = string, placeAfter = placeAfter };
else
buffer = l2.buffer;
- if(!line.AdjustBuffer(newLineCount))
+ if(!line.AdjustBuffer(newLineCount))
return;
#ifdef _DEBUG
{
this.lineCount--;
delete line.buffer;
-
+
if(line == this.viewLine)
{
if(this.viewLine.next)
//this.viewY++;
style.recomputeSyntax = true;
}
- else
+ else
{
this.viewLine = this.viewLine.prev;
this.viewY--;
this.x = this.line.count;
//this.y++;
}
- else
+ else
{
this.line = this.line.prev;
this.x = this.line.count;
this.dropLine = this.dropLine.next;
this.dropX = this.dropLine.count;
}
- else
+ else
{
this.dropLine = this.dropLine.prev;
this.dropX = this.dropLine.count;
this.selLine = this.selLine.next;
this.selX = this.selLine.count;
}
- else
+ else
{
this.selLine = this.selLine.prev;
this.selX = this.selLine.count;
bool hadComment = false;
// Add the line here
EditLine line = this.line;
-
+
// The purpose of this is solely to lock a max number of characters if no HSCROLLING is present
if(!style.hScroll && created)
{
}
x += w;
- if(x >= clientSize.w)
+ if(x >= clientSize.w)
{
count = c - max;
break;
{
int addedSpaces = 0;
int addedTabs = 0;
-
+
// Add blank spaces if EES_FREECARET
if(this.x > line.count)
{
{
BufferLocation before = { this.line, this.y, this.x }, after = { this.line, this.y, this.x };
bool hasComment;
-
+
memmove(line.buffer+this.x+count, line.buffer+this.x,line.count-this.x);
CopyBytes(line.buffer + this.x + addedTabs + addedSpaces, stringLine, count);
if(addedTabs)
#endif
line.count += addedSpaces;
if(addedSpacesPtr) *addedSpacesPtr = addedSpaces;
- }
+ }
else if(addedSpacesPtr)
*addedSpacesPtr = 0;
#ifdef _DEBUG
ComputeLength(line);
ComputeColumn();
- after.x = this.x;
+ after.x = this.x;
hasComment = HasCommentOrEscape(line);
if(!undoBuffer.insideRedo)
this.endY = clientSize.h-1;
//ErrorLog("DirtyEnd %d\n", y);
}
-
+
void DirtyLine(int y)
{
if(y >= this.viewY)
len = 1;
}
else
- FontExtent(display, this.font, line.buffer + start, len, &w, null);
+ FontExtent(display, this.font, line.buffer + start, len, &w, null);
}
else
{
c++;
}
x += w;
- }
+ }
}
if(setCaret)
caretX = x;
len = 1;
}
else
- FontExtent(display, font, line.buffer + start, len, &w, null);
+ FontExtent(display, font, line.buffer + start, len, &w, null);
}
- else
+ else
{
if(style.freeCaret && c < max)
w = space.w;
- else
+ else
{
if(px) *px = x;
return c;
}
c++;
}
- if(x + (((half && len == 1) ? (w / 2) : w)) >= position)
+ if(x + (((half && len == 1) ? (w / 2) : w)) >= position)
{
int lastW;
while(len > 0)
if(this.x < c)
this.x = x;
else
- {
+ {
c = AdjustXPosition(line, viewX + clientSize.w - 1, false, &x, MAXINT, c);
if(this.x > c)
this.x = c;
{
int c, numLines;
EditLine oldLine = this.line;
-
+
bool selecting = this.x != this.selX || this.y != this.selY;
numLines = clientSize.h / this.space.h;
popup = PopupMenu { master = this, menu = contextMenu,
/*
- nonClient = true, interim = false, parent = parent,
+ nonClient = true, interim = false, parent = parent,
position = { x + clientStart.x + parent.clientStart.x + position.x, y + cientStart.y + parent.sy + clientStart.y + position.y };
*/
position = { x + clientStart.x + absPosition.x - guiApp.desktop.position.x, y + clientStart.y + absPosition.y - guiApp.desktop.position.y }
}
ComputeColumn();
}
-
+
UpdateDirty();
UpdateCaretPosition(true);
return true;
mouseSelect = false;
wordSelect = false;
-
+
x -= XOFFSET;
-
+
ReleaseCapture();
if(!style.readOnly)
{
EditLine line;
bool needScroll;
- if(mods != -1 && mods.isSideEffect)
- {
- SetSelectCursor();
- return true;
+ if(mods != -1 && mods.isSideEffect)
+ {
+ SetSelectCursor();
+ return true;
}
if(style.noSelect) return true;
if(wordSelect) return true;
{
if(!needScroll)
timer.Stop();
- else
+ else
{
if(needScroll)
timer.Start();
- if(mods != -1 &&
+ if(mods != -1 &&
((style.hScroll) || (style.vScroll)))
return true;
}
if(!IS_ALUNDER(this.line.buffer[i]))
break;
}
-
+
for(; i < this.line.count; i++)
{
//Delete trailing whitespace
Modified();
}
}
- else
+ else
{
if(!(style.freeCaret))
{
if(this.x < this.line.count)
stuffAfter = true;
-
+
//If last character is a { indent one tab
if(this.line.buffer[this.x - 1] == '{')
{
{
byte ch = line.buffer[c];
if(UTF8_IS_FIRST(ch)) break;
- }
+ }
}
- // No next word found,
+ // No next word found,
if(!found && ( this.x > 0 || (!line.count && this.x)))
{
foundAlpha = true;
{
byte ch = buffer[x];
if(UTF8_IS_FIRST(ch)) break;
- }
+ }
}
else
x--;
EditLine line, lastLine;
int y = this.y;
int lastC, lastY, lastNumBytes;
-
+
for(line = this.line; (line && !found); line = line.next, y++)
{
int start = (line == this.line) ? this.x : 0;
lastY = y;
break;
}
- }
+ }
if(found)
{
DirtyLine(this.y);
break;
}
}
- // No next word found,
+ // No next word found,
if(!found && (c != this.x || line != this.line))
{
found = true;
{
byte ch = buffer[x];
if(UTF8_IS_FIRST(ch)) break;
- }
+ }
}
else
x++;
else
{
if(style.stuckCaret) break;
-
+
if(!shift) SelDirty();
DirtyLine(this.y);
this.y--;
this.x = AdjustXPosition(line, caretX, true, null, MAXINT, 0);
}
-
+
DirtyLine(this.y);
if(!shift) _Deselect();
ComputeColumn();
len = (nextSpace - (text + textPos));
else
len = line.count - textPos;
-
+
if(textPos < line.count)
{
display.FontExtent(font, text + textPos, len, &w, null);
return false;
}
*/
-
+
// PREVIOUS CODE
/*
if(this.line.prev)
if(!shift) SelDirty();
DirtyLine(this.y);
-
+
if(style.wrap)
{
/*
if(!shift) _Deselect();
ComputeColumn();
SetViewToCursor(false);
-
+
/*
while(!textPos || (style.freeCaret || textPos<line.count))
{
len = (nextSpace - (text + textPos));
else
len = line.count - textPos;
-
+
if(textPos < line.count)
{
display.FontExtent(font, text + textPos, len, &w, &th);
this.x--;
else
while(this.x > 0 && !UTF8_IS_FIRST(text[--this.x]));
-
+
len = this.x - startPos;
display.FontExtent(font, text + startPos, len, &x, null);
}
-
+
if(!shift) _Deselect();
ComputeColumn();
SetViewToCursor(false);
return false;
- }
+ }
else if(textPos >= line.count && line.next)
{
startPos = 0;
break;
if(shift && (c != 0 || this.x))
DirtyLine(this.y);
- if(this.x != c)
+ if(this.x != c)
this.x = c;
else
this.x = 0;
Record(action);
}
memmove(line.buffer,line.buffer+lastC,line.size-lastC);
- if(!line.AdjustBuffer(line.count-lastC))
+ if(!line.AdjustBuffer(line.count-lastC))
break;
line.count-=lastC;
DirtyLine(y);
{
BufferLocation before = { line, y, 0 }, after = { line, y, 1 };
- if(!line.AdjustBuffer(line.count+1))
+ if(!line.AdjustBuffer(line.count+1))
break;
NotifyCharsAdded(master, this, &before, &after, this.pasteOperation);
BufferLocation before = { line, y, 0 }, after = { line, y, this.tabSize };
NotifyCharsAdded(master, this, &before, &after, this.pasteOperation);
- if(!line.AdjustBuffer(line.count+this.tabSize))
+ if(!line.AdjustBuffer(line.count+this.tabSize))
break;
{
NotifyOvrToggle(master, this, this.overwrite);
}
break;
- case hotKey:
+ case hotKey:
break;
default:
-
+
switch(key)
{
case ctrlA:
//Save current view position
int tempX = this.viewX;
int tempY = this.viewY;
-
+
this.selX = 0;
this.selY = 0;
this.selLine = this.lines.first;
ComputeColumn();
DirtyAll();
SetViewToCursor(true);
-
+
//Restore previous view position
SetScrollPosition(tempX, tempY * this.space.h);
-
+
UpdateDirty();
SetSelectCursor();
SelectionEnables();
int i;
char * newline;
int putsize;
-
+
int indentwidth;
EditLine line = this.line;
-
+
//Only remove one tab if there is nothing else on the line.
for(i = 0; i < this.line.count; i++)
{
return false;
}
}
-
+
//Find opening {
i = 1;
while(i && line)
{
int pos;
-
+
indentwidth = 0;
for(pos = line.count - 1; pos >= 0; pos--)
{
}
line = line.prev;
}
-
+
//Place the } to get an undo:
PutCh(ch);
-
+
this.x = this.line.count;
this.selX = 0;
-
+
if(!style.useTab)
putsize = indentwidth;
else
putsize = indentwidth / this.tabSize + indentwidth % this.tabSize;
-
+
newline = new char[putsize+2];
newline[putsize] = '}';
newline[putsize+1] = '\0';
-
+
i = 0;
if(style.useTab)
for(; i < indentwidth / this.tabSize; i++)
newline[i] = '\t';
for(;i < putsize; i++)
newline[i] = ' ';
-
+
AddS(newline);
-
+
delete newline;
}
return false;
for(; position > this.viewY && this.viewLine.next; this.viewLine = this.viewLine.next, this.viewY++);
FigureStartSyntaxStates(oldViewLine, false);
}
-
+
if(action != setRange)
{
if(!this.mouseMove && style.cursorFollowsView && !SelSize()) SetCursorToViewY();
int numLines = clientSize.h / this.space.h;
int y;
if(Abs(this.viewY - oldViewY) < numLines)
-
-
+
+
if(this.viewY > oldViewY)
{
for(y = oldViewY; y <this.viewY; y++)
Box box { 0,0, clientSize.w-1, YOFFSET-1 };
Update(box);
}
-
+
UpdateDirty();
}
int addedSpaces = 0, addedTabs = 0;
if(ch == '\r') return true;
- if(style.stuckCaret /*|EES_READONLY)*/ )
+ if(style.stuckCaret /*|EES_READONLY)*/ )
GoToEnd(true);
-
+
if(ch == '\n' && !(style.multiLine) && this.line) return false;
-
+
if(!undoBuffer.dontRecord)
{
if(selX != x || selY != y)
length = this.line.count - endX;
}
}
- if(!line.AdjustBuffer(length))
+ if(!line.AdjustBuffer(length))
return false;
if(this.line)
{
this.pasteOperation = true;
- if(style.stuckCaret /*|EES_READONLY)*/ )
+ if(style.stuckCaret /*|EES_READONLY)*/ )
GoToEnd(true);
if(!undoBuffer.dontRecord)
if(!style.multiLine)
{
int i;
- char ch;
+ char ch;
for(i = 0; (ch = placeString[i]); i++)
if(ch == '\n')
{
break;
}
}
-
+
if(selX != x || selY != y)
{
char * newString;
action = AddTextAction { y1 = y, x1 = Min(this.line.count, x), string = placeString };
else
action = AddTextAction { y1 = y, x1 = x, string = placeString };
-
+
Record(action);
}
else
count = 0;
line = string+c+1;
/*
- if(string[c] == '\r' && *line == '\n')
+ if(string[c] == '\r' && *line == '\n')
{
line++;
c++;
void PutCh(unichar ch)
{
bool result;
-
+
if((ch >= 32 /*&& ch <=126*/) || ch == '\n')
//if((ch >= 32) || ch == '\n')
{
replaceAction.y3 = y;
replaceAction.addedSpaces = addedSpaces;
replaceAction.addedTabs = addedTabs;
- }
+ }
if(addCharAction)
{
addCharAction.x -= addedTabs * (tabSize-1);
FixScrollArea();
selected = selX != this.x || selY != y;
-
+
viewX = this.viewX;
viewY = this.viewY;
}
}
- if(!dontScroll)
+ if(!dontScroll)
{
if(style.vScroll)
{
for(;dropLine && dropLine.prev && dropY >= numLines;)
{
dropLine = dropLine.prev;
- dropY--;
+ dropY--;
}
else
for(;this.line && this.line.prev && this.y >= numLines;)
{
this.line = this.line.prev;
- y--;
+ y--;
}
}
{
int c, numLines;
EditLine line;
-
+
if(this.y == 0) return;
numLines = clientSize.h / this.space.h;
//DirtyAll();
// this.viewLine = this.viewLine.next;
// this.viewY++;
-
+
SetScrollPosition(this.viewX, (this.viewY + 1) * this.space.h);
}
}
}
nx1 = Min(x1,l1.count);
nx2 = Min(x2,l2.count);
-
+
// Find Number of Bytes Needed
size = 0;
for(line = l1; line; line = line.next)
- {
+ {
if(line == l1) start = nx1; else start = 0;
if(line == l2) end = nx2; else end = line.count;
size += end-start;
// Copy text
for(line = l1; line; line = line.next)
- {
+ {
if(line == l1) start = nx1; else start = 0;
if(line == l2) end = nx2; else end = line.count;
if(text)
{
CopyBytes(text, line.buffer + start, end - start);
text += end-start;
- }
+ }
numChars += end-start;
-
+
if(style.freeCaret && line == l2 && addSpaces)
{
if(l1 == l2)
if(text)
*(text++) = '\r';
numChars++;
- }
+ }
if(text)
*(text++) = '\n';
- numChars++;
+ numChars++;
}
// '\0' terminate Terminate
if(text)
ClipBoard clipBoard { };
if(clipBoard.Allocate(size+1))
{
- GetSel(clipBoard.memory, true);
+ GetSel(clipBoard.memory, true);
// Save clipboard
clipBoard.Save();
}
savedAction = undoBuffer.curAction;
for(line = this.lines.first; line; line = line.next)
- {
+ {
f.Write(line.buffer, line.count,1);
if(line.next)
{
if(f)
{
char buffer[BUFFER_SIZE];
-
+
for(;;)
{
int count = f.Read(buffer, 1, BUFFER_SIZE-1);
{
char * string;
- if(!line)
+ if(!line)
{
if(isSearchDown)
{
result = wrapped;
}
}
-
+
if(isSearchDown)
string = SearchString(line.buffer, firstPass ? Min(this.x,line.count) : 0,text,matchCase,matchWord);
else
{
Select((void *)line,num,string - line.buffer,(void *)line,num,string - line.buffer + strlen(text));
return result;
- }
+ }
if(line == this.line && !firstPass) break;
if(isSearchDown)
{
Select((void *)line,y,string - line.buffer,(void *)line,y,string - line.buffer + strlen(text));
return found;
- }
+ }
}
return notFound;
}
#endif
if(!NotifyKeyDown(master, this, key, ch))
return false;
- else
+ else
{
switch(key)
{
y++;
}
else
- break;
+ break;
}
editBox.line = editBox.selLine = line;
}
return result;
}
-
+
bool Puts(char * string)
{
EditBox editBox = this.editBox;
BufferLocation start { editBox.line, editBox.y, editBox.x };
BufferLocation pos;
-
+
numBytes = 0;
editBox.AddS(string);
}
return true;
}
- return false;
+ return false;
}
bool Getc(char * ch)
public:
property Window labeledWindow
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
Size size;
};
property bool isGroupBox
- {
- property_category $"Appearance"
+ {
+ property_category $"Appearance"
set
{
isGroupBox = value;
inactive = !value;
- }
+ }
get { return isGroupBox; }
};
private:
-public class DataField
+public class DataField
{
public:
property Class dataType
set
{
userData = value;
- }
+ }
get
{
return this ? userData : null;
};
property bool freeData
{
- set { freeData = value; } get { return freeData; }
+ set { freeData = value; } get { return freeData; }
};
property DataField prev { get { return prev; } };
property DataField next { get { return next; } };
listBox.fields.Remove(this);
for(field = listBox.fields.first; field; field = field.next)
{
- if(field.index >= index)
+ if(field.index >= index)
field.index--;
}
if(listBox.currentField == this)
- listBox.currentField = null;
+ listBox.currentField = null;
listBox.numFields--;
listBox.OnResize(listBox.clientSize.w, listBox.clientSize.h);
listBox = null;
if(!listBox.clickedRow)
listBox.clickedRow = this;
}
- if(listBox.currentRow && !listBox.currentRow.parent.IsExpanded())
+ if(listBox.currentRow && !listBox.currentRow.parent.IsExpanded())
{
listBox.SetCurrentRow(this, true);
}
- if(listBox.firstRowShown && !listBox.firstRowShown.parent.IsExpanded())
+ if(listBox.firstRowShown && !listBox.firstRowShown.parent.IsExpanded())
{
listBox.firstRowShown = GetPrevRow();
if(!listBox.firstRowShown)
listBox.SetScrollArea(
listBox.width,
- (listBox.rowCount * listBox.rowHeight) +
+ (listBox.rowCount * listBox.rowHeight) +
((listBox.style.header) ? listBox.rowHeight : 0) -
((!((listBox.clientSize.h+1) % listBox.rowHeight)) ? listBox.rowHeight : 0), true);
listBox.Update(null);
listBox.HideEditBox(false, false, true);
/*
- if(this == listBox.clickedRow)
+ if(this == listBox.clickedRow)
{
listBox.clickedRow = GetNextRow();
if(!listBox.clickedRow)
listBox.clickedRow = GetPrevRow();
}
- if(this == listBox.currentRow)
+ if(this == listBox.currentRow)
{
DataRow newCurrentRow = GetNextRow();
if(!listBox.newCurrentRow)
listBox.SetCurrentRow(newCurrentRow, true);
}
- if(this == listBox.firstRowShown)
+ if(this == listBox.firstRowShown)
{
listBox.firstRowShown = GetPrevRow();
if(!listBox.firstRowShown)
listBox.SetScrollArea(
listBox.width,
- (listBox.rowCount * listBox.rowHeight) +
+ (listBox.rowCount * listBox.rowHeight) +
((listBox.style.header) ? listBox.rowHeight : 0) -
((!((listBox.clientSize.h+1) % listBox.rowHeight)) ? listBox.rowHeight : 0), true);
if(listBox.style.autoScroll)
if(!after || after.index < index)
{
- if(after == listBox.firstRowShown.prev)
+ if(after == listBox.firstRowShown.prev)
listBox.firstRowShown = this;
// All rows between AFTER (exclusive) and ROW (exclusive) are incremented by one
break;
if(field)
{
- int size = (field.dataType && field.dataType.typeSize) ?
+ int size = (field.dataType && field.dataType.typeSize) ?
(sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
ListBoxCell cell = (ListBoxCell)new0 byte[size];
row.cells.Add(cell);
listBox.rowCount++;
for(search = row.GetNextRow(); search; search = search.GetNextRow())
- search.index++;
+ search.index++;
listBox.SetScrollArea(
listBox.width,
- (listBox.rowCount * listBox.rowHeight) +
+ (listBox.rowCount * listBox.rowHeight) +
((listBox.style.header) ? listBox.rowHeight : 0) -
((!((listBox.clientSize.h+1) % listBox.rowHeight)) ? listBox.rowHeight : 0), true);
if(listBox.style.autoScroll)
int result = 0;
ListBoxCell cell1, cell2;
uint index;
- for(index = 0, cell1 = cells.first, cell2 = b.cells.first;
- index != sortField.index;
+ for(index = 0, cell1 = cells.first, cell2 = b.cells.first;
+ index != sortField.index;
index++, cell1 = cell1.next, cell2 = cell2.next);
/*
if(!cell1.isSet && !cell2.isSet)
{
if(sortField.dataType.type == normalClass || sortField.dataType.type == noHeadClass)
{
- result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType,
- (cell1.isSet && cell1.data) ? cell1.data[0] : null,
+ result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType,
+ (cell1.isSet && cell1.data) ? cell1.data[0] : null,
(cell2.isSet && cell2.data) ? cell2.data[0] : null);
}
else
{
- result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType,
- cell1.isSet ? cell1.data : null,
+ result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType,
+ cell1.isSet ? cell1.data : null,
cell2.isSet ? cell2.data : null);
}
}
{
DataRow row;
// Find Next row
- if(subRows.first && !collapsed)
+ if(subRows.first && !collapsed)
row = subRows.first;
- else
+ else
{
for(row = this; row; row = row.parent)
{
property int rowHeight
{
- property_category $"Appearance"
+ property_category $"Appearance"
isset { return style.heightSet; }
set
{
};
property Seconds typingTimeout
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
typedString[0] = '\0';
property bool hasClearHeader { property_category $"Appearance" set { style.clearHeader = value; if(value) property::hasHeader = true; } get { return style.clearHeader; } };
property bool hasHeader
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
if(value && !style.header)
style.header = value;
}
get { return style.header; }
- };
+ };
property bool multiSelect { property_category $"Behavior" set { style.multiSelect = value; } get { return style.multiSelect; } };
property bool alwaysEdit { property_category $"Behavior" set { style.alwaysEdit = value; } get { return style.alwaysEdit; } };
property bool fullRowSelect { property_category $"Appearance" set { style.fullRowSelect = value; } get { return style.fullRowSelect; } };
property bool noDragging { property_category $"Behavior" set { style.noDragging = value; } get { return style.noDragging; } };
property bool fillLastField
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
style.fillLastField = value;
virtual bool Window::NotifyResized(ListBox listBox, DataField field, Modifiers mods);
virtual bool Window::NotifyCollapse(ListBox listBox, DataRow row, bool collapsed);
virtual bool Window::NotifyKeyHit(ListBox listBox, DataRow row, Key key, unichar ch);
- virtual bool Window::NotifyModified(ListBox listBox, DataRow row);
+ virtual bool Window::NotifyModified(ListBox listBox, DataRow row);
virtual bool Window::NotifyEditing(ListBox listBox, DataRow row);
#ifdef _DEBUG
incref addedField;
addedField.listBox = this;
fields.Add(addedField);
-
+
addedField.sortOrder = 1;
addedField.index = numFields;
numFields++;
field = addedField;
for(row = rows.first; row; )
{
- int size = (field.dataType && field.dataType.typeSize) ?
+ int size = (field.dataType && field.dataType.typeSize) ?
(sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
ListBoxCell cell = (ListBoxCell)new0 byte[size];
row.cells.Add(cell);
FillBytes(cell.data, 0, size - (uint)&((ListBoxCell)0).data);
cell.isSet = false;
- if(row.subRows.first)
+ if(row.subRows.first)
row = row.subRows.first;
- else
+ else
{
for(; row; row = row.parent)
{
delete cell;
}
- if(row.subRows.first)
+ if(row.subRows.first)
row = row.subRows.first;
- else
+ else
{
for(; row; row = row.parent)
{
row.listBox = this;
for(search = row.GetNextRow(); search; search = search.GetNextRow())
- search.index++;
+ search.index++;
this.rowCount++;
row.cells.Clear();
-
+
firstRowShown = row;
SetScrollArea(
width,
- (rowCount * rowHeight) +
+ (rowCount * rowHeight) +
((style.header) ? rowHeight : 0) -
((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
if(style.autoScroll)
break;
if(field)
{
- int size = (field.dataType && field.dataType.typeSize) ?
+ int size = (field.dataType && field.dataType.typeSize) ?
(sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
ListBoxCell cell = (ListBoxCell) new0 byte[size];
row.cells.Add(cell);
if(rowHeight)
SetScrollArea(
width,
- (rowCount * rowHeight) +
+ (rowCount * rowHeight) +
((style.header) ? rowHeight : 0) -
((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
if(style.autoScroll)
row.listBox = this;
for(search = row.GetNextRow(); search; search = search.GetNextRow())
- search.index++;
+ search.index++;
this.rowCount++;
row.cells.Clear();
break;
if(field)
{
- int size = (field.dataType && field.dataType.typeSize) ?
+ int size = (field.dataType && field.dataType.typeSize) ?
(sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
ListBoxCell cell = (ListBoxCell) new0 byte[size];
row.cells.Add(cell);
SetScrollArea(
width,
- (rowCount * rowHeight) +
+ (rowCount * rowHeight) +
((style.header) ? rowHeight : 0) -
((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
if(style.autoScroll)
if(row.parent.IsExpanded())
{
for(search = row.GetNextRow(); search; search = search.GetNextRow())
- search.index--;
+ search.index--;
this.rowCount--;
}
HideEditBox(false, false, true);
- if(row == clickedRow)
+ if(row == clickedRow)
{
clickedRow = row.GetNextRow();
if(!clickedRow)
clickedRow = row.GetPrevRow();
}
- if(row == currentRow)
+ if(row == currentRow)
{
DataRow newCurrentRow = row.GetNextRow();
if(!newCurrentRow)
SetCurrentRow(newCurrentRow, true);
}
- if(row == firstRowShown)
+ if(row == firstRowShown)
{
firstRowShown = row.GetPrevRow();
if(!firstRowShown)
SetScrollArea(
this.width,
- (this.rowCount * rowHeight) +
+ (this.rowCount * rowHeight) +
((style.header) ? rowHeight : 0) -
((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
if(this)
{
DataRow row = null;
-
+
for(row = rows.first; row; row = row.next)
{
if(!row.noneRow && row.tag == tag)
HideEditBox(false, true, false);
editData.Destroy(0);
-
+
firstRowShown = currentRow = null;
ClearEx();
-
+
if(master)
{
if(style.freeSelect)
if(style.alwaysEdit && currentRow)
currentRow.Edit(currentField);
-
+
this.rowCount = 0;
-
+
SetScrollArea(
this.width,
- (this.rowCount * rowHeight) +
+ (this.rowCount * rowHeight) +
((style.header) ? rowHeight : 0) -
((rowHeight && !((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
Update(null);
if(*row)
{
if(!*field) *field = this ? currentField : null;
- if(!*field && this)
+ if(!*field && this)
{
for(*field = fields.first; (*field).index != 0; *field = (*field).next);
}
if(editData && editData.visible)
{
Class dataType = currentField.dataType;
- if(save)
+ if(save)
editData.SaveData();
-
+
editData.visible = false;
NotifyEditDone(master, this, currentRow);
int height = rowHeight - (style.alwaysEdit ? 1 : 0);
int y = currentRow.index * rowHeight + (style.header ? rowHeight : 0);
int x = currentField.x;
- int width = (!currentField.next && style.fillLastField && (!hasHorzScroll || clientSize.w - currentField.x > currentField.width + EXTRA_SPACE)) ?
+ int width = (!currentField.next && style.fillLastField && (!hasHorzScroll || clientSize.w - currentField.x > currentField.width + EXTRA_SPACE)) ?
clientSize.w - currentField.x : (currentField.width + EXTRA_SPACE);
if(!style.alwaysEdit)
}
else
printf("");
-
+
/*else
currentField = null;*/
}
x += 15;
for(field = fields.first; field; field = field.next)
{
- width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(field == currentField) break;
x += width;
for(field = fields.first; field; field = field.next)
{
- width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(field == whichField) break;
x += width;
bool result = DataBox::OnKeyDown(key, ch);
if(visible && active) // Added this check here, because we will not use enter/escape otherwise, and lose DataBox's result
{
- if((SmartKey)key == enter || (SmartKey)key == escape)
+ if((SmartKey)key == enter || (SmartKey)key == escape)
return true;
}
return result;
// Vertical lines
for(field = fields.first; field; field = field.next)
{
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(field.prev && y > 0)
surface.VLine(0, y-1, x);
int y1 = y + PLUSY + 4;
int y2;
DataRow child;
-
+
for(child = row.collapsed ? null : row.subRows.first; child && child != row; )
{
numRows++;
if(sortField && !style.clearHeader && style.header)
{
DataField field = sortField;
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
int tw = 0, th = 0;
if(field.header)
{
bool up = field.sortOrder == 1;
int x = 4, y = 4;
- Box clip =
- {
- field.x + 2 - scroll.x, 0,
+ Box clip =
+ {
+ field.x + 2 - scroll.x, 0,
field.x + width + EXTRA_SPACE - 1 - scroll.x, rowHeight
};
surface.Clip(&clip);
x = field.x + (width + EXTRA_SPACE - tw) / 2 + tw + EXTRA_SPACE + 4;
else
x = field.x + tw + EXTRA_SPACE + 4;
-
+
x = Min(x, field.x + width - 4);
}
else if(field.alignment == right)
surface.PutPixel(x + 1, y + 5);
surface.PutPixel(x + 1, y + 3);
surface.PutPixel(x + 2, y + 1);
-
+
surface.SetForeground(white);
surface.DrawLine(x + 4, y, x + 7, y + 5);
surface.PutPixel(x + 6, y + 5);
surface.PutPixel(x + 1, y+1);
surface.PutPixel(x + 1, y+3);
surface.PutPixel(x + 2, y+5);
-
+
surface.SetForeground(white);
surface.DrawLine(x + 4, y+6, x + 7, y+1);
surface.PutPixel(x + 6, y+1);
SetScrollArea(
width,
- (rowCount * rowHeight) +
+ (rowCount * rowHeight) +
((style.header) ? rowHeight : 0) -
((!((clientSize.h+1) % rowHeight)) ? rowHeight : 0), true);
for(field = fields.first; field; field = field.next)
{
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(style.header && field.headButton)
{
// false: dont destroy edit box
HideEditBox(true, false, true);
if(style.resizable && ((!field && x < RESIZE_BORDER && fields.last) ||
- (field && x < RESIZE_BORDER && field.prev) ||
+ (field && x < RESIZE_BORDER && field.prev) ||
(field && x >= control.clientSize.w - RESIZE_BORDER)))
{
if(!field)
x += control.position.x;
// Tweak to prevent shrinking field if we're actually moving right
- if(x - scroll.x > this.oldX &&
+ if(x - scroll.x > this.oldX &&
this.startWidth + x - this.resizeX < field.width)
{
this.oldX = x - scroll.x;
int fieldX = 0;
for(field = fields.first; field; field = field.next)
{
- fieldX += ((field.width || style.resizable) ?
+ fieldX += ((field.width || style.resizable) ?
field.width : clientSize.w) + EXTRA_SPACE;
- if(fieldX > x)
+ if(fieldX > x)
break;
}
if(draggingField == field)
field.x >= field.x + field.width + EXTRA_SPACE - clientSize.w)
{
SetScrollPosition(
- field.x + field.width + EXTRA_SPACE - clientSize.w,
+ field.x + field.width + EXTRA_SPACE - clientSize.w,
scroll.y);
}
else if(field.x + field.width + EXTRA_SPACE - clientSize.w > scroll.x ||
if(draggingField)
{
bool result = true;
-
+
if(style.moveFields)
{
if(dropField)
x += draggingField.x;
for(field = fields.first; field; field = field.next)
{
- fieldX += ((field.width || style.resizable) ?
+ fieldX += ((field.width || style.resizable) ?
field.width : clientSize.w) + EXTRA_SPACE;
- if(fieldX > x)
+ if(fieldX > x)
{
switchField = field;
break;
bool OnLoadGraphics()
{
- display.FontExtent(fontObject, "W", 1, null, &fontH);
+ display.FontExtent(fontObject, "W", 1, null, &fontH);
if(!style.heightSet)
{
rowHeight = Max(fontH + 2, 16) + (style.alwaysEdit ? 1 : 0);
Font font = fontObject;
Font boldFont = this.boldFont.font;
Display display = this.display;
-
+
for(row = rows.first; row; row = row.GetNextRow())
{
Bitmap icon = row.icon ? row.icon.bitmap : null;
for(field = fields.first; field; field = field.next)
{
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(field.prev)
if((editData && editData.visible) || (style.alwaysEdit))
return true;
-
+
if(x == MAXINT && y == MAXINT)
{
x = this.mouseX;
mouseY = y;
if(this.dragging &&
- ((vertScroll && vertScroll.visible &&
+ ((vertScroll && vertScroll.visible &&
(y < 0 || y >= clientSize.h)) ||
- (horzScroll && horzScroll.visible &&
+ (horzScroll && horzScroll.visible &&
(x < 0 || x >= clientSize.w))))
{
timer.Start();
if(isTimer)
{
- if(vertScroll && vertScroll.visible &&
+ if(vertScroll && vertScroll.visible &&
(y < 0 || y >= clientSize.h))
vertScroll.Action((y<0)?up:down, 0, 0);
- if(horzScroll && horzScroll.visible &&
+ if(horzScroll && horzScroll.visible &&
(x < 0 || x >= clientSize.w))
horzScroll.Action((x<0)?up:down, 0, 0);
}
{
DataRow thisRow;
for(thisRow = rows.first; thisRow; thisRow = thisRow.GetNextRow())
- if((thisRow.selectedFlag == selected || thisRow.selectedFlag == tempSelected) ||
+ if((thisRow.selectedFlag == selected || thisRow.selectedFlag == tempSelected) ||
thisRow == row)
break;
if(thisRow != row)
for(field = fields.first; field; field = field.next)
{
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(field.prev)
for(row = firstRowShown; row; row = row.GetNextRow(), rowIndex ++)
{
rowY += rowHeight;
- if(rowY > y || (style.multiSelect && !row.GetNextRow()))
+ if(rowY > y || (style.multiSelect && !row.GetNextRow()))
{
int plusIndent = 0;
if(style.treeBranch)
if(style.collapse && row.subRows.first && (row.parent || !(style.treeBranch) || (style.rootCollapse)) &&
(x >= rowStart + 3 + plusIndent && y >= rowY - rowHeight + PLUSY && x <= rowStart + 11 + plusIndent && y <= rowY - rowHeight + PLUSY + 8))
*/
- if(style.collapse &&
+ if(style.collapse &&
(x >= rowStart && y >= rowY - rowHeight && x <= rowStart + 18 + plusIndent && y <= rowY + rowHeight-1))
{
if(row.subRows.first && (row.parent || !(style.treeBranch) || (style.rootCollapse)) && x >= plusIndent)
clickedRow = row;
//this.clickedRowIndex = rowIndex;
}
- else if(style.moveRows && !(mods.shift) &&
+ else if(style.moveRows && !(mods.shift) &&
(row.selectedFlag == selected || row.selectedFlag == tempSelected) &&
!right && !(mods.isActivate))
moveMultiple = true;
{
if(selRow != clickedRow)
{
- if(selRow.selectedFlag)
+ if(selRow.selectedFlag)
selRow.selectedFlag = tempUnselected;
else
selRow.selectedFlag = tempSelected;
if(style.freeSelect)
NotifyHighlight(master, this, currentRow, mods);
- else if((moveMultiple || (!(style.multiSelect) && previousRow == currentRow)) &&
+ else if((moveMultiple || (!(style.multiSelect) && previousRow == currentRow)) &&
newCurrentRow && !(mods.shift))
{
if(!right)
for(field = fields.first; field; field = field.next)
{
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(!field.prev) width -= indent;
if(x >= sx && x < sx + width)
- break;
+ break;
sx += width;
}
if(field == currentField)
editData.Deactivate();
else
{
- currentRow.Edit(field);
+ currentRow.Edit(field);
editData.Activate();
}
}
if(style.collapse && !(style.treeBranch))
sx += 15;
-
+
whichField = currentField;
{
for(field = fields.first; field; field = field.next)
{
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(!field.prev) width -= indent;
if(x >= sx && x < sx + width && newCurrentRow)
for(field = fields.first; field; field = field.next)
{
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
if(!field.prev) width -= indent;
for(row = firstRowShown; row; row = row.GetNextRow())
{
rowY += rowHeight;
- if(rowY > y)
+ if(rowY > y)
{
switchRow = row;
break;
int fieldX = 0;
for(field = fields.first; field; field = field.next)
{
- int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
+ int width = (!field.next && style.fillLastField && (!hasHorzScroll || clientSize.w - field.x > field.width + EXTRA_SPACE)) ?
clientSize.w - field.x : (field.width + EXTRA_SPACE);
fieldX += width;
- if(fieldX > x + scroll.x)
+ if(fieldX > x + scroll.x)
break;
}
-
+
if(field && field.editable)
{
// true: destroy edit box
clickedRow = row;
}
else
- {
+ {
if(style.multiSelect)
{
if(!switchRow.selectedFlag)
for(row = firstRowShown; row; row = row.GetNextRow())
{
rowY += rowHeight;
- if(rowY > y || (style.multiSelect && !row.GetNextRow()))
+ if(rowY > y || (style.multiSelect && !row.GetNextRow()))
{
if(style.treeBranch)
{
bool looped = false;
if(len == 1 && currentRow)
startRow = (next = startRow.GetNextRow(), (next ? next : rows.first));
-
+
for(row = startRow; row != startRow || !looped; next = row.GetNextRow(), row = next ? next : rows.first)
{
void * data = row.GetData(field);
draggingField = null;
Update(null);
return false;
- }
+ }
}
- if(!currentField || !currentField.editable)
+ if(!currentField || !currentField.editable)
for(field = fields.first; field; field = field.next)
{
if(field.editable)
return false;
}
}
-
+
if(!NotifyKeyDown(master, this, currentRow, key, ch))
return false;
return editData.OnKeyDown(key, ch);
return true; // We want to pick up the OnKeyHit to replace contents, but skip GoToLetter
}
-
+
if(ch >=32 && ch != 128 && !key.alt && !key.ctrl && GoToLetter(ch, false))
{
/*if(inactive && window.state != Hidden)
{
delay = 0.5; // typingTimeOut
userData = this;
-
+
bool DelayExpired()
{
typedString[0] = '\0';
if(menu)
menu.RemoveItem(this);
if(value)
- value.AddItem(this);
+ value.AddItem(this);
}
}
};
set
{
accelerator = value;
-
+
if(!manualAccelText && text)
{
char accelString[50] = "\t";
}
// Should callback be called here? guess not ;)
}
- get { return checked; }
+ get { return checked; }
};
property bool disabled { set { if(this) disabled = value; } };
property bool checkable { set { checkable = value; } };
{
MenuPlacement()
{
- placement = true;
+ placement = true;
}
public:
item.menu = this;
}
}
-
+
void RemoveItem(MenuItem item)
{
if(item.menu == this)
MenuItem menuItem { };
ItemPtr ptr { item = menuItem };
items.Add(ptr);
-
+
incref menuItem;
itemCount++;
}
}
}
-
+
void AddDynamic(MenuItem addedItem, Window master, bool persistent)
{
if(addedItem)
{
ItemPtr ptr = null, oldItemPtr;
-
+
for(oldItemPtr = items.first; oldItemPtr; oldItemPtr = oldItemPtr.next)
{
if((oldItemPtr.item.subMenu || oldItemPtr.item.placement) && !strcmpTillTab(ITEM_TEXT(oldItemPtr.item), ITEM_TEXT(addedItem)))
addedItem.menu = this;
}
}
-
+
MenuItem FindItem(bool (* Window::notifySelect)(MenuItem selection, Modifiers mods), uint64 id)
{
ItemPtr ptr;
-
+
for(ptr = items.first; ptr; ptr = ptr.next)
{
MenuItem item = ptr.item;
ptr.item = ptr.oldItem;
ptr.oldItem = null;
delete ptr.item;
- }
+ }
items.Delete(ptr);
}
}
itemCount++;
}
}
-
+
if(!beingMergedItem.isDivider || (previous.item && !previous.item.isDivider))
{
mergeIntoItemPtr = ItemPtr { };
}
else if(item.subMenu)
item.subMenu.Clean(window);
-
+
if(ptr.inserted.deleteItem)
delete item;
Menu FindMenu(char * name)
{
ItemPtr ptr;
-
+
for(ptr = items.first; ptr; ptr = ptr.next)
{
MenuItem item = ptr.item;
int rw, rh;
int totalHeight;
Menu menu;
- ItemPtr selected;
+ ItemPtr selected;
bool pressed;
bool altDown;
bool keyboardFocus;
bool mouseInput;
Time unpressedTime;
-
+
void (* FontExtent)(Display display, Font font, char * text, int len, int * width, int * height);
FontResource boldFont { faceName = font.faceName, font.size, bold = true, window = this };
{
ItemPtr selected, current = this.selected;
for(selected = (current && current.prev) ? current.prev : menu.items.last;
- selected &&
- (selected.item.isDivider || selected.item.placement || ITEM_DISABLED(selected.item)) &&
+ selected &&
+ (selected.item.isDivider || selected.item.placement || ITEM_DISABLED(selected.item)) &&
selected != current;
selected = selected.prev ? selected.prev : menu.items.last)
{
{
ItemPtr selected, current = this.selected;
for(selected = (current && current.next) ? current.next : menu.items.first;
- selected &&
- (selected.item.isDivider || selected.item.placement || ITEM_DISABLED(selected.item)) &&
+ selected &&
+ (selected.item.isDivider || selected.item.placement || ITEM_DISABLED(selected.item)) &&
selected != current;
selected = selected.next ? selected.next : menu.items.first)
{
Window parent = this.parent;
Window activeClient = parent.activeClient;
bool systemButtons = activeClient && activeClient.state == maximized;
-
+
keyboardFocus = true;
pressed = true;
int y = 0;
int selectedY = 0;
ItemPtr ptr;
-
+
for(ptr = menu.items.first; ptr; ptr = ptr.next)
{
MenuItem item = ptr.item;
if(item.placement) continue; //&& !ptr.inserted) continue;
if(selected == ptr)
{
-
+
selectedY = y;
break;
}
MenuItem selection = selectionPtr.item;
if(!ITEM_DISABLED(selection))
{
- Window master = this;
+ Window master = this;
if(!isMenuBar)
master = master.master;
master = selectionPtr.master;
while(eClass_IsDerived(master._class, _class) && master.master)
master = master.master;
-
+
if(selection.checkable)
selection.checked = !selection.checked;
else if(selection.radio)
MenuItem item = ptr.item;
if(item.subMenu)
{
- if(!CheckAccelerators(item.subMenu, key))
+ if(!CheckAccelerators(item.subMenu, key))
return false;
}
else if(!item.isDivider)
Menu menu = this.menu;
// Mouse moved inside menu
ItemPtr selected = null;
-
+
*selectedX = 0;
*selectedY = 0;
if(!helpBreak)
{
ItemPtr nextPtr;
-
+
int breakX = clientSize.w - (systemButtons ? 48 : 0);
for(nextPtr = ptr.next; nextPtr; nextPtr = nextPtr.next)
{
else
{
// Shiny gradient for menu bar
- ColorKey keys[2] =
+ ColorKey keys[2] =
{
{ white, 0 },
{ popupMenuColor, 1 }
if(key && menu)
{
ItemPtr ptr;
-
+
for(ptr = menu.items.first; ptr; ptr = ptr.next)
{
MenuItem item = ptr.item;
if(MenuGoToNextItem())
Update(null);
result = false;
- }
+ }
break;
case end:
if(!isMenuBar)
if(MenuGoToPrevItem())
Update(null);
result = false;
- }
+ }
break;
case left:
if(isMenuBar)
if(key && menu)
{
//ItemPtr ptr;
-
+
if(ch >= 32 && !isMenuBar)
return false;
/*
if(this != masterMenuBar)
{
- if(!*w)
+ if(!*w)
*w = 80;
- if(!*h)
+ if(!*h)
*h = 20;
}
return true;
else
{
*x = Min(*x, parent.clientSize.w - w);
- *y = Min(*y, parent.clientSize.h - h);
+ *y = Min(*y, parent.clientSize.h - h);
}
if(parent == guiApp.desktop)
{
if(this.selected)
{
Menu childMenu = selected.item.subMenu;
-
+
this.pressed = pressed;
if(this.selected.item.subMenu)
break;
}
}
- if(destroy)
+ if(destroy)
{
if(MenuDestroyMasters(false))
return false;
property::split = split;
}
}
-
+
bool OnLeftButtonDown(int x, int y, Modifiers mods)
{
sliding = true;
startX = position.y;
}
Capture();
-
+
return true;
}
{
set { rightPane = value; property::split = split; } get { return rightPane; }
}
- property Window topPane
+ property Window topPane
{
set { leftPane = value; property::split = split; } get { return leftPane; }
}
property int split
{
set
- {
+ {
split = value;
if(orientation == vertical)
{
scale = false;
}
- }
+ }
get { return split; }
}
GetSystemPathBuffer(path, editBox.contents);
if(!(path[0] == DIR_SEP && path[1] == DIR_SEP && (!path[2] || !strchr(&path[2], DIR_SEP))))
exists = FileExists(path);
-
+
switch(typeExpected)
{
case any:
typeExpected = value;
if(browseDialog && browseDialog.type == open && typeExpected == directory)
browseDialog.type = selectDir;
- }
+ }
}
}
inactive = true;
public:
- property Color tint { set { tint = value; } };
+ property Color tint { set { tint = value; } };
property BitmapResource image
{
- property_category $"Appearance"
+ property_category $"Appearance"
set
{
if(this)
{
OnUnloadGraphics();
- bitmapImage = value;
+ bitmapImage = value;
OnLoadGraphics();
}
if(!bitmap)
{
bitmap = { };
-
+
if(hasHorzScroll || hasVertScroll)
bitmap.Copy(bitmapImage);
else if(bitmap.Allocate(null, clientSize.w, clientSize.h, 0, bitmapImage.pixelFormat, false))
else
*w = 80;
}
-
+
if(!size.h && (!anchor.top.type || !anchor.bottom.type))
{
-
+
if(bitmap)
*h = bitmap.height;
else
if(zoomFactor < 25)
{
float x = 0.5f, y = 0.5f;
- if(bitmap.width * zoomFactor > clientSize.w)
+ if(bitmap.width * zoomFactor > clientSize.w)
x = scroll.x / (bitmap.width * zoomFactor - clientSize.w);
- if(bitmap.height * zoomFactor > clientSize.h)
+ if(bitmap.height * zoomFactor > clientSize.h)
y = scroll.y / (bitmap.height * zoomFactor - clientSize.h);
zoomFactor *= 1.5;
SetScrollArea(
- (int)(bitmap.width * zoomFactor),
+ (int)(bitmap.width * zoomFactor),
(int)(bitmap.height * zoomFactor), false);
SetScrollPosition(
if(zoomFactor > 0.05)
{
float x = 0.5f, y = 0.5f;
- if(bitmap.width * zoomFactor > clientSize.w)
+ if(bitmap.width * zoomFactor > clientSize.w)
x = scroll.x / (bitmap.width * zoomFactor - clientSize.w);
- if(bitmap.height * zoomFactor > clientSize.h)
+ if(bitmap.height * zoomFactor > clientSize.h)
y = scroll.y / (bitmap.height * zoomFactor - clientSize.h);
zoomFactor /= 1.5;
SetScrollArea(
- (int)(bitmap.width * zoomFactor),
+ (int)(bitmap.width * zoomFactor),
(int)(bitmap.height * zoomFactor), false);
SetScrollPosition(
int h = (int)(bitmap.height * zoomFactor);
if(w == bitmap.width && h == bitmap.height)
{
- surface.Blit(bitmap,
- Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
+ surface.Blit(bitmap,
+ Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
scroll.x,scroll.y, w, h);
}
else
{
if(filter)
- surface.Filter(bitmap,
- Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
- (int)(scroll.x / zoomFactor), (int)(scroll.y / zoomFactor), w, h,
+ surface.Filter(bitmap,
+ Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
+ (int)(scroll.x / zoomFactor), (int)(scroll.y / zoomFactor), w, h,
bitmap.width, bitmap.height);
else
- surface.Stretch(bitmap,
- Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
- (int)(scroll.x / zoomFactor), (int)(scroll.y / zoomFactor), w, h,
+ surface.Stretch(bitmap,
+ Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
+ (int)(scroll.x / zoomFactor), (int)(scroll.y / zoomFactor), w, h,
bitmap.width, bitmap.height);
}
}
int w = bitmap.width;
int h = bitmap.height;
if(clientSize.w == bitmap.width && clientSize.h == bitmap.height)
- surface.Blit(bitmap,
+ surface.Blit(bitmap,
Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
- scroll.x,scroll.y,
+ scroll.x,scroll.y,
hasHorzScroll ? clientSize.w : bitmap.width, hasVertScroll ? clientSize.h : bitmap.height);
else
{
background = formColor;
borderStyle = deep;
-
+
public:
property uint progress { property_category $"Data" set { position = value; Update(null); } get { return position; } };
property uint range { property_category $"Data" set { range = value; Update(null); } get { return range; } };
// SNAPDOWN(position, lineStep);
if(position < 0) position = 0;
- if(position >= range)
+ if(position >= range)
position = range - 1;
if(thumb)
property bool snap { property_category $"Behavior" set { sbStyle.snap = value; } get { return sbStyle.snap; } };
property int range
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
total = value + seen - 1;
// Improve this, needs to be done in 2 so updates commented out for seen
property int seen
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
if(this)
};
property int total
{
- property_category $"Behavior"
+ property_category $"Behavior"
set
{
if(this)
bool NotifyPushed(Button button, int x, int y, Modifiers mods)
{
- action = up;
+ action = up;
Action(action, 0, Key { modifiers = mods });
timer.Start();
return true;
bool draggingThumb;
Point pos, thumbClick;
bool inside;
-
+
void OnRedraw(Surface surface)
{
int sbWidth = SB_WIDTH;
thumbSize = seen * size / total;
}
else
- thumbSize = 0;
+ thumbSize = 0;
if(sbStyle.vertical)
{
{
case left:
case up: Action(up, 0, key); break;
- case right:
- case down:
- Action(down, 0, key);
+ case right:
+ case down:
+ Action(down, 0, key);
break;
case pageUp: Action(pageUp, 0, key); break;
case pageDown: Action(pageDown, 0, key); break;
surface.LineStipple(0x5555);
surface.Rectangle(x1, y1, x2, y2);
- surface.LineStipple(0);
+ surface.LineStipple(0);
}
public class SelectorBar : Stacker
if(eClass_IsDerived(b._class, class(SelectorButton)) && b != this)
b.checked = false;
}
- font = { font.faceName, font.size, bold = true };
+ font = { font.faceName, font.size, bold = true };
// this should not be required: the font change should resize the control and Stacker should adapt automatically
// why does it not?
selector.OnResize(selector.clientSize.w, selector.clientSize.h);
if(master && ((EditableSelectorButton)master).focusHolder)
((EditableSelectorButton)master).focusHolder.Activate();
delete this;
- }
+ }
return true;
}
-
+
bool NotifyModified(EditBox editBox)
{
char * oldName = CopyString(text);
char * newName = CopyString(editBox.contents);
-
+
if(OnRename(master, this, &oldName, &newName))
{
SelectorBar selector = (SelectorBar)parent;
if(selector)
selector.MakeControlVisible(this);
}
-
+
delete oldName;
delete newName;
-
+
//OnLeavingEdit();? //master.someControl.Activate();
if(focusHolder)
focusHolder.Activate();
}
};
incref editBox;
- editBox.contents = text;
+ editBox.contents = text;
editBox.Create();
editBox.SetModified(false);
editBox.SelectAll();
{
if(this && field)
{
- field._statusBar = null;
+ field._statusBar = null;
width -= field.width + (guiApp.textMode ? 0 : 6);
fields.Remove(field);
delete field;
if(!guiApp.textMode)
surface.ThinBevel(false, -1,0, clientSize.w+2, clientSize.h+1);
-
+
for(field = fields.first; field; field = field.next)
{
int x = position - field.width;
surface.Clip(clip);
surface.TextExtent(field.text, strlen(field.text), &tw, null);
surface.WriteTextf(x + (field.width - tw) / 2, 2, field.text);
- surface.Clip(null);
+ surface.Clip(null);
}
position -= field.width + (guiApp.textMode ? 0 : 6);
}
surface.SetForeground(white);
else
surface.SetForeground(foreground);
-
+
surface.WriteTextf(2, 2, text);
surface.Clip(null);
}
}
property Color color
{
- set
+ set
{
if(this)
{
{
return true;
}
-
+
bool OnLeftButtonDown(int x, int y, Modifiers mods)
{
Button::OnLeftButtonDown(x, y, mods);
surface.DrawLine(x+2,h-1, w-4, h-1);
surface.PutPixel(x,h-3);
surface.PutPixel(x+1,h-2);
-
+
surface.PutPixel(w-2, h - 3);
surface.PutPixel(w-3, h - 2);
break;
surface.DrawLine(x+2,0, w-4,0);
surface.PutPixel(x, 2);
surface.PutPixel(x+1, 1);
-
+
surface.PutPixel(w-2, 2);
surface.PutPixel(w-3, 1);
break;
surface.DrawLine(w-1,y+2, w-1, h-4);
surface.PutPixel(w-3, y);
surface.PutPixel(w-2, y+1);
-
+
surface.PutPixel(w - 3, h-2);
surface.PutPixel(w - 2, h-3);
break;
surface.DrawLine(0,y+2, 0, h-4);
surface.PutPixel(2, y);
surface.PutPixel(1, y+1);
-
+
surface.PutPixel(2, h-2);
surface.PutPixel(1, h-3);
break;
if(text)
surface.TextExtent(text, strlen(text),&tw, &th);
y = (clientSize.h - th - 1)/2 + (checked ? 0 : -2);
-
+
if(ellipsis)
{
int width = clientSize.w - 2*6;
surface.LineStipple(0x5555);
surface.Rectangle(x1, y1, x2, y2);
- surface.LineStipple(0);
+ surface.LineStipple(0);
}
}
}
}
}
else
- return true;
+ return true;
}
return false;
}
{
surface.SetForeground(gray);
surface.Rectangle(0,1, size.w-1, CAPTION+1);
-
+
surface.SetForeground(white);
surface.Rectangle(1, 1, clientSize.w-2, CAPTION-1);
- surface.SetBackground(skinBackground);
+ surface.SetBackground(skinBackground);
surface.Area(2, 2, size.w-3, CAPTION+1);
-
+
surface.SetForeground((active ? skinTextColor : skinInactiveTextColor));
surface.TextOpacity(false);
surface.TextFont(captionFont);
{
int buttonsSize = border +
((hasMaximize || hasMinimize) ? 52 : 18);
- surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
+ surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
size.w - (buttonsSize + border + 4), name, strlen(name));
}
}
{
surface.SetForeground(white);
surface.Rectangle(
- clientStart.x + 1 + (placement == left) * 80,
- clientStart.y + 1 + (placement == top) * 30,
- clientStart.x + clientSize.w - (placement == right) * 80 - 2,
+ clientStart.x + 1 + (placement == left) * 80,
+ clientStart.y + 1 + (placement == top) * 30,
+ clientStart.x + clientSize.w - (placement == right) * 80 - 2,
clientStart.y + clientSize.h - (placement == bottom) * 30 - 2);
surface.SetForeground(gray);
surface.Rectangle(
- clientStart.x + (placement == left) * 80,
- clientStart.y + (placement == top) * 30,
- clientStart.x + clientSize.w - (placement == right) * 80 - 1,
+ clientStart.x + (placement == left) * 80,
+ clientStart.y + (placement == top) * 30,
+ clientStart.x + clientSize.w - (placement == right) * 80 - 1,
clientStart.y + clientSize.h - (placement == bottom) * 30 - 1);
}
Button button = curButton;
int x = button.position.x;
int y = button.position.y;
-
+
switch(placement)
{
case TabsPlacement::bottom:
surface.SetForeground(white);
switch(placement)
{
- case TabsPlacement::bottom: surface.VLine(clientSize.h-32 + clientStart.y + 1, clientSize.h-28 + clientStart.y + 1, x + 1 + clientStart.x); break;
+ case TabsPlacement::bottom: surface.VLine(clientSize.h-32 + clientStart.y + 1, clientSize.h-28 + clientStart.y + 1, x + 1 + clientStart.x); break;
case TabsPlacement::top: surface.VLine(clientStart.y + 30, clientStart.y + 31, x + 1 + clientStart.x); break;
case TabsPlacement::left: surface.HLine(78 + clientStart.x, 81 + clientStart.x, y + 1 + clientStart.y); break;
case TabsPlacement::right: surface.HLine(clientStart.y + 30, clientStart.y + 31, y + 1 + clientStart.y); break;
int pleft = button.anchor.left.distance, nleft = newButton ? newButton.anchor.left.distance : 0;
int ptop = button.anchor.top.distance, ntop = newButton ? newButton.anchor.top.distance : 0;
if(button == curButton) continue;
- if((smartKey == left && (pleft < cleft || ptop < ctop) && (!newButton || pleft > nleft || ptop > ntop)) ||
+ if((smartKey == left && (pleft < cleft || ptop < ctop) && (!newButton || pleft > nleft || ptop > ntop)) ||
(smartKey == right && (pleft > cleft || ptop > ctop) && (!newButton || pleft < nleft || pleft < ptop)))
newButton = button;
}
timer.Stop();
position =
{
- pos.x + offset.x + tippedWindow.clientStart.x +
+ pos.x + offset.x + tippedWindow.clientStart.x +
tippedWindow.absPosition.x - parent.position.x;
- pos.y + offset.y + tippedWindow.clientStart.y +
+ pos.y + offset.y + tippedWindow.clientStart.y +
tippedWindow.absPosition.y - parent.position.y;
};
Create();
surface.VLine(0, 23, 1);
surface.foreground = white;
surface.VLine(0, 23, 2);
- }
+ }
}
static ColorAlpha Color_aLbA(float A, float L, float B, float a)
{
- return ColorAlpha
+ return ColorAlpha
{
(byte)Max(Min(a*255, 255), 0),
ColorLab
- {
- L * 100,
- (A * LAB_AB_RANGE) - (LAB_AB_RANGE+1)/2,
+ {
+ L * 100,
+ (A * LAB_AB_RANGE) - (LAB_AB_RANGE+1)/2,
(B * LAB_AB_RANGE) - (LAB_AB_RANGE+1)/2
};
};
fy = Min(Max(fy,0),1);
switch((ColorPlaneType) id)
{
- case xyPlane:
- picker.x = fx; picker.y = fy;
+ case xyPlane:
+ picker.x = fx; picker.y = fy;
break;
case zRamp:
- picker.z = fy;
+ picker.z = fy;
picker.xyPlaneUpdate = true;
break;
case aRamp:
- picker.w = fx;
+ picker.w = fx;
picker.xyPlaneUpdate = true;
break;
}
for(y = 0; y<256; y++)
{
ColorAlpha color = ColorFunctions[picker.colorMode](
- (float)x / (256-1),
- (float)(256-1-y) / (256-1),
+ (float)x / (256-1),
+ (float)(256-1-y) / (256-1),
picker.z, picker.w);
surface.SetForeground(color);
}
surface.Blit(bitmap, 0,0,0,0, clientSize.w, clientSize.h);
-
+
x = (int)(picker.x * (clientSize.w-1));
y = (int)(clientSize.h-1-(picker.y * (clientSize.h-1)));
for(z = 0; z<ch; z++)
{
ColorAlpha color = ColorFunctions[picker.colorMode](
- picker.x, picker.y,
+ picker.x, picker.y,
(float)(ch-1-z) / (ch-1), picker.w);
surface.SetForeground(color);
for(a = 0; a<clientSize.w; a++)
{
ColorAlpha color = ColorFunctions[picker.colorMode](
- picker.x, picker.y,
+ picker.x, picker.y,
picker.z, (float)a / (clientSize.w-1));
surface.SetForeground(color);
Lab = rgb;
cmyk = rgb;
hsv = rgb;
-
+
UpdatePosition();
}
get { return argb; }
colorMode = (ColorSelectionMode)control.id;
xyPlaneUpdate = true;
}
-
+
UpdatePosition();
return true;
EditBox a
{
this, position = { 442, 30 }, size = { 32, 20 };
-
+
bool NotifyModified(EditBox control)
{
ColorRGB rgb;
EditBox C
{
this, position = { 350, 150 }, size = { 32, 20 }, text = "C:", hotKey = altC;
-
+
bool NotifyModified(EditBox control)
{
ColorRGB rgb;
// position = { 330, 270 },
// anchor = { right = 10, bottom = 32 };
-
+
bool NotifyModified(EditBox control)
{
ColorRGB rgb;
{
this, isRadio = true, position = { 312, 10 }, id = ColorSelectionMode::selectH, text = "H:", hotKey = altH, checked = true;
NotifyClicked = RadioClicked;
- };
+ };
Button rS
{
this, isRadio = true, position = { 312, 80 }, id = ColorSelectionMode::selectR, text = "R:", hotKey = altR;
NotifyClicked = RadioClicked;
};
-
+
Button rG
{
this, isRadio = true, position = { 312, 100 }, id = ColorSelectionMode::selectG, text = "G:", hotKey = altG;
surface.Area(0,0, 49, 49);
}
}
- };
+ };
EditBox R
{
aRamp.autoCreate = value;
A.autoCreate = value;
labelA.autoCreate = value;
- if(value) clientSize.h = 275 + 50; else clientSize.h = 275;
+ if(value) clientSize.h = 275 + 50; else clientSize.h = 275;
}
- get
+ get
{
return hasAlpha;
}
extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyHit;
private:
-static char * iconNames[] =
+static char * iconNames[] =
{
"<:ecere>places/folder.png",
"<:ecere>status/folderOpen.png",
textFile, webFile, pictureFile, soundFile,
archiveFile, packageFile, opticalMediaImageFile; /* these (all previous) are sort equal */
- /*property char *
+ /*property char *
{
set
{
public enum FileForceExtension { never, always, whenNoneGiven };
public struct FileType
{
- char * name, * typeExtension;
+ char * name, * typeExtension;
FileForceExtension forceExtension;
};
indentSize = 8;
}
textOffset = indent * indentSize + (icon ? (icon.width + 4) : 0);
-
+
surface.WriteTextDots
(alignment, x + textOffset, y + 2, width - textOffset, name, strlen(name));
if(icon)
// Stuff currently in config moving to FileDialog:
property char * filePath { set { strcpy(filePath, value); } get { return (char *)filePath; } };
property char * currentDirectory
- {
+ {
set
{
GetWorkingDir(currentDirectory, MAX_DIRECTORY);
listing.name[1] == currentDirectory[1])
{
#endif
- for(c = start; currentDirectory[c]; )
+ for(c = start; currentDirectory[c]; )
{
int len = 0;
char ch;
for(;(ch = currentDirectory[c]) && (ch != '/' && ch != '\\'); c++)
{
if(len < MAX_FILENAME)
- tmpDir[len++] = ch;
+ tmpDir[len++] = ch;
}
for(;(ch = currentDirectory[c]) && (ch == '/' || ch == '\\'); c++);
tmpDir[len] = '\0';
{
if(currentDirectory[0] == '\\' && currentDirectory[1] == '\\')
{
- for(c = 2; currentDirectory[c]; )
+ for(c = 2; currentDirectory[c]; )
{
int len = 0;
char ch;
for(;(ch = currentDirectory[c]) && (ch != '/' && ch != '\\'); c++)
{
if(len < MAX_FILENAME)
- tmpDir[len++] = ch;
+ tmpDir[len++] = ch;
}
for(;(ch = currentDirectory[c]) && (ch == '/' || ch == '\\'); c++);
tmpDir[len] = '\0';
if(sizeFilters < sizeof(FileFilter) && !fileFilter)
listing.extensions = null;
else if(filters && fileFilter < sizeFilters / (int)sizeof(FileFilter))
- listing.extensions = filters[fileFilter].extensions;
+ listing.extensions = filters[fileFilter].extensions;
else
listing.extensions = customFilter.extensions;
-
+
listBox.Clear();
fileName.indent = 0;
if(listing.stats.attribs.isShare) fileName.type = share;
if(listing.stats.attribs.isCDROM) fileName.type = cdrom;
if(listing.stats.attribs.isRemote) fileName.type = netDrive;
- if(listing.stats.attribs.isRemovable)
+ if(listing.stats.attribs.isRemovable)
{
if(listing.name[0] == 'A' || listing.name[0] == 'B')
fileName.type = floppy;
#endif
goUp.disabled = true;
}
- else
+ else
goUp.disabled = false;
ListDrives();
strcat(*selectedFileName, name);
}
else
- #endif
+ #endif
strcat(*selectedFileName, fileName->name);
if(selection.count > 1) strcat(*selectedFileName, "\"");
}
bool result = true;
FileAttribs exists = 0;
char * wildcardPointer = strstr(fileName, "*");
-
+
if(wildcardPointer)
{
if(style != selectDir)
while(pointer)
{
if(pointer[1] == '.' && pointer[2])
- pointer +=3;
- else
+ pointer +=3;
+ else
pointer ++;
pointer = strstr(pointer, "*");
numExtensions++;
extension[len++] = ch;
}
extension[len] = '\0';
-
+
if(!strcmpi(extension, compared))
{
matched = true;
char * name = new char[numExtensions * (4 + MAX_EXTENSION)];
delete customFilter.extensions;
-
+
if(!strcmp(wildcardPointer, "*") || strstr(wildcardPointer, "*.*"))
{
strcpy(name, $"All Files");
customFilter.extensions = new char[numExtensions * (2 + MAX_EXTENSION)];
customFilter.extensions[0] = '\0';
name[0] = '\0';
-
+
numExtensions = 0;
for(c = 0; wildcardPointer[c]; )
{
for(;(ch = wildcardPointer[c]) && IS_ALUNDER(ch); c++)
{
if(len < MAX_EXTENSION)
- extension[len++] = ch;
+ extension[len++] = ch;
}
extension[len] = '\0';
}
strcat(name, "*.");
strcat(name, extension);
- if(!extension[0])
+ if(!extension[0])
strcat(customFilter.extensions, ".");
else
strcat(customFilter.extensions, extension);
delete name;
}
-
+
filter.currentRow = filter.FindRow(fileFilter);
ListFiles();
result = true;
for(selection = selections.first; selection; selection = selection.next)
{
char * fileName = selection.data;
-
+
// For every file
strcpy(currentFileName, currentDirectory);
if(PathCat(currentFileName, fileName))
ListFiles();
}
- else
+ else
{
// *** SAVING ONLY ****
if(style == save)
DropBox filter
{
this, text = $"Filter:", anchor = { left = 96, right = 104, bottom = 16 }, hotKey = altR;
-
+
bool NotifySelect(DropBox control, DataRow row, Modifiers mods)
{
fileFilter = (int)(row ? row.tag : 0);
return true;
}
};
-
+
Label typeLabel
{
this, inactive = true, visible = false, anchor = { left = 8, bottom = 19 }, labeledWindow = type;
#endif
if(indent < fileName->indent)
{
- for(; currentDirectory[c]; )
+ for(; currentDirectory[c]; )
{
int len = 0;
char ch;
for(;(ch = currentDirectory[c]) && (ch != '/' && ch != '\\'); c++)
{
if(len < MAX_FILENAME)
- directory[len++] = ch;
+ directory[len++] = ch;
}
for(;(ch = currentDirectory[c]) && (ch == '/' || ch == '\\'); c++);
directory[len] = '\0';
};
DataField lookInField { dataType = "FileName", userData = this };
-
+
Label lookInLabel
{
this, position = { 10, 11 }, labeledWindow = lookIn;
return true;
}
};
-
+
Button cancel
{
parent = this, position = { 140, 60 }, size = { 60 }, hotKey = escape, text = $"Cancel";
{
this, isCheckbox = true, text = $"Match case", position = { 10, 60 }, hotKey = altC
};
-
+
Button searchUp
{
this, isRadio = true, text = $"Up", position = { 220, 50 }, hotKey = altU
Button cancel
{
this, text = $"Cancel", anchor = Anchor { right = 10, top = 45 }, size = { 80 }, hotKey = escape;
-
+
bool NotifyClicked(Button control, int x, int y, Modifiers mods)
{
findWhat.Activate();
this, text = $"Close", hotKey = escape, anchor = { right = 10, top = 45 }, size = { 80 };
NotifyClicked = ButtonCloseDialog;
};
-
+
EditBox lineBox
{
this, text = $"Line number:", anchor = { left = 120, right = 100, top = 10 }, size.h = 20, hotKey = altL;
-
+
void NotifyUpdate(EditBox editBox)
{
goTo.disabled = atoi(lineBox.contents) ? false : true;
}
}
}
- };
+ };
private:
MessageBoxType style;
background = formColor;
minClientSize = { 432, 144 };
text = $"Replace";
-
+
public:
property EditBox editBox
{
// If in whole file mode, the starting position is the end of the replace
else
editBox.GetSelPos(
- null, &this.y, &this.x,
+ null, &this.y, &this.x,
null, null, null, true);
}
&line, &this.y, &this.x, true);
// If in whole file mode, the starting position is the end of the replace
else
- editBox.GetSelPos(
- null, &this.y, &this.x,
+ editBox.GetSelPos(
+ null, &this.y, &this.x,
null, null, null, true);
}
EditBoxFindResult findResult;
if(selectionOnly)
- findResult = editBox.FindInSelection(searchString,
+ findResult = editBox.FindInSelection(searchString,
wholeWord, matchCase,
line, this.y, this.x);
else
{
return ok.NotifyClicked(this, ok, x, y, mods);
}
- };
+ };
Label label
{
if(window && window.windowData)
{
}
- }
+ }
void ClearClipboard()
{
{
bool result = false;
if((clipBoard.text = new0 byte[size]))
- result = true;
+ result = true;
return result;
}
void SetTimerResolution(uint hertz)
{
// timerDelay = hertz ? (1000000 / hertz) : MAXINT;
- }
+ }
bool SetIcon(Window window, BitmapResource resource)
{
//PrintLn("Got a motion input event: ", action);
/*
if(action == 8) //AMOTION_EVENT_ACTION_SCROLL)
- axis = AMotionEvent_getAxisValue(event, 9, index); //AMOTION_EVENT_AXIS_VSCROLL);
+ axis = AMotionEvent_getAxisValue(event, 9, index); //AMOTION_EVENT_AXIS_VSCROLL);
*/
AInputQueue_finishEvent(inputQueue, event, 1);
{
Module app;
-
+
// Evolve the Application class into a GuiApplication
eInstance_Evolve((Instance *)&__androidCurrentModule, class(GuiApplication));
if(ch == 0x1B) //Escaped = true;
{
ch = getch();
-#ifdef NCDEBUG
+#ifdef NCDEBUG
fprintf(f, " \\e: %d\n",ch);
-#endif
+#endif
if((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9'))
{
key = characters2Key[ch];
ch = getch();
#ifdef NCDEBUG
fprintf(f, " [: %d\n",ch);
-#endif
+#endif
ch1 = getch();
#ifdef NCDEBUG
fprintf(f, " MOD: %c\n",ch1);
-#endif
+#endif
if(ch == '[')
{
if(ch1 == 'A') key = f1;
switch(ch)
{
case '1': case '7': key = home; break;
- case '2': key = insert; break;
+ case '2': key = insert; break;
case '3': key = del; break;
case '4': case '8': key = end; break;
case '5': key = pageUp; break;
ch = getch();
#ifdef NCDEBUG
fprintf(f, " O: %d\n",ch);
-#endif
+#endif
keyFlags.ctrl = true;
switch(ch)
{
key = escape;
ch = 27;
}
- else
+ else
ch = 0;
/*else
{
}*/
}
}
- else if(ch<256)
+ else if(ch<256)
{
key = characters2Key[ch];
if(!key && ch <= 26)
if(event.bstate & BUTTON1_PRESSED)
{
Time time = GetTime();
- if(time - lastTime[0] < DBLCLICK_DELAY &&
+ if(time - lastTime[0] < DBLCLICK_DELAY &&
Abs(mousePosition.x - lastPos[0].x) < DBLCLICK_DELTA &&
Abs(mousePosition.y - lastPos[0].y) < DBLCLICK_DELTA)
AddMsg(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftDoubleClick, x, y, keyFlags);
if(event.bstate & BUTTON3_PRESSED)
{
Time time = GetTime();
- if(time - lastTime[2] < DBLCLICK_DELAY &&
+ if(time - lastTime[2] < DBLCLICK_DELAY &&
Abs(mousePosition.x - lastPos[2].x) < DBLCLICK_DELTA &&
Abs(mousePosition.y - lastPos[2].y) < DBLCLICK_DELTA)
AddMsg(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightDoubleClick, x, y, keyFlags);
if(event.bstate & BUTTON2_PRESSED)
{
Time time = GetTime();
- if(time - lastTime[1] < DBLCLICK_DELAY &&
+ if(time - lastTime[1] < DBLCLICK_DELAY &&
Abs(mousePosition.x - lastPos[1].x) < DBLCLICK_DELTA &&
Abs(mousePosition.y - lastPos[1].y) < DBLCLICK_DELTA)
AddMsg(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleDoubleClick, x, y, keyFlags);
byte c = 0,f,b;
initscr();
-
+
SetLoggingMode(buffer, null);
if((bool)has_colors())
{
for(f=0; f<8; f++)
init_pair(c++,colorMap[f],colorMap[b]);
}
-
+
printf( "\033(U\017");
fflush(stdout);
intrflush(stdscr, (_Bool)false);
ncursesMutex = Mutex { };
ncursesTerminate = false;
-
+
ncursesThread = Thread { };
incref ncursesThread;
ncursesThread.Main = NCursesThread;
}
else
caretVisible = false;
- }
+ }
// --- Clipboard manipulation ---
{
bool result = false;
if((clipBoard.text = new char[size]))
- result = true;
+ result = true;
return result;
}
import "Display"
default:
-WINBASEAPI HWND WINAPI GetConsoleWindow ();
+WINBASEAPI HWND WINAPI GetConsoleWindow ();
private:
}
else
{
- keys[key] = (byte)bool::false;
+ keys[key] = (byte)bool::false;
guiApp.desktop.KeyMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyUp,keyFlags,ch);
}
break;
default:
if(buttonState.left && !(lastButtonState.left))
guiApp.desktop.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonDown,
- mousePosition.x, mousePosition.y, &keyFlags, false,
+ mousePosition.x, mousePosition.y, &keyFlags, false,
(event.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK) ? false : true) ;
else if(buttonState.middle && !(lastButtonState.middle))
guiApp.desktop.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleButtonDown,
}
case WINDOW_BUFFER_SIZE_EVENT:
{
- COORD coord =
- {
+ COORD coord =
+ {
event.Event.WindowBufferSizeEvent.dwSize.X,
event.Event.WindowBufferSizeEvent.dwSize.Y
};
void SetCaret(int x, int y, int size)
{
COORD coords = { (short)(x / textCellW), (short)(y / textCellH) };
- CONSOLE_CURSOR_INFO cursor =
- {
- size ? size : 99,
+ CONSOLE_CURSOR_INFO cursor =
+ {
+ size ? size : 99,
(size && x >= 0 && y >= 0 && x < guiApp.desktop.clientSize.w && y < guiApp.desktop.clientSize.h) ? TRUE : FALSE
};
SetConsoleCursorInfo(hStdout, &cursor);
SetConsoleCursorPosition(hStdout, coords);
- }
+ }
// --- Clipboard manipulation ---
class Win32Interface : Interface
{
class_property(name) = "Win32";
-
+
void ::RepositionDesktop(bool updateChildren)
{
int c;
static double lastAutoHideCheck = 0;
int newTaskBarState = taskBarState;
HMONITOR primaryMonitor;
-
+
time = GetTime();
if(time - lastTime < 0.1) return;
lastTime = time;
memcpy(lastMonitorAreas, monitorAreas, sizeof(monitorAreas));
guiApp.virtualScreen =
- {
+ {
GetSystemMetrics(SM_CXVIRTUALSCREEN),
GetSystemMetrics(SM_CYVIRTUALSCREEN)
};
}
}
}
-
+
if(c < monitor ||
placement.rcNormalPosition.left != taskBarPlacement.rcNormalPosition.left ||
placement.rcNormalPosition.top != taskBarPlacement.rcNormalPosition.top ||
Key key;
// UNICODE FIX
bool frenchShift = (ch < 0x10000) ? (((VkKeyScan((uint16)ch) >> 8) & 6) == 6) : false;
-
+
if(msg == WM_CHAR || msg == WM_DEADCHAR)
{
wParam = 0;
code.ctrl = true;
if(key != leftAlt && key != rightAlt && ::GetKeyState(VK_MENU) & 0x80000 && !frenchShift)
code.alt = true;
-
+
if(msg == WM_MOUSEWHEEL)
{
result = window.KeyMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyHit, code, 0);
if(::GetKeyState(VK_CAPITAL))
ch = toupper(ch);
*/
-
+
if(msg == WM_KEYUP || msg == WM_SYSKEYUP)
{
- result = window.KeyMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyUp, code, ch);
+ result = window.KeyMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyUp, code, ch);
}
else
{
result = window.KeyMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyHit, code,ch);
}
}
-
+
return result;
}
if(wParam)
{
Window modalRoot = window.FindModal();
-
+
HWND modalWindow = modalRoot ? modalRoot.windowHandle : null;
FLASHWINFO flashInfo = { 0 };
{
for(window = guiApp.desktop.firstChild; window; window = window.next)
SetWindowPos(window.windowHandle, window.style.stayOnTop ? HWND_TOPMOST : HWND_TOP, 0,0,0,0,
- SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE); //|SWP_NOREDRAW);
+ SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE); //|SWP_NOREDRAW);
activateApp = false;
}
else
{
Window window;
-
+
if(wParam && !guiApp.desktop.active /*&& lParam != GetCurrentThreadID()*/)
{
activateApp = true;
/*
for(window = guiApp.desktop.firstChild; window; window = window.next)
SetWindowPos(window.windowHandle, window.style.stayOnTop ? HWND_TOPMOST : HWND_TOP, 0,0,0,0,
- SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE); //|SWP_NOREDRAW);
- */
+ SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOMOVE|SWP_NOSIZE); //|SWP_NOREDRAW);
+ */
}
guiApp.SetAppFocus((bool)wParam);
}
}
- else
+ else
guiApp.SetAppFocus((bool)wParam);
break;
case WM_PAINT:
BoxItem item = window.dirtyArea.count ? (BoxItem)ACCESS_ITEM(window.dirtyArea, window.dirtyArea.first) : null;
BeginPaint(windowHandle, &ps);
-
+
// Prevent flickering if we're going to update anyways
/*
- printf(" Paint message (%d, %d)-(%d, %d)\n",
+ printf(" Paint message (%d, %d)-(%d, %d)\n",
item ? item.box.left : 0,
item ? item.box.top : 0,
item ? item.box.right : 0,
item ? item.box.bottom : 0);
*/
- // Causes redraw bug...
+ // Causes redraw bug...
if(!window.manageDisplay || !item ||
- item.box.left > 0 ||
+ item.box.left > 0 ||
item.box.top > 0 ||
- item.box.right < window.size.w - 1 ||
+ item.box.right < window.size.w - 1 ||
item.box.bottom < window.size.h - 1)
{
Box box { ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right-1, ps.rcPaint.bottom-1 };
{
lastBits = (int)wParam;
lastRes = (int)lParam;
-
+
externalDisplayChange = true;
if(guiApp.desktop.DisplayModeChanged())
{
// Keyboard Messages
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
- case WM_SYSKEYUP:
+ case WM_SYSKEYUP:
case WM_KEYUP:
- case WM_CHAR:
- //case WM_DEADCHAR:
+ case WM_CHAR:
+ //case WM_DEADCHAR:
{
MSG charMsg;
DWORD min, max;
-
+
if(msg != WM_CHAR && window.composing)
break;
return HTCLIENT;
// Mouse Messages
- case WM_LBUTTONUP:
+ case WM_LBUTTONUP:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
case WM_LBUTTONDOWN:
case WM_MOUSEMOVE:
x = window.absPosition.x;
y = window.absPosition.y;
- /*case WM_NCLBUTTONUP:
+ /*case WM_NCLBUTTONUP:
case WM_NCRBUTTONUP:
case WM_NCMBUTTONUP:
case WM_NCLBUTTONDOWN:
{
Modifiers code = 0;
bool consequential = false;
-
+
x += (short)LOWORD(lParam);
y += (short)HIWORD(lParam);
if(wParam & MK_LBUTTON) code.left = true;
if(wParam & MK_MBUTTON) code.middle = true;
if(wParam & MK_RBUTTON) code.right = true;
-
+
if(msg == WM_MOUSEMOVE)
{
if(lastPos.x == x && lastPos.y == y)
break;
//case WM_NCLBUTTONDOWN:
case WM_LBUTTONDOWN:
- window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonDown,x,y,&code, false,
+ window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonDown,x,y,&code, false,
/*(msg == WM_LBUTTONDBLCLK) ? false: */true);
break;
//case WM_NCLBUTTONUP:
break;
//case WM_NCMBUTTONDOWN:
case WM_MBUTTONDOWN:
- window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleButtonDown, x,y,&code, false,
+ window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleButtonDown, x,y,&code, false,
(msg == WM_LBUTTONDBLCLK) ? false: true);
break;
//case WM_NCMBUTTONUP:
break;
//case WM_NCRBUTTONDOWN:
case WM_RBUTTONDOWN:
- window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonDown, x,y,&code, false,
+ window.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonDown, x,y,&code, false,
(msg == WM_LBUTTONDBLCLK) ? false: true);
break;
//case WM_NCRBUTTONUP:
bool CALLBACK ::JoystickAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, void * context )
{
- DIPROPRANGE diprg;
+ DIPROPRANGE diprg;
IDirectInputDevice2 * curJoy = (IDirectInputDevice2 *)context;
- diprg.diph.dwSize = sizeof(DIPROPRANGE);
- diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- diprg.diph.dwHow = DIPH_BYOFFSET;
+ diprg.diph.dwSize = sizeof(DIPROPRANGE);
+ diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ diprg.diph.dwHow = DIPH_BYOFFSET;
diprg.diph.dwObj = pdidoi->dwOfs;
- diprg.lMin = -128;
- diprg.lMax = 127;
+ diprg.lMin = -128;
+ diprg.lMax = 127;
if(curJoy->lpVtbl->SetProperty(curJoy, DIPROP_RANGE, &diprg.diph))
return DIENUM_STOP;
return DIENUM_CONTINUE;
void ::TerminateDirectInput()
{
int j;
- if (directMouse)
+ if (directMouse)
{
directMouse->lpVtbl->Unacquire(directMouse);
directMouse->lpVtbl->Release(directMouse);
#ifndef ECERE_NOJOYSTICK
for(j=0; j<numJoysticks; j++)
{
- if (directJoysticks[j])
+ if (directJoysticks[j])
{
directJoysticks[j]->lpVtbl->Unacquire(directJoysticks[j]);
directJoysticks[j]->lpVtbl->Release(directJoysticks[j]);
}
numJoysticks = 0;
#endif
- if(dInput)
+ if(dInput)
{
dInput->lpVtbl->Release(dInput);
dInput = null;
dInput->lpVtbl->EnumDevices(dInput, DIDEVTYPE_JOYSTICK, JoystickCallback, null, DIEDFL_ATTACHEDONLY );
for(j=0; j<NUMJOY; j++)
if(directJoysticks[j])
- if(!directJoysticks[j]->lpVtbl->SetDataFormat(directJoysticks[j], &c_dfDIJoystick ))
+ if(!directJoysticks[j]->lpVtbl->SetDataFormat(directJoysticks[j], &c_dfDIJoystick ))
directJoysticks[j]->lpVtbl->EnumObjects(directJoysticks[j], JoystickAxesCallback, directJoysticks[j], DIDFT_AXIS );
#endif
result = true;
directMouse->lpVtbl->SetCooperativeLevel(directMouse, /*fullScreenMode ? */windowHandle /*: HWND_DESKTOP*/, DISCL_EXCLUSIVE|DISCL_FOREGROUND);
directMouse->lpVtbl->Acquire(directMouse);
}
- else
+ else
directMouse->lpVtbl->Unacquire(directMouse);
}
#ifndef ECERE_NOJOYSTICK
// --- User Interface System ---
bool Initialize()
{
- WNDCLASS wcl =
- {
- CS_DBLCLKS, ApplicationWindow, 0L, 0L, 0,
- LoadIcon(null, IDI_APPLICATION),
+ WNDCLASS wcl =
+ {
+ CS_DBLCLKS, ApplicationWindow, 0L, 0L, 0,
+ LoadIcon(null, IDI_APPLICATION),
null,
null,
null,
1000.0 / 500.0,
TimerProc,0,TIME_PERIODIC);
*/
-
+
/*
topWindow = CreateWindowEx(0, className, "",WS_POPUP,0,0,1,1,HWND_DESKTOP,
null, hInstance, null);
if(hiResTimer) timeKillEvent(hiResTimer);
if(hertz)
hiResTimer = timeSetEvent(1000 / hertz, 1000 / hertz, TimerProc, 0, TIME_PERIODIC);
- }
+ }
bool ProcessInput(bool processAll)
{
{
windowHandle = CreateWindowEx(0, className, text,
WS_POPUP,
- 0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),
- HWND_DESKTOP,
+ 0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),
+ HWND_DESKTOP,
null, hInstance, null);
ShowWindow(windowHandle, SW_SHOWNORMAL);
}
else if(window.systemParent)
- windowHandle = CreateWindowEx(0, className, text,
+ windowHandle = CreateWindowEx(0, className, text,
WS_CHILD,0,0,1,1, window.systemParent, null, hInstance, null);
else
{
if(rootWindow && (window._isModal || window.style.interim))
parentWindow = rootWindow.is3D ? rootWindow.parent.windowHandle : rootWindow.windowHandle;
-
+
if(window.alphaBlend)
// if(window.background.a < 255) //&& window.style & ES_REDRAW) Not needed anymore?
exStyle |= WS_EX_LAYERED; // | WS_EX_TRANSPARENT;
windowHandle = CreateWindowEx(
exStyle,
className, text,
- style | (window.systemParent ? WS_CHILD :
+ style | (window.systemParent ? WS_CHILD :
(WS_POPUP | (window.style.hasMinimize ? WS_MINIMIZEBOX : 0))),
0,0,1,1, parentWindow, null, hInstance, null);
#if 0
#endif
// SetLayeredWindowAttributes(window.windowHandle, 0, 255 /*Max(A(window.background),1)*/, LWA_ALPHA);
}
- }
+ }
}
void OffsetWindow(Window window, int * x, int * y)
{
case maximized:
case normal:
- ShowWindow(window.windowHandle, ((window.active || window.creationActivation == activate) && !externalDisplayChange) ?
+ ShowWindow(window.windowHandle, ((window.active || window.creationActivation == activate) && !externalDisplayChange) ?
((window.nativeDecorations && state == maximized) ? SW_MAXIMIZE : SW_SHOWNORMAL) : SW_SHOWNOACTIVATE);
break;
case minimized:
void SetCaret(int x, int y, int size)
{
- }
+ }
// --- Clipboard manipulation ---
middle = (dims.rgbButtons[2] & 0x80) ? true : false };
}
#endif
-
+
return result;
}
{
DIJOYSTATE dijs = {0};
#ifndef ECERE_NOJOYSTICK
- if(acquiredWindow && device < numJoysticks)
+ if(acquiredWindow && device < numJoysticks)
{
- if(directJoysticks[device])
+ if(directJoysticks[device])
{
directJoysticks[device]->lpVtbl->Poll(directJoysticks[device]);
if(directJoysticks[device]->lpVtbl->GetDeviceState(directJoysticks[device], sizeof(DIJOYSTATE), &dijs ))
joystick.rx = dijs.lRx;
joystick.ry = dijs.lRy;
joystick.rz = dijs.lRz;
- joystick.buttons =
+ joystick.buttons =
((dijs.rgbButtons[0] & 0x80) ? JOY_BUTTON1 : 0)
| ((dijs.rgbButtons[1] & 0x80) ? JOY_BUTTON2 : 0)
| ((dijs.rgbButtons[2] & 0x80) ? JOY_BUTTON3 : 0)
PixelFormat format = window.display.pixelFormat;
int bits = GetDepthBits(format);
bool blend;
-
+
bitmap.Convert(null, pixelFormat888, null);
and.Allocate(null, (bitmap.width+7/8), bitmap.height, 0, pixelFormat8, false);
}
if(bits == 15) { bits = 16; format = pixelFormat565; };
bitmap.Convert(null, format, null);
-
+
icon = CreateIcon(hInstance, bitmap.width, bitmap.height, 1, (byte)bits, and.picture, bitmap.picture);
delete and;
}
GetMonitorInfo(monitor, &info);
// box = { info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom };
box = { info.rcMonitor.left, info.rcMonitor.top, info.rcMonitor.right-1, info.rcMonitor.bottom-1 };
-
+
if(taskBarMonitor == monitor)
{
if(taskBarPlacement.rcNormalPosition.top <= box.top && taskBarPlacement.rcNormalPosition.bottom >= box.bottom)
box.top -= desktopY;
box.right -= desktopX;
box.bottom -= desktopY;
- }
+ }
}
}
XVisualInfo vinfo;
XVisualInfo *vinfo_ret;
int numitems;
-
+
vinfo._class = TrueColor;
vinfo_ret = XGetVisualInfo(dpy, VisualClassMask, &vinfo, &numitems);
if(numitems)
return vinfo.visual;
}
}
- }
+ }
return null;
}
int w, h;
Screen * x_screen = XDefaultScreenOfDisplay(xGlobalDisplay);
X11Window x_root;
- int current = 0;
+ int current = 0;
char *data = null;
int format;
unsigned long len, fill;
w = XDisplayWidth(xGlobalDisplay, DefaultScreen(xGlobalDisplay));
h = XDisplayHeight(xGlobalDisplay, DefaultScreen(xGlobalDisplay));
x_root = XRootWindowOfScreen(x_screen);
-
+
if(atoms[_net_number_of_desktops] != None)
{
if(XGetWindowProperty(xGlobalDisplay, x_root, atoms[_net_number_of_desktops], 0, 1, False,
{
printf("cant get xa desktops property\n");
}
-
+
if(data)
{
int desktops = 0;
data = null;
}
}
-
+
if(atoms[_net_current_desktop] != None)
- {
+ {
if(XGetWindowProperty(xGlobalDisplay, x_root, atoms[_net_current_desktop], 0, 1, False,
XA_CARDINAL, &type, &format, &len, &fill,
&data) != Success)
{
printf("cant get xa current property\n");
}
-
+
if(data)
{
current = (int)*(long *)data;
//printf("_NET_CURRENT_DESKTOP is %d\n", current);
}
- }
+ }
if(atoms[_net_workarea] != None)
{
long *workareas;
{
//printf("warning\n");
}
-
+
/*
if(type == None || format == 0)
printf("warning\n");
if(fill)
printf("warning\n");
-
+
if(len % 4)
printf("warning\n");
*/
-
+
if(data)
{
workareas = (long *)data;
-
+
x = (int)workareas[current * 4];
y = (int)workareas[current * 4 + 1];
w = (int)workareas[current * 4 + 2];
/*
key = key - 8;
//Logf("Got 0x%x (%d)\n", key, key);
-
+
switch(key)
{
case KEYCODE_HOME: key = home; break;
case KEYCODE_DEL: key = del; break;
case KEYCODE_SLASH: key = keyPadSlash; break;
}
-
+
ch = (byte)Interface::TranslateKey(key, event->state & ShiftMask);
*/
/*
if(!buf)
buf = malloc((uint)bufsize);
if(windowData && windowData.ic)
- {
+ {
buflength = XmbLookupString(windowData.ic, event, buf, (int)bufsize, &keysym, &status);
if (status == XBufferOverflow)
{
// case XK_Begin:
// case XK_Select:
- // case XK_Print:
+ // case XK_Print:
// case XK_Execute:
case XK_Insert: key = insert; break;
// case XK_Undo:
// case XK_script_switch:
case XK_Num_Lock: key = numLock; break;
- // case XK_KP_Space:
+ // case XK_KP_Space:
// case XK_KP_Tab:
case XK_KP_Enter: key = keyPadEnter; break;
// case XK_KP_F1:
case XK_KP_Add: key = keyPadPlus; break;
case XK_KP_Separator:key = keyPadDelete; break;
case XK_KP_Subtract: key = keyPadMinus; break;
- // case XK_KP_Decimal:
+ // case XK_KP_Decimal:
case XK_KP_Divide: key = keyPadSlash; break;
case XK_KP_0: key = keyPad0; break;
case XK_Control_L: key = leftControl; break;
case XK_Control_R: key = rightControl; break;
case XK_Caps_Lock: key = capsLock; break;
- // case XK_Shift_Lock:
+ // case XK_Shift_Lock:
// case XK_Meta_L:
// case XK_Meta_R:
case XK_Alt_L: key = leftAlt; break;
code.alt = true;
/*buflength = 0;
ch = 0;*/
- }
+ }
#endif
// Logf("Key Message: %s, keysym: 0x%x, key: %d state: %d, ch: %c\n", release ? ((release == 2) ? "REPEAT" : "KeyRelease") : "KeyPress", keysym, key, event->state, (byte)ch);
int numBytes;
ch = UTF8GetChar(buf + c, &numBytes);
if(ch == 127) ch = 0;
- result = window.KeyMessage((c == 0) ?
+ result = window.KeyMessage((c == 0) ?
__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyDown : __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyHit,
(c == 0) ? code : 0, ch);
c += numBytes;
}
else
result = window.KeyMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyHit, code, ch);
- }
+ }
}
delete window;
-
+
return result;
}
/*
//bool waitSemaphore = false;
fd_set readSet, writeSet, exceptSet;
struct timeval tv = { (timerDelay == MAXINT) ? 0 : (timerDelay / 1000000), (timerDelay == MAXINT) ? (int)(1000000 / 18.2) : (timerDelay % 1000000) };
-
+
if(xTerminate) break;
FD_ZERO(&readSet);
FD_ZERO(&writeSet);
PropertyChangeMask, (union _XEvent *)&event);
}
xMutex.Release();
- guiApp.SignalEvent();
+ guiApp.SignalEvent();
xSemaphore.Wait();
#if 0
//int attempts = 0;
//Logf("Wait for viewable %s\n", window.name);
XFlush(xGlobalDisplay);
- //while(attempts++ < 40)
+ //while(attempts++ < 40)
while(true)
{
XWindowAttributes attributes = { 0 };
{
bool terminate;
uint delay;
-
+
void Stop()
{
if(started)
Wait();
}
}
-
+
uint Main()
{
while(!terminate)
joystickFD[1] = open("/dev/js1", O_RDONLY);
joystickFD[2] = open("/dev/js2", O_RDONLY);
joystickFD[3] = open("/dev/js3", O_RDONLY);
-
+
if(xGlobalDisplay)
{
XWindowAttributes attributes = { 0 };
XVisualInfo vinfo;
XVisualInfo *vinfo_ret;
int numitems = 0;
-
+
vinfo.visualid = XVisualIDFromVisual(xSystemVisual);
vinfo_ret = XGetVisualInfo(xGlobalDisplay, VisualIDMask, &vinfo, &numitems);
if(numitems)
else
printf("Could not get a 555 visual\n");
*/
- }
+ }
break;
}
}
// printf("Got a depth of %d\n", xSystemDepth);
- {
+ {
int major, minor, pixmaps;
xSharedMemory = XShmQueryExtension(xGlobalDisplay) && XShmQueryVersion(xGlobalDisplay, &major, &minor, &pixmaps) && pixmaps;
- }
+ }
// printf("Opening IM\n");
im = XOpenIM(xGlobalDisplay, null, null, null);
XkbSetDetectableAutoRepeat(xGlobalDisplay, True, &autoRepeatDetectable);
XInternAtoms(xGlobalDisplay, (char**)atomNames, AtomIdents::enumSize, False, atoms);
-
+
{
Atom protocols[2] = { atoms[wm_delete_window], atoms[wm_take_focus] };
/*
XIMStyles *IMcando;
- XIMStyle clientCanDo;
+ XIMStyle clientCanDo;
XIMStyle styleWeWillUse = null;
int i;
XVaNestedList arglist;
XIMPreeditPosition | XIMStatusArea |
XIMPreeditArea | XIMStatusArea |
XIMPreeditNothing | XIMStatusNothing;
-
+
for(i=0; i<IMcando->count_styles; i++)
{
XIMStyle tmpStyle;
XSetICFocus(ic);
*/
}
-
+
xMutex.Wait();
timerThread = Thread { };
incref timerThread;
timerThread.Create();
return true;
- }
+ }
}
return false;
}
break;
}
case MotionNotify:
- {
+ {
static uint lastTime = 0;
XMotionEvent * event = (XMotionEvent *) thisEvent;
while(XCheckIfEvent(xGlobalDisplay, (XEvent *)thisEvent, EventChecker, (void *)MotionNotify));
}
else
respond.xselection._property = None;
-
+
respond.xselection.type = SelectionNotify;
respond.xselection.display = req->display;
respond.xselection.requestor = req->requestor;
if(XCheckTypedWindowEvent(xGlobalDisplay, thisEvent->window, FocusOut, (XEvent *)thisEvent))
{
XFocusChangeEvent *event = (XFocusChangeEvent *) thisEvent;
-
+
XFindContext(xGlobalDisplay, thisEvent->window, windowContext, (XPointer *) &window);
if(window)
{
{
XWindowData windowData;
XFindContext(xGlobalDisplay, thisEvent->window, windowContext, (XPointer *) &window);
-
+
if(window)
{
XFocusChangeEvent *event = (XFocusChangeEvent *) thisEvent;
{
XCheckTypedEvent(xGlobalDisplay, /*thisEvent->window, */ButtonPress, (XEvent *)thisEvent);
}
-
+
//delete lastActive;
/*
lastActive = window;
X11Window rootChild;
int rootX, rootY;
XTranslateCoordinates(xGlobalDisplay, event->window,
- RootWindow(xGlobalDisplay, DefaultScreen(xGlobalDisplay)), 0, 0,
+ RootWindow(xGlobalDisplay, DefaultScreen(xGlobalDisplay)), 0, 0,
&rootX, &rootY, &rootChild);
x = rootX;
y = rootY;
activeWindow = (X11Window)window.windowHandle;
timeStamp = (int)event->data.l[1];
-
+
windowData = window.windowData;
laterFocus = windowData.laterFocus;
windowData.laterFocus = true;
if(guiApp.interimWindow && guiApp.interimWindow.created && window != guiApp.interimWindow) break; //window == window.parent.activeChild) break;
// if(window == window.parent.activeChild) break;
incref window;
-
+
{
XEvent checkEvent;
//XFlush(xGlobalDisplay);
else
{
XSetInputFocus(xGlobalDisplay, (X11Window)window.windowHandle, RevertToPointerRoot, (uint)timeStamp);
- window.ExternalActivate(true, true, window, null); // lastActive);
+ window.ExternalActivate(true, true, window, null); // lastActive);
if(windowData && windowData.ic)
{
// XSetICValues(ic, XNClientWindow, window.windowHandle, XNFocusWindow, window.windowHandle, 0);
GLX_BLUE_SIZE, 1
};
int numAttribs = 14;
-
+
GLXFBConfig *fbconfigs = null, fbconfig;
int numfbconfigs;
int i;
}
if(!visualInfo)
{
- int attrList[] =
+ int attrList[] =
{
GLX_USE_GL, GLX_DEPTH_SIZE, 1,
- GLX_RGBA,
+ GLX_RGBA,
GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
+ GLX_DOUBLEBUFFER,
None
};
visualInfo = glXChooseVisual(xGlobalDisplay, DefaultScreen(xGlobalDisplay), attrList);
if(fullScreenMode)
{
windowHandle = XCreateWindow(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay),
- 0,0,guiApp.desktop.size.w,guiApp.desktop.size.h,0, depth, InputOutput, visual ? visual : CopyFromParent,
+ 0,0,guiApp.desktop.size.w,guiApp.desktop.size.h,0, depth, InputOutput, visual ? visual : CopyFromParent,
CWEventMask | (visual ? (CWColormap | CWBorderPixel) : 0)/*| CWOverrideRedirect*/, &attributes);
}
/*
if(window.style.showInTaskBar)
parentWindow = (X11Window)null;
- windowHandle = XCreateWindow(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay),
- 0,0,1,1,0, depth, InputOutput, visual ? visual : CopyFromParent,
+ windowHandle = XCreateWindow(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay),
+ 0,0,1,1,0, depth, InputOutput, visual ? visual : CopyFromParent,
CWEventMask | CWOverrideRedirect | (visual ? (CWColormap | CWBorderPixel) : 0), &attributes);
if(parentWindow && (window.interim || window.isModal))
int num_missing_charsets = 0;
char *default_string;
XFontSet fontset;
- XRectangle area = { 0, 0, 400, 400 };
+ XRectangle area = { 0, 0, 400, 400 };
XVaNestedList argList;
// sprintf(fontString, "-*-%s-*-r-*-*-*-%d-*-*-*-*-*-*", "Helvetica" /*window.font.faceName*/, (int)(window.font.size * 20));
fontset = XCreateFontSet(xGlobalDisplay, fontString, &missing_charsets, &num_missing_charsets, &default_string);
argList = XVaCreateNestedList(0,
- XNSpotLocation, &cursor_location,
+ XNSpotLocation, &cursor_location,
//XNArea, &area,
XNFontSet, fontset,/*
XNForeground,
*/
{
- if ( atoms[_motif_wm_hints] != None )
+ if ( atoms[_motif_wm_hints] != None )
{
MWM_Hints hints
{
if(atoms[_net_wm_pid] != None)
{
int pid = getpid();
- // printf("Setting _NET_WM_PID to %d\n", pid);
+ // printf("Setting _NET_WM_PID to %d\n", pid);
XChangeProperty(xGlobalDisplay, windowHandle, atoms[_net_wm_pid], XA_CARDINAL, 32,
- PropModeReplace, (unsigned char*)&pid, 1);
+ PropModeReplace, (unsigned char*)&pid, 1);
}
}
-
+
/*
{
Atom protocolsAtom = XInternAtom(xGlobalDisplay, "WM_PROTOCOLS", False);
- if ( protocolsAtom != None )
+ if ( protocolsAtom != None )
{
MWM_Hints hints = { MWM_HINTS_DECORATIONS|MWM_HINTS_FUNCTIONS, 0, 0, 0, 0 };
XChangeProperty(xGlobalDisplay, windowHandle, atoms[_motif_wm_hints], atoms[_motif_wm_hints], 32,
}*/
// XFlush(xGlobalDisplay);
window.windowData = XWindowData { visualInfo, ic };
-
+
XSaveContext(xGlobalDisplay, windowHandle, windowContext, (XPointer)window);
XSelectInput(xGlobalDisplay, windowHandle, mask);
{
XEvent event;
- XDeleteContext(xGlobalDisplay, (XID)window, windowContext);
+ XDeleteContext(xGlobalDisplay, (XID)window, windowContext);
XSaveContext(xGlobalDisplay, (X11Window)window.windowHandle, windowContext, null);
XDestroyWindow(xGlobalDisplay, (X11Window)window.windowHandle);
XSync(xGlobalDisplay, 0);
atoms[utf8_string], 8, PropModeReplace, (byte *)name, name ? strlen(name) : 0);
XChangeProperty(xGlobalDisplay, (X11Window)window.windowHandle, atoms[wm_name],
atoms[utf8_string], 8, PropModeReplace, (byte *)name, name ? strlen(name) : 0);
- }
+ }
}
void PositionRootWindow(Window window, int x, int y, int w, int h, bool move, bool resize)
WaitForViewableWindow(window);
if(window.creationActivation == activate && state != minimized)
ActivateRootWindow(window);
-
+
if(state == minimized)
{
uint iconic = IconicState;
XChangeProperty(xGlobalDisplay, window.windowHandle, atoms[wm_state], XA_CARDINAL, 32,
PropModeReplace, &iconic, 1);
*/
-
+
/*
XClientMessageEvent event = { 0 };
event.type = ClientMessage;
// With native decorations, we do it the first time
// or the WM (Gnome) is sticking it to the top/right!
- XMoveResizeWindow(xGlobalDisplay,
+ XMoveResizeWindow(xGlobalDisplay,
(X11Window)window.windowHandle,
x, y, w, h);
UpdateRootWindow(window);
event.send_event = 1;
event.format = 32;
event.data.l[0] = 0;
-
+
//event.data.l[0] = 2;
//event.data.l[1] = timeStamp;
-
+
//event.data.l[1] = atoms[_net_wm_user_time];
//event.data.l[2] = activeWindow; //guiApp.desktop.activeChild.windowHandle;
-
+
#ifdef _DEBUG
//printf("(ActivateRootWindow) Setting _NET_ACTIVE_WINDOW for %s (%x)\n", window._class.name, window);
#endif
-
+
XSendEvent(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay), bool::false, SubstructureRedirectMask | SubstructureNotifyMask, (union _XEvent *)&event);
//#if defined(__APPLE__)
XSetInputFocus(xGlobalDisplay, (X11Window)window.windowHandle, RevertToPointerRoot, CurrentTime);
unsigned int state;
((GuiApplication)__thisModule.application).Lock();
//XLockDisplay(xGlobalDisplay);
- XQueryPointer(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay), &childWindow,
+ XQueryPointer(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay), &childWindow,
&rootWindow, x, y, &mx, &my, &state);
//XUnlockDisplay(xGlobalDisplay);
((GuiApplication)__thisModule.application).Unlock();
{
((GuiApplication)__thisModule.application).Lock();
//XLockDisplay(xGlobalDisplay);
- if(box && box.left > 0 && box.top > 0 &&
+ if(box && box.left > 0 && box.top > 0 &&
box.right < guiApp.desktop.clientSize.w - 1 && box.bottom < guiApp.desktop.clientSize.h - 1)
{
if(!window.parent || !window.parent.display)
{
- XMoveResizeWindow(xGlobalDisplay, confineWindow, box.left + desktopX, box.top + desktopY,
+ XMoveResizeWindow(xGlobalDisplay, confineWindow, box.left + desktopX, box.top + desktopY,
box.right - box.left + 1, box.bottom - box.top + 1);
-
+
if(!restrictedWindow)
XMapWindow(xGlobalDisplay, confineWindow);
}
else
XUngrabPointer(xGlobalDisplay, CurrentTime);
-
+
if(restrictedWindow)
XUnmapWindow(xGlobalDisplay, confineWindow);
else if(capturedWindow != None)
{
if(restrictedWindow)
- XGrabPointer(xGlobalDisplay, (X11Window) restrictedWindow.rootWindow.windowHandle, False,
+ XGrabPointer(xGlobalDisplay, (X11Window) restrictedWindow.rootWindow.windowHandle, False,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask, GrabModeAsync,
GrabModeAsync, confineWindow, fullScreenMode ? nullCursor : None, CurrentTime);
else
XSetICValues(windowData.ic, XNPreeditAttributes, argList, 0);
}
}
- }
+ }
void ClearClipboard()
{
{
bool result = false;
if((clipBoard.text = new0 byte[size]))
- result = true;
+ result = true;
return result;
}
if(clipBoard.text)
{
Window rootWindow = guiApp.desktop;
- if(!fullScreenMode)
+ if(!fullScreenMode)
{
- for(rootWindow = rootWindow.children.first;
- rootWindow && !rootWindow.windowHandle;
+ for(rootWindow = rootWindow.children.first;
+ rootWindow && !rootWindow.windowHandle;
rootWindow = rootWindow.next);
}
if(clipBoardData)
delete clipBoardData;
else if(rootWindow)
- XSetSelectionOwner(xGlobalDisplay, atoms[clipboard],
+ XSetSelectionOwner(xGlobalDisplay, atoms[clipboard],
(X11Window) rootWindow.windowHandle, CurrentTime);
clipBoardData = clipBoard.text;
clipBoard.text = null;
Window rootWindow = guiApp.desktop;
if(!fullScreenMode)
{
- for(rootWindow = rootWindow.children.first;
- rootWindow && !rootWindow.windowHandle;
+ for(rootWindow = rootWindow.children.first;
+ rootWindow && !rootWindow.windowHandle;
rootWindow = rootWindow.next);
}
if(rootWindow)
bool GetJoystickState(int device, Joystick joystick)
{
bool result = false;
- #if defined(__linux__)
+ #if defined(__linux__)
if(joystick && device < 4)
{
struct JS_DATA_TYPE js = { 0 };
result = true;
}
}
- #endif
+ #endif
return result;
}
hiResTimer.Create();
}
*/
- }
+ }
bool SetIcon(Window window, BitmapResource resource)
{
#import <Cocoa/Cocoa.h>
-
+
#import "CocoaEcereBridge.h"
#import "EcereView.h"
{
[[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
-
+
[NSOpenGLContext clearCurrentContext];
return true;
untilDate:nil
inMode:NSDefaultRunLoopMode
dequeue:YES];
-
+
[NSApp sendEvent:event];
- if ([event type])
+ if ([event type])
printf("e%i\n", [event type]);
} while (event && processAll);
bool CocoaLock(WindowHandle handle)
{
EcereView *view = (EcereView*)handle;
-
+
[view lockFocus];
-
+
return true;
}
{
EcereView *view = (EcereView*)handle;
- [view unlockFocus];
+ [view unlockFocus];
}
void CocoaGetCurrentMode(bool * fullScreen, int * resolution, int * colorDepth, int * refreshRate)
WindowHandle CocoaCreateRootWindow(EcereWindowRef ecereWindow)
{
NSWindow *window = [[NSWindow alloc]
- initWithContentRect:NSZeroRect
- styleMask:( NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask)
- backing:NSBackingStoreBuffered
+ initWithContentRect:NSZeroRect
+ styleMask:( NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask)
+ backing:NSBackingStoreBuffered
defer:NO
screen:nil];
-
+
EcereView *view = [[EcereView alloc] initWithEcereWindow:ecereWindow];
[window setContentView:view];
-
+
if (window) {
[window makeKeyAndOrderFront:window];
}
-
+
return view;
}
void CocoaDestroyRootWindow(WindowHandle handle)
{
EcereView *view = (EcereView*)handle;
-
+
[[view window] release];
[view release];
}
void CocoaSetRootWindowCaption(WindowHandle handle, char *name)
{
EcereView *view = (EcereView*)handle;
-
+
NSString *title = [NSString stringWithCString:name];
-
+
[[view window] setTitle:title];
-
+
[title release];
}
void CocoaPositionRootWindow(WindowHandle handle, int x, int y, int w, int h, bool move, bool resize)
{
EcereView *view = (EcereView*)handle;
-
+
NSRect frame = [[view window] frame];
-
+
if (move) {
frame.origin.x = x;
frame.origin.y = y;
}
-
+
if (resize) {
frame.size.width = w;
frame.size.height = h;
}
-
+
[[view window] setFrame:frame display:YES];
}
void CocoaGetMousePosition(int *x, int *y)
{
- NSPoint location;
+ NSPoint location;
location = [NSEvent mouseLocation];
*x = location.x;
void CocoaOpenGLMakeCurrentContext(WindowHandle handle)
{
EcereView *view = (EcereView*)handle;
-
+
[view makeCurrentContext];
}
void CocoaOpenGLUpdate(WindowHandle handle)
{
- EcereView *view = (EcereView*)handle;
-
+ EcereView *view = (EcereView*)handle;
+
[view flushOpenGLBuffer];
}
bool Initialize()
{
bool result;
-
+
printf("Initialize %s:%i\n", __FILE__, __LINE__);
result = CocoaInitialize();
-
+
return result;
}
bool ProcessInput(bool processAll)
{
bool result;
-
+
//printf("ProcessInput %s:%i\n", __FILE__, __LINE__);
result = CocoaProcessInput(processAll);
-
+
return result;
}
{
static char *graphicsDrivers[] = { "CocoaOpenGL" };
*numDrivers = sizeof(graphicsDrivers) / sizeof(char *);
-
+
return (char **)graphicsDrivers;
}
void GetCurrentMode(bool * fullScreen, int * resolution, int * colorDepth, int * refreshRate)
- {
+ {
printf("GetCurrentMode %s:%i\n", __FILE__, __LINE__);
CocoaGetCurrentMode(fullScreen, resolution, colorDepth, refreshRate);
}
bool ScreenMode(bool fullScreen, int resolution, int colorDepth, int refreshRate, bool * textMode)
{
printf("STUB! %s:%i\n", __FILE__, __LINE__);
-
+
*textMode = false;
return true;
}
// TODO:
printf("CreateRootWindow %s:%i\n", __FILE__, __LINE__);
window.windowHandle = CocoaCreateRootWindow(window);
-
+
return window.windowHandle;
}
// TODO:
printf("STUB! %s:%i\n", __FILE__, __LINE__);
}
-
+
void ActivateRootWindow(Window window)
{
// TODO:
{
// TODO:
printf("STUB! %s:%i\n", __FILE__, __LINE__);
- }
+ }
void ClearClipboard()
{
{
// TODO:
printf("STUB! %s:%i\n", __FILE__, __LINE__);
- }
+ }
bool SetIcon(Window window, BitmapResource resource)
{
// TODO:
printf("STUB! %s:%i\n", __FILE__, __LINE__);
-
+
return true;
}
}
@private
// Reference to the Ecere Window class via pointer. Used for callbacks.
EcereWindowRef _ecereWindow;
-
+
// Foreground and background draw color.
CocoaColor _foreground;
CocoaColor _background;
-
+
int lockCount;
-
+
NSOpenGLContext *_context;
NSOpenGLPixelFormat *_pixelformat;
}
@implementation EcereView
- (EcereView*)initWithEcereWindow:(EcereWindowRef)ecereWindow;
-{
+{
self = [super initWithFrame:NSZeroRect];
-
+
lockCount = 0;
-
+
if (self != nil)
- {
+ {
NSOpenGLPixelFormatAttribute attributes[] =
- {
+ {
NSOpenGLPFAWindow,
//NSOpenGLPFAAccelerated,
NSOpenGLPFADoubleBuffer,
// exceeds these requirements
0
};
-
+
_pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] ;
-
+
if (_pixelformat == nil)
- {
+ {
NSLog( @"No valid OpenGL pixel format" );
NSLog( @"matching attributes specified" );
exit(1);
}
-
+
[self setEcereWindow:ecereWindow];
-
+
_context = [[NSOpenGLContext alloc]
initWithFormat:_pixelformat shareContext:nil] ;
-
+
if (_context == nil)
{
// Failed initialization
NSLog( @"No valid OpenGL" ) ;
exit(1);
}
- else
+ else
{
// ensure we are pointing to ourself as the Drawable
[_context setView:self];
}
}
-
+
if (_context == nil) {
self = nil;
}
-
+
return self;
}
}
- (NSOpenGLContext*)openGLContext
-{
+{
return _context;
}
- (void)lockFocus
-{
+{
// ensure we are ready to draw
lockCount++;
-
+
[_context setView:self];
[super lockFocus];
-
+
[self makeCurrentContext];
-
+
printf("- (void)lockFocus(%i)\n", lockCount);
}
- (void)unlockFocus
-{
+{
lockCount--;
[self flushOpenGLBuffer];
-
+
[super unlockFocus];
printf("- (void)unlockFocus(%i)\n", lockCount);
- (void)makeCurrentContext
{
printf("- (void)makeCurrentContext\n");
-
+
[_context makeCurrentContext];
}
}
- drawRect:(NSRect)rect
-{
+{
// make us the current OpenGL context
//[_context makeCurrentContext];
printf("- drawRect:(NSRect)rect\n");
// Register with window for resize and move notification.
[[NSNotificationCenter defaultCenter]
addObserver:self
- selector:@selector(windowResized:)
+ selector:@selector(windowResized:)
name:NSWindowDidResizeNotification
object:[self window]];
[[NSNotificationCenter defaultCenter]
addObserver:self
- selector:@selector(windowMoved:)
+ selector:@selector(windowMoved:)
name:NSWindowDidMoveNotification
object:[self window]];
}
NSRect rect = [[self window] frame];
CocoaDispatch_ExternalPosition([self ecereWindow], rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
-
+
printf("- (void)windowResized:(NSNotification *)notification\n");
}
NSRect rect = [[self window] frame];
CocoaDispatch_ExternalPosition([self ecereWindow], rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
-
+
printf("- (void)windowMoved:(NSNotification *)notification\n");
}
- setEcereWindow:(EcereWindowRef)ecereWindow
{
- _ecereWindow = ecereWindow;
+ _ecereWindow = ecereWindow;
}
- (void)mouseDown:(NSEvent *)event
{
NSPoint location = [NSEvent mouseLocation];
-
+
CocoaKeyMod mod;
-
+
CocoaDispatch_OnLeftButtonDown([self ecereWindow], location.x, location.y, mod);
}
#define BORDER 5 //4
#define TOP 3
#define BOTTOM (4 + 2)
-#define CORNER (BORDER * 2 + 6)
+#define CORNER (BORDER * 2 + 6)
#define CAPTION 22 // 20
#define DEAD_BORDER 0 //3
#define MIN_WIDTH 68
int w = 14;// * sizeW / 14;
int sideH = 10; // * sizeW / 14;
int middleH = size.h - 2 * (sideH + y);
-
+
surface.Stretch(left.bitmap, x, y, 0,0, w, sideH, left.bitmap.width, left.bitmap.height);
surface.HTile(middle.bitmap, x, y + sideH, w, middleH);
surface.Stretch(right.bitmap, x, y + sideH + middleH, 0,0, w, sideH, right.bitmap.width, right.bitmap.height);
-
+
/*
surface.Filter(left.bitmap, x, y, 0,0, w, sideH, left.bitmap.width, left.bitmap.height);
surface.FilterVTile(middle.bitmap, x, y + sideH, w, middleH);
surface.Filter(right.bitmap, x, y + sideH + middleH, 0,0, w, sideH, right.bitmap.width, right.bitmap.height);
*/
}
-
+
static bool Button::ThumbIsInside(int x, int y)
{
return (x >= 0 && y >= 0 && x < size.w && y < size.h);
}
return true;
}
-
+
void OnRedraw(Surface surface)
{
surface.VTile(bmpScrollVert.bitmap, 0, 0, clientSize.w, clientSize.h);
}
void OnRedraw(Surface surface)
- {
+ {
if(bitmap)
{
return PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface);
surface.Filter(left.bitmap, x, y, 0,0, sideW, h, left.bitmap.width, left.bitmap.height);
surface.FilterHTile(middle.bitmap, x + sideW, y, middleW, h);
surface.Filter(right.bitmap, x + sideW + middleW, y, 0,0, sideW, h, left.bitmap.width, left.bitmap.height);
-
+
surface.CenterTextf(clientSize.w/2 + offset, (clientSize.h - textH * 1.1) / 2 + offset, text);
}
}
-char * cursorsBitmaps[] =
+char * cursorsBitmaps[] =
{
"<:ecere>cursors/arrow.png",
"<:ecere>cursors/iBeam.png",
deepBottom = (((BorderBits)borderStyle).fixed /*sizable*/ && isNormal) ? bottom : border;
}
- surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
+ surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
size.w - deepBorder - deepBorder, size.h - deepBottom - deepTop);
}
surface.SetForeground(activeBorder);
surface.Rectangle(2, 2, size.w-3, size.h-3);
- // Resizeable frame is 1 pixel thicker
+ // Resizeable frame is 1 pixel thicker
if(((BorderBits)borderStyle).sizable && isNormal)
surface.Rectangle(3, 3, size.w - 4, size.h - 4);
surface.Gradient(gradient, sizeof(gradient) / sizeof(ColorKey), GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
else
- surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
+ surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
*/
// surface.blend = rootWindow != this;
surface.Blit(bmpTopLeftBorder.bitmap, 0, 0, 0, 0, bmpTopLeftBorder.bitmap.width, bmpTopLeftBorder.bitmap.height);
- surface.Stretch(bmpTopBorder.bitmap, bmpTopLeftBorder.bitmap.width, 0, 0, 0, size.w - 2 * bmpTopLeftBorder.bitmap.width, bmpTopBorder.bitmap.height,
+ surface.Stretch(bmpTopBorder.bitmap, bmpTopLeftBorder.bitmap.width, 0, 0, 0, size.w - 2 * bmpTopLeftBorder.bitmap.width, bmpTopBorder.bitmap.height,
bmpTopBorder.bitmap.width, bmpTopBorder.bitmap.height);
surface.Blit(bmpTopRightBorder.bitmap, size.w - bmpTopRightBorder.bitmap.width, 0, 0, 0, bmpTopRightBorder.bitmap.width, bmpTopRightBorder.bitmap.height);
surface.Stretch(bmpRightBorder.bitmap, size.w-9, 27, 0, 0, bmpRightBorder.bitmap.width, size.h - 27 - 9, bmpLeftBorder.bitmap.width, bmpLeftBorder.bitmap.height);
surface.Blit(bmpBottomLeftBorder.bitmap, 0, size.h - 9, 0, 0, bmpBottomLeftBorder.bitmap.width, bmpBottomLeftBorder.bitmap.height);
- surface.Stretch(bmpBottomBorder.bitmap, bmpBottomLeftBorder.bitmap.width, size.h - 9, 0, 0, size.w - 2 * bmpBottomLeftBorder.bitmap.width, bmpBottomBorder.bitmap.height,
+ surface.Stretch(bmpBottomBorder.bitmap, bmpBottomLeftBorder.bitmap.width, size.h - 9, 0, 0, size.w - 2 * bmpBottomLeftBorder.bitmap.width, bmpBottomBorder.bitmap.height,
bmpBottomBorder.bitmap.width, bmpBottomBorder.bitmap.height);
surface.Blit(bmpBottomRightBorder.bitmap, size.w - bmpBottomRightBorder.bitmap.width, size.h - 9, 0, 0, bmpBottomRightBorder.bitmap.width, bmpBottomRightBorder.bitmap.height);
//surface.alphaWrite = DontWrite;
{
int buttonsSize = border +
((hasMaximize || hasMinimize) ? 60 : 26);
- surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
+ surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
size.w - (buttonsSize + border + NAME_OFFSETX /*4*/), name, strlen(name));
}
}
Copyright (c) 2001-2007 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
tvision.ec - TurboVision'ish skin implementation
****************************************************************************/
import "Skin"
int corner = (style.sizable && state == normal) ? CORNER : 0;
int border = (style.sizable && state == normal) ? BORDER : 0;
int top = (style.sizable && state == normal) ? TOP : 0;
-
+
// Special case for having caption on resize bar
if(!CAPTION)
result = Box { corner, 0, w-corner-1, TOP-1 }.IsPointInside({x, y});
{ ColorAlpha { 255, Color { 192, 192, 192 } }, 1.00f }
};
*/
-char * cursorsBitmaps[] =
+char * cursorsBitmaps[] =
{
"<:ecere>cursors/arrow.png",
"<:ecere>cursors/iBeam.png",
deepBottom = (((BorderBits)borderStyle).sizable && isNormal) ? bottom : border;
}
- surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
+ surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
size.w - deepBorder - deepBorder, size.h - deepBottom - deepTop);
}
surface.SetForeground(formColor);
surface.Rectangle(2, 2, size.w-3, size.h-3);
- // Resizeable frame is 1 pixel thicker
+ // Resizeable frame is 1 pixel thicker
if(((BorderBits)borderStyle).sizable && isNormal)
surface.Rectangle(3, 3, size.w - 4, size.h - 4);
}
surface.Gradient(gradient, sizeof(gradient) / sizeof(ColorKey), GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
else
- surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
+ surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
{
int buttonsSize = border +
((hasMaximize || hasMinimize) ? (BUTTON_SIZE*3)+7 : (BUTTON_SIZE+3));
- surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
+ surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
size.w - (buttonsSize + border + 4), name, strlen(name));
}
}
x, y,
0,0,buttonBitmap.width,buttonBitmap.height);
}
- else
+ else
{
// Push Buttons
if(scaleBitmap)
{
if(bevel || offset)
- surface.Stretch(buttonBitmap,
+ surface.Stretch(buttonBitmap,
1 + offset, 1 + offset,0,0,
clientSize.w-3,clientSize.h-3,buttonBitmap.width,buttonBitmap.height);
else
if((isRadio || isCheckbox) && !bevelOver)
WriteCaption(surface, CAPTION_DISTANCE + 3, // + clientSize.h,
(clientSize.h - th - 4)/2);
- else
+ else
{
int x, y = (clientSize.h - th - 1)/2 + offset;
-
+
if(buttonStyle.bevelOver && buttonBitmap && !buttonStyle.checkBox && !buttonStyle.radio)
{
if(bitmapAlignment == top)
bool DataBox::NotifyClose(DropBox dropBox)
{
- //dropBox.Deactivate();
+ //dropBox.Deactivate();
return true;
}
};
char * string = "";
EditBox editBox
{
- window, master = master, visible = false, //position = { x, y },
+ window, master = master, visible = false, //position = { x, y },
borderStyle = 0,
modifyVirtualArea = false, //sizeAnchor = { { w, h }, isClientH = true };
autoSize = (eClass_IsDerived(window._class, class(DataBox)) ? ((DataBox)window).autoSize : false);
}
return editBox;
}
-
+
}
__on_register_module()
pos += c;
count -= c;
buffer += c;
-
+
}
else
break;
}
-
+
return pos;
}
HTTPConnection connection = null;
close = false;
- if(fileName)
+ if(fileName)
{
fileName++;
memcpy(server, serverStart, fileName - serverStart - 1);
#endif
};
incref connection; // HTTPFile reference on success
-
+
connection.file = this;
connectionsMutex.Release();
this.connection = connection;
this.relocation = relocation;
//openStarted = false;
-
+
totalSizeSet = false; // HEAD will sometimes give you 0!
strcpy(msg, askBody ? "GET /" : "HEAD /");
}
strcat(msg, "\r\n");
len = strlen(msg);
-
+
//::PrintLn("Releasing connectionsMutex before GET for ", name, " ", (uint64)this, " in thread ", GetCurrentThreadID());
connectionsMutex.Release();
}
}
}
-
+
connectionsMutex.Wait();
if(this.connection)
{
this.connection.OnReceive = null;
this.connection.file = null;
-
+
if(close)
{
this.connection.Disconnect(0);
connection = null;
}
}
-
+
status = 0;
delete this.connection; // This decrements the file's reference
this.relocation = null;
numbytes = Min(numbytes, readSize - read);
if(totalSizeSet)
numbytes = Min(numbytes, totalSize - position);
-
+
if(numbytes)
{
lastTime = GetTime();
}
memcpy(file.buffer + file.bufferCount, buffer + overlap, bytesToRead);
file.bufferCount += bytesToRead;
- }
+ }
// Request some more data!
if(file.bufferCount < BUFFER_SIZE)
switch(mode)
{
case start:
- newPosition = pos;
+ newPosition = pos;
break;
case current:
newPosition += pos;
{
return position;
}
-
+
bool Eof()
{
return false;
OldList blocks { };
Request request;
NetDataBlock block { };
-
+
blocks.Add(block);
// Initialize block to what we need
(request.CallBack == Request::ReadResultCallback || request.CallBack == Request::ReadCallback))
{
// If this request overlap with the entire block of data we need
- if(*start + *size >= request.readStart &&
+ if(*start + *size >= request.readStart &&
*start + *size < request.readStart + request.readSize)
{
NetDataBlock next;
{
next = block.next;
// If this block overlap with this request
- if(request.readStart < block.end &&
+ if(request.readStart < block.end &&
request.readStart + request.readSize >= block.start)
{
// We have all this block, get rid of it
- if(request.readStart <= block.start &&
+ if(request.readStart <= block.start &&
request.readStart + request.readSize > block.end)
blocks.Delete(block);
// We're missing data at the end of this block
request.semaphore.Wait();
delete request.semaphore;
delete request;
-
+
if(!f.handle)
delete f;
return f;
mutex.Wait();
while((request = requests.first))
- {
+ {
uint numBytes = request.numBytes;
if(count - bytesProcessed < numBytes)
break;
sbio = null;
}
if(ssl)
- {
+ {
//SSL_free(ssl);
ssl = null;
}
{
SSL_CTX_free(ctx);
ctx = null;
- }
+ }
}
int ReceiveData(unsigned char * buffer, int count, unsigned int flags)
ssl = SSL_new(ctx);
sbio = BIO_new_socket(s, BIO_NOCLOSE);
SSL_set_bio(ssl,sbio,sbio);
-
+
result = SSL_connect(ssl) > 0;
/*
{
if(!(SSL_CTX_use_certificate_chain_file(ctx, "client.pem")))
printf("Can't read certificate file");
-
+
SSL_CTX_set_default_passwd_cb(ctx, password_cb);
-
+
if(!(SSL_CTX_use_PrivateKey_file(ctx, "client.pem", SSL_FILETYPE_PEM)))
printf("Can't read key file");
FD_SET(s, &network.readSet);
FD_SET(s, &network.exceptSet);
- if(s >= network.ns)
+ if(s >= network.ns)
{
network.ns = (int)(s+1);
network.socketsSemaphore.Release();
};
static class SocketConnectThread : Thread
-{
+{
Socket socket;
-
+
uint Main()
{
bool result = false;
{
network.mutex.Wait();
strcpy(socket.inetAddress, inet_ntoa(socket.a.sin_addr));
- socket.inetPort = ntohs(socket.a.sin_port);
+ socket.inetPort = ntohs(socket.a.sin_port);
network.mutex.Release();
if(socket.OnEstablishConnection((int)socket.s))
SOCKET s;
SOCKADDR_IN a;
int addrLen = sizeof(a);
-
+
value.accepted = true;
s = accept(value.s,(SOCKADDR *)&a, &addrLen);
if(s != -1)
address = null;
this.a = a;
strcpy(inetAddress, inet_ntoa(this.a.sin_addr));
- inetPort = ntohs(a.sin_port);
+ inetPort = ntohs(a.sin_port);
this.s = s;
service = value;
connectThread = null;
network.mutex.Wait();
FD_SET(s, &network.exceptSet);
FD_SET(s, &network.readSet);
- if(s >= network.ns)
+ if(s >= network.ns)
{
network.ns = (int)(s+1);
network.socketsSemaphore.Release();
OnReceivePacket(packet);
delete tempBuffer;
return 0;
- }
+ }
}
return 0;
}
if(s == network.ns - 1)
Network_DetermineMaxSocket();
-
+
if(s != -1)
{
FD_CLR(s, &network.readSet);
#endif
{
//Print("~");
- }
+ }
// This is what was making eCom jam...
// select(s+1, null, &ws, &es, null);
FD_CLR(s, &network.writeSet);
FD_SET(s, &network.readSet);
FD_SET(s, &network.exceptSet);
- if(s >= network.ns)
+ if(s >= network.ns)
{
network.ns = (int)(s+1);
network.socketsSemaphore.Release();
service = null;
_connected = 0;
}
-
+
if(s != -1) { closesocket(s); this.s = -1; }
delete address;
- delete recvBuffer;
+ delete recvBuffer;
recvBufferSize = 0;
recvBytes = 0;
- if(s != -1)
+ if(s != -1)
{
FD_CLR(s, &network.readSet);
FD_CLR(s, &network.writeSet);
_connected = -2;
FD_SET(s, &network.writeSet);
- if(s >= network.ns && !processAlone)
+ if(s >= network.ns && !processAlone)
{
network.ns = (int)(s+1);
network.socketsSemaphore.Release();
if(_connected == -1 || destroyed)
{
_connected = 0;
-
+
if(s == network.ns - 1)
Network_DetermineMaxSocket();
#if 0
}
else
this.s = -1;
-
+
delete connectThread;
}
else
recvBuffer = renew recvBuffer byte[recvBufferSize + MAX_RECEIVE];
recvBufferSize += MAX_RECEIVE;
}
-
+
if(FD_ISSET(s, rs) && disconnectCode == (DisconnectCode)-1)
{
if(type == tcp /*|| _connected*/)
else
{
int len = sizeof(a);
- count = (int)recvfrom(s, recvBuffer + recvBytes,
+ count = (int)recvfrom(s, recvBuffer + recvBytes,
recvBufferSize - recvBytes, 0, (SOCKADDR *)&a, &len);
strcpy(inetAddress, inet_ntoa(this.a.sin_addr));
inetPort = ntohs((uint16)a.sin_port);
processingSocket = (DCOMServerSocket)next)
{
next = processingSocket.next;
- if(processingSocket.connected &&
+ if(processingSocket.connected &&
(int64)processingSocket.thread.id == currentThreadID)
break;
}
static uint32 letohd(uint32 value)
{
- return GETLEDWORD((byte *)&value);
+ return GETLEDWORD((byte *)&value);
}
class DCOMServerThread : Thread
Class runClass = eSystem_FindClass(__thisModule.application, createInstance.className + 4);
DCOMServerObject object;
int vid;
-
+
if(!_class)
_class = eSystem_FindClass(runClass.module, createInstance.className);
-
+
objects = renew objects DCOMServerObject[numObjects+1];
object = objects[numObjects] = eInstance_New(_class);
incref object;
object.serverSocket = this;
object.id = numObjects++;
- object.instance = eInstance_New(runClass);
+ object.instance = eInstance_New(runClass);
incref object.instance;
object.instance._vTbl = new void *[object.instance._class.vTblSize + 1];
object.instance._vTbl++;
packet.type = (DCOMPacketType)htoled((DCOMPacketType)dcom_CreateInstance);
packet.size = size;
CopyBytes(packet.className, "DCOM", 4);
- CopyBytes(packet.className + 4, _class.name + strlen("DCOMClient_"), len-4+1);
+ CopyBytes(packet.className + 4, _class.name + strlen("DCOMClient_"), len-4+1);
answered = false;
SendPacket(packet);
delete packet;
while(!network.networkTerminated)
{
int ns = network.ns;
-
+
if(ns)
{
struct timeval tv = { 0, 0 }; // TESTING 0 INSTEAD OF (int)(1000000 / 18.2) };
network.mutex.Release();
network.selectSemaphore.Wait();
network.mutex.Wait();
- }
+ }
else
{
ecere::sys::Sleep(1 / 18.2f);
network.socketsSemaphore.Wait();
network.mutex.Wait();
}
-
+
}
network.mutex.Release();
return 0;
{
if(handle)
{
- uint totalBytesRead = 0;
+ uint totalBytesRead = 0;
uint bufferCount = this.bufferCount;
uint bufferPos = this.bufferPos;
byte * fileBuffer = this.buffer + bufferPos;
//bufferCount = 0;
//bufferPos = 0;
-
+
if(bytesToBuffer < numBytes && bufferCount >= bufferPos && numBytes < bufferSize && missing < bufferPos)
{
memcpy(this.buffer, this.buffer + missing, bufferPos - missing);
bytesToBuffer = Min(numBytes, bufferSize);
memcpy(this.buffer, buffer + numBytes - bytesToBuffer, bytesToBuffer);
bufferPos = bytesToBuffer;
- bufferCount = bytesToBuffer;
+ bufferCount = bytesToBuffer;
}
return result;
}
switch(mode)
{
case start:
- newPosition = pos;
+ newPosition = pos;
break;
case current:
newPosition += pos;
{
return pos;
}
-
+
bool Eof()
{
return eof;
if(!result)
delete f;
}
- }
+ }
return result;
}
int year;
Month month;
int day;
-
+
char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
if(stringOutput)
{
if(day && year)
- sprintf(stringOutput, "%s, %s %2d, %d",
+ sprintf(stringOutput, "%s, %s %2d, %d",
longDaysNames[dayOfTheWeek], longMonthsNames[month], day, year);
else
stringOutput[0] = 0;
time.GetLocalTime();
if(!strcmpi(string, "today") || !strcmpi(string, $"today") ||
- !strcmpi(string, "now") || !strcmpi(string, $"now") ||
+ !strcmpi(string, "now") || !strcmpi(string, $"now") ||
!strcmpi(string, "tomorrow") || !strcmpi(string, $"tomorrow") ||
!strcmpi(string, "yesterday") || !strcmpi(string, $"yesterday"))
{
this.day = time.day;
return true;
}
-
+
if(string)
{
if(!string[0])
}
if(isAlpha)
- {
+ {
Month m;
for(m = 0; m<Month::enumSize; m++)
if(!strcmpi(shortMonthsNames[m], value) || !strcmpi(longMonthsNames[m], value) ||
if(dayOfTheWeek < 0)
dayOfTheWeek += 7;
return dayOfTheWeek;
- }
+ }
}
bool OnSaveEdit(DropBox dropBox, void * object)
borderStyle = 0;
hotKey = f2;
};
-
+
if(day || year || month)
{
char tempString[MAX_F_STRING] = "";
comboBox.calendar.shownMonth = (Month)now.month;
comboBox.calendar.shownYear = now.year;
}
-
+
comboBox.contents = string;
comboBox.Create();
if(!dataBox.active)
calendar.Create();
return calendar;
}
-
+
void OnCloseDropDown(Window dateEditor)
{
master.Update(null);
bool pressing;
isRemote = true;
inactive = true;
-
+
property Seconds delay { set { timer2.delay = value; } }
property Seconds delay0 { set { timer.delay = value; } }
-
+
bool OnKeyHit(Key key, unichar ch)
{
if(key == hotKey)
result = SetFilePointer(dp->inputHandle, pos, null, FILE_END) != -1;
break;
}
- return result;
+ return result;
#endif
return false;
}
// Not yet supported... Will ever be?
bool DualPipe_GetSize(_DualPipe * dp)
{
- return 0;
+ return 0;
}
bool DualPipe_Peek(_DualPipe * dp)
unsigned int read;
char buffer[1];
dp->eof = !ReadFile(dp->inputHandle, buffer, 0, (DWORD *)&read, null);
- }
+ }
return avail ? true : false;
#else
bool result = false; //true; // false
void DualPipe_Wait(_DualPipe * dp)
{
-#if defined(__WIN32__)
+#if defined(__WIN32__)
WaitForSingleObject(dp->hProcess, INFINITE);
#else
if(dp->pid)
dp->exitCode = WEXITSTATUS(status);
dp->gotExitCode = true;
}
-#endif
+#endif
}
_DualPipe * _DualPipeOpen(PipeOpenMode mode, char * commandLine, char * env, void ** inputPtr, void ** outputPtr)
FILE * input = null, * output = null;
int hInput[2] = { 0 }, hOutput[2] = { 0 };
pid_t pid;
-
+
if((mode & POM_error) || (mode & POM_output))
pipe(hOutput);
close(hInput[PIPE_WRITE]);
if(hOutput[PIPE_READ])
close(hOutput[PIPE_READ]);
-
+
if((mode & POM_error) && hOutput[PIPE_WRITE] != STDERR_FILENO)
dup2(hOutput[PIPE_WRITE], STDERR_FILENO);
if((mode & POM_output) && hOutput[PIPE_WRITE] != STDOUT_FILENO)
dup2(hOutput[PIPE_WRITE], STDOUT_FILENO);
if(hOutput[PIPE_WRITE] && hOutput[PIPE_WRITE] != STDOUT_FILENO)
- close(hOutput[PIPE_WRITE]);
-
+ close(hOutput[PIPE_WRITE]);
+
if((mode & POM_input) && hInput[PIPE_READ] != STDIN_FILENO)
{
dup2(hInput[PIPE_READ], STDIN_FILENO);
close(hInput[PIPE_READ]);
}
-
+
#if 0 //#ifdef _DEBUG
fprintf(stderr, "\n_DualPipeOpen (in child): %s\n\n", commandLineCopy);
#endif
if((mode & POM_output) || !hStdOut)
CreatePipe(&hOutput[PIPE_READ],&hOutput[PIPE_WRITE],&sa,0);
- if(( (mode & POM_error) && !(mode & POM_output)) ||
+ if(( (mode & POM_error) && !(mode & POM_output)) ||
(!(mode & POM_error) && !hStdErr))
CreatePipe(&hError[PIPE_READ], &hError[PIPE_WRITE],&sa,0);
-
+
if((mode & POM_input) || !hStdIn)
CreatePipe(&hInput[PIPE_READ], &hInput[PIPE_WRITE], &sa,0);
DuplicateHandle(GetCurrentProcess(),hOutput[PIPE_READ],GetCurrentProcess(),&hOutputRead,0,FALSE,DUPLICATE_SAME_ACCESS);
DuplicateHandle(GetCurrentProcess(),hOutput[PIPE_WRITE],GetCurrentProcess(),&hError[PIPE_WRITE],0,TRUE,DUPLICATE_SAME_ACCESS);
}
- else
+ else
{
if(hOutput[PIPE_WRITE])
DuplicateHandle(GetCurrentProcess(),hOutput[PIPE_READ],GetCurrentProcess(),&hOutputRead,0,FALSE,DUPLICATE_SAME_ACCESS);
public:
bool Peek() { return DualPipe_Peek(dp); }
void Terminate() { DualPipe_Terminate(dp); }
- int GetExitCode() { return DualPipe_GetExitCode(dp); }
+ int GetExitCode() { return DualPipe_GetExitCode(dp); }
int GetProcessID() { return DualPipe_GetProcessID(dp); }
void Wait() { DualPipe_Wait(dp); }
};
};
static struct EARHeader
-{
+{
byte recognition[sizeof(earRecognition)] __attribute__((packed));
uint version __attribute__((packed));
FileSize totalSize __attribute__((packed));
for(;;)
{
char fileName[MAX_FILENAME];
-
+
f.Read(entry, sizeof(EAREntry), 1);
f.Read(fileName, 1, entry.nameLen);
fileName[entry.nameLen] = '\0';
// Fix the size of the archive
FileTruncate(path, archiveStart);
}*/
-
+
freeBlocks.Free(null);
}
rootDir = Position(2*sizeof(uint));
dir.position = rootDir;
}
-
+
result = dir;
// Open rest of directory...
if(f.Seek(dirPosition + sizeof(uint), start))
f.Write(&last, sizeof(uint), 1);
}
-
+
for(; position; position = next)
{
EAREntry entry { };
for(position = directory.first; position; position = entry.next)
{
char fileName[MAX_FILENAME];
-
+
if(f.Seek(position, start) && f.Read(entry, sizeof(EAREntry), 1))
{
if(entry.nameLen > MAX_FILENAME)
void AddFreeBlock(uint position, uint size)
{
FreeBlock block, prevBlock, nextBlock = null;
-
+
// Find the previous and next free block
prevBlock = null;
for(block = freeBlocks.first; block; block = block.next)
if(block.end < position)
- prevBlock = block;
+ prevBlock = block;
else
{
nextBlock = block;
size = sizeof(EAREntry) + entry.nameLen + (entry.cSize ? entry.cSize : entry.size);
// Unlink this file
- if(entry.prev)
+ if(entry.prev)
{
f.Seek(entry.prev + OFFSET(EAREntry, next), start);
f.Write(&entry.next, sizeof(uint), 1);
}
- if(entry.next)
+ if(entry.next)
{
f.Seek(entry.next + OFFSET(EAREntry, prev), start);
f.Write(&entry.prev, sizeof(uint), 1);
strcpy(namePart, DIR_SEPS);
// Search for directory
-
+
position = archive.Find(this, namePart, entry);
if(position)
{
archive.f.Read(&dir.first, sizeof(uint), 1);
archive.f.Read(&dir.last, sizeof(uint), 1);
-
+
result = dir;
- }
+ }
}
// If directory doesn't exist already
strcpy(namePart, name);
if(!strcmp(namePart, "/") || !strcmp(namePart, "\\"))
strcpy(namePart, DIR_SEPS);
-
+
position = archive.Find(this, namePart, entry);
if(position)
{
archive.f.Seek(entry.prev + OFFSET(EAREntry, next), start);
archive.f.Write(&entry.next, sizeof(uint), 1);
}
- if(entry.next)
+ if(entry.next)
{
archive.f.Seek(entry.next + OFFSET(EAREntry, prev), start);
archive.f.Write(&entry.prev, sizeof(uint), 1);
dataSize = 2 * sizeof(uint);
else
dataSize = entry.cSize ? entry.cSize : entry.size;
-
+
newEntry.nameLen = strlen(newName);
if(newEntry.nameLen > entry.nameLen)
{
archive.f.Write(newName, sizeof(char), newEntry.nameLen);
// Fix the links
- if(entry.prev)
+ if(entry.prev)
{
archive.f.Seek(entry.prev + OFFSET(EAREntry, next), start);
archive.f.Write(&newPosition, sizeof(uint), 1);
}
- if(entry.next)
+ if(entry.next)
{
archive.f.Seek(entry.next + OFFSET(EAREntry, prev), start);
archive.f.Write(&newPosition, sizeof(uint), 1);
// There will be free space at the end of an entry with a shorter new name
if(newEntry.nameLen < entry.nameLen)
- archive.AddFreeBlock(position + sizeof(EAREntry) + newEntry.nameLen + dataSize, entry.nameLen - newEntry.nameLen);
+ archive.AddFreeBlock(position + sizeof(EAREntry) + newEntry.nameLen + dataSize, entry.nameLen - newEntry.nameLen);
}
if(entry.nameLen != newEntry.nameLen)
{
break;
// Only updates changed files
case refresh:
- if(oldPosition &&
- (oldEntry.size != stats.size ||
- oldEntry.modified != (TimeStamp32)stats.modified ||
+ if(oldPosition &&
+ (oldEntry.size != stats.size ||
+ oldEntry.modified != (TimeStamp32)stats.modified ||
oldEntry.created != (TimeStamp32)stats.created))
archive.Delete(this, oldPosition, oldEntry);
else
case update:
if(oldPosition)
{
- if(oldEntry.size != stats.size ||
- oldEntry.modified != (TimeStamp32)stats.modified ||
+ if(oldEntry.size != stats.size ||
+ oldEntry.modified != (TimeStamp32)stats.modified ||
oldEntry.created != (TimeStamp32)stats.created)
archive.Delete(this, oldPosition, oldEntry);
else
entry.prev = last;
entry.next = 0;
entry.type = ENTRY_FILE;
-
+
entry.size = stats.size;
entry.created = (TimeStamp32)stats.created;
entry.modified = (TimeStamp32)stats.modified;
-
+
if(compression)
{
byte * uncompressed = new byte[entry.size];
{
if(newPosition) *newPosition = 0;
}
-
+
// archive.f.handle = archive.f;
return true;
}
bool result = false;
switch(mode)
{
- case start:
+ case start:
if(pos <= (int)size)
{
position = pos;
}
break;
}
- return result;
+ return result;
}
uint Tell()
file.stats.accessed = file.stats.modified = (TimeStamp)entry.modified;
file.stats.created = (TimeStamp)entry.created;
file.stats.size = entry.size;
-
+
strcpy(file.path, d.path);
PathCat(file.path, file.name);
d.next = entry.next;
EAR_RECOGNITION,
MDWORD(0, 1)
};
-
+
archive.f.Seek(0, end);
-
+
archive.archiveStart = archive.f.Tell();
archive.freeBlocks.Add(FreeBlock { start = archive.archiveStart + sizeof(EARHeader), end = MAXDWORD });
{
DWORD pid;
if(IsWindowVisible(hwnd) && GetWindowThreadProcessId(hwnd, &pid) && pid == GetCurrentProcessId())
- {
+ {
*(void **)lParam = hwnd;
return FALSE;
}
- return TRUE;
+ return TRUE;
}
bool WinReviveNetworkResource(uint16 * _wfileName)
{
if(!windowHandle)
{
EnumWindows(EnumThreadWindowsProc, (LPARAM)&windowHandle);
-
+
}
if(WNetAddConnection3(windowHandle, &nr, null, null, CONNECT_INTERACTIVE|CONNECT_PROMPT) == NO_ERROR)
result = true;
(uint)(length ? ((length & 0xFFFFFFFF00000000LL) >> 32) : 0xFFFFFFFF),
&overlapped) != 0;
else
- return LockFileEx(hFile, ((type == exclusive) ? LOCKFILE_EXCLUSIVE_LOCK : 0) | (wait ? 0 : LOCKFILE_FAIL_IMMEDIATELY), 0,
+ return LockFileEx(hFile, ((type == exclusive) ? LOCKFILE_EXCLUSIVE_LOCK : 0) | (wait ? 0 : LOCKFILE_FAIL_IMMEDIATELY), 0,
(uint)(length ? (length & 0xFFFFFFFF) : 0xFFFFFFFF),
(uint)(length ? ((length & 0xFFFFFFFF00000000LL) >> 32) : 0xFFFFFFFF),
&overlapped) != 0;
fd = fileno(output ? output : input);
return fcntl(fd, wait ? F_SETLKW : F_SETLK, &fl) != -1;
-#endif
+#endif
}
}
stats->accessed = Win32FileTimeToTimeStamp(&a);
stats->modified = Win32FileTimeToTimeStamp(&m);
#endif
-
+
CloseHandle(hFile);
}
}
}
// Copy Entire Computer to new path
else if(file[0] == '/' && !file[1])
-
+
{
parent[0] = '/';
parent[1] = '\0';
for(;(ch = file[c]) && (ch != '/' && ch != '\\'); c++)
{
if(len < MAX_FILENAME)
- directory[len++] = ch;
+ directory[len++] = ch;
}
directory[len] = '\0';
// Missing function...
/*
-#ifndef WNetGetResourceInformation
+#ifndef WNetGetResourceInformation
DWORD APIENTRY WNetGetResourceInformationA(LPNETRESOURCE lpNetResource, LPVOID lpBuffer, LPDWORD lpcbBuffer, LPTSTR* lplpSystem);
#ifdef UNICODE
#define WNetGetResourceInformation WNetGetResourceInformationW
{
Window editData = class::OnEdit(dataBox, obsolete, x + 24, y, w - 48, h, userData);
Button load
- {
+ {
dataBox, inactive = true, text = $"Import"."Imp", hotKey = f2,
position = { Max(x + 24, x + w - 24), y }, size = { 24, h };
}
};
Button save
- {
+ {
dataBox, inactive = true, text = $"Export"."Exp", hotKey = f2,
position = { Max(x + 24, x + w - 48), y }, size = { 24, h };
{
byte buffer[4096];
uint read = input.Read(buffer, 1, sizeof(buffer));
- f.Write(buffer, 1, read);
+ f.Write(buffer, 1, read);
}
delete f;
- }
+ }
}
return true;
}
{
return input ? feof(input) : true;
}
-
+
virtual bool Truncate(FileSize size)
{
#ifdef ECERE_BOOTSTRAP
return output ? (_chsize(fileno(output), size) == 0) : false;
#else
return output ? (ftruncate(fileno(output), size) == 0) : false;
- #endif
+ #endif
#endif
}
{
return FILE_GetSize(input);
}
-
+
virtual void CloseInput(void)
{
if(input)
while(c<max-1)
{
char ch = 0;
-
+
if(/*!Peek() || */ !Getc(&ch))
{
result = false;
break;
}
- if(ch =='\n')
+ if(ch =='\n')
break;
if(ch !='\r')
s[c++]=ch;
else
string[c]=ch;
- if(!Getc(&ch))
+ if(!Getc(&ch))
{
c++;
result = false;
- break;
+ break;
}
}
string[c]=0;
set
{
FILE_set_buffered(input, output, value);
- }
+ }
}
property bool eof { get { return Eof(); } }
//if(!result)
{
/* TOFIX:
- LogErrorCode((mode == Read || mode == ReadWrite) ?
+ LogErrorCode((mode == Read || mode == ReadWrite) ?
ERR_FILE_NOT_FOUND : ERR_FILE_WRITE_FAILED, fileName);
*/
}
// TIME_ZONE_INFORMATION tz = { 0 };
SYSTEMTIME st, lt;
DateTime tm;
-
+
tm = t;
st.wYear = (short)tm.year;
{
delete file;
/* TOFIX:
- LogErrorCode((mode == Read || mode == ReadWrite) ?
+ LogErrorCode((mode == Read || mode == ReadWrite) ?
ERR_FILE_NOT_FOUND : ERR_FILE_WRITE_FAILED, fileName);
*/
}
if(hFile != INVALID_HANDLE_VALUE)
{
FILETIME c, a, m;
-
+
TimeStampToWin32FileTime(created, &c);
TimeStampToWin32FileTime(accessed, &a);
TimeStampToWin32FileTime(modified, &m);
mm = Win32FileTimeToTimeStamp(&m);
}
*/
-
+
if(SetFileTime(hFile, &c, &a, &m))
result = true;
else
{
Dir d;
-
+
if((d = file.dir = Dir {}))
{
#if defined(__WIN32__)
}
drives ^= (1<<c);
if(driveType == DRIVE_NO_ROOT_DIR) continue;
-
- if(driveType != DRIVE_REMOVABLE && driveType != DRIVE_REMOTE &&
+
+ if(driveType != DRIVE_REMOVABLE && driveType != DRIVE_REMOTE &&
GetVolumeInformation(_wfilePath, _wvolume, MAX_FILENAME - 1, null, null, null, null, 0))
{
file.path[2] = '\0';
size = 512 * sizeof(NETRESOURCE);
resources = (NETRESOURCE *)new0 byte[size];
-
+
// Entire Network
WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, 0, &buffer[c], &handle);
while(true)
_wpath[3] = 0;
}
- if(driveType != DRIVE_REMOVABLE && driveType != DRIVE_REMOTE &&
+ if(driveType != DRIVE_REMOVABLE && driveType != DRIVE_REMOTE &&
GetVolumeInformation(_wpath, _wvolume, MAX_FILENAME - 1, null, null, null, null, 0))
{
UTF16toUTF8Buffer(_wvolume, volume, MAX_FILENAME);
break;
countInGroup = 0xFFFFFFFF;
resources = (NETRESOURCE *)renew0 resources byte[size];
-
+
}
WNetCloseEnum(handle);
d.numResources = countInGroup;
}
else
{
- if(d.resources)
+ if(d.resources)
delete d.resources;
}
}
//strcpy(buffer, template);
strcat(buffer, "XXXXXX");
// mktemp(buffer);
- fd = mkstemp(buffer);
+ fd = mkstemp(buffer);
strcpy(tempFileName, buffer);
f = { };
f.output = f.input = fdopen(fd, "r+");
GetTempPathA(MAX_LOCATION, tempPath); // TODO: Patch this whole thing to support Unicode temp path
GetTempFileNameA(tempPath, template, 0, tempFileName);
f = FileOpen(tempFileName, readWrite);
-#endif
+#endif
return f;
#endif
}
{
if(watchFor & action)
{
- fileNotifies.Add(FileNotify {
+ fileNotifies.Add(FileNotify {
monitor = this, action = action, fileName = CopyString(fileName), param = CopyString(param)
});
return true;
return 1;
else if(e1.attribs.isDirectory && !e2.attribs.isDirectory)
return -1;
- else
+ else
return strcmp(e1.name, e2.name);
}
}
monitor.files.Free(FileEntry::Free);
monitor.files = newEntries;
- }
+ }
}
else if(monitor.fileName)
{
{
fileActivity |= monitor.AddFileNotify(FileChange { deleted = true }, monitor.fileName, null);
monitor.exists = false;
- }
+ }
else if(monitor.exists)
{
FileStats stats { };
// printf("[%d] Releasing Mutex...\n", (int)GetCurrentThreadID());
globalSystem.fileMonitorMutex.Release();
}
-
+
// printf("[%d] Sleeping...\n", (int)GetCurrentThreadID());
Sleep(1.0 / 18.2);
}
if(driver.name && !strcmp(driver.name, driverName))
return driver;
}
-
+
/*{
Module module;
char moduleName[MAX_LOCATION];
{
//Class dsdClass = class(GlobalSettingsDriver);
Class dsdClass = eSystem_FindClass(module /-__thisModule.application-/, "GlobalSettingsDriver");
-
+
for(link = dsdClass.derivatives.first; link; link = link.next)
{
subclass(GlobalSettingsDriver) driver = link.data;
{
set { delete settingsName; if(value && value[0]) settingsName = CopyString(value); }
get { return settingsName; }
- };
+ };
property char * settingsExtension
{
set { delete settingsExtension; if(value && value[0]) settingsExtension = CopyString(value); }
property char * settingsFilePath
{
get { return settingsFilePath; }
- };
+ };
property bool allowDefaultLocations
{
set { allowDefaultLocations = value; }
char * PreparePortablePath()
{
- //
+ //
char * path = null;
char location[MAX_LOCATION];
LocateModule(null, location);
}
return path;
}
-
+
char * PrepareSystemPath()
{
char * path = new char[MAX_LOCATION];
result = success;
}
}
-
+
}
return result;
}
}
}
result = true;
- break;
+ break;
}
}
}
item.Next();
if(item.pointer)
strcat(outputLine, ",");
- }
+ }
break;
}
case singleString:
if(!f.GetLine(line, sizeof(line)))
break;
if(posBeforeSection == -1 || !line[0])
- posBeforeSection = pos;
-
+ posBeforeSection = pos;
+
if(line[0] == '[')
{
// We've already reached next section
{
Container array;
result = GetArray(type, &array);
-
+
if(type && eClass_IsDerived(type, class(Container)))
{
value.p = array;
}
buffer[c] = 0;
result = success;
-
+
if(type)
- {
+ {
if(!strcmp(type.name, "bool"))
{
if(!strcmpi(buffer, "false")) value.i = 0;
else
result = typeMismatch;
}
- else if(!strcmpi(buffer, "null"))
+ else if(!strcmpi(buffer, "null"))
{
value.p = 0;
}
{
t = value.ui64;
}
- else if(arrayType.typeSize == sizeof(int) || !strcmp(arrayType.dataTypeString, "int") ||
+ else if(arrayType.typeSize == sizeof(int) || !strcmp(arrayType.dataTypeString, "int") ||
!strcmp(arrayType.dataTypeString, "unsigned int") || !strcmp(arrayType.dataTypeString, "uint"))
{
t = value.i;
}
- else if(arrayType.typeSize == sizeof(short int) || !strcmp(arrayType.dataTypeString, "short") ||
- !strcmp(arrayType.dataTypeString, "unsigned short") || !strcmp(arrayType.dataTypeString, "uint16") ||
+ else if(arrayType.typeSize == sizeof(short int) || !strcmp(arrayType.dataTypeString, "short") ||
+ !strcmp(arrayType.dataTypeString, "unsigned short") || !strcmp(arrayType.dataTypeString, "uint16") ||
!strcmp(arrayType.dataTypeString, "int16"))
{
t = value.s;
}
- else if(arrayType.typeSize == sizeof(byte) || !strcmp(arrayType.dataTypeString, "char") ||
+ else if(arrayType.typeSize == sizeof(byte) || !strcmp(arrayType.dataTypeString, "char") ||
!strcmp(arrayType.dataTypeString, "unsigned char") || !strcmp(arrayType.dataTypeString, "byte"))
{
t = value.c;
}
}
}
- ch = 0;
+ ch = 0;
return result;
}
f.Getc(&unicode[0]);
f.Getc(&unicode[1]);
f.Getc(&unicode[2]);
- f.Getc(&unicode[3]);
+ f.Getc(&unicode[3]);
}
escaped = false;
}
}
else
PrintLn("Warning: member ", string, " not found in class ", (String)objectType.name);
- }
+ }
}
// Find Member in Object Class
{
{
*(uint64 *)((byte *)*object + member._class.offset + member.offset) = value.ui64;
}
- else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
+ else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
!strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint"))
{
*(int *)((byte *)*object + member._class.offset + member.offset) = value.i;
}
- else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
- !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
+ else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
+ !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
!strcmp(type.dataTypeString, "int16"))
{
*(short *)((byte *)*object + member._class.offset + member.offset) = value.s;
}
- else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
+ else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
!strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
{
*(char *)((byte *)*object + member._class.offset + member.offset) = value.c;
{
((void (*)(void *, uint64))(void *)prop.Set)(*object, value.ui64);
}
- else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
+ else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
!strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint"))
{
((void (*)(void *, int))(void *)prop.Set)(*object, value.i);
}
- else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
- !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
+ else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
+ !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
!strcmp(type.dataTypeString, "int16"))
{
((void (*)(void *, short))(void *)prop.Set)(*object, value.s);
}
- else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
+ else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
!strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
{
((void (*)(void *, char))(void *)prop.Set)(*object, value.c);
Class arrayType = type.templateArgs[0].dataTypeClass;
f.Puts("[\n");
indent++;
-
+
while(it.Next())
{
byte * pointer;
if(!isFirst)
f.Puts(",\n");
else
- isFirst = false;
-
+ isFirst = false;
+
// Add value
// TODO: Verify the matching between template type and uint64
if(arrayType.type == structClass)
{
value.ui64 = t;
}
- else if(arrayType.typeSize == sizeof(int) || !strcmp(arrayType.dataTypeString, "int") ||
+ else if(arrayType.typeSize == sizeof(int) || !strcmp(arrayType.dataTypeString, "int") ||
!strcmp(arrayType.dataTypeString, "unsigned int") || !strcmp(arrayType.dataTypeString, "uint"))
{
value.i = (int)t;
}
- else if(arrayType.typeSize == sizeof(short int) || !strcmp(arrayType.dataTypeString, "short") ||
- !strcmp(arrayType.dataTypeString, "unsigned short") || !strcmp(arrayType.dataTypeString, "uint16") ||
+ else if(arrayType.typeSize == sizeof(short int) || !strcmp(arrayType.dataTypeString, "short") ||
+ !strcmp(arrayType.dataTypeString, "unsigned short") || !strcmp(arrayType.dataTypeString, "uint16") ||
!strcmp(arrayType.dataTypeString, "int16"))
{
value.s = (short)t;
}
- else if(arrayType.typeSize == sizeof(byte) || !strcmp(arrayType.dataTypeString, "char") ||
+ else if(arrayType.typeSize == sizeof(byte) || !strcmp(arrayType.dataTypeString, "char") ||
!strcmp(arrayType.dataTypeString, "unsigned char") || !strcmp(arrayType.dataTypeString, "byte"))
{
value.c = (char)t;
}
for(i = 0; i<indent; i++) f.Puts(" ");
WriteValue(f, arrayType, value, indent);
- }
+ }
f.Puts("\n");
indent--;
for(i = 0; i<indent; i++) f.Puts(" ");
- f.Puts("]");
+ f.Puts("]");
}
else
f.Puts("null");
else if(type.type == enumClass)
{
f.Puts("\"");
- WriteNumber(f, type, value, indent);
+ WriteNumber(f, type, value, indent);
f.Puts("\"");
}
else if(eClass_IsDerived(type, class(Container)))
Property prop;
int c;
bool isFirst = true;
-
+
f.Puts("{\n");
indent++;
{
value.ui64 = ((uint64 (*)(void *))(void *)prop.Get)(object);
}
- else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
+ else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
!strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint"))
{
value.i = ((int (*)(void *))(void *)prop.Get)(object);
}
- else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
- !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
+ else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
+ !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
!strcmp(type.dataTypeString, "int16"))
{
value.s = ((short (*)(void *))(void *)prop.Get)(object);
}
- else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
+ else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
!strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
{
value.c = ((char (*)(void *))(void *)prop.Get)(object);
{
value.ui64 = *(uint64 *)((byte *)object + member._class.offset + member.offset);
}
- else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
+ else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
!strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint"))
{
value.i = *(int *)((byte *)object + member._class.offset + member.offset);
if(!value.i)
continue;
}
- else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
- !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
+ else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
+ !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
!strcmp(type.dataTypeString, "int16"))
{
value.s = *(short *)((byte *)object + member._class.offset + member.offset);
}
- else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
+ else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
!strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
{
value.c = *(char *)((byte *)object + member._class.offset + member.offset);
}
else
{
- value.i = *(int *)((byte *)object + member._class.offset + member.offset);
+ value.i = *(int *)((byte *)object + member._class.offset + member.offset);
}
if(!isFirst) f.Puts(",\n");
isFirst = false;
}
}
- }
+ }
indent--;
f.Puts("\n");
semaphore_t semaphore;
int count;
Mutex mutex { };
-#else
+#else
sem_t semaphore;
#endif
for(;(ch = path[c]) && (ch != '/' && ch != '\\'); c++)
{
if(len < MAX_FILENAME)
- directory[len++] = ch;
+ directory[len++] = ch;
}
directory[len] = '\0';
if(locationLen > 0 &&
for(;(ch = path[c]) && (ch != '/' && ch != '\\'); c++)
{
if(len < MAX_FILENAME)
- directory[len++] = ch;
+ directory[len++] = ch;
}
directory[len] = '\0';
if(locationLen > 0 &&
__ecereNameSpace__ecere__sys__UTF16toUTF8Buffer(result, (byte *)envValue, max);
else
envValue[0] = 0;
-
+
__ecereNameSpace__ecere__com__eSystem_Delete(_wenvName);
return envValue; //result ? envValue : null;
#else
__ecereNameSpace__ecere__com__eSystem_Delete(_wenvValue);
#else
setenv(envName, envValue, 1);
-#endif
+#endif
}
void System_UnsetEnvironment(char * envName)
__ecereNameSpace__ecere__com__eSystem_Delete(_wenvName);
#else
unsetenv(envName);
-#endif
+#endif
}
bool System_Execute(char * env, char * command, va_list args)
{
veryFatal = 0,
fatal = 1,
- major = 2,
+ major = 2,
minor = 3
};
break;
}
#endif
- case stdOut:
+ case stdOut:
fputs(text, eC_stdout());
fflush(eC_stdout());
break;
}
case buffer:
case msgBox:
- strcat(globalSystem.errorBuffer, text);
+ strcat(globalSystem.errorBuffer, text);
break;
}
}
if(errorCode.level <= globalSystem.errorLevel)
{
if(details)
- Logf("System Error [%d]: %s (%s).\n",
+ Logf("System Error [%d]: %s (%s).\n",
errorCode.level,
- errorMessages[errorCode.code],
+ errorMessages[errorCode.code],
details);
else
- Logf("System Error [%d]: %s.\n",
+ Logf("System Error [%d]: %s.\n",
errorCode.level,
errorMessages[errorCode.code]);
}
break;
*/
}
-
+
sprintf(title, "%s - Fatal Error", guiApp.appName);
if(globalSystem.errorBuffer && globalSystem.errorBuffer[0])
}
else
MessageBox(HWND_DESKTOP, exceptionString, title, MB_OK|MB_ICONERROR);
-
+
return EXCEPTION_EXECUTE_HANDLER;
}
#endif
this.size += increase;
this.buffer = renew this.buffer byte[this.size];
}
- return result;
+ return result;
}
uint Tell()
~Thread()
{
#if defined(__WIN32__)
- if(handle)
+ if(handle)
CloseHandle(handle);
#endif
}
handle = null;
}
#else
- if(started)
+ if(started)
pthread_kill(id, SIGQUIT);
#endif
if(started)
if(WaitForSingleObject(handle, INFINITE /*2000*/) == WAIT_TIMEOUT)
PrintLn("Thread not returning?\n");
#else
-
+
/*dontDetach = true;
if(started)
pthread_join(id, NULL);*/
param.sched_priority = (priority > 0) ? (priority * 99 / 15) : 0;
pthread_setschedparam(id, policy, ¶m);
*/
-#endif
+#endif
}
property bool created { get { return started; } };
else if( beforeStandardDate || afterDaylightDate )
retval = TIME_ZONE_ID_DAYLIGHT;
}
- else
+ else
retval = TIME_ZONE_ID_UNKNOWN;
return retval;
}
return true;
}
-static bool _TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime)
+static bool _TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime)
{
FILETIME ft;
LONG lBias;
value = (int)(time / (60 * 60 * 24));
if(value)
{
-
+
sprintf(temp, "%d:", value);
strcat(tempString, temp);
time -= value * 60 * 60 * 24;
#else
struct tm tm;
//time_t t = (time_t)(SecSince1970)this;
- time_t t = MakeTimeTfromDT(this);
+ time_t t = MakeTimeTfromDT(this);
gmtime_r(&t, &tm);
value.year = tm.tm_year + 1900;
value.month = (Month)tm.tm_mon;
{
int64 days, y;
int rem;
-
+
days = value / SECS_PER_DAY;
rem = (int)(value % SECS_PER_DAY);
if(!year && !day && !month && !this.hour && !minute && !second)
stringOutput[0] = 0;
else
- sprintf(stringOutput, "%s %s %2d %2d:%02d:%02d %s %04d",
+ sprintf(stringOutput, "%s %s %2d %2d:%02d:%02d %s %04d",
shortDaysNames[dayOfTheWeek], shortMonthsNames[month], day, hour, minute, second, ampm[pm], year);
return stringOutput;
for(c = 0; c < count; c++)
{
int i;
- for(i = 0; i<7; i++)
+ for(i = 0; i<7; i++)
if(!strcmpi(tokens[c], shortDaysNames[i]) || !strcmpi(tokens[c], longDaysNames[i]) ||
!strcmpi(tokens[c], enShortDaysNames[i]) || !strcmpi(tokens[c], enLongDaysNames[i]))
- break;
+ break;
if(i < 7) { dayOfTheWeek = (DayOfTheWeek)i; foundDayOfTheWeek = true; continue; }
- for(i = 0; i<12; i++)
+ for(i = 0; i<12; i++)
if(!strcmpi(tokens[c], shortMonthsNames[i]) || !strcmpi(tokens[c], longMonthsNames[i]) ||
!strcmpi(tokens[c], enShortMonthsNames[i]) || !strcmpi(tokens[c], enLongMonthsNames[i]))
- break;
+ break;
if(i < 12) { month = (Month)i; continue; }
if(strchr(tokens[c], ':'))
else if(!strcmpi(subTokens[t], "pm")) pm = true;
else if(t-am-pm == 0) hour = atoi(subTokens[t]);
else if(t-am-pm == 1) minute = atoi(subTokens[t]);
- else if(t-am-pm == 2) second = atoi(subTokens[t]);
+ else if(t-am-pm == 2) second = atoi(subTokens[t]);
}
-
+
if(c < count - 1)
{
if(!strcmpi(tokens[c+1], "am")) am = true;
continue;
}
-
+
if(!foundDate)
{
if(strchr(tokens[c], '/') || strchr(tokens[c], '-'))
f.Read(&transStrings, sizeof(uint), 1); if(swap) SWAP_DWORD(transStrings);
f.Read(&hashingSize, sizeof(uint), 1); if(swap) SWAP_DWORD(hashingSize);
f.Read(&hashingOffset, sizeof(uint), 1); if(swap) SWAP_DWORD(hashingOffset);
-
+
if(!moduleMaps)
moduleMaps = { };
{
#if !defined(ECERE_BOOTSTRAP) && (defined(__WATCOMC__) || defined(__MSC__) || defined(__BORLANDC__))
_asm
{
- push esi
+ push esi
push edi
push ecx
mov edi,dest
mov ecx,count
rep movsb
-
+
pop ecx
pop edi
pop esi
mov edi,dest
mov ecx,count
rep movsd
-
+
pop ecx
pop edi
pop esi
mov ecx,count
mov ax,value
rep stosw
-
+
pop eax
pop ecx
pop edi
}
if(i < numBytes)
error = true;
- if(codePoint > 0x10FFFF || (codePoint >= 0xD800 && codePoint <= 0xDFFF) ||
- (codePoint < 0x80 && numBytes > 1) ||
- (codePoint < 0x800 && numBytes > 2) ||
+ if(codePoint > 0x10FFFF || (codePoint >= 0xD800 && codePoint <= 0xDFFF) ||
+ (codePoint < 0x80 && numBytes > 1) ||
+ (codePoint < 0x800 && numBytes > 2) ||
(codePoint < 0x10000 && numBytes > 3))
error = true;
if(error)
dest[d] = 0;
return d;
}
- return 0;
+ return 0;
}
public int UTF16BEtoUTF8Buffer(uint16 * source, byte * dest, int max)
if(u16 < 0xD800 || u16 > 0xDBFF)
{
// TOFIX: PRECOMP ERROR IF NO BRACKETS
- ch = (unichar)u16;
+ ch = (unichar)u16;
}
else
{
separators = CharCategories { separatorSpace = true, separatorLine = true, separatorParagraph = true },
others = CharCategories { otherControl = true, otherFormat = true, otherSurrogate = true, otherPrivateUse = true, otherNotAssigned = true },
letters = CharCategories { letterUpperCase = true, letterLowerCase = true, letterTitleCase = true, letterModifier = true, letterOther = true },
- punctuation = CharCategories { punctiationConnector = true, punctuationDash = true, punctuationOpen = true, punctuationClose = true, punctuationInitial = true,
+ punctuation = CharCategories { punctiationConnector = true, punctuationDash = true, punctuationOpen = true, punctuationClose = true, punctuationInitial = true,
punctuationFinal = true, punctuationOther = true },
symbols = CharCategories { symbolMath = true, symbolCurrency = true, symbolModifier = true, symbolOther = true },
connector = CharCategories { punctuationConnector = true },
static CharCategory asciiCategories[] =
{
- Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
- Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
- Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
- Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
+ Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
+ Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
+ Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
+ Cc, Cc, Cc, Cc, Cc, Cc, Cc, Cc,
Zs, Po, Po, Po, Sc, Po, Po, Po,
Ps, Pe, Po, Sm, Cs, Pd, Po, Po,
Nd, Nd, Nd, Nd, Nd, Nd, Nd, Nd,
Nd, Nd, Po, Po, Sm, Sm, Sm, Po,
- Po, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
- Lu, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
- Lu, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
+ Po, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
+ Lu, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
+ Lu, Lu, Lu, Lu, Lu, Lu, Lu, Lu,
Lu, Lu, Lu, Ps, Po, Pe, Sk, Pc,
- Sk, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
- Ll, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
- Ll, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
+ Sk, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
+ Ll, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
+ Ll, Ll, Ll, Ll, Ll, Ll, Ll, Ll,
Ll, Ll, Ll, Ps, Sm, Pe, Sm, Cc
};
{
node.key = (uintptr)new Range[1];
*(Range *)node.key = range;
- }
+ }
else
delete node;
}
string[len++] = ';';
string[len++] = ' ';
range->category.OnGetString(string + len, null, null);
- len += 2;
+ len += 2;
string[len++] = '\n';
string[len] = '\0';
f.Puts(string);
delete f;
}
*/
- }
+ }
}
~UnicodeDatabase()
{
void ClipOffset(Box against, int x, int y)
{
// Clip Top Left
- //if(against)
+ //if(against)
{
if(left + x < against.left) left = against.left - x;
if(top + y < against.top) top = against.top - y;
void Clip(Box against)
{
// Clip Top Left
- if(against != null)
+ if(against != null)
{
if(left < against.left) left = against.left;
if(top < against.top) top = against.top;
}
property int width
- {
+ {
set { right = left + value - 1; }
get { return right - left + 1; }
}
public property Angle { };
}
-public class Degrees : Angle
+public class Degrees : Angle
{
public property Radians
{
static void LogMySqlErrorf(MYSQL * mySql, String format, ...)
{
char msg[MAX_F_STRING];
-
+
va_list args;
va_start(args, format);
vsprintf(msg, format, args);
va_end(args);
-
+
Logf("%s\n MySql Error: #%d %s\n", msg, mysql_errno(mySql), mysql_error(mySql));
}
public:
MYSQL_ROW myRow;
unsigned long *myLengths;
-
+
MySqlTable dTbl;
MySqlField dFld;
pszT = mysql_get_host_info(src.mySql); Logf(" Host info: %s\n", pszT);
pszT = mysql_get_server_info(src.mySql); Logf(" Server info: %s\n", pszT);
Log(" _____________________________________\n\n");
-
+
Log(" ********************************************* \n");
Log(" * Stats * \n");
Log(" ********************************************* \n");
Log("TODO: MySql - DatabaseNameGet");
return null;
}
-
+
bool ::DatabaseNameSet(Database db, const String value)
{
MySqlDatabase dDb = (MySqlDatabase)db.driverData;
Table databases;
db.driver = ds.driver;
db.driverData = (void *)dDb;
-
+
databases = ds.OpenTable(null, { databasesList });
if(databases)
{
}
else
Log("Unable to detect if database exists!\n");
-
+
if(mysql_select_db(dDb.mySql, name) < 0)
{
LogMySqlErrorf(src.mySql, "Can't open the %s database!\n", db);
Log("TODO: MySql - DatabaseDelete");
return false;
}
-
+
/* -------------------------------------------------------------------------------------------------- */
/* --- Table ---------------------------------------------------------------------------------------- */
MySqlTable dTbl = (MySqlTable)tbl.driverData;
if(dTbl.myRes) mysql_free_result(dTbl.myRes);
}
-
+
uint ::TableFieldsCount(Table tbl)
{
MySqlTable dTbl = (MySqlTable)tbl.driverData;
return mysql_num_fields(dTbl.myRes);
}
-
+
uint ::TableRowsCount(Table tbl)
{
MySqlTable dTbl = (MySqlTable)tbl.driverData;
return (uint)mysql_num_rows(dTbl.myRes);
}
-
+
Field ::TableField(Table tbl)
{
MySqlTable dTbl = (MySqlTable)tbl.driverData;
}
return dTbl.row;
}
-
+
String ::TableNameGet(Table tbl)
{
MySqlTable dTbl = (MySqlTable)tbl.driverData;
else if(options.type == viewRows)
;
}
-
+
if(options.type == tableRows)
{
if(tables)
name[dFld.myFlds[dFld.fldsPos].org_name_length] = '\0';
return name;
}
-
+
bool ::FieldNameSet(Field fld, const String value)
{
MySqlField dFld = (MySqlField)fld.driverData;
}
return dRow.fld;
}
-
+
bool ::RowEnd(Row row)
{
MySqlRow dRow = (MySqlRow)row.driverData;
return false;
}
dRow.rowsPos--;
- dRow.myRow = mysql_fetch_row(dTbl.myRes); // this won't work at all...
+ dRow.myRow = mysql_fetch_row(dTbl.myRes); // this won't work at all...
Log("TODO: MySql - FieldNameSet");
return false;
return true;
MySqlRow dRow = (MySqlRow)row.driverData;
MySqlTable dTbl = dRow.dTbl;
MySqlField dFld = dRow.dFld;
-
+
switch(dFld.myFlds[dFld.fldsPos].type)
{
case FIELD_TYPE_TINY:
{
char r[MAX_F_STRING];
char t[MAX_LOCATION];
-
+
/*
host
hostaddr
krbsrvname
service
*/
-
+
r[0] = '\0';
if(ds.host)
sprintf(t, "host=%s ", ds.host), strcat(r, t);
char dbLocator[MAX_F_STRING];
PGconn * conn;
PgSQLDatabase db;
-
+
//PGconn *PQconnectStart(const char *conninfo);
//PostgresPollingStatusType PQconnectPoll(PGconn *conn);
//void PQreset(PGconn *conn);
ExecStatusType status;
PgSQLTable tbl { };
tbl.res = PQexec(conn, sql);
- //PGresult *PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes,
+ //PGresult *PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes,
// const char * const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);
//PGresult *PQprepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes);
//PGresult *PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, const char * const *paramValues,
{
return res ? PQnfields(res) : 0;
}
-
+
uint GetRowsCount()
{
return res ? PQntuples(res) : 0;
}
-
+
DriverRow CreateRow()
{
return null;
}
-
+
Field AddField(const String name, Class type, int length)
{
return null;
}
-
+
//char *PQfname(const PGresult *res, int column_number);
//Oid PQftable(const PGresult *res, int column_number);
//int PQftablecol(const PGresult *res, int column_number);
//int PQnparams(const PGresult *res);
//Oid PQparamtype(const PGresult *res, int param_number);
//void PQprint(FILE *fout, /* output stream */ const PGresult *res, const PQprintOpt *po);
-
+
//char *PQcmdStatus(PGresult *res);
//char *PQcmdTuples(PGresult *res);
//Oid PQoidValue(const PGresult *res);
}
return null;
}
-
+
bool Index(int count, FieldIndex * fieldIndexes)
{
return false;
{
public:
PgSQLTable tbl;
-
+
Class type;
int length;
{
return _num == -1;
}
-
+
bool Select(MoveOptions move)
{
int rowsCount = tbl.GetRowsCount();
int OracleExecuteNonQuery(OCIEnv* env, OCISvcCtx* svc, String command)
{
- OCIStmt* stmt;
+ OCIStmt* stmt;
OCIError* err;
text errbuf[512];
ub4 buflen;
ub4 errcode;
int r;
-
+
OCIHandleAlloc(env, (dvoid**)&err, OCI_HTYPE_ERROR, 0, 0);
OCIHandleAlloc(env, (dvoid**)&stmt, OCI_HTYPE_STMT, 0, 0);
r = OCIStmtExecute(svc, stmt, err, 1, 0,
(OCISnapshot *) 0, (OCISnapshot *) 0, OCI_COMMIT_ON_SUCCESS);
-
+
OCIStmtRelease(stmt, err, (OraText *)NULL, 0, OCI_DEFAULT);
if (err) OCIHandleFree(err, OCI_HTYPE_ERROR);
char s[MAX_F_STRING];
char t[MAX_LOCATION];
-
+
s[0] = '\0';
strcat(s, "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(");
if(ds.host)
if(name)
sprintf(t, "SID=%s", name), strcat(s, t);
strcat(s, ")))");
-
+
if (ses) OCIHandleFree(ses, OCI_HTYPE_SESSION);
if (svc) OCIHandleFree(svc, OCI_HTYPE_SVCCTX);
if (srv) OCIHandleFree(srv, OCI_HTYPE_SERVER);
if (err) OCIHandleFree(err, OCI_HTYPE_ERROR);
if (env) OCIHandleFree(env, OCI_HTYPE_ENV);
- r = OCIEnvCreate(&env, OCI_DEFAULT, 0, 0, 0, 0, 0, 0);
+ r = OCIEnvCreate(&env, OCI_DEFAULT, 0, 0, 0, 0, 0, 0);
OCIHandleAlloc(env, (dvoid**)&err, OCI_HTYPE_ERROR, 0, 0);
OCIHandleAlloc(env, (dvoid**)&srv, OCI_HTYPE_SERVER, 0, 0);
OCIAttrSet(svc, OCI_HTYPE_SVCCTX, srv, 0, OCI_ATTR_SERVER, err);
- OCIAttrSet(ses, OCI_HTYPE_SESSION, ds.user, strlen(ds.user), OCI_ATTR_USERNAME, err);
+ OCIAttrSet(ses, OCI_HTYPE_SESSION, ds.user, strlen(ds.user), OCI_ATTR_USERNAME, err);
OCIAttrSet(ses, OCI_HTYPE_SESSION, ds.pass, strlen(ds.pass), OCI_ATTR_PASSWORD, err);
r = OCISessionBegin(svc, err, ses, OCI_CRED_RDBMS, OCI_DEFAULT);
OCIServer* srv;
OCISvcCtx* svc;
OCISession* ses;
-
+
~OracleDatabase()
{
//
OCIDefine* p_dfn3;
char p_sli1[1024];
char p_sli2[1024];
- int p_sli3;
+ int p_sli3;
int oracleType;
OracleField field;
int num;
- OCIStmt* stmtRows;
+ OCIStmt* stmtRows;
OCIHandleAlloc(env, (dvoid**)&stmtRows, OCI_HTYPE_STMT, 0, 0);
if (type)
{
- if(!strcmp(type.dataTypeString, "int") || !strcmp(type.dataTypeString, "unsigned int") ||
- !strcmp(type.dataTypeString, "long") || !strcmp(type.dataTypeString, "long int") ||
- !strcmp(type.dataTypeString, "uint") || !strcmp(type.dataTypeString, "uint32") ||
- !strcmp(type.dataTypeString, "int64") || !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") ||
+ if(!strcmp(type.dataTypeString, "int") || !strcmp(type.dataTypeString, "unsigned int") ||
+ !strcmp(type.dataTypeString, "long") || !strcmp(type.dataTypeString, "long int") ||
+ !strcmp(type.dataTypeString, "uint") || !strcmp(type.dataTypeString, "uint32") ||
+ !strcmp(type.dataTypeString, "int64") || !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") ||
!strcmp(type.dataTypeString, "short") || !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
!strcmp(type.dataTypeString, "char") || !strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
oracleType = SQLT_INT;
{
oracleType = SQLT_TIMESTAMP_TZ;
}
-
+
field = { name = CopyString(p_sli1), type = type, length = p_sli3, num = table.fields.count, oracleType = oracleType };
incref field;
table.fields.Add(field);
OCIStmtRelease(stmtRows, err, (OraText *)NULL, 0, OCI_DEFAULT);
- if (stmtRows) OCIHandleFree(stmtRows, OCI_HTYPE_STMT);
+ if (stmtRows) OCIHandleFree(stmtRows, OCI_HTYPE_STMT);
}
return (Table)table;
OCIStmt* stmt;
OCIDefine* def;
OCIDefine* p_dfn;
- char p_sli[1024];
+ char p_sli[1024];
Field AddField(const String fieldName, Class type, int length)
{
command[0] = 0;
if(FindField(fieldName)) return null;
-
+
oracleType = SQLT_BLOB;
((Class)(&type)).OnGetDataFromString(type); // TODO: THIS REQUIRES A FIX SOMEWHERE ELSE
if (type)
{
- if(!strcmp(type.dataTypeString, "int") || !strcmp(type.dataTypeString, "unsigned int") ||
- !strcmp(type.dataTypeString, "long") || !strcmp(type.dataTypeString, "long int") ||
- !strcmp(type.dataTypeString, "uint") || !strcmp(type.dataTypeString, "uint32") ||
- !strcmp(type.dataTypeString, "int64") || !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") ||
+ if(!strcmp(type.dataTypeString, "int") || !strcmp(type.dataTypeString, "unsigned int") ||
+ !strcmp(type.dataTypeString, "long") || !strcmp(type.dataTypeString, "long int") ||
+ !strcmp(type.dataTypeString, "uint") || !strcmp(type.dataTypeString, "uint32") ||
+ !strcmp(type.dataTypeString, "int64") || !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") ||
!strcmp(type.dataTypeString, "short") || !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
!strcmp(type.dataTypeString, "char") || !strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
oracleType = SQLT_INT;
Field FindField(const String name)
{
- String upperName = CopyString(name);
+ String upperName = CopyString(name);
ToUpperAndUnderscore(upperName);
for(f : fields)
}
}
- delete upperFieldName;
- return (Field)f;
+ delete upperFieldName;
+ return (Field)f;
}
delete upperFieldName;
int nCols, nRows;
int result;
uint rowCount = 0;
-
- OCIStmt* stmtCount;
+
+ OCIStmt* stmtCount;
OCIError* err;
text errbuf[512];
ub4 buflen;
}
if (stmt) OCIHandleFree(stmt, OCI_HTYPE_STMT);
- OCIHandleAlloc(db.env, (dvoid**)&stmt, OCI_HTYPE_STMT, 0, 0);
+ OCIHandleAlloc(db.env, (dvoid**)&stmt, OCI_HTYPE_STMT, 0, 0);
for (i = 0; i < fields.count; i++)
{
r = OCIStmtPrepare(stmt, db.err, (OraText *)command,
(ub4)strlen((char *)command),
(ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);
-
+
for (i = 0; i < fields.count; i++)
{
OracleField field = fields[i];
~OracleTable()
{
- if (stmt) OCIHandleFree(stmt, OCI_HTYPE_STMT);
+ if (stmt) OCIHandleFree(stmt, OCI_HTYPE_STMT);
delete name;
delete specialStatement;
done = true;
int64 rowID;
int numVal;
-
+
bool Nil()
{
return done;
int r;
text errbuf[512];
- ub4 errcode;
+ ub4 errcode;
int i;
switch(move)
break;
}
case previous:
- {
+ {
break;
}
case nil:
{
OracleField oracleField = (OracleField)fld;
Class dataType = oracleField.type;
- int r;
+ int r;
switch (oracleField.oracleType)
{
rowID = 1;
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_FIRST, 0, OCI_DEFAULT);
-
+
if (oracleField.p_sliInt == dataValue)
{
return true;
rowID = 1;
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_FIRST, 0, OCI_DEFAULT);
-
+
if (oracleField.p_sliInt == dataValue)
{
return true;
rowID = 1;
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_FIRST, 0, OCI_DEFAULT);
-
+
if (oracleField.p_sliInt == dataValue)
{
return true;
rowID = 1;
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_FIRST, 0, OCI_DEFAULT);
-
+
if (oracleField.p_sliInt == dataValue)
{
return true;
rowID = 1;
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_FIRST, 0, OCI_DEFAULT);
-
+
if (oracleField.p_sliInt == dataValue)
{
return true;
return true;
}
}
- }
+ }
break;
}
}
rowID = 1;
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_FIRST, 0, OCI_DEFAULT);
-
+
if (oracleField.p_sliInt == dataValue)
{
return true;
rowID = 1;
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_FIRST, 0, OCI_DEFAULT);
-
+
if (!strcmp(oracleField.p_sli, dataValue))
{
return true;
rowID = 1;
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_FIRST, 0, OCI_DEFAULT);
-
+
OCIDateTimeGetDate(tbl.db.env, tbl.db.err, oracleField.p_sliDateTime,
- &year, &month, &day);
+ &year, &month, &day);
if ((year == date.year) && ((Month)(month-1) == date.month) && (day == date.day))
{
}
}
}
-
+
return false;
}
{
/* New row with id as max(id)+i*/
sprintf(command, "INSERT INTO %s (%s) SELECT MAX(CAST(%s AS INTEGER)) + 1 FROM %s",
- tableName, primaryKeyName, primaryKeyName, tbl.name);
+ tableName, primaryKeyName, primaryKeyName, tbl.name);
}
OracleExecuteNonQuery(tbl.db.env, tbl.db.svc, command);
-
+
OCIStmtRelease(tbl.stmt, tbl.db.err, (OraText *)NULL, 0, OCI_DEFAULT);
r = OCIStmtExecute(tbl.db.svc, tbl.stmt, tbl.db.err, 0, 0,
- (OCISnapshot *) 0, (OCISnapshot *) 0, OCI_STMT_SCROLLABLE_READONLY);
+ (OCISnapshot *) 0, (OCISnapshot *) 0, OCI_STMT_SCROLLABLE_READONLY);
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, 1, OCI_FETCH_LAST, 0, OCI_DEFAULT);
-
+
delete primaryKeyName;
delete tableName;
{
primaryKeyName = CopyString(tbl.GetFirstField().name);
}
-
+
primaryKeyField = (OracleField)tbl.FindField(primaryKeyName);
tableName = CopyString(tbl.name);
buffer.count = buffer._size;
dataType._vTbl[__ecereVMethodID_class_OnUnserialize](dataType, data, buffer);
-
+
buffer._buffer = null;
delete buffer;
break;
{
primaryKeyName = CopyString(tbl.GetFirstField().name);
}
-
+
primaryKeyField = (OracleField)tbl.FindField(primaryKeyName);
if (primaryKeyField.oracleType == SQLT_STR)
{
}
}
break;
- case SQLT_FLT:
+ case SQLT_FLT:
sprintf(command, "UPDATE %s SET %s = '%i' WHERE %s = %s", tableName, fieldName, (uint16)data, primaryKeyName, primaryKeyValue);
r = OracleExecuteNonQuery(tbl.db.env, tbl.db.svc, command);
break;
break;
}
case SQLT_BLOB: // No basic datatype
- {
+ {
break;
}
}
actualRowID = rowID;
OracleExecuteNonQuery(tbl.db.env, tbl.db.svc, command);
-
+
OCIStmtRelease(tbl.stmt, tbl.db.err, (OraText *)NULL, 0, OCI_DEFAULT);
r = OCIStmtExecute(tbl.db.svc, tbl.stmt, tbl.db.err, 0, 0,
- (OCISnapshot *) 0, (OCISnapshot *) 0, OCI_STMT_SCROLLABLE_READONLY);
+ (OCISnapshot *) 0, (OCISnapshot *) 0, OCI_STMT_SCROLLABLE_READONLY);
r = OCIStmtFetch2(tbl.stmt, tbl.db.err, (uint)actualRowID, OCI_FETCH_ABSOLUTE, 0, OCI_DEFAULT);
-
+
if ((r == OCI_SUCCESS) || (r == OCI_SUCCESS_WITH_INFO))
return true;
-
+
return false;
}
bool GoToSysID(uint id)
{
- /* We need to find in primaryKey field the row matching primaryKey field value and id */
+ /* We need to find in primaryKey field the row matching primaryKey field value and id */
char idValue[64];
int r;
int i;
((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, &inst2, buffer2);
result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, inst1, inst2);
-
+
buffer1.buffer = null;
buffer2.buffer = null;
delete buffer1;
((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnUnserialize])(type, inst2, buffer2);
result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type, inst1, inst2);
-
+
buffer1.buffer = null;
buffer2.buffer = null;
delete buffer1;
// sqlite3_open(path, &db);
// sqlite3_open_v2(path, &db, SQLITE_OPEN_READONLY /*SQLITE_OPEN_READWRITE*/ /*SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE*/, null );
-
+
if(sqlite3_open_v2(path, &db, (createOptions == readOnly) ? SQLITE_OPEN_READONLY :
(SQLITE_OPEN_READWRITE | ((createOptions == create) ? SQLITE_OPEN_CREATE : 0)), null))
{
if(sqlite3_exec(db, "INSERT INTO eda_table_fields (Table_Name, Name, Type, Length) VALUES ('lockDummy', 'lockDummy', 'lockDummy', 'lockDummy')", null, null, null))
success = false;
else
- sqlite3_exec(db, "DELETE FROM eda_table_fields WHERE Name = 'lockDummy'", null, null, null);
+ sqlite3_exec(db, "DELETE FROM eda_table_fields WHERE Name = 'lockDummy'", null, null, null);
}
}
if(success)
{
sqlite3 * db;
AVLTree<String> collations { };
-
+
~SQLiteDatabase()
{
sqlite3_exec(db, "PRAGMA locking_mode=normal", null, null, null);
sprintf(command, "SELECT sql FROM sqlite_master WHERE type='table' AND name='%s';", name);
nCols = 0, nRows = 0;
result = sqlite3_get_table(db, command, &t, &nRows, &nCols, null);
-
+
if((nCols || nRows) || options.create)
{
table = SQLiteTable { db = this, name = CopyString(name) };
{
char * sql = t[nCols * r];
char * bracket = strchr(sql, '(');
- if(bracket)
+ if(bracket)
{
int c = 0;
bracket++;
dataType[c - d - 2] = 0;
while(ch && bracket[c] == ' ') c++;
-
+
if(!strcmp(dataType, "REAL")) { sqliteType = SQLITE_FLOAT; type = class(double); }
else if(!strcmp(dataType, "TEXT")) { sqliteType = SQLITE_TEXT; type = class(String); }
else if(!strcmp(dataType, "INTEGER")) { sqliteType = SQLITE_INTEGER; type = class(int); }
{
Table refTable = null;
sqlite3_stmt * statement;
-
+
sprintf(command, "SELECT Name, Type, Length FROM eda_table_fields WHERE Table_Name='%s';", name);
result = sqlite3_prepare_v2(db, command, -1, &statement, null);
if(type)
{
- if(!strcmp(type.dataTypeString, "int") || !strcmp(type.dataTypeString, "unsigned int") ||
- !strcmp(type.dataTypeString, "long") || !strcmp(type.dataTypeString, "long int") ||
- !strcmp(type.dataTypeString, "uint") || !strcmp(type.dataTypeString, "uint32") ||
- !strcmp(type.dataTypeString, "int64") || !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") ||
+ if(!strcmp(type.dataTypeString, "int") || !strcmp(type.dataTypeString, "unsigned int") ||
+ !strcmp(type.dataTypeString, "long") || !strcmp(type.dataTypeString, "long int") ||
+ !strcmp(type.dataTypeString, "uint") || !strcmp(type.dataTypeString, "uint32") ||
+ !strcmp(type.dataTypeString, "int64") || !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") ||
!strcmp(type.dataTypeString, "short") || !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
!strcmp(type.dataTypeString, "char") || !strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
sqliteType = SQLITE_INTEGER;
Table refTable = null;
Field idField = null;
command[0] = 0;
-
+
if(FindField(fieldName)) return null;
- if(!strcmp(type.dataTypeString, "int") || !strcmp(type.dataTypeString, "unsigned int") ||
- !strcmp(type.dataTypeString, "long") || !strcmp(type.dataTypeString, "long int") ||
- !strcmp(type.dataTypeString, "uint") || !strcmp(type.dataTypeString, "uint32") ||
- !strcmp(type.dataTypeString, "int64") || !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") ||
+ if(!strcmp(type.dataTypeString, "int") || !strcmp(type.dataTypeString, "unsigned int") ||
+ !strcmp(type.dataTypeString, "long") || !strcmp(type.dataTypeString, "long int") ||
+ !strcmp(type.dataTypeString, "uint") || !strcmp(type.dataTypeString, "uint32") ||
+ !strcmp(type.dataTypeString, "int64") || !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") ||
!strcmp(type.dataTypeString, "short") || !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
!strcmp(type.dataTypeString, "char") || !strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
{
PrintLn($"WARNING: Table not yet created for class ", (String)type.name);
}
}
-
+
if(mustCreate)
{
if(sqliteType == SQLITE_BLOB)
sqlite3_prepare_v2(db.db, command, -1, &setRowIDStmt, null);
return SQLiteRow
- { tbl = this, defaultStatement = statement, curStatement = statement, sysIDStatement = sysIDStmt,
+ { tbl = this, defaultStatement = statement, curStatement = statement, sysIDStatement = sysIDStmt,
insertStatement = insertStmt, deleteStatement = deleteStmt, selectRowIDsStmt = selectRowIDsStmt, setRowIDStmt = setRowIDStmt,
previousStatement = prevStmt, nextStatement = nextStmt, lastStatement = lastStmt, insertIDStatement = insertIDStmt };
}
// this flag is used to distinguish between a Find() and a GoToSysID() for Select(next) purposes:
bool findSysID;
int findBindId;
-
+
bool Nil()
{
return done;
case previous:
{
// For sysID statement, for a Find() we want to go through next/previous in order, otherwise we just go to nil
- if((move == next && curStatement != prevFindStatement && curStatement != lastFindStatement && !stepping && (curStatement != sysIDStatement || findSysID)) ||
+ if((move == next && curStatement != prevFindStatement && curStatement != lastFindStatement && !stepping && (curStatement != sysIDStatement || findSysID)) ||
(move == previous && (curStatement == prevFindStatement || curStatement == lastFindStatement)))
{
result = sqlite3_step(curStatement);
SerialBuffer buffer = null;
switch(fld.sqliteType)
{
- case SQLITE_INTEGER:
+ case SQLITE_INTEGER:
{
switch(dataType.typeSize)
{
switch(sqlFld.sqliteType)
{
- case SQLITE_INTEGER:
+ case SQLITE_INTEGER:
{
switch(dataType.typeSize)
{
buffer.count = buffer._size;
((void (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnUnserialize])(dataType, data, buffer);
-
+
buffer._buffer = null;
delete buffer;
break;
// sqlite3_open(path, &db);
// sqlite3_open_v2(path, &db, SQLITE_OPEN_READONLY /*SQLITE_OPEN_READWRITE*/ /*SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE*/, null );
-
+
if(sqlite3_open_v2(path, &db, (createOptions == readOnly) ? SQLITE_OPEN_READONLY :
(SQLITE_OPEN_READWRITE | ((createOptions == create) ? SQLITE_OPEN_CREATE : 0)), null))
// fprintf(stderr, "%s\n", s); // interesting
else
printf($"Can't open database (%s): %s -- password may be incorrect\n", path, sqlite3_errstr(rc));
}
- }
+ }
if(!result)
sqlite3_close(db);
delete path;
String user;
String pass;
String locator;
-
+
~DataSource()
{
delete locator;
property Field primaryKey { get { return GetPrimaryKey(); } }
property uint fieldsCount { get { return GetFieldsCount(); } }
property uint rowsCount { get { return GetRowsCount(); } }
-
+
virtual Field AddField(const String name, Class type, int length);
virtual Field FindField(const String name);
virtual bool GenerateIndex(int count, FieldIndex * fieldIndexes, bool init);
editable = true;
header = fld.name;
width = 100;
- };
+ };
list.AddField(df);
}
}
#ifdef AUTO_DELETE
tbl.listRows.Add(this);
#endif
- }
+ }
}
get { return tbl; }
}
bool SetData(Field field, typed_object data) { return (row && field) ? row.SetData(field, data) : false; }
bool Delete() { return row ? row.Delete() : false; }
bool SetQueryParam(int paramID, int value) { return row ? row.SetQueryParam(paramID, value) : false; }
- bool SetQueryParam64(int paramID, int64 value) { return row ? row.SetQueryParam64(paramID, value) : false; }
+ bool SetQueryParam64(int paramID, int64 value) { return row ? row.SetQueryParam64(paramID, value) : false; }
bool SetQueryParamText(int paramID, char * value) { return row ? row.SetQueryParamText(paramID, value) : false; }
bool SetQueryParamObject(int paramID, void * value, Class type) { return row ? row.SetQueryParamObject(paramID, value, type) : false; }
// TOCHECK: Field is passed here to have sqlite type handy. The API might be nicer without
*allocatedRowsCount = 0;
*deletedRowsCount = 0;
}
-
+
switch(action)
{
case init: break;
/*
Table OpenDatabasesListTable(subclass(DataDriver) driver)
{
- // get the table for databasesList using a temporary archive of a db with a table databases filled
+ // get the table for databasesList using a temporary archive of a db with a table databases filled
// with the list of edb files in data source's dirPath
-
+
TempFile f { };
//ArchiveFile af = ArchiveOpen
-
+
return null;
}
*/
{
File f;
};
-
+
static class EDBArchiveDir : ArchiveDir
{
EDBArchive archive;
strcat(indexName, (index.fieldIndexes[c].order == ascending) ? "+" : "-");
}
tf.Seek(0, start);
-
+
dirTable = db.archive.OpenDirectory(apath, FileStats { }, replace);
dirTable.AddFromFile(indexName, tf, { size = tf.GetSize() }, replace, 0, null, null);
delete dirTable;
dbTables.Add(dbTbl);
dbTbl.dir = archive.OpenDirectory(apath, null, readOnlyDir);
-
+
RowsCountFileEdit(archive, apath, init, &dbTbl.allocatedRowsCount, &dbTbl.deletedRowsCount, &dbTbl.rowsCountPosition);
dbTbl.rowsCount = dbTbl.allocatedRowsCount - dbTbl.deletedRowsCount;
dbTbl.rowPositionsSize = dbTbl.allocatedRowsCount;
dbTbl.rowPositions = new0 uint[Max(1,dbTbl.rowPositionsSize)];
position = dir.first;
-
+
while(true)
{
char fileName[MAX_FILENAME] = "";
int f;
EDBRow row1 = index.row1;
EDBRow row2 = index.row2;
-
+
if(index.cache && index.cache._num == r1)
row1 = index.cache;
else
}
((bool (*)())(void *)row1.GetData)(row1, field, type, (type.type == structClass) ? (void *)data1 : &data1);
((bool (*)())(void *)row2.GetData)(row2, field, type, (type.type == structClass) ? (void *)data2 : &data2);
- fieldResult = order * ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ fieldResult = order * ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
(type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &data1 : (void *)data1,
(type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &data2 : (void *)data2);
((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)data1);
row2.tbl = ((EDBTable)index.fieldIndexes[f].memberTable).dbTable;
row2.index = ((EDBTable)index.fieldIndexes[f].memberTable).index;
row2.num = 0;
- row2.Find(index.fieldIndexes[f].memberIdField, middle, nil, data2);
+ row2.Find(index.fieldIndexes[f].memberIdField, middle, nil, data2);
field = memberField;
memberField = null;
{
EDBDatabase edb = dbTable.db;
EDBField field
- {
+ {
tbl = dbTable,
name = CopyString(name),
type = type,
{
return EDBRow { tbl = dbTable, index = index, num = 0 };
}
-
+
bool GenerateIndex(int count, FieldIndex * fieldIndexes, bool init)
{
DBIndex index = null;
{
int c;
for(c = 0; c<count; c++)
- if(index.fieldIndexes[c].field != fieldIndexes[c].field ||
+ if(index.fieldIndexes[c].field != fieldIndexes[c].field ||
index.fieldIndexes[c].order != fieldIndexes[c].order ||
index.fieldIndexes[c].memberField != fieldIndexes[c].memberField)
break;
if(c == count)
break;
- }
+ }
}
if(!index)
{
for(field = dbTable.fields.first; field; field = field.next)
if(field == fieldIndexes[c].field)
break;
- if(!field)
+ if(!field)
return false;
}
}
DBTable tbl;
DBIndex index;
BTNode node;
-
+
String aname;
int _num;
uint size;
f.Read(offsets, sizeof(uint), oldNumFields);
tf.Put(numFields);
-
+
tf.Write(offsets, sizeof(uint), numFields);
size = f.GetSize();
{
buffer = renew buffer byte[size];
f.Read(buffer, 1, size);
- tf.Write(buffer, 1, size);
+ tf.Write(buffer, 1, size);
}
// Update the offset of the field we're writing to
break;
}
}
-
+
if(c < numFields)
{
int fileSize = f.GetSize();
BTNode n = (i == index) ? node : null;
int c;
for(c = 0; c<i.numFields; c++)
- if(i.fieldIndexes[c].field == field ||
+ if(i.fieldIndexes[c].field == field ||
i.fieldIndexes[c].memberField == field ||
i.fieldIndexes[c].memberIdField == field)
break;
{
return !_num;
}
-
+
bool Select(MoveOptions move)
{
EDBDatabase edb = tbl.db;
}
delete offsets;
}
-
+
delete f;
}
return result;
{
this.node = node;
num = (uint)node.key;
- return true;
+ return true;
}
}
else if(move == previous)
{
this.node = node;
num = (uint)node.key;
- return true;
+ return true;
}
}
//if(data._class == type)
{
result = order * ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
- (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &read : (void *)read,
+ (type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &read : (void *)read,
(type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &findData[c].value.i64 : (void *)findData[c].value.i64);
}
((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, (void *)read);
{
BTNode node = this.node, lastNode = null;
int result;
-
+
if(move == next || move == nil)
{
if(move == next)
{
this.node = node;
num = (uint)node.key;
- return true;
+ return true;
}
}
else if(move == previous)
{
this.node = node;
num = (uint)node.key;
- return true;
+ return true;
}
}
EDBDatabase edb = tbl.db;
TempFile f;
ArchiveDir dirTable;
-
+
RowsCountFileEdit(edb.archive, tbl.apath, reused ? reuse : add, &tbl.allocatedRowsCount, &tbl.deletedRowsCount, &tbl.rowsCountPosition);
tbl.rowsCount = tbl.allocatedRowsCount - tbl.deletedRowsCount;
if(reused)
}
dirTable = edb.archive.OpenDirectory(tbl.apath, FileStats { }, replace);
-
+
f = TempFile { };
f.Seek(0, start);
}
dirTable.AddFromFileAtPosition(tbl.rowPositions[_num - 1], aname, f, { size = f.GetSize() }, replace, 0, null, &tbl.rowPositions[_num - 1]);
delete f;
-
+
delete dirTable;
-
+
{
DBIndex i;
for(i = tbl.indexes.first; i; i = i.next)
ArchiveDir dirTable;
BTNode node = this.node;
int oldNum = this._num;
-
+
RowsCountFileEdit(edb.archive, tbl.apath, del, &tbl.allocatedRowsCount, &tbl.deletedRowsCount, &tbl.rowsCountPosition);
tbl.rowsCount = tbl.allocatedRowsCount - tbl.deletedRowsCount;
tbl.rowPositions[_num - 1] = 0;
-
+
dirTable = edb.archive.OpenDirectory(tbl.apath, FileStats { }, replace);
if(!aname)
{
}
dirTable.Delete(aname);
delete dirTable;
-
+
Select(next);
if(!_num)
Select(last);
-
+
{
DBIndex i;
for(i = tbl.indexes.first; i; i = i.next)
if(tbl.allocatedRowsCount >= id && id > 0 && tbl.rowPositions[id - 1])
{
_num = id;
-
+
if(index)
node = index.tree.FindAll(id);
return true;
static class EDBMemoryDataSource : DataSourceDriver
{
class_property(name) = "MemoryEDB";
-
+
Database OpenDatabase(const String name, CreateOptions createOptions, DataSource ds)
{
return EDBDatabase { path = null, archive = ArchiveOpen(null, ArchiveOpenFlags { true }) };
Window inside { this };
int headerHeight;
-
+
private:
Orientation orientation;
}
reportHeader.anchor = Anchor { left = 0, top = 0, right = 0 };
reportHeader.master = destination;
reportHeader.parent = inside;
-
+
pageTop += reportHeader.size.h;
reportHeader.Create();
-
+
}
/*if(report.reportFooter)
{
pageHeader.anchor = Anchor { left = 0, top = pageTop, right = 0 };
pageHeader.master = destination;
pageHeader.parent = inside;
-
+
pageTop += pageHeader.size.h;
pageHeader.Create();
}
-
+
if(report.pageFooter)
{
pageFooter = eInstance_New(report.pageFooter);
pageFooter.anchor = Anchor { left = 0, bottom = (int)reportFooter.size.h, right = 0 };
else
pageFooter.anchor = Anchor { left = 0, bottom = 0, right = 0 };
-
+
pageFooter.Create();
}
if(nil && report.reportFooter)
{
reportFooter.Create();
}
-
+
destination.EndPage(page);
if(nil)
break;
-
+
// still have to bump report footer if it does not fit...
}
pleaseWait.Destroy(0);
detailSize = detail.size.h;
overlap = (insideSize - pageTop - footerHeight) - detailSize;
-
+
if(overlap < 0 && detail.keepTogether)
{
delete detail;
void AddPage(Page page)
{
- PreviewPage previewPage { this, this, page = page, orientation = page.orientation,
+ PreviewPage previewPage { this, this, page = page, orientation = page.orientation,
anchor = { top = pageCount * ((int)page.size.h + shadowS + pgs) } };
previewPage.Create();
page.anchor = { left = pgs, top = pgs, right = shadowS + pgs, bottom = shadowS + pgs};
page.Create();
pageCount++;
}
-
+
Report GetReport()
{
return report;
Array<FileFilter> csvFilters
{ [
- {
+ {
$"Comma Separated Values Spreadsheet (*.csv)",
"csv"
},
hasVertScroll = true;
dontHideScroll = true;
background = dimGray;
-
+
Page lastPage;
void AddPage(Page page)
pageCount++;
page.Create();
}
-
+
void PutString(File f, char * text)
{
char output[4096];
File f = FileOpen(saveTo.filePath, write);
if(f)
{
- Detail detail, first = null;
+ Detail detail, first = null;
for(detail = (Detail)page.inside.firstChild; detail && detail != first; detail = (Detail)detail.next)
{
if(!first) first = detail;
if(eClass_IsDerived(detail._class, class(Detail)))
{
Label label, first = null;
-
+
if(detail._class == report.pageFooter) continue;
if(detail._class == report.groupings[0].header)
f.Puts("\n");
public:
Id id;
Field field;
-
+
bool RowMatch(Row row)
{
Id value;
filters.Free();
delete row;
}
-
+
virtual bool ShouldSkip()
{
return false;
result = row.Next();
if(!result)
return false;
-
+
if(reverseLink)
reverseLink.row.GetData(reverseListFieldLink, reverseIdList);
{
return grouping.Advance(linkId, dontAdvance);
}
-
+
virtual bool ExecuteData(Database db)
{
return false;
{
dataBox, borderStyle = 0, text = dataBox.text, anchor = { 0, 0, 0, 0 },
// size = { 100, 22 };
- modifyVirtualArea = false, isCheckbox = true;
+ modifyVirtualArea = false, isCheckbox = true;
bool DataBox::NotifyClicked(Button control, int x, int y, Modifiers mods)
{
tbl.GenerateIndex(1, indexedFields, false);
r = Row { tbl };
-
+
for(r.Find(filterField, middle, nil, filter); !r.nil; r.Next()) //while(r.Next())
{
Id id;
}
else if((SmartKey)key == enter)
parent.CycleChildren(true, false, false, true);
-
+
return DropBox::OnKeyHit(key, ch);
}
dropBox.filter = filter;
else
dropBox.filtered = false;
-
+
dropBox.exclusion = exclusion;
dropBox.showNone = showNone;
}
if(!DataBox::SaveData())
Refresh();
- ((bool (*)())(void *)Row::SetData)(row, field, type,
+ ((bool (*)())(void *)Row::SetData)(row, field, type,
(type.type == noHeadClass || type.type == normalClass) ? *(void **)data : data);
}
}
{
if((SmartKey)key == enter)
parent.CycleChildren(true, false, false, true);
-
+
return DataBox::OnKeyHit(key, ch);
}
void Save()
{
TableDropBox dropBox = (TableDropBox) editor;
-
+
if(!dropBox.currentRow && dropBox.contents[0])
{
Row row { dropBox.table };
if(table)
{
FieldIndex indexedFields[1];
-
+
if(!fldId) fldId = table.FindField(defaultIdField);
if(!fldName) fldName = table.FindField(defaultNameField);
if(!fldActive) fldActive = table.FindField(defaultActiveField);
-
+
indexedFields[0] = { fldId };
table.Index(1, indexedFields);
-
+
editor.editRow.tbl = table;
-
+
RefillList();
}
}
{
return MessageBox { master = this, type = yesNoCancel, text = $"List Editor", contents = $"You have modified this entry. Would you like to save it before proceeding?" }.Modal();
}
-
+
bool OnClose(bool parentClosing)
{
if(editor && editor.modifiedDocument)
list.NotifySelect(this, list, null, 0);
if(!editor.modifiedDocument)
{
- uint id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
+ uint id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
Row r { table };
-
+
if(r.Last()) // this will reuse ids in cases where the item(s) with the last id have been deleted
{
r.GetData(fldId, id);
}
else
id = 1;
-
+
editor.EditClear();
{
bool active = true;
virtual bool Window::NotifyDeleteConfirmation(ListSection listSection)
{
- return MessageBox { master = this, type = yesNo, text = $"List Editor",
+ return MessageBox { master = this, type = yesNo, text = $"List Editor",
contents = $"You are about to delete an entry.\n"
"Do you wish to continue?"
}.Modal() == yes;
{
this, anchor = { left = sgs * 2, top = 22 + 22 + sgs * 4, right = shadowS + sgs * 2, bottom = shadowS + sgs * 2 };
alwaysHighLight = true;
-
+
bool NotifySelect(ListBox listBox, DataRow row, Modifiers mods)
{
bool result = true;
};
virtual void Window::NotifySelectListRow(ListSection listSection, uint64 id);
-
+
void SelectListRow(DataRow row)
{
// Time startTime = GetTime();
editor.disabled = !(bool)list.firstRow;
}
}
-
+
void OnResize(int width, int height)
{
int x = width - btnDelete.size.w - 20;
OldList editBoxes { };
Window editArea { this, borderStyle = deep, tabCycle = true, anchor = { left = 8, top = 54, right = 10, bottom = 10 }, hasVertScroll = true, dontHideScroll = true };
-
+
ButtonStyle btnSave
{
this, anchor = { right = shadowS + sgs * 2, top = 24 }, hotKey = altV, text = $"Save";
}
virtual void Window::NotifyInitFields(EditSection editSection);
-
+
void InitFields()
{
OldLink link;
{
edit.listRow.string = name;
}
-
+
void EditSave()
{
bool stringName = !strcmp(list.fldName.type.dataTypeString, "char *");
//virtual bool Window::NotifyNew(AltListSection listSection, Row r);
//virtual void Window::NotifyInitFields(AltEditSection editSection);
-
+
virtual DialogResult OnLeavingModifiedDocument()
{
DebugLn("TableEditor::OnLeavingModifiedDocument");
contents = $"You have modified this entry. Would you like to save it before proceeding?"
}.Modal();
}
-
+
virtual bool OnRemovalRequest()
{
DebugLn("TableEditor::OnRemovalRequest");
//list.NotifySelect(this, list, null, 0);
if(table && editRow && editRow.tbl && !modifiedDocument)
{
- uint id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
+ uint id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
// I think the 3 following comment lines apply to the old sqlite driver before many fix we done for wsms
Row r = editRow;// { table }; // the multipurpose row is buggy with sqlite driver, you can't use the same row to do Row::Last(), Row::Next(), Row::Find(), etc...
//Row r { editRow.tbl }; // for example, Row::Last() here is not using the proper sqlite statement and fails to
}
return result;
}
-
+
bool SelectPrevious(bool loopAround)
{
bool result = NotifyClosing();
}
return result;
}
-
+
void SelectListRow(DataRow row)
{
// Time startTime = GetTime();
struct WordEntryBinaryTree : BinaryTree
{
WordEntry * entries;
-
+
void OnSerialize(IOChannel channel)
{
WordEntry node;
{
bool isLeft = node == node.parent.left;
node = node.parent;
-
+
while(node)
{
if(isLeft && node.right)
uint count;
DebugLn("WordEntryBinaryTree::OnUnserialize");
channel.Unserialize(count);
- entries = new WordEntry[count];
+ entries = new WordEntry[count];
btnodes = entries;
channel.Unserialize(root);
this.root = (BTNode)root;
- // count = root ? this.root.count : 0;
+ // count = root ? this.root.count : 0;
this.count = count;
for(node = (WordEntry)root; node;)
{
{
bool isLeft = node == node.parent.left;
node = node.parent;
-
+
while(node)
{
if(isLeft && node.right)
WordEntry parent;
WordEntry left, right;
int depth;
-
+
IdList items;
IdList words;
uint id;
// TODO: Fix typed_object issues
entry = btnodes[id - 1] = eInstance_New(class(WordEntry));
this = (void *)entry;
-
+
channel.Unserialize(string);
channel.Unserialize(items);
channel.Unserialize(words);
return result;
}
}
-
+
// DataBox has a member called editor as well?
// would like to rename TableEditor to TableControl anyway
public property TableEditor editor
if(!DataBox::SaveData())
Refresh();
- ((bool (*)())(void *)Row::SetData)(row, field, type,
+ ((bool (*)())(void *)Row::SetData)(row, field, type,
(type.type == noHeadClass || type.type == normalClass) ? *(void **)data : data);
-
+
modifiedDocument = false;
}
}
{
if((SmartKey)key == enter)
parent.CycleChildren(true, false, false, true);
-
+
return DataBox::OnKeyHit(key, ch);
}
dropBox = TableDropBox
{
- dataBox, borderStyle = 0, anchor = { 0, 0, 0, 0 },
+ dataBox, borderStyle = 0, anchor = { 0, 0, 0, 0 },
modifyVirtualArea = false, activeStipple = false;
showNone = true;
nameField = class_data(nameField) ? *class_data(nameField) : null;
count = 0;
}
}
-
+
bool Includes(Id id)
{
if(this)
{
int c;
for(c = 0; c < count; c++)
- if(ids[c] == id)
+ if(ids[c] == id)
return true;
}
return false;
}
*/
-
+
char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
stringOutput[0] = 0;
int idA = ids[c], idB = b.ids[c];
if(idA > idB) return 1;
else if(idA < idB) return -1;
- }
+ }
}
return 0;
}
{
if(row.next)
listBox.DeleteRow(row);
- }
+ }
else
{
if(row == listBox.lastRow)
{
Id id = r.GetData(null);
if(id)
- Add(id);
+ Add(id);
}
return true;
}
return false;
}
-
+
~IdList()
{
delete ids;
public class StringList
{
StringBinaryTree strings
- {
+ {
CompareKey = (void *)BinaryTree::CompareString;
FreeKey = (void *)FreeString;
};
{
strings.Free();
}
-
+
bool Includes(String string)
{
return strings.FindString(string) != null;
{
channel.Get(strings);
}
-
+
void OnUnserialize(IOChannel channel)
{
this = eInstance_New(class(StringList));
result = strcmp((char *)nodeA.key, (char *)nodeB.key);
if(result) return result;
}
- }
+ }
return 0;
}
{
return (key == enter) ? false : ListBox::OnKeyHit(key, ch);
}
-
+
bool DataBox::NotifyChanged(ListBox listBox, DataRow row)
{
String string = row.GetData(null);
listBox.DeleteRow(row);
listBox.firstChild.Activate();
}
- }
+ }
else
{
if(row == listBox.lastRow)
listBox.DeleteRow(row);
listBox.firstChild.Activate();
}
- }
+ }
else
{
if(row == listBox.lastRow)
BTNode node;
DataRow r;
-
+
/*
{
if(!this)
ListBox list = (ListBox) window;
if(list.modifiedDocument)
{
-
+
DataRow r;
if(list.activeChild)
((DataBox)list.activeChild).SaveData();
}
return false;
}
-
+
~StringList()
{
strings.Free();
void DataBox::NotifyUpdate(EditBox editBox)
{
- Modified();
+ Modified();
modifiedDocument = true;
}
};
public class CIString : String
{
-
+
}
public class MultiLineString : String
if(!class_data(type))
class_data(type) = eSystem_FindClass(__thisModule.application, class_data(typeName));
type = class_data(type);
-
+
this = { };
while(true)
else
{
Class type = class_data(type);
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
(type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &nodeA.data : (void *)nodeA.data,
(type.type == systemClass || type.type == bitClass || type.type == enumClass || type.type == unitClass) ? &nodeB.data : (void *)nodeB.data);
if(result) return result;
}
- }
+ }
return 0;
}
{
return (key == enter) ? false : ListBox::OnKeyHit(key, ch);
}
-
+
bool DataBox::NotifyChanged(ListBox listBox, DataRow row)
{
Class type = ((subclass(DataList))this.type).dataType;
listBox.DeleteRow(row);
listBox.firstChild.Activate();
}*/
- }
+ }
else
{
if(row == listBox.lastRow)
listBox.DeleteRow(row);
listBox.firstChild.Activate();
}
- }
+ }
else
{
if(row == listBox.lastRow)
listBox.scroll.y = listBox.scrollArea.h;
listBox.alwaysEdit = true;
}
- }
+ }
return true;
}
Modified();
return true;
}
-
+
void OnDestroy()
{
Class type = firstField.dataType;
if(!class_data(type))
class_data(type) = eSystem_FindClass(__thisModule.application, class_data(typeName));
type = class_data(type);
-
+
list.AddField({ type, editable = true });
for(node = first; node; node = node.next)
{
}
void OnFree()
- {
+ {
Class type;
OldLink node;
}
if(!epjPath)
valid = false;
-
+
if(!valid)
{
printf($"Syntax:\n");
delete settingsContainer;
// TODO: Command line option to choose between the two
- // or a command line option to not use global settings
+ // or a command line option to not use global settings
//defaultCompiler = MakeDefaultCompiler();
defaultCompiler = ideSettings.GetCompilerConfig(compiler);
// possible TODO: use the workspace to select the active compiler
{
bool status = true;
int c = 0;
-
+
for(s : strings)
{
Column column;
#if 0
#define BUFSIZE 4096
TCHAR chNewEnv[BUFSIZE];
- LPTSTR lpszCurrentVariable;
+ LPTSTR lpszCurrentVariable;
DWORD dwFlags=0;
TCHAR szAppName[]=TEXT("ex3.exe");
STARTUPINFO si;
PROCESS_INFORMATION pi;
- BOOL fSuccess;
- // Copy environment strings into an environment block.
+ BOOL fSuccess;
+ // Copy environment strings into an environment block.
lpszCurrentVariable = (LPTSTR) chNewEnv;
if(FAILED(StringCchCopy(lpszCurrentVariable, BUFSIZE, TEXT("MySetting=A"))))
{
- printf("String copy failed\n");
+ printf("String copy failed\n");
return FALSE;
}
- lpszCurrentVariable += lstrlen(lpszCurrentVariable) + 1;
- if(FAILED(StringCchCopy(lpszCurrentVariable, BUFSIZE, TEXT("MyVersion=2"))))
+ lpszCurrentVariable += lstrlen(lpszCurrentVariable) + 1;
+ if(FAILED(StringCchCopy(lpszCurrentVariable, BUFSIZE, TEXT("MyVersion=2"))))
{
- printf("String copy failed\n");
+ printf("String copy failed\n");
return FALSE;
}
- // Terminate the block with a NULL byte.
- lpszCurrentVariable += lstrlen(lpszCurrentVariable) + 1;
- *lpszCurrentVariable = (TCHAR)0;
- // Create the child process, specifying a new environment block.
+ // Terminate the block with a NULL byte.
+ lpszCurrentVariable += lstrlen(lpszCurrentVariable) + 1;
+ *lpszCurrentVariable = (TCHAR)0;
+ // Create the child process, specifying a new environment block.
SecureZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
#ifdef UNICODE
#endif
fSuccess = CreateProcess(szAppName, NULL, NULL, NULL, TRUE, dwFlags,
(LPVOID) chNewEnv, // new environment block
- NULL, &si, &pi);
- if(!fSuccess)
+ NULL, &si, &pi);
+ if(!fSuccess)
{
printf("CreateProcess failed (%d)\n", GetLastError());
return FALSE;
env.AddCurrentEnvVars();
if(headerLine)
PrintLn(headerLine);
- env.Print();
+ env.Print();
env.Free();
delete env;
}
percentStyleRefId = new char[percentStyleRefIdLen+1];
sprintf(percentStyleRefId, "%%%s%%", varName);
percentStyleRef = strstr(varValue, percentStyleRefId);
-
+
// TODO: Make this a loop to replace multiple instances of both dollar and percent style references
if(dollarStyleRef)
{
}
else
this[varName] = CopyString(varValue);
-
+
delete dollarStyleRefId;
delete percentStyleRefId;
delete oldValue;
frame = StackFrame { };
stack.Add(frame);
frame.path = CopyString(startPath);
- frame.listing = FileListing { startPath, extensions = extensions }; // there should be a sorted = true/false
+ frame.listing = FileListing { startPath, extensions = extensions }; // there should be a sorted = true/false
}
if(iterateStartPath)
{
return false;
}
-
+
virtual bool OnFile(char * filePath)
{
return true;
{
void Temp()
{
- //listing = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false
+ //listing = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false
}
}
else
Free();
}
-
+
}
get { return regex; }
}
{
int c;
int result;
- result = regexec(&compiledRegex, string, maxMatchCount, matches, executeFlags);
+ result = regexec(&compiledRegex, string, maxMatchCount, matches, executeFlags);
if(result == 0) // != REG_NOMATCH
{
for(c = 0; c < maxMatchCount; c++)
}
}
if(c == maxMatchCount)
- matchCount = maxMatchCount;
+ matchCount = maxMatchCount;
return string + matches[0].rm_so;
}
else
{
return matches[matchPos].rm_so;
}
-
+
int GetMatchEndOffset(int matchPos)
{
return matches[matchPos].rm_eo;
valid = result == 0;
if(valid && !maxMatchCount)
property::maxMatchCount = 1;
-
+
// TODO: handle errors?
- // size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size);
- // REG_BADBR Invalid use of back reference operator.
- // REG_BADPAT Invalid use of pattern operators such as group or list.
- // REG_BADRPT Invalid use of repetition operators such as using '*' as the first character.
- // REG_EBRACE Un-matched brace interval operators.
- // REG_EBRACK Un-matched bracket list operators.
- // REG_ECOLLATE Invalid collating element.
- // REG_ECTYPE Unknown character class name.
- // REG_EEND Non specific error. This is not defined by POSIX.2.
- // REG_EESCAPE Trailing backslash.
- // REG_EPAREN Un-matched parenthesis group operators.
- // REG_ERANGE Invalid use of the range operator, eg. the ending point of the range occurs prior to the starting point.
- // REG_ESIZE Compiled regular expression requires a pattern buffer larger than 64Kb. This is not defined by POSIX.2.
- // REG_ESPACE The regex routines ran out of memory.
+ // size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size);
+ // REG_BADBR Invalid use of back reference operator.
+ // REG_BADPAT Invalid use of pattern operators such as group or list.
+ // REG_BADRPT Invalid use of repetition operators such as using '*' as the first character.
+ // REG_EBRACE Un-matched brace interval operators.
+ // REG_EBRACK Un-matched bracket list operators.
+ // REG_ECOLLATE Invalid collating element.
+ // REG_ECTYPE Unknown character class name.
+ // REG_EEND Non specific error. This is not defined by POSIX.2.
+ // REG_EESCAPE Trailing backslash.
+ // REG_EPAREN Un-matched parenthesis group operators.
+ // REG_ERANGE Invalid use of the range operator, eg. the ending point of the range occurs prior to the starting point.
+ // REG_ESIZE Compiled regular expression requires a pattern buffer larger than 64Kb. This is not defined by POSIX.2.
+ // REG_ESPACE The regex routines ran out of memory.
// REG_ESUBREG Invalid back reference to a subexpression.
}
}
void OnDisconnect(int code)
{
- replied = true;
+ replied = true;
}
void WaitReply()
{
socket.SendString("HELO localhost\r\n");
socket.WaitReply();
Logf("MAIL from: %s\n", from);
- socket.Sendf("MAIL from: %s\r\n", from);
+ socket.Sendf("MAIL from: %s\r\n", from);
socket.WaitReply();
Logf("RCPT To: %s\n", to);
- socket.Sendf("RCPT To: %s\r\n", to);
+ socket.Sendf("RCPT To: %s\r\n", to);
socket.WaitReply();
Log("DATA\n");
- socket.SendString("DATA\r\n");
+ socket.SendString("DATA\r\n");
socket.WaitReply();
Log("Subject: Email test\n");
Log("Mime-Version: 1.0;\n");
socket.SendString("Content-Type: text/html; charset=\"ISO-8859-1\";\r\n");
socket.SendString("Content-Transfer-Encoding: 7bit;\r\n");
socket.SendString("\r\n");
-
+
file.Seek(0, start);
while(!file.Eof())
{
uint read = file.Read(buffer, 1, sizeof(buffer));
socket.Send(buffer, read);
}
-
+
Log("\n.\n");
socket.SendString("\r\n.\r\n");
socket.WaitReply();
Send("mail.server.ca", "user@mail.com", "user@server.com", f);
delete f;
getch();
- }
+ }
}
*/
if(!quoted && wasQuoted)
break;
- if((ch == ' ' || ch == '\t') && !quoted)
+ if((ch == ' ' || ch == '\t') && !quoted)
{
if(!start) break;
}
}
else if(ch != '\r' && ch != '\n')
{
- if(c < maxSize)
+ if(c < maxSize)
keyWord[c++] = ch;
start = false;
}
int charLen = 0;
int oldDepth = xmlDepth;
tag[0] = 0;
-
+
closingTag = false;
-
+
// Preparse to check for completeness
for(stringPos = 0; stringPos < count; stringPos++)
{
byte ch = inputString[stringPos];
-
+
if(commented)
{
if((ch == '-' && tagLen < 2) || (ch == '>' && tagLen == 2))
for(stringPos = 0; stringPos < count; stringPos++)
{
byte ch = inputString[stringPos];
-
+
if(commented)
{
if((ch == '-' && tagLen < 2) || (ch == '>' && tagLen == 2))
if(ch == '<' || charLen == CHARBUFSIZE - 1)
{
ProcessCharacterData(characterData);
- charLen = 0;
+ charLen = 0;
}
if(ch == '<')
{
uint Main()
{
- while(!done)
+ while(!done)
{
if(paused)
{
double m = volume / (1 + Abs(balance * 2 - 1));
double ll = (2 - (2 * Max(balance, 0.5)))* m;
double lr = (-2 * Min(balance, 0.5) + 1) * m;
- double rl = (2 * Max(balance, 0.5) - 1) * m;
+ double rl = (2 * Max(balance, 0.5) - 1) * m;
double rr = (2 * Min(balance, 0.5)) * m;
// printf("Volume: %f, m : %f, Left: (%f, %f), Right: (%f, %f) \n", volume, m, ll, lr, rl, rr);
waveFormat.wFormatTag = WAVE_FORMAT_PCM;
waveFormat.nBlockAlign = (waveFormat.wBitsPerSample >> 3) * waveFormat.nChannels;
waveFormat.nAvgBytesPerSec = waveFormat.nBlockAlign * waveFormat.nSamplesPerSec;
-
+
waveOutOpen(&hWaveOut, WAVE_MAPPER, &waveFormat, 0, 0, CALLBACK_NULL);
mixerOpen((HMIXER *)&hmx, (uint)hWaveOut, 0, 0, MIXER_OBJECTF_HWAVEOUT);
}
{
streamingSound.volume = percent;
result = true;
- }
+ }
}
else
{
MIXERLINE uMixerLine;
-
+
// waveOutSetVolume((HWAVEOUT)0, (uint)(percent * 0xFFFF) | ((uint)(percent * 0xFFFF) << 16));
uMixerLine.cbStruct = sizeof(MIXERLINE);
{
MIXERLINECONTROLS uMixerLineControls;
MIXERCONTROL mixerControl;
-
+
uMixerLineControls.cbStruct = sizeof(MIXERLINECONTROLS);
uMixerLineControls.dwLineID = uMixerLine.dwLineID;
uMixerLineControls.dwControlID = MIXERCONTROL_CONTROLTYPE_VOLUME;
{
*percent = streamingSound.volume;
result = true;
- }
+ }
}
else
{
MIXERLINE uMixerLine;
-
+
uMixerLine.cbStruct = sizeof(MIXERLINE);
uMixerLine.dwComponentType = (type == pcm) ? MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT : MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
if(mixerGetLineInfo(hmx, &uMixerLine, MIXER_GETLINEINFOF_COMPONENTTYPE) == MMSYSERR_NOERROR)
{
MIXERLINECONTROLS uMixerLineControls;
MIXERCONTROL mixerControl;
-
+
uMixerLineControls.cbStruct = sizeof(MIXERLINECONTROLS);
uMixerLineControls.dwLineID = uMixerLine.dwLineID;
uMixerLineControls.dwControlID = MIXERCONTROL_CONTROLTYPE_VOLUME;
{
streamingSound.volume = wanted.volume;
dSoundThread.bDone = false;
-
+
//dSoundThread.Create();
return 1;
}
IDirectSoundBuffer_SetPan(apDSBuffer[0], pan);
}
}
-
+
property uint dwNumBuffers
{
set
}
}
}
-
+
~StreamingSound()
{
uint i;
{
if(apDSBuffer[i])
{
- IDirectSoundBuffer_Release( apDSBuffer[i] );
+ IDirectSoundBuffer_Release( apDSBuffer[i] );
apDSBuffer[i] = 0;
}
}
-
- delete( apDSBuffer );
+
+ delete( apDSBuffer );
}
-
+
int RestoreBuffer( IDirectSoundBuffer * pDSB, bool* pbWasRestored )
{
int hr;
uint dwStatus;
-
+
if( pDSB == null )
return CO_E_NOTINITIALIZED;
if( pbWasRestored )
*pbWasRestored = false;
-
+
if( FAILED( hr = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus) ) )
return 1; //DXUT_ERR( L"GetStatus", hr );
-
+
if( dwStatus & DSBSTATUS_BUFFERLOST )
{
// Since the app could have just been activated, then
- // DirectSound may not be giving us control yet, so
- // the restoring the buffer may fail.
+ // DirectSound may not be giving us control yet, so
+ // the restoring the buffer may fail.
// If it does, sleep until DirectSound gives us control.
- do
+ do
{
hr = IDirectSoundBuffer_Restore(pDSB);
if( hr == DSERR_BUFFERLOST )
Sleep( 10 );
}
while( ( hr = IDirectSoundBuffer_Restore(pDSB) ) == DSERR_BUFFERLOST );
-
+
if( pbWasRestored != null )
*pbWasRestored = true;
-
+
return S_OK;
}
else
{
uint i;
if(!apDSBuffer)
- return null;
-
+ return null;
+
for( i=0; i<dwNumBuffers; i++ )
{
if( apDSBuffer[i] )
- {
+ {
uint dwStatus = 0;
IDirectSoundBuffer_GetStatus(apDSBuffer[i], &dwStatus );
if ( ( dwStatus & DSBSTATUS_PLAYING ) == 0 )
break;
}
}
-
+
if( i != dwNumBuffers )
return apDSBuffer[ i ];
else
return apDSBuffer[ rand() % dwNumBuffers ];
}
-
+
IDirectSoundBuffer * GetBuffer( uint dwIndex )
{
if( apDSBuffer == null )
return null;
if( dwIndex >= dwNumBuffers )
return null;
-
+
return apDSBuffer[dwIndex];
}
-
+
int Play( uint dwPriority, uint dwFlags, uint lVolume, uint lFrequency, uint lPan )
{
int result;
int hr;
bool bRestored;
//IDirectSoundBuffer * pDSB;
-
+
// For Streaming Sound
dwFlags |= DSBPLAY_LOOPING;
if( apDSBuffer == null )
return CO_E_NOTINITIALIZED;
-
+
pDSB = GetFreeBuffer();
-
+
if( pDSB == null )
return 1; //DXUT_ERR( L"GetFreeBuffer", E_FAIL );
-
+
// Restore the buffer if it was lost
if( FAILED( hr = RestoreBuffer( pDSB, &bRestored ) ) )
return 1; //DXUT_ERR( L"RestoreBuffer", hr );
-
+
if( bRestored )
{
// The buffer was restored, so we need to fill it with new data
if( FAILED( hr = FillBufferWithSound( pDSB, false ) ) )
return 1; //DXUT_ERR( L"FillBufferWithSound", hr );
}
-
+
if( dwCreationFlags & DSBCAPS_CTRLVOLUME )
{
//IDirectSoundBuffer_SetVolume(pDSB, lVolume);
}
-
- if( lFrequency != -1 &&
+
+ if( lFrequency != -1 &&
(dwCreationFlags & DSBCAPS_CTRLFREQUENCY) )
{
IDirectSoundBuffer_SetFrequency(pDSB, lFrequency);
}
-
+
if( dwCreationFlags & DSBCAPS_CTRLPAN )
{
//IDirectSoundBuffer_SetPan(pDSB, lPan);
uint i;
if( apDSBuffer == null )
return CO_E_NOTINITIALIZED;
-
+
for( i=0; i<dwNumBuffers; i++ )
hr |= IDirectSoundBuffer_Stop(apDSBuffer[i]);
-
+
return hr;
}
uint playCursor, writeCursor;
bool bRestored;
uint start, size;
-
+
static uint cursor;
bool written = true;
int c;
while(written)
{
written = false;
-
+
// Figure out how much data has been played so far. When we have played
// past the end of the file, we will either need to start filling the
- // buffer with silence or starting reading from the beginning of the file,
+ // buffer with silence or starting reading from the beginning of the file,
// depending if the user wants to loop the sound
if(IDirectSoundBuffer_GetCurrentPosition(apDSBuffer[0], &dwCurrentPlayPos, null))
{
IDirectSoundBuffer_Unlock(apDSBuffer[0], pDSLockedBuffer, dwDSLockedBufferSize, null, 0 );
dwNextWriteOffset = 0;
}
-
+
if(start > 0)
{
start = 0;
}
return true;
}
-
+
int Reset()
{
int hr;
bool bRestored;
int result;
-
+
if(!apDSBuffer[0])
return 1;
-
+
dwLastPlayPos = 0;
dwPlayProgress = 0;
dwNextWriteOffset = 0;
bFillNextNotificationWithSilence = false;
-
+
// Restore the buffer if it was lost
if(RestoreBuffer( apDSBuffer[0], &bRestored ))
return 1;
-
+
if( bRestored )
{
// The buffer was restored, so we need to fill it with new data
if(FillBufferWithSound( apDSBuffer[0], false))
return 1;
}
-
+
result = IDirectSoundBuffer_SetCurrentPosition(apDSBuffer[0], 0L );
return result;
}
int FillBufferWithSound( IDirectSoundBuffer * pDSB, bool bRepeatWavIfBufferLarger )
{
- int hr;
+ int hr;
void* pDSLockedBuffer = null; // Pointer to locked buffer memory
uint dwDSLockedBufferSize = 0; // Size of the locked DirectSound buffer
- uint dwWavDataRead = 0; // Amount of data read from the wav file
-
+ uint dwWavDataRead = 0; // Amount of data read from the wav file
+
if( pDSB == null )
return CO_E_NOTINITIALIZED;
-
+
// Make sure we have focus, and we didn't just switch in from
// an app which had a DirectSound device
if(RestoreBuffer( pDSB, null ))
return 1;
-
+
// Lock the buffer down
if(IDirectSoundBuffer_Lock(pDSB, 0, dwDSBufferSize, &pDSLockedBuffer, &dwDSLockedBufferSize, null, null, 0L ))
return 1;
-
+
callback(data, pDSLockedBuffer, dwDSLockedBufferSize);
dwWavDataRead = dwDSLockedBufferSize;
-
+
printf("Filling 16 spots\n");
IDirectSoundBuffer_Unlock(pDSB, pDSLockedBuffer, dwDSLockedBufferSize, null, 0 );
static class CSoundManager
{
IDirectSound8* pDS;
-
+
~CSoundManager()
{
if(pDS)
- IDirectSound_Release( pDS );
+ IDirectSound_Release( pDS );
}
-
+
int Initialize( void * hWnd )
{
int hr;
-
+
if(pDS)
{
IDirectSound_Release( pDS );
pDS = null;
}
-
+
// Create IDirectSound using the primary sound device
if( FAILED( hr = DirectSoundCreate8( null, &pDS, null ) ) )
return 1; //DXUT_ERR( L"DirectSoundCreate8", hr );
-
- // Set DirectSound coop level
+
+ // Set DirectSound coop level
if( FAILED( hr = IDirectSound_SetCooperativeLevel(pDS, hWnd, DSSCL_PRIORITY ) ) )
- return 1; //DXUT_ERR( L"SetCooperativeLevel", hr );
-
+ return 1; //DXUT_ERR( L"SetCooperativeLevel", hr );
+
return S_OK;
}
-
-
+
+
int SetPrimaryBufferFormat( uint dwPrimaryChannels, uint dwPrimaryFreq, uint dwPrimaryBitRate )
{
int hr;
IDirectSoundBuffer * pDSBPrimary = null;
DSBUFFERDESC dsbd;
WAVEFORMATEX wfx;
-
+
if( pDS == null )
return CO_E_NOTINITIALIZED;
-
- // Get the primary buffer
+
+ // Get the primary buffer
ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );
dsbd.dwSize = sizeof(DSBUFFERDESC);
dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME;
dsbd.dwBufferBytes = 0;
dsbd.lpwfxFormat = null;
-
+
if( FAILED( hr = IDirectSound_CreateSoundBuffer(pDS, &dsbd, &pDSBPrimary, null ) ) )
return 1; // DXUT_ERR( L"CreateSoundBuffer", hr );
-
- ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
- wfx.wFormatTag = (WORD) WAVE_FORMAT_PCM;
- wfx.nChannels = (WORD) dwPrimaryChannels;
- wfx.nSamplesPerSec = (uint) dwPrimaryFreq;
- wfx.wBitsPerSample = (WORD) dwPrimaryBitRate;
+
+ ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
+ wfx.wFormatTag = (WORD) WAVE_FORMAT_PCM;
+ wfx.nChannels = (WORD) dwPrimaryChannels;
+ wfx.nSamplesPerSec = (uint) dwPrimaryFreq;
+ wfx.wBitsPerSample = (WORD) dwPrimaryBitRate;
wfx.nBlockAlign = (WORD) (wfx.wBitsPerSample / 8 * wfx.nChannels);
wfx.nAvgBytesPerSec = (uint) (wfx.nSamplesPerSec * wfx.nBlockAlign);
-
+
if( FAILED( hr = IDirectSoundBuffer_SetFormat(pDSBPrimary, &wfx) ) )
return 1; //DXUT_ERR( L"SetFormat", hr );
-
+
if(pDSBPrimary)
{
IDirectSoundBuffer_Release( pDSBPrimary );
pDSBPrimary = null;
- }
+ }
return S_OK;
}
-
+
bool InitStreaming(StreamingSound * ppStreamingSound, uint dwNotifyCount, uint dwNotifySize, void * hNotifyEvent,
void (*callback)(void * data, void * buffer, int len), void * data, int nChannels, int freq,int bits)
int hr;
IDirectSoundBuffer * pDSBuffer = null;
uint dwDSBufferSize = 0;
- DSBPOSITIONNOTIFY * aPosNotify = null;
+ DSBPOSITIONNOTIFY * aPosNotify = null;
IDirectSoundNotify * pDSNotify = null;
DSBUFFERDESC dsbd;
uint i;
-
+
if(!pDS)
return false;
if(!ppStreamingSound || !hNotifyEvent)
return false;
-
+
dwDSBufferSize = dwNotifySize * dwNotifyCount;
-
+
ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );
dsbd.dwSize= sizeof(DSBUFFERDESC);
dsbd.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME;
dsbd.lpwfxFormat->wBitsPerSample = (uint16)bits;
dsbd.lpwfxFormat->nBlockAlign = dsbd.lpwfxFormat->nChannels * dsbd.lpwfxFormat->wBitsPerSample / 8;
dsbd.lpwfxFormat->nAvgBytesPerSec = dsbd.lpwfxFormat->nSamplesPerSec * dsbd.lpwfxFormat->nBlockAlign;
-
+
if(IDirectSound_CreateSoundBuffer(pDS, &dsbd, &pDSBuffer, null))
{
delete dsbd.lpwfxFormat;
return false;
}
delete dsbd.lpwfxFormat;
-
+
if(IDirectSoundBuffer_QueryInterface(pDSBuffer, &IID_IDirectSoundNotify, (void**)&pDSNotify))
{
delete aPosNotify;
return false;
}
-
+
aPosNotify = new DSBPOSITIONNOTIFY[ dwNotifyCount ];
if( aPosNotify == null )
return false;
-
+
for( i = 0; i < dwNotifyCount; i++ )
{
aPosNotify[i].dwOffset = (dwNotifySize * i) + dwNotifySize - 1;
- aPosNotify[i].hEventNotify = hNotifyEvent;
+ aPosNotify[i].hEventNotify = hNotifyEvent;
}
-
+
if(IDirectSoundNotify_SetNotificationPositions(pDSNotify, dwNotifyCount, aPosNotify ))
{
if(pDSNotify)
delete( aPosNotify );
return false;
}
-
+
if(pDSNotify)
IDirectSoundNotify_Release(pDSNotify);
delete aPosNotify;
-
+
*ppStreamingSound = StreamingSound
{
- dwCreationFlags = DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME, dwNumBuffers = 1, dwNotifySize = dwNotifySize, dwDSBufferSize = dwDSBufferSize, apDSBuffer = &pDSBuffer,
-
+ dwCreationFlags = DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME, dwNumBuffers = 1, dwNotifySize = dwNotifySize, dwDSBufferSize = dwDSBufferSize, apDSBuffer = &pDSBuffer,
+
callback = callback, data = data
};
// ppStreamingSound->FillBufferWithSound( pDSBuffer, false );
{
bool filled = false;
SetPriority(timeCritical);
- while( !bDone )
- {
+ while( !bDone )
+ {
WaitForSingleObject(g_hNotificationEvent, INFINITE);
if(streamingSound)
{
} while(se >= frequency);
if(s < sound.length)
{
- sampleL = sBuffer[s];
+ sampleL = sBuffer[s];
sampleR = (chn == 2) ? sBuffer[s+1] : sampleL;
}
else
- break;
+ break;
}
}
v.pos = s;
} while(se >= frequency);
if(s < sound.length)
{
- sampleL = sBuffer[s];
+ sampleL = sBuffer[s];
sampleR = (chn == 2) ? sBuffer[s+1] : sampleL;
}
else
- break;
+ break;
}
}
v.pos = s;
windowHandle = systemHandle;
volume = 100;
};
-
+
if(!OpenAudio(wantedSpec, spec))
{
MessageBox { contents = "OpenAudio failed" }.Modal();
while(c < len)
{
buffer = ((int)base64inv[input[c]] << 18) | ((int)base64inv[input[c+1]] << 12) | ((int)base64inv[input[c+2]] << 6) | ((int)base64inv[input[c+3]]);
-
+
decoded[decLen++] = (byte)((buffer & 0xFF0000) >> 16);
if(len - c < 4)
{
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
****************************************************************************/
import "ecere"
f.Getc(&ch);
put=ch;
- if(!put)
+ if(!put)
put=256;
f.Read(palette+skip*3,1,3*put);
{
Surface surface;
- animation.PlayFrame(image);
-
+ animation.PlayFrame(image);
+
surface = temp.GetSurface(0,0,null);
/*
if(surface)
// temp.Allocate(null, w, h, 0, PixelFormatRGBA, false);
temp.Allocate(null, w, h, 0, PixelFormat888, false);
surface = temp.GetSurface(0,0,null);
- surface.Stretch(image, 0,0,0,0, temp.width, temp.height,
+ surface.Stretch(image, 0,0,0,0, temp.width, temp.height,
image.width, image.height);
delete surface;
}
//surface.Stretch(image, 0,0,0,0, clientSize.w, clientSize.h, image.width,image.height);
}
-
+
void OnDestroy()
{
image.Free();
bool OnKeyDown(Key key, unichar ch)
{
- if(key == escape)
- Destroy(0);
+ if(key == escape)
+ Destroy(0);
return true;
}
}
icons.Add(br);
}
}
-
+
void Unload()
{
icons.RemoveAll();
0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-static byte insideData[] =
+static byte insideData[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
{
byte b = picture[y * s + x];
byte ib = ipicture[y * s + x];
-
+
((byte *)bl.picture)[(h-1-y) * s + x] = b;
((byte *)br.picture)[(h-1-y) * s + (w-1-x)] = b;
((byte *)tr.picture)[y * s + (w-1-x)] = b;
((byte *)ibl.picture)[(h-1-y) * s + x] = ib;
((byte *)ibr.picture)[(h-1-y) * s + (w-1-x)] = ib;
((byte *)itr.picture)[y * s + (w-1-x)] = ib;
-
+
/*if(x) Print(", ");
printf("0x%02X", b);*/
}
for(x = 0; x < tl.width; x++)
{
byte ib = ipicture[y * s + x];
-
+
if(x) Print(", ");
printf("0x%02X", ib);
}
ihorz.Grab(itl, tl.width - horz.width, 0);
ieVert.Grab(ibr, tl.width - borderSize, 0);
ieHorz.Grab(ibr, 0, tl.height - borderSize);
-
+
tl.MakeDD(displaySystem);
bl.MakeDD(displaySystem);
tr.MakeDD(displaySystem);
surface.Tile(ivert, 0, tl.height, borderSize, size.h - 2*tl.height);
surface.Tile(ieHorz, br.width, size.h - ieHorz.height, size.w - 2*br.width, ieHorz.height);
surface.Tile(ieVert, size.w - ieVert.width, br.height, ieVert.width, size.h - 2*br.height);
-
+
surface.Blit(itl, 0,0,0,0, borderSize, tl.height);
surface.Blit(itl, 0,0,0,0, tl.width, borderSize);
surface.Tile(vert, 0, tl.height, borderSize, size.h - 2*tl.height);
surface.Tile(eHorz, br.width, size.h - ieHorz.height, size.w - 2*br.width, ieHorz.height);
surface.Tile(eVert, size.w - ieVert.width, br.height, ieVert.width, size.h - 2*br.height);
-
+
surface.Blit(tl, 0,0,0,0, borderSize, tl.height);
surface.Blit(tl, 0,0,0,0, tl.width, borderSize);
checkIndent = 20;
- fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true,
+ fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true,
noDragging = true;
// rowHeight = 18;
{
buttonMaps.RemoveAll();
}
-
+
bool NotifyCollapse(CheckListBox listBox, DataRow row, bool collapsed)
{
DataRow r;
{
listBox.SetupButtons(r, false);
}
- if(r.firstRow && !r.collapsed)
+ if(r.firstRow && !r.collapsed)
r = r.firstRow;
- else
+ else
for(; r != row; r = r.parent)
if(r.next) { r = r.next; break; }
}
}
return false;
}
-
+
void SetupButtons(DataRow row, bool recurse)
{
DataRow parent;
if(ListBox::OnCreate())
{
DataRow row;
-
+
buttonMaps.RemoveAll();
for(row = firstRow; row; row = row.next)
DataRow r;
for(r = row; r; r = r.parent)
if(rowChecks.Find(r))
- {
+ {
checked = true;
break;
- }
+ }
SetCheck(row, !checked);
}
}
}
NotifyChecked(master, this, row);
}
-
+
void UnsetChildren(DataRow row)
{
DataRow r;
it.Remove();
UnsetChildren(r);
NotifyChecked(master, this, r);
- }
+ }
}
-
+
void SetCheck(DataRow row, bool checked)
{
DataRow parent;
}
}
}
-
+
bool NotifyKeyDown(CheckListBox listBox, DataRow row, Key key, unichar ch)
{
if(key == space)
};
DataField nameField { dataType = class(char *), editable = true, width = 120 };
DataField stringField { dataType = class(char *), editable = true };
-
+
NamedStringsBox()
{
//DataRow row;
deepBottom = (((BorderBits)borderStyle).sizable && isNormal) ? bottom : border;
}
- surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
+ surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
size.w - deepBorder - deepBorder, size.h - deepBottom - deepTop);
}
surface.SetForeground(activeBorder);
surface.Rectangle(2, 2, size.w-3, size.h-3);
- // Resizeable frame is 1 pixel thicker
+ // Resizeable frame is 1 pixel thicker
if(((BorderBits)borderStyle).sizable && isNormal)
surface.Rectangle(3, 3, size.w - 4, size.h - 4);
}
surface.Gradient(gradient, sizeof(gradient) / sizeof(ColorKey), GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
else
- surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
+ surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
{
int buttonsSize = border +
((hasMaximize || hasMinimize) ? 52 : 18);
- surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
+ surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
size.w - (buttonsSize + border + 4), name, (int)strlen(name));
}
}
surface.SetForeground(Color { Min((int)c.r * 16/10, 255), Min((int)c.g * 16/10, 255), Min((int)c.b * 16/10,255) });
surface.HLine(0 + isDefault, clientSize.w-2 - isDefault, isDefault);
surface.VLine(1 + isDefault, clientSize.h-2 - isDefault, isDefault);
-
-
+
+
surface.SetForeground(skinMainColor);
surface.HLine(1 + isDefault, clientSize.w-2 - isDefault, clientSize.h-2 - isDefault);
surface.VLine(1 + isDefault, clientSize.h-3 - isDefault, clientSize.w-2 - isDefault);
-
+
if(bevel)
{
//surface.SetForeground(skinForeground);
x, y,
0,0,buttonBitmap.width,buttonBitmap.height);
}
- else
+ else
{
// Push Buttons
if(scaleBitmap)
{
if(bevel || offset)
- surface.Stretch(buttonBitmap,
+ surface.Stretch(buttonBitmap,
1 + offset, 1 + offset,0,0,
clientSize.w-3,clientSize.h-3,buttonBitmap.width,buttonBitmap.height);
else
surface.TextExtent(text, (int)strlen(text),&tw, &th);
if((isRadio || isCheckbox) && !bevelOver)
- WriteCaption(surface, /*clientSize.h +*/ CAPTION_DISTANCE + 3,
+ WriteCaption(surface, /*clientSize.h +*/ CAPTION_DISTANCE + 3,
(clientSize.h - th - 4)/2);
- else
+ else
{
int x, y = (clientSize.h - th - 1)/2 + offset;
-
+
if(ellipsis)
{
int width = clientSize.w - 2*6;
downBtn.background = Color { 70 * 6/10, 130* 6/10, 180* 6/10 }; //skinBackground;
downBtn.bitmap = { (direction == vertical) ? "<:ecere>elements/arrowDown.png" : "<:ecere>elements/arrowRight.png", monochrome = true };
thumb.background = Color { 70 * 6/10, 130* 6/10, 180* 6/10 }; //skinBackground;*/
- }
+ }
}
/*class SimSkin_DropBox : DropBox
background = skinBackground;
foreground = skinForeground;
selectionColor = skinMainColor;
- }
+ }
}*/
/*class SimSkin_ListBox : ListBox
background = skinBackground;
foreground = skinForeground;
selectionColor = skinMainColor;
- }
+ }
}*/
public class SimSkin : Skin
delete bitmap;
delete referer;
delete src;
- bitmapPtrs.Free(null);
+ bitmapPtrs.Free(null);
}
};
RequestLink request;
//((GuiApplication)__thisModule).Lock();
-
+
for(;!objectThreadTerminate;)
{
OldLink bitmapPtr;
if(!request) break;
entry = request.data;
-
+
strcpy(path, entry.src);
//strcpy(referer, browserWindow.location ? browserWindow.location : "");
strcpy(referer, entry.referer); //browserWindow.location ? browserWindow.location : "");
-
+
//((GuiApplication)__thisModule).Unlock();
if(path && strstr(path, "http://") == path)
objectThreadSemaphore.Wait();
}
}
- objectThreadDead = true;
+ objectThreadDead = true;
return 0;
}
}
for(c = 0; c<indent; c++)
f.Printf(" ");
-
+
switch(block.type)
{
case TEXT:
}
return true;
}
-
+
void OnUnloadGraphics()
{
ImageEntry entry;
Block block = html.body;
int textPos = 0;
int centered = 0;
-
+
Surface surface = display.GetSurface(0,0,null);
if(surface)
{
block.minW = 0;
block.rowSpan = block.span = 1;
}
-
+
for(b = block.subBlocks.first; b; b = b.next)
{
Clear(b);
- }
+ }
}
void ComputeSizes()
{
int centered = 0;
Surface surface = display.GetSurface(0,0,null);
- if(!initSize.w)
+ if(!initSize.w)
width = parent.clientSize.w;
- if(!initSize.h)
+ if(!initSize.h)
height = parent.clientSize.h;
if(surface)
SetScrollArea(totalWidth, totalHeight, false);
SetScrollArea(totalWidth, totalHeight, false);
}
-
+
if(!initSize.w || !initSize.h)
clientSize = Size {!initSize.w ? totalWidth : clientSize.w, !initSize.h ? totalHeight : clientSize.h };
}
objectsMutex.Wait();
for(request = objectRequests.first; request; request = (RequestLink)request.next)
{
- if(request.data == entry)
+ if(request.data == entry)
break;
}
if(!request)
surface.font = font;
PositionLine(this, surface, x - scroll.x, y - scroll.y,
- maxW, newH, block, textPos, nextBlock, nextTextPos,
+ maxW, newH, block, textPos, nextBlock, nextTextPos,
left - scroll.x, right - scroll.x);
if(changeLine)
while(!opened)
{
char path[MAX_LOCATION];
-
+
if(this.location)
delete this.location;
this.location = CopyString(relocation);
}
}
*/
-
+
}
((GuiApplication)__thisModule.application).Unlock();
// PrintLn("At position ", f.Tell(), " for ", fileName);
delete f;
}
}
- */
+ */
}
NotifyPageOpened(master);
}
objectThread3.objectThreadSemaphore.Release();
objectThread4.objectThreadSemaphore.Release();
-
- while(!objectThread1.objectThreadDead ||
+
+ while(!objectThread1.objectThreadDead ||
!objectThread2.objectThreadDead ||
!objectThread3.objectThreadDead ||
!objectThread4.objectThreadDead)
case tab:
CycleChildren(false, false, false, true);
return false;
- case left: case right:
+ case left: case right:
horzScroll.OnKeyHit(key, character);
break;
case down: case up: case pageDown: case pageUp:
vertScroll.OnKeyHit(key, character);
break;
- }
+ }
return true;
}
horzScroll.OnKeyDown(end, character);
break;
}
- }
+ }
return true;
}
surface.font = font;
- if(PickLine(this, surface, x - scroll.x, y - scroll.y,
- maxW, newH, block, textPos, nextBlock, nextTextPos,
+ if(PickLine(this, surface, x - scroll.x, y - scroll.y,
+ maxW, newH, block, textPos, nextBlock, nextTextPos,
left - scroll.x, right - scroll.x, pickX, pickY, pickBlock, pickTextPos))
{
result = true;
- break;
+ break;
}
if(changeLine)
Open(newLocation, null);
return true;
}
-
+
bool OnLeftButtonUp(int x, int y, Modifiers mods)
{
if(clickedLink)
int len;
char * text;
- if(location[strlen(location)-1] != '?')
+ if(location[strlen(location)-1] != '?')
{
strcat(location, "&");
}
if(!quoted && wasQuoted)
break;
- if((ch == ' ' || ch == '\t') && !quoted)
+ if((ch == ' ' || ch == '\t') && !quoted)
{
if(!start) break;
}
}
else if(ch != '\r' && ch != '\n')
{
- if(c < maxSize)
+ if(c < maxSize)
keyWord[c++] = ch;
start = false;
}
if(string[sc] != ' ' && string[sc] != '\"')
break;
}
-
+
for(wc = 0; what[wc]; wc++, sc++)
{
if((count && sc >= count) || (string[sc] != what[wc] && tolower(string[sc]) != tolower(what[wc])))
fontBlock.size = 12;
fontBlock.textColor = LT_BLUE|0xFF000000;
*/
-
+
fontBlock.textColor = black;
fontBlock.size = 10;
fontCache.Add(fontBlock.font);*/
background = white;
-
+
text = new char[32768*4];
block.font = fontBlock.font;
body = block;
-
+
// Parse entire file
while(!f.Eof() && block)
{
byte ch = 0;
-
+
f.Getc(&ch);
#ifdef _DEBUG
//fwrite(&ch, 1, 1, stdout);
else if(!strcmpi(keyWord, "text"))
{
GetKeyWord(&string, keyWord, sizeof(keyWord));
- fontBlock.textColor =
+ fontBlock.textColor =
block.textColor = 0xFF000000 | strtol((keyWord[0] == '#') ? (keyWord+1) : keyWord, null, 16);
}
}
else if(!strcmpi(keyWord, "p"))
{
}
- else if(!strcmpi(keyWord, "font") || !strcmpi(keyWord, "b") || !strcmpi(keyWord, "i")
- || !strcmpi(keyWord, "strong") || !strcmpi(keyWord, "em") ||
+ else if(!strcmpi(keyWord, "font") || !strcmpi(keyWord, "b") || !strcmpi(keyWord, "i")
+ || !strcmpi(keyWord, "strong") || !strcmpi(keyWord, "em") ||
!strcmpi(keyWord, "h1") || !strcmpi(keyWord, "h2") || !strcmpi(keyWord, "h3"))
{
if((!strcmpi(keyWord, "h1") || !strcmpi(keyWord, "h2") || !strcmpi(keyWord, "h3")))
else if(!strcmpi(keyWord, "color"))
{
GetKeyWord(&string, keyWord, sizeof(keyWord));
- subBlock.textColor =
+ subBlock.textColor =
0xFF000000 | strtol((keyWord[0] == '#') ? (keyWord+1) : keyWord, null, 16);
}
}
char utf8[5];
if(symbol[0] == '#' && symbol[1] == 'x')
unicode = strtol(symbol+2, null, 16);
- else if(!strcmpi(symbol, "nbsp"))
+ else if(!strcmpi(symbol, "nbsp"))
unicode = ' ';
- else if(!strcmpi(symbol, "copy"))
+ else if(!strcmpi(symbol, "copy"))
unicode ='©';
- else if(!strcmpi(symbol, "raquo"))
+ else if(!strcmpi(symbol, "raquo"))
unicode = '»';
else if(!strcmpi(symbol, "eacute"))
unicode = 'é';
subBlock.textLen = textLen;
textLen = 0;
text[0] = '\0';
- subBlock = AddBlock(block, BR);
+ subBlock = AddBlock(block, BR);
}
}
}
if(titleBlock && titleBlock.subBlocks.first && ((Block)titleBlock.subBlocks.first).type == TEXT)
{
Block t = titleBlock.subBlocks.first;
- return t.text;
+ return t.text;
}
return null;
}
return block;
}
-int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nextBlock, int * nextTextPos, int * centered, int * w,
+int ComputeLine(Surface surface, Block startBlock, int startTextPos, Block * nextBlock, int * nextTextPos, int * centered, int * w,
int maxW, int maxH, uint flags, int y, OldList leftObjects, OldList rightObjects, bool * changeLine, bool computeStartY, int sy, int sx)
{
int h = 0;
len = (nextSpace - (text + textPos)) + 1;
else
len = block.textLen - textPos;
-
+
surface.TextExtent(text + textPos, len, &w, &th);
if(x + width + w > maxW && x > 0)
ComputeTable(surface, block, textPos, &width, &height, maxW, maxH, flags, y + sy, x + sx);
surface.font = font;
x += width;
-
+
*nextBlock = NextBlockUp(surface, block, centered, flags);
*nextTextPos = 0;
h = Max(h, height);
{
surface.Bevel(false, dx, dy, bw, bh);
if(browser.missing.bitmap)
- surface.Blit(browser.missing.bitmap, dx + 5, dy + 5, 0,0,
+ surface.Blit(browser.missing.bitmap, dx + 5, dy + 5, 0,0,
browser.missing.bitmap.width, browser.missing.bitmap.height);
}
surface.SetForeground(fg);
}
}
-bool PickLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Block startBlock, int startTextPos,
+bool PickLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Block startBlock, int startTextPos,
Block endBlock, int endTextPos, int left, int right, int pickX, int pickY, Block* pickBlock, int * pickTextPos)
{
bool result = false;
return result;
}
-
-void PositionLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Block startBlock, int startTextPos,
+
+void PositionLine(HTMLView browser, Surface surface, int x, int y, int w, int h, Block startBlock, int startTextPos,
Block endBlock, int endTextPos, int left, int right)
{
int textPos = startTextPos;
{
Window parent = block.window.parent;
block.window.Move(
- x + parent.scroll.x, y + parent.scroll.y,
+ x + parent.scroll.x, y + parent.scroll.y,
block.window.size.w, block.window.size.h);
//block.window.visible = false;
x += block.window.size.w;
if(flags.lineW)
{
column.lineW = Max(column.lineW, cell.lineW);
- column.minW = Max(column.minW, cell.minW);
+ column.minW = Max(column.minW, cell.minW);
}
}
{
column.rowSpan = cell.rowSpan;
sumColW += column.w;
- column = column.next;
+ column = column.next;
}
rowLineW += Max(sumColW, cell.lineW);
}
if(w < table.w)
{
int needed = 0;
-
+
// Step 1: Weights how to distribute
for(column = table.columns.first; column; column = column.next)
{
while(columnStart && columnStart.rowSpan)
columnStart = columnStart.next;
-
+
for(c = 0, column = columnStart; c<cell.span && column; c++)
{
column.rowSpan = cell.rowSpan;
if(cell.span == 1)
totalW += column.w;
- column = column.next;
+ column = column.next;
}
if(cell.span == 1 && totalW < cell.lineW)
{
needed += cell.lineW - totalW;
}
- columnStart = column;
+ columnStart = column;
}
for(column = table.columns.first; column; column = column.next)
if(column.rowSpan) column.rowSpan--;
column.rowSpan = cell.rowSpan;
totalW += column.w;
sumDesires += column.desire;
- column = column.next;
+ column = column.next;
}
if(cell.span > 1 && totalW < cell.minW)
{
for(c = 0, column = columnStart; c<cell.span && column; c++)
{
totalW += column.minW;
- column = column.next;
+ column = column.next;
}
if(totalW < cell.minW)
}
}
}
- columnStart = column;
+ columnStart = column;
}
for(column = table.columns.first; column; column = column.next)
if(column.rowSpan) column.rowSpan--;
column.w = column.minW;
}
}
-
-
+
+
// Repeat Step 1: Weights how to distribute
needed = 0;
for(column = table.columns.first; column; column = column.next)
while(columnStart && columnStart.rowSpan)
columnStart = columnStart.next;
-
+
for(c = 0, column = columnStart; c<cell.span && column; c++)
{
column.rowSpan = cell.rowSpan;
if(/*cell.span == 1 && */cell.width)
totalW += column.w;
- column = column.next;
+ column = column.next;
}
if(/*cell.span == 1 && */totalW < cell.lineW && cell.width)
{
needed += cell.lineW - totalW;
}
- columnStart = column;
+ columnStart = column;
}
for(column = table.columns.first; column; column = column.next)
if(column.rowSpan) column.rowSpan--;
else
row = NextBlock(surface, row, null, 0);
}
-
+
// Step 2: Do the distribution
if(needed)
{
while(columnStart && columnStart.rowSpan)
columnStart = columnStart.next;
-
+
for(c = 0, column = columnStart; c<cell.span && column; c++)
{
column.rowSpan = cell.rowSpan;
if(/*cell.span == 1 && */!cell.width)
totalW += column.w;
- column = column.next;
+ column = column.next;
}
if(/*cell.span == 1 && */totalW < cell.lineW && !cell.width)
{
needed += cell.lineW - totalW;
}
- columnStart = column;
+ columnStart = column;
}
for(column = table.columns.first; column; column = column.next)
if(column.rowSpan) column.rowSpan--;
else
row = NextBlock(surface, row, null, 0);
}
-
+
// Step 2: Do the distribution
if(needed)
{
for(column = table.columns.first; column; column = column.next)
w += column.w;
}
-
+
// Repartition the rest of the space in the columns
if(w < table.w)
{
rightObjects.Delete(object);
}
cellW = Max(cellW, 0);
-
+
// TRIED ADDING THIS CODE HERE...
{
int x;
cell.parent = null;
cell.next = null;
-
+
/*
if(cell.width)
cellW = cell.width;
{
column.rowSpan = cell.rowSpan;
x += column.w;
- column = column.next;
+ column = column.next;
}
}
c++;
row = NextBlockUp(surface, row, null, 0);
}
else
- row = NextBlock(surface, row, null, 0);
+ row = NextBlock(surface, row, null, 0);
}
}
font = surface.font;
newLineH = ComputeLine(surface, block, textPos, &nextCellBlock, &nextCellPos, ¢ered, &lineW, maxW, maxH, RenderFlags {}, y, &leftObjects, &rightObjects, &changeLine, false, 0, 0);
- surface.font = font;
+ surface.font = font;
//surface.TextFont(font);
{
column.rowSpan = cell.rowSpan;
x += column.w;
- column = column.next;
+ column = column.next;
}
}
c++;
row = NextBlockUp(surface, row, null, 0);
}
else
- row = NextBlock(surface, row, null, 0);
+ row = NextBlock(surface, row, null, 0);
}
return result;
}
{
column.rowSpan = cell.rowSpan;
x += column.w;
- column = column.next;
+ column = column.next;
}
}
c++;
for(c = 0; c<16; c++)
{
sprintf(output + len, "%02x", bytes[c]);
- len += 2;
+ len += 2;
}
}
/*
Copyright (c) 2009 Gabriel A. Petursson
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
{
uint32 h[8];
byte buffer[64];
-
+
uint64 length;
void Init()
{
uint32 wv[8];
uint32 w[16];
-
+
PACK_32(&data[(i << 6) ], &w[ 0]);
PACK_32(&data[(i << 6) + 4], &w[ 1]);
PACK_32(&data[(i << 6) + 8], &w[ 2]);
PACK_32(&data[(i << 6) + 52], &w[13]);
PACK_32(&data[(i << 6) + 56], &w[14]);
PACK_32(&data[(i << 6) + 60], &w[15]);
-
+
wv[0] = h[0];
wv[1] = h[1];
wv[2] = h[2];
wv[5] = h[5];
wv[6] = h[6];
wv[7] = h[7];
-
+
SHA256_PRC(0, 1, 2, 3, 4, 5, 6, 7, w[ 0], 0x428a2f98);
SHA256_PRC(7, 0, 1, 2, 3, 4, 5, 6, w[ 1], 0x71374491);
SHA256_PRC(6, 7, 0, 1, 2, 3, 4, 5, w[ 2], 0xb5c0fbcf);
SHA256_PRC(3, 4, 5, 6, 7, 0, 1, 2, w[13], 0x80deb1fe);
SHA256_PRC(2, 3, 4, 5, 6, 7, 0, 1, w[14], 0x9bdc06a7);
SHA256_PRC(1, 2, 3, 4, 5, 6, 7, 0, w[15], 0xc19bf174);
-
+
SHA256_PRC(0, 1, 2, 3, 4, 5, 6, 7, SHA256_EXT( 0), 0xe49b69c1);
SHA256_PRC(7, 0, 1, 2, 3, 4, 5, 6, SHA256_EXT( 1), 0xefbe4786);
SHA256_PRC(6, 7, 0, 1, 2, 3, 4, 5, SHA256_EXT( 2), 0x0fc19dc6);
SHA256_PRC(3, 4, 5, 6, 7, 0, 1, 2, SHA256_EXT(13), 0xa4506ceb);
SHA256_PRC(2, 3, 4, 5, 6, 7, 0, 1, SHA256_EXT(14), 0xbef9a3f7);
SHA256_PRC(1, 2, 3, 4, 5, 6, 7, 0, SHA256_EXT(15), 0xc67178f2);
-
+
h[0] += wv[0];
h[1] += wv[1];
h[2] += wv[2];
if (size >= 64 - length % 64)
{
memcpy(&buffer[length % 64], data, (uint32)(64 - length % 64));
-
+
TransformData(buffer, 1);
//TransformData(&data[64 - length % 64], size / 64);
TransformData(&data[64 - length % 64], (size - (64 - length % 64)) / 64);
{
memcpy(&buffer[length % 64], data, size);
}
-
+
length += size;
}
void Finish(byte *digest)
{
AmpheckSHA256 tmp { };
-
+
tmp.h[0] = h[0];
tmp.h[1] = h[1];
tmp.h[2] = h[2];
tmp.h[5] = h[5];
tmp.h[6] = h[6];
tmp.h[7] = h[7];
-
+
memcpy(tmp.buffer, buffer, (uint32)(length % 64));
tmp.buffer[length % 64] = 0x80;
-
+
if (length % 64 < 56)
{
memset(&tmp.buffer[length % 64 + 1], 0x00, (uint32)(55 - length % 64));
{
memset(&tmp.buffer[length % 64 + 1], 0x00, (uint32)(63 - length % 64));
tmp.TransformData(tmp.buffer, 1);
-
+
memset(tmp.buffer, 0x00, 56);
}
-
+
UNPACK_64(length % 64 * 8, &tmp.buffer[56]);
tmp.TransformData(tmp.buffer, 1);
-
+
UNPACK_32(tmp.h[0], &digest[ 0]);
UNPACK_32(tmp.h[1], &digest[ 4]);
UNPACK_32(tmp.h[2], &digest[ 8]);
Copyright (c) 1997-2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
astar.ec - A* Path Finding Algorithm
****************************************************************************/
import "ecere"
if(aStar->stackIndex>=aStar->stackSize)
break;
aStar->stack[aStar->stackIndex++] = child;
- }
+ }
}
while(aStar->stackIndex > 0)
old->parent=bestNode;
old->g=g;
old->f=g+old->h;
- AStarPropagateDown(aStar, old);
+ AStarPropagateDown(aStar, old);
}
}
else
successor->position.x=positionX;
successor->position.y=positionY;
successor->nodeNum=tileNumS;
- AStarInsert(aStar, successor);
+ AStarInsert(aStar, successor);
for(c=0;c<8;c++)
if(!bestNode->child[c]) break;
bestNode->child[c]=successor;
Copyright (c) 1997-2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
sequence.c - Sprite Sequence System
****************************************************************************/
import "ecere"
bool SequenceLoadTable(Sequence **sequences, int count, char *fileName)
{
bool result = false;
- File f = FileOpen(fileName, read);
+ File f = FileOpen(fileName, read);
FillBytes(sequences, 0, sizeof(Sequence *) * count);
- if(f)
+ if(f)
{
int c;
result = true;
Copyright (c) 1997-2005 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
sprite.ec - Bitmap Sprite System
****************************************************************************/
import "ecere"
dx = x+frame->xDis;
dy = y+frame->yDis;
}
-
+
if(inPal)
frame->bitmap.paletteShades = inPal;
Copyright (c) 1997-2005 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
tiles.ec - Main Module
****************************************************************************/
import "astar.ec"
uint16 * regions;
uint16 * contents;
uint16 * frames;
-
+
// Dimension Stuff
int numLayers;
Point maxDim;
// What's this for??
Direction direction;
- uint16 displaced;
+ uint16 displaced;
byte retries;
Point path[256];
bool chase;
int pathPos;
Direction direction;
- uint16 displaced;
+ uint16 displaced;
byte retries;
Point path[MAXPATH];
bool chase;
Point UnitExact(TileMap * map, TileUnit * unit)
{
Point exact;
-
+
exact.x = unit->pos.x*map->tileW*map->maxDim.x/map->dim[unit->space].x;
exact.y = unit->pos.y*map->tileH*map->maxDim.y/map->dim[unit->space].y;
MapForward(unit->direction,&exact,unit->displaced);
if(!target||(target==unit))
return false;
-
+
unit->chase=1;
unit->target=target;
UnitRemove(map, unit);
surface.SetForeground(white);
exact = Point{exact.x-viewX*map->tileW, exact.y-viewY*map->tileH};
-
+
if(!unit->space)
{
unit->sprite.DisplayFrame(surface,unit->seqPos,exact.x,exact.y,true,unit->filter);
{
frame += unit->direction;
unit->sprite.DisplayFrame(surface,frame,exact.x,exact.y,false,unit->filter);
- }
+ }
}
}
}
unit->event = Moving;
- if(unit->tick<seq->frames[unit->event][unit->seqPos].wait)
+ if(unit->tick<seq->frames[unit->event][unit->seqPos].wait)
return;
unit->displaced+=seq->frames[unit->event][unit->seqPos].walk;
static String countryNames[CountryCode] =
{
"(none)",
- "Andorra", // 1974
- "United Arab Emirates", // 1974
- "Afghanistan", // 1974
- "Antigua and Barbuda", // 1974
+ "Andorra", // 1974
+ "United Arab Emirates", // 1974
+ "Afghanistan", // 1974
+ "Antigua and Barbuda", // 1974
"Anguilla", // 1983 AI previously represented French Afar and Issas
- "Albania", // 1974
- "Armenia", // 1992
- "Netherlands Antilles", // 1974
- "Angola", // 1974
+ "Albania", // 1974
+ "Armenia", // 1992
+ "Netherlands Antilles", // 1974
+ "Angola", // 1974
"Antarctica", // 1974 Covers the territories south of 60° south latitude
- "Argentina", // 1974
- "American Samoa", // 1974
- "Austria", // 1974
+ "Argentina", // 1974
+ "American Samoa", // 1974
+ "Austria", // 1974
"Australia", // 1974 Includes the Ashmore and Cartier Islands and the Coral Sea Islands
- "Aruba", // 1986
- "Åland Islands", // 2004
- "Azerbaijan", // 1992
- "Bosnia and Herzegovina", // 1992
- "Barbados", // 1974
- "Bangladesh", // 1974
- "Belgium", // 1974
+ "Aruba", // 1986
+ "Åland Islands", // 2004
+ "Azerbaijan", // 1992
+ "Bosnia and Herzegovina", // 1992
+ "Barbados", // 1974
+ "Bangladesh", // 1974
+ "Belgium", // 1974
"Burkina Faso", // 1984 Name changed from Upper Volta (HV)
- "Bulgaria", // 1974
- "Bahrain", // 1974
- "Burundi", // 1974
+ "Bulgaria", // 1974
+ "Bahrain", // 1974
+ "Burundi", // 1974
"Benin", // 1977 Name changed from Dahomey (DY)
- "Saint Barthélemy", // 2007
- "Bermuda", // 1974
- "Brunei Darussalam", // 1974
+ "Saint Barthélemy", // 2007
+ "Bermuda", // 1974
+ "Brunei Darussalam", // 1974
"Bolivia, Plurinational State of", // 1974 Previous country name used by ISO: Bolivia
- "Brazil", // 1974
- "Bahamas", // 1974
- "Bhutan", // 1974
- "Bouvet Island", // 1974
- "Botswana", // 1974
+ "Brazil", // 1974
+ "Bahamas", // 1974
+ "Bhutan", // 1974
+ "Bouvet Island", // 1974
+ "Botswana", // 1974
"Belarus", // 1974 Code taken from previous country name used by ISO: Byelorussian SSR
- "Belize", // 1974
- "Canada", // 1974
- "Cocos (Keeling) Islands", // 1974
+ "Belize", // 1974
+ "Canada", // 1974
+ "Cocos (Keeling) Islands", // 1974
"Congo, the Democratic Republic of the", // 1997 Name changed from Zaire (ZR)
- "Central African Republic", // 1974
+ "Central African Republic", // 1974
"Congo", // 1974 i.e., Congo, the Republic of the
"Switzerland", // 1974 Code taken from name in Latin: Confoederatio Helvetica
"Côte d'Ivoire", // 1974 i.e., Ivory Coast
- "Cook Islands", // 1974
- "Chile", // 1974
- "Cameroon", // 1974
- "China", // 1974
- "Colombia", // 1974
- "Costa Rica", // 1974
- "Cuba", // 1974
- "Cape Verde", // 1974
- "Christmas Island", // 1974
- "Cyprus", // 1974
- "Czech Republic", // 1993
+ "Cook Islands", // 1974
+ "Chile", // 1974
+ "Cameroon", // 1974
+ "China", // 1974
+ "Colombia", // 1974
+ "Costa Rica", // 1974
+ "Cuba", // 1974
+ "Cape Verde", // 1974
+ "Christmas Island", // 1974
+ "Cyprus", // 1974
+ "Czech Republic", // 1993
"Germany", // 1974 Code taken from name in German: Deutschland, Code used for West Germany before , // 1990 (previous country name used by ISO: Germany, Federal Republic of)
"Djibouti", // 1977 Name changed from French Afar and Issas (AI)
- "Denmark", // 1974
- "Dominica", // 1974
- "Dominican Republic", // 1974
+ "Denmark", // 1974
+ "Dominica", // 1974
+ "Dominican Republic", // 1974
"Algeria", // 1974 Code taken from name in Kabyle: Dzayer
- "Ecuador", // 1974
+ "Ecuador", // 1974
"Estonia", // 1992 Code taken from name in Estonian: Eesti
- "Egypt", // 1974
+ "Egypt", // 1974
"Western Sahara", // 1974 Disputed territory Previous country name used by ISO: Spanish Sahara (code taken from name in Spanish: Sahara español)
- "Eritrea", // 1993
+ "Eritrea", // 1993
"Spain", // 1974 Code taken from name in Spanish: España
- "Ethiopia", // 1974
- "Finland", // 1974
- "Fiji", // 1974
- "Falkland Islands (Malvinas)", // 1974
+ "Ethiopia", // 1974
+ "Finland", // 1974
+ "Fiji", // 1974
+ "Falkland Islands (Malvinas)", // 1974
"Micronesia, Federated States of", // 1986 Previous country name used by ISO: Micronesia
- "Faroe Islands", // 1974
+ "Faroe Islands", // 1974
"France", // 1974 Includes Clipperton Island
- "Gabon", // 1974
+ "Gabon", // 1974
"United Kingdom", // 1974 Code taken from official name: United Kingdom of Great Britain and Northern Ireland
- "Grenada", // 1974
+ "Grenada", // 1974
"Georgia", // 1992 GE previously represented Gilbert and Ellice Islands
"French Guiana", // 1974 Code taken from name in French: Guyane française
- "Guernsey", // 2006
- "Ghana", // 1974
- "Gibraltar", // 1974
- "Greenland", // 1974
- "Gambia", // 1974
- "Guinea", // 1974
- "Guadeloupe", // 1974
+ "Guernsey", // 2006
+ "Ghana", // 1974
+ "Gibraltar", // 1974
+ "Greenland", // 1974
+ "Gambia", // 1974
+ "Guinea", // 1974
+ "Guadeloupe", // 1974
"Equatorial Guinea", // 1974 Code taken from name in French: Guinée équatoriale
- "Greece", // 1974
- "South Georgia and the South Sandwich Islands", // 1993
- "Guatemala", // 1974
- "Guam", // 1974
- "Guinea-Bissau", // 1974
- "Guyana", // 1974
- "Hong Kong", // 1974
- "Heard Island and McDonald Islands", // 1974
- "Honduras", // 1974
+ "Greece", // 1974
+ "South Georgia and the South Sandwich Islands", // 1993
+ "Guatemala", // 1974
+ "Guam", // 1974
+ "Guinea-Bissau", // 1974
+ "Guyana", // 1974
+ "Hong Kong", // 1974
+ "Heard Island and McDonald Islands", // 1974
+ "Honduras", // 1974
"Croatia", // 1992 Code taken from name in Croatian: Hrvatska
- "Haiti", // 1974
- "Hungary", // 1974
- "Indonesia", // 1974
- "Ireland", // 1974
- "Israel", // 1974
- "Isle of Man", // 2006
- "India", // 1974
- "British Indian Ocean Territory", // 1974
- "Iraq", // 1974
- "Iran, Islamic Republic of", // 1974
+ "Haiti", // 1974
+ "Hungary", // 1974
+ "Indonesia", // 1974
+ "Ireland", // 1974
+ "Israel", // 1974
+ "Isle of Man", // 2006
+ "India", // 1974
+ "British Indian Ocean Territory", // 1974
+ "Iraq", // 1974
+ "Iran, Islamic Republic of", // 1974
"Iceland", // 1974 Code taken from name in Icelandic: Ísland
- "Italy", // 1974
- "Jersey", // 2006
- "Jamaica", // 1974
- "Jordan", // 1974
- "Japan", // 1974
- "Kenya", // 1974
- "Kyrgyzstan", // 1992
+ "Italy", // 1974
+ "Jersey", // 2006
+ "Jamaica", // 1974
+ "Jordan", // 1974
+ "Japan", // 1974
+ "Kenya", // 1974
+ "Kyrgyzstan", // 1992
"Cambodia", // 1974 Code taken from former name: Khmer Republic, Previous country name used by ISO: Kampuchea
- "Kiribati", // 1979
+ "Kiribati", // 1979
"Comoros", // 1974 Code taken from name in Comorian: Komori
"Saint Kitts and Nevis", // 1974 Previous country name used by ISO: Saint Kitts-Nevis-Anguilla
"Korea, Democratic People's Republic of", // 1974 i.e., North Korea
"Korea, Republic of", // 1974 i.e., South Korea
- "Kuwait", // 1974
- "Cayman Islands", // 1974
+ "Kuwait", // 1974
+ "Cayman Islands", // 1974
"Kazakhstan", // 1992 Previous country name used by ISO: Kazakstan
- "Lao People's Democratic Republic", // 1974
- "Lebanon", // 1974
- "Saint Lucia", // 1974
- "Liechtenstein", // 1974
- "Sri Lanka", // 1974
- "Liberia", // 1974
- "Lesotho", // 1974
- "Lithuania", // 1992
- "Luxembourg", // 1974
- "Latvia", // 1992
- "Libyan Arab Jamahiriya", // 1974
+ "Lao People's Democratic Republic", // 1974
+ "Lebanon", // 1974
+ "Saint Lucia", // 1974
+ "Liechtenstein", // 1974
+ "Sri Lanka", // 1974
+ "Liberia", // 1974
+ "Lesotho", // 1974
+ "Lithuania", // 1992
+ "Luxembourg", // 1974
+ "Latvia", // 1992
+ "Libyan Arab Jamahiriya", // 1974
"Morocco", // 1974 Code taken from name in French: Maroc
- "Monaco", // 1974
+ "Monaco", // 1974
"Moldova, Republic of", // 1992 Previous country name used by ISO: Moldova
- "Montenegro", // 2006
- "Saint Martin (French part)", //2007
- "Madagascar", // 1974
- "Marshall Islands", // 1986
+ "Montenegro", // 2006
+ "Saint Martin (French part)", //2007
+ "Madagascar", // 1974
+ "Marshall Islands", // 1986
"Macedonia, the former Yugoslav Republic of", // 1993 Designated as such due to the Macedonia naming dispute, Code taken from name in Macedonian: Makedonija
- "Mali", // 1974
+ "Mali", // 1974
"Myanmar", // 1989 Name changed from Burma (BU)
- "Mongolia", // 1974
+ "Mongolia", // 1974
"Macao", // 1974 Previous country name used by ISO: Macau
- "Northern Mariana Islands", // 1986
- "Martinique", // 1974
- "Mauritania", // 1974
- "Montserrat", // 1974
- "Malta", // 1974
- "Mauritius", // 1974
- "Maldives", // 1974
- "Malawi", // 1974
- "Mexico", // 1974
- "Malaysia", // 1974
- "Mozambique", // 1974
- "Namibia", // 1974
- "New Caledonia", // 1974
- "Niger", // 1974
- "Norfolk Island", // 1974
- "Nigeria", // 1974
- "Nicaragua", // 1974
- "Netherlands", // 1974
- "Norway", // 1974
- "Nepal", // 1974
- "Nauru", // 1974
- "Niue", // 1974
- "New Zealand", // 1974
- "Oman", // 1974
- "Panama", // 1974
- "Peru", // 1974
+ "Northern Mariana Islands", // 1986
+ "Martinique", // 1974
+ "Mauritania", // 1974
+ "Montserrat", // 1974
+ "Malta", // 1974
+ "Mauritius", // 1974
+ "Maldives", // 1974
+ "Malawi", // 1974
+ "Mexico", // 1974
+ "Malaysia", // 1974
+ "Mozambique", // 1974
+ "Namibia", // 1974
+ "New Caledonia", // 1974
+ "Niger", // 1974
+ "Norfolk Island", // 1974
+ "Nigeria", // 1974
+ "Nicaragua", // 1974
+ "Netherlands", // 1974
+ "Norway", // 1974
+ "Nepal", // 1974
+ "Nauru", // 1974
+ "Niue", // 1974
+ "New Zealand", // 1974
+ "Oman", // 1974
+ "Panama", // 1974
+ "Peru", // 1974
"French Polynesia", // 1974 Code taken from name in French: Polynésie française
- "Papua New Guinea", // 1974
- "Philippines", // 1974
- "Pakistan", // 1974
- "Poland", // 1974
- "Saint Pierre and Miquelon", // 1974
- "Pitcairn", // 1974
- "Puerto Rico", // 1974
+ "Papua New Guinea", // 1974
+ "Philippines", // 1974
+ "Pakistan", // 1974
+ "Poland", // 1974
+ "Saint Pierre and Miquelon", // 1974
+ "Pitcairn", // 1974
+ "Puerto Rico", // 1974
"Palestinian Territory, Occupied", // 1999 Consists of the West Bank and the Gaza Strip
- "Portugal", // 1974
- "Palau", // 1986
- "Paraguay", // 1974
- "Qatar", // 1974
- "Réunion", // 1974
- "Romania", // 1974
+ "Portugal", // 1974
+ "Palau", // 1986
+ "Paraguay", // 1974
+ "Qatar", // 1974
+ "Réunion", // 1974
+ "Romania", // 1974
"Serbia", // 2006 Code taken from official name: Republic of Serbia (see Serbian country codes)
- "Russian Federation", // 1992
- "Rwanda", // 1974
- "Saudi Arabia", // 1974
+ "Russian Federation", // 1992
+ "Rwanda", // 1974
+ "Saudi Arabia", // 1974
"Solomon Islands", // 1974 Code taken from former name: British Solomon Islands
- "Seychelles", // 1974
- "Sudan", // 1974
- "Sweden", // 1974
- "Singapore", // 1974
+ "Seychelles", // 1974
+ "Sudan", // 1974
+ "Sweden", // 1974
+ "Singapore", // 1974
"Saint Helena, Ascension and Tristan da Cunha", // 1974 Previous country name used by ISO: Saint Helena
- "Slovenia", // 1992
+ "Slovenia", // 1992
"Svalbard and Jan Mayen", // 1974 Consists of Svalbard and Jan Mayen
"Slovakia", // 1993 SK previously represented Sikkim
- "Sierra Leone", // 1974
- "San Marino", // 1974
- "Senegal", // 1974
- "Somalia", // 1974
- "Suriname", // 1974
- "Sao Tome and Principe", // 1974
- "El Salvador", // 1974
- "Syrian Arab Republic", // 1974
- "Swaziland", // 1974
- "Turks and Caicos Islands", // 1974
+ "Sierra Leone", // 1974
+ "San Marino", // 1974
+ "Senegal", // 1974
+ "Somalia", // 1974
+ "Suriname", // 1974
+ "Sao Tome and Principe", // 1974
+ "El Salvador", // 1974
+ "Syrian Arab Republic", // 1974
+ "Swaziland", // 1974
+ "Turks and Caicos Islands", // 1974
"Chad", // 1974 Code taken from name in French: Tchad
"French Southern Territories", // 1979 Covers the territory of the French Southern and Antarctic Lands except Adélie Land, Code taken from name in French: Terres australes françaises
- "Togo", // 1974
- "Thailand", // 1974
- "Tajikistan", // 1992
- "Tokelau", // 1974
+ "Togo", // 1974
+ "Thailand", // 1974
+ "Tajikistan", // 1992
+ "Tokelau", // 1974
"Timor-Leste", // 2002 Name changed from East Timor (TP)
- "Turkmenistan", // 1992
- "Tunisia", // 1974
- "Tonga", // 1974
- "Turkey", // 1974
- "Trinidad and Tobago", // 1974
- "Tuvalu", // 1979
+ "Turkmenistan", // 1992
+ "Tunisia", // 1974
+ "Tonga", // 1974
+ "Turkey", // 1974
+ "Trinidad and Tobago", // 1974
+ "Tuvalu", // 1979
"Taiwan, Province of China", // 1974 Covers the current jurisdiction of the Republic of China except Kinmen and Lienchiang, Designated as such due to its political status within the United Nations
- "Tanzania, United Republic of", // 1974
+ "Tanzania, United Republic of", // 1974
"Ukraine", // 1974 Previous country name used by ISO: Ukrainian SSR
- "Uganda", // 1974
+ "Uganda", // 1974
// "United Kingdom",
"United States Minor Outlying Islands", // 1986 Consists of Baker Island, Howland Island, Jarvis Island, Johnston Atoll, Kingman Reef, Midway Islands, Navassa Island, Palmyra Atoll, and Wake Island
- "United States", // 1974
- "Uruguay", // 1974
- "Uzbekistan", // 1992
+ "United States", // 1974
+ "Uruguay", // 1974
+ "Uzbekistan", // 1992
"Holy See (Vatican City State)", // 1974 Territory of the Holy See Previous country name used by ISO: Vatican City State (Holy See)
- "Saint Vincent and the Grenadines", // 1974
+ "Saint Vincent and the Grenadines", // 1974
"Venezuela, Bolivarian Republic of", // 1974 Previous country name used by ISO: Venezuela
- "Virgin Islands, British", // 1974
- "Virgin Islands, U.S.", // 1974
- "Viet Nam", // 1974
+ "Virgin Islands, British", // 1974
+ "Virgin Islands, U.S.", // 1974
+ "Viet Nam", // 1974
"Vanuatu", // 1980 Name changed from New Hebrides (NH)
- "Wallis and Futuna", // 1974
+ "Wallis and Futuna", // 1974
"Samoa", // 1974 Code taken from former name: Western Samoa
"Yemen", // 1974 Previous country name used by ISO: Yemen, Republic of, Code used for North Yemen before 1990
- "Mayotte", // 1993
+ "Mayotte", // 1993
"South Africa", // 1974 Code taken from name in Dutch: Zuid-Afrika
- "Zambia", // 1974
+ "Zambia", // 1974
"Zimbabwe" // 1980 Name changed from Southern Rhodesia (RH)
};
sprintf(fn, ":types/countryCode/%s.png", s);
flags[c] = { fn };
incref flags[c];
- }
+ }
}
~FlagCollection() { flags.Free(); }
}
}
};
-static String subdivisionCategoryNames[SubdivisionCategory] =
+static String subdivisionCategoryNames[SubdivisionCategory] =
{
"(none)",
"Administration", "Metropolitan Administration",
number[len++] = ch;
if(numDecimals == 2)
break;
- }
+ }
}
number[len] = 0;
return ((bool (*)(void *, void *, const char *))(void *)class(double)._vTbl[__ecereVMethodID_class_OnGetDataFromString])(class(double), &this, number);
return MSCOM_IUnknown::QueryInterface(iid, ppvObj);
}
- virtual uint stdcall BandedDataCallback(uint lReason, uint lStatus, uint lPercentComplete, uint lOffset, uint lLength,
+ virtual uint stdcall BandedDataCallback(uint lReason, uint lStatus, uint lPercentComplete, uint lOffset, uint lLength,
uint lReserved, uint lResLength, byte * pbBuffer);
};
class WiaPropertyStorage
{
IWiaPropertyStorage *pWiaPropertyStorage;
-
+
bool ReadLong(const PROPSPEC *pPropSpec, uint *plResult)
{
bool result = true;
}
class ScanningProgress : Window
-{
+{
autoCreate = false;
text = "Scanning in progress. Please wait.";
borderStyle = fixed;
{
TempFile f { };
- uint stdcall BandedDataCallback(uint lReason, uint lStatus, uint lPercentComplete, uint lOffset, uint lLength,
+ uint stdcall BandedDataCallback(uint lReason, uint lStatus, uint lPercentComplete, uint lOffset, uint lLength,
uint lReserved, uint lResLength, byte * pbBuffer)
{
switch(lReason)
{
PROPSPEC specPages;
PROPVARIANT varPages;
-
+
specPages.ulKind = PRSPEC_PROPID;
specPages.propid = WIA_DPS_PAGES;
varPages.lVal = ALL_PAGES;
scannerProp.WriteMultiple(1, &specPages, &varPages, WIA_DPS_FIRST);
-
+
PropVariantClear(&varPages);
}
}
delete scannerProp;
-
+
nextPage = true;
while(nextPage)
{
define defaultObjDirExpression = "obj/$(CONFIG).$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX)";
-char * settingsDirectoryNames[DirTypes] =
+char * settingsDirectoryNames[DirTypes] =
{
"Include Files",
"Library Files",
char * tmp = copy;
char * start = tmp;
Array<char *> parts { };
-
+
for(c=0; c<len; c++)
{
if(tmp[c] == '$')
PathCat(defaultConfigFilePath, "App");
PathCat(defaultConfigFilePath, "DefaultData");
PathCat(defaultConfigFilePath, "ecereIDE.ini");
-
+
if(FileExists(defaultConfigFilePath))
{
if(!FileExists(configFilePath))
}
PathCat(path, "Data");
// the forced settings location will only be
- // used if the running ide's path matches
+ // used if the running ide's path matches
// the PortableApps.com directory structure
- // and the default ini file is found in
+ // and the default ini file is found in
// the DefaultData directory
settingsLocation = path;
portable = true;
delete data.displayDriver; data.displayDriver = CopyString(oldSettings.displayDriver);
data.projectDefaultTargetDir = oldSettings.projectDefaultTargetDir;
data.projectDefaultIntermediateObjDir = oldSettings.projectDefaultIntermediateObjDir;
-
+
Save();
result = success;
}
bool showLineNumbers;
bool caretFollowsScrolling;
char * displayDriver;
-
+
// TODO: Classify settings
//EditorSettings editor { };
recentProjects.Free();
delete recentProjects;
delete docDir;
-
+
delete projectDefaultTargetDir;
delete projectDefaultIntermediateObjDir;
delete compilerConfigsDir;
{
get { return OnGetString(null, null, null); }
set
- {
+ {
if(value)
{
Platform c;
define defaultTargetDir = "Default Target Directory";
define defaultIntermediateObjDir = "Default Intermediate Objects Directory";
-define makeDefaultCommand = (GetRuntimePlatform() == win32) ? "mingw32-make" :
+define makeDefaultCommand = (GetRuntimePlatform() == win32) ? "mingw32-make" :
#ifdef __FreeBSD__
"gmake";
#else
recentFiles.Free();
recentProjects.Free();
delete docDir;
-
+
delete projectDefaultTargetDir;
delete projectDefaultIntermediateObjDir;
void OnAskReloadSettings()
{
- /*if(MessageBox { type = YesNo, master = this,
- text = "Global Settings Modified Externally",
+ /*if(MessageBox { type = YesNo, master = this,
+ text = "Global Settings Modified Externally",
contents = "The global settings were modified by another instance.\n"
"Would you like to reload them?" }.Modal() == Yes)*/
{
{
Array<String> configNames { };
CompilerConfig compiler;
-
+
CompilerConfig defaultCompiler = MakeDefaultCompiler(defaultCompilerName, true);
compilerConfigs.Free();
compilerConfigs.Add(defaultCompiler);
GetGlobalValue("Editing", "UseFreeCaret", integer, &useFreeCaret);
GetGlobalValue("Editing", "CaretFollowsScrolling", integer, &caretFollowsScrolling);
GetGlobalValue("Editing", "ShowLineNumbers", integer, &showLineNumbers);
-
+
GetGlobalValue("Building", "NumParallelJobs", integer, &defaultCompiler.numJobs);
{
delete displayDriver;
for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
configNames.Add(CopyString(compiler.name));
-
+
PutGlobalValue("Compilers", "Configs", stringList, configNames);
for(compiler : compilerConfigs; compiler != compilerConfigs.firstIterator.data)
}
configNames.Free();
delete configNames;
-
+
CloseAndMonitor();
}
return result;
char * nodeName = currentNode && currentNode != project.topNode ? currentNode.name : "";
char * config = buildTab.selectedConfigName;
char * platform = buildTab.selectedPlatformName;
- char * label = new char[strlen(dialogTitle) + 3 + strlen(project.topNode.name) + 3 +
+ char * label = new char[strlen(dialogTitle) + 3 + strlen(project.topNode.name) + 3 +
strlen(nodeName) + 2 + strlen(config) + 1 + strlen(platform) + 1 + 1];
strcpy(label, dialogTitle);
strcat(label, " - ");
return true;
}
};
-
+
bool Window::OptionBox_OnRightButtonDown(int x, int y, Modifiers mods)
{
OptionBox ob = (OptionBox)id;
break;
}
}
-
+
if(!c)
{
label = null;
buildTab = (BuildTab)buildTab.master;
if(buildTab) buildTab.modifiedDocument = true;
}
-
+
void Unset()
{
char * platformName = platform ? platform.OnGetString(0,0,0) : null;
skipped = true;
break;
}
- }
+ }
if(skipped && c.options && OptionSet(c.options))
{
}
break;
}
- }
+ }
nodeConfig = c;
break;
if(!found) tempStrings.Add(s);
}
}
- }
+ }
else
{
SetStrings(options ? *(Array<String>*)((byte *)options + option) : null);
void RetrieveOption(ProjectOptions options, bool isCfgOrPlt)
{
bool checked = ((Button)editor).checked;
- *(SetBool*)((byte *)options + option) = checked ? true :
+ *(SetBool*)((byte *)options + option) = checked ? true :
((currentNode.parent || isCfgOrPlt) ? false : unset);
}
((OptionBox)dropBox.id).Retrieve();
return true;
}
- };
+ };
void LoadOption(ProjectOptions options)
{
surface.LineStipple(0x5555);
surface.Rectangle(x1, y1, x2, y2);
- surface.LineStipple(0);
+ surface.LineStipple(0);
}
class BuildTab : Tab
if(button && button.id)
{
Platform platform = (Platform)button.id;
- char * platformName = platform ? platform.OnGetString(0,0,0) : null; // all these platformName are leaking, no?
+ char * platformName = platform ? platform.OnGetString(0,0,0) : null; // all these platformName are leaking, no?
return platformName;
}
}
}
return SelectorBar::OnKeyDown(key, ch);
}
-
+
bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
{
((BuildTab)master).labelConfigurations.Update(null);
config.options.debug = true;
config.options.optimization = none;
config.options.warnings = all;
- */
+ */
button =
{
return true;
}
};
-
+
Label labelPlatforms
{
this, anchor = { left = 8, top = 44 }, labeledWindow = platformSelector;
}
project.topNode.RenameConfig(config.name, *newName);
-
+
modifiedDocument = true;
return true;
}
if(!node) node = project.topNode;
newNodeRes = node.isInResources;
-
+
currentNode = node;
if(!ignoreAsLastSelection)
lastSelectedNode = node;
compilerTab.labelIncludeDirs.visible = !newNodeRes;
compilerTab.includeDirs.visible = !newNodeRes;
}
-
+
if(node == project.topNode)
{
compilerTab.objDir.visible = true;
checked = true;
NotifyClicked = ConfigClicked;
};
-
+
config = null;
if(project.topNode.configurations)
}
}
}
-
+
void Init()
{
Platform p;
SelectorButton button;
activeConfigName = project.config ? CopyString(project.config.name) : null;
-
+
compilerTab.AddNode(project.topNode, null);
CreateConfigButtons();
{
SelectorButton button
{
- platformSelector, master = this, text = p.OnGetString(0,0,0), id = (int64)p;
+ platformSelector, master = this, text = p.OnGetString(0,0,0), id = (int64)p;
NotifyClicked = PlatformClicked;
};
}
}
};
- Window rightPane
+ Window rightPane
{
this, anchor = { left = 196, top = 0, right = 0, bottom = 0 }, background = formColor, tabCycle = true;
};
row.SetData(null, node);
- if(node.files && node.files.first && node.parent &&
- !(!node.parent.parent &&
- (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
+ if(node.files && node.files.first && node.parent &&
+ !(!node.parent.parent &&
+ (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
!strcmpi(node.name, "src") || !strcmpi(node.name, "tools"))))
row.collapsed = true;
else if(node.type == folder)
if(activeChild && activeChild.active)
{
Window control = activeChild;
- control.Deactivate();
+ control.Deactivate();
control.Activate();
}
}
this, position = { 8, 24 }, size = { 200, 22 };
text = $"Target Name", hotKey = altN, option = OPTION(targetFileName);
};
-
+
Label labelTargetType { this, position = { 216, 8 }, labeledWindow = targetType };
TargetTypeDB targetType
{
this, position = { 216, 24 }, size = { 120, 22 };
text = $"Target Type", hotKey = altT, option = OPTION(targetType);
};
-
+
Label labelTargetDirectory { this, position = { 344, 8 }, labeledWindow = targetDirectory };
PathOptionBox targetDirectory
{
if(activeChild && activeChild.active)
{
Window control = activeChild;
- control.Deactivate();
+ control.Deactivate();
control.Activate();
}
}
if(activeChild && activeChild.active)
{
Window control = activeChild;
- control.Deactivate();
+ control.Deactivate();
control.Activate();
}
}
return true;
}
};
- Button button
+ Button button
{
this, text = $"OK", isDefault = true, size = { 80, 20 }, anchor = { right = 13, bottom = 10 };
background = { r = 250, g = 252, b = 255 };
multiLine = true,
hasVertScroll = true,
- contents =
+ contents =
"Réjean Loyer\n"
" Most of the additional programming on the IDE\n"
" Initial EDA design\n"
static int TokenizeList(char * string, const char seperator, Array<char *> tokens)
{
uint level = 0;
-
+
bool quoted = false, escaped = false;
char * start = string, ch;
-
+
for(; (ch = *string); string++)
{
if(!start)
char * targetDir;
char * targetFile;
-
+
GdbExecution gdbExecution;
DebuggerUserAction userAction;
DebuggerState state;
GdbDataStop stopItem;
GdbDataBreakpoint bpItem;
Frame activeFrame;
-
+
List<Breakpoint> sysBPs { };
Breakpoint bpRunToCursor;
Breakpoint intBpEntry;
targetDir = null;
targetFile = null;
-
+
_ChangeState(none);
event = none;
breakType = none;
stopItem = null;
bpItem = null;
activeFrame = 0;
-
+
bpRunToCursor = null;
delete currentCompiler;
/*GdbThread gdbThread
Timer gdbTimer*/
}
-
+
Debugger()
{
_dpl2(_dpct, dplchan::debuggerCall, 0, "Debugger::constructor");
{
bool returnedExitCode = false;
char verboseExitCode[128];
-
+
_dpl2(_dpct, dplchan::debuggerCall, 0, "Debugger::HandleExit(", reason, ", ", code, ")");
_ChangeState(loaded); // this state change seems to be superfluous, might be in case of gdb crash
targetProcessId = 0;
}
else
verboseExitCode[0] = '\0';
-
+
event = exit;
// ClearBreakDisplay();
}
ide.Update(null);
}
-
+
DebuggerState StartSession(CompilerConfig compiler, ProjectConfig config, int bitDepth, bool useValgrind, bool restart, bool ignoreBreakpoints)
{
DebuggerState result = none;
*lineTopFrame = stopItem.frame.line;
else
*lineTopFrame = 0;
-
+
if(*lineTopFrame == *lineCursor && *lineTopFrame)
*lineTopFrame = 0;
}
}
}
}
-
+
// moving code cursors is futile, on next step, stop, hit, cursors will be offset anyways
}
while(debuggerFileDialog.Modal())
{
strcpy(sourceDir, debuggerFileDialog.filePath);
- if(!fstrcmp(ide.workspace.projectDir, sourceDir) &&
- MessageBox { type = yesNo, master = ide,
- contents = $"This is the project directory.\nWould you like to try again?",
+ if(!fstrcmp(ide.workspace.projectDir, sourceDir) &&
+ MessageBox { type = yesNo, master = ide,
+ contents = $"This is the project directory.\nWould you like to try again?",
text = $"Invalid Source Directory" }.Modal() == no)
return false;
else
break;
}
}
-
- if(srcDir &&
- MessageBox { type = yesNo, master = ide,
- contents = $"This source directory is already specified.\nWould you like to try again?",
+
+ if(srcDir &&
+ MessageBox { type = yesNo, master = ide,
+ contents = $"This source directory is already specified.\nWould you like to try again?",
text = $"Invalid Source Directory" }.Modal() == no)
return false;
else
strcpy(file, sourceDir);
PathCat(file, test);
result = FileExists(file);
- if(!result &&
- MessageBox { type = yesNo, master = ide,
- contents = $"Unable to locate source file.\nWould you like to try again?",
+ if(!result &&
+ MessageBox { type = yesNo, master = ide,
+ contents = $"Unable to locate source file.\nWould you like to try again?",
text = $"Invalid Source Directory" }.Modal() == no)
return false;
}
else
result = true;
-
+
if(result)
return true;
}
_dpl2(_dpct, dplchan::debuggerCall, 0, "Debugger::AddSourceDir(", sourceDir, ")");
ide.workspace.sourceDirs.Add(CopyString(sourceDir));
ide.workspace.Save();
-
+
if(targeted)
{
DebuggerState oldState = state;
}
if(srcDir)
break;
-
+
if(SourceDirDialog(title, directory, null, sourceDir))
{
if(IsPathInsideOf(absolutePath, sourceDir))
MakePathRelative(absolutePath, sourceDir, relativePath);
break;
}
- else if(MessageBox { type = yesNo, master = ide,
- contents = $"You must provide a valid source directory in order to place a breakpoint in this file.\nWould you like to try again?",
+ else if(MessageBox { type = yesNo, master = ide,
+ contents = $"You must provide a valid source directory in order to place a breakpoint in this file.\nWould you like to try again?",
text = $"Invalid Source Directory" }.Modal() == no)
return;
}
Array<char *> argumentTokens { minAllocSize = 50 };
DebugListItem item { };
Argument arg;
-
+
//_dpl2(_dpct, dplchan::debuggerCall, 0, "Debugger::ParseFrame()");
TokenizeList(string, ',', frameTokens);
for(i = 0; i < frameTokens.count; i++)
else
_dpl(0, "Bad frame");
}
-
+
delete frameTokens;
delete argsTokens;
delete argumentTokens;
vsnprintf(string, sizeof(string), format, args);
string[sizeof(string)-1] = 0;
va_end(args);
-
+
gdbReady = false;
ide.debugger.serialSemaphore.TryWait();
app.Unlock();
ide.debugger.serialSemaphore.Wait();
app.Lock();
- }
+ }
}
bool ValidateBreakpoint(Breakpoint bp)
}
else
ChangeWorkingDir(ide.workspace.projectDir);
-
+
ide.SetPath(true, compiler, config, bitDepth);
// TODO: This pollutes the environment, but at least it works
bp.Reset();
if(bpRunToCursor)
bpRunToCursor.Reset();
-
+
ide.outputView.debugBox.Logf($"Debugging stopped\n");
ClearBreakDisplay();
ide.Update(null);
progThread.Wait();
app.Lock();
delete fifoFile;
- }
+ }
DeleteFile(progFifoPath);
progFifoPath[0] = '\0';
rmdir(progFifoDir);
bool ResolveWatch(Watch wh)
{
bool result = false;
-
+
_dpl2(_dpct, dplchan::debuggerWatches, 0, "Debugger::ResolveWatch()");
wh.Reset();
/*delete wh.value;
- if(wh.type)
+ if(wh.type)
{
FreeType(wh.type);
wh.type = null;
SetGlobalContext(codeEditor.globalContext);
SetGlobalData(&codeEditor.globalData);
}
-
+
exp = ParseExpressionString(wh.expression);
-
+
if(exp && !parseError)
{
char expString[4096];
long v = (long)exp.val.f;
sprintf(temp, "%i", v);
break;
- }
+ }
case doubleType:
{
long v = (long)exp.val.d;
long v = (long)exp.val.f;
sprintf(temp, "0x%x", v);
break;
- }
+ }
case doubleType:
{
long v = (long)exp.val.d;
long v = (long)exp.val.f;
sprintf(temp, "0o%o", v);
break;
- }
+ }
case doubleType:
{
long v = (long)exp.val.d;
case constantExp:
case stringExp:
// Temporary Code for displaying Strings
- if((exp.expType && ((exp.expType.kind == pointerType ||
- exp.expType.kind == arrayType) && exp.expType.type.kind == charType)) ||
- (wh.type && wh.type.kind == classType && wh.type._class &&
+ if((exp.expType && ((exp.expType.kind == pointerType ||
+ exp.expType.kind == arrayType) && exp.expType.type.kind == charType)) ||
+ (wh.type && wh.type.kind == classType && wh.type._class &&
wh.type._class.registered && wh.type._class.registered.type == normalClass &&
!strcmp(wh.type._class.registered.name, "String")))
{
else
snprintf(value, sizeof(value), (GetRuntimePlatform() == win32) ? "0x%08I64x " : "0x%08llx ", address);
value[sizeof(value)-1] = 0;
-
+
if(!address)
strcat(value, $"Null string");
else
{
int c;
char ch;
-
+
for(c = 0; (ch = string[c]) && c<4096; c++)
- value[len++] = ch;
+ value[len++] = ch;
value[len++] = ')';
value[len++] = '\0';
-
+
}
else
{
wh.value = CopyString(value);
}
}
- else if(wh.type && wh.type.kind == classType && wh.type._class &&
+ else if(wh.type && wh.type.kind == classType && wh.type._class &&
wh.type._class.registered && wh.type._class.registered.type == enumClass)
{
uint64 value = strtoul(exp.constant, null, 0);
wh.value = CopyString($"Invalid Enum Value");
result = true;
}
- else if(wh.type && (wh.type.kind == charType || (wh.type.kind == classType && wh.type._class &&
+ else if(wh.type && (wh.type.kind == charType || (wh.type.kind == classType && wh.type._class &&
wh.type._class.registered && !strcmp(wh.type._class.registered.fullName, "ecere::com::unichar"))) )
{
unichar value;
else
snprintf(string, sizeof(string), "\'%s\' (%d)", charString, value);
string[sizeof(string)-1] = 0;
-
+
wh.value = CopyString(string);
result = true;
}
if(exp.member.memberType == propertyMember)
snprintf(watchmsg, sizeof(watchmsg), $"Missing property evaluation support for \"%s\"", wh.expression);
else
- snprintf(watchmsg, sizeof(watchmsg), $"Evaluation failed for \"%s\" of type \"%s\"", wh.expression,
+ snprintf(watchmsg, sizeof(watchmsg), $"Evaluation failed for \"%s\" of type \"%s\"", wh.expression,
exp.type.OnGetString(tempString, null, null));
}
break;
snprintf(watchmsg, sizeof(watchmsg), $"Invalid expression: \"%s\"", wh.expression);
if(exp) FreeExpression(exp);
-
+
SetPrivateModule(backupPrivateModule);
SetCurrentContext(backupContext);
SetTopContext(backupContext);
SetGlobalContext(backupContext);
SetThisClass(backupThisClass);
}
- //else
+ //else
// wh.value = CopyString("No source file found for selected frame");
-
+
watchmsg[sizeof(watchmsg)-1] = 0;
if(!wh.value)
wh.value = CopyString(watchmsg);
gdbTimer.Stop();
gdbHandle.Wait();
delete gdbHandle;
-
+
ide.outputView.debugBox.Logf($"Debugger Fatal Error: GDB lost\n");
ide.outputView.debugBox.Logf($"Debugging stopped\n");
ide.Update(null);
DebugListItem item { };
DebugListItem item2 { };
bool setWaitingForPID = false;
-
+
#if defined(GDB_DEBUG_CONSOLE) || defined(GDB_DEBUG_GUI)
#ifdef GDB_DEBUG_CONSOLE
// _dpl2(_dpct, dplchan::gdbOutput, 0, output);
if(ide.gdbDialog) ide.gdbDialog.AddOutput(output);
#endif
#endif
-
+
switch(output[0])
{
case '~':
class Watch : struct
{
class_no_expansion;
-
+
Type type;
char * expression;
char * value;
{
uint count = 0;
uint level = 0;
-
+
bool quoted = false; //bool escaped = false;
char * start = null;
-
+
for(; *string && count < maxTokens; string++)
{
if(!start)
}
class Output : struct
-{
+{
public:
Output prev, next;
char * output;
}
class Command : struct
-{
+{
public:
Command prev, next;
char * command;
if(commands.first)
{
bool previous = ((SmartKey)key == up);
-
+
if(!lastCommand)
lastCommand = previous ? commands.last : commands.first;
else
lastCommand = previous ? lastCommand.prev : lastCommand.next;
-
+
if(lastCommand)
{
command.contents = lastCommand.command;
DataRow root, frame, row;
TempListItem item { };
Output out;
-
+
tree.Clear();
root = tree.AddString("Output");
{
t = CopyString(out.output);
s = t;
-
+
switch(s[0])
{
case '^':
row.AddString(string);
delete string;
}
-
+
void UpdateTreeFrame(TempListItem item, DataRow frame)
{
int k, l, m, frameTksCount, argsTksCount, mTksCount;
char * frameTokens[3200], * argsTokens[3200], * mTokens[3200];
-
+
item.value = StripCurlies(item.value);
frameTksCount = TokenizeList(item.value, sizeof(frameTokens) / sizeof(char *), ',', frameTokens);
for(k = 0; k < frameTksCount; k++)
}
return true;
}
-
+
~GDBDialog()
{
commands.Free(Command::Free);
static bool InsideIncl(Location loc, int line, int charPos)
{
- //return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
+ //return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
// (loc.end.line > line || (loc.end.line == line && loc.end.charPos >= charPos));
return !loc.start.included && loc.start.line <= line && loc.end.line >= line;
}
static bool Inside(Location loc, int line, int charPos)
{
- //return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
+ //return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
// (loc.end.line > line || (loc.end.line == line && loc.end.charPos > charPos));
return !loc.start.included && loc.start.line < line && loc.end.line > line;
}
static bool InsideEndIncl(Location loc, int line, int charPos)
{
- //return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
+ //return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
// (loc.end.line > line || (loc.end.line == line && loc.end.charPos >= charPos));
return !loc.start.included && loc.start.line < line && loc.end.line >= line;
}
case bracketsExp:
{
Expression expression;
-
+
for(expression = exp.list->first; expression; expression = expression.next)
{
if(InsideIncl(&expression.loc, line, charPos))
idResult = DebugFindCtxExpression(exp.index.exp, line, charPos);
if(idResult) return idResult;
}
-
+
for(expression = exp.index.index->first; expression; expression = expression.next)
{
if(InsideIncl(&expression.loc, line, charPos))
idResult = DebugFindCtxExpression(exp.call.exp, line, charPos);
if(idResult) return idResult;
}
-
+
if(exp.call.argLoc.start.line > line || (line == exp.call.argLoc.start.line && exp.call.argLoc.start.charPos >= charPos))
arg = -1;
- else
+ else
arg = 0;
if(exp.call.arguments)
{
if(InsideIncl(&expression.loc, line, charPos))
idResult = DebugFindCtxExpression(expression, line, charPos);
-
+
// Break
break;
}
}
- if(idResult)
+ if(idResult)
return idResult;
}
break;
idResult = DebugFindCtxStatement(stmt.forStmt.init, line, charPos);
if(idResult) return idResult;
}
-
+
if(stmt.forStmt.check && InsideIncl(&stmt.forStmt.check.loc, line, charPos))
{
idResult = DebugFindCtxStatement(stmt.forStmt.check, line, charPos);
if(idResult) return idResult;
}
-
+
if(stmt.forStmt.increment)
{
for(exp = stmt.forStmt.increment->first; exp; exp = exp.next)
if(stmt.expressions)
{
Expression exp;
-
+
for(exp = stmt.expressions->first; exp; exp = exp.next)
{
if(InsideIncl(&exp.loc, line, charPos))
{
Initializer init;
Identifier idResult;
-
+
for(init = initializer.list->first; init; init = init.next)
{
if(InsideIncl(&init.loc, line, charPos))
static Identifier DebugFindCtxDeclaration(Declaration decl, int line, int charPos)
{
Identifier idResult;
-
+
switch(decl.type)
{
case structDeclaration:
if(d.type == DeclaratorStruct && d.declarator && d.declarator.type == DeclaratorIdentifier)
return d.declarator.identifier;
}
- }
+ }
}
*/
break;
idResult = DebugFindCtxInitDeclarator(d, line, charPos);
if(idResult) return idResult;
}
- }
+ }
}
break;
}
if(func.body && InsideIncl(&func.body.loc, line, charPos))
{
Identifier idResult;
-
+
Identifier id = GetDeclId(func.declarator);
Symbol symbol = func.declarator.symbol;
Type type = symbol.type;
MembersInit init;
MemberInit memberInit;
for(init = inst.members->first; init; init = init.next)
- {
+ {
if(init.loc.start.line > line || (line == init.loc.start.line && init.loc.start.charPos > charPos))
break;
return idResult;
SetThisClass(oldThisClass);
- return (void *)-1; // ?
+ return (void *)-1; // ?
}
static Identifier DebugFindCtxClassFunction(ClassFunction func, int line, int charPos)
if(func.body && InsideIncl(&func.body.loc, line, charPos))
{
Identifier idResult;
-
+
Identifier id = GetDeclId(func.declarator);
Symbol symbol = func.declarator ? func.declarator.symbol : null;
Type type = symbol ? symbol.type : null;
SetThisClass(currentClass);
idResult = DebugFindCtxStatement(def.propertyWatch.compound, line, charPos);
- if(idResult)
+ if(idResult)
return idResult;
SetThisClass(oldThisClass);
}
{
switch(external.type)
{
- case functionExternal:
+ case functionExternal:
if(InsideIncl(&external.loc, line, charPos))
{
idResult = DebugFindCtxFunction(external.function, line, charPos);
return (idResult == (void *)-1 || idResult == (void *)-2) ? null : idResult;
}
break;
- case declarationExternal:
+ case declarationExternal:
if(InsideIncl(&external.loc, line, charPos))
{
idResult = DebugFindCtxDeclaration(external.declaration, line, charPos);
return (idResult == (void *)-1 || idResult == (void *)-2) ? null : idResult;
}
break;
- case classExternal:
+ case classExternal:
if(InsideIncl(&external._class.loc, line, charPos))
{
currentClass = external._class.symbol.registered;
{
Expression temp { };
- // This function assumes that expError is contained within exp,
+ // This function assumes that expError is contained within exp,
// and therefore these types will be freed when freeing the old contents
// of the expression we're carying into.
// f : Regard the bits of the value as a floating point number and print using typical floating point syntax.
if(!type)
return 'x';
-
+
switch(type.kind)
{
case charType:
/*static */bool ExpressionIsError(Expression exp)
{
- return (exp.type == dereferenceErrorExp || exp.type == symbolErrorExp || exp.type == classMemberSymbolErrorExp ||
+ return (exp.type == dereferenceErrorExp || exp.type == symbolErrorExp || exp.type == classMemberSymbolErrorExp ||
exp.type == structMemberSymbolErrorExp || exp.type == memoryErrorExp || exp.type == unknownErrorExp ||
exp.type == noDebuggerErrorExp || exp.type == debugStateErrorExp);
}
Expression expNew;
TypeKind kind = dummyType;
Type dataType = exp.expType;
-
+
char temp[1024];
uint64 address;
bool hasAddress;
bool isPointer = false;
-
+
if(dataType && dataType.kind == classType && dataType._class.registered)
{
Class _class = dataType._class.registered;
temp[0] = '\0';
switch(kind)
{
- case charType: case shortType: case intType: case int64Type: case longType: case floatType: case doubleType:
+ case charType: case shortType: case intType: case int64Type: case longType: case floatType: case doubleType:
case enumType:
case arrayType:
case structType:
{
exp.address = _strtoui64(exp.constant, null, 0);
exp.address *= size;
- }
+ }
}
}
}
Expression e, n;
//for(
// e = (*exp.list).first, n = e ? e.next : null;
- // e;
+ // e;
// e = n, n = n?(n.next) : null)
for(e = exp.list->first; e; e = n)
if(!exp.index.exp.isConstant)
exp.isConstant = false;
-
+
// int r[0]
// 4 == size = ComputeTypeSize(exp.expType);
// 0 == size = ComputeTypeSize(exp.expType.arrayType);
// 4 == size = ComputeTypeSize(exp.index.exp.expType);
// 0 == size = ComputeTypeSize(exp.index.exp.expType.arrayType);
size = ComputeTypeSize(exp.expType);
- format = GetGdbFormatChar(exp.expType);
-
+ format = GetGdbFormatChar(exp.expType);
+
for(e = exp.index.index->first; e; e = e.next)
{
DebugComputeExpression(e);
if(!ExpressionIsError(exp))
{
exp.expType = Dereference(exp.index.exp.expType);
-
+
if(exp.index.index && exp.index.index->last && ((Expression)exp.index.index->last) && ((Expression)exp.index.index->last).expType &&
((Expression)exp.index.index->last).expType.kind == intType)
{
classSym = FindClass(string);
_class = classSym ? classSym.registered : null;
}
-
+
if(memberID && _class)
{
/*
double value;
double (*Get)(double);
GetDouble(memberExp, &value);
-
+
if(convertTo)
Get = (void *)prop.Set;
else
loc = exp.loc;
};
exp.type = instanceExp;
-
+
GetInt(value, &intValue);
Set(exp.instance.data, intValue);
loc = exp.loc;
};
exp.type = instanceExp;
-
+
GetInt64(value, &intValue);
Set(exp.instance.data, intValue);
loc = exp.loc;
};
exp.type = instanceExp;
-
+
GetDouble(value, &doubleValue);
Set(exp.instance.data, doubleValue);
ExpressionType evalError = dummyExp;
uint64 address;
Expression prev = exp.prev, next = exp.next;
- char format;
+ char format;
int size;
Expression expNew;
TypeKind kind = dummyType;
if(!dataType)
dataType = member.dataType = ProcessTypeString(member.dataTypeString, false);
- if(dataType.kind == classType && dataType._class.registered &&
+ if(dataType.kind == classType && dataType._class.registered &&
(dataType._class.registered.type == enumClass || dataType._class.registered.type == bitClass || dataType._class.registered.type == unitClass))
{
if(dataType._class.registered.dataTypeString)
address = 0;
GetUInt64(memberExp, &address);
//printf("Unhandled !!\n");
-
+
//printf("memberExp.hasAddress = %d\n", memberExp.hasAddress);
//printf("memberExp.type = %d\n", memberExp.type);
//printf("_class.name = %s, _class.type = %d\n", _class.name, _class.type);
}
-
+
address += offset;
-
- if((dataType.kind == classType && dataType._class &&
+
+ if((dataType.kind == classType && dataType._class &&
(!dataType._class.registered || dataType._class.registered.type == normalClass || dataType._class.registered.type == noHeadClass || dataType._class.registered.type == systemClass)) ||
(dataType.kind != classType && dataType.kind != arrayType && dataType.kind != structType && dataType.kind != unionType))
{
}
//else
// exp.type = ExpUnknownError;
-
+
//FreeExpContents(exp);
//exp.constant = PrintUInt64(value);
//exp.type = constantExp;
uint offset = 0;
Type memberType = exp.member.member ? FindMemberAndOffset(type, exp.member.member.string, &offset) : null;
if(memberType)
- {
+ {
char * evaluation = null;
ExpressionType evalError = dummyExp;
uint64 address;
Expression prev = exp.prev, next = exp.next;
- char format;
+ char format;
int size = memberType.size;
Expression expNew;
Type dataType = memberType;
TypeKind kind = dummyType;
- if(dataType.kind == classType && dataType._class.registered &&
+ if(dataType.kind == classType && dataType._class.registered &&
(dataType._class.registered.type == enumClass || dataType._class.registered.type == bitClass || dataType._class.registered.type == unitClass))
dataType = dataType._class.registered.dataType;
address = memberExp.address;
else if(memberExp.type == constantExp)
GetUInt64(memberExp, &address);
-
+
address += offset;
-
- if((dataType.kind == classType && dataType._class &&
+
+ if((dataType.kind == classType && dataType._class &&
(!dataType._class.registered || dataType._class.registered.type == normalClass || dataType._class.registered.type == noHeadClass || dataType._class.registered.type == systemClass)) ||
(dataType.kind != classType && dataType.kind != arrayType && dataType.kind != structType && dataType.kind != unionType))
{
Type type = ProcessType(exp.typeName.qualifiers, exp.typeName.declarator);
FreeExpContents(exp);
exp.constant = PrintUInt(ComputeTypeSize(type));
- exp.type = constantExp;
+ exp.type = constantExp;
FreeType(type);
break;
}
case castExp:
{
DebugComputeExpression(exp.cast.exp);
-
+
if(ExpressionIsError(exp.cast.exp)) //.type == ExpSymbolError
CarryExpressionError(exp, exp.cast.exp);
else
break;
}
case doubleType:
- {
+ {
double value;
GetDouble(exp.cast.exp, &value);
FreeExpContents(exp);
exp.cond.elseExp.destType = exp.destType;
DebugComputeExpression(exp.cond.elseExp);
break;
- }
+ }
*/
}
if(parent) hwnd = parent; else break;
}
SetForegroundWindow(hwnd); //SetForegroundWindow( GetAncestor(hwnd, GA_ROOTOWNER));
- return false;
+ return false;
}
return true;
}
{
int c;
XFlush(xGlobalDisplay);
- for(c = 0; c<4; c++)
+ for(c = 0; c<4; c++)
// while(true)
{
XWindowAttributes attributes = { 0 };
// printf("cant get _NET_WM_PID property\n");
break;
}
-
+
if(data)
{
int pid = *(int *)data;
event.send_event = 1;
event.format = 32;
event.data.l[0] = 0;
-
+
XSendEvent(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay), bool::false, SubstructureRedirectMask | SubstructureNotifyMask, (union _XEvent *)&event);
}
else
#ifdef __WIN32__
HANDLE hProcessSnap;
PROCESSENTRY32 pe32;
-
+
int childProcessId = 0;
-
+
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
-
+
if(hProcessSnap != INVALID_HANDLE_VALUE)
{
pe32.dwSize = sizeof(PROCESSENTRY32);
-
+
if(Process32First(hProcessSnap, &pe32))
{
do
{ $"Text Files", "txt", never }
] };
-static char * iconNames[] =
+static char * iconNames[] =
{
"<:ecere>constructs/class.png",
"<:ecere>constructs/data.png",
enum MethodAction
{
- actionAddMethod = 1,
- actionDeleteMethod = 2,
- actionDetachMethod = 3,
- actionAttachMethod = 4,
+ actionAddMethod = 1,
+ actionDeleteMethod = 2,
+ actionDetachMethod = 3,
+ actionAttachMethod = 4,
actionReattachMethod = 5
};
f.Puts("\\\\");
else
f.Putc(string[c]);
- }
+ }
}
void OutputType(File f, Type type, bool outputName)
{
char ch;
int before = 0;
-
+
if(position)
f.Seek(pos - *position, current);
-
+
// Try to delete spaces and \n before...
f.Seek(-1, current);
for(;f.Getc(&ch);)
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
// Cut & Paste function
-
+
{
EditLine l1, l2;
int y1,x1,y2,x2;
*text = new char[*size+1 + (y2-y1+1) * linePad + pad]; // Add pad for tabs and new name
editBox.GetSel(*text, false);
}
-
+
editBox.SetSelPos(l1, y1, x1, l2, y2, x2);
f.Printf(""); // Make the stream point to where the editbox is
}
{
void * dataForm = new0 byte[dataType.structSize];
void * dataTest = new0 byte[dataType.structSize];
-
+
((void (*)(void *, void *))(void *)prop.Get)(selected.instance, dataForm);
((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
else if(dataType && dataType._vTbl && (dataType.type == normalClass || dataType.type == noHeadClass))
{
void * dataForm, * dataTest;
-
+
dataForm = ((void *(*)(void *))(void *)prop.Get)(selected.instance);
dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
-
+
if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
else if(dataType && dataType._vTbl)
{
DataValue dataForm, dataTest;
-
+
GetProperty(prop, selected.instance, &dataForm);
GetProperty(prop, test, &dataTest);
-
+
if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
{
SetProperty(prop, test, dataForm);
SetProperty(prop, selected.instance, dataForm);
}
result = true;
- }
+ }
}
}
return result;
bool disabled = false;
if(selected.oClass == selected)
{
- ClassDef def;
+ ClassDef def;
if(selected.classDefinition)
{
for(def = selected.classDefinition.definitions->first; def; def = def.next)
static bool CheckCompatibleMethod(Method method, Type type, Class regClass, bool isForm, Symbol selectedClass)
{
- bool result = false;
+ bool result = false;
bool reset = false;
if(!method.dataType)
method.dataType = ProcessTypeString(method.dataTypeString, false);
method.dataType = ProcessTypeString(method.dataTypeString, false);
confirmation = false;
-
+
// Check if default function should be calling base class:
if(object.instance._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
{
else
{
if(stmt)
- confirmation = true;
+ confirmation = true;
}
}
else
}
if(!exp || exp.type != callExp || exp.call.exp.type != identifierExp)
- confirmation = true;
+ confirmation = true;
else
{
Identifier id = exp.call.exp.identifier;
arg = arg ?arg.next : null;
}
}
- }
+ }
}
}
}
isActiveClient = true;
anchor = Anchor { left = 300, right = 150, top = 0, bottom = 0 };
menu = Menu { };
-
- // eWindow_SetX(A_CASCADE); eWindow_SetY(A_CASCADE);
+
+ // eWindow_SetX(A_CASCADE); eWindow_SetY(A_CASCADE);
// eWindow_SetWidth(A_RELATIVE|80); eWindow_SetHeight(A_RELATIVE|80);
SheetType sheetSelected;
OldList classes;
bool codeModified;
bool formModified;
-
+
ObjectInfo selected;
ObjectInfo oClass;
bool expectingMove;
BitmapResource icons[CodeObjectType];
-
+
FontResource boldFont { $"Tahoma", 8.25f, bold = true, window = this };
FontResource normalFont { $"Tahoma", 8.25f, window = this };
ide.pos.text = temp;
}
if(sheet.codeEditor != this) return;
-
+
if(!updatingCode)
{
for(classItem = classes.first; classItem; classItem = classItem.next)
EditBox editBox
{
textVertScroll = true, multiLine = true, /*lineNumbers = ideSettings.showLineNumbers,*/
- freeCaret = ideSettings.useFreeCaret, caretFollowsScrolling = ideSettings.caretFollowsScrolling,
+ freeCaret = ideSettings.useFreeCaret, caretFollowsScrolling = ideSettings.caretFollowsScrolling,
tabKey = true, smartHome = true;
tabSelection = true, /*maxLineSize = 65536, */parent = this, hasHorzScroll = true, hasVertScroll = true;
selectionColor = selectionColor, selectionText = selectionText,
hide = true;
break;
}
- if(!isSpace)
+ if(!isSpace)
firstChar = false;
else if(firstChar)
{
editBox.GetCaretPosition(&caret);
-
+
// Go back in the buffer until no space before
//yydebug = true;
codeModified = true;
EnsureUpToDate();
SetYydebug(false);
- {
+ {
EditBoxStream f { editBox = editBox };
oldCharPos = x1;
x1--;
membersList.position = { x, y };
}
-
+
membersLine = l1;
membersLoc.start.line = line - 1;
membersLoc.start.charPos = oldCharPos;
}
else if(ch == ')' || ch == '}' || ch == ';')
{
- codeModified = true;
+ codeModified = true;
skipModified = true;
if(paramsShown)
InvokeParameters(false, true, false);
skipModified = false;
}
- else
+ else
{
bool back = codeModified;
codeModified = false;
{
loc = &object.instCode.loc;
- if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
+ if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
(after.y+1 > loc->end.line || (after.y+1 == loc->end.line && after.x+1 >= loc->end.charPos)))
{
object.instCode = null;
if(oClass.classDefinition)
{
loc = &oClass.classDefinition.loc;
- if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
+ if((before.y+1 < loc->start.line || (before.y+1 == loc->start.line && before.x+1 <= loc->start.charPos)) &&
(after.y+1 > loc->end.line || (after.y+1 == loc->end.line && after.x+1 >= loc->end.charPos)))
{
oClass.classDefinition = null;
designer.DroppedObject(control, object, false, classObject.instance);
sheet.AddObject(object, object.name, typeData /* className*/, true);
-
+
UpdateFormCode();
//codeModified = true;
EnsureUpToDate();
if(!node)
{
char * s;
- s = PrintString($"The ", fileName, $" file is not part of any project.\n",
+ s = PrintString($"The ", fileName, $" file is not part of any project.\n",
$"It can't be compiled.");
MessageBox { type = ok, /*parent = ide, */master = ide, text = $"File not in project error", contents = s }.Modal();
delete s;
bool OnKeyDown(Key key, unichar ch)
{
CodeEditor editor = (CodeEditor) master;
- if(key == escape || key == leftAlt || key == rightAlt ||
- (key.ctrl && key.code != left && key.code != right &&
+ if(key == escape || key == leftAlt || key == rightAlt ||
+ (key.ctrl && key.code != left && key.code != right &&
key.code != leftShift && key.code != rightShift && key.code != space))
{
bool result = true;
return result;
}
- else
+ else
return editor.editBox.OnKeyDown(key, ch);
return false;
}
Window paramsList
{
- master = this,
+ master = this,
interim = true,
clickThrough = true,
autoCreate = false,
borderStyle = contour,
cursor = null,
background = { 255,255,225 },
-
+
OnKeyDown = membersList.OnKeyDown;
/*bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
display.FontExtent(boldFont, instanceName, strlen(instanceName), &nameW, null);
totalW = functionW + nameW;
surface.TextFont(boldFont);
- }
+ }
surface.WriteText(x, y, string, strlen(string));
x += functionW + spaceW;
if(id == editor.paramsID)
surface.TextFont(boldFont);
-
+
if(methodType.methodClass)
surface.TextExtent(methodType.methodClass.name, strlen(methodType.methodClass.name), &tw, null);
{
surface.WriteText(x, y, ",", 1);
x += ((id == editor.paramsID) ? commaWB : commaW);
- }
+ }
lineW += width;
{
surface.WriteText(x, y, ",", 1);
x += ((id == editor.paramsID) ? commaWB : commaW);
- }
+ }
lineW += width;
display.FontExtent(boldFont, instanceName, strlen(instanceName), &nameW, null);
totalW = functionW + nameW + spaceW;
}
-
+
if(editor.functionType)
{
if(methodType)
paramString[0] = 0;
PrintType(param, paramString, true, true);
display.FontExtent((id == editor.paramsID || param.kind == ellipsisType) ? boldFont : font, paramString, strlen(paramString), &width, null);
- if(param.next)
+ if(param.next)
width += ((id == editor.paramsID) ? commaWB : commaW);
if(!height)
for(oClass = (classes).first, next = oClass ? oClass.next : null; oClass; oClass = next, next = next ? (next.next) : null)
{
ObjectInfo object, next;
-
+
for(object = oClass.instances.first; object; object = next)
{
next = object.next;
}
editBox.Save(f, false);
modifiedDocument = false;
-
+
delete f;
return true;
}
}
else
bmpRes = breakpointEnabled[i] ? ide.bmpBp : ide.bmpBpDisabled;
-
+
DrawLineMarginIcon(surface, bmpRes, breakpointLines[i], lineH, scrollY, boxH);
}
}
File f = FileOpen(filePath, read);
if(f)
{
- // Added this here...
+ // Added this here...
fileName = filePath;
loadingFile = true;
updatingCode = true;
}
}
}
- else
+ else
selectedPos = -1;
}
if(this.oClass)
{
ObjectInfo _class, next;
-
+
for(_class = classes.first; _class; _class = next)
{
ObjectInfo object;
next = _class.next;
-
+
for(;object = _class.instances.first;)
{
if(object.instance)
}
if(!project)
project = ide.project;
-
+
GetWorkingDir(oldWorkDir, MAX_LOCATION);
if(project)
ChangeWorkingDir(project.topNode.path);
case win32: SetSymbolsDir("obj/debug.win32"); break;
case tux: SetSymbolsDir("obj/debug.linux"); break;
case apple: SetSymbolsDir("obj/debug.apple"); break;
- }
+ }
SetIncludeDirs(null);
SetSysIncludeDirs(null);
}
}
}
}
-
+
if(!(strcmpi(mainModuleName, "instance.ec") && strcmpi(mainModuleName, "BinaryTree.ec") &&
strcmpi(mainModuleName, "dataTypes.ec") && strcmpi(mainModuleName, "OldList.ec") &&
strcmpi(mainModuleName, "String.ec") && strcmpi(mainModuleName, "BTNode.ec") &&
strcpy(symLocation, GetSymbolsDir());
PathCat(symLocation, symFile);
-
+
// if(!GetEcereImported() && !GetBuildingEcereCom())
if(!strcmp(extension, "ec") || !strcmp(extension, "eh"))
{
SetIncludeDirs(null);
SetSysIncludeDirs(null);
-
+
delete editFile;
fileInput = null;
SetFileInput(null);
if(GetAST())
{
ast = GetAST();
-
+
#ifdef _TIMINGS
startTime = GetTime();
#endif
if(eClass_GetDesigner(regClass) && !GetBuildingEcereComModule())
{
Instance instance = eInstance_New(regClass);
- ObjectInfo classObject
+ ObjectInfo classObject
{
name = CopyString(_class._class.name);
instance = instance;
FreeType(propDef.initializer.exp.destType);
propDef.initializer.exp.destType = MkClassType(propertyClass.name);
ProcessExpressionType(propDef.initializer.exp);
-
+
if(propertyClass.type == structClass || propertyClass.type == noHeadClass || propertyClass.type == normalClass)
{
Expression computed = CopyExpression(propDef.initializer.exp);
if(prop.Set)
{
if(computed.instance._class && computed.instance._class.symbol &&
- computed.instance._class.symbol.registered &&
+ computed.instance._class.symbol.registered &&
eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
{
((void (*)(void *, void *))(void *)prop.Set)(instance, computed.instance.data);
}
else
propDef.variable = true;
-
+
FreeExpression(computed);
}
else
else
{
Method method = eClass_FindMethod(regClass, id.string, this.privateModule);
- if(method && method.type == virtualMethod && propDef.initializer && propDef.initializer.type == expInitializer &&
+ if(method && method.type == virtualMethod && propDef.initializer && propDef.initializer.type == expInitializer &&
propDef.initializer.exp && propDef.initializer.exp.type == identifierExp)
{
ClassDef def;
}
}
}
- }
+ }
}
}
}
{
Instance control;
object = object ? object.next : classObject.instances.first;
- control = object.instance;
-
+ control = object.instance;
+
if(inst.members)
{
MembersInit members;
if(propertyClass)
{
ProcessExpressionType(member.initializer.exp);
-
+
if(propertyClass.type == structClass || propertyClass.type == normalClass || propertyClass.type == noHeadClass)
{
Expression computed;
if(computed)
{
ComputeExpression(computed);
-
+
if(computed.type == instanceExp && computed.isConstant && computed.isConstant)
{
if(computed.instance.data)
{
if(computed.instance._class && computed.instance._class.symbol &&
- computed.instance._class.symbol.registered &&
+ computed.instance._class.symbol.registered &&
eClass_IsDerived(computed.instance._class.symbol.registered, propertyClass))
{
((void (*)(void *, void *))(void *)prop.Set)(control, computed.instance.data);
else
member.variable = true;
}
- else if(ident && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
+ else if(ident && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
member.initializer.exp.type == memberExp) // identifierExp
{
Method method = eClass_FindMethod(instClass, ident.string, this.privateModule);
break;
}
}
- }
+ }
}
designer.PostCreateObject(object.instance, object, false, classObject.instance);
{
ObjectInfo check;
int pos = 0;
-
+
for(check = this.oClass.instances.first; check; check = check.next)
{
if(check.name && !strcmp(check.name, selectedName))
printf("Total MkExternalImport time is %.3f seconds\n\n", externalImportTotalTime);
printf("Total FindSymbol time is %.3f seconds\n\n", findSymbolTotalTime);
// printf("Total Class Members Find time is %.3f seconds\n\n", GetClassFindTime());
-
+
printf("Whole ParseCode function took %.3f seconds\n\n", GetTime() - parseCodeStart);
#endif
if(inUseDebug && ide.projectView)
Class dataType = prop.dataTypeClass;
if(!dataType)
dataType = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
-
+
if(dataType)
{
if(dataType.type == structClass)
{
void * dataForm = new0 byte[dataType.structSize];
void * dataTest = new0 byte[dataType.structSize];
-
+
((void (*)(void *, void *))(void *)prop.Get)(control, dataForm);
((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
-
+
if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
char tempString[1024] = "";
bool needClass = true;
if(*prev)
f.Printf(", ");
-
+
((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
-
+
string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
-
+
eClass_FindNextMember(_class, curClass, curMember, null, null);
if(*curMember != (DataMember)prop)
f.Printf("%s = ", prop.name);
else if(dataType.type == normalClass || dataType.type == noHeadClass)
{
void * dataForm, * dataTest;
-
+
dataForm = ((void *(*)(void *))(void *)prop.Get)(control);
dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
-
+
if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
char tempString[1024] = "";
char * string = "";
if(*prev)
f.Printf(", ");
-
+
((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
-
+
eClass_FindNextMember(_class, curClass, curMember, null, null);
if(*curMember != (DataMember)prop)
f.Printf("%s = ", prop.name);
else
{
DataValue dataForm, dataTest;
-
+
GetProperty(prop, control, &dataForm);
GetProperty(prop, test, &dataTest);
-
+
if((prop.IsSet && !prop.IsSet(test)) || ((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
{
char * string;
char tempString[1024] = "";
SetProperty(prop, test, dataForm);
-
+
if(dataType.type != bitClass)
{
bool needClass = true;
}
else
string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, &dataForm, tempString, null, &needClass);
-
+
if(string && string[0])
{
if(*prev)
Class _class;
bool lastIsMethod = true;
ObjectInfo classObject = object.oClass;
-
+
if(inst)
{
if(object.deleted)
char ch;
f.Seek(pos - position, current);
while(f.Getc(&ch))
- {
+ {
if(isspace(ch))
{
f.Seek(-1, current);
position--;
if(count > 6)
{
- toDelete += count - 6;
+ toDelete += count - 6;
count = 6;
}
- else
+ else
toAdd = 6 - count;
- break;
+ break;
}
}
if(toDelete)
}
}
- else
+ else
{
// Instance not there, create a brand new one
DeleteJunkBefore(f, position, &position);
Class instClass = eSystem_FindClass(this.privateModule, inst._class.name);
DeleteJunkBefore(f, position, &position);
-
+
// Instance already there, clear out the properties
for(members = inst.members->first; members; members = members.next)
{
else
{
Method method = eClass_FindMethod(instClass, ident.string, this.privateModule);
- if(method && method.type == virtualMethod && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
+ if(method && method.type == virtualMethod && member.initializer && member.initializer.type == expInitializer && member.initializer.exp &&
member.initializer.exp.type == memberExp /*ExpIdentifier*/)
{
if(((this.methodAction == actionDetachMethod || this.methodAction == actionReattachMethod) && this.method == method && this.selected == object) ||
position = member.loc.end.pos;
deleted = true;
}
- }
+ }
}
}
}
//f.Seek(member.loc.start.pos - position, current);
//position = member.loc.start.pos;
DeleteJunkBefore(f, member.loc.start.pos, &position);
- if(prev) f.Printf(", ");
+ if(prev) f.Printf(", ");
else if(keptMember) f.Printf(" ");
prev = false;
}
- }
-
+ }
+
if(!keptMember || !members.next)
{
char ch = 0;
f.Seek(members.loc.end.pos - position, current);
f.Getc(&ch);
-
+
if(ch == ';')
{
f.Seek(-1, current);
*/
prev = true;
lastIsMethod = false;
-
+
}
}
else
methodPresent = true;
// Delete instance method here
- if((this.methodAction == actionDeleteMethod || (this.methodAction == actionDetachMethod && this.moveAttached)) &&
+ if((this.methodAction == actionDeleteMethod || (this.methodAction == actionDetachMethod && this.moveAttached)) &&
members.function == function)
{
if(this.moveAttached && !*text)
DeleteJunkBefore(f, members.loc.start.pos, &position);
lastIsMethod = true;
- f.Printf("\n\n ");
+ f.Printf("\n\n ");
}
f.Seek(members.loc.end.pos - position, current);
memmove(*text + movedFuncIdPos + newLen, *text + movedFuncIdPos + movedFuncIdLen, *textSize - movedFuncIdPos - movedFuncIdLen + 1);
*textSize += newLen - movedFuncIdLen;
memcpy(*text + movedFuncIdPos, method.name, newLen);
-
+
// Second, tab right
{
int c;
// ADDING METHOD HERE
f.Printf("\n ");
OutputType(f, returnType, false);
-
+
f.Printf(" ");
if(dataType.thisClass)
{
if(param.next)
f.Printf(", ");
}
- f.Printf(")\n");
+ f.Printf(")\n");
f.Printf(" %c\n\n", OpenBracket);
if(control._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
{
Property propIt;
Class regClass = eSystem_FindClass(privateModule, classObject.name);
-
+
if(_class.base && _class.base.type != systemClass) OutputClassProperties(_class.base, classObject, f, test);
-
+
for(propIt = _class.membersAndProperties.first; propIt; propIt = propIt.next)
{
Property prop = eClass_FindProperty(selected.instance._class, propIt.name, privateModule);
if(prop && prop.isProperty && !prop.conversion)
{
- if(prop.Set && prop.Get && prop.dataTypeString && strcmp(prop.name, "name") && !Code_IsPropertyDisabled(classObject, prop.name) &&
+ if(prop.Set && prop.Get && prop.dataTypeString && strcmp(prop.name, "name") && !Code_IsPropertyDisabled(classObject, prop.name) &&
(!prop.IsSet || prop.IsSet(classObject.instance)))
{
Class dataType = prop.dataTypeClass;
if(!dataType)
dataType = prop.dataTypeClass = eSystem_FindClass(this.privateModule, prop.dataTypeString);
-
+
if(dataType && dataType.type == structClass)
{
void * dataForm = new0 byte[dataType.structSize];
void * dataTest = new0 byte[dataType.structSize];
-
+
((void (*)(void *, void *))(void *)prop.Get)(classObject.instance, dataForm);
((void (*)(void *, void *))(void *)prop.Get)(test, dataTest);
if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
bool needClass = true;
-
+
string = ((char * (*)(void *, void *, void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnGetString])(dataType, dataForm, tempString, null, &needClass);
((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
if(needClass)
else if(dataType && (dataType.type == normalClass || dataType.type == noHeadClass))
{
void * dataForm, * dataTest;
-
+
dataForm = ((void *(*)(void *))(void *)prop.Get)(classObject.instance);
dataTest = ((void *(*)(void *))(void *)prop.Get)(test);
-
+
if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, dataForm, dataTest))
{
char tempString[1024] = "";
char * string;
((void (*)(void *, void *))(void *)prop.Set)(test, dataForm);
-
+
if(eClass_IsDerived(classObject.instance._class, dataType) && classObject.instance == dataForm)
{
// Shouldn't go here ...
else if(dataType)
{
DataValue dataForm, dataTest;
-
+
GetProperty(prop, classObject.instance, &dataForm);
GetProperty(prop, test, &dataTest);
-
+
if(((int (*)(void *, void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnCompare])(dataType, &dataForm, &dataTest))
{
SetProperty(prop, test, dataForm);
else if(string[0])
f.Printf("\n %s%s = %s;", specify ? "property::" : "", prop.name, string);
}
- }
+ }
}
}
}
int position = 0;
char * text = null;
int textSize;
- Identifier movedFuncId;
+ Identifier movedFuncId;
int movedFuncIdLen = 0, movedFuncIdPos = 0;
ObjectInfo classObject;
// Put it in the same desktop window...
designer.PrepareTestObject(test);
-
+
//f.Printf("class %s : %s\n", classObject.name, classObject.oClass.name);
//f.Printf("%c\n\n", OpenBracket);
int back = 0;
f.Seek(classDef.blockStart.end.pos - position, current);
position = classDef.blockStart.end.pos;
-
+
for(; f.Getc(&ch); count++)
{
if(!isspace(ch))
f.Seek(-1, current);
break;
}
-
+
if(ch == '\n')
back = 0;
else
back++;
}
-
+
f.Seek(-count, current);
-
+
f.DeleteBytes(count-back);
//f.Printf("\n");
position += count-back;
bool keptMember = false;
MemberInit propDef;
MemberInit lastKept = null;
-
+
lastIsDecl = false;
DeleteJunkBefore(f, def.loc.start.pos, &position);
f.Printf("\n ");
position = propDef.loc.end.pos;
deleted = true;
}
- }
+ }
}
}
}
lastKept = propDef;
}
}
-
+
if(!keptMember)
{
char ch = 0;
int count = 0;
f.Seek(def.loc.end.pos - position - 1, current);
f.Getc(&ch);
-
+
if(ch == ';')
{
f.Seek(-1, current);
{
char ch;
int count = 0;
-
+
f.Seek(-1, current);
for(;f.Getc(&ch);)
{
{
f.Seek(def.loc.end.pos - position, current);
position = def.loc.end.pos;
- }
+ }
}
break;
}
f.Printf("\n\n ");
// Delete _class methods
- if((methodAction == actionDeleteMethod || (moveAttached && selected != classObject)) &&
+ if((methodAction == actionDeleteMethod || (moveAttached && selected != classObject)) &&
def.function == function)
{
char ch;
position = function.loc.start.pos + movedFuncIdPos + movedFuncIdLen;
}
- if((methodAction == actionAttachMethod || methodAction == actionReattachMethod) && selected == classObject && moveAttached &&
+ if((methodAction == actionAttachMethod || methodAction == actionReattachMethod) && selected == classObject && moveAttached &&
function == def.function)
{
// In case of attaching methods in the _class, simply rename the method
firstObject = false;
lastIsDecl = true;
}
- else
+ else
{
f.Printf("\n ");
lastIsDecl = false;
DeleteJunkBefore(f, position, &position);
f.Printf("\n %s = %s;\n", method.name, function.declarator.symbol.string);
}
-
+
// ********** INSTANCES ***************
for(; object; object = object.next)
{
f.Printf("\n\n");
f.Printf(" ");
OutputType(f, returnType, false);
-
+
f.Printf(" ");
if(dataType.thisClass && !dataType.classObjectType)
{
if(param.next)
f.Printf(", ");
}
- f.Printf(")\n");
+ f.Printf(")\n");
f.Printf(" %c\n\n", OpenBracket);
if(test._class._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad]) // Temp Check for DefaultFunction
if(methodName)
{
ObjectInfo object = this.selected;
-
+
if(object && object == this.oClass)
{
ClassDefinition classDef = object.oClass.classDefinition;
{
if(!testMethod.dataType)
testMethod.dataType = ProcessTypeString(testMethod.dataTypeString, false);
-
+
//if(CheckCompatibleMethod(method, testMethod.dataType, ®Class, false, selectedClass)) // this.selected == this.oClass, selectedClass))
if(CheckCompatibleMethod(method, testMethod.dataType, this.oClass.instance._class, false, selectedClass)) // this.selected == this.oClass, selectedClass))
//if(CheckCompatibleMethod(method, testMethod.dataType, ®Class, this.selected == this.oClass, FindClass(this.oClass.oClass.name)))
this.method = method;
ModifyCode();
}
- UpdateFormCode();
+ UpdateFormCode();
GoToMethod(methodName);
}
}
methodAction = actionDeleteMethod;
this.function = function;
ModifyCode();
- UpdateFormCode();
+ UpdateFormCode();
Update(null);
}
this.method = method;
this.function = function;
ModifyCode();
- UpdateFormCode();
+ UpdateFormCode();
Update(null);
}
}
{
char title[1024];
sprintf(title, $"Attach %s", function.declarator.symbol.string);
- if(MessageBox { type = yesNo, master = parent, text = title,
+ if(MessageBox { type = yesNo, master = parent, text = title,
contents = $"Method is unused. Move method inside instance?" }.Modal() == yes)
{
moveAttached = true;
this.method = method;
this.function = function;
ModifyCode();
- UpdateFormCode();
+ UpdateFormCode();
Update(null);
}
}
{
Window dialog
{
- hasClose = true, borderStyle = sizable, minClientSize = { 300, 55 },
+ hasClose = true, borderStyle = sizable, minClientSize = { 300, 55 },
master = sheet, text = $"Name detached method", background = formColor
};
Button cancelButton
strcat(name, this.methodName);
strcpy(this.methodName, name);
}
-
+
this.moveAttached = true;
}
this.method = method;
this.function = function;
ModifyCode();
- UpdateFormCode();
+ UpdateFormCode();
Update(null);
}
}
ObjectInfo check;
sprintf(name, "%c%s%d", tolower(instance._class.name[0]), instance._class.name+1, id);
- // if(strcmp(name, this.oClass.instance.name))
-
+ // if(strcmp(name, this.oClass.instance.name))
+
{
for(check = oClass.instances.first; check; check = check.next)
- if(!check.deleted && check.name && !strcmp(name, check.name))
+ if(!check.deleted && check.name && !strcmp(name, check.name))
break;
if(!check)
{
break;
}
}
- }
+ }
toolBox.controlClass = null;
ModifyCode();
ObjectInfo select = object;
for(;;)
- {
+ {
select = select.prev;
- if(!select)
+ if(!select)
{
if(looped) break;
select = object.oClass.instances.last;
BitmapResource bitmap = null;
if(!subMember.dataType)
subMember.dataType = ProcessTypeString(subMember.dataTypeString, false);
-
+
if(subMember.dataType && subMember.dataType.kind == classType && subMember.dataType._class)
{
char * bitmapName = (char *)eClass_GetProperty(subMember.dataType._class.registered, "icon");
else if(member.name && !membersList.FindString(member.name))
{
DataRow row = membersList.AddString(member.name);
-
+
BitmapResource bitmap = null;
if(!member.dataType)
member.dataType = ProcessTypeString(member.dataTypeString, false);
-
+
if(member.dataType && member.dataType.kind == classType && member.dataType._class)
{
char * bitmapName = (char *)eClass_GetProperty(member.dataType._class.registered, "icon");
else if(member.name && (!curString || strcmp(curString, member.name)))
{
DataRow row = membersList.AddString(member.name);
-
+
BitmapResource bitmap = null;
if(!member.dataType)
member.dataType = ProcessTypeString(member.dataTypeString, false);
-
+
if(member.dataType && member.dataType.kind == classType && member.dataType._class)
{
char * bitmapName = (char *)eClass_GetProperty(member.dataType._class.registered, "icon");
if(type && (type.kind == classType || type.kind == structType || type.kind == unionType))
{
Class _class;
-
+
if(type.kind == classType)
{
if(type._class)
{
DataRow row = membersList.FindSubString(string);
if(!row)
- listedEnums = false;
+ listedEnums = false;
}
-
+
if(!insideClass && exp && exp.destType && exp.destType.kind == functionType && GetThisClass())
{
ListClassMembersMatch(GetThisClass(), exp.destType);
Symbol symbol = null;
{
if(GetThisClass())
- {
+ {
ListClassMembers(GetThisClass(), false);
}
{
row.icon = icons[typeEnumValue];
}
- else
+ else
{
BitmapResource bitmap = null;
if(symbol.type && symbol.type.kind == classType && symbol.type._class && symbol.type._class)
{
row.icon = icons[typeEnumValue];
}
- else
+ else
{
BitmapResource bitmap = null;
if(data.dataType && data.dataType.kind == classType && data.dataType._class && data.dataType._class)
OutputType(f, returnType, false);
f.Printf(" ");
-
+
if(dataType.thisClass && !dataType.classObjectType && (!isInstance || !insideClass || !eClass_IsDerived(insideClass, dataType.thisClass.registered)))
{
if(dataType.thisClass.shortName)
f.Printf(", ");
}
}
- f.Printf(")\n");
+ f.Printf(")\n");
if(extraIndent) f.Printf(" ");
f.Printf(" %c\n", OpenBracket);
f.Printf("\n");
- if(!_class ||
+ if(!_class ||
(
(isInstance ? _class : _class.base)._vTbl[method.vid] == moduleClass._vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Module_OnLoad] ||
(isInstance ? _class : _class.base)._vTbl[method.vid] == DummyMethod)) // Temp Check for DefaultFunction
}
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
- {
+ {
EditBoxStream f { editBox = editBox };
updatingCode = true;
else if(!pointer)
{
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
- {
+ {
EditBoxStream f { editBox = editBox };
char ch = 0;
editBox.SetSelPos(l1, y1, idStart.charPos-1, l2, y2, idStart.charPos-1);
editBox.GetCaretPosition(caret);
editBox.SetSelPos(l1, y1, x1, l2, y2, x2);
-
+
membersList.master = this;
caret.y += editBox.GetCaretSize();
}
if(row)
membersList.SetScrollPosition(0, row.index * membersList.rowHeight);
- }
+ }
}
}
}
EnsureUpToDate();
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
- {
+ {
EditBoxStream f { editBox = editBox };
char ch;
delete f;
updatingCode = false;
}
-
+
charPos = Min(charPos, l1.count + 1);
if(!caretMove)
FindParamsTree(ast, lineNum, charPos);
if(this.functionType != ::functionType || this.instanceType != ::instanceType)
reposition = false;
- if(!this.paramsShown || reposition || paramsInsideExp != functionExp || ::instanceType) // Added instanceType here, otherwise instance popups never reposition...
+ if(!this.paramsShown || reposition || paramsInsideExp != functionExp || ::instanceType) // Added instanceType here, otherwise instance popups never reposition...
// ( Dummy exp: always ends up with same memory)
{
editBox.GetSelPos(&l1, &y1, &x1, &l2, &y2, &x2, false);
int nameLen = strlen(name);
Bitmap icon = bitmap ? bitmap.bitmap : editor.icons[type].bitmap;
-
+
textOffset = this.indent * indent + (icon ? (/*icon.width + 4*/ 20) : 0);
if(overriden || object)
surface.TextFont(editor.boldFont.font);
{
deleteBtn.Destroy(0);
delete deleteBtn;
- }
+ }
if(detachBtn)
{
detachBtn.Destroy(0);
void CodeAddObject(Instance instance, ObjectInfo * object)
{
- codeEditor.AddObject(instance, object);
+ codeEditor.AddObject(instance, object);
}
void SheetAddObject(ObjectInfo object)
{
((IDEWorkSpace)master).toolBox.AddControl(_class);
}
-
+
void AddDefaultMethod(Instance instance, Instance classInstance)
{
Class _class = instance._class;
void SelectObjectFromDesigner(ObjectInfo object)
{
- codeEditor.SelectObjectFromDesigner(object);
+ codeEditor.SelectObjectFromDesigner(object);
}
borderStyle = sizable;
categorized.disabled = true;
methods.Activate();
-
+
// ((IDEWorkSpace)master).SheetSelected(Methods);
return true;
}
{
CodeObject object = control.GetData(methodName);
if(object)
- codeEditor.AddMethod(object.method);
+ codeEditor.AddMethod(object.method);
return false;
}
this, bevelOver = true, checked = true, inactive = true, position = { 0, 25 }, size = { 24, 24 };
bitmap = { "<:ecere>elements/orderCategorized.png" };
// isRadio = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(!categorized.checked)
dropBox.Clear();
dropField.userData = codeEditor;
methodName.userData = codeEditor;
-
+
if(codeEditor)
codeEditor.EnumerateObjects(this);
}
else if(key == escape)
{
Window activeClient = ide.activeClient;
- if(activeClient)
+ if(activeClient)
activeClient.Activate();
- else
+ else
ide.RepositionWindows(true);
}
return true;
{
DataRow row = dropBox.currentRow;
ObjectInfo selected = row ? (ObjectInfo)row.tag : null;
-
+
//int scroll = 0;
bool categorized = this.categorized.checked;
bool currentRow = false;
char * propName;
while(propRow && propRow.parent && !propRow.parent.isHeader)
propRow = row.parent;
-
+
propName = propRow.GetData(propertyName);
strcpy(this.selectedProp, propName);
selectedScroll = properties.scroll.y;
if(propIt.isProperty)
{
Property prop = eClass_FindProperty(selected.instance._class, propIt.name, GetPrivateModule());
-
+
if(prop && prop.Set && prop.Get && prop.compiled && (!prop.category || strcmpi(prop.category, $"Deprecated")))
{
bool disabled = Code_IsPropertyDisabled(selected, prop.name);
if(!strcmp(_class.name, "DesignerBase"))
disabled = true;
- bold = !disabled && Code_IsPropertyModified(test, selected, prop);
+ bold = !disabled && Code_IsPropertyModified(test, selected, prop);
if(dataType)
{
Category category = categories.FindName(name, false);
// Hide properties like this for now..
- if(name && !strcmp(name, "Private"))
+ if(name && !strcmp(name, "Private"))
{
delete info;
continue;
if(!dataType.noExpansion && (dataType.type == structClass || dataType.type == normalClass || dataType.type == noHeadClass || dataType.type == bitClass))
{
DataMember member;
-
+
if(clear)
row.collapsed = true;
}
else
subRow = row.FindRow((int64)subProp);
-
+
subRow.SetData(propertyName, subProp.name);
subRow.SetData(propertyValue, info);
}
if(!properties.currentRow)
{
bool found = false;
-
+
for(_class = selected.instance._class; _class; _class = _class.base)
{
Property prop;
row = category ? (categorized ? category.row.FindRow((int64)prop) : properties.FindRow((int64)prop)) : null;
properties.currentRow = row;
found = true;
- break;
+ break;
}
}
}
}
row = (DataRow)dropBox.AddRowAfter(after);
-
+
row.tag = (int64)object;
- codeObject =
+ codeObject =
{
object = object;
name = name;
codeObject.bitmap = { bitmap };
AddResource(codeObject.bitmap);
}
-
+
row.SetData(null, codeObject);
if(select)
if(row)
{
CodeObject codeObject = row.GetData(null);
-
+
if(codeObject.bitmap)
RemoveResource(codeObject.bitmap);
dropBox.DeleteRow(row);
Property prop = propertyPtr ? propertyPtr.prop : null;
Instance object = this.object;
if(prop)
- {
+ {
Class dataType = prop.dataTypeClass;
if(!dataType)
dataType = prop.dataTypeClass = eSystem_FindClass(codeEditor.privateModule, prop.dataTypeString);
else
{
SetPropValue(prop, object, (uint32)setValue);
- }
+ }
Code_FixProperty(propertyPtr.prop, object);
properties.Update(null);
ClassFunction function = (ClassFunction)selection.id;
CodeObject object = methods.GetData(methodName);
if(object)
- codeEditor.AddMethod(object.method);
+ codeEditor.AddMethod(object.method);
return true;
}
{
DataRow row = (DataRow)button.id;
CodeObject object = row.GetData(methodName);
- codeEditor.AddMethod(object.method);
+ codeEditor.AddMethod(object.method);
return true;
}
void CreateButtons(CodeObject codeObject, int y, int h, DataRow row)
{
BitmapResource bitmap;
-
+
if(codeObject.overriden)
{
if(codeObject.overriden == 1)
sprintf(title, $"Delete %s", codeObject.name);
if(MessageBox
{
- master = parent, type = okCancel, text = title,
+ master = parent, type = okCancel, text = title,
contents = $"Method still contains code. Are you sure you want to delete it?"
}.Modal() == ok)
confirmation = false;
if(codeObject.overriden == 2 || !codeObject.function.attached.count)
{
- codeObject.detachBtn = Button
+ codeObject.detachBtn = Button
{
methods,
master = methods.master,
PopupMenu popupMenu;
Menu menu { };
-
+
for(compatible = object.compatible.first; compatible; compatible = compatible.next)
{
ClassFunction function = compatible.data;
attachMethod = object.method;
popupMenu = PopupMenu
- {
- master = this, menu = menu,
+ {
+ master = this, menu = menu,
position =
{
button.absPosition.x - app.desktop.position.x,
{
DataMember member;
for(member = _class.membersAndProperties.first; member; member = member.next)
- {
+ {
Class memberType = member.dataTypeClass;
if(!memberType)
memberType = member.dataTypeClass = eSystem_FindClass(((Designer)GetActiveDesigner()).codeEditor.privateModule, member.dataTypeString);
surface.TextFont(font.font);
if(disabled)
- {
+ {
surface.SetBackground(Color { 170, 170, 170 });
surface.Area(0,0, x+width-1, y+100);
}
Module module = ((Designer)GetActiveDesigner()).codeEditor.privateModule;
if(!dataType)
dataType = prop.dataTypeClass = eSystem_FindClass(module, prop.dataTypeString);
-
+
if(dataType && prop.Get)
{
void * dataPtr, * data = null, * subData = null;
DataValue valueData, valueSubData;
uint64 bitValue;
-
+
// Get main prop
if(dataType.type == structClass)
{
else
dataPtr = &valueData;
}
-
+
// Get sub prop
if(this.subMember)
{
{
Window editData = null;
Property prop = this.prop;
-
+
dataBox.SetData = Sheet::EditSetData;
if(prop && prop.dataTypeString && !this.disabled)
{
void * dataPtr, * data = null, * subData = null;
DataValue valueData, valueSubData;
uint64 bitValue;
-
+
// Get main prop
if(dataType.type == structClass)
{
else
dataPtr = &valueData;
}
-
+
// Get sub prop
if(this.subMember)
{
if(!category1) category1 = $"Misc";
if(!category2) category2 = $"Misc";
-
+
if(!prop)
{
// result = String::OnCompare((String)category1, (String)category2);
if(!mainDataType)
mainDataType = prop.dataTypeClass = eSystem_FindClass(((Designer)GetActiveDesigner()).codeEditor.privateModule, prop.dataTypeString);
dataType = mainDataType;
-
+
// Prepare main prop
if(dataType.type == structClass)
{
else if(dataType.type == normalClass || dataType.type == noHeadClass)
{
dataPtr = &valueData;
-
+
if(this.subMember || this.subProperty)
{
Class _class;
}
else
{
-
+
if(this.subMember || this.subProperty)
GetProperty(prop, object, &valueData);
-
+
dataPtr = &valueData;
propObject = &valueData;
}
-
+
// Prepare sub prop
if(this.subMember)
{
{
Property subProperty = this.subProperty;
Class subDataType = subProperty.dataTypeClass;
-
+
if(!subDataType)
- subDataType = subProperty.dataTypeClass =
+ subDataType = subProperty.dataTypeClass =
eSystem_FindClass(((Designer)GetActiveDesigner()).codeEditor.privateModule, subProperty.dataTypeString);
if(!subProperty.Get) subDataType = null;
if(subDataType)
((void(*)(void *,byte))(void *)this.subProperty.Set)(propObject, valueSubData.uc);
else if(!strcmp(dataType.dataTypeString, "uint16"))
((void(*)(void *,uint16))(void *)this.subProperty.Set)(propObject, valueSubData.us);
- else
+ else
((void (*)(void *, uint))(void *)this.subProperty.Set)(propObject, valueSubData.ui);
}
else
{
set
{
- if(value != selectedClass ||
+ if(value != selectedClass ||
(value && value.instance && (!selectedClass.instance || selectedClass.instance._class != value.instance._class)))
{
Button control, next;
{
((Designer)GetActiveDesigner()).isDragging = false;
ReleaseCapture();
- return rootWindow.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonUp,
+ return rootWindow.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonUp,
x + absPosition.x + clientStart.x, y + absPosition.y + clientStart.y, &mods, false, false);
}
return true;
static bool InsideIncl(Location loc, int line, int charPos)
{
- return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
+ return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
(loc.end.line > line || (loc.end.line == line && loc.end.charPos >= charPos));
}
static bool Inside(Location loc, int line, int charPos)
{
- return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
+ return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
(loc.end.line > line || (loc.end.line == line && loc.end.charPos > charPos));
}
static bool InsideEndIncl(Location loc, int line, int charPos)
{
- return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
+ return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
(loc.end.line > line || (loc.end.line == line && loc.end.charPos >= charPos));
}
case bracketsExp:
{
Expression expression;
-
+
for(expression = exp.list->first; expression; expression = expression.next)
{
if(InsideIncl(&expression.loc, line, charPos))
idResult = FindCtxExpression(exp.index.exp, line, charPos);
if(idResult) return idResult;
}
-
+
for(expression = exp.index.index->first; expression; expression = expression.next)
{
if(InsideIncl(&expression.loc, line, charPos))
idResult = FindCtxExpression(exp.call.exp, line, charPos);
if(idResult) return idResult;
}
-
+
if(exp.call.argLoc.start.line > line || (line == exp.call.argLoc.start.line && exp.call.argLoc.start.charPos >= charPos))
arg = -1;
- else
+ else
arg = 0;
if(exp.call.arguments)
Expression expression;
ctxInsideExp = null;
-
+
for(expression = exp.call.arguments->first; expression; expression = expression.next)
{
if(InsideIncl(&expression.loc, line, charPos) || (expression.loc.end.line > line || (line == expression.loc.end.line && expression.loc.end.charPos > charPos)))
{
if(Inside(&expression.loc, line, charPos))
idResult = FindCtxExpression(expression, line, charPos);
-
+
// Break
break;
}
return idResult ? idResult : (void *)-1;
}
}
- if(idResult)
+ if(idResult)
return idResult;
}
break;
case dummyExp:
return (void *)-2;
}
-
+
if(exp.destType && !exp.destType.truth) // && !exp.addedThis)
return (void *)-1;
-
+
ctxInsideExp = oldExp;
return null;
}
idResult = FindCtxStatement(stmt.forStmt.init, line, charPos);
if(idResult) return idResult;
}
-
+
if(stmt.forStmt.check && InsideIncl(&stmt.forStmt.check.loc, line, charPos))
{
idResult = FindCtxStatement(stmt.forStmt.check, line, charPos);
if(idResult) return idResult;
}
-
+
if(stmt.forStmt.increment)
{
for(exp = stmt.forStmt.increment->first; exp; exp = exp.next)
if(stmt.expressions)
{
Expression exp;
-
+
for(exp = stmt.expressions->first; exp; exp = exp.next)
{
if(InsideIncl(&exp.loc, line, charPos))
{
Initializer init;
Identifier idResult;
-
+
for(init = initializer.list->first; init; init = init.next)
{
if(InsideIncl(&init.loc, line, charPos))
static Identifier FindCtxDeclaration(Declaration decl, int line, int charPos)
{
Identifier idResult;
-
+
switch(decl.type)
{
case structDeclaration:
if(d.type == DeclaratorStruct && d.declarator && d.declarator.type == DeclaratorIdentifier)
return d.declarator.identifier;
}
- }
+ }
}
*/
break;
idResult = FindCtxInitDeclarator(d, line, charPos);
if(idResult) return idResult;
}
- }
+ }
}
break;
}
if(func.body && Inside(&func.body.loc, line, charPos))
{
Identifier idResult;
-
+
Identifier id = GetDeclId(func.declarator);
Symbol symbol = func.declarator.symbol;
Type type = symbol.type;
MembersInit init;
MemberInit memberInit;
for(init = inst.members->first; init; init = init.next)
- {
+ {
if(init.loc.start.line > line || (line == init.loc.start.line && init.loc.start.charPos > charPos))
break;
if(func.body && Inside(&func.body.loc, line, charPos))
{
Identifier idResult;
-
+
Identifier id = GetDeclId(func.declarator);
Symbol symbol = func.declarator ? func.declarator.symbol : null;
Type type = symbol ? symbol.type : null;
{
switch(external.type)
{
- case functionExternal:
+ case functionExternal:
if(Inside(&external.loc, line, charPos))
{
idResult = FindCtxFunction(external.function, line, charPos);
return (idResult == (void *)-1 || idResult == (void *)-2) ? null : idResult;
}
break;
- case declarationExternal:
+ case declarationExternal:
if(InsideIncl(&external.loc, line, charPos))
{
idResult = FindCtxDeclaration(external.declaration, line, charPos);
return (idResult == (void *)-1 || idResult == (void *)-2) ? null : idResult;
}
break;
- case classExternal:
+ case classExternal:
if(Inside(&external._class.loc, line, charPos))
{
currentClass = external._class.symbol.registered;
static bool Inside(Location loc, int line, int charPos)
{
- return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
+ return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
(loc.end.line > line || (loc.end.line == line && loc.end.charPos >= charPos));
}
}
break;
case identifierExp:
-
+
break;
case instanceExp:
if(Inside(&exp.instance.loc, line, charPos))
case bracketsExp:
{
Expression expression;
-
+
for(expression = exp.list->first; expression; expression = expression.next)
{
if(Inside(&expression.loc, line, charPos))
expResult = FindExpExpression(exp.index.exp, line, charPos);
if(expResult) return expResult;
}
-
+
for(expression = exp.index.index->first; expression; expression = expression.next)
{
if(Inside(&expression.loc, line, charPos))
expResult = FindExpExpression(exp.call.exp, line, charPos);
if(expResult) return expResult;
}
-
+
if(exp.call.arguments)
{
Expression expression;
expResult = FindExpStatement(stmt.forStmt.init, line, charPos);
if(expResult) return expResult;
}
-
+
if(stmt.forStmt.check && Inside(&stmt.forStmt.check.loc, line, charPos))
{
expResult = FindExpStatement(stmt.forStmt.check, line, charPos);
if(expResult) return expResult;
}
-
+
if(stmt.forStmt.increment)
{
for(exp = stmt.forStmt.increment->first; exp; exp = exp.next)
if(stmt.expressions)
{
Expression exp;
-
+
for(exp = stmt.expressions->first; exp; exp = exp.next)
{
if(Inside(&exp.loc, line, charPos))
}
}
}
- break;
+ break;
}
}
return null;
{
Initializer init;
Expression expResult;
-
+
for(init = initializer.list->first; init; init = init.next)
{
if(Inside(&init.loc, line, charPos))
static Expression FindExpDeclaration(Declaration decl, int line, int charPos)
{
Expression expResult;
-
+
switch(decl.type)
{
case structDeclaration:
expResult = FindExpInitDeclarator(d, line, charPos);
if(expResult) return expResult;
}
- }
+ }
}
break;
}
if(func.body && Inside(&func.body.loc, line, charPos))
{
Expression result;
-
+
Identifier id = GetDeclId(func.declarator);
Symbol symbol = func.declarator.symbol;
Type type = symbol.type;
if(func.body && Inside(&func.body.loc, line, charPos))
{
Expression result;
-
+
Identifier id = GetDeclId(func.declarator);
Symbol symbol = func.declarator ? func.declarator.symbol : null;
Type type = symbol?symbol.type:null;
{
switch(external.type)
{
- case functionExternal:
+ case functionExternal:
expResult = FindExpFunction(external.function, line, charPos);
if(expResult)
return expResult;
break;
- case declarationExternal:
+ case declarationExternal:
expResult = FindExpDeclaration(external.declaration, line, charPos);
if(expResult)
return expResult;
break;
- case classExternal:
+ case classExternal:
currentClass = external._class.symbol.registered;
expResult = FindExpClass(external._class, line, charPos);
currentClass = null;
static bool InsideIncl(Location loc, int line, int charPos)
{
/*
- return (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
+ return (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
(loc.end.line > line || (loc.end.line == line && loc.end.charPos >= charPos));
*/
- return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
+ return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos <= charPos)) &&
(loc.end.line > line || (loc.end.line == line && loc.end.charPos >= charPos));
}
static bool Inside(Location loc, int line, int charPos)
{
- return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
+ return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
(loc.end.line > line || (loc.end.line == line && loc.end.charPos > charPos));
}
static bool InsideEndIncl(Location loc, int line, int charPos)
{
- return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
+ return !loc.start.included && (loc.start.line < line || (loc.start.line == line && loc.start.charPos < charPos)) &&
(loc.end.line > line || (loc.end.line == line && loc.end.charPos >= charPos));
}
case bracketsExp:
{
Expression expression;
-
+
for(expression = exp.list->first; expression; expression = expression.next)
{
if(InsideIncl(&expression.loc, line, charPos))
idResult = FindParamsExpression(exp.index.exp, line, charPos);
if(idResult) return idResult;
}
-
+
for(expression = exp.index.index->first; expression; expression = expression.next)
{
if(InsideIncl(&expression.loc, line, charPos))
if(!functionType && !instanceType)
{
functionType = type;
- if(paramsInsideExp == exp.call.exp)
+ if(paramsInsideExp == exp.call.exp)
paramsInsideExp = exp;
}
if(idResult) return idResult;
}
-
+
if(exp.call.argLoc.start.line > line || (line == exp.call.argLoc.start.line && exp.call.argLoc.start.charPos >= charPos))
arg = -1;
- else
+ else
arg = 0;
if(exp.call.arguments)
idResult = FindParamsStatement(stmt.forStmt.init, line, charPos);
if(idResult) return idResult;
}
-
+
if(stmt.forStmt.check && InsideIncl(&stmt.forStmt.check.loc, line, charPos))
{
idResult = FindParamsStatement(stmt.forStmt.check, line, charPos);
if(idResult) return idResult;
}
-
+
if(stmt.forStmt.increment)
{
for(exp = stmt.forStmt.increment->first; exp; exp = exp.next)
if(stmt.expressions)
{
Expression exp;
-
+
for(exp = stmt.expressions->first; exp; exp = exp.next)
{
if(InsideIncl(&exp.loc, line, charPos))
{
Initializer init;
Identifier idResult;
-
+
for(init = initializer.list->first; init; init = init.next)
{
if(InsideIncl(&init.loc, line, charPos))
static Identifier FindParamsDeclaration(Declaration decl, int line, int charPos)
{
Identifier idResult;
-
+
switch(decl.type)
{
case structDeclaration:
idResult = FindParamsInitDeclarator(d, line, charPos);
if(idResult) return idResult;
}
- }
+ }
}
break;
}
if(func.body && Inside(&func.body.loc, line, charPos))
{
Identifier idResult;
-
+
Identifier id = GetDeclId(func.declarator);
Symbol symbol = func.declarator.symbol;
Type type = symbol.type;
}
if(!insideParams && sym && sym.registered && InsideIncl(&inst.insideLoc, line, charPos) && insideBrackets && !insideSomething)
{
- if(dataMember && !method)
+ if(dataMember && !method)
{
if(!dataMember.dataType)
dataMember.dataType = ProcessTypeString(dataMember.dataTypeString, false);
if(func.body && Inside(&func.body.loc, line, charPos))
{
Identifier idResult;
-
+
Identifier id = GetDeclId(func.declarator);
Symbol symbol = func.declarator ? func.declarator.symbol : null;
Type type = symbol ? symbol.type : null;
{
switch(external.type)
{
- case functionExternal:
+ case functionExternal:
if(Inside(&external.loc, line, charPos))
{
idResult = FindParamsFunction(external.function, line, charPos);
return (idResult == (void *)-1) ? null : idResult;
}
break;
- case declarationExternal:
+ case declarationExternal:
if(InsideIncl(&external.loc, line, charPos))
{
idResult = FindParamsDeclaration(external.declaration, line, charPos);
return true;
}*/
};
-
+
Button cancel
{
this, size = { 80 }, position = { 480, 8 };
text = $"Compilers Detection";
CompilerType selectedCompilerType;
-
+
//property Array<NamedString> compilerEnvVars
property CompilerConfig compilerConfig
{
equal[0] = '\0';
TrimLSpaces(var, var);
TrimRSpaces(var, var);
- if(!strcmpi(var, "VSINSTALLDIR") || !strcmpi(var, "VCINSTALLDIR") ||
- !strcmpi(var, "FrameworkDir") || !strcmpi(var, "FrameworkVersion") || !strcmpi(var, "FrameworkSDKDir") ||
+ if(!strcmpi(var, "VSINSTALLDIR") || !strcmpi(var, "VCINSTALLDIR") ||
+ !strcmpi(var, "FrameworkDir") || !strcmpi(var, "FrameworkVersion") || !strcmpi(var, "FrameworkSDKDir") ||
!strcmpi(var, "DevEnvDir") || !strcmpi(var, "LIBPATH"))
{
result.environmentVars.Add(NamedString { name = CopyString(var), string = CopyString(val) });
return true;
}
};
-
+
Button
{
this, hotKey = escape, text = $"Cancel";
tabCycle = true;
size = { 440, 208 };
autoCreate = false;
-
+
public:
property char * searchString { set { findContent.contents = value; } get { return findContent.contents; } };
property bool contentWholeWord { set { contentWholeWord.checked = value; } get { return contentWholeWord.checked; } };
return true;
}
};
-
+
SearchThread searchThread { findDialog = this };
FileDialog fileDialog { master = this, type = selectDir, text = $"Select Search Location..." };
findWhere.disabled = disabled;
subDirs.disabled = disabled;*/
-
+
findContent.Activate();
return true;
}
void SearchStart()
{
char text[2048];
-
+
searchThread.active = true;
searchThread.project = null;
searchThread.projectNode = null;
//searchThread.nameWholeWord = nameWholeWord.checked;
searchThread.contentMatchCase = contentMatchCase.checked;
searchThread.contentWholeWord = contentWholeWord.checked;
-
+
searchThread.filter = filters[fileFilter];
strcpy(searchThread.nameCriteria, fileName.contents);
searchThread.replaceMode = replaceMode;
//cancel.text = "Stop";
-
+
ide.outputView.ShowClearSelectTab(find);
Destroy(0);
-
+
searchThread.Create();
}
//double lastTime = GetTime();
SearchStackFrame stack[stackSize];
FindInFilesMode mode = this.mode;
-
+
EditBox replaceEdit = null;
abort = false;
project.name, filterName, substring, and, containing);
}
app.Unlock();
-
+
if(replaceMode)
{
replaceEdit = EditBox
{
- multiLine = true,textHorzScroll = true,textVertScroll = true,
+ multiLine = true,textHorzScroll = true,textVertScroll = true,
text = $"Replacing Editbox", size = Size { 640,480 }/*,maxLineSize = 65536*/
};
}
if(mode == directory)
{
strcpy(stack[0].path, dir);
- stack[0].fileList = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false
+ stack[0].fileList = FileListing { dir, extensions = filter.extensions }; // there should be a sorted = true/false
for(frame = 0; frame >= 0 && frame < stackSize && !abort; )
{
{
MakePathRelative(stack[frame].fileList.path, dir, fileRelative);
relative = true;
-
+
filesSearchedCount++;
if(match && contentCriteria[0])
{
}
break;
case file:
- {
+ {
bool relative = true;
char fileRelative[MAX_LOCATION];
char filePath[MAX_LOCATION];
// todo
/*else
f.Seek(-strlen(contentCriteria), current);*/
-
+
}
delete f;
if(replaceCount)
IDESettings ideSettings;
IDESettingsContainer settingsContainer;
String workspaceActiveCompiler;
-
+
TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 8, right = 8, bottom = 40 } };
-
+
EditorTab editorTab { this, tabControl = tabControl };
CompilersTab compilersTab { this, tabControl = tabControl };
ProjectOptionsTab projectOptionsTab { this, tabControl = tabControl };
WorkspaceOptionsTab workspaceOptionsTab { this, tabControl = tabControl };
-
+
property bool settingsModified
{
get
bool compilerSettingsChanged = false;
bool projectOptionsChanged = false;
bool workspaceOptionsChanged = false;
-
+
if(editorTab.modifiedDocument)
{
if(editorTab.useFreeCaret.checked != ideSettings.useFreeCaret ||
editorSettingsChanged = true;
}
}
-
+
if(compilersTab.modifiedDocument)
{
Workspace workspace = ide.workspace;
projectOptionsTab.modifiedDocument = false;
workspaceOptionsTab.modifiedDocument = false;
}
-
+
Destroy(DialogResult::ok);
return true;
}
activateCompiler = readonlyCompiler;
if(!activateCompiler && ideSettings.compilerConfigs.count)
activateCompiler = ideSettings.compilerConfigs[0];
-
+
for(compiler : ideSettings.compilerConfigs)
compilersTab.AddCompiler(compiler.Copy(), compiler == activateCompiler);
compilersTab.compilerConfigsDir.path = ideSettings.compilerConfigsDir;
// ProjectOptionsTab
projectOptionsTab.defaultTargetDir.path = ideSettings.projectDefaultTargetDir;
projectOptionsTab.defaultIntermediateObjDir.path = ideSettings.projectDefaultIntermediateObjDir;
-
+
return true;
}
surface.LineStipple(0x5555);
surface.Rectangle(x1, y1, x2, y2);
- surface.LineStipple(0);
+ surface.LineStipple(0);
}
class CompilersTab : GlobalSettingsSubTab
}
return SelectorBar::OnKeyDown(key, ch);
}
-
+
bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
{
((CompilersTab)master).labelCompilers.Update(null);
};
TabControl tabControl { this, background = formColor, anchor = { left = 8, top = 68, right = 8, bottom = 8 } };
-
+
CompilerDirectoriesTab dirsTab { this, tabControl = tabControl };
CompilerToolchainTab toolchainTab { this, tabControl = tabControl };
CompilerEnvironmentTab environmentTab { this, tabControl = tabControl };
}
};
incref dirs[c];
-
+
if(c)
dirs[c].visible = false;
-
+
// (width) Should be 324 for text...
//field[c] = { dataType = class(char *), editable = true };
//dirs[c].AddField(field[c]);
else if(c == executables)
dirTypeTglBtn[c].hotKey = altE;
}
- }
+ }
currentDirs = dirs[includes];
dirTypeTglBtn[includes].checked = true;
return true;
bool OnKeyDown(Key key, unichar ch)
{
if((SmartKey)key == enter)
- {
+ {
DataBox::OnKeyDown(key, ch);
return true;
}
else
return DataBox::OnKeyDown(key, ch);
}
-
+
bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
{
if(!active)
excludedLibraries.strings = compiler.excludeLibs;
compilerFlags.strings = compiler.compilerFlags;
linkerFlags.strings = compiler.linkerFlags;
-
+
labelTargetPlatform.disabled = disabled;
targetPlatform.disabled = disabled;
};
}
-// COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
+// COMPILER TOFIX: if class GlobalSettingsSubTab is after class WorkspaceOptionsTab the OnPostCreate
// of WorkspaceOptionsTab will *not* be called!
class GlobalSettingsSubTab : Tab
{
for(compiler : dialog.ideSettings.compilerConfigs)
{
row = defaultCompilerDropBox.AddString(compiler.name);
- if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
+ if(dialog.ideSettings.defaultCompiler && dialog.ideSettings.defaultCompiler[0] &&
!strcmp(compiler.name, dialog.ideSettings.defaultCompiler))
defaultCompilerDropBox.currentRow = row;
}
parent = this, text = $"Create Form", hotKey = altF, position = { 200, 30 };
isCheckbox = true, checked = true;
};
-
+
EditBox projectName
{
parent = this, textHorzScroll = true, position = { 10, 30 }, size = { 160 };
MessageBox { type = ok, master = this, text = tempDir, contents = $"Temporary directory does not exist." }.Modal();
return true;
}
-
+
ide.tmpPrjDir = tempDir;
strcpy(filePath, tempDir);
debug = ProjectConfig
{
name = CopyString("Debug");
- options =
+ options =
{
optimization = none;
fastMath = false;
strcpy(workspaceFile, filePath);
ChangeExtension(workspaceFile, WorkspaceExtension, workspaceFile);
workspace = Workspace { compiler = ideSettings.defaultCompiler, workspaceFile = workspaceFile };
- }
+ }
workspace.projects.Add(project);
ide.findInFilesDialog.AddProjectItem(project);
return true;
}
};
-
+
Button
{
parent = this, position = { 240, 70 }, size = { 60 }, hotKey = escape, text = $"Cancel";
NotifyClicked = ButtonCloseDialog;
};
-
+
QuickProjectDialog()
{
DataRow row;
anchor = { left = 10, top = 80, right = 10 };
NotifyModified = PathNotifyModified;
};
-
+
Label absolutePathLabel { parent = this, position = { 10, 110 }, labeledWindow = absolutePath };
EditBox absolutePath
{
position = { 10, 130 }, size = { 260 }, text = $"Absolute Path";
anchor = { left = 10, top = 130, right = 10 };
};
-
+
Label nameLabel { parent = this, position = { 10, 10 }, labeledWindow = name };
EditBox name
{
set
{
Size minSize = { 280, 260 };
-
+
// name { 10, 10 } { 10, 30 }
// path { 10, 60 } { 10, 80 }
// absolutePath { 10, 110 } { 10, 130 }
}
}
- // project: - name path absolute -
+ // project: - name path absolute -
// file
- // in res: - name path absolute -
- // not: - name path absolute -
+ // in res: - name path absolute -
+ // not: - name path absolute -
// folder: - name -
// resources: - name path -
-
+
{
char * s;
text = (s = PrintString(node.name, $" Properties"));
return true;
}
};
-
+
Button cancel
{
this, size = { 80 }, position = { 480, 8 };
this, position = { 160, 8 }, size = { 220 };
text = $"Active Configuration", hotKey = altA;
};
-
+
}
text = $"Module Version", hotKey = altV;
NotifyModified = ProjectControlModified;
};
-
+
Label lcompilerConfigsDir { this, position = { 8, 96 }, labeledWindow = compilerConfigsDir };
PathBox compilerConfigsDir
{
project.description = s = description.multiLineContents; delete s;
project.license = s = license.multiLineContents; delete s;
project.compilerConfigsDir = compilerConfigsDir.path;
-
+
project.topNode.modified = true;
project.ModifiedAllConfigs(true, false, true, false);
ide.projectView.modifiedDocument = true;
diffuse = white, specular = white;
}; // light.diffuse.r = light.diffuse.g = light.diffuse.b = 1; light.specular.r = light.specular.g = light.specular.b = 1;
Window help;
-
+
Timer timer
{
userData = this, delay = 0.05;
{
if(model)
model.Animate(model.frame + 1);
-
+
Update(null);
return true;
}
};
-
+
property char * modelFile
{
set
{
//eObject_Free(model, null);
}
-
+
void OnRedraw(Surface surface)
{
surface.SetBackground(lightBlue);
{
case wheelDown: case minus: camera.position.z *= 1.1111111f; break;
case wheelUp: case equal: camera.position.z *= 0.9f; break;
-
+
/*
case minus: camera.position.z += 10; break;
case equal: camera.position.z -= 10; break;
Copyright (c) 2003 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
pictureEdit.ec - Picture Editor Control
****************************************************************************/
#ifdef ECERE_STATIC
float zoomFactor;
char fileName[MAX_LOCATION];
Bitmap bitmap;
-
+
//saveDialog = pictureEditFileDialog;
-
+
Menu fileMenu { menu, $"File", f }
MenuItem { fileMenu, $"Save", s, ctrlS, NotifySelect = MenuFileSave };
MenuItem { fileMenu, $"Save As...", a, NotifySelect = MenuFileSaveAs };
}
};
#endif
-
+
property char * bitmapFile
{
set
clientSize = size;
/*
- Move(eWindow_GetStartX(window), eWindow_GetStartY(window),
- (!eWindow_GetStartWidth(window)) ? (A_CLIENT|bitmap.width) : eWindow_GetStartWidth(window),
+ Move(eWindow_GetStartX(window), eWindow_GetStartY(window),
+ (!eWindow_GetStartWidth(window)) ? (A_CLIENT|bitmap.width) : eWindow_GetStartWidth(window),
(!eWindow_GetStartHeight(window)) ? (A_CLIENT|bitmap.height) : eWindow_GetStartHeight(window));
*/
/*
- Move(eWindow_GetStartX(window), eWindow_GetStartY(window),
- (!) ? (A_CLIENT|bitmap.width) : eWindow_GetStartWidth(window),
+ Move(eWindow_GetStartX(window), eWindow_GetStartY(window),
+ (!) ? (A_CLIENT|bitmap.width) : eWindow_GetStartWidth(window),
(!eWindow_GetStartHeight(window)) ? (A_CLIENT|bitmap.height) : eWindow_GetStartHeight(window));
*/
}
int h = (int)(bitmap.height * zoomFactor);
if(w == bitmap.width && h == bitmap.height)
{
- surface.Blit(bitmap,
- Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
+ surface.Blit(bitmap,
+ Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
scroll.x, scroll.y, w, h);
}
else
{
- surface.Filter(bitmap,
- Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
- (int)(scroll.x / zoomFactor), (int)(scroll.y / zoomFactor), w, h,
+ surface.Filter(bitmap,
+ Max(0, (clientSize.w - w) / 2), Max(0, (clientSize.h - h) / 2),
+ (int)(scroll.x / zoomFactor), (int)(scroll.y / zoomFactor), w, h,
bitmap.width, bitmap.height);
}
}
if(bitmap && zoomFactor < 25)
{
float x = 0.5f, y = 0.5f;
- if(bitmap.width * zoomFactor > clientSize.w)
+ if(bitmap.width * zoomFactor > clientSize.w)
x = scroll.x / (bitmap.width * zoomFactor - clientSize.w);
- if(bitmap.height * zoomFactor > clientSize.h)
+ if(bitmap.height * zoomFactor > clientSize.h)
y = scroll.y / (bitmap.height * zoomFactor - clientSize.h);
zoomFactor *= 1.5;
scrollArea = Size { bitmap.width * zoomFactor, bitmap.height * zoomFactor };
- scroll = Point {
- (int)(Max(0, bitmap.width * zoomFactor - clientSize.w) * x),
+ scroll = Point {
+ (int)(Max(0, bitmap.width * zoomFactor - clientSize.w) * x),
(int)(Max(0, bitmap.height * zoomFactor - clientSize.h) * y) };
Update(null);
if(bitmap && zoomFactor > 0.05)
{
float x = 0.5f, y = 0.5f;
- if(bitmap.width * zoomFactor > clientSize.w)
+ if(bitmap.width * zoomFactor > clientSize.w)
x = scroll.x / (bitmap.width * zoomFactor - clientSize.w);
- if(bitmap.height * zoomFactor > clientSize.w)
+ if(bitmap.height * zoomFactor > clientSize.w)
y = scroll.y / (bitmap.height * zoomFactor - clientSize.h);
zoomFactor /= 1.5;
scrollArea = Size { bitmap.width * zoomFactor, bitmap.height * zoomFactor };
- scroll = Point {
+ scroll = Point {
(int)(Max(0, bitmap.width * zoomFactor - clientSize.w) * x),
(int)(Max(0, bitmap.height * zoomFactor - clientSize.h) * y) };
bool result = false;
if(bitmap)
{
- if(bitmap.Save(fileName,
+ if(bitmap.Save(fileName,
((FileType *)pictureEditFileDialog.types)[pictureEditFileDialog.fileType].typeExtension, (void *) bool::true))
{
modifiedDocument = false;
}
return result;
}
-
+
PictureEdit()
{
zoomFactor = 1.0f;
double tolH = 1;
double tolS = 1;
double tolV = 1;
-
+
h = target.h - replace.h;
s = target.s / replace.s;
v = target.v / replace.v;
/* Edit options */
// Cut
- // Copy
+ // Copy
// Paste
// Undo
// Redo
BitmapResource bmpTopFrameError { ":codeMarks/topFrameError.png", window = this };
BitmapResource bmpTopFrameHalf { ":codeMarks/topFrameHalf.png", window = this };
BitmapResource bmpTopFrameHalfError { ":codeMarks/topFrameHalfError.png", window = this };
-
+
Debugger debugger { };
ProjectView projectView;
{
switch(key)
{
- case escape:
+ case escape:
if(activeBox != findBox || !ide.findInFilesDialog || !ide.findInFilesDialog.SearchAbort())
- ide.ShowCodeEditor();
+ ide.ShowCodeEditor();
break;
default:
{
}
}
};
-
+
WatchesView watchesView { parent = this };
ThreadsView threadsView
{
gotWhatWeWant = true;
}
if(gotWhatWeWant ||
- MessageBox { type = yesNo, master = this, text = $"Error opening file",
+ MessageBox { type = yesNo, master = this, text = $"Error opening file",
contents = $"Open a different file?" }.Modal() == no)
{
if(!projectView && gotWhatWeWant)
}
MenuPlacement editMenu { menu, $"Edit", e };
-
+
Menu projectMenu { menu, $"Menu"."Project", p, hasMargin = true };
MenuItem projectNewItem
{
{
if(OpenFile(ideProjectFileDialog.filePath, normal, true, projectTypes[ideProjectFileDialog.fileType].typeExtension, no, add, mods.ctrl && mods.shift))
break;
- if(MessageBox { type = yesNo, master = this, text = $"Error opening project file",
+ if(MessageBox { type = yesNo, master = this, text = $"Error opening project file",
contents = $"Add a different project?" }.Modal() == no)
{
break;
}
};
#endif
-
+
bool NotifySelectDisplayDriver(MenuItem selection, Modifiers mods)
{
//app.driver = app.drivers[selection.id];
{
this;
fileName = fileName;
-
+
void NotifyDestroyed(Window window, DialogResult result)
{
projectView = null;
text = titleECEREIDE;
-
+
AdjustMenus();
}
};
bool outputVisible = expand ? false : outputView.visible;
int topDistance = (callStackVisible || threadsVisible) ? 200 : 0;
int bottomDistance = (outputVisible || watchesVisible || breakpointsVisible) ? 240 : 0;
-
+
for(child = firstChild; child; child = child.next)
{
- if(child._class == class(CodeEditor) || child._class == class(Designer) ||
+ if(child._class == class(CodeEditor) || child._class == class(Designer) ||
child._class == class(Sheet) || child._class == class(ProjectView))
{
Anchor anchor = child.anchor;
}
else if(expand)
{
- if(child._class == class(OutputView) || child._class == class(CallStackView) || child._class == class(ThreadsView) || child._class == class(WatchesView) ||
+ if(child._class == class(OutputView) || child._class == class(CallStackView) || child._class == class(ThreadsView) || child._class == class(WatchesView) ||
child._class == class(BreakpointsView))
child.visible = false;
}
if(activeClient)
activeClient.Activate();
else if(projectView)
- {
+ {
projectView.visible = true;
projectView.Activate();
}
{
if(debugger.isActive)
{
- if(MessageBox { type = yesNo, master = ide,
- contents = $"Do you want to terminate the debugging session in progress?",
+ if(MessageBox { type = yesNo, master = ide,
+ contents = $"Do you want to terminate the debugging session in progress?",
text = title }.Modal() == no)
return true;
/*
- MessageBox msg { type = yesNo, master = ide,
- contents = "Do you want to terminate the debugging session in progress?",
+ MessageBox msg { type = yesNo, master = ide,
+ contents = "Do you want to terminate the debugging session in progress?",
text = title };
if(msg.Modal() == no)
{
{
Project project;
Workspace workspace = null;
-
+
if(FileExists(filePath))
{
if(!strcmp(extension, ProjectExtension))
findInFilesDialog.mode = FindInFilesMode::project;
findInFilesDialog.currentDirectory = ide.project.topNode.path;
-
+
{
char location[MAX_LOCATION];
StripLastDirectory(ide.project.topNode.path, location);
ChangeProjectFileDialogDirectory(location);
}
-
+
break;
}
- else
+ else
{
if(MessageBox { type = yesNo, master = this, text = $"Error opening project", contents = $"Open a different project?" }.Modal() == yes)
{
}
if(prj)
{
- MessageBox { type = ok, parent = parent, master = this, text = $"Same Project",
+ MessageBox { type = ok, parent = parent, master = this, text = $"Same Project",
contents = $"This project is already present in workspace." }.Modal();
}
else
!strcmp(extension, "jpeg") || !strcmp(extension, "png"))
{
if(FileExists(filePath))
- document = PictureEdit { hasMaximize = true, hasMinimize = true, hasClose = true, borderStyle = sizable,
- hasVertScroll = true, hasHorzScroll = true, parent = this, state = state,
+ document = PictureEdit { hasMaximize = true, hasMinimize = true, hasClose = true, borderStyle = sizable,
+ hasVertScroll = true, hasHorzScroll = true, parent = this, state = state,
visible = visible, bitmapFile = filePath, OnClose = PictureEditOnClose/*why?--GenericDocumentOnClose*/;
};
if(!document)
else if(!strcmp(extension, "3ds"))
{
if(FileExists(filePath))
- document = ModelView { hasMaximize = true, hasMinimize = true, hasClose = true, borderStyle = sizable,
- hasVertScroll = true, hasHorzScroll = true, parent = this, state = state,
+ document = ModelView { hasMaximize = true, hasMinimize = true, hasClose = true, borderStyle = sizable,
+ hasVertScroll = true, hasHorzScroll = true, parent = this, state = state,
visible = visible, modelFile = filePath, OnClose = ModelViewOnClose/*why?--GenericDocumentOnClose*/
};
workspace.UpdateOpenedFileInfo(filePath, opened);
}
}
-
+
if(!document && createIfFails != no)
{
- if(createIfFails != yes && !needFileModified &&
+ if(createIfFails != yes && !needFileModified &&
MessageBox { type = yesNo, master = this, text = filePath, contents = $"File doesn't exist. Create?" }.Modal() == yes)
createIfFails = yes;
if(createIfFails == yes || createIfFails == whatever)
editor.editBox.scroll = scroll;
editor.openedFileInfo.holdTracking = false;
}
-
+
if(needFileModified)
document.OnFileModified = OnFileModified;
document.NotifySaved = DocumentSaved;
-
+
if(isProject)
ideSettings.AddRecentProject(document.fileName);
else
ide.UpdateRecentMenus();
ide.AdjustFileMenus();
settingsContainer.Save();
-
+
return document;
}
else
SetCurrentContext(codeEditor.globalContext);
SetTopContext(codeEditor.globalContext);
SetGlobalContext(codeEditor.globalContext);
-
+
SetDefines(&codeEditor.defines);
SetImports(&codeEditor.imports);
SetActiveDesigner(codeEditor.designer);
-
+
sheet.codeEditor = codeEditor;
toolBox.codeEditor = codeEditor;
if(isCObject)
ChangeExtension(node.name, "c", nodeName);
sprintf(name, $"Compile %s", isCObject ? nodeName : node.name);
- projectCompileItem =
+ projectCompileItem =
{
copyText = true, text = name, c, ctrlF7, disabled = projectView.buildInProgress;
{
driverItems[c] = MenuItem { driversMenu, app.drivers[c], NotifySelect = NotifySelectDisplayDriver };
driverItems[c].id = c;
- driverItems[c].isRadio = true;
+ driverItems[c].isRadio = true;
}
*/
driverItems = new MenuItem[2];
#if defined(__unix__)
driverItems[0] = MenuItem { driversMenu, "X", NotifySelect = NotifySelectDisplayDriver };
driverItems[0].id = 0;
- driverItems[0].isRadio = true;
+ driverItems[0].isRadio = true;
#else
driverItems[0] = MenuItem { driversMenu, "GDI", NotifySelect = NotifySelectDisplayDriver };
driverItems[0].id = 0;
- driverItems[0].isRadio = true;
+ driverItems[0].isRadio = true;
#endif
driverItems[1] = MenuItem { driversMenu, "OpenGL", NotifySelect = NotifySelectDisplayDriver };
driverItems[1].id = 1;
- driverItems[1].isRadio = true;
+ driverItems[1].isRadio = true;
/* skinItems = new MenuItem[app.numSkins];
for(c = 0; c < app.numSkins; c++)
{
skinItems[c] = MenuItem {skinsMenu, app.skins[c], NotifySelect = NotifySelectDisplaySkin };
skinItems[c].id = c;
- skinItems[c].isRadio = true;
+ skinItems[c].isRadio = true;
}
*/
ideFileDialog.master = this;
size.h = 240;
bool moved, logging;
-
+
ListBox listBox
{
parent = this, resizable = true, hasHeader = true, alwaysEdit = true, collapseControl = true, size = { 206, 624 };
}
return true;
}
-
+
bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch)
{
if((SmartKey)key == enter)
return true;
}
};
-
+
// TODO: set field size based on font and i18n header string
// TODO: save column widths to ide settings
DataField locationField { "char *", true , width = 220, header = $"Location" };
DataField ignoreField { "char *", true , width = 80, header = $"Ignore Count" };
DataField levelField { "char *", true , width = 74, header = $"Stack Depth" };
DataField conditionField { "char *", true , width = 130, header = $"Condition" };
-
+
BreakpointsView()
{
listBox.AddField(locationField);
int lineH;
int scrollY = listBox.scroll.y;
int boxH = clientSize.h;
-
+
displaySystem.FontExtent(listBox.font.font, " ", 1, null, &lineH);
//Window::OnRedraw(surface);
ide.debugger.GetCallStackCursorLine(&error, &lineActive, &lineUser);
ide.callStackView.Update(null);
Update(null);
}
-
+
void UpdateBreakpoint(DataRow row)
{
if(row && row.tag)
row.SetData(breaksField, bp.breaks);
}
}
-
+
void Clear()
{
listBox.Clear();
bool moved, logging;
FindDialog findDialog { master = this, editBox = editBox, isModal = true, autoCreate = false, text = $"Find" };
-
+
EditBox editBox
{
parent = this, freeCaret = true, autoEmpty = true, multiLine = true, readOnly = true;
Menu editMenu { menu, $"Edit", e };
MenuItem item;
-
+
MenuItem copyItem
{
editMenu, $"Copy", c, ctrlC;
return true;
}
};
-
+
Button debugBtn
{
this, inactive = true, text = "Debug", bevelOver = true, isRadio = true, bitmap = null;
return true;
}
};
-
+
Button findBtn
{
this, inactive = true, text = "Find", bevelOver = true, isRadio = true, bitmap = null;
EditBox activeBox;
activeBox = buildBox;
-
+
LogBox buildBox
{
parent = this, freeCaret = true, autoEmpty = true, multiLine = true;
background = outputBackground;
foreground = outputText;
selectionColor = selectionColor, selectionText = selectionText;
-
+
bool NotifyDoubleClick(EditBox editBox, EditLine line, Modifiers mods)
{
OnGotoError(editBox.line.text, mods.ctrl && mods.shift);
return true;
}
};
-
+
LogBox debugBox
{
parent = this, freeCaret = true, autoEmpty = true, multiLine = true;
return true;
}
};
-
+
LogBox findBox
{
parent = this, freeCaret = true, autoEmpty = true, multiLine = true;
selectionColor = selectionColor, selectionText = selectionText;
};
#endif
-
+
Menu editMenu { menu, $"Edit", e };
MenuItem item;
if(len > 1023)
{
char * newStart, * start = entry;
-
+
while(len > 1023)
{
char backup[3];
bool moved, logging;
FindDialog findDialog { master = this, editBox = editBox, isModal = true, autoCreate = false, text = "Find" };
-
+
BitmapResource bmpCursor { ":codeMarks/cursor.png", window = this };
BitmapResource bmpCursorError { ":codeMarks/cursorError.png", window = this };
BitmapResource bmpTopFrame { ":codeMarks/topFrame.png", window = this };
Menu editMenu { menu, $"Edit", e };
MenuItem item;
-
+
MenuItem copyItem
{
editMenu, $"Copy", c, ctrlC;
int boxH = clientSize.h;
int lineNumber;
int activeThread, hitThread, signalThread;
-
+
if(OnGetThreadsInfo(&activeThread, &hitThread, &signalThread))
{
EditLine line;
bool NotifyChanged(ListBox listBox, DataRow row)
{
char * expression = row.GetData(expressionField);
-
+
if(expression && expression[0])
{
TrimLSpaces(expression, expression);
TrimRSpaces(expression, expression);
}
-
+
if(expression && expression[0])
{
row.SetData(valueField, null);
modifyVirtualArea = false,
anchor = { 0, 0, 0, 0 };
//position = { x + dataBox.absPosition.x, y + dataBox.absPosition.y };
- //size = { w, h * 4 };
+ //size = { w, h * 4 };
multiLine = true;
bool OnKeyDown(Key key, unichar ch)
void DataBox::NotifyUpdate(EditBox editBox)
{
- Modified();
+ Modified();
}
};
- dataBox.size = { w, h * 4 + 2 };
+ dataBox.size = { w, h * 4 + 2 };
if(dataBox.size.h + dataBox.position.y > dataBox.parent.clientSize.h)
dataBox.position.y = dataBox.parent.clientSize.h - dataBox.size.h;
if(dataBox.size.w + dataBox.position.x > dataBox.parent.clientSize.w)
fileNameLen += len;
path = new char[len+1];
f.Read(path, sizeof(char), len+1);
-
+
/*
fileName = new char[fileNameLen+2];
strcpy(fileName, path);
f.Read(&type, sizeof(type), 1);
f.Read(&count, sizeof(count), 1);
-
+
if(type == file)
{
nodeType = file;
if(path && path[0])
f.Printf("%s Path = %s\n", indentation, path);
}
-
+
/*if(buildExclusions.first && type != project)
{
for(item = buildExclusions.first; item; item = item.next)
f.Printf("\n");
}
*/
-
+
if(type == project && (files.count /*|| preprocessorDefs.first*/))
{
f.Printf("\n");
{
if(numOfBreaks > 1)
f.Printf("%s%d =", name, c+1);
-
+
len = 3;
itemCount = breaks[c];
for(n=offset; n<offset+itemCount; n++)
strcpy(temp, item);
StripExtension(temp);
s = temp;
- }
+ }
f.Puts(" \\\n\t$(call _L,");
usedFunction = true;
}
}
else
PathCatSlash(string, targetFileName);
-
+
switch(targetType)
{
case executable:
if(c && ((c.options && cfg.options && cfg.options.console != c.options.console) ||
(!c.options || !cfg.options)))
cfg.symbolGenModified = true;
- if(c && ((c.options && cfg.options &&
- ( (cfg.options.libraries && c.options.libraries && cfg.options.libraries.OnCompare(c.options.libraries)) || (!cfg.options.libraries || !c.options.libraries)) )
+ if(c && ((c.options && cfg.options &&
+ ( (cfg.options.libraries && c.options.libraries && cfg.options.libraries.OnCompare(c.options.libraries)) || (!cfg.options.libraries || !c.options.libraries)) )
|| (!c.options || !cfg.options)))
cfg.linkingModified = true;
ide.workspace.modified = true;
}
}
-
+
void RotateActiveConfig(bool forward, bool syncAllProjects)
{
if(configurations.first && configurations.last != configurations.first)
DynamicString windres { };
/*
- if(bitDepth == 64 && compiler.targetPlatform == win32)
+ if(bitDepth == 64 && compiler.targetPlatform == win32)
gnuToolchainPrefix = "x86_64-w64-mingw32-";
else if(bitDepth == 32 && compiler.targetPlatform == win32)
gnuToolchainPrefix = "i686-w64-mingw32-";
{
// Silence warnings for compiled eC
char * objDir = strstr(moduleName, objDirExp.dir);
-
+
if(linking)
{
if((pointer = strstr(line, "undefined")) ||
ide.outputView.buildBox.Logf("%d %s, ", numErrors, (numErrors > 1) ? $"errors" : $"error");
else
ide.outputView.buildBox.Logf($"no error, ");
-
+
if(numWarnings)
ide.outputView.buildBox.Logf("%d %s\n", numWarnings, (numWarnings > 1) ? $"warnings" : $"warning");
else
strcpy(makeFilePath, topNode.path);
CatMakeFileName(makeFile, config);
PathCatSlash(makeFilePath, makeFile);
-
+
if(compiler.type.isVC)
{
bool result = false;
char oldwd[MAX_LOCATION];
GetWorkingDir(oldwd, sizeof(oldwd));
ChangeWorkingDir(topNode.path);
-
+
// TODO: justPrint support
sprintf(command, "%s /useenv /clean /nologo /logcommands %s.sln %s|Win32", compiler.makeCommand, name, config.name);
if(justPrint)
}
void Run(char * args, CompilerConfig compiler, ProjectConfig config, int bitDepth)
- {
+ {
String target = new char[maxPathLen];
char oldDirectory[MAX_LOCATION];
char * executableLauncher = compiler.executableLauncher;
ReplaceSpaces(objDirNoSpaces, objDirExp);
ReplaceSpaces(fixedModuleName, moduleName);
-
+
//sprintf(fixedModuleName, "%s.main", fixedPrjName);
//strcat(fixedModuleName, ".main");
PathCatSlash(topNodePath, filePath);
project.filePath = topNodePath;
-
+
/* THIS IS ALREADY DONE BY filePath property
StripLastDirectory(topNodePath, topNodePath);
project.topNode.path = CopyString(topNodePath);
*/
// Shouldn't this be done BEFORE the StripLastDirectory? project.filePath = topNodePath;
-
+
// newConfig.options.defaultNameSpace = "";
/*newConfig.objDir.dir = "obj";
newConfig.targetDir.dir = "";*/
f.Read(&temp, sizeof(int),1);
project./*config.*/options.debug = temp ? true : false;
- f.Read(&temp, sizeof(int),1);
+ f.Read(&temp, sizeof(int),1);
project./*config.*/options.optimization = temp ? speed : none;
f.Read(&temp, sizeof(int),1);
project./*config.*/options.profile = temp ? true : false;
project.options.libraryDirs = { };
for(c = 0; c < count; c++)
{
- char * name;
+ char * name;
f.Read(&len, sizeof(int),1);
name = new char[len+1];
f.Read(name, sizeof(char), len+1);
}
void ProjectConfig::LegacyProjectConfigLoad(File f)
-{
+{
delete options;
options = { };
while(!f.Eof())
char * equal;
int len;
uint pos;
-
+
pos = f.Tell();
f.GetLine(buffer, 65536 - 1);
TrimLSpaces(buffer, buffer);
}
}
}
- }
+ }
}
}
if(cfg.options.targetType != staticLibrary)
{
int result;
-
+
if(type.type == noHeadClass || type.type == normalClass)
{
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
*(void **)((byte *)firstConfig.options + member.offset + member._class.offset),
*(void **)((byte *)cfg.options + member.offset + member._class.offset));
}
else
{
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
(byte *)firstConfig.options + member.offset + member._class.offset,
(byte *)cfg.options + member.offset + member._class.offset);
}
break;
}
}
- }
+ }
}
if(same)
{
if(type.type == noHeadClass || type.type == normalClass)
{
- if(!((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ if(!((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
*(void **)((byte *)firstConfig.options + member.offset + member._class.offset),
*(void **)((byte *)nullOptions + member.offset + member._class.offset)))
continue;
}
else
{
- if(!((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ if(!((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
(byte *)firstConfig.options + member.offset + member._class.offset,
(byte *)nullOptions + member.offset + member._class.offset))
continue;
}
if(!project.options) project.options = { };
-
+
/*if(type.type == noHeadClass || type.type == normalClass)
{
- ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCopy])(type,
+ ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCopy])(type,
(byte *)project.options + member.offset + member._class.offset,
*(void **)((byte *)firstConfig.options + member.offset + member._class.offset));
}
{
void * address = (byte *)firstConfig.options + member.offset + member._class.offset;
// TOFIX: ListBox::SetData / OnCopy mess
- ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCopy])(type,
+ ((void (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCopy])(type,
(byte *)project.options + member.offset + member._class.offset,
- (type.typeSize > 4) ? address :
- ((type.typeSize == 4) ? (void *)*(uint32 *)address :
- ((type.typeSize == 2) ? (void *)*(uint16*)address :
- (void *)*(byte *)address )));
+ (type.typeSize > 4) ? address :
+ ((type.typeSize == 4) ? (void *)*(uint32 *)address :
+ ((type.typeSize == 2) ? (void *)*(uint16*)address :
+ (void *)*(byte *)address )));
}*/
memcpy(
(byte *)project.options + member.offset + member._class.offset,
if(cfg.options.targetType == staticLibrary)
{
int result;
-
+
if(type.type == noHeadClass || type.type == normalClass)
{
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
*(void **)((byte *)firstConfig.options + member.offset + member._class.offset),
*(void **)((byte *)cfg.options + member.offset + member._class.offset));
}
else
{
- result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
+ result = ((int (*)(void *, void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnCompare])(type,
(byte *)firstConfig.options + member.offset + member._class.offset,
(byte *)cfg.options + member.offset + member._class.offset);
}
{
if(type.type == noHeadClass || type.type == normalClass)
{
- ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type,
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type,
*(void **)((byte *)cfg.options + member.offset + member._class.offset));
}
else
{
- ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type,
+ ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type,
(byte *)cfg.options + member.offset + member._class.offset);
}
memset((byte *)cfg.options + member.offset + member._class.offset, 0, type.typeSize);
- }
+ }
}
memset((byte *)firstConfig.options + member.offset + member._class.offset, 0, type.typeSize);
}
{
project.resNode = project.topNode.Add(project, "Resources", project.topNode.files.last, resources, archiveFile, false);
}
-
+
if(!project.moduleName)
project.moduleName = CopyString(project.name);
- if(project.config &&
+ if(project.config &&
(!project.options || !project.options.targetFileName || !project.options.targetFileName[0]) &&
(!project.config.options.targetFileName || !project.config.options.targetFileName[0]))
{
//delete project.config.options.targetFileName;
-
+
project.options.targetFileName = /*CopyString(*/project.moduleName/*)*/;
project.config.options.optimization = none;
project.config.options.debug = true;
(!postbuildCommands || !postbuildCommands.count) &&
(!installCommands || !installCommands.count))
return true;
- return false;
+ return false;
}
}
}
strcpy(pathRest, path);
for(; ofRest[0] && pathRest[0];)
{
- SplitDirectory(ofRest, ofPart, ofRest);
+ SplitDirectory(ofRest, ofPart, ofRest);
SplitDirectory(pathRest, pathPart, pathRest);
if(fstrcmp(pathPart, ofPart))
return false;
// For folders, it includes the folder it refers to. If there is a name difference between the
// file system folder and the grouping folder of the project view, it maps to that folder.
char * path;
-
+
NodeTypes type;
NodeIcons icon;
int indent;
DataRow row;
bool modified;
-
+
// This is only set for Top Nodes
Project project;
while(n && n.type != project) n = n.parent;
return n ? (*&n.project) : null;
}
- }
+ }
void RenameConfig(char * oldName, char * newName)
{
{
ProjectConfig config = c.data;
if(!strcmp(configToDelete.name, config.name))
- {
+ {
c.Remove();
delete config;
break;
result.b = exp;
}
delete exclusionInfo;
-
+
return result;
}
if(options && options.excludeFromBuild)
output[unknown] = options.excludeFromBuild;
-
+
if(config && config.options && config.options.excludeFromBuild)
output[unknown] = config.options.excludeFromBuild;
{
showConfig = false;
projectView = ide.projectView;
- }
-
+ }
+
bmp = projectView.icons[icon].bitmap;
xStart = /*indent * indent + */x + (bmp ? (bmp.width + 5) : 0);
}
}
len = strlen(label);
-
+
if(!bmp)
{
if(type == folder || type == folderOpen)
surface.TextOpacity(false);
surface.TextExtent(label, len, &w, &h);
h = Max(h, 16);
-
+
// Draw the current row stipple
if(displayFlags.selected)
//surface.Area(xStart - 1, y, xStart - 1, y + h - 1);
//surface.Area(xStart + w - 1, y, xStart + w + 1, y + h - 1);
surface.Area(xStart - 3, y, xStart + w + 1, y + h - 1);
-
+
surface.WriteTextDots(alignment, xStart, y + 2, width, label, len);
-
+
if(!app.textMode)
{
if(displayFlags.current)
}
}
}
-
+
int GenMakefilePrintNode(File f, Project project, GenMakefilePrintTypes printType,
Map<String, NameCollisionInfo> namesInfo, Array<String> items,
ProjectConfig prjConfig, bool * containsCXX)
info = namesInfo[moduleName];
collision = info ? info.IsExtensionColliding(extension) : false;
-
+
ReplaceSpaces(modulePath, path);
if(modulePath[0]) strcat(modulePath, SEPS);
if(!strcmpi(extension, "ec"))
f.Printf("$(OBJ)%s.o: $(OBJ)%s.c\n", moduleName, moduleName);
else
- f.Printf("$(OBJ)%s%s%s.o: %s%s.%s\n", moduleName,
+ f.Printf("$(OBJ)%s%s%s.o: %s%s.%s\n", moduleName,
collision ? "." : "", collision ? extension : "", modulePath, moduleName, extension);
if(!strcmpi(extension, "cc") || !strcmpi(extension, "cpp") || !strcmpi(extension, "cxx"))
f.Printf("\t$(CXX)");
{ $"Ecere IDE Workspace", WorkspaceExtension }
] };
-static char * iconNames[] =
+static char * iconNames[] =
{
"<:ecere>mimeTypes/file.png", /*genFile*/
"<:ecere>mimeTypes/textEcereWorkspace.png", /*ewsFile*/
size = { 300 };
anchor = Anchor { left = 0, top = 0, bottom = 0 };
menu = Menu { };
-
+
//hasMinimize = true;
saveDialog = projectFileDialog;
-
+
DataRow resourceRow;
BuildState buildInProgress;
BitmapResource icons[NodeIcons];
}
get { return workspace; }
}
-
+
bool drawingInProjectSettingsDialog;
bool drawingInProjectSettingsDialogHeader;
ProjectSettings projectSettingsDialog;
if(!active) Update(null);
return ListBox::OnActivate(active, previous, goOnWithActivation, direct);
}
-
+
bool NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
{
// Prevent the double click from reactivating the project view (returns false if we opened something)
{
bool na = buildInProgress; // N/A - buildMenuUnavailable
Menu pop { };
-
+
if(node.type == NodeTypes::project)
{
MenuItem mi;
MenuItem { pop, $"Properties...", p, Key { enter, alt = true }, NotifySelect = FileProperties };
}
- popupMenu =
+ popupMenu =
{
master = this, menu = pop;
position = {
- x + clientStart.x + absPosition.x - app.desktop.position.x,
+ x + clientStart.x + absPosition.x - app.desktop.position.x,
y + clientStart.y + absPosition.y - app.desktop.position.y };
void NotifyDestroyed(Window window, DialogResult result)
{
case altEnter: case Key { keyPadEnter, alt = true }:
{
- NodeProperties { parent = parent, master = this,
+ NodeProperties { parent = parent, master = this,
position = { position.x + 100, position.y + 100 }, node = node }.Create();
return false;
}
case Key { keyPadEnter, true, true }: OpenSelectedNodes(true); break;
case enter: case keyPadEnter: OpenSelectedNodes(false); break;
case del: RemoveSelectedNodes(); break;
- case escape:
+ case escape:
{
Window activeClient = ide.activeClient;
if(activeClient)
ide.watchesView.Clear();
ide.threadsView.Clear();
ide.breakpointsView.Clear();
- ide.outputView.ShowClearSelectTab(find); // why this?
+ ide.outputView.ShowClearSelectTab(find); // why this?
}
bool OnSaveFile(char * fileName)
char makefileName[MAX_LOCATION];
bool exists;
LogBox logBox = ide.outputView.buildBox;
-
+
strcpy(makefilePath, project.topNode.path);
project.CatMakeFileName(makefileName, config);
PathCatSlash(makefilePath, makefileName);
}
return false;
}
-
+
bool BuildInterrim(Project prj, BuildType buildType, CompilerConfig compiler, ProjectConfig config, int bitDepth, bool justPrint)
{
if(ProjectPrepareForToolchain(prj, normal, true, true, compiler, config))
if(row)
{
ProjectNode node = (ProjectNode)row.tag;
- NodeProperties { parent = parent, master = this, node = node,
+ NodeProperties { parent = parent, master = this, node = node,
position = { position.x + 100, position.y + 100 } }.Create();
}
return true;
}
return prj;
}
-
+
void SelectNextProject(bool backwards)
{
DataRow row = fileList.currentRow;
char command[MAX_LOCATION];
ide.SetPath(false, compiler, config, bitDepth);
-
+
GetWorkingDir(oldwd, sizeof(oldwd));
ChangeWorkingDir(project.topNode.path);
}
}
delete compiler;
- return result;
+ return result;
}
void GoToError(const char * line, const bool noParsing)
{
char * colon;
-
+
while(isspace(*line)) line++;
colon = strstr(line, ":");
if(comma)
col = atoi(comma+1);
}
-
+
{
char moduleName[MAX_LOCATION], filePath[MAX_LOCATION] = "";
char ext[MAX_EXTENSION] = "";
strcpy(filePath, project.topNode.path);
PathCatSlash(filePath, moduleName);
}
-
+
codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal, noParsing);
if(!codeEditor && !strcmp(ext, "c"))
{
row.SetData(null, node);
- if(node.files && node.files.first && node.parent &&
- !(!node.parent.parent &&
- (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
+ if(node.files && node.files.first && node.parent &&
+ !(!node.parent.parent &&
+ (!strcmpi(node.name, "notes") || !strcmpi(node.name, "sources") ||
!strcmpi(node.name, "src") || !strcmpi(node.name, "tools"))))
row.collapsed = true;
else if(node.type == folder)
for(p : ide.workspace.projects)
{
if(p.topNode.modified)
- {
+ {
modPrj = p;
break;
}
{
//bool isFolder = toNode.type == folder;
//bool isRes = toNode.isInResources;
-
+
FileDialog fileDialog = importFileDialog;
fileDialog.master = parent;
if(fileDialog.Modal() == ok)
break;
after = node;
}
-
+
if(name && name[0])
folderNode = parentNode.Add(prj, name, after, folder, folder, true);
else
Update(null);
folderNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
folderNode.row.tag = (int64)folderNode;
-
+
folderNode.row.SetData(null, folderNode);
fileList.currentRow = folderNode.row;
-
+
if(showProperties)
{
nodeProperties = NodeProperties
addThisFile = false;
else if(!exists)
{
- if(MessageBox { master = ide, type = yesNo, text = filePath,
+ if(MessageBox { master = ide, type = yesNo, text = filePath,
contents = $"File doesn't exist. Create?" }.Modal() == yes)
{
File f = FileOpen(filePath, write);
}
else
{
- MessageBox { master = ide, type = ok, text = filePath,
+ MessageBox { master = ide, type = ok, text = filePath,
contents = $"Couldn't create file."}.Modal();
addThisFile = false;
}
strcat(message, s);
strcat(message, "\n");
}
- MessageBox { master = ide, type = ok, text = $"Name Conflict",
+ MessageBox { master = ide, type = ok, text = $"Name Conflict",
contents = message }.Modal();
delete message;
}
project.ModifiedAllConfigs(true, false, false, true);
projectNode.row = parentNode.row.AddRowAfter(after ? after.row : null);
projectNode.row.tag =(int64)projectNode;
-
+
projectNode.row.SetData(null, projectNode);
fileList.currentRow = projectNode.row;
}
}
//visible = false;
- return codeEditor;
+ return codeEditor;
}
// Returns true if we opened something
{
OldList selection;
OldLink item, next;
-
+
fileList.GetMultiSelection(selection);
// Remove children of parents we're deleting
ide.workspace.modified = true;
}
}
-
+
void Activate()
{
if(trackingAllowed)
{
files.Move(it.pointer, files.GetPrev(files.GetLast()));
ide.workspace.modified = true;
- }
+ }
}
}
~OpenedFileInfo()
if(project)
{
projectDir = CopyString(project.topNode.path);
-
+
if(!project.config && activeConfig && activeConfig[0])
{
ProjectConfig cfg;
{
bool bkpts = false;
File file;
-
+
file = FileOpen(workspaceFile, write);
if(file)
{
file.Printf("Breakpoint=0,%d,%s,%s\n", bp.line, bp.absoluteFilePath, bp.relativeFilePath);
}
}
-
+
for(wh : watches)
file.Printf("Watch=%s\n", wh.expression);
-
+
for(dir : sourceDirs)
file.Printf("SourceDir=%s\n", dir);
if(debugDir && debugDir[0])
file.Printf("DebugDir=%s\n", debugDir);
-
+
if(commandLineArgs && commandLineArgs[0])
file.Printf("CommandLineArgs=%s\n", commandLineArgs);
*/
file.Printf("\nWorkspace\n");
file.Printf("\n Active Compiler = %s\n", compiler ? compiler : defaultCompilerName);
file.Printf("\n Active Bit Depth = %d\n", bitDepth);
-
+
if(projects.first)
{
file.Printf("\n Projects\n\n");
//strcat(location, ".epj");
file.Printf(" %s %s\n", "-", location);
-
+
if(prj.config)
file.Printf(" Active Configuration = %s\n", prj.config.name);
for(cfg : prj.configurations)
}
}
}
-
+
file.Printf("\n Execution Data\n");
if(commandLineArgs && commandLineArgs[0])
{
return CopyString(absolute);
}
}
-
+
return null;
}
int c, numTokens;
sourceDirs.Free();
-
+
for(s : dirs)
sourceDirs.Add(CopyString(s));
-
+
DropInvalidBreakpoints(null);
delete dirs;
}
-
+
void RemoveProject(Project project)
{
Iterator<Project> it { projects };
}
ide.breakpointsView.Update(null);
}
-
+
void Free()
{
delete workspaceFile;
delete workspaceDir;
delete commandLineArgs;
delete debugDir;
-
+
//project = null;
projects.Free();
ide.breakpointsView.Clear();
property::debugDir = "";
-
+
SetSourceDirs(sourceDirs);
}
char buffer[65536];
char * equal;
int len;
-
+
Watch wh;
Breakpoint bp;
-
+
file.GetLine(buffer, 65536 - 1);
TrimLSpaces(buffer, buffer);
TrimRSpaces(buffer, buffer);
char * strLevel = null;
char * strLine = null;
char * strFile = null;
-
+
strEnabled = equal;
if(strEnabled && strEnabled[0])
{
strFile[0] = '\0';
strFile++;
}
- if(strEnabled && strEnabled[0] && strIgnore && strIgnore[0] &&
+ if(strEnabled && strEnabled[0] && strIgnore && strIgnore[0] &&
strLevel && strLevel[0] && strLine && strLine[0] && strFile && strFile[0])
{
bool enabled;
}
}
PathCatSlash(absolutePath, equal);
-
+
if(state == closed || FileExists(absolutePath))
workspace.openedFiles.Add(OpenedFileInfo { path = CopyString(absolutePath), state = state, lineNumber = lineNumber, position = position, scroll = scroll });
else
item = openedFilesNotFound.first;
if(item.next)
strcpy(s, "s");
-
+
for(item = openedFilesNotFound.first; item; item = item.next)
{
c++;
sprintf(title, $"File%s not found", s);
sprintf(msg, $"The following file%s could not be re-opened.%s", s, files);
-
+
MessageBox { type = ok, master = ide, contents = msg, text = title }.Modal();
delete files;
else if(fromProjectFile)
{
//MessageBox { type = Ok, master = ide, contents = "Worspace load file failed", text = "Worspace Load File Error" }.Modal();
-
+
char projectFile[MAX_LOCATION];
Project newProject;
-
+
//strcpy(projectFile, filePath);
//ChangeExtension(projectFile, ProjectExtension, projectFile);
newProject = LoadProject(fromProjectFile /*projectFile*/, null);
workspace.Save();
}
}
-
+
if(workspace)
{
ide.ChangeFileDialogsDirectory(workspace.workspaceDir, false);
f.Print(""); f.Printf("\r\n");
f.Print("Microsoft Visual Studio Solution File, Format Version ", compiler.type.solutionFileVersionString); f.Printf("\r\n");
f.Print("# Visual Studio ", compiler.type.yearString); f.Printf("\r\n");
- f.Print("Project(\"{", slnGUID, "}\") = \"", projectName, "\", \"", projectName, ".",
+ f.Print("Project(\"{", slnGUID, "}\") = \"", projectName, "\", \"", projectName, ".",
compiler.type.projectFileExtension, "\", \"{", prjGUID, "}\"", attribSep); f.Printf("\r\n");
f.Print("EndProject"); f.Printf("\r\n");
f.Print("Global"); f.Printf("\r\n");
f.Print("\t\tHideSolutionNode = FALSE"); f.Printf("\r\n");
f.Print("\tEndGlobalSection"); f.Printf("\r\n");
f.Print("EndGlobal"); f.Printf("\r\n");
-
+
delete f;
}
}
f.Print(attribIndent, "/>", tagLine);
IndentPop();
f.Print(tagIndent, "</Platforms>", tagLine);
-
+
f.Print(tagIndent, "<ToolFiles>", tagLine);
f.Print(tagIndent, "</ToolFiles>", tagLine);
f.Print(attribIndent, "Filter=\"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx\"", attribSep);
f.Print(attribIndent, "UniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\"", attribSep);
f.Print(attribIndent, ">", tagLine);
-
+
PrintNodes(f, project, project.topNode, namesInfo, source, false, usePrecompiledHeaders);
IndentPop();
f.Print(tagIndent, "</Filter>", tagLine);
f.Print(attribIndent, "Filter=\"h;hpp;hxx;hm;inl;inc;xsd\"", attribSep);
f.Print(attribIndent, "UniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\"", attribSep);
f.Print(attribIndent, ">", tagLine);
-
+
PrintNodes(f, project, project.topNode, namesInfo, header, false, usePrecompiledHeaders);
IndentPop();
f.Print(tagIndent, "</Filter>", tagLine);
f.Print(attribIndent, "Filter=\"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav\"", attribSep);
f.Print(attribIndent, "UniqueIdentifier=\"{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}\"", attribSep);
f.Print(attribIndent, ">", tagLine);
-
+
PrintNodes(f, project, project.resNode, namesInfo, resource, false, usePrecompiledHeaders);
IndentPop();
f.Print(tagIndent, "</Filter>", tagLine);
f.Print(tagIndent, "<Globals>", tagLine);
f.Print(tagIndent, "</Globals>", tagLine);
-
+
IndentPop();
f.Print("</VisualStudioProject>", tagLine);
-
+
namesInfo.Free();
delete namesInfo;
delete f;
f.Print(attribIndent, "GenerateDebugInformation=\"true\"", attribSep);
f.Print(attribIndent, "SubSystem=\"1\"", attribSep);
if(optimize)
- {
+ {
f.Print(attribIndent, "OptimizeReferences=\"2\"", attribSep);
f.Print(attribIndent, "EnableCOMDATFolding=\"2\"", attribSep);
}
Platform platform = win32;
//for(platform = firstPlatform; platform <= lastPlatform; platform++)
//for(platform = win32; platform <= apple; platform++)
-
+
//for(platform = (Platform)1; platform < Platform::enumSize; platform++)
//{
PlatformOptions projectPlatformOptions = null;
IndentPush();
f.Print(attribIndent, "RelativePath=\"", relativePath, "\"", attribSep);
f.Print(attribIndent, ">", tagLine);
-
+
for(config : prj.configurations)
{
node.CollectPerFileAndDirOptions(config, perFilePreprocessorDefs, perFileIncludeDirs);
byte a = 0x20;
PrintLn((a & 0x20) == 0x20);
}
-
+
system("pause");
}
}
{
char operation = 0;
PrintLn("Chose an operation to perform: +, -, *, /, ^. q to quit.");
- do
+ do
{
char input[1024];
gets(input);
operation = input[0];
break;
default:
- PrintLn("Invalid Operation");
+ PrintLn("Invalid Operation");
}
} while(!operation);
return operation;
{
PrintLn("Print enter a valid numeric value");
gets(input);
- }
+ }
return operand;
}
double operand1, operand2;
char operation = GetOperation();
if(operation == 'q') break;
-
+
PrintLn("Enter the first operand:");
operand1 = GetOperand();
PrintLn("Enter the second operand:");
operand2 = GetOperand();
if(operation == '/' && operand2 == 0)
PrintLn("Cannot divide by 0");
- else
+ else
{
- double result = ComputeOperation(operation, operand1, operand2);
+ double result = ComputeOperation(operation, operand1, operand2);
PrintLn(operand1, " ", operation, " ", operand2, " = ", result);
}
}
{
char operation = 0;
PrintLn("Chose an operation to perform: +, -. q to quit.");
- do
+ do
{
char input[1024];
gets(input);
operation = input[0];
break;
default:
- PrintLn("Invalid Operation");
+ PrintLn("Invalid Operation");
}
} while(!operation);
return operation;
{
Print("Please enter a known color (black, red, green, blue, yellow, magenta, cyan or white)");
gets(input);
- }
+ }
return operand;
}
KnownColor operand1, operand2;
char operation = GetOperation();
if(operation == 'q') break;
-
+
PrintLn("Enter the first operand:");
operand1 = GetOperand();
PrintLn("Enter the second operand:");
{
char operation = 0;
PrintLn("Chose an operation to perform: +, -, *, /, m (module/length). q to quit.");
- do
+ do
{
char input[1024];
gets(input);
operation = input[0];
break;
default:
- PrintLn("Invalid Operation");
+ PrintLn("Invalid Operation");
}
} while(!operation);
return operation;
{
PrintLn("Print enter a valid numeric value");
gets(input);
- }
+ }
return scalar;
}
{
PrintLn("Print enter a valid 2D vector value");
gets(input);
- }
+ }
return vector;
}
float scalar;
char operation = GetOperation();
if(operation == 'q') break;
-
+
PrintLn("Enter the first operand:");
vector1 = GetVector();
}
if(operation == '/' && scalar == 0)
PrintLn("Cannot divide by 0");
- else
+ else
{
switch(operation)
{
int difficulty;
int damage;
int manaCost;
-
+
virtual void Backfire(Creature self, Creature opponent)
{
self.health -= damage/4;
class FireBall : Spell { difficulty = 20, damage = 8; manaCost = 5; };
class Lightning : Spell { difficulty = 10, damage = 4; manaCost = 3; };
-class Healing : Spell
+class Healing : Spell
{
difficulty = 20;
manaCost = 5;
int howBad = 0;
EquipmentSlot slot;
int damage;
-
+
if(where < 60)
{
slot = body;
slot = legs;
howBad = 1;
}
- else
+ else
{
slot = feet;
howBad = 1;
}
break;
}
- case realm:
+ case realm:
PrintLn("You are wandering in the realm. What would you like to do?");
PrintLn("[F]ight bad guys Visit the [S]hop [R]est St[a]ts");
if(player.xp >= 1000)
if(slot == ring)
while(player.equipment[slot] && slot < ring4)
slot++;
-
+
if(slot == rightHand && eq.twoHands)
{
if(player.equipment[EquipmentSlot::leftHand])
}
else if(player.equipment[slot])
tradeIn1 = player.equipment[slot];
-
+
tradeIn = ((tradeIn1 ? tradeIn1.value : 0) + (tradeIn2 ? tradeIn2.value : 0)) / 2;
if(player.gold + tradeIn < eq.value)
PrintLn("You do not have enough gold!");
PrintLn("gaining experience and equipment in the process. You will need to reach");
PrintLn("at least 1000 experience points to search for the sorcerer's hideout.");
PrintLn("At any time you can [Q]uit.");
- while(state != end)
+ while(state != end)
{
PrintStatus();
GetCommand();
FileGetSize(path, &dataSize);
GetLastDirectory(outputFile, fileName);
-
+
((GuiApplication)__thisModule).SignalEvent();
//((GuiApplication)__thisModule).ProcessInput();
//((GuiApplication)__thisModule).UpdateDisplay();
-
+
for(c = 0; c<dataSize && !abortInstall; c += BUFFERSIZE)
{
uint size = (dataSize > c + BUFFERSIZE) ? BUFFERSIZE : (dataSize - c);
if(requiredSize)
{
uint p = installProgress.progressBar.progress;
- ExtractFileFromArchive(installProgress.progressBar, source, path);
+ ExtractFileFromArchive(installProgress.progressBar, source, path);
}
}
if(subComponents)
Button browse
{
master = this, autoCreate = false, inactive = true, text = "...";
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
DataRow row = componentsBox.currentRow;
CheckListBox componentsBox
{
this, size = { 460, 112 }, position = { 160, 160 }, hasHeader = true;
- fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true,
+ fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true,
noDragging = true;
rowHeight = 18;
selectionColor = { 145, 150, 140 };
component->requiredSize = 0;
if(component->selected)
{
- component->requiredSize += component->size;
+ component->requiredSize += component->size;
if(component->subComponents)
for(c = 0; component->subComponents[c].name; c++)
component->requiredSize += component->subComponents[c].requiredSize;
}
else
row.UnsetData(reqField);
- if(!component->parent)
+ if(!component->parent)
{
totalSize += component->requiredSize;
{
CheckListBox optionsBox
{
this, size = { 460, 94 }, position = { 160, 284 };
- fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true,
+ fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true,
noDragging = true;
rowHeight = 18;
opacity = 0;
};
EditBox label7
{
- this, opacity = 0, borderStyle = none, inactive = true, size = { 136, 53 }, position = { 14, 280 }, noSelect = true,
+ this, opacity = 0, borderStyle = none, inactive = true, size = { 136, 53 }, position = { 14, 280 }, noSelect = true,
multiLine = true,
contents = $"Select icons to install, file\n"
"associations, and system\n"
if(component.defInstallPath)
PathCat(path, component.defInstallPath);
component.parent = parent;
-
+
row.SetData(null, CheckItem { component.name, component, (component.arch == bits32 && osIS64bit) } );
if(component.defInstallPath)
while(!FileExists(path) && path[0])
StripLastDirectory(path, path);
-
+
if(path[0])
GetFreeSpace(path, &avSize);
else
GetEnvironment("APPDATA", appData, sizeof(appData));
GetEnvironment("HOMEDRIVE", homeDrive, sizeof(homeDrive));
GetEnvironment("windir", winDir, sizeof(winDir));
-
+
componentsBox.AddField(componentField);
componentsBox.AddField(locationField);
componentsBox.AddField(reqField);
}
else
strcpy(installDir, "C:\\Ecere SDK");
-
+
if(appData && appData[0])
{
static char defSamplesPath[MAX_LOCATION];
PathCat(defExtrasPath, "Ecere SDK\\extras");
additional[extras].defInstallPath = defExtrasPath;
}
-
+
destBox.path = installDir;
{
if(!found)
{
char * start;
- if(*count)
+ if(*count)
{
strcat(userPath, ";");
start = paths[(*count)-1] + strlen(paths[(*count)-1])+1;
sprintf(keyName, "%s\\shell\\%s\\command", name, action);
RegCreateKeyEx(HKEY_CLASSES_ROOT, keyName, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, null, &key, &status);
-
+
sprintf(keyName, path);
strcat(keyName, " \"%L\"");
{
}
// Add paths
- if(pathOptions[PathOptions::AddECEREPaths].selected
+ if(pathOptions[PathOptions::AddECEREPaths].selected
#ifndef NOMINGW
|| pathOptions[PathOptions::AddMinGWPaths].selected
#endif
installProgress.installing.text = "Registering paths...";
((GuiApplication)__thisModule).Unlock();
((GuiApplication)__thisModule).SignalEvent();
-
+
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", 0, KEY_QUERY_VALUE, &systemKey) == ERROR_SUCCESS)
{
size = sizeof(wSystemPath);
RegQueryValueExW(systemKey, L"path", null, null, (byte *)wSystemPath, &size);
UTF16toUTF8Buffer(wSystemPath, systemPath, sizeof(systemPath));
}
-
+
RegCreateKeyEx(HKEY_CURRENT_USER, "Environment", 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, null, &userKey, &status);
if(status == REG_OPENED_EXISTING_KEY)
{
installProgress.installing.text = $"Resgistering File Types...";
((GuiApplication)__thisModule).Unlock();
((GuiApplication)__thisModule).SignalEvent();
-
+
if(associateOptions[AssociateOptions::AssociateEPJ].selected)
{
AssociateExtension(".epj", "Ecere IDE Project", "epj_file", "Open", idePath);
else if(key == k2) cameraObject = model.Find("Camera02");
else if(key == k3) cameraObject = model.Find("Camera03");
else if(key == k4) cameraObject = model.Find("Full Scree");
-
+
camera = cameraObject.camera;
camera.Setup(clientSize.w, clientSize.h, null);
Update(null);
Object specularLight
{
flags = { light = true; };
- light =
+ light =
{
multiplier = 1;
diffuse = white;
object.transform.scaling = { scaling, scaling, scaling };
object.material = Material
{
- opacity = 1,
+ opacity = 1,
diffuse = ColorRGB { (x + 1) / 2.0f, (y + 1) / 2.0f, (z + 1) / 2.0f };
ambient = ColorRGB { (x + 1) / 2.0f, (y + 1) / 2.0f, (z + 1) / 2.0f };
specular = white;
pitch -= (double)diffTime / 3 * pitch;
if(yaw < 0.0001) yaw = 0;
if(pitch < 0.0001) pitch = 0;
-
+
spin.yaw = yaw * signYaw;
spin.pitch = pitch * signPitch;
temp.Multiply(orientation, thisSpin);
orientation.Normalize(temp);
-
+
cube.transform.orientation = orientation;
cube.UpdateTransform();
}
cube.Create(displaySystem);
return true;
}
-
+
void OnResize(int w, int h)
{
camera.Setup(w, h, null);
}
-
+
void OnRedraw(Surface surface)
{
int x, y;
Camera camera
{
fixed,
- position = { 0, 0, -200 },
+ position = { 0, 0, -200 },
orientation = Euler { 0, 0, 0 },
fov = 53;
};
temp.Multiply(orientation, thisSpin);
orientation.Normalize(temp);
-
+
cube.transform.orientation = orientation;
cube.UpdateTransform();
Update(null);
delete textures[c];
delete group.material;
}
-
+
}
bool OnLoadGraphics()
{
char * hiragana[6] = { "あ", "い", "う", "え", "お", "ん" };
int c;
-
+
PrimitiveGroup group;
Font font;
DisplaySystem lfbSystem { };
//font = lfbSystem.LoadFont("Arial Unicode MS", 180, 0);
//font = lfbSystem.LoadFont("MingLiu", 150, 0);
font = lfbSystem.LoadFont("FreeSans.ttf", 175, 0);
-
+
for(group = cube.mesh.groups.first, c = 0; c<6; c++, group = group.next)
{
Surface surface;
int tw, th;
textures[c] = Bitmap { };
textures[c].Allocate(null, 256, 256, 0, pixelFormat888, false);
-
+
surface = textures[c].GetSurface(0,0, null);
surface.TextFont(font);
surface.SetBackground(ColorAlpha { 255/*64*/, beige });
surface.Clear(colorBuffer);
- surface.SetForeground(ColorAlpha { 255/*128*/, ColorHSV { 60 * c, 100, 50 }});
+ surface.SetForeground(ColorAlpha { 255/*128*/, ColorHSV { 60 * c, 100, 50 }});
surface.TextExtent(hiragana[c], strlen(hiragana[c]), &tw, &th);
//surface.WriteText((256 - tw) / 2, (256 - th) / 2 /*+ 20*/, hiragana[c], strlen(hiragana[c]));
surface.WriteText(12,-45, hiragana[c], strlen(hiragana[c]));
cube.UpdateTransform();
return true;
}
-
+
void OnResize(int w, int h)
{
camera.Setup(w, h, null);
}
-
+
void OnRedraw(Surface surface)
{
surface.Clear(colorAndDepth);
bool selected = false;
if(argc > 1)
{
- selected = true;
+ selected = true;
strcpy(fileDialog.filePath, argv[1]);
}
else
{
strcpy(fileDialog.filePath, "toyota.3ds");
- //selected = true;
+ //selected = true;
}
while(selected || fileDialog.Modal() == ok)
{
{
attached,
fov = 53,
- position = { 0, 0,-100 },
+ position = { 0, 0,-100 },
orientation = Euler { 0, 30, 0 },
zMin = 0.01f;
model.frame++;
// cameraObject.frame++;
}
-
+
Update(null);
return true;
}
case g:
fillMode = (fillMode == wireframe) ? solid : wireframe;
break;
- case h:
+ case h:
help.visible ^= true;
break;
case k1: case k2: case k3: case k4:
else if(key == k2) cameraObject = model.Find("Camera02");
else if(key == k3) cameraObject = model.Find("Camera03");
else if(key == k4) cameraObject = model.Find("Camera04");
-
+
camera = cameraObject.camera;
camera.Setup(clientSize.w, clientSize.h, null);
Update(null);
driverBox.AddString("Direct3D 9").tag = (int)"Direct3D";
driverBox.AddString("Direct3D 8").tag = (int)"Direct3D8";
driverBox.currentRow = driverBox.firstRow;
-
+
resBox.AddString("Current");
resBox.AddString("640x480").tag = Resolution::res640x480;
resBox.AddString("800x600").tag = Resolution::res800x600;
}
};
- void UpdateObjects(Time diffTime)
+ void UpdateObjects(Time diffTime)
{
Quaternion orientation = cube.transform.orientation;
orientation.RotateYawPitch((Degrees)diffTime * 0.5, (Degrees)diffTime * 0.5);
cube.UpdateTransform();
return true;
}
-
+
void OnResize(int w, int h)
{
camera.Setup(w, h, null);
float blue[] = {0.3f, 0.2f, 1, 1};
float ambient[4] = { 0.2f, 0.2f, 0.2f };
float power = 0;
- float light[] = { -0.810f, -0.585f, 0.468f, 0 };
+ float light[] = { -0.810f, -0.585f, 0.468f, 0 };
Matrix view
{
Camera camera
{
fixed,
- position = Vector3D { 0, 0, -300 },
+ position = Vector3D { 0, 0, -300 },
orientation = Euler { 0, 0, 0 },
fov = 53;
};
cube.UpdateTransform();
return true;
}
-
+
void OnResize(int w, int h)
{
camera.Setup(w, h, null);
}
-
+
void OnRedraw(Surface surface)
{
surface.Clear(depthBuffer);
Camera camera
{
attachedQuaternion,
- position = Vector3D { 0, 0, -250 },
+ position = Vector3D { 0, 0, -250 },
orientation = Euler { 120, 30, 0 },
zMin = 0.01f;
fov = 53;
Camera camera
{
fixed,
- position = Vector3D { 0, 0, -200 },
+ position = Vector3D { 0, 0, -200 },
orientation = Euler { 0, 0, 0 },
fov = 53;
};
uint16 indices[6][4] =
{
// up, front, down, back, right, left
- { 17,21,20,16 },
- { 0,3,2,1 },
- { 22,18,19,23 },
- { 5,6,7,4 },
- { 9,10,14,13 },
+ { 17,21,20,16 },
+ { 0,3,2,1 },
+ { 22,18,19,23 },
+ { 5,6,7,4 },
+ { 9,10,14,13 },
{ 12,15,11,8 }
};
cube.UpdateTransform();
return true;
}
-
+
void OnResize(int w, int h)
{
camera.Setup(w, h, null);
}
-
+
void OnRedraw(Surface surface)
{
surface.Clear(depthBuffer);
Camera camera
{
fixed,
- position = { 0, 0, -200 },
+ position = { 0, 0, -200 },
orientation = Euler { 0, 0, 0 },
fov = 53;
};
temp.Multiply(orientation, thisSpin);
orientation.Normalize(temp);
-
+
cube.transform.orientation = orientation;
cube.UpdateTransform();
Update(null);
bool OnLoadGraphics()
{
display.ambient = ColorRGB { 0.7f, 0.7f, 0.7f };
-
+
material.baseMap = texture.bitmap;
cube.Create(displaySystem);
cube.mesh.ApplyMaterial(material);
return true;
}
-
+
void OnResize(int w, int h)
{
camera.Setup(w, h, null);
}
-
+
void OnRedraw(Surface surface)
{
surface.Clear(colorAndDepth);
Camera camera
{
fixed,
- position = Vector3D { 0, 0, -300 },
+ position = Vector3D { 0, 0, -300 },
orientation = Euler { 0, 0, 0 },
fov = 53;
};
cube.UpdateTransform();
return true;
}
-
+
void OnResize(int w, int h)
{
camera.Setup(w, h, null);
camera.Update();
}
-
+
void OnRedraw(Surface surface)
{
surface.Clear(depthBuffer);
};
uint16 indices[4] =
{
- 5,6,7,4,
+ 5,6,7,4,
};
CopyBytes(mesh.vertices, vertices, sizeof(vertices));
uint16 indices[16] =
{
// up, down, right, left
- 17,21,20,16 ,
- 22,18,19,23,
- 9,10,14,13,
+ 17,21,20,16 ,
+ 22,18,19,23,
+ 9,10,14,13,
12,15,11,8
};
class Desktop3D : Window
{
text = "Orbiting 3D Desktop", size = Size { WINDOW_WIDTH,WINDOW_HEIGHT };
-
+
Object lookAt {};
Camera camera
{
dock.speed = 0;
dock.currentIcon--;
if(dock.currentIcon < 0)
- dock.currentIcon += NUM_ICONS;
+ dock.currentIcon += NUM_ICONS;
dockTimer.Stop();
}
return true;
if(sliding == 1 && switching == 1 && entering == 1)
{
globalPosition += (double)diffTime * ORBIT_SPEED;
-
+
for(child = firstChild; child; child = child.next)
{
if(child.display != display)
{
Window3D window3D = Desktop3DGetWindowHandle(child);
-
+
if(window3D.position < window3D.wantedPosition - 0.000001)
{
window3D.wantedPosition += (double)diffTime * ORBIT_SPEED;
position.x = fromPosition.x + factor * (toPosition.x - fromPosition.x);
position.y = fromPosition.y + factor * (toPosition.y - fromPosition.y);
position.z = fromPosition.z + factor * (toPosition.z - fromPosition.z);
-
+
camera.AdjustAngle(angle);
camera.AdjustPosition(position);
}
// sliding = 1;
switching = 1;
entering = 1;
-
+
light.diffuse = white;
light.specular = white;
light.orientation = Euler { }; //Quaternion { 1,0,Pi,0 };
icon -= 2;
if(icon < 0) icon += NUM_ICONS;
/*
- eSurface_Blit(surface, dock.background, 0,0,0,0,
+ eSurface_Blit(surface, dock.background, 0,0,0,0,
dock.background->width, dock.background->height);
*/
for(c = 0; c<NUM_ICONS; c++)
void OnRedraw(Surface surface)
{
Window child;
-
+
surface.Clear(depthBuffer);
//PrintLn("position: ", camera.cPosition);
camera.Unproject(startPositionProjected, startPositionView);
camera.Untransform(startPositionView, startPositionWorld);
-
+
finalPosition.x = (float)(cos(window3D.position) * ORBIT_RADIUS);
finalPosition.y = 0;
finalPosition.z = (float)(sin(window3D.position) * ORBIT_RADIUS);
}
}
- // display.DrawObject(knot);
-
+ // display.DrawObject(knot);
+
display.SetCamera(null, null);
Dock_OnRedraw(surface);
display.DrawObject(window3D.cube.Find("Front"));
}
else
- {
+ {
HitRecord hit;
OldList list;
}
}
display.GetHits(list);
-
+
hit = list.first;
if(hit && hit.numTags)
{
}
}
}
-
+
return true;
}
{
int mx, my;
bool back;
-
+
Window clickedWindow = GetCursorLocation(x, y, &mx, &my, &back);
if(clickedWindow)
{
Desktop3DMouseMessage(clickedWindow, 26, mx, my, &mods, false, true);
}
-
+
if(moving)
{
ReleaseCapture();
bool OnKeyHit(Key key, unichar character)
{
static int id = 0;
- static char * shotFileNames[] =
+ static char * shotFileNames[] =
{
":shot1.jpg", ":shot2.jpg", ":shot3.jpg", ":shot4.jpg"
};
{
EditBox
{
- this, multiLine = true, is3D = true, borderStyle = Fixed, hasClose = true, text = "Video",
+ this, multiLine = true, is3D = true, borderStyle = Fixed, hasClose = true, text = "Video",
size = Size { WINDOW_WIDTH, WINDOW_HEIGHT }, fileName = ":430.flc"
}.Create();
}
{
Picture
{
- this, is3D = true, borderStyle = fixed, hasClose = true, text = "3D Window",
+ this, is3D = true, borderStyle = fixed, hasClose = true, text = "3D Window",
size = Size { WINDOW_WIDTH, WINDOW_HEIGHT }, image = BitmapResource { fileName = shotFileNames[id] }, opacity = 1, inactive = false
}.Create();
}
if(child == window)
child3D = window3D;
- child3D.wantedPosition = virtualDesktop.globalPosition +
+ child3D.wantedPosition = virtualDesktop.globalPosition +
child3D.id * 2*Pi / (virtualDesktop.numWindows+1);
if(child == window)
window3D.position = window3D.wantedPosition;
- virtualDesktop.poppingBiggest = Max(virtualDesktop.poppingBiggest,
+ virtualDesktop.poppingBiggest = Max(virtualDesktop.poppingBiggest,
child3D.position - child3D.wantedPosition);
}
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
box.left,
window.size.h - h - box.top,
box.left + virtualDesktop.clientStart.x,
for(y = start; y <= end && !view3D.abort; y++)
{
Box box { 0, y, bitmap.width, y };
-
+
for(x = 0; x < bitmap.width && !view3D.abort; x++)
{
Vector3D v, end;
g /= count*count;
b /= count*count;
- picture[y * stride + x] =
+ picture[y * stride + x] =
{
- (byte)Min(255, Max(0, a*255)),
+ (byte)Min(255, Max(0, a*255)),
{ (byte)Min(255, Max(0, r*255)), (byte)Min(255, Max(0, g*255)), (byte)Min(255, Max(0, b*255)) }
- };
+ };
}
}
done = true;
Update(null);
UpdateDisplay();
-
+
camera.Setup(bitmap.width, bitmap.height, null);
camera.Update();
-
+
for(lt : scene.lights)
{
Light * light = lt;
Update(null);
UpdateDisplay();
}
-
+
for(t = 0; t < numThreads; t++)
delete threads[t];
virtual void Compute();
virtual bool Render(Line ray, ColorARGBd * color, Vector3D intersect, Vector3D vIntersect)
- {
+ {
return false;
}
}
for(o : objects)
{
ColorARGBd newColor;
-
+
// TOFIX: &ray here has different behavior?
if(o.Render(ray, newColor, null, vIntersect) && vIntersect.z < z)
{
uint16 indices[6][4] =
{
// up, front, down, back, right, left
- { 17,21,20,16 },
- { 0,3,2,1 },
- { 22,18,19,23 },
- { 5,6,7,4 },
- { 9,10,14,13 },
+ { 17,21,20,16 },
+ { 0,3,2,1 },
+ { 22,18,19,23 },
+ { 5,6,7,4 },
+ { 9,10,14,13 },
{ 12,15,11,8 }
//{ 8,11,15,12 }
};
}
}
}
-
+
if(visible && gotIntersect)
{
Vector3D v;
firstPointInside = true;
l.delta.Scale(l.delta, -1);
}
-
+
while(true)
{
Vector3D p
l.p0.z - l.delta.z * stopT
};
is = p;
- return true;
+ return true;
}
if(refine == refineCount)
{
Vector3D rayDirection;
Vector3D localIntersect;
Vector3D p;
- Line toBulb;
+ Line toBulb;
rayDirection.MultMatrix(ray.delta, inverse);
localIntersect.MultMatrix(intersect, inverse);
-
+
rayDirection.Normalize(rayDirection);
toBulb.p0 = localIntersect;
toBulb.delta = rayDirection;
Angle phi = atan2(p.y, p.x);
Vector3D normal { };
int count = 0;
- //Angle
+ //Angle
offset = 2 * asin(angleOffset / (2*r));
toBulb2.delta = toBulb2.p0;
toBulb2.delta.Normalize(toBulb2.delta);
-
+
//if(WalkTowards(toBulb2, pp, ((r * safetyFactor) - r) / 2.0, 30))
if(WalkTowards(toBulb2, pp, (r + startOffDistance - r) / 2.0, 30, true))
{
if(numFound >= 2)
{
Plane normalPlane { };
-
+
double d1 = (found[0] && found[2]) ? (distances[0] * distances[1]) : MAXDOUBLE;
double d2 = (found[1] && found[2]) ? (distances[1] * distances[2]) : MAXDOUBLE;
double d3 = (found[2] && found[3]) ? (distances[2] * distances[3]) : MAXDOUBLE;
R.Normalize(R);
l = R.DotProduct(localCameraDirection);
if(l < 0) l = 0;
-
+
r += pow(l, material.power) * light->multiplier * light->specular.r * material.specular.r;
g += pow(l, material.power) * light->multiplier * light->specular.g * material.specular.g;
b += pow(l, material.power) * light->multiplier * light->specular.b * material.specular.b;
scene.lights.Add(&light2);
//scene.lights.Add(&light3);
//scene.objects.Add(RTCube { center = { }, size = { 100, 100, 100 } });
- scene.objects.Add(RTMandelbulb {
- material.power = 16;
- material.ambient = blanchedAlmond;
- material.specular = blanchedAlmond;
- material.diffuse = blanchedAlmond,
+ scene.objects.Add(RTMandelbulb {
+ material.power = 16;
+ material.ambient = blanchedAlmond;
+ material.specular = blanchedAlmond;
+ material.diffuse = blanchedAlmond,
center = { }, orientation = Euler { yaw = 0, pitch = 220 /*-140*/ }, size = { 100, 100, 100 } });
//scene.objects.Add(RTCube { center = { -40, 0, 0 }, orientation = Euler { 143, -138, 0 }, size = { 50, 50, 50 } });
//scene.objects.Add(RTCube { center = { 40, 0, 0}, orientation = Euler { -145, -22, 0 }, size = { 30, 30, 30 } });
static void RotateSprite(BallSprite sprite, Degrees amount)
{
if((sprite.t+=amount * ROTATESPEED)>=2*Pi)sprite.t-=2*Pi;
-
+
sprite.r = (int)(1+sin(NUMPETALS*(sprite.t))*FACTOR1);
sprite.x = (int)(sprite.r*cos(sprite.t));
sprite.y = (float)(sprite.r*sin(sprite.t) - BALLHEIGHT);
sprite.y += sprite.yi * amount;
sprite.y = Min(Max(sprite.y, CEILING), FLOORALT);
if(Sgn(sprite.yi) == 1)
- {
+ {
if(sprite.y >= FLOORALT) sprite.yi *= -1;
}
else
timer.Start();
timerStarted = true;
lastTime = GetTime();
-
+
display.SetPalette(palette, true);
return true;
}
float minZ, maxZ;
// Background
float layers[] = { 0, 0.5f, 0.51f, 0.525f, 0.55f, 0.65f, 0.8f, 1.0f };
- ColorAlpha colors[] =
- {
- palette[16],
+ ColorAlpha colors[] =
+ {
+ palette[16],
#ifdef GRAYBACKGROUND
palette[17],palette[18],palette[19], palette[20],palette[21],palette[22]
#else
if(sprites[c].transformed.z > maxZ) maxZ = (float)sprites[c].transformed.z;
}
- for(z=(int)maxZ; z>=(int)minZ; z--)
- for(c=0; c<NUMBALLS; c++)
+ for(z=(int)maxZ; z>=(int)minZ; z--)
+ for(c=0; c<NUMBALLS; c++)
{
- if((int)sprites[c].transformed.z == z)
+ if((int)sprites[c].transformed.z == z)
ShowSpriteVector3D(camera, surface, sprites[c]);
}
}
-
+
#ifndef ECERE_MODULE
bool OnStateChange(WindowState state, Modifiers mods)
{
Copyright (c) 2001-2010 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
demo.ec - Main Module
****************************************************************************/
import "ecere"
bool OnLoadGraphics()
{
Bitmap map { };
-
+
light.ambient = { 0.2f, 0.2f, 0.2f };
light.diffuse = light.specular = white;
light.orientation = { 1,0,0,0 };
textures[c].Allocate(null, 256, 256, 0, map.pixelFormat, true);
if(map.pixelFormat == pixelFormat8)
memcpy(textures[c].palette, map.palette, 256*4);
- textures[c].Grab(map,
+ textures[c].Grab(map,
(c % across) * textures[c].width,
(c / across) * textures[c].height);
textures[c].MakeMipMaps(displaySystem);
if(!filled) display.fillMode = wireframe;
terrainMesh.RenderMesh(display, null, textures);
- if(!filled) display.fillMode = solid;
+ if(!filled) display.fillMode = solid;
display.DrawObject(dna);
display.DrawObject(player);
surface.SetForeground(black);
//surface.WriteTextf(10,10, "Detail: %.0f, ZMax: %.02f, FPS: %.02f", detailBias, zMax, frameRate.fps);
-
+
frameRate.Step();
}
acquiredInput = false;
GetMousePosition(&lastMousePosition.x, &lastMousePosition.y);
break;
- case a:
+ case a:
acquiredInput = AcquireInput(true);
break;
- case k0:
- camera.type = fixed;
+ case k0:
+ camera.type = fixed;
camera.position = camera.cPosition;
camera.orientation = camera.cOrientation;
break;
- case k1:
- /*camera.type = attached;
+ case k1:
+ /*camera.type = attached;
camera.position = { 0, 0, -30 };
camera.Slerp(0.1f);
*/
camera.orientation = Euler { 180, 20, 0 };
camera.Slerp(0.3f);
break;
- case k2:
- camera.type = lookAt;
+ case k2:
+ camera.type = lookAt;
camera.position = camera.cPosition; //{ 1000, -3000, 0 };
camera.position.z -= 50;
camera.orientation = { 1,0,0,0 };
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
dna.ec - DNA 3D Model
****************************************************************************/
public import "ecere"
uint16 indices[36] =
{
// up, front, down, back, right, left
- 21,20,16, 17,21,16,
- 3,2,1, 0,3,1,
- 18,19,23, 22,18,23,
- 6,7,4, 5,6,4,
- 10,14,13, 9,10,13,
+ 21,20,16, 17,21,16,
+ 3,2,1, 0,3,1,
+ 18,19,23, 22,18,23,
+ 6,7,4, 5,6,4,
+ 10,14,13, 9,10,13,
15,11,8, 12,15,8
};
PrimitiveGroup group;
uint16 num = (uint16)(curveSegments*numCurves);
int vertexCount = (num+1)*4;
-
+
if(Allocate({ vertices = true, texCoords1 = true }, vertexCount, displaySystem))
{
uint16 v;
char name[20];
Vector3D pos;
- // Pick texture
+ // Pick texture
int b1 = GetRandom(0,3);
int b2 = 3-b1;
Quaternion angle { 1,0,0,0 };
Vector3D position;
Matrix matrix;
-
+
// Change Rotation
angle.Yaw(-rotation*c);
matrix.RotationQuaternion(angle);
base.UpdateTransform();
pos.MultMatrix(position, matrix); base.transform.position = pos;
base.material = displaySystem.GetMaterial(names[b2]);
-
+
//******************* DESOXYRIBOSE *******************
sprintf(name, "Desoxyribose%02d", c*2);
desoxyribose = { }; AddName(desoxyribose, name);
Copyright (c) 2001-2010 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
dted.ec - DTED data loader
****************************************************************************/
import "terrain"
{
float ix = Abs(x),iy = Abs(y), iz = Abs(z);
float tmp;
-
+
if(ix < iy) { tmp = ix; ix = iy; iy = tmp; }
if(ix < iz) { tmp = ix; ix = iz; iz = tmp; }
if(iz > iy) { iz = iy; }
rightChild.rightChild = null;
leftChild.tv0 = tva;
- rightChild.tv1 = tva;
+ rightChild.tv1 = tva;
leftChild.tva = tvc;
rightChild.tva = tvc;
leftChild.tv1 = tv0;
leftChild.v0 = va;
rightChild.v1 = va;
- leftChild.va = vc;
+ leftChild.va = vc;
rightChild.va = vc;
leftChild.v1 = v0;
rightChild.v0 = v1;
}
void Split(struct BinTri * stack, int * triIndex,
- byte level, float resolutionX, float resolutionY, int positionX, int positionY, int positionZ,
+ byte level, float resolutionX, float resolutionY, int positionX, int positionY, int positionZ,
Elevation * heightMap, byte maxVarLevel, int detailBias, Elevation * variance, byte maxLevel)
{
int distance;
if(ix < iz) { tmp = ix; ix = iz; iz = tmp; }
if(iz > iy) { iz = iy; }
distance = ix + (iz>>1);
-
+
// *** Find the variance table index ***
varIndex = index;
if(level > maxVarLevel)
varIndex >>= (level - maxVarLevel);
varIndex--;
-
+
if(distance < detailBias * variance[varIndex])
{
// *** Split Further ***
Elevation *leftVariance, *rightVariance;
Elevation maxHeight, minHeight;
- Elevation CalcVariance(Elevation * variance, int patchSize, int numBinTris, int numVarTris,
+ Elevation CalcVariance(Elevation * variance, int patchSize, int numBinTris, int numVarTris,
int i, /*struct */Point v0, /*struct */Point va, /*struct */Point v1, /*struct */Point vc)
{
Elevation real, avg;
PrimitiveGroup group;
bool shown:1;
- void Create(Mesh mesh, int wide, int patchSize,
+ void Create(Mesh mesh, int wide, int patchSize,
float resolutionX, float resolutionY,
- int acrossX, int acrossY, int tilingMult, int detailMult, Bitmap * detail,
+ int acrossX, int acrossY, int tilingMult, int detailMult, Bitmap * detail,
bool invertX, bool invertY)
{
int x,y,v;
dy = ((wide - 1 - patch.y) % pptY) * (patchSize - 1);
else
dy = (patch.y % pptY) * (patchSize - 1);
-
+
// *** Compute the Vertices ***
for(v = 0, y = 0; y<patchSize; y++)
{
mesh.texCoords[v].x *= tilingMult;
mesh.texCoords[v].y *= tilingMult;
}
- }
+ }
}
}
};
class PatchNode : struct
{
- TerrainPatch patch;
+ TerrainPatch patch;
PatchNode child[4];
Elevation maxHeight, minHeight;
Vector3D block;
radius = Max(dx, dy) * SQR2;
child[0] = child[1] = child[2] = child[3] = null;
- }
+ }
return true;
}
shown = camera.SphereVisible(block, radius);
if(shown)
{
- if(patch)
+ if(patch)
patch.shown = true;
else if(child[0])
{
void QuadClear(int patchesWide)
{
int x,y;
-
+
TerrainPatch terrainPatch;
if(!shown) return;
terrainPatch = patch;
-
+
if(terrainPatch)
{
struct TerrainPatch * terrainPatchPtr = (void *)terrainPatch;
}
void QuadSplit(TerrainMesh terrainMesh,
- byte maxVarLevel, byte maxLevel, float resolutionX, float resolutionY,
+ byte maxVarLevel, byte maxLevel, float resolutionX, float resolutionY,
int positionX, int positionY, int positionZ, int detailBias)
{
TerrainPatch patch = this.patch;
if(patch)
{
- patch.leftTri.Split(terrainMesh.binTriStack, &terrainMesh.index, 0, resolutionX, resolutionY, positionX, positionY, positionZ,
+ patch.leftTri.Split(terrainMesh.binTriStack, &terrainMesh.index, 0, resolutionX, resolutionY, positionX, positionY, positionZ,
patch.patch.heightMap, maxVarLevel, detailBias, patch.patch.leftVariance, maxLevel);
- patch.rightTri.Split(terrainMesh.binTriStack, &terrainMesh.index, 0, resolutionX, resolutionY, positionX, positionY, positionZ,
+ patch.rightTri.Split(terrainMesh.binTriStack, &terrainMesh.index, 0, resolutionX, resolutionY, positionX, positionY, positionZ,
patch.patch.heightMap, maxVarLevel, detailBias, patch.patch.rightVariance, maxLevel);
}
else if(child[0])
}
}
else
- {
+ {
child[0].QuadTriangles(terrainMesh);
child[1].QuadTriangles(terrainMesh);
child[2].QuadTriangles(terrainMesh);
struct TerrainPatch * patches;
PatchNode nodes { };
int acrossX, acrossY;
-
+
// *** Runtime Stuff ***
int nTriangles;
int maxTris;
nodes.QuadCheck((int)camera.cPosition.x, (int)camera.cPosition.y, (int)camera.cPosition.z, distance, camera);
nodes.QuadClear(terrain.wide);
- nodes.QuadSplit(this, (byte)terrain.maxVarLevel, (byte)terrain.maxLevel,
+ nodes.QuadSplit(this, (byte)terrain.maxVarLevel, (byte)terrain.maxLevel,
terrain.resolutionX, terrain.resolutionY,
(int)camera.cPosition.x, (int)camera.cPosition.y, (int)camera.cPosition.z, (int)bias);
nodes.QuadTriangles(this);
object.transform.scaling = { 1, 1, 1 };
object.UpdateTransform();
-
+
object.matrix.Identity();
display.PushMatrix();
-
+
display.SetTransform(object.matrix, false);
for(c = 0; c<terrain.numPatches; c++)
{
if((patches = new0 struct TerrainPatch[terrain.numPatches]))
{
result = true;
-
+
// *** Set up Patches ***
for(c = 0, y = 0; y<terrain.wide; y++)
{
if(patch.group)
{
patch.group.material = patch.material;
- patch.Create(patch.mesh, terrain.wide, terrain.patchSize,
+ patch.Create(patch.mesh, terrain.wide, terrain.patchSize,
terrain.resolutionX, terrain.resolutionY,
acrossX, acrossY, 0, 0, null, invertX, invertY);
patch.mesh.UnlockPrimitiveGroup(patch.group);
{
bool result = false;
- if((1 << log2i(size - 1)) + 1 != size)
+ if((1 << log2i(size - 1)) + 1 != size)
Log("Invalid terrain size.\n");
else if(1 << log2i(patchesCount) != patchesCount || ((size-1) / patchesCount) > 128)
Log("Invalid patch size.\n");
numVarTris = (1 << (maxVarLevel + 1)) - 1;
result = true;
-
+
// *** Set up Patches ***
for(c = 0, y = 0; y < patchesCount; y++)
{
// *** Set up Height Map ***
patch.heightMap = new Elevation[numSamples];
if(!patch.heightMap) { result = false; break; };
-
+
k = (y*(size-1)) * this.size + (x * (size-1));
for(h = 0, j = 0; j<size; j++)
{
patch.rightTri.tva = size-1;
}
- patch.leftTri.vc =
+ patch.leftTri.vc =
{
- (patch.leftTri.v0.x + patch.leftTri.v1.x) / 2,
- (patch.leftTri.v0.y + patch.leftTri.v1.y) / 2
+ (patch.leftTri.v0.x + patch.leftTri.v1.x) / 2,
+ (patch.leftTri.v0.y + patch.leftTri.v1.y) / 2
};
patch.leftTri.tvc = (patch.leftTri.tv0 + patch.leftTri.tv1)/2;
if(!patch.rightVariance) { result = false; break; };
// *** Compute Variance ***
- patch.CalcVariance(patch.leftVariance,
+ patch.CalcVariance(patch.leftVariance,
patchSize, numBinTris, numVarTris,
1, patch.leftTri.v0,patch.leftTri.va,
patch.leftTri.v1, patch.leftTri.vc);
// There are 12 half-tones in an octave, and the frequency doubles in an octave.
define Do = 1.0;
-define Do_ = 1.0594630943592952645618252949463; // The root 12 of 2.
+define Do_ = 1.0594630943592952645618252949463; // The root 12 of 2.
define Re = Do_*Do_;
define Re_ = Re*Do_;
define Mi = Re_*Do_;
mixer.Release();
}
}
-
+
void PlayNote(Mixer mixer, Instrument ins, uint16 note, uint16 octave, byte volume, uint16 channel)
{
uint32 note_st3period;
double freq = 14317456.0 / note_st3period / 22150/2;
//double freq = 500.0/note_st3period;
Voice v = voices[channel-1];
-
+
if(!v)
{
v = mixer.Play(ins.sound, vol, bal, freq);
// There are 12 half-tones in an octave, and the frequency doubles in an octave.
define Do = 1.0;
-define Do_ = 1.0594630943592952645618252949463; // The root 12 of 2.
+define Do_ = 1.0594630943592952645618252949463; // The root 12 of 2.
define Re = Do_*Do_;
define Re_ = Re*Do_;
define Mi = Re_*Do_;
//s3m.Load("forgivme.s3m");
//s3m.Load("quiadroi.s3m");
//s3m.Load("everyido.s3m");
- //s3m.Load("saywords.s3m");
+ //s3m.Load("saywords.s3m");
//s3m.Load("keven1.s3m");
instrument = s3m.instruments[0].sound;
{
delete mixer;
}
-
+
Timer pbTimer
{
this, 0.01, true;
DataSource ds { };
Database db;
Table tbl;
-
+
Label groupDrv { this, anchor = { left = 8, top = 8, right = 8 }, size = { h = 60 }, text = "Driver", inactive = false, isGroupBox = true };
-
- DropBox driver
+
+ DropBox driver
{
groupDrv, this, "Driver", size = { 136, 24 }, position = { 16, 24 };
bool OnPostCreate(void)
{
- //AddField({ "subclass(DataSourceDriver)" }); // won't compile, should be done differently?
+ //AddField({ "subclass(DataSourceDriver)" }); // won't compile, should be done differently?
//AddRow().SetData(null, GetDataDriver("EDB"));
//AddRow().SetData(null, GetDataDriver("MySQL"));
-
+
AddString("EDB");
AddString("MemoryEDB");
AddString("MySQL");
};
Label groupDs { this, anchor = { left = 8, top = 76, right = 8 }, size = { h = 60 }, text = "Datasource (Host, Port, Username, Password)", inactive = false, isGroupBox = true, disabled = true };
-
+
EditBox host { groupDs, this, size = { 142, 24 }, position = { 16, 24 } };
EditBox port { groupDs, this, size = { 70, 24 }, position = { 168, 24 } };
EditBox username { groupDs, this, size = { 150, 24 }, position = { 264, 24 } };
Button openDs
{
groupDs, this, text = "Open", position = { 552, 24 };
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
ds.driver = driver.currentRow.string;
Button closeDs
{
groupDs, this, text = "Close", position = { 598, 24 }, disabled = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
ds.driver = null;
Button testDs
{
groupDs, this, text = "Test", position = { 644, 24 }, disabled = false;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
int c;
return true;
}
};
-
-
+
+
Label groupDb { this, text = "Database (List, Name)", anchor = { left = 8, top = 152, right = 8 }, size = { h = 120 }, inactive = false, isGroupBox = true, disabled = true };
ListBox listDatabases
Button openDb
{
groupDb, this, "Open", position = { 448, 24 };
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
db = ds.OpenDatabase(nameDb.contents, dbCreate.checked ? create : no);
Button closeDb
{
groupDb, this, "Close", position = { 496, 24 }, disabled = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
delete db;
Button deleteDb
{
groupDb, this, "Delete", position = { 544, 24 }, disabled = false;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(!ds.DeleteDatabase(nameDb.contents))
Button openTbl
{
groupTbl, this, "Open", position = { 448, 24 };
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
tbl = db.OpenTable(nameTbl.contents, { type = tableRows, create = tblCreate.checked ? create : no });
tblFields.GUIListBoxAddRowsField(listFields, "Name");
delete tblFields;
}
-
+
tableBox.text = tbl.name;
tbl.GUIListBoxAddFields(tableBox);
tbl.GUIListBoxAddRows(tableBox);
Button closeTbl
{
groupTbl, this, "Close", position = { 496, 24 }, disabled = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
delete tbl;
ListBox listFields { groupFld, this, size = { 200, 88 }, position = { 16, 24 } };
EditBox nameFld { groupFld, this, size = { 200, 24 }, position = { 232, 24 } };
- DropBox fldDataType
+ DropBox fldDataType
{
groupFld, this, "Data Type", size = { 136, 24 }, position = { 448, 24 };
Button createFld
{
groupFld, this, "Create", position = { 600, 24 };
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(tbl.AddField(nameFld.contents, fldDataType.currentRow.GetData(null), 0))
Button addRow
{
this, text = "AddRow", anchor = { left = 10, bottom = 10 };
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
Row row { tbl };
Button find
{
this, text = "Find", anchor = { left = 110, bottom = 10 };
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
Row row { tbl };
DataRow curRow = listBox.firstRow;
Row row { tbl };
int sysID = 0;
-
+
while(row.Next() && curRow)
{
if(curRow == listBox.currentRow)
else
{
boxCommercialNames.Load();
- boxGenericName.Clear();
+ boxGenericName.Clear();
}
boxSubClass.Clear();
boxClass.Clear();
answers.disabled = false;
}
- }
+ }
return true;
}
};
SubClass subClass = row.subClass;
DrugClass drugClass = row.drugClass;
Restriction restriction = row.restriction;
- FormConcentrations formConcentrations = row.formConcentrations;
+ FormConcentrations formConcentrations = row.formConcentrations;
// if(commercialNames.OnCompare(*(void **)boxCommercialNames.data))
if(class(StringList)._vTbl[__ecereVMethodID_class_OnCompare](class(StringList), commercialNames, *(void **)boxCommercialNames.data))
// if(genericName.OnCompare(*(void **)boxGenericName.data))
if(class(String)._vTbl[__ecereVMethodID_class_OnCompare](class(String), genericName, *(void **)boxGenericName.data))
boxGenericName.foreground = red;
-
+
if(drugClass.OnCompare(boxClass.data))
boxClass.foreground = red;
{
DataBox formEditor;
DataBox amountEditor;
- DataBox unitEditor;
+ DataBox unitEditor;
}
default:
{
public:
Form form;
- double amount;
+ double amount;
Unit unit;
bool Window::NotifyChanged(bool closed)
editor.amountEditor.SaveData();
return false;
}
-
+
void OnFree() { } // WE DON'T WANT THE LISTBOX TO DELETE THE INSTANCES...
};
String name "name";
};
-dbtable "SubClasses" SubClass
+dbtable "SubClasses" SubClass
{
SubClass id "id";
String name "name";
font = { "Arial", 10 };
keepTogether = true;
-
+
Label movieName { this, anchor = { left = 4, top = 2, right = 0.60, bottom = 2 } };
Label mediaType { this, anchor = { left = 0.40, top = 2, right = 0.45, bottom = 2 } };
Label dateAdded { this, anchor = { left = 0.55, top = 2, right = 0.30, bottom = 2 } };
{
String s;
RowMovies row = (RowMovies)report.groupings[0].row;
-
+
s = row.name; movieName.text = s; delete s;
s = PrintString(row.mediaType); mediaType.text = s; delete s;
s = PrintString((ShortDate)row.dateAdded); dateAdded.text = s; delete s;
font = { "Arial", 10 };
keepTogether = true;
-
+
Label movieName { this, anchor = { left = 44, top = 2, right = 0.30, bottom = 2 } };
Label dateBorrowed { this, anchor = { left = 0.5, top = 2, right = 0.20, bottom = 2 } };
String s;
BorrowerReport report = (BorrowerReport)((ReportDestination)master).GetReport();
RowMovies row = (RowMovies)report.groupings[1].row;
-
+
s = row.name; movieName.text = s; delete s;
s = PrintString((ShortDate)row.dateBorrowed); dateBorrowed.text = s; delete s;
return true;
font = { "Arial", 10, bold = true };
keepTogether = true;
-
+
Label name { this, anchor = { left = 4, top = 7, right = 0.65, bottom = 2 } };
Label phone { this, anchor = { left = 0.4, top = 7, right = 4, bottom = 2 } };
font = { "Arial", 10, bold = true };
keepTogether = true;
-
+
Label name { this, anchor = { left = 4, top = 7, right = 0.65, bottom = 2 } };
bool OnCreate(void)
String s;
BorrowerReport report = (BorrowerReport)((ReportDestination)master).GetReport();
RowBorrowers row = (RowBorrowers)report.groupings[0].row;
-
+
s = PrintString(row.name, " (Continued)"); name.text = s; delete s;
return true;
}
font = { "Arial", 10, bold = true };
keepTogether = true;
-
+
Label title { this, anchor = { left = 0.85, top = 9, right = 0.03, bottom = 2 }, text = "Total count:" };
Label total { this, anchor = { left = 0.97, top = 9, right = 9, bottom = 2 } };
if(daysAgo)
{
static char reportTitle[256];
- sprintf(reportTitle, "Movies borrowed for more than %d days", daysAgo);
+ sprintf(reportTitle, "Movies borrowed for more than %d days", daysAgo);
title = reportTitle;
}
else
{
char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
- static const char months[12][4] =
+ static const char months[12][4] =
{
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
class CommonReportHeader : Detail
{
size = { 500, 100 };
-
+
ReportTitle { this, anchor = { left = 0, top = 4, right = 0 }, text = "Movie Collection Report" };
ReportTitle title { this, size = { h = 28 }, anchor = { left = 0, top = 42, right = 0 }, font = { "Arial", 12, bold = true } };
class CommonReportPageFooter : Detail
{
size = { 500, 32 };
-
+
Label pageNumber { this, anchor = { top = 0, right = 0 } };
-
+
void OnRedraw(Surface surface)
{
int x = clientSize.w - 1;
surface.DrawLine(0, 0, x, 0);
}
-
+
bool OnCreate(void)
{
char number[64];
class CommonReportFooter : Detail
{
size = { 500, 32 };
-
+
void OnRedraw(Surface surface)
{
int x = clientSize.w - 1;
{
size = { 1024, 768 };
state = maximized;
-
+
hasClose = true;
fullRender = true;
background = activeBorder;
bool HasPrimeFactor(int x)
{
int max = (int)floor(sqrt((double)x));
-
+
for(i : primeList)
{
if(i > max) break;
byte bytes[4096] = { 0x00 };
AmpheckSHA256 ctx { };
byte digest[32];
-
+
ctx.Init();
for (i = 0; i < 262144; ++i)
ctx.Update(bytes, 4096);
-
+
ctx.Finish(digest);
-
+
for (i = 0; i < 32; ++i)
printf("%02x", digest[i]);
-
+
printf("\n");
}
}
bool OnCreate(void)
{
-
+
return true;
}
{
if (ch=='\r')
DoParse(true);
-
+
return true;
}
class FunctionList : Dictionary {
Array<CASFunctionDefinition> f {};
FunctionList() {
- CASFunction i;
+ CASFunction i;
for (i=0; i<CASFunction::enumSize; i++)
array.Add(StrDup(function_string[i]));
f.size = CASFunction::enumSize;
f[CASFunction::sum] = {
-
+
};
f[CASFunction::product] = {
-
+
};
f[CASFunction::polynomial] = {
-
+
};
f[CASFunction::exp] = {
bool Expression::Sanitize()
};
f[CASFunction::ln] = {
Sanitize = SanitizeSingleArgument;
-
+
};
f[CASFunction::sin] = {
Sanitize = SanitizeSingleArgument;
-
+
};
f[CASFunction::cos] = {
Sanitize = SanitizeSingleArgument;
-
+
};
f[CASFunction::tan] = {
Sanitize = SanitizeSingleArgument;
-
+
};
f[CASFunction::arcsin] = {
Sanitize = SanitizeSingleArgument;
-
+
};
f[CASFunction::arccos] = {
Sanitize = SanitizeSingleArgument;
-
+
};
f[CASFunction::arctan] = {
Sanitize = SanitizeSingleArgument;
-
+
};
}
//these functions check to make sure the input is a function of correct range before executing
public:
Expression expr;
Expression user0, user1, user2;
-
+
void Go(void) {
switch (expr.ExprClass()) {
case prefix:
break;
}
}
-
+
void Free(void) {
ExprChildWalker w {this;
bool On(Expression *e) {
}
return ret;
}
-
+
//collect terms in this expression separated by the binary operator op
//e.g. separate x^2+3x+1 by plus into [x^2, 3x, 1]
//Will separate (x^2+3x+1)/2 by plus into [(x^2+3x+1)/2]
fprintf(stderr, "BUG: Attempted to call Unlink on non-unary node.\n");
}
}
-
+
//Note that FromString likes to toy with the string, but anything done to the string will be undone.
bool FromString(char *str, CASDictionary dictionary) {
ExpressionFromString(this, str, dictionary);
return Sanitize(this, dictionary);
}
char *ToString(void) {
-
+
}
const char *OpString(void) {
if (type==prefix && prefix.op<PrefixOperator::enumSize)
return nullary;
}
void Simplify(CASDictionary dict) {
-
+
}
};
char borrow;
expr.Free();
-
+
s = str;
e = s;
while (*s) {
/*property char * {
set { charsSet = value; }
}*/
-
+
byte flags[256]; //flags[c] indicates whether character c is selected
void Clear(void) {
memset(flags, 0, sizeof(flags));
{
POOR,
OK,
- GOOD
+ GOOD
};
struct Example
Piece * piece = &pieces[selectedPiece];
int w = (direction & 1) ? piece->h : piece->w;
int h = (direction & 1) ? piece->w : piece->h;
- drag = { offset.x + mx, offset.y + my };
+ drag = { offset.x + mx, offset.y + my };
- if(mx - squareDragged.x * squareWidth >= boardStartX - 10 && mx - squareDragged.x * squareWidth < boardStartX + ((boardSize-w)+1) * squareWidth + 10 &&
+ if(mx - squareDragged.x * squareWidth >= boardStartX - 10 && mx - squareDragged.x * squareWidth < boardStartX + ((boardSize-w)+1) * squareWidth + 10 &&
my - squareDragged.y * squareWidth >= boardStartY - 10 && my - squareDragged.y * squareWidth < boardStartY + ((boardSize-h)+1) * squareWidth + 10)
{
int x, y;
squareDragged = { w-1-y, x };
else
squareDragged = { y, h-1-x };
-
+
offset.x -= squareDragged.x * squareWidth;
offset.y -= squareDragged.y * squareWidth;
empty.b + lightValue * (full.b - empty.b)
};
}
-
+
surface.foreground = aqua;
for(c = 0; c <= boardSize; c++)
{
drag.y + y * squareWidth,
colorPlayed,
gameStarted && gameState.colorTurn == colorPlayed && gameState.validPieces[selectedPiece]);
-
+
if(x == 0 || !PieceBlock(selectedPiece, x-1, y, direction, flip))
{
surface.foreground = white;
{
borderStyle = sizable, hasMaximize = true, hasMinimize = true, hasClose = true;
text = "Bomb Squad", clientSize = Size { 640,400 };
-
+
bool fullScreen;
char board[DIMY][DIMX];
};
EditBox passEdit
{
- this, textHorzScroll = true, text = "Password",
- anchor = Anchor { left = 0.03, top = 0.05, right = 0.84, bottom = 0.80 },
+ this, textHorzScroll = true, text = "Password",
+ anchor = Anchor { left = 0.03, top = 0.05, right = 0.84, bottom = 0.80 },
autoCreate = false
};
Bitmap buffer {};
surface.Blit(gfx[PLAYER],
offX + player.x*mapSize.w, offY + player.y*mapSize.h,
0,0,mapSize.w,mapSize.h);
-
+
surface.SetForeground(TIMEBAR);
surface.Rectangle(0,buffer.height - 20,buffer.width-1,buffer.height-1);
width = (int)((buffer.width - 2)*(MAXTIME-secPassed)/MAXTIME);
}
delete surface;
- surface2.Stretch(buffer, 0,0, 0,0, clientSize.w, clientSize.h,
+ surface2.Stretch(buffer, 0,0, 0,0, clientSize.w, clientSize.h,
buffer.width, buffer.height);
}
switch(key)
{
case s: LoadLevel(1); break;
- case p:
+ case p:
state = STATE_PASSWORD;
passEdit.Create();
break;
}
switch(key)
{
- case escape:
+ case escape:
if(state == STATE_GAME)
timer.Stop();
- state = STATE_MENU;
+ state = STATE_MENU;
SetPalette(true);
Update(null);
break;
{
player1.Join();
player2.Join();
-
+
player1.NewGame();
}
Bitmap board = boardBmp.bitmap;
Bitmap bmp = res.bitmap;
int bw = (int)(board.width * scale;
- int bh = clientSize.h;
+ int bh = clientSize.h;
int bx = (clientSize.w - bw) / 2;
int by = (clientSize.h - bh) / 2;
int x = (int)(upperLeftX + (p1.x+0.5)*spaceX + (p2.x - p1.x)/3 * c * spaceX / 4 - (smileBmp.bitmap.width*3)/2);
int y = (int)(upperLeftY + (p1.y+0.5)*spaceY + (p2.y - p1.y)/3 * c * spaceY / 4 - (smileBmp.bitmap.height*3)/2);
DrawBitmap(surface, smileBmp, x, y, 3);
- }
+ }
}
-
+
void DrawStone(Surface surface, Point where, Stone color)
{
Bitmap stone = stoneBmps[color].bitmap;
Bitmap board = boardBmp.bitmap;
Bitmap remove = removeBmp.bitmap;
Bitmap wStone = stoneBmps[Stone::white].bitmap;
-
+
int x, y;
Stone c;
DrawBitmap(surface, stoneBmps[c],
drawerX - stone.width/2, topDrawer + r*wStone.height*2/3, 1);
}
-
+
// Draw the stones
for(y = 0; y < 4; y++)
{
stones[sy][sx] = none;
takeOut = false;
played = true;
-
+
}
}
else if(movesLeft && !stones[sy][sx])
int symbol = symbols[sy][sx];
if(numStones[turn] > 0)
numStones[turn]--;
-
+
for(y = 0; y < 4; y++)
{
int x;
break;
}
}
-
+
stones[sy][sx] = turn;
// Check for win
}
return color;
}
-
+
void NewGame()
{
game.NewGame();
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
bet.ec - Poker Bet Window
****************************************************************************/
import "poker.ec"
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
player.ec - Poker Player Window
****************************************************************************/
import "poker.ec"
import "pokerUtils.ec"
-static char handTypes[10][20] =
+static char handTypes[10][20] =
{
"NOTHING",
"ONE PAIR",
else if(gameOver)
{
surface.SetForeground(red);
- if(winner)
+ if(winner)
surface.WriteTextf(10, 130, "WINNER");
surface.SetForeground(blue);
surface.WriteTextf(80, 130, "%s", handTypes[handType]);
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
poker.ec - Poker Main Window
****************************************************************************/
import "ecere"
enum PokerHand { nothing, onePair, twoPair, threeOfAKind, straight, flush, fullHouse, fourOfAKind, straightFlush, royalFlush };
/*
-ROYAL FLUSH 0.0002 %
-STRAIGHT FLUSH 0.0012 %
-FOUR OF A KIND 0.0240 %
-FULL HOUSE 0.1441 %
-FLUSH 0.1967 %
-STRAIGHT 0.3532 %
-THREE OF A KIND 2.1128 %
-TWO PAIR 4.7539 %
-ONE PAIR 42.2569 %
-NOTHING 50.1570 %
+ROYAL FLUSH 0.0002 %
+STRAIGHT FLUSH 0.0012 %
+FOUR OF A KIND 0.0240 %
+FULL HOUSE 0.1441 %
+FLUSH 0.1967 %
+STRAIGHT 0.3532 %
+THREE OF A KIND 2.1128 %
+TWO PAIR 4.7539 %
+ONE PAIR 42.2569 %
+NOTHING 50.1570 %
*/
enum Facing { faceDown, faceUp };
if(!created) return;
- if(numPlayersLeft >= 2)
+ if(numPlayersLeft >= 2)
{
currentBet = 0;
for(p = 0; p<numPlayers; p++)
eInstance_DecRef(bet);
if(!created) return;
-
+
//player.thisBet = 0;
-
+
if(player.thisBet < currentBet)
{
player.folded = true;
// --- Poker Games Definitions ---
/*
- TEXAS HOLDEM - The most popular poker game in Blackhawk. A variation of 7-Card
+ TEXAS HOLDEM - The most popular poker game in Blackhawk. A variation of 7-Card
Stud where every player gets dealt 2 cards face down and there is a community
board of 5 cards. Players Ise the 2 cards in their hand plus the 5 community
cards to make the best possible 5 card hand. A dealers button moves around the
- table each hand. The player to the left of the dealer button is dealt the
- first card. Also the person to the left of the button has to post a blind.
- There is a betting round after the players receive their first 2 cards. Then the
- dealer places 3 cards on the board (the flop) and there is a betting round. Then
- the dealer places another card on the board (the turn) and there is another
- betting round. Then the dealer places the final card (the river) on the board
- and there is a final betting round. Games may have 1 blind or 2 blinds. Games
+ table each hand. The player to the left of the dealer button is dealt the
+ first card. Also the person to the left of the button has to post a blind.
+ There is a betting round after the players receive their first 2 cards. Then the
+ dealer places 3 cards on the board (the flop) and there is a betting round. Then
+ the dealer places another card on the board (the turn) and there is another
+ betting round. Then the dealer places the final card (the river) on the board
+ and there is a final betting round. Games may have 1 blind or 2 blinds. Games
vary from $2-5 betting to straight $5 betting.
*/
void TexasHoldem()
}
/*
- OMAHA - A games similar to Texas Holdem except the players are dealt 4 cards
+ OMAHA - A games similar to Texas Holdem except the players are dealt 4 cards
face down. There is a board of 5 community cards and you must Ise 2 cards out
- of your hand to make the best possible hand. The game may be played straight
- high or high/lowHand. There is a dealer button that moves around the table each
- hand and the player that has the dealers button may choose to play the game
- straight high or high/lowHand. The player to the left of the dealer button has
- to post a small blind of $1 and the person to his/her left has to post the
- large blind of $2. To qualify for a lowHand hand, the player must have 5 cards
- that are 8 or lowHander. There is a betting round after the players receive their
- 4 cards. Then the dealer places 3 cards on the board (the flop). After the
- betting round, the dealer places another card on the board (the turn) and there
- is another betting round. Then the dealer places the last card (the river) on
- the board and there is a final betting round. The betting limits are Isually
+ of your hand to make the best possible hand. The game may be played straight
+ high or high/lowHand. There is a dealer button that moves around the table each
+ hand and the player that has the dealers button may choose to play the game
+ straight high or high/lowHand. The player to the left of the dealer button has
+ to post a small blind of $1 and the person to his/her left has to post the
+ large blind of $2. To qualify for a lowHand hand, the player must have 5 cards
+ that are 8 or lowHander. There is a betting round after the players receive their
+ 4 cards. Then the dealer places 3 cards on the board (the flop). After the
+ betting round, the dealer places another card on the board (the turn) and there
+ is another betting round. Then the dealer places the last card (the river) on
+ the board and there is a final betting round. The betting limits are Isually
$2-$5.
*/
void OmahaHoldem()
{
int i;
cardBack.LoadT(":ecereCard.png",null,displaySystem);
-
+
for(i = 0; i < 52; i++)
{
bitmapCards[i] = Bitmap {};
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
pokerutils.c - Poker Backend Utilities
****************************************************************************/
import "poker.ec"
what[numPairs++] = card;
}
}
- if(numPairs)
+ if(numPairs)
{
int d;
qsort(what, numPairs, sizeof(int), Compare);
// --- External Functions ---
void POKER_SortCards(int * cards, int numCards)
-{
+{
qsort(cards, numCards, sizeof(int), Compare);
}
for(c = 0; c<52; c++)
{
int whichCut;
-
+
if(indexCut[0] < numCut[0] && indexCut[1] < numCut[1])
whichCut = GetRandom(0,1);
else if(indexCut[0] < numCut[0])
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
widow.ec - Widow Window
****************************************************************************/
import "poker.ec"
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
5, 5, 5, 10, 10, 15, 15, 15,
- 20, 20, 20, 25, 25, 25, 30, 30,
+ 20, 20, 20, 25, 25, 25, 30, 30,
30, 35, 35, 35, 40, 40, 40, 45,
- 45, 45, 50, 50, 50, 55, 55, 55,
+ 45, 45, 50, 50, 50, 55, 55, 55,
60, 60, 60, 65, 65, 65, 70, 70,
- 70, 75, 75, 75, 80, 80, 80, 85,
+ 70, 75, 75, 75, 80, 80, 80, 85,
90, 95, 100
};
static const int kindTable[37] =
{
0,
5, 5, 10, 10, 10, 15,
- 15, 15, 20, 20, 20, 25,
+ 15, 15, 20, 20, 20, 25,
25, 25, 30, 30, 30, 35,
35, 35, 40, 40, 40, 45,
50, 55, 60, 65, 70, 75,
for(kind=0; kind<(Kind)4; kind++)
{
- if(numberOfKind[kind] >= 3 &&
+ if(numberOfKind[kind] >= 3 &&
(trump == none || high[kind] > high[trump] || (high[kind] == high[trump] && numberOfKind[kind] > numberOfKind[trump])))
trump = kind;
}
case 8: kindScore = Min(kindScore, 80); break;
}
- if(trump == none || betTable[highTotal] > betTable[highTotal - high[trump]] + kindScore)
+ if(trump == none || betTable[highTotal] > betTable[highTotal - high[trump]] + kindScore)
{
trump = none;
bet = betTable[highTotal];
for(c=0; c<9; c++)
{
Card * card = &player.cards[c];
- if(card->kind == whichCard.kind &&
- card->number != whichCard.number &&
- card->number != ace &&
- card->number != _10 &&
+ if(card->kind == whichCard.kind &&
+ card->number != whichCard.number &&
+ card->number != ace &&
+ card->number != _10 &&
card->number != _5)
return true;
}
switch(trumpFlag)
{
case AnyCard: return c;
- case NoTrump:
+ case NoTrump:
if(trump == kindRequested || card->kind != trump)
return c;
break;
// Count the remaining trump
if(trump != none)
{
- int count = 0;
+ int count = 0;
for(c = 0; c<9; c++)
if(!player.left[trump][c])
count++;
for(kind = 0; kind<4; kind++)
for(c = 0; c<9; c++)
player.left[kind][c] = true;
- player.trumpLeft[0] = player.trumpLeft[1] =
+ player.trumpLeft[0] = player.trumpLeft[1] =
player.trumpLeft[2] = player.trumpLeft[3] = true;
for(c = 0; c<9; c++)
{
RuffGame * game = player.game;
Round * round = &game->rounds[game->round];
-
+
player.left[kind][number] = false;
// Mark this player as not having trump anymore
if(game->played[game->start].kind == round->bet.trump &&
EditBox edit { this, size = Size { 80, 20 }, anchor = Anchor { top = 10 }; };
- bool OnPostCreate()
+ bool OnPostCreate()
{
edit.Activate();
return true;
ruff.lastPlayed[0].kind = ruff.lastPlayed[1].kind =
ruff.lastPlayed[2].kind = ruff.lastPlayed[3].kind = None;
game.gameStarted = true;
-
+
Setup_EnableButtons(ruff.setup);
eWindow_Update(window, null);
eWindow_Update(ruff.scores, null);
}
}
}
-*/
+*/
ruff.lastPlayed[0].kind = ruff.lastPlayed[1].kind =
ruff.lastPlayed[2].kind = ruff.lastPlayed[3].kind = none;
game->gameStarted = true;
-
+
ruff.setup.EnableButtons();
ruff.Update(null);
ruff.scores.Update(null);
// The selected card
if(selectedCard != None && player->cards[selectedCard].kind != none)
- RUFF_DrawCard(surface,
- selectedCard * 20 + player->cards[selectedCard].kind * 71, 0,
+ RUFF_DrawCard(surface,
+ selectedCard * 20 + player->cards[selectedCard].kind * 71, 0,
&player->cards[selectedCard]);
}
surface.CenterTextf(namePos[c].x, namePos[c].y,game.players[c].name);
}
}
-
+
bool OnLeftButtonDown(int x, int y, Modifiers mods)
{
if(selectedCard != None && playedPlayer != none)
if(ptrCardLoad.Load(":cards.pcx",null,null))
{
int i;
- cardBack.LoadT(":ecereCard.png",null,displaySystem);
+ cardBack.LoadT(":ecereCard.png",null,displaySystem);
for(i=0;i<52;i++)
{
bitmapCards[i] = Bitmap {};
CopyBytesBy4(bitmapCards[i].palette, ptrCardLoad.palette, 256);
bitmapCards[i].Grab(ptrCardLoad,0,(ptrCardLoad.height/52)*i);
bitmapCards[i].transparent = true;
- bitmapCards[i].MakeDD(displaySystem);
+ bitmapCards[i].MakeDD(displaySystem);
}
}
delete ptrCardLoad;
// 5, 7, 8, 9,10, J, Q, K, A
4, 6, 7, 8, 9, 10, 11, 12, 0
};
-
+
if(card != null)
bitmap = bitmapCards[cardNo[card.number] * 4 + card.kind];
else
isRemote = true;
background = white;
borderStyle = fixed, hasVertScroll = true, text = "The Scores", anchor = Anchor { horz = 0.3, vert = 0.1 }, clientSize = Size { 316,441 };
-
+
bool OnPostCreate()
{
SetScrollLineStep(1, 20);
int r;
int scores[2]={0,0};
Ruff ruff = (Ruff)master;
-
+
if(ruff.game.players)
{
int scoreScroll = vertScroll.thumbPosition / 20;
surface.CenterTextf(37,40+r*20,"%c",ruff.game.players[shuffle].name[0]);
// Bet
- if(r + scoreScroll < ruff.game.round ||
+ if(r + scoreScroll < ruff.game.round ||
(r + scoreScroll == ruff.game.round && !ruff.game.betting && ruff.game.gameStarted))
{
int x = (round->bet.player%2) ? 188 : 162;
scores[0] += round->scores[0];
scores[1] += round->scores[1];
- if(r < ruff.game.round ||
+ if(r < ruff.game.round ||
(r == ruff.game.round && !ruff.game.betting && ruff.game.gameStarted))
{
// Winning box
surface.Area(201,41+(r-scoreScroll)*20,299,59+(r-scoreScroll)*20);
}
}
-
+
// Current Score
ShowScore(surface, 75, 40 + (r-scoreScroll) * 20, round->scores[0], r);
ShowScore(surface, 225, 40 + (r-scoreScroll) * 20, round->scores[1], r);
for(c = 0; c<NUMCARDS; c++)
{
int whichCut;
-
+
if(indexCut[0] < numCut[0] && indexCut[1] < numCut[1])
whichCut = GetRandom(0,1);
else if(indexCut[0] < numCut[0])
else
{
for(c = 0; c<4; c++)
- Player_InformNewRound(&game.players[c], game.round, game.rounds[game.round].shuffle,
+ Player_InformNewRound(&game.players[c], game.round, game.rounds[game.round].shuffle,
game.players[c].cards);
}
}
Card theCard = player.cards[card];
for(c = 0; c<4; c++)
- Player_InformCardPlayed(&game.players[c], player.id,
+ Player_InformCardPlayed(&game.players[c], player.id,
theCard.kind, theCard.number);
game.played[player.id] = theCard;
Player_InformStopGame(setup.player);
setup.player->socket = null;
}
-
+
setup.connected = false;
setup.player = null;
setup.EnableButtons();
strcpy(game->players[3].name, "Arnold");
game->players[0].ruff = game->players[1].ruff =
game->players[2].ruff = game->players[3].ruff = (Ruff)master;
-
+
playerNames[0] = EditBox { this, text = "Player 1", NotifyModified = PlayerNamedChanged,
position = Point { 10,30 }, size = Size { 140 }, id = 0, hotKey = alt1 };
-
+
playerTypes[0] = DropBox { this, position = Point { 160,30 }, id = 0, NotifySelect = PlayerTypeSelect };
playerNames[1] = EditBox { this, text = "Player 2", NotifyModified = PlayerNamedChanged,
OnGetString(name, trumpDialog, null);
len = strlen(name);
-
+
surface.TextExtent(name, len, &w, &h);
surface.WriteText(xStart, y, name, len);
-
+
// Draw the current row stipple
if(flags.selected)
{
surface.Rectangle(xStart - 3, y, xStart + w + 1, y + h - 1);
surface.LineStipple(0);
}
-
+
if(icon)
{
surface.SetForeground(white);
typedef struct
{
int typeOfHouse;
-
+
union
{
struct straight
{
int numCards;
int cardValues[13];
- House houseDown[4];
+ House houseDown[4];
int numHouseDown;
bool cardLifted[13];
bool callTag;
{
house++; //possible 3or4 of a kind house
}
- }
+ }
if(straight == cardsToCheck-1)
return 0;
else if(house == cardsToCheck-1)
int CompareInteger(int * a, int * b)
{
- if(*a > *b)
+ if(*a > *b)
return 1;
else if(*b > *a)
return -1;
int c;
for(c=0;c<numOfPlayers;c++)
{
- qsort(player[c].cardValues,player[c].numCards,sizeof(int),CompareInteger);
+ qsort(player[c].cardValues,player[c].numCards,sizeof(int),CompareInteger);
//qsort(tempHouse,tempCtr,sizeof(int),CompareInteger);
}
}
Bitmap ptrCardLoad {};
ptrCardLoad.Load(":cards.pcx",null,null);
cardBack.LoadT(":ecereCard.png", null, displaySystem);
-
+
for(i=0;i<52;i++)
{
Bitmap bitmap { transparent = true };
for(i=0;i<52;i++)
bitmapCards[i].Free();
}
-
+
void GameOver()
{
/*
Window gameOverBox
- {
+ {
this, hasClose = true, background = LightBlue, text = "Game Over", [position.y] = A_CENTER|20, size = Size { 300, 200 }
};
Button { gameOverBox, text = "Close", [position.y] = A_CENTER|80, size = Size { 80,20 } };
int h=0,i=0,j=0,k=0,x=0;
surface.Rectangle(375, 315, 495, 475);
-
+
if(gameOver)
{
surface.SetForeground(blue);
h++;
}
}
-
+
if(player[j].houseDown[i].typeOfHouse == 1)
{
for(k=0;k<4;k++) //player[j].houseDown[i].kind.suits[k]
{
- if(player[j].houseDown[i].kind.suits[k] == true)
+ if(player[j].houseDown[i].kind.suits[k] == true)
{
Bitmap bitmap = bitmapCards[MCARD((k),(player[j].houseDown[i].kind.number))];
surface.Blit(bitmap,xyPositions[j].x + OFFSETTER1 * h,xyPositions[j].y + 75,0,0, bitmap.width,bitmap.height);
}
suit = KIND(discard[discardCounter-1]);
number = NUMBER(discard[discardCounter-1]);
- tempHouse[tempCtr++] = discard[discardCounter-1];
+ tempHouse[tempCtr++] = discard[discardCounter-1];
for(i=0;i<player[currentPlayer].numCards;i++)
{
if(player[currentPlayer].cardLifted[i])
if(tempCtr >= 3)
{
int checkResult;
-
+
qsort(tempHouse,tempCtr,sizeof(int),CompareInteger);
checkResult = CheckHouse(tempCtr,tempHouse);
switch(checkResult)
House * house = &player[currentPlayer].houseDown[player[currentPlayer].numHouseDown];
house->typeOfHouse = checkResult;
for(i=0;i<tempCtr;i++)
- {
+ {
house->kind.number = NUMBER(tempHouse[i]);
- house->kind.suits[KIND(tempHouse[i])] = true;
- }
+ house->kind.suits[KIND(tempHouse[i])] = true;
+ }
player[currentPlayer].numHouseDown++;
break;
}
house->typeOfHouse = checkResult;
house->straight.first = NUMBER(tempHouse[0]);
house->straight.last = NUMBER(tempHouse[tempCtr-1]);
- house->straight.suit = KIND(tempHouse[0]);
+ house->straight.suit = KIND(tempHouse[0]);
player[currentPlayer].numHouseDown++;
break;
}
j++;
}
}
- player[currentPlayer].numCards = j;
+ player[currentPlayer].numCards = j;
discard[discardCounter--];
drawButton[currentPlayer].disabled = true;
chowButton[currentPlayer].disabled = true;
callButton[currentPlayer].disabled = true;
showButton[currentPlayer].disabled = false;
dumpButton[currentPlayer].disabled = false;
- Update(null);
+ Update(null);
}
if(player[currentPlayer].numCards == 0)
{
}
bool DumpClicked(Button button, int x, int y, Modifiers mods)
- {
+ {
MessageBox { text = button.text }.Create();
return true;
}
House * house = &player[currentPlayer].houseDown[player[currentPlayer].numHouseDown];
house->typeOfHouse = checkResult;
for(i=0;i<tempCtr;i++)
- {
+ {
house->kind.number = NUMBER(tempHouse[i]);
- house->kind.suits[KIND(tempHouse[i])] = true;
- }
+ house->kind.suits[KIND(tempHouse[i])] = true;
+ }
player[currentPlayer].numHouseDown++;
break;
}
house->typeOfHouse = checkResult;
house->straight.first = NUMBER(tempHouse[0]);
house->straight.last = NUMBER(tempHouse[tempCtr-1]);
- house->straight.suit = KIND(tempHouse[0]);
+ house->straight.suit = KIND(tempHouse[0]);
player[currentPlayer].numHouseDown++;
break;
}
j++;
}
}
- player[currentPlayer].numCards = j;
+ player[currentPlayer].numCards = j;
if(player[currentPlayer].numCards == 0)
{
GameOver();
}
- Update(null);
+ Update(null);
}
return true;
}
width = bitmap.width;
height = bitmap.height;
xCursorPositionAtCard = (xyPositions[currentPlayer].x + (OFFSETTER1 * i)) - x;
- yCursorPositionAtCard = (player[currentPlayer].cardLifted[i] ?
- (xyPositions[currentPlayer].y - OFFSETTER2 - y - 20) :
+ yCursorPositionAtCard = (player[currentPlayer].cardLifted[i] ?
+ (xyPositions[currentPlayer].y - OFFSETTER2 - y - 20) :
(xyPositions[currentPlayer].y - OFFSETTER2 - y));
flagButtonDown = true;
OnMouseMove(x,y,mods);
Box boxCard = {x + xCursorPositionAtCard,y + yCursorPositionAtCard, x + xCursorPositionAtCard + width - 1, y + yCursorPositionAtCard + height - 1};
if(flagButtonDown)
{
- if(boxCard.Overlap(boxDiscard))
+ if(boxCard.Overlap(boxDiscard))
{
xLeftButtonUp = 400;
yLeftButtonUp = 350;
for(j=0;j<numOfPlayers;j++)
{
Bitmap bitmap = cardBack;
- Box boxHouseDown =
- {
+ Box boxHouseDown =
+ {
xyPositions[j].x,xyPositions[j].y + 75,
0, xyPositions[j].y + 75 + bitmap.height
};
(player[j].houseDown[i].straight.last - player[j].houseDown[i].straight.first) * OFFSETTER1 - 1;
if(boxCard.Overlap(boxHouseDown))
{
- if(dragCard == MCARD((player[j].houseDown[i].straight.suit),(player[j].houseDown[i].straight.first)) - 4)
+ if(dragCard == MCARD((player[j].houseDown[i].straight.suit),(player[j].houseDown[i].straight.first)) - 4)
{
player[j].houseDown[i].straight.first --;
CopyBytesBy4(&player[currentPlayer].cardValues[cardToReposition],
player[j].callTag = true;
j = numOfPlayers;
break;
-
+
}
else if(dragCard == MCARD((player[j].houseDown[i].straight.suit),(player[j].houseDown[i].straight.last )) + 4)
{
break;
}
}
- boxHouseDown.left +=
+ boxHouseDown.left +=
(player[j].houseDown[i].straight.last - player[j].houseDown[i].straight.first + 2) * OFFSETTER1;
}
else if(player[j].houseDown[i].typeOfHouse == 1)
flagButtonDown = false;
ReleaseCapture();
Update(null);
- }
+ }
return true;
}
Update(null);
return false;
}
-
+
}
return true;
}
xyPositions[currentPlayer].x + (OFFSETTER1 * i),
(player[currentPlayer].cardLifted[i] ? (xyPositions[currentPlayer].y - OFFSETTER2 - 20) :(xyPositions[currentPlayer].y - OFFSETTER2)),
bitmap.width + (xyPositions[currentPlayer].x + OFFSETTER1 * i),
- bitmap.height + (player[currentPlayer].cardLifted[i] ? (xyPositions[currentPlayer].y - OFFSETTER2 - 20) : (xyPositions[currentPlayer].y - OFFSETTER2))
+ bitmap.height + (player[currentPlayer].cardLifted[i] ? (xyPositions[currentPlayer].y - OFFSETTER2 - 20) : (xyPositions[currentPlayer].y - OFFSETTER2))
}.IsPointInside(Point{x,y}) && drawButton[currentPlayer].disabled)
{
width = bitmap.width;
height = bitmap.height;
xCursorPositionAtCard = (xyPositions[currentPlayer].x + (OFFSETTER1 * i)) - x;
- yCursorPositionAtCard = (player[currentPlayer].cardLifted[i] ?
- (xyPositions[currentPlayer].y - OFFSETTER2 - y - 20) :
+ yCursorPositionAtCard = (player[currentPlayer].cardLifted[i] ?
+ (xyPositions[currentPlayer].y - OFFSETTER2 - y - 20) :
(xyPositions[currentPlayer].y - OFFSETTER2 - y));
flagButtonDown = true;
OnMouseMove(x,y,mods);
bool OnRightButtonUp(int x, int y, Modifiers mods)
{
Bitmap bitmap = cardBack;
- int swapCard,dest,source,i;
+ int swapCard,dest,source,i;
Box boxPlayerCards={xyPositions[currentPlayer].x,xyPositions[currentPlayer].y - OFFSETTER2,
- xyPositions[currentPlayer].x + player[currentPlayer].numCards * OFFSETTER1 + bitmap.width,
+ xyPositions[currentPlayer].x + player[currentPlayer].numCards * OFFSETTER1 + bitmap.width,
xyPositions[currentPlayer].y - OFFSETTER2 + bitmap.height};
Box boxCard = {x + xCursorPositionAtCard,y + yCursorPositionAtCard, x + xCursorPositionAtCard,y + yCursorPositionAtCard + height - 1};
{
if(boxCard.Overlap(boxPlayerCards))
{
- swapCard = (x + xCursorPositionAtCard >= player[currentPlayer].numCards * 15 + xyPositions[currentPlayer].x) ?
+ swapCard = (x + xCursorPositionAtCard >= player[currentPlayer].numCards * 15 + xyPositions[currentPlayer].x) ?
(player[currentPlayer].numCards-1) : ((x + xCursorPositionAtCard - xyPositions[currentPlayer].x) / 15);
if(cardToReposition > swapCard)
{
MoveBytes(&player[currentPlayer].cardValues[dest],
&player[currentPlayer].cardValues[source],(swapCard - cardToReposition) * sizeof(int));
player[currentPlayer].cardValues[swapCard] = dragCard;
- //player[currentPlayer].cardLifted[swapCard] = false;
+ //player[currentPlayer].cardLifted[swapCard] = false;
}
}
-
+
for(i=0;i<player[currentPlayer].numCards;i++)
{
player[currentPlayer].cardLifted[i] = false;
- }
+ }
flagButtonDown = false;
ReleaseCapture();
OthelloService service { port = OTHELLO_PORT, othello = this };
// Default properties
- background = black, tabCycle = true, text = "ECERE Othello", borderStyle = sizable, hasClose = true,
+ background = black, tabCycle = true, text = "ECERE Othello", borderStyle = sizable, hasClose = true,
size.h = 480, clientSize.w = NUM_COLUMNS*WIDTH;
// --- Othello Utilities ---
{
int x,y;
int numChips = 0;
-
+
sx += dx;
sy += dy;
-
+
// Out of the board...
if(sx < 0 || sx >= NUM_COLUMNS || sy < 0 || sy >= NUM_ROWS)
return 0;
-
+
// Chip of the same color...
if(board[sy][sx] == color || board[sy][sx] == empty)
return 0;
-
- for(x = sx, y = sy;
- x >= 0 && x < NUM_COLUMNS && y >= 0 && y < NUM_ROWS;
+
+ for(x = sx, y = sy;
+ x >= 0 && x < NUM_COLUMNS && y >= 0 && y < NUM_ROWS;
x += dx, y += dy)
{
// Chip of the same color at the end of the line...
{
if(turn)
{
- for(x = sx, y = sy;
+ for(x = sx, y = sy;
x >= 0 && x < NUM_COLUMNS && y >= 0 && y < NUM_ROWS;
x += dx, y += dy)
{
- if(board[y][x] == color)
+ if(board[y][x] == color)
break;
else
board[y][x] = color;
else
numChips ++;
}
-
+
// No chip of the same color at the end...
return 0;
}
-
+
bool PossibleMove()
{
bool validMove = false;
validMove = true;
return validMove;
}
-
+
int TurnChips(int sx, int sy, ChipColor color, int turn)
{
int x,y;
int numChips = 0;
-
+
for(y = -1; y <= 1; y++)
for(x = -1; x <= 1; x++)
if(x || y)
this.numChips[color] += numChips + 1;
this.numChips[1-color] -= numChips;
this.turn = 1-color;
-
+
if(!PossibleMove())
{
this.turn = color;
if(!PossibleMove())
gameOver = true;
}
-
+
Update(null);
}
return numChips;
}
-
+
void NewGame()
{
int x,y;
-
+
for(y = 0; y<NUM_ROWS; y++)
for(x = 0; x<NUM_COLUMNS; x++)
board[y][x] = empty;
gameOver = false;
Update(null);
}
-
+
void EnableButtons()
{
join.disabled = false;
disconnect.disabled = false;
stop.disabled = false;
localGame.disabled = false;
-
+
if(gameRunning || hosting || sockets[SERVER])
localGame.disabled = true;
- if(!hosting)
+ if(!hosting)
stop.disabled = true;
if(!gameRunning && !sockets[SERVER])
disconnect.disabled = true;
-
+
if(hosting || sockets[SERVER] || local)
host.disabled = true;
-
+
if(sockets[SERVER] || local || hosting)
join.disabled = true;
-
+
address.disabled = join.disabled;
}
// Children
- Button localGame
+ Button localGame
{
parent = this, text = "Local Game", position = Point{ 160, 330 }, size = Size { 100, 20 }, hotKey = altL;
surface.WriteTextf(50, 420, "It is your turn to move.");
}
}
-
+
bool OnKeyDown(Key key, unichar ch)
{
if(key == escape) Destroy(0);
}
}
return true;
- }
+ }
}
// --- Othello Communication ---
othello.sockets[SERVER] = null;
othello.gameRunning = false;
}
-
+
othello.EnableButtons();
othello.Update(null);
}
}
return 0;
}
-
+
void OnConnect()
{
othello.sockets[SERVER] = this;
othello.EnableButtons();
othello.NewGame();
}
-
+
property Othello othello { set { othello = value; } }
}
if(!othello.sockets[CLIENT] && !othello.gameRunning)
{
OPacket packet { newGame };
-
+
othello.sockets[CLIENT] = OthelloSocket { this, othello = othello };
othello.sockets[CLIENT].Send((byte *)&packet, sizeof(OPacket));
-
+
othello.NewGame();
othello.gameRunning = true;
othello.EnableButtons();
LoadWords(dicos[value]);
}
}
-
+
Letters board[15][15];
Letters blankValues[15][15];
PlayedMove curMove;
move.tiles[move.numTiles++].letter = letter;
}
}
-
+
void NewGame()
{
int c;
int numPlayers = 0;
-
+
for(c = 0; c<MaxPlayers; c++)
if(players[c])
numPlayers++;
Letters l;
PlayerList list { };
PlayedMove tiles { };
-
+
numLettersAvailable = 0;
-
+
for(l = 0; l<Letters::empty; l++)
{
numLettersAvailable += lettersCount[language][l];
char word[100];
f.GetLine(word, sizeof(word));
dictionary.Add(CopyString(word));
- }
+ }
delete f;
}
-
+
/*{
IteratorPointer test1, test2;
test1 = dictionary.Find("gewurztraminer");
test2 = dictionary.Find("gewurstraminer");
Print("");
}*/
-
+
}
bool CheckWord(Letters newBoard[15][15], Direction direction, int where, int start, int end, int * score)
}
for(c = first; c>=0; c--)
- {
+ {
Letters letter = direction ? newBoard[c][where] : newBoard[where][c];
if(letter == empty) break;
wordStart = c;
anchored = true;
}
for(c = last; c<15; c++)
- {
+ {
Letters letter = direction ? newBoard[c][where] : newBoard[where][c];
if(letter == empty) break;
wordEnd = c;
int a;
for(a = where; a>=0; a--)
- {
+ {
Letters letter = direction ? newBoard[c][a] : newBoard[a][c];
if(letter == empty) break;
wordStart = a;
anchored = true;
}
for(a = where; a<15; a++)
- {
+ {
Letters letter = direction ? newBoard[c][a] : newBoard[a][c];
if(letter == empty) break;
wordEnd = a;
delete scrabbleGame.players[player.id];
delete player;
scrabbleGame.EndGame();
- }
+ }
}
int Join()
{
int c;
PlayedMove newTiles { };
-
+
for(c = 0; c<move.numTiles; c++)
{
int d;
memmove(player.letters + d, player.letters + d + 1, sizeof(int) * (player.numLetters - d - 1));
player.numLetters--;
break;
- }
+ }
}
scrabbleGame.GetTiles(scrabbleGame.curPlayer, newTiles);
for(c = 0; c<move.numTiles; c++)
{
scrabbleGame.lettersAvailable[move.tiles[c].letter]++;
- scrabbleGame.numLettersAvailable++;
+ scrabbleGame.numLettersAvailable++;
}
scrabbleGame.curMove = { }; // TODO: Add informing other players of number of exchanged letters when passing...
for(c = 0; c<Letters::blank; c++)
{
list.AddRow().SetData(field, c);
- }
+ }
}
}
char ch = (char)a + 'A';
surface.SetForeground(blank ? gray : black);
surface.TextFont(letterFont.font);
- surface.WriteText(x + 5, y, &ch, 1);
+ surface.WriteText(x + 5, y, &ch, 1);
if(!blank)
{
if(boardLetters[cy][cx] == empty)
{
- surface.Area(x + 2, y + 2, x + TileSize - 1, y + TileSize - 1);
+ surface.Area(x + 2, y + 2, x + TileSize - 1, y + TileSize - 1);
surface.SetForeground(black);
if(cx == 7 && cy == 7)
{
else if(boardLetters[cy][cx] == empty)
{
surface.SetBackground(burlyWood);
- surface.Area(x + 2, y + 2, x + TileSize - 1, y + TileSize - 1);
- }
+ surface.Area(x + 2, y + 2, x + TileSize - 1, y + TileSize - 1);
+ }
}
void OnRedraw(Surface surface)
surface.HLine(BoardX, BoardX + TileSize * 15, BoardY + y * TileSize);
surface.HLine(BoardX, BoardX + TileSize * 15, BoardY + y * TileSize+1);
}
-
+
for(x = 0; x<16; x++)
{
surface.VLine(BoardY + 0, BoardY + TileSize * 15, BoardX + x * TileSize);
{
DrawSquare(surface, x, y);
}
-
+
for(c = 0; c<numLetters; c++)
{
if(dragging && c == dragLetter)
// Picking Letters on the board
if(gameStarted && turn == playerID)
{
- if(mx > BoardX && mx < BoardX + TileSize * 15 &&
+ if(mx > BoardX && mx < BoardX + TileSize * 15 &&
my > BoardY && my < BoardY + TileSize * 15)
{
int x = (mx - BoardX) / TileSize;
blankValues[y][x] = empty;
numLetters++;
dragging = true;
-
+
dragY = my;
dragPos = -1;
Capture();
numLetters++;
dragging = true;
-
+
dragY = my;
dragPos = -1;
Capture();
else if(posA > posB)
return 1;
else
- return 0;
+ return 0;
}
bool OnMouseMove(int mx, int my, Modifiers mods)
for(c = 0; c<numLetters; c++)
ordered[c] = c;
-
+
if(y < TileSize && y > -TileSize && moveX + TileSize >= 0 && moveX <= TrayWidth)
{
qsort(ordered, numLetters, sizeof(int), ComparePositions);
memmove(ordered + dragPos + 1, ordered + dragPos, (pos - dragPos) * sizeof(int));
ordered[dragPos] = dragLetter;
}
-
+
ordered[dragPos] = dragLetter;
ordered[pos] = oldValue;
}
if(out && c != numLetters)
collision = true;
}
-
+
if(moveX >= lastX || collision)
{
int end;
-
+
for(c = 0; c<numLetters; c++)
{
if(ordered[c] == dragLetter)
break;
}
}
-
+
end = moveX + TileSize;
for(; c < numLetters; c++)
}
end = ((ordered[c] == dragLetter) ? moveX : positions[ordered[c]]) + TileSize;
}
-
+
// RIGHT LIMIT
end = TrayWidth;
for(c = numLetters-1; c>= 0; c--)
// Dropping On the board
if(gameStarted && turn == playerID)
{
- if(mx > BoardX && mx < BoardX + TileSize * 15 &&
+ if(mx > BoardX && mx < BoardX + TileSize * 15 &&
my > BoardY && my < BoardY + TileSize * 15)
{
x = (mx - BoardX) / TileSize;
int end;
int ordered[7];
int c;
-
+
for(c = 0; c<numLetters; c++)
ordered[c] = c;
qsort(ordered, numLetters, sizeof(int), ComparePositions);
positions[ordered[c]] = end;
end = positions[ordered[c]] + TileSize;
}
-
+
// RIGHT LIMIT
end = TrayWidth;
for(c = numLetters-1; c>= 0; c--)
{
dragging = false;
ReleaseCapture();
-
+
if(my > ThrowHeight)
{
throwLetters[numThrowLetters++] = letters[dragLetter];
// Dropping Letters on the board
if(gameStarted && turn == playerID)
{
- if(mx > BoardX && mx < BoardX + TileSize * 15 &&
+ if(mx > BoardX && mx < BoardX + TileSize * 15 &&
my > BoardY && my < BoardY + TileSize * 15)
{
int x = (mx - BoardX) / TileSize;
}
DataField scoreFields[MaxPlayers];
-
- Button playBtn
+
+ Button playBtn
{
this, text = "Play", bevel = false, position = { 520, 540 };
font = { "Arial", 20, true };
opacity = 0; drawBehind = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(!numThrowLetters && gameStarted && turn == playerID)
this, text = "Throw / Pass", bevel = false, position = { 430, 622 };
font = { "Arial", 20, true };
opacity = 0; drawBehind = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
bool placed = false;
this, text = "Connect", bevel = false, position = { 520, 122 };
font = { "Arial", 20, true };
opacity = 0; drawBehind = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(!server)
int y = move.tiles[c].y;
scrabble.boardLetters[y][x] = move.tiles[c].letter;
scrabble.blankValues[y][x] = move.tiles[c].blankValue;
- }
+ }
scrabble.playerScores[move.player] += move.score;
scrabble.scores.AddRow().SetData(scrabble.scoreFields[move.player], scrabble.playerScores[move.player]);
scrabble.Update(null);
memcpy(scrabble.lastBoard, scrabble.boardLetters, sizeof(scrabble.lastBoard));
-
+
do
{
scrabble.turn++;
this, text = "Start", bevel = false, position = { 520, 222 };
font = { "Arial", 20, true };
opacity = 0; drawBehind = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(scrabbleGame)
this, text = "Host (Français)", bevel = false, position = { 520, 322 };
font = { "Arial", 16, true };
opacity = 0; drawBehind = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(!scrabbleGame || !scrabbleGame.gameStarted)
this, text = "Host (English)", bevel = false, position = { 520, 362 };
font = { "Arial", 16, true };
opacity = 0; drawBehind = true;
-
+
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(!scrabbleGame || !scrabbleGame.gameStarted)
Copyright (c) 2001-2007 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
tetris.ec - Tetris
****************************************************************************/
import "ecere"
host.disabled = false;
disconnect.disabled = false;
stop.disabled = false;
-
+
if(!hosting)
stop.disabled = true;
if(!sockets[SERVER])
if(hosting || sockets[SERVER])
host.disabled = true;
-
+
if(sockets[CLIENT] || hosting)
join.disabled = true;
case 0: case 2: rx += piece->x0; break;
case 1: case 3: rx += piece->x1; break;
}
-
+
square = piece->data[y * piece->w + x];
if(square)
surface.Blit(squares[square-1], (rx + playerx) * 16, (ry + playery) * 16, 0, 0, 16, 16);
case 0: case 2: rx += piece->x0; break;
case 1: case 3: rx += piece->x1; break;
}
-
+
square = piece->data[y * piece->w + x];
if(square)
surface.Blit(squares[square-1], rx * 16 + (WIDTH + 2) * 16, ry * 16 + 10, 0, 0, 16, 16);
memmove(&board[1], &board, y * WIDTH);
memset(&board, 0, WIDTH);
y++;
- }
+ }
}
NewPiece();
playery++;
}
playery--;
- FreezePiece();
+ FreezePiece();
}
bool CheckPiece()
playerx = Min(playerx, 12 - ((angle == 0 || angle == 2) ? (piece->x0 + piece->w) : (piece->x1 + piece->h)));
if(CheckPiece())
{
- if(key == left) playerx++; else playerx--;
+ if(key == left) playerx++; else playerx--;
}
break;
case down:
FreezePiece();
}
break;
- case up:
+ case up:
{
int oldx = playerx;
angle++;
listBox1.AddField( field1 );
listBox1.AddField( field2 );
-
+
listBox1.currentRow = listBox1.AddRow();
listBox1.SetData( field1, 2 );
Label label
{
- this, position = { 10, 10 }, font = { "Arial", 30 },
+ this, position = { 10, 10 }, font = { "Arial", 30 },
text = "Hello, World!!"
};
};
void OnRedraw(Surface surface)
{
Bitmap bitmap = castleGfx.bitmap;
-
+
if(bitmap)
surface.Blit(bitmap, 100, 100, 0,0, bitmap.width, bitmap.height);
}
surface.foreground = white;
surface.Rectangle(x-2, y-2, x + bmp.width+1, y + bmp.height+1);
}
- }
+ }
}
public:
class Mage : WorldObject { res = mageGfx; selectable = true; }
class Archer : WorldObject { res = archerGfx; selectable = true; }
class Castle : WorldObject { res = castleGfx; }
-
+
Array<WorldObject> objects
{ [
Castle { 180, 150 },
Dragon { 320, 50 }
] };
-WorldObject selected;
+WorldObject selected;
class WorldObjectController : WindowController<WorldObject>
{
surface.foreground = white;
surface.Rectangle(x-2, y-2, x + bmp.width+1, y + bmp.height+1);
}
- }
+ }
}
public:
Dragon { 320, 50 }
] };
-WorldObject selected;
+WorldObject selected;
class MainWindow : Window
{
surface.foreground = white;
surface.Rectangle(x-2, y-2, x + bmp.width+1, y + bmp.height+1);
}
- }
+ }
}
public:
class Mage : WorldObject { res = mageGfx; selectable = true; }
class Archer : WorldObject { res = archerGfx; selectable = true; }
class Castle : WorldObject { res = castleGfx; }
-
+
Array<WorldObject> objects
{ [
Castle { 180, 150 },
Dragon { 320, 50 }
] };
-WorldObject selected;
+WorldObject selected;
class MainWindow : Window
{
class Mage : WorldObject { res = mageGfx; }
class Archer : WorldObject { res = archerGfx; }
class Castle : WorldObject { res = castleGfx; }
-
+
Array<WorldObject> objects
{ [
Castle { 180, 150 },
size = Size { 300, 200 };
borderStyle = sizable;
text = "Sizable";
-
+
Button
{
this, text = "Push Me", position = { 100, 20 }, size = { 80, 30 };
surface.Clear(colorBuffer);
time.GetLocalTime();
surface.SetForeground({ 128, darkGray });
- surface.WriteTextf(0,0, "%02d:%02d:%02d",
+ surface.WriteTextf(0,0, "%02d:%02d:%02d",
time.hour, time.minute, time.second);
surface.SetForeground({ 192, teal });
- surface.WriteTextf(2, 2, "%02d:%02d:%02d",
+ surface.WriteTextf(2, 2, "%02d:%02d:%02d",
time.hour, time.minute, time.second);
-
+
}
}
for (i=0; i<=d; i++)
surface.DrawLine(0,i*h/d,i*w/d,h);
}
-
+
/*void OnRedraw(Surface surface)
{
int i,w,h,d;
bool OnLeftButtonDown(int x, int y, Modifiers mods)
{
-
+
return true;
- }
+ }
};
define skinBackground = Color { r = 40, g = 40, b = 40 };
surface.Area(0, clientSize.h / 2 - 3, clientSize.w-1, clientSize.h/2 + 3);
surface.SetForeground(black);
surface.Rectangle(1, clientSize.h / 2 - 2, clientSize.w-2, clientSize.h/2 + 2);
-
+
surface.SetBackground(darkGray);
surface.Area(pos - 3, 0, pos + 3, clientSize.h-1);
surface.SetForeground(white);
import "ecere"
-
+
class ColorFun : Window
{
text = "Fun With Colors and Data Boxes";
nativeDecorations = true;
tabCycle = true;
size = { 640, 480 };
-
+
Color color;
color = activeBorder;
SavingDataBox colorBox
- {
+ {
this, size = { 116, 20 }, position = { 176, 104 }; data = &color; type = class(Color);
-
+
bool NotifyChanged(bool closingDropDown)
{
background = color;
return true;
}
};
-
+
Date date;
DateTime now;
date = (now.GetLocalTime(), Date { now.year, now.month, now.day });
SavingDataBox dateBox
- {
+ {
this, size = { 200, 20 }, position = { 376, 104 }; data = &date; type = class(Date);
};
DateTime dateTime;
dateTime = now;
SavingDataBox dateTimeBox
- {
+ {
this, size = { 200, 20 }, position = { 376, 304 }; data = &dateTime; type = class(DateTime);
};
-
+
double d;
d = Pi;
SavingDataBox doubleBox
- {
+ {
this, size = { 116, 20 }, position = { 176, 204 }; data = &d; type = class(double);
};
}
-
+
ColorFun form {};
struct WindowAsteroid {
Window win;
int dx, dy;
-
+
property int x {
get { return win.position.x; }
set { win.position.x = value; }
Window holder;
uint count;
WindowAsteroid *item;
-
+
void Initialize(uint wcount, Window win[]) {
uint i;
count = wcount;
} while (!item[i].dx && !item[i].dy);
}
}
-
+
void Advance(void) {
WindowAsteroid *i = item;
uint d = count;
i->dy = -i->dy;
}
}
-
+
~WindowAsteroidField() {
delete item;
}
return true;
}
};
- Button button4
- {
+ Button button4
+ {
this, text = "Enabled", position = { 288, 88 }, isCheckbox = true, checked = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
};
EditBox editBox1 { this, text = "editBox1", contents = "0", position = { 96, 56 }, readOnly = true };
EditBox editBox2 { this, text = "editBox2", contents = "0", position = { 296, 56 }, readOnly = true };
- Button button3
- {
+ Button button3
+ {
this, text = "Enabled", position = { 88, 88 }, isCheckbox = true, checked = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
return true;
}
};
- Button button2
- {
+ Button button2
+ {
this, text = "Up Me", size = { 119, 21 }, position = { 280, 24 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
return true;
}
};
- Button button1
- {
+ Button button1
+ {
this, text = "Up Me", size = { 95, 21 }, position = { 88, 24 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
}
return false;
}
- EditBox editBox
+ EditBox editBox
{
this, font = { "Lucida Console", 10 }, anchor = { left = 0.0, top = 0.0, right = 0.0, bottom = 0.0 }, hasHorzScroll = true, hasVertScroll = true, multiLine = true;
bool OnFileModified(FileChange fileChange, char * param)
{
-
+
return true;
}
bool Init()
{
app = this;
-
+
if(argc == 2)
strcpy(paramLocation, argv[1]); // how to check if the path is valid?
else
paramLocation[0] = '\0';
appWindow = eNodepadWindow { };
-
+
return true;
}
}
Copyright (c) 2001 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
FliPlayApp.ec - Main Module
****************************************************************************/
import "fliPlay"
class FliPlayApp : GuiApplication
-{
+{
appName = "ECERE FLC Player";
// driver = "OpenGL";
{
FliPlay
{
- borderStyle = sizable, hasClose = true, hasMaximize = true, hasMinimize = true,
+ borderStyle = sizable, hasClose = true, hasMaximize = true, hasMinimize = true,
text = "ECERE FLC Player", anchor = { left = 0.125, top = 0.125, right = 0.125, bottom = 0.125 },
animation = argv[1]
};
while(stack.count > 0)
{
ShortPoint point = stack.Pop();
-
+
picture = (ColorAlpha *)bitmap.picture + (point.y * bitmap.stride) + point.x;
if(*picture == oldColor)
{
int x = point.x, sx = point.x;
int y = point.y;
bool upIn = false, downIn = false;
-
+
while(x > 0)
{
x--;
if(*picture != oldColor) break;
sx = x;
}
-
+
pic = picture = (ColorAlpha *)bitmap.picture + (y * bitmap.stride) + sx;
pictureUp = (y > 0) ? (picture - bitmap.stride) : null;
pictureDown = (y < bitmap.height - 1) ? (picture + bitmap.stride) : null;
hasVertScroll = true;
hasHorzScroll = true;
borderStyle = deep;
-
+
Bitmap bitmap
{
-
+
};
void OnRedraw(Surface surface)
delete dialog;
return true;
}
-
- };
+
+ };
DrawingArea drawingArea
{
this,
return true;
}
};
- Button fillBtn
- {
+ Button fillBtn
+ {
this, text = "Fill", position = { 24, 64 };
toggle = true;
return true;
}
};
- Button clearBtn
- {
+ Button clearBtn
+ {
this, text = "Clear", position = { 24, 104 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
running_b = value;
goItem.checked = value;
wheelSpinner.started = value;
-
+
centerItem.disabled = value;
nudgeLeftItem.disabled = value;
nudgeRightItem.disabled = value;
nudgeUpItem.disabled = value;
nudgeDownItem.disabled = value;
-
+
if (!value)
Update(null);
}
Timer wheelSpinner {this, 0.015, started=false;
bool DelayExpired() {
double t = GetTime();
-
+
this.modifiedDocument = true;
-
+
//game.FrameMulti(LOGICAL_FPS/DRAWN_FPS*2);
game.FrameMulti((uint)((t-lastFrameTime)*LOGICAL_FPS));
lastFrameTime = t;
-
+
//let's center the camera on the ball
{
Coord2D p = game.vehicles[0].location;
bool NotifySelect(MenuItem selection, Modifiers mods)
{
- if (MessageBox {master=this, text = "OpenRider",
+ if (MessageBox {master=this, text = "OpenRider",
contents="Are you sure you want to clear the current track and start a new one?",
type=yesNo}.Modal() != yes)
return true;
MenuItem fileSaveAsItem { fileMenu, "Save As...", a, Key {a, ctrl = true}, NotifySelect=MenuFileSaveAs }
MenuDivider {fileMenu};
MenuItem exitItem {fileMenu, "Exit", x, altF4, NotifySelect = MenuFileExit };
-
+
Menu viewMenu {menu, "View", v};
MenuItem centerItem {viewMenu, "Center on ball", c, tab;
bool NotifySelect(MenuItem selection, Modifiers mods) {
MenuItem nudgeRightItem {viewMenu, "Right", r, right, NotifySelect = NudgeCallback, id=1}
MenuItem nudgeUpItem {viewMenu, "Up", u, up, NotifySelect = NudgeCallback, id=2}
MenuItem nudgeDownItem {viewMenu, "Down", d, down, NotifySelect = NudgeCallback, id=3}
-
+
bool NudgeCallback(MenuItem selection, Modifiers mods) {
Camera2D *c = camera;
double nudgeAmount = 20.0 / c->zoom;
-
+
if (running)
return true;
-
+
if (selection.id == 0)
c->x -= nudgeAmount;
else if (selection.id == 1)
c->y -= nudgeAmount;
else
c->y += nudgeAmount;
-
+
Update(null);
-
+
return true;
}
-
+
Menu toolMenu {menu, "Tool", t};
MenuItem browseItem {toolMenu, "Browse", b, b, checked=false, isRadio=true, NotifySelect = MyCustomMenu};
MenuItem pencilItem {toolMenu, "Draw", d, d, checked=true, isRadio=true, NotifySelect = MyCustomMenu};
MenuItem speedItem {toolMenu, "Right accelerator", r, r, checked=false, isRadio=true, NotifySelect = MyCustomMenu};
MenuItem slowItem {toolMenu, "Left accelerator", f, f, checked=false, isRadio=true, NotifySelect = MyCustomMenu};
MenuItem decorItem {toolMenu, "Decoration", c, c, checked=false, isRadio=true, NotifySelect = MyCustomMenu};
-
+
Menu controlMenu {menu, "Control", c};
MenuItem goItem {controlMenu, "Go", g, Key {g, ctrl=true}, checked=false, checkable=true;
bool NotifySelect(MenuItem selection, Modifiers mods)
drawingTool = line;
else if (eraserItem.checked)
drawingTool = eraser;
-
+
if (normalItem.checked)
gameLineType = regular;
else if (speedItem.checked)
f.Read(vn, 1, 16);
vn[15] = 0;
f.Get(mv);
-
+
if (mv > max_version_code_supported) {
const char *vnp = *vn ? vn : "www.thedailywtf.com";
const char *message_format = "This track was created by a newer version of OpenRider (version %s). Continue opening it?";
for (i=0; i<ROTATION_RESOLUTION; i++)
wheel[i] = CreateRotatedBitmap(wheel_orig, 48.0/64.0, (double)i*2*Pi/ROTATION_RESOLUTION, wheel_background);
-
+
for (i=0; i<ROTATION_RESOLUTION; i++)
wheel[i].MakeDD(displaySystem);
#else
for (i=0; i<ROTATION_RESOLUTION; i++)
wheel[i] = wheel_orig;
#endif
-
+
return true;
}
Zoom(1/1.05, true);
break;
case wheelUp:
- Zoom(1.05, true);
+ Zoom(1.05, true);
break;
case minus:
Zoom(1/1.25, false);
bool needUpdate = false;
int x,y;
double fx, fy;
-
+
GetMousePosition(&x, &y);
fx = (double)(x-(clientSize.w>>1))/c->zoom+c->x;
fy = (double)(y-(clientSize.h>>1))/c->zoom+c->y;
needUpdate = true;
}
}
-
+
if (navigating || (drawing && drawingTool==browse)) {
double ox = nx-(double)x;
double oy = ny-(double)y;
c->y = cstarty + oy;
needUpdate = true;
}
-
+
if (needUpdate)
Update(null);
return true;
int y= (int)((ball.location.y-c->y)*c->zoom)+(clientSize.h>>1);
int rwidth = (int)(ball.radius*2*c->zoom);
Bitmap w = wheel[angle2index(ball.angle)];
-
+
if (w) {
x -= rwidth>>1;
y -= rwidth>>1;
else
surface.Filter(w, x,y, 0,0, rwidth,rwidth, w.width,w.height);
}
-
+
#if 0
if (!running && fabs(camera.zoom-1.0)>0.01) {
double newradius = ball.radius*camera.zoom;
surface.SetForeground(red);
break;
}
-
+
DrawThickLine(x0, y0, x1, y1);
}
};
double dp;
double elasticity_cur;
bool clockcont = false; //if positive angle velocity contributes to speed toward parallel of ball velocity
-
+
//printf("COLLIDE! (location=(%f, %f), p = <%f, %f>)\n",location.x, location.y, soonest_line->x0-location.x,soonest_line->y0-location.y);
//if (soonest.t<0.0)
// PrintLn("Negative time after subtract", soonest.t);
soonest.t-=0.01; //don't fall all the way in, or we'll have multiple collisions after this
-
+
//compensate for the time taken to get to the collision
location.x += velocity.x*soonest.t;
location.y += velocity.y*soonest.t;
if ((v_normal.x<0 && v_parallel.y>0) || (v_normal.x>0 && v_parallel.y<0))
clockcont = true;
}
-
+
//we need a reference to this before v_normal gets zeroed if elasticity_cur is 0.
v_parallel_normalized = {-v_normal.y, v_normal.x};
v_parallel_normalized.Normalize();
//elastic collision: multiply the normal by negative elasticity
v_normal.x *= elasticity_cur;
v_normal.y *= elasticity_cur;
-
+
//an attempt at the effects of angular velocity and friction
{
double gs; //goal velocity squared
else
angle_velocity = -g/radius;
}
-
+
velocity.Add(v_parallel, v_normal);
//at last, we'll handle speed/slow lines by simply changing the angular velocity
uint version_code; //which version of OpenRider to act like
version_code = max_version_code_supported;
-
+
~Game() { FreeAll(); }
void FreeAll(void) {
for (i:vehicles)
for (;count--;c+=2)
lines.Add({c[0],c[1],c[2],c[3],regular,floor});
}
-
+
//returns true if any lines were erased
bool EraseAtBox(double x0, double y0, double x1, double y1) {
uint erasures = 0;
lines.size -= erasures;
return !!erasures;
}
-
+
//used for efficiency, not for precision
//This only checks for lines in box by looking at the bounding boxes of lines in question
void FindLinesInBox(double x0, double y0, double x1, double y1, bool tolerance) {
}
#undef Swap
}
-
+
virtual void Instance::DrawLine(GameLine line);
virtual void Instance::DrawBall(GameBall ball);
}
{
Vector2D pc1;
double t_pa,t_pb,t_c0,t_c1;
-
+
//TODO: Consider |b|=0
-
+
t_pa=LineIntersect(a,b,pa);
t_pb=LineIntersect(a,b,pb);
-
+
ret.s = b;
if (t_pa<t_pb && t_pa!=INF)
{
ret.t=t_pb;
goto finalize;
}
-
+
t_c0=CircleIntersect(a,r,pc);
-
+
if (t_c0!=INF)
{
ret.t=t_c0;
ret.s.y = pc.x - a.x*t_c0;
goto finalize;
}
-
+
pc1.Add(pc, b);
t_c1=CircleIntersect(a,r,pc1);
-
+
if (t_c1!=INF)
{
ret.t=t_c1;
ret.s.y = pc1.x - a.x*t_c1;
goto finalize;
}
-
+
ret.t=INF;
return;
finalize:
Vector2D a2; //copy of 'a' that can be reversed for backtracing
char backtracing=0;
//printf("Colliding %f, <%f,%f>, <%f,%f>, <%f,%f>\n", r, a.x, a.y, b.x, b.y, pc.x, pc.y);
-
+
//TODO: Consider |b|=0
-
+
//initialize some vectors
a2 = a;
p.x = b.y;
pb.Add(pc,p);
p.x*=2.0;
p.y*=2.0;
-
+
//Find out if the ball is inside the line (and thus if we need to backtrace)
{
-
+
double dist_ca,dist_cb;
double b_squared,p_squared,v_dot_b,v_dot_p;
double pcx=pc.x,pcy=pc.y;
-
+
dist_ca=pcx*pcx+pcy*pcy;
pcx+=b.x;
pcy+=b.y;
delete image;
AddResource(value);
RemoveResource(image);
- image = value;
+ image = value;
material.baseMap = image ? image.bitmap : null;
material.opacity = 0.5f;
material.flags.translucent = true;
type = fixed;
position = { 0, -1000, 0 };
zMin = 0.1f,
- orientation = Euler { 0, 90, 0 };
+ orientation = Euler { 0, 90, 0 };
};
bool OnLoadGraphics()
plane.Create(displaySystem);
//plane.transform.scaling = { 20 / 2 / 0.707, 20 /2 / 0.707f, 20 /2/ 0.707f };
plane.transform.scaling = { 1.0f, 1.5f, 1.0f };
-
+
// plane.transform.scaling = { image.bitmap.width, 1.5f, image.bitmap.height };
//plane.transform.scaling = { Max(image.bitmap.width, image.bitmap.height), 1.5f, Max(image.bitmap.width, image.bitmap.height) };
//camera.aspectRatio = 1.0f;
else
*w = 80;
}
-
+
if(!size.h && (!anchor.top.type || !anchor.bottom.type))
{
if(bitmap)
display.DrawObject(plane);
display.SetCamera(surface, null);
}
-
+
Material material
{
emissive = white;
}
Label note { this, text = "Note", position = { 16, 160 }, anchor = { left = 10, bottom = 10 } };
- Button remindMe
+ Button remindMe
{
this, caption = "Remind Me", escape, anchor = { right = 54, bottom = 10 };
return true;
}
};
- Button done
- {
+ Button done
+ {
this, text = "Done", anchor = { right = 10, bottom = 10 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
int entriesReplaced;
EditBox replaceEdit
{
- multiLine = true,textHorzScroll = true,textVertScroll = true,
+ multiLine = true,textHorzScroll = true,textVertScroll = true,
text = "Replacing Editbox", size = Size { 640,480 },maxLineSize = 65536
};
-
+
log.Clear();
-
+
app.UpdateDisplay();
entriesReplaced =
- ReplaceInDirectory(directory.contents, findWhat.contents, replaceWith.contents,
+ ReplaceInDirectory(directory.contents, findWhat.contents, replaceWith.contents,
matchCase.checked, wholeWord.checked, recurse.checked, replaceEdit, log);
log.Printf("SEARCH & REPLACE COMPLETED: %d ENTRIES REPLACED.\n", entriesReplaced);
this, noCaret = true, multiLine = true, autoEmpty = true, textHorzScroll = true, hasVertScroll = true, anchor = Anchor { left = 420, top = 30, right = 10, bottom = 10 }
};
- int ReplaceInDirectory(char * directory, char * findWhat, char * replaceWith,
+ int ReplaceInDirectory(char * directory, char * findWhat, char * replaceWith,
bool matchCase, bool wholeWord, bool recurse, EditBox edit, EditBox log)
{
FileListing listing { directory, "htm, html, css, ec" };
delete f;
for(entriesReplaced = 0;
- edit.Find(findWhat, wholeWord, matchCase, true) == found;
+ edit.Find(findWhat, wholeWord, matchCase, true) == found;
entriesReplaced++)
edit.PutS(replaceWith);
if(entriesReplaced)
deepBottom = (((BorderBits)borderStyle).sizable && isNormal) ? bottom : border;
}
- surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
+ surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
size.w - deepBorder - deepBorder, size.h - deepBottom - deepTop);
}
surface.SetForeground(activeBorder);
surface.Rectangle(2, 2, size.w-3, size.h-3);
- // Resizeable frame is 1 pixel thicker
+ // Resizeable frame is 1 pixel thicker
if(((BorderBits)borderStyle).sizable && isNormal)
surface.Rectangle(3, 3, size.w - 4, size.h - 4);
}
surface.Gradient(gradient, sizeof(gradient) / sizeof(ColorKey), GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
else
- surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
+ surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
{
int buttonsSize = border +
((hasMaximize || hasMinimize) ? 52 : 18);
- surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
+ surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
size.w - (buttonsSize + border + 4), name, strlen(name));
}
}
surface.SetForeground(Color { Min((int)c.r * 16/10, 255), Min((int)c.g * 16/10, 255), Min((int)c.b * 16/10,255) });
surface.HLine(0 + isDefault, clientSize.w-2 - isDefault, isDefault);
surface.VLine(1 + isDefault, clientSize.h-2 - isDefault, isDefault);
-
-
+
+
surface.SetForeground(selectionColor);
surface.HLine(1 + isDefault, clientSize.w-2 - isDefault, clientSize.h-2 - isDefault);
surface.VLine(1 + isDefault, clientSize.h-3 - isDefault, clientSize.w-2 - isDefault);
-
+
if(bevel)
{
//surface.SetForeground(skinForeground);
downBtn.background = Color { 70 * 6/10, 130* 6/10, 180* 6/10 }; //skinBackground;
downBtn.bitmap = { "<:ecere>elements/arrowDown.png", monochrome = true };
thumb.background = Color { 70 * 6/10, 130* 6/10, 180* 6/10 }; //skinBackground;
- }
+ }
}
class AcovelSkin_DropBox : DropBox
background = skinBackground;
foreground = skinForeground;
this.selectionColor = ::selectionColor;
- }
+ }
}
class AcovelSkin_ListBox : ListBox
background = skinBackground;
foreground = skinForeground;
this.selectionColor = ::selectionColor;
- }
+ }
}
public class AcovelSkin : Skin
#define BORDER 5 //4
#define TOP 3
#define BOTTOM (4 + 2)
-#define CORNER (BORDER * 2 + 6)
+#define CORNER (BORDER * 2 + 6)
#define CAPTION 22 // 20
#define DEAD_BORDER 0 //3
#define MIN_WIDTH 68
int w = 14;// * sizeW / 14;
int sideH = 10; // * sizeW / 14;
int middleH = size.h - 2 * (sideH + y);
-
+
surface.Stretch(left.bitmap, x, y, 0,0, w, sideH, left.bitmap.width, left.bitmap.height);
surface.HTile(middle.bitmap, x, y + sideH, w, middleH);
surface.Stretch(right.bitmap, x, y + sideH + middleH, 0,0, w, sideH, right.bitmap.width, right.bitmap.height);
-
+
/*
surface.Filter(left.bitmap, x, y, 0,0, w, sideH, left.bitmap.width, left.bitmap.height);
surface.FilterVTile(middle.bitmap, x, y + sideH, w, middleH);
surface.Filter(right.bitmap, x, y + sideH + middleH, 0,0, w, sideH, right.bitmap.width, right.bitmap.height);
*/
}
-
+
static bool Button::ThumbIsInside(int x, int y)
{
return (x >= 0 && y >= 0 && x < size.w && y < size.h);
}
return true;
}
-
+
void OnRedraw(Surface surface)
{
surface.VTile(bmpScrollVert.bitmap, 0, 0, clientSize.w, clientSize.h);
}
void OnRedraw(Surface surface)
- {
+ {
if(bitmap)
{
((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface);
surface.Filter(left.bitmap, x, y, 0,0, sideW, h, left.bitmap.width, left.bitmap.height);
surface.FilterHTile(middle.bitmap, x + sideW, y, middleW, h);
surface.Filter(right.bitmap, x + sideW + middleW, y, 0,0, sideW, h, left.bitmap.width, left.bitmap.height);
-
+
surface.CenterTextf(clientSize.w/2 + offset, (clientSize.h - textH * 1.1) / 2 + offset, text);
}
}
-char * cursorsBitmaps[] =
+char * cursorsBitmaps[] =
{
"<:ecere>cursors/arrow.png",
"<:ecere>cursors/iBeam.png",
deepBottom = (((BorderBits)borderStyle).fixed /*sizable*/ && isNormal) ? bottom : border;
}
- surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
+ surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
size.w - deepBorder - deepBorder, size.h - deepBottom - deepTop);
}
surface.SetForeground(activeBorder);
surface.Rectangle(2, 2, size.w-3, size.h-3);
- // Resizeable frame is 1 pixel thicker
+ // Resizeable frame is 1 pixel thicker
if(((BorderBits)borderStyle).sizable && isNormal)
surface.Rectangle(3, 3, size.w - 4, size.h - 4);
surface.Gradient(gradient, sizeof(gradient) / sizeof(ColorKey), GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
else
- surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
+ surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
*/
// surface.blend = rootWindow != this;
surface.Blit(bmpTopLeftBorder.bitmap, 0, 0, 0, 0, bmpTopLeftBorder.bitmap.width, bmpTopLeftBorder.bitmap.height);
- surface.Stretch(bmpTopBorder.bitmap, bmpTopLeftBorder.bitmap.width, 0, 0, 0, size.w - 2 * bmpTopLeftBorder.bitmap.width, bmpTopBorder.bitmap.height,
+ surface.Stretch(bmpTopBorder.bitmap, bmpTopLeftBorder.bitmap.width, 0, 0, 0, size.w - 2 * bmpTopLeftBorder.bitmap.width, bmpTopBorder.bitmap.height,
bmpTopBorder.bitmap.width, bmpTopBorder.bitmap.height);
surface.Blit(bmpTopRightBorder.bitmap, size.w - bmpTopRightBorder.bitmap.width, 0, 0, 0, bmpTopRightBorder.bitmap.width, bmpTopRightBorder.bitmap.height);
surface.Stretch(bmpRightBorder.bitmap, size.w-9, 27, 0, 0, bmpRightBorder.bitmap.width, size.h - 27 - 9, bmpLeftBorder.bitmap.width, bmpLeftBorder.bitmap.height);
surface.Blit(bmpBottomLeftBorder.bitmap, 0, size.h - 9, 0, 0, bmpBottomLeftBorder.bitmap.width, bmpBottomLeftBorder.bitmap.height);
- surface.Stretch(bmpBottomBorder.bitmap, bmpBottomLeftBorder.bitmap.width, size.h - 9, 0, 0, size.w - 2 * bmpBottomLeftBorder.bitmap.width, bmpBottomBorder.bitmap.height,
+ surface.Stretch(bmpBottomBorder.bitmap, bmpBottomLeftBorder.bitmap.width, size.h - 9, 0, 0, size.w - 2 * bmpBottomLeftBorder.bitmap.width, bmpBottomBorder.bitmap.height,
bmpBottomBorder.bitmap.width, bmpBottomBorder.bitmap.height);
surface.Blit(bmpBottomRightBorder.bitmap, size.w - bmpBottomRightBorder.bitmap.width, size.h - 9, 0, 0, bmpBottomRightBorder.bitmap.width, bmpBottomRightBorder.bitmap.height);
//surface.alphaWrite = DontWrite;
{
int buttonsSize = border +
((hasMaximize || hasMinimize) ? 60 : 26);
- surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
+ surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
size.w - (buttonsSize + border + NAME_OFFSETX /*4*/), name, strlen(name));
}
}
deepBottom = (((BorderBits)borderStyle).sizable && isNormal) ? bottom : border;
}
- surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
+ surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
size.w - deepBorder - deepBorder, size.h - deepBottom - deepTop);
}
surface.SetForeground(activeBorder);
surface.Rectangle(2, 2, size.w-3, size.h-3);
- // Resizeable frame is 1 pixel thicker
+ // Resizeable frame is 1 pixel thicker
if(((BorderBits)borderStyle).sizable && isNormal)
surface.Rectangle(3, 3, size.w - 4, size.h - 4);
}
surface.Gradient(gradient, sizeof(gradient) / sizeof(ColorKey), GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
else
- surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
+ surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
border, top, size.w - border - 1, top + CAPTION - 2);
{
int buttonsSize = border +
((hasMaximize || hasMinimize) ? 52 : 18);
- surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
+ surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
size.w - (buttonsSize + border + 4), name, strlen(name));
}
}
surface.SetForeground(Color { Min((int)c.r * 16/10, 255), Min((int)c.g * 16/10, 255), Min((int)c.b * 16/10,255) });
surface.HLine(0 + isDefault, clientSize.w-2 - isDefault, isDefault);
surface.VLine(1 + isDefault, clientSize.h-2 - isDefault, isDefault);
-
-
+
+
surface.SetForeground(skinMainColor);
surface.HLine(1 + isDefault, clientSize.w-2 - isDefault, clientSize.h-2 - isDefault);
surface.VLine(1 + isDefault, clientSize.h-3 - isDefault, clientSize.w-2 - isDefault);
-
+
if(bevel)
{
//surface.SetForeground(skinForeground);
x, y,
0,0,buttonBitmap.width,buttonBitmap.height);
}
- else
+ else
{
// Push Buttons
if(scaleBitmap)
{
if(bevel || offset)
- surface.Stretch(buttonBitmap,
+ surface.Stretch(buttonBitmap,
1 + offset, 1 + offset,0,0,
clientSize.w-3,clientSize.h-3,buttonBitmap.width,buttonBitmap.height);
else
surface.TextExtent(text, strlen(text),&tw, &th);
if((isRadio || isCheckbox) && !bevelOver)
- WriteCaption(surface, /*clientSize.h +*/ CAPTION_DISTANCE + 3,
+ WriteCaption(surface, /*clientSize.h +*/ CAPTION_DISTANCE + 3,
(clientSize.h - th - 4)/2);
- else
+ else
{
int x, y = (clientSize.h - th - 1)/2 + offset;
-
+
if(ellipsis)
{
int width = clientSize.w - 2*6;
downBtn.background = Color { 70 * 6/10, 130* 6/10, 180* 6/10 }; //skinBackground;
downBtn.bitmap = { (direction == vertical) ? "<:ecere>elements/arrowDown.png" : "<:ecere>elements/arrowRight.png", monochrome = true };
thumb.background = Color { 70 * 6/10, 130* 6/10, 180* 6/10 }; //skinBackground;*/
- }
+ }
}
/*class SimSkin_DropBox : DropBox
background = skinBackground;
foreground = skinForeground;
selectionColor = skinMainColor;
- }
+ }
}*/
/*class SimSkin_ListBox : ListBox
background = skinBackground;
foreground = skinForeground;
selectionColor = skinMainColor;
- }
+ }
}*/
public class SimSkin : Skin
background = black;
anchor = Anchor { 0, 0, 0, 0 };
-
+
void NextImage(int direction)
{
timer.Stop();
{
PictureFile oldFileName = fileName;
int oldDirID = fileName.dirID;
- while(fileName.dirID == oldDirID ||
- (direction == -2 &&
+ while(fileName.dirID == oldDirID ||
+ (direction == -2 &&
(fileName.prev ? fileName.prev : (PictureFile)fileNames.last).dirID == fileName.dirID))
{
if(Sgn(direction) == 1)
if(!fileName) fileName = fileNames.last;
}
if(Abs(direction) == 1) break;
-
+
if(fileName == oldFileName) break;
}
}
{
FileListing listing { directory, "pcx, jpg, bmp, png" };
OldList list { };
-
+
PictureFile fileName;
int thisDirID = dirID++;
for(;(fileName = list.first);)
{
list.Remove(fileName);
-
+
if(fileName.dir)
{
AddDirectory(files, fileName.name);
surface.background = backgroundColor;
surface.Area(0,0, w-1, h-1);
surface.WriteText((clientSize.w - tw)/2, (clientSize.h - th)/2, textString, len);
-
+
#ifndef __WIN32__
XSync(IS_XGetDisplay()); // TODO: Need an API for this...
#endif
memcpy(buffer.picture, bitmap.picture, buffer.sizeBytes);
}
-
+
if(screenBuffer)
{
int x,y;
bool atRight = (offset % stride) >= w - 1;
switch(GetRandom(0, 2))
{
- case 0:
+ case 0:
if(!SnowTo(offset, stride))
{
if(GetRandom(0, 4) == 0)
this, anchor = { 5,5,5,5 };
clickThrough = true;
};
-
+
Label prompt { column, font = { "Arial", 14, bold = true }, anchor = { horz = 0, top = 10 }, text = "testing" };
EditBox query
{
delete linesText;
delete contents;
}
-
+
property String contents
{
set
}
get { return contents; }
};
-
+
bool OnLoadGraphics()
{
int c;
button2, tip = "You can change fonts and colors!";
alphaBlend = true, opacity = 0.75;
font = { "Comic Sans MS", 12 };
- background = lightSkyBlue, foreground = darkSlateBlue;
+ background = lightSkyBlue, foreground = darkSlateBlue;
};
}
return true;
}
};
- Button btnHost
- {
+ Button btnHost
+ {
this, text = "Host", position = { 32, 16 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
}
};
EditBox message { this, size = { 510, 43 }, position = { 16, 400 } };
- Button btnSend
- {
+ Button btnSend
+ {
this, text = "Send", isDefault = true, size = { 60, 37 }, position = { 552, 400 };
disabled = true;
{
int stringLen;
// stringLen + 1 bytes are actually used (variable size depending on string)
- char string[1];
+ char string[1];
};
class SampleService : Service
{
int stringLen;
// stringLen + 1 bytes are actually used (variable size depending on string)
- char string[1];
+ char string[1];
};
class SampleService : Service
else if(servingSocket == this)
servingSocket = null;
- form.UpdateButtonStates();
+ form.UpdateButtonStates();
}
unsigned int OnReceive(unsigned char * buffer, unsigned int count)
// The Listen button is disabled if we're already listening
btnListen.disabled = listening;
}
-
- Button btnSend
- {
+
+ Button btnSend
+ {
this, text = "Send", position = { 344, 64 }, disabled = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
};
EditBox serverAddress { this, text = "Server Address", size = { 174, 19 }, position = { 8, 40 }, contents = "localhost" };
Label lblServerAddress { this, position = { 8, 16 }, labeledWindow = serverAddress };
- Button btnListen
- {
+ Button btnListen
+ {
this, text = "Listen", position = { 144, 104 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
Label lblSentString { this, position = { 224, 16 }, labeledWindow = sentString };
EditBox recvString { this, text = "Received String", size = { 166, 19 }, position = { 224, 104 } };
Label label1 { this, position = { 224, 80 }, labeledWindow = recvString };
- Button btnConnect
- {
+ Button btnConnect
+ {
this, text = "Connect", position = { 8, 72 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
int stringLen;
// stringLen + 1 bytes are actually used (variable size depending on string)
- char string[1];
+ char string[1];
};
// We don't really need anything special in this class here, we could simply use Socket directly
{
printf("Connected!\n");
}
-
+
}
MySocket socket { };
/********************************************************
- This sample demonstrates how to use the XMLParser
- class to parse an XML communication protocol and
+ This sample demonstrates how to use the XMLParser
+ class to parse an XML communication protocol and
update model objects accordingly.
********************************************************/
if(object)
{
object.type = type;
- object.description = desc;
+ object.description = desc;
}
else
{
{
File f = FileOpen(htmlView.location, read);
if(f)
- {
+ {
if(!f.CopyTo(saveFileDialog.filePath))
{
String e = PrintString("Error saving to ", saveFileDialog.filePath);
};
MenuDivider { fileMenu };
MenuItem exitItem { fileMenu, "Exit\tAlt+F4", x, NotifySelect = MenuFileExit };
-
+
bool PageOpened()
{
char caption[MAX_LOCATION];
}
bool OnPostCreate()
- {
+ {
addressBar.MakeActive();
return true;
}
borderStyle = sizable, hasClose = true, hasMinimize = true, showInTaskBar = true, size = Size { 580, 600 },
minClientSize = Size { 300, 440 }, tabCycle = true, background = activeBorder;
- Button close
- {
+ Button close
+ {
this, text = "Close", size = Size { 80, 0 }, anchor = Anchor { right = 10, bottom = 5 }, hotKey = altC;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
Destroy(0);
- return true;
+ return true;
}
};
Label { this, text = "[=== UPLOAD ===]", position = Point { 10, 10 } };
}
};
- Button sendBrowse
- {
+ Button sendBrowse
+ {
this, text = "Browse", size = Size { 80,20 }, anchor = Anchor { right = 100, top = 40 }, hotKey = altB;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
if(fileList.Modal() == ok)
{
- sendFile.Clear();
+ sendFile.Clear();
sendFile.PutS(fileList.filePath);
}
return true;
}
};
- Button send
- {
+ Button send
+ {
this, text = "Send", size = Size { 80, 20 }, anchor = Anchor { right = 10, top = 40 }, hotKey = altS, disabled = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
char * fileName = sendFile.line.text;
-
+
fileSend = FileOpen(fileName, read);
if(fileSend)
{
delete packet;
}
-
+
sending.Clear();
sending.Printf("Sending %s at", outputFile);
}
EditBox sending { this, textHorzScroll = true, readOnly = true, borderStyle = deep, inactive = true, size.h = 20, anchor = Anchor { left = 10, top = 70, right = 190 }, opacity = 0 };
Label sendSpeed { this, borderStyle = deep, anchor = Anchor { right = 100, top = 70 }, size = Size { 80, 20 } };
Button sendCancel
- {
+ {
this, text = "Cancel", anchor = Anchor { right = 10, top = 70 }, size = Size { 80,20 }, disabled = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
}
};
ProgressBar recvProgress { this, borderStyle = deep, inactive = true, anchor = Anchor { left = 10, top = 200, right = 10 }, size.h = 20 };
- EditBox log
+ EditBox log
{
this, readOnly = true, multiLine = true, autoEmpty = true, text = "Conversation", inactive = true, size = Size { 560, 226 }, anchor = Anchor { left = 10, top = 270, right = 10, bottom = 100 }, hasHorzScroll = true, hasVertScroll = true
};
Label { this, position = Point { 10, 250 }, labeledWindow = log };
- Button clear
- {
+ Button clear
+ {
this, text = "Clear", anchor = Anchor { left = 10, bottom = 5 }, size = Size { 80, 0 }, hotKey = altR;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
}
};
Button backButton
- {
+ {
this, text = "Background...", anchor = Anchor { bottom = 5 }, size = Size { 100, 0 }, hotKey = altK;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
return true;
}
};
- EditBox message
+ EditBox message
{
this, multiLine = true, text = "Message", size = Size { 0, 50 }, anchor = Anchor { left = 10, right = 10, bottom = 32 }, disabled = true, hasHorzScroll = true, hasVertScroll = true, size.h = 50;
if((SmartKey)key == ctrlEnter)
{
EditLine line;
-
+
log.End();
log.AddS("\n");
log.AddS("<");
{
namePacket->type = Name;
namePacket->dataSize = strlen(name);
-
+
CopyBytes(namePacket + 1, name, namePacket->dataSize);
socket.Send(namePacket, sizeof(eComPacket) + namePacket->dataSize);
CopyBytes(fileName, data, packet.dataSize);
fileName[packet.dataSize] = '\0';
-
+
if(FileExists(fileName))
{
FileGetSize(fileName, &resumePosition);
connection.incomingMessage = renew connection.incomingMessage char[connection.incomingMsgLen + packet.dataSize + 1];
CopyBytes(connection.incomingMessage + connection.incomingMsgLen, data, packet.dataSize);
connection.incomingMessage[connection.incomingMsgLen + packet.dataSize] = '\0';
-
+
connection.incomingMsgLen += packet.dataSize;
if(packet.msg.over)
{
eComPacket ackPacket { DataAck };
Seconds diffTime;
-
+
if(connection.abortRecv)
ackPacket.data.status = Abort;
else if(packet.dataSize)
ackPacket.data.status = packet.data.status;
connection.recvProgress.progress += packet.dataSize;
-
+
diffTime = GetTime() - connection.recvTime;
if(diffTime)
{
strcat(string, "/s");
connection.recvSpeed.text = string;
}
-
+
if(ackPacket.data.status)
{
connection.log.End();
connection.log.Printf("\n* Remote ran out of disk space receiving %s.", connection.sendFileName);
break;
}
-
+
connection.sendProgress.range = 0;
delete connection.fileSend;
}
};
Button localHost
- {
+ {
this, text = "Local Host", position = Point { 320, 30 }, size = Size { 80, 0 }, hotKey = altL;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
return true;
}
};
-
+
EditBox log
{
- this, readOnly = true, multiLine = true, autoEmpty = true, hasVertScroll = true, hasHorzScroll = true, inactive = true,
- text = "Communication Log",
+ this, readOnly = true, multiLine = true, autoEmpty = true, hasVertScroll = true, hasHorzScroll = true, inactive = true,
+ text = "Communication Log",
anchor = Anchor { left = 10, top = 100, right = 10, bottom = 30 },
contents = app.appName
};
{
char * string = nameBox.contents;
OldLink link;
- for(link = connections.first; link; link = link.next)
+ for(link = connections.first; link; link = link.next)
((Connection)link.data).SendName(string);
}
};
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
- Destroy(0);
+ Destroy(0);
return true;
}
};
class eComService : Service
{
MainPanel mainPanel;
-
+
port = ECOMMUNICATOR_PORT;
void OnAccept()
Copyright (c) 2001-2008 Jerome Jacovella-St-Louis
All Rights Reserved.
-
+
console.ec - Console Dialog
****************************************************************************/
import "ecere"
if(version)
surface.WriteTextf(
clientSize.w - verLROffset.x * 768 / referenceHeight,
- clientSize.h - verLROffset.y * 768 / referenceHeight,
+ clientSize.h - verLROffset.y * 768 / referenceHeight,
version);
}
}
// console.Log("\n");
console.Log(buffer);
-
+
/* // Auto connect login Script
if(!strcmpi(buffer, "NOTICE AUTH :*** Got ident response"))
{
{
ircSocket.Sendf("NICK %s\n", const_NickName );
ircSocket.Sendf("USER %s %s %s %s\n", const_NickName, const_NickName, const_NickName , const_NickName );
-
+
}
}
{
if(buffer[c] == '\r' && buffer[c+1] == '\n')
break;
- }
+ }
if(c<count)
{
char * string = (char *)buffer;
{
f = FileOpen(indexFile, read);
break;
- }
+ }
}
// List contents if we didn't find an index
if(i == NUM_INDEX)
static byte buffer[PACKETSIZE];
int read = client.f.Read(buffer, 1, PACKETSIZE);
-
+
if(read)
client.Send(buffer, read);
if(client.f.Eof())
int newsize;
uint * indexfs = null;
int c;
-
+
f.Seek(0, end);
newsize = f.Tell();
f.Seek(0, 0);
-
+
indexfs = renew indexfs byte[newsize];
c = f.Read(indexfs, newsize, 1);
delete f;
delete f;
// while(true) Sleep(1);
- }
+ }
delete connection;
}
}
OpenPacket packet = (OpenPacket) packetHeader;
byte reply[4] = XDWORD(MAXDWORD);
int c;
-
+
Log("Open\n");
for(c = 0; c < MAX_HANDLES; c++)
{
WaitEvent();
ProcessNetworkEvents();
}
- }
+ }
}
}
}
void OnDisconnect(int code)
{
- replied = true;
+ replied = true;
}
void WaitReply()
{
socket.WaitReply();
socket.SendString("HELO localhost\n");
socket.WaitReply();
- socket.Sendf("MAIL from: %s\n", from);
+ socket.Sendf("MAIL from: %s\n", from);
socket.WaitReply();
- socket.Sendf("RCPT To: %s\n", to);
+ socket.Sendf("RCPT To: %s\n", to);
socket.WaitReply();
- socket.SendString("DATA\n");
+ socket.SendString("DATA\n");
socket.WaitReply();
socket.SendString("Subject: Email test\n");
socket.SendString("Content-Type: text/html; charset=Windows-1252\n");
-
+
file.Seek(0, start);
while(!file.Eof())
{
Send("mail.mailserver.com", "destaddress@destdomain.com", "srcaddress@srcdomain.com", f);
delete f;
getch();
- }
+ }
}
Bitmap scannedBitmap;
WiaItem scanner;
-
+
~ScanningTest()
{
delete scannedImage;
packet.size = size;
packet.delay = delay;
- CopyBytes(packet.string, string, len+1);
+ CopyBytes(packet.string, string, len+1);
SendPacket(packet);
delete packet;
return true;
}
};
- ListBox listBox1
+ ListBox listBox1
{
this, alwaysHighLight = true, text = "listBox1", hasVertScroll = true, size = Size { 172, 268 }, position = Point { 56, 72 };
void AddString(char * string)
{
DataRow row = null;
-
+
/*for(row = listBox1.firstRow; row; row = row.next)
if(!strcmp(row.string, string))
break;*/