-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- *
- * Small compiler
+/* Small compiler
* Function and variable definition and declaration, statement parser.
*
* Copyright (c) ITB CompuPhase, 1997-2003
* Version: $Id$
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#ifdef HAVE_EVIL
# include <Evil.h>
#endif /* HAVE_EVIL */
-#include "embryo_cc_osdefs.h"
#include "embryo_cc_sc.h"
#include "embryo_cc_prefix.h"
static int skipinput = 0; /* number of lines to skip from the first input file */
static int wq[wqTABSZ]; /* "while queue", internal stack for nested loops */
static int *wqptr; /* pointer to next entry */
-static char binfname[_MAX_PATH]; /* binary file name */
+static char binfname[PATH_MAX]; /* binary file name */
int
main(int argc, char *argv[], char *env[] __UNUSED__)
{
- char argv0[_MAX_PATH];
- int i;
-
- snprintf(argv0, _MAX_PATH, "%s", argv[0]);
- /* Linux stores the name of the program in argv[0], but not the path.
- * To adjust this, I store a string with the path in argv[0]. To do
- * so, I try to get the current path with getcwd(), and if that fails
- * I search for the PWD= setting in the environment.
- */
- if (NULL != getcwd(argv0, _MAX_PATH))
- {
- i = strlen(argv0);
- snprintf(argv0 + i, _MAX_PATH - i, "/%s", argv[0]);
- }
- else
- {
- char *pwd = getenv("PWD");
-
- if (pwd != NULL)
- snprintf(argv0, _MAX_PATH, "%s/%s", pwd, argv[0]);
- } /* if */
- argv[0] = argv0; /* set location to new first parameter */
-
- e_prefix_determine(argv0);
-
+ e_prefix_determine(argv[0]);
return sc_compile(argc, argv);
}
void
sc_closeasm(void *handle)
{
- if (handle != NULL)
+ if (handle)
fclose((FILE *) handle);
}
{
int entry, i, jmpcode, fd_out;
int retcode;
- char incfname[_MAX_PATH];
- char reportname[_MAX_PATH];
+ char incfname[PATH_MAX];
+ char reportname[PATH_MAX];
FILE *binf;
void *inpfmark;
char lcl_ctrlchar;
goto cleanup;
/* allocate memory for fixed tables */
- inpfname = (char *)malloc(_MAX_PATH);
+ inpfname = (char *)malloc(PATH_MAX);
litq = (cell *) malloc(litmax * sizeof(cell));
- if (litq == NULL)
+ if (!litq)
error(103); /* insufficient memory */
if (!phopt_init())
error(103); /* insufficient memory */
tmpdir = (char *)evil_tmpdir_get();
#endif /* ! HAVE_EVIL */
- snprintf(outfname, _MAX_PATH, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
+ snprintf(outfname, PATH_MAX, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
fd_out = mkstemp(outfname);
if (fd_out < 0)
error(101, outfname);
- unlink (outfname); /* kill this file as soon as it's (f)close'd */
-
setconfig(argv[0]); /* the path to the include files */
lcl_ctrlchar = sc_ctrlchar;
lcl_packstr = sc_packstr;
lcl_needsemicolon = sc_needsemicolon;
lcl_tabsize = sc_tabsize;
inpf = inpf_org = (FILE *) sc_opensrc(inpfname);
- if (inpf == NULL)
+ if (!inpf)
error(100, inpfname);
freading = TRUE;
outf = (FILE *) sc_openasm(fd_out); /* first write to assembler
* file (may be temporary) */
- if (outf == NULL)
+ if (!outf)
error(101, outfname);
/* immediately open the binary file, for other programs to check */
binf = (FILE *) sc_openbin(binfname);
- if (binf == NULL)
+ if (!binf)
error(101, binfname);
setconstants(); /* set predefined constants and tagnames */
for (i = 0; i < skipinput; i++) /* skip lines in the input file */
- if (sc_readsrc(inpf, pline, sLINEMAX) != NULL)
+ if (sc_readsrc(inpf, pline, sLINEMAX))
fline++; /* keep line number up to date */
skipinput = fline;
sc_status = statFIRST;
error(13); /* no entry point (no public functions) */
cleanup:
- if (inpf != NULL) /* main source file is not closed, do it now */
+ if (inpf) /* main source file is not closed, do it now */
sc_closesrc(inpf);
/* write the binary file (the file is already open) */
if (errnum == 0 && jmpcode == 0)
sc_resetasm(outf); /* flush and loop back, for reading */
assemble(binf, outf); /* assembler file is now input */
} /* if */
- if (outf != NULL)
+ if (outf)
sc_closeasm(outf);
- if (binf != NULL)
+ unlink (outfname);
+ if (binf)
sc_closebin(binf, errnum != 0);
- if (inpfname != NULL)
+ if (inpfname)
free(inpfname);
- if (litq != NULL)
+ if (litq)
free(litq);
phopt_cleanup();
stgbuffer_cleanup();
constvalue *ptr;
int last, tag;
- if (name == NULL)
+ if (!name)
{
/* no tagname was given, check for one */
if (lex(&val, &name) != tLABEL)
last = 0;
ptr = tagname_tab.next;
- while (ptr != NULL)
+ while (ptr)
{
tag = (int)(ptr->value & TAGMASK);
if (strcmp(name, ptr->name) == 0)
/* tagname currently unknown, add it */
tag = last + 1; /* guaranteed not to exist already */
- if (isupper(*name))
+ if (sc_isupper(*name))
tag |= (int)FIXEDTAG;
append_constval(&tagname_tab, name, (cell) tag, 0);
return tag;
static void
setconfig(char *root)
{
- char path[_MAX_PATH];
+ char path[PATH_MAX];
char *ptr;
int len;
+ path[sizeof(path) - 1] = 0;
+
/* add the default "include" directory */
- if (root != NULL)
+ if (root)
{
/* path + filename (hopefully) */
strncpy(path, root, sizeof(path) - 1);
path[sizeof(path) - 1] = 0;
}
/* terminate just behind last \ or : */
- if ((ptr = strrchr(path, DIRSEP_CHAR)) != NULL
- || (ptr = strchr(path, ':')) != NULL)
+ if ((ptr = strrchr(path, DIRSEP_CHAR))
+ || (ptr = strchr(path, ':')))
{
/* If there was no terminating "\" or ":",
* the filename probably does not
case tSTATIC:
/* This can be a static function or a static global variable;
* we know which of the two as soon as we have parsed up to the
- * point where an opening paranthesis of a function would be
+ * point where an opening parenthesis of a function would be
* expected. To back out after deciding it was a declaration of
* a static variable after all, we have to store the symbol name
* and tag.
size = 1; /* single size (no array) */
numdim = 0; /* no dimensions */
ident = iVARIABLE;
- if (firstname != NULL)
+ if (firstname)
{
assert(strlen(firstname) <= sNAMEMAX);
strcpy(name, firstname); /* save symbol name */
strcpy(name, str); /* save symbol name */
} /* if */
sym = findglb(name);
- if (sym == NULL)
+ if (!sym)
sym = findconst(name);
- if (sym != NULL && (sym->usage & uDEFINE) != 0)
+ if (sym && (sym->usage & uDEFINE) != 0)
error(21, name); /* symbol already defined */
ispublic = fpublic;
if (name[0] == PUBLIC_CHAR)
* for public variables
*/
cidx = 0; /* only to avoid a compiler warning */
- if (sc_status == statWRITE && sym != NULL
+ if (sc_status == statWRITE && sym
&& (sym->usage & (uREAD | uWRITTEN | uPUBLIC)) == 0)
{
sc_status = statSKIP;
dumplits(); /* dump the literal queue */
dumpzero((int)size - litidx);
litidx = 0;
- if (sym == NULL)
+ if (!sym)
{ /* define only if not yet defined */
sym =
addvariable(name, sizeof(cell) * glb_declared, ident, sGLOBAL,
* the "nesting level" of local variables to verify the
* multi-definition of symbols.
*/
- if ((sym = findloc(name)) != NULL && sym->compound == nestlevel)
+ if ((sym = findloc(name)) && sym->compound == nestlevel)
error(21, name); /* symbol already defined */
/* Although valid, a local variable whose name is equal to that
* of a global variable or to that of a local variable at a lower
* level might indicate a bug.
*/
- if (((sym = findloc(name)) != NULL && sym->compound != nestlevel)
- || findglb(name) != NULL)
+ if (((sym = findloc(name)) && sym->compound != nestlevel)
+ || findglb(name))
error(219, name); /* variable shadows another symbol */
while (matchtoken('['))
{
* symbol instruction.
*/
} /* if */
- if ((sym = findglb(name)) != 0)
+ if ((sym = findglb(name)))
{ /* already in symbol table? */
if (sym->ident != iFUNCTN)
{
* local symbols are function arguments.
*/
sym = loctab.next;
- while (sym != NULL)
+ while (sym)
{
assert(sym->ident != iLABEL);
assert(sym->vclass == sLOCAL);
{
symbol *sub = sym;
- while (sub != NULL)
+ while (sub)
{
symbolrange(sub->dim.array.level, sub->dim.array.length);
sub = finddepend(sub);
/* change the operator name */
assert(opername[0] != '\0');
operator_symname(tmpname, opername, tags[0], tags[1], count, resulttag);
- if ((oldsym = findglb(tmpname)) != NULL)
+ if ((oldsym = findglb(tmpname)))
{
int i;
sym->usage |= oldsym->usage; /* copy flags from the previous
* definition */
for (i = 0; i < oldsym->numrefers; i++)
- if (oldsym->refer[i] != NULL)
+ if (oldsym->refer[i])
refer_symbol(sym, oldsym->refer[i]);
delete_symbol(&glbtab, oldsym);
} /* if */
tag &= TAGMASK;
assert(tag >= 0);
sprintf(dest, "0%x", tag);
- return isdigit(dest[1]) ? &dest[1] : dest;
+ return sc_isdigit(dest[1]) ? &dest[1] : dest;
}
char *
} /* if */
assert(!unary || *tag1 == 0);
assert(*ptr != '\0');
- for (name = opname; !isdigit(*ptr);)
+ for (name = opname; !sc_isdigit(*ptr);)
*name++ = *ptr++;
*name = '\0';
*tag2 = (int)strtol(ptr, NULL, 16);
constvalue *tagsym[2];
int unary;
- if (isalpha(*funcname) || *funcname == '_' || *funcname == PUBLIC_CHAR
+ if (sc_isalpha(*funcname) || *funcname == '_' || *funcname == PUBLIC_CHAR
|| *funcname == '\0')
{
if (dest != funcname)
sym = fetchfunc(symbolname, tag); /* get a pointer to the
* function entry */
- if (sym == NULL)
+ if (!sym)
return;
if (native)
{
glbdecl = 0;
filenum = fcurrent; /* save file number at start of declaration */
- if (firstname != NULL)
+ if (firstname)
{
assert(strlen(firstname) <= sNAMEMAX);
strcpy(symbolname, firstname); /* save symbol name */
} /* if */
sym = fetchfunc(symbolname, tag); /* get a pointer to the
* function entry */
- if (sym == NULL)
+ if (!sym)
return TRUE;
if (fpublic)
sym->usage |= uPUBLIC;
sym->dim.arglist =
(arginfo *) realloc(sym->dim.arglist,
(argcnt + 2) * sizeof(arginfo));
- if (sym->dim.arglist == 0)
+ if (!sym->dim.arglist)
error(103); /* insufficient memory */
sym->dim.arglist[argcnt] = arg;
sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list
sym->dim.arglist =
(arginfo *) realloc(sym->dim.arglist,
(argcnt + 2) * sizeof(arginfo));
- if (sym->dim.arglist == 0)
+ if (!sym->dim.arglist)
error(103); /* insufficient memory */
sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list
* terminated */
sym->dim.arglist[argcnt].numtags = numtags;
sym->dim.arglist[argcnt].tags =
(int *)malloc(numtags * sizeof tags[0]);
- if (sym->dim.arglist[argcnt].tags == NULL)
+ if (!sym->dim.arglist[argcnt].tags)
error(103); /* insufficient memory */
memcpy(sym->dim.arglist[argcnt].tags, tags,
numtags * sizeof tags[0]);
assert(size >= litidx);
/* allocate memory to hold the initial values */
arg->defvalue.array.data = (cell *) malloc(litidx * sizeof(cell));
- if (arg->defvalue.array.data != NULL)
+ if (arg->defvalue.array.data)
{
int i;
arg->hasdefault = TRUE; /* argument has default value */
arg->defvalue.array.size = litidx;
arg->defvalue.array.addr = -1;
- /* calulate size to reserve on the heap */
+ /* calculate size to reserve on the heap */
arg->defvalue.array.arraysize = 1;
for (i = 0; i < arg->numdim; i++)
arg->defvalue.array.arraysize *= arg->dim[i];
cell val;
tokeninfo(&val, &name);
- if ((arg->defvalue.size.symname =
- strdup(name)) == NULL)
+ if (!(arg->defvalue.size.symname = strdup(name)))
error(103); /* insufficient memory */
arg->defvalue.size.level = 0;
if (size_tag_token == uSIZEOF)
arg->usage = (char)(fconst ? uCONST : 0);
arg->numtags = numtags;
arg->tags = (int *)malloc(numtags * sizeof tags[0]);
- if (arg->tags == NULL)
+ if (!arg->tags)
error(103); /* insufficient memory */
memcpy(arg->tags, tags, numtags * sizeof tags[0]);
argsym = findloc(name);
- if (argsym != NULL)
+ if (argsym)
{
error(21, name); /* symbol already defined */
}
else
{
- if ((argsym = findglb(name)) != NULL && argsym->ident != iFUNCTN)
+ if ((argsym = findglb(name)) && argsym->ident != iFUNCTN)
error(219, name); /* variable shadows another symbol */
/* add details of type and address */
assert(numtags > 0);
count = 0;
for (i = 0; i < entry->numrefers; i++)
- if (entry->refer[i] != NULL)
+ if (entry->refer[i])
count++;
return count;
}
do
{
restart = 0;
- for (sym = root->next; sym != NULL; sym = sym->next)
+ for (sym = root->next; sym; sym = sym->next)
{
- if (sym->parent != NULL)
+ if (sym->parent)
continue; /* hierarchical data type */
if (sym->ident == iFUNCTN
&& (sym->usage & uNATIVE) == 0
sym->usage &= ~(uREAD | uWRITTEN); /* erase usage bits if
* there is no referrer */
/* find all symbols that are referred by this symbol */
- for (ref = root->next; ref != NULL; ref = ref->next)
+ for (ref = root->next; ref; ref = ref->next)
{
- if (ref->parent != NULL)
+ if (ref->parent)
continue; /* hierarchical data type */
assert(ref->refer != NULL);
for (i = 0; i < ref->numrefers && ref->refer[i] != sym;
}
else if ((sym->ident == iVARIABLE || sym->ident == iARRAY)
&& (sym->usage & uPUBLIC) == 0
- && sym->parent == NULL && count_referrers(sym) == 0)
+ && !sym->parent && count_referrers(sym) == 0)
{
sym->usage &= ~(uREAD | uWRITTEN); /* erase usage bits if
* there is no referrer */
symbol *sym = root->next;
- while (sym != NULL && sym->compound >= level)
+ while (sym && sym->compound >= level)
{
switch (sym->ident)
{
break;
default:
/* a variable */
- if (sym->parent != NULL)
+ if (sym->parent)
break; /* hierarchical data type */
if ((sym->usage & (uWRITTEN | uREAD | uSTOCK | uPUBLIC)) == 0)
error(203, sym->name); /* symbol isn't used (and not stock
{
cell sublength =
calc_array_datasize(finddepend(sym), offset);
- if (offset != NULL)
+ if (offset)
*offset = length * (*offset + sizeof(cell));
if (sublength > 0)
length *= length * sublength;
}
else
{
- if (offset != NULL)
+ if (offset)
*offset = 0;
} /* if */
return length;
int savepri = FALSE;
symbol *sym = root->next;
- while (sym != NULL && sym->compound >= level)
+ while (sym && sym->compound >= level)
{
if (sym->ident == iVARIABLE || sym->ident == iARRAY)
{
/* check that the '~' operator is defined for this tag */
operator_symname(symbolname, "~", sym->tag, 0, 1, 0);
- if ((opsym = findglb(symbolname)) != NULL)
+ if ((opsym = findglb(symbolname)))
{
- /* save PRI, in case of a return statment */
+ /* save PRI, in case of a return statement */
if (!savepri)
{
push1(); /* right-hand operand is in PRI */
if (sc_status != statSKIP)
markusage(opsym, uREAD); /* do not mark as "used" when this
* call itself is skipped */
- if (opsym->x.lib != NULL)
+ if (opsym->x.lib)
opsym->x.lib->value += 1; /* increment "usage count"
* of the library */
} /* if */
static constvalue *
insert_constval(constvalue * prev, constvalue * next, char *name,
- cell val, short index)
+ cell val, short idx)
{
constvalue *cur;
- if ((cur = (constvalue *) malloc(sizeof(constvalue))) == NULL)
+ if (!(cur = (constvalue *)malloc(sizeof(constvalue))))
error(103); /* insufficient memory (fatal error) */
memset(cur, 0, sizeof(constvalue));
strcpy(cur->name, name);
cur->value = val;
- cur->index = index;
+ cur->index = idx;
cur->next = next;
prev->next = cur;
return cur;
}
constvalue *
-append_constval(constvalue * table, char *name, cell val, short index)
+append_constval(constvalue * table, char *name, cell val, short idx)
{
constvalue *cur, *prev;
/* find the end of the constant table */
- for (prev = table, cur = table->next; cur != NULL;
+ for (prev = table, cur = table->next; cur;
prev = cur, cur = cur->next)
/* nothing */ ;
- return insert_constval(prev, NULL, name, val, index);
+ return insert_constval(prev, NULL, name, val, idx);
}
constvalue *
-find_constval(constvalue * table, char *name, short index)
+find_constval(constvalue * table, char *name, short idx)
{
constvalue *ptr = table->next;
- while (ptr != NULL)
+ while (ptr)
{
- if (strcmp(name, ptr->name) == 0 && ptr->index == index)
+ if (strcmp(name, ptr->name) == 0 && ptr->index == idx)
return ptr;
ptr = ptr->next;
} /* while */
{
constvalue *ptr = table->next;
- while (ptr != NULL)
+ while (ptr)
{
if (ptr->value == val)
return ptr;
{
constvalue *cur = table->next, *next;
- while (cur != NULL)
+ while (cur)
{
next = cur->next;
free(cur);
if (tok != '{')
setline(fline, fcurrent);
/* lex() has set stmtindent */
- if (lastindent != NULL && tok != tLABEL)
+ if (lastindent && tok != tLABEL)
{
#if 0
if (*lastindent >= 0 && *lastindent != stmtindent &&
doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
int *tag, int chkfuncresult)
{
- int constant, index, ident;
+ int constant, idx, ident;
int localstaging = FALSE;
cell val;
localstaging = TRUE;
assert(stgidx == 0);
} /* if */
- index = stgidx;
+ idx = stgidx;
errorset(sEXPRMARK);
do
{
/* on second round through, mark the end of the previous expression */
- if (index != stgidx)
+ if (idx != stgidx)
endexpr(TRUE);
sideeffect = FALSE;
ident = expression(&constant, &val, tag, chkfuncresult);
errorset(sEXPRRELEASE);
if (localstaging)
{
- stgout(index);
+ stgout(idx);
stgset(FALSE); /* stop staging */
} /* if */
}
int
constexpr(cell * val, int *tag)
{
- int constant, index;
+ int constant, idx;
cell cidx;
stgset(TRUE); /* start stage-buffering */
- stgget(&index, &cidx); /* mark position in code generator */
+ stgget(&idx, &cidx); /* mark position in code generator */
errorset(sEXPRMARK);
expression(&constant, val, tag, FALSE);
- stgdel(index, cidx); /* scratch generated code */
+ stgdel(idx, cidx); /* scratch generated code */
stgset(FALSE); /* stop stage-buffering */
if (constant == 0)
error(8); /* must be constant expression */
static void
test(int label, int parens, int invert)
{
- int index, tok;
+ int idx, tok;
cell cidx;
value lval = { NULL, 0, 0, 0, 0, NULL };
int localstaging = FALSE;
stgset(TRUE); /* start staging */
localstaging = TRUE;
#if !defined NDEBUG
- stgget(&index, &cidx); /* should start at zero if started
+ stgget(&idx, &cidx); /* should start at zero if started
* locally */
- assert(index == 0);
+ assert(idx == 0);
#endif
} /* if */
- /* FIXME: 64bit unsafe! putting an int on a stack of void *'s */
pushstk((stkitem) intest);
intest = 1;
if (parens)
needtoken('(');
do
{
- stgget(&index, &cidx); /* mark position (of last expression) in
+ stgget(&idx, &cidx); /* mark position (of last expression) in
* code generator */
if (hier14(&lval))
rvalue(&lval);
if (lval.ident == iARRAY || lval.ident == iREFARRAY)
{
char *ptr =
- (lval.sym->name != NULL) ? lval.sym->name : "-unknown-";
+ (lval.sym->name) ? lval.sym->name : "-unknown-";
error(33, ptr); /* array must be indexed */
} /* if */
if (lval.ident == iCONSTEXPR)
{ /* constant expression */
intest = (int)(long)popstk(); /* restore stack */
- stgdel(index, cidx);
+ stgdel(idx, cidx);
if (lval.constval)
{ /* code always executed */
error(206); /* redundant test: always non-zero */
{
int wq[wqSIZE], skiplab;
cell save_decl;
- int save_nestlevel, index;
+ int save_nestlevel, idx;
int *ptr;
save_decl = declared;
assert(!staging);
stgset(TRUE); /* start staging */
assert(stgidx == 0);
- index = stgidx;
+ idx = stgidx;
stgmark(sSTARTREORDER);
stgmark((char)(sEXPRSTART + 0)); /* mark start of 2nd expression
* in stage */
needtoken(')');
} /* if */
stgmark(sENDREORDER); /* mark end of reversed evaluation */
- stgout(index);
+ stgout(idx);
stgset(FALSE); /* stop staging */
statement(NULL, FALSE);
jumplabel(wq[wqLOOP]);
* case values at the same time.
*/
for (csp = &caselist, cse = caselist.next;
- cse != NULL && cse->value < val;
+ cse && cse->value < val;
csp = cse, cse = cse->next)
/* nothing */ ;
- if (cse != NULL && cse->value == val)
+ if (cse && cse->value == val)
error(40, val); /* duplicate "case" label */
/* Since the label is stored as a string in the
* "constvalue", the size of an identifier must
casecount++;
/* find the new insertion point */
for (csp = &caselist, cse = caselist.next;
- cse != NULL && cse->value < val;
+ cse && cse->value < val;
csp = cse, cse = cse->next)
/* nothing */ ;
- if (cse != NULL && cse->value == val)
+ if (cse && cse->value == val)
error(40, val); /* duplicate "case" label */
insert_constval(csp, cse, itoh(lbl_case), val, 0);
} /* if */
while (tok != '}');
#if !defined NDEBUG
- /* verify that the case table is sorted (unfortunatly, duplicates can
+ /* verify that the case table is sorted (unfortunately, duplicates can
* occur; there really shouldn't be duplicate cases, but the compiler
* may not crash or drop into an assertion for a user error). */
- for (cse = caselist.next; cse != NULL && cse->next != NULL; cse = cse->next)
+ for (cse = caselist.next; cse && cse->next; cse = cse->next)
; /* empty. no idea whether this is correct, but we MUST NOT do
* the setlabel(lbl_table) call in the loop body. doing so breaks
* switch statements that only have one case statement following.
} /* if */
ffcase(casecount, labelname, TRUE);
/* generate the rest of the table */
- for (cse = caselist.next; cse != NULL; cse = cse->next)
+ for (cse = caselist.next; cse; cse = cse->next)
ffcase(cse->value, cse->name, FALSE);
setlabel(lbl_exit);
static void
doassert(void)
{
- int flab1, index;
+ int flab1, idx;
cell cidx;
value lval = { NULL, 0, 0, 0, 0, NULL };
else
{
stgset(TRUE); /* start staging */
- stgget(&index, &cidx); /* mark position in code generator */
+ stgget(&idx, &cidx); /* mark position in code generator */
do
{
if (hier14(&lval))
rvalue(&lval);
- stgdel(index, cidx); /* just scrap the code */
+ stgdel(idx, cidx); /* just scrap the code */
}
while (matchtoken(','));
stgset(FALSE); /* stop staging */
symbol *sym;
tokeninfo(&val, &st); /* retrieve label name again */
- if (find_constval(&tagname_tab, st, 0) != NULL)
+ if (find_constval(&tagname_tab, st, 0))
error(221, st); /* label name shadows tagname */
sym = fetchlab(st);
setlabel((int)sym->addr);
ptr = readwhile(); /* readwhile() gives an error if not in loop */
needtoken(tTERM);
- if (ptr == NULL)
+ if (!ptr)
return;
destructsymbols(&loctab, nestlevel);
modstk(((int)declared - ptr[wqBRK]) * sizeof(cell));
ptr = readwhile(); /* readwhile() gives an error if not in loop */
needtoken(tTERM);
- if (ptr == NULL)
+ if (!ptr)
return;
destructsymbols(&loctab, nestlevel);
modstk(((int)declared - ptr[wqCONT]) * sizeof(cell));
assert((tag & PUBLICTAG) == 0);
for (ptr = tagname_tab.next;
- ptr != NULL && tag != (int)(ptr->value & TAGMASK); ptr = ptr->next)
+ ptr && tag != (int)(ptr->value & TAGMASK); ptr = ptr->next)
/* nothing */ ;
- if (ptr != NULL)
+ if (ptr)
ptr->value |= PUBLICTAG;
} /* if */
}