unsigned maxInterrupts = 6;
int allocInfo = 1;
symbol *mainf;
-extern char *VersionString;
set *pipeSet = NULL; /* set of pipes */
set *tmpfileSet = NULL; /* set of tmp file created by the compiler */
set *tmpfileNameSet = NULL; /* All are unlinked at close. */
continue;
/* print extra debug info if required */
- if (options.debug) {
- cdbSymbol (sym, cdbFile, FALSE, FALSE);
- if (!sym->level) /* global */
- if (IS_STATIC (sym->etype))
- fprintf (map->oFile, "F%s$", moduleName); /* scope is file */
+ if (options.debug)
+ {
+ if (!sym->level) /* global */
+ {
+ if (IS_STATIC (sym->etype))
+ fprintf (map->oFile, "F%s$", moduleName); /* scope is file */
+ else
+ fprintf (map->oFile, "G$"); /* scope is global */
+ }
else
- fprintf (map->oFile, "G$"); /* scope is global */
- else
- /* symbol is local */
- fprintf (map->oFile, "L%s$", (sym->localof ? sym->localof->name : "-null-"));
- fprintf (map->oFile, "%s$%d$%d", sym->name, sym->level, sym->block);
- }
+ {
+ /* symbol is local */
+ fprintf (map->oFile, "L%s$", (sym->localof ? sym->localof->name : "-null-"));
+ }
+ fprintf (map->oFile, "%s$%d$%d", sym->name, sym->level, sym->block);
+ }
/* if it has an initial value then do it only if
it is a global variable */
val->type = newLink (DECLARATOR);
if (SPEC_SCLS (expr->left->etype) == S_CODE) {
DCL_TYPE (val->type) = CPOINTER;
- DCL_TYPE (val->type) = port->mem.code_ro;
+ DCL_PTR_CONST (val->type) = port->mem.code_ro;
}
else if (SPEC_SCLS (expr->left->etype) == S_XDATA)
DCL_TYPE (val->type) = FPOINTER;
/* print extra debug info if required */
if (options.debug) {
- cdbSymbol (sym, cdbFile, FALSE, FALSE);
+
if (!sym->level)
{ /* global */
if (IS_STATIC (sym->etype))
time_t t;
time (&t);
fprintf (afile, "%s", iComments1);
- fprintf (afile, "; Version %s %s\n", VersionString, asctime (localtime (&t)));
+ fprintf (afile, "; Version " SDCC_VERSION_STR " %s\n", asctime (localtime (&t)));
fprintf (afile, "%s", iComments2);
}
/* print extra debug info if required */
if (options.debug)
{
- cdbSymbol (sym, cdbFile, FALSE, FALSE);
-
if (!sym->level)
{ /* global */
if (IS_STATIC (sym->etype))
}
}
+
+/*-----------------------------------------------------------------*/
+/* spacesToUnderscores - replace spaces with underscores */
+/*-----------------------------------------------------------------*/
+static char *
+spacesToUnderscores (char *dest, const char *src, size_t len)
+{
+ int i;
+ char *p;
+
+ assert(dest != NULL);
+ assert(src != NULL);
+ assert(len > 0);
+
+ --len;
+ for (p = dest, i = 0; *src != '\0' && i < len; ++src, ++i) {
+ *p++ = isspace(*src) ? '_' : *src;
+ }
+ *p = '\0';
+
+ return dest;
+}
+
+
/*-----------------------------------------------------------------*/
/* glue - the final glue that hold the whole thing together */
/*-----------------------------------------------------------------*/
FILE *vFile;
FILE *asmFile;
FILE *ovrFile = tempfile ();
+ char moduleBuf[PATH_MAX];
addSetHead (&tmpfileSet, ovrFile);
/* print the global struct definitions */
if (options.debug)
- cdbStructBlock (0, cdbFile);
+ cdbStructBlock (0);
vFile = tempfile ();
/* PENDING: this isnt the best place but it will do */
/* do the overlay segments */
emitOverlay (ovrFile);
+ outputDebugSymbols();
+
/* now put it all together into the assembler file */
/* create the assembler file name */
initialComments (asmFile);
/* print module name */
- tfprintf (asmFile, "\t!module\n", moduleName);
+ tfprintf (asmFile, "\t!module\n",
+ spacesToUnderscores (moduleBuf, moduleName, sizeof moduleBuf));
tfprintf (asmFile, "\t!fileprelude\n");
/* Let the port generate any global directives, etc. */