aboutsummaryrefslogtreecommitdiff
path: root/listbas.c
diff options
context:
space:
mode:
Diffstat (limited to 'listbas.c')
-rw-r--r--listbas.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/listbas.c b/listbas.c
index b0e2253..bac42c1 100644
--- a/listbas.c
+++ b/listbas.c
@@ -59,11 +59,12 @@ int color_cmd = C_YELLOW;
int color_op = C_GREEN;
int color_func = C_PURPLE;
int color_const = C_RED;
-int color_lnum_text = C_CYAN;
+int color_lineno = C_CYAN;
+int color_text = C_CYAN;
int color_varnames = NO_COLOR;
-int badtok = 0; /* set to 1 if we find a bad token */
-int inv = 0; /* set to 1 when we're printing inverse */
+int badtok = 0; /* set to 1 if we find a bad token */
+int inv = 0; /* set to 1 when we're printing inverse */
int cur_color = -1; /* -1 = no color */
FILE *outfh;
@@ -81,15 +82,16 @@ int parse_color(char c) {
void parse_color_scheme(const char *arg) {
if(!arg) return;
- if(strlen(arg) != 6)
- die("Color scheme must be 6 characters.");
+ if(strlen(arg) != 7)
+ die("Color scheme must be 7 characters.");
color_cmd = parse_color(arg[0]);
color_op = parse_color(arg[1]);
color_func = parse_color(arg[2]);
color_const = parse_color(arg[3]);
- color_lnum_text = parse_color(arg[4]);
- color_varnames = parse_color(arg[5]);
+ color_lineno = parse_color(arg[4]);
+ color_text = parse_color(arg[5]);
+ color_varnames = parse_color(arg[6]);
}
void print_help(void) {
@@ -254,22 +256,22 @@ void print_number(unsigned int pos) {
need to be printed that way. */
int affects_inv(unsigned char c) {
switch(c) {
- case 0x1b:
- case 0x1c:
- case 0x1d:
- case 0x1e:
- case 0x1f:
- case 0x9b:
- case 0x9c:
- case 0x9d:
- case 0x9e:
- case 0x9f:
- case 0x7d:
- case 0x7e:
- case 0x7f:
- case 0xfd:
- case 0xfe:
- case 0xff:
+ case 0x1b: /* esc */
+ case 0x1c: /* up */
+ case 0x1d: /* down */
+ case 0x1e: /* left */
+ case 0x1f: /* right */
+ case 0x9b: /* EOL */
+ case 0x9c: /* del line */
+ case 0x9d: /* ins line */
+ case 0x9e: /* clear tab */
+ case 0x9f: /* set tab */
+ case 0x7d: /* cls */
+ case 0x7e: /* BS */
+ case 0x7f: /* tab */
+ case 0xfd: /* bell */
+ case 0xfe: /* del chr */
+ case 0xff: /* ins chr */
return 0;
default:
return 1;
@@ -366,7 +368,7 @@ void print_string(unsigned int pos, unsigned int len) {
}
CALLBACK(print_lineno) {
- if(color) color_on(color_lnum_text);
+ if(color) color_on(color_lineno);
fprintf(outfh, "%d ", lineno);
if(color) color_off();
}
@@ -404,8 +406,8 @@ CALLBACK(print_op) {
if(color) {
if(tok > 0x3c)
color_on(color_func);
- else if(tok == OP_UMINUS)
- color_on(color_const); /* show leading - in same color as the number */
+ else if(tok == OP_UMINUS || tok == OP_UPLUS)
+ color_on(color_const); /* show leading sign in same color as the number */
else if((tok >= 0x17 && tok <= 0x1b) || (tok >= 0x28 && tok <= 0x2a))
color_on(color_cmd);
else
@@ -444,7 +446,7 @@ CALLBACK(print_text) {
unsigned char c, is_data = program[pos - 1] == CMD_DATA, comma = 0;
inv = 0;
- if(color) color_on(color_lnum_text);
+ if(color) color_on(color_text);
while(program[pos] != 0x9b) {
c = program[pos++];
if(color && is_data && c == ',') {
@@ -455,7 +457,7 @@ CALLBACK(print_text) {
}
print_ata_chr(c);
if(comma)
- color_on(color_lnum_text);
+ color_on(color_text);
}
if(inv) end_inv(0);
if(color) color_off();