}
}
- if(spec.type == nameSpecifier /*Class*/ || spec.type == subClassSpecifier)
+ if(spec.type == nameSpecifier || spec.type == subClassSpecifier)
{
- Symbol classSym = spec.symbol; // FindClass(spec.name);
+ // TODO: Apply more care because nameSpecifier / subClassSpecifier use different parts of the union!
+ Symbol classSym = spec.symbol;
if(spec.type == subClassSpecifier)
{
classSym = FindClass("ecere::com::Class");
//spec.name = CopyString(name);
delete spec.name;
spec.type = structSpecifier;
+ spec.baseSpecs = null;
spec.id = MkIdentifier(name);
spec.list = null;
spec.definitions = null;
-
- /*
- external = DeclareStruct(_class.fullName, false);
- // If this declaration created something, we gotta pass it through
- if(external)
- {
- Context ctx = curContext;
- curContext = globalContext;
- InstDeclPassDeclaration(external.declaration);
- curContext = ctx;
- }
- */
+ spec.ctx = null;
+ spec.addNameSpace = false;
}
else if(_class && _class.type == noHeadClass)
{
- /*
- delete spec.name;
- spec.name = CopyString("void");
- */
-
char name[1024] = "";
FullClassNameCat(name, _class.fullName, false);
delete spec.name;
spec.type = structSpecifier;
+ spec.baseSpecs = null;
spec.id = MkIdentifier(name);
spec.list = null;
spec.definitions = null;
+ spec.ctx = null;
+ spec.addNameSpace = false;
}
else if(_class)
{
if((_class.type != systemClass ||
!strcmp(_class.fullName, "enum") ||
- !strcmp(_class.fullName, "ecere::com::Instance") ||
(_class.dataTypeString && !strcmp(_class.dataTypeString, "char *")) ||
//strcmp(_class.fullName, "bool") &&
!strcmp(_class.fullName, "uint64") ||
!strcmp(_class.fullName, "uint32") ||
!strcmp(_class.fullName, "uint16") ||
+ !strcmp(_class.fullName, "uintptr") ||
+ !strcmp(_class.fullName, "intptr") ||
+ !strcmp(_class.fullName, "uintsize") ||
+ !strcmp(_class.fullName, "intsize") ||
!strcmp(_class.fullName, "uint") ||
!strcmp(_class.fullName, "byte")))
{
if(!strcmp(_class.dataTypeString, "uint64") ||
!strcmp(_class.dataTypeString, "uint32") ||
!strcmp(_class.dataTypeString, "uint16") ||
+ !strcmp(_class.dataTypeString, "uintptr") ||
+ !strcmp(_class.dataTypeString, "intptr") ||
+ !strcmp(_class.dataTypeString, "uintsize") ||
+ !strcmp(_class.dataTypeString, "intsize") ||
!strcmp(_class.dataTypeString, "uint") ||
!strcmp(_class.dataTypeString, "byte"))
{
spec.type = structSpecifier;
spec.id = MkIdentifier("__ecereNameSpace__ecere__com__Instance");
spec.list = null;
+ spec.baseSpecs = null;
spec.definitions = null;
+ spec.ctx = null;
+ spec.addNameSpace = false;
}
- if(_class && _class.dataTypeString && !strcmp(_class.dataTypeString /*fullName*/, "char *"))
+ if(_class && _class.dataTypeString && !strcmp(_class.dataTypeString, "char *"))
return true; //false;
- if(!_class || _class.type == normalClass || _class.type == noHeadClass || !strcmp(_class.fullName, "ecere::com::Instance"))
+ if(!_class || _class.type == normalClass || _class.type == noHeadClass)
return true;
else if(param && _class.type == structClass)
return 2;
if(spec.specifier == TYPED_OBJECT)
{
spec.type = extendedSpecifier;
- spec.name = CopyString("struct __ecereNameSpace__ecere__com__Class * class, void *");
+ spec.extDecl = MkExtDeclString(CopyString("struct __ecereNameSpace__ecere__com__Class * class, void *"));
}
break;
case nameSpecifier:
break;
}
case extendedSpecifier:
- if(!strcmp(spec.name, "dllexport"))
+ if(spec.extDecl && spec.extDecl.type == extDeclString && spec.extDecl.s)
{
- Specifier prevSpec;
- delete spec.name;
- for(prevSpec = spec.prev; prevSpec; prevSpec = prevSpec.prev)
- if(prevSpec.type == baseSpecifier && prevSpec.specifier == EXTERN)
- break;
- if(prevSpec)
+ if(!strcmp(spec.extDecl.s, "dllexport"))
{
- if(targetPlatform == win32)
- spec.name = CopyString("__declspec(dllexport)");
+ Specifier prevSpec;
+ delete spec.extDecl.s;
+ for(prevSpec = spec.prev; prevSpec; prevSpec = prevSpec.prev)
+ if(prevSpec.type == baseSpecifier && prevSpec.specifier == EXTERN)
+ break;
+ if(prevSpec)
+ {
+ if(targetPlatform == win32)
+ spec.extDecl.s = CopyString("__declspec(dllexport)");
+ else
+ spec.extDecl.s = CopyString("__attribute__ ((visibility(\"default\")))");
+ }
else
- spec.name = CopyString("__attribute__ ((visibility(\"default\")))");
+ {
+ if(targetPlatform == win32)
+ spec.extDecl.s = CopyString("extern __declspec(dllexport)");
+ else
+ spec.extDecl.s = CopyString("extern __attribute__ ((visibility(\"default\")))");
+ }
}
- else
+ 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;
if(targetPlatform == win32)
- spec.name = CopyString("extern __declspec(dllexport)");
+ spec.extDecl.s = CopyString("__attribute__((__stdcall__))");
else
- spec.name = CopyString("extern __attribute__ ((visibility(\"default\")))");
+ spec.extDecl.s = CopyString("");
}
}
break;
-
- /*case classSpecifier:
- break;*/
}
}
case extendedDeclaratorEnd:
if((decl.type == extendedDeclarator || decl.type == extendedDeclaratorEnd) && decl.extended.extended)
{
- if(!strcmp(decl.extended.extended, "dllexport"))
+ if(decl.extended.extended.type == extDeclString && decl.extended.extended.s && !strcmp(decl.extended.extended.s, "dllexport"))
{
- delete decl.extended.extended;
+ delete decl.extended.extended.s;
if(targetPlatform == win32)
- decl.extended.extended = CopyString("extern __declspec(dllexport)");
+ decl.extended.extended.s = CopyString("extern __declspec(dllexport)");
else
- decl.extended.extended = CopyString("extern __attribute__ ((visibility(\"default\")))");
+ decl.extended.extended.s = CopyString("extern __attribute__ ((visibility(\"default\")))");
}
- else if(!strcmp(decl.extended.extended, "stdcall") || !strcmp(decl.extended.extended, "_stdcall") ||
- !strcmp(decl.extended.extended, "__stdcall") || !strcmp(decl.extended.extended, "__stdcall__"))
+ 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__")))
{
- delete decl.extended.extended;
+ delete decl.extended.extended.s;
if(targetPlatform == win32)
- decl.extended.extended = CopyString("__attribute__((__stdcall__))");
+ decl.extended.extended.s = CopyString("__attribute__((__stdcall__))");
else
- decl.extended.extended = CopyString("");
+ decl.extended.extended.s = CopyString("");
}
}
if(decl.declarator)
{
Symbol classSym = (spec.type == nameSpecifier) ? spec.symbol /*FindClass(spec.name)*/ : null;
if(type.classObjectType && (!classSym || (classSym && classSym.registered &&
- (classSym.registered.type == enumClass || classSym.registered.type == bitClass || classSym.registered.type == unitClass ||
- (classSym.registered.type == systemClass && strcmp(classSym.string, "ecere::com::Instance") && strcmp(classSym.string, "ecere::com::Class"))))))
+ (classSym.registered.type == enumClass || classSym.registered.type == bitClass || classSym.registered.type == unitClass))))
ReplaceByInstancePtr(spec, &type.declarator, 2);
}
InstDeclPassSpecifier(spec);
}
case memberExp:
{
- InstDeclPassExpression(exp.member.exp);
+ if(exp.member.exp)
+ InstDeclPassExpression(exp.member.exp);
break;
}
case pointerExp:
{
- InstDeclPassExpression(exp.member.exp);
+ if(exp.member.exp)
+ InstDeclPassExpression(exp.member.exp);
break;
}
case typeSizeExp:
InstDeclPassExpression(exp.vaArg.exp);
break;
}
+ case extensionInitializerExp:
+ {
+ InstDeclPassTypeName(exp.initializer.typeName, false);
+ InstDeclPassInitializer(exp.initializer.initializer);
+ break;
+ }
}
}
{
switch(stmt.type)
{
+ case badDeclarationStmt:
+ if(stmt.decl)
+ InstDeclPassDeclaration(stmt.decl);
+ break;
case labeledStmt:
InstDeclPassStatement(stmt.labeled.stmt);
break;