diff options
Diffstat (limited to 'whichbas.rst')
-rw-r--r-- | whichbas.rst | 94 |
1 files changed, 80 insertions, 14 deletions
diff --git a/whichbas.rst b/whichbas.rst index 472b216..350be21 100644 --- a/whichbas.rst +++ b/whichbas.rst @@ -27,6 +27,14 @@ OPTIONS Detection Options ----------------- +**-s** + Script (or silent) mode. Instead of printing a human-readable + name like "Turbo BASIC XL" or "OSS BASIC XE" to stdout, **whichbas** + will print nothing on standard output, but will exit with a status + indicating what it detected. The caller can check the return status + (e.g. the **$?** variable in Bourne/POSIX shells, or **ERRORLEVEL** + in MS-DOS or Windows). See **EXIT STATUS**, below. + **-k** Keep going. The default is to stop looking at the program if the BASIC type gets narrowed down to either Turbo BASIC or BASIC XE. @@ -37,7 +45,8 @@ Detection Options NOTES ===== -Atari BASIC programs are detected 100% reliably. +Atari BASIC programs are detected *almost* 100% reliably. See **BUGS**, below, +for the gory details. Turbo BASIC, BASIC XL, and BASIC XE are all supersets of Atari BASIC. If you wrote a program using one of them, but didn't use any of the @@ -55,8 +64,8 @@ adds to those found in BASIC XL. Detection of Turbo vs. BXL/BXE isn't 100% reliable, and probably never will be. There's too much overlap between the sets of extra tokens added by each. Programs that don't use very many of the extra -functions provided by Turbo/BXL/BXE may show up as "Not Atari BASIC; -probably either Turbo or BXL/BXE". +functions provided by Turbo/BXL/BXE may show up as "Either Turbo BASIC XL +or OSS BASIC XE". Atari Microsoft BASIC is detected by checking that the first two bytes of the file are not zero, and that the last 3 are zero. This @@ -70,22 +79,79 @@ ELF binaries, etc) as a convenience, but I wouldn't rely on LIMITATIONS =========== -Currently, **whichbas** doesn't look at the variable name or type -tables. One problem caused by this: If a program uses only Atari BASIC -tokens, but uses variable(s) with _ in the name, it will be identified -as Atari BASIC... even though _ in variable names is illegal in Atari -BASIC and pretty much guarantees the program is Turbo/BXL/BXE. - -Looking at the variable types could also improve detection, since -Turbo and BXL/BXE support extended variable types (procedure labels -for Turbo, string arrays for BXL/BXE). - **whichbas** knows nothing about other BASICs such as Frost BASIC, BASIC/A+, Altirra BASIC... +BUGS +==== +It's possible to get a BASIC XL/XE program to misdetect as Atari BASIC +by writing a program that does these things: + + - Dimensions a string array with a number of elements that isn't just a + numeric constant or numeric variable (e.g. *DIM A$(2+2,10)* or + *DIM A$(I*2,10)*). The code that detects a 2D string *DIM* command + can only handle simple cases like *DIM A$(10,10)* or *DIM A$(I,10)*. + It doesn't actually matter if the 2nd argument is a fancy expression, + though. + + - Does *not* actually *use* the string array variable by assigning to + it or reading a value from it. String array accesses in BASIC XL/XE + are reliably detected because they require a semicolon after the + first number, even if there isn't a 2nd number. Example: *? A$(2;)* + prints the 2nd element of the *A$* string array. If it were written + as *? A$(2)*, but *A$* is a string array (not a regular string), + BASIC XL/XE would give an *Error 40* (string type mismatch) at + runtime. + +The good news is, such a program will still work fine in Atari BASIC. +Believe it or not, it's true. + EXIT STATUS =========== -0 for success, 1 for failure. +Without the **-s** option, exit status is 0 for success, non-zero for +failure. + +With the **-s** option, the exit status is: + +**0** + Not used with **-s**. + +**1** or **2** + Error reading file. Error message will be printed on standard error. + +**3** + Atari BASIC detected. + +**4** + Turbo BASIC detected. + +**5** + OSS BASIC XL detected. + +**6** + Non-EXTENDed OSS BASIC XE detected. + +**7** + Turbo BASIC or BASIC XL (undecided which). + +**8** + Turbo BASIC or non-EXTENDed BASIC XE (undecided which). + +**9** + Turbo BASIC, BASIC XL, or non-EXTENDed BASIC XE (undecided which). + +**10** + Unknown Atari BASIC derivative (not Atari BASIC, but not + Turbo/BXL/BXE either). + +**11** + Atari Microsoft BASIC detected. + +**12** + EXTENDed OSS BASIC XE detected. + +**32** + None of the above; not BASIC. .. include:: manftr.rst |