fixed bugs, added No_Mem()
This commit is contained in:
parent
1228fe1baf
commit
64e1fa33d3
5 changed files with 11 additions and 6 deletions
|
@ -21,7 +21,6 @@
|
||||||
formal parameter in this text.
|
formal parameter in this text.
|
||||||
*/
|
*/
|
||||||
struct macro {
|
struct macro {
|
||||||
struct macro *next;
|
|
||||||
char * mc_text; /* the replacement text */
|
char * mc_text; /* the replacement text */
|
||||||
int mc_nps; /* number of formal parameters */
|
int mc_nps; /* number of formal parameters */
|
||||||
int mc_length; /* length of replacement text */
|
int mc_length; /* length of replacement text */
|
||||||
|
|
|
@ -82,3 +82,8 @@ compile(argc, argv)
|
||||||
if (source) WorkingDir = getwdir(dummy);
|
if (source) WorkingDir = getwdir(dummy);
|
||||||
preprocess(source);
|
preprocess(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
No_Mem() /* called by alloc package */
|
||||||
|
{
|
||||||
|
fatal("out of memory");
|
||||||
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ do_option(text)
|
||||||
{
|
{
|
||||||
register char *cp = text, *name, *mactext;
|
register char *cp = text, *name, *mactext;
|
||||||
|
|
||||||
if (class(*cp) != STIDF || class(*cp) == STELL) {
|
if (class(*cp) != STIDF && class(*cp) != STELL) {
|
||||||
error("identifier missing in -D%s", text);
|
error("identifier missing in -D%s", text);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ do_pragma()
|
||||||
*c_ptr = '\0';
|
*c_ptr = '\0';
|
||||||
while(c != '\n') {
|
while(c != '\n') {
|
||||||
if (c_ptr + 1 - cur_line == size) {
|
if (c_ptr + 1 - cur_line == size) {
|
||||||
cur_line = Realloc(cur_line, size + ITEXTSIZE);
|
cur_line = Realloc(cur_line, size += ITEXTSIZE);
|
||||||
c_ptr = cur_line + size - 1;
|
c_ptr = cur_line + size - 1;
|
||||||
}
|
}
|
||||||
*c_ptr++ = c;
|
*c_ptr++ = c;
|
||||||
|
|
|
@ -186,9 +186,10 @@ expand_defined(repl)
|
||||||
}
|
}
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
str = GetIdentifier(0);
|
str = GetIdentifier(0);
|
||||||
if (str)
|
if (str) {
|
||||||
id = str2idf(str, 0);
|
id = findidf(str);
|
||||||
else id = 0;
|
free(str);
|
||||||
|
} else id = 0;
|
||||||
assert(id || class(ch) == STELL);
|
assert(id || class(ch) == STELL);
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
ch = skipspaces(ch, 0);
|
ch = skipspaces(ch, 0);
|
||||||
|
|
Loading…
Reference in a new issue