aboutsummaryrefslogtreecommitdiff
path: root/cxrefbas.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-06-16 18:04:09 -0400
committerB. Watson <urchlay@slackware.uk>2024-06-16 18:04:09 -0400
commited910cdfa474bd7a3fd0cf3082119abc41b094e4 (patch)
tree175cfefe090bcd125b96c889c07487c75083083b /cxrefbas.c
parente2250e5cb71c9a06bf75d59e9c0369efd65b1206 (diff)
downloadbw-atari8-tools-ed910cdfa474bd7a3fd0cf3082119abc41b094e4.tar.gz
cxrefbas: computed warning now says ON/GOTO or ON/GOSUB, not just ON.
Diffstat (limited to 'cxrefbas.c')
-rw-r--r--cxrefbas.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/cxrefbas.c b/cxrefbas.c
index 45369d4..7cc3114 100644
--- a/cxrefbas.c
+++ b/cxrefbas.c
@@ -11,7 +11,7 @@
unsigned short *linerefs[32769];
int refcounts[32769];
int lines_exist[32769];
-int last_cmd;
+unsigned char last_cmd, on_op;
int last_cmd_pos;
void add_lineref(unsigned short from, unsigned short to) {
@@ -57,9 +57,10 @@ CALLBACK(start_stmt) {
CALLBACK(got_cmd) {
last_cmd = tok;
last_cmd_pos = pos;
+ on_op = 0;
}
-void computed_msg(unsigned char tok, unsigned short lineno) {
+void computed_msg(unsigned short lineno) {
static int last_lineno = -1;
char *cmd;
@@ -67,7 +68,7 @@ void computed_msg(unsigned char tok, unsigned short lineno) {
if(lineno == last_lineno) return;
last_lineno = lineno;
- switch(tok) {
+ switch(last_cmd) {
case CMD_GOTO:
cmd = "GOTO"; break;
case CMD_GO_TO:
@@ -79,7 +80,11 @@ void computed_msg(unsigned char tok, unsigned short lineno) {
case CMD_TRAP:
cmd = "TRAP"; break;
case CMD_ON:
- cmd = "ON"; break;
+ if(on_op == OP_GOSUB)
+ cmd = "ON/GOSUB";
+ else
+ cmd = "ON/GOTO";
+ break;
default: /* should never happen! */
cmd = "???"; break;
}
@@ -94,7 +99,7 @@ CALLBACK(got_var) {
case CMD_GOSUB:
case CMD_RESTORE:
case CMD_TRAP:
- computed_msg(last_cmd, lineno);
+ computed_msg(lineno);
break;
default:
break;
@@ -104,6 +109,11 @@ CALLBACK(got_var) {
CALLBACK(got_exp) {
int standalone;
+ if(last_cmd == CMD_ON) {
+ if(tok == OP_GOTO || tok == OP_GOSUB)
+ on_op = tok;
+ }
+
if(tok != OP_NUMCONST) return;
standalone = is_standalone_num(pos);
@@ -116,7 +126,7 @@ CALLBACK(got_exp) {
if((pos == last_cmd_pos + 1) && standalone) {
add_lineref(lineno, fp2int(program + pos + 1));
} else {
- computed_msg(last_cmd, lineno);
+ computed_msg(lineno);
}
break;
case CMD_ON: {
@@ -128,7 +138,7 @@ CALLBACK(got_exp) {
if(standalone)
add_lineref(lineno, fp2int(program + pos + 1));
else
- computed_msg(last_cmd, lineno);
+ computed_msg(lineno);
break;
default:
break;