}
}
+static void GetSourceName(char * name, const char * src)
+{
+ name[0] = 0;
+ if(src)
+ {
+ if(!strchr(src, '/') && !strchr(src, '\\'))
+ StripLastDirectory(sourceFile, name);
+ PathCat(name, src);
+ }
+ else if(sourceFile)
+ PathCat(name, sourceFile);
+ ChangeCh(name, '\\', '/');
+}
+
static void OutputStatement(Statement stmt, File f)
{
char name[MAX_FILENAME] = "";
char origName[MAX_FILENAME] = "";
- /*
- if(sourceFile)
- eString_GetLastDirectory(sourceFile, name);
- */
-
if(inCompiler)
{
- if(yylloc.start.included)
- {
- //GetWorkingDir(name, sizeof(name));
- PathCat(name, GetIncludeFileFromID(yylloc.start.included));
- }
- else if(sourceFile)
- {
- //GetWorkingDir(name, sizeof(name));
- PathCat(name, sourceFile);
- }
- ChangeCh(name, '\\', '/');
+ GetSourceName(name, stmt.loc.start.included ? GetIncludeFileFromID(stmt.loc.start.included) : null);
- //GetWorkingDir(origName, sizeof(origName));
PathCat(origName, outputFile);
ChangeCh(origName, '\\', '/');
}
switch(stmt.type)
{
+ case badDeclarationStmt:
+ OutputDeclaration(stmt.decl, f);
+ break;
case labeledStmt:
OutputIdentifier(stmt.labeled.id, f);
f.Puts(":\n");
}
else
{
- PrintType(exp.expType, string, true, true);
+ // Printing 'name' as a hack when we're dealing with typedefs with extended attributes
+ PrintTypeNoConst(exp.expType, string, exp.expType.kind == dummyType ? true : false, true);
decl = SpecDeclFromString(string, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereReturnVal")));
}
}
}
f.Puts(");\n");
+ outputLine++;
break;
}
}
char name[MAX_FILENAME] = "";
char origName[MAX_FILENAME] = "";
- /*
- if(sourceFile)
- eString_GetLastDirectory(sourceFile, name);
- */
-
if(inCompiler)
{
- if(yylloc.start.included)
- {
- //GetWorkingDir(name, sizeof(name));
- PathCat(name, GetIncludeFileFromID(yylloc.start.included));
- }
- else if(sourceFile)
- {
- //GetWorkingDir(name, sizeof(name));
- PathCat(name, sourceFile);
- }
- ChangeCh(name, '\\', '/');
+ GetSourceName(name, initializer.loc.start.included ? GetIncludeFileFromID(initializer.loc.start.included) : null);
- //GetWorkingDir(origName, sizeof(origName));
PathCat(origName, outputFile);
ChangeCh(origName, '\\', '/');
}
if(d.initializer)
{
char name[MAX_FILENAME] = "";
- /*
- if(sourceFile)
- GetLastDirectory(sourceFile, name);
- */
- if(yylloc.start.included)
- {
- //GetWorkingDir(name, sizeof(name));
- PathCat(name, GetIncludeFileFromID(yylloc.start.included));
- }
- else if(sourceFile)
- {
- //GetWorkingDir(name, sizeof(name));
- PathCat(name, sourceFile);
- }
- ChangeCh(name, '\\', '/');
+ GetSourceName(name, decl.loc.start.included ? GetIncludeFileFromID(decl.loc.start.included) : null);
if(inCompiler && outputLineNumbers && decl.loc.start.line)
{
char name[1024] = "";
Identifier id = GetDeclId(func.declarator);
- if(yylloc.start.included)
- {
- //GetWorkingDir(name, sizeof(name));
- PathCat(name, GetIncludeFileFromID(yylloc.start.included));
- }
- else if(sourceFile)
- {
- //GetWorkingDir(name, sizeof(name));
- PathCat(name, sourceFile);
- }
- ChangeCh(name, '\\', '/');
+ GetSourceName(name, func.loc.start.included ? GetIncludeFileFromID(func.loc.start.included) : null);
f.Printf("{\n");
f.Printf(" __ecereNameSpace__ecere__com__MemoryGuard_PushLoc(\"%s:%s\");\n", name, id.string);
{
External external;
- outputLine = 30;
+ outputLine = 31;
for(external = ast.first; external; external = external.next)
{