The BASIC run-time support library works invisibly with basic(1) and, along with the BASIC code generator and UNIX libraries, accomplishes all the tasks possible with BASIC. Thus one need not typically refer to this section. However, when code written in another language is to be integrated with a BASIC program, it becomes necessary to have some knowledge of the inner workings of BASIC. This may occur, for example, if the programmer needs to use a tightly coded assembler routine or has available a FORTRAN statistics package or perhaps wants to gain access to UNIX system functions using a C routine.
This section should make BASIC a “good neighbor” to the other UNIX languages, but the methods described here remain trade secrets of Basmark.
The names of the symbols defined by the code generator and the library are:
Bargc | chain | err | lset | setalarm | |||||||
Bargv | chainy | errdisable | ltrimS | setstr | |||||||
Bcomal | chrS | exitty | main | sgn | |||||||
Bcomon | cint | field | makeaddr | shell1 | |||||||
Bdata | closedir | file0 | midS1 | shell2 | |||||||
Berror | clrstr | filed | midS2 | sorter | |||||||
Bseg | cls | filel | mkbiobuf | spaceS | |||||||
L0 | cmpstr | filen | mkdS | spc | |||||||
_reset | color | files | mkdmbS | sqr | |||||||
asc | comma | filptr | mkiS | stop | |||||||
asgstr | comndS | fix | mksS | strS | |||||||
atobasic | csng | genfilnam | mksmbS | strinS | |||||||
bchdir | csrlin | getalarm | name | tab | |||||||
bclose | cstring | getcol | newlin | telldir | |||||||
beep | cvd | getrow | numcvt | terment | |||||||
bend | cvdmb | hexS | octS | termflag | |||||||
bexit | cvi | ignsigs | opendir | termgoto | |||||||
bget | cvs | initio | ospeed | termnum | |||||||
bgetc | cvsmb | initrm | peek | termpad | |||||||
biofn | dateS | initsg | poke | termstr | |||||||
biotab | defseg | initty | pos | timeS | |||||||
bkill | dezomb | inkeyS | power | timer | |||||||
bload | dimd | inkmatch | trace | ||||||||
blog | dirfiles | inline | printu | trapsigs | |||||||
bmkdir | doclose | input | random | tron | |||||||
bopen | docvt | inputS | readdir | ttyerase | |||||||
bput | doerr | instr | rembiobuf | ttykill | |||||||
bputc | doread | lcaseS | rightS | ubound | |||||||
bputs | dotrim | lclose | rnd | ucaseS | |||||||
breset | dowrite | leftS | round | unixerror | |||||||
brmdir | ehandl | len | rset | useaddr | |||||||
bsave | envir | linein | rtrimS | usenum | |||||||
btermcap | envirS | loc | run | usfnum | |||||||
bunget | eof | locate | runerr | val | |||||||
bwrite | erased | lock | runmess | varptS | |||||||
catstr | erases | lof | seekdir | varptr | |||||||
cdbl | erl | lpos | seg | width |
Other errors generally can not be anticipated and are the result
of error conditions detected by UNIX system calls. These errors
are handled by mapping the UNIX error number, errno
(see intro(2)), into the most appropriate BASIC error number.
Although code could be written to produce the UNIX error number,
the following list describes the mapping to help the
user discover which UNIX error code caused the
BASIC error condition:
BASIC Error | UNIX Error | ||||||||
5 | Illegal function call | 1 | Not owner | ||||||
5 | Illegal function call | 13 | Permission denied | ||||||
6 | Overflow | 34 | Result too large | ||||||
7 | Out of memory | 12 | Not enough space | ||||||
11 | Division by zero | 33 | Math argument | ||||||
53 | File not found | 2 | No such file or directory | ||||||
58 | File already exists | 17 | File exists | ||||||
61 | Disk full | 28 | No space left on device | ||||||
64 | Bad file name | 21 | Is a directory | ||||||
70 | Disk Write Protect | 30 | Read-only file system | ||||||
71 | Disk not Ready | 6 | No such device or address | ||||||
72 | Disk Media Error | 5 | I/O Error |
from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber