From c9f7d845a2a08af8460970210d9c34c1e4568b89 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 5 Aug 1987 13:09:37 +0000 Subject: [PATCH] temporary fix for commas within operands --- mach/proto/top/queue.h | 1 - mach/proto/top/top.c | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mach/proto/top/queue.h b/mach/proto/top/queue.h index 5d9a7fc03..45e890462 100644 --- a/mach/proto/top/queue.h +++ b/mach/proto/top/queue.h @@ -3,7 +3,6 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -typedef struct item *item_p; typedef struct queue_t *queue; struct queue_t { diff --git a/mach/proto/top/top.c b/mach/proto/top/top.c index bb4d5e54f..4b423fba0 100644 --- a/mach/proto/top/top.c +++ b/mach/proto/top/top.c @@ -14,8 +14,7 @@ extern char *lstrip(); extern instr_p newinstr(); extern instr_p read_instr(); extern instr_p gen_instr(); -extern char *eval_templ(); -extern instr_p malloc(); +extern char * malloc(); struct variable var[NRVARS+1]; struct variable ANY; /* ANY symbol matching any instruction */ @@ -64,7 +63,6 @@ optimize() struct queue_t windowq, backupq; queue window, backup; instr_p ip; - bool change; window = &windowq; backup = &backupq; @@ -344,10 +342,15 @@ bool operand(ip,n) { register char *p; int oplen; + int nesting = 0; skip_white(ip); p = ip->rest_line; - while( *p != OP_SEPARATOR && *p != '\n') p++; + while((*p != OP_SEPARATOR || nesting) && *p != '\n') { + if (*p == '(') nesting++; + else if (*p == ')') nesting--; + p++; + } oplen = p - ip->rest_line; if (oplen == 0 || oplen > MAXOPLEN) return FALSE; strncpy(ip->op[n],ip->rest_line,oplen); @@ -571,7 +574,8 @@ instr_p newinstr() int i; if (instr_pool == NIL) { - instr_pool = malloc(sizeof(struct instruction)); + instr_pool = (instr_p) malloc(sizeof(struct instruction)); + instr_pool->fw = 0; nr_mallocs++; } assert(instr_pool != NIL); -- 2.34.1