Reduce clang warnings from top
Also add `static` and remove `register` in mach/proto/top/top.c. A static function is only in one file, so its function declaration may go in that file, instead of a header file.
This commit is contained in:
parent
51e34acab1
commit
0576641cae
|
@ -5,7 +5,7 @@ MAXOP 5;
|
||||||
LABEL_STARTER '.';
|
LABEL_STARTER '.';
|
||||||
|
|
||||||
{
|
{
|
||||||
int plus(const char *, const char *, const char *);
|
int plus(const char *, const char *, char *);
|
||||||
}
|
}
|
||||||
|
|
||||||
%%;
|
%%;
|
||||||
|
@ -31,7 +31,7 @@ static int fits16(long l) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tries sum = a + b with signed 16-bit integers. */
|
/* Tries sum = a + b with signed 16-bit integers. */
|
||||||
int plus(const char *a, const char *b, const char *sum)
|
int plus(const char *a, const char *b, char *sum)
|
||||||
{
|
{
|
||||||
long la, lb, lsum;
|
long la, lb, lsum;
|
||||||
char *end;
|
char *end;
|
||||||
|
|
|
@ -8,7 +8,7 @@ LABEL_STARTER '.';
|
||||||
int not_using_sp(const char *);
|
int not_using_sp(const char *);
|
||||||
int positive(const char *);
|
int positive(const char *);
|
||||||
int lift(const char *);
|
int lift(const char *);
|
||||||
int plus(const char *, const char *, const char *);
|
int plus(const char *, const char *, char *);
|
||||||
}
|
}
|
||||||
|
|
||||||
%%;
|
%%;
|
||||||
|
@ -177,7 +177,7 @@ static int fits16(long l) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tries sum = a + b with signed 16-bit integers. */
|
/* Tries sum = a + b with signed 16-bit integers. */
|
||||||
int plus(const char *a, const char *b, const char *sum)
|
int plus(const char *a, const char *b, char *sum)
|
||||||
{
|
{
|
||||||
long la, lb, lsum;
|
long la, lb, lsum;
|
||||||
char *end;
|
char *end;
|
||||||
|
|
|
@ -6,21 +6,18 @@
|
||||||
#include "top.h"
|
#include "top.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
empty_queue(q)
|
void empty_queue(queue q)
|
||||||
register queue q;
|
|
||||||
{
|
{
|
||||||
q->head = q->tail = (instr_p) 0;
|
q->head = q->tail = (instr_p) 0;
|
||||||
q->qlen = 0;
|
q->qlen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int empty(q)
|
int empty(queue q)
|
||||||
queue q;
|
|
||||||
{
|
{
|
||||||
return q->qlen == 0;
|
return q->qlen == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_head(q)
|
void remove_head(queue q)
|
||||||
register queue q;
|
|
||||||
{
|
{
|
||||||
if ( (q->head = q->head->fw) == (instr_p) 0) {
|
if ( (q->head = q->head->fw) == (instr_p) 0) {
|
||||||
q->tail = (instr_p) 0;
|
q->tail = (instr_p) 0;
|
||||||
|
@ -30,9 +27,7 @@ remove_head(q)
|
||||||
q->qlen--;
|
q->qlen--;
|
||||||
}
|
}
|
||||||
|
|
||||||
add(q,instr)
|
void add(queue q, instr_p instr)
|
||||||
register queue q;
|
|
||||||
register instr_p instr;
|
|
||||||
{
|
{
|
||||||
if (q->qlen++ == 0) {
|
if (q->qlen++ == 0) {
|
||||||
q->head = q->tail = instr;
|
q->head = q->tail = instr;
|
||||||
|
@ -45,9 +40,7 @@ add(q,instr)
|
||||||
instr->fw = (instr_p) 0;
|
instr->fw = (instr_p) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
insert(q,instr)
|
void insert(queue q, instr_p instr)
|
||||||
register queue q;
|
|
||||||
register instr_p instr;
|
|
||||||
{
|
{
|
||||||
if (q->qlen++ == 0) {
|
if (q->qlen++ == 0) {
|
||||||
q->head = q->tail = instr;
|
q->head = q->tail = instr;
|
||||||
|
@ -60,8 +53,7 @@ insert(q,instr)
|
||||||
instr->bw = (instr_p) 0;
|
instr->bw = (instr_p) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
join_queues(q1,q2)
|
void join_queues(queue q1, queue q2)
|
||||||
register queue q1,q2;
|
|
||||||
{
|
{
|
||||||
if (q1->qlen > 0) {
|
if (q1->qlen > 0) {
|
||||||
q2->qlen += q1->qlen;
|
q2->qlen += q1->qlen;
|
||||||
|
|
|
@ -14,3 +14,10 @@ struct queue_t {
|
||||||
#define qhead(q) (q)->head
|
#define qhead(q) (q)->head
|
||||||
#define qlength(q) (q)->qlen
|
#define qlength(q) (q)->qlen
|
||||||
#define next(x) (x)->fw
|
#define next(x) (x)->fw
|
||||||
|
|
||||||
|
void empty_queue(queue);
|
||||||
|
int empty(queue);
|
||||||
|
void remove_head(queue);
|
||||||
|
void add(queue, instr_p);
|
||||||
|
void insert(queue, instr_p);
|
||||||
|
void join_queues(queue, queue);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -13,18 +14,38 @@
|
||||||
|
|
||||||
/* STANDARD MACHINE-INDEPENT C CODE *************/
|
/* STANDARD MACHINE-INDEPENT C CODE *************/
|
||||||
|
|
||||||
extern char *lstrip();
|
static void optimize(void);
|
||||||
extern instr_p newinstr();
|
static bool try_hashentry(int *, queue);
|
||||||
extern instr_p read_instr();
|
static int hash(queue);
|
||||||
extern instr_p gen_instr();
|
static void fill_window(queue, int);
|
||||||
|
static void write_first(queue);
|
||||||
|
static void set_opcode(instr_p);
|
||||||
|
static bool check_pattern(patdescr_p, queue);
|
||||||
|
static bool check_operands(patdescr_p, queue);
|
||||||
|
static void clear_vars(void);
|
||||||
|
static bool opmatch(templ_p, const char *);
|
||||||
|
static bool split_operands(instr_p);
|
||||||
|
static void labeldef(instr_p);
|
||||||
|
static bool operand(instr_p, int);
|
||||||
|
static bool remainder_empty(instr_p);
|
||||||
|
static char *lstrip(char *, const char *);
|
||||||
|
static bool rstrip(char *, const char *);
|
||||||
|
static bool unify(const char *, struct variable *);
|
||||||
|
static void xform(patdescr_p, queue);
|
||||||
|
static void replacement(patdescr_p, queue);
|
||||||
|
static instr_p gen_instr(idescr_p);
|
||||||
|
static instr_p read_instr(void);
|
||||||
|
static instr_p newinstr(void);
|
||||||
|
static void oldinstr(instr_p);
|
||||||
|
static bool op_separator(instr_p);
|
||||||
|
static bool well_shaped(const char *);
|
||||||
|
static bool is_letter(char);
|
||||||
|
|
||||||
struct variable var[NRVARS+1];
|
static struct variable var[NRVARS+1];
|
||||||
struct variable ANY; /* ANY symbol matching any instruction */
|
static struct variable ANY; /* ANY symbol matching any instruction */
|
||||||
|
|
||||||
char *REST; /* Opcode of first instruction not matched by current pattern */
|
/* Opcode of first instruction not matched by current pattern */
|
||||||
|
static char *REST;
|
||||||
void labeldef();
|
|
||||||
void set_opcode();
|
|
||||||
|
|
||||||
#include "gen.c"
|
#include "gen.c"
|
||||||
|
|
||||||
|
@ -36,7 +57,7 @@ void set_opcode();
|
||||||
/* Skip white space in the unprocessed part of instruction 'ip' */
|
/* Skip white space in the unprocessed part of instruction 'ip' */
|
||||||
#define skip_white(ip) while (is_white(*(ip)->rest_line)) (ip)->rest_line++
|
#define skip_white(ip) while (is_white(*(ip)->rest_line)) (ip)->rest_line++
|
||||||
|
|
||||||
main()
|
int main(void)
|
||||||
{
|
{
|
||||||
optimize();
|
optimize();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -63,7 +84,7 @@ main()
|
||||||
* is written to the output and is removed.
|
* is written to the output and is removed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
optimize()
|
static void optimize(void)
|
||||||
{
|
{
|
||||||
struct queue_t windowq, backupq;
|
struct queue_t windowq, backupq;
|
||||||
queue window, backup;
|
queue window, backup;
|
||||||
|
@ -93,11 +114,9 @@ optimize()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool try_hashentry(list,window)
|
static bool try_hashentry(int *list, queue window)
|
||||||
int *list;
|
|
||||||
queue window;
|
|
||||||
{
|
{
|
||||||
register int *pp;
|
int *pp;
|
||||||
patdescr_p p;
|
patdescr_p p;
|
||||||
|
|
||||||
for (pp = list; *pp != -1; pp++) {
|
for (pp = list; *pp != -1; pp++) {
|
||||||
|
@ -126,11 +145,10 @@ bool try_hashentry(list,window)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int hash(w)
|
static int hash(queue w)
|
||||||
queue w;
|
|
||||||
{
|
{
|
||||||
register char *p;
|
char *p;
|
||||||
register sum,i;
|
int sum,i;
|
||||||
instr_p ip;
|
instr_p ip;
|
||||||
|
|
||||||
ip = qhead(w);
|
ip = qhead(w);
|
||||||
|
@ -147,10 +165,9 @@ int hash(w)
|
||||||
* When end-of-file is encountered it may contain fewer items.
|
* When end-of-file is encountered it may contain fewer items.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fill_window(w,len)
|
static void fill_window(queue w, int len)
|
||||||
register queue w;
|
|
||||||
{
|
{
|
||||||
register instr_p ip;
|
instr_p ip;
|
||||||
|
|
||||||
while(qlength(w) < len) {
|
while(qlength(w) < len) {
|
||||||
if ((ip = read_instr()) == NIL) break;
|
if ((ip = read_instr()) == NIL) break;
|
||||||
|
@ -160,10 +177,9 @@ fill_window(w,len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
write_first(w)
|
static void write_first(queue w)
|
||||||
queue w;
|
|
||||||
{
|
{
|
||||||
register instr_p ip = qhead(w);
|
instr_p ip = qhead(w);
|
||||||
|
|
||||||
fputs(ip->line, stdout);
|
fputs(ip->line, stdout);
|
||||||
remove_head(w);
|
remove_head(w);
|
||||||
|
@ -173,12 +189,9 @@ write_first(w)
|
||||||
|
|
||||||
/* Try to recognize the opcode part of an instruction */
|
/* Try to recognize the opcode part of an instruction */
|
||||||
|
|
||||||
void
|
static void set_opcode(instr_p ip)
|
||||||
set_opcode(ip)
|
|
||||||
register instr_p ip;
|
|
||||||
{
|
{
|
||||||
register char *p,*q;
|
char *p,*q,*qlim;
|
||||||
char *qlim;
|
|
||||||
|
|
||||||
if (ip->state == JUNK) return;
|
if (ip->state == JUNK) return;
|
||||||
skip_white(ip);
|
skip_white(ip);
|
||||||
|
@ -206,13 +219,10 @@ set_opcode(ip)
|
||||||
|
|
||||||
/* Check if pattern 'p' matches the current input */
|
/* Check if pattern 'p' matches the current input */
|
||||||
|
|
||||||
bool check_pattern(p,w)
|
static bool check_pattern(patdescr_p p, queue w)
|
||||||
patdescr_p p;
|
|
||||||
queue w;
|
|
||||||
{
|
{
|
||||||
register idescr_p id_p;
|
idescr_p id_p, idlim;
|
||||||
idescr_p idlim;
|
instr_p ip;
|
||||||
register instr_p ip;
|
|
||||||
|
|
||||||
ip = qhead(w);
|
ip = qhead(w);
|
||||||
ANY.vstate = UNINSTANTIATED;
|
ANY.vstate = UNINSTANTIATED;
|
||||||
|
@ -232,12 +242,10 @@ bool check_pattern(p,w)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool check_operands(p,w)
|
static bool check_operands(patdescr_p p, queue w)
|
||||||
patdescr_p p;
|
|
||||||
queue w;
|
|
||||||
{
|
{
|
||||||
register instr_p ip;
|
instr_p ip;
|
||||||
register idescr_p id_p;
|
idescr_p id_p;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* fprintf(stderr,"try pattern %d\n",p-patterns); */
|
/* fprintf(stderr,"try pattern %d\n",p-patterns); */
|
||||||
|
@ -263,9 +271,9 @@ bool check_operands(p,w)
|
||||||
|
|
||||||
/* Reset all variables to uninstantiated */
|
/* Reset all variables to uninstantiated */
|
||||||
|
|
||||||
clear_vars()
|
static void clear_vars(void)
|
||||||
{
|
{
|
||||||
register v;
|
int v;
|
||||||
|
|
||||||
for (v = 1; v <= NRVARS; v++) var[v].vstate = UNINSTANTIATED;
|
for (v = 1; v <= NRVARS; v++) var[v].vstate = UNINSTANTIATED;
|
||||||
}
|
}
|
||||||
|
@ -278,9 +286,7 @@ clear_vars()
|
||||||
* mode-definitions part of the table.
|
* mode-definitions part of the table.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool opmatch(t,s)
|
static bool opmatch(templ_p t, const char *s)
|
||||||
templ_p t;
|
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
char *l, buf[MAXOPLEN+1];
|
char *l, buf[MAXOPLEN+1];
|
||||||
bool was_instantiated;
|
bool was_instantiated;
|
||||||
|
@ -304,10 +310,9 @@ bool opmatch(t,s)
|
||||||
|
|
||||||
/* Try to recognize the operands of an instruction */
|
/* Try to recognize the operands of an instruction */
|
||||||
|
|
||||||
bool split_operands(ip)
|
static bool split_operands(instr_p ip)
|
||||||
register instr_p ip;
|
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
bool res;
|
bool res;
|
||||||
|
|
||||||
if (strcmp(ip->opc,"labdef") ==0) {
|
if (strcmp(ip->opc,"labdef") ==0) {
|
||||||
|
@ -322,11 +327,9 @@ bool split_operands(ip)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
static void labeldef(instr_p ip)
|
||||||
labeldef(ip)
|
|
||||||
register instr_p ip;
|
|
||||||
{
|
{
|
||||||
register char *p;
|
char *p;
|
||||||
int oplen;
|
int oplen;
|
||||||
|
|
||||||
p = ip->rest_line;
|
p = ip->rest_line;
|
||||||
|
@ -344,10 +347,9 @@ labeldef(ip)
|
||||||
|
|
||||||
/* Try to recognize the next operand of instruction 'ip' */
|
/* Try to recognize the next operand of instruction 'ip' */
|
||||||
|
|
||||||
bool operand(ip,n)
|
static bool operand(instr_p ip, int n)
|
||||||
register instr_p ip;
|
|
||||||
{
|
{
|
||||||
register char *p;
|
char *p;
|
||||||
int oplen;
|
int oplen;
|
||||||
#ifdef PAREN_OPEN
|
#ifdef PAREN_OPEN
|
||||||
int nesting = 0;
|
int nesting = 0;
|
||||||
|
@ -381,8 +383,7 @@ bool operand(ip,n)
|
||||||
* (or contains only white space).
|
* (or contains only white space).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool remainder_empty(ip)
|
static bool remainder_empty(instr_p ip)
|
||||||
instr_p ip;
|
|
||||||
{
|
{
|
||||||
skip_white(ip);
|
skip_white(ip);
|
||||||
return *ip->rest_line == '\n';
|
return *ip->rest_line == '\n';
|
||||||
|
@ -393,8 +394,7 @@ bool remainder_empty(ip)
|
||||||
* succeeds then return a pointer to the rest (unmatched part) of 'str'.
|
* succeeds then return a pointer to the rest (unmatched part) of 'str'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *lstrip(str,ctxt)
|
static char *lstrip(char *str, const char *ctxt)
|
||||||
register char *str, *ctxt;
|
|
||||||
{
|
{
|
||||||
assert(ctxt != NULLSTRING);
|
assert(ctxt != NULLSTRING);
|
||||||
while (*str != '\0' && *str == *ctxt) {
|
while (*str != '\0' && *str == *ctxt) {
|
||||||
|
@ -410,10 +410,10 @@ char *lstrip(str,ctxt)
|
||||||
* replace truncate 'str'.
|
* replace truncate 'str'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool rstrip(str,ctxt)
|
static bool rstrip(char *str, const char *ctxt)
|
||||||
char *str,*ctxt;
|
|
||||||
{
|
{
|
||||||
register char *s, *c;
|
char *s;
|
||||||
|
const char *c;
|
||||||
|
|
||||||
for (s = str; *s != '\0'; s++);
|
for (s = str; *s != '\0'; s++);
|
||||||
for (c = ctxt; *c != '\0'; c++);
|
for (c = ctxt; *c != '\0'; c++);
|
||||||
|
@ -432,9 +432,7 @@ bool rstrip(str,ctxt)
|
||||||
* variable becomes instantiated to the string.
|
* variable becomes instantiated to the string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool unify(str,v)
|
static bool unify(const char *str, struct variable *v)
|
||||||
char *str;
|
|
||||||
register struct variable *v;
|
|
||||||
{
|
{
|
||||||
if (v->vstate == UNINSTANTIATED) {
|
if (v->vstate == UNINSTANTIATED) {
|
||||||
v->vstate = INSTANTIATED;
|
v->vstate = INSTANTIATED;
|
||||||
|
@ -449,11 +447,9 @@ bool unify(str,v)
|
||||||
|
|
||||||
/* Transform the working window according to pattern 'p' */
|
/* Transform the working window according to pattern 'p' */
|
||||||
|
|
||||||
xform(p,w)
|
static void xform(patdescr_p p, queue w)
|
||||||
patdescr_p p;
|
|
||||||
queue w;
|
|
||||||
{
|
{
|
||||||
register instr_p ip;
|
instr_p ip;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < p->patlen; i++) {
|
for (i = 0; i < p->patlen; i++) {
|
||||||
|
@ -471,11 +467,9 @@ xform(p,w)
|
||||||
* Note that we generate instructions in reverser order.
|
* Note that we generate instructions in reverser order.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
replacement(p,w)
|
static void replacement(patdescr_p p, queue w)
|
||||||
register patdescr_p p;
|
|
||||||
queue w;
|
|
||||||
{
|
{
|
||||||
register idescr_p id_p;
|
idescr_p id_p;
|
||||||
|
|
||||||
for (id_p = &p->repl[p->replen-1]; id_p >= p->repl; id_p--) {
|
for (id_p = &p->repl[p->replen-1]; id_p >= p->repl; id_p--) {
|
||||||
insert(w,gen_instr(id_p));
|
insert(w,gen_instr(id_p));
|
||||||
|
@ -490,13 +484,11 @@ replacement(p,w)
|
||||||
* in exactly the same way as normal instructions that are just read in.
|
* in exactly the same way as normal instructions that are just read in.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
instr_p gen_instr(id_p)
|
static instr_p gen_instr(idescr_p id_p)
|
||||||
idescr_p id_p;
|
|
||||||
{
|
{
|
||||||
char *opc;
|
char *opc, *s;
|
||||||
instr_p ip;
|
instr_p ip;
|
||||||
register templ_p t;
|
templ_p t;
|
||||||
register char *s;
|
|
||||||
bool islabdef;
|
bool islabdef;
|
||||||
int n;
|
int n;
|
||||||
static char tmp[] = "x";
|
static char tmp[] = "x";
|
||||||
|
@ -547,13 +539,12 @@ instr_p gen_instr(id_p)
|
||||||
|
|
||||||
static bool junk_state = FALSE; /* TRUE while processing a very long line */
|
static bool junk_state = FALSE; /* TRUE while processing a very long line */
|
||||||
|
|
||||||
instr_p read_instr()
|
static instr_p read_instr(void)
|
||||||
{
|
{
|
||||||
instr_p ip;
|
instr_p ip;
|
||||||
register int c;
|
int c;
|
||||||
register char *p;
|
char *p, *plim;
|
||||||
register FILE *inp = stdin;
|
FILE *inp = stdin;
|
||||||
char *plim;
|
|
||||||
|
|
||||||
ip = newinstr();
|
ip = newinstr();
|
||||||
plim = &ip->line[MAXLINELEN];
|
plim = &ip->line[MAXLINELEN];
|
||||||
|
@ -586,9 +577,9 @@ instr_p read_instr()
|
||||||
static instr_p instr_pool;
|
static instr_p instr_pool;
|
||||||
int nr_mallocs = 0; /* for statistics */
|
int nr_mallocs = 0; /* for statistics */
|
||||||
|
|
||||||
instr_p newinstr()
|
static instr_p newinstr(void)
|
||||||
{
|
{
|
||||||
register instr_p ip;
|
instr_p ip;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (instr_pool == NIL) {
|
if (instr_pool == NIL) {
|
||||||
|
@ -607,8 +598,7 @@ instr_p newinstr()
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldinstr(ip)
|
static void oldinstr(instr_p ip)
|
||||||
instr_p ip;
|
|
||||||
{
|
{
|
||||||
ip->fw = instr_pool;
|
ip->fw = instr_pool;
|
||||||
instr_pool = ip;
|
instr_pool = ip;
|
||||||
|
@ -616,30 +606,9 @@ oldinstr(ip)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Debugging stuff */
|
|
||||||
|
|
||||||
badassertion(file,line)
|
|
||||||
char *file;
|
|
||||||
unsigned line;
|
|
||||||
{
|
|
||||||
fprintf(stderr,"assertion failed file %s, line %u\n",file,line);
|
|
||||||
error("assertion");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* VARARGS1 */
|
|
||||||
error(s,a)
|
|
||||||
char *s,*a;
|
|
||||||
{
|
|
||||||
fprintf(stderr,s,a);
|
|
||||||
fprintf(stderr,"\n");
|
|
||||||
abort();
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Low level routines */
|
/* Low level routines */
|
||||||
|
|
||||||
bool op_separator(ip)
|
static bool op_separator(instr_p ip)
|
||||||
instr_p ip;
|
|
||||||
{
|
{
|
||||||
skip_white(ip);
|
skip_white(ip);
|
||||||
if (*(ip->rest_line) == OP_SEPARATOR) {
|
if (*(ip->rest_line) == OP_SEPARATOR) {
|
||||||
|
@ -652,14 +621,13 @@ bool op_separator(ip)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool well_shaped(opc)
|
static bool well_shaped(const char *opc)
|
||||||
char *opc;
|
|
||||||
{
|
{
|
||||||
return is_letter(opc[0]);
|
return is_letter(opc[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_letter(c)
|
static bool is_letter(char c)
|
||||||
{
|
{
|
||||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,5 +89,3 @@ typedef int bool;
|
||||||
|
|
||||||
#define NIL (instr_p) 0
|
#define NIL (instr_p) 0
|
||||||
#define NULLSTRING (char *) 0
|
#define NULLSTRING (char *) 0
|
||||||
|
|
||||||
#define assert(x) if(!(x)) badassertion(__FILE__,__LINE__)
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ declaration_block :
|
||||||
|
|
||||||
mode_definitions
|
mode_definitions
|
||||||
{ int lin; } :
|
{ int lin; } :
|
||||||
{ fputs("tok_chk(varno) {\n\tint r;\n", genc);
|
{ fputs("int tok_chk(int varno) {\n\tint r;\n", genc);
|
||||||
fputs("\tchar *VAL;\n\n",genc);
|
fputs("\tchar *VAL;\n\n",genc);
|
||||||
fputs("\tVAL = var[varno].value;\n",genc);
|
fputs("\tVAL = var[varno].value;\n",genc);
|
||||||
fputs("\tswitch(varno) {\n",genc);
|
fputs("\tswitch(varno) {\n",genc);
|
||||||
|
|
Loading…
Reference in a new issue