/* setParseWithComma - separates string with comma to a set */
/*-----------------------------------------------------------------*/
void
-setParseWithComma (set **dest, char *src)
+setParseWithComma (set **dest, const char *src)
{
- char *p;
- int length;
+ const char *p, *end;
+ struct dbuf_s dbuf;
/* skip the initial white spaces */
while (isspace((unsigned char)*src))
- src++;
+ ++src;
/* skip the trailing white spaces */
- length = strlen(src);
- while (length && isspace((unsigned char)src[length-1]))
- src[--length] = '\0';
+ end = &src[strlen(src) - 1];
+ while (end >= src && isspace((unsigned char)*end))
+ --end;
+ ++end;
+
+ dbuf_init(&dbuf, 16);
+
+ p = src;
+ while (src < end)
+ {
+ while (p < end && ',' != *p)
+ ++p;
+ dbuf_append(&dbuf, src, p - src);
+ addSet(dest, Safe_strdup(dbuf_c_str(&dbuf)));
+ dbuf_set_size(&dbuf, 0);
+ src = ++p;
+ }
- for (p = strtok(src, ","); p != NULL; p = strtok(NULL, ","))
- addSet(dest, Safe_strdup(p));
+ dbuf_destroy(&dbuf);
}
/*-----------------------------------------------------------------*/
options.code_loc = 0; /* code starts at 0 */
options.data_loc = 0; /* JCF: By default let the linker locate data */
options.xdata_loc = 0;
- options.idata_loc = 0x80;
+ options.idata_loc = 0; /* MB: No need to limit idata to 0x80-0xFF */
options.nopeep = 0;
options.model = port->general.default_model;
options.nostdlib = 0;
}
/* if the extention is type .rel or .r or .REL or .R
- addtional object file will be passed to the linker */
+ additional object file will be passed to the linker */
if (strcmp (fext, ".r") == 0 || strcmp (fext, ".rel") == 0 ||
strcmp (fext, ".R") == 0 || strcmp (fext, ".REL") == 0 ||
strcmp (fext, port->linker.rel_ext) == 0)
/* data segment start. If zero, the linker chooses
the best place for data */
- if(options.data_loc)
+ if (options.data_loc)
{
WRITE_SEG_LOC (DATA_NAME, options.data_loc);
}
/* xdata segment start. If zero, the linker chooses
the best place for xdata */
- if(options.xdata_loc)
+ if (options.xdata_loc)
{
WRITE_SEG_LOC (XDATA_NAME, options.xdata_loc);
}
/* if (options.verbose)fprintf(stderr, "linker command line: %s\n", buffer); */
system_ret = my_system (buffer);
+
+#ifdef _WIN32
+ #define STRCMP stricmp
+#else
+ #define STRCMP strcmp
+#endif
+
/* TODO: most linker don't have a -o parameter */
/* -o option overrides default name? */
if (fullDstFileName)
strncatz (scratchFileName,
options.out_fmt ? ".S19" : ".ihx",
sizeof(scratchFileName));
- if (strcmp (fullDstFileName, scratchFileName))
+ if (STRCMP (fullDstFileName, scratchFileName))
remove (fullDstFileName);
rename (scratchFileName, fullDstFileName);
strncatz (scratchFileName, ".map", sizeof(scratchFileName));
*q = 0;
strncatz(buffer, ".map", sizeof(buffer));
- if (strcmp (scratchFileName, buffer))
+ if (STRCMP (scratchFileName, buffer))
remove (buffer);
rename (scratchFileName, buffer);
*p = 0;
strncatz (scratchFileName, ".mem", sizeof(scratchFileName));
*q = 0;
strncatz(buffer, ".mem", sizeof(buffer));
- if (strcmp (scratchFileName, buffer))
+ if (STRCMP (scratchFileName, buffer))
remove (buffer);
rename (scratchFileName, buffer);
if (options.debug)
strncatz (scratchFileName, ".cdb", sizeof(scratchFileName));
*q = 0;
strncatz(buffer, ".cdb", sizeof(buffer));
- if (strcmp (scratchFileName, buffer))
+ if (STRCMP (scratchFileName, buffer))
remove (buffer);
rename (scratchFileName, buffer);
/* and the OMF file without extension: */
*p = 0;
*q = 0;
- if (strcmp (scratchFileName, buffer))
+ if (STRCMP (scratchFileName, buffer))
remove (buffer);
rename (scratchFileName, buffer);
}