aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-17 14:37:56 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-17 14:40:44 -0400
commit271c293f1a8a1ba3316d6b9fecb955d336441fd0 (patch)
treeeb1657fe3c4c39d688b2ea024123d740db839975
parent7b7bccf53b94ea80c60f5b9ee4b4a8c64cce5823 (diff)
downloadbw-atari8-tools-271c293f1a8a1ba3316d6b9fecb955d336441fd0.tar.gz
listbas: add -k (no mixed case) option for BXL/BXE.
-rw-r--r--listbas.110
-rw-r--r--listbas.c12
-rw-r--r--listbas.rst10
3 files changed, 27 insertions, 5 deletions
diff --git a/listbas.1 b/listbas.1
index 07ef088..126f00c 100644
--- a/listbas.1
+++ b/listbas.1
@@ -44,7 +44,7 @@ escape sequences for inverse video and color syntax highlighting.
.sp
\fBlistbas\fP supports several BASIC dialects used on the Atari. By
default, the BASIC dialect is autodetected by running \fBwhichbas\fP(1)
-as an external process.
+as an external process. To override this, see the \fB\-b\fP option, below.
.SH OPTIONS
.SS BASIC options
.INDENT 0.0
@@ -81,6 +81,14 @@ Include the immediate mode command (line 32768) in the output.
.B \fB\-l\fP
Do not print line numbers at the start of each line. \fBGOTO\fP, \fBGOSUB\fP,
\fBTRAP\fP, and \fBTHEN\fP target line numbers are still printed.
+.TP
+.B \fB\-t\fP
+Do not indent, if the program is Turbo BASIC, BASIC/A+, BASIC XL, or BASIC XE.
+If you want to indent an Atari BASIC program, use \fB\-bt\fP or \fB\-bxl\fP\&.
+.TP
+.B \fB\-k\fP
+Do not print keywords in mixed case (e.g. \fBPrint\fP, \fBGraphics\fP),
+for BASIC XL or BASIC XE.
.UNINDENT
.SS Output modes
.sp
diff --git a/listbas.c b/listbas.c
index 11455e5..eed8334 100644
--- a/listbas.c
+++ b/listbas.c
@@ -77,6 +77,7 @@ int underline = 0; /* 1 with -u */
int skip_lineno = 0; /* 1 with -l */
int dump_tables = 0; /* 1 with -D */
int autodetect = 1; /* 0 with -b */
+int mixed_case = 1; /* 0 with -k, or if input is B_ATARI or B_APLUS */
/* change these with -c */
int color_cmd = C_YELLOW;
@@ -145,7 +146,7 @@ int get_bas_type(char *arg) {
}
void print_help(void) {
- printf("Usage: %s [-a|-d|-m|-x|-U] [-B] [-i] [-l] [-u] [-n|-C] [-v] [-c *colors*] <inputfile>\n", self);
+ printf("Usage: %s [-a|-d|-m|-x|-U] [-B] [-i] [-l] [-u] [-n|-C] [-v] [-c *colors*] [-k] <inputfile>\n", self);
printf(" -b <XX>: set BASIC type. XX is: a = atari, t = turbo, xl, xe, a+.\n");
printf(" -U: output ATASCII as Unicode/UTF-8 (this is the default).\n");
printf(" -a: output raw ATASCII.\n");
@@ -159,6 +160,7 @@ void print_help(void) {
printf(" -n: disable color syntax highlighting.\n");
printf(" -u: use underline for inverse video.\n");
printf(" -c: use custom colors (see man page).\n");
+ printf(" -k: disable mixed case keywords for BXL/BXE (e.g. Print).\n");
printf(" -v: verbose.\n");
}
@@ -167,7 +169,7 @@ void parse_args(int argc, char **argv, int from_env) {
optind = 1;
- while( (opt = getopt(argc, argv, "Db:UCviamnBdhxulc:")) != -1) {
+ while( (opt = getopt(argc, argv, "Db:UCviamnBdhxulc:k")) != -1) {
switch(opt) {
case 'U': output_mode = M_UTF8; break;
case 'a': output_mode = M_ATASCII; color = 0; break;
@@ -182,6 +184,7 @@ void parse_args(int argc, char **argv, int from_env) {
case 'C': color = 1; break;
case 'n': color = 0; break;
case 'l': skip_lineno = 1; break;
+ case 'k': mixed_case = 0; break;
case 'b': autodetect = 0; bas_type = get_bas_type(optarg); break;
case 'c': parse_color_scheme(optarg); break;
case 'h': print_help(); exit(0);
@@ -493,7 +496,7 @@ CALLBACK(print_cmd) {
if(bas_type == B_BXL && tok == 0x5a)
name = get_bxl_ext_name(program[pos + 1]);
- if(bas_type == B_BXL || bas_type == B_BXE) {
+ if(mixed_case && (bas_type == B_BXL || bas_type == B_BXE)) {
print_mixed_case(name);
outchr(' ');
} else {
@@ -839,6 +842,9 @@ void init_bas_dialect() {
if(bas_type == B_BXL)
bxl_exttok_hack = 1;
+
+ if(bas_type == B_ATARI || bas_type == B_APLUS || bas_type == B_TURBO)
+ mixed_case = 0;
}
int main(int argc, char **argv) {
diff --git a/listbas.rst b/listbas.rst
index 7895b1b..a32f5c2 100644
--- a/listbas.rst
+++ b/listbas.rst
@@ -25,7 +25,7 @@ escape sequences for inverse video and color syntax highlighting.
**listbas** supports several BASIC dialects used on the Atari. By
default, the BASIC dialect is autodetected by running **whichbas**\(1)
-as an external process.
+as an external process. To override this, see the **-b** option, below.
OPTIONS
=======
@@ -64,6 +64,14 @@ BASIC options
Do not print line numbers at the start of each line. **GOTO**, **GOSUB**,
**TRAP**, and **THEN** target line numbers are still printed.
+**-t**
+ Do not indent, if the program is Turbo BASIC, BASIC/A+, BASIC XL, or BASIC XE.
+ If you want to indent an Atari BASIC program, use **-bt** or **-bxl**.
+
+**-k**
+ Do not print keywords in mixed case (e.g. **Print**, **Graphics**),
+ for BASIC XL or BASIC XE.
+
Output modes
------------