From 712b0690da4b03842a954bfbd1f75925bb7b234e Mon Sep 17 00:00:00 2001 From: anthk Date: Mon, 8 Mar 2021 21:34:43 +0000 Subject: =?UTF-8?q?Importaci=C3=B3n=20inicial=20a=20texto-plano?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BCCDOS16.BAT | 35 + BCCDOS16.TXT | 48 + COPYING | 341 + DMCDOS32.CMD | 35 + DMCDOS32.TXT | 123 + DMCWIN32.CMD | 35 + DMCWIN32.TXT | 132 + DOCS/ALL.txt | 21021 ++++++++++++++++++++++++++++++++++++++++++++++++++ DOCS/BYWATER-2.txt | 1391 ++++ DOCS/BYWATER.txt | 2538 ++++++ DOCS/CALL-360.txt | 1089 +++ DOCS/CBASIC-II.txt | 1109 +++ DOCS/CMDS.HTM | 394 + DOCS/DARTMOUTH.txt | 1009 +++ DOCS/ECMA-116.txt | 1318 ++++ DOCS/ECMA-55.txt | 873 +++ DOCS/FNCS.HTM | 373 + DOCS/GCOS.txt | 1114 +++ DOCS/HAARDT.txt | 1788 +++++ DOCS/HANDBOOK1.txt | 1562 ++++ DOCS/HANDBOOK2.txt | 2004 +++++ DOCS/HEATH.txt | 1110 +++ DOCS/MARK-I.txt | 1064 +++ DOCS/MARK-II.txt | 1114 +++ DOCS/MBASIC.txt | 1599 ++++ DOCS/PDP-11.txt | 836 ++ DOCS/PDP-8.txt | 877 +++ DOCS/RBASIC.txt | 1262 +++ DOCS/RSTS-11.txt | 1740 +++++ DOCS/SYSTEM-360.txt | 1089 +++ DOCS/SYSTEM-370.txt | 1089 +++ DOCS/TRS-80.txt | 1604 ++++ DOCS/VINTAGE.txt | 844 ++ DOCS/XBASIC.txt | 1245 +++ INSTALL | 87 + Makefile | 116 + Makefile.in | 115 + Makefile.ncu | 121 + OW19.BAT | 12 + README | 485 ++ allcms.bat | 9 + allcms.exec | 28 + allmvs.bat | 3 + bwb_cmd.c | 10217 ++++++++++++++++++++++++ bwb_cnd.c | 1937 +++++ bwb_dio.c | 1281 +++ bwb_exp.c | 3519 +++++++++ bwb_fnc.c | 4721 ++++++++++++ bwb_inp.c | 3525 +++++++++ bwb_int.c | 4086 ++++++++++ bwb_prn.c | 2973 +++++++ bwb_stc.c | 1433 ++++ bwb_str.c | 762 ++ bwb_tbl.c | 1156 +++ bwb_var.c | 5068 ++++++++++++ bwbasic.c | 3639 +++++++++ bwbasic.doc | 1156 +++ bwbasic.h | 3050 ++++++++ bwbasic.mak | 85 + bwbasic1.jcl | 9 + bwbasic2.jcl | 35 + bwbasic3.jcl | 22 + bwbasic4.jcl | 32 + bwbasic5.jcl | 64 + bwbasic6.jcl | 38 + bwbasic7.jcl | 45 + bwd_cmd.c | 2627 +++++++ bwd_fun.c | 4014 ++++++++++ bwd_six.h | 564 ++ bwx_tty.c | 137 + cms.bas | 108 + compile.bat | 23 + compile.exec | 65 + config.status | 55 + configure | 317 + configure.in | 12 + example.bas | 6 + makefile.qcl | 60 + makefile.wcl386 | 96 + profile.bas | 1 + renum | Bin 0 -> 15928 bytes renum.c | 580 ++ stdbwb.parm | 1 + stdcomp.bat | 3 + subjobs.bat | 9 + unixio.c | 170 + unixio.h | 41 + zipcms.bat | 2 + zipmvs.bat | 9 + 89 files changed, 112534 insertions(+) create mode 100644 BCCDOS16.BAT create mode 100644 BCCDOS16.TXT create mode 100644 COPYING create mode 100644 DMCDOS32.CMD create mode 100644 DMCDOS32.TXT create mode 100644 DMCWIN32.CMD create mode 100644 DMCWIN32.TXT create mode 100644 DOCS/ALL.txt create mode 100644 DOCS/BYWATER-2.txt create mode 100644 DOCS/BYWATER.txt create mode 100644 DOCS/CALL-360.txt create mode 100644 DOCS/CBASIC-II.txt create mode 100644 DOCS/CMDS.HTM create mode 100644 DOCS/DARTMOUTH.txt create mode 100644 DOCS/ECMA-116.txt create mode 100644 DOCS/ECMA-55.txt create mode 100644 DOCS/FNCS.HTM create mode 100644 DOCS/GCOS.txt create mode 100644 DOCS/HAARDT.txt create mode 100644 DOCS/HANDBOOK1.txt create mode 100644 DOCS/HANDBOOK2.txt create mode 100644 DOCS/HEATH.txt create mode 100644 DOCS/MARK-I.txt create mode 100644 DOCS/MARK-II.txt create mode 100644 DOCS/MBASIC.txt create mode 100644 DOCS/PDP-11.txt create mode 100644 DOCS/PDP-8.txt create mode 100644 DOCS/RBASIC.txt create mode 100644 DOCS/RSTS-11.txt create mode 100644 DOCS/SYSTEM-360.txt create mode 100644 DOCS/SYSTEM-370.txt create mode 100644 DOCS/TRS-80.txt create mode 100644 DOCS/VINTAGE.txt create mode 100644 DOCS/XBASIC.txt create mode 100644 INSTALL create mode 100644 Makefile create mode 100644 Makefile.in create mode 100644 Makefile.ncu create mode 100644 OW19.BAT create mode 100644 README create mode 100644 allcms.bat create mode 100644 allcms.exec create mode 100644 allmvs.bat create mode 100644 bwb_cmd.c create mode 100644 bwb_cnd.c create mode 100644 bwb_dio.c create mode 100644 bwb_exp.c create mode 100644 bwb_fnc.c create mode 100644 bwb_inp.c create mode 100644 bwb_int.c create mode 100644 bwb_prn.c create mode 100644 bwb_stc.c create mode 100644 bwb_str.c create mode 100644 bwb_tbl.c create mode 100644 bwb_var.c create mode 100644 bwbasic.c create mode 100644 bwbasic.doc create mode 100644 bwbasic.h create mode 100644 bwbasic.mak create mode 100644 bwbasic1.jcl create mode 100644 bwbasic2.jcl create mode 100644 bwbasic3.jcl create mode 100644 bwbasic4.jcl create mode 100644 bwbasic5.jcl create mode 100644 bwbasic6.jcl create mode 100644 bwbasic7.jcl create mode 100644 bwd_cmd.c create mode 100644 bwd_fun.c create mode 100644 bwd_six.h create mode 100644 bwx_tty.c create mode 100644 cms.bas create mode 100644 compile.bat create mode 100644 compile.exec create mode 100755 config.status create mode 100644 configure create mode 100644 configure.in create mode 100644 example.bas create mode 100644 makefile.qcl create mode 100644 makefile.wcl386 create mode 100644 profile.bas create mode 100755 renum create mode 100644 renum.c create mode 100644 stdbwb.parm create mode 100644 stdcomp.bat create mode 100644 subjobs.bat create mode 100644 unixio.c create mode 100644 unixio.h create mode 100644 zipcms.bat create mode 100644 zipmvs.bat diff --git a/BCCDOS16.BAT b/BCCDOS16.BAT new file mode 100644 index 0000000..307a86a --- /dev/null +++ b/BCCDOS16.BAT @@ -0,0 +1,35 @@ +@echo off +rem Filename: BCCDOS16.BAT +rem Purpose: Build Bywater BASIC for MS-DOS (16-bit) using Borland C++ Version 3.1 +rem Author: Howard Wulf, AF5NE +rem Date: 2015-01-29 +rem Uasage: implementation defined +rem Example: +rem cd \sdcard\Download\BASIC\bwbasic3\ +rem BCCDOS16.BAT +rem +rem This is the location of BCC.EXE +rem +set BINDIR=C:\DOS\BC31\BIN +rem +rem Cleanup before compile +rem +DEL BW*.EXE 1> NUL 2> NUL +DEL BW*.OBJ 1> NUL 2> NUL +DEL BW*.MAP 1> NUL 2> NUL +rem +rem Compile +rem +set OLDPATH=%PATH% +set PATH=%BINDIR%;%PATH% +bcc.exe > BCCDOS16.TXT +bcc.exe -mh -eBWBASIC.EXE -DHAVE_MSDOS=1 -Y bw*.c >> BCCDOS16.TXT +set PATH=%OLDPATH% +set OLDPATH= +set BINDIR= +rem +rem Cleanup after compile +rem +DEL BW*.OBJ 1> NUL 2> NUL +DEL BW*.MAP 1> NUL 2> NUL +rem EOF diff --git a/BCCDOS16.TXT b/BCCDOS16.TXT new file mode 100644 index 0000000..b55e4bb --- /dev/null +++ b/BCCDOS16.TXT @@ -0,0 +1,48 @@ +Borland C++ Version 3.1 Copyright (c) 1992 Borland International +Syntax is: BCC [ options ] file[s] * = default; -x- = turn switch x off + -1 80186/286 Instructions -2 80286 Protected Mode Inst. + -Ax Disable extensions -B Compile via assembly + -C Allow nested comments -Dxxx Define macro + -Exxx Alternate Assembler name -G Generate for speed + -Hxxx Use pre-compiled headers -Ixxx Include files directory + -K Default char is unsigned -Lxxx Libraries directory + -M Generate link map -N Check stack overflow + -Ox Optimizations -P Force C++ compile + -Qxxx Memory usage control -S Produce assembly output + -Txxx Set assembler option -Uxxx Undefine macro + -Vx Virtual table control -Wxxx Create Windows application + -X Suppress autodep. output -Yx Overlay control + -Z Suppress register reloads -a Generate word alignment + -b * Treat enums as integers -c Compile only + -d Merge duplicate strings -exxx Executable file name + -fxx Floating point options -gN Stop after N warnings + -iN Max. identifier length -jN Stop after N errors + -k Standard stack frame -lx Set linker option + -mx Set Memory Model -nxxx Output file directory + -oxxx Object file name -p Pascal calls + -r * Register variables -u * Underscores on externs + -v Source level debugging -wxxx Warning control + -y Produce line number info -zxxx Set segment namesBorland C++ Version 3.1 Copyright (c) 1992 Borland International +bwbasic.c: +Warning bwbasic.c 302: Parameter 'x' is never used in function break_mes +Warning bwbasic.c 371: Condition is always true in function bwx_TIMER +bwb_cmd.c: +Warning bwb_cmd.c 5907: Condition is always true in function bwb_ON_TIMER +bwb_cnd.c: +bwb_dio.c: +bwb_exp.c: +bwb_fnc.c: +bwb_inp.c: +Warning bwb_inp.c 2424: Unreachable code in function user_input_loop +bwb_int.c: +bwb_prn.c: +bwb_stc.c: +bwb_str.c: +bwb_tbl.c: +bwb_var.c: +bwd_cmd.c: +bwd_fun.c: +bwx_tty.c: +Turbo Link Version 5.1 Copyright (c) 1992 Borland International + + Available memory 3614708 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..86cf81a --- /dev/null +++ b/COPYING @@ -0,0 +1,341 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + diff --git a/DMCDOS32.CMD b/DMCDOS32.CMD new file mode 100644 index 0000000..36a725f --- /dev/null +++ b/DMCDOS32.CMD @@ -0,0 +1,35 @@ +@echo off +rem Filename: DMCDOS32.CMD +rem Purpose: Build Bywater BASIC for MS-DOS (32-bit) using Digital Mars Compiler Version 8.42n +rem Author: Howard Wulf, AF5NE +rem Date: 2015-01-29 +rem Uasage: implementation defined +rem Example: +rem cd \sdcard\Download\BASIC\bwbasic3\ +rem DMCDOS32.CMD +rem +rem This is the location of DMC.EXE +rem +set BINDIR=C:\DOS\dm\bin; +rem +rem Cleanup before compile +rem +DEL BW*.EXE 1> NUL 2> NUL +DEL BW*.OBJ 1> NUL 2> NUL +DEL BW*.MAP 1> NUL 2> NUL +rem +rem Compile +rem +set OLDPATH=%PATH% +set PATH=%BINDIR%;%PATH% +dmc.exe > DMCDOS32.TXT +dmc.exe -mx -A89 -oBWBASIC.EXE -DHAVE_MSDOS=1 bwbasic.c bwb_cmd.c bwb_cnd.c bwb_dio.c bwb_exp.c bwb_fnc.c bwb_inp.c bwb_int.c bwb_prn.c bwb_stc.c bwb_str.c bwb_tbl.c bwb_var.c bwd_cmd.c bwd_fun.c bwx_tty.c X32.LIB >> DMCDOS32.TXT +set PATH=%OLDPATH% +set OLDPATH= +set BINDIR= +rem +rem Cleanup after compile +rem +DEL BW*.OBJ 1> NUL 2> NUL +DEL BW*.MAP 1> NUL 2> NUL +rem EOF diff --git a/DMCDOS32.TXT b/DMCDOS32.TXT new file mode 100644 index 0000000..5acec19 --- /dev/null +++ b/DMCDOS32.TXT @@ -0,0 +1,123 @@ +Digital Mars Compiler Version 8.42n +Copyright (C) Digital Mars 2000-2004. All Rights Reserved. +Written by Walter Bright www.digitalmars.com/ctg/sc.html +DMC is a one-step program to compile and link C++, C and ASM files. +Usage ([] means optional, ... means zero or more): + + DMC file... [flags...] [@respfile] + +file... .CPP, .C or .ASM source, .OBJ object or .LIB library file name +@respfile... pick up arguments from response file or environment variable +flags... one of the following: +-a[1|2|4|8] alignment of struct members -A strict ANSI C/C++ +-Aa enable new[] and delete[] -Ab enable bool +-Ae enable exception handling -Ar enable RTTI +-B[e|f|g|j] message language: English, French, German, Japanese +-c skip the link, do compile only -cpp source files are C++ +-cod generate .cod (assembly) file -C no inline function expansion +-d generate .dep (make dependency) file +-D #define DEBUG 1 -Dmacro[=text] define macro +-e show results of preprocessor -EC do not elide comments +-EL #line directives not output -f IEEE 754 inline 8087 code +-fd work around FDIV problem -ff fast inline 8087 code +-g generate debug info +-gf disable debug info optimization -gg make static functions global +-gh symbol info for globals -gl debug line numbers only +-gp generate pointer validations -gs debug symbol info only +-gt generate trace prolog/epilog -GTnnnn set data threshold to nnnn +-H use precompiled headers (ph) -HDdirectory use ph from directory +-HF[filename] generate ph to filename -HHfilename read ph from filename +-HIfilename #include "filename" -HO include files only once +-HS only search -I directories -HX automatic precompiled headers + +-Ipath #include file search path -j[0|1|2] Asian language characters + 0: Japanese 1: Taiwanese and Chinese 2: Korean +-Jm relaxed type checking -Ju char==unsigned char +-Jb no empty base class optimization -J chars are unsigned +-l[listfile] generate list file -L using non-Digital Mars linker +-Llink specify linker to use -L/switch pass /switch to linker +-Masm specify assembler to use -M/switch pass /switch to assembler +-m[tsmclvfnrpxz][do][w][u] set memory model + s: small code and data m: large code, small data + c: small code, large data l: large code and data + v: VCM r: Rational 16 bit DOS Extender + p: Pharlap 32 bit DOS Extender x: DOSX 32 bit DOS Extender + z: ZPM 16 bit DOS Extender f: OS/2 2.0 32 bit + t: .COM file n: Windows 32s/95/98/NT/2000/ME/XP + d: DOS 16 bit o: OS/2 16 bit + w: SS != DS u: reload DS +-Nc function level linking -NL no default library +-Ns place expr strings in code seg -NS new code seg for each function +-NTname set code segment name -NV vtables in far data +-o[-+flag] run optimizer with flag -ooutput output filename +-p turn off autoprototyping -P default to pascal linkage +-Pz default to stdcall linkage -r strict prototyping +-R put switch tables in code seg -s stack overflow checking +-S always generate stack frame -u suppress predefined macros +-v[0|1|2] verbose compile -w suppress all warnings +-wc warn on C style casts +-wn suppress warning number n -wx treat warnings as errors +-W{0123ADabdefmrstuvwx-+} Windows prolog/epilog + -WA Windows EXE + -WD Windows DLL +-x turn off error maximum -XD instantiate templates +-XItemp instantiate template class temp +-XIfunc(type) instantiate template function func(type) +-[0|2|3|4|5|6] 8088/286/386/486/Pentium/P6 code + for (l = l->OtherLine; l->cmdnum != C_END_IF; l = l->OtherLine); + ^ +bwbasic.c(2440) : Warning 7: possible extraneous ';' + l = l->OtherLine); + ^ +bwbasic.c(2446) : Warning 7: possible extraneous ';' + for (x = x->OtherLine; x->cmdnum != C_END_IF; x = x->OtherLine); + ^ +bwb_cmd.c(6092) : Warning 7: possible extraneous ';' + for (x = x->OtherLine; x->cmdnum != C_END_SELECT; x = x->OtherLine); + ^ +bwb_cmd.c(6097) : Warning 7: possible extraneous ';' + for (l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine); + ^ +bwb_cnd.c(581) : Warning 7: possible extraneous ';' + for (l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine); + ^ +bwb_cnd.c(599) : Warning 7: possible extraneous ';' + for (l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine); + ^ +bwb_cnd.c(899) : Warning 7: possible extraneous ';' + for (l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine); + ^ +bwb_cnd.c(917) : Warning 7: possible extraneous ';' + for (m = 0; m < n && buff_skip_char (buffer, &q, T->Name[m]); m++); + ^ +bwb_exp.c(1881) : Warning 7: possible extraneous ';' + for (; x->cmdnum != C_DATA && x != My->EndMarker; x = x->next); + ^ +bwb_inp.c(945) : Warning 7: possible extraneous ';' + x = x->next); + ^ +bwb_stc.c(1358) : Warning 7: possible extraneous ';' + for (argn = argv; argn->next != NULL; argn = argn->next); + ^ +bwb_stc.c(1389) : Warning 7: possible extraneous ';' + while (line_skip_seperator (l)); + ^ +bwb_var.c(113) : Warning 7: possible extraneous ';' +bwbasic.c: +bwb_cmd.c: +bwb_cnd.c: +bwb_dio.c: +bwb_exp.c: +bwb_fnc.c: +bwb_inp.c: +bwb_int.c: +bwb_prn.c: +bwb_stc.c: +bwb_str.c: +bwb_tbl.c: +bwb_var.c: +bwd_cmd.c: +bwd_fun.c: +bwx_tty.c: +link cx+bwbasic+bwb_cmd+bwb_cnd+bwb_dio+bwb_exp+bwb_fnc+bwb_inp+bwb_int+bwb_prn+bwb_stc+bwb_str+bwb_tbl+bwb_var+bwd_cmd+bwd_fun+bwx_tty,BWBASIC.EXE,,X32/noi; + diff --git a/DMCWIN32.CMD b/DMCWIN32.CMD new file mode 100644 index 0000000..441e0df --- /dev/null +++ b/DMCWIN32.CMD @@ -0,0 +1,35 @@ +@echo off +rem Filename: DMCWIN32.CMD +rem Purpose: Build Bywater BASIC for MS-WINDOWS (32-bit) using Digital Mars Compiler Version 8.42n +rem Author: Howard Wulf, AF5NE +rem Date: 2015-01-29 +rem Uasage: implementation defined +rem Example: +rem cd \sdcard\Download\BASIC\bwbasic3\ +rem DMCWIN32.CMD +rem +rem This is the location of DMC.EXE +rem +set BINDIR=C:\DOS\dm\bin +rem +rem Cleanup before compile +rem +DEL BW*.EXE 1> NUL 2> NUL +DEL BW*.OBJ 1> NUL 2> NUL +DEL BW*.MAP 1> NUL 2> NUL +rem +rem Compile +rem +set OLDPATH=%PATH% +set PATH=%BINDIR%;%PATH% +dmc.exe > DMCWIN32.TXT +dmc.exe -mn -A89 -oBWBASIC.EXE -DHAVE_MSDOS=1 bwbasic.c bwb_cmd.c bwb_cnd.c bwb_dio.c bwb_exp.c bwb_fnc.c bwb_inp.c bwb_int.c bwb_prn.c bwb_stc.c bwb_str.c bwb_tbl.c bwb_var.c bwd_cmd.c bwd_fun.c bwx_tty.c >> DMCWIN32.TXT +set PATH=%OLDPATH% +set OLDPATH= +set BINDIR= +rem +rem Cleanup after compile +rem +DEL BW*.OBJ 1> NUL 2> NUL +DEL BW*.MAP 1> NUL 2> NUL +rem EOF diff --git a/DMCWIN32.TXT b/DMCWIN32.TXT new file mode 100644 index 0000000..abe607c --- /dev/null +++ b/DMCWIN32.TXT @@ -0,0 +1,132 @@ +Digital Mars Compiler Version 8.42n +Copyright (C) Digital Mars 2000-2004. All Rights Reserved. +Written by Walter Bright www.digitalmars.com/ctg/sc.html +DMC is a one-step program to compile and link C++, C and ASM files. +Usage ([] means optional, ... means zero or more): + + DMC file... [flags...] [@respfile] + +file... .CPP, .C or .ASM source, .OBJ object or .LIB library file name +@respfile... pick up arguments from response file or environment variable +flags... one of the following: +-a[1|2|4|8] alignment of struct members -A strict ANSI C/C++ +-Aa enable new[] and delete[] -Ab enable bool +-Ae enable exception handling -Ar enable RTTI +-B[e|f|g|j] message language: English, French, German, Japanese +-c skip the link, do compile only -cpp source files are C++ +-cod generate .cod (assembly) file -C no inline function expansion +-d generate .dep (make dependency) file +-D #define DEBUG 1 -Dmacro[=text] define macro +-e show results of preprocessor -EC do not elide comments +-EL #line directives not output -f IEEE 754 inline 8087 code +-fd work around FDIV problem -ff fast inline 8087 code +-g generate debug info +-gf disable debug info optimization -gg make static functions global +-gh symbol info for globals -gl debug line numbers only +-gp generate pointer validations -gs debug symbol info only +-gt generate trace prolog/epilog -GTnnnn set data threshold to nnnn +-H use precompiled headers (ph) -HDdirectory use ph from directory +-HF[filename] generate ph to filename -HHfilename read ph from filename +-HIfilename #include "filename" -HO include files only once +-HS only search -I directories -HX automatic precompiled headers + +-Ipath #include file search path -j[0|1|2] Asian language characters + 0: Japanese 1: Taiwanese and Chinese 2: Korean +-Jm relaxed type checking -Ju char==unsigned char +-Jb no empty base class optimization -J chars are unsigned +-l[listfile] generate list file -L using non-Digital Mars linker +-Llink specify linker to use -L/switch pass /switch to linker +-Masm specify assembler to use -M/switch pass /switch to assembler +-m[tsmclvfnrpxz][do][w][u] set memory model + s: small code and data m: large code, small data + c: small code, large data l: large code and data + v: VCM r: Rational 16 bit DOS Extender + p: Pharlap 32 bit DOS Extender x: DOSX 32 bit DOS Extender + z: ZPM 16 bit DOS Extender f: OS/2 2.0 32 bit + t: .COM file n: Windows 32s/95/98/NT/2000/ME/XP + d: DOS 16 bit o: OS/2 16 bit + w: SS != DS u: reload DS +-Nc function level linking -NL no default library +-Ns place expr strings in code seg -NS new code seg for each function +-NTname set code segment name -NV vtables in far data +-o[-+flag] run optimizer with flag -ooutput output filename +-p turn off autoprototyping -P default to pascal linkage +-Pz default to stdcall linkage -r strict prototyping +-R put switch tables in code seg -s stack overflow checking +-S always generate stack frame -u suppress predefined macros +-v[0|1|2] verbose compile -w suppress all warnings +-wc warn on C style casts +-wn suppress warning number n -wx treat warnings as errors +-W{0123ADabdefmrstuvwx-+} Windows prolog/epilog + -WA Windows EXE + -WD Windows DLL +-x turn off error maximum -XD instantiate templates +-XItemp instantiate template class temp +-XIfunc(type) instantiate template function func(type) +-[0|2|3|4|5|6] 8088/286/386/486/Pentium/P6 code + setjmp(My->mark); + ^ +bwbasic.c(757) : Warning 6: value of expression is not used + setjmp(My->mark); + ^ +bwbasic.c(847) : Warning 6: value of expression is not used + setjmp(My->mark); + ^ +bwbasic.c(921) : Warning 6: value of expression is not used + for( l = l->OtherLine; l->cmdnum != C_END_IF; l = l->OtherLine ); + ^ +bwbasic.c(2478) : Warning 7: possible extraneous ';' + for( l = l->OtherLine; l->cmdnum != C_END_SELECT; l = l->OtherLine ); + ^ +bwbasic.c(2483) : Warning 7: possible extraneous ';' + for( x = x->OtherLine; x->cmdnum != C_END_IF; x = x->OtherLine ); + ^ +bwb_cmd.c(6066) : Warning 7: possible extraneous ';' + for( x = x->OtherLine; x->cmdnum != C_END_SELECT; x = x->OtherLine ); + ^ +bwb_cmd.c(6071) : Warning 7: possible extraneous ';' + for( l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine ); + ^ +bwb_cnd.c(579) : Warning 7: possible extraneous ';' + for( l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine ); + ^ +bwb_cnd.c(597) : Warning 7: possible extraneous ';' + for( l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine ); + ^ +bwb_cnd.c(896) : Warning 7: possible extraneous ';' + for( l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine ); + ^ +bwb_cnd.c(914) : Warning 7: possible extraneous ';' + for( m = 0; m < n && buff_skip_char( buffer, &q, T->Name[ m ] ); m++ ); + ^ +bwb_exp.c(1729) : Warning 7: possible extraneous ';' + for( ; x->cmdnum != C_DATA && x != My->EndMarker; x = x->next ); + ^ +bwb_inp.c(930) : Warning 7: possible extraneous ';' + for( x = My->StartMarker->next; x != My->EndMarker && x->number < number; x = x->next ); + ^ +bwb_stc.c(1327) : Warning 7: possible extraneous ';' + for (argn = argv; argn->next != NULL; argn = argn->next); + ^ +bwb_stc.c(1357) : Warning 7: possible extraneous ';' + while( line_skip_seperator(l) ); + ^ +bwb_var.c(111) : Warning 7: possible extraneous ';' +bwbasic.c: +bwb_cmd.c: +bwb_cnd.c: +bwb_dio.c: +bwb_exp.c: +bwb_fnc.c: +bwb_inp.c: +bwb_int.c: +bwb_prn.c: +bwb_stc.c: +bwb_str.c: +bwb_tbl.c: +bwb_var.c: +bwd_cmd.c: +bwd_fun.c: +bwx_tty.c: +link bwbasic+bwb_cmd+bwb_cnd+bwb_dio+bwb_exp+bwb_fnc+bwb_inp+bwb_int+bwb_prn+bwb_stc+bwb_str+bwb_tbl+bwb_var+bwd_cmd+bwd_fun+bwx_tty,BWBASIC.EXE,,user32+kernel32/noi; + diff --git a/DOCS/ALL.txt b/DOCS/ALL.txt new file mode 100644 index 0000000..690d8b2 --- /dev/null +++ b/DOCS/ALL.txt @@ -0,0 +1,21021 @@ +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program; lines in filename$ + replace any matching lines in the current + program. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: APPEND # filenumber +DESCRIPTION: Positions filenumber at EOF and sets the file + to writing; filenumber <= 0 is ignored. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: AUTO [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates AUTO mode. + Regardless whether the line exists, entering + the command MAN will terminate AUTO mode. + AUTO mode is also terminated by any ERROR or + by pressing control-C. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: BACKSPACE # X +DESCRIPTION: Points the file to the previous item. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: BREAK line [, ...]] +DESCRIPTION: Diagnostic command to stop execution at the + specified line(s). BREAK only applies to + user-numbered lines. For multi-statement + lines, BREAK only applies to the first + statement. BREAK effectively inserts a + hidden STOP command immediately after the + line number. Once a BREAK occurrs on a + specified line, it is automatically removed. + To remove all existing BREAKs, execute BREAK + without any line numbers. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: BUILD [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates BUILD mode. + Regardless whether the line exists, entering + the command MAN will terminate BUILD mode. + BUILD mode is also terminated by any ERROR or + by pressing control-C. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [X] PDP-8 + [X] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CALL subname( [parameter [, ...] ] ) +DESCRIPTION: Calls a subroutine that was defined by SUB and + END SUB. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CASE constant [TO constant] +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CASE IF operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CASE IS operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CASE ELSE +DESCRIPTION: Introduces a default SELECT CASE element. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: CHANGE A$ TO X +DESCRIPTION: Changes a string to a numeric array. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CHANGE X TO A$ +DESCRIPTION: Changes a numeric array to a string. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: CLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CLOAD* arrayname +DESCRIPTION: Loads a numeric array from a file saved using + CSAVE*. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CLOSE +DESCRIPTION: Closes all files. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CLOSE filename$ [, ...] +DESCRIPTION: Closes a file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CLOSE filenumber [, ...] +DESCRIPTION: Closes a file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CLR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CMDS +DESCRIPTION: Prints a list of all implemented BASIC + commands. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CONSOLE [WIDTH width] +DESCRIPTION: Directs the output of PRINT commands to the + console (stdout), and optionally changes the + console width. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CONST variable [, ...] = value +DESCRIPTION: Assigns the value to variable. Any later + assignment to the variable causus a VARIABLE + NOT DECLARED error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: CONTINUE +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: COPY source$ TO target$ +DESCRIPTION: Copy an exisitng file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CREATE filename$ [ RECL reclen ] AS filenum + [ BUFF number ] [ RECS size ] +DESCRIPTION: Creates the file and opens it. If the file + already exists, then it is ereased. If the + file cannot be created, then an error occurs. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: CSAVE* ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by CLOAD*. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: DEC variable [,...] +DESCRIPTION: Decrement a numeric variable. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [X] PDP-8 + [X] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DEFBYT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DEFCUR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DEFLNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DEFSNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DELETE filenumber +DESCRIPTION: Closes and deletes the file OPEN as + filenumber. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DELIMIT # X, A$ +DESCRIPTION: Sets the delimiter for READ # and WRITE #. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: DISPLAY source$ +DESCRIPTION: Display an exisitng text file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DO UNTIL value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is non-zero. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DO +DESCRIPTION: Top of a DO - LOOP structure. If the loop is + not terminated by EXIT DO or LOOP UNTIL or + LOOP WHILE, then it will loop forever. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DO WHILE value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is zero. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DOS +DESCRIPTION: Exits to the operating system. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: DSP variable [, ...]] +DESCRIPTION: Diagnostic command to display the value every + time the variable is assigned. To remove all + existing DSPs, execute DSP without any + variables. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: END FUNCTION +DESCRIPTION: Specifies the last line of a multi-line + FUNCTION definition. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: END SELECT +DESCRIPTION: Specifies the last line of a multi-line SELECT + CASE definition. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: END SUB +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EXCHANGE variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EXIT +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EXIT DO +DESCRIPTION: Immediately exits the inner-most DO-LOOP + strucure. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EXIT FOR +DESCRIPTION: Immediately exits the inner-most FOR-NEXT + strucure. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EXIT FUNCTION +DESCRIPTION: Immediately exits the inner-most multi-line + FUNCTION strucure. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EXIT REPEAT +DESCRIPTION: Exit a REPEAT - UNTIL structure. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EXIT SUB +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: EXIT WHILE +DESCRIPTION: Immediately exits the inner-most WHILE-END + strucure. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: FEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: FILE filename$ [( reclen )] +DESCRIPTION: Opens the file in READ mode. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: FILE # X, A$ +DESCRIPTION: If A$ is "*" then closes file # X. If A$ is + not "*" then opens the file named A$ in READ + mode. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: FILES A$[, ...] +DESCRIPTION: If A$ is not "*" opens the file named A$ in + READ mode. The first filename of the first + FILES command is assocated with file number + 1. Note that multiple FILES commands + accumulate. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: FLEX +DESCRIPTION: Exits to the operating system. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: FNCS +DESCRIPTION: Prints a list of all pre-defined BASIC + functions. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [X] PDP-8 + [X] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: FUNCTION [ ( parameter [, ... ] ) ] +DESCRIPTION: Top line of a multi-line FUNCTION definition. + The variable names specified are local to the + FUNCTION definition, and are initialized + BYVAL when the function is invoked by another + routine. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: GET # file_number , [ byte_number ] , scalar + [,...] +DESCRIPTION: Gets one (or more) values from a BINARY file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: GET # file_number [ , RECORD record_number ] +DESCRIPTION: Gets one (or more) values from a file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: GET # file_number [ , RECORD record_number ] +DESCRIPTION: Gets one (or more) values from a file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: GET filename$ , scalar [, ...] +DESCRIPTION: Gets one (or more) values from a file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: GET # file_number [ , record_number ] +DESCRIPTION: Gets one (or more) values from a RANDOM file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: GOODBYE +DESCRIPTION: Exits to the operating system. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: HELP name +DESCRIPTION: Provides help on the specified name which is a + command name or function name. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: IF END # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is at EOF , then branch to line1. If the + file is not at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: IF MORE # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is not at EOF , then branch to line1. If the + file is at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: IMAGE "format string" +DESCRIPTION: Provides format string for PRINT USING + linenum. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: INC variable [,...] +DESCRIPTION: Increment a numeric variable. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: INPUT LINE variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: INPUT LINE # filenum , variable$ +DESCRIPTION: Reads entire line from a file into variable$. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: INPUT LINE "prompt string" , variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$ after displaying a prompt + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LLIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the printer on stderr. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: LOCAL [# filenum,] variable([ lower TO ] + upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. Only supported inside a FUNCTION or + SUB. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LOOP UNTIL value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is nonz-zero. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LOOP WHILE value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is zero. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LOOP +DESCRIPTION: Bottom of a DO - LOOP structure. If the loop + is not terminated by EXIT DO or DO UNTIL or + DO WHILE, then it will loop forever. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LPRINTER [WIDTH width] +DESCRIPTION: Directs the output of PRINT commands to the + printer (stderr), and optionally changes the + printer width. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LPT [filename$] +DESCRIPTION: Directs the PRINT commands to write to the + printer (stderr), or optionally to the + specified file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: MARGIN # filenumber, width +DESCRIPTION: Sets the file margin for writing; filenumber + <= 0 is ignored. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MAT GET filename$, arrayname +DESCRIPTION: Matrix get. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MAT PUT filename$, arrayname +DESCRIPTION: Matrix put. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MAT WRITE arrayname +DESCRIPTION: Matrix write. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MERGE filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program. Lines in filename$ + replace any matching lines in the current + program. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: MON +DESCRIPTION: Exits to the operating system. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: NAME old$ AS new$ +DESCRIPTION: Changes the name of an existing file. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [X] PDP-8 + [X] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: ON ERROR GOSUB errline +DESCRIPTION: When a trappable error occurs, execute GOSUB + errline. The error handler must terminate + with a RETURN command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOSUB. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOTO. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: ON ERROR RETURN +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: ON ERROR RETURN NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOSUB. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: ON TIMER count GOSUB line +DESCRIPTION: Specifies a line (or label) to gosub when + count seconds have elaspsed after TIMER ON is + executed. The interrupt routine should end + with a RETURN command. Timer events only + occur in running BASIC programs. The + resolution of the clock is implementation + defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: OPEN NEW|OLD|VIRTUAL filename$ + AS filenumber +DESCRIPTION: Opens a file for use. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS [#] fileenumber + [LEN [=] record-length] +DESCRIPTION: Opens a file for use. + RANDOM requires LEN. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS FILE filenumber + [ ,RECORDSIZE ignored ] + [ ,CLUSTERSIZE ignored ] + [ ,MODE ignored ] +DESCRIPTION: Opens a file for use. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: OPEN filename + FOR READ|WRITE|VIRTUAL + AS FILE filenumber +DESCRIPTION: Opens a file for use. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: OPEN filename$ + [ RECL reclen ] + AS filenumber + [ BUFF ignored ] + [ RECS ignored ] +DESCRIPTION: Opens a file for use. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: OPEN filenumber, + filename$, + INPUT|OUTPUT|APPEND|VIRTUAL +DESCRIPTION: Opens a file for use. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: PAUSE [comment] +DESCRIPTION: Pauses processing until the ENTER key is + presseed. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: PDEL line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: POP +DESCRIPTION: Pops one GOSUB from the return stack. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: PTP [filename$] +DESCRIPTION: Directs the PRINT commands to write to the + paper tape punch file ("PTP"), or optionally + to the specified file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: PTR [filename$] +DESCRIPTION: Directs the INPUT commands to read from the + paper tape reader file ("PTR"), or optionally + from the specified file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: PUT # file_number , [ byte_number ] , scalar + [,...] +DESCRIPTION: Puts one (or more) values into a BINARY file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: PUT filename$ , value [, ...] +DESCRIPTION: Puts one (or more) values into a file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: PUT # file_number [ , RECORD record_number ] +DESCRIPTION: Puts one (or more) values into a file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: PUT # file_number [ , record_number ] +DESCRIPTION: Puts one (or more) values into a RANDOM file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RECALL ArrayName +DESCRIPTION: Loads a numeric array from a file saved using + STORE. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RENAME from$ TO to$ +DESCRIPTION: Rename a file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: RENAME [filename$] +DESCRIPTION: Changes the file name which will be used by + SAVE. Does not save the file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RENUMBER +DESCRIPTION: Implementation defined. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: REPEAT +DESCRIPTION: Top of a REPEAT - UNTIL structure. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: REPLACE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: RESET filename$ [, ...] +DESCRIPTION: Positions an input or output file to the + bcginning. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: SCRATCH [# X] +DESCRIPTION: SCRATCH Deletes the program in memory and + clears all variables. SCRATCH # X Sets the + file mode to writing. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SELECT +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SELECT CASE value +DESCRIPTION: Introduces a multi-line conditional selection + statement. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: STORE ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by RECALL. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SUB name [ ( parameter [,...] ) ] +DESCRIPTION: Top line of a multi-line SUB definition. The + variable names specified are local to the SUB + definition, and are initialized BYVAL when + the subroutine is invoked by another routine. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SUB END +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. Same as END SUB. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SUB EXIT +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. Same as EXIT SUB. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SUBEND +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. Same as END SUB. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SUBEXIT +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. Same as EXIT SUB. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TEXT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: TIMER +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TIMER OFF +DESCRIPTION: TIMER OFF terminates the timer interrupt. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TIMER ON +DESCRIPTION: TIMER ON enables the timer interrupt. When + the specified seconds have elapsed, TIMER + STOP is internaly executed before the + interrupt is taken. TIMER ON should be + executed just before the RETURN command if + you want the interrupt to occur again. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TIMER STOP +DESCRIPTION: TIMER STOP disables the interrupt, but the + count continues. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: TRACE +DESCRIPTION: Enables tracing. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TRACE OFF +DESCRIPTION: Disables tracing. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TRACE ON +DESCRIPTION: Enables tracing. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TTY +DESCRIPTION: Directs the PRINT commands to write to the + console (stdout), and the INPUT commands to + read from.the console (stdin). This cancels + LPT, PTP and PTR. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TTY IN +DESCRIPTION: Directs the INPUT commands to read from.the + console (stdin). This cancels PTR. It does + not cancel LPT or PTP. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: TTY OUT +DESCRIPTION: Directs the PRINT commands to write to the + console (stdout). This cancels LPT or PTP. + It does not cancel PTR. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: UNTIL value +DESCRIPTION: Bottom of a REPEAT - UNTIL. If the value is + non-zero, then the loop is terminated. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: USE parameter$ +DESCRIPTION: Receives the value from the calling CHAINing + program. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: VARS +DESCRIPTION: Prints a list of all global variables. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = ACOS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACOS(X) <= PI. X shall be in the range -1 <= + X <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ACS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACS(X) <= PI. X shall be in the range -1 <= + X <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ACSD( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in degrees, where 0 <= + ACSD(X) <= 180. X shall be in the range -1 + <= X <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ACSG( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in gradians, where 0 <= + ACS(X) <= 200. X shall be in the range -1 <= + X <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ANGLE( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The angle in radians between the positive + x-axis and the vector joining the origin to + the point with coordinates (X, Y), where -PI + < ANGLE(X,Y) <= PI. X and Y must not both be + 0. Note that the counterclockwise is + positive, e.g., ANGLE(1,1) = 45 degrees. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ARCCOS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ARCCOS(X) <= PI. X shall be in the range -1 + <= X <= 1. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = ARCSIN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ARCSIN(X) <= PI/2; X shall be in the range -1 + <= X <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = ARCTAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ARCTAN(X) < + PI/2. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = ARGC +DESCRIPTION: The number of parameters passed to a FUNCTION + or SUB. If not in a FUNCTION or SUB, returns + -1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = ARGT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The type of the Xth parameter to a FUNCTION or + SUB. If the Xth parameter is a string, then + return value is "$". If the Xth parameter is + a number, then return value is not "$". X in + [1,ARGC]. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ARGV( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The numeric value of the Xth parameter to a + FUNCTION or SUB. X in [1,ARGC] and ARGT$( X + ) <> "$". + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = ARGV$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The string value of the Xth parameter to a + FUNCTION or SUB. X in [1,ARGC] and ARGT$( X + ) = "$". + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = ASC( A$, X ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The numeric code of the Xth character in A$. + Same as ASC(MID$(A$,X)). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ASCII( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASCII("ABC") returns 65 on ASCII + systems. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ASIN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASIN(X) <= PI/2; X shall be in the range -1 + <= X <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ASN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASN(X) <= PI/2; X shall be in the range -1 <= + X <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ASND( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in degrees, where -90 <= + ASN(X) <= 90; X shall be in the range -1 <= X + <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ASNG( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in gradians, where -100 <= + ASNG(X) <= 100; X shall be in the range -1 <= + X <= 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ATAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATAN(X) < + PI/2. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = ATND( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in degrees, i.e. the angle + whose tangent is X, where -90 < ATND(X) < 90. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ATNG( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in gradians, i.e. the + angle whose tangent is X, where -100 < + ATND(X) < 100. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = BASE +DESCRIPTION: The current OPTION BASE setting. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = BIN$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the binary (base 2) representation of X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = BIN$( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The the binary (base 2) representation of X. + The result will be at least Y digits long. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CATALOG +DESCRIPTION: Displays all the file names. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CATALOG( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CCUR( X ) + PARAMETER: X is a number, [MINCUR,MAXCUR] +DESCRIPTION: The currency (64-bit) integer value of X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CDBL( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The double-precision value of X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CEIL( X ) + PARAMETER: X is a number +DESCRIPTION: The smallest integer not less than X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = CHAR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The string Y bytes long consisting of CHR$(X). + Same as STRING$(Y,X). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = CHAR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHAR$(65) returns "A". + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CHDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Changes to the directory named to A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = CHR( X ) + PARAMETER: X is a number +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR(65) returns "A". + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = CHR( X ) + PARAMETER: X is a number +DESCRIPTION: The output of PRINT X. A$ = CHR(X) is the + opposite of X = NUM(A$). + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = CIN( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If file # X is <= 0 then returns -1. If file + # X is not opened for reading then returns + -1. If file # X is at EOF then returns -1, + Otherwise returns the next byte value read + from file X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CLG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CLK( X ) + PARAMETER: X is a number +DESCRIPTION: The time elapsed since the previous midnight, + expressed in hours; e.g., the value of CLK at + 3:15 PM is 15.25. If there is no clock + available, then the value of CLK shall be -1. + The value of CLK at midnight shall be zero + (not 24). The value of X is ignored. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = CLK( X ) + PARAMETER: X is a number +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of CLK + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of CLK shall + be "99:99:99". The value of TIME$ at + midnight is "00:00:00". The value of + parameter X is ignored. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = CLK$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CLNG( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The long (32-bit) integer value of X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CLOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CLOSE +DESCRIPTION: Close all open files. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = CLS +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CNTRL( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: CNTRL 1,Y sets the number of significant + digits to print. CNTRL 3,Y sets the width of + the print zones. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CODE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, CODE("ABC") returns 65 on ASCII + systems. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = COLOR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sets the foreground text color to X, and the + background text color to Y. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = COMMAND$ +DESCRIPTION: All command line parameters, concatenated with + one space between each. Support for + parameters varies by operating system, + compiler, and so on. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = COMMAND$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The command line parameters. COMMAND$(0) is + the BASIC program name. COMMAND$(1) is the + first parameter after the BASIC program name, + and so on. Support for parameters varies by + operating system, compiler, and so on. X in + [0..9] + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = COSD( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in degrees. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = COSG( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in gradians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = COSH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = COT( X ) + PARAMETER: X is a number +DESCRIPTION: The cotangent of X, where X is in radians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = COUNT +DESCRIPTION: The current cursor position in the line. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CSC( X ) + PARAMETER: X is a number +DESCRIPTION: The cosecant of X, where X is in radians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CSH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CSNG( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The single-precision value of X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = CUR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CVC( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(CUR) +DESCRIPTION: The currency (64-bit) integer value in A$, + which was created by MKC$. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = CVL( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(LNG) +DESCRIPTION: The long (32-bit) integer value in A$, which + was created by MKL$. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = DAT$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DATE +DESCRIPTION: The current date in decimal form YYYDDD, where + YYY are the number of years since 1900 and + DDD is the ordinal number of the current day + of the year; e.g., the value of DATE on May + 9, 1977 was 77129. If there is no calendar + available, then the value of DATE shall be + -1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = DATE$( X ) + PARAMETER: X is a number +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. + The value of parameter X is ignored. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DEG +DESCRIPTION: Configures the math functions to accept and + return angles in degrees. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: When X is zero sets RADIANS. When X is + non-zero sets DEGREES. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DEGREE +DESCRIPTION: Configures the math functions to accept and + return angles in degrees. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DEGREE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DIGITS( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: X is the number of significiant digits to + print for numbers (0..17). If X = 0 then + disabled. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = DIGITS( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: X is the number of significiant digits to + print for numbers (0..17). If X = 0 then + disabled. Y is the number of decimal places + to round (0..17). If Y = 0 then disabled. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = DIM( ... ) +DESCRIPTION: DIM( arrayname ). The total number of + dimensions of the array. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = DPEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. Causes + ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = DPOKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = EDIT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Edits the characters of A$, according to the + bits set in X. + 1 = discard parity bit. + 2 = discard all spaces. + 4 = discard all carriage returns, line feeds, + form feeds, deletes, escapes and nulls. + 8 = discard leading spaces. + 16 = replace multiple spaces with one space. + 32 = change lower case to upper case. + 64 = change [ to ( and change ] to ). + 128 = discard trailing spacess. + 256 = suppress editing within quotes. + The order in which edits occur is + implementation defined. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ENVIRON( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Sends the environment variable expression + contained in A$ to the host operating system. + A$ must contain the "=" character. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = ENVIRON$( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the environment variable named + A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = EOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If device number X is at the end-of-file, then + -1, otherwise 0. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = EPS( X ) + PARAMETER: X is a number +DESCRIPTION: The maximum of (X-X1,X2-X, sigma) where X1 and + X2 are the predecessor and successor of X and + signma is the smallest positive value + representable. If X has no predecessor the + X1=X and if X has no successor the X2=X. + Note EPS(0) is the smallest positive number + representable by the implementation, and is + therefor implementation-defined. Note also + that EPS may produce different results for + different arithmetic options (see OPTION + ARITHMETIC). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = ERR$ +DESCRIPTION: The last error message. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ERRL +DESCRIPTION: The line number of the most recent error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ERRN +DESCRIPTION: The error number of the most recent error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ERROR( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Simulate the error number in X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ERROR( X, A$ ) + PARAMETER: X is a number, [0,255] + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: Simulate the error number in X, with a custom + message in A$. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = ERROR$ +DESCRIPTION: The last error message. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = EXAM( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = EXEC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = EXF( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [X] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = FALSE +DESCRIPTION: The value of FALSE. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FETCH( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FILEATTR( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, if Y = 1 then returns open mode, + otherwise returns zero. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FILES +DESCRIPTION: Displays all the file names. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FILES( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FILL( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FLOAT( X ) + PARAMETER: X is a number +DESCRIPTION: The rounded integer valuet of X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FLOW +DESCRIPTION: Turn tracing ON + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FP( X ) + PARAMETER: X is a number +DESCRIPTION: The fractional part of X, i.e. X - IP(X). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FRAC( X ) + PARAMETER: X is a number +DESCRIPTION: The fractional part of X, i.e. X - IP(X). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = FREE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FREE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FREE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = FREEFILE +DESCRIPTION: The next available file number. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets the next available record. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number +DESCRIPTION: Get character code from input. The value of X + is ignored. Similar to ASC(INKEY$). + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = GET( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets record number Y. The first + record number is 1. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = GRAD +DESCRIPTION: Configures the math functions to accept and + return angles in gradians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = GRADIAN +DESCRIPTION: Configures the math functions to accept and + return angles in gradians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = HCS( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = HEX( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric value of the hexadecimal string in + A$. For example, HEX("FFFF") returns 65535. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. The result will be at least Y digits + long. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = HOME +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = HSN( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = HTN( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic tangent of X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = INCH$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = INDEX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = INITIALIZE +DESCRIPTION: This function is provided for backward + compatibility only and it always returns a + fixed value of 0. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X characters, read from the + terminal. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The string of X characters, read from file Y. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = INT%( X ) + PARAMETER: X is a number +DESCRIPTION: The rounded integer valuet of X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = IP( X ) + PARAMETER: X is a number +DESCRIPTION: The integer part of X, i.e., + SGN(X)*INT(ABS(X)). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = KEY +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = KEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = LBOUND( ... ) +DESCRIPTION: LBOUND( arrayname [, dimension] ). The lower + bound of the array. The dimension defaults + to 1. dimension in [1,DIM(arrayname)] + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = LCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = LEFT( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = LGT( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = LIN( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string X bytes long of newline characters. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LN( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LNO( X ) + PARAMETER: X is a number +DESCRIPTION: Returns X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LOCATE( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LOCK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Lock file number X. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = LOG10( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LOG2( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The base 2 logarithm of X; X shall be greater + than zero. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LOGE( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = LOWER$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LPOS +DESCRIPTION: The current cursor position in the line for + the printer. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = LTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + leading space characters. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LTW( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The base 2 logarithm of X; X shall be greater + than zero. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = LWIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For printer, sets the line width to X. Zero + means no wrapping will occur. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MATCH( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MAX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The larger of the parameters. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXBYT +DESCRIPTION: The largest finite positive number + representable as a BYTE; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXCUR +DESCRIPTION: The largest finite positive number + representable as a CURRENCY; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXDBL +DESCRIPTION: The largest finite positive number + representable as a DOUBLE; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXDEV +DESCRIPTION: The largest finite positive number useable as + a FILE NUMBER; implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXINT +DESCRIPTION: The largest finite positive number + representable as an INTEGER; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXLEN +DESCRIPTION: The maximum string length. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXLEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The maximum length associated with the + simple-string-variable A$. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXLNG +DESCRIPTION: The largest finite positive number + representable as a LONG; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXLVL +DESCRIPTION: The maximum stack level; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXNUM +DESCRIPTION: The largest finite positive number + representable and manipulable by the + implementation; implementation-defined. + MAXNUM may represent diffent number for + different arithmetic options (see OPTION + ARITHMETIC). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MAXSNG +DESCRIPTION: The largest finite positive number + representable as a SINGLE; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MEM +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MID( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MID( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MIN( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The smaller of the parameters. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MINBYT +DESCRIPTION: The largest finite negative number + representable as a BYTE; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MINCUR +DESCRIPTION: The largest finite negative number + representable as a CURRENCY; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MINDBL +DESCRIPTION: The largest finite negative number + representable as a DOUBLE; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MINDEV +DESCRIPTION: The largest finite negative number useable as + a FILE NUMBER; implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MININT +DESCRIPTION: The largest finite negative number + representable as an INTEGER; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MINLNG +DESCRIPTION: The largest finite negative number + representable as a LONG; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MINNUM +DESCRIPTION: The largest finite negative number + representable and manipulable by the + implementation; implementation-defined. + MINNUM may represent diffent number for + different arithmetic options (see OPTION + ARITHMETIC). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = MINSNG +DESCRIPTION: The largest finite negative number + representable as a SINGLE; + implementation-defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MKC$( X ) + PARAMETER: X is a number, [MINCUR,MAXCUR] +DESCRIPTION: The internal representation of the currency + (64-bit) integer X as a string. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = MKDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Makes the directory named in A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MKL$( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The internal representation of the long + (32-bit) integer X as a string. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = MOD( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, <> 0 +DESCRIPTION: X modulo Y, i.e., X-Y*INT(X/Y). Y shall not + equal zero. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = NAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename the file named A$ into B$. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = NAME( ... ) +DESCRIPTION: Returns hardware address of variable. Causes + ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = NOFLOW +DESCRIPTION: Turn tracing OFF + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = NOTRACE +DESCRIPTION: Turn tracing OFF + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = NULL( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Appends X null characters after each line + printed by LPRINT or LLIST. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = NUM +DESCRIPTION: The number of values processed by the last MAT + INPUT. Zero means error. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = NUM( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, NUM( " 123.5 " ) = 123.5, NUM( + "2.E-99" ) could be zero, and NUM( "MCMXVII" + ) causes an exception. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the octal (base 8) representation of X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The the octal (base 8) representation of X. + The result will be at least Y digits long. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Default the + record length. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$, Y ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Y is the + record length. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ORD( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The ordinal position of the character named by + the string associated with A$ in the + collating sequence of ASCII character set, + where the first member of the character set + is in position zero. The acceptable values + for the standard character set are shown in + Table 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PAD( X ) + PARAMETER: X is a number +DESCRIPTION: Returns zero. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PAUSE( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then PAUSE + does nothing. The resolution is + implementation defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PDL( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = PI +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PI( X ) + PARAMETER: X is a number +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter, + times X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PIN( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the first character of + A$. If there is not such occurence, then the + value returned is zero. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PRECISION( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: X is the number of decimal places to round + (0..17). If X = 0 then disabled. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PTR( ... ) +DESCRIPTION: Returns hardware address of variable. Causes + ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Send character code to output. Returns the + value of X. Similar to PRINT CHR$(X). + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts the next available record. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = PUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts record number Y. The first + record number is 1. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RAD +DESCRIPTION: Configures the math functions to accept and + return angles in radians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RAD( X ) + PARAMETER: X is a number +DESCRIPTION: The number of radians in X degrees. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RADIAN +DESCRIPTION: Configures the math functions to accept and + return angles in radians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RAN +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RAN( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RANDOM +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RANDOM( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = REMAINDER( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, <> 0 +DESCRIPTION: The remainder function, i.e., X-Y*IP(X/Y). Y + shall not equal zero. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RENAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename file A$ to B$. If successful, the + returns -1 else returns 0. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string consisting of X copies of + LEFT$(A$,1); X > 0. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string consisting of X copies of CHR$(Y); + X > 0. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RESET +DESCRIPTION: Close all open files. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RESIDUE +DESCRIPTION: The residue of the last Integer Divide + operation. The RESIDUE of -17 / 5 is -2. + For X / Y, RESIDUE = CINT( X - Y * CINT( X / + Y ) ). + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = RIGHT( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = RMDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the directory named in A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = ROUND( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The value of X rounded to Y decimal digits to + the right of the decimal point (or -Y digits + to the left if Y < 0); i.e., + INT(X*10^Y+.5)/10^Y. Y must be in [-32,32]. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = RTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + trailing space characters. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SCALE( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: X is the number of decimal places to round + (0..17). If X = 0 then disabled. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = SEC( X ) + PARAMETER: X is a number +DESCRIPTION: The secant of X, where X is in radians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SEEK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SEEK( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, move to record number Y; the first + record number is 1. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SEG( X ) + PARAMETER: X is a number +DESCRIPTION: Returns zero. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = SEG( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = SEG$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = SHELL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = SIND( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in degrees. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SING( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in gradians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SINH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SIZE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The total number of 1KB blockes required to + contain the file. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SIZE( ... ) +DESCRIPTION: SIZE( arrayname ). The total number of items + in the array. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SLEEP( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then SLEEP + does nothing. The resolution is + implementation defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = SNH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = SPA( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = SPACE( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = SQRT( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = STR( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = STRING( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = STRIP$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: Return the string with the eighth bit of each + character cleared. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = STUFF( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = TAND( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in degrees. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TANG( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in gradians. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TANH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic tangent of X. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TI +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = TI$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TIM +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [X] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TIM( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: If X is 0, returns minutes in current hour. + If X is 1, returns hours in current day. If + X is 2, returns days in current year. If X + is 3, returns years since 1900. Any other + value for X is an ERROR. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TIME +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TIME( X ) + PARAMETER: X is a number +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). The value of the parameter + X is ignored. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = TIME$( X ) + PARAMETER: X is a number +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". The value of X is + ignored. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TIMER +DESCRIPTION: The time in the system clock in seconds + elapsed since midnight. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TOP +DESCRIPTION: The address of the top of available memory. + This function is provided for backward + compatibility only and it always returns a + fixed value of 32000. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TRACE +DESCRIPTION: Turn tracing ON + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TRACE( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: When X is zero turn tracing off. When X is + non-zero turn tracing ON + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = TRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string resulting from removing both + leading and trailing spaces from A$. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = TRUE +DESCRIPTION: The value of TRUE. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = TRUNCATE( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The value of X truncated to Y decimal digits + to the right of the decimal point (or -Y + digits to the left if Y < 0); i.e., + IP(X*10^Y)/10^Y. Y in [-32,32]. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = UBOUND( ... ) +DESCRIPTION: UBOUND( arrayname [, dimension] ). The upper + bound of the array. The dimension defaults + to 1. dimension in [1,DIM(arrayname)] + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = UCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = UNLOCK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Unlock file number X. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = UNSAVE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: S$ = UPPER$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR0( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR1( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR2( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR3( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR4( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR5( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR6( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR7( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR8( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = USR9( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = UUF( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [X] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: N = VARPTR( ... ) +DESCRIPTION: Returns hardware address of variable. Causes + ERROR 73. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = VTAB( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Savme as LOCATE X, 1. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = WAIT( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then WAIT does + nothing. The resolution is implementation + defined. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Waits for the value of (INP(X) AND Y) to + become nonzero. Causes ERROR 73. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y, Z ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] + PARAMETER: Z is a number, [0,255] +DESCRIPTION: Waits for the value of ((INP(X) XOR Z) AND Y) + to become nonzero. Causes ERROR 73. + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = WIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For console, sets the line width to X. Zero + means no wrapping will occur. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ZONE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Sets the width of the print zones. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: N = ZONE( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: X is ignored. Y sets the width of the print + zones. + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [_] ECMA-116 + [X] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [_] MBASIC + [X] PDP-8 + [X] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: X [ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [_] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X & Y +DESCRIPTION: Concatenation + PRECEDENCE: 8 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [X] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [X] PDP-8 + [X] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: A$ LIKE B$ +DESCRIPTION: Compare A$ to the pattern in B$ + PRECEDENCE: 7 + VERSIONS: + [X] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [X] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [X] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [X] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [X] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [X] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [X] XBASIC +------------------------------------------------------------ + SYNTAX: X XRA Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 + VERSIONS: + [_] BYWATER + [_] BYWATER-2 + [_] CALL/360 + [_] CBASIC-II + [_] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [_] GCOS + [_] HAARDT + [_] HANDBOOK1 + [X] HANDBOOK2 + [_] HEATH + [_] MARK-I + [_] MARK-II + [_] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [_] RSTS-11 + [_] SYSTEM/360 + [_] SYSTEM/370 + [_] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 + VERSIONS: + [X] BYWATER + [X] BYWATER-2 + [X] CALL/360 + [X] CBASIC-II + [X] DARTMOUTH + [_] ECMA-55 + [_] ECMA-116 + [X] GCOS + [X] HAARDT + [_] HANDBOOK1 + [_] HANDBOOK2 + [_] HEATH + [X] MARK-I + [X] MARK-II + [X] MBASIC + [_] PDP-8 + [_] PDP-11 + [_] RBASIC + [X] RSTS-11 + [X] SYSTEM/360 + [X] SYSTEM/370 + [X] TRS-80 + [_] VINTAGE + [_] XBASIC +------------------------------------------------------------ + + diff --git a/DOCS/BYWATER-2.txt b/DOCS/BYWATER-2.txt new file mode 100644 index 0000000..37e97c1 --- /dev/null +++ b/DOCS/BYWATER-2.txt @@ -0,0 +1,1391 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "BYWATER-2" +REM INTERNAL ID: B93 +REM DESCRIPTION: Bywater BASIC 2 +REM REFERENCE: Bywater BASIC Interpreter, version 2.61 +REM by Ted A. Campbell, Jon B. Volkoff, Paul Edwards, et al. +REM Copyright (c) 1993-2014, Ted A. Campbell +REM http://wwww.sourceforge.net/bwbasic/ +REM bwbasic-2.61.zip +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS ON +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOSUB +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%Y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: CALL subname( [parameter [, ...] ] ) +DESCRIPTION: Calls a subroutine that was defined by SUB and + END SUB. +------------------------------------------------------------ + SYNTAX: CASE constant [TO constant] +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE IF operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE IS operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE ELSE +DESCRIPTION: Introduces a default SELECT CASE element. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CMDS +DESCRIPTION: Prints a list of all implemented BASIC + commands. +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: DO UNTIL value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is non-zero. +------------------------------------------------------------ + SYNTAX: DO +DESCRIPTION: Top of a DO - LOOP structure. If the loop is + not terminated by EXIT DO or LOOP UNTIL or + LOOP WHILE, then it will loop forever. +------------------------------------------------------------ + SYNTAX: DO WHILE value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is zero. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END FUNCTION +DESCRIPTION: Specifies the last line of a multi-line + FUNCTION definition. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: END SELECT +DESCRIPTION: Specifies the last line of a multi-line SELECT + CASE definition. +------------------------------------------------------------ + SYNTAX: END SUB +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. +------------------------------------------------------------ + SYNTAX: EXIT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: EXIT DO +DESCRIPTION: Immediately exits the inner-most DO-LOOP + strucure. +------------------------------------------------------------ + SYNTAX: EXIT FOR +DESCRIPTION: Immediately exits the inner-most FOR-NEXT + strucure. +------------------------------------------------------------ + SYNTAX: EXIT FUNCTION +DESCRIPTION: Immediately exits the inner-most multi-line + FUNCTION strucure. +------------------------------------------------------------ + SYNTAX: EXIT SUB +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. +------------------------------------------------------------ + SYNTAX: EXIT WHILE +DESCRIPTION: Immediately exits the inner-most WHILE-END + strucure. +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. +------------------------------------------------------------ + SYNTAX: FNCS +DESCRIPTION: Prints a list of all pre-defined BASIC + functions. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: FUNCTION [ ( parameter [, ... ] ) ] +DESCRIPTION: Top line of a multi-line FUNCTION definition. + The variable names specified are local to the + FUNCTION definition, and are initialized + BYVAL when the function is invoked by another + routine. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LOOP UNTIL value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is nonz-zero. +------------------------------------------------------------ + SYNTAX: LOOP WHILE value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is zero. +------------------------------------------------------------ + SYNTAX: LOOP +DESCRIPTION: Bottom of a DO - LOOP structure. If the loop + is not terminated by EXIT DO or DO UNTIL or + DO WHILE, then it will loop forever. +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MERGE filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program. Lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. +------------------------------------------------------------ + SYNTAX: NAME old$ AS new$ +DESCRIPTION: Changes the name of an existing file. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOSUB errline +DESCRIPTION: When a trappable error occurs, execute GOSUB + errline. The error handler must terminate + with a RETURN command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOSUB. +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS [#] fileenumber + [LEN [=] record-length] +DESCRIPTION: Opens a file for use. + RANDOM requires LEN. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SELECT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: SELECT CASE value +DESCRIPTION: Introduces a multi-line conditional selection + statement. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SUB name [ ( parameter [,...] ) ] +DESCRIPTION: Top line of a multi-line SUB definition. The + variable names specified are local to the SUB + definition, and are initialized BYVAL when + the subroutine is invoked by another routine. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: VARS +DESCRIPTION: Prints a list of all global variables. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CHDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Changes to the directory named to A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLOSE +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = CLS +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSNG( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The single-precision value of X. +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = ENVIRON( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Sends the environment variable expression + contained in A$ to the host operating system. + A$ must contain the "=" character. +------------------------------------------------------------ + SYNTAX: S$ = ENVIRON$( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the environment variable named + A$. +------------------------------------------------------------ + SYNTAX: N = EOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If device number X is at the end-of-file, then + -1, otherwise 0. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERROR( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Simulate the error number in X. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FILES +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = FILES( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets the next available record. +------------------------------------------------------------ + SYNTAX: N = GET( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOCATE( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = MKDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Makes the directory named in A$. +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the octal (base 8) representation of X. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Default the + record length. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$, Y ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Y is the + record length. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts the next available record. +------------------------------------------------------------ + SYNTAX: N = PUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RMDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the directory named in A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = TIMER +DESCRIPTION: The time in the system clock in seconds + elapsed since midnight. +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For console, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X & Y +DESCRIPTION: Concatenation + PRECEDENCE: 8 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/BYWATER.txt b/DOCS/BYWATER.txt new file mode 100644 index 0000000..dc126a3 --- /dev/null +++ b/DOCS/BYWATER.txt @@ -0,0 +1,2538 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "BYWATER" +REM INTERNAL ID: B15 +REM DESCRIPTION: Bywater BASIC 3 +REM REFERENCE: Bywater BASIC Interpreter, version 3.20 +REM by Ted A. Campbell, Jon B. Volkoff, Paul Edwards, et al. +REM (c) 2014-2017, Howard Wulf, AF5NE +REM http://wwww.sourceforge.net/bwbasic/ +REM bwbasic-3.20.zip +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS ON +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE ON +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%Y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY "@" +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE "~" +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT "@" +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program; lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: AUTO [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates AUTO mode. + Regardless whether the line exists, entering + the command MAN will terminate AUTO mode. + AUTO mode is also terminated by any ERROR or + by pressing control-C. +------------------------------------------------------------ + SYNTAX: BREAK line [, ...]] +DESCRIPTION: Diagnostic command to stop execution at the + specified line(s). BREAK only applies to + user-numbered lines. For multi-statement + lines, BREAK only applies to the first + statement. BREAK effectively inserts a + hidden STOP command immediately after the + line number. Once a BREAK occurrs on a + specified line, it is automatically removed. + To remove all existing BREAKs, execute BREAK + without any line numbers. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CALL subname( [parameter [, ...] ] ) +DESCRIPTION: Calls a subroutine that was defined by SUB and + END SUB. +------------------------------------------------------------ + SYNTAX: CASE constant [TO constant] +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE IF operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE IS operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE ELSE +DESCRIPTION: Introduces a default SELECT CASE element. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CHANGE A$ TO X +DESCRIPTION: Changes a string to a numeric array. +------------------------------------------------------------ + SYNTAX: CHANGE X TO A$ +DESCRIPTION: Changes a numeric array to a string. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: CLOAD* arrayname +DESCRIPTION: Loads a numeric array from a file saved using + CSAVE*. +------------------------------------------------------------ + SYNTAX: CMDS +DESCRIPTION: Prints a list of all implemented BASIC + commands. +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. +------------------------------------------------------------ + SYNTAX: CONST variable [, ...] = value +DESCRIPTION: Assigns the value to variable. Any later + assignment to the variable causus a VARIABLE + NOT DECLARED error. +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: CSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: CSAVE* ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by CLOAD*. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DEFBYT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFCUR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFLNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: DO UNTIL value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is non-zero. +------------------------------------------------------------ + SYNTAX: DO +DESCRIPTION: Top of a DO - LOOP structure. If the loop is + not terminated by EXIT DO or LOOP UNTIL or + LOOP WHILE, then it will loop forever. +------------------------------------------------------------ + SYNTAX: DO WHILE value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is zero. +------------------------------------------------------------ + SYNTAX: DSP variable [, ...]] +DESCRIPTION: Diagnostic command to display the value every + time the variable is assigned. To remove all + existing DSPs, execute DSP without any + variables. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END FUNCTION +DESCRIPTION: Specifies the last line of a multi-line + FUNCTION definition. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: END SELECT +DESCRIPTION: Specifies the last line of a multi-line SELECT + CASE definition. +------------------------------------------------------------ + SYNTAX: END SUB +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. +------------------------------------------------------------ + SYNTAX: EXCHANGE variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: EXIT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: EXIT DO +DESCRIPTION: Immediately exits the inner-most DO-LOOP + strucure. +------------------------------------------------------------ + SYNTAX: EXIT FOR +DESCRIPTION: Immediately exits the inner-most FOR-NEXT + strucure. +------------------------------------------------------------ + SYNTAX: EXIT FUNCTION +DESCRIPTION: Immediately exits the inner-most multi-line + FUNCTION strucure. +------------------------------------------------------------ + SYNTAX: EXIT REPEAT +DESCRIPTION: Exit a REPEAT - UNTIL structure. +------------------------------------------------------------ + SYNTAX: EXIT SUB +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. +------------------------------------------------------------ + SYNTAX: EXIT WHILE +DESCRIPTION: Immediately exits the inner-most WHILE-END + strucure. +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. +------------------------------------------------------------ + SYNTAX: FNCS +DESCRIPTION: Prints a list of all pre-defined BASIC + functions. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: FUNCTION [ ( parameter [, ... ] ) ] +DESCRIPTION: Top line of a multi-line FUNCTION definition. + The variable names specified are local to the + FUNCTION definition, and are initialized + BYVAL when the function is invoked by another + routine. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOODBYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: HELP name +DESCRIPTION: Provides help on the specified name which is a + command name or function name. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: INPUT LINE variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE # filenum , variable$ +DESCRIPTION: Reads entire line from a file into variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE "prompt string" , variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$ after displaying a prompt +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LLIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the printer on stderr. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LOOP UNTIL value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is nonz-zero. +------------------------------------------------------------ + SYNTAX: LOOP WHILE value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is zero. +------------------------------------------------------------ + SYNTAX: LOOP +DESCRIPTION: Bottom of a DO - LOOP structure. If the loop + is not terminated by EXIT DO or DO UNTIL or + DO WHILE, then it will loop forever. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MARGIN # filenumber, width +DESCRIPTION: Sets the file margin for writing; filenumber + <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: MERGE filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program. Lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. +------------------------------------------------------------ + SYNTAX: NAME old$ AS new$ +DESCRIPTION: Changes the name of an existing file. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOSUB errline +DESCRIPTION: When a trappable error occurs, execute GOSUB + errline. The error handler must terminate + with a RETURN command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOSUB. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: ON ERROR RETURN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR RETURN NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOSUB. +------------------------------------------------------------ + SYNTAX: ON TIMER count GOSUB line +DESCRIPTION: Specifies a line (or label) to gosub when + count seconds have elaspsed after TIMER ON is + executed. The interrupt routine should end + with a RETURN command. Timer events only + occur in running BASIC programs. The + resolution of the clock is implementation + defined. +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS [#] fileenumber + [LEN [=] record-length] +DESCRIPTION: Opens a file for use. + RANDOM requires LEN. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: POP +DESCRIPTION: Pops one GOSUB from the return stack. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: RECALL ArrayName +DESCRIPTION: Loads a numeric array from a file saved using + STORE. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: REPEAT +DESCRIPTION: Top of a REPEAT - UNTIL structure. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SELECT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: SELECT CASE value +DESCRIPTION: Introduces a multi-line conditional selection + statement. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: STORE ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by RECALL. +------------------------------------------------------------ + SYNTAX: SUB name [ ( parameter [,...] ) ] +DESCRIPTION: Top line of a multi-line SUB definition. The + variable names specified are local to the SUB + definition, and are initialized BYVAL when + the subroutine is invoked by another routine. +------------------------------------------------------------ + SYNTAX: SUBEND +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. Same as END SUB. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TIMER +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TIMER OFF +DESCRIPTION: TIMER OFF terminates the timer interrupt. +------------------------------------------------------------ + SYNTAX: TIMER ON +DESCRIPTION: TIMER ON enables the timer interrupt. When + the specified seconds have elapsed, TIMER + STOP is internaly executed before the + interrupt is taken. TIMER ON should be + executed just before the RETURN command if + you want the interrupt to occur again. +------------------------------------------------------------ + SYNTAX: TIMER STOP +DESCRIPTION: TIMER STOP disables the interrupt, but the + count continues. +------------------------------------------------------------ + SYNTAX: TLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: UNTIL value +DESCRIPTION: Bottom of a REPEAT - UNTIL. If the value is + non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: VARS +DESCRIPTION: Prints a list of all global variables. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ACOS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACOS(X) <= PI. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ACS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACS(X) <= PI. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ACSD( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in degrees, where 0 <= + ACSD(X) <= 180. X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ACSG( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in gradians, where 0 <= + ACS(X) <= 200. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ANGLE( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The angle in radians between the positive + x-axis and the vector joining the origin to + the point with coordinates (X, Y), where -PI + < ANGLE(X,Y) <= PI. X and Y must not both be + 0. Note that the counterclockwise is + positive, e.g., ANGLE(1,1) = 45 degrees. +------------------------------------------------------------ + SYNTAX: N = ARCSIN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ARCSIN(X) <= PI/2; X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ARCTAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ARCTAN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ARGC +DESCRIPTION: The number of parameters passed to a FUNCTION + or SUB. If not in a FUNCTION or SUB, returns + -1. +------------------------------------------------------------ + SYNTAX: S$ = ARGT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The type of the Xth parameter to a FUNCTION or + SUB. If the Xth parameter is a string, then + return value is "$". If the Xth parameter is + a number, then return value is not "$". X in + [1,ARGC]. +------------------------------------------------------------ + SYNTAX: N = ARGV( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The numeric value of the Xth parameter to a + FUNCTION or SUB. X in [1,ARGC] and ARGT$( X + ) <> "$". +------------------------------------------------------------ + SYNTAX: S$ = ARGV$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The string value of the Xth parameter to a + FUNCTION or SUB. X in [1,ARGC] and ARGT$( X + ) = "$". +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASC( A$, X ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The numeric code of the Xth character in A$. + Same as ASC(MID$(A$,X)). +------------------------------------------------------------ + SYNTAX: N = ASCII( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASCII("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASIN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASIN(X) <= PI/2; X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ASN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASN(X) <= PI/2; X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ASND( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in degrees, where -90 <= + ASN(X) <= 90; X shall be in the range -1 <= X + <= 1. +------------------------------------------------------------ + SYNTAX: N = ASNG( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in gradians, where -100 <= + ASNG(X) <= 100; X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ATAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATAN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ATND( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in degrees, i.e. the angle + whose tangent is X, where -90 < ATND(X) < 90. +------------------------------------------------------------ + SYNTAX: N = ATNG( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in gradians, i.e. the + angle whose tangent is X, where -100 < + ATND(X) < 100. +------------------------------------------------------------ + SYNTAX: N = BASE +DESCRIPTION: The current OPTION BASE setting. +------------------------------------------------------------ + SYNTAX: N = CCUR( X ) + PARAMETER: X is a number, [MINCUR,MAXCUR] +DESCRIPTION: The currency (64-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CDBL( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The double-precision value of X. +------------------------------------------------------------ + SYNTAX: N = CEIL( X ) + PARAMETER: X is a number +DESCRIPTION: The smallest integer not less than X. +------------------------------------------------------------ + SYNTAX: S$ = CHAR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The string Y bytes long consisting of CHR$(X). + Same as STRING$(Y,X). +------------------------------------------------------------ + SYNTAX: S$ = CHAR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHAR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CHDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Changes to the directory named to A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR( X ) + PARAMETER: X is a number +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR(65) returns "A". +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = CLK( X ) + PARAMETER: X is a number +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of CLK + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of CLK shall + be "99:99:99". The value of TIME$ at + midnight is "00:00:00". The value of + parameter X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = CLK$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = CLNG( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The long (32-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = CLOSE +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = CLS +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = CODE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, CODE("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = COLOR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sets the foreground text color to X, and the + background text color to Y. +------------------------------------------------------------ + SYNTAX: S$ = COMMAND$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The command line parameters. COMMAND$(0) is + the BASIC program name. COMMAND$(1) is the + first parameter after the BASIC program name, + and so on. Support for parameters varies by + operating system, compiler, and so on. X in + [0..9] +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COSD( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in degrees. +------------------------------------------------------------ + SYNTAX: N = COSG( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in gradians. +------------------------------------------------------------ + SYNTAX: N = COSH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. +------------------------------------------------------------ + SYNTAX: N = COT( X ) + PARAMETER: X is a number +DESCRIPTION: The cotangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COUNT +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = CSC( X ) + PARAMETER: X is a number +DESCRIPTION: The cosecant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. +------------------------------------------------------------ + SYNTAX: N = CSNG( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The single-precision value of X. +------------------------------------------------------------ + SYNTAX: S$ = CUR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. +------------------------------------------------------------ + SYNTAX: N = CVC( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(CUR) +DESCRIPTION: The currency (64-bit) integer value in A$, + which was created by MKC$. +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. +------------------------------------------------------------ + SYNTAX: N = CVL( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(LNG) +DESCRIPTION: The long (32-bit) integer value in A$, which + was created by MKL$. +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. +------------------------------------------------------------ + SYNTAX: N = DATE +DESCRIPTION: The current date in decimal form YYYDDD, where + YYY are the number of years since 1900 and + DDD is the ordinal number of the current day + of the year; e.g., the value of DATE on May + 9, 1977 was 77129. If there is no calendar + available, then the value of DATE shall be + -1. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = DEG +DESCRIPTION: Configures the math functions to accept and + return angles in degrees. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = DEGREE +DESCRIPTION: Configures the math functions to accept and + return angles in degrees. +------------------------------------------------------------ + SYNTAX: N = DEGREE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: N = DIM( ... ) +DESCRIPTION: DIM( arrayname ). The total number of + dimensions of the array. +------------------------------------------------------------ + SYNTAX: N = ENVIRON( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Sends the environment variable expression + contained in A$ to the host operating system. + A$ must contain the "=" character. +------------------------------------------------------------ + SYNTAX: S$ = ENVIRON$( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the environment variable named + A$. +------------------------------------------------------------ + SYNTAX: N = EOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If device number X is at the end-of-file, then + -1, otherwise 0. +------------------------------------------------------------ + SYNTAX: N = EPS( X ) + PARAMETER: X is a number +DESCRIPTION: The maximum of (X-X1,X2-X, sigma) where X1 and + X2 are the predecessor and successor of X and + signma is the smallest positive value + representable. If X has no predecessor the + X1=X and if X has no successor the X2=X. + Note EPS(0) is the smallest positive number + representable by the implementation, and is + therefor implementation-defined. Note also + that EPS may produce different results for + different arithmetic options (see OPTION + ARITHMETIC). +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: S$ = ERR$ +DESCRIPTION: The last error message. +------------------------------------------------------------ + SYNTAX: N = ERRL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERRN +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERROR( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Simulate the error number in X. +------------------------------------------------------------ + SYNTAX: N = ERROR( X, A$ ) + PARAMETER: X is a number, [0,255] + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: Simulate the error number in X, with a custom + message in A$. +------------------------------------------------------------ + SYNTAX: S$ = ERROR$ +DESCRIPTION: The last error message. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FILEATTR( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, if Y = 1 then returns open mode, + otherwise returns zero. +------------------------------------------------------------ + SYNTAX: N = FILES +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = FILES( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = FLOW +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = FP( X ) + PARAMETER: X is a number +DESCRIPTION: The fractional part of X, i.e. X - IP(X). +------------------------------------------------------------ + SYNTAX: N = FRAC( X ) + PARAMETER: X is a number +DESCRIPTION: The fractional part of X, i.e. X - IP(X). +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = FREEFILE +DESCRIPTION: The next available file number. +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets the next available record. +------------------------------------------------------------ + SYNTAX: N = GET( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = GRAD +DESCRIPTION: Configures the math functions to accept and + return angles in gradians. +------------------------------------------------------------ + SYNTAX: N = GRADIAN +DESCRIPTION: Configures the math functions to accept and + return angles in gradians. +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. +------------------------------------------------------------ + SYNTAX: N = HOME +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = INDEX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X characters, read from the + terminal. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The string of X characters, read from file Y. +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = IP( X ) + PARAMETER: X is a number +DESCRIPTION: The integer part of X, i.e., + SGN(X)*INT(ABS(X)). +------------------------------------------------------------ + SYNTAX: S$ = KEY +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: S$ = KEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = LBOUND( ... ) +DESCRIPTION: LBOUND( arrayname [, dimension] ). The lower + bound of the array. The dimension defaults + to 1. dimension in [1,DIM(arrayname)] +------------------------------------------------------------ + SYNTAX: S$ = LCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOCATE( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG10( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG2( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The base 2 logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LPOS +DESCRIPTION: The current cursor position in the line for + the printer. +------------------------------------------------------------ + SYNTAX: S$ = LTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + leading space characters. +------------------------------------------------------------ + SYNTAX: N = LWIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For printer, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: S$ = MAX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MAXBYT +DESCRIPTION: The largest finite positive number + representable as a BYTE; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MAXCUR +DESCRIPTION: The largest finite positive number + representable as a CURRENCY; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MAXDBL +DESCRIPTION: The largest finite positive number + representable as a DOUBLE; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MAXDEV +DESCRIPTION: The largest finite positive number useable as + a FILE NUMBER; implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MAXINT +DESCRIPTION: The largest finite positive number + representable as an INTEGER; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MAXLEN +DESCRIPTION: The maximum string length. +------------------------------------------------------------ + SYNTAX: N = MAXLEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The maximum length associated with the + simple-string-variable A$. +------------------------------------------------------------ + SYNTAX: N = MAXLNG +DESCRIPTION: The largest finite positive number + representable as a LONG; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MAXLVL +DESCRIPTION: The maximum stack level; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MAXNUM +DESCRIPTION: The largest finite positive number + representable and manipulable by the + implementation; implementation-defined. + MAXNUM may represent diffent number for + different arithmetic options (see OPTION + ARITHMETIC). +------------------------------------------------------------ + SYNTAX: N = MAXSNG +DESCRIPTION: The largest finite positive number + representable as a SINGLE; + implementation-defined. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MIN( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: N = MINBYT +DESCRIPTION: The largest finite negative number + representable as a BYTE; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MINCUR +DESCRIPTION: The largest finite negative number + representable as a CURRENCY; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MINDBL +DESCRIPTION: The largest finite negative number + representable as a DOUBLE; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MINDEV +DESCRIPTION: The largest finite negative number useable as + a FILE NUMBER; implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MININT +DESCRIPTION: The largest finite negative number + representable as an INTEGER; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MINLNG +DESCRIPTION: The largest finite negative number + representable as a LONG; + implementation-defined. +------------------------------------------------------------ + SYNTAX: N = MINNUM +DESCRIPTION: The largest finite negative number + representable and manipulable by the + implementation; implementation-defined. + MINNUM may represent diffent number for + different arithmetic options (see OPTION + ARITHMETIC). +------------------------------------------------------------ + SYNTAX: N = MINSNG +DESCRIPTION: The largest finite negative number + representable as a SINGLE; + implementation-defined. +------------------------------------------------------------ + SYNTAX: S$ = MKC$( X ) + PARAMETER: X is a number, [MINCUR,MAXCUR] +DESCRIPTION: The internal representation of the currency + (64-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = MKDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Makes the directory named in A$. +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKL$( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The internal representation of the long + (32-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = NAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename the file named A$ into B$. +------------------------------------------------------------ + SYNTAX: N = NOFLOW +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = NULL( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Appends X null characters after each line + printed by LPRINT or LLIST. +------------------------------------------------------------ + SYNTAX: N = NUM +DESCRIPTION: The number of values processed by the last MAT + INPUT. Zero means error. +------------------------------------------------------------ + SYNTAX: N = NUM( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, NUM( " 123.5 " ) = 123.5, NUM( + "2.E-99" ) could be zero, and NUM( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the octal (base 8) representation of X. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Default the + record length. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$, Y ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Y is the + record length. +------------------------------------------------------------ + SYNTAX: N = ORD( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The ordinal position of the character named by + the string associated with A$ in the + collating sequence of ASCII character set, + where the first member of the character set + is in position zero. The acceptable values + for the standard character set are shown in + Table 1. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PAUSE( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then PAUSE + does nothing. The resolution is + implementation defined. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PI +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter. +------------------------------------------------------------ + SYNTAX: N = PI( X ) + PARAMETER: X is a number +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter, + times X. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the first character of + A$. If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts the next available record. +------------------------------------------------------------ + SYNTAX: N = PUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = RAD +DESCRIPTION: Configures the math functions to accept and + return angles in radians. +------------------------------------------------------------ + SYNTAX: N = RAD( X ) + PARAMETER: X is a number +DESCRIPTION: The number of radians in X degrees. +------------------------------------------------------------ + SYNTAX: N = RADIAN +DESCRIPTION: Configures the math functions to accept and + return angles in radians. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = REMAINDER( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, <> 0 +DESCRIPTION: The remainder function, i.e., X-Y*IP(X/Y). Y + shall not equal zero. +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string consisting of X copies of + LEFT$(A$,1); X > 0. +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string consisting of X copies of CHR$(Y); + X > 0. +------------------------------------------------------------ + SYNTAX: N = RESET +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RMDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the directory named in A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = ROUND( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The value of X rounded to Y decimal digits to + the right of the decimal point (or -Y digits + to the left if Y < 0); i.e., + INT(X*10^Y+.5)/10^Y. Y must be in [-32,32]. +------------------------------------------------------------ + SYNTAX: S$ = RTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + trailing space characters. +------------------------------------------------------------ + SYNTAX: N = SEC( X ) + PARAMETER: X is a number +DESCRIPTION: The secant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SEEK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = SEEK( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, move to record number Y; the first + record number is 1. +------------------------------------------------------------ + SYNTAX: S$ = SEG( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = SEG$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SHELL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SIND( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in degrees. +------------------------------------------------------------ + SYNTAX: N = SING( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in gradians. +------------------------------------------------------------ + SYNTAX: N = SINH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. +------------------------------------------------------------ + SYNTAX: N = SLEEP( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then SLEEP + does nothing. The resolution is + implementation defined. +------------------------------------------------------------ + SYNTAX: N = SNH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TAND( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in degrees. +------------------------------------------------------------ + SYNTAX: N = TANG( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in gradians. +------------------------------------------------------------ + SYNTAX: N = TANH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic tangent of X. +------------------------------------------------------------ + SYNTAX: N = TIME +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: S$ = TIME$( X ) + PARAMETER: X is a number +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = TIMER +DESCRIPTION: The time in the system clock in seconds + elapsed since midnight. +------------------------------------------------------------ + SYNTAX: S$ = TRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string resulting from removing both + leading and trailing spaces from A$. +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = TRUNCATE( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The value of X truncated to Y decimal digits + to the right of the decimal point (or -Y + digits to the left if Y < 0); i.e., + IP(X*10^Y)/10^Y. Y in [-32,32]. +------------------------------------------------------------ + SYNTAX: N = UBOUND( ... ) +DESCRIPTION: UBOUND( arrayname [, dimension] ). The upper + bound of the array. The dimension defaults + to 1. dimension in [1,DIM(arrayname)] +------------------------------------------------------------ + SYNTAX: S$ = UCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: N = WAIT( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then WAIT does + nothing. The resolution is implementation + defined. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Waits for the value of (INP(X) AND Y) to + become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y, Z ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] + PARAMETER: Z is a number, [0,255] +DESCRIPTION: Waits for the value of ((INP(X) XOR Z) AND Y) + to become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For console, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X [ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X & Y +DESCRIPTION: Concatenation + PRECEDENCE: 8 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: A$ LIKE B$ +DESCRIPTION: Compare A$ to the pattern in B$ + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/CALL-360.txt b/DOCS/CALL-360.txt new file mode 100644 index 0000000..58443c4 --- /dev/null +++ b/DOCS/CALL-360.txt @@ -0,0 +1,1089 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "CALL/360" +REM INTERNAL ID: S70 +REM DESCRIPTION: SBC CALL/360 Mainframe BASIC +REM REFERENCE: CALL/360: BASIC Reference Handbook +REM by International Business Machines Corporation +REM (c) 1970, The Service Bureau Corporation +REM http://bitsavers.trailing-edge.com/pdf/ibm/360/os/ +REM call_360/CALL_360_BASIC_Reference_Handbook_1970.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 1 +OPTION RECLEN 0 +OPTION DATE "%Y/%m/%d" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE " " +OPTION PUNCT SINGLE " " +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG " " +OPTION PUNCT INTEGER " " +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE ":" +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM " " +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA " " +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "!" +OPTION USING DOLLAR " " +OPTION USING FILLER " " +OPTION USING LITERAL " " +OPTION USING FIRST " " +OPTION USING ALL " " +OPTION USING LENGTH " " + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLOSE +DESCRIPTION: Closes all files. +------------------------------------------------------------ + SYNTAX: CLOSE filename$ [, ...] +DESCRIPTION: Closes a file. +------------------------------------------------------------ + SYNTAX: CLOSE filenumber [, ...] +DESCRIPTION: Closes a file. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GET filename$ , scalar [, ...] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IMAGE "format string" +DESCRIPTION: Provides format string for PRINT USING + linenum. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT GET filename$, arrayname +DESCRIPTION: Matrix get. +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT PUT filename$, arrayname +DESCRIPTION: Matrix put. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPEN filenumber, + filename$, + INPUT|OUTPUT|APPEND|VIRTUAL +DESCRIPTION: Opens a file for use. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PAUSE [comment] +DESCRIPTION: Pauses processing until the ENTER key is + presseed. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: PUT filename$ , value [, ...] +DESCRIPTION: Puts one (or more) values into a file. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESET filename$ [, ...] +DESCRIPTION: Positions an input or output file to the + bcginning. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: USE parameter$ +DESCRIPTION: Receives the value from the calling CHAINing + program. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ACS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACS(X) <= PI. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASN(X) <= PI/2; X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR( X ) + PARAMETER: X is a number +DESCRIPTION: The output of PRINT X. A$ = CHR(X) is the + opposite of X = NUM(A$). +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COT( X ) + PARAMETER: X is a number +DESCRIPTION: The cotangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSC( X ) + PARAMETER: X is a number +DESCRIPTION: The cosecant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = HCS( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. +------------------------------------------------------------ + SYNTAX: N = HSN( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. +------------------------------------------------------------ + SYNTAX: N = HTN( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic tangent of X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LGT( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LTW( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The base 2 logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = MAX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MIN( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: N = NUM( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, NUM( " 123.5 " ) = 123.5, NUM( + "2.E-99" ) could be zero, and NUM( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = RAD( X ) + PARAMETER: X is a number +DESCRIPTION: The number of radians in X degrees. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SEC( X ) + PARAMETER: X is a number +DESCRIPTION: The secant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TIM +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/CBASIC-II.txt b/DOCS/CBASIC-II.txt new file mode 100644 index 0000000..60eec56 --- /dev/null +++ b/DOCS/CBASIC-II.txt @@ -0,0 +1,1109 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "CBASIC-II" +REM INTERNAL ID: C77 +REM DESCRIPTION: CBASIC-II for CP/M +REM REFERENCE: CBASIC-II +REM by Compiler Systems +REM (c) 1977, Compiler Systems +REM http://bitsavers.trailing-edge.com/pdf/digitalResearch/cb80/ +REM CBASIC_Version_2_Jan81.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 0 +OPTION DATE "%Y/%m/%d" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "\" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "/" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. +------------------------------------------------------------ + SYNTAX: CONSOLE [WIDTH width] +DESCRIPTION: Directs the output of PRINT commands to the + console (stdout), and optionally changes the + console width. +------------------------------------------------------------ + SYNTAX: CREATE filename$ [ RECL reclen ] AS filenum + [ BUFF number ] [ RECS size ] +DESCRIPTION: Creates the file and opens it. If the file + already exists, then it is ereased. If the + file cannot be created, then an error occurs. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DELETE filenumber +DESCRIPTION: Closes and deletes the file OPEN as + filenumber. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: FEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FILE filename$ [( reclen )] +DESCRIPTION: Opens the file in READ mode. +------------------------------------------------------------ + SYNTAX: FILE # X, A$ +DESCRIPTION: If A$ is "*" then closes file # X. If A$ is + not "*" then opens the file named A$ in READ + mode. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF END # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is at EOF , then branch to line1. If the + file is not at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LLIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the printer on stderr. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINTER [WIDTH width] +DESCRIPTION: Directs the output of PRINT commands to the + printer (stderr), and optionally changes the + printer width. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MERGE filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program. Lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPEN filename$ + [ RECL reclen ] + AS filenumber + [ BUFF ignored ] + [ RECS ignored ] +DESCRIPTION: Opens a file for use. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: S$ = COMMAND$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The command line parameters. COMMAND$(0) is + the BASIC program name. COMMAND$(1) is the + first parameter after the BASIC program name, + and so on. Support for parameters varies by + operating system, compiler, and so on. X in + [0..9] +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FLOAT( X ) + PARAMETER: X is a number +DESCRIPTION: The rounded integer valuet of X. +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = INITIALIZE +DESCRIPTION: This function is provided for backward + compatibility only and it always returns a + fixed value of 0. +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = INT%( X ) + PARAMETER: X is a number +DESCRIPTION: The rounded integer valuet of X. +------------------------------------------------------------ + SYNTAX: S$ = LCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = MATCH( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RENAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename file A$ to B$. If successful, the + returns -1 else returns 0. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SIZE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The total number of 1KB blockes required to + contain the file. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = UCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/CMDS.HTM b/DOCS/CMDS.HTM new file mode 100644 index 0000000..778107f --- /dev/null +++ b/DOCS/CMDS.HTM @@ -0,0 +1,394 @@ +CMDS +

LEGEND


+ + + + + + + + + + + + + + + + + + + + + + + + + + +
IDNAMEDESCRIPTION
B15BYWATERBywater BASIC 3
B93BYWATER-2Bywater BASIC 2
S70CALL/360SBC CALL/360 Mainframe BASIC
C77CBASIC-IICBASIC-II for CP/M
D64DARTMOUTHDartmouth DTSS BASIC
E78ECMA-55ANSI Minimal BASIC
E86ECMA-116ANSI Full BASIC
G74GCOSGE 600 Mainframe BASIC
H14HAARDTbas 2.4 by Michael Haardt
HB1HANDBOOK1The BASIC Handbook, 1st Edition
HB2HANDBOOK2The BASIC Handbook, 2nd Edition
H80HEATHHeath Benton Harbor BASIC
G65MARK-IGE 265 Mainframe BASIC
G67MARK-IIGE 435 Mainframe BASIC
M80MBASICMicrosoft BASIC-80 for Xenix
D73PDP-8DEC PDP-8 BASIC
D70PDP-11DEC PDP-11 BASIC
R86RBASICMicronics RBASIC for 6809 FLEX
D71RSTS-11DEC RSTS-11 BASIC-PLUS
I70SYSTEM/360IBM System/360 Mainframe BASIC
I73SYSTEM/370IBM System/370 Mainframe BASIC
T80TRS-80TRS-80 Model I/III/4 LBASIC
V09VINTAGEVintage BASIC 1.0.1
T79XBASICTSC XBASIC for 6800 FLEX
+
+

DETAILS


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
COMMANDB15B93S70C77D64E78E86G74H14HB1HB2H80G65G67M80D73D70R86D71I70I73T80V09T79
APPEND filename$X X X X
APPEND # filenumber X X XX
ASXX X X XX X X
AUTO [start [, increment]]X XX X X X
BACKSPACE # X X X XX
BREAK line [, ...]]X XX
BUILD [start [, increment]] X
BYEX X XX XXXX XX X
CALL subname( [parameter [, ...] ] )XX X X
CASE constant [TO constant]XX X X
CASE IF operator constantXX X X
CASE IS operator constantXX X X
CASE ELSEXX X X
CHAIN filename$ [, linenumber]XXXX X XXXXXX XXXXX X
CHANGE A$ TO XX X X X XX X
CHANGE X TO A$X X X X XX X
CLEARXX XXXX X XX X X
CLOAD [filename$]X XX X X X
CLOAD* arraynameX XX X X X
CLOSE X XX
CLOSE filename$ [, ...] X XX
CLOSE filenumber [, ...] X XX
CLR XX
CMDSXX
COMMON variable [, ...]XX X X X X X X
CONSOLE [WIDTH width] X
CONST variable [, ...] = valueX
CONTX XX X XX X X
CONTINUE X
COPY source$ TO target$ X
CREATE filename$ [ RECL reclen ] AS filenum +[ BUFF number ] [ RECS size ] X
CSAVE [filename$]X XX X X X
CSAVE* ArrayNameX XX X X X
DATA constant [, ...]XXXXXXXXXXXXXXXXXXXXXXXX
DEC variable [,...] X
DEF FNname[( arg [,...] )] = valueXXXXXXXX XXXXXXXXXXXXXXX
DEF FNname[( arg [,...] )]X X X XXX X XX XXXX
DEFBYT letter[-letter] [, ...]X
DEFCUR letter[-letter] [, ...]X
DEFDBL letter[-letter] [, ...]XX XXX X X X
DEFINT letter[-letter] [, ...]XX XXX X X X
DEFLNG letter[-letter] [, ...]X
DEFSNG letter[-letter] [, ...]XX XX X X X
DEFSTR letter[-letter] [, ...]XX XXX X X X
DELETE filenumber X
DELETE line [- line]XX XXXX XXX X X
DELIMIT # X, A$ X XX
DIM [# filenum,] variable([ lower TO ] upper)XXXXXXXXXXXXXXXXXXXXXXXX
DISPLAY source$ X
DO UNTIL valueXX X X
DOXX X X
DO WHILE valueXX X X
DOS X
DSP variable [, ...]]X XX
EDITXXXXXXXX XXXXXX XXXXX X
ELSEXX X X XXXX XXXXX XXX
ELSEIFXX X X XXXX XXXXX XXX
ENDXXXXXXXXXXXXXXXXXXXXXXXX
END FUNCTIONXX X X
END IFXX X X XXXX XXXXX XXX
END SELECTXX X X
END SUBXX X X
ERASE variable [, ...]XX XXX X X X
EXCHANGE variable, variableX X
EXITXX X X X
EXIT DOXX X X
EXIT FORXX X X X
EXIT FUNCTIONXX X X
EXIT REPEATX X X
EXIT SUBXX X X
EXIT WHILEXX X
FEND X
FIELD [#] filenum, number AS variable$ [, ...]XX X X XX X X
FILE filename$ [( reclen )] X
FILE # X, A$ XX X XX
FILES A$[, ...] X X XX
FLEX X
FNCSXX
FNENDX X X XXX X XX XXXX
FOR variable = start TO finish [STEP increment]XXXXXXXXXXXXXXXXXXXXXXXX
FUNCTION [ ( parameter [, ... ] ) ]XX X X
GET # file_number , [ byte_number ] , scalar [,...] X
GET # file_number [ , RECORD record_number ] XX X
GET # file_number [ , RECORD record_number ] XX X
GET filename$ , scalar [, ...] X XX
GET # file_number [ , record_number ] X
GOX XXXXXXXXXXXXXXXXXXXXXX
GO SUB lineX XXXXXXXXXXXXXXXXXXXXXX
GO TO lineX XXXXXXXXXXXXXXXXXXXXXX
GOODBYEX X X X XX X
GOSUB lineXXXXXXXXXXXXXXXXXXXXXXXX
GOTO lineXXXXXXXXXXXXXXXXXXXXXXXX
HELP nameX
IF value THEN line1 [ELSE line2]XXXXXXXXXXXXXXXXXXXXXXXX
IF END # filenum THEN line1 [ELSE line2] XX X XX
IF MORE # filenum THEN line1 [ELSE line2] X X XX
IF value THENXX X X XXXX XXXXX XXX
IMAGE "format string" X XXX XX
INC variable [,...] X
INPUT "prompt string" , variable [, ...]XXXXXXXXXXXXXXXXXXXXXX X
INPUT # filenum , variable [, ...]sXXXXXXXXXXXXXXXXXXXXXX X
INPUT variable [, ...]XXXXXXXXXXXXXXXXXXXXXX X
INPUT LINE variable$X X X XX X X
INPUT LINE # filenum , variable$X X X XX X X
INPUT LINE "prompt string" , variable$X X X XX X X
[LET] variable [, ...] = valueXXXXXXXXXXXXXXXXXXXXXXXX
LINEXX X XX X XX X X
LINE INPUT [[#] filenum,]["prompt string";] variable$XX X XX X XX X X
LIST line1 [- line2]XXXXXXXXXXXXXXXXXXXXXX X
LISTNH line1 [- line2]X XXX X XX XXX
LLIST line1 [- line2]X X X X X X X
LOAD [filename$]XXXXXXXXXXX XXX XXXXX X
LOCAL [# filenum,] variable([ lower TO ] upper) X
LOOP UNTIL valueXX X X
LOOP WHILE valueXX X X
LOOPXX X X
LPRINT [USING format-string$;] value ...X X XX X X X XXXX
LPRINTER [WIDTH width] X
LPT [filename$] X
LSET variable$ = valueXX X X XX X X
MAINTAINERXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER CMDSXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER CMDS HTMLXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER CMDS IDXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER CMDS MANUALXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER CMDS_SWITCHXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER CMDS TABLEXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER DEBUGXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER DEBUG OFFXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER DEBUG ONXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER FNCSXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER FNCS HTMLXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER FNCS IDXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER FNCS MANUALXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER FNCS SWITCHXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER FNCS TABLEXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER MANUALXXXXXXXXXXXXXXXXXXXXXXXX
MAINTAINER STACKXXXXXXXXXXXXXXXXXXXXXXXX
MARGIN # filenumber, widthX X X X XX
MAT arrayname = value X X XXXX XX XXX
MAT GET filename$, arrayname X X XX XX
MAT INPUT arrayname X X XXXX XX XXX
MAT PRINT arrayname X X XXXX XX XXX
MAT PUT filename$, arrayname X X XX XX
MAT READ arrayname X X XXXX XX XXX
MAT WRITE arrayname X XXXX XX
MERGE filename$XX X X X X
MID$( variable$, start [, count ] ) = valueXX X X X X X X
MON X
NAME old$ AS new$XX X X X X
NEWXXXXXXXXXXX XXXXXXXXXX X
NEXT [variable]XXXXXXXXXXXXXXXXXXXXXXXX
OFX XXXXXX XX XXX XXXXX X
OLD [filename$] X X XXX XX X
ON value GOSUB line [, ...]XXXXXXXXXXXXXXX XXXXXXX
ON value GOTO line [, ...]XXXXXXXXXXXXXXX XXXXXXX
ON ERRORXX XXX X XX X X
ON ERROR GOSUB errlineXX
ON ERROR GOTO errlineX XXX X XX X X
ON ERROR RESUMEX X X XX X X
ON ERROR RESUME NEXTX X X XX X X
ON ERROR RETURNX
ON ERROR RETURN NEXTX
ON TIMER count GOSUB lineX
OPEN NEW|OLD|VIRTUAL filename$ +AS filenumber X X
OPEN filename$ +FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL +AS [#] fileenumber +[LEN [=] record-length]XX X X X X
OPEN filename$ +FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL +AS FILE filenumber +[ ,RECORDSIZE ignored ] +[ ,CLUSTERSIZE ignored ] +[ ,MODE ignored ] X
OPEN filename +FOR READ|WRITE|VIRTUAL +AS FILE filenumber X
OPEN filename$ +[ RECL reclen ] +AS filenumber +[ BUFF ignored ] +[ RECS ignored ] X
OPEN filenumber, +filename$, +INPUT|OUTPUT|APPEND|VIRTUAL X XX
OPTIONXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ANGLEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ANGLE DEGREESXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ANGLE GRADIANSXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ANGLE RADIANSXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ARITHMETICXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ARITHMETIC DECIMALXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ARITHMETIC FIXEDXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ARITHMETIC NATIVEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION BASE integerXXXXXXXXXXXXXXXXXXXXXXXX
OPTION BUGSXXXXXXXXXXXXXXXXXXXXXXXX
OPTION BUGS BOOLEANXXXXXXXXXXXXXXXXXXXXXXXX
OPTION BUGS OFFXXXXXXXXXXXXXXXXXXXXXXXX
OPTION BUGS ONXXXXXXXXXXXXXXXXXXXXXXXX
OPTION COMPAREXXXXXXXXXXXXXXXXXXXXXXXX
OPTION COMPARE BINARYXXXXXXXXXXXXXXXXXXXXXXXX
OPTION COMPARE DATABASEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION COMPARE TEXTXXXXXXXXXXXXXXXXXXXXXXXX
OPTION COVERAGEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION COVERAGE OFFXXXXXXXXXXXXXXXXXXXXXXXX
OPTION COVERAGE ONXXXXXXXXXXXXXXXXXXXXXXXX
OPTION DATE format$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION DIGITS integerXXXXXXXXXXXXXXXXXXXXXXXX
OPTION DISABLEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION DISABLE COMMAND name$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION DISABLE FUNCTION name$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION DISABLE OPERATOR name$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION EDIT string$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION ENABLEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ENABLE COMMAND name$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION ENABLE FUNCTION name$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION ENABLE OPERATOR name$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION ERRORXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ERROR GOSUBXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ERROR GOTOXXXXXXXXXXXXXXXXXXXXXXXX
OPTION EXPLICITXXXXXXXXXXXXXXXXXXXXXXXX
OPTION EXTENSION string$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION FILES string$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION IMPLICITXXXXXXXXXXXXXXXXXXXXXXXX
OPTION INDENT integerXXXXXXXXXXXXXXXXXXXXXXXX
OPTION LABELSXXXXXXXXXXXXXXXXXXXXXXXX
OPTION LABELS OFFXXXXXXXXXXXXXXXXXXXXXXXX
OPTION LABELS ONXXXXXXXXXXXXXXXXXXXXXXXX
OPTION PROMPT string$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCTXXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT AT char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT BYTE char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT COMMENT char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT CURRENCY char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT DOUBLE char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT FILENUM char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT IMAGE char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT INPUT char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT INTEGER char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT LONG char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT LPAREN char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT_PRINT char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT QUOTE char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT RPAREN char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT SINGLE char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT STATEMENT char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION PUNCT STRING char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION RECLEN integerXXXXXXXXXXXXXXXXXXXXXXXX
OPTION RENUM string$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION ROUNDXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ROUND BANKXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ROUND MATHXXXXXXXXXXXXXXXXXXXXXXXX
OPTION ROUND TRUNCATEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION SCALE integerXXXXXXXXXXXXXXXXXXXXXXXX
OPTION SLEEP doubleXXXXXXXXXXXXXXXXXXXXXXXX
OPTION STDERR filename$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION STDIN filename$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION STDOUT filename$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION STRICTXXXXXXXXXXXXXXXXXXXXXXXX
OPTION STRICT OFFXXXXXXXXXXXXXXXXXXXXXXXX
OPTION STRICT ONXXXXXXXXXXXXXXXXXXXXXXXX
OPTION TERMINALXXXXXXXXXXXXXXXXXXXXXXXX
OPTION TERMINAL ADMXXXXXXXXXXXXXXXXXXXXXXXX
OPTION TERMINAL ANSIXXXXXXXXXXXXXXXXXXXXXXXX
OPTION TERMINAL NONEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION TIME format$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION TRACEXXXXXXXXXXXXXXXXXXXXXXXX
OPTION TRACE OFFXXXXXXXXXXXXXXXXXXXXXXXX
OPTION TRACE ONXXXXXXXXXXXXXXXXXXXXXXXX
OPTION USINGXXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING ALL char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING COMMA char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING DIGIT char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING DOLLAR char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING EXRAD char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING FILLER char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING FIRST char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING LENGTH char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING LITERAL char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING MINUS char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING PERIOD char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION USING PLUS char$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION VERSION version$XXXXXXXXXXXXXXXXXXXXXXXX
OPTION ZONE integerXXXXXXXXXXXXXXXXXXXXXXXX
PAUSE [comment] X XX
PDEL line [- line] X X
POPX X
PRINT # filenum , [USING format$;] value ...XXXXXXXXXXXXXXXXXXXXXX X
PRINT [USING format$;] value ...XXXXXXXXXXXXXXXXXXXXXXXX
PTP [filename$] X
PTR [filename$] X
PUT # file_number , [ byte_number ] , scalar [,...] X
PUT filename$ , value [, ...] X XX
PUT # file_number [ , RECORD record_number ] XX X
PUT # file_number [ , record_number ] X
QUITX XXXXXX XX XXX
READ variable [, ...]XXXXXXXXXXXXXXXXXXXXXXXX
RECALL ArrayNameX X
REM ...XXXXXXXXXXXXXXXXXXXXXXXX
RENAME from$ TO to$ X
RENAME [filename$] X X XX X
RENUMXX XXX X XX X X
RENUMBER XX
REPEATX X X
REPLACE [filename$] X
RESET filename$ [, ...] X XX
RESTORE [line]XXXXXXXXXXXXXXXXXXXXXXXX
RESUMEX XXX X XX X X
RESUME lineX XXX X XX X X
RESUME NEXTX XXX X XX X X
RESUME 0X XXX X XX X X
RETURNXXXXXXXXXXXXXXXXXXXXXXXX
RSET variable$ = valueXX X X XX X X
RUN filename$XXXXXXXXXXXXXXXXXXXXXX X
RUN lineXXXXXXXXXXXXXXXXXXXXXX X
RUNXXXXXXXXXXXXXXXXXXXXXX X
RUNNH lineX XXX X XX XXX
RUNNH filename$X XXX X XX XXX
RUNNHX XXX X XX XXX
SAVE [filename$]XXXXXXXXXXXXXXXXXXXXXX X
SCRATCH [# X] X XXXX
SELECTXX X X
SELECT CASE valueXX X X
STEPXXXXXXXXXXXXXXXXXXXXXXXX
STOPXXXXXXXXXXXXXXXXXXXXXXXX
STORE ArrayNameX X
SUB name [ ( parameter [,...] ) ]XX X X X
SUB END X
SUB EXIT X
SUBENDX X X
SUBEXIT X
SWAP variable, variableXX X X X XX X X
SYSTEMXXXXXXXXXXX XXX XXXXX
TEXT letter[-letter] [, ...] XX
THENX XXXXXXXXXXXXXXXXXXXXXX
TIMERX
TIMER OFFX
TIMER ONX
TIMER STOPX
TLOAD [filename$]X X
TOXXXXXXXXXXXXXXXXXXXXXXXX
TRACE X XX X
TRACE OFF X XX X
TRACE ON X XX X
TSAVE [filename$]X X
TTY X
TTY IN X
TTY OUT X
UNTIL valueX X X
USE parameter$ X XX
VARSXX
WENDXX X XXX X X X
WHILE valueXX X XXX X X X
WRITE # filenum, value [, .... ]XX XX XXX X X
WRITE value [, .... ]XX XX XXX X X
+ + diff --git a/DOCS/DARTMOUTH.txt b/DOCS/DARTMOUTH.txt new file mode 100644 index 0000000..e61f3a6 --- /dev/null +++ b/DOCS/DARTMOUTH.txt @@ -0,0 +1,1009 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "DARTMOUTH" +REM INTERNAL ID: D64 +REM DESCRIPTION: Dartmouth DTSS BASIC +REM REFERENCE: BASIC +REM by Computation Center, Dartmouth College +REM (c) 1964, Trustees of Dartmouth College +REM http://www.bitsavers.org/pdf/dartmouth/ +REM BASIC_Oct64.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%y" +OPTION TIME "%H:%M" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE ":" +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND # filenumber +DESCRIPTION: Positions filenumber at EOF and sets the file + to writing; filenumber <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: BACKSPACE # X +DESCRIPTION: Points the file to the previous item. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CHANGE A$ TO X +DESCRIPTION: Changes a string to a numeric array. +------------------------------------------------------------ + SYNTAX: CHANGE X TO A$ +DESCRIPTION: Changes a numeric array to a string. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: FILE # X, A$ +DESCRIPTION: If A$ is "*" then closes file # X. If A$ is + not "*" then opens the file named A$ in READ + mode. +------------------------------------------------------------ + SYNTAX: FILES A$[, ...] +DESCRIPTION: If A$ is not "*" opens the file named A$ in + READ mode. The first filename of the first + FILES command is assocated with file number + 1. Note that multiple FILES commands + accumulate. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOODBYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF END # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is at EOF , then branch to line1. If the + file is not at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF MORE # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is not at EOF , then branch to line1. If the + file is at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MARGIN # filenumber, width +DESCRIPTION: Sets the file margin for writing; filenumber + <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: MAT WRITE arrayname +DESCRIPTION: Matrix write. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENAME [filename$] +DESCRIPTION: Changes the file name which will be used by + SAVE. Does not save the file. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CATALOG +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = CATALOG( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = RANDOM +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = UNSAVE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/ECMA-116.txt b/DOCS/ECMA-116.txt new file mode 100644 index 0000000..ba96f4a --- /dev/null +++ b/DOCS/ECMA-116.txt @@ -0,0 +1,1318 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "ECMA-116" +REM INTERNAL ID: E86 +REM DESCRIPTION: ANSI Full BASIC +REM REFERENCE: STANDARD ECMA-116: Full BASIC +REM by EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION +REM (c) 1986, EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION +REM http://www.ecma-international.org/publications/files/ +REM ECMA-ST-WITHDRAWN/ECMA-116,%201st%20edition,%20June%201986.pdf +REM +OPTION STRICT ON +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS ON +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 1 +OPTION RECLEN 128 +OPTION DATE "%Y-%m-%d" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "!" +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: CASE constant [TO constant] +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE IF operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE IS operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE ELSE +DESCRIPTION: Introduces a default SELECT CASE element. +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: DO UNTIL value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is non-zero. +------------------------------------------------------------ + SYNTAX: DO +DESCRIPTION: Top of a DO - LOOP structure. If the loop is + not terminated by EXIT DO or LOOP UNTIL or + LOOP WHILE, then it will loop forever. +------------------------------------------------------------ + SYNTAX: DO WHILE value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is zero. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END FUNCTION +DESCRIPTION: Specifies the last line of a multi-line + FUNCTION definition. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: END SELECT +DESCRIPTION: Specifies the last line of a multi-line SELECT + CASE definition. +------------------------------------------------------------ + SYNTAX: END SUB +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. +------------------------------------------------------------ + SYNTAX: EXIT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: EXIT DO +DESCRIPTION: Immediately exits the inner-most DO-LOOP + strucure. +------------------------------------------------------------ + SYNTAX: EXIT FOR +DESCRIPTION: Immediately exits the inner-most FOR-NEXT + strucure. +------------------------------------------------------------ + SYNTAX: EXIT FUNCTION +DESCRIPTION: Immediately exits the inner-most multi-line + FUNCTION strucure. +------------------------------------------------------------ + SYNTAX: EXIT SUB +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. +------------------------------------------------------------ + SYNTAX: EXIT WHILE +DESCRIPTION: Immediately exits the inner-most WHILE-END + strucure. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: FUNCTION [ ( parameter [, ... ] ) ] +DESCRIPTION: Top line of a multi-line FUNCTION definition. + The variable names specified are local to the + FUNCTION definition, and are initialized + BYVAL when the function is invoked by another + routine. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LOOP UNTIL value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is nonz-zero. +------------------------------------------------------------ + SYNTAX: LOOP WHILE value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is zero. +------------------------------------------------------------ + SYNTAX: LOOP +DESCRIPTION: Bottom of a DO - LOOP structure. If the loop + is not terminated by EXIT DO or DO UNTIL or + DO WHILE, then it will loop forever. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SELECT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: SELECT CASE value +DESCRIPTION: Introduces a multi-line conditional selection + statement. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SUB name [ ( parameter [,...] ) ] +DESCRIPTION: Top line of a multi-line SUB definition. The + variable names specified are local to the SUB + definition, and are initialized BYVAL when + the subroutine is invoked by another routine. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ACOS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACOS(X) <= PI. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ANGLE( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The angle in radians between the positive + x-axis and the vector joining the origin to + the point with coordinates (X, Y), where -PI + < ANGLE(X,Y) <= PI. X and Y must not both be + 0. Note that the counterclockwise is + positive, e.g., ANGLE(1,1) = 45 degrees. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASIN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASIN(X) <= PI/2; X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CEIL( X ) + PARAMETER: X is a number +DESCRIPTION: The smallest integer not less than X. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COSH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. +------------------------------------------------------------ + SYNTAX: N = COT( X ) + PARAMETER: X is a number +DESCRIPTION: The cotangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSC( X ) + PARAMETER: X is a number +DESCRIPTION: The cosecant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = DATE +DESCRIPTION: The current date in decimal form YYYDDD, where + YYY are the number of years since 1900 and + DDD is the ordinal number of the current day + of the year; e.g., the value of DATE on May + 9, 1977 was 77129. If there is no calendar + available, then the value of DATE shall be + -1. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = EPS( X ) + PARAMETER: X is a number +DESCRIPTION: The maximum of (X-X1,X2-X, sigma) where X1 and + X2 are the predecessor and successor of X and + signma is the smallest positive value + representable. If X has no predecessor the + X1=X and if X has no successor the X2=X. + Note EPS(0) is the smallest positive number + representable by the implementation, and is + therefor implementation-defined. Note also + that EPS may produce different results for + different arithmetic options (see OPTION + ARITHMETIC). +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = FP( X ) + PARAMETER: X is a number +DESCRIPTION: The fractional part of X, i.e. X - IP(X). +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = IP( X ) + PARAMETER: X is a number +DESCRIPTION: The integer part of X, i.e., + SGN(X)*INT(ABS(X)). +------------------------------------------------------------ + SYNTAX: N = LBOUND( ... ) +DESCRIPTION: LBOUND( arrayname [, dimension] ). The lower + bound of the array. The dimension defaults + to 1. dimension in [1,DIM(arrayname)] +------------------------------------------------------------ + SYNTAX: S$ = LCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG10( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG2( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The base 2 logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = LTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + leading space characters. +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MAXLEN +DESCRIPTION: The maximum string length. +------------------------------------------------------------ + SYNTAX: N = MAXLEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The maximum length associated with the + simple-string-variable A$. +------------------------------------------------------------ + SYNTAX: N = MAXNUM +DESCRIPTION: The largest finite positive number + representable and manipulable by the + implementation; implementation-defined. + MAXNUM may represent diffent number for + different arithmetic options (see OPTION + ARITHMETIC). +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: N = MOD( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, <> 0 +DESCRIPTION: X modulo Y, i.e., X-Y*INT(X/Y). Y shall not + equal zero. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = ORD( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The ordinal position of the character named by + the string associated with A$ in the + collating sequence of ASCII character set, + where the first member of the character set + is in position zero. The acceptable values + for the standard character set are shown in + Table 1. +------------------------------------------------------------ + SYNTAX: N = PI +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter. +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the first character of + A$. If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = RAD( X ) + PARAMETER: X is a number +DESCRIPTION: The number of radians in X degrees. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = REMAINDER( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, <> 0 +DESCRIPTION: The remainder function, i.e., X-Y*IP(X/Y). Y + shall not equal zero. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = ROUND( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The value of X rounded to Y decimal digits to + the right of the decimal point (or -Y digits + to the left if Y < 0); i.e., + INT(X*10^Y+.5)/10^Y. Y must be in [-32,32]. +------------------------------------------------------------ + SYNTAX: S$ = RTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + trailing space characters. +------------------------------------------------------------ + SYNTAX: N = SEC( X ) + PARAMETER: X is a number +DESCRIPTION: The secant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SEEK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SINH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. +------------------------------------------------------------ + SYNTAX: N = SIZE( ... ) +DESCRIPTION: SIZE( arrayname ). The total number of items + in the array. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TANH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic tangent of X. +------------------------------------------------------------ + SYNTAX: N = TIME +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: S$ = TRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string resulting from removing both + leading and trailing spaces from A$. +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = TRUNCATE( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The value of X truncated to Y decimal digits + to the right of the decimal point (or -Y + digits to the left if Y < 0); i.e., + IP(X*10^Y)/10^Y. Y in [-32,32]. +------------------------------------------------------------ + SYNTAX: N = UBOUND( ... ) +DESCRIPTION: UBOUND( arrayname [, dimension] ). The upper + bound of the array. The dimension defaults + to 1. dimension in [1,DIM(arrayname)] +------------------------------------------------------------ + SYNTAX: S$ = UCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + + diff --git a/DOCS/ECMA-55.txt b/DOCS/ECMA-55.txt new file mode 100644 index 0000000..ee0618c --- /dev/null +++ b/DOCS/ECMA-55.txt @@ -0,0 +1,873 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "ECMA-55" +REM INTERNAL ID: E78 +REM DESCRIPTION: ANSI Minimal BASIC +REM REFERENCE: STANDARD ECMA-55: Minimal BASIC +REM by EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION +REM (c) 1978, EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION +REM http://www.ecma-international.org/publications/files/ +REM ECMA-ST-WITHDRAWN/ECMA-55,%201st%20Edition,%20January%201978.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%Y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + + diff --git a/DOCS/FNCS.HTM b/DOCS/FNCS.HTM new file mode 100644 index 0000000..e0fe706 --- /dev/null +++ b/DOCS/FNCS.HTM @@ -0,0 +1,373 @@ +FNCS +

LEGEND


+ + + + + + + + + + + + + + + + + + + + + + + + + + +
IDNAMEDESCRIPTION
B15BYWATERBywater BASIC 3
B93BYWATER-2Bywater BASIC 2
S70CALL/360SBC CALL/360 Mainframe BASIC
C77CBASIC-IICBASIC-II for CP/M
D64DARTMOUTHDartmouth DTSS BASIC
E78ECMA-55ANSI Minimal BASIC
E86ECMA-116ANSI Full BASIC
G74GCOSGE 600 Mainframe BASIC
H14HAARDTbas 2.4 by Michael Haardt
HB1HANDBOOK1The BASIC Handbook, 1st Edition
HB2HANDBOOK2The BASIC Handbook, 2nd Edition
H80HEATHHeath Benton Harbor BASIC
G65MARK-IGE 265 Mainframe BASIC
G67MARK-IIGE 435 Mainframe BASIC
M80MBASICMicrosoft BASIC-80 for Xenix
D73PDP-8DEC PDP-8 BASIC
D70PDP-11DEC PDP-11 BASIC
R86RBASICMicronics RBASIC for 6809 FLEX
D71RSTS-11DEC RSTS-11 BASIC-PLUS
I70SYSTEM/360IBM System/360 Mainframe BASIC
I73SYSTEM/370IBM System/370 Mainframe BASIC
T80TRS-80TRS-80 Model I/III/4 LBASIC
V09VINTAGEVintage BASIC 1.0.1
T79XBASICTSC XBASIC for 6800 FLEX
+
+

DETAILS


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FUNCTIONB15B93S70C77D64E78E86G74H14HB1HB2H80G65G67M80D73D70R86D71I70I73T80V09T79
N = ABS( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = ACOS( X )X X
N = ACS( X )X X X XX
N = ACSD( X )X X
N = ACSG( X )X X
N = ANGLE( X, Y )X X
N = ARCCOS( X ) X X
N = ARCSIN( X )X X X X
N = ARCTAN( X )X XX X X
N = ARGCX
S$ = ARGT$( X )X
N = ARGV( X )X
S$ = ARGV$( X )X
N = ASC( A$ )XXXXXXXXXXXXXXX X XXXXX
N = ASC( A$, X )X XX
N = ASCII( A$ )X X X
N = ASIN( X )X X
N = ASN( X )X X XX XX
N = ASND( X )X X
N = ASNG( X )X X
N = ATAN( X )X XX
N = ATN( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = ATND( X )X X
N = ATNG( X )X X
N = BASEX
S$ = BIN$( X ) X
S$ = BIN$( X, Y ) X
N = CATALOG X X XX X
N = CATALOG( A$ ) X X XX X
N = CCUR( X )X
N = CDBL( X )X XX X X X
N = CEIL( X )X X
S$ = CHAR( X, Y )X XX
S$ = CHAR$( X )X XX
N = CHDIR( A$ )XX X X X X
S$ = CHR( X )X XX
S$ = CHR( X ) X XX
S$ = CHR$( X )XX XXXXXXXXXXXX XX XXX
N = CIN( X ) X
N = CINT( X )XX XXX X X X
N = CLG( X )X XX
N = CLK( X ) X XX
S$ = CLK( X )X XX
S$ = CLK$X X XX X
N = CLNG( X )X X X X
N = CLOG( X )X XX
N = CLOSEXX X X X X X
N = CLOSE( X )XX X X XX X XX X X
N = CLSXX XXX X X
N = CNTRL( X, Y ) X
N = CODE( A$ )X X X
N = COLOR( X, Y )X X X X
S$ = COMMAND$ X
S$ = COMMAND$( X )X X X
N = COS( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = COSD( X )X X
N = COSG( X )X X
N = COSH( X )X X
N = COT( X )X X XX X XX
N = COUNTX X
N = CSC( X )X X X XX
N = CSH( X )X X
N = CSNG( X )XX XX X X X
S$ = CUR( X, Y )X X
N = CVC( A$ )X
N = CVD( A$ )XX X X XX X X
N = CVI( A$ )XX X X XX X X
N = CVL( A$ )X X XX X X
N = CVS( A$ )XX X X XX X X
S$ = DAT$ X X
N = DATEX X
S$ = DATE$XX X X X XX X X
S$ = DATE$( X ) X
N = DEGX XX
N = DEG( X ) X
N = DEG( X )X X X XXX XX
N = DEGREEX X
N = DEGREE( X )X X
N = DETX X XX X X XXX
N = DIGITS( X ) X X
N = DIGITS( X, Y ) X X X
N = DIM( ... )X
N = DPEEK( X ) X X
N = DPOKE( X, Y ) X X
S$ = EDIT$( A$, X ) X
N = ENVIRON( A$ )XX X X X X
S$ = ENVIRON$( A$ )XX X X X X
N = EOF( X )XX X X X X X
N = EPS( X )X X
N = ERLXX XXX X XX X X
N = ERRXX XXX X XX X X
S$ = ERR$X X X X
N = ERRLX X
N = ERRNX X
N = ERROR( X )XX XX X X X
N = ERROR( X, A$ )X XX
S$ = ERROR$X X X X
N = EXAM( X ) XX
N = EXEC( A$ ) X X
N = EXF( ... ) X
N = EXP( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = FALSE X
N = FETCH( X ) XX
N = FILEATTR( X, Y )X X X X
N = FILESXX X X X
N = FILES( A$ )XX X X X
N = FILL( X, Y ) XX
N = FIX( X )X X XXXXXXX XXX XXXX
N = FLOAT( X ) X
N = FLOWX X
N = FP( X )X X X
N = FRAC( X )X X X
N = FREX X XX X XX X X
N = FRE( A$ )X XX X XX X X
N = FRE( X )X XX X XX X X
N = FREE XXX
N = FREE( X ) XX
N = FREE( A$ ) XX
N = FREEFILEX X
N = GET( X )XX X X X X
N = GET( X ) X
N = GET( X, Y )XX X X X X
N = GRADX X
N = GRADIANX X
N = HCS( X ) X XX
N = HEX( A$ ) X X
S$ = HEX$( X )XX X X X X
S$ = HEX$( X, Y ) X
N = HOMEX XXX
N = HSN( X ) X XX
N = HTN( X ) X XX
S$ = INCH$ X X
N = INDEX( A$, B$ )X X
N = INITIALIZE X
S$ = INKEY$XX XXX X X X
N = INP( X )X X XXX X X X
S$ = INPUT$( X )X X X X X X
S$ = INPUT$( X, Y )X X X X X
N = INSTR( A$, B$ )XX X X X X X
N = INSTR( A$, B$, X ) X
N = INSTR( X, A$, B$ )XX X X X XX X X
N = INT( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = INT( X ) X X
N = IP( X )X X X
S$ = KEYX X
S$ = KEY$X X
N = KILL( A$ )XX X X XX X X
N = LBOUND( ... )X X
S$ = LCASE$( A$ )X X X X X X X
S$ = LEFT( A$, X ) XX X
S$ = LEFT$( A$, X )XX X X XXXX X X XX
N = LEN( A$ )XXXXXXXXXXXXXXX XXXXXXX
N = LGT( X ) X XX XX
S$ = LIN( X ) XX
N = LN( X ) XX
N = LNO( X ) X
N = LOC( X )XX XXX XXX X X
N = LOCATE( X, Y )XX X X X X
N = LOCK( X ) X
N = LOF( X )XX XXX XXX X X
N = LOG( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = LOG10( X )X X XXX X
N = LOG2( X )X X X
N = LOGE( X ) XX
S$ = LOWER$( A$ ) X
N = LPOSX X X X
S$ = LTRIM$( A$ )X X X X X X
N = LTW( X ) X XX
N = LWIDTH( X )X X X X
N = MATCH( A$, B$, X ) X X X
S$ = MAX( A$, B$ )X X XX XX
N = MAX( X, Y )X X X X XX XX
N = MAXBYTX
N = MAXCURX
N = MAXDBLX
N = MAXDEVX
N = MAXINTX
N = MAXLENX X
N = MAXLEN( A$ )X X
N = MAXLNGX
N = MAXLVLX
N = MAXNUMX X
N = MAXSNGX
N = MEM XX
S$ = MID( A$, X ) XX X
S$ = MID( A$, X, Y ) XX X
S$ = MID$( A$, X )XX X X XXXX X XX XXX
S$ = MID$( A$, X, Y )XX X X XXXX X XX XXX
N = MIN( X, Y )X X X X XX XX
S$ = MIN( A$, B$ )X X XX XX
N = MINBYTX
N = MINCURX
N = MINDBLX
N = MINDEVX
N = MININTX
N = MINLNGX
N = MINNUMX
N = MINSNGX
S$ = MKC$( X )X
S$ = MKD$( X )XX X X XX X X
N = MKDIR( A$ )XX X X X X
S$ = MKI$( X )XX X X XX X X
S$ = MKL$( X )X X XX X X
S$ = MKS$( X )XX X X XX X X
N = MOD( X, Y ) X
N = NAME( A$, B$ )X X X X
N = NAME( ... ) X X
N = NOFLOWX X
N = NOTRACE XX
N = NULL( X )X X X X
N = NUMX X X X
N = NUM( A$ )X X X XX
S$ = NUM$( X )X X XXXX XX XXX XXXX
S$ = OCT$( X )XX X X X X
S$ = OCT$( X, Y ) X
N = OPEN( A$, X, B$ )XX X X X X X
N = OPEN( A$, X, B$, Y )XX X X X X X
N = ORD( A$ )X X
N = OUT( X, Y )X X XXXX X X X
N = PAD( X ) X
N = PAUSE( X )X XX
N = PDL( X ) XX
N = PEEK( X )X X XXXX X XX X X
N = PIX X XXX X
N = PI( X )X X
N = PIN( X ) XXX
N = POKE( X, Y )X X XXXX X XX X X
N = POSXX X X X X XX X X
N = POS( X )X X XX X XX X X
N = POS( A$, B$ )X X X X
N = POS( A$, B$, X )X X X X
N = PRECISION( X ) X
N = PTR( ... ) X X
N = PUT( X ) X
N = PUT( X )XX X X X X
N = PUT( X, Y )XX X X X X
N = RADX XX
N = RAD( X )X X X X X XX
N = RADIANX XX
N = RAN XX
N = RAN( X ) XX
N = RANDOM X X XX XX
N = RANDOM( X ) XX X
N = RANDOMIZEXXXXXXXXXXXXXXXXX XXXXX
N = RANDOMIZE( X )XXXXXXXXXXXXXXX XXXX
N = REMAINDER( X, Y )X X
N = RENAME( A$, B$ ) X X X
S$ = REPEAT$( X, A$ )X X X X
S$ = REPEAT$( X, Y )X X X X
N = RESETX XX X X X
N = RESIDUE X
S$ = RIGHT( A$, X ) XX X
S$ = RIGHT$( A$, X )XX X X XXXX X XX XXX
N = RMDIR( A$ )XX X X X
N = RNDXXXXXXXXXXXXXXXXXXXXXXXX
N = RND( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = ROUND( X, Y )X X
S$ = RTRIM$( A$ )X X X X X X
N = SCALE( X ) X X
N = SEC( X )X X X XX
N = SEEK( X )X X X X X
N = SEEK( X, Y )X X X X
N = SEG( X ) X
S$ = SEG( A$, X, Y )X X
S$ = SEG$( A$, X, Y )X X X
N = SGN( X )XXXXXXXXX XXXXXXXXXXXXXX
N = SHELL( A$ )X X X X X
N = SIN( X )XXXXXXXXXXXXXXXXXXXXXX X
N = SIND( X )X X
N = SING( X )X X
N = SINH( X )X X X
N = SIZE( A$ ) X
N = SIZE( ... ) X
N = SLEEP( X )X XXX X
N = SNH( X )X X
S$ = SPA( X ) XX
S$ = SPACE( X ) XX X
S$ = SPACE$( X )XX XXX X X X
S$ = SPC( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = SQR( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = SQRT( X ) XX
S$ = STR( X, Y )X X
S$ = STR$( X )XXXXXXXXXXXXXXX XXXXXXX
S$ = STRING( X, Y )X X
S$ = STRING$( X, A$ )XX X XXX X X X
S$ = STRING$( X, Y )XX X XXX X X X
S$ = STRIP$( A$ ) X
N = STUFF( X, Y ) XX
S$ = TAB( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = TAN( X )XXXXXXXXXXXXXXXXXXXXXXXX
N = TAND( X )X X
N = TANG( X )X X
N = TANH( X )X X X
N = TI XX
S$ = TI$ XX
N = TIM X X XX X XX
N = TIM( X ) X XX XX
N = TIMEX X XXX X
N = TIME( X ) XX X
S$ = TIME$XX X XXX X X X
S$ = TIME$( X )X X X
N = TIMERXX X X X X
N = TOP X
N = TRACE XX
N = TRACE( X ) X
S$ = TRIM$( A$ )X X X X X
N = TROFFXX X XXX X X X X
N = TRONXX X XXX X X X X
N = TRUE X
N = TRUNCATE( X, Y )X X
N = UBOUND( ... )X X
S$ = UCASE$( A$ )X X X X X X X
N = UNLOCK( X ) X
N = UNSAVE( A$ ) X X XXX X
S$ = UPPER$( A$ ) X
N = USR( ... ) X X X X
N = USR0( ... ) X X X X
N = USR1( ... ) X X X X
N = USR2( ... ) X X X X
N = USR3( ... ) X X X X
N = USR4( ... ) X X X X
N = USR5( ... ) X X X X
N = USR6( ... ) X X X X
N = USR7( ... ) X X X X
N = USR8( ... ) X X X X
N = USR9( ... ) X X X X
N = UUF( ... ) X
N = VAL( A$ )XXXXXXXXXXXXXXX XXXXXXX
N = VARPTR( ... ) X
N = VTAB( X ) XX
N = WAIT( X )X XX X
N = WAIT( X, Y )X XXX X X X
N = WAIT( X, Y, Z )X XXX X X X
N = WIDTH( X )XX X X X X
N = WIDTH( X, Y )XX XXX X X X
N = ZONE( X ) X
N = ZONE( X, Y ) X
+ + diff --git a/DOCS/GCOS.txt b/DOCS/GCOS.txt new file mode 100644 index 0000000..c3e9e29 --- /dev/null +++ b/DOCS/GCOS.txt @@ -0,0 +1,1114 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "GCOS" +REM INTERNAL ID: G74 +REM DESCRIPTION: GE 600 Mainframe BASIC +REM REFERENCE: TIME-SHARING SYSTEM POCKET GUIDE, SERIES 600/6000 GCOS +REM by Honeywell +REM (c) 1974, Honeywell +REM http://www.trailingedge.com/misc/ +REM GCOS-TSS-PocketGuide.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%y" +OPTION TIME "%H:%M" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE ":" +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND # filenumber +DESCRIPTION: Positions filenumber at EOF and sets the file + to writing; filenumber <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: BACKSPACE # X +DESCRIPTION: Points the file to the previous item. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CHANGE A$ TO X +DESCRIPTION: Changes a string to a numeric array. +------------------------------------------------------------ + SYNTAX: CHANGE X TO A$ +DESCRIPTION: Changes a numeric array to a string. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DELIMIT # X, A$ +DESCRIPTION: Sets the delimiter for READ # and WRITE #. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: FILE # X, A$ +DESCRIPTION: If A$ is "*" then closes file # X. If A$ is + not "*" then opens the file named A$ in READ + mode. +------------------------------------------------------------ + SYNTAX: FILES A$[, ...] +DESCRIPTION: If A$ is not "*" opens the file named A$ in + READ mode. The first filename of the first + FILES command is assocated with file number + 1. Note that multiple FILES commands + accumulate. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOODBYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF END # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is at EOF , then branch to line1. If the + file is not at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF MORE # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is not at EOF , then branch to line1. If the + file is at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MARGIN # filenumber, width +DESCRIPTION: Sets the file margin for writing; filenumber + <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT GET filename$, arrayname +DESCRIPTION: Matrix get. +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT PUT filename$, arrayname +DESCRIPTION: Matrix put. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: MAT WRITE arrayname +DESCRIPTION: Matrix write. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENAME [filename$] +DESCRIPTION: Changes the file name which will be used by + SAVE. Does not save the file. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SCRATCH [# X] +DESCRIPTION: SCRATCH Deletes the program in memory and + clears all variables. SCRATCH # X Sets the + file mode to writing. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TRACE +DESCRIPTION: Enables tracing. +------------------------------------------------------------ + SYNTAX: TRACE OFF +DESCRIPTION: Disables tracing. +------------------------------------------------------------ + SYNTAX: TRACE ON +DESCRIPTION: Enables tracing. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CATALOG +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = CATALOG( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CLK( X ) + PARAMETER: X is a number +DESCRIPTION: The time elapsed since the previous midnight, + expressed in hours; e.g., the value of CLK at + 3:15 PM is 15.25. If there is no clock + available, then the value of CLK shall be -1. + The value of CLK at midnight shall be zero + (not 24). The value of X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = CLK$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COT( X ) + PARAMETER: X is a number +DESCRIPTION: The cotangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = DAT$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = NUM +DESCRIPTION: The number of values processed by the last MAT + INPUT. Zero means error. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = RANDOM +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TIM +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = TIM( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: If X is 0, returns minutes in current hour. + If X is 1, returns hours in current day. If + X is 2, returns days in current year. If X + is 3, returns years since 1900. Any other + value for X is an ERROR. +------------------------------------------------------------ + SYNTAX: N = UNSAVE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/HAARDT.txt b/DOCS/HAARDT.txt new file mode 100644 index 0000000..30ec123 --- /dev/null +++ b/DOCS/HAARDT.txt @@ -0,0 +1,1788 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "HAARDT" +REM INTERNAL ID: H14 +REM DESCRIPTION: bas 2.4 by Michael Haardt +REM REFERENCE: BAS +REM by by Michael Haardt +REM (c) 2014, by Michael Haardt +REM http://www.moria.de/~michael/bas/ +REM bas-2.4.tar.gz +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 1 +OPTION DATE "%m/%d/%Y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG " " +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CALL subname( [parameter [, ...] ] ) +DESCRIPTION: Calls a subroutine that was defined by SUB and + END SUB. +------------------------------------------------------------ + SYNTAX: CASE constant [TO constant] +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE IF operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE IS operator constant +DESCRIPTION: Introduces an element of a SELECT CASE + statement. Multiple tests must be seperated + a comma. For example: CASE 1, 2 TO 3, IS > + 4, IF < 5 +------------------------------------------------------------ + SYNTAX: CASE ELSE +DESCRIPTION: Introduces a default SELECT CASE element. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: COPY source$ TO target$ +DESCRIPTION: Copy an exisitng file. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEC variable [,...] +DESCRIPTION: Decrement a numeric variable. +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: DISPLAY source$ +DESCRIPTION: Display an exisitng text file. +------------------------------------------------------------ + SYNTAX: DO UNTIL value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is non-zero. +------------------------------------------------------------ + SYNTAX: DO +DESCRIPTION: Top of a DO - LOOP structure. If the loop is + not terminated by EXIT DO or LOOP UNTIL or + LOOP WHILE, then it will loop forever. +------------------------------------------------------------ + SYNTAX: DO WHILE value +DESCRIPTION: Top of a DO - LOOP structure. Exits when + value is zero. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END FUNCTION +DESCRIPTION: Specifies the last line of a multi-line + FUNCTION definition. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: END SELECT +DESCRIPTION: Specifies the last line of a multi-line SELECT + CASE definition. +------------------------------------------------------------ + SYNTAX: END SUB +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. +------------------------------------------------------------ + SYNTAX: EXIT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: EXIT DO +DESCRIPTION: Immediately exits the inner-most DO-LOOP + strucure. +------------------------------------------------------------ + SYNTAX: EXIT FOR +DESCRIPTION: Immediately exits the inner-most FOR-NEXT + strucure. +------------------------------------------------------------ + SYNTAX: EXIT FUNCTION +DESCRIPTION: Immediately exits the inner-most multi-line + FUNCTION strucure. +------------------------------------------------------------ + SYNTAX: EXIT REPEAT +DESCRIPTION: Exit a REPEAT - UNTIL structure. +------------------------------------------------------------ + SYNTAX: EXIT SUB +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: FUNCTION [ ( parameter [, ... ] ) ] +DESCRIPTION: Top line of a multi-line FUNCTION definition. + The variable names specified are local to the + FUNCTION definition, and are initialized + BYVAL when the function is invoked by another + routine. +------------------------------------------------------------ + SYNTAX: GET # file_number , [ byte_number ] , scalar + [,...] +DESCRIPTION: Gets one (or more) values from a BINARY file. +------------------------------------------------------------ + SYNTAX: GET # file_number [ , record_number ] +DESCRIPTION: Gets one (or more) values from a RANDOM file. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: IMAGE "format string" +DESCRIPTION: Provides format string for PRINT USING + linenum. +------------------------------------------------------------ + SYNTAX: INC variable [,...] +DESCRIPTION: Increment a numeric variable. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LLIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the printer on stderr. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LOCAL [# filenum,] variable([ lower TO ] + upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. Only supported inside a FUNCTION or + SUB. +------------------------------------------------------------ + SYNTAX: LOOP UNTIL value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is nonz-zero. +------------------------------------------------------------ + SYNTAX: LOOP WHILE value +DESCRIPTION: Bottom of a DO - LOOP structure. Exits when + value is zero. +------------------------------------------------------------ + SYNTAX: LOOP +DESCRIPTION: Bottom of a DO - LOOP structure. If the loop + is not terminated by EXIT DO or DO UNTIL or + DO WHILE, then it will loop forever. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: MAT WRITE arrayname +DESCRIPTION: Matrix write. +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. +------------------------------------------------------------ + SYNTAX: NAME old$ AS new$ +DESCRIPTION: Changes the name of an existing file. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS [#] fileenumber + [LEN [=] record-length] +DESCRIPTION: Opens a file for use. + RANDOM requires LEN. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: PUT # file_number , [ byte_number ] , scalar + [,...] +DESCRIPTION: Puts one (or more) values into a BINARY file. +------------------------------------------------------------ + SYNTAX: PUT # file_number [ , record_number ] +DESCRIPTION: Puts one (or more) values into a RANDOM file. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENAME from$ TO to$ +DESCRIPTION: Rename a file. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: REPEAT +DESCRIPTION: Top of a REPEAT - UNTIL structure. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SELECT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: SELECT CASE value +DESCRIPTION: Introduces a multi-line conditional selection + statement. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SUB name [ ( parameter [,...] ) ] +DESCRIPTION: Top line of a multi-line SUB definition. The + variable names specified are local to the SUB + definition, and are initialized BYVAL when + the subroutine is invoked by another routine. +------------------------------------------------------------ + SYNTAX: SUB END +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. Same as END SUB. +------------------------------------------------------------ + SYNTAX: SUB EXIT +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. Same as EXIT SUB. +------------------------------------------------------------ + SYNTAX: SUBEND +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. Same as END SUB. +------------------------------------------------------------ + SYNTAX: SUBEXIT +DESCRIPTION: Immediately exits the inner-most multi-line + SUB strucure. Same as EXIT SUB. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: UNTIL value +DESCRIPTION: Bottom of a REPEAT - UNTIL. If the value is + non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = BIN$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the binary (base 2) representation of X. +------------------------------------------------------------ + SYNTAX: S$ = BIN$( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The the binary (base 2) representation of X. + The result will be at least Y digits long. +------------------------------------------------------------ + SYNTAX: N = CHDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Changes to the directory named to A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLOSE +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = CLS +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = CODE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, CODE("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = COLOR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sets the foreground text color to X, and the + background text color to Y. +------------------------------------------------------------ + SYNTAX: S$ = COMMAND$ +DESCRIPTION: All command line parameters, concatenated with + one space between each. Support for + parameters varies by operating system, + compiler, and so on. +------------------------------------------------------------ + SYNTAX: S$ = COMMAND$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The command line parameters. COMMAND$(0) is + the BASIC program name. COMMAND$(1) is the + first parameter after the BASIC program name, + and so on. Support for parameters varies by + operating system, compiler, and so on. X in + [0..9] +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: S$ = EDIT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Edits the characters of A$, according to the + bits set in X. + 1 = discard parity bit. + 2 = discard all spaces. + 4 = discard all carriage returns, line feeds, + form feeds, deletes, escapes and nulls. + 8 = discard leading spaces. + 16 = replace multiple spaces with one space. + 32 = change lower case to upper case. + 64 = change [ to ( and change ] to ). + 128 = discard trailing spacess. + 256 = suppress editing within quotes. + The order in which edits occur is + implementation defined. +------------------------------------------------------------ + SYNTAX: N = ENVIRON( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Sends the environment variable expression + contained in A$ to the host operating system. + A$ must contain the "=" character. +------------------------------------------------------------ + SYNTAX: S$ = ENVIRON$( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the environment variable named + A$. +------------------------------------------------------------ + SYNTAX: N = EOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If device number X is at the end-of-file, then + -1, otherwise 0. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FALSE +DESCRIPTION: The value of FALSE. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = FP( X ) + PARAMETER: X is a number +DESCRIPTION: The fractional part of X, i.e. X - IP(X). +------------------------------------------------------------ + SYNTAX: N = FRAC( X ) + PARAMETER: X is a number +DESCRIPTION: The fractional part of X, i.e. X - IP(X). +------------------------------------------------------------ + SYNTAX: N = FREEFILE +DESCRIPTION: The next available file number. +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets the next available record. +------------------------------------------------------------ + SYNTAX: N = GET( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. The result will be at least Y digits + long. +------------------------------------------------------------ + SYNTAX: N = HOME +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X characters, read from the + terminal. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The string of X characters, read from file Y. +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = INT%( X ) + PARAMETER: X is a number +DESCRIPTION: The rounded integer valuet of X. +------------------------------------------------------------ + SYNTAX: N = IP( X ) + PARAMETER: X is a number +DESCRIPTION: The integer part of X, i.e., + SGN(X)*INT(ABS(X)). +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: S$ = LCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOCATE( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. +------------------------------------------------------------ + SYNTAX: N = LOCK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Lock file number X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG10( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG2( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The base 2 logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = LOWER$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. +------------------------------------------------------------ + SYNTAX: S$ = LTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + leading space characters. +------------------------------------------------------------ + SYNTAX: N = MATCH( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = MKDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Makes the directory named in A$. +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the octal (base 8) representation of X. +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The the octal (base 8) representation of X. + The result will be at least Y digits long. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Default the + record length. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$, Y ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Y is the + record length. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PI +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the first character of + A$. If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts the next available record. +------------------------------------------------------------ + SYNTAX: N = PUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = RAD( X ) + PARAMETER: X is a number +DESCRIPTION: The number of radians in X degrees. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = RTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + trailing space characters. +------------------------------------------------------------ + SYNTAX: S$ = SEG$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SHELL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SLEEP( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then SLEEP + does nothing. The resolution is + implementation defined. +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = STRIP$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: Return the string with the eighth bit of each + character cleared. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TIME +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = TIMER +DESCRIPTION: The time in the system clock in seconds + elapsed since midnight. +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = TRUE +DESCRIPTION: The value of TRUE. +------------------------------------------------------------ + SYNTAX: S$ = UCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. +------------------------------------------------------------ + SYNTAX: N = UNLOCK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Unlock file number X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: S$ = UPPER$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Waits for the value of (INP(X) AND Y) to + become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y, Z ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] + PARAMETER: Z is a number, [0,255] +DESCRIPTION: Waits for the value of ((INP(X) XOR Z) AND Y) + to become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For console, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. +------------------------------------------------------------ + SYNTAX: N = ZONE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Sets the width of the print zones. +------------------------------------------------------------ + SYNTAX: N = ZONE( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: X is ignored. Y sets the width of the print + zones. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/HANDBOOK1.txt b/DOCS/HANDBOOK1.txt new file mode 100644 index 0000000..6bdf0ed --- /dev/null +++ b/DOCS/HANDBOOK1.txt @@ -0,0 +1,1562 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "HANDBOOK1" +REM INTERNAL ID: HB1 +REM DESCRIPTION: The BASIC Handbook, 1st Edition +REM REFERENCE: The BASIC Handbook: Encyclopedia of the BASIC Computer Language +REM by David A. Lien +REM (c) 1978, Compusoft Publishing +REM ISBN 0-932760-00-7 +REM (1st Edition) 364 pages +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%Y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT "@" +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: AUTO [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates AUTO mode. + Regardless whether the line exists, entering + the command MAN will terminate AUTO mode. + AUTO mode is also terminated by any ERROR or + by pressing control-C. +------------------------------------------------------------ + SYNTAX: BREAK line [, ...]] +DESCRIPTION: Diagnostic command to stop execution at the + specified line(s). BREAK only applies to + user-numbered lines. For multi-statement + lines, BREAK only applies to the first + statement. BREAK effectively inserts a + hidden STOP command immediately after the + line number. Once a BREAK occurrs on a + specified line, it is automatically removed. + To remove all existing BREAKs, execute BREAK + without any line numbers. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: CLOAD* arrayname +DESCRIPTION: Loads a numeric array from a file saved using + CSAVE*. +------------------------------------------------------------ + SYNTAX: CLR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: CSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: CSAVE* ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by CLOAD*. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: DSP variable [, ...]] +DESCRIPTION: Diagnostic command to display the value every + time the variable is assigned. To remove all + existing DSPs, execute DSP without any + variables. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: IMAGE "format string" +DESCRIPTION: Provides format string for PRINT USING + linenum. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: MAT WRITE arrayname +DESCRIPTION: Matrix write. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RENUMBER +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: TEXT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TRACE +DESCRIPTION: Enables tracing. +------------------------------------------------------------ + SYNTAX: TRACE OFF +DESCRIPTION: Disables tracing. +------------------------------------------------------------ + SYNTAX: TRACE ON +DESCRIPTION: Enables tracing. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ARCTAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ARCTAN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASC( A$, X ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The numeric code of the Xth character in A$. + Same as ASC(MID$(A$,X)). +------------------------------------------------------------ + SYNTAX: N = ASN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASN(X) <= PI/2; X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ATAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATAN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CDBL( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The double-precision value of X. +------------------------------------------------------------ + SYNTAX: S$ = CHAR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The string Y bytes long consisting of CHR$(X). + Same as STRING$(Y,X). +------------------------------------------------------------ + SYNTAX: S$ = CHAR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHAR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: S$ = CHR( X ) + PARAMETER: X is a number +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR(65) returns "A". +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = CLK( X ) + PARAMETER: X is a number +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of CLK + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of CLK shall + be "99:99:99". The value of TIME$ at + midnight is "00:00:00". The value of + parameter X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = CLK$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = CLOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = CLS +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSNG( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The single-precision value of X. +------------------------------------------------------------ + SYNTAX: N = DEG +DESCRIPTION: Configures the math functions to accept and + return angles in degrees. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERROR( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Simulate the error number in X. +------------------------------------------------------------ + SYNTAX: N = ERROR( X, A$ ) + PARAMETER: X is a number, [0,255] + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: Simulate the error number in X, with a custom + message in A$. +------------------------------------------------------------ + SYNTAX: N = EXAM( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FETCH( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = FILL( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = FREE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FREE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = FREE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = HOME +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: S$ = LEFT( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LGT( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = LIN( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string X bytes long of newline characters. +------------------------------------------------------------ + SYNTAX: N = LN( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG10( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOGE( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = MEM +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: S$ = MID( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = NOTRACE +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PDL( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PI +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter. +------------------------------------------------------------ + SYNTAX: N = PIN( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = RAD +DESCRIPTION: Configures the math functions to accept and + return angles in radians. +------------------------------------------------------------ + SYNTAX: N = RADIAN +DESCRIPTION: Configures the math functions to accept and + return angles in radians. +------------------------------------------------------------ + SYNTAX: N = RAN +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RAN( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RANDOM +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOM( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RESET +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SLEEP( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then SLEEP + does nothing. The resolution is + implementation defined. +------------------------------------------------------------ + SYNTAX: S$ = SPA( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPACE( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: N = SQRT( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: N = STUFF( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TI +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: S$ = TI$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = TIM +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = TIM( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: If X is 0, returns minutes in current hour. + If X is 1, returns hours in current day. If + X is 2, returns days in current year. If X + is 3, returns years since 1900. Any other + value for X is an ERROR. +------------------------------------------------------------ + SYNTAX: N = TIME +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = TIME( X ) + PARAMETER: X is a number +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). The value of the parameter + X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = TRACE +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: N = VTAB( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Savme as LOCATE X, 1. +------------------------------------------------------------ + SYNTAX: N = WAIT( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then WAIT does + nothing. The resolution is implementation + defined. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Waits for the value of (INP(X) AND Y) to + become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y, Z ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] + PARAMETER: Z is a number, [0,255] +DESCRIPTION: Waits for the value of ((INP(X) XOR Z) AND Y) + to become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X [ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + + diff --git a/DOCS/HANDBOOK2.txt b/DOCS/HANDBOOK2.txt new file mode 100644 index 0000000..dfaf5fc --- /dev/null +++ b/DOCS/HANDBOOK2.txt @@ -0,0 +1,2004 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "HANDBOOK2" +REM INTERNAL ID: HB2 +REM DESCRIPTION: The BASIC Handbook, 2nd Edition +REM REFERENCE: The BASIC Handbook: Encyclopedia of the BASIC Computer Language +REM by David A. Lien +REM (c) 1981, CompuSoft Publishing +REM ISBN 0-932760-05-8 +REM (2nd Edition) 480 pages +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%Y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT "@" +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program; lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: AUTO [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates AUTO mode. + Regardless whether the line exists, entering + the command MAN will terminate AUTO mode. + AUTO mode is also terminated by any ERROR or + by pressing control-C. +------------------------------------------------------------ + SYNTAX: BREAK line [, ...]] +DESCRIPTION: Diagnostic command to stop execution at the + specified line(s). BREAK only applies to + user-numbered lines. For multi-statement + lines, BREAK only applies to the first + statement. BREAK effectively inserts a + hidden STOP command immediately after the + line number. Once a BREAK occurrs on a + specified line, it is automatically removed. + To remove all existing BREAKs, execute BREAK + without any line numbers. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CALL subname( [parameter [, ...] ] ) +DESCRIPTION: Calls a subroutine that was defined by SUB and + END SUB. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CHANGE A$ TO X +DESCRIPTION: Changes a string to a numeric array. +------------------------------------------------------------ + SYNTAX: CHANGE X TO A$ +DESCRIPTION: Changes a numeric array to a string. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: CLOAD* arrayname +DESCRIPTION: Loads a numeric array from a file saved using + CSAVE*. +------------------------------------------------------------ + SYNTAX: CLR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: CSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: CSAVE* ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by CLOAD*. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: DSP variable [, ...]] +DESCRIPTION: Diagnostic command to display the value every + time the variable is assigned. To remove all + existing DSPs, execute DSP without any + variables. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. +------------------------------------------------------------ + SYNTAX: EXCHANGE variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: EXIT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: EXIT FOR +DESCRIPTION: Immediately exits the inner-most FOR-NEXT + strucure. +------------------------------------------------------------ + SYNTAX: EXIT REPEAT +DESCRIPTION: Exit a REPEAT - UNTIL structure. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOODBYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: IMAGE "format string" +DESCRIPTION: Provides format string for PRINT USING + linenum. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LLIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the printer on stderr. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MARGIN # filenumber, width +DESCRIPTION: Sets the file margin for writing; filenumber + <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: MAT WRITE arrayname +DESCRIPTION: Matrix write. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS [#] fileenumber + [LEN [=] record-length] +DESCRIPTION: Opens a file for use. + RANDOM requires LEN. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: POP +DESCRIPTION: Pops one GOSUB from the return stack. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: RECALL ArrayName +DESCRIPTION: Loads a numeric array from a file saved using + STORE. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RENUMBER +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: REPEAT +DESCRIPTION: Top of a REPEAT - UNTIL structure. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SCRATCH [# X] +DESCRIPTION: SCRATCH Deletes the program in memory and + clears all variables. SCRATCH # X Sets the + file mode to writing. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: STORE ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by RECALL. +------------------------------------------------------------ + SYNTAX: SUB name [ ( parameter [,...] ) ] +DESCRIPTION: Top line of a multi-line SUB definition. The + variable names specified are local to the SUB + definition, and are initialized BYVAL when + the subroutine is invoked by another routine. +------------------------------------------------------------ + SYNTAX: SUBEND +DESCRIPTION: Specifies the last line of a multi-line SUB + definition. Same as END SUB. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: TEXT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TRACE +DESCRIPTION: Enables tracing. +------------------------------------------------------------ + SYNTAX: TRACE OFF +DESCRIPTION: Disables tracing. +------------------------------------------------------------ + SYNTAX: TRACE ON +DESCRIPTION: Enables tracing. +------------------------------------------------------------ + SYNTAX: TSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: UNTIL value +DESCRIPTION: Bottom of a REPEAT - UNTIL. If the value is + non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ACS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACS(X) <= PI. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ACSD( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in degrees, where 0 <= + ACSD(X) <= 180. X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ACSG( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in gradians, where 0 <= + ACS(X) <= 200. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ARCSIN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ARCSIN(X) <= PI/2; X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ARCTAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ARCTAN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASC( A$, X ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The numeric code of the Xth character in A$. + Same as ASC(MID$(A$,X)). +------------------------------------------------------------ + SYNTAX: N = ASCII( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASCII("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASN(X) <= PI/2; X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ASND( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in degrees, where -90 <= + ASN(X) <= 90; X shall be in the range -1 <= X + <= 1. +------------------------------------------------------------ + SYNTAX: N = ASNG( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in gradians, where -100 <= + ASNG(X) <= 100; X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ATAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATAN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ATND( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in degrees, i.e. the angle + whose tangent is X, where -90 < ATND(X) < 90. +------------------------------------------------------------ + SYNTAX: N = ATNG( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in gradians, i.e. the + angle whose tangent is X, where -100 < + ATND(X) < 100. +------------------------------------------------------------ + SYNTAX: N = CDBL( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The double-precision value of X. +------------------------------------------------------------ + SYNTAX: S$ = CHAR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The string Y bytes long consisting of CHR$(X). + Same as STRING$(Y,X). +------------------------------------------------------------ + SYNTAX: S$ = CHAR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHAR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: S$ = CHR( X ) + PARAMETER: X is a number +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR(65) returns "A". +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = CLK( X ) + PARAMETER: X is a number +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of CLK + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of CLK shall + be "99:99:99". The value of TIME$ at + midnight is "00:00:00". The value of + parameter X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = CLK$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = CLOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = CLS +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = CODE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, CODE("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COSD( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in degrees. +------------------------------------------------------------ + SYNTAX: N = COSG( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in gradians. +------------------------------------------------------------ + SYNTAX: N = COUNT +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = CSH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. +------------------------------------------------------------ + SYNTAX: N = CSNG( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The single-precision value of X. +------------------------------------------------------------ + SYNTAX: S$ = CUR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. +------------------------------------------------------------ + SYNTAX: N = DEG +DESCRIPTION: Configures the math functions to accept and + return angles in degrees. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = DEGREE +DESCRIPTION: Configures the math functions to accept and + return angles in degrees. +------------------------------------------------------------ + SYNTAX: N = DEGREE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: N = DIGITS( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: X is the number of significiant digits to + print for numbers (0..17). If X = 0 then + disabled. Y is the number of decimal places + to round (0..17). If Y = 0 then disabled. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERRL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERRN +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERROR( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Simulate the error number in X. +------------------------------------------------------------ + SYNTAX: N = ERROR( X, A$ ) + PARAMETER: X is a number, [0,255] + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: Simulate the error number in X, with a custom + message in A$. +------------------------------------------------------------ + SYNTAX: N = EXAM( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FETCH( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = FILL( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = FLOW +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = FRAC( X ) + PARAMETER: X is a number +DESCRIPTION: The fractional part of X, i.e. X - IP(X). +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = FREE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FREE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = FREE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = GRAD +DESCRIPTION: Configures the math functions to accept and + return angles in gradians. +------------------------------------------------------------ + SYNTAX: N = GRADIAN +DESCRIPTION: Configures the math functions to accept and + return angles in gradians. +------------------------------------------------------------ + SYNTAX: N = HOME +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = INDEX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X characters, read from the + terminal. +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: S$ = KEY +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: S$ = KEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: S$ = LEFT( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LGT( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = LIN( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string X bytes long of newline characters. +------------------------------------------------------------ + SYNTAX: N = LN( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG10( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOGE( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = MAX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MEM +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: S$ = MID( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MIN( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: N = NOFLOW +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = NOTRACE +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = NUM +DESCRIPTION: The number of values processed by the last MAT + INPUT. Zero means error. +------------------------------------------------------------ + SYNTAX: N = NUM( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, NUM( " 123.5 " ) = 123.5, NUM( + "2.E-99" ) could be zero, and NUM( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PAUSE( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then PAUSE + does nothing. The resolution is + implementation defined. +------------------------------------------------------------ + SYNTAX: N = PDL( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PI +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter. +------------------------------------------------------------ + SYNTAX: N = PI( X ) + PARAMETER: X is a number +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter, + times X. +------------------------------------------------------------ + SYNTAX: N = PIN( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the first character of + A$. If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = POS( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: N = PRECISION( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: X is the number of decimal places to round + (0..17). If X = 0 then disabled. +------------------------------------------------------------ + SYNTAX: N = RAD +DESCRIPTION: Configures the math functions to accept and + return angles in radians. +------------------------------------------------------------ + SYNTAX: N = RAD( X ) + PARAMETER: X is a number +DESCRIPTION: The number of radians in X degrees. +------------------------------------------------------------ + SYNTAX: N = RADIAN +DESCRIPTION: Configures the math functions to accept and + return angles in radians. +------------------------------------------------------------ + SYNTAX: N = RAN +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RAN( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RANDOM +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOM( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RESET +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = SEG( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = SEG$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SIND( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in degrees. +------------------------------------------------------------ + SYNTAX: N = SING( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in gradians. +------------------------------------------------------------ + SYNTAX: N = SINH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. +------------------------------------------------------------ + SYNTAX: N = SLEEP( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then SLEEP + does nothing. The resolution is + implementation defined. +------------------------------------------------------------ + SYNTAX: N = SNH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. +------------------------------------------------------------ + SYNTAX: S$ = SPA( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPACE( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: N = SQRT( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: N = STUFF( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TAND( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in degrees. +------------------------------------------------------------ + SYNTAX: N = TANG( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in gradians. +------------------------------------------------------------ + SYNTAX: N = TANH( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic tangent of X. +------------------------------------------------------------ + SYNTAX: N = TI +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: S$ = TI$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = TIM +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = TIM( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: If X is 0, returns minutes in current hour. + If X is 1, returns hours in current day. If + X is 2, returns days in current year. If X + is 3, returns years since 1900. Any other + value for X is an ERROR. +------------------------------------------------------------ + SYNTAX: N = TIME +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = TIME( X ) + PARAMETER: X is a number +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). The value of the parameter + X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: S$ = TIME$( X ) + PARAMETER: X is a number +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = TOP +DESCRIPTION: The address of the top of available memory. + This function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = TRACE +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: N = VTAB( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Savme as LOCATE X, 1. +------------------------------------------------------------ + SYNTAX: N = WAIT( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then WAIT does + nothing. The resolution is implementation + defined. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Waits for the value of (INP(X) AND Y) to + become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y, Z ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] + PARAMETER: Z is a number, [0,255] +DESCRIPTION: Waits for the value of ((INP(X) XOR Z) AND Y) + to become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X [ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X & Y +DESCRIPTION: Concatenation + PRECEDENCE: 8 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X XRA Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + + diff --git a/DOCS/HEATH.txt b/DOCS/HEATH.txt new file mode 100644 index 0000000..c5c93ee --- /dev/null +++ b/DOCS/HEATH.txt @@ -0,0 +1,1110 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "HEATH" +REM INTERNAL ID: H80 +REM DESCRIPTION: Heath Benton Harbor BASIC +REM REFERENCE: Extended Benton Harbor BASIC +REM by Heath Company +REM (c) 1980, Heath Company +REM http://www.lesbird.com/sebhc/documentation/software/HDOS-2/ +REM HDOS_Reference_Chapter6.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 0 +OPTION DATE "" +OPTION TIME "" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: BUILD [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates BUILD mode. + Regardless whether the line exists, entering + the command MAN will terminate BUILD mode. + BUILD mode is also terminated by any ERROR or + by pressing control-C. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CONTINUE +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: INPUT LINE variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE # filenum , variable$ +DESCRIPTION: Reads entire line from a file into variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE "prompt string" , variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$ after displaying a prompt +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPEN filename + FOR READ|WRITE|VIRTUAL + AS FILE filenumber +DESCRIPTION: Opens a file for use. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: REPLACE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SCRATCH [# X] +DESCRIPTION: SCRATCH Deletes the program in memory and + clears all variables. SCRATCH # X Sets the + file mode to writing. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CIN( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If file # X is <= 0 then returns -1. If file + # X is not opened for reading then returns + -1. If file # X is at EOF then returns -1, + Otherwise returns the next byte value read + from file X. +------------------------------------------------------------ + SYNTAX: N = CLOSE +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = CNTRL( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: CNTRL 1,Y sets the number of significant + digits to print. CNTRL 3,Y sets the width of + the print zones. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = EOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If device number X is at the end-of-file, then + -1, otherwise 0. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FREE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LNO( X ) + PARAMETER: X is a number +DESCRIPTION: Returns X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = MATCH( A$, B$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The character position, within the value + assocated with A$, of the first character of + the first occurence of the value associated + with B$, starting at the Xth character of A$. + If there is not such occurence, then the + value returned is zero. +------------------------------------------------------------ + SYNTAX: S$ = MAX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MIN( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Default the + record length. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$, Y ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Y is the + record length. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PAD( X ) + PARAMETER: X is a number +DESCRIPTION: Returns zero. +------------------------------------------------------------ + SYNTAX: N = PAUSE( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then PAUSE + does nothing. The resolution is + implementation defined. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PIN( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SEG( X ) + PARAMETER: X is a number +DESCRIPTION: Returns zero. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = UNSAVE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + + diff --git a/DOCS/MARK-I.txt b/DOCS/MARK-I.txt new file mode 100644 index 0000000..a4e4100 --- /dev/null +++ b/DOCS/MARK-I.txt @@ -0,0 +1,1064 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "MARK-I" +REM INTERNAL ID: G65 +REM DESCRIPTION: GE 265 Mainframe BASIC +REM REFERENCE: BASIC LANGUAGE REFERENCE MANUAL +REM by Time-Sharing Service, Information Service Department, General Electric +REM (c) 1965, Trustees of Dartmouth College +REM http://www.bitsavers.org/pdf/ge/MarkI_Timesharing/ +REM 202026A_BASIC_Language_Reference_Manual_Jan1967.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%y" +OPTION TIME "%H:%M" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE ":" +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND # filenumber +DESCRIPTION: Positions filenumber at EOF and sets the file + to writing; filenumber <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: BACKSPACE # X +DESCRIPTION: Points the file to the previous item. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CHANGE A$ TO X +DESCRIPTION: Changes a string to a numeric array. +------------------------------------------------------------ + SYNTAX: CHANGE X TO A$ +DESCRIPTION: Changes a numeric array to a string. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DELIMIT # X, A$ +DESCRIPTION: Sets the delimiter for READ # and WRITE #. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: FILE # X, A$ +DESCRIPTION: If A$ is "*" then closes file # X. If A$ is + not "*" then opens the file named A$ in READ + mode. +------------------------------------------------------------ + SYNTAX: FILES A$[, ...] +DESCRIPTION: If A$ is not "*" opens the file named A$ in + READ mode. The first filename of the first + FILES command is assocated with file number + 1. Note that multiple FILES commands + accumulate. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOODBYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF END # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is at EOF , then branch to line1. If the + file is not at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF MORE # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is not at EOF , then branch to line1. If the + file is at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MARGIN # filenumber, width +DESCRIPTION: Sets the file margin for writing; filenumber + <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT GET filename$, arrayname +DESCRIPTION: Matrix get. +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT PUT filename$, arrayname +DESCRIPTION: Matrix put. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: MAT WRITE arrayname +DESCRIPTION: Matrix write. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENAME [filename$] +DESCRIPTION: Changes the file name which will be used by + SAVE. Does not save the file. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SCRATCH [# X] +DESCRIPTION: SCRATCH Deletes the program in memory and + clears all variables. SCRATCH # X Sets the + file mode to writing. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CATALOG +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = CATALOG( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CLK( X ) + PARAMETER: X is a number +DESCRIPTION: The time elapsed since the previous midnight, + expressed in hours; e.g., the value of CLK at + 3:15 PM is 15.25. If there is no clock + available, then the value of CLK shall be -1. + The value of CLK at midnight shall be zero + (not 24). The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = RANDOM +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TIM( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: If X is 0, returns minutes in current hour. + If X is 1, returns hours in current day. If + X is 2, returns days in current year. If X + is 3, returns years since 1900. Any other + value for X is an ERROR. +------------------------------------------------------------ + SYNTAX: N = UNSAVE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/MARK-II.txt b/DOCS/MARK-II.txt new file mode 100644 index 0000000..963d9d7 --- /dev/null +++ b/DOCS/MARK-II.txt @@ -0,0 +1,1114 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "MARK-II" +REM INTERNAL ID: G67 +REM DESCRIPTION: GE 435 Mainframe BASIC +REM REFERENCE: BASIC Language Reference Manual +REM by Time-Sharing Service, Information Service Department, General Electric +REM (c) 1968, General Electric Company and the Trustees of Dartmouth College +REM http://www.bitsavers.org/pdf/ge/MarkI_Timesharing/ +REM 711224A_BASICLanguageReferenceManual_Nov1970.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%y" +OPTION TIME "%H:%M" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE ":" +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND # filenumber +DESCRIPTION: Positions filenumber at EOF and sets the file + to writing; filenumber <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: BACKSPACE # X +DESCRIPTION: Points the file to the previous item. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CHANGE A$ TO X +DESCRIPTION: Changes a string to a numeric array. +------------------------------------------------------------ + SYNTAX: CHANGE X TO A$ +DESCRIPTION: Changes a numeric array to a string. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DELIMIT # X, A$ +DESCRIPTION: Sets the delimiter for READ # and WRITE #. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: FILE # X, A$ +DESCRIPTION: If A$ is "*" then closes file # X. If A$ is + not "*" then opens the file named A$ in READ + mode. +------------------------------------------------------------ + SYNTAX: FILES A$[, ...] +DESCRIPTION: If A$ is not "*" opens the file named A$ in + READ mode. The first filename of the first + FILES command is assocated with file number + 1. Note that multiple FILES commands + accumulate. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOODBYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF END # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is at EOF , then branch to line1. If the + file is not at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF MORE # filenum THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the file + is not at EOF , then branch to line1. If the + file is at EOF and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MARGIN # filenumber, width +DESCRIPTION: Sets the file margin for writing; filenumber + <= 0 is ignored. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT GET filename$, arrayname +DESCRIPTION: Matrix get. +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT PUT filename$, arrayname +DESCRIPTION: Matrix put. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: MAT WRITE arrayname +DESCRIPTION: Matrix write. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENAME [filename$] +DESCRIPTION: Changes the file name which will be used by + SAVE. Does not save the file. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: SCRATCH [# X] +DESCRIPTION: SCRATCH Deletes the program in memory and + clears all variables. SCRATCH # X Sets the + file mode to writing. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TRACE +DESCRIPTION: Enables tracing. +------------------------------------------------------------ + SYNTAX: TRACE OFF +DESCRIPTION: Disables tracing. +------------------------------------------------------------ + SYNTAX: TRACE ON +DESCRIPTION: Enables tracing. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CATALOG +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = CATALOG( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CLK( X ) + PARAMETER: X is a number +DESCRIPTION: The time elapsed since the previous midnight, + expressed in hours; e.g., the value of CLK at + 3:15 PM is 15.25. If there is no clock + available, then the value of CLK shall be -1. + The value of CLK at midnight shall be zero + (not 24). The value of X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = CLK$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COT( X ) + PARAMETER: X is a number +DESCRIPTION: The cotangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = DAT$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = NUM +DESCRIPTION: The number of values processed by the last MAT + INPUT. Zero means error. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = RANDOM +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TIM +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = TIM( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: If X is 0, returns minutes in current hour. + If X is 1, returns hours in current day. If + X is 2, returns days in current year. If X + is 3, returns years since 1900. Any other + value for X is an ERROR. +------------------------------------------------------------ + SYNTAX: N = UNSAVE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/MBASIC.txt b/DOCS/MBASIC.txt new file mode 100644 index 0000000..4ea25fb --- /dev/null +++ b/DOCS/MBASIC.txt @@ -0,0 +1,1599 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "MBASIC" +REM INTERNAL ID: M80 +REM DESCRIPTION: Microsoft BASIC-80 for Xenix +REM REFERENCE: Microsoft BASIC Reference Manual +REM by Microsoft +REM (c) 1982, Microsoft +REM http://chiclassiccomp.org/docs/content/computing/Microsoft/ +REM Microsoft_Basic_8086Xenix_Reference.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "%m/%d/%Y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: AUTO [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates AUTO mode. + Regardless whether the line exists, entering + the command MAN will terminate AUTO mode. + AUTO mode is also terminated by any ERROR or + by pressing control-C. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: CLOAD* arrayname +DESCRIPTION: Loads a numeric array from a file saved using + CSAVE*. +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: CSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: CSAVE* ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by CLOAD*. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: INPUT LINE variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE # filenum , variable$ +DESCRIPTION: Reads entire line from a file into variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE "prompt string" , variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$ after displaying a prompt +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LLIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the printer on stderr. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MERGE filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program. Lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. +------------------------------------------------------------ + SYNTAX: NAME old$ AS new$ +DESCRIPTION: Changes the name of an existing file. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS [#] fileenumber + [LEN [=] record-length] +DESCRIPTION: Opens a file for use. + RANDOM requires LEN. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CDBL( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The double-precision value of X. +------------------------------------------------------------ + SYNTAX: N = CHDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Changes to the directory named to A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLNG( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The long (32-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLOSE +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = CLS +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = COLOR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sets the foreground text color to X, and the + background text color to Y. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSNG( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The single-precision value of X. +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. +------------------------------------------------------------ + SYNTAX: N = CVL( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(LNG) +DESCRIPTION: The long (32-bit) integer value in A$, which + was created by MKL$. +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = ENVIRON( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Sends the environment variable expression + contained in A$ to the host operating system. + A$ must contain the "=" character. +------------------------------------------------------------ + SYNTAX: S$ = ENVIRON$( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the environment variable named + A$. +------------------------------------------------------------ + SYNTAX: N = EOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If device number X is at the end-of-file, then + -1, otherwise 0. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: S$ = ERR$ +DESCRIPTION: The last error message. +------------------------------------------------------------ + SYNTAX: N = ERROR( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Simulate the error number in X. +------------------------------------------------------------ + SYNTAX: S$ = ERROR$ +DESCRIPTION: The last error message. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FILEATTR( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, if Y = 1 then returns open mode, + otherwise returns zero. +------------------------------------------------------------ + SYNTAX: N = FILES +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = FILES( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets the next available record. +------------------------------------------------------------ + SYNTAX: N = GET( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X characters, read from the + terminal. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The string of X characters, read from file Y. +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: S$ = LCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOCATE( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LPOS +DESCRIPTION: The current cursor position in the line for + the printer. +------------------------------------------------------------ + SYNTAX: S$ = LTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + leading space characters. +------------------------------------------------------------ + SYNTAX: N = LWIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For printer, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = MKDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Makes the directory named in A$. +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKL$( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The internal representation of the long + (32-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = NAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename the file named A$ into B$. +------------------------------------------------------------ + SYNTAX: N = NULL( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Appends X null characters after each line + printed by LPRINT or LLIST. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the octal (base 8) representation of X. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Default the + record length. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$, Y ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Y is the + record length. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts the next available record. +------------------------------------------------------------ + SYNTAX: N = PUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string consisting of X copies of + LEFT$(A$,1); X > 0. +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string consisting of X copies of CHR$(Y); + X > 0. +------------------------------------------------------------ + SYNTAX: N = RESET +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RMDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the directory named in A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = RTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + trailing space characters. +------------------------------------------------------------ + SYNTAX: N = SEEK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = SEEK( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, move to record number Y; the first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SHELL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = TIMER +DESCRIPTION: The time in the system clock in seconds + elapsed since midnight. +------------------------------------------------------------ + SYNTAX: S$ = TRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string resulting from removing both + leading and trailing spaces from A$. +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: S$ = UCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. +------------------------------------------------------------ + SYNTAX: N = USR( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR0( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR1( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR2( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR3( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR4( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR5( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR6( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR7( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR8( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR9( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: N = VARPTR( ... ) +DESCRIPTION: Returns hardware address of variable. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Waits for the value of (INP(X) AND Y) to + become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y, Z ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] + PARAMETER: Z is a number, [0,255] +DESCRIPTION: Waits for the value of ((INP(X) XOR Z) AND Y) + to become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For console, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/PDP-11.txt b/DOCS/PDP-11.txt new file mode 100644 index 0000000..8cf2882 --- /dev/null +++ b/DOCS/PDP-11.txt @@ -0,0 +1,836 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "PDP-11" +REM INTERNAL ID: D70 +REM DESCRIPTION: DEC PDP-11 BASIC +REM REFERENCE: PDP-11 BASIC Programming Manual +REM by Digital Equipement Corporation +REM (c) 1970, Digital Equipement Corporation +REM http://bitsavers.trailing-edge.com/pdf/dec/pdp11/basic/ +REM DEC-11-AJPB-D_PDP-11_BASIC_Programming_Manual_Dec70.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "" +OPTION TIME "" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = EXF( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + + diff --git a/DOCS/PDP-8.txt b/DOCS/PDP-8.txt new file mode 100644 index 0000000..b3da9ad --- /dev/null +++ b/DOCS/PDP-8.txt @@ -0,0 +1,877 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "PDP-8" +REM INTERNAL ID: D73 +REM DESCRIPTION: DEC PDP-8 BASIC +REM REFERENCE: DEC 8K BASIC +REM by Digital Equipement Corporation +REM (c) 1973, Digital Equipement Corporation +REM http://bitsavers.trailing-edge.com/pdf/dec/pdp8/basic/ +REM DEC-08-LBSMA-A-D_8K_BASIC_Jul73.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "" +OPTION TIME "" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT "\" +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LPT [filename$] +DESCRIPTION: Directs the PRINT commands to write to the + printer (stderr), or optionally to the + specified file. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: PTP [filename$] +DESCRIPTION: Directs the PRINT commands to write to the + paper tape punch file ("PTP"), or optionally + to the specified file. +------------------------------------------------------------ + SYNTAX: PTR [filename$] +DESCRIPTION: Directs the INPUT commands to read from the + paper tape reader file ("PTR"), or optionally + from the specified file. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TTY +DESCRIPTION: Directs the PRINT commands to write to the + console (stdout), and the INPUT commands to + read from.the console (stdin). This cancels + LPT, PTP and PTR. +------------------------------------------------------------ + SYNTAX: TTY IN +DESCRIPTION: Directs the INPUT commands to read from.the + console (stdin). This cancels PTR. It does + not cancel LPT or PTP. +------------------------------------------------------------ + SYNTAX: TTY OUT +DESCRIPTION: Directs the PRINT commands to write to the + console (stdout). This cancels LPT or PTP. + It does not cancel PTR. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number +DESCRIPTION: Get character code from input. The value of X + is ignored. Similar to ASC(INKEY$). +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Send character code to output. Returns the + value of X. Similar to PRINT CHR$(X). +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = UUF( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + + diff --git a/DOCS/RBASIC.txt b/DOCS/RBASIC.txt new file mode 100644 index 0000000..50cd869 --- /dev/null +++ b/DOCS/RBASIC.txt @@ -0,0 +1,1262 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "RBASIC" +REM INTERNAL ID: R86 +REM DESCRIPTION: Micronics RBASIC for 6809 FLEX +REM REFERENCE: RBASIC User's Manual +REM by R. Jones +REM (c) 1986, Micronics Research Corp. +REM http://www.evenson-consulting.com/swtpc/downloads/ +REM RBASIC.zip +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 0 +OPTION DATE "%d-%b-%y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT "!" +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program; lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: DOS +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GET # file_number [ , RECORD record_number ] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GET # file_number [ , RECORD record_number ] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: INPUT LINE variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE # filenum , variable$ +DESCRIPTION: Reads entire line from a file into variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE "prompt string" , variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$ after displaying a prompt +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MON +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: OPEN NEW|OLD|VIRTUAL filename$ + AS filenumber +DESCRIPTION: Opens a file for use. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PDEL line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: PUT # file_number [ , RECORD record_number ] +DESCRIPTION: Puts one (or more) values into a file. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ARCCOS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ARCCOS(X) <= PI. X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ARCSIN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ARCSIN(X) <= PI/2; X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ARCTAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ARCTAN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. +------------------------------------------------------------ + SYNTAX: N = CVL( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(LNG) +DESCRIPTION: The long (32-bit) integer value in A$, which + was created by MKL$. +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: When X is zero sets RADIANS. When X is + non-zero sets DEGREES. +------------------------------------------------------------ + SYNTAX: N = DIGITS( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: X is the number of significiant digits to + print for numbers (0..17). If X = 0 then + disabled. +------------------------------------------------------------ + SYNTAX: N = DIGITS( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: X is the number of significiant digits to + print for numbers (0..17). If X = 0 then + disabled. Y is the number of decimal places + to round (0..17). If Y = 0 then disabled. +------------------------------------------------------------ + SYNTAX: N = DPEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = DPOKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = EXEC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = HEX( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric value of the hexadecimal string in + A$. For example, HEX("FFFF") returns 65535. +------------------------------------------------------------ + SYNTAX: S$ = INCH$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKL$( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The internal representation of the long + (32-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = NAME( ... ) +DESCRIPTION: Returns hardware address of variable. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = PTR( ... ) +DESCRIPTION: Returns hardware address of variable. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = RENAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename file A$ to B$. If successful, the + returns -1 else returns 0. +------------------------------------------------------------ + SYNTAX: N = RESIDUE +DESCRIPTION: The residue of the last Integer Divide + operation. The RESIDUE of -17 / 5 is -2. + For X / Y, RESIDUE = CINT( X - Y * CINT( X / + Y ) ). +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SCALE( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: X is the number of decimal places to round + (0..17). If X = 0 then disabled. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TRACE( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: When X is zero turn tracing off. When X is + non-zero turn tracing ON +------------------------------------------------------------ + SYNTAX: N = USR( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR0( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR1( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR2( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR3( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR4( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR5( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR6( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR7( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR8( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR9( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + + diff --git a/DOCS/RSTS-11.txt b/DOCS/RSTS-11.txt new file mode 100644 index 0000000..c8178be --- /dev/null +++ b/DOCS/RSTS-11.txt @@ -0,0 +1,1740 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "RSTS-11" +REM INTERNAL ID: D71 +REM DESCRIPTION: DEC RSTS-11 BASIC-PLUS +REM REFERENCE: RSTS-11 User's Guide : BASIC-PLUS Programming Language +REM by Digital Equipment Corporation +REM (c) 1971, Digital Equipment Corporation +REM http://bitsavers.trailing-edge.com/pdf/dec/pdp11/rsts/ +REM PL-11-71-01-01-A-D_RSTS-11UsersGuide_May71.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 512 +OPTION DATE "%d-%b-%y" +OPTION TIME "%I:%M %p" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "!" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: AUTO [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates AUTO mode. + Regardless whether the line exists, entering + the command MAN will terminate AUTO mode. + AUTO mode is also terminated by any ERROR or + by pressing control-C. +------------------------------------------------------------ + SYNTAX: BYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CHANGE A$ TO X +DESCRIPTION: Changes a string to a numeric array. +------------------------------------------------------------ + SYNTAX: CHANGE X TO A$ +DESCRIPTION: Changes a numeric array to a string. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: CLOAD* arrayname +DESCRIPTION: Loads a numeric array from a file saved using + CSAVE*. +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: CSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: CSAVE* ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by CLOAD*. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GET # file_number [ , RECORD record_number ] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GET # file_number [ , RECORD record_number ] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOODBYE +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: INPUT LINE variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE # filenum , variable$ +DESCRIPTION: Reads entire line from a file into variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE "prompt string" , variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$ after displaying a prompt +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LLIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the printer on stderr. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: MERGE filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program. Lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. +------------------------------------------------------------ + SYNTAX: NAME old$ AS new$ +DESCRIPTION: Changes the name of an existing file. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OLD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS FILE filenumber + [ ,RECORDSIZE ignored ] + [ ,CLUSTERSIZE ignored ] + [ ,MODE ignored ] +DESCRIPTION: Opens a file for use. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: PUT # file_number [ , RECORD record_number ] +DESCRIPTION: Puts one (or more) values into a file. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENAME [filename$] +DESCRIPTION: Changes the file name which will be used by + SAVE. Does not save the file. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASCII( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASCII("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CATALOG +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = CATALOG( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: N = CDBL( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The double-precision value of X. +------------------------------------------------------------ + SYNTAX: N = CHDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Changes to the directory named to A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLNG( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The long (32-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLOSE +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSNG( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The single-precision value of X. +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. +------------------------------------------------------------ + SYNTAX: N = CVL( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(LNG) +DESCRIPTION: The long (32-bit) integer value in A$, which + was created by MKL$. +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: S$ = DATE$( X ) + PARAMETER: X is a number +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. + The value of parameter X is ignored. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: N = ENVIRON( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Sends the environment variable expression + contained in A$ to the host operating system. + A$ must contain the "=" character. +------------------------------------------------------------ + SYNTAX: S$ = ENVIRON$( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the environment variable named + A$. +------------------------------------------------------------ + SYNTAX: N = EOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If device number X is at the end-of-file, then + -1, otherwise 0. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: S$ = ERR$ +DESCRIPTION: The last error message. +------------------------------------------------------------ + SYNTAX: N = ERROR( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Simulate the error number in X. +------------------------------------------------------------ + SYNTAX: S$ = ERROR$ +DESCRIPTION: The last error message. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FILEATTR( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, if Y = 1 then returns open mode, + otherwise returns zero. +------------------------------------------------------------ + SYNTAX: N = FILES +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = FILES( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets the next available record. +------------------------------------------------------------ + SYNTAX: N = GET( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X characters, read from the + terminal. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The string of X characters, read from file Y. +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: S$ = LCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. +------------------------------------------------------------ + SYNTAX: S$ = LEFT( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOCATE( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG10( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LPOS +DESCRIPTION: The current cursor position in the line for + the printer. +------------------------------------------------------------ + SYNTAX: S$ = LTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + leading space characters. +------------------------------------------------------------ + SYNTAX: N = LWIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For printer, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: S$ = MID( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = MKDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Makes the directory named in A$. +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKL$( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The internal representation of the long + (32-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = NAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename the file named A$ into B$. +------------------------------------------------------------ + SYNTAX: N = NULL( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Appends X null characters after each line + printed by LPRINT or LLIST. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the octal (base 8) representation of X. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Default the + record length. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$, Y ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Y is the + record length. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PI +DESCRIPTION: The constant 3.14159 which is the ratio of the + circumference of a circle to its diameter. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts the next available record. +------------------------------------------------------------ + SYNTAX: N = PUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = RANDOM( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string consisting of X copies of + LEFT$(A$,1); X > 0. +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string consisting of X copies of CHR$(Y); + X > 0. +------------------------------------------------------------ + SYNTAX: N = RESET +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RMDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the directory named in A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = RTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + trailing space characters. +------------------------------------------------------------ + SYNTAX: N = SEEK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = SEEK( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, move to record number Y; the first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SHELL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SLEEP( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then SLEEP + does nothing. The resolution is + implementation defined. +------------------------------------------------------------ + SYNTAX: S$ = SPACE( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TIME +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = TIME( X ) + PARAMETER: X is a number +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). The value of the parameter + X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: S$ = TIME$( X ) + PARAMETER: X is a number +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = TIMER +DESCRIPTION: The time in the system clock in seconds + elapsed since midnight. +------------------------------------------------------------ + SYNTAX: S$ = TRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string resulting from removing both + leading and trailing spaces from A$. +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: S$ = UCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. +------------------------------------------------------------ + SYNTAX: N = UNSAVE( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: N = WAIT( X ) + PARAMETER: X is a number +DESCRIPTION: The program pauses for X times the value of + OPTION SLEEP seconds. If the result is zero, + negative, or more than INT_MAX then WAIT does + nothing. The resolution is implementation + defined. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Waits for the value of (INP(X) AND Y) to + become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y, Z ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] + PARAMETER: Z is a number, [0,255] +DESCRIPTION: Waits for the value of ((INP(X) XOR Z) AND Y) + to become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For console, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/SYSTEM-360.txt b/DOCS/SYSTEM-360.txt new file mode 100644 index 0000000..aafc2d5 --- /dev/null +++ b/DOCS/SYSTEM-360.txt @@ -0,0 +1,1089 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "SYSTEM/360" +REM INTERNAL ID: I70 +REM DESCRIPTION: IBM System/360 Mainframe BASIC +REM REFERENCE: BASIC Language Reference Manual +REM by International Business Machines Corporation +REM (c) 1970, International Business Machines Corporation +REM http://bitsavers.org/pdf/ibm/360/os/tso/ +REM GC28-6837-0_BASIC_Language_Ref_Man_Jun70.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 1 +OPTION RECLEN 0 +OPTION DATE "%Y/%m/%d" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE " " +OPTION PUNCT SINGLE " " +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG " " +OPTION PUNCT INTEGER " " +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE ":" +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM " " +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA " " +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "!" +OPTION USING DOLLAR " " +OPTION USING FILLER " " +OPTION USING LITERAL " " +OPTION USING FIRST " " +OPTION USING ALL " " +OPTION USING LENGTH " " + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLOSE +DESCRIPTION: Closes all files. +------------------------------------------------------------ + SYNTAX: CLOSE filename$ [, ...] +DESCRIPTION: Closes a file. +------------------------------------------------------------ + SYNTAX: CLOSE filenumber [, ...] +DESCRIPTION: Closes a file. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GET filename$ , scalar [, ...] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IMAGE "format string" +DESCRIPTION: Provides format string for PRINT USING + linenum. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT GET filename$, arrayname +DESCRIPTION: Matrix get. +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT PUT filename$, arrayname +DESCRIPTION: Matrix put. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPEN filenumber, + filename$, + INPUT|OUTPUT|APPEND|VIRTUAL +DESCRIPTION: Opens a file for use. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PAUSE [comment] +DESCRIPTION: Pauses processing until the ENTER key is + presseed. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: PUT filename$ , value [, ...] +DESCRIPTION: Puts one (or more) values into a file. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESET filename$ [, ...] +DESCRIPTION: Positions an input or output file to the + bcginning. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: USE parameter$ +DESCRIPTION: Receives the value from the calling CHAINing + program. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ACS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACS(X) <= PI. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASN(X) <= PI/2; X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR( X ) + PARAMETER: X is a number +DESCRIPTION: The output of PRINT X. A$ = CHR(X) is the + opposite of X = NUM(A$). +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COT( X ) + PARAMETER: X is a number +DESCRIPTION: The cotangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSC( X ) + PARAMETER: X is a number +DESCRIPTION: The cosecant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = HCS( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. +------------------------------------------------------------ + SYNTAX: N = HSN( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. +------------------------------------------------------------ + SYNTAX: N = HTN( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic tangent of X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LGT( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LTW( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The base 2 logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = MAX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MIN( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: N = NUM( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, NUM( " 123.5 " ) = 123.5, NUM( + "2.E-99" ) could be zero, and NUM( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = RAD( X ) + PARAMETER: X is a number +DESCRIPTION: The number of radians in X degrees. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SEC( X ) + PARAMETER: X is a number +DESCRIPTION: The secant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TIM +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/SYSTEM-370.txt b/DOCS/SYSTEM-370.txt new file mode 100644 index 0000000..c63dde9 --- /dev/null +++ b/DOCS/SYSTEM-370.txt @@ -0,0 +1,1089 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "SYSTEM/370" +REM INTERNAL ID: I73 +REM DESCRIPTION: IBM System/370 Mainframe BASIC +REM REFERENCE: IBM Virtual Machine Facility/370: BASIC Language Reference Manual +REM by International Business Machines Corporation +REM (c) 1973, International Business Machines Corporation +REM http://bitsavers.trailing-edge.com/pdf/ibm/370/VM_370/Release_1/ +REM GC20-1803-1_VM370_BASIC_Language_Reference_Manual_Rel_1_Apr73.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS OFF +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 1 +OPTION RECLEN 0 +OPTION DATE "%Y/%m/%d" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE " " +OPTION PUNCT SINGLE " " +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG " " +OPTION PUNCT INTEGER " " +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT " " +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE ":" +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM " " +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA " " +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "!" +OPTION USING DOLLAR " " +OPTION USING FILLER " " +OPTION USING LITERAL " " +OPTION USING FIRST " " +OPTION USING ALL " " +OPTION USING LENGTH " " + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLOSE +DESCRIPTION: Closes all files. +------------------------------------------------------------ + SYNTAX: CLOSE filename$ [, ...] +DESCRIPTION: Closes a file. +------------------------------------------------------------ + SYNTAX: CLOSE filenumber [, ...] +DESCRIPTION: Closes a file. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GET filename$ , scalar [, ...] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IMAGE "format string" +DESCRIPTION: Provides format string for PRINT USING + linenum. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LISTNH line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MAT arrayname = value +DESCRIPTION: Matrix operations: + MAT A = CON + MAT A = IDN + MAT A = ZER + MAT A = INV B + MAT A = TRN B + MAT A = (k) * B + MAT A = B + MAT A = B + C + MAT A = B - C + MAT A = B * C +------------------------------------------------------------ + SYNTAX: MAT GET filename$, arrayname +DESCRIPTION: Matrix get. +------------------------------------------------------------ + SYNTAX: MAT INPUT arrayname +DESCRIPTION: Matrix input. +------------------------------------------------------------ + SYNTAX: MAT PRINT arrayname +DESCRIPTION: Matrix print. +------------------------------------------------------------ + SYNTAX: MAT PUT filename$, arrayname +DESCRIPTION: Matrix put. +------------------------------------------------------------ + SYNTAX: MAT READ arrayname +DESCRIPTION: Matrix read. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPEN filenumber, + filename$, + INPUT|OUTPUT|APPEND|VIRTUAL +DESCRIPTION: Opens a file for use. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PAUSE [comment] +DESCRIPTION: Pauses processing until the ENTER key is + presseed. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: PUT filename$ , value [, ...] +DESCRIPTION: Puts one (or more) values into a file. +------------------------------------------------------------ + SYNTAX: QUIT +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESET filename$ [, ...] +DESCRIPTION: Positions an input or output file to the + bcginning. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: RUNNH line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUNNH filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUNNH +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: USE parameter$ +DESCRIPTION: Receives the value from the calling CHAINing + program. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ACS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ACS(X) <= PI. X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ASN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ASN(X) <= PI/2; X shall be in the range -1 <= + X <= 1. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR( X ) + PARAMETER: X is a number +DESCRIPTION: The output of PRINT X. A$ = CHR(X) is the + opposite of X = NUM(A$). +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = COT( X ) + PARAMETER: X is a number +DESCRIPTION: The cotangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSC( X ) + PARAMETER: X is a number +DESCRIPTION: The cosecant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = DEG( X ) + PARAMETER: X is a number +DESCRIPTION: The number of degrees in X radians. +------------------------------------------------------------ + SYNTAX: N = DET +DESCRIPTION: The determinant of the last MAT INV. Zero + means error. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = HCS( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic cosine of X. +------------------------------------------------------------ + SYNTAX: N = HSN( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic sine of X. +------------------------------------------------------------ + SYNTAX: N = HTN( X ) + PARAMETER: X is a number +DESCRIPTION: The hyperbolic tangent of X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LGT( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The common logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LTW( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The base 2 logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = MAX( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MAX( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The larger of the parameters. +------------------------------------------------------------ + SYNTAX: N = MIN( X, Y ) + PARAMETER: X is a number + PARAMETER: Y is a number +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: S$ = MIN( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The smaller of the parameters. +------------------------------------------------------------ + SYNTAX: N = NUM( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, NUM( " 123.5 " ) = 123.5, NUM( + "2.E-99" ) could be zero, and NUM( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: N = RAD( X ) + PARAMETER: X is a number +DESCRIPTION: The number of radians in X degrees. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SEC( X ) + PARAMETER: X is a number +DESCRIPTION: The secant of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TIM +DESCRIPTION: The time elapsed since the previous midnight, + expressed in seconds; e.g., the value of TIME + at 11:15 AM is 40500. If there is no clock + available, then the value of TIME shall be + -1. The value of TIME at midnight shall be + zero (not 86400). +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ** Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/TRS-80.txt b/DOCS/TRS-80.txt new file mode 100644 index 0000000..d3db636 --- /dev/null +++ b/DOCS/TRS-80.txt @@ -0,0 +1,1604 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "TRS-80" +REM INTERNAL ID: T80 +REM DESCRIPTION: TRS-80 Model I/III/4 LBASIC +REM REFERENCE: LBASIC USER'S GUIDE +REM by Galactic Software, Ltd. +REM (c) 1981, Galactic Software, Ltd. +REM http://www.tim-mann.org/trs80/doc/ +REM lbasic.txt +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "" +OPTION TIME "%m/%d/%y %H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT "'" +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT "@" +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "%" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: AUTO [start [, increment]] +DESCRIPTION: Automatic line numbering for manual program + entry. If the line already exists, then an + asterisk is displayed and pressing ENTER + leaves the line as-is. If the line does not + exist, then an asterisk is not displayed and + pressing ENTER terminates AUTO mode. + Regardless whether the line exists, entering + the command MAN will terminate AUTO mode. + AUTO mode is also terminated by any ERROR or + by pressing control-C. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CLOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: CLOAD* arrayname +DESCRIPTION: Loads a numeric array from a file saved using + CSAVE*. +------------------------------------------------------------ + SYNTAX: COMMON variable [, ...] +DESCRIPTION: Designates variables to be passed to a CHAINed + program. +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: CSAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: CSAVE* ArrayName +DESCRIPTION: Saves a numeric array into a file for later + loading by CLOAD*. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] +DESCRIPTION: Defines a multiline function. Multi-line DEF + functions do not have an equal sign and must + end with FNEND. +------------------------------------------------------------ + SYNTAX: DEFDBL letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFINT letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSNG letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + numeric variables. +------------------------------------------------------------ + SYNTAX: DEFSTR letter[-letter] [, ...] +DESCRIPTION: Declares variables with single-letter names as + string variables. +------------------------------------------------------------ + SYNTAX: DELETE line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: ERASE variable [, ...] +DESCRIPTION: Eliminates arrayed variables from a program. +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. +------------------------------------------------------------ + SYNTAX: FNEND +DESCRIPTION: Specifies the last line of a multi-line DEF + function. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: INPUT LINE variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE # filenum , variable$ +DESCRIPTION: Reads entire line from a file into variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE "prompt string" , variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$ after displaying a prompt +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LLIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the printer on stderr. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LPRINT [USING format-string$;] value ... +DESCRIPTION: Send output to the printer (stderr). +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: MERGE filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program. Lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: MID$( variable$, start [, count ] ) = value +DESCRIPTION: Replaces a subtring of variable$ with value. +------------------------------------------------------------ + SYNTAX: NAME old$ AS new$ +DESCRIPTION: Changes the name of an existing file. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: OPEN filename$ + FOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL + AS [#] fileenumber + [LEN [=] record-length] +DESCRIPTION: Opens a file for use. + RANDOM requires LEN. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: WEND +DESCRIPTION: Bottom of a WHILE - WEND structure. +------------------------------------------------------------ + SYNTAX: WHILE value +DESCRIPTION: Top of a WHILE - WEND structure. If the value + is non-zero, then the loop is terminated. +------------------------------------------------------------ + SYNTAX: WRITE # filenum, value [, .... ] +DESCRIPTION: Outputs value to a file. Strings are quoted + and each value is seperated by a omma. +------------------------------------------------------------ + SYNTAX: WRITE value [, .... ] +DESCRIPTION: Outputs value to the screen. Strings are + quoted and each value is seperated by a + comma. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = CDBL( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The double-precision value of X. +------------------------------------------------------------ + SYNTAX: N = CHDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Changes to the directory named to A$. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CINT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The short (16-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLNG( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The long (32-bit) integer value of X. +------------------------------------------------------------ + SYNTAX: N = CLOSE +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = CLS +DESCRIPTION: Clears the screen. Cursor is positioned at row + 1, column 1. +------------------------------------------------------------ + SYNTAX: N = COLOR( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sets the foreground text color to X, and the + background text color to Y. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CSNG( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The single-precision value of X. +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. +------------------------------------------------------------ + SYNTAX: N = CVL( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(LNG) +DESCRIPTION: The long (32-bit) integer value in A$, which + was created by MKL$. +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = ENVIRON( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Sends the environment variable expression + contained in A$ to the host operating system. + A$ must contain the "=" character. +------------------------------------------------------------ + SYNTAX: S$ = ENVIRON$( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the environment variable named + A$. +------------------------------------------------------------ + SYNTAX: N = EOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: If device number X is at the end-of-file, then + -1, otherwise 0. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: S$ = ERR$ +DESCRIPTION: The last error message. +------------------------------------------------------------ + SYNTAX: N = ERROR( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Simulate the error number in X. +------------------------------------------------------------ + SYNTAX: S$ = ERROR$ +DESCRIPTION: The last error message. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FILEATTR( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, if Y = 1 then returns open mode, + otherwise returns zero. +------------------------------------------------------------ + SYNTAX: N = FILES +DESCRIPTION: Displays all the file names. +------------------------------------------------------------ + SYNTAX: N = FILES( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Displays all the file names matching A$. +------------------------------------------------------------ + SYNTAX: N = FIX( X ) + PARAMETER: X is a number +DESCRIPTION: The truncated integer, part of X. FIX (X) is + equivalent to SGN(X)*INT(ABS(X)). The major + difference between FIX and INT is that FIX + does not return the next lower number for + negative X. +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = GET( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets the next available record. +------------------------------------------------------------ + SYNTAX: N = GET( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, gets record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: S$ = HEX$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the hexadecimal (base 16) representation + of X. +------------------------------------------------------------ + SYNTAX: S$ = INKEY$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INP( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The value read from machine port X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X characters, read from the + terminal. +------------------------------------------------------------ + SYNTAX: S$ = INPUT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: The string of X characters, read from file Y. +------------------------------------------------------------ + SYNTAX: N = INSTR( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position 1. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: S$ = LCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters from the value + associatedwith A$ by replacing each + upper-case-letter in the string by its + lower-case version. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOC( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = LOCATE( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Locates the cursor to row X, column Y. +------------------------------------------------------------ + SYNTAX: N = LOF( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The length of file X. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: N = LPOS +DESCRIPTION: The current cursor position in the line for + the printer. +------------------------------------------------------------ + SYNTAX: S$ = LTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + leading space characters. +------------------------------------------------------------ + SYNTAX: N = LWIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For printer, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = MKDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Makes the directory named in A$. +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKL$( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The internal representation of the long + (32-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = NAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename the file named A$ into B$. +------------------------------------------------------------ + SYNTAX: N = NULL( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: Appends X null characters after each line + printed by LPRINT or LLIST. +------------------------------------------------------------ + SYNTAX: S$ = NUM$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = OCT$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The the octal (base 8) representation of X. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Default the + record length. +------------------------------------------------------------ + SYNTAX: N = OPEN( A$, X, B$, Y ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: B$ is a string, LEN >= 1 + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Open file number X. A$ is the mode: "I", "O", + "A", "R". B$ is the file name. Y is the + record length. +------------------------------------------------------------ + SYNTAX: N = OUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware port X. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = PUT( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts the next available record. +------------------------------------------------------------ + SYNTAX: N = PUT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, puts record number Y. The first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE( X ) + PARAMETER: X is a number +DESCRIPTION: Seeds the pseudo-random number generator with + X. +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string consisting of X copies of + LEFT$(A$,1); X > 0. +------------------------------------------------------------ + SYNTAX: S$ = REPEAT$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string consisting of X copies of CHR$(Y); + X > 0. +------------------------------------------------------------ + SYNTAX: N = RESET +DESCRIPTION: Close all open files. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RMDIR( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the directory named in A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: S$ = RTRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by deleting all + trailing space characters. +------------------------------------------------------------ + SYNTAX: N = SEEK( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The location of file X; the next record that + GET or PUT statements will use. +------------------------------------------------------------ + SYNTAX: N = SEEK( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: For file X, move to record number Y; the first + record number is 1. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SHELL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPACE$( X ) + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The string of X blank spaces. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, A$ ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The string X bytes long consisting of the + first character of A$. +------------------------------------------------------------ + SYNTAX: S$ = STRING$( X, Y ) + PARAMETER: X is a number, [0,MAXLEN] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: The string X bytes long consisting of CHR$(Y). +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = TIME$ +DESCRIPTION: The time of day in 24-hour notation according + to ISO 3307. For example, the value of TIME$ + at 11:15 AM is "11:15:00". If there is no + clock available, then the value of TIME$ + shall be "99:99:99". The value of TIME$ at + midnight is "00:00:00". +------------------------------------------------------------ + SYNTAX: N = TIMER +DESCRIPTION: The time in the system clock in seconds + elapsed since midnight. +------------------------------------------------------------ + SYNTAX: S$ = TRIM$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string resulting from removing both + leading and trailing spaces from A$. +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: S$ = UCASE$( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The string of characters resulting from the + value associated with A$ by replacing each + lower-case-letter in the string by its + upper-case version. +------------------------------------------------------------ + SYNTAX: N = USR( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR0( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR1( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR2( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR3( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR4( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR5( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR6( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR7( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR8( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR9( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Waits for the value of (INP(X) AND Y) to + become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WAIT( X, Y, Z ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] + PARAMETER: Z is a number, [0,255] +DESCRIPTION: Waits for the value of ((INP(X) XOR Z) AND Y) + to become nonzero. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: For console, sets the line width to X. Zero + means no wrapping will occur. +------------------------------------------------------------ + SYNTAX: N = WIDTH( X, Y ) + PARAMETER: X is a number, [MININT,MAXINT] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: If X = 0, sets the console width to Y. + If X < 0, sets the printer width to Y. + If X is an open file number, sets the file + line width to Y. + Otherwise sets the console rows to X and the + line width to Y. + A value of zero for Y means no wrapping will + occur. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X [ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X \ Y +DESCRIPTION: Integer Division + PRECEDENCE: 11 +------------------------------------------------------------ + SYNTAX: X MOD Y +DESCRIPTION: Integer Modulus + PRECEDENCE: 10 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + SYNTAX: X EQV Y +DESCRIPTION: Bitwise EQV + PRECEDENCE: 2 +------------------------------------------------------------ + SYNTAX: X IMP Y +DESCRIPTION: Bitwise IMP + PRECEDENCE: 1 +------------------------------------------------------------ + + diff --git a/DOCS/VINTAGE.txt b/DOCS/VINTAGE.txt new file mode 100644 index 0000000..9d33dba --- /dev/null +++ b/DOCS/VINTAGE.txt @@ -0,0 +1,844 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "VINTAGE" +REM INTERNAL ID: V09 +REM DESCRIPTION: Vintage BASIC 1.0.1 +REM REFERENCE: Vintage BASIC User's Guide 1.0.1 +REM by Lyle Kopnicky +REM (c) 2009, Lyle Kopnicky +REM http://www.vintage-basic.net/ +REM vintage-basic-1.0.1.tar.gz +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 128 +OPTION DATE "" +OPTION TIME "" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE " " +OPTION PUNCT SINGLE " " +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG " " +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT " " +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM " " +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SYSTEM +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: S$ = LEFT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The X left-most characters of A$, beginning + from postion 1. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: N = RANDOMIZE +DESCRIPTION: Seeds the pseudo-random number generator with + TIME. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + + diff --git a/DOCS/XBASIC.txt b/DOCS/XBASIC.txt new file mode 100644 index 0000000..64a07e6 --- /dev/null +++ b/DOCS/XBASIC.txt @@ -0,0 +1,1245 @@ +============================================================ + GENERAL +============================================================ + + +OPTION VERSION "XBASIC" +REM INTERNAL ID: T79 +REM DESCRIPTION: TSC XBASIC for 6800 FLEX +REM REFERENCE: Extended BASIC User's Manual +REM by Technical Systems Consultants +REM (c) 1979, Technical Systems Consultants +REM http://www.swtpc.com/mholley/Setton/ +REM xbasic.pdf +REM +OPTION STRICT OFF +OPTION ANGLE RADIANS +OPTION BUGS ON +OPTION LABELS OFF +OPTION COMPARE BINARY +OPTION COVERAGE OFF +OPTION TRACE OFF +OPTION ERROR GOTO +OPTION IMPLICIT +OPTION BASE 0 +OPTION RECLEN 0 +OPTION DATE "%d-%b-%y" +OPTION TIME "%H:%M:%S" +OPTION PUNCT STRING "$" +OPTION PUNCT DOUBLE "#" +OPTION PUNCT SINGLE "!" +OPTION PUNCT CURRENCY " " +OPTION PUNCT LONG "&" +OPTION PUNCT INTEGER "%" +OPTION PUNCT BYTE " " +OPTION PUNCT QUOTE """ +OPTION PUNCT COMMENT " " +OPTION PUNCT STATEMENT ":" +OPTION PUNCT PRINT "?" +OPTION PUNCT INPUT " " +OPTION PUNCT IMAGE " " +OPTION PUNCT LPAREN "(" +OPTION PUNCT RPAREN ")" +OPTION PUNCT FILENUM "#" +OPTION PUNCT AT " " +OPTION USING DIGIT "#" +OPTION USING COMMA "," +OPTION USING PERIOD "." +OPTION USING PLUS "+" +OPTION USING MINUS "-" +OPTION USING EXRAD "^" +OPTION USING DOLLAR "$" +OPTION USING FILLER "*" +OPTION USING LITERAL "_" +OPTION USING FIRST "!" +OPTION USING ALL "&" +OPTION USING LENGTH "\" + + +============================================================ + COMMANDS +============================================================ + + +------------------------------------------------------------ + SYNTAX: APPEND filename$ +DESCRIPTION: Merges the BASIC program in filename$ into the + current BASIC program; lines in filename$ + replace any matching lines in the current + program. +------------------------------------------------------------ + SYNTAX: AS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: CHAIN filename$ [, linenumber] +DESCRIPTION: Load and execute another BASIC program, + without clearing common variables. For + System/370, the syntax is CHAIN + filename$,parameter$. +------------------------------------------------------------ + SYNTAX: CLEAR +DESCRIPTION: Sets all numeric variables to 0, and all + string variables to empty strings. +------------------------------------------------------------ + SYNTAX: CONT +DESCRIPTION: Continue a BASIC program after a STOP has been + executed. Program resumes at the line after + the STOP. +------------------------------------------------------------ + SYNTAX: DATA constant [, ...] +DESCRIPTION: Stores numeric and string constants to be + accessed by READ. +------------------------------------------------------------ + SYNTAX: DEF FNname[( arg [,...] )] = value +DESCRIPTION: Defines a single-line function. Single-line + functions require an equal sign. +------------------------------------------------------------ + SYNTAX: DIM [# filenum,] variable([ lower TO ] upper) +DESCRIPTION: Declares variables and specifies the + dimensions of array variables. For array + variables, if the lower bound is not + provided, then the OPTION BASE value is used. + If filenum is provided, then the variable is + virtual. +------------------------------------------------------------ + SYNTAX: EDIT +DESCRIPTION: implementation defined. +------------------------------------------------------------ + SYNTAX: ELSE +DESCRIPTION: Introduces a default condition in a multi-line + IF statement. +------------------------------------------------------------ + SYNTAX: ELSEIF +DESCRIPTION: Introduces a secondary condition in a + multi-line IF statement. +------------------------------------------------------------ + SYNTAX: END +DESCRIPTION: Terminates program execution. If the BASIC + program was executed from the operating + system level, then control returns to the + operating system, oterwise control reuturns + to the BASIC prompt. +------------------------------------------------------------ + SYNTAX: END IF +DESCRIPTION: Specifies the last line of a multi-line IF + definition. +------------------------------------------------------------ + SYNTAX: FIELD [#] filenum, number AS variable$ [, ...] +DESCRIPTION: Assigns number bytes in the buffer of random + file filenum to the variable variable$. GET + will automatically update the variable, and + PUT will automatically use the variable. +------------------------------------------------------------ + SYNTAX: FLEX +DESCRIPTION: Exits to the operating system. +------------------------------------------------------------ + SYNTAX: FOR variable = start TO finish [STEP + increment] +DESCRIPTION: Top of a FOR - NEXT structure. The loop will + continue a fixed number of times, which is + determined by the values of start, finish, + and increment. +------------------------------------------------------------ + SYNTAX: GET # file_number [ , RECORD record_number ] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GET # file_number [ , RECORD record_number ] +DESCRIPTION: Gets one (or more) values from a file. +------------------------------------------------------------ + SYNTAX: GO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: GO SUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GO TO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOSUB line +DESCRIPTION: Initiates a subroutine call to the line + specified. The subroutine must end with + RETURN. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: GOTO line +DESCRIPTION: Branches program execution to the specified + line. The line may be a number or a label. +------------------------------------------------------------ + SYNTAX: IF value THEN line1 [ELSE line2] +DESCRIPTION: Single line standard IF command. If the value + is non-zero, then branh to line1. If the + value is zero and ELSE is provided, then + branch to line2. Otherwise continue to the + next line. LABELS are not allowed. +------------------------------------------------------------ + SYNTAX: IF value THEN +DESCRIPTION: Top of a multi-line IF - END IF structure. If + the value is non-zero, then the program lines + upto the next ELSE or ELSE IF command are + executed, otherwise the program branches to + the next ELSE or ELSE IF command. +------------------------------------------------------------ + SYNTAX: INPUT "prompt string" , variable [, ...] +DESCRIPTION: Reads input from the terminal after displaying + a prompt. +------------------------------------------------------------ + SYNTAX: INPUT # filenum , variable [, ...]s +DESCRIPTION: Reads input from the file specified by + filenum. +------------------------------------------------------------ + SYNTAX: INPUT variable [, ...] +DESCRIPTION: Reads input from the terminal. +------------------------------------------------------------ + SYNTAX: INPUT LINE variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE # filenum , variable$ +DESCRIPTION: Reads entire line from a file into variable$. +------------------------------------------------------------ + SYNTAX: INPUT LINE "prompt string" , variable$ +DESCRIPTION: Reads entire line from the terminal into + variable$ after displaying a prompt +------------------------------------------------------------ + SYNTAX: [LET] variable [, ...] = value +DESCRIPTION: Assigns the value to the variable. The LET + keyword is optional. +------------------------------------------------------------ + SYNTAX: LINE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: LINE INPUT [[#] filenum,]["prompt string";] + variable$ +DESCRIPTION: Reads entire line from the keyboard or a file + into variable$. +------------------------------------------------------------ + SYNTAX: LIST line1 [- line2] +DESCRIPTION: Lists BASIC program lines from line1 to line2 + to the console on stdout. +------------------------------------------------------------ + SYNTAX: LOAD [filename$] +DESCRIPTION: Loads an ASCII BASIC program into memory. +------------------------------------------------------------ + SYNTAX: LSET variable$ = value +DESCRIPTION: Left-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the right with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: MAINTAINER +DESCRIPTION: This command is reserved for use by the + Bywater BASIC maintainer. It is not for the + BASIC programmer. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS HTML +DESCRIPTION: Dump COMMAND vs VERSION as HTML table +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS ID +DESCRIPTION: Dump COMMAND #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS MANUAL +DESCRIPTION: Dump COMMAND manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS_SWITCH +DESCRIPTION: Dump COMMAND switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER CMDS TABLE +DESCRIPTION: Dump COMMAND table. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG OFF +DESCRIPTION: Disable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER DEBUG ON +DESCRIPTION: Enable degug tracing. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS HTML +DESCRIPTION: Dump FUNCTION vs VERSION as HTML table. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS ID +DESCRIPTION: Dump FUNCTION #define. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS MANUAL +DESCRIPTION: Dump FUNCTION manual. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS SWITCH +DESCRIPTION: Dump FUNCTION switch. +------------------------------------------------------------ + SYNTAX: MAINTAINER FNCS TABLE +DESCRIPTION: Dump FUNCTION table. +------------------------------------------------------------ + SYNTAX: MAINTAINER MANUAL +DESCRIPTION: Dump manual for the currently selected OPTION + VERSION. +------------------------------------------------------------ + SYNTAX: MAINTAINER STACK +DESCRIPTION: Dump the BASIC stack. +------------------------------------------------------------ + SYNTAX: NEW +DESCRIPTION: Deletes the program in memory and clears all + variables. +------------------------------------------------------------ + SYNTAX: NEXT [variable] +DESCRIPTION: The bottom line of a FOR - NEXT structure. +------------------------------------------------------------ + SYNTAX: OF +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON value GOSUB line [, ...] +DESCRIPTION: Calls based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON value GOTO line [, ...] +DESCRIPTION: Branches based on the rounded value. +------------------------------------------------------------ + SYNTAX: ON ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR GOTO errline +DESCRIPTION: When a trappable error occurs, execute GOTO + errline. The error handler must terminate + with a RESUME command. If the line number is + 0 (zerp), then use the default error handler. + Valid when OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: ON ERROR RESUME NEXT +DESCRIPTION: When a trappable error occurs, execution + continues with the next line. Valid when + OPTION ERROR GOTO. +------------------------------------------------------------ + SYNTAX: OPEN NEW|OLD|VIRTUAL filename$ + AS filenumber +DESCRIPTION: Opens a file for use. +------------------------------------------------------------ + SYNTAX: OPTION +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE DEGREES +DESCRIPTION: Configures these math functions to accept and + return angles in degrees: ACOS, ACS, ANGLE, + ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, COS, + COT, CSC, SEC, SIN and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE GRADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in gradians: ACOS, ANGLE, + ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN + and TAN. +------------------------------------------------------------ + SYNTAX: OPTION ANGLE RADIANS +DESCRIPTION: Configures these math functions to accept and + return angles in radians: ACOS, ANGLE, ASIN, + ASN, ATN, ATAN, COS, COT, CSC, SEC, SIN and + TAN. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC DECIMAL +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC FIXED +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION ARITHMETIC NATIVE +DESCRIPTION: Currently has no effect. +------------------------------------------------------------ + SYNTAX: OPTION BASE integer +DESCRIPTION: Sets the default lowest array subscript. +------------------------------------------------------------ + SYNTAX: OPTION BUGS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION BUGS BOOLEAN +DESCRIPTION: Boolean results are 1 or 0 instead of bitwise. +------------------------------------------------------------ + SYNTAX: OPTION BUGS OFF +DESCRIPTION: Disables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION BUGS ON +DESCRIPTION: Enables bugs commonly found in many BASIC + dialects. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE BINARY +DESCRIPTION: Causes string comparisons to be + case-sensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE DATABASE +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COMPARE TEXT +DESCRIPTION: Causes string comparisons to be + case-insensitive. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE OFF +DESCRIPTION: Disables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION COVERAGE ON +DESCRIPTION: Enables BASIC code coverage recording, + displayed using the LIST command. +------------------------------------------------------------ + SYNTAX: OPTION DATE format$ +DESCRIPTION: Sets the date format string used by C + strftime() for DATE$. +------------------------------------------------------------ + SYNTAX: OPTION DIGITS integer +DESCRIPTION: Sets the number of significant digits for + PRINT. Setting the value to zero restores + the default. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE COMMAND name$ +DESCRIPTION: Disables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE FUNCTION name$ +DESCRIPTION: Disables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION DISABLE OPERATOR name$ +DESCRIPTION: Disables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION EDIT string$ +DESCRIPTION: Sets the program name used by the EDIT + command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE COMMAND name$ +DESCRIPTION: Enables the specified BASIC command. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE FUNCTION name$ +DESCRIPTION: Enables the specified BASIC function. +------------------------------------------------------------ + SYNTAX: OPTION ENABLE OPERATOR name$ +DESCRIPTION: Enables the specified BASIC operator. +------------------------------------------------------------ + SYNTAX: OPTION ERROR +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOSUB +DESCRIPTION: When an error occurs, GOSUB to the error + handler. The error handler exits with + RETURN. +------------------------------------------------------------ + SYNTAX: OPTION ERROR GOTO +DESCRIPTION: When an error occurs, GOTO to the error + handler. The error handler exits with + RESUME. +------------------------------------------------------------ + SYNTAX: OPTION EXPLICIT +DESCRIPTION: All variables must be declared using DIM. +------------------------------------------------------------ + SYNTAX: OPTION EXTENSION string$ +DESCRIPTION: Sets the BASIC filename extension, commonly + ".bas". +------------------------------------------------------------ + SYNTAX: OPTION FILES string$ +DESCRIPTION: Sets the program name used by the FILES + command. +------------------------------------------------------------ + SYNTAX: OPTION IMPLICIT +DESCRIPTION: Variables need not be declared using DIM, + provided arrays have no more that 10 + elements. This is the opposite of OPTION + EXPLICIT, and is the default for all versions + of BASIC. +------------------------------------------------------------ + SYNTAX: OPTION INDENT integer +DESCRIPTION: Sets indention level for LIST. Zero means no + indention. Default is 2. +------------------------------------------------------------ + SYNTAX: OPTION LABELS +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION LABELS OFF +DESCRIPTION: Disables text labels. +------------------------------------------------------------ + SYNTAX: OPTION LABELS ON +DESCRIPTION: Enables text labels. +------------------------------------------------------------ + SYNTAX: OPTION PROMPT string$ +DESCRIPTION: Sets the BASIC prompt. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT AT char$ +DESCRIPTION: Sets the PRINT AT character, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT BYTE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type BYTE, commonly "~". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT COMMENT char$ +DESCRIPTION: Sets the shortcut COMMENT character. +------------------------------------------------------------ + SYNTAX: OPTION PUNCT CURRENCY char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type CURRENCY, commonly "@". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT DOUBLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type DOUBLE, commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT FILENUM char$ +DESCRIPTION: Sets the FILE NUMBER prefix character, + commonly "#". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT IMAGE char$ +DESCRIPTION: Sets the shortcut IMAGE character, commonly + ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INPUT char$ +DESCRIPTION: Sets the shortcut INPUT character, commonly + "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT INTEGER char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type INTEGER, commonly "%". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LONG char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type LONG, commonly "&". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT LPAREN char$ +DESCRIPTION: Sets the LEFT PARENTHESIS character, commonly + "(". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT_PRINT char$ +DESCRIPTION: Sets the shortcut PRINT character, commonly + "?". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT QUOTE char$ +DESCRIPTION: Sets the QUOTE character, commonly """ +------------------------------------------------------------ + SYNTAX: OPTION PUNCT RPAREN char$ +DESCRIPTION: Sets the RIGHT PARENTHESIS character, commonly + ")". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT SINGLE char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type SINGLE, commonly "!". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STATEMENT char$ +DESCRIPTION: Sets the statement seperator character, + commonly ":". +------------------------------------------------------------ + SYNTAX: OPTION PUNCT STRING char$ +DESCRIPTION: Sets the suffix character that indicates a + variable is of type STRING, commonly "$". +------------------------------------------------------------ + SYNTAX: OPTION RECLEN integer +DESCRIPTION: Sets the default RANDOM record length. +------------------------------------------------------------ + SYNTAX: OPTION RENUM string$ +DESCRIPTION: Sets the program name used by the RENUM + command. +------------------------------------------------------------ + SYNTAX: OPTION ROUND +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION ROUND BANK +DESCRIPTION: Round using the Banker rule. +------------------------------------------------------------ + SYNTAX: OPTION ROUND MATH +DESCRIPTION: Round using mathematical rules. +------------------------------------------------------------ + SYNTAX: OPTION ROUND TRUNCATE +DESCRIPTION: Round using truncation. +------------------------------------------------------------ + SYNTAX: OPTION SCALE integer +DESCRIPTION: Sets the number of digits to round after the + decimal point for PRINT. Setting the value + to zero disables rounding. +------------------------------------------------------------ + SYNTAX: OPTION SLEEP double +DESCRIPTION: Sets multiplier for SLEEP and WAIT. Zero + means no waiting. Default is 1. +------------------------------------------------------------ + SYNTAX: OPTION STDERR filename$ +DESCRIPTION: Sets the file used for STDERR, which is used + by LPRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDIN filename$ +DESCRIPTION: Sets the file used for STDIN, which is used by + INPUT commands. +------------------------------------------------------------ + SYNTAX: OPTION STDOUT filename$ +DESCRIPTION: Sets the file used for STDOUT, which is used + by PRINT commands. +------------------------------------------------------------ + SYNTAX: OPTION STRICT +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION STRICT OFF +DESCRIPTION: Disables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION STRICT ON +DESCRIPTION: Enables checking for implicit array creation + without using the DIM command. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ADM +DESCRIPTION: Enables ADM-3A terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL ANSI +DESCRIPTION: Enables ANSI terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TERMINAL NONE +DESCRIPTION: Disables terminal control codes for CLS, + COLOR, and LOCATE. +------------------------------------------------------------ + SYNTAX: OPTION TIME format$ +DESCRIPTION: Sets the time format string used by C + strftime() for TIME$. +------------------------------------------------------------ + SYNTAX: OPTION TRACE +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION TRACE OFF +DESCRIPTION: Disables displaying a stack trace when an + ERROR occurs. +------------------------------------------------------------ + SYNTAX: OPTION TRACE ON +DESCRIPTION: Enables displaying a stack trace when an ERROR + occurs. +------------------------------------------------------------ + SYNTAX: OPTION USING +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: OPTION USING ALL char$ +DESCRIPTION: Specifies the magic ALL character for the + PRINT USING command. A common value is "&". +------------------------------------------------------------ + SYNTAX: OPTION USING COMMA char$ +DESCRIPTION: Specifies the magic COMMA character for the + PRINT USING command. A common value is ",". +------------------------------------------------------------ + SYNTAX: OPTION USING DIGIT char$ +DESCRIPTION: Specifies the magic DIGIT character for the + PRINT USING command. A common value is "#". +------------------------------------------------------------ + SYNTAX: OPTION USING DOLLAR char$ +DESCRIPTION: Specifies the magic DOLLAR character for the + PRINT USING command. A common value is "$". +------------------------------------------------------------ + SYNTAX: OPTION USING EXRAD char$ +DESCRIPTION: Specifies the magic EXRAD character for the + PRINT USING command. A common value is "^". +------------------------------------------------------------ + SYNTAX: OPTION USING FILLER char$ +DESCRIPTION: Specifies the magic FILLER character for the + PRINT USING command. A common value is "*". +------------------------------------------------------------ + SYNTAX: OPTION USING FIRST char$ +DESCRIPTION: Specifies the magic FIRST character for the + PRINT USING command. A common value is "!". +------------------------------------------------------------ + SYNTAX: OPTION USING LENGTH char$ +DESCRIPTION: Specifies the magic LENGTH character for the + PRINT USING command. A common value is "\". +------------------------------------------------------------ + SYNTAX: OPTION USING LITERAL char$ +DESCRIPTION: Specifies the magic LITERAL character for the + PRINT USING command. A common value is "_". +------------------------------------------------------------ + SYNTAX: OPTION USING MINUS char$ +DESCRIPTION: Specifies the magic MINUS character for the + PRINT USING command. A common value is "-". +------------------------------------------------------------ + SYNTAX: OPTION USING PERIOD char$ +DESCRIPTION: Specifies the magic PERIOD character for the + PRINT USING command. A common value is ".". +------------------------------------------------------------ + SYNTAX: OPTION USING PLUS char$ +DESCRIPTION: Specifies the magic PLUS character for the + PRINT USING command. A common value is "+". +------------------------------------------------------------ + SYNTAX: OPTION VERSION version$ +DESCRIPTION: Selects a specific BASIC version, which is a + combination of OPTION settings, commands, + functions and operators. If no version is + specified, displays a list of the available + versions. +------------------------------------------------------------ + SYNTAX: OPTION ZONE integer +DESCRIPTION: Sets the PRINT zone width. Setting the value + to zero restores the default. +------------------------------------------------------------ + SYNTAX: PDEL line [- line] +DESCRIPTION: Deletes program lines indicated by the + argument(s). All program lines have a + number, which is visible with the LIST + command. If line numbers are not provided, + they are assigned beginning with 1. Deleting + a non-existing line does not cause an error. +------------------------------------------------------------ + SYNTAX: PRINT # filenum , [USING format$;] value ... +DESCRIPTION: Sends output to a file. +------------------------------------------------------------ + SYNTAX: PRINT [USING format$;] value ... +DESCRIPTION: Sends output to the screen. +------------------------------------------------------------ + SYNTAX: PUT # file_number [ , RECORD record_number ] +DESCRIPTION: Puts one (or more) values into a file. +------------------------------------------------------------ + SYNTAX: READ variable [, ...] +DESCRIPTION: Reads values from DATA statements. +------------------------------------------------------------ + SYNTAX: REM ... +DESCRIPTION: Remark. +------------------------------------------------------------ + SYNTAX: RENUM +DESCRIPTION: Implementation defined. +------------------------------------------------------------ + SYNTAX: RESTORE [line] +DESCRIPTION: Resets the line used for the next READ + statement. line may be either a number or a + label. +------------------------------------------------------------ + SYNTAX: RESUME +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RESUME line +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the specified + line. +------------------------------------------------------------ + SYNTAX: RESUME NEXT +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to the line after + ERL. +------------------------------------------------------------ + SYNTAX: RESUME 0 +DESCRIPTION: Used in an error handler to specify the next + line to execute. Branch to ERL. +------------------------------------------------------------ + SYNTAX: RETURN +DESCRIPTION: Concludes a subroutine called by GOSUB. +------------------------------------------------------------ + SYNTAX: RSET variable$ = value +DESCRIPTION: Right-aligns the value into variable$. If the + length of the value is too short, then it is + padded on the left with spaces. If the + length of the value is too long, then it is + truncated on the right. This is only for use + with variables assigned to a random access + buffer with FIELD command. +------------------------------------------------------------ + SYNTAX: RUN filename$ +DESCRIPTION: Loads a new BAASIC program and executes the + program from the start. +------------------------------------------------------------ + SYNTAX: RUN line +DESCRIPTION: Executes the program in memory beginning at + line. +------------------------------------------------------------ + SYNTAX: RUN +DESCRIPTION: Executes the program in memory from the start. +------------------------------------------------------------ + SYNTAX: SAVE [filename$] +DESCRIPTION: Saves the current program into the file + filename$ in ASCII format. +------------------------------------------------------------ + SYNTAX: STEP +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: STOP +DESCRIPTION: Interrupts program execution and displays the + line number of the STOP command. For use + when debugging BASIC programs. Whether STOP + issues a SIGINT signal is implementation + defined. +------------------------------------------------------------ + SYNTAX: SWAP variable, variable +DESCRIPTION: Swaps the values of two variables. Both + variables must be of the same type. +------------------------------------------------------------ + SYNTAX: THEN +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + SYNTAX: TO +DESCRIPTION: Syntax Error. +------------------------------------------------------------ + + +============================================================ + FUNCTIONS +============================================================ + + +------------------------------------------------------------ + SYNTAX: N = ABS( X ) + PARAMETER: X is a number +DESCRIPTION: The absolute value of X. +------------------------------------------------------------ + SYNTAX: N = ARCCOS( X ) + PARAMETER: X is a number +DESCRIPTION: The arccosine of X in radians, where 0 <= + ARCCOS(X) <= PI. X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ARCSIN( X ) + PARAMETER: X is a number +DESCRIPTION: The arcsine of X in radians, where -PI/2 <= + ARCSIN(X) <= PI/2; X shall be in the range -1 + <= X <= 1. +------------------------------------------------------------ + SYNTAX: N = ARCTAN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ARCTAN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: N = ASC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric code for the first letter in A$. + For example, ASC("ABC") returns 65 on ASCII + systems. +------------------------------------------------------------ + SYNTAX: N = ATN( X ) + PARAMETER: X is a number +DESCRIPTION: The arctangent of X in radians, i.e. the angle + whose tangent is X, where -PI/2 < ATN(X) < + PI/2. +------------------------------------------------------------ + SYNTAX: S$ = CHR$( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: The one-character string with the character + corresponding to the numeric code X. On + ASCII systems, CHR$(65) returns "A". +------------------------------------------------------------ + SYNTAX: N = CLOSE( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: Close file number X. +------------------------------------------------------------ + SYNTAX: N = COS( X ) + PARAMETER: X is a number +DESCRIPTION: The cosine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = CVD( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(DBL) +DESCRIPTION: The double-precision value in A$, which was + created by MKD$. +------------------------------------------------------------ + SYNTAX: N = CVI( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(INT) +DESCRIPTION: The short (16-bit) integer value in A$, which + was created by MKI$. +------------------------------------------------------------ + SYNTAX: N = CVL( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(LNG) +DESCRIPTION: The long (32-bit) integer value in A$, which + was created by MKL$. +------------------------------------------------------------ + SYNTAX: N = CVS( A$ ) + PARAMETER: A$ is a string, LEN >= sizeof(FLT) +DESCRIPTION: The single-precision value in A$, which was + created by MKS$. +------------------------------------------------------------ + SYNTAX: S$ = DATE$ +DESCRIPTION: The current date based on the internal clock + as a string in the format set by OPTION DATE. +------------------------------------------------------------ + SYNTAX: N = DIGITS( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: X is the number of significiant digits to + print for numbers (0..17). If X = 0 then + disabled. +------------------------------------------------------------ + SYNTAX: N = DIGITS( X, Y ) + PARAMETER: X is a number, [0,255] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: X is the number of significiant digits to + print for numbers (0..17). If X = 0 then + disabled. Y is the number of decimal places + to round (0..17). If Y = 0 then disabled. +------------------------------------------------------------ + SYNTAX: N = DPEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = DPOKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [MININT,MAXINT] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = ERL +DESCRIPTION: The line number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = ERR +DESCRIPTION: The error number of the most recent error. +------------------------------------------------------------ + SYNTAX: N = EXEC( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The exit code resulting from the execution of + an operating system command. +------------------------------------------------------------ + SYNTAX: N = EXP( X ) + PARAMETER: X is a number +DESCRIPTION: The exponential value of X, i.e., the value of + the base of natural logarithms (e = 2.71828) + raised to the power of X; if EXP(X) is less + that machine infinitesimal, then its value + shall be replaced with zero. +------------------------------------------------------------ + SYNTAX: N = FRE +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. +------------------------------------------------------------ + SYNTAX: N = FRE( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000.The value of A$ is + ignored. +------------------------------------------------------------ + SYNTAX: N = FRE( X ) + PARAMETER: X is a number +DESCRIPTION: The number of bytes of available memory. This + function is provided for backward + compatibility only and it always returns a + fixed value of 32000. The value of X is + ignored. +------------------------------------------------------------ + SYNTAX: N = HEX( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The numeric value of the hexadecimal string in + A$. For example, HEX("FFFF") returns 65535. +------------------------------------------------------------ + SYNTAX: S$ = INCH$ +DESCRIPTION: The keypress, if available. If a keypress is + not available, then immediately returns an + empty string. If not supported by the + platform, then always returns an empty + string, so use INPUT$(1) instead. +------------------------------------------------------------ + SYNTAX: N = INSTR( X, A$, B$ ) + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: B$ is a string, LEN >= 0 +DESCRIPTION: The position at which B$ occurs in A$, + beginning at position X. +------------------------------------------------------------ + SYNTAX: N = INT( X ) + PARAMETER: X is a number +DESCRIPTION: The largest integer not greater than X; e.g. + INT(1.3) = 1 and INT(-1.3) = 2. +------------------------------------------------------------ + SYNTAX: N = KILL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: Removes the file named in A$. +------------------------------------------------------------ + SYNTAX: N = LEN( A$ ) + PARAMETER: A$ is a string, LEN >= 0 +DESCRIPTION: The length of A$. +------------------------------------------------------------ + SYNTAX: N = LOG( X ) + PARAMETER: X is a number, > 0 +DESCRIPTION: The natural logarithm of X; X shall be greater + than zero. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] +DESCRIPTION: The characters of A$, starting from postion X. +------------------------------------------------------------ + SYNTAX: S$ = MID$( A$, X, Y ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [1,MAXLEN] + PARAMETER: Y is a number, [0,MAXLEN] +DESCRIPTION: The Y characters of A$, starting from postion + X. +------------------------------------------------------------ + SYNTAX: S$ = MKD$( X ) + PARAMETER: X is a number, [MINDBL,MAXDBL] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKI$( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The internal representation of the short + (16-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKL$( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The internal representation of the long + (32-bit) integer X as a string. +------------------------------------------------------------ + SYNTAX: S$ = MKS$( X ) + PARAMETER: X is a number, [MINFLT,MAXFLT] +DESCRIPTION: The internal representation of X as a string. +------------------------------------------------------------ + SYNTAX: N = NAME( ... ) +DESCRIPTION: Returns hardware address of variable. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = PEEK( X ) + PARAMETER: X is a number, [MINLNG,MAXLNG] +DESCRIPTION: The value read from hardware address X. + Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = POKE( X, Y ) + PARAMETER: X is a number, [MINLNG,MAXLNG] + PARAMETER: Y is a number, [0,255] +DESCRIPTION: Sends Y to hardware address X. Causes ERROR + 73. +------------------------------------------------------------ + SYNTAX: N = POS +DESCRIPTION: The current cursor position in the line. +------------------------------------------------------------ + SYNTAX: N = POS( X ) + PARAMETER: X is a number, [MININT,MAXINT] +DESCRIPTION: The current cursor position in the line for + file X. +------------------------------------------------------------ + SYNTAX: N = PTR( ... ) +DESCRIPTION: Returns hardware address of variable. Causes + ERROR 73. +------------------------------------------------------------ + SYNTAX: N = RENAME( A$, B$ ) + PARAMETER: A$ is a string, LEN >= 1 + PARAMETER: B$ is a string, LEN >= 1 +DESCRIPTION: Rename file A$ to B$. If successful, the + returns -1 else returns 0. +------------------------------------------------------------ + SYNTAX: S$ = RIGHT$( A$, X ) + PARAMETER: A$ is a string, LEN >= 0 + PARAMETER: X is a number, [0,MAXLEN] +DESCRIPTION: The right-most X characters of A$. +------------------------------------------------------------ + SYNTAX: N = RND +DESCRIPTION: The next pseudo-random number in an + implementation-defined sequence of + pseudo-random numbers uniformly distributed + in the range 0 <= RND < 1. +------------------------------------------------------------ + SYNTAX: N = RND( X ) + PARAMETER: X is a number +DESCRIPTION: Returns a pseudorandom number in the range + [0,1]. The value of X is ignored. +------------------------------------------------------------ + SYNTAX: N = SCALE( X ) + PARAMETER: X is a number, [0,255] +DESCRIPTION: X is the number of decimal places to round + (0..17). If X = 0 then disabled. +------------------------------------------------------------ + SYNTAX: N = SGN( X ) + PARAMETER: X is a number +DESCRIPTION: The sign of X: -1 if X < 0, 0 if X = 0, and +1 + if X > 0. +------------------------------------------------------------ + SYNTAX: N = SIN( X ) + PARAMETER: X is a number +DESCRIPTION: The sine of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: S$ = SPC( X ) + PARAMETER: X is a number +DESCRIPTION: The string of X spaces. Only for use within + the PRINT command. +------------------------------------------------------------ + SYNTAX: N = SQR( X ) + PARAMETER: X is a number, >= 0 +DESCRIPTION: The non-negative square root of X; X shall be + non-negative. +------------------------------------------------------------ + SYNTAX: S$ = STR$( X ) + PARAMETER: X is a number +DESCRIPTION: The string generated by the print-statement as + the numeric-representation of the value + associated with X. +------------------------------------------------------------ + SYNTAX: S$ = TAB( X ) + PARAMETER: X is a number +DESCRIPTION: The string required to advance to column X. + Only for use within the PRINT command. +------------------------------------------------------------ + SYNTAX: N = TAN( X ) + PARAMETER: X is a number +DESCRIPTION: The tangent of X, where X is in radians. +------------------------------------------------------------ + SYNTAX: N = TROFF +DESCRIPTION: Turn tracing OFF +------------------------------------------------------------ + SYNTAX: N = TRON +DESCRIPTION: Turn tracing ON +------------------------------------------------------------ + SYNTAX: N = USR( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR0( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR1( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR2( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR3( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR4( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR5( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR6( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR7( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR8( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = USR9( ... ) +DESCRIPTION: Execute hardware program. Causes ERROR 73. +------------------------------------------------------------ + SYNTAX: N = VAL( A$ ) + PARAMETER: A$ is a string, LEN >= 1 +DESCRIPTION: The value of the numeric-constant associated + with A$, if the string associated with A$ is + a numeric-constant. Leading and trailing + spaces in the string are ignored. If the + evaluation of the numeric-constant would + result in a value which causes an underflow, + then the value returned shall be zero. For + example, VAL( " 123.5 " ) = 123.5, VAL( + "2.E-99" ) could be zero, and VAL( "MCMXVII" + ) causes an exception. +------------------------------------------------------------ + + +============================================================ + OPERATORS +============================================================ + + +------------------------------------------------------------ + SYNTAX: X ^ Y +DESCRIPTION: Exponential + PRECEDENCE: 14 +------------------------------------------------------------ + SYNTAX: # X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: + X +DESCRIPTION: Posation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: - X +DESCRIPTION: Negation + PRECEDENCE: 13 +------------------------------------------------------------ + SYNTAX: X * Y +DESCRIPTION: Multiplication + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X / Y +DESCRIPTION: Division + PRECEDENCE: 12 +------------------------------------------------------------ + SYNTAX: X + Y +DESCRIPTION: Addition + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X - Y +DESCRIPTION: Subtraction + PRECEDENCE: 9 +------------------------------------------------------------ + SYNTAX: X < Y +DESCRIPTION: Less than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <= Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X <> Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X = Y +DESCRIPTION: Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X =< Y +DESCRIPTION: Less than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X => Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X > Y +DESCRIPTION: Greater than + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >< Y +DESCRIPTION: Not Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: X >= Y +DESCRIPTION: Greater than or Equal + PRECEDENCE: 7 +------------------------------------------------------------ + SYNTAX: NOT X +DESCRIPTION: Bitwise NOT + PRECEDENCE: 6 +------------------------------------------------------------ + SYNTAX: X AND Y +DESCRIPTION: Bitwise AND + PRECEDENCE: 5 +------------------------------------------------------------ + SYNTAX: X OR Y +DESCRIPTION: Bitwise OR + PRECEDENCE: 4 +------------------------------------------------------------ + SYNTAX: X XOR Y +DESCRIPTION: Bitwise Exclusive OR + PRECEDENCE: 3 +------------------------------------------------------------ + + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..dde4846 --- /dev/null +++ b/INSTALL @@ -0,0 +1,87 @@ +Some Notes on Installation of the Bywater BASIC Interpreter: +----------------------------------------------------------- + +0. Quick-Start Guide For Compiling + + To use the default configuration (which is reasonable for most situations): + + On Unix using GCC: + gcc -o bwbasic -lm -ansi -pedantic -Wall -Werror bw*.c + + On Android CCTools using GCC: + gcc -o bwbasic -lm -ansi -pedantic -Wall -Werror bw*.c + + On MSDOS using Borland C++ 3.1: + bcc.exe -mh -eBWBASIC.EXE -D_DOS=1 -Y bw*.c + + On MSDOS using Digital Mars Compiler Version 8.42n: + dmc.exe -mx -A89 -oBWBASIC.EXE -DHAVE_DOS=1 bwbasic.c bwb_cmd.c bwb_cnd.c + bwb_dio.c bwb_exp.c bwb_fnc.c bwb_inp.c bwb_int.c bwb_prn.c bwb_stc.c + bwb_str.c bwb_tbl.c bwb_var.c bwd_cmd.c bwd_fun.c bwx_tty.c X32.LIB + + On MSDOS using Open Watcom 1.9: + wcl386 -bc -c -ox -q -wx -za -D_DOS -D__WATCOM__ bw*.c + wlink option quiet file bw*.obj name bwbasic.exe + + The following MSDOS compilers are unable to compile Bywater BASIC: + Borland Turbo C 2.01 + Hi-Tech Pacific C 7.51 + Mix Power C 2.2.0 + + You can skip the rest of this file unless you want to customize the + BASIC dialect that is supported, or something goes wrong in the + above commands. + + +1. Compiler Requirements + + ANSI C. + + +2. Configuration of header files + + You may need to examine file "bwbasic.h" to make important + changes for specific hardware and compiler configurations. + + +3. Makefiles + + Several compiler-specific makefiles are provided AS-IS, + and have not been tested with Bywater BASIC version 3.XX. + + "makefile" should compile the program on Unix-based computers. + + "makefile.qcl" should compile using Microsoft QuickC (tm). + + +4. Implementations + + TTY is the base implementation and presumes a simple + TTY-style environment, with all keyboard and screen input + and output directed through stdin and stdout. All commands, + functions and operators should be available in the TTY + implementation, even when they do nothing. For example, + CLS, COLOR and LOCATE do nothing when OPTION TERMINAL NONE + is specified. This allows exising classic BASIC applications + to execute, even though the display will not be accurate. + + +5. Adding Commands and Functions + + Follow the rules in "Implementation rules for functions and commands"; + the majority of BASIC commands are actually intrinsic functions. + Adding a new command is more work than adding a new function. + + In order to add a new command to bwBASIC: + + Search for C_WRITE and bwb_WRITE, + and add your command's eqivalent information in the same places. + Each command (#define C_...) shoud have a unique number. + + Adding a new function is easier: + + Search for F_ABS_X_N, + and add your function's equivalent information in the same places. + Each function (#define F_...) shoud have a unique number. + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..45cf3e2 --- /dev/null +++ b/Makefile @@ -0,0 +1,116 @@ +# Generated automatically from Makefile.in by configure. +# Unix Makefile for Bywater BASIC Interpreter + +##---------------------------------------------------------------## +## NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, ## +## 11/1995 (eidetics@cerf.net). ## +##---------------------------------------------------------------## + +srcdir = . +VPATH = . + +CC = gcc + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = $(INSTALL) +INSTALL_DATA = $(INSTALL) -m 644 + +DEFS = -DHAVE_STRING=1 -DHAVE_STDLIB=1 -DHAVE_UNISTD=1 -DHAVE_RAISE=1 + +# Revised by JBV +#CFLAGS = -O +CFLAGS = -g -ansi -DHAVE_UNIX + +# Revised by JBV +#LDFLAGS = -s + +prefix = /usr/local +exec_prefix = $(prefix) +bindir = $(exec_prefix)/bin + +SHELL = /bin/sh + +CFILES= bwbasic.c bwb_cmd.c bwb_cnd.c bwb_dio.c\ + bwb_exp.c bwb_fnc.c bwb_inp.c bwb_int.c\ + bwb_prn.c bwb_stc.c bwb_str.c bwb_tbl.c\ + bwb_var.c bwd_cmd.c bwd_fun.c bwx_tty.c + +OFILES= bwbasic.o bwb_cmd.o bwb_cnd.o bwb_dio.o\ + bwb_exp.o bwb_fnc.o bwb_inp.o bwb_int.o\ + bwb_prn.o bwb_stc.o bwb_str.o bwb_tbl.o\ + bwb_var.o bwd_cmd.o bwd_fun.o bwx_tty.o + +HFILES= bwbasic.h + +MISCFILES= COPYING INSTALL Makefile.in README bwbasic.doc\ + bwbasic.mak configure.in configure makefile.qcl\ + bwb_tcc.c bwx_iqc.c bwx_iqc.h + +TESTFILES= \ + abs.bas assign.bas callfunc.bas callsub.bas chain1.bas\ + chain2.bas dataread.bas deffn.bas dim.bas doloop.bas\ + dowhile.bas elseif.bas end.bas err.bas fncallfn.bas\ + fornext.bas function.bas gosub.bas gotolabl.bas ifline.bas\ + index.txt input.bas lof.bas loopuntl.bas main.bas\ + mlifthen.bas on.bas onerr.bas onerrlbl.bas ongosub.bas\ + opentest.bas option.bas putget.bas random.bas selcase.bas\ + snglfunc.bas stop.bas term.bas whilwend.bas width.bas\ + writeinp.bas pascaltr.bas + +DISTFILES= $(CFILES) $(HFILES) $(MISCFILES) + +# Revised by JBV +#all: bwbasic +all: bwbasic renum + +bwbasic: $(OFILES) + $(CC) $(OFILES) -lm -o $@ $(LDFLAGS) + +# Added by JBV +renum: + $(CC) renum.c -o renum + +$(OFILES): $(HFILES) + +.c.o: + $(CC) -c $(CPPFLAGS) -I$(srcdir) $(DEFS) $(CFLAGS) $< + +install: all + $(INSTALL_PROGRAM) bwbasic $(bindir)/bwbasic + +uninstall: + rm -f $(bindir)/bwbasic + +Makefile: Makefile.in config.status + $(SHELL) config.status +config.status: configure + $(SHELL) config.status --recheck +configure: configure.in + cd $(srcdir); autoconf + +TAGS: $(CFILES) + etags $(CFILES) + +clean: + rm -f *.o bwbasic core + +mostlyclean: clean + +distclean: clean + rm -f Makefile config.status + +realclean: distclean + rm -f TAGS + +dist: $(DISTFILES) + echo bwbasic-2.61 > .fname + rm -rf `cat .fname` + mkdir `cat .fname` + ln $(DISTFILES) `cat .fname` + mkdir `cat .fname`/bwbtest + cd bwbtest; ln $(TESTFILES) ../`cat ../.fname`/bwbtest + tar czhf `cat .fname`.tar.gz `cat .fname` + rm -rf `cat .fname` .fname + +# Prevent GNU make v3 from overflowing arg limit on SysV. +.NOEXPORT: diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..5e6b018 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,115 @@ +# Unix Makefile for Bywater BASIC Interpreter + +##---------------------------------------------------------------## +## NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, ## +## 11/1995 (eidetics@cerf.net). ## +##---------------------------------------------------------------## + +srcdir = @srcdir@ +VPATH = @srcdir@ + +CC = @CC@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +DEFS = @DEFS@ + +# Revised by JBV +#CFLAGS = -O +CFLAGS = -g -ansi -DHAVE_UNIX + +# Revised by JBV +#LDFLAGS = -s + +prefix = /usr/local +exec_prefix = $(prefix) +bindir = $(exec_prefix)/bin + +SHELL = /bin/sh + +CFILES= bwbasic.c bwb_cmd.c bwb_cnd.c bwb_dio.c\ + bwb_exp.c bwb_fnc.c bwb_inp.c bwb_int.c\ + bwb_prn.c bwb_stc.c bwb_str.c bwb_tbl.c\ + bwb_var.c bwd_cmd.c bwd_fun.c bwx_tty.c + +OFILES= bwbasic.o bwb_cmd.o bwb_cnd.o bwb_dio.o\ + bwb_exp.o bwb_fnc.o bwb_inp.o bwb_int.o\ + bwb_prn.o bwb_stc.o bwb_str.o bwb_tbl.o\ + bwb_var.o bwd_cmd.o bwd_fun.o bwx_tty.o + +HFILES= bwbasic.h + +MISCFILES= COPYING INSTALL Makefile.in README bwbasic.doc\ + bwbasic.mak configure.in configure makefile.qcl\ + bwb_tcc.c bwx_iqc.c bwx_iqc.h + +TESTFILES= \ + abs.bas assign.bas callfunc.bas callsub.bas chain1.bas\ + chain2.bas dataread.bas deffn.bas dim.bas doloop.bas\ + dowhile.bas elseif.bas end.bas err.bas fncallfn.bas\ + fornext.bas function.bas gosub.bas gotolabl.bas ifline.bas\ + index.txt input.bas lof.bas loopuntl.bas main.bas\ + mlifthen.bas on.bas onerr.bas onerrlbl.bas ongosub.bas\ + opentest.bas option.bas putget.bas random.bas selcase.bas\ + snglfunc.bas stop.bas term.bas whilwend.bas width.bas\ + writeinp.bas pascaltr.bas + +DISTFILES= $(CFILES) $(HFILES) $(MISCFILES) + +# Revised by JBV +#all: bwbasic +all: bwbasic renum + +bwbasic: $(OFILES) + $(CC) $(OFILES) -lm -o $@ $(LDFLAGS) + +# Added by JBV +renum: + $(CC) renum.c -o renum + +$(OFILES): $(HFILES) + +.c.o: + $(CC) -c $(CPPFLAGS) -I$(srcdir) $(DEFS) $(CFLAGS) $< + +install: all + $(INSTALL_PROGRAM) bwbasic $(bindir)/bwbasic + +uninstall: + rm -f $(bindir)/bwbasic + +Makefile: Makefile.in config.status + $(SHELL) config.status +config.status: configure + $(SHELL) config.status --recheck +configure: configure.in + cd $(srcdir); autoconf + +TAGS: $(CFILES) + etags $(CFILES) + +clean: + rm -f *.o bwbasic core + +mostlyclean: clean + +distclean: clean + rm -f Makefile config.status + +realclean: distclean + rm -f TAGS + +dist: $(DISTFILES) + echo bwbasic-2.61 > .fname + rm -rf `cat .fname` + mkdir `cat .fname` + ln $(DISTFILES) `cat .fname` + mkdir `cat .fname`/bwbtest + cd bwbtest; ln $(TESTFILES) ../`cat ../.fname`/bwbtest + tar czhf `cat .fname`.tar.gz `cat .fname` + rm -rf `cat .fname` .fname + +# Prevent GNU make v3 from overflowing arg limit on SysV. +.NOEXPORT: diff --git a/Makefile.ncu b/Makefile.ncu new file mode 100644 index 0000000..70f2c4b --- /dev/null +++ b/Makefile.ncu @@ -0,0 +1,121 @@ +# Generated automatically from Makefile.in by configure. +# Unix Makefile for Bywater BASIC Interpreter + +##---------------------------------------------------------------## +## NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, ## +## 10/1995 (eidetics@cerf.net). ## +##---------------------------------------------------------------## + +# 2015-04-25 Updated for version 3.00 by Howard Wulf, AF5NE + +srcdir = . +VPATH = . + +CC = cc + +INSTALL = cp +INSTALL_PROGRAM = $(INSTALL) +INSTALL_DATA = $(INSTALL) + +DEFS = -DHAVE_STRING=1 -DHAVE_STDLIB=1 -DHAVE_RAISE=1 -DHAVE_UNISTD=1 + +# Revised by JBV +#CFLAGS = -O +CFLAGS = -g -ansi -DHAVE_UNIX + +# Revised by JBV +#LDFLAGS = -s + +prefix = /usr/local +exec_prefix = $(prefix) +bindir = $(exec_prefix)/bin + +SHELL = /bin/sh + +CFILES= bwbasic.c bwb_cmd.c bwb_cnd.c bwb_dio.c\ + bwb_exp.c bwb_fnc.c bwb_inp.c bwb_int.c\ + bwb_prn.c bwb_stc.c bwb_str.c bwb_tbl.c\ + bwb_var.c bwd_cmd.c bwd_fun.c bwx_tty.c + +OFILES= bwbasic.o bwb_cmd.o bwb_cnd.o bwb_dio.o\ + bwb_exp.o bwb_fnc.o bwb_inp.o bwb_int.o\ + bwb_prn.o bwb_stc.o bwb_str.o bwb_tbl.o\ + bwb_var.o bwd_cmd.o bwd_fun.o bwx_tty.o + + +HFILES= bwbasic.h + +MISCFILES= COPYING INSTALL Makefile.in README bwbasic.doc\ + bwbasic.mak configure.in configure makefile.qcl + +TESTFILES= \ + abs.bas assign.bas callfunc.bas callsub.bas chain1.bas\ + chain2.bas dataread.bas deffn.bas dim.bas doloop.bas\ + dowhile.bas elseif.bas end.bas err.bas fncallfn.bas\ + fornext.bas function.bas gosub.bas gotolabl.bas ifline.bas\ + index.txt input.bas lof.bas loopuntl.bas main.bas\ + mlifthen.bas on.bas onerr.bas onerrlbl.bas ongosub.bas\ + opentest.bas option.bas putget.bas random.bas selcase.bas\ + snglfunc.bas stop.bas term.bas whilwend.bas width.bas\ + writeinp.bas pascaltr.bas + +DISTFILES= $(CFILES) $(HFILES) $(MISCFILES) + +# Revised by JBV +#all: bwbasic +all: bwbasic renum + +bwbasic: $(OFILES) + $(CC) $(OFILES) -lm -o $@ $(LDFLAGS) + +# Added by JBV +renum: + $(CC) renum.c -o renum + +$(OFILES): $(HFILES) + +.c.o: + $(CC) -c $(CPPFLAGS) -I$(srcdir) $(DEFS) $(CFLAGS) $< + +install: all + $(INSTALL_PROGRAM) bwbasic $(bindir)/bwbasic + +uninstall: + rm -f $(bindir)/bwbasic + +Makefile: Makefile.in config.status + $(SHELL) config.status +config.status: configure + $(SHELL) config.status --recheck +configure: configure.in + cd $(srcdir); autoconf + +TAGS: $(CFILES) + etags $(CFILES) + +clean: + rm -f *.o bwbasic core + +mostlyclean: clean + +distclean: clean + rm -f Makefile config.status + +realclean: distclean + rm -f TAGS + +# Version number changed to 2.61 by PE +dist: $(DISTFILES) + echo bwbasic-3.00 > .fname + rm -rf `cat .fname` + mkdir `cat .fname` + ln $(DISTFILES) `cat .fname` + mkdir `cat .fname`/bwbtest + cd bwbtest; ln $(TESTFILES) ../`cat ../.fname`/bwbtest + tar czhf `cat .fname`.tar.gz `cat .fname` + rm -rf `cat .fname` .fname + +# Prevent GNU make v3 from overflowing arg limit on SysV. +.NOEXPORT: + +# EOF diff --git a/OW19.BAT b/OW19.BAT new file mode 100644 index 0000000..cc89da2 --- /dev/null +++ b/OW19.BAT @@ -0,0 +1,12 @@ +rem Filename: OW19.BAT +rem Purpose: Build Bywater BASIC for MSDOS (80386) using Open Watcom 1.9 +rem Author: Howard Wulf, AF5NE +rem Date: 2015-01-29 +rem Uasage: implementation defined +rem Example: +rem cd \sdcard\Download\BASIC\bwbasic3\ +rem OW19.BAT +rem +wcl386 -bc -c -ox -q -wx -za -DHAVE_MSDOS=1 -D__WATCOM__ bw*.c +wlink option quiet file bw*.obj name bwbasic.exe +rem EOF diff --git a/README b/README new file mode 100644 index 0000000..b11ecc4 --- /dev/null +++ b/README @@ -0,0 +1,485 @@ + + + README file for + + + Bywater BASIC Interpreter, version 3.20 + --------------------------------------------- + + Copyright (c) 1993, Ted A. Campbell + for bwBASIC version 2.10, 11 October 1993 + + Version 2.20 modifications by Jon B. Volkoff, + 25 November 1995 + + Patch level 1 release by Jon B. Volkoff, + 15 March 1996 + + Patch level 2 release by Jon B. Volkoff, + 11 October 1997 + + Version 2.30 modifications by Paul Edwards, + 5 March 2008 + + Version 2.40 modifications by Paul Edwards, + 26 Jan 2009 + + Version 2.50 modifications by Paul Edwards, + 4 June 2009 + + Version 2.60 modifications by Paul Edwards, + 6 November 2012 + + Version 2.61 modifications by Paul Edwards, + 4 August 2014 + + Version 3.00 modifications by Howard Wulf, AF5NE + 12 May 2015 + + Version 3.10 modifications by Howard Wulf, AF5NE + 27 July 2016 + + Version 3.20 modifications by Howard Wulf, AF5NE + 4 June 2017 + + + + +DESCRIPTION: + + The Bywater BASIC Interpreter (bwBASIC) implements a large + superset of the ANSI Standard for Minimal BASIC (X3.60-1978), + a significant subset of the ANSI Standard for Full BASIC + (X3.113-1987), and many classic BASIC dialects in C. bwBASIC + seeks to be as portable as possible. + + This version of Bywater BASIC is released under the terms of the + GNU General Public License (GPL), which is distributed with this + software in the file "COPYING". The GPL specifies the terms + under which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + + + +OBTAINING THE SOURCE CODE: + + The source code for bwBASIC is available from + http://bwbasic.sourceforge.net + + +COMMUNICATIONS: + + email: tcamp@delphi.com (for Ted Campbell) + eidetics@cerf.net (for Jon Volkoff) + mutazilah@gmail.com (for Paul Edwards) + + +A LIST OF BASIC COMMANDS AND FUNCTIONS IMPLEMENTED in bwBASIC: + + The complete list of over 500 commands, functions and operators is + in the file "ALL.txt" in the DOCS directory. Documentation for each + dialect is also in the DOCS directory. Be aware that the commands, + functions and operators available depend upon the particular BASIC + dialect selected using the OPTION VERSION command. + + +CHANGE HISTORY + +CHANGES FROM 3.10 to 3.20 + + * Implements most of the following BASIC dialects: + OPTION VERSION "BYWATER" ' Bywater BASIC 3 + OPTION VERSION "BYWATER-2" ' Bywater BASIC 2 + OPTION VERSION "CALL/360" ' SBC CALL/360 Mainframe BASIC + OPTION VERSION "CBASIC-II" ' CBASIC-II for CP/M + OPTION VERSION "DARTMOUTH" ' Dartmouth DTSS BASIC + OPTION VERSION "ECMA-55" ' ANSI Minimal BASIC + OPTION VERSION "ECMA-116" ' ANSI Full BASIC + OPTION VERSION "GCOS" ' GE 600 Mainframe BASIC + OPTION VERSION "HAARDT" ' bas 2.4 by Michael Haardt + OPTION VERSION "HANDBOOK1" ' The BASIC Handbook, 1st Edition + OPTION VERSION "HANDBOOK2" ' The BASIC Handbook, 2nd Edition + OPTION VERSION "HEATH" ' Heath Benton Harbor BASIC + OPTION VERSION "MARK-I" ' GE 265 Mainframe BASIC + OPTION VERSION "MARK-II" ' GE 435 Mainframe BASIC + OPTION VERSION "MBASIC" ' Microsoft BASIC-80 for Xenix + OPTION VERSION "PDP-8" ' DEC PDP-8 BASIC + OPTION VERSION "PDP-11" ' DEC PDP-11 BASIC + OPTION VERSION "RBASIC" ' Micronics RBASIC for 6809 FLEX + OPTION VERSION "RSTS-11" ' DEC RSTS-11 BASIC-PLUS + OPTION VERSION "SYSTEM/360" ' IBM System/360 Mainframe BASIC + OPTION VERSION "SYSTEM/370" ' IBM System/370 Mainframe BASIC + OPTION VERSION "TRS-80" ' TRS-80 Model I/III/4 LBASIC + OPTION VERSION "VINTAGE" ' Vintage BASIC 1.0.1 + OPTION VERSION "XBASIC" ' TSC XBASIC for 6800 FLEX + + * CONST variable [, ...] = value + Assigns the value to variable. + Any later assignment to the variable causus a VARIABLE NOT DECLARED error. + + * DIM now supports lower and upper bounds. + OPTION BASE 1 + DIM X( 9 ) ' lower bound is 1 + DIM Y( 5 TO 9 ) ' lower bound is 5 + + * DIM now supports virtual variables. + OPTION BASE 1 + OPEN "VIRTUAL.DAT" FOR VIRTUAL AS # 3 ' virtual data file + DIM # 3, A( 1000 ) ' array is virtual + LET A( 1000 ) = 0 ' value is written to the file + LET X = A( 1000 ) ' value is read from the file + CLOSE # 3 ' array is no longer valid + + * ERROR 27, "Bad DATA" + Occurs when the READ command detects garbage in a DATA command. + + * INPUT LINE + Same as LINE INPUT. + + * MAT now supports lower and upper bounds. + OPTION BASE 1 + MAT X( 9 ) = ZER ' lower bound is 1 + MAT Y( 5 TO 9 ) = ZER ' lower bound is 5 + MAT X = ZER( 9 ) ' lower bound is 1 + MAT Y - ZER( 5 TO 9 ) ' lower bound is 5 + + * MAXLEN() + Returns the maximum string length. + + * OPTION DIGITS integer + Sets the number of significant digits for PRINT. + Setting the value to zero restores the default. + + * OPTION EDIT string$ + Sets the program name used by the EDIT command. + Setting this to "" disables EDIT command. + + * OPTION FILES string$ + Sets the program name used by the FILES command. + Setting this to "" disables FILES command. + + * OPTION PROMPT string$ + Sets the prompt. + + * OPTION PUNCT AT char$ + Sets the PRINT AT character, commonly "@". + Setting this to "" disables PRINT AT. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT BYTE char$ + Sets the BYTE type suffix, commonly "~". + Setting this to "" disables BYTE suffix. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT COMMENT char$ + Sets the trailing COMMENT character, commonly "'". + Setting this to "" disables trailing comments. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT CURRENCY char$ + Sets the CURRENCY type suffix, commonly "@". + Setting this to "" disables CURRENCY suffix. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT DOUBLE char$ + Sets the DOUBLE type suffix, commonly "#". + Setting this to "" disables DOUBLE suffix. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT FILENUM char$ + Sets the FILE NUMBER prefix, commonly "#". + Setting this to "" disables the FILE NUMBER prefix. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT IMAGE char$ + Sets the shortcut IMAGE character, commonly ":". + Setting this to "" disables the shortcut IMAGE character. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT INPUT char$ + Sets the shortcut INPUT character, commonly "!". + Setting this to "" disables the shortcut INPUT character. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT INTEGER char$ + Sets the INTEGER type suffix, commonly "%". + Setting this to "" disables INTEGER suffix. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT LONG char$ + Sets the LONG type suffix, commonly "&". + Setting this to "" disables LONG suffix. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT LPAREN char$ + Sets the LEFT PARENTHESIS character, commonly "(". + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT PRINT char$ + Sets the shortcut PRINT character, commonly "?". + Setting this to "" disables the shortcut PRINT character. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT QUOTE char$ + Sets the QUOTE character, commonly """". + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT RPAREN char$ + Sets the RIGHT PARENTHESIS character, commonly ")". + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT SINGLE char$ + Sets the SINGLE type suffix, commonly "!". + Setting this to "" disables SINGLE suffix. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT STATEMENT char$ + Sets the shortcut STATEMENT seperator character, commonly ":". + Setting this to "" disables the STATEMENT seperator. + Setting this to a non-punctuation character is not supported. + + * OPTION PUNCT STRING char$ + Sets the STRING type suffix, commonly "$". + Setting this to "" disables STRING suffix. + Setting this to a non-punctuation character is not supported. + + * OPTION RECLEN integer + Sets the default record length for RANDOM files, commonly 128. + Setting thisto zero means there is no default RANDOM record + length, so the record length must be specified in the OPEN + statement. + With OPTION RECLEN 128: + OPEN "FILE.DAT" FOR RANDOM AS #3 + is considered to be the same as + OPEN "FILE.DAT" FOR RANDOM AS #3 LEN 128 + With OPTION RECLEN 0: + OPEN "FILE.DAT" FOR RANDOM AS #3 + causes an error. + + * OPTION RENUM string$ + Sets the program name used by the RENUM command. + Setting this to "" disables RENUM command. + + * OPTION SCALE integer + Sets the number of digits to round after the decimal point for PRINT. + Setting the value to zero disables rounding. + + * OPTION USING DIGIT + * OPTION USING COMMA + * OPTION USING PERIOD + * OPTION USING PLUS + * OPTION USING MINUS + * OPTION USING EXRAD + * OPTION USING DOLLAR + * OPTION USING FILLER + * OPTION USING LITERAL + * OPTION USING FIRST + * OPTION USING ALL + * OPTION USING LENGTH + Sets the characters recognized by PRINT USING. + Setting these to a non-punctuation character is not supported. + + * OPTION VERSION now requires a string instead of a literal. + Some version names have changed. + + * OPTION VERSION "PDP-8" + Added LPT, PTP, PTR, TTY, TTY IN and TTY OUT commands. + Added GET() and PUT() functions. + + * OPTION VERSION "CALL/360" + * OPTION VERSION "SYSTEM/360" + * OPTION VERSION "SYSTEM/370" + Added alphabet extenders. $ is a string variable. + + * OPTION ZONE integer + Sets the PRINT zone width. + Setting the value to zero restores the default. + + * REPEAT - UNTIL added + REPEAT + ... + EXIT REPEAT + ... + UNTIL expression ' exits when expression != 0 + + * SPC( X ) and TAB( X ) + No longer use control codes. + + * UNTIL - UEND removed (to add REPEAT - UNTIL) + Here is a work-around for existin code using UNTIL-UEND: + UNITL expression -->> WHILE NOT expression + ... ... + EXIT UNTIL -->> EXIT WHILE + ... ... + UEND -->> WEND + + * from Howard Wulf, AF5NE + + +CHANGES FROM 3.00 to 3.10 + + * Implements most of the following BASIC dialects: + OPTION VERSION DARTMOUTH ' Dartmouth DTSS BASIC + OPTION VERSION MARK-I ' GE 265 Mainframe BASIC + OPTION VERSION MARK-II ' GE 435 Mainframe BASIC + OPTION VERSION SYSTEM-360 ' IBM System/360 BASIC + OPTION VERSION SYSTEM-370 ' IBM System/370 BASIC + OPTION VERSION CBASIC-II ' CBASIC-II for CP/M + OPTION VERSION ECMA-55 ' ANSI Minimal BASIC + OPTION VERSION HANDBOOK1 ' The BASIC Handbook, 1st Edition + OPTION VERSION HANDBOOK2 ' The BASIC Handbook, 2nd Edition + OPTION VERSION TRS-80 ' TRS-80 Model I/III/4 LBASIC + OPTION VERSION BASIC-80 ' Microsoft BASIC-80 for Xenix + OPTION VERSION ECMA-116 ' ANSI Full BASIC + + * from Howard Wulf, AF5NE + + +CHANGES FROM 2.61 to 3.00 + + * Code redesign from Howard Wulf, AF5NE + + +CHANGES FROM 2.60 to 2.61 + + * Bug fix from Matthias Rustler + + +CHANGES FROM 2.50 to 2.60 + + * New maths functions and append mode support from Edmond Orignac + + * Bug fixes + + +CHANGES FROM 2.40 to 2.50 + + * Bug fixes + + * New compilation procedure for MVS and CMS + + +CHANGES FROM 2.30 to 2.40 + + * Bug fixes from Bill Chatfield + + * Updated documentation + + * Added support for compiling on CMS (another IBM mainframe OS) + + +CHANGES FROM 2.20pl2 to 2.30 + + * Minor bug fixes, cosmetic improvements and portability improvements + + * Added support for compiling on MVS (IBM mainframe) + + +CHANGES FROM 2.20pl1 to 2.20pl2 + +bwb_cmd.c + Fixed calling stack level logic in RETURN statement to prevent erroneous + "RETURN without GOSUB" messages. + +bwb_cnd.c +bwb_stc.c + + Changed continuation condition for WHILE, ELSEIF, and LOOP UNTIL + to be != FALSE, not == TRUE. More in line with common commercial + BASIC implementations. + +bwb_mth.c + Fixed initialization in VAL function so that old results are not later + returned as values. + +bwb_var.c + Added parenthesis level checking to dim_getparams. Using multi-level + expressions as array subscripts was causing the program to bomb. + +bwx_iqc.c +bwx_tty.c +bwb_mes.h + Added second copyright notice. + +bwb_dio.c +bwb_str.c + Added support for strings longer than 255 characters. + +bwb_prn.c + Disabled tab expansion and print width checks when not printing to a file. + +bwb_inp.c + Fixed LINE INPUT file reads to accommodate strings of length MAXSTRINGSIZE. + +bwx_ncu.h +bwx_ncu.c + New files. Code for UNIX ncurses interface, compliments of L.C. Benschop, + Eindhoven, The Netherlands. + +Makefile.ncu + New files. Sample makefile for ncurses implementation. + +bwbasic.h + Revised defines for MININTSIZE and MAXINTSIZE from 16-bit to 32-bit limits. + Revised define for MAXSTRINGSIZE from 255 to 5000 characters. + Changed string length from unsigned char to unsigned int to support strings + longer than 255 characters. + Added support for new ncurses package. + Revised VERSION define to reflect above changes. + + +CHANGES FROM 2.20 to 2.20pl1 + +bwb_cnd.c + + Moved init routine for bwb_while so that it would be initialized regardless + of expression value, not just if TRUE. This was causing some segmentation + faults in WHILE-WEND loops. + +bwb_elx.c + + Plugged gaping memory leak. Temp variable space for expression evaluation + was being allocated but not freed when done (oops!). + +bwb_fnc.c + + Added check for NULL return from getenv to prevent segmentation faults. + +bwbasic.h + Revised VERSION define to reflect above changes. + + + +CHANGES FROM 2.10 to 2.20: + + * Plugged numerous memory leaks, resolved memory overruns and allocation + difficulties. + + * General cleanup and bug fixes, too many to list in detail here. + The major problem areas addressed were: + + - RUN command with file name argument + - nested and cascaded FOR-NEXT loops + - PRINT USING + - EOF, LOF functions + - string concatenation + - operator hierarchy + - multi-level expression evaluation + - hex constant interpretation + - hex and octal constants in INPUT and DATA statements + + * Added a CLOSE all files feature (when no argument supplied). + + * Added a unary minus sign operator. + + * Added a MID$ command to complement the MID$ function. + + * Added a RENUM facility in a standalone program. + + * Added checking in configure for unistd.h (important on Sun systems). + + + + diff --git a/allcms.bat b/allcms.bat new file mode 100644 index 0000000..c41b5da --- /dev/null +++ b/allcms.bat @@ -0,0 +1,9 @@ +del output.txt +call zipcms + +rem for S/380 testing, use this +call runcms allcms.exec output.txt all.zip bwbasic-exe.vmarc + +rem for S/390 testing, use this +rem mvsendec encb all.zip all.dat +rem loc2ebc all.dat xfer.card diff --git a/allcms.exec b/allcms.exec new file mode 100644 index 0000000..ef8f686 --- /dev/null +++ b/allcms.exec @@ -0,0 +1,28 @@ +* Usage - ALLCMS + +* This script compiles all the files on SRC disk (default is A) +* and copies the resultant modules to the EXE disk (default B) + +&SRC = A +&EXE = B + + +&IF &INDEX EQ 0 &GOTO -FINARGS +&SRC = &1 +&ARGS &2 &3 &4 &5 &6 &7 &8 &9 + +&IF &INDEX EQ 0 &GOTO -FINARGS +&EXE = &1 + +-FINARGS + + +FILEDEF INPUT TAP1 (LRECL 0 BLKSIZE 32760 RECFM U +MVSUNZIP DD:INPUT &SRC +FILEDEF INPUT CLEAR + + +EXEC COMPILE &SRC &EXE + + +VMARC PACK * * &EXE (TAP2 BLOCK 80 diff --git a/allmvs.bat b/allmvs.bat new file mode 100644 index 0000000..53c01ba --- /dev/null +++ b/allmvs.bat @@ -0,0 +1,3 @@ +del output.txt +call zipmvs +call subjobs diff --git a/bwb_cmd.c b/bwb_cmd.c new file mode 100644 index 0000000..d627d34 --- /dev/null +++ b/bwb_cmd.c @@ -0,0 +1,10217 @@ +/*************************************************************** + + bwb_cmd.c Miscellaneous Commands + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + +static void bwb_copy_file (char *Source, char *Target); +static LineType *bwb_delete (LineType * l); +static void bwb_display_file (char *Source); +static LineType *bwb_load (LineType * Line, char *Prompt, int IsNew); +static void bwb_new (void); +static LineType *bwb_run_filename_or_linenumber (LineType * L); +static LineType *bwb_save (LineType * Line, char *Prompt); +static LineType *bwb_system (LineType * l); +static LineType *bwb_xlist (LineType * l, FILE * file); +static LineType *bwx_run (LineType * Line, char *ProgramName); +static void CommandOptionVersion (int n, char *OutputLine); +static void CommandUniqueID (int i, char *UniqueID); +static void CommandVector (int i, char *Vector); +static VariableType *find_variable_by_type (char *name, int dimensions, + char VariableTypeCode); +static void FixUp (char *Name); +static LineType *H14_RENAME (LineType * l); +static int line_read_matrix_redim (LineType * l, VariableType * v); +static void ProcessEscapeChars (const char *Input, char *Output); +static int xl_line (FILE * file, LineType * l); + + +/* + fprintf( file, "------------------------------------------------------------\n"); + 123456789012345678901234567890123456789012345678901234567890 + fprintf( file, " SYNTAX: %s\n", IntrinsicCommandTable[n].Syntax); + sprintf( tbuf, "DESCRIPTION: %s\n", IntrinsicCommandTable[n].Description); + fprintf( file, " " ); + fprintf( file, " [%c] %s\n", X, bwb_vertable[i].Name); + 1234567890123 +*/ +#define LEFT_LENGTH 13 +#define RIGHT_LENGTH 47 +#define TOTAL_LENGTH ( LEFT_LENGTH + RIGHT_LENGTH ) + +/* +-------------------------------------------------------------------------------------------- + EDIT, RENUM, RENUMBER +-------------------------------------------------------------------------------------------- +*/ + +static LineType * +bwx_run (LineType * Line, char *ProgramName) +{ + size_t n; + char *tbuf; + + assert (Line != NULL); + assert( My != NULL ); + + if (is_empty_string (ProgramName)) + { + WARN_BAD_FILE_NAME; + return (Line); + } + if (is_empty_string (My->ProgramFilename)) + { + WARN_BAD_FILE_NAME; + return (Line); + } + n = bwb_strlen (ProgramName) + 1 + bwb_strlen (My->ProgramFilename); + if ((tbuf = (char *) calloc (n + 1 /* NulChar */ , sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (Line); + } + bwb_strcpy (tbuf, ProgramName); + bwb_strcat (tbuf, " "); + bwb_strcat (tbuf, My->ProgramFilename); + system (tbuf); + free (tbuf); + tbuf = NULL; + + /* open edited file for read */ + bwb_NEW (Line); /* Relocated by JBV (bug found by DD) */ + if (bwb_fload (NULL) == FALSE) + { + WARN_BAD_FILE_NAME; + return (Line); + } + return (Line); +} + + + +/*************************************************************** + + FUNCTION: bwb_edit() + + DESCRIPTION: This function implements the BASIC EDIT + program by shelling out to a default editor + specified by the variable BWB.EDITOR$. + + SYNTAX: EDIT + +***************************************************************/ + +LineType * +bwb_EDIT (LineType * Line) +{ + /* + SYNTAX: EDIT + */ + + assert (Line != NULL); + assert( My != NULL ); + + return bwx_run (Line, My->OptionEditString); +} + +/*************************************************************** + + FUNCTION: bwb_renum() + + DESCRIPTION: This function implements the BASIC RENUM + command by shelling out to a default + renumbering program called "renum". + Added by JBV 10/95 + + SYNTAX: RENUM + +***************************************************************/ + +LineType * +bwb_RENUM (LineType * Line) +{ + /* + SYNTAX: RENUM + */ + + assert (Line != NULL); + assert( My != NULL ); + + return bwx_run (Line, My->OptionRenumString); +} + +LineType * +bwb_RENUMBER (LineType * Line) +{ + /* + SYNTAX: RENUMBER + */ + + assert (Line != NULL); + assert( My != NULL ); + + return bwx_run (Line, My->OptionRenumString); +} + +/* +-------------------------------------------------------------------------------------------- + REM +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_REM (LineType * L) +{ + /* + SYNTAX: REM comment + */ + /* + This line holds BASIC comments. + */ + + assert (L != NULL); + + line_skip_eol (L); + return L; +} + +/* +-------------------------------------------------------------------------------------------- + IMAGE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_IMAGE (LineType * L) +{ + /* + SYNTAX: IMAGE print-using-format + */ + + assert (L != NULL); + + line_skip_eol (L); + return L; +} + +/* +-------------------------------------------------------------------------------------------- + LET +-------------------------------------------------------------------------------------------- +*/ + + +LineType * +bwb_LET (LineType * L) +{ + /* + SYNTAX: LET variable [,...] = expression + */ + VariableType *v; + VariantType x; + VariantType *X; + + assert (L != NULL); + X = &x; + CLEAR_VARIANT (X); + /* read the list of variables */ + do + { + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + } + while (line_skip_seperator (L)); + + /* skip the equal sign */ + if (line_skip_EqualChar (L)) + { + /* OK */ + } + else if (line_skip_word (L, "EQ")) + { + /* OK */ + } + else if (line_skip_word (L, ".EQ.")) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + + /* evaluate the expression */ + if (line_read_expression (L, X)) /* bwb_LET */ + { + /* save the value */ + if (line_is_eol (L) == FALSE) + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + L->position = L->Startpos; + + /* for each variable, assign the value */ + do + { + /* read a variable */ + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + assert (v != NULL); + assert (X != NULL); + if (var_set (v, X) == FALSE) + { + WARN_TYPE_MISMATCH; + goto EXIT; + } + } + while (line_skip_seperator (L)); + + /* we are now at the equals sign */ + line_skip_eol (L); + } + else + { + WARN_SYNTAX_ERROR; + } +EXIT: + RELEASE_VARIANT (X); + return L; +} + + +LineType * +bwb_CONST (LineType * L) +{ + /* + SYNTAX: CONST variable [,...] = expression + */ + VariableType *v; + VariantType x; + VariantType *X; + + assert (L != NULL); + + X = &x; + CLEAR_VARIANT (X); + /* read the list of variables */ + do + { + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + } + while (line_skip_seperator (L)); + /* we are now at the equals sign */ + + /* skip the equal sign */ + if (line_skip_EqualChar (L)) + { + /* OK */ + } + else if (line_skip_word (L, "EQ")) + { + /* OK */ + } + else if (line_skip_word (L, ".EQ.")) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + + /* evaluate the expression */ + if (line_read_expression (L, X)) /* bwb_LET */ + { + /* save the value */ + if (line_is_eol (L) == FALSE) + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + + /* for each variable, assign the value */ + L->position = L->Startpos; + do + { + /* read a variable */ + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + assert (v != NULL); + assert (X != NULL); + if (var_set (v, X) == FALSE) + { + WARN_TYPE_MISMATCH; + goto EXIT; + } + } + while (line_skip_seperator (L)); + /* we are now at the equals sign */ + + /* for each variable, mark as constant */ + L->position = L->Startpos; + do + { + /* read a variable */ + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + assert (v != NULL); + v->VariableFlags |= VARIABLE_CONSTANT; + } + while (line_skip_seperator (L)); + /* we are now at the equals sign */ + + line_skip_eol (L); + } + else + { + WARN_SYNTAX_ERROR; + } +EXIT: + RELEASE_VARIANT (X); + return L; +} + +LineType * +bwb_DEC (LineType * L) +{ + /* + SYNTAX: DEC variable [,...] + */ + VariableType *v; + VariantType x; + VariantType *X; + + assert (L != NULL); + + X = &x; + CLEAR_VARIANT (X); + /* read the list of variables */ + do + { + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + if (v->VariableTypeCode == StringTypeCode) + { + WARN_TYPE_MISMATCH; + goto EXIT; + } + } + while (line_skip_seperator (L)); + /* we are now at the end of the line */ + + if (line_is_eol (L) == FALSE) + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + L->position = L->Startpos; + + /* for each variable, assign the value */ + do + { + /* read a variable */ + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + assert (v != NULL); + assert (X != NULL); + if (var_get (v, X) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + X->Number--; + if (var_set (v, X) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + } + while (line_skip_seperator (L)); + /* we are now at the end of the line */ +EXIT: + RELEASE_VARIANT (X); + return L; +} + +LineType * +bwb_INC (LineType * L) +{ + /* + SYNTAX: INC variable [,...] + */ + VariableType *v; + VariantType x; + VariantType *X; + + assert (L != NULL); + + X = &x; + CLEAR_VARIANT (X); + /* read the list of variables */ + do + { + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + if (v->VariableTypeCode == StringTypeCode) + { + WARN_TYPE_MISMATCH; + goto EXIT; + } + } + while (line_skip_seperator (L)); + /* we are now at the end of the line */ + + if (line_is_eol (L) == FALSE) + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + L->position = L->Startpos; + + /* for each variable, assign the value */ + do + { + /* read a variable */ + if ((v = line_read_scalar (L)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + assert (v != NULL); + assert (X != NULL); + if (var_get (v, X) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + X->Number++; + if (var_set (v, X) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + } + while (line_skip_seperator (L)); + /* we are now at the end of the line */ +EXIT: + RELEASE_VARIANT (X); + return L; +} + + + +/* +-------------------------------------------------------------------------------------------- + GO +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_GO (LineType * L) +{ + + assert (L != NULL); + WARN_SYNTAX_ERROR; + return L; +} + +LineType * +bwb_THEN (LineType * L) +{ + + assert (L != NULL); + WARN_SYNTAX_ERROR; + return L; +} + +LineType * +bwb_TO (LineType * L) +{ + + assert (L != NULL); + WARN_SYNTAX_ERROR; + return L; +} + +LineType * +bwb_STEP (LineType * L) +{ + + assert (L != NULL); + WARN_SYNTAX_ERROR; + return L; +} + +LineType * +bwb_OF (LineType * L) +{ + + assert (L != NULL); + WARN_SYNTAX_ERROR; + return L; +} + +LineType * +bwb_AS (LineType * L) +{ + + assert (L != NULL); + WARN_SYNTAX_ERROR; + return L; +} + + +/* +-------------------------------------------------------------------------------------------- + AUTO +-------------------------------------------------------------------------------------------- +*/ + + +LineType * +bwb_BUILD (LineType * L) +{ + /* + SYNTAX: BUILD + SYNTAX: BUILD start + SYNTAX: BUILD start, increment + */ + + assert (L != NULL); + return bwb_AUTO (L); +} + +LineType * +bwb_AUTO (LineType * L) +{ + /* + SYNTAX: AUTO + SYNTAX: AUTO start + SYNTAX: AUTO start , increment + */ + + assert (L != NULL); + assert( My != NULL ); + + My->AutomaticLineNumber = 0; + My->AutomaticLineIncrement = 0; + + if (line_is_eol (L)) + { + /* AUTO */ + My->AutomaticLineNumber = 10; + My->AutomaticLineIncrement = 10; + return L; + } + if (line_read_line_number (L, &My->AutomaticLineNumber)) + { + /* AUTO ### ... */ + if (My->AutomaticLineNumber < MINLIN || My->AutomaticLineNumber > MAXLIN) + { + WARN_UNDEFINED_LINE; + return L; + } + if (line_is_eol (L)) + { + /* AUTO start */ + My->AutomaticLineIncrement = 10; + return L; + } + else if (line_skip_seperator (L)) + { + /* AUTO ### , ... */ + if (line_read_line_number (L, &My->AutomaticLineIncrement)) + { + /* AUTO start , increment */ + if (My->AutomaticLineIncrement < MINLIN + || My->AutomaticLineIncrement > MAXLIN) + { + WARN_UNDEFINED_LINE; + return L; + } + return L; + } + } + } + My->AutomaticLineNumber = 0; + My->AutomaticLineIncrement = 0; + WARN_SYNTAX_ERROR; + return L; +} + +/* +-------------------------------------------------------------------------------------------- + BREAK +-------------------------------------------------------------------------------------------- +*/ + + +LineType * +bwb_BREAK (LineType * l) +{ + /* + SYNTAX: BREAK + SYNTAX: BREAK line [,...] + SYNTAX: BREAK line - line + */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->StartMarker != NULL ); + assert( My->EndMarker != NULL ); + + if (line_is_eol (l)) + { + /* BREAK */ + /* remove all line breaks */ + LineType *x; + for (x = My->StartMarker->next; x != My->EndMarker; x = x->next) + { + x->LineFlags &= ~LINE_BREAK; + } + return (l); + } + else + { + do + { + int head; + int tail; + + if (line_read_line_sequence (l, &head, &tail)) + { + /* BREAK 's' - 'e' */ + LineType *x; + if (head < MINLIN || head > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + if (tail < MINLIN || tail > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + if (head > tail) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* valid range */ + /* now go through and list appropriate lines */ + for (x = My->StartMarker->next; x != My->EndMarker; x = x->next) + { + if (head <= x->number && x->number <= tail) + { + if (x->LineFlags & LINE_NUMBERED) + { + x->LineFlags |= LINE_BREAK; + } + } + } + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + } + while (line_skip_seperator (l)); + } + return (l); +} + + +/* +-------------------------------------------------------------------------------------------- + DSP +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_DSP (LineType * l) +{ + /* + SYNTAX: DSP + SYNTAX: DSP variablename [,...] + */ + VariableType *v; + + assert (l != NULL); + assert( My != NULL ); + + + if (line_is_eol (l)) + { + /* DSP */ + /* remove all variable displays */ + for (v = My->VariableHead; v != NULL; v = v->next) + { + v->VariableFlags &= ~VARIABLE_DISPLAY; /* bwb_DSP() */ + } + return (l); + } + /* DSP variablename [,...] */ + do + { + char varname[NameLengthMax + 1]; + + if (line_read_varname (l, varname)) + { + /* mark the variable */ + for (v = My->VariableHead; v != NULL; v = v->next) + { + if (bwb_stricmp (v->name, varname) == 0) + { + v->VariableFlags |= VARIABLE_DISPLAY; /* bwb_DSP() */ + } + } + } + } + while (line_skip_seperator (l)); + return (l); +} + + +/* +-------------------------------------------------------------------------------------------- + GOTO +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_GO_TO (LineType * l) +{ + + assert (l != NULL); + return bwb_GOTO (l); +} + +LineType * +bwb_GOTO (LineType * l) +{ + /* + SYNTAX: GOTO line ' standard GOTO + SYNTAX: GOTO expression ' calculated GOTO + SYNTAX: GOTO expression OF line,... ' indexed GOTO, same as ON expression GOTO line,... + SYNTAX: GOTO line [,...] ON expression ' indexed GOTO, same as ON expression GOTO line,... + */ + int Value; + int LineNumber; + LineType *x; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + Value = 0; + LineNumber = 0; + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (line_is_eol (l)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (line_is_eol (l)) + { + /* GOTO linenumber */ + /* 'Value' is the line number */ + LineNumber = Value; + } + else if (line_skip_word (l, "OF")) + { + /* GOTO expression OF line, ... */ + /* 'Value' is an index into a list of line numbers */ + if (line_read_index_item (l, Value, &LineNumber)) + { + /* found 'LineNumber' */ + } + else if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_ON) ) /* GOTO X OF ... */ + { + /* silently fall-thru to the following line */ + line_skip_eol (l); + return (l); + } + else + { + /* ERROR */ + WARN_UNDEFINED_LINE; + return (l); + } + } + else if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* GOTO line [,...] ON expression */ + while (line_skip_seperator (l)) + { + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + if (line_skip_word (l, "ON") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* 'Value' is an index into a list of line numbers */ + l->position = l->Startpos; + if (line_read_index_item (l, Value, &LineNumber)) + { + /* found 'LineNumber' */ + } + else + { + /* silently fall-thru to the following line */ + line_skip_eol (l); + return (l); + } + line_skip_eol (l); + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (LineNumber < MINLIN || LineNumber > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + /* valid range */ + x = NULL; +#if THE_PRICE_IS_RIGHT + if (l->OtherLine != NULL) + { + /* look in the cache */ + if (l->OtherLine->number == LineNumber) + { + x = l->OtherLine; /* found in cache */ + } + } +#endif /* THE_PRICE_IS_RIGHT */ + if (x == NULL) + { + x = find_line_number (LineNumber); /* not found in the cache */ + } + if (x != NULL) + { + /* FOUND */ + line_skip_eol (l); + x->position = 0; +#if THE_PRICE_IS_RIGHT + l->OtherLine = x; /* save in cache */ +#endif /* THE_PRICE_IS_RIGHT */ + return x; + } + /* NOT FOUND */ + WARN_UNDEFINED_LINE; + return (l); +} + + +/* +-------------------------------------------------------------------------------------------- + GOSUB +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_GO_SUB (LineType * l) +{ + + assert (l != NULL); + return bwb_GOSUB (l); +} + +LineType * +bwb_GOSUB (LineType * l) +{ + /* + SYNTAX: GOSUB line ' standard GOSUB + SYNTAX: GOSUB expression ' calculated GOSUB + SYNTAX: GOSUB expression OF line,... ' indexed GOSUB, same as ON expression GOSUB line,... + SYNTAX: GOSUB line [,...] ON expression ' indexed GOSUB, same as ON expression GOSUB line,... + */ + int Value; + int LineNumber; + LineType *x; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + Value = 0; + LineNumber = 0; + x = NULL; + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (line_is_eol (l)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (line_is_eol (l)) + { + /* GOSUB linenumber */ + /* 'Value' is the line number */ + LineNumber = Value; + } + else if (line_skip_word (l, "OF")) + { + /* GOSUB linenumber [,...] OF expression */ + /* 'Value' is an index into a list of line numbers */ + if (line_read_index_item (l, Value, &LineNumber)) + { + /* found 'LineNumber' */ + } + else if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_ON) ) /* GOSUB X OF ... */ + { + /* silently fall-thru to the following line */ + line_skip_eol (l); + return (l); + } + else + { + /* ERROR */ + WARN_UNDEFINED_LINE; + return (l); + } + } + else if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* GOSUB line [,...] ON expression */ + while (line_skip_seperator (l)) + { + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + if (line_skip_word (l, "ON") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* 'Value' is an index into a list of line numbers */ + l->position = l->Startpos; + if (line_read_index_item (l, Value, &LineNumber)) + { + /* found 'LineNumber' */ + } + else + { + /* silently fall-thru to the following line */ + line_skip_eol (l); + return (l); + } + line_skip_eol (l); + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (LineNumber < MINLIN || LineNumber > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + /* valid range */ + x = NULL; +#if THE_PRICE_IS_RIGHT + if (l->OtherLine != NULL) + { + /* look in the cache */ + if (l->OtherLine->number == LineNumber) + { + x = l->OtherLine; /* found in cache */ + } + } +#endif /* THE_PRICE_IS_RIGHT */ + if (x == NULL) + { + x = find_line_number (LineNumber); /* not found in the cache */ + } + if (x != NULL) + { + /* FOUND */ + line_skip_eol (l); + /* save current stack level */ + My->StackHead->line = l; + /* increment exec stack */ + if (bwb_incexec ()) + { + /* set the new position to x and return x */ + x->position = 0; + My->StackHead->line = x; + My->StackHead->ExecCode = EXEC_GOSUB; +#if THE_PRICE_IS_RIGHT + l->OtherLine = x; /* save in cache */ +#endif /* THE_PRICE_IS_RIGHT */ + return x; + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return My->EndMarker; + } + } + /* NOT FOUND */ + WARN_UNDEFINED_LINE; + return (l); +} + + + +/* +-------------------------------------------------------------------------------------------- + RETURN +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_RETURN (LineType * l) +{ + /* + SYNTAX: RETURN + */ + + assert (l != NULL); + assert (My != NULL); + assert (My->CurrentVersion != NULL); + assert (My->StackHead != NULL); + + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* RETURN [comment] */ + line_skip_eol (l); + } + + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + /* CBASIC-II: RETURN exits the first FUNCTION or GOSUB */ + + while (My->StackHead->ExecCode != EXEC_GOSUB + && My->StackHead->ExecCode != EXEC_FUNCTION) + { + bwb_decexec (); + if (My->StackHead == NULL) + { + WARN_RETURN_WITHOUT_GOSUB; + return (l); + } + if (My->StackHead->ExecCode == EXEC_NORM) /* End of the line? */ + { + WARN_RETURN_WITHOUT_GOSUB; + return (l); + } + } + } + else + { + /* RETURN exits the first GOSUB */ + + while (My->StackHead->ExecCode != EXEC_GOSUB) + { + bwb_decexec (); + if (My->StackHead == NULL) + { + WARN_RETURN_WITHOUT_GOSUB; + return (l); + } + if (My->StackHead->ExecCode == EXEC_NORM) /* End of the line? */ + { + WARN_RETURN_WITHOUT_GOSUB; + return (l); + } + } + } + + + /* decrement the EXEC stack counter */ + + bwb_decexec (); + assert (My->StackHead != NULL); + return My->StackHead->line; +} + +/* +-------------------------------------------------------------------------------------------- + POP +-------------------------------------------------------------------------------------------- +*/ + + +LineType * +bwb_POP (LineType * l) +{ + /* + SYNTAX: POP + */ + StackType *StackItem; + + assert (l != NULL); + assert (My != NULL); + assert (My->CurrentVersion != NULL); + assert (My->StackHead != NULL); + + StackItem = My->StackHead; + while (StackItem->ExecCode != EXEC_GOSUB) + { + StackItem = StackItem->next; + if (StackItem == NULL) + { + WARN_RETURN_WITHOUT_GOSUB; + return (l); + } + if (StackItem->ExecCode == EXEC_NORM) + { + /* End of the line */ + WARN_RETURN_WITHOUT_GOSUB; + return (l); + } + } + /* hide the GOSUB */ + StackItem->ExecCode = EXEC_POPPED; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + ON +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_ON (LineType * l) +{ + /* + SYNTAX: ON expression GOTO line,... ' expression evaluates to an index + SYNTAX: ON expression GOSUB line,... ' expression evaluates to an index + */ + int Value; + int command; + int LineNumber; + LineType *x; + + assert (l != NULL); + assert (My != NULL); + assert (My->CurrentVersion != NULL); + + Value = 0; + command = 0; + LineNumber = 0; + x = NULL; + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (line_is_eol (l)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_UNDEFINED_LINE; + return (l); + } + if (line_skip_word (l, "GO")) + { + if (line_skip_word (l, "TO")) + { + command = C_GOTO; + } + else if (line_skip_word (l, "SUB")) + { + command = C_GOSUB; + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_word (l, "GOTO")) + { + command = C_GOTO; + } + else if (line_skip_word (l, "GOSUB")) + { + command = C_GOSUB; + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + + /* 'Value' is an index into a list of line numbers */ + if (line_read_index_item (l, Value, &LineNumber)) + { + /* found 'LineNumber' */ + } + else if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_ON) ) /* ON X GOTO|GOSUB ... */ + { + /* silently fall-thru to the following line */ + line_skip_eol (l); + return (l); + } + else + { + /* ERROR */ + WARN_UNDEFINED_LINE; + return (l); + } + + if (LineNumber < MINLIN || LineNumber > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + /* valid range */ + x = NULL; +#if THE_PRICE_IS_RIGHT + if (l->OtherLine != NULL) + { + /* look in the cache */ + if (l->OtherLine->number == LineNumber) + { + x = l->OtherLine; /* found in cache */ + } + } +#endif /* THE_PRICE_IS_RIGHT */ + if (x == NULL) + { + x = find_line_number (LineNumber); /* not found in the cache */ + } + if (x != NULL) + { + /* FOUND */ + if (command == C_GOTO) + { + /* ON ... GOTO ... */ + line_skip_eol (l); + x->position = 0; +#if THE_PRICE_IS_RIGHT + l->OtherLine = x; /* save in cache */ +#endif /* THE_PRICE_IS_RIGHT */ + return x; + } + else if (command == C_GOSUB) + { + /* ON ... GOSUB ... */ + line_skip_eol (l); + /* save current stack level */ + My->StackHead->line = l; + /* increment exec stack */ + if (bwb_incexec ()) + { + /* set the new position to x and return x */ + x->position = 0; + My->StackHead->line = x; + My->StackHead->ExecCode = EXEC_GOSUB; +#if THE_PRICE_IS_RIGHT + l->OtherLine = x; /* save in cache */ +#endif /* THE_PRICE_IS_RIGHT */ + return x; + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return My->EndMarker; + } + } + else + { + /* ERROR */ + WARN_SYNTAX_ERROR; + return (l); + } + } + /* NOT FOUND */ + WARN_UNDEFINED_LINE; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + PAUSE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_PAUSE (LineType * l) +{ + /* + SYNTAX: PAUSE + */ + char *pstring; + char *tbuf; + int tlen; + + assert (l != NULL); + assert (My != NULL); + assert (My->CurrentVersion != NULL); + assert (My->ConsoleOutput != NULL); + assert (My->ConsoleInput != NULL); + + pstring = My->ConsoleOutput; + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* PAUSE [comment] */ + line_skip_eol (l); + } + sprintf (pstring, "PAUSE AT %d\n", l->number); + bwx_input (pstring, FALSE, tbuf, tlen); + return (l); +} + + +/* +-------------------------------------------------------------------------------------------- + STOP +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_STOP (LineType * l) +{ + /* + SYNTAX: STOP + */ + + assert (l != NULL); + assert (My != NULL); + assert (My->CurrentVersion != NULL); + + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* STOP [comment] */ + line_skip_eol (l); + } + My->ContinueLine = l->next; + bwx_STOP (TRUE); + return bwb_END (l); +} + + +/* +-------------------------------------------------------------------------------------------- + END +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_END (LineType * l) +{ + /* + SYNTAX: END + */ + + assert (l != NULL); + assert (My != NULL); + assert (My->CurrentVersion != NULL); + + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* END [comment] */ + line_skip_eol (l); + } + My->ContinueLine = l->next; + bwx_STOP (FALSE); + return My->EndMarker; +} + +/* +-------------------------------------------------------------------------------------------- + RUN +-------------------------------------------------------------------------------------------- +*/ + +static LineType * +bwb_run_filename_or_linenumber (LineType * L) +{ + LineType *current = NULL; + VariantType x; + VariantType *X; + + assert (L != NULL); + assert (My != NULL); + assert (My->StartMarker != NULL); + + X = &x; + CLEAR_VARIANT (X); + if (line_read_expression (L, X) == FALSE) /* bwb_run_filename_or_linenumber */ + { + WARN_SYNTAX_ERROR; + return L; + } + if (X->VariantTypeCode == StringTypeCode) + { + /* RUN "filename" */ + /* RUN A$ */ + if (is_empty_string (X->Buffer)) + { + WARN_BAD_FILE_NAME; + return L; + } + /* open the file and execute it */ + bwb_new (); /* clear memory */ + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = bwb_strdup (X->Buffer); + if (bwb_fload (NULL) == FALSE) + { + WARN_BAD_FILE_NAME; + return L; + } + /* + ** + ** FORCE SCAN + ** + */ + if (bwb_scan () == FALSE) + { + WARN_CANT_CONTINUE; + return L; + } + current = My->StartMarker->next; + } + else + { + /* RUN 100 */ + /* RUN N */ + /* execute the line */ + int LineNumber; + + + LineNumber = (int) bwb_rint (X->Number); + /* + ** + ** FORCE SCAN + ** + */ + if (bwb_scan () == FALSE) + { + WARN_CANT_CONTINUE; + goto EXIT; + } + current = find_line_number (LineNumber); /* RUN 100 */ + if (current == NULL) + { + WARN_CANT_CONTINUE; + return L; + } + } +EXIT: + RELEASE_VARIANT (X); + return current; +} + +LineType * +bwb_RUNNH (LineType * L) +{ + + assert (L != NULL); + return bwb_RUN (L); +} + +LineType * +bwb_RUN (LineType * L) +{ + /* + SYNTAX: RUN + SYNTAX: RUN filename$ + SYNTAX: RUN linenumber + */ + LineType *current; + + assert (L != NULL); + assert (My != NULL); + assert (My->EndMarker != NULL); + assert (My->DefaultVariableType != NULL); + + /* clear the STACK */ + bwb_clrexec (); + if (bwb_incexec ()) + { + /* OK */ + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return My->EndMarker; + } + + if (line_is_eol (L)) + { + /* RUN */ + + var_CLEAR (); + + /* if( TRUE ) */ + { + int n; + for (n = 0; n < 26; n++) + { + My->DefaultVariableType[n] = DoubleTypeCode; + } + } + /* + ** + ** FORCE SCAN + ** + */ + if (bwb_scan () == FALSE) + { + WARN_CANT_CONTINUE; + return My->EndMarker; + } + current = My->StartMarker->next; + } + else + { + /* RUN 100 : RUN filename$ */ + current = bwb_run_filename_or_linenumber (L); + if (current == NULL) + { + WARN_UNDEFINED_LINE; + return My->EndMarker; + } + } + current->position = 0; + + assert (My->StackHead != NULL); + My->StackHead->line = current; + My->StackHead->ExecCode = EXEC_NORM; + + /* RUN */ + WARN_CLEAR; /* bwb_RUN */ + My->ContinueLine = NULL; + SetOnError (0); + + /* if( TRUE ) */ + { + time_t t; + struct tm *lt; + + time (&t); + lt = localtime (&t); + My->StartTimeInteger = lt->tm_hour; + My->StartTimeInteger *= 60; + My->StartTimeInteger += lt->tm_min; + My->StartTimeInteger *= 60; + My->StartTimeInteger += lt->tm_sec; + /* number of seconds since midnight */ + } + + return current; +} + +/* +-------------------------------------------------------------------------------------------- + CONT +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_CONTINUE (LineType * l) +{ + /* + SYNTAX: CONTINUE + */ + + assert (l != NULL); + return bwb_CONT (l); +} + +LineType * +bwb_CONT (LineType * l) +{ + /* + SYNTAX: CONT + */ + LineType *current; + + assert (l != NULL); + assert (My != NULL); + assert (My->EndMarker != NULL); + assert (My->StartMarker != NULL); + + current = NULL; + /* see if there is an element */ + if (line_is_eol (l)) + { + /* CONT */ + current = My->ContinueLine; + } + else + { + /* CONT 100 */ + int LineNumber; + + LineNumber = 0; + if (line_read_line_number (l, &LineNumber)) + { + current = find_line_number (LineNumber); /* CONT 100 */ + } + } + + + if (current == NULL || current == My->EndMarker) + { + /* same as RUN */ + current = My->StartMarker->next; + } + /* + ** + ** FORCE SCAN + ** + */ + if (bwb_scan () == FALSE) + { + WARN_CANT_CONTINUE; + return (l); + } + current->position = 0; + bwb_clrexec (); + if (bwb_incexec ()) + { + /* OK */ + My->StackHead->line = current; + My->StackHead->ExecCode = EXEC_NORM; + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return My->EndMarker; + } + + + /* CONT */ + My->ContinueLine = NULL; + return current; +} + + +/* +-------------------------------------------------------------------------------------------- + NEW +-------------------------------------------------------------------------------------------- +*/ + +void +bwb_xnew (LineType * l) +{ + LineType *current; + LineType *previous; + int wait; + + assert (l != NULL); + assert (My != NULL); + assert (My->EndMarker != NULL); + + previous = NULL; /* JBV */ + wait = TRUE; + for (current = l->next; current != My->EndMarker; current = current->next) + { + assert (current != NULL); + if (wait == FALSE) + { + free (previous); + previous = NULL; + } + wait = FALSE; + previous = current; + } + l->next = My->EndMarker; +} + +static void +bwb_new () +{ + assert (My != NULL); + assert (My->StartMarker != NULL); + assert (My->DefaultVariableType != NULL); + + + /* clear program in memory */ + bwb_xnew (My->StartMarker); + + /* clear all variables */ + var_CLEAR (); + /* if( TRUE ) */ + { + int n; + for (n = 0; n < 26; n++) + { + My->DefaultVariableType[n] = DoubleTypeCode; + } + } + + /* NEW */ + WARN_CLEAR; /* bwb_new */ + My->ContinueLine = NULL; + SetOnError (0); +} + +LineType * +bwb_NEW (LineType * l) +{ + /* + SYNTAX: NEW + */ + + assert (l != NULL); + assert (My != NULL); + assert (My->CurrentVersion != NULL); + + bwb_new (); + if (My->CurrentVersion->OptionVersionValue & (D64 | G65 | G67 | G74)) + { + if (line_is_eol (l)) + { + /* NEW */ + char *tbuf; + int tlen; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + /* prompt for the program name */ + bwx_input ("NEW PROBLEM NAME:", FALSE, tbuf, tlen); + if (is_empty_string (tbuf)) + { + WARN_BAD_FILE_NAME; + return l; + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = bwb_strdup (tbuf); + } + else + { + /* NEW filename$ */ + /* the parameter is the program name */ + + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (is_empty_string (Value)) + { + WARN_BAD_FILE_NAME; + return l; + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = Value; + } + } + else + { + /* ignore any parameters */ + line_skip_eol (l); + } + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + SCRATCH +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_SCRATCH (LineType * l) +{ + /* + SYNTAX: SCRATCH -- same as NEW + SYNTAX: SCRATCH # filenumber -- close file and re-open for output + */ + + assert (l != NULL); + + if (line_is_eol (l)) + { + /* SCRATCH */ + bwb_new (); + return (l); + } + if (line_skip_FilenumChar (l)) + { + /* SCRATCH # X */ + int FileNumber; + + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber < 0) + { + /* SCRATCH # -1 is silently ignored */ + return (l); + } + if (FileNumber == 0) + { + /* SCRATCH # 0 is silently ignored */ + return (l); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (My->CurrentFile->DevMode != DEVMODE_CLOSED) + { + My->CurrentFile->DevMode = DEVMODE_CLOSED; + } + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = NULL; + } + if (My->CurrentFile->buffer != NULL) + { + free (My->CurrentFile->buffer); + My->CurrentFile->buffer = NULL; + } + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + if (is_empty_string (My->CurrentFile->FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (bwb_strcmp (My->CurrentFile->FileName, "*") != 0) + { + if ((My->CurrentFile->cfp = + fopen (My->CurrentFile->FileName, "w")) == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + My->CurrentFile->DevMode = DEVMODE_OUTPUT; + } + /* OK */ + return (l); + } + WARN_SYNTAX_ERROR; + return (l); +} + +/* +============================================================================================ + SYSTEM and so on +============================================================================================ +*/ +static LineType * +bwb_system (LineType * l) +{ + /* + SYNTAX: SYSTEM + */ + assert (l != NULL); + assert (My != NULL); + assert (My->SYSOUT != NULL); + assert (My->SYSOUT->cfp != NULL); + + fprintf (My->SYSOUT->cfp, "\n"); + fflush (My->SYSOUT->cfp); + bwx_terminate (); + return (l); /* never reached */ +} + +/* +-------------------------------------------------------------------------------------------- + BYE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_BYE (LineType * l) +{ + /* + SYNTAX: BYE + */ + + assert (l != NULL); + return bwb_system (l); +} + +/* +-------------------------------------------------------------------------------------------- + DOS +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_DOS (LineType * l) +{ + /* + SYNTAX: DOS + */ + + assert (l != NULL); + return bwb_system (l); +} + +/* +-------------------------------------------------------------------------------------------- + FLEX +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_FLEX (LineType * l) +{ + /* + SYNTAX: FLEX + */ + + assert (l != NULL); + return bwb_system (l); +} + +/* +-------------------------------------------------------------------------------------------- + GOODBYE +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_GOODBYE (LineType * l) +{ + /* + SYNTAX: GOODBYE + */ + + assert (l != NULL); + return bwb_system (l); +} + +/* +-------------------------------------------------------------------------------------------- + MON +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_MON (LineType * l) +{ + /* + SYNTAX: MON + */ + + assert (l != NULL); + return bwb_system (l); +} + +/* +-------------------------------------------------------------------------------------------- + QUIT +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_QUIT (LineType * l) +{ + /* + SYNTAX: QUIT + */ + + assert (l != NULL); + return bwb_system (l); +} + +/* +-------------------------------------------------------------------------------------------- + SYSTEM +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_SYSTEM (LineType * l) +{ + /* + SYNTAX: SYSTEM + */ + + assert (l != NULL); + return bwb_system (l); +} + + +/* +============================================================================================ + LOAD and so on +============================================================================================ +*/ + +static LineType * +bwb_load (LineType * Line, char *Prompt, int IsNew) +{ + /* + ** + ** load a BASIC program from a file + ** + */ + /* + SYNTAX: ... [filename$] + */ + + assert (Line != NULL); + assert (Prompt != NULL); + assert (My != NULL); + assert (My->CurrentVersion != NULL); + + if (IsNew) + { + /* TRUE == LOAD */ + bwb_new (); + } + else + { + /* FALSE == MERGE */ + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + } + if (line_is_eol (Line)) + { + /* default is the last filename used by LOAD or SAVE */ + /* if( My->CurrentVersion->OptionVersionValue & (D64 | G65 | G67 | G74) ) */ + if (is_empty_string (My->ProgramFilename)) + { + /* prompt for the program name */ + char *tbuf; + int tlen; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + bwx_input (Prompt, FALSE, tbuf, tlen); + if (is_empty_string (tbuf)) + { + WARN_BAD_FILE_NAME; + return (Line); + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = bwb_strdup (tbuf); + } + fprintf (My->SYSOUT->cfp, "Loading %s\n", My->ProgramFilename); + ResetConsoleColumn (); + } + else + { + /* Get an argument for filename */ + char *Value; + + Value = NULL; + if (line_read_string_expression (Line, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (is_empty_string (Value)) + { + WARN_BAD_FILE_NAME; + return (Line); + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = Value; + } + if (bwb_fload (NULL) == FALSE) + { + WARN_BAD_FILE_NAME; + return (Line); + } + if (IsNew) + { + /* TRUE == LOAD */ + } + else + { + /* FALSE == MERGE */ + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + } + /* + ** + ** FORCE SCAN + ** + */ + if (bwb_scan () == FALSE) + { + WARN_CANT_CONTINUE; + } + return (Line); +} + +/* +-------------------------------------------------------------------------------------------- + CLOAD +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_CLOAD (LineType * Line) +{ + /* + SYNTAX: CLOAD [filename$] + */ + + assert (Line != NULL); + return bwb_load (Line, "CLOAD FILE NAME:", TRUE); +} + +/* +-------------------------------------------------------------------------------------------- + LOAD +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_LOAD (LineType * Line) +{ + /* + SYNTAX: LOAD [filename$] + */ + + assert (Line != NULL); + return bwb_load (Line, "LOAD FILE NAME:", TRUE); +} + +/* +-------------------------------------------------------------------------------------------- + MERGE +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_MERGE (LineType * l) +{ + /* + SYNTAX: MERGE [filename$] + */ + + assert (l != NULL); + return bwb_load (l, "MERGE FILE NAME:", FALSE); +} + +/* +-------------------------------------------------------------------------------------------- + OLD +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_OLD (LineType * Line) +{ + /* + SYNTAX: OLD [filename$] + */ + + assert (Line != NULL); + return bwb_load (Line, "OLD PROBLEM NAME:", TRUE); +} + +/* +-------------------------------------------------------------------------------------------- + TLOAD +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_TLOAD (LineType * Line) +{ + /* + SYNTAX: TLOAD [filename$] + */ + + assert (Line != NULL); + return bwb_load (Line, "TLOAD FILE NAME:", TRUE); +} + + +/* +-------------------------------------------------------------------------------------------- + RENAME +-------------------------------------------------------------------------------------------- +*/ +static LineType * +H14_RENAME (LineType * l) +{ + /* + SYNTAX: RENAME from$ TO to$ + */ + char *From; + char *To; + + assert (l != NULL); + + From = NULL; + To = NULL; + if (line_read_string_expression (l, &From) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (is_empty_string (From)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (line_skip_word (l, "TO") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_string_expression (l, &To) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (is_empty_string (To)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (rename (From, To)) + { + WARN_BAD_FILE_NAME; + return (l); + } + return (l); +} + +LineType * +bwb_RENAME (LineType * l) +{ + /* + SYNTAX: RENAME filename$ + */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + assert( My->ConsoleInput != NULL ); + + if (My->CurrentVersion->OptionVersionValue & (H14)) + { + /* RENAME == change an exisiting file's name */ + return H14_RENAME (l); + } + /* RENAME == change the BASIC program's name for a later SAVE */ + if (line_is_eol (l)) + { + /* RENAME */ + if (My->CurrentVersion->OptionVersionValue & (D64 | G65 | G67 | G74)) + { + /* prompt for the program name */ + char *tbuf; + int tlen; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + bwx_input ("RENAME PROBLEM NAME:", FALSE, tbuf, tlen); + if (is_empty_string (tbuf)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = bwb_strdup (tbuf); + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + } + else + { + /* RENAME value$ */ + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (is_empty_string (Value)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = Value; + } + return (l); +} + + +/* +-------------------------------------------------------------------------------------------- + MAT +-------------------------------------------------------------------------------------------- +*/ + +extern void +Determinant (VariableType * v) +{ + /* http://easy-learn-c-language.blogspot.com/search/label/Numerical%20Methods */ + /* Numerical Methods: Determinant of nxn matrix using C */ + + DoubleType **matrix; + DoubleType ratio; + + int i; + int j; + int k; + int n; + + assert (v != NULL); + assert( My != NULL ); + + + My->LastDeterminant = 0; /* default */ + + n = v->UBOUND[0] - v->LBOUND[0] + 1; + + if ((matrix = (DoubleType **) calloc (n, sizeof (DoubleType *))) == NULL) + { + goto EXIT; + } + assert( matrix != NULL ); + for (i = 0; i < n; i++) + { + if ((matrix[i] = (DoubleType *) calloc (n, sizeof (DoubleType))) == NULL) + { + goto EXIT; + } + assert( matrix[i] != NULL ); + } + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + v->VINDEX[0] = v->LBOUND[0] + i; + v->VINDEX[1] = v->LBOUND[1] + j; + if (var_get (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + if (variant.VariantTypeCode == StringTypeCode) + { + WARN_TYPE_MISMATCH; + goto EXIT; + } + matrix[i][j] = variant.Number; + } + } + + /* Conversion of matrix to upper triangular */ + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + if (j > i) + { + if (matrix[i][i] == 0) + { + /* - Evaluation of an expression results in division + * by zero (nonfatal, the recommended recovery + * procedure is to supply machine infinity with the + * sign of the numerator and continue) + */ + if (WARN_DIVISION_BY_ZERO) + { + /* ERROR */ + goto EXIT; + } + /* CONTINUE */ + if (matrix[j][i] < 0) + { + ratio = MINDBL; + } + else + { + ratio = MAXDBL; + } + } + else + { + ratio = matrix[j][i] / matrix[i][i]; + } + for (k = 0; k < n; k++) + { + matrix[j][k] -= ratio * matrix[i][k]; + } + } + } + } + + + My->LastDeterminant = 1; /* storage for determinant */ + + for (i = 0; i < n; i++) + { + DoubleType Value; + + Value = matrix[i][i]; + My->LastDeterminant *= Value; + } + +EXIT: + if( matrix != NULL ) + { + for (i = 0; i < n; i++) + { + if( matrix[i] != NULL ) + { + free (matrix[i]); + /* matrix[i] = NULL; */ + } + } + free (matrix); + /* matrix = NULL; */ + } +} + +int +InvertMatrix (VariableType * vOut, VariableType * vIn) +{ + /* http://easy-learn-c-language.blogspot.com/search/label/Numerical%20Methods */ + /* Numerical Methods: Inverse of nxn matrix using C */ + + int Result; + DoubleType **matrix; + DoubleType ratio; + + int i; + int j; + int k; + int n; + + assert (vOut != NULL); + assert (vIn != NULL); + + Result = FALSE; + n = vIn->UBOUND[0] - vIn->LBOUND[0] + 1; + + if ((matrix = (DoubleType **) calloc (n, sizeof (DoubleType *))) == NULL) + { + goto EXIT; + } + assert( matrix != NULL ); + + for (i = 0; i < n; i++) + { + if ((matrix[i] = + (DoubleType *) calloc (n + n, sizeof (DoubleType))) == NULL) + { + goto EXIT; + } + assert( matrix[i] != NULL ); + } + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + vIn->VINDEX[0] = vIn->LBOUND[0] + i; + vIn->VINDEX[1] = vIn->LBOUND[1] + j; + if (var_get (vIn, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + if (variant.VariantTypeCode == StringTypeCode) + { + WARN_TYPE_MISMATCH; + goto EXIT; + } + matrix[i][j] = variant.Number; + } + } + + for (i = 0; i < n; i++) + { + for (j = n; j < 2 * n; j++) + { + if (i == (j - n)) + { + matrix[i][j] = 1.0; + } + else + { + matrix[i][j] = 0.0; + } + } + } + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + if (i != j) + { + if (matrix[i][i] == 0) + { + /* - Evaluation of an expression results in division + * by zero (nonfatal, the recommended recovery + * procedure is to supply machine infinity with the + * sign of the numerator and continue) + */ + if (WARN_DIVISION_BY_ZERO) + { + /* ERROR */ + goto EXIT; + } + /* CONTINUE */ + if (matrix[j][i] < 0) + { + ratio = MINDBL; + } + else + { + ratio = MAXDBL; + } + } + else + { + ratio = matrix[j][i] / matrix[i][i]; + } + for (k = 0; k < 2 * n; k++) + { + matrix[j][k] -= ratio * matrix[i][k]; + } + } + } + } + + for (i = 0; i < n; i++) + { + DoubleType a; + + a = matrix[i][i]; + if (a == 0) + { + /* - Evaluation of an expression results in division + * by zero (nonfatal, the recommended recovery + * procedure is to supply machine infinity with the + * sign of the numerator and continue) + */ + if (WARN_DIVISION_BY_ZERO) + { + /* ERROR */ + goto EXIT; + } + /* CONTINUE */ + for (j = 0; j < 2 * n; j++) + { + if (matrix[i][j] < 0) + { + matrix[i][j] = MINDBL; + } + else + { + matrix[i][j] = MAXDBL; + } + } + } + else + { + for (j = 0; j < 2 * n; j++) + { + matrix[i][j] /= a; + } + } + } + + for (i = 0; i < n; i++) + { + for (j = 0; j < n; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + vOut->VINDEX[0] = vOut->LBOUND[0] + i; + vOut->VINDEX[1] = vOut->LBOUND[0] + j; + variant.VariantTypeCode = vOut->VariableTypeCode; + variant.Number = matrix[i][j + n]; + if (var_set (vOut, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + goto EXIT; + } + } + } + /* + ** + ** Everything is OK + ** + */ + Result = TRUE; + + +EXIT: + if (matrix != NULL) + { + for (i = 0; i < n; i++) + { + if (matrix[i] != NULL) + { + free (matrix[i]); + /* matrix[i] = NULL; */ + } + } + free (matrix); + /* matrix = NULL; */ + } + return Result; +} + +static int +line_read_matrix_redim (LineType * l, VariableType * v) +{ + /* get OPTIONAL parameters if the variable is dimensioned */ + + assert (l != NULL); + assert (v != NULL); + + if (line_peek_LparenChar (l)) + { + /* get requested size, which is <= original array size */ + size_t array_units; + int n; + int dimensions; + int LBOUND[MAX_DIMS]; + int UBOUND[MAX_DIMS]; + + if (line_read_array_redim (l, &dimensions, LBOUND, UBOUND) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + /* update array dimensions */ + array_units = 1; + for (n = 0; n < dimensions; n++) + { + if (UBOUND[n] < LBOUND[n]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return FALSE; + } + array_units *= UBOUND[n] - LBOUND[n] + 1; + } + if (array_units > v->array_units) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return FALSE; + } + v->dimensions = dimensions; + for (n = 0; n < dimensions; n++) + { + v->LBOUND[n] = LBOUND[n]; + v->UBOUND[n] = UBOUND[n]; + } + } + return TRUE; +} + +LineType * +bwb_MAT (LineType * l) +{ + /* + SYNTAX: MAT A = CON + SYNTAX: MAT A = IDN + SYNTAX: MAT A = ZER + SYNTAX: MAT A = INV B + SYNTAX: MAT A = TRN B + SYNTAX: MAT A = (k) * B + SYNTAX: MAT A = B + SYNTAX: MAT A = B + C + SYNTAX: MAT A = B - C + SYNTAX: MAT A = B * C + */ + VariableType *v_A; + char varname_A[NameLengthMax + 1]; + + assert (l != NULL); + + /* just a placeholder for now. this will grow. */ + + if (line_read_varname (l, varname_A) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + v_A = mat_find (varname_A); + if (v_A == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v_A)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v_A) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_EqualChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* MAT A = ... */ + if (line_skip_word (l, "CON")) + { + /* MAT A = CON */ + /* MAT A = CON(I) */ + /* MAT A = CON(I,J) */ + /* MAT A = CON(I,J,K) */ + /* OK */ + int i; + int j; + int k; + + if (line_read_matrix_redim (l, v_A) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + /* both arrays are of the same size */ + switch (v_A->dimensions) + { + case 1: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + variant.VariantTypeCode = v_A->VariableTypeCode; + variant.Number = 1; + v_A->VINDEX[0] = i; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + break; + case 2: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + variant.VariantTypeCode = v_A->VariableTypeCode; + variant.Number = 1; + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + break; + case 3: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + for (k = v_A->LBOUND[2]; k <= v_A->UBOUND[2]; k++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + variant.VariantTypeCode = v_A->VariableTypeCode; + variant.Number = 1; + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + v_A->VINDEX[2] = k; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + break; + default: + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_word (l, "IDN")) + { + /* MAT A = IDN */ + /* MAT A = IDN(I,J) */ + /* OK */ + int i; + int j; + + if (line_read_matrix_redim (l, v_A) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (v_A->dimensions != 2) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_A->LBOUND[0] != v_A->LBOUND[1]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_A->UBOUND[0] != v_A->UBOUND[1]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + /* square matrix */ + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + variant.VariantTypeCode = v_A->VariableTypeCode; + if (i == j) + { + variant.Number = 1; + } + else + { + variant.Number = 0; + } + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + else if (line_skip_word (l, "ZER")) + { + /* MAT A = ZER */ + /* MAT A = ZER(I) */ + /* MAT A = ZER(I,J) */ + /* MAT A = ZER(I,J,K) */ + /* OK */ + int i; + int j; + int k; + + if (line_read_matrix_redim (l, v_A) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* both arrays are of the same size */ + switch (v_A->dimensions) + { + case 1: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + variant.VariantTypeCode = v_A->VariableTypeCode; + variant.Number = 0; + v_A->VINDEX[0] = i; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + break; + case 2: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + variant.VariantTypeCode = v_A->VariableTypeCode; + variant.Number = 0; + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + break; + case 3: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + for (k = v_A->LBOUND[2]; k <= v_A->UBOUND[2]; k++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + variant.VariantTypeCode = v_A->VariableTypeCode; + variant.Number = 0; + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + v_A->VINDEX[2] = k; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + break; + default: + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_word (l, "INV")) + { + /* MAT A = INV B */ + /* MAT A = INV( B ) */ + /* OK */ + VariableType *v_B; + char varname_B[NameLengthMax + 1]; + + if (v_A->dimensions != 2) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (v_A->LBOUND[0] != v_A->LBOUND[1] || v_A->UBOUND[0] != v_A->UBOUND[1]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (line_skip_LparenChar (l)) + { + /* optional */ + } + if (line_read_varname (l, varname_B) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if ((v_B = mat_find (varname_B)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v_B)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v_B) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_RparenChar (l)) + { + /* optional */ + } + if (v_B->dimensions != 2) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (v_B->LBOUND[0] != v_B->LBOUND[1] || v_B->UBOUND[0] != v_B->UBOUND[1]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_A->LBOUND[0] != v_B->LBOUND[0] || v_A->UBOUND[0] != v_B->UBOUND[0]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + /* square matrix */ + Determinant (v_B); + if (My->LastDeterminant == 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (InvertMatrix (v_A, v_B) == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + } + else if (line_skip_word (l, "TRN")) + { + /* MAT A = TRN B */ + /* MAT A = TRN( B ) */ + /* OK */ + int i; + int j; + VariableType *v_B; + char varname_B[NameLengthMax + 1]; + + if (v_A->dimensions != 2) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_LparenChar (l)) + { + /* optional */ + } + if (line_read_varname (l, varname_B) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if ((v_B = mat_find (varname_B)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v_B)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v_B) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_RparenChar (l)) + { + /* optional */ + } + if (v_B->dimensions != 2) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* MxN */ + if (v_A->LBOUND[0] != v_B->LBOUND[1] || v_A->UBOUND[0] != v_B->UBOUND[1]) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (v_A->LBOUND[1] != v_B->LBOUND[0] || v_A->UBOUND[1] != v_B->UBOUND[0]) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* transpose matrix */ + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + v_B->VINDEX[1] = i; + v_B->VINDEX[0] = j; + if (var_get (v_B, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + else if (line_peek_LparenChar (l)) + { + /* MAT A = (k) * B */ + DoubleType Multiplier; + VariableType *v_B; + int i; + int j; + int k; + char *E; + int p; + char varname_B[NameLengthMax + 1]; + char *tbuf; + + tbuf = My->ConsoleInput; + bwb_strcpy (tbuf, &(l->buffer[l->position])); + E = bwb_strrchr (tbuf, '*'); + if (E == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + *E = NulChar; + p = 0; + if (buff_read_numeric_expression (tbuf, &p, &Multiplier) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + l->position += p; + if (line_skip_StarChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_varname (l, varname_B) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if ((v_B = mat_find (varname_B)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v_B)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v_B) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (v_A->dimensions != v_B->dimensions) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* both arrays are of the same size */ + switch (v_A->dimensions) + { + case 1: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + v_B->VINDEX[0] = i; + if (var_get (v_B, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant.Number *= Multiplier; + + v_A->VINDEX[0] = i; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + break; + case 2: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = j; + if (var_get (v_B, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant.Number *= Multiplier; + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + break; + case 3: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + for (k = v_A->LBOUND[2]; k <= v_A->UBOUND[2]; k++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = j; + v_B->VINDEX[2] = k; + if (var_get (v_B, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant.Number *= Multiplier; + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + v_A->VINDEX[2] = k; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + break; + default: + WARN_SYNTAX_ERROR; + return (l); + } + } + else + { + /* MAT A = B */ + /* MAT A = B + C */ + /* MAT A = B - C */ + /* MAT A = B * C */ + VariableType *v_B; + char varname_B[NameLengthMax + 1]; + + if (line_read_varname (l, varname_B) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if ((v_B = mat_find (varname_B)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v_B)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v_B) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_is_eol (l)) + { + /* MAT A = B */ + /* OK */ + int i; + int j; + int k; + + if (v_A->dimensions != v_B->dimensions) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* both arrays are of the same size */ + switch (v_A->dimensions) + { + case 1: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + v_B->VINDEX[0] = i; + if (var_get (v_B, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_A->VINDEX[0] = i; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + break; + case 2: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = j; + if (var_get (v_B, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + break; + case 3: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + for (k = v_A->LBOUND[2]; k <= v_A->UBOUND[2]; k++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = j; + v_B->VINDEX[2] = k; + if (var_get (v_B, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + v_A->VINDEX[2] = k; + if (var_set (v_A, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + break; + default: + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_PlusChar (l)) + { + /* MAT A = B + C */ + /* OK */ + int i; + int j; + int k; + VariableType *v_C; + char varname_C[NameLengthMax + 1]; + + if (v_A->dimensions != v_B->dimensions) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* both arrays are of the same size */ + + if (line_read_varname (l, varname_C) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if ((v_C = mat_find (varname_C)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v_C)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v_C) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (v_B->dimensions != v_C->dimensions) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* both arrays are of the same size */ + switch (v_A->dimensions) + { + case 1: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + VariantType variant_L; + VariantType variant_R; + CLEAR_VARIANT (&variant_L); + CLEAR_VARIANT (&variant_R); + + v_B->VINDEX[0] = i; + if (var_get (v_B, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_C->VINDEX[0] = i; + if (var_get (v_C, &variant_R) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant_L.Number += variant_R.Number; + + v_A->VINDEX[0] = i; + if (var_set (v_A, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + break; + case 2: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant_L; + VariantType variant_R; + CLEAR_VARIANT (&variant_L); + CLEAR_VARIANT (&variant_R); + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = j; + if (var_get (v_B, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_C->VINDEX[0] = i; + v_C->VINDEX[1] = j; + if (var_get (v_C, &variant_R) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant_L.Number += variant_R.Number; + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + break; + case 3: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + for (k = v_A->LBOUND[2]; k <= v_A->UBOUND[2]; k++) + { + VariantType variant_L; + VariantType variant_R; + CLEAR_VARIANT (&variant_L); + CLEAR_VARIANT (&variant_R); + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = j; + v_B->VINDEX[2] = k; + if (var_get (v_B, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_C->VINDEX[0] = i; + v_C->VINDEX[1] = j; + v_C->VINDEX[2] = k; + if (var_get (v_C, &variant_R) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant_L.Number += variant_R.Number; + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + v_A->VINDEX[2] = k; + if (var_set (v_A, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + break; + default: + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_MinusChar (l)) + { + /* MAT A = B - C */ + /* OK */ + int i; + int j; + int k; + VariableType *v_C; + char varname_C[NameLengthMax + 1]; + + if (v_A->dimensions != v_B->dimensions) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* both arrays are of the same size */ + + if (line_read_varname (l, varname_C) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if ((v_C = mat_find (varname_C)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v_C)) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v_C) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (v_B->dimensions != v_C->dimensions) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* both arrays are of the same dimension */ + switch (v_A->dimensions) + { + case 1: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + VariantType variant_L; + VariantType variant_R; + CLEAR_VARIANT (&variant_L); + CLEAR_VARIANT (&variant_R); + + v_B->VINDEX[0] = i; + if (var_get (v_B, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_C->VINDEX[0] = i; + if (var_get (v_C, &variant_R) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant_L.Number -= variant_R.Number; + + v_A->VINDEX[0] = i; + if (var_set (v_A, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + break; + case 2: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant_L; + VariantType variant_R; + CLEAR_VARIANT (&variant_L); + CLEAR_VARIANT (&variant_R); + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = j; + if (var_get (v_B, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_C->VINDEX[0] = i; + v_C->VINDEX[1] = j; + if (var_get (v_C, &variant_R) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant_L.Number -= variant_R.Number; + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + break; + case 3: + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + for (k = v_A->LBOUND[2]; k <= v_A->UBOUND[2]; k++) + { + VariantType variant_L; + VariantType variant_R; + CLEAR_VARIANT (&variant_L); + CLEAR_VARIANT (&variant_R); + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = j; + v_B->VINDEX[2] = k; + if (var_get (v_B, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_C->VINDEX[0] = i; + v_C->VINDEX[1] = j; + v_C->VINDEX[2] = k; + if (var_get (v_C, &variant_R) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant_L.Number -= variant_R.Number; + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + v_A->VINDEX[2] = k; + if (var_set (v_A, &variant_L) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + break; + default: + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_StarChar (l)) + { + /* MAT A = B * C */ + int i; + int j; + int k; + VariableType *v_C; + char varname_C[NameLengthMax + 1]; + + + if (v_A->dimensions != 2) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_B->dimensions != 2) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (line_read_varname (l, varname_C) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if ((v_C = mat_find (varname_C)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v_C)) + { + WARN_TYPE_MISMATCH; + return (l); + } + if (line_read_matrix_redim (l, v_C) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (v_C->dimensions != 2) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_A->LBOUND[0] != v_B->LBOUND[0]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_A->UBOUND[0] != v_B->UBOUND[0]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_A->LBOUND[1] != v_C->LBOUND[1]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_A->UBOUND[1] != v_C->UBOUND[1]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_B->LBOUND[1] != v_C->LBOUND[0]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v_B->UBOUND[1] != v_C->UBOUND[0]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + for (i = v_A->LBOUND[0]; i <= v_A->UBOUND[0]; i++) + { + for (j = v_A->LBOUND[1]; j <= v_A->UBOUND[1]; j++) + { + VariantType variant_A; + CLEAR_VARIANT (&variant_A); + + variant_A.VariantTypeCode = v_A->VariableTypeCode; + variant_A.Number = 0; + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant_A) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + for (k = v_C->LBOUND[0]; k <= v_C->UBOUND[0]; k++) + { + VariantType variant_B; + VariantType variant_C; + CLEAR_VARIANT (&variant_B); + CLEAR_VARIANT (&variant_C); + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_get (v_A, &variant_A) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_B->VINDEX[0] = i; + v_B->VINDEX[1] = k; + if (var_get (v_B, &variant_B) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + v_C->VINDEX[0] = k; + v_C->VINDEX[1] = j; + if (var_get (v_C, &variant_C) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + variant_A.Number += variant_B.Number * variant_C.Number; + + v_A->VINDEX[0] = i; + v_A->VINDEX[1] = j; + if (var_set (v_A, &variant_A) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + } + } + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + } + return (l); +} + + + +/* +-------------------------------------------------------------------------------------------- + STORE +-------------------------------------------------------------------------------------------- +*/ + + +LineType * +bwb_STORE (LineType * l) +{ + /* + SYNTAX: STORE NumericArrayName + */ + + assert (l != NULL); + return bwb_CSAVE8 (l); +} + + +/* +-------------------------------------------------------------------------------------------- + CSAVE* +-------------------------------------------------------------------------------------------- +*/ + +#define CSAVE_VERSION_1 0x20150218L + +LineType * +bwb_CSAVE8 (LineType * l) +{ + /* + SYNTAX: CSAVE* NumericArrayName + */ + VariableType *v = NULL; + FILE *f; + unsigned long n; + size_t t; + char varname[NameLengthMax + 1]; + + assert (l != NULL); + + if (line_read_varname (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + v = mat_find (varname); + if (v == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* variable MUST be numeric */ + if (VAR_IS_STRING (v)) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* variable MUST be an array */ + if (v->dimensions == 0) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* variable storage is a mess, we bypass that tradition here. */ + t = v->array_units; + if (t <= 1) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* open file */ + f = fopen (v->name, "w"); + if (f == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* write version number */ + n = CSAVE_VERSION_1; + fwrite (&n, sizeof (long), 1, f); + /* write total number of elements */ + fwrite (&t, sizeof (long), 1, f); + /* write data */ + fwrite (v->Value.Number, sizeof (DoubleType), t, f); + /* OK */ + bwb_fclose (f); + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + RECALL +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_RECALL (LineType * l) +{ + /* + SYNTAX: RECALL NumericArrayName + */ + + assert (l != NULL); + return bwb_CLOAD8 (l); +} + +/* +-------------------------------------------------------------------------------------------- + CLOAD* +-------------------------------------------------------------------------------------------- +*/ + + +LineType * +bwb_CLOAD8 (LineType * l) +{ + /* + SYNTAX: CLOAD* NumericArrayName + */ + VariableType *v = NULL; + FILE *f; + unsigned long n; + size_t t; + char varname[NameLengthMax + 1]; + + assert (l != NULL); + + if (line_read_varname (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + v = mat_find (varname); + if (v == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + /* variable MUST be numeric */ + if (VAR_IS_STRING (v)) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* variable MUST be an array */ + if (v->dimensions == 0) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_matrix_redim (l, v) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* variable storage is a mess, we bypass that tradition here. */ + t = v->array_units; + if (t <= 1) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* open file */ + f = fopen (v->name, "r"); + if (f == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + /* read version number */ + n = 0; + fread (&n, sizeof (long), 1, f); + if (n != CSAVE_VERSION_1) + { + bwb_fclose (f); + WARN_BAD_FILE_NAME; + return (l); + } + /* read total number of elements */ + n = 0; + fread (&n, sizeof (long), 1, f); + if (n != t) + { + bwb_fclose (f); + WARN_BAD_FILE_NAME; + return (l); + } + /* read data */ + fread (v->Value.Number, sizeof (DoubleType), t, f); + /* OK */ + bwb_fclose (f); + return (l); +} + + + + +/* +============================================================================================ + SAVE and so on +============================================================================================ +*/ + +static LineType * +bwb_save (LineType * Line, char *Prompt) +{ + /* + SYNTAX: SAVE [filename$] + */ + FILE *outfile; + + assert (Line != NULL); + assert (Prompt != NULL); + assert( My != NULL ); + assert( My->ConsoleInput != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + + /* Get an argument for filename */ + if (line_is_eol (Line)) + { + /* default is the last filename used by LOAD or SAVE */ + if (is_empty_string (My->ProgramFilename) && Prompt != NULL) + { + /* prompt for the program name */ + char *tbuf; + int tlen; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + bwx_input (Prompt, FALSE, tbuf, tlen); + if (is_empty_string (tbuf)) + { + WARN_BAD_FILE_NAME; + return (Line); + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = bwb_strdup (tbuf); + } + assert( My->ProgramFilename != NULL ); + fprintf (My->SYSOUT->cfp, "Saving %s\n", My->ProgramFilename); + ResetConsoleColumn (); + } + else + { + char *Value; + + Value = NULL; + if (line_read_string_expression (Line, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (is_empty_string (Value)) + { + WARN_BAD_FILE_NAME; + return (Line); + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + } + My->ProgramFilename = Value; + } + assert( My->ProgramFilename != NULL ); + if ((outfile = fopen (My->ProgramFilename, "w")) == NULL) + { + WARN_BAD_FILE_NAME; + return (Line); + } + bwb_xlist (Line, outfile); + bwb_fclose (outfile); + return (Line); +} + +/* +-------------------------------------------------------------------------------------------- + CSAVE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_CSAVE (LineType * Line) +{ + /* + SYNTAX: CSAVE [filename$] + */ + + assert (Line != NULL); + return bwb_save (Line, "CSAVE FILE NAME:"); +} + +/* +-------------------------------------------------------------------------------------------- + REPLACE +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_REPLACE (LineType * Line) +{ + /* + SYNTAX: REPLACE [filename$] + */ + + assert (Line != NULL); + return bwb_save (Line, "REPLACE FILE NAME:"); +} + +/* +-------------------------------------------------------------------------------------------- + SAVE +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_SAVE (LineType * l) +{ + /* + SYNTAX: SAVE [filename$] + */ + + assert (l != NULL); + return bwb_save (l, "SAVE FILE NAME:"); +} + +/* +-------------------------------------------------------------------------------------------- + TSAVE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_TSAVE (LineType * Line) +{ + /* + SYNTAX: TSAVE [filename$] + */ + + assert (Line != NULL); + return bwb_save (Line, "TSAVE FILE NAME:"); +} + + +/* +============================================================================================ + LIST and so on +============================================================================================ +*/ +static int +xl_line (FILE * file, LineType * l) +{ + char LineExecuted; + char *C; /* start of comment text */ + char *buffer; /* 0...99999 */ + + assert (file != NULL); + assert (l != NULL); + assert( My != NULL ); + assert( My->NumLenBuffer != NULL ); + assert( My->CurrentVersion != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + assert( My->SYSPRN != NULL ); + assert( My->SYSPRN->cfp != NULL ); + + /* + ** The only difference between LIST, LLIST and SAVE is: + ** LIST and LLIST display an '*' + ** when a line has been executed + ** and OPTION COVERAGE ON is enabled. + */ + + buffer = My->NumLenBuffer; + LineExecuted = ' '; + if (My->CurrentVersion->OptionFlags & (OPTION_COVERAGE_ON)) + { + if (l->LineFlags & LINE_EXECUTED) + { + if (file == My->SYSOUT->cfp || file == My->SYSPRN->cfp) + { + /* LIST */ + /* LLIST */ + LineExecuted = '*'; + } + else + { + /* SAVE */ + /* EDIT implies SAVE */ + } + } + } + + C = l->buffer; + if (l->LineFlags & LINE_NUMBERED) + { + /* explicitly numbered */ + sprintf (buffer, "%*d", LineNumberDigits, l->number); + /* ##### xxx */ + } + else + { + /* implicitly numbered */ + if (My->LastLineNumber == l->number) + { + /* multi-statement line */ + if (l->cmdnum == C_REM + && IS_CHAR (l->buffer[0], My->CurrentVersion->OptionCommentChar)) + { + /* trailing comment */ + sprintf (buffer, "%*s%c", LineNumberDigits - 1, "", + My->CurrentVersion->OptionCommentChar); + C++; /* skip comment char */ + while (*C == ' ') + { + /* skip spaces */ + C++; + } + /* ____' xxx */ + } + else if (My->CurrentVersion->OptionStatementChar) + { + /* all other commands, add a colon */ + sprintf (buffer, "%*s%c", LineNumberDigits - 1, "", + My->CurrentVersion->OptionStatementChar); + /* ____: xxx */ + } + else + { + /* + The user is trying to list a multi-line statement + in a dialect that does NOT support multi-line statements. + This could occur when LOADing in one dialect and then SAVEing as another dialect, such as: + OPTION VERSION BASIC-80 + LOAD "TEST1.BAS" + 100 REM TEST + 110 PRINT:PRINT:PRINT + OPTION VERSION MARK-I + EDIT + 100 REM TEST + 110 PRINT + PRINT + PRINT + The only thing we can reasonably do is put spaces for the line number, + since the user will have to edit the results manually anyways. + */ + sprintf (buffer, "%*s", LineNumberDigits, ""); + /* _____ xxx */ + } + } + else + { + /* single-statement line */ + sprintf (buffer, "%*s", LineNumberDigits, ""); + /* _____ xxx */ + } + } + + fprintf (file, "%s", buffer); + fprintf (file, "%c", LineExecuted); + + /* if( TRUE ) */ + { + /* %INCLUDE */ + int i; + for (i = 0; i < l->IncludeLevel; i++) + { + fputc (' ', file); + } + } + if (My->OptionIndentInteger > 0) + { + int i; + + for (i = 0; i < l->Indention; i++) + { + int j; + for (j = 0; j < My->OptionIndentInteger; j++) + { + fputc (' ', file); + } + } + } + fprintf (file, "%s\n", C); + + My->LastLineNumber = l->number; + + return TRUE; +} + +static LineType * +bwb_xlist (LineType * l, FILE * file) +{ + + assert (l != NULL); + assert (file != NULL); + assert( My != NULL ); + assert( My->StartMarker != NULL ); + assert( My->EndMarker != NULL ); + + /* + ** + ** FORCE SCAN + ** + */ + if (bwb_scan () == FALSE) + { + /* + ** + ** we are used by bwb_SAVE and bwb_EDIT + ** + WARN_CANT_CONTINUE; + return (l); + */ + } + + if (line_is_eol (l)) + { + /* LIST */ + LineType *x; + /* now go through and list appropriate lines */ + My->LastLineNumber = -1; + for (x = My->StartMarker->next; x != My->EndMarker; x = x->next) + { + xl_line (file, x); + } + fprintf (file, "\n"); + } + else + { + do + { + int head; + int tail; + + if (line_read_line_sequence (l, &head, &tail)) + { + /* LIST 's' - 'e' */ + LineType *x; + if (head < MINLIN || head > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + if (tail < MINLIN || tail > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + if (head > tail) + { + WARN_UNDEFINED_LINE; + return (l); + } + /* valid range */ + /* now go through and list appropriate lines */ + My->LastLineNumber = -1; + for (x = My->StartMarker->next; x != My->EndMarker; x = x->next) + { + if (head <= x->number && x->number <= tail) + { + xl_line (file, x); + } + } + fprintf (file, "\n"); + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + } + while (line_skip_seperator (l)); + } + if (file == My->SYSOUT->cfp) + { + ResetConsoleColumn (); + } + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + LIST +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_LIST (LineType * l) +{ + /* + SYNTAX: LIST + SYNTAX: LIST line [,...] + SYNTAX: LIST line - line + */ + + assert (l != NULL); + + return bwb_xlist (l, My->SYSOUT->cfp); +} + +/* +-------------------------------------------------------------------------------------------- + LISTNH +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_LISTNH (LineType * l) +{ + /* + SYNTAX: LISTNH + SYNTAX: LISTNH line [,...] + SYNTAX: LISTNH line - line + */ + + assert (l != NULL); + + return bwb_xlist (l, My->SYSOUT->cfp); +} + +/* +-------------------------------------------------------------------------------------------- + LLIST +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_LLIST (LineType * l) +{ + /* + SYNTAX: LLIST + SYNTAX: LLIST line [,...] + SYNTAX: LLIST line - line + */ + + assert (l != NULL); + + return bwb_xlist (l, My->SYSPRN->cfp); +} + + + +/* +============================================================================================ + DELETE and so on +============================================================================================ +*/ + +static LineType * +bwb_delete (LineType * l) +{ + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + assert( My->StartMarker != NULL ); + assert( My->EndMarker != NULL ); + + if (line_is_eol (l)) + { + /* DELETE */ + WARN_SYNTAX_ERROR; + return (l); + } + else if (My->CurrentVersion->OptionVersionValue & (C77)) + { + /* + SYNTAX: DELETE filenum [,...] + */ + do + { + int FileNumber; + + FileNumber = 0; + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (My->CurrentFile->DevMode == DEVMODE_CLOSED) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = NULL; + } + if (My->CurrentFile->buffer != NULL) + { + free (My->CurrentFile->buffer); + My->CurrentFile->buffer = NULL; + } + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + My->CurrentFile->DevMode = DEVMODE_CLOSED; + if (My->CurrentFile->FileName == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + remove (My->CurrentFile->FileName); + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + while (line_skip_seperator (l)); + /* OK */ + return (l); + } + else + { + /* + SYNTAX: DELETE line [,...] + SYNTAX: DELETE line - line + */ + + do + { + int head; + int tail; + + if (line_read_line_sequence (l, &head, &tail)) + { + /* DELETE 's' - 'e' */ + LineType *x; + LineType *previous; + if (head < MINLIN || head > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + if (tail < MINLIN || tail > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + if (head > tail) + { + WARN_UNDEFINED_LINE; + return (l); + } + /* valid range */ + + /* avoid deleting ourself */ + + if (l->LineFlags & (LINE_USER)) + { + /* console line (immediate mode) */ + } + else if (head <= l->number && l->number <= tail) + { + /* 100 DELETE 100 */ + WARN_CANT_CONTINUE; + return (l); + } + /* now go through and list appropriate lines */ + previous = My->StartMarker; + for (x = My->StartMarker->next; x != My->EndMarker;) + { + LineType *next; + + next = x->next; + if (x->number < head) + { + previous = x; + } + else if (head <= x->number && x->number <= tail) + { + if (x == l) + { + /* 100 DELETE 100 */ + WARN_CANT_CONTINUE; + return (l); + } + bwb_freeline (x); + previous->next = next; + } + x = next; + } + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + } + while (line_skip_seperator (l)); + /* + ** + ** FORCE SCAN + ** + */ + if (bwb_scan () == FALSE) + { + WARN_CANT_CONTINUE; + return (l); + } + } + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + DELETE +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_DELETE (LineType * l) +{ + + assert (l != NULL); + + return bwb_delete (l); +} + +/* +-------------------------------------------------------------------------------------------- + PDEL +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_PDEL (LineType * l) +{ + + assert (l != NULL); + + return bwb_delete (l); +} + +#if FALSE /* keep the source to DONUM and DOUNNUM */ + +/* +-------------------------------------------------------------------------------------------- + DONUM +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_donum (LineType * l) +{ + /* + SYNTAX: DONUM + */ + LineType *current; + int lnumber; + + assert (l != NULL); + assert( My != NULL ); + assert( My->StartMarker != NULL ); + assert( My->EndMarker != NULL ); + + lnumber = 10; + for (current = My->StartMarker->next; current != My->EndMarker; + current = current->next) + { + current->number = lnumber; + + lnumber += 10; + if (lnumber > MAXLIN) + { + return (l); + } + } + + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + DOUNUM +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_dounnum (LineType * l) +{ + /* + SYNTAX: DOUNNUM + */ + LineType *current; + + assert (l != NULL); + assert( My != NULL ); + assert( My->StartMarker != NULL ); + assert( My->EndMarker != NULL ); + + for (current = My->StartMarker->next; current != My->EndMarker; + current = current->next) + { + current->number = 0; + } + + return (l); +} + +#endif /* FALSE */ + + + +/* +-------------------------------------------------------------------------------------------- + FILES +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_FILES (LineType * l) +{ + /* + SYNTAX: FILES A$ [, ...] + */ + /* open a list of files in READ mode */ + + assert (l != NULL); + assert( My != NULL ); + + do + { + int FileNumber; + + FileNumber = My->LastFileNumber; + FileNumber++; + if (FileNumber < 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber == 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + My->CurrentFile = file_new (); + My->CurrentFile->FileNumber = FileNumber; + } + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = Value; + Value = NULL; + } + if (My->CurrentFile->DevMode != DEVMODE_CLOSED) + { + My->CurrentFile->DevMode = DEVMODE_CLOSED; + } + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = NULL; + } + if (My->CurrentFile->buffer != NULL) + { + free (My->CurrentFile->buffer); + My->CurrentFile->buffer = NULL; + } + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + if (is_empty_string (My->CurrentFile->FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (bwb_strcmp (My->CurrentFile->FileName, "*") != 0) + { + if ((My->CurrentFile->cfp = + fopen (My->CurrentFile->FileName, "r")) == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + My->CurrentFile->DevMode = DEVMODE_INPUT; + } + My->LastFileNumber = FileNumber; + /* OK */ + } + while (line_skip_seperator (l)); + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + FILE +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_FILE (LineType * l) +{ + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + /* + CBASIC-II: + FILE file_name$ ' filename$ must be a simple string scalar (no arrays) + FILE file_name$ ( record_length% ) ' filename$ must be a simple string scalar (no arrays) + -- if the file exists, + then it is used, + else it is created. + -- Does not trigger IF END # + */ + do + { + int FileNumber; + VariableType *v; + char varname[NameLengthMax + 1]; + + if (line_read_varname (l, varname) == FALSE) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (is_empty_string (varname)) + { + WARN_BAD_FILE_NAME; + return (l); + } + v = find_variable_by_type (varname, 0, StringTypeCode); + if (v == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + if (VAR_IS_STRING (v)) + { + /* OK */ + } + else + { + WARN_TYPE_MISMATCH; + return (l); + } + + FileNumber = My->LastFileNumber; + FileNumber++; + if (FileNumber < 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber == 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + My->CurrentFile = file_new (); + My->CurrentFile->FileNumber = FileNumber; + } + if (My->CurrentFile->DevMode != DEVMODE_CLOSED) + { + My->CurrentFile->DevMode = DEVMODE_CLOSED; + } + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = NULL; + } + if (My->CurrentFile->buffer != NULL) + { + free (My->CurrentFile->buffer); + My->CurrentFile->buffer = NULL; + } + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + /* OK */ + if (line_skip_LparenChar (l)) + { + /* RANDOM file */ + int RecLen; + + if (line_read_integer_expression (l, &RecLen) == FALSE) + { + WARN_FIELD_OVERFLOW; + return (l); + } + if (RecLen <= 0) + { + WARN_FIELD_OVERFLOW; + return (l); + } + if (line_skip_RparenChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if ((My->CurrentFile->buffer = + (char *) calloc (RecLen + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + My->CurrentFile->width = RecLen; + } + + /* if( TRUE ) */ + { + VariantType variant; + CLEAR_VARIANT (&variant); + + if (var_get (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + if (variant.VariantTypeCode == StringTypeCode) + { + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = variant.Buffer; + variant.Buffer = NULL; + } + else + { + WARN_TYPE_MISMATCH; + return (l); + } + } + if (is_empty_string (My->CurrentFile->FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + My->CurrentFile->cfp = fopen (My->CurrentFile->FileName, "r+"); + if (My->CurrentFile->cfp == NULL) + { + My->CurrentFile->cfp = fopen (My->CurrentFile->FileName, "w"); + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = fopen (My->CurrentFile->FileName, "r+"); + } + } + if (My->CurrentFile->cfp == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (My->CurrentFile->width > 0) + { + /* RANDOM file */ + My->CurrentFile->DevMode = DEVMODE_RANDOM; + } + else + { + /* SERIAL file */ + My->CurrentFile->DevMode = DEVMODE_INPUT | DEVMODE_OUTPUT; + } + /* OK */ + My->LastFileNumber = FileNumber; + } + while (line_skip_seperator (l)); + /* OK */ + return (l); + } + if (line_skip_FilenumChar (l)) + { + /* + SYNTAX: FILE # X, A$ + */ + int FileNumber; + + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (line_skip_seperator (l)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + if (FileNumber < 0) + { + /* "FILE # -1" is an ERROR */ + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber == 0) + { + /* "FILE # 0" is an ERROR */ + WARN_BAD_FILE_NUMBER; + return (l); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + My->CurrentFile = file_new (); + My->CurrentFile->FileNumber = FileNumber; + } + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = Value; + Value = NULL; + } + if (My->CurrentFile->DevMode != DEVMODE_CLOSED) + { + My->CurrentFile->DevMode = DEVMODE_CLOSED; + } + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = NULL; + } + if (My->CurrentFile->buffer != NULL) + { + free (My->CurrentFile->buffer); + My->CurrentFile->buffer = NULL; + } + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + if (is_empty_string (My->CurrentFile->FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (bwb_strcmp (My->CurrentFile->FileName, "*") != 0) + { + if ((My->CurrentFile->cfp = + fopen (My->CurrentFile->FileName, "r")) == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + My->CurrentFile->DevMode = DEVMODE_INPUT; + } + /* OK */ + return (l); + } + WARN_SYNTAX_ERROR; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + DELIMIT +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_DELIMIT (LineType * l) +{ + /* + SYNTAX: DELIMIT # X, A$ + */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSIN != NULL ); + + if (line_skip_FilenumChar (l)) + { + /* DELIMIT # */ + int FileNumber; + char delimit; + + My->CurrentFile = My->SYSIN; + + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (line_skip_seperator (l)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + delimit = Value[0]; + free (Value); + Value = NULL; + if (bwb_ispunct (delimit)) + { + /* OK */ + } + else + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + } + if (FileNumber < 0) + { + /* "DELIMIT # -1" is SYSPRN */ + My->SYSPRN->delimit = delimit; + return (l); + } + if (FileNumber == 0) + { + /* "DELIMIT # 0" is SYSOUT */ + My->SYSOUT->delimit = delimit; + return (l); + } + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + My->CurrentFile->delimit = delimit; + /* OK */ + return (l); + } + WARN_SYNTAX_ERROR; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + MARGIN +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_MARGIN (LineType * l) +{ + /* + SYNTAX: MARGIN # X, Y + */ + /* set width for OUTPUT */ + int FileNumber; + int Value; + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSIN != NULL ); + + if (line_skip_FilenumChar (l)) + { + /* MARGIN # */ + My->CurrentFile = My->SYSIN; + + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (line_skip_seperator (l)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value < 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (FileNumber < 0) + { + /* "MARGIN # -1" is SYSPRN */ + My->SYSPRN->width = Value; + return (l); + } + if (FileNumber == 0) + { + /* "MARGIN # 0" is SYSOUT */ + My->SYSOUT->width = Value; + return (l); + } + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if ((My->CurrentFile->DevMode & DEVMODE_WRITE) == 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + My->CurrentFile->width = Value; + /* OK */ + return (l); + } + WARN_SYNTAX_ERROR; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + USE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_USE (LineType * l) +{ + /* + SYNTAX: USE parameter$ ' CALL/360, System/360, System/370 + */ + VariableType *v; + + assert (l != NULL); + assert( My != NULL ); + + if ((v = line_read_scalar (l)) == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (v->VariableTypeCode != StringTypeCode) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + if (My->UseParameterString) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + variant.VariantTypeCode = StringTypeCode; + variant.Buffer = My->UseParameterString; + variant.Length = bwb_strlen (My->UseParameterString); + var_set (v, &variant); + } + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + CHAIN +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_CHAIN (LineType * l) +{ + /* + SYNTAX: CHAIN file-name$ [, linenumber] ' most dialects + SYNTAX: CHAIN file-name$ [, parameter$] ' CALL/360, System/360, System/370 + */ + /* originally based upon bwb_load() */ + int LineNumber; + LineType *x; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + assert( My->StartMarker != NULL ); + assert( My->EndMarker != NULL ); + + /* Get an argument for filename */ + if (line_is_eol (l)) + { + WARN_BAD_FILE_NAME; + return (l); + } + else + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (is_empty_string (Value)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + My->ProgramFilename = NULL; + } + My->ProgramFilename = Value; + } + /* optional linenumber */ + LineNumber = 0; + if (line_skip_seperator (l)) + { + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* CHAIN filename$, parameter$ */ + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (My->UseParameterString) + { + free (My->UseParameterString); + My->UseParameterString = NULL; + } + My->UseParameterString = Value; + } + } + else + { + /* CHAIN filename$, linenumber */ + if (line_read_integer_expression (l, &LineNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (LineNumber < MINLIN || LineNumber > MAXLIN) + { + WARN_UNDEFINED_LINE; + return (l); + } + } + } + + /* deallocate all variables except common ones */ + var_delcvars (); + + /* remove old program from memory */ + bwb_xnew (My->StartMarker); + + /* load new program in memory */ + if (bwb_fload (NULL) == FALSE) + { + WARN_BAD_FILE_NAME; + return (l); + } + /* FIXME */ + x = My->StartMarker; + if (MINLIN <= LineNumber && LineNumber <= MAXLIN) + { + /* search for a matching line number */ + while (x->number != LineNumber && x != My->EndMarker) + { + x = x->next; + } + if (x == My->EndMarker) + { + /* NOT FOUND */ + x = My->StartMarker; + } + } + x->position = 0; + /* + ** + ** FORCE SCAN + ** + */ + if (bwb_scan () == FALSE) + { + WARN_CANT_CONTINUE; + return (l); + } + /* reset all stack counters */ + bwb_clrexec (); + if (bwb_incexec ()) + { + /* OK */ + My->StackHead->line = x; + My->StackHead->ExecCode = EXEC_NORM; + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return My->EndMarker; + } + + /* run the program */ + + /* CHAIN */ + WARN_CLEAR; /* bwb_CHAIN */ + My->ContinueLine = NULL; + SetOnError (0); + return x; +} + +/* +-------------------------------------------------------------------------------------------- + APPEND +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_APPEND (LineType * l) +{ + /* + SYNTAX: APPEND # filenumber ' Dartmouth, Mark-I, Mark-II, GCOS + SYNTAX: APPEND [filename$] ' all others + */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + if (My->CurrentVersion->OptionVersionValue & (D64 | G65 | G67 | G74)) + { + if (line_skip_FilenumChar (l)) + { + /* APPEND # filenumber */ + int FileNumber; + + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (FileNumber < 0) + { + /* "APPEND # -1" is silently ignored */ + return (l); + } + if (FileNumber == 0) + { + /* "APPEND # 0" is silently ignored */ + return (l); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + /* normal file */ + fseek (My->CurrentFile->cfp, 0, SEEK_END); + My->CurrentFile->DevMode = DEVMODE_APPEND; + /* OK */ + return (l); + } + } + /* APPEND filename$ */ + return bwb_load (l, "APPEND FILE NAME:", FALSE); +} + + + +/* +-------------------------------------------------------------------------------------------- + ON ERROR and so on +-------------------------------------------------------------------------------------------- +*/ + +extern void +SetOnError (int LineNumber) +{ + /* scan the stack looking for a FUNCTION/SUB */ + StackType *StackItem; + assert( My != NULL ); + + + if (My->StackHead == NULL) + { + return; + } + + for (StackItem = My->StackHead; StackItem->next != NULL; + StackItem = StackItem->next) + { + LineType *current; + + current = StackItem->LoopTopLine; + if (current != NULL) + { + switch (current->cmdnum) + { + case C_FUNCTION: + case C_SUB: + /* FOUND */ + /* we are in a FUNCTION/SUB, so this is LOCAL */ + StackItem->OnErrorGoto = LineNumber; + return; + /* break; */ + } + } + } + /* StackItem->next == NULL */ + /* NOT FOUND */ + /* we are NOT in a FUNCTION/SUB */ + assert (StackItem != NULL); + StackItem->OnErrorGoto = LineNumber; +} + + +extern int +GetOnError (void) +{ + /* scan the stack looking for an active "ON ERROR GOTO linenumber" */ + StackType *StackItem; + assert( My != NULL ); + + + for (StackItem = My->StackHead; StackItem != NULL; + StackItem = StackItem->next) + { + if (StackItem->OnErrorGoto != 0) + { + /* FOUND */ + return StackItem->OnErrorGoto; + } + } + /* NOT FOUND */ + return 0; +} + +/* +-------------------------------------------------------------------------------------------- + ON ERROR +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_ON_ERROR (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + ON ERROR GOTO +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_ON_ERROR_GOTO (LineType * l) +{ + /* ON ERROR GOTO line */ + int LineNumber; + + assert (l != NULL); + + WARN_CLEAR; /* bwb_ON_ERROR_GOTO */ + + /* get the line number */ + LineNumber = 0; + if (line_is_eol (l)) + { + /* ON ERROR GOTO */ + SetOnError (0); + return (l); + } + if (line_read_integer_expression (l, &LineNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* ON ERORR GOTO linenumber */ + if (LineNumber == 0) + { + /* ON ERROR GOTO 0 */ + SetOnError (0); + return (l); + } + if (LineNumber < MINLIN || LineNumber > MAXLIN) + { + /* ERROR */ + WARN_UNDEFINED_LINE; + return (l); + } + /* OK */ + SetOnError (LineNumber); + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + ON ERROR GOSUB +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_ON_ERROR_GOSUB (LineType * l) +{ + /* ON ERROR GOSUB line */ + + assert (l != NULL); + return bwb_ON_ERROR_GOTO (l); +} + +/* +-------------------------------------------------------------------------------------------- + ON ERROR RESUME +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_ON_ERROR_RESUME (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + ON ERROR RESUME NEXT +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_ON_ERROR_RESUME_NEXT (LineType * l) +{ + + assert (l != NULL); + WARN_CLEAR; /* bwb_ON_ERROR_RESUME_NEXT */ + SetOnError (-1); + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + ON ERROR RETURN +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_ON_ERROR_RETURN (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + ON ERROR RETURN NEXT +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_ON_ERROR_RETURN_NEXT (LineType * l) +{ + + assert (l != NULL); + return bwb_ON_ERROR_RESUME_NEXT (l); +} + +/* +-------------------------------------------------------------------------------------------- + ON TIMER +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_ON_TIMER (LineType * l) +{ + /* ON TIMER(...) GOSUB ... */ + DoubleType v; + DoubleType minv; + int LineNumber; + + assert (l != NULL); + assert( My != NULL ); + + My->IsTimerOn = FALSE; /* bwb_ON_TIMER */ + My->OnTimerLineNumber = 0; + My->OnTimerCount = 0; + + + /* get the SECOMDS parameter */ + if (line_read_numeric_expression (l, &v) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + minv = 1; + assert (CLOCKS_PER_SEC > 0); + minv /= CLOCKS_PER_SEC; + if (v < minv) + { + /* ERROR */ + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + + /* get the GOSUB keyword */ + if (line_skip_word (l, "GOSUB") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* ON TIMER(X) GOSUB line */ + if (line_read_integer_expression (l, &LineNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (LineNumber < MINLIN || LineNumber > MAXLIN) + { + /* ERROR */ + WARN_UNDEFINED_LINE; + return (l); + } + /* OK */ + My->OnTimerLineNumber = LineNumber; + My->OnTimerCount = v; + return (l); +} + + +/* +-------------------------------------------------------------------------------------------- + TIMER +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_TIMER (LineType * l) +{ + + assert (l != NULL); + assert( My != NULL ); + + My->IsTimerOn = FALSE; /* bwb_TIMER */ + WARN_SYNTAX_ERROR; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + TIMER OFF +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_TIMER_OFF (LineType * l) +{ + + assert (l != NULL); + assert( My != NULL ); + + /* TIMER OFF */ + My->IsTimerOn = FALSE; /* bwb_TIMER_OFF */ + My->OnTimerLineNumber = 0; + My->OnTimerCount = 0; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + TIMER ON +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_TIMER_ON (LineType * l) +{ + + assert (l != NULL); + assert( My != NULL ); + + My->IsTimerOn = FALSE; /* bwb_TIMER_ON */ + /* TIMER ON */ + if (My->OnTimerCount > 0 && My->OnTimerLineNumber > 0) + { + My->OnTimerExpires = bwx_TIMER (My->OnTimerCount); + My->IsTimerOn = TRUE; /* bwb_TIMER_ON */ + } + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + TIMER STOP +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_TIMER_STOP (LineType * l) +{ + + assert (l != NULL); + assert( My != NULL ); + + My->IsTimerOn = FALSE; /* bwb_TIMER_STOP */ + + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + RESUME +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_RESUME (LineType * l) +{ + int LineNumber; + LineType *x; + + assert (l != NULL); + assert( My != NULL ); + + LineNumber = 0; + x = My->ERL; /* bwb_RESUME */ + WARN_CLEAR; /* bwb_RESUME */ + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (x == NULL) + { + WARN_RESUME_WITHOUT_ERROR; + return (l); + } + /* Get optional argument for RESUME */ + if (line_is_eol (l)) + { + /* RESUME */ + /* + Execution resumes at the statement which caused the error + For structured commands, this is the top line of the structure. + */ + x->position = 0; + return x; + } + if (line_skip_word (l, "NEXT")) + { + /* RESUME NEXT */ + /* + Execution resumes at the statement immediately following the one which caused the error. + For structured commands, this is the bottom line of the structure. + */ + switch (x->cmdnum) + { + case C_IF8THEN: + /* skip to END_IF */ + assert (x->OtherLine != NULL); + for (x = x->OtherLine; x->cmdnum != C_END_IF; x = x->OtherLine); + break; + case C_SELECT_CASE: + /* skip to END_SELECT */ + assert (x->OtherLine != NULL); + for (x = x->OtherLine; x->cmdnum != C_END_SELECT; x = x->OtherLine); + break; + default: + x = x->next; + } + x->position = 0; + return x; + } + /* RESUME ### */ + if (line_read_integer_expression (l, &LineNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (LineNumber == 0) + { + /* SPECIAL CASE */ + /* RESUME 0 */ + /* Execution resumes at the statement which caused the error */ + x->position = 0; + return x; + } + /* VERIFY LINE EXISTS */ + x = find_line_number (LineNumber); /* RESUME 100 */ + if (x != NULL) + { + /* FOUND */ + x->position = 0; + return x; + } + /* NOT FOUND */ + WARN_UNDEFINED_LINE; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + CMDS +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_CMDS (LineType * l) +{ + int n; + int t; + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + My->CurrentFile = My->SYSOUT; + fprintf (My->SYSOUT->cfp, "BWBASIC COMMANDS AVAILABLE:\n"); + + /* run through the command table and print comand names */ + + t = 0; + for (n = 0; n < NUM_COMMANDS; n++) + { + fprintf (My->SYSOUT->cfp, IntrinsicCommandTable[n].name); + if (t < 4) + { + fprintf (My->SYSOUT->cfp, "\t"); + t++; + } + else + { + fprintf (My->SYSOUT->cfp, "\n"); + t = 0; + } + } + if (t > 0) + { + fprintf (My->SYSOUT->cfp, "\n"); + } + ResetConsoleColumn (); + return (l); +} + +static void +FixUp (char *Name) +{ + char *C; + + assert (Name != NULL); + + C = Name; + while (*C) + { + if (bwb_isalnum (*C)) + { + /* OK */ + } + else + { + /* FIX */ + switch (*C) + { + case '!': + *C = '1'; + break; + case '@': + *C = '2'; + break; + case '#': + *C = '3'; + break; + case '$': + *C = '4'; + break; + case '%': + *C = '5'; + break; + case '^': + *C = '6'; + break; + case '&': + *C = '7'; + break; + case '*': + *C = '8'; + break; + case '(': + *C = '9'; + break; + case ')': + *C = '0'; + break; + default: + *C = '_'; + } + } + C++; + } +} + + +static void +CommandUniqueID (int i, char *UniqueID) +{ + + assert (UniqueID != NULL); + + bwb_strcpy (UniqueID, "C_"); + bwb_strcat (UniqueID, IntrinsicCommandTable[i].name); + FixUp (UniqueID); +} + +static void +CommandVector (int i, char *Vector) +{ + + assert (Vector != NULL); + + bwb_strcpy (Vector, "bwb_"); + bwb_strcat (Vector, IntrinsicCommandTable[i].name); + FixUp (Vector); +} + +static void +CommandOptionVersion (int n, char *OutputLine) +{ + int i; + int j; + + assert (OutputLine != NULL); + + bwb_strcpy (OutputLine, ""); + j = 0; + for (i = 0; i < NUM_VERSIONS; i++) + { + if (IntrinsicCommandTable[n].OptionVersionBitmask & bwb_vertable[i]. + OptionVersionValue) + { + if (j > 0) + { + bwb_strcat (OutputLine, " | "); + } + bwb_strcat (OutputLine, bwb_vertable[i].ID); + j++; + } + } +} + + +void +SortAllCommands (void) +{ + /* sort by name */ + int i; + assert( My != NULL ); + + + for (i = 0; i < NUM_COMMANDS - 1; i++) + { + int j; + int k; + k = i; + for (j = i + 1; j < NUM_COMMANDS; j++) + { + if (bwb_stricmp + (IntrinsicCommandTable[j].name, IntrinsicCommandTable[k].name) < 0) + { + k = j; + } + } + if (k > i) + { + CommandType t; + bwb_memcpy (&t, &(IntrinsicCommandTable[i]), sizeof (CommandType)); + bwb_memcpy (&(IntrinsicCommandTable[i]), &(IntrinsicCommandTable[k]), + sizeof (CommandType)); + bwb_memcpy (&(IntrinsicCommandTable[k]), &t, sizeof (CommandType)); + } + } +#if THE_PRICE_IS_RIGHT + for (i = 0; i < 26; i++) + { + My->CommandStart[i] = -1; + } + for (i = 0; i < NUM_COMMANDS; i++) + { + int j; + j = VarTypeIndex (IntrinsicCommandTable[i].name[0]); + if (j < 0) + { + /* non-alpha */ + } + else if (My->CommandStart[j] < 0) + { + /* this is the first command starting with this letter */ + My->CommandStart[j] = i; + } + } +#endif /* THE_PRICE_IS_RIGHT */ +} + +void +SortAllFunctions (void) +{ + /* sort by name then number of parameters */ + int i; + assert( My != NULL ); + + + for (i = 0; i < NUM_FUNCTIONS - 1; i++) + { + int j; + int k; + k = i; + for (j = i + 1; j < NUM_FUNCTIONS; j++) + { + int n; + n = + bwb_stricmp (IntrinsicFunctionTable[j].Name, + IntrinsicFunctionTable[k].Name); + if (n < 0) + { + k = j; + } + else if (n == 0) + { + if (IntrinsicFunctionTable[j].ParameterCount < + IntrinsicFunctionTable[k].ParameterCount) + { + k = j; + } + } + } + if (k > i) + { + IntrinsicFunctionType t; + bwb_memcpy (&t, &(IntrinsicFunctionTable[i]), + sizeof (IntrinsicFunctionType)); + bwb_memcpy (&(IntrinsicFunctionTable[i]), &(IntrinsicFunctionTable[k]), + sizeof (IntrinsicFunctionType)); + bwb_memcpy (&(IntrinsicFunctionTable[k]), &t, + sizeof (IntrinsicFunctionType)); + } + } +#if THE_PRICE_IS_RIGHT + for (i = 0; i < 26; i++) + { + My->IntrinsicFunctionStart[i] = -1; + } + for (i = 0; i < NUM_FUNCTIONS; i++) + { + int j; + j = VarTypeIndex (IntrinsicFunctionTable[i].Name[0]); + if (j < 0) + { + /* non-alpha */ + } + else if (My->IntrinsicFunctionStart[j] < 0) + { + /* this is the first command starting with this letter */ + My->IntrinsicFunctionStart[j] = i; + } + } +#endif /* THE_PRICE_IS_RIGHT */ +} + + +void +DumpAllCommandUniqueID (FILE * file) +{ + int i; + int j; + char LastUniqueID[NameLengthMax + 1]; + + assert (file != NULL); + + j = 0; + LastUniqueID[0] = NulChar; + + fprintf (file, "/* COMMANDS */\n"); + + /* run through the command table and print comand #define */ + + for (i = 0; i < NUM_COMMANDS; i++) + { + char UniqueID[NameLengthMax + 1]; + + CommandUniqueID (i, UniqueID); + if (bwb_stricmp (LastUniqueID, UniqueID) != 0) + { + /* not a duplicate */ + bwb_strcpy (LastUniqueID, UniqueID); + j = j + 1; + fprintf (file, "#define %-30s %3d /* %-30s */\n", UniqueID, j, + IntrinsicCommandTable[i].name); + } + } + fprintf (file, "#define NUM_COMMANDS %d\n", j); + fflush (file); +} + +static void +ProcessEscapeChars (const char *Input, char *Output) +{ + int n; + + assert (Input != NULL); + assert (Output != NULL); + + n = 0; + + while (*Input) + { + /* \a \b \f \n \r \t \v \" \\ */ + switch (*Input) + { + case '\a': + *Output = '\\'; + Output++; + *Output = 'a'; + Output++; + break; + case '\b': + *Output = '\\'; + Output++; + *Output = 'b'; + Output++; + break; + case '\f': + *Output = '\\'; + Output++; + *Output = 'f'; + Output++; + break; + case '\n': + *Output = '\\'; + Output++; + *Output = 'n'; + Output++; + break; + case '\r': + *Output = '\\'; + Output++; + *Output = 'r'; + Output++; + break; + case '\t': + *Output = '\\'; + Output++; + *Output = 't'; + Output++; + break; + case '\v': + *Output = '\\'; + Output++; + *Output = 'n'; + Output++; + break; + case '\"': + *Output = '\\'; + Output++; + *Output = '"'; + Output++; + break; + case '\\': + *Output = '\\'; + Output++; + *Output = '\\'; + Output++; + break; + default: + *Output = *Input; + Output++; + break; + } + *Output = NulChar; + n++; + if (n > 60 && *Input == ' ') + { + *Output = '\"'; + Output++; + *Output = '\n'; + Output++; + *Output = ' '; + Output++; + *Output = ' '; + Output++; + *Output = '\"'; + Output++; + *Output = NulChar; + n = 0; + } + Input++; + } +} + +void +DumpAllCommandTableDefinitions (FILE * file) +{ + /* generate bwd_cmd.c */ + + int i; + + assert (file != NULL); + + fprintf (file, "/* COMMAND TABLE */\n\n"); + fprintf (file, "#include \"bwbasic.h\"\n\n"); + fprintf (file, + "CommandType IntrinsicCommandTable[ /* NUM_COMMANDS */ ] =\n"); + fprintf (file, "{\n"); + + /* run through the command table and print comand #define */ + + for (i = 0; i < NUM_COMMANDS; i++) + { + char tbuf[MAINTAINER_BUFFER_LENGTH + 1]; /* DumpAllCommandTableDefinitions */ + + + fprintf (file, "{\n"); + + fprintf (file, " "); + CommandUniqueID (i, tbuf); + fprintf (file, tbuf); + fprintf (file, ", /* UniqueID */\n"); + + fprintf (file, " "); + fprintf (file, "\""); + ProcessEscapeChars (IntrinsicCommandTable[i].Syntax, tbuf); + fprintf (file, tbuf); + fprintf (file, "\""); + fprintf (file, ", /* Syntax */\n"); + + fprintf (file, " "); + fprintf (file, "\""); + ProcessEscapeChars (IntrinsicCommandTable[i].Description, tbuf); + fprintf (file, tbuf); + fprintf (file, "\""); + fprintf (file, ", /* Description */\n"); + + fprintf (file, " "); + fprintf (file, "\""); + fprintf (file, IntrinsicCommandTable[i].name); + fprintf (file, "\""); + fprintf (file, ", /* Name */\n"); + + fprintf (file, " "); + CommandOptionVersion (i, tbuf); + fprintf (file, tbuf); + fprintf (file, " /* OptionVersionBitmask */\n"); + + fprintf (file, "},\n"); + } + fprintf (file, "};\n"); + fprintf (file, "\n"); + fprintf (file, + "const size_t NUM_COMMANDS = sizeof( IntrinsicCommandTable ) / sizeof( CommandType );\n"); + fprintf (file, "\n"); + fflush (file); +} + +void +DumpAllCommandSwitchStatement (FILE * file) +{ + int i; + char LastUniqueID[NameLengthMax + 1]; + + assert (file != NULL); + + LastUniqueID[0] = NulChar; + + /* run through the command table and print comand #define */ + fprintf (file, "/* SWITCH */\n"); + fprintf (file, "LineType *bwb_vector( LineType *l )\n"); + fprintf (file, "{\n"); + + fprintf (file, " "); + fprintf (file, "LineType *r;\n"); + + fprintf (file, " "); + fprintf (file, "switch( l->cmdnum )\n"); + + fprintf (file, " "); + fprintf (file, "{\n"); + + for (i = 0; i < NUM_COMMANDS; i++) + { + char tbuf[NameLengthMax + 1]; + + CommandUniqueID (i, tbuf); + if (bwb_stricmp (LastUniqueID, tbuf) != 0) + { + /* not a duplicate */ + bwb_strcpy (LastUniqueID, tbuf); + + fprintf (file, " "); + fprintf (file, "case "); + CommandUniqueID (i, tbuf); + fprintf (file, tbuf); + fprintf (file, ":\n"); + + fprintf (file, " "); + fprintf (file, " "); + fprintf (file, "r = "); + CommandVector (i, tbuf); + fprintf (file, tbuf); + fprintf (file, "( l );\n"); + + fprintf (file, " "); + fprintf (file, " "); + fprintf (file, "break;\n"); + } + } + + fprintf (file, " "); + fprintf (file, "default:\n"); + + fprintf (file, " "); + fprintf (file, " "); + fprintf (file, "WARN_INTERNAL_ERROR;\n"); + + fprintf (file, " "); + fprintf (file, " "); + fprintf (file, "r = l;\n"); + + fprintf (file, " "); + fprintf (file, " "); + fprintf (file, "break;\n"); + + + fprintf (file, " "); + fprintf (file, "}\n"); + + fprintf (file, " "); + fprintf (file, "return r;\n"); + + fprintf (file, "}\n"); + + fflush (file); +} + +void +FixDescription (FILE * file, const char *left, const char *right) +{ + char buffer[MAINTAINER_BUFFER_LENGTH + 1]; /* FixDescription */ + int l; /* length of left side */ + int p; /* current position */ + int n; /* position of the last space character, zero means none yet seen */ + int i; /* number of characters since last '\n' */ + + assert (left != NULL); + assert (right != NULL); + + l = bwb_strlen (left); + p = 0; + n = 0; + i = 0; + bwb_strcpy (buffer, right); + + while (buffer[p]) + { + if (buffer[p] == '\n') + { + n = p; + i = 0; + } + if (buffer[p] == ' ') + { + n = p; + } + if (i > 45 && n > 0) + { + buffer[n] = '\n'; + i = p - n; + } + p++; + i++; + } + fputs (left, file); + p = 0; + while (buffer[p]) + { + if (buffer[p] == '\n') + { + fputc (buffer[p], file); + p++; + while (buffer[p] == ' ') + { + p++; + } + for (i = 0; i < l; i++) + { + fputc (' ', file); + } + } + else + { + fputc (buffer[p], file); + p++; + } + } + fputc ('\n', file); + +} + +void +DumpOneCommandSyntax (FILE * file, int IsXref, int n) +{ + + assert (file != NULL); + + if (n < 0 || n >= NUM_COMMANDS) + { + return; + } + /* NAME */ + { + FixDescription (file, " SYNTAX: ", IntrinsicCommandTable[n].Syntax); + } + /* DESCRIPTION */ + { + FixDescription (file, "DESCRIPTION: ", + IntrinsicCommandTable[n].Description); + } + /* COMPATIBILITY */ + if (IsXref) + { + int i; + fprintf (file, " VERSIONS:\n"); + for (i = 0; i < NUM_VERSIONS; i++) + { + char X; + if (IntrinsicCommandTable[n].OptionVersionBitmask & bwb_vertable[i]. + OptionVersionValue) + { + /* SUPPORTED */ + X = 'X'; + } + else + { + /* NOT SUPPORTED */ + X = '_'; + } + fprintf (file, " [%c] %s\n", X, bwb_vertable[i].Name); + } + } + + fflush (file); +} + +void +DumpAllCommandSyntax (FILE * file, int IsXref, + OptionVersionType OptionVersionValue) +{ + /* for the C maintainer */ + int i; + + assert (file != NULL); + + fprintf (file, + "============================================================\n"); + fprintf (file, + " COMMANDS \n"); + fprintf (file, + "============================================================\n"); + fprintf (file, "\n"); + fprintf (file, "\n"); + for (i = 0; i < NUM_COMMANDS; i++) + { + if (IntrinsicCommandTable[i].OptionVersionBitmask & OptionVersionValue) + { + fprintf (file, + "------------------------------------------------------------\n"); + DumpOneCommandSyntax (file, IsXref, i); + } + + } + fprintf (file, + "------------------------------------------------------------\n"); + + + fprintf (file, "\n"); + fprintf (file, "\n"); + fflush (file); +} + + +void +DumpAllCommandHtmlTable (FILE * file) +{ + /* generate bwd_cmd.htm */ + + int i; + int j; + + assert (file != NULL); + + + /* LEGEND */ + fprintf (file, "CMDS\n"); + fprintf (file, "

LEGEND


\n"); + fprintf (file, "\n"); + + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, "\n"); + + for (j = 0; j < NUM_VERSIONS; j++) + { + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, "\n"); + } + fprintf (file, "
"); + fprintf (file, ""); + fprintf (file, "ID"); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, "NAME"); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, "DESCRIPTION"); + fprintf (file, ""); + fprintf (file, "
"); + fprintf (file, bwb_vertable[j].ID); + fprintf (file, ""); + fprintf (file, bwb_vertable[j].Name); + fprintf (file, ""); + fprintf (file, bwb_vertable[j].Description); + fprintf (file, "
\n"); + fprintf (file, "
\n"); + + + /* DETAILS */ + fprintf (file, "

DETAILS


\n"); + fprintf (file, "\n"); + + fprintf (file, ""); + fprintf (file, ""); + for (j = 0; j < NUM_VERSIONS; j++) + { + fprintf (file, ""); + } + fprintf (file, "\n"); + + + /* run through the command table and print comand -vs- OPTION VERSION */ + + for (i = 0; i < NUM_COMMANDS; i++) + { + fprintf (file, ""); + fprintf (file, ""); + + for (j = 0; j < NUM_VERSIONS; j++) + { + fprintf (file, ""); + } + fprintf (file, "\n"); + } + fprintf (file, "
"); + fprintf (file, ""); + fprintf (file, "COMMAND"); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, bwb_vertable[j].ID); + fprintf (file, ""); + fprintf (file, "
"); + fprintf (file, (char *) IntrinsicCommandTable[i].Syntax); + fprintf (file, ""); + if (IntrinsicCommandTable[i].OptionVersionBitmask & bwb_vertable[j]. + OptionVersionValue) + { + fprintf (file, "X"); + } + else + { + fprintf (file, " "); + } + fprintf (file, "
\n"); + fprintf (file, "\n"); + fprintf (file, "\n"); + + fflush (file); +} + +/* +-------------------------------------------------------------------------------------------- + HELP +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_HELP (LineType * l) +{ + /* HELP ... */ + int n; + int Found; + char *C; + char *tbuf; + + assert (l != NULL); + assert( My != NULL ); + assert( My->ConsoleInput != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + tbuf = My->ConsoleInput; + Found = FALSE; + + C = l->buffer; + C += l->position; + bwb_strcpy (tbuf, C); + + /* RTRIM$ */ + C = tbuf; + if (*C != 0) + { + /* not an empty line, so remove one (or more) trailing spaces */ + char *E; + + E = bwb_strchr (tbuf, 0); + E--; + while (E >= tbuf && *E == ' ') + { + *E = 0; + E--; + } + } + + + /* EXACT match */ + for (n = 0; n < NUM_COMMANDS; n++) + { + if (bwb_stricmp (IntrinsicCommandTable[n].name, tbuf) == 0) + { + fprintf (My->SYSOUT->cfp, + "------------------------------------------------------------\n"); + DumpOneCommandSyntax (My->SYSOUT->cfp, FALSE, n); + Found = TRUE; + } + } + + for (n = 0; n < NUM_FUNCTIONS; n++) + { + if (bwb_stricmp (IntrinsicFunctionTable[n].Name, tbuf) == 0) + { + fprintf (My->SYSOUT->cfp, + "------------------------------------------------------------\n"); + DumpOneFunctionSyntax (My->SYSOUT->cfp, FALSE, n); + Found = TRUE; + } + } + + if (Found == FALSE) + { + /* PARTIAL match */ + int Length; + Length = bwb_strlen (tbuf); + + for (n = 0; n < NUM_COMMANDS; n++) + { + if (bwb_strnicmp (IntrinsicCommandTable[n].name, tbuf, Length) == 0) + { + if (Found == FALSE) + { + fprintf (My->SYSOUT->cfp, + "The following topics are a partial match:\n"); + } + fprintf (My->SYSOUT->cfp, IntrinsicCommandTable[n].name); + fprintf (My->SYSOUT->cfp, "\t"); + Found = TRUE; + } + } + + for (n = 0; n < NUM_FUNCTIONS; n++) + { + if (bwb_strnicmp (IntrinsicFunctionTable[n].Name, tbuf, Length) == 0) + { + if (Found == FALSE) + { + fprintf (My->SYSOUT->cfp, + "The following topics are a partial match:\n"); + } + fprintf (My->SYSOUT->cfp, IntrinsicFunctionTable[n].Name); + fprintf (My->SYSOUT->cfp, "\t"); + Found = TRUE; + } + } + if (Found == TRUE) + { + /* match */ + fprintf (My->SYSOUT->cfp, "\n"); + } + } + if (Found == FALSE) + { + /* NO match */ + fprintf (My->SYSOUT->cfp, "No help found.\n"); + } + ResetConsoleColumn (); + line_skip_eol (l); + return (l); + +} + +int +NumberValueCheck (ParamTestType ParameterTests, DoubleType X) +{ + DoubleType XR; /* rounded value */ + unsigned char TestNibble; + + + + /* VerifyNumeric */ + if (isnan (X)) + { + /* INTERNAL ERROR */ + return -1; + } + if (isinf (X)) + { + /* - Evaluation of an expression results in an overflow + * (nonfatal, the recommended recovery procedure is to supply + * machine in- finity with the algebraically correct sign and + * continue). */ + if (X < 0) + { + X = MINDBL; + } + else + { + X = MAXDBL; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + return -1; + } + /* CONTINUE */ + } + /* OK */ + /* VALID NUMERIC VALUE */ + XR = bwb_rint (X); + ParameterTests &= 0x0000000F; + TestNibble = (unsigned char) ParameterTests; + switch (TestNibble) + { + case P1ERR: + /* INTERNAL ERROR */ + return -1; + /* break; */ + case P1ANY: + if (X < MINDBL || X > MAXDBL) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1BYT: + if (XR < MINBYT || XR > MAXBYT) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1INT: + if (XR < MININT || XR > MAXINT) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1LNG: + if (XR < MINLNG || XR > MAXLNG) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1CUR: + if (XR < MINCUR || XR > MAXCUR) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1FLT: + if (X < MINSNG || X > MAXSNG) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1DBL: + if (X < MINDBL || X > MAXDBL) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1DEV: + /* ERROR */ + return -1; + /* break; */ + case P1LEN: + if (XR < MINLEN || XR > MAXLEN) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1POS: + if (XR < 1 || XR > MAXLEN) + { + /* ERROR */ + return -1; + } + /* OK */ + return 0; + /* break; */ + case P1COM: + /* ERROR */ + return -1; + /* break; */ + case P1LPT: + /* ERROR */ + return -1; + /* break; */ + case P1GTZ: + if (X > 0) + { + /* OK */ + return 0; + } + break; + case P1GEZ: + if (X >= 0) + { + /* OK */ + return 0; + } + break; + case P1NEZ: + if (X != 0) + { + /* OK */ + return 0; + } + break; + } + /* ERROR */ + return -1; +} + +int +StringLengthCheck (ParamTestType ParameterTests, int s) +{ + unsigned char TestNibble; + + + /* check for invalid string length */ + if (s < 0 || s > MAXLEN) + { + /* INTERNAL ERROR */ + return -1; + } + /* VALID STRING LENGTH */ + ParameterTests &= 0x0000000F; + TestNibble = (unsigned char) ParameterTests; + switch (TestNibble) + { + case P1ERR: + /* INTERNAL ERROR */ + return -1; + /* break; */ + case P1ANY: + /* OK */ + return 0; + /* break; */ + case P1BYT: + if (s >= sizeof (ByteType)) + { + /* OK */ + return 0; + } + break; + case P1INT: + if (s >= sizeof (IntegerType)) + { + /* OK */ + return 0; + } + break; + case P1LNG: + if (s >= sizeof (LongType)) + { + /* OK */ + return 0; + } + break; + case P1CUR: + if (s >= sizeof (CurrencyType)) + { + /* OK */ + return 0; + } + break; + case P1FLT: + if (s >= sizeof (SingleType)) + { + /* OK */ + return 0; + } + break; + case P1DBL: + if (s >= sizeof (DoubleType)) + { + /* OK */ + return 0; + } + break; + case P1DEV: + /* ERROR */ + return -1; + /* break; */ + case P1LEN: + /* ERROR */ + return -1; + /* break; */ + case P1POS: + /* ERROR */ + return -1; + /* break; */ + case P1GEZ: + /* ERROR */ + return -1; + /* break; */ + case P1GTZ: + /* ERROR */ + return -1; + /* break; */ + case P1NEZ: + /* ERROR */ + return -1; + /* break; */ + } + /* ERROR */ + return -1; +} + +void +IntrinsicFunctionDefinitionCheck (IntrinsicFunctionType * f) +{ + /* function definition check -- look for obvious errors */ + + assert (f != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + + /* sanity check */ + if (f->ParameterCount == PNONE || f->ParameterCount == 0xFF) + { + /* function has NO explicit parameters */ + if (f->ParameterTypes == PNONE) + { + /* OK */ + } + else + { + /* oops */ + fprintf (My->SYSOUT->cfp, "invalid ParameterTypes <%s>\n", f->Name); + } + if (f->ParameterTests == PNONE) + { + /* OK */ + } + else + { + /* oops */ + fprintf (My->SYSOUT->cfp, "invalid ParameterTests <%s>\n", f->Name); + } + } + else + { + /* function HAS an explicit number of parameters */ + int i; + ParamTestType ParameterTests; + + ParameterTests = f->ParameterTests; + for (i = 0; i < f->ParameterCount; i++) + { + /* sanity check this parameter */ + ParamTestType thischeck; + thischeck = ParameterTests & 0x0000000F; + /* verify parameter check */ + if (f->ParameterTypes & (1 << i)) + { + /* STRING */ + if (thischeck >= P1ANY && thischeck <= P1DBL) + { + /* OK */ + } + else + { + /* oops */ + fprintf (My->SYSOUT->cfp, + "invalid ParameterTests <%s> parameter %d\n", f->Name, + i + 1); + } + } + else + { + /* NUMBER */ + if (thischeck >= P1ANY && thischeck <= P1NEZ) + { + /* OK */ + } + else + { + /* oops */ + fprintf (My->SYSOUT->cfp, + "invalid ParameterTests <%s> parameter %d\n", f->Name, + i + 1); + } + } + ParameterTests = ParameterTests >> 4; + } + if (ParameterTests != 0) + { + /* oops */ + fprintf (My->SYSOUT->cfp, "invalid ParameterTests <%s> parameter %d\n", + f->Name, i + 1); + } + } +} + +void +IntrinsicFunctionUniqueID (IntrinsicFunctionType * f, char *UniqueID) +{ + /* generate the function's UniqueID */ + /* manual fixup required for duplicates */ + char NumVar; + char StrVar; + + assert (f != NULL); + assert (UniqueID != NULL); + + + NumVar = 'X'; + StrVar = 'A'; + + /* F_ */ + bwb_strcpy (UniqueID, "F_"); + /* NAME */ + bwb_strcat (UniqueID, f->Name); + /* PARAMETERS */ + if (f->ParameterCount == PNONE || f->ParameterCount == 0xFF) + { + /* function has NO explicit parameters */ + } + else + { + /* function HAS explicit parameters */ + int i; + ParamBitsType ParameterTypes; + ParameterTypes = f->ParameterTypes; + for (i = 0; i < f->ParameterCount; i++) + { + char VarName[NameLengthMax + 1]; + if (ParameterTypes & 1) + { + /* STRING */ + sprintf (VarName, "_%c", StrVar); + StrVar++; + } + else + { + /* NUMBER */ + sprintf (VarName, "_%c", NumVar); + NumVar++; + } + bwb_strcat (UniqueID, VarName); + ParameterTypes = ParameterTypes >> 1; + } + } + /* RETURN TYPE */ + if (f->ReturnTypeCode == StringTypeCode) + { + bwb_strcat (UniqueID, "_S"); + } + else + { + bwb_strcat (UniqueID, "_N"); + } + /* fixup illegal characters, "DEF FN" "BLOAD:", "CLOAD*" */ + FixUp (UniqueID); +} + + +void +IntrinsicFunctionSyntax (IntrinsicFunctionType * f, char *Syntax) +{ + /* generate the function's Syntax */ + char NumVar; + char StrVar; + + assert (f != NULL); + assert (Syntax != NULL); + + + NumVar = 'X'; + StrVar = 'A'; + + /* RETURN TYPE */ + if (f->ReturnTypeCode == StringTypeCode) + { + bwb_strcpy (Syntax, "S$ = "); + } + else + { + bwb_strcpy (Syntax, "N = "); + } + /* NAME */ + bwb_strcat (Syntax, f->Name); + /* PARAMETERS */ + if (f->ParameterCount == PNONE) + { + /* function has NO explicit parameters */ + } + else if (f->ParameterCount == 0xFF) + { + /* function has a variable number of parameters */ + bwb_strcat (Syntax, "( ... )"); + } + else + { + /* function HAS explicit parameters */ + int i; + ParamBitsType ParameterTypes; + ParameterTypes = f->ParameterTypes; + + if (f->ReturnTypeCode == StringTypeCode) + { + bwb_strcat (Syntax, "( "); + } + else + { + bwb_strcat (Syntax, "( "); + } + + for (i = 0; i < f->ParameterCount; i++) + { + char VarName[NameLengthMax + 1]; + if (i > 0) + { + bwb_strcat (Syntax, ", "); + } + /* verify parameter check */ + if (ParameterTypes & 1) + { + /* STRING */ + sprintf (VarName, "%c$", StrVar); + StrVar++; + } + else + { + /* NUMBER */ + sprintf (VarName, "%c", NumVar); + NumVar++; + } + bwb_strcat (Syntax, VarName); + ParameterTypes = ParameterTypes >> 1; + } + if (f->ReturnTypeCode == StringTypeCode) + { + bwb_strcat (Syntax, " )"); + } + else + { + bwb_strcat (Syntax, " )"); + } + } +} + +void +DumpAllFunctionUniqueID (FILE * file) +{ + /* for the C maintainer */ + int i; + int j; + char LastUniqueID[NameLengthMax + 1]; + + assert (file != NULL); + + j = 0; + LastUniqueID[0] = NulChar; + + fprintf (file, "/* FUNCTIONS */\n"); + for (i = 0; i < NUM_FUNCTIONS; i++) + { + char UniqueID[NameLengthMax + 1]; + + IntrinsicFunctionUniqueID (&(IntrinsicFunctionTable[i]), UniqueID); + if (bwb_stricmp (LastUniqueID, UniqueID) != 0) + { + /* not a duplicate */ + char Syntax[NameLengthMax + 1]; + + bwb_strcpy (LastUniqueID, UniqueID); + j = j + 1; + IntrinsicFunctionSyntax (&(IntrinsicFunctionTable[i]), Syntax); + fprintf (file, "#define %-30s %3d /* %-30s */\n", UniqueID, j, Syntax); + } + } + fprintf (file, "#define NUM_FUNCTIONS %d\n", j); + fflush (file); +} + +void +DumpAllFunctionSwitch (FILE * file) +{ + /* for the C maintainer */ + int i; + + assert (file != NULL); + + + fprintf (file, "/* SWITCH */\n"); + fprintf (file, "switch( UniqueID )\n"); + fprintf (file, "{\n"); + for (i = 0; i < NUM_FUNCTIONS; i++) + { + char tbuf[MAINTAINER_BUFFER_LENGTH + 1]; /* DumpAllFunctionSwitch */ + + fprintf (file, "case "); + IntrinsicFunctionUniqueID (&(IntrinsicFunctionTable[i]), tbuf); + fprintf (file, tbuf); + fprintf (file, ":\n"); + fprintf (file, " break;\n"); + } + fprintf (file, "}\n"); + fflush (file); +} + +static const char *ParameterRangeID[16] = { + "P%dERR", + "P%dANY", + "P%dBYT", + "P%dINT", + "P%dLNG", + "P%dCUR", + "P%dFLT", + "P%dDBL", + "P%dDEV", + "P%dLEN", + "P%dPOS", + "P%dCOM", + "P%dLPT", + "P%dGTZ", + "P%dGEZ", + "P%dNEZ", +}; + +static const char *NumberVariableRange[16] = { + /* P1ERR */ " PARAMETER: %c is a number, INTERNAL ERROR", + /* P1ANY */ " PARAMETER: %c is a number", + /* P1BYT */ " PARAMETER: %c is a number, [0,255]", + /* P1INT */ " PARAMETER: %c is a number, [MININT,MAXINT]", + /* P1LNG */ " PARAMETER: %c is a number, [MINLNG,MAXLNG]", + /* P1CUR */ " PARAMETER: %c is a number, [MINCUR,MAXCUR]", + /* P1FLT */ " PARAMETER: %c is a number, [MINFLT,MAXFLT]", + /* P1DBL */ " PARAMETER: %c is a number, [MINDBL,MAXDBL]", + /* P1DEV */ " PARAMETER: %c is a number, RESERVED", + /* P1LEN */ " PARAMETER: %c is a number, [0,MAXLEN]", + /* P1POS */ " PARAMETER: %c is a number, [1,MAXLEN]", + /* P1COM */ " PARAMETER: %c is a number, RESERVED", + /* P1LPT */ " PARAMETER: %c is a number, RESERVED", + /* P1GTZ */ " PARAMETER: %c is a number, > 0", + /* P1GEZ */ " PARAMETER: %c is a number, >= 0", + /* P1NEZ */ " PARAMETER: %c is a number, <> 0", +}; + +static const char *StringVariableRange[16] = { + /* P1ERR */ " PARAMETER: %c$ is a string, INTERNAL ERROR", + /* P1ANY */ " PARAMETER: %c$ is a string, LEN >= 0", + /* P1BYT */ " PARAMETER: %c$ is a string, LEN >= 1", + /* P1INT */ " PARAMETER: %c$ is a string, LEN >= sizeof(INT)", + /* P1LNG */ " PARAMETER: %c$ is a string, LEN >= sizeof(LNG)", + /* P1CUR */ " PARAMETER: %c$ is a string, LEN >= sizeof(CUR)", + /* P1FLT */ " PARAMETER: %c$ is a string, LEN >= sizeof(FLT)", + /* P1DBL */ " PARAMETER: %c$ is a string, LEN >= sizeof(DBL)", + /* P1DEV */ " PARAMETER: %c$ is a string, RESERVED", + /* P1LEN */ " PARAMETER: %c$ is a string, RESERVED", + /* P1POS */ " PARAMETER: %c$ is a string, RESERVED", + /* P1COM */ " PARAMETER: %c$ is a string, RESERVED", + /* P1LPT */ " PARAMETER: %c$ is a string, RESERVED", + /* P1GTZ */ " PARAMETER: %c$ is a string, RESERVED", + /* P1GEZ */ " PARAMETER: %c$ is a string, RESERVED", + /* P1NEZ */ " PARAMETER: %c$ is a string, RESERVED", +}; + +void +DumpAllFuctionTableDefinitions (FILE * file) +{ + /* generate bwd_fun.c */ + int n; + + assert (file != NULL); + + + fprintf (file, "/* FUNCTION TABLE */\n"); + fprintf (file, "\n"); + fprintf (file, "#include \"bwbasic.h\"\n"); + fprintf (file, "\n"); + fprintf (file, + "IntrinsicFunctionType IntrinsicFunctionTable[ /* NUM_FUNCTIONS */ ] =\n"); + fprintf (file, "{\n"); + for (n = 0; n < NUM_FUNCTIONS; n++) + { + int i; + int j; + char tbuf[MAINTAINER_BUFFER_LENGTH + 1]; /* DumpAllFuctionTableDefinitions */ + char UniqueID[MAINTAINER_BUFFER_LENGTH + 1]; /* DumpAllFuctionTableDefinitions */ + char Syntax[MAINTAINER_BUFFER_LENGTH + 1]; /* DumpAllFuctionTableDefinitions */ + IntrinsicFunctionType *f; + + f = &(IntrinsicFunctionTable[n]); + + IntrinsicFunctionUniqueID (f, UniqueID); + IntrinsicFunctionSyntax (f, Syntax); + fprintf (file, "{\n"); + fprintf (file, " %s, /* UniqueID */\n", UniqueID); + fprintf (file, " \"%s\", /* Syntax */\n", Syntax); + fprintf (file, " "); + fprintf (file, "\""); + ProcessEscapeChars (f->Description, tbuf); + fprintf (file, tbuf); + fprintf (file, "\""); + fprintf (file, ", /* Description */\n"); + fprintf (file, " \"%s\", /* Name */\n", f->Name); + switch (f->ReturnTypeCode) + { + case ByteTypeCode: + fprintf (file, " %s, /* ReturnTypeCode */\n", "ByteTypeCode"); + break; + case IntegerTypeCode: + fprintf (file, " %s, /* ReturnTypeCode */\n", "IntegerTypeCode"); + break; + case LongTypeCode: + fprintf (file, " %s, /* ReturnTypeCode */\n", "LongTypeCode"); + break; + case CurrencyTypeCode: + fprintf (file, " %s, /* ReturnTypeCode */\n", "CurrencyTypeCode"); + break; + case SingleTypeCode: + fprintf (file, " %s, /* ReturnTypeCode */\n", "SingleTypeCode"); + break; + case DoubleTypeCode: + fprintf (file, " %s, /* ReturnTypeCode */\n", "DoubleTypeCode"); + break; + case StringTypeCode: + fprintf (file, " %s, /* ReturnTypeCode */\n", "StringTypeCode"); + break; + default: + fprintf (file, " %s, /* ReturnTypeCode */\n", "INTERNAL ERROR"); + break; + } + fprintf (file, " %d, /* ParameterCount */\n", f->ParameterCount); + if (f->ParameterCount == 0 || f->ParameterCount == 0xFF) + { + /* function has NO explicit parameters */ + fprintf (file, " %s, /* ParameterTypes */\n", "PNONE"); + fprintf (file, " %s, /* ParameterTests */\n", "PNONE"); + } + else + { + /* function has explicit parameters */ + bwb_strcpy (tbuf, " "); + for (i = 0; i < f->ParameterCount; i++) + { + ParamBitsType ParameterTypes; + ParameterTypes = f->ParameterTypes >> i; + ParameterTypes &= 0x1; + if (i > 0) + { + bwb_strcat (tbuf, " | "); + } + if (ParameterTypes) + { + sprintf (bwb_strchr (tbuf, NulChar), "P%dSTR", i + 1); + } + else + { + sprintf (bwb_strchr (tbuf, NulChar), "P%dNUM", i + 1); + } + } + bwb_strcat (tbuf, ", /* ParameterTypes */\n"); + fprintf (file, tbuf); + + + bwb_strcpy (tbuf, " "); + for (i = 0; i < f->ParameterCount; i++) + { + ParamTestType ParameterTests; + ParameterTests = f->ParameterTests >> (i * 4); + ParameterTests &= 0xF; + + if (i > 0) + { + bwb_strcat (tbuf, " | "); + } + sprintf (bwb_strchr (tbuf, 0), ParameterRangeID[ParameterTests], + i + 1); + /* Conversion may lose significant digits */ + } + bwb_strcat (tbuf, ", /* ParameterTests */\n"); + fprintf (file, tbuf); + } + bwb_strcpy (tbuf, " "); + j = 0; + for (i = 0; i < NUM_VERSIONS; i++) + { + if (f->OptionVersionBitmask & bwb_vertable[i].OptionVersionValue) + { + if (j > 0) + { + bwb_strcat (tbuf, " | "); + } + bwb_strcat (tbuf, bwb_vertable[i].ID); + j++; + } + } + bwb_strcat (tbuf, " /* OptionVersionBitmask */\n"); + fprintf (file, tbuf); + fprintf (file, "},\n"); + } + fprintf (file, "};\n"); + fprintf (file, "\n"); + fprintf (file, + "const size_t NUM_FUNCTIONS = sizeof( IntrinsicFunctionTable ) / sizeof( IntrinsicFunctionType );\n"); + fprintf (file, "\n"); + fflush (file); +} + +void +DumpOneFunctionSyntax (FILE * file, int IsXref, int n) +{ + IntrinsicFunctionType *f; + assert (file != NULL); + + + + if (n < 0 || n >= NUM_FUNCTIONS) + { + return; + } + f = &(IntrinsicFunctionTable[n]); + /* NAME */ + { + char UniqueID[MAINTAINER_BUFFER_LENGTH + 1]; /* DumpOneFunctionSyntax */ + char Syntax[MAINTAINER_BUFFER_LENGTH + 1]; /* DumpOneFunctionSyntax */ + + IntrinsicFunctionUniqueID (f, UniqueID); + IntrinsicFunctionSyntax (f, Syntax); + fprintf (file, " SYNTAX: %s\n", Syntax); + } + /* PARAMETERS */ + if (f->ParameterCount == PNONE || f->ParameterCount == 0xFF) + { + /* function has NO explicit parameters */ + } + else + { + /* function HAS explicit parameters */ + int i; + ParamBitsType ParameterTypes; + ParamTestType ParameterTests; + char NumVar; + char StrVar; + ParameterTypes = f->ParameterTypes; + ParameterTests = f->ParameterTests; + NumVar = 'X'; + StrVar = 'A'; + for (i = 0; i < f->ParameterCount; i++) + { + /* sanity check this parameter */ + unsigned long thischeck; + char tbuf[MAINTAINER_BUFFER_LENGTH + 1]; /* DumpOneFunctionSyntax */ + + thischeck = ParameterTests & 0x0000000F; + /* verify parameter check */ + if (ParameterTypes & 1) + { + /* STRING */ + sprintf (tbuf, StringVariableRange[thischeck], StrVar); + /* Conversion may lose significant digits */ + StrVar++; + } + else + { + /* NUMBER */ + sprintf (tbuf, NumberVariableRange[thischeck], NumVar); + /* Conversion may lose significant digits */ + NumVar++; + } + fprintf (file, tbuf); + fprintf (file, "\n"); + ParameterTypes = ParameterTypes >> 1; + ParameterTests = ParameterTests >> 4; + } + } + /* DESCRIPTION */ + { + FixDescription (file, "DESCRIPTION: ", f->Description); + } + /* COMPATIBILITY */ + if (IsXref) + { + int i; + fprintf (file, " VERSIONS:\n"); + for (i = 0; i < NUM_VERSIONS; i++) + { + char X; + if (f->OptionVersionBitmask & bwb_vertable[i].OptionVersionValue) + { + /* SUPPORTED */ + X = 'X'; + } + else + { + /* NOT SUPPORTED */ + X = '_'; + } + fprintf (file, " [%c] %s\n", X, bwb_vertable[i].Name); + } + } + + fflush (file); +} + +void +DumpAllFunctionSyntax (FILE * file, int IsXref, + OptionVersionType OptionVersionValue) +{ + /* for the C maintainer */ + int i; + + assert (file != NULL); + + + fprintf (file, + "============================================================\n"); + fprintf (file, + " FUNCTIONS \n"); + fprintf (file, + "============================================================\n"); + fprintf (file, "\n"); + fprintf (file, "\n"); + for (i = 0; i < NUM_FUNCTIONS; i++) + { + if (IntrinsicFunctionTable[i].OptionVersionBitmask & OptionVersionValue) + { + fprintf (file, + "------------------------------------------------------------\n"); + DumpOneFunctionSyntax (file, IsXref, i); + } + } + fprintf (file, + "------------------------------------------------------------\n"); + fprintf (file, "\n"); + fprintf (file, "\n"); + fflush (file); +} + +void +DumpAllFunctionHtmlTable (FILE * file) +{ + /* generate bwd_cmd.htm */ + int i; + int j; + + assert (file != NULL); + + + /* LEGEND */ + fprintf (file, "FNCS\n"); + fprintf (file, "

LEGEND


\n"); + fprintf (file, "\n"); + + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, "\n"); + + for (j = 0; j < NUM_VERSIONS; j++) + { + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, "\n"); + } + fprintf (file, "
"); + fprintf (file, ""); + fprintf (file, "ID"); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, "NAME"); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, "DESCRIPTION"); + fprintf (file, ""); + fprintf (file, "
"); + fprintf (file, bwb_vertable[j].ID); + fprintf (file, ""); + fprintf (file, bwb_vertable[j].Name); + fprintf (file, ""); + fprintf (file, bwb_vertable[j].Description); + fprintf (file, "
\n"); + fprintf (file, "
\n"); + + + /* DETAILS */ + fprintf (file, "

DETAILS


\n"); + fprintf (file, "\n"); + + fprintf (file, ""); + fprintf (file, ""); + for (j = 0; j < NUM_VERSIONS; j++) + { + fprintf (file, ""); + } + fprintf (file, "\n"); + + + /* run through the command table and print comand -vs- OPTION VERSION */ + + for (i = 0; i < NUM_FUNCTIONS; i++) + { + fprintf (file, ""); + fprintf (file, ""); + + for (j = 0; j < NUM_VERSIONS; j++) + { + fprintf (file, ""); + } + fprintf (file, "\n"); + } + fprintf (file, "
"); + fprintf (file, ""); + fprintf (file, "FUNCTION"); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, ""); + fprintf (file, bwb_vertable[j].ID); + fprintf (file, ""); + fprintf (file, "
"); + fprintf (file, (char *) IntrinsicFunctionTable[i].Syntax); + fprintf (file, ""); + if (IntrinsicFunctionTable[i].OptionVersionBitmask & bwb_vertable[j]. + OptionVersionValue) + { + fprintf (file, "X"); + } + else + { + fprintf (file, " "); + } + fprintf (file, "
\n"); + fprintf (file, "\n"); + fprintf (file, "\n"); + + fflush (file); +} + +/* +-------------------------------------------------------------------------------------------- + FNCS +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_FNCS (LineType * l) +{ + int n; + int t; + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + + My->CurrentFile = My->SYSOUT; + fprintf (My->SYSOUT->cfp, "BWBASIC FUNCTIONS AVAILABLE:\n"); + + /* run through the command table and print comand names */ + + t = 0; + for (n = 0; n < NUM_FUNCTIONS; n++) + { + fprintf (My->SYSOUT->cfp, IntrinsicFunctionTable[n].Name); + if (t < 4) + { + fprintf (My->SYSOUT->cfp, "\t"); + t++; + } + else + { + fprintf (My->SYSOUT->cfp, "\n"); + t = 0; + } + } + if (t > 0) + { + fprintf (My->SYSOUT->cfp, "\n"); + } + ResetConsoleColumn (); + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + MAINTAINER +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_MAINTAINER (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_MAINTAINER_CMDS (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_MAINTAINER_CMDS_HTML (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllCommandHtmlTable (My->SYSPRN->cfp); + return (l); +} + +LineType * +bwb_MAINTAINER_CMDS_ID (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllCommandUniqueID (My->SYSPRN->cfp); + return (l); +} + +LineType * +bwb_MAINTAINER_CMDS_MANUAL (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllCommandSyntax (My->SYSPRN->cfp, TRUE, (OptionVersionType)(-1)); + return (l); +} + +LineType * +bwb_MAINTAINER_CMDS_SWITCH (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllCommandSwitchStatement (My->SYSPRN->cfp); + return (l); +} + +LineType * +bwb_MAINTAINER_CMDS_TABLE (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllCommandTableDefinitions (My->SYSPRN->cfp); + return (l); +} + +LineType * +bwb_MAINTAINER_DEBUG (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_MAINTAINER_DEBUG_ON (LineType * l) +{ + + assert (l != NULL); + return (l); +} + +LineType * +bwb_MAINTAINER_DEBUG_OFF (LineType * l) +{ + + assert (l != NULL); + return (l); +} + +LineType * +bwb_MAINTAINER_FNCS (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_MAINTAINER_FNCS_HTML (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllFunctionHtmlTable (My->SYSPRN->cfp); + return (l); +} + +LineType * +bwb_MAINTAINER_FNCS_ID (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllFunctionUniqueID (My->SYSPRN->cfp); + return (l); +} + +LineType * +bwb_MAINTAINER_FNCS_MANUAL (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllFunctionSyntax (My->SYSPRN->cfp, TRUE, (OptionVersionType)(-1)); + DumpAllOperatorSyntax (My->SYSPRN->cfp, TRUE, (OptionVersionType)(-1)); + return (l); +} + +LineType * +bwb_MAINTAINER_FNCS_SWITCH (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllFunctionSwitch (My->SYSPRN->cfp); + return (l); +} + +LineType * +bwb_MAINTAINER_FNCS_TABLE (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + DumpAllFuctionTableDefinitions (My->SYSPRN->cfp); + return (l); +} + +void +DumpHeader (FILE * file) +{ + char c; + + assert (file != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + fprintf (file, + "============================================================\n"); + fprintf (file, + " GENERAL \n"); + fprintf (file, + "============================================================\n"); + fprintf (file, "\n"); + fprintf (file, "\n"); + + fprintf (file, "OPTION VERSION \"%s\"\n", My->CurrentVersion->Name); + fprintf (file, "REM INTERNAL ID: %s\n", My->CurrentVersion->ID); + fprintf (file, "REM DESCRIPTION: %s\n", My->CurrentVersion->Description); + fprintf (file, "REM REFERENCE: %s\n", My->CurrentVersion->ReferenceTitle); + fprintf (file, "REM %s\n", + My->CurrentVersion->ReferenceAuthor); + fprintf (file, "REM %s\n", + My->CurrentVersion->ReferenceCopyright); + fprintf (file, "REM %s\n", My->CurrentVersion->ReferenceURL1); + fprintf (file, "REM %s\n", My->CurrentVersion->ReferenceURL2); + fprintf (file, "REM\n"); + + if (My->CurrentVersion->OptionFlags & (OPTION_STRICT_ON)) + { + fprintf (file, "OPTION STRICT ON\n"); + } + else + { + fprintf (file, "OPTION STRICT OFF\n"); + } + + if (My->CurrentVersion->OptionFlags & (OPTION_ANGLE_DEGREES)) + { + fprintf (file, "OPTION ANGLE DEGREES\n"); + } + else if (My->CurrentVersion->OptionFlags & (OPTION_ANGLE_GRADIANS)) + { + fprintf (file, "OPTION ANGLE GRADIANS\n"); + } + else + { + fprintf (file, "OPTION ANGLE RADIANS\n"); + } + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_ON)) + { + fprintf (file, "OPTION BUGS ON\n"); + } + else + { + fprintf (file, "OPTION BUGS OFF\n"); + } + + if (My->CurrentVersion->OptionFlags & (OPTION_LABELS_ON)) + { + fprintf (file, "OPTION LABELS ON\n"); + } + else + { + fprintf (file, "OPTION LABELS OFF\n"); + } + + if (My->CurrentVersion->OptionFlags & (OPTION_COMPARE_TEXT)) + { + fprintf (file, "OPTION COMPARE TEXT\n"); + } + else + { + fprintf (file, "OPTION COMPARE BINARY\n"); + } + + if (My->CurrentVersion->OptionFlags & (OPTION_COVERAGE_ON)) + { + fprintf (file, "OPTION COVERAGE ON\n"); + } + else + { + fprintf (file, "OPTION COVERAGE OFF\n"); + } + + if (My->CurrentVersion->OptionFlags & (OPTION_TRACE_ON)) + { + fprintf (file, "OPTION TRACE ON\n"); + } + else + { + fprintf (file, "OPTION TRACE OFF\n"); + } + + if (My->CurrentVersion->OptionFlags & (OPTION_ERROR_GOSUB)) + { + fprintf (file, "OPTION ERROR GOSUB\n"); + } + else + { + fprintf (file, "OPTION ERROR GOTO\n"); + } + + if (My->CurrentVersion->OptionFlags & (OPTION_EXPLICIT_ON)) + { + fprintf (file, "OPTION EXPLICIT\n"); + } + else + { + fprintf (file, "OPTION IMPLICIT\n"); + } + + fprintf (file, "OPTION BASE %d\n", + My->CurrentVersion->OptionBaseInteger); + fprintf (file, "OPTION RECLEN %d\n", + My->CurrentVersion->OptionReclenInteger); + fprintf (file, "OPTION DATE \"%s\"\n", + My->CurrentVersion->OptionDateFormat); + fprintf (file, "OPTION TIME \"%s\"\n", + My->CurrentVersion->OptionTimeFormat); + + c = My->CurrentVersion->OptionStringChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT STRING \"%c\"\n", c); + + c = My->CurrentVersion->OptionDoubleChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT DOUBLE \"%c\"\n", c); + + c = My->CurrentVersion->OptionSingleChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT SINGLE \"%c\"\n", c); + + c = My->CurrentVersion->OptionCurrencyChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT CURRENCY \"%c\"\n", c); + + c = My->CurrentVersion->OptionLongChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT LONG \"%c\"\n", c); + + c = My->CurrentVersion->OptionIntegerChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT INTEGER \"%c\"\n", c); + + c = My->CurrentVersion->OptionByteChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT BYTE \"%c\"\n", c); + + c = My->CurrentVersion->OptionQuoteChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT QUOTE \"%c\"\n", c); + + c = My->CurrentVersion->OptionCommentChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT COMMENT \"%c\"\n", c); + + c = My->CurrentVersion->OptionStatementChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT STATEMENT \"%c\"\n", c); + + c = My->CurrentVersion->OptionPrintChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT PRINT \"%c\"\n", c); + + c = My->CurrentVersion->OptionInputChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT INPUT \"%c\"\n", c); + + c = My->CurrentVersion->OptionImageChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT IMAGE \"%c\"\n", c); + + c = My->CurrentVersion->OptionLparenChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT LPAREN \"%c\"\n", c); + + c = My->CurrentVersion->OptionRparenChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT RPAREN \"%c\"\n", c); + + c = My->CurrentVersion->OptionFilenumChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT FILENUM \"%c\"\n", c); + + c = My->CurrentVersion->OptionAtChar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION PUNCT AT \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingDigit; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING DIGIT \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingComma; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING COMMA \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingPeriod; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING PERIOD \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingPlus; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING PLUS \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingMinus; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING MINUS \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingExrad; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING EXRAD \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingDollar; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING DOLLAR \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingFiller; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING FILLER \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingLiteral; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING LITERAL \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingFirst; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING FIRST \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingAll; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING ALL \"%c\"\n", c); + + c = My->CurrentVersion->OptionUsingLength; + if (!bwb_isgraph (c)) + { + c = ' '; + }; + fprintf (file, "OPTION USING LENGTH \"%c\"\n", c); + + fprintf (file, "\n"); + fprintf (file, "\n"); + fflush (file); +} + +LineType * +bwb_MAINTAINER_MANUAL (LineType * l) +{ + + assert (l != NULL); + + DumpHeader (My->SYSPRN->cfp); + DumpAllCommandSyntax (My->SYSPRN->cfp, FALSE, + My->CurrentVersion->OptionVersionValue); + DumpAllFunctionSyntax (My->SYSPRN->cfp, FALSE, + My->CurrentVersion->OptionVersionValue); + DumpAllOperatorSyntax (My->SYSPRN->cfp, FALSE, + My->CurrentVersion->OptionVersionValue); + return (l); +} + +LineType * +bwb_MAINTAINER_STACK (LineType * l) +{ + /* + dump the current execution stack, + Leftmost is the top, + Rigthmost is the bottom. + */ + StackType *StackItem; + + assert (l != NULL); + + for (StackItem = My->StackHead; StackItem != NULL; + StackItem = StackItem->next) + { + LineType *l; + + l = StackItem->line; + if (l != NULL) + { + fprintf (My->SYSOUT->cfp, "%d:", l->number); + } + } + fprintf (My->SYSOUT->cfp, "\n"); + ResetConsoleColumn (); + return (l); +} + + +/*************************************************************** + + FUNCTION: IntrinsicFunction_init() + + DESCRIPTION: This command initializes the function + linked list, placing all predefined functions + in the list. + +***************************************************************/ + +int +IntrinsicFunction_init (void) +{ + int n; + + + for (n = 0; n < NUM_FUNCTIONS; n++) + { + IntrinsicFunctionDefinitionCheck (&(IntrinsicFunctionTable[n])); + } + return TRUE; +} + + + +VariableType * +IntrinsicFunction_deffn (int argc, VariableType * argv, UserFunctionType * f) +{ + /* + The generic handler for user defined functions. + When called by exp_function(), f->id will be set to the line number of a specific DEF USR. + */ + VariableType *v; + VariableType *argn; + int i; + LineType *call_line; + StackType *save_elevel; + + assert (argc >= 0); + assert (argv != NULL); + assert (f != NULL); + assert(My != NULL); + + /* initialize the variable if necessary */ + + /* these errors should not occur */ + if (f == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (f->line == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (argv == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (f->ParameterCount == 0xFF) + { + /* VARIANT */ + } + else if (argc != f->ParameterCount) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (f->ParameterCount == 0xFF) + { + /* VARIANT */ + f->local_variable = argv; + } + else if (argc > 0) + { + v = f->local_variable; + argn = argv; + for (i = 0; i < argc; i++) + { + argn = argn->next; + if (v == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (argn == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (VAR_IS_STRING (v) != VAR_IS_STRING (argn)) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (is_empty_string (v->name) == FALSE) + { + int IsError; + IsError = 0; + switch (v->VariableTypeCode) + { + case ByteTypeCode: + IsError = NumberValueCheck (P1BYT, PARAM_NUMBER); + break; + case IntegerTypeCode: + IsError = NumberValueCheck (P1INT, PARAM_NUMBER); + break; + case LongTypeCode: + IsError = NumberValueCheck (P1LNG, PARAM_NUMBER); + break; + case CurrencyTypeCode: + IsError = NumberValueCheck (P1CUR, PARAM_NUMBER); + break; + case SingleTypeCode: + IsError = NumberValueCheck (P1FLT, PARAM_NUMBER); + break; + case DoubleTypeCode: + IsError = NumberValueCheck (P1DBL, PARAM_NUMBER); + break; + case StringTypeCode: + IsError = StringLengthCheck (P1ANY, PARAM_LENGTH); + break; + default: + WARN_TYPE_MISMATCH; + return NULL; + } + if (IsError != 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return argv; + } + } + v = v->next; + } + } + /* OK */ + call_line = f->line; /* line to call for function */ + call_line->position = f->startpos; + + if (call_line->cmdnum == C_DEF) + { + if (line_skip_EqualChar (call_line) == FALSE) + { + WARN_INTERNAL_ERROR; + return NULL; + } + } +/* PUSH STACK */ + + save_elevel = My->StackHead; + if (bwb_incexec ()) + { + /* OK */ + My->StackHead->line = call_line; + My->StackHead->ExecCode = EXEC_FUNCTION; + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return NULL; + } + + + /* create variable chain */ + if (f->ParameterCount == 0xFF) + { + /* VARIANT */ + } + else if (argc > 0) + { + VariableType *source = NULL; /* source variable */ + source = f->local_variable; + argn = argv; + for (i = 0; i < argc; i++) + { + argn = argn->next; + /* copy the name */ + bwb_strcpy (argn->name, source->name); + + if (VAR_IS_STRING (source)) + { + } + else + { + int IsError; + double Value; + VariantType variant; + CLEAR_VARIANT (&variant); + + if (var_get (argn, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return NULL; + } + if (variant.VariantTypeCode == StringTypeCode) + { + WARN_TYPE_MISMATCH; + return NULL; + } + Value = variant.Number; + IsError = 0; + switch (source->VariableTypeCode) + { + case ByteTypeCode: + IsError = NumberValueCheck (P1BYT, Value); + Value = bwb_rint (Value); + break; + case IntegerTypeCode: + IsError = NumberValueCheck (P1INT, Value); + Value = bwb_rint (Value); + break; + case LongTypeCode: + IsError = NumberValueCheck (P1LNG, Value); + Value = bwb_rint (Value); + break; + case CurrencyTypeCode: + IsError = NumberValueCheck (P1CUR, Value); + Value = bwb_rint (Value); + break; + case SingleTypeCode: + IsError = NumberValueCheck (P1FLT, Value); + break; + case DoubleTypeCode: + IsError = NumberValueCheck (P1DBL, Value); + break; + case StringTypeCode: + WARN_TYPE_MISMATCH; + return NULL; + /* break; */ + default: + WARN_TYPE_MISMATCH; + return NULL; + } + if (IsError != 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return argv; + } + variant.Number = Value; + if (var_set (argn, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return NULL; + } + } + source = source->next; + } + } + if (call_line->cmdnum == C_DEF) + { + VariantType x; + VariantType *X; + + X = &x; + CLEAR_VARIANT (X); + /* the function return variable is hidden */ + My->StackHead->local_variable = argv->next; + /* var_islocal() uses the LoopTopLine to find local variables */ + My->StackHead->LoopTopLine = call_line; /* FUNCTION, SUB */ + + /* evaluate the expression */ + if (line_read_expression (call_line, X) == FALSE) /* IntrinsicFunction_deffn */ + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + + /* save the value */ + switch (X->VariantTypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + if (argv->VariableTypeCode == StringTypeCode) + { + WARN_TYPE_MISMATCH; + goto EXIT; + } + /* OK */ + { + int IsError; + double Value; + + IsError = 0; + Value = X->Number; + /* VerifyNumeric */ + if (isnan (Value)) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; + } + if (isinf (Value)) + { + /* - Evaluation of an expression results in an overflow + * (nonfatal, the recommended recovery procedure is to supply + * machine in- finity with the algebraically correct sign and + * continue). */ + if (Value < 0) + { + Value = MINDBL; + } + else + { + Value = MAXDBL; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + goto EXIT; + } + /* CONTINUE */ + } + /* OK */ + switch (argv->VariableTypeCode) + { + case ByteTypeCode: + IsError = NumberValueCheck (P1BYT, Value); + Value = bwb_rint (Value); + break; + case IntegerTypeCode: + IsError = NumberValueCheck (P1INT, Value); + Value = bwb_rint (Value); + break; + case LongTypeCode: + IsError = NumberValueCheck (P1LNG, Value); + Value = bwb_rint (Value); + break; + case CurrencyTypeCode: + IsError = NumberValueCheck (P1CUR, Value); + Value = bwb_rint (Value); + break; + case SingleTypeCode: + IsError = NumberValueCheck (P1FLT, Value); + break; + case DoubleTypeCode: + IsError = NumberValueCheck (P1DBL, Value); + break; + default: + WARN_TYPE_MISMATCH; + goto EXIT; + /* break; */ + } + if (IsError != 0) + { + if (WARN_OVERFLOW) + { + /* ERROR */ + goto EXIT; + } + /* CONTINUE */ + } + /* assign Value */ + RESULT_NUMBER = Value; + } + break; + case StringTypeCode: + if (argv->VariableTypeCode != StringTypeCode) + { + WARN_TYPE_MISMATCH; + goto EXIT; + } + /* OK */ + if (RESULT_BUFFER != My->MaxLenBuffer) + { + WARN_INTERNAL_ERROR; + goto EXIT; + } + if (X->Length > MAXLEN) + { + WARN_STRING_TOO_LONG; /* IntrinsicFunction_deffn */ + X->Length = MAXLEN; + } + bwb_memcpy (RESULT_BUFFER, X->Buffer, X->Length); + RESULT_LENGTH = X->Length; + break; + default: + WARN_TYPE_MISMATCH; + goto EXIT; + /* break; */ + } + EXIT: + RELEASE_VARIANT (X); + + + /* break variable chain */ + My->StackHead->local_variable = NULL; + + + +/* POP STACK */ + bwb_decexec (); + + } + else + { + /* the function return variable is visible */ + My->StackHead->local_variable = argv; + /* var_islocal() uses the LoopTopLine to find local variables */ + My->StackHead->LoopTopLine = call_line; /* FUNCTION, SUB */ + /* execute until function returns */ + while (My->StackHead != save_elevel) + { + bwb_execline (); + } + } + + if (f->ParameterCount == 0xFF) + { + /* VARIANT */ + f->local_variable = NULL; + } + + if (is_empty_string (argv->name) == FALSE) + { + int IsError; + + IsError = 0; + switch (argv->VariableTypeCode) + { + case ByteTypeCode: + IsError = NumberValueCheck (P1BYT, RESULT_NUMBER); + break; + case IntegerTypeCode: + IsError = NumberValueCheck (P1INT, RESULT_NUMBER); + break; + case LongTypeCode: + IsError = NumberValueCheck (P1LNG, RESULT_NUMBER); + break; + case CurrencyTypeCode: + IsError = NumberValueCheck (P1CUR, RESULT_NUMBER); + break; + case SingleTypeCode: + IsError = NumberValueCheck (P1FLT, RESULT_NUMBER); + break; + case DoubleTypeCode: + IsError = NumberValueCheck (P1DBL, RESULT_NUMBER); + break; + case StringTypeCode: + IsError = StringLengthCheck (P1ANY, RESULT_LENGTH); + break; + default: + /* no check */ + break; + } + if (IsError != 0) + { + if (WARN_OVERFLOW) + { + /* ERROR */ + } + /* CONTINUE */ + } + } + return argv; +} + +/*************************************************************** + + FUNCTION: IntrinsicFunction_find() + + DESCRIPTION: This C function attempts to locate + a BASIC function with the specified name. + If successful, it returns a pointer to + the C structure for the BASIC function, + if not successful, it returns NULL. + +***************************************************************/ + +extern int +IntrinsicFunction_name (char *name) +{ + /* search INTRINSIC functions */ + IntrinsicFunctionType *f; + int i; + + assert (name != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + +#if THE_PRICE_IS_RIGHT + /* start with the closest function, without going over */ + i = VarTypeIndex (name[0]); + if (i < 0) + { + /* non-alpha */ + return FALSE; + } + i = My->IntrinsicFunctionStart[i]; /* first function starting with this letter */ + if (i < 0) + { + /* NOT FOUND */ + return FALSE; + } +#else /* THE_PRICE_IS_RIGHT */ + i = 0; +#endif /* THE_PRICE_IS_RIGHT */ + for (; i < NUM_FUNCTIONS; i++) + { + f = &IntrinsicFunctionTable[i]; + if (My->CurrentVersion->OptionVersionValue & f->OptionVersionBitmask) + { + int result; + + result = bwb_stricmp (f->Name, name); + + if (result == 0) + { + /* FOUND */ + return TRUE; + } + if (result > 0 /* found > searched */ ) + { + /* NOT FOUND */ + return FALSE; + } + } + } + /* NOT FOUND */ + return FALSE; +} + + +IntrinsicFunctionType * +IntrinsicFunction_find_exact (char *name, int ParameterCount, + ParamBitsType ParameterTypes) +{ + IntrinsicFunctionType *f; + int i; + + assert (name != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + /* search INTRINSIC functions */ +#if THE_PRICE_IS_RIGHT + /* start with the closest function, without going over */ + i = VarTypeIndex (name[0]); + if (i < 0) + { + /* non-alpha */ + return NULL; + } + i = My->IntrinsicFunctionStart[i]; /* first function starting with this letter */ + if (i < 0) + { + /* NOT FOUND */ + return NULL; + } +#else /* THE_PRICE_IS_RIGHT */ + i = 0; +#endif /* THE_PRICE_IS_RIGHT */ + for (; i < NUM_FUNCTIONS; i++) + { + f = &IntrinsicFunctionTable[i]; + if (My->CurrentVersion->OptionVersionValue & f->OptionVersionBitmask) + { + if (f->ParameterCount == ParameterCount) + { + if (f->ParameterTypes == ParameterTypes) + { + int result; + + result = bwb_stricmp (f->Name, name); + + if (result == 0) + { + /* FOUND */ + return f; + } + if (result > 0 /* found > searched */ ) + { + /* NOT FOUND */ + return NULL; + } + } + } + } + } + /* NOT FOUND */ + return NULL; +} + +static VariableType * +find_variable_by_type (char *name, int dimensions, char VariableTypeCode) +{ + VariableType *v = NULL; + + assert (name != NULL); + + v = var_find (name, dimensions, FALSE); + if (v) + { + if (VAR_IS_STRING (v)) + { + if (VariableTypeCode == StringTypeCode) + { + /* found */ + return v; + } + } + else + { + if (VariableTypeCode != StringTypeCode) + { + /* found */ + return v; + } + } + } + /* not found */ + return NULL; +} + +/* +-------------------------------------------------------------------------------------------- + CHANGE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_CHANGE (LineType * l) +{ + /* SYNTAX: CHANGE A$ TO X */ + /* SYNTAX: CHANGE X TO A$ */ + char varname[NameLengthMax + 1]; + VariableType *v; + VariableType *A; + VariableType *X; + int IsStringToArray; + + assert (l != NULL); + + v = NULL; + A = NULL; + X = NULL; + IsStringToArray = FALSE; + + /* get 1st variable */ + if (line_read_varname (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + v = find_variable_by_type (varname, 0, StringTypeCode); + if (v) + { + /* STRING to ARRAY */ + A = v; + IsStringToArray = TRUE; + } + else + { + /* ARRAY to STRING */ + v = find_variable_by_type (varname, 1, DoubleTypeCode); + if (v) + { + X = v; + IsStringToArray = FALSE; + } + } + if (v == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + /* get "TO" */ + if (line_skip_word (l, "TO") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* get 2nd variable */ + if (line_read_varname (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (IsStringToArray) + { + /* STRING to ARRAY */ + v = find_variable_by_type (varname, 1, DoubleTypeCode); + if (v == NULL) + { + v = var_find (varname, 1, TRUE); + } + if (v) + { + X = v; + } + } + else + { + /* ARRAY to STRING */ + v = find_variable_by_type (varname, 0, StringTypeCode); + if (v == NULL) + { + v = var_find (varname, 0, TRUE); + } + if (v) + { + A = v; + } + } + + if (v == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + assert(A != NULL); + assert(X != NULL); + if (IsStringToArray) + { + /* CHANGE A$ TO X */ + int i; + int n; + char *a; + DoubleType *x; + unsigned long t; + + if (A->Value.String == NULL) + { + WARN_INTERNAL_ERROR; + return (l); + } + if (A->Value.String->sbuffer == NULL) + { + WARN_INTERNAL_ERROR; + return (l); + } + /* variable storage is a mess, we bypass that tradition here. */ + t = 1; + for (n = 0; n < X->dimensions; n++) + { + t *= X->UBOUND[n] - X->LBOUND[n] + 1; + } + if (t <= A->Value.String->length) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + n = A->Value.String->length; + a = A->Value.String->sbuffer; + x = X->Value.Number; + *x = n; + x++; + for (i = 0; i < n; i++) + { + char C; + DoubleType V; + + C = *a; + V = C; + *x = V; + x++; + a++; + } + } + else + { + /* CHANGE X TO A$ */ + int i; + int n; + char *a; + DoubleType *x; + unsigned long t; + + /* variable storage is a mess, we bypass that tradition here. */ + t = 1; + for (n = 0; n < X->dimensions; n++) + { + t *= X->UBOUND[n] - X->LBOUND[n] + 1; + } + if (t <= 1) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (t > MAXLEN) + { + WARN_STRING_TOO_LONG; /* bwb_CHANGE */ + t = MAXLEN; + } + if (A->Value.String == NULL) + { + if ((A->Value.String = + (StringType *) calloc (1, sizeof (StringType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + A->Value.String->sbuffer = NULL; + A->Value.String->length = 0; + } + if (A->Value.String->sbuffer != NULL) + { + free (A->Value.String->sbuffer); + A->Value.String->sbuffer = NULL; + A->Value.String->length = 0; + } + if (A->Value.String->sbuffer == NULL) + { + A->Value.String->length = 0; + if ((A->Value.String->sbuffer = + (char *) calloc (t + 1 /* NulChar */ , sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + } + a = A->Value.String->sbuffer; + x = X->Value.Number; + n = (int) bwb_rint (*x); + if (n > MAXLEN) + { + WARN_STRING_TOO_LONG; /* bwb_CHANGE */ + n = MAXLEN; + } + A->Value.String->length = n; + x++; + for (i = 0; i < n; i++) + { + char C; + DoubleType V; + + V = *x; + C = V; + *a = C; + x++; + a++; + } + } + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + CONSOLE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_CONSOLE (LineType * l) +{ + /* SYNTAX: CONSOLE */ + /* SYNTAX: CONSOLE WIDTH width */ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + + + if (My->IsPrinter == TRUE) + { + /* reset printer column */ + if (My->SYSPRN->col != 1) + { + fputc ('\n', My->SYSPRN->cfp); + My->SYSPRN->col = 1; + } + My->IsPrinter = FALSE; + } + if (line_skip_word (l, "WIDTH")) + { + int width; + + width = 0; + if (line_read_integer_expression (l, &width) == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (width < 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + My->SYSOUT->width = width; + } + + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + LPRINTER +-------------------------------------------------------------------------------------------- +*/ + + +LineType * +bwb_LPRINTER (LineType * l) +{ + /* SYNTAX: LPRINTER */ + /* SYNTAX: LPRINTER WIDTH width */ + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + + + if (My->IsPrinter == FALSE) + { + /* reset console column */ + if (My->SYSOUT->col != 1) + { + fputc ('\n', My->SYSOUT->cfp); + My->SYSOUT->col = 1; + } + My->IsPrinter = TRUE; + } + if (line_skip_word (l, "WIDTH")) + { + int width; + + width = 0; + if (line_read_integer_expression (l, &width) == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (width < 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + My->SYSPRN->width = width; + } + return (l); +} + +extern void +bwb_fclose (FILE * file) +{ + if (file == NULL) + { + /* don't close */ + } + else if (file == stdin) + { + /* don't close */ + } + else if (file == stdout) + { + /* don't close */ + } + else if (file == stderr) + { + /* don't close */ + } + else + { + fclose (file); + } +} +LineType * +bwb_LPT (LineType * l) +{ + /* SYNTAX: LPT */ + /* SYNTAX: LPT filename$ */ + FILE *file; + char *filename; + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + + + file = NULL; + filename = NULL; + if (line_is_eol (l)) + { + /* OK */ + file = stderr; + } + else if (line_read_string_expression (l, &filename)) + { + /* OK */ + if (is_empty_string (filename)) + { + WARN_BAD_FILE_NAME; + return (l); + } + file = fopen (filename, "w"); + free (filename); + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + if (file == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + bwb_fclose (My->SYSOUT->cfp); + My->SYSOUT->cfp = file; + return (l); +} + +LineType * +bwb_PTP (LineType * l) +{ + /* SYNTAX: PTP */ + /* SYNTAX: PTP filename$ */ + FILE *file; + char *filename; + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + + file = NULL; + filename = NULL; + if (line_is_eol (l)) + { + /* OK */ + file = fopen ("PTP", "w"); + } + else if (line_read_string_expression (l, &filename)) + { + /* OK */ + if (is_empty_string (filename)) + { + WARN_BAD_FILE_NAME; + return (l); + } + file = fopen (filename, "w"); + free (filename); + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + if (file == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + bwb_fclose (My->SYSOUT->cfp); + My->SYSOUT->cfp = file; + return (l); +} + +LineType * +bwb_PTR (LineType * l) +{ + /* SYNTAX: PTR */ + /* SYNTAX: PTR filename$ */ + FILE *file; + char *filename; + + assert (l != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + file = NULL; + filename = NULL; + if (line_is_eol (l)) + { + /* OK */ + file = fopen ("PTR", "r"); + } + else if (line_read_string_expression (l, &filename)) + { + /* OK */ + if (is_empty_string (filename)) + { + WARN_BAD_FILE_NAME; + return (l); + } + file = fopen (filename, "r"); + free (filename); + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + if (file == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + bwb_fclose (My->SYSIN->cfp); + My->SYSIN->cfp = file; + return (l); +} + +LineType * +bwb_TTY (LineType * l) +{ + /* SYNTAX: TTY */ + assert (l != NULL); + + bwb_TTY_IN (l); + bwb_TTY_OUT (l); + return (l); +} + +LineType * +bwb_TTY_IN (LineType * l) +{ + /* SYNTAX: TTY IN */ + assert (l != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + bwb_fclose (My->SYSIN->cfp); + My->SYSIN->cfp = stdin; + return (l); +} + +LineType * +bwb_TTY_OUT (LineType * l) +{ + /* SYNTAX: TTY OUT */ + assert (l != NULL); + assert(My != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + + bwb_fclose (My->SYSOUT->cfp); + My->SYSOUT->cfp = stdout; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + CREATE +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_CREATE (LineType * l) +{ + /* SYNTAX: CREATE filename$ [ RECL reclen ] AS filenum [ BUFF number ] [ RECS size ] */ + int FileNumber; + int width; + int buffnum; + int recsnum; + char *filename; + + assert (l != NULL); + assert(My != NULL); + + + FileNumber = 0; + width = 0; + buffnum = 0; + recsnum = 0; + filename = NULL; + if (line_read_string_expression (l, &filename) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (is_empty_string (filename)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (line_skip_word (l, "RECL")) + { + if (line_read_integer_expression (l, &width) == FALSE) + { + WARN_FIELD_OVERFLOW; + return (l); + } + if (width <= 0) + { + WARN_FIELD_OVERFLOW; + return (l); + } + } + if (line_skip_word (l, "AS") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (line_skip_word (l, "BUFF")) + { + if (line_read_integer_expression (l, &buffnum) == FALSE) + { + WARN_FIELD_OVERFLOW; + return (l); + } + if (buffnum <= 0) + { + WARN_FIELD_OVERFLOW; + return (l); + } + } + if (line_skip_word (l, "RECS")) + { + if (line_read_integer_expression (l, &recsnum) == FALSE) + { + WARN_FIELD_OVERFLOW; + return (l); + } + if (recsnum <= 0) + { + WARN_FIELD_OVERFLOW; + return (l); + } + } + /* now, we are ready to create the file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + My->CurrentFile = file_new (); + My->CurrentFile->FileNumber = FileNumber; + } + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = filename; + filename = NULL; + if (My->CurrentFile->DevMode != DEVMODE_CLOSED) + { + My->CurrentFile->DevMode = DEVMODE_CLOSED; + } + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = NULL; + } + if (My->CurrentFile->buffer != NULL) + { + free (My->CurrentFile->buffer); + My->CurrentFile->buffer = NULL; + } + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + /* truncate to zero length or create text file for update (reading and writing) */ + if (is_empty_string (My->CurrentFile->FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if ((My->CurrentFile->cfp = + fopen (My->CurrentFile->FileName, "w+")) == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (width > 0) + { + My->CurrentFile->width = width; + My->CurrentFile->DevMode = DEVMODE_RANDOM; + } + else + { + My->CurrentFile->DevMode = DEVMODE_INPUT | DEVMODE_OUTPUT; + } + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + COPY +-------------------------------------------------------------------------------------------- +*/ + +static void +bwb_copy_file (char *Source, char *Target) +{ + FILE *source; + FILE *target; + + source = NULL; + target = NULL; + + if (is_empty_string (Source)) + { + WARN_BAD_FILE_NAME; + goto EXIT; + } + if (is_empty_string (Target)) + { + WARN_BAD_FILE_NAME; + goto EXIT; + } + source = fopen (Source, "rb"); + if (source == NULL) + { + WARN_BAD_FILE_NAME; + goto EXIT; + } + target = fopen (Target, "wb"); + if (target == NULL) + { + WARN_BAD_FILE_NAME; + goto EXIT; + } + /* OK */ + while (TRUE) + { + int C; + + C = fgetc (source); + if (C < 0 /* EOF */ || feof (source) || ferror (source)) + { + break; + } + fputc (C, target); + if (ferror (target)) + { + break; + } + } + /* DONE */ +EXIT: + if (source) + { + fclose (source); + } + if (target) + { + fclose (target); + } +} + +LineType * +bwb_COPY (LineType * Line) +{ + /* SYNTAX: COPY source$ TO target$ */ + char *Source; + char *Target; + + assert (Line != NULL); + + Source = NULL; + Target = NULL; + if (line_read_string_expression (Line, &Source) == FALSE) + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + if (line_skip_word (Line, "TO") == FALSE) + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + if (line_read_string_expression (Line, &Target) == FALSE) + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + bwb_copy_file (Source, Target); +EXIT: + if (Source) + { + free (Source); + } + if (Target) + { + free (Target); + } + return (Line); +} + +/* +-------------------------------------------------------------------------------------------- + DISPLAY +-------------------------------------------------------------------------------------------- +*/ + +static void +bwb_display_file (char *Source) +{ + FILE *source; + + assert (My->SYSOUT != NULL); + assert (My->SYSOUT->cfp != NULL); + + source = NULL; + + if (is_empty_string (Source)) + { + WARN_BAD_FILE_NAME; + goto EXIT; + } + source = fopen (Source, "rb"); + if (source == NULL) + { + WARN_BAD_FILE_NAME; + goto EXIT; + } + /* OK */ + while (TRUE) + { + int C; + + C = fgetc (source); + if (C < 0 /* EOF */ || feof (source) || ferror (source)) + { + break; + } + fputc (C, My->SYSOUT->cfp); + } + /* DONE */ +EXIT: + if (source) + { + fclose (source); + } +} + +LineType * +bwb_DISPLAY (LineType * Line) +{ + /* SYNTAX: DISPLAY source$ */ + char *Source; + + assert (Line != NULL); + Source = NULL; + if (line_read_string_expression (Line, &Source) == FALSE) + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + bwb_display_file (Source); +EXIT: + if (Source) + { + free (Source); + } + return (Line); +} + +/* +-------------------------------------------------------------------------------------------- + EOF +-------------------------------------------------------------------------------------------- +*/ + + + +/* EOF */ diff --git a/bwb_cnd.c b/bwb_cnd.c new file mode 100644 index 0000000..f4b8c9c --- /dev/null +++ b/bwb_cnd.c @@ -0,0 +1,1937 @@ +/*************************************************************** + + bwb_cnd.c Conditional Expressions and Commands + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + +static LineType *bwb_then_else (LineType * l, int Value); +static LineType *bwb_if_file (LineType * l, int ThenValue); +static int FindTopLineOnStack (LineType * l); +static int for_limit_check (DoubleType Value, DoubleType Target, + DoubleType Step); +static int IsTypeMismatch (char LeftTypeCode, char RightTypeCode); + + +/* +-------------------------------------------------------------------------------------------- + EXIT +-------------------------------------------------------------------------------------------- +*/ + +LineType * +bwb_EXIT (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + SELECT +-------------------------------------------------------------------------------------------- +*/ +LineType * +bwb_SELECT (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + + +/* +-------------------------------------------------------------------------------------------- + FUNCTION - END FUNCTION +-------------------------------------------------------------------------------------------- +*/ + +/*************************************************************** + + FUNCTION: bwb_FUNCTION() + + DESCRIPTION: This function implements the BASIC + FUNCTION command, introducing a named + function. + + SYNTAX: FUNCTION subroutine-name + ... + [ EXIT FUNCTION ] + ... + END FUNCTION + +***************************************************************/ + +LineType * +bwb_FUNCTION (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* check current exec level */ + assert(My != NULL); + assert(My->StackHead != NULL); + if (My->StackHead->next == NULL) + { + /* skip over the entire function definition */ + l = l->OtherLine; /* line of END SUB */ + l = l->next; /* line after END SUB */ + l->position = 0; + return l; + } + + /* we are being executed via IntrinsicFunction_deffn() */ + + /* if this is the first time at this SUB statement, note it */ + if (My->StackHead->LoopTopLine != l) + { + if (bwb_incexec ()) + { + /* OK */ + My->StackHead->LoopTopLine = l; + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return My->EndMarker; + } + } + line_skip_eol (l); + return (l); +} + + +LineType * +bwb_EXIT_FUNCTION (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* check integrity of SUB commmand */ + if (FindTopLineOnStack (l->OtherLine)) + { + /* FOUND */ + LineType *r; + bwb_decexec (); + r = l->OtherLine; /* line of FUNCTION */ + r = r->OtherLine; /* line of END FUNCTION */ + r = r->next; /* line after END FUNCTION */ + r->position = 0; + return r; + } + /* NOT FOUND */ + WARN_EXIT_FUNCTION_WITHOUT_FUNCTION; + return (l); +} + +LineType * +bwb_END_FUNCTION (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* check integrity of SUB commmand */ + if (FindTopLineOnStack (l->OtherLine) == FALSE) + { + /* NOT FOUND */ + WARN_END_FUNCTION_WITHOUT_FUNCTION; + return (l); + } + /* decrement the stack */ + bwb_decexec (); + + /* and return next from old line */ + assert(My != NULL); + assert(My->StackHead != NULL); + My->StackHead->line->next->position = 0; + return My->StackHead->line->next; +} + +LineType * +bwb_FNEND (LineType * l) +{ + + assert (l != NULL); + return bwb_END_FUNCTION (l); +} + +LineType * +bwb_FEND (LineType * l) +{ + + assert (l != NULL); + return bwb_END_FUNCTION (l); +} + + +/* +-------------------------------------------------------------------------------------------- + SUB - END SUB +-------------------------------------------------------------------------------------------- +*/ + +/*************************************************************** + + FUNCTION: bwb_sub() + + DESCRIPTION: This function implements the BASIC + SUB command, introducing a named + subroutine. + + SYNTAX: SUB subroutine-name + ... + [ EXIT SUB ] + ... + END SUB + +***************************************************************/ + +LineType * +bwb_SUB (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* check current exec level */ + assert(My != NULL); + assert(My->StackHead != NULL); + if (My->StackHead->next == NULL) + { + /* skip over the entire function definition */ + l = l->OtherLine; /* line of END SUB */ + l = l->next; /* line after END SUB */ + l->position = 0; + return l; + } + /* we are being executed via IntrinsicFunction_deffn() */ + + /* if this is the first time at this SUB statement, note it */ + if (My->StackHead->LoopTopLine != l) + { + if (bwb_incexec ()) + { + /* OK */ + My->StackHead->LoopTopLine = l; + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return My->EndMarker; + } + } + line_skip_eol (l); + return (l); +} + +LineType * +bwb_EXIT_SUB (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* check integrity of SUB commmand */ + if (FindTopLineOnStack (l->OtherLine)) + { + /* FOUND */ + LineType *r; + bwb_decexec (); + r = l->OtherLine; /* line of FUNCTION */ + r = r->OtherLine; /* line of END FUNCTION */ + r = r->next; /* line after END FUNCTION */ + r->position = 0; + return r; + } + /* NOT FOUND */ + WARN_EXIT_SUB_WITHOUT_SUB; + return (l); +} + +LineType * +bwb_SUBEXIT (LineType * l) +{ + + assert (l != NULL); + return bwb_EXIT_SUB (l); +} + +LineType * +bwb_SUB_EXIT (LineType * l) +{ + + assert (l != NULL); + return bwb_EXIT_SUB (l); +} + +LineType * +bwb_END_SUB (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* check integrity of SUB commmand */ + if (FindTopLineOnStack (l->OtherLine) == FALSE) + { + /* NOT FOUND */ + WARN_END_SUB_WITHOUT_SUB; + return (l); + } + /* decrement the stack */ + bwb_decexec (); + + /* and return next from old line */ + assert(My != NULL); + assert(My->StackHead != NULL); + My->StackHead->line->next->position = 0; + return My->StackHead->line->next; +} + +LineType * +bwb_SUBEND (LineType * l) +{ + + assert (l != NULL); + return bwb_END_SUB (l); +} + +LineType * +bwb_SUB_END (LineType * l) +{ + + assert (l != NULL); + return bwb_END_SUB (l); +} + + +/* +-------------------------------------------------------------------------------------------- + IF - END IF +-------------------------------------------------------------------------------------------- +*/ + + +/*************************************************************** + + FUNCTION: bwb_IF() + + DESCRIPTION: This function handles the BASIC IF + statement, standard flavor. + standard + SYNTAX: IF expression THEN line [ELSE line] + IF END # file THEN line [ELSE line] + IF MORE # file THEN line [ELSE line] + +***************************************************************/ +LineType * +bwb_IF (LineType * l) +{ + /* classic IF */ + /* IF expression THEN 100 */ + /* IF expression THEN 100 ELSE 200 */ + int Value; + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + return bwb_then_else (l, Value); +} + +LineType * +bwb_IF_END (LineType * l) +{ + /* IF END #1 THEN 100 */ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + assert(My != NULL); + assert(My->CurrentVersion != NULL); + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + /* sets a linenumber to branch to on EOF */ + int FileNumber = 0; + int LineNumber = 0; + + + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (line_skip_word (l, "THEN") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &LineNumber) == FALSE) + { + WARN_UNDEFINED_LINE; + return (l); + } + if (LineNumber < 0) + { + WARN_UNDEFINED_LINE; + return (l); + } + /* now, we are ready to create the file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + My->CurrentFile = file_new (); + My->CurrentFile->FileNumber = FileNumber; + } + My->CurrentFile->EOF_LineNumber = LineNumber; + return (l); + } + /* branch to the line if we are currently at EOF */ + return bwb_if_file (l, TRUE); +} + +LineType * +bwb_IF_MORE (LineType * l) +{ + /* IF MORE #1 THEN 100 */ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + /* branch to the line if we are not currently at EOF */ + return bwb_if_file (l, FALSE); +} + + + + + +/*************************************************************** + + FUNCTION: bwb_IF8THEN() + + DESCRIPTION: This function handles the BASIC IF + statement, structured flavor. + + SYNTAX: IF expression THEN + ... + ELSEIF expression + ... + ELSE + ... + END IF + +***************************************************************/ +LineType * +bwb_IF8THEN (LineType * l) +{ + /* structured IF */ + LineType *else_line; + int Value; + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* evaluate the expression */ + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value) + { + /* expression is TRUE */ + l->next->position = 0; + return l->next; + } + + /* + RESUME knows we iterate thru the various ELSEIF commands, and restarts at the IF THEN command. + RESUME NEXT knows we iterate thru the various ELSEIF commands, and restarts at the END IF command. + */ + + for (else_line = l->OtherLine; else_line->cmdnum == C_ELSEIF; + else_line = else_line->OtherLine) + { + else_line->position = else_line->Startpos; + + /* evaluate the expression */ + if (line_read_integer_expression (else_line, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value) + { + /* expression is TRUE */ + else_line->next->position = 0; + return else_line->next; + } + } + /* ELSE or END IF */ + else_line->next->position = 0; + return else_line->next; +} + +LineType * +bwb_ELSEIF (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + for (l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine); + l = l->next; /* line after END IF */ + l->position = 0; + return l; +} + +LineType * +bwb_ELSE (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + for (l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine); + l = l->next; /* line after END IF */ + l->position = 0; + return l; +} + +LineType * +bwb_END_IF (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + SELECT CASE - END SELECT +-------------------------------------------------------------------------------------------- +*/ + + +/*************************************************************** + + FUNCTION: bwb_select() + + DESCRIPTION: This C function handles the BASIC SELECT + statement. + + SYNTAX: SELECT CASE expression ' examples: + CASE value ' CASE 5 + CASE min TO max ' CASE 1 TO 10 + CASE IF relationaloperator value ' CASE IF > 5 + CASE IS relationaloperator value ' CASE IS > 5 + CASE ELSE + END SELECT + +***************************************************************/ + + + +LineType * +bwb_SELECT_CASE (LineType * l) +{ + VariantType selectvalue; + VariantType *e; + LineType *else_line; + + assert (l != NULL); + + e = &selectvalue; + CLEAR_VARIANT (e); + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* evaluate the expression */ + if (line_read_expression (l, e) == FALSE) /* bwb_SELECT_CASE */ + { + WARN_SYNTAX_ERROR; + return (l); + } + /* + ** + ** RESUME knows we iterate thru the various CASE commands, and restarts at the SELECT CASE command. + ** RESUME NEXT knows we iterate thru the various CASE commands, and restarts at the END SELECT command. + ** + */ + for (else_line = l->OtherLine; else_line->cmdnum == C_CASE; + else_line = else_line->OtherLine) + { + else_line->position = else_line->Startpos; + do + { + /* evaluate the expression */ + if (line_skip_word (else_line, "IF") + || line_skip_word (else_line, "IS")) + { + /* CASE IS < 10 */ + /* CASE IF < "DEF" */ + /* CASE IS > 7 */ + /* CASE IS > "ABC" */ + char *tbuf; + int tlen; + size_t n; /* number of characters we want to put in tbuf */ + int position; + VariantType casevalue; + VariantType *r; + + assert(My != NULL); + assert(My->ConsoleOutput != NULL); + assert(MAX_LINE_LENGTH > 1); + tbuf = My->ConsoleOutput; + tlen = MAX_LINE_LENGTH; + n = 0; + r = &casevalue; + CLEAR_VARIANT (r); + + /* + ** + ** Available choices: + ** 1. Parse every possible operator combination, depending upon the BASIC flavor. + ** 2. Jump into the middle of the expression parser, by exposing the parser internals. + ** 3. Limit the length of the expression. This is the choice I made. + ** + */ + + if (e->VariantTypeCode == StringTypeCode) + { + /* STRING */ + n += bwb_strlen (e->Buffer); + if (n > tlen) + { + WARN_STRING_FORMULA_TOO_COMPLEX; /* bwb_SELECT_CASE */ + return (l); + } + /* OK , everything will fit */ + bwb_strcpy (tbuf, e->Buffer); + } + else + { + /* NUMBER */ + FormatBasicNumber (e->Number, tbuf); + n += bwb_strlen (tbuf); + if (n > tlen) + { + WARN_STRING_FORMULA_TOO_COMPLEX; /* bwb_SELECT_CASE */ + return (l); + } + /* OK , everything will fit */ + } + { + char *Space; + + Space = " "; + n += bwb_strlen (Space); + if (n > tlen) + { + WARN_STRING_FORMULA_TOO_COMPLEX; /* bwb_SELECT_CASE */ + return (l); + } + /* OK , everything will fit */ + bwb_strcat (tbuf, Space); + } + { + n += bwb_strlen (&(else_line->buffer[else_line->position])); + + if (n > tlen) + { + WARN_STRING_FORMULA_TOO_COMPLEX; /* bwb_SELECT_CASE */ + return (l); + } + /* OK , everything will fit */ + bwb_strcat (tbuf, &(else_line->buffer[else_line->position])); + } + position = 0; + if (buff_read_expression (tbuf, &position, r) == FALSE) /* bwb_SELECT_CASE */ + { + WARN_SYNTAX_ERROR; + return (l); + } + if (r->VariantTypeCode == StringTypeCode) + { + RELEASE_VARIANT (r); + WARN_TYPE_MISMATCH; + return (l); + } + if (r->Number) + { + /* expression is TRUE */ + else_line->next->position = 0; + return else_line->next; + } + /* condition is FALSE */ + /* proceed to next CASE line if there is one */ + } + else + { + /* CASE 7 */ + /* CASE 7 TO 10 */ + /* CASE "ABC" */ + /* CASE "ABC" TO "DEF" */ + VariantType minvalue; + VariantType *minval; + + minval = &minvalue; + CLEAR_VARIANT (minval); + /* evaluate the MIN expression */ + if (line_read_expression (else_line, minval) == FALSE) /* bwb_SELECT_CASE */ + { + WARN_SYNTAX_ERROR; + return (l); + } + if (IsTypeMismatch (e->VariantTypeCode, minval->VariantTypeCode)) + { + RELEASE_VARIANT (minval); + WARN_TYPE_MISMATCH; + return (l); + } + if (line_skip_word (else_line, "TO")) + { + /* CASE 7 TO 10 */ + /* CASE "ABC" TO "DEF" */ + VariantType maxvalue; + VariantType *maxval; + + maxval = &maxvalue; + CLEAR_VARIANT (maxval); + + /* evaluate the MAX expression */ + if (line_read_expression (else_line, maxval) == FALSE) /* bwb_SELECT_CASE */ + { + WARN_SYNTAX_ERROR; + return (l); + } + if (IsTypeMismatch (e->VariantTypeCode, maxval->VariantTypeCode)) + { + RELEASE_VARIANT (maxval); + WARN_TYPE_MISMATCH; + return (l); + } + if (e->VariantTypeCode == StringTypeCode) + { + /* STRING */ + if (bwb_strcmp (e->Buffer, minval->Buffer) >= 0 + && bwb_strcmp (e->Buffer, maxval->Buffer) <= 0) + { + /* expression is TRUE */ + RELEASE_VARIANT (maxval); + else_line->next->position = 0; + return else_line->next; + } + RELEASE_VARIANT (maxval); + } + else + { + /* NUMBER */ + if (e->Number >= minval->Number && e->Number <= maxval->Number) + { + /* expression is TRUE */ + else_line->next->position = 0; + return else_line->next; + } + } + } + else + { + /* CASE 7 */ + /* CASE "ABC" */ + if (e->VariantTypeCode == StringTypeCode) + { + /* STRING */ + if (bwb_strcmp (e->Buffer, minval->Buffer) == 0) + { + /* expression is TRUE */ + RELEASE_VARIANT (minval); + else_line->next->position = 0; + return else_line->next; + } + RELEASE_VARIANT (minval); + } + else + { + /* NUMBER */ + if (e->Number == minval->Number) + { + /* expression is TRUE */ + else_line->next->position = 0; + return else_line->next; + } + } + } + /* condition is FALSE */ + /* proceed to next CASE line if there is one */ + } + } + while (line_skip_seperator (else_line)); + } + /* CASE_ELSE or END_SELECT */ + RELEASE_VARIANT (e); + else_line->next->position = 0; + return else_line->next; +} + +LineType * +bwb_CASE (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + for (l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine); + l = l->next; /* line after END SELECT */ + l->position = 0; + return l; +} + +LineType * +bwb_CASE_ELSE (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + for (l = l->OtherLine; l->OtherLine != NULL; l = l->OtherLine); + l = l->next; /* line after END SELECT */ + l->position = 0; + return l; +} + + +LineType * +bwb_END_SELECT (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + return (l); +} + +/* +-------------------------------------------------------------------------------------------- + DO - LOOP +-------------------------------------------------------------------------------------------- +*/ + +/*************************************************************** + + FUNCTION: bwb_DO() + + DESCRIPTION: This C function implements the ANSI BASIC + DO statement. + + SYNTAX: DO [UNTIL|WHILE condition] + ... + [EXIT DO] + ... + LOOP [UNTIL|WHILE condition] + +***************************************************************/ + +LineType * +bwb_DO (LineType * l) +{ + LineType *r; + int Value; + + assert (l != NULL); + + /* DO ' forever */ + /* DO UNTIL ' exits when != 0 */ + /* DO WHILE ' exits when == 0 */ + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + do + { + /* evaluate the expression */ + if (line_is_eol (l)) + { + break; /* exit 'do' */ + } + else if (line_skip_word (l, "UNTIL")) + { + /* DO UNTIL */ + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (Value != 0) + { + /* EXIT DO */ + r = l->OtherLine; /* line of LOOP */ + r = r->next; /* line after LOOP */ + r->position = 0; + return r; + } + } + else if (line_skip_word (l, "WHILE")) + { + /* DO WHILE */ + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (Value == 0) + { + /* EXIT DO */ + r = l->OtherLine; /* line of LOOP */ + r = r->next; /* line after LOOP */ + r->position = 0; + return r; + } + } + + } + while (line_skip_seperator (l)); + + return (l); +} + + +LineType * +bwb_EXIT_DO (LineType * l) +{ + LineType *r; + + assert (l != NULL); + + /* EXIT DO */ + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + r = l->OtherLine; /* line of DO */ + r = r->OtherLine; /* line of LOOP */ + r = r->next; /* line after LOOP */ + r->position = 0; + return r; +} + + +LineType * +bwb_LOOP (LineType * l) +{ + LineType *r; + int Value; + + assert (l != NULL); + + /* LOOP ' forever */ + /* LOOP UNTIL ' exits when != 0 */ + /* LOOP WHILE ' exits when == 0 */ + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + do + { + /* evaluate the expression */ + if (line_is_eol (l)) + { + break; /* exit 'do' */ + } + else if (line_skip_word (l, "UNTIL")) + { + /* LOOP UNTIL */ + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (Value != 0) + { + /* EXIT DO */ + return (l); + } + } + else if (line_skip_word (l, "WHILE")) + { + /* LOOP WHILE */ + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (Value == 0) + { + /* EXIT DO */ + return (l); + } + } + + } + while (line_skip_seperator (l)); + + /* loop around to DO again */ + r = l->OtherLine; /* line of DO */ + r->position = 0; + return r; +} + + + +/* +-------------------------------------------------------------------------------------------- + WHILE - WEND +-------------------------------------------------------------------------------------------- +*/ + + + + +/*************************************************************** + + FUNCTION: bwb_WHILE() + + DESCRIPTION: This function handles the BASIC + WHILE statement. + + SYNTAX: WHILE expression ' exits when == 0 + ... + [EXIT WHILE] + ... + WEND + + +***************************************************************/ +LineType * +bwb_WHILE (LineType * l) +{ + int Value; + + LineType *r; + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == 0) + { + /* EXIT WHILE */ + r = l->OtherLine; /* line of WEND */ + r = r->next; /* line after WEND */ + r->position = 0; + return r; + } + return (l); +} + + +LineType * +bwb_EXIT_WHILE (LineType * l) +{ + LineType *r; + + assert (l != NULL); + + /* EXIT WHILE */ + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + r = l->OtherLine; /* line of WHILE */ + r = r->OtherLine; /* line of WEND */ + r = r->next; /* line after WEND */ + r->position = 0; + return r; +} + +LineType * +bwb_WEND (LineType * l) +{ + LineType *r; + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + r = l->OtherLine; /* line of WHILE */ + r->position = 0; + return r; +} + + +/* +-------------------------------------------------------------------------------------------- + REPEAT - UNTIL +-------------------------------------------------------------------------------------------- +*/ + + + + + + + +/*************************************************************** + + FUNCTION: bwb_UNTIL() + + DESCRIPTION: This function handles the BASIC + UNTIL statement. + + SYNTAX: UNTIL expression ' exits when != 0 + ... + [EXIT UNTIL] + ... + UEND + + +***************************************************************/ +LineType * +bwb_REPEAT (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + return (l); +} + + +LineType * +bwb_EXIT_REPEAT (LineType * l) +{ + LineType *r; + + assert (l != NULL); + + /* EXIT REPEAT */ + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + r = l->OtherLine; /* line of REPEAT */ + r = r->OtherLine; /* line of UNTIL */ + r = r->next; /* line after UNTIL */ + r->position = 0; + return r; +} + + +LineType * +bwb_UNTIL (LineType * l) +{ + int Value; + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (Value == 0) + { + /* GOTO REPEAT */ + LineType *r; + + r = l->OtherLine; /* line of REPEAT */ + r->position = 0; + return r; + } + /* EXITS when Value != 0 */ + return (l); + +} + + +/* +-------------------------------------------------------------------------------------------- + FOR - NEXT +-------------------------------------------------------------------------------------------- +*/ + + + +/*************************************************************** + + FUNCTION: bwb_for() + + DESCRIPTION: This function handles the BASIC FOR + statement. + + SYNTAX: FOR counter = start TO finish [STEP increment] + ... + [EXIT FOR] + ... + NEXT [counter] + +NOTE: This is controlled by the OptionVersion bitmask. + + The order of expression evaluation and variable creation varies. + For example: + FUNCTION FNA( Y ) + PRINT "Y="; Y + FNA = Y + END FUNCTION + FOR X = FNA(3) TO FNA(1) STEP FNA(2) + NEXT X + ANSI/ECMA; + Y= 1 + Y= 2 + Y= 3 + X is created (if it does not exist) + X is assigned the value of 3 + MICROSOFT; + X is created (if it does not exist) + Y= 3 + X is assigned the value of 3 + Y= 1 + Y= 2 + + +ECMA-55: Section 13.4 + ... + The action of the for-statement and the next-statement is de- + fined in terms of other statements, as follows: + + FOR v = initial-value TO limit STEP increment + (block) + NEXT v + + is equivalent to: + + LET own1 = limit + LET own2 = increment + LET v = initial-value + line1 IF (v-own1) * SGN (own2) > 0 THEN line2 + (block) + LET v = v + own2 + GOTO line1 + line2 REM continued in sequence + ... + +***************************************************************/ + + +LineType * +bwb_FOR (LineType * l) +{ + LineType *r; + VariableType *v; + DoubleType Value; + DoubleType Target; + DoubleType Step; + VariantType variant; + CLEAR_VARIANT (&variant); + + assert (l != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* if this is the first time at this FOR statement, note it */ + if (FindTopLineOnStack (l) == FALSE) + { + if (bwb_incexec ()) + { + /* OK */ + } + else + { + /* ERROR */ + WARN_OUT_OF_MEMORY; + return My->EndMarker; + } + } + + /* INITIALIZE */ + + + if ((v = line_read_scalar (l)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + if (v->dimensions > 0) + { + WARN_TYPE_MISMATCH; + return (l); + } + if (v->VariableTypeCode == StringTypeCode) + { + WARN_TYPE_MISMATCH; + return (l); + } + if (line_skip_EqualChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_numeric_expression (l, &Value) == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (My->CurrentVersion->OptionFlags & OPTION_BUGS_ON /* FOR X = ... */ ) + { + /* Assign Variable */ + variant.VariantTypeCode = v->VariableTypeCode; + variant.Number = Value; + if (var_set (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + else + { + /* assigned below */ + } + if (line_skip_word (l, "TO") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_numeric_expression (l, &Target) == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (line_skip_word (l, "STEP")) + { + if (line_read_numeric_expression (l, &Step) == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + } + else + { + Step = 1; + } + if (My->CurrentVersion->OptionFlags & OPTION_BUGS_ON /* FOR X = ... */ ) + { + /* assigned above */ + } + else + { + /* Assign Variable */ + variant.VariantTypeCode = v->VariableTypeCode; + variant.Number = Value; + if (var_set (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + } + + /* CHECK */ + if (for_limit_check (Value, Target, Step)) + { + /* EXIT FOR */ + bwb_decexec (); + + r = l->OtherLine; /* line of NEXT */ + r = r->next; /* line after NEXT */ + r->position = 0; + return r; + } + + /* we will loop at least once */ + assert(My->StackHead != NULL); + My->StackHead->line = l; + My->StackHead->ExecCode = EXEC_FOR; + My->StackHead->local_variable = v; + My->StackHead->for_step = Step; + My->StackHead->for_target = Target; + My->StackHead->LoopTopLine = l; + My->StackHead->OnErrorGoto = 0; + /* proceed with processing */ + return (l); +} + + +LineType * +bwb_EXIT_FOR (LineType * l) +{ + LineType *r; + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (FindTopLineOnStack (l->OtherLine) == FALSE) + { + WARN_EXIT_FOR_WITHOUT_FOR; + return (l); + } + assert(My != NULL); + assert(My->StackHead != NULL); + My->StackHead->ExecCode = EXEC_FOR; + bwb_decexec (); + + r = l->OtherLine; /* line of FOR */ + r = r->OtherLine; /* line of NEXT */ + r = r->next; /* line after NEXT */ + r->position = 0; + return r; +} + + +LineType * +bwb_NEXT (LineType * l) +{ + LineType *r; + VariableType *v; + DoubleType Value; + DoubleType Target; + DoubleType Step; + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + if (FindTopLineOnStack (l->OtherLine) == FALSE) + { + WARN_NEXT_WITHOUT_FOR; + return (l); + } + assert(My != NULL); + assert(My->StackHead != NULL); + My->StackHead->ExecCode = EXEC_FOR; + + /* INCREMENT */ + v = My->StackHead->local_variable; + Target = My->StackHead->for_target; + Step = My->StackHead->for_step; + + /* if( TRUE ) */ + { + VariantType variant; + CLEAR_VARIANT (&variant); + if (var_get (v, &variant) == FALSE) + { + WARN_NEXT_WITHOUT_FOR; + return (l); + } + if (variant.VariantTypeCode == StringTypeCode) + { + WARN_NEXT_WITHOUT_FOR; + return (l); + } + variant.Number += Step; + Value = variant.Number; + if (var_set (v, &variant) == FALSE) + { + WARN_NEXT_WITHOUT_FOR; + return (l); + } + } + + /* CHECK */ + if (for_limit_check (Value, Target, Step)) + { + /* EXIT FOR */ + bwb_decexec (); + return (l); + } + /* proceed with processing */ + r = l->OtherLine; /* line of FOR */ +#if FALSE /* keep this ... */ + /* + This example causes a Syntax Error: + 100 FOR I = 1 TO 1000:NEXT + The error is actually caused by execline(). + Note that the example is a delay loop. + Only NEXT has this issue, because it jumps to TOP->next. + All other loop structures jump to either TOP or BOTTOM->next. + */ + r = r->next; /* line after FOR */ + r->position = 0; +#endif + line_skip_eol (r); + return r; +} + + +/* +-------------------------------------------------------------------------------------------- + STATIC UTILITY ROUTINES +-------------------------------------------------------------------------------------------- +*/ + + +static int +FindTopLineOnStack (LineType * l) +{ + /* since we are at the top of a loop, we MIGHT be on the stack */ + StackType *StackItem; + + assert (l != NULL); + assert(My != NULL); + + for (StackItem = My->StackHead; StackItem != NULL; + StackItem = StackItem->next) + { + LineType *current; + + current = StackItem->LoopTopLine; + if (current != NULL) + { + if (current == l) + { + /* FOUND */ + while (My->StackHead != StackItem) + { + bwb_decexec (); + } + /* we are now the top item on the stack */ + return TRUE; + } + /* do NOT cross a function/sub boundary */ + switch (current->cmdnum) + { + case C_FUNCTION: + case C_SUB: + case C_GOSUB: + /* NOT FOUND */ + return FALSE; + /* break; */ + } + } + } + /* NOT FOUND */ + return FALSE; +} + +static LineType * +bwb_if_file (LineType * l, int ThenValue) +{ + /* IF END # filenumber THEN linenumber */ + /* IF MORE # filenumber THEN linenumber */ + int Value; + int FileNumber; + + assert (l != NULL); + + + if (line_skip_FilenumChar (l)) + { + /* IF END # */ + FileType *F; + + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber < 0) + { + /* Printer is NOT EOF */ + Value = FALSE; + } + else if (FileNumber == 0) + { + /* Console is NOT EOF */ + Value = FALSE; + } + else + { + /* normal file */ + F = find_file_by_number (FileNumber); + if (F == NULL) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + /* if( TRUE ) */ + { + /* actual file -- are we at the end? */ + FILE *fp; + long current; + long total; + fp = F->cfp; + assert( fp != NULL ); + current = ftell (fp); + fseek (fp, 0, SEEK_END); + total = ftell (fp); + if (total == current) + { + /* EOF */ + Value = TRUE; + } + else + { + /* NOT EOF */ + Value = FALSE; + fseek (fp, current, SEEK_SET); + } + } + } + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (Value == ThenValue) + { + /* expression is TRUE, take THEN path */ + return bwb_then_else (l, TRUE); + } + /* expression is FALSE, take ELSE path */ + return bwb_then_else (l, FALSE); +} + +static LineType * +bwb_then_else (LineType * l, int Value) +{ + /* + ... THEN 100 + ... THEN 100 ELSE 200 + + The deciding expression has already been parsed and evaluated. + If Value != 0, then we want to take the THEN path. + If Value == 0, then we want to take the ELSE path. + */ + int LineNumber; + LineType *x; + + assert (l != NULL); + + if (line_skip_seperator (l)) + { + /* OK */ + } + else + { + /* OPTIONAL */ + } + + if (line_skip_word (l, "THEN")) + { + /* OK */ + } + else if (line_skip_word (l, "GOTO")) + { + /* OK */ + } + else + { + /* REQUIRED */ + WARN_SYNTAX_ERROR; + return (l); + } + + /* read THEN's LineNumber */ + if (line_read_integer_expression (l, &LineNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (Value == 0) + { + /* expression is FALSE, take ELSE path */ + if (line_is_eol (l)) + { + /* OPTIONAL */ + return (l); + } + + if (line_skip_seperator (l)) + { + /* OK */ + } + else + { + /* OPTIONAL */ + } + + if (line_skip_word (l, "ELSE")) + { + /* OK */ + } + else + { + /* REQUIRED */ + WARN_SYNTAX_ERROR; + return (l); + } + + if (line_read_integer_expression (l, &LineNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + + x = NULL; +#if THE_PRICE_IS_RIGHT + if (l->OtherLine != NULL) + { + /* look in the cache */ + if (l->OtherLine->number == LineNumber) + { + x = l->OtherLine; /* found in cache */ + } + } +#endif /* THE_PRICE_IS_RIGHT */ + if (x == NULL) + { + x = find_line_number (LineNumber); /* bwb_then_else */ + } + if (x != NULL) + { + line_skip_eol (l); + x->position = 0; +#if THE_PRICE_IS_RIGHT + l->OtherLine = x; /* save in cache */ +#endif /* THE_PRICE_IS_RIGHT */ + return x; + } + WARN_SYNTAX_ERROR; + return (l); + +} + +static int +IsTypeMismatch (char LeftTypeCode, char RightTypeCode) +{ + + if (LeftTypeCode == StringTypeCode && RightTypeCode == StringTypeCode) + { + /* both STRING */ + return FALSE; + } + if (LeftTypeCode != StringTypeCode && RightTypeCode != StringTypeCode) + { + /* both NUMBER */ + return FALSE; + } + /* TYPE MISMATCH */ + return TRUE; +} + +static int +for_limit_check (DoubleType Value, DoubleType Target, DoubleType Step) +{ + + if (Step > 0) + { + /* POSITIVE */ + if (Value > Target) + { + /* FOR I = 3 TO 2 STEP 1 */ + return TRUE; + } + } + else + { + /* NEGATIVE */ + if (Value < Target) + { + /* FOR I = -3 TO -2 STEP -1 */ + return TRUE; + } + } + return FALSE; +} + +/* EOF */ diff --git a/bwb_dio.c b/bwb_dio.c new file mode 100644 index 0000000..4affd33 --- /dev/null +++ b/bwb_dio.c @@ -0,0 +1,1281 @@ +/*************************************************************** + + bwb_dio.c Device Input/Output Routines + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + + +static LineType *C77_OPEN (LineType * l); +static LineType *D71_OPEN (LineType * l); +static LineType *H80_OPEN (LineType * l); +static LineType *M80_OPEN (LineType * l); +static LineType *S70_OPEN (LineType * l); +static LineType *T79_OPEN (LineType * l); + + +/*************************************************************** + + FUNCTION: bwb_open() + + DESCRIPTION: This function implements the BASIC OPEN + command to open a stream for device input/output. + + SYNTAX: 1. OPEN "I"|"O"|"R"|"A", [#]n, filename [,rlen] + 2. OPEN filename [FOR INPUT|OUTPUT|APPEND|RANDOM|BINARY] AS [#]n [LEN=n] + +***************************************************************/ + +extern void +bwb_file_open (char A, int x, char *B, int y) +{ + /* OPEN "I"|"O"|"R"|"A", [#] filenum, filename [,reclen] */ + /* P1STR|P2NUM|P3STR|P4NUM */ + /* P1BYT|P2DEV|P3BYT|P4INT */ + int mode; + FileType *F; + FILE *fp; + char *buffer; + + assert (B != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSPRN != NULL); + + mode = 0; + F = NULL; + fp = NULL; + buffer = NULL; + if (y < 0) + { + WARN_FIELD_OVERFLOW; + return; + } + + mode = bwb_toupper (A); + switch (mode) + { + case 'I': + case 'O': + case 'A': + case 'B': + case 'V': + case 'R': + /* valid mode */ + break; + default: + WARN_BAD_FILE_MODE; + return; + } + /* valid mode */ + F = find_file_by_number (x); + if (F == NULL) + { + F = file_new (); + if (F == NULL) + { + WARN_OUT_OF_MEMORY; + return; + } + } + if (F == My->SYSIN) + { + WARN_BAD_FILE_NUMBER; + return; + } + if (F == My->SYSOUT) + { + WARN_BAD_FILE_NUMBER; + return; + } + if (F == My->SYSPRN) + { + WARN_BAD_FILE_NUMBER; + return; + } + if (F->DevMode != DEVMODE_CLOSED) + { + WARN_BAD_FILE_NUMBER; + return; + } + /* valid filenumber */ + switch (mode) + { + case 'I': + mode = DEVMODE_INPUT; + fp = fopen (B, "r"); + if (fp == NULL) + { + WARN_BAD_FILE_NAME; + return; + } + if (y > 0) + { + /* RECLEN == INPUT BUFFER SIZE */ + if ((buffer = + (char *) calloc (y + 1 /* NulChar */ , sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return; + } + bwb_memset (buffer, ' ', y); /* flush */ + buffer[y] = NulChar; + } + break; + case 'O': + mode = DEVMODE_OUTPUT; + fp = fopen (B, "w"); + if (fp == NULL) + { + WARN_BAD_FILE_NAME; + return; + } + if (y > 0) + { + /* RECLEN == OUTPUT WRAP WIDTH */ + } + break; + case 'A': + mode = DEVMODE_APPEND; + fp = fopen (B, "a"); + if (fp == NULL) + { + WARN_BAD_FILE_NAME; + return; + } + fseek (fp, 0, SEEK_END); + if (y > 0) + { + /* RECLEN == OUTPUT WRAP WIDTH */ + } + break; + case 'B': + mode = DEVMODE_BINARY; + fp = fopen (B, "r+"); + if (fp == NULL) + { + fp = fopen (B, "w"); + if (fp != NULL) + { + bwb_fclose (fp); + fp = fopen (B, "r+"); + } + } + if (fp == NULL) + { + WARN_BAD_FILE_NAME; + return; + } + if (y > 0) + { + /* RECLEN == SILENTLY IGNORED */ + } + break; + case 'V': + mode = DEVMODE_VIRTUAL; + fp = fopen (B, "r+"); + if (fp == NULL) + { + fp = fopen (B, "w"); + if (fp != NULL) + { + bwb_fclose (fp); + fp = fopen (B, "r+"); + } + } + if (fp == NULL) + { + WARN_BAD_FILE_NAME; + return; + } + if (y > 0) + { + /* RECLEN == SILENTLY IGNORED */ + } + break; + case 'R': + if (y == 0) + { + /* dialect-specific default record length */ + y = My->CurrentVersion->OptionReclenInteger; + if (y == 0) + { + /* there is no default record length */ + WARN_FIELD_OVERFLOW; + return; + } + } + mode = DEVMODE_RANDOM; + fp = fopen (B, "r+"); + if (fp == NULL) + { + fp = fopen (B, "w"); + if (fp != NULL) + { + bwb_fclose (fp); + fp = fopen (B, "r+"); + } + } + if (fp == NULL) + { + WARN_BAD_FILE_NAME; + return; + } + if (y > 0) + { + /* RECLEN == RANDOM BUFFER SIZE */ + if ((buffer = (char *) calloc (y, sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return; + } + bwb_memset (buffer, ' ', y); /* flush */ + } + break; + default: + /* should not happen */ + WARN_BAD_FILE_MODE; + return; + } + /* OK */ + F->FileNumber = x; + F->DevMode = mode; + F->cfp = fp; + F->width = y; /* WIDTH == RECLEN */ + F->col = 1; + F->row = 1; + F->delimit = ','; + if (F->buffer != NULL) + { + free (F->buffer); + F->buffer = NULL; + } + F->buffer = buffer; + if (F->FileName != NULL) + { + free (F->FileName); + F->FileName = NULL; + } + F->FileName = bwb_strdup (B); /* 'B' is free'd by caller */ + return; +} + + + +static LineType * +C77_OPEN (LineType * l) +{ + int FileNumber; + int RecordLength; + char *FileName; + + assert (l != NULL); + assert(My != NULL); + + FileNumber = 0; + RecordLength = 0; + FileName = NULL; + /* + SYNTAX: OPEN filename$ [ RECL reclen ] AS filenumber [ BUFF ignored ] [ RECS ignored ] + */ + + /* + --------------------------------------------- + FILE NAME + --------------------------------------------- + */ + if (line_read_string_expression (l, &FileName) == FALSE) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (FileName == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (is_empty_string (FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + /* + --------------------------------------------- + RECORD LENGTH + --------------------------------------------- + */ + if (line_skip_word (l, "RECL")) + { + if (line_read_integer_expression (l, &RecordLength) == FALSE) + { + WARN_FIELD_OVERFLOW; + return (l); + } + if (RecordLength <= 0) + { + WARN_FIELD_OVERFLOW; + return (l); + } + } + /* + --------------------------------------------- + FILE NUMBER + --------------------------------------------- + */ + if (line_skip_word (l, "AS") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_FilenumChar (l)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + /* + --------------------------------------------- + IGNORED + --------------------------------------------- + */ + /* if( TRUE ) */ + { + int Ignored; + + Ignored = 0; + /* + these are all parsed but ignored + */ + + if (line_skip_word (l, "BUFF")) + { + if (line_read_integer_expression (l, &Ignored) == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (Ignored <= 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + } + if (line_skip_word (l, "RECS")) + { + if (line_read_integer_expression (l, &Ignored) == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (Ignored <= 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + } + } + /* + --------------------------------------------- + FILE MODE + --------------------------------------------- + */ + /* + --------------------------------------------- + DO IT + --------------------------------------------- + */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + My->CurrentFile = file_new (); + My->CurrentFile->FileNumber = FileNumber; + } + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = FileName; + FileName = NULL; + if (My->CurrentFile->DevMode != DEVMODE_CLOSED) + { + My->CurrentFile->DevMode = DEVMODE_CLOSED; + } + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = NULL; + } + if (My->CurrentFile->buffer != NULL) + { + free (My->CurrentFile->buffer); + My->CurrentFile->buffer = NULL; + } + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + /* open EXISTING text file for update (reading and writing) */ + if (is_empty_string (My->CurrentFile->FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if ((My->CurrentFile->cfp = + fopen (My->CurrentFile->FileName, "r+")) == NULL) + { + /* IF END # file_number THEN line_number */ + if (My->CurrentFile->EOF_LineNumber > 0) + { + LineType *x; + + x = find_line_number (My->CurrentFile->EOF_LineNumber); /* not found in the cache */ + if (x != NULL) + { + /* FOUND */ + line_skip_eol (l); + x->position = 0; + free (FileName); + FileName = NULL; + return x; + } + /* NOT FOUND */ + WARN_UNDEFINED_LINE; + return (l); + } + WARN_BAD_FILE_NAME; + return (l); + } + if (RecordLength > 0) + { + My->CurrentFile->width = RecordLength; /* includes the terminating '\n' */ + My->CurrentFile->DevMode = DEVMODE_RANDOM; + if ((My->CurrentFile->buffer = + (char *) calloc (RecordLength, sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + bwb_memset (My->CurrentFile->buffer, ' ', RecordLength); /* flush */ + } + else + { + My->CurrentFile->DevMode = DEVMODE_INPUT | DEVMODE_OUTPUT; + } + /* OK */ + free (FileName); + FileName = NULL; + return (l); +} + +static LineType * +S70_OPEN (LineType * l) +{ + int FileNumber; + char FileMode; + int RecordLength; + char *FileName; + + assert (l != NULL); + + FileNumber = 0; + FileMode = 'R'; + RecordLength = 0; + FileName = NULL; + /* + SYNTAX: OPEN filenumber, filename$, INPUT | OUTPUT | APPEND | VIRTUAL + */ + /* + --------------------------------------------- + FILE NUMBER + --------------------------------------------- + */ + if (line_skip_FilenumChar (l)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (line_skip_seperator (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* + --------------------------------------------- + FILE NAME + --------------------------------------------- + */ + if (line_read_string_expression (l, &FileName) == FALSE) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (FileName == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (is_empty_string (FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (line_skip_seperator (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* + --------------------------------------------- + FILE MODE + --------------------------------------------- + */ + /* if( TRUE ) */ + { + if (line_skip_word (l, "INPUT")) + { + FileMode = 'I'; + } + else if (line_skip_word (l, "OUTPUT")) + { + FileMode = 'O'; + } + else if (line_skip_word (l, "APPEND")) + { + FileMode = 'A'; + } + else if (line_skip_word (l, "VIRTUAL")) + { + FileMode = 'V'; + } + else + { + WARN_BAD_FILE_MODE; + return (l); + } + } + /* + --------------------------------------------- + RECORD LENGTH + --------------------------------------------- + */ + RecordLength = 0; + /* + --------------------------------------------- + DO IT + --------------------------------------------- + */ + bwb_file_open (FileMode, FileNumber, FileName, RecordLength); + free (FileName); + FileName = NULL; + return (l); +} + +static LineType * +D71_OPEN (LineType * l) +{ + int FileNumber; + char FileMode; + int RecordLength; + char *FileName; + + assert (l != NULL); + + FileNumber = 0; + FileMode = 'R'; + RecordLength = 0; + FileName = NULL; + /* + SYNTAX: OPEN filename$ [FOR mode] AS FILE filenumber [ ,RECORDSIZE ignored ] [ ,CLUSTERSIZE ignored ] [ ,MODE ignored ] + */ + /* + --------------------------------------------- + FILE NAME + --------------------------------------------- + */ + if (line_read_string_expression (l, &FileName) == FALSE) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (FileName == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (is_empty_string (FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + /* + --------------------------------------------- + FILE MODE + --------------------------------------------- + */ + if (line_skip_word (l, "FOR")) + { + if (line_skip_word (l, "INPUT")) + { + FileMode = 'I'; + } + else if (line_skip_word (l, "OUTPUT")) + { + FileMode = 'O'; + } + else if (line_skip_word (l, "APPEND")) + { + FileMode = 'A'; + } + else if (line_skip_word (l, "RANDOM")) + { + FileMode = 'R'; + } + else if (line_skip_word (l, "BINARY")) + { + FileMode = 'B'; + } + else if (line_skip_word (l, "VIRTUAL")) + { + FileMode = 'V'; + } + else + { + WARN_BAD_FILE_MODE; + return (l); + } + } + /* + --------------------------------------------- + FILE NUMBER + --------------------------------------------- + */ + if (line_skip_word (l, "AS") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_word (l, "FILE") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_FilenumChar (l)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + /* + --------------------------------------------- + RECORD LENGTH + --------------------------------------------- + */ + RecordLength = 0; + while (line_is_eol (l) == FALSE) + { + int Ignored; + + Ignored = 0; + /* + these are all parsed but ignored + */ + if (line_skip_seperator (l)) + { + /* OK */ + } + else if (line_skip_word (l, "RECORDSIZE")) + { + if (line_read_integer_expression (l, &Ignored) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_word (l, "CLUSTERSIZE")) + { + if (line_read_integer_expression (l, &Ignored) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_word (l, "FILESIZE")) + { + if (line_read_integer_expression (l, &Ignored) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + else if (line_skip_word (l, "MODE")) + { + if (line_read_integer_expression (l, &Ignored) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + else + { + WARN_SYNTAX_ERROR; + return (l); + } + } + /* + --------------------------------------------- + DO IT + --------------------------------------------- + */ + bwb_file_open (FileMode, FileNumber, FileName, RecordLength); + free (FileName); + FileName = NULL; + return (l); +} + +static LineType * +H80_OPEN (LineType * l) +{ + int FileNumber; + char FileMode; + int RecordLength; + char *FileName; + + assert (l != NULL); + + FileNumber = 0; + FileMode = 'R'; + RecordLength = 0; + FileName = NULL; + /* + SYNTAX: OPEN filename$ FOR mode AS FILE filenumber + */ + /* + --------------------------------------------- + FILE NAME + --------------------------------------------- + */ + if (line_read_string_expression (l, &FileName) == FALSE) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (FileName == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (is_empty_string (FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + /* + --------------------------------------------- + FILE MODE + --------------------------------------------- + */ + if (line_skip_word (l, "FOR") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_word (l, "READ")) + { + FileMode = 'I'; + } + else if (line_skip_word (l, "WRITE")) + { + FileMode = 'O'; + } + else if (line_skip_word (l, "VIRTUAL")) + { + FileMode = 'V'; + } + else + { + WARN_BAD_FILE_MODE; + return (l); + } + /* + --------------------------------------------- + FILE NUMBER + --------------------------------------------- + */ + if (line_skip_word (l, "AS") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_word (l, "FILE") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_FilenumChar (l)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + /* + --------------------------------------------- + RECORD LENGTH + --------------------------------------------- + */ + RecordLength = 0; + /* + --------------------------------------------- + DO IT + --------------------------------------------- + */ + bwb_file_open (FileMode, FileNumber, FileName, RecordLength); + free (FileName); + FileName = NULL; + return (l); +} + + +static LineType * +M80_OPEN (LineType * l) +{ + int FileNumber; + char FileMode; + int RecordLength; + char *FileName; + + assert (l != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + FileNumber = 0; + FileMode = 'R'; + RecordLength = 0; + FileName = NULL; + /* + SYNTAX: OPEN filename$ [FOR mode] AS filenumber [LEN reclen] + */ + /* + --------------------------------------------- + FILE NAME + --------------------------------------------- + */ + if (line_read_string_expression (l, &FileName) == FALSE) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (FileName == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (is_empty_string (FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + /* + --------------------------------------------- + FILE MODE + --------------------------------------------- + */ + if (line_skip_word (l, "FOR")) + { + if (line_skip_word (l, "INPUT")) + { + FileMode = 'I'; + } + else if (line_skip_word (l, "OUTPUT")) + { + FileMode = 'O'; + } + else if (line_skip_word (l, "APPEND")) + { + FileMode = 'A'; + } + else if (line_skip_word (l, "RANDOM")) + { + FileMode = 'R'; + } + else if (line_skip_word (l, "BINARY")) + { + FileMode = 'B'; + } + else if (line_skip_word (l, "VIRTUAL")) + { + FileMode = 'V'; + } + else + { + WARN_BAD_FILE_MODE; + return (l); + } + } + + if (My->CurrentVersion->OptionVersionValue & (H14)) + { + /* + ** + ** these are parsed but ignored + ** + */ + if (line_skip_word (l, "ACCESS")) + { + /* ACCESS */ + if (line_skip_word (l, "READ")) + { + /* ACCESS READ */ + if (line_skip_word (l, "WRITE")) + { + /* ACCESS READ WRITE */ + } + } + else if (line_skip_word (l, "WRITE")) + { + /* ACCESS WRITE */ + } + } + if (line_skip_word (l, "SHARED")) + { + /* SHARED */ + } + else if (line_skip_word (l, "LOCK")) + { + /* LOCK */ + if (line_skip_word (l, "READ")) + { + /* LOCK READ */ + } + else if (line_skip_word (l, "WRITE")) + { + /* LOCK WRITE */ + } + } + } + /* + --------------------------------------------- + FILE NUMBER + --------------------------------------------- + */ + if (line_skip_word (l, "AS") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (My->CurrentVersion->OptionVersionValue & (H14)) + { + if (line_skip_word (l, "FILE")) + { + /* OPTIONAL */ + } + } + + if (line_skip_FilenumChar (l)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + /* + --------------------------------------------- + RECORD LENGTH + --------------------------------------------- + */ + RecordLength = 0; + if (line_skip_word (l, "LEN")) + { + if (line_skip_EqualChar (l)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (l, &RecordLength) == FALSE) + { + WARN_FIELD_OVERFLOW; + return (l); + } + if (RecordLength <= 0) + { + WARN_FIELD_OVERFLOW; + return (l); + } + } + /* + --------------------------------------------- + DO IT + --------------------------------------------- + */ + bwb_file_open (FileMode, FileNumber, FileName, RecordLength); + free (FileName); + FileName = NULL; + return (l); +} + +static LineType * +T79_OPEN (LineType * l) +{ + int FileNumber; + char FileMode; + int RecordLength; + char *FileName; + + assert (l != NULL); + + FileNumber = 0; + FileMode = 'R'; + RecordLength = 0; + FileName = NULL; + /* + SYNTAX: OPEN [NEW | OLD] filename$ AS filenumber + */ + /* + --------------------------------------------- + FILE MODE + --------------------------------------------- + */ + if (line_skip_word (l, "NEW")) + { + FileMode = 'O'; + } + else if (line_skip_word (l, "OLD")) + { + FileMode = 'I'; + } + else if (line_skip_word (l, "VIRTUAL")) + { + FileMode = 'V'; + } + /* + --------------------------------------------- + FILE NAME + --------------------------------------------- + */ + if (line_read_string_expression (l, &FileName) == FALSE) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (FileName == NULL) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (is_empty_string (FileName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + /* + --------------------------------------------- + FILE NUMBER + --------------------------------------------- + */ + if (line_skip_word (l, "AS") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_FilenumChar (l)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + /* + --------------------------------------------- + RECORD LENGTH + --------------------------------------------- + */ + RecordLength = 0; + /* + --------------------------------------------- + DO IT + --------------------------------------------- + */ + bwb_file_open (FileMode, FileNumber, FileName, RecordLength); + free (FileName); + FileName = NULL; + return (l); +} + +LineType * +bwb_OPEN (LineType * l) +{ + + assert (l != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + return S70_OPEN (l); + } + if (My->CurrentVersion->OptionVersionValue & (D71)) + { + return D71_OPEN (l); + } + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + return C77_OPEN (l); + } + if (My->CurrentVersion->OptionVersionValue & (H80)) + { + return H80_OPEN (l); + } + if (My->CurrentVersion->OptionVersionValue & (T79 | R86)) + { + return T79_OPEN (l); + } + /* default */ + return M80_OPEN (l); +} + +/*************************************************************** + + FUNCTION: bwb_name() + + DESCRIPTION: This function implements the BASIC NAME + command to rename a disk file. + + SYNTAX: NAME old_filename AS new_filename + +***************************************************************/ + + +LineType * +bwb_NAME (LineType * l) +{ + char *OldName; + char *NewName; + + assert (l != NULL); + + OldName = NULL; + NewName = NULL; + if (line_read_string_expression (l, &OldName) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (is_empty_string (OldName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + if (line_skip_word (l, "AS") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_string_expression (l, &NewName) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (is_empty_string (NewName)) + { + WARN_BAD_FILE_NAME; + return (l); + } + /* try to rename the file */ + if (rename (OldName, NewName) != 0) + { + WARN_BAD_FILE_NAME; + } + free (OldName); + OldName = NULL; + free (NewName); + NewName = NULL; + return (l); +} + + +/* EOF */ diff --git a/bwb_exp.c b/bwb_exp.c new file mode 100644 index 0000000..b603d1d --- /dev/null +++ b/bwb_exp.c @@ -0,0 +1,3519 @@ +/**************************************************************** + + bwb_exp.c Expression Parser + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + + +/* +-------------------------------------------------------------------------------------------- + EXPRESSION PARSER + +Inspired by https://groups.google.com/forum/m/#!topic/comp.compilers/RCyhEbLfs40 +... +// Permission is given to use this source provided an acknowledgement is given. +// I'd also like to know if you've found it useful. +// +// The following Research Report describes the idea, and shows how the +// parsing method may be understood as an encoding of the usual family-of- +// parsing-procedures technique as used e.g. in Pascal compilers. +// @techreport{QMW-DCS-383-1986a, +// author ="Clarke, Keith", +// title ="The Top-Down Parsing of Expressions", +// institution ="Department of Computer Science, Queen Mary College, University of London, England", +// year ="1986", +// month ="June", +// number ="QMW-DCS-1986-383", +// scope ="theory", +// abstractURL ="http://www.dcs.qmw.ac.uk/publications/report_abstracts/1986/383", +// keywords ="Recursive-descent parsing, expression parsing, operator precedence parsing." +// } +// A formal proof of the algorithm was made, as part of his PhD thesis work, +// by A.M. Abbas of QMC, London, in the framework of Constructive Set Theory. +// copyright Keith Clarke, Dept of Computer Science, QMW, University of London, +// England. email kei...@dcs.qmw.ac.uk +... +-------------------------------------------------------------------------------------------- +*/ + +/* +For all functions named "line_*", "LineType * line" is the first parameter. +For all functions named "buff_*", "char * buffer, int * position" are the first two parameters. +FALSE must be zero. +TRUE must be non-zero. +*/ + + + +/* OperatorType.Arity */ +#define UNARY 1 +#define BINARY 2 + +/* OperatorType.IsAlpha */ +#define IS_ALPHA 'T' +#define NO_ALPHA 'F' + + +#define COPY_VARIANT( X, Y ) if( X != NULL ) { bwb_memcpy( X, Y, sizeof( VariantType ) ); bwb_memset( Y, 0, sizeof( VariantType ) ); } + +typedef ResultType (OperatorFunctionType) (VariantType * X, VariantType * Y); + +struct OperatorStruct +{ + const unsigned char ThisPrec; + const unsigned char NextPrec; /* if BINARY and LEFT assoc, then ThisPrec+1, else ThisPrec */ + const unsigned char Arity; /* UNARY or BINARY */ + const char IsAlpha; /* IS_ALPHA or NO_ALPHA, determines how operator is matched */ + const char *Name; + OperatorFunctionType *Eval; + const char *Syntax; + const char *Description; + OptionVersionType OptionVersionBitmask; /* OPTION VERSION bitmask */ +}; +typedef struct OperatorStruct OperatorType; + +static int both_are_long (VariantType * X, VariantType * Y); +static int both_integer_type (VariantType * X, VariantType * Y); +static int both_number_type (VariantType * X, VariantType * Y); +static int both_string_type (VariantType * X, VariantType * Y); +static ResultType buff_read_expr (char *buffer, int *position, + VariantType * X, unsigned char LastPrec); +static ResultType buff_read_function (char *buffer, int *position, + VariantType * X); +static ResultType buff_read_internal_constant (char *buffer, int *position, + VariantType * X); +static OperatorType *buff_read_operator (char *buffer, int *position, + unsigned char LastPrec, + unsigned char Arity); +static ResultType buff_read_primary (char *buffer, int *position, + VariantType * X); +static ResultType buff_read_string_constant (char *buffer, int *position, + VariantType * X); +static ResultType buff_read_variable (char *buffer, int *position, + VariantType * X); +static int bwb_isodigit (int C); +static int is_integer_type (VariantType * X); +static int is_long_value (VariantType * X); +static int is_number_type (VariantType * X); +static int is_string_type (VariantType * X); +static char Largest_TypeCode (char TypeCode, VariantType * X); +static char math_type (VariantType * X, VariantType * Y); +static char max_number_type (char X, char Y); +static char min_value_type (VariantType * X); +static ResultType OP_ADD (VariantType * X, VariantType * Y); +static ResultType OP_AMP (VariantType * X, VariantType * Y); +static ResultType OP_AND (VariantType * X, VariantType * Y); +static ResultType OP_DIV (VariantType * X, VariantType * Y); +static ResultType OP_EQ (VariantType * X, VariantType * Y); +static ResultType OP_EQV (VariantType * X, VariantType * Y); +static ResultType OP_EXP (VariantType * X, VariantType * Y); +static ResultType OP_GE (VariantType * X, VariantType * Y); +static ResultType OP_GT (VariantType * X, VariantType * Y); +static ResultType OP_IDIV (VariantType * X, VariantType * Y); +static ResultType OP_IMP (VariantType * X, VariantType * Y); +static ResultType OP_LE (VariantType * X, VariantType * Y); +static ResultType OP_LIKE (VariantType * X, VariantType * Y); +static ResultType OP_LT (VariantType * X, VariantType * Y); +static ResultType OP_MAX (VariantType * X, VariantType * Y); +static ResultType OP_MIN (VariantType * X, VariantType * Y); +static ResultType OP_MOD (VariantType * X, VariantType * Y); +static ResultType OP_MUL (VariantType * X, VariantType * Y); +static ResultType OP_NE (VariantType * X, VariantType * Y); +static ResultType OP_NEG (VariantType * X, VariantType * Y); +static ResultType OP_NOT (VariantType * X, VariantType * Y); +static ResultType OP_OR (VariantType * X, VariantType * Y); +static ResultType OP_POS (VariantType * X, VariantType * Y); +static ResultType OP_SUB (VariantType * X, VariantType * Y); +static ResultType OP_XOR (VariantType * X, VariantType * Y); +static void SortAllOperatorsForManual (void); +static ResultType test_eq (VariantType * X, VariantType * Y, int TrueValue, + int FalseValue); +static ResultType test_gt (VariantType * X, VariantType * Y, int TrueValue, + int FalseValue); +static ResultType test_lt (VariantType * X, VariantType * Y, int TrueValue, + int FalseValue); + + +/* table of operators */ + +/* +In BASIC, 2 ^ 3 ^ 2 = ( 2 ^ 3 ) ^ 2 = 64, and -2 ^ 2 = - (2 ^ 2) = -4. +*/ + + +static OperatorType OperatorTable[ /* NUM_OPERATORS */ ] = +{ + /* LOGICAL */ + {0x01, 0x02, BINARY, IS_ALPHA, "IMP", OP_IMP, "X IMP Y", "Bitwise IMP", + B15 | B93 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 | M80 | T80 + | H14}, + {0x02, 0x03, BINARY, IS_ALPHA, "EQV", OP_EQV, "X EQV Y", "Bitwise EQV", + B15 | B93 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 | M80 | T80 + | H14}, + {0x03, 0x04, BINARY, IS_ALPHA, "XOR", OP_XOR, "X XOR Y", + "Bitwise Exclusive OR", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | M80 | T79 | R86 | T80 | H14}, + {0x03, 0x04, BINARY, IS_ALPHA, "XRA", OP_XOR, "X XRA Y", + "Bitwise Exclusive OR", + HB2}, + {0x04, 0x05, BINARY, IS_ALPHA, "OR", OP_OR, "X OR Y", "Bitwise OR", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x05, 0x06, BINARY, IS_ALPHA, "AND", OP_AND, "X AND Y", "Bitwise AND", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x06, 0x06, UNARY, IS_ALPHA, "NOT", OP_NOT, "NOT X", "Bitwise NOT", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, +/* RELATIONAL */ + {0x07, 0x08, BINARY, IS_ALPHA, "NE", OP_NE, "X NE Y", "Not Equal", + 0}, + {0x07, 0x08, BINARY, NO_ALPHA, "#", OP_NE, "X # Y", "Not Equal", + 0}, + {0x07, 0x08, BINARY, NO_ALPHA, "<>", OP_NE, "X <> Y", "Not Equal", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, NO_ALPHA, "><", OP_NE, "X >< Y", "Not Equal", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, IS_ALPHA, "GE", OP_GE, "X GE Y", + "Greater than or Equal", + 0}, + {0x07, 0x08, BINARY, NO_ALPHA, ">=", OP_GE, "X >= Y", + "Greater than or Equal", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, NO_ALPHA, "=>", OP_GE, "X => Y", + "Greater than or Equal", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, IS_ALPHA, "LE", OP_LE, "X LE Y", "Less than or Equal", + 0}, + {0x07, 0x08, BINARY, NO_ALPHA, "<=", OP_LE, "X <= Y", "Less than or Equal", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, NO_ALPHA, "=<", OP_LE, "X =< Y", "Less than or Equal", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, IS_ALPHA, "EQ", OP_EQ, "X EQ Y", "Equal", + 0}, + {0x07, 0x08, BINARY, NO_ALPHA, "=", OP_EQ, "X = Y", "Equal", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, IS_ALPHA, "LT", OP_LT, "X LT Y", "Less than", + 0}, + {0x07, 0x08, BINARY, NO_ALPHA, "<", OP_LT, "X < Y", "Less than", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, IS_ALPHA, "GT", OP_GT, "X GT Y", "Greater than", + 0}, + {0x07, 0x08, BINARY, NO_ALPHA, ">", OP_GT, "X > Y", "Greater than", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x07, 0x08, BINARY, IS_ALPHA, "LIKE", OP_LIKE, "A$ LIKE B$", + "Compare A$ to the pattern in B$", + B15}, + {0x07, 0x08, BINARY, IS_ALPHA, "MAX", OP_MAX, "X MAX Y", "Maximum", + 0}, + {0x07, 0x08, BINARY, IS_ALPHA, "MIN", OP_MIN, "X MIN Y", "Minimum", + 0}, +/* CONCATENATION */ + {0x08, 0x09, BINARY, NO_ALPHA, "&", OP_AMP, "X & Y", "Concatenation", + B15 | B93 | HB2}, +/* ARITHMETIC */ + {0x09, 0x0A, BINARY, NO_ALPHA, "+", OP_ADD, "X + Y", "Addition", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x09, 0x0A, BINARY, NO_ALPHA, "-", OP_SUB, "X - Y", "Subtraction", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x0A, 0x0B, BINARY, IS_ALPHA, "MOD", OP_MOD, "X MOD Y", "Integer Modulus", + B15 | B93 | HB1 | HB2 | D71 | M80 | R86 | T80 | H14}, + {0x0B, 0x0C, BINARY, NO_ALPHA, "\\", OP_IDIV, "X \\ Y", "Integer Division", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | E78 | E86 | M80 | T80 | H14}, + {0x0C, 0x0D, BINARY, NO_ALPHA, "*", OP_MUL, "X * Y", "Multiplication", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x0C, 0x0D, BINARY, NO_ALPHA, "/", OP_DIV, "X / Y", "Division", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x0D, 0x0D, UNARY, NO_ALPHA, "#", OP_POS, "# X", "Posation", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | C77 | D71 | E86 | M80 | T79 + | R86 | T80 | H80 | H14}, + {0x0D, 0x0D, UNARY, NO_ALPHA, "+", OP_POS, "+ X", "Posation", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x0D, 0x0D, UNARY, NO_ALPHA, "-", OP_NEG, "- X", "Negation", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | T80 | H80 | V09 | H14}, + {0x0E, 0x0F, BINARY, NO_ALPHA, "^", OP_EXP, "X ^ Y", "Exponential", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78 | E86 | M80 | T79 | R86 | H80 | V09 | H14}, + {0x0E, 0x0F, BINARY, NO_ALPHA, "[", OP_EXP, "X [ Y", "Exponential", + B15 | HB1 | HB2 | T80}, + {0x0E, 0x0F, BINARY, NO_ALPHA, "**", OP_EXP, "X ** Y", "Exponential", + B15 | B93 | HB1 | HB2 | D64 | G65 | G67 | G74 | S70 | I70 | I73 | C77 | D71 + | D70 | D73 | E78}, +}; + +static const size_t NUM_OPERATORS = + sizeof (OperatorTable) / sizeof (OperatorType); + +/* +-------------------------------------------------------------------------------------------- + Helpers +-------------------------------------------------------------------------------------------- +*/ + +extern void +SortAllOperators (void) /* SortAllOperators() should be called by bwb_init() */ +{ + /* sort the operators by decreasing length, so "**" matches before "*" and so on. */ + int i; + + + for (i = 0; i < NUM_OPERATORS - 1; i++) + { + int j; + int k; + int m; + + k = i; + m = bwb_strlen (OperatorTable[i].Name); + + for (j = i + 1; j < NUM_OPERATORS; j++) + { + int n; + n = bwb_strlen (OperatorTable[j].Name); + if (n > m) + { + m = n; + k = j; + } + } + if (k > i) + { + /* swap */ + OperatorType t; + OperatorType *T; + OperatorType *I; + OperatorType *K; + + T = &t; + I = &OperatorTable[i]; + K = &OperatorTable[k]; + + bwb_memcpy (T, I, sizeof (t)); + bwb_memcpy (I, K, sizeof (t)); + bwb_memcpy (K, T, sizeof (t)); + } + } +} + +static void +SortAllOperatorsForManual (void) /* SortAllOperators() should be called aftwards */ +{ + /* sort the operators by by precedence (high-to-low) then name (alphabetically). */ + int i; + + + for (i = 0; i < NUM_OPERATORS - 1; i++) + { + int j; + int k; + int m; + + k = i; + m = OperatorTable[i].ThisPrec; + + for (j = i + 1; j < NUM_OPERATORS; j++) + { + int n; + n = OperatorTable[j].ThisPrec; + if (n > m) + { + m = n; + k = j; + } + else + if (n == m + && bwb_stricmp (OperatorTable[j].Name, OperatorTable[k].Name) < 0) + { + m = n; + k = j; + } + } + if (k > i) + { + /* swap */ + OperatorType t; + OperatorType *T; + OperatorType *I; + OperatorType *K; + + T = &t; + I = &OperatorTable[i]; + K = &OperatorTable[k]; + + bwb_memcpy (T, I, sizeof (t)); + bwb_memcpy (I, K, sizeof (t)); + bwb_memcpy (K, T, sizeof (t)); + } + } +} +static char +min_value_type (VariantType * X) +{ + /* returns the minimal TypeCode, based upon a NUMBER's value */ + + assert (X != NULL); + + + if (isnan (X->Number)) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return NulChar; + } + if (X->Number == bwb_rint (X->Number)) + { + /* INTEGER */ + if (MINBYT <= X->Number && X->Number <= MAXBYT) + { + return ByteTypeCode; + } + if (MININT <= X->Number && X->Number <= MAXINT) + { + return IntegerTypeCode; + } + if (MINLNG <= X->Number && X->Number <= MAXLNG) + { + return LongTypeCode; + } + if (MINCUR <= X->Number && X->Number <= MAXCUR) + { + return CurrencyTypeCode; + } + } + /* FLOAT */ + if (MINSNG <= X->Number && X->Number <= MAXSNG) + { + return SingleTypeCode; + } + if (MINDBL <= X->Number && X->Number <= MAXDBL) + { + return DoubleTypeCode; + } + /* OVERFLOW */ + if (X->Number < 0) + { + X->Number = MINDBL; + } + else + { + X->Number = MAXDBL; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + } + /* CONTINUE */ + return DoubleTypeCode; +} + + + +static char +max_number_type (char X, char Y) +{ + /* returns the maximal TypeCode, given two NUMBER TypeCode's */ + + + + if (X == DoubleTypeCode || Y == DoubleTypeCode) + { + return DoubleTypeCode; + } + if (X == SingleTypeCode || Y == SingleTypeCode) + { + return SingleTypeCode; + } + if (X == CurrencyTypeCode || Y == CurrencyTypeCode) + { + return CurrencyTypeCode; + } + if (X == LongTypeCode || Y == LongTypeCode) + { + return LongTypeCode; + } + if (X == IntegerTypeCode || Y == IntegerTypeCode) + { + return IntegerTypeCode; + } + if (X == ByteTypeCode || Y == ByteTypeCode) + { + return ByteTypeCode; + } + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return NulChar; +} +static char +math_type (VariantType * X, VariantType * Y) +{ + /* + ** + ** Returns the TypeCode resulting from a math operation, such as addition. + ** The return TypeCode should be the maximal of: + ** a. The original X's TypeCode. + ** b. The original Y's TypeCode. + ** c. The result's minimal TypeCode. + ** + */ + + assert (X != NULL); + assert (Y != NULL); + return + max_number_type (max_number_type (X->VariantTypeCode, Y->VariantTypeCode), + min_value_type (X)); +} + +static char +Largest_TypeCode (char TypeCode, VariantType * X) +{ + assert (X != NULL); + if (is_integer_type (X)) + { + X->Number = bwb_rint (X->Number); + } + return max_number_type (TypeCode, min_value_type (X)); +} +static int +is_string_type (VariantType * X) +{ + /* if value is a STRING, then TRUE, else FALSE */ + + assert (X != NULL); + switch (X->VariantTypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + if (X->Buffer != NULL) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; + } + return FALSE; + case StringTypeCode: + if (X->Buffer == NULL) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; + } + return TRUE; + } + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; +} +static int +is_number_type (VariantType * X) +{ + /* if value is a NUMBER, then TRUE, else FALSE */ + + assert (X != NULL); + switch (X->VariantTypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + if (X->Buffer != NULL) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; + } + return TRUE; + case StringTypeCode: + if (X->Buffer == NULL) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; + } + return FALSE; + } + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; /* never reached */ +} +static int +is_integer_type (VariantType * X) +{ + /* if value is an INTEGER, then TRUE, else FALSE */ + + assert (X != NULL); + switch (X->VariantTypeCode) + { + case ByteTypeCode: + return TRUE; + case IntegerTypeCode: + return TRUE; + case LongTypeCode: + return TRUE; + case CurrencyTypeCode: + return TRUE; + case SingleTypeCode: + return FALSE; + case DoubleTypeCode: + return FALSE; + case StringTypeCode: + return FALSE; + } + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; +} +static int +both_string_type (VariantType * X, VariantType * Y) +{ + /* if both values are a STRING, then TRUE, else FALSE */ + + assert (X != NULL); + assert (Y != NULL); + if (is_string_type (X) && is_string_type (Y)) + { + return TRUE; + } + return FALSE; +} +static int +both_number_type (VariantType * X, VariantType * Y) +{ + /* if both values are a NUMBER, then TRUE, else FALSE */ + + assert (X != NULL); + assert (Y != NULL); + if (is_number_type (X) && is_number_type (Y)) + { + return TRUE; + } + return FALSE; +} +static int +both_integer_type (VariantType * X, VariantType * Y) +{ + /* if both values are an INTEGER, then TRUE, else FALSE */ + + assert (X != NULL); + assert (Y != NULL); + if (is_integer_type (X) && is_integer_type (Y)) + { + return TRUE; + } + return FALSE; +} +static int +is_long_value (VariantType * X) +{ + /* if the NUMBER's value can be a LONG, then TRUE, else FALSE */ + + assert (X != NULL); + if (isnan (X->Number)) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; + } + if (X->Number == bwb_rint (X->Number)) + { + if (MINCUR <= X->Number && X->Number <= MAXCUR) + { + return TRUE; + } + } + return FALSE; +} +static int +both_are_long (VariantType * X, VariantType * Y) +{ + /* if both values can be a LONG, then TRUE, else FALSE */ + + assert (X != NULL); + assert (Y != NULL); + if (is_long_value (X) && is_long_value (Y)) + { + return TRUE; + } + return FALSE; +} +static int +bwb_isodigit (int C) +{ + + switch (C) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + return TRUE; + } + return FALSE; +} + + + +/* +-------------------------------------------------------------------------------------------- + Operators +-------------------------------------------------------------------------------------------- +*/ + +static ResultType +OP_ADD (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + if (both_number_type (X, Y)) + { + /* X = (X + Y) */ + X->Number += Y->Number; + if (both_integer_type (X, Y)) + { + X->Number = bwb_rint (X->Number); + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + if (both_string_type (X, Y)) + { + /* X$ = (X$ + Y$) */ + return OP_AMP (X, Y); + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_AMP (VariantType * X, VariantType * Y) +{ + /* X$ = (X & Y ) */ + /* X$ = (X & Y$) */ + /* X$ = (X$ & Y ) */ + /* X$ = (X$ & Y$) */ + size_t CharsRemaining; + VariantType t; + VariantType *T; + + assert (X != NULL); + assert (Y != NULL); + + T = &t; + if (X->VariantTypeCode != StringTypeCode) + { + /* coerce X to X$ */ + if ((X->Buffer = (char *) calloc (NUMLEN, sizeof (char))) == NULL) /* free() called by OP_ADD() */ + { + WARN_OUT_OF_MEMORY; + return RESULT_ERROR; + } + FormatBasicNumber (X->Number, X->Buffer); + X->Length = bwb_strlen (X->Buffer); + X->VariantTypeCode = StringTypeCode; + } + if (Y->VariantTypeCode != StringTypeCode) + { + /* coerce Y to Y$ */ + if ((Y->Buffer = (char *) calloc (NUMLEN, sizeof (char))) == NULL) /* free() called by OP_ADD() */ + { + WARN_OUT_OF_MEMORY; + return RESULT_ERROR; + } + FormatBasicNumber (Y->Number, Y->Buffer); + Y->Length = bwb_strlen (Y->Buffer); + Y->VariantTypeCode = StringTypeCode; + } + if (X->Length > MAXLEN) + { + WARN_STRING_TOO_LONG; + X->Length = MAXLEN; + } + if (Y->Length > MAXLEN) + { + WARN_STRING_TOO_LONG; + Y->Length = MAXLEN; + } + T->VariantTypeCode = StringTypeCode; + T->Length = X->Length + Y->Length; + if (T->Length > MAXLEN) + { + WARN_STRING_TOO_LONG; + T->Length = MAXLEN; + } + /* we always allocate a buffer, even for non-empty strings */ + if ((T->Buffer = + (char *) calloc (T->Length + 1 /* NulChar */ , sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return RESULT_ERROR; + } + CharsRemaining = T->Length; + if (X->Length > CharsRemaining) + { + X->Length = CharsRemaining; + } + if (X->Length > 0) + { + bwb_memcpy (T->Buffer, X->Buffer, X->Length); + CharsRemaining -= X->Length; + } + if (Y->Length > CharsRemaining) + { + Y->Length = CharsRemaining; + } + if (Y->Length > 0) + { + bwb_memcpy (&T->Buffer[X->Length], Y->Buffer, Y->Length); + CharsRemaining -= Y->Length; + } + if (CharsRemaining != 0) + { + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + } + T->Buffer[T->Length] = NulChar; + RELEASE_VARIANT (X); + RELEASE_VARIANT (Y); + COPY_VARIANT (X, T); + return RESULT_SUCCESS; +} +static ResultType +OP_SUB (VariantType * X, VariantType * Y) +{ + /* X = (X - Y) */ + + assert (X != NULL); + assert (Y != NULL); + if (both_number_type (X, Y)) + { + X->Number -= Y->Number; + if (both_integer_type (X, Y)) + { + X->Number = bwb_rint (X->Number); + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_MUL (VariantType * X, VariantType * Y) +{ + /* X = (X * Y) */ + + assert (X != NULL); + assert (Y != NULL); + if (both_number_type (X, Y)) + { + X->Number *= Y->Number; + if (both_integer_type (X, Y)) + { + X->Number = bwb_rint (X->Number); + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_IDIV (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = (X \ Y) */ + X->Number = bwb_rint (X->Number); + Y->Number = bwb_rint (Y->Number); + if (Y->Number == 0) + { + /* - Evaluation of an expression results in division + * by zero (nonfatal, the recommended recovery + * procedure is to supply machine infinity with the + * sign of the numerator and continue) + */ + if (X->Number < 0) + { + /* NEGATIVE */ + X->Number = MINDBL; /* NEGATIVE INFINITY */ + } + else + { + /* POSITIVE */ + X->Number = MAXDBL; /* POSITIVE INFINITY */ + } + if (WARN_DIVISION_BY_ZERO) + { + return RESULT_ERROR; + } + /* CONTINUE */ + } + else + { + DoubleType N; + + N = bwb_rint (X->Number / Y->Number); + if (My->CurrentVersion->OptionVersionValue & (R86)) + { + /* for RBASIC's RESIDUE function */ + My->RESIDUE = bwb_rint (X->Number - N * Y->Number); + } + X->Number = N; + + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_DIV (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + if (both_number_type (X, Y)) + { + /* X = (X / Y) */ + if (both_integer_type (X, Y)) + { + return OP_IDIV (X, Y); + } + if (Y->Number == 0) + { + /* - Evaluation of an expression results in division + * by zero (nonfatal, the recommended recovery + * procedure is to supply machine infinity with the + * sign of the numerator and continue) + */ + if (X->Number < 0) + { + /* NEGATIVE */ + X->Number = MINDBL; /* NEGATIVE INFINITY */ + } + else + { + /* POSITIVE */ + X->Number = MAXDBL; /* POSITIVE INFINITY */ + } + if (WARN_DIVISION_BY_ZERO) + { + return RESULT_ERROR; + } + /* CONTINUE */ + } + else + { + X->Number /= Y->Number; + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_MOD (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + if (both_number_type (X, Y)) + { + /* X = (X MOD Y) */ + X->Number = bwb_rint (X->Number); + Y->Number = bwb_rint (Y->Number); + if (Y->Number == 0) + { + /* - Evaluation of an expression results in division + * by zero (nonfatal, the recommended recovery + * procedure is to supply machine infinity with the + * sign of the numerator and continue) + */ + if (X->Number < 0) + { + /* NEGATIVE */ + X->Number = MINDBL; /* NEGATIVE INFINITY */ + } + else + { + /* POSITIVE */ + X->Number = MAXDBL; /* POSITIVE INFINITY */ + } + if (WARN_DIVISION_BY_ZERO) + { + return RESULT_ERROR; + } + /* CONTINUE */ + } + else + { + DoubleType N; + DoubleType I; + N = X->Number / Y->Number; + modf (N, &I); + N = X->Number - Y->Number * I; + X->Number = bwb_rint (N); + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_EXP (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + if (both_number_type (X, Y)) + { + /* X = (X ^ Y) */ + if (X->Number < 0 && Y->Number != bwb_rint (Y->Number)) + { + /*** FATAL ***/ + /* - Evaluation of the operation of + * involution results in a negative number + * being raised to a non-integral power + * (fatal). */ + X->Number = 0; + WARN_ILLEGAL_FUNCTION_CALL; + return RESULT_ERROR; + } + if (X->Number == 0 && Y->Number < 0) + { + /* - Evaluation of the operation of + * involution results in a zero being + * raised to a negative value (nonfatal, the + * recommended recovery procedure is to + * supply positive machine infinity and + * continue). */ + + X->Number = MAXDBL; + if (WARN_OVERFLOW) + { + /* ERROR */ + } + /* CONTINUE */ + } + else + { + X->Number = pow (X->Number, Y->Number); + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_NEG (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y == NULL); + if (Y != NULL) + { + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + } + if (is_number_type (X)) + { + /* X = (- X) */ + X->Number = -X->Number; + X->VariantTypeCode = min_value_type (X); + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_POS (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y == NULL); + if (Y != NULL) + { + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + } + if (is_number_type (X)) + { + /* X = (+ X) */ + /* + X->Number = X->Number; + X->VariantTypeCode = min_value_type( X ); + */ + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_OR (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = (X OR Y) */ + if (both_are_long (X, Y)) + { + long x; + long y; + + x = (long) bwb_rint (X->Number); + y = (long) bwb_rint (Y->Number); + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* OR */ ) + { + if (x) + { + x = -1; + } + if (y) + { + y = -1; + } + } + + x = x | y; + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* OR */ ) + { + if (x) + { + x = 1; + } + } + + X->Number = x; + X->VariantTypeCode = min_value_type (X); + return RESULT_SUCCESS; + } + WARN_OVERFLOW; + return RESULT_ERROR; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_AND (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = (X AND Y) */ + if (both_are_long (X, Y)) + { + long x; + long y; + + x = (long) bwb_rint (X->Number); + y = (long) bwb_rint (Y->Number); + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* AND */ ) + { + if (x) + { + x = -1; + } + if (y) + { + y = -1; + } + } + + x = x & y; + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* AND */ ) + { + if (x) + { + x = 1; + } + } + + X->Number = x; + X->VariantTypeCode = min_value_type (X); + return RESULT_SUCCESS; + } + WARN_OVERFLOW; + return RESULT_ERROR; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_XOR (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = (X XOR Y) */ + if (both_are_long (X, Y)) + { + long x; + long y; + + x = (long) bwb_rint (X->Number); + y = (long) bwb_rint (Y->Number); + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* XOR */ ) + { + if (x) + { + x = -1; + } + if (y) + { + y = -1; + } + } + + x = x ^ y; + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* XOR */ ) + { + if (x) + { + x = 1; + } + } + + X->Number = x; + X->VariantTypeCode = min_value_type (X); + return RESULT_SUCCESS; + } + WARN_OVERFLOW; + return RESULT_ERROR; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_EQV (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = (X EQV Y) = NOT ( X XOR Y ) */ + if (both_are_long (X, Y)) + { + long x; + long y; + + x = (long) bwb_rint (X->Number); + y = (long) bwb_rint (Y->Number); + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* EQV */ ) + { + if (x) + { + x = -1; + } + if (y) + { + y = -1; + } + } + + x = ~(x ^ y); + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* EQV */ ) + { + if (x) + { + x = 1; + } + } + + X->Number = x; + X->VariantTypeCode = min_value_type (X); + return RESULT_SUCCESS; + } + WARN_OVERFLOW; + return RESULT_ERROR; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_IMP (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = (X IMP Y) = (X AND Y) OR (NOT X) */ + if (both_are_long (X, Y)) + { + long x; + long y; + + x = (long) bwb_rint (X->Number); + y = (long) bwb_rint (Y->Number); + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* IMP */ ) + { + if (x) + { + x = -1; + } + if (y) + { + y = -1; + } + } + + x = (x & y) | (~x); + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* IMP */ ) + { + if (x) + { + x = 1; + } + } + + X->Number = x; + X->VariantTypeCode = min_value_type (X); + return RESULT_SUCCESS; + } + WARN_OVERFLOW; + return RESULT_ERROR; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_NOT (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y == NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (Y != NULL) + { + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + } + if (is_number_type (X)) + { + /* X = (NOT X) */ + if (is_long_value (X)) + { + long x; + + x = (long) bwb_rint (X->Number); + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* NOT */ ) + { + if (x) + { + x = -1; + } + } + + x = ~x; + + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_BOOLEAN) /* NOT */ ) + { + if (x) + { + x = 1; + } + } + + X->Number = x; + X->VariantTypeCode = min_value_type (X); + return RESULT_SUCCESS; + } + WARN_OVERFLOW; + return RESULT_ERROR; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_MAX (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + if (both_number_type (X, Y)) + { + /* X = (X MAX Y) = IIF( X < Y, Y, X ) */ + if (X->Number < Y->Number) + { + X->Number = Y->Number; + } + if (both_integer_type (X, Y)) + { + X->Number = bwb_rint (X->Number); + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + if (both_string_type (X, Y)) + { + /* X$ = ( X$ MAX Y$ ) == IIF( X$ < Y$, Y$, X$ ) */ + if (bwb_stricmp (X->Buffer, Y->Buffer) < 0) + { + RELEASE_VARIANT (X); + COPY_VARIANT (X, Y); + } + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_MIN (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + if (both_number_type (X, Y)) + { + /* X = (X MIN Y) = IIF( X > Y, Y, X ) */ + if (X->Number > Y->Number) + { + X->Number = Y->Number; + } + if (both_integer_type (X, Y)) + { + X->Number = bwb_rint (X->Number); + } + X->VariantTypeCode = math_type (X, Y); + return RESULT_SUCCESS; + } + if (both_string_type (X, Y)) + { + /* X$ = ( X$ MIN Y$ ) == IIF( X$ > Y$, Y$, X$ ) */ + if (bwb_stricmp (X->Buffer, Y->Buffer) > 0) + { + RELEASE_VARIANT (X); + COPY_VARIANT (X, Y); + } + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} + +/* +COMPARISON OPERATORS - these all return a TRUE/FALSE result in X +*/ + + +/* ------------------- equality */ + +static ResultType +test_eq (VariantType * X, VariantType * Y, int TrueValue, int FalseValue) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = IIF( X = Y, TrueValue, FalseValue ) */ + if (both_are_long (X, Y)) + { + long x; + long y; + + x = (long) bwb_rint (X->Number); + y = (long) bwb_rint (Y->Number); + + if (x == y) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + else + { + if (X->Number == Y->Number) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + + } + X->VariantTypeCode = IntegerTypeCode; + return RESULT_SUCCESS; + } + if (both_string_type (X, Y)) + { + /* X = IIF( X$ = Y$, TrueValue, FalseValue ) */ + /* NOTE: embedded NulChar terminate comparison */ + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + /* case insensitive */ + if (bwb_stricmp (X->Buffer, Y->Buffer) == 0) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + else + { + /* case sensitive */ + if (bwb_strcmp (X->Buffer, Y->Buffer) == 0) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + RELEASE_VARIANT (X); + RELEASE_VARIANT (Y); + X->VariantTypeCode = IntegerTypeCode; + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_EQ (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + return test_eq (X, Y, TRUE, FALSE); +} +static ResultType +OP_NE (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + return test_eq (X, Y, FALSE, TRUE); +} + +/* ------------------- greater */ + +static ResultType +test_gt (VariantType * X, VariantType * Y, int TrueValue, int FalseValue) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = IIF( X > Y, TrueValue, FalseValue ) */ + if (both_are_long (X, Y)) + { + long x; + long y; + + x = (long) bwb_rint (X->Number); + y = (long) bwb_rint (Y->Number); + + if (x > y) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + else + { + if (X->Number > Y->Number) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + + } + X->VariantTypeCode = IntegerTypeCode; + return RESULT_SUCCESS; + } + if (both_string_type (X, Y)) + { + /* X = IIF( X$ > Y$, TrueValue, FalseValue ) */ + /* NOTE: embedded NUL characters terminate comparison */ + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + /* case insensitive */ + if (bwb_stricmp (X->Buffer, Y->Buffer) > 0) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + else + { + /* case sensitive */ + if (bwb_strcmp (X->Buffer, Y->Buffer) > 0) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + RELEASE_VARIANT (X); + RELEASE_VARIANT (Y); + X->VariantTypeCode = IntegerTypeCode; + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_GT (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + return test_gt (X, Y, TRUE, FALSE); +} +static ResultType +OP_LE (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + return test_gt (X, Y, FALSE, TRUE); +} + +/* ------------------- lesser */ + +static ResultType +test_lt (VariantType * X, VariantType * Y, int TrueValue, int FalseValue) +{ + + assert (X != NULL); + assert (Y != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (both_number_type (X, Y)) + { + /* X = IIF( X < Y, TrueValue, FalseValue ) */ + if (both_are_long (X, Y)) + { + long x; + long y; + + x = (long) bwb_rint (X->Number); + y = (long) bwb_rint (Y->Number); + + if (x < y) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + else + { + if (X->Number < Y->Number) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + + } + X->VariantTypeCode = IntegerTypeCode; + return RESULT_SUCCESS; + } + if (both_string_type (X, Y)) + { + /* X = IIF( X$ < Y$, TrueValue, FalseValue ) */ + /* NOTE: embedded NUL characters terminate comparison */ + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + /* case insensitive */ + if (bwb_stricmp (X->Buffer, Y->Buffer) < 0) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + else + { + /* case sensitive */ + if (bwb_strcmp (X->Buffer, Y->Buffer) < 0) + { + X->Number = TrueValue; + } + else + { + X->Number = FalseValue; + } + } + RELEASE_VARIANT (X); + RELEASE_VARIANT (Y); + X->VariantTypeCode = IntegerTypeCode; + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} +static ResultType +OP_LT (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + return test_lt (X, Y, TRUE, FALSE); +} +static ResultType +OP_GE (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + return test_lt (X, Y, FALSE, TRUE); +} + +/* ------------------- like */ + +static ResultType +OP_LIKE (VariantType * X, VariantType * Y) +{ + + assert (X != NULL); + assert (Y != NULL); + if (both_string_type (X, Y)) + { + /* X = (X$ LIKE Y$) */ + int X_count; + int Y_count; + + X_count = 0; + Y_count = 0; + + if (IsLike (X->Buffer, &X_count, X->Length, + Y->Buffer, &Y_count, Y->Length)) + { + X->Number = TRUE; + } + else + { + X->Number = FALSE; + } + RELEASE_VARIANT (X); + RELEASE_VARIANT (Y); + X->VariantTypeCode = IntegerTypeCode; + return RESULT_SUCCESS; + } + WARN_TYPE_MISMATCH; + return RESULT_ERROR; +} + + +/* +-------------------------------------------------------------------------------------------- + Line Parsing Utilities +-------------------------------------------------------------------------------------------- +*/ + +static OperatorType * +buff_read_operator (char *buffer, int *position, unsigned char LastPrec, + unsigned char Arity) +{ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + p = *position; + if (bwb_isalpha (buffer[p])) + { + /* only consider alphabetic operators */ + /* spaces between any character of the operator is not allowed */ + char name[NameLengthMax + 1]; + + if (buff_read_varname (buffer, &p, name)) + { + int i; + for (i = 0; i < NUM_OPERATORS; i++) + { + OperatorType *T; + + T = &OperatorTable[i]; + if (T->OptionVersionBitmask & My->CurrentVersion->OptionVersionValue) + { + if (T->ThisPrec >= LastPrec && T->Arity == Arity + && T->IsAlpha == IS_ALPHA) + { + /* possible */ + if (bwb_stricmp (T->Name, name) == 0) + { + /* FOUND */ + *position = p; + return T; + } + } + } + } + } + } + else + { + /* only consider non-alphabetic operators */ + /* spaces between any character of the operator is allowed */ + int i; + for (i = 0; i < NUM_OPERATORS; i++) + { + OperatorType *T; + + T = &OperatorTable[i]; + if (T->OptionVersionBitmask & My->CurrentVersion->OptionVersionValue) + { + if (T->ThisPrec >= LastPrec && T->Arity == Arity + && T->IsAlpha == NO_ALPHA) + { + /* possible */ + int m; /* number of characters actually matched */ + int n; /* number of characters to match */ + int q; /* position after skipping the characters */ + + n = bwb_strlen (T->Name); /* number of characters to match */ + q = p; + + for (m = 0; m < n && buff_skip_char (buffer, &q, T->Name[m]); m++); + if (m == n) + { + /* FOUND */ + *position = q; + return T; + } + } + } + } + } + /* NOT FOUND */ + return NULL; +} + +#if FALSE /* keep line_... */ +static OperatorType * +line_read_operator (LineType * line, unsigned char LastPrec, + unsigned char Arity) +{ + + assert (line != NULL); + return buff_read_operator (line->buffer, &(line->position), LastPrec, + Arity); +} +#endif +static ResultType +buff_read_string_constant (char *buffer, int *position, VariantType * X) +{ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + p = *position; + if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + int q; /* start of constant */ + X->VariantTypeCode = StringTypeCode; + p++; /* skip leading quote */ + /* determine the length of the quoted string */ + X->Length = 0; + q = p; + while (buffer[p]) + { + if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + p++; /* quote */ + if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + /* embedded string "...""..." */ + } + else + { + /* properly terminated string "...xx..." */ + break; + } + } + X->Length++; + p++; + } + if ((X->Buffer = + (char *) calloc (X->Length + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return RESULT_ERROR; + } + /* copy the quoted string */ + X->Length = 0; + p = q; + while (buffer[p]) + { + if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + p++; /* skip quote */ + if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + /* embedded string "...""..." */ + } + else + { + /* properly terminated string "...xx..." */ + break; + } + } + X->Buffer[X->Length] = buffer[p]; + X->Length++; + p++; + } + X->Buffer[X->Length] = NulChar; + *position = p; + return RESULT_SUCCESS; + } + /* NOT FOUND */ + return RESULT_UNPARSED; +} + +#if FALSE /* keep line_... */ +static ResultType +line_read_string_constant (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_string_constant (line->buffer, &(line->position), X); +} +#endif +extern ResultType +buff_read_hexadecimal_constant (char *buffer, int *position, VariantType * X, + int IsConsoleInput) +{ + /* &h... */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + + p = *position; + if (My->CurrentVersion->OptionFlags & OPTION_BUGS_ON ) /* allows hexadecimal constants */ + { + if (buffer[p] == '&') + { + p++; /* skip '&' */ + if (bwb_tolower (buffer[p]) == 'h') + { + /* &h... */ + p++; /* skip 'h' */ + if (bwb_isxdigit (buffer[p])) + { + /* &hABCD */ + int n; /* number of characters read */ + unsigned long x; /* value read */ + + n = 0; + x = 0; + + /* if( sscanf( &buffer[ p ], "%lx%n", &x, &n ) == 1 ) */ + if (sscanf (&buffer[p], HexScanFormat, &x, &n) == 1) + { + /* FOUND */ + p += n; + + X->Number = x; + X->VariantTypeCode = min_value_type (X); + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_ON)) /* TypeSuffix allowed on constants */ + { + char TypeCode; + TypeCode = Char_to_TypeCode (buffer[p]); + switch (TypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + p++; /* skip TypeCode */ + /* verify the value actually fits in the declared type */ + X->VariantTypeCode = TypeCode; + TypeCode = Largest_TypeCode (TypeCode, X); + if (X->VariantTypeCode != TypeCode) + { + /* declared type is too small */ + if (IsConsoleInput) + { + /* + ** + ** The user will re-enter the data + ** + */ + return RESULT_UNPARSED; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + return RESULT_ERROR; + } + /* CONTINUE */ + X->VariantTypeCode = TypeCode; + } + break; + case StringTypeCode: + /* oops */ + if (IsConsoleInput) + { + /* + ** + ** The user will re-enter the data + ** + */ + return RESULT_UNPARSED; + } + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + /* break; */ + default: + X->VariantTypeCode = min_value_type (X); + } + } + *position = p; + return RESULT_SUCCESS; + } + } + /* not HEXADECIMAL */ + } + } + } + /* NOT FOUND */ + return RESULT_UNPARSED; +} + +#if FALSE /* keep line_... */ +static ResultType +line_read_hexadecimal_constant (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_hexadecimal_constant (line->buffer, &(line->position), X, + FALSE); +} +#endif +extern ResultType +buff_read_octal_constant (char *buffer, int *position, VariantType * X, + int IsConsoleInput) +{ + /* &o... */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + + p = *position; + + if (My->CurrentVersion->OptionFlags & OPTION_BUGS_ON ) /* allows octal constants */ + { + if (buffer[p] == '&') + { + p++; /* skip '&' */ + if (bwb_tolower (buffer[p]) == 'o') + { + /* &o777 */ + p++; /* skip 'o' */ + /* fall-thru */ + } + if (bwb_isodigit (buffer[p])) + { + /* &o777 */ + /* &777 */ + int n; /* number of characters read */ + unsigned long x; /* value read */ + + n = 0; + x = 0; + + /* if( sscanf( &buffer[ p ], "%64lo%n", &x, &n ) == 1 ) */ + if (sscanf (&buffer[p], OctScanFormat, &x, &n) == 1) + { + /* FOUND */ + p += n; + + X->Number = x; + X->VariantTypeCode = min_value_type (X); + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_ON)) /* TypeSuffix allowed on constants */ + { + char TypeCode; + + TypeCode = Char_to_TypeCode (buffer[p]); + switch (TypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + p++; /* skip TypeCode */ + /* verify the value actually fits in the declared type */ + X->VariantTypeCode = TypeCode; + TypeCode = Largest_TypeCode (TypeCode, X); + if (X->VariantTypeCode != TypeCode) + { + /* declared type is too small */ + if (IsConsoleInput) + { + /* + ** + ** The user will re-enter the data + ** + */ + return RESULT_UNPARSED; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + return RESULT_ERROR; + } + /* CONTINUE */ + X->VariantTypeCode = TypeCode; + } + break; + case StringTypeCode: + /* oops */ + if (IsConsoleInput) + { + /* + ** + ** The user will re-enter the data + ** + */ + return RESULT_UNPARSED; + } + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + /* break; */ + default: + X->VariantTypeCode = min_value_type (X); + } + } + *position = p; + return RESULT_SUCCESS; + } + } + } + } + /* NOT FOUND */ + return RESULT_UNPARSED; +} + +#if FALSE /* keep line_... */ +static ResultType +line_read_octal_constant (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_octal_constant (line->buffer, &(line->position), X, FALSE); +} +#endif +static ResultType +buff_read_internal_constant (char *buffer, int *position, VariantType * X) +{ + /* &... */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + + p = *position; + + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* IBM System/360 and System/370 BASIC dialects */ + if (buffer[p] == '&') + { + p++; /* skip '&' */ + if (bwb_isalpha (buffer[p])) + { + char *S; + S = &(buffer[p]); + if (bwb_strnicmp (S, "PI", 2) == 0) + { + /* &PI */ + p += 2; + X->Number = 3.14159265358979; + X->VariantTypeCode = DoubleTypeCode; + *position = p; + return RESULT_SUCCESS; + } + if (bwb_strnicmp (S, "E", 1) == 0) + { + /* &E */ + p += 1; + X->Number = 2.71828182845905; + X->VariantTypeCode = DoubleTypeCode; + *position = p; + return RESULT_SUCCESS; + } + if (bwb_strnicmp (S, "SQR2", 4) == 0) + { + /* &SQR2 */ + p += 4; + X->Number = 1.41421356237309; + X->VariantTypeCode = DoubleTypeCode; + *position = p; + return RESULT_SUCCESS; + } + /* NOT a magic word */ + } + } + } + /* NOT FOUND */ + return RESULT_UNPARSED; +} + +#if FALSE /* keep line_... */ +static ResultType +line_read_internal_constant (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_internal_constant (line->buffer, &(line->position), X); +} +#endif +extern ResultType +buff_read_decimal_constant (char *buffer, int *position, VariantType * X, + int IsConsoleInput) +{ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + + p = *position; + if (bwb_isdigit (buffer[p]) || buffer[p] == '.') + { + /* .12345 */ + /* 123.45 */ + /* 123456 */ + /* 123E45 */ + /* TODO: 'D' instead of 'E' */ + int n; /* number of characters read */ + DoubleType x; /* value read */ + + + n = 0; + x = 0; + + /* if( sscanf( &buffer[ p ], "%lg%n", &X->Number, &n ) == 1 ) */ + if (sscanf (&buffer[p], DecScanFormat, &x, &n) == 1) + { + /* FOUND */ + p += n; + + /* VerifyNumeric */ + if (isnan (x)) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + } + if (isinf (x)) + { + /* - Evaluation of an expression results in an overflow + * (nonfatal, the recommended recovery procedure is to supply + * machine in- finity with the algebraically correct sign and + * continue). */ + if (x < 0) + { + x = MINDBL; + } + else + { + x = MAXDBL; + } + if (IsConsoleInput) + { + /* + ** + ** The user will re-enter the data + ** + */ + return RESULT_UNPARSED; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + return RESULT_ERROR; + } + /* CONTINUE */ + } + /* OK */ + X->Number = x; + X->VariantTypeCode = DoubleTypeCode; /* min_value_type( X ); */ + if (My->CurrentVersion->OptionFlags & OPTION_BUGS_ON ) /* TypeSuffix allowed on constants */ + { + char TypeCode; + TypeCode = Char_to_TypeCode (buffer[p]); + switch (TypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + p++; /* skip TypeCode */ + /* verify the value actually fits in the declared type */ + X->VariantTypeCode = TypeCode; + TypeCode = Largest_TypeCode (TypeCode, X); + if (X->VariantTypeCode != TypeCode) + { + /* declared type is too small */ + if (IsConsoleInput) + { + /* + ** + ** The user will re-enter the data + ** + */ + return RESULT_UNPARSED; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + return RESULT_ERROR; + } + /* CONTINUE */ + X->VariantTypeCode = TypeCode; + } + break; + case StringTypeCode: + /* oops */ + if (IsConsoleInput) + { + /* + ** + ** The user will re-enter the data + ** + */ + return RESULT_UNPARSED; + } + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + /* break; */ + default: + X->VariantTypeCode = DoubleTypeCode; /* min_value_type( X ); */ + } + } + *position = p; + return RESULT_SUCCESS; + } + } + /* NOT FOUND */ + return RESULT_UNPARSED; +} + +#if FALSE /* keep line_... */ +static int +line_read_decimal_constant (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_decimal_constant (line->buffer, &(line->position), X, + FALSE); +} +#endif + +static ResultType +buff_read_function (char *buffer, int *position, VariantType * X) +{ + int p; + char name[NameLengthMax + 1]; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + + p = *position; + if (buff_read_varname (buffer, &p, name)) + { + if (UserFunction_name (name) || IntrinsicFunction_name (name)) + { + /* ---------------------------------------------------------------------------- */ + /* if( TRUE ) */ + { + /* here we handle some pseudo-functions that return information about arrays */ + char Xbound; + + Xbound = NulChar; + if (buff_peek_LparenChar (buffer, &p)) + { + if (bwb_stricmp (name, "DET") == 0) + { + /* N = DET( varname ) */ + /* N = DET is handled by F_DET_N */ + Xbound = 'd'; + } + else if (bwb_stricmp (name, "DIM") == 0) + { + /* N = DIM( varname ) */ + /* return total number of dimensions */ + Xbound = 'D'; + } + else if (bwb_stricmp (name, "SIZE") == 0) + { + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + /* N = SIZE( filename ) is handled by F_SIZE_A_N */ + } + else + { + /* N = SIZE( varname ) */ + /* return total number of elements */ + Xbound = 'S'; + } + } + else if (bwb_stricmp (name, "LBOUND") == 0) + { + /* N = LBOUND( varname [ , dimension ] ) */ + /* return LOWER bound */ + Xbound = 'L'; + } + else if (bwb_stricmp (name, "UBOUND") == 0) + { + /* N = UBOUND( varname [ , dimension ] ) */ + /* return UPPER bound */ + Xbound = 'U'; + } + } + if (Xbound) + { + VariableType *v; + int dimension; + char varname[NameLengthMax + 1]; + + v = NULL; + dimension = 0; /* default */ + + + if (buff_skip_LparenChar (buffer, &p) == FALSE) + { + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + } + if (buff_read_varname (buffer, &p, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + } + /* search for array */ + v = mat_find (varname); + if (v == NULL) + { + WARN_TYPE_MISMATCH; + return RESULT_ERROR; + } + if (v->dimensions == 0) + { + /* calling DET(), DIM(), SIZE(), LBOUND() or UBOUND() on a scalar is an ERROR */ + WARN_TYPE_MISMATCH; + return RESULT_ERROR; + } + switch (Xbound) + { + case 'd': /* DET() */ + case 'D': /* DIM() */ + case 'S': /* SIZE() */ + break; + case 'L': /* LBOUND() */ + case 'U': /* UBOUND() */ + if (buff_skip_seperator (buffer, &p)) + { + ResultType ResultCode; + VariantType t; + VariantType *T; + + T = &t; + ResultCode = buff_read_expr (buffer, &p, T, 1); + if (ResultCode != RESULT_SUCCESS) + { + /* ERROR */ + RELEASE_VARIANT (T); + return ResultCode; + } + if (is_string_type (T)) + { + RELEASE_VARIANT (T); + WARN_TYPE_MISMATCH; + return RESULT_ERROR; + } + T->Number = bwb_rint (T->Number); + if (T->Number < 1 || T->Number > v->dimensions) + { + WARN_TYPE_MISMATCH; + return RESULT_ERROR; + } + dimension = (int) bwb_rint (T->Number); + dimension--; /* BASIC to C */ + } + else + { + dimension = 0; /* default */ + } + break; + default: + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + /* break; */ + } + if (buff_skip_RparenChar (buffer, &p) == FALSE) + { + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + } + /* OK */ + switch (Xbound) + { + case 'd': /* DET() */ + Determinant (v); + X->Number = My->LastDeterminant; + break; + case 'D': /* DIM() */ + X->Number = v->dimensions; + break; + case 'S': /* SIZE() */ + X->Number = v->array_units; + break; + case 'L': /* LBOUND() */ + X->Number = v->LBOUND[dimension]; + break; + case 'U': /* UBOUND() */ + X->Number = v->UBOUND[dimension]; + break; + default: + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + /* break; */ + } + X->VariantTypeCode = LongTypeCode; + *position = p; + return RESULT_SUCCESS; + } + } + /* ---------------------------------------------------------------------------- */ + /* if( TRUE ) */ + { + /* it is a function */ + UserFunctionType *L; + unsigned char ParameterCount; + ParamBitsType ParameterTypes; + VariableType *argv; + VariableType *argn; + + ParameterCount = 0; + ParameterTypes = 0; + argv = var_chain (NULL); /* RETURN variable */ + argn = NULL; + + if (buff_skip_LparenChar (buffer, &p)) + { + if (buff_skip_RparenChar (buffer, &p)) + { + /* RND() */ + } + else + { + /* RND( 1, 2, 3 ) */ + do + { + ResultType ResultCode; + VariantType T; + + ResultCode = buff_read_expr (buffer, &p, &T, 1); + if (ResultCode != RESULT_SUCCESS) + { + /* ERROR */ + var_free (argv); /* free ARGV chain */ + return ResultCode; + } + /* add value to ARGV chain */ + argn = var_chain (argv); + /* 'argn' is the variable to use */ + if (is_string_type (&T)) + { + /* STRING */ + var_make (argn, StringTypeCode); + if ((argn->Value.String = + (StringType *) calloc (1, sizeof (StringType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return RESULT_ERROR; + } + PARAM_LENGTH = T.Length; + /* PARAM_BUFFER = T.Buffer; */ + if ((PARAM_BUFFER = + (char *) calloc (T.Length + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return RESULT_ERROR; + } + bwb_memcpy (PARAM_BUFFER, T.Buffer, T.Length); + PARAM_BUFFER[PARAM_LENGTH] = NulChar; + /* add type to ParameterTypes */ + if (ParameterCount < MAX_FARGS) + { + ParameterTypes |= (1 << ParameterCount); + } + } + else + { + /* NUMBER */ + var_make (argn, DoubleTypeCode); + PARAM_NUMBER = T.Number; + } + /* increment ParameterCount */ + if (ParameterCount < 255 /* (...) */ ) + { + ParameterCount++; + } + /* RELEASE_VARIANT( &T ); */ + } + while (buff_skip_seperator (buffer, &p)); + + + if (buff_skip_RparenChar (buffer, &p) == FALSE) + { + /* ERROR */ + var_free (argv); /* free ARGV chain */ + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + } + } + } + else + { + /* RND */ + } + + /* search for exact match to the function parameter signature */ + if (ParameterCount > MAX_FARGS) + { + /* FORCE (...) */ + ParameterCount = 255; /* (...) */ + ParameterTypes = 0; + } + /* did we find the correct function above? */ + L = UserFunction_find_exact (name, ParameterCount, ParameterTypes); + if (L == NULL) + { + L = UserFunction_find_exact (name, 255 /* (...) */ , 0); + } + if (L != NULL) + { + /* USER function */ + if (L->line == NULL) + { + var_free (argv); /* free ARGV chain */ + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + } + /* defaullt the return value */ + var_make (argv, L->ReturnTypeCode); + bwb_strcpy (argv->name, name); + if (VAR_IS_STRING (argv)) + { + RESULT_BUFFER = My->MaxLenBuffer; + RESULT_LENGTH = 0; + RESULT_BUFFER[RESULT_LENGTH] = NulChar; + } + else + { + RESULT_NUMBER = 0; + } + /* execute function */ + /* for all USER DEFINED FUNCTIONS: f->UniqueID == line number of DEF FN... */ + switch (L->line->cmdnum) + { + case C_DEF: /* execute a user function declared using DEF FN ...(...) = ... */ + case C_FUNCTION: /* execute a user function declared using FUNCTION ...(...) */ + case C_SUB: /* execute a user subroutine declared using SUB ...(...) */ + IntrinsicFunction_deffn (ParameterCount, argv, L); + break; + case C_DEF8LBL: /* IF ERL > label1 AND ERL < label2 THEN ... */ + if (ParameterCount > 0) + { + var_free (argv); /* free ARGV chain */ + WARN_ILLEGAL_FUNCTION_CALL; + return RESULT_ERROR; + } + /* return the line number associated with the label */ + RESULT_NUMBER = L->line->number; + break; + default: + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + var_free (argv); /* free ARGV chain */ + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + /* break; */ + } + } + else + { + /* INTRINSIC */ + IntrinsicFunctionType *f; + + f = + IntrinsicFunction_find_exact (name, ParameterCount, + ParameterTypes); + if (f == NULL) + { + /* NOT FOUND */ + f = IntrinsicFunction_find_exact (name, 255 /* (...) */ , 0); + } + if (f == NULL) + { + /* NOT FOUND */ + var_free (argv); /* free ARGV chain */ + WARN_ILLEGAL_FUNCTION_CALL; + return RESULT_ERROR; + } + /* FOUND */ + /* defaullt the return value */ + var_make (argv, f->ReturnTypeCode); + bwb_strcpy (argv->name, name); + if (VAR_IS_STRING (argv)) + { + RESULT_BUFFER = My->MaxLenBuffer; + RESULT_LENGTH = 0; + RESULT_BUFFER[RESULT_LENGTH] = NulChar; + } + else + { + RESULT_NUMBER = 0; + } + /* execute function */ + /* for all INTRINSIC FUNCTIONS: f->UniqueID == #define F_... */ + IntrinsicFunction_execute (ParameterCount, argv, f); + } + /* return results */ + X->VariantTypeCode = argv->VariableTypeCode; + if (VAR_IS_STRING (argv)) + { + if (RESULT_LENGTH > MAXLEN) + { + WARN_STRING_TOO_LONG; /* buff_read_function */ + RESULT_LENGTH = MAXLEN; + } + X->Length = RESULT_LENGTH; + if ((X->Buffer = + (char *) calloc (X->Length + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return RESULT_ERROR; + } + bwb_memcpy (X->Buffer, RESULT_BUFFER, X->Length); + X->Buffer[X->Length] = NulChar; + RESULT_BUFFER = NULL; + } + else + { + X->Number = RESULT_NUMBER; + } + /* free ARGV chain */ + var_free (argv); + /* OK */ + *position = p; + return RESULT_SUCCESS; + } + /* ---------------------------------------------------------------------------- */ + } + } + /* NOT FOUND */ + return RESULT_UNPARSED; +} + +#if FALSE /* keep line_... */ +static int +line_read_function (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_function (line->buffer, &(line->position), X); +} +#endif + + +static ResultType +buff_read_variable (char *buffer, int *position, VariantType * X) +{ + int p; + char name[NameLengthMax + 1]; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + + + p = *position; + if (buff_read_varname (buffer, &p, name)) + { + VariableType *v; + int n_params; + int pp[MAX_DIMS]; + + if (buff_peek_LparenChar (buffer, &p)) + { + /* array */ + if (buff_peek_array_dimensions (buffer, &p, &n_params) == FALSE) + { + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + } + v = var_find (name, n_params, TRUE); + } + else + { + /* scalar */ + v = var_find (name, 0, TRUE); + } + if (v == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return RESULT_ERROR; + } + if (v->dimensions > 0) + { + /* array */ + int n; + + if (buff_read_array_dimensions (buffer, &p, &n_params, pp) == FALSE) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return RESULT_ERROR; + } + for (n = 0; n < v->dimensions; n++) + { + if (pp[n] < v->LBOUND[n] || pp[n] > v->UBOUND[n]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return RESULT_ERROR; + } + v->VINDEX[n] = pp[n]; + } + } + if (var_get (v, X) == FALSE) + { + WARN_TYPE_MISMATCH; + return RESULT_ERROR; + } + *position = p; + return RESULT_SUCCESS; + } + /* NOT FOUND */ + return RESULT_UNPARSED; +} + +#if FALSE /* keep line_... */ +static int +line_read_variable (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_variable (line->buffer, &(line->position), X); +} +#endif +/* +-------------------------------------------------------------------------------------------- + Precedence Climbing Expression Parser +-------------------------------------------------------------------------------------------- +*/ + +/* +// Read an infix expression containing top-level operators that bind at least +// as tightly as the given precedence. +// Don't consume the first non-digit character after the last number. +// Complain if you can't even find the first number, +// or if there is an operator with no following number. +*/ +static ResultType +buff_read_expr (char *buffer, int *position, VariantType * X, + unsigned char LastPrec) +{ + ResultType ResultCode; + OperatorType *C; + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + + + p = *position; + bwb_memset (X, 0, sizeof (VariantType)); /* NOTE */ + + ResultCode = buff_read_primary (buffer, &p, X); + if (ResultCode != RESULT_SUCCESS) + { + return ResultCode; + } + if (X->VariantTypeCode == NulChar) + { + /* we do not know the primary's type */ + WARN_INTERNAL_ERROR; + return RESULT_ERROR; + } + buff_skip_spaces (buffer, &p); /* keep this */ + while ((C = buff_read_operator (buffer, &p, LastPrec, BINARY)) != NULL) + { + VariantType Y; + + ResultCode = buff_read_expr (buffer, &p, &Y, C->NextPrec); + if (ResultCode != RESULT_SUCCESS) + { + /* ERROR */ + if (Y.Buffer != NULL) + { + free (Y.Buffer); + Y.Buffer = NULL; + } + return ResultCode; + } + ResultCode = C->Eval (X, &Y); + if (Y.Buffer != NULL) + { + free (Y.Buffer); + Y.Buffer = NULL; + } + if (ResultCode != RESULT_SUCCESS) + { + /* ERROR */ + return ResultCode; + } + /* OK */ + } + /* + Normal termination, such as end-of-line, ',', or "THEN". + */ + *position = p; + return RESULT_SUCCESS; +} + +#if FALSE /* keep line_... */ +static ResultType +line_read_expr (LineType * line, VariantType * X, unsigned char LastPrec) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_expr (line->buffer, &(line->position), X, LastPrec); +} +#endif +static ResultType +buff_read_primary (char *buffer, int *position, VariantType * X) +{ + ResultType ResultCode; + OperatorType *C; + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_is_eol (buffer, &p)) + { + /* we expected to find something, but there is nothing here */ + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + } + /* there is something to parse */ + if (buff_skip_LparenChar (buffer, &p)) + { + /* nested expression */ + ResultCode = buff_read_expr (buffer, &p, X, 1); + if (ResultCode != RESULT_SUCCESS) + { + return ResultCode; + } + if (buff_skip_RparenChar (buffer, &p) == FALSE) + { + WARN_SYNTAX_ERROR; + return RESULT_ERROR; + } + *position = p; + return RESULT_SUCCESS; + } + /* not a nested expression */ + C = buff_read_operator (buffer, &p, 1, UNARY); + if (C != NULL) + { + ResultCode = buff_read_expr (buffer, &p, X, C->NextPrec); + if (ResultCode != RESULT_SUCCESS) + { + return ResultCode; + } + ResultCode = C->Eval (X, NULL); + if (ResultCode != RESULT_SUCCESS) + { + return ResultCode; + } + *position = p; + return RESULT_SUCCESS; + } + /* not an operator */ + ResultCode = buff_read_string_constant (buffer, &p, X); + if (ResultCode != RESULT_UNPARSED) + { + /* either OK or ERROR */ + if (ResultCode == RESULT_SUCCESS) + { + *position = p; + } + return ResultCode; + } + ResultCode = buff_read_hexadecimal_constant (buffer, &p, X, FALSE); + if (ResultCode != RESULT_UNPARSED) + { + /* either OK or ERROR */ + if (ResultCode == RESULT_SUCCESS) + { + *position = p; + } + return ResultCode; + } + ResultCode = buff_read_octal_constant (buffer, &p, X, FALSE); + if (ResultCode != RESULT_UNPARSED) + { + /* either OK or ERROR */ + if (ResultCode == RESULT_SUCCESS) + { + *position = p; + } + return ResultCode; + } + ResultCode = buff_read_internal_constant (buffer, &p, X); + if (ResultCode != RESULT_UNPARSED) + { + /* either OK or ERROR */ + if (ResultCode == RESULT_SUCCESS) + { + *position = p; + } + return ResultCode; + } + ResultCode = buff_read_decimal_constant (buffer, &p, X, FALSE); + if (ResultCode != RESULT_UNPARSED) + { + /* either OK or ERROR */ + if (ResultCode == RESULT_SUCCESS) + { + *position = p; + } + return ResultCode; + } + /* not a constant */ + ResultCode = buff_read_function (buffer, &p, X); + if (ResultCode != RESULT_UNPARSED) + { + /* either OK or ERROR */ + if (ResultCode == RESULT_SUCCESS) + { + *position = p; + } + return ResultCode; + } + /* not a function */ + ResultCode = buff_read_variable (buffer, &p, X); + /* + the variable will be implicitly created unless: + OPTION EXPLICIT ON, or + the varname matches an existing command/function/operator. + */ + if (ResultCode != RESULT_UNPARSED) + { + /* either OK or ERROR */ + if (ResultCode == RESULT_SUCCESS) + { + *position = p; + } + return ResultCode; + } + /* not a variable */ + WARN_SYNTAX_ERROR; + return RESULT_ERROR; +} + +#if FALSE /* keep line_... */ +static ResultType +line_read_primary (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_primary (line->buffer, &(line->position), X); +} +#endif + + +int +buff_read_expression (char *buffer, int *position, VariantType * X) +{ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + + p = *position; + if (buff_read_expr (buffer, &p, X, 1) == RESULT_SUCCESS) + { + switch (X->VariantTypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + case StringTypeCode: + /* OK */ + break; + default: + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + RELEASE_VARIANT (X); + WARN_INTERNAL_ERROR; + return FALSE; + /* break; */ + } + *position = p; + return TRUE; + } + RELEASE_VARIANT (X); /* NEW */ + return FALSE; +} + + +int +line_read_expression (LineType * line, VariantType * X) +{ + + assert (line != NULL); + assert (X != NULL); + return buff_read_expression (line->buffer, &(line->position), X); +} + +/* +-------------------------------------------------------------------------------------------- + BASIC commands +-------------------------------------------------------------------------------------------- +*/ + +#if FALSE /* keep line_... */ +LineType * +bwb_EVAL (LineType * line) +{ + /* + EVAL 1 + 2 + 3 + EVAL "ABC" & "DEF" + */ + ResultType ResultCode; + VariantType x; + VariantType *X; + + assert (line != NULL); + + + VX = &x; + ResultCode = line_read_expression (line, X); + if (ResultCode != RESULT_SUCCESS) + { + return (line); + } + + switch (X->VariantTypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + printf (" NUMBER: %g, %c\n", X->Number, X->VariantTypeCode); + ResetConsoleColumn (); + break; + case StringTypeCode: + printf (" STRING: %s, %c\n", X->Buffer, X->VariantTypeCode); + ResetConsoleColumn (); + break; + default: + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + break; + } + RELEASE_VARIANT (X); + return (line); +} +#endif + +LineType * +bwb_OPTION_DISABLE_OPERATOR (LineType * l) +{ + /* OPTION DISABLE OPERATOR name$ */ + int IsFound; + + assert (l != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + + IsFound = FALSE; + /* Get OPERATOR */ + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + { + /* Name */ + int i; + for (i = 0; i < NUM_OPERATORS; i++) + { + if (bwb_stricmp (Value, OperatorTable[i].Name) == 0) + { + /* FOUND */ + /* DISABLE OPERATOR */ + OperatorTable[i].OptionVersionBitmask &= + ~My->CurrentVersion->OptionVersionValue; + IsFound = TRUE; + } + } + } + free (Value); + Value = NULL; + } + if (IsFound == FALSE) + { + /* display warning message */ + fprintf (My->SYSOUT->cfp, "IGNORED: %s\n", l->buffer); + ResetConsoleColumn (); + } + return (l); +} + +LineType * +bwb_OPTION_ENABLE_OPERATOR (LineType * l) +{ + /* OPTION ENABLE OPERATOR name$ */ + int IsFound; + + assert (l != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + + + IsFound = FALSE; + /* Get OPERATOR */ + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + { + /* Name */ + int i; + for (i = 0; i < NUM_OPERATORS; i++) + { + if (bwb_stricmp (Value, OperatorTable[i].Name) == 0) + { + /* FOUND */ + /* ENABLE OPERATOR */ + OperatorTable[i].OptionVersionBitmask |= + My->CurrentVersion->OptionVersionValue; + IsFound = TRUE; + } + } + } + free (Value); + Value = NULL; + } + if (IsFound == FALSE) + { + /* display warning message */ + fprintf (My->SYSOUT->cfp, "IGNORED: %s\n", l->buffer); + ResetConsoleColumn (); + } + return (l); +} + +void +DumpOneOperatorSyntax (FILE * file, int IsXref, int n) +{ + + assert (file != NULL); + + if (n < 0 || n >= NUM_OPERATORS) + { + return; + } + /* NAME */ + { + FixDescription (file, " SYNTAX: ", OperatorTable[n].Syntax); + } + /* DESCRIPTION */ + { + + FixDescription (file, "DESCRIPTION: ", OperatorTable[n].Description); + } + /* PRECEDENCE */ + { + fprintf (file, " PRECEDENCE: %d\n", OperatorTable[n].ThisPrec); + } + /* COMPATIBILITY */ + if (IsXref) + { + int i; + fprintf (file, " VERSIONS:\n"); + for (i = 0; i < NUM_VERSIONS; i++) + { + char X; + if (OperatorTable[n].OptionVersionBitmask & bwb_vertable[i]. + OptionVersionValue) + { + /* SUPPORTED */ + X = 'X'; + } + else + { + /* NOT SUPPORTED */ + X = '_'; + } + fprintf (file, " [%c] %s\n", X, bwb_vertable[i].Name); + } + } + + fflush (file); +} + +void +DumpAllOperatorSyntax (FILE * file, int IsXref, + OptionVersionType OptionVersionValue) +{ + /* for the C maintainer */ + int n; + + assert (file != NULL); + + fprintf (file, + "============================================================\n"); + fprintf (file, + " OPERATORS \n"); + fprintf (file, + "============================================================\n"); + fprintf (file, "\n"); + fprintf (file, "\n"); + SortAllOperatorsForManual (); + for (n = 0; n < NUM_OPERATORS; n++) + { + if (OperatorTable[n].OptionVersionBitmask & OptionVersionValue) + { + fprintf (file, + "------------------------------------------------------------\n"); + DumpOneOperatorSyntax (file, IsXref, n); + } + } + SortAllOperators (); + fprintf (file, + "------------------------------------------------------------\n"); + + fprintf (file, "\n"); + fprintf (file, "\n"); + fflush (file); +} + +/* EOF */ diff --git a/bwb_fnc.c b/bwb_fnc.c new file mode 100644 index 0000000..1fb6ee5 --- /dev/null +++ b/bwb_fnc.c @@ -0,0 +1,4721 @@ +/**************************************************************** + + bwb_fnc.c Interpretation Routines + for Predefined Functions + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + + +#ifndef RAND_MAX +#define RAND_MAX 32767 +#endif /* RAND_MAX */ + +#ifndef PI +#define PI 3.14159265358979323846 +#endif /* PI */ + +#define FromDegreesToRadians( X ) ( X * PI / 180.0 ) +#define FromRadiansToDegrees( X ) ( X * 180.0 / PI ) + +#define FromGradiansToRadians( X ) ( X * PI / 200.0 ) +#define FromRadiansToGradians( X ) ( X * 200.0 / PI ) + + +static time_t t; +static struct tm *lt; + + +/* ORD() Table 1 */ + + /* ACRONYM */ +typedef struct +{ + const int Value; + const char *Name; +} Acronym; + +#define NUM_ACRONYMS (34) + +Acronym AcronymTable[NUM_ACRONYMS] = { + {0, "NUL"}, + {1, "SOH"}, + {2, "STX"}, + {3, "ETX"}, + {4, "EOT"}, + {5, "ENQ"}, + {6, "ACK"}, + {7, "BEL"}, + {8, "BS"}, + {9, "HT"}, + {10, "LF"}, + {11, "VT"}, + {12, "FF"}, + {13, "CR"}, + {14, "SO"}, + {15, "SI"}, + {16, "DLE"}, + {17, "DC1"}, + {18, "DC2"}, + {19, "DC3"}, + {20, "DC4"}, + {21, "NAK"}, + {22, "SYN"}, + {23, "ETB"}, + {24, "CAN"}, + {25, "EM"}, + {26, "SUB"}, + {27, "ESC"}, + {28, "FS"}, + {29, "GS"}, + {30, "RS"}, + {31, "US"}, + {32, "SP"}, + {127, "DEL"} +}; + +/* ... ORD() */ + + + + +extern VariableType * +IntrinsicFunction_execute (int argc, VariableType * argv, + IntrinsicFunctionType * f) +{ + /* this is the generic handler for all intrinsic BASIC functions */ + /* Follow the BASIC naming conventions, so the code is easier to read and maintain */ + + /* assign reasonable default values */ + VariableType *argn; + /* Follow the BASIC naming conventions, so the code is easier to maintain */ + char *S; /* S$ - STRING functions */ + size_t s; /* LEN( S$ ) */ + DoubleType N; /* N - NUMBER functions */ + char *A; /* A$ - 1st STRING parameter */ + size_t a; /* LEN( A$ ) */ + char *B; /* B$ - 2nd STRING parameter */ + size_t b; /* LEN( B$ ) */ +#if FALSE /* keep third parameter */ + char *C; /* C$ - 3rd STRING parameter */ + size_t c; /* LEN( C$ ) */ +#endif + DoubleType X; /* X - 1st NUMBER parameter */ + IntegerType x; /* CINT( X ) */ + DoubleType Y; /* Y - 2nd NUMBER parameter */ + IntegerType y; /* CINT( Y ) */ +#if FALSE /* keep third parameter */ + DoubleType Z; /* Z - 3rd NUMBER parameter */ + IntegerType z; /* CINT( Z ) */ +#endif + + assert (argc >= 0); + assert (argv != NULL); + assert (f != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + S = NULL; + s = 0; + N = 0; + A = NULL; + a = 0; + B = NULL; + b = 0; +#if FALSE /* keep third parameter */ + C = NULL; + c = 0; +#endif + X = 0; + x = 0; + Y = 0; + y = 0; +#if FALSE /* keep third parameter */ + Z = 0; + z = 0; +#endif + + if (f == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (argc < 0) + { + WARN_INTERNAL_ERROR; + return NULL; + } + /* the RETURN variable is the first variable in the 'argv' vaariable chain */ + if (argv == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (VAR_IS_STRING (argv)) + { + if (argv->Value.String == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (RESULT_BUFFER == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + RESULT_LENGTH = 0; + RESULT_BUFFER[RESULT_LENGTH] = NulChar; + } + else + { + if (argv->Value.Number == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + RESULT_NUMBER = 0; + } + argn = argv; + /* don't make a bad situation worse */ + if (My->IsErrorPending /* Keep This */ ) + { + /* An unrecognized NON-FATAL ERROR is pending. Just return a sane value. */ + /* LET N = LOG(SQR(X)) ' X = -1 */ + return argv; + } + /* so the following code is easier to read and maintain */ + { + /* assign actual values */ + if (f->ReturnTypeCode == StringTypeCode) + { + S = RESULT_BUFFER; + s = RESULT_LENGTH; + } + else + { + N = RESULT_NUMBER; + } + if (f->ParameterCount == 255 /* (...) */ ) + { + /* ... VARIANT number of parameters */ + } + else + { + int i; + int StrCount; /* count of STRING parameters - NEVER > 3 */ + int NumCount; /* count of NUMBER parameters - NEVER > 3 */ + ParamTestType ParameterTests; + + StrCount = 0; + NumCount = 0; + ParameterTests = f->ParameterTests; + for (i = 0; i < argc && i < MAX_TESTS && My->IsErrorPending == FALSE; + i++) + { + argn = argn->next; + if (argn == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (VAR_IS_STRING (argn)) + { + if (argn->Value.String == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + StrCount++; + switch (StrCount) + { + case 1: + /* 1st STRING parameter = A$ */ + A = PARAM_BUFFER; + a = PARAM_LENGTH; + if (StringLengthCheck (ParameterTests, a)) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + A[a] = NulChar; + } + break; + case 2: + /* 2nd STRING parameter = B$ */ + B = PARAM_BUFFER; + b = PARAM_LENGTH; + if (StringLengthCheck (ParameterTests, b)) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + B[b] = NulChar; + } + break; +#if FALSE /* keep third parameter */ + case 3: + /* 3rd STRING parameter = C$ */ + /* not currently used */ + C = PARAM_BUFFER; + c = PARAM_LENGTH; + if (StringLengthCheck (ParameterTests, c)) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + C[c] = NulChar; + } + break; +#endif + default: + /* Nth STRING parameter = ERROR */ + WARN_ILLEGAL_FUNCTION_CALL; + break; + } + } + else + { + if (argn->Value.Number == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + NumCount++; + switch (NumCount) + { + case 1: + /* 1st NUMBER parameter = X */ + X = PARAM_NUMBER; + if (NumberValueCheck (ParameterTests, X)) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + DoubleType R; + R = bwb_rint (X); + if (R < INT_MIN || R > INT_MAX) + { + /* certainly not a + * classic BASIC + * integer */ + } + else + { + /* Many classic BASIC + * intrinsic + * functions use the + * rounded integer + * value. */ + x = (int) R; + } + } + break; + case 2: + /* 2nd NUMBER parameter = Y */ + Y = PARAM_NUMBER; + if (NumberValueCheck (ParameterTests, Y)) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + DoubleType R; + R = bwb_rint (Y); + if (R < INT_MIN || R > INT_MAX) + { + /* certainly not a + * classic BASIC + * integer */ + } + else + { + /* Many classic BASIC + * intrinsic + * functions use the + * rounded integer + * value. */ + y = (int) R; + } + } + break; +#if FALSE /* keep third parameter */ + case 3: + /* 3rd NUMBER parameter = Z */ + /* not currently used */ + Z = PARAM_NUMBER; + if (NumberValueCheck (ParameterTests, Z)) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + DoubleType R; + R = bwb_rint (Z); + if (R < INT_MIN || R > INT_MAX) + { + /* certainly not a + * classic BASIC + * integer */ + } + else + { + /* Many classic BASIC + * intrinsic + * functions use the + * rounded integer + * value. */ + z = (int) R; + } + } + break; +#endif + default: + /* Nth NUMBER parameter = ERROR */ + WARN_ILLEGAL_FUNCTION_CALL; + break; + } + } + ParameterTests = ParameterTests >> 4; + } + } + } + if (My->IsErrorPending /* Keep This */ ) + { + /* An unrecognized NON-FATAL ERROR is pending. Just return a sane value. */ + /* LET N = LOG(SQR(X)) ' X = -1 */ + return argv; + } + /* + ** + ** all parameters have been checked and are OK + ** execute the intrinsic function + ** + */ + switch (f->FunctionID) + { + /* + ** + ** ALL paramters have been checked + ** for TYPE MISMATCH and INVALID RANGE. + ** ONLY A HANDFUL OF ERRORS CAN OCCUR + ** + */ + case 0: + { + /* INTERNAL ERROR */ + WARN_INTERNAL_ERROR; + } + break; + case F_ARGC_N: + /* N = ARGC */ + { + /* determine number of parameters to the current USER DEFINED FUNCTION */ + int n; + n = 0; + if (My->StackHead != NULL) + { + int Loop; + StackType *StackItem; + Loop = TRUE; + for (StackItem = My->StackHead; StackItem != NULL && Loop == TRUE; + StackItem = StackItem->next) + { + if (StackItem->LoopTopLine != NULL) + { + switch (StackItem->LoopTopLine->cmdnum) + { + case C_FUNCTION: + case C_SUB: + /* we have checked all the way to a FUNCTION or SUB boundary */ + /* FOUND */ + { + VariableType *v; + + for (v = StackItem->local_variable; v != NULL && Loop == TRUE; + v = v->next) + { + n++; + } + } + Loop = FALSE; + break; + } + } + } + } + n--; /* FUNCTION or SUB name */ + N = n; + } + break; + case F_ARGT4_X_S: + /* S$ = ARGT$( X ) */ + { + /* determine parameter type to the current USER DEFINED FUNCTION */ + int Found; + int n; + Found = FALSE; + n = 0; + s = 0; + if (x < 1) + { + /* bad param number */ + } + else if (My->StackHead != NULL) + { + int Loop; + StackType *StackItem; + Loop = TRUE; + for (StackItem = My->StackHead; StackItem != NULL && Loop == TRUE; + StackItem = StackItem->next) + { + if (StackItem->LoopTopLine != NULL) + { + switch (StackItem->LoopTopLine->cmdnum) + { + case C_FUNCTION: + case C_SUB: + /* we have checked all the way to a FUNCTION or SUB boundary */ + /* FOUND */ + { + VariableType *v; + + + for (v = StackItem->local_variable; v != NULL && Loop == TRUE; + v = v->next) + { + if (n == x) + { + char Char; + Char = TypeCode_to_Char (v->VariableTypeCode); + if (Char) + { + S[0] = Char; + s = 1; + Found = TRUE; + } + Loop = FALSE; + } + n++; + } + } + Loop = FALSE; + break; + } + } + } + } + if (Found == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + } + break; + + case F_ARGV4_X_S: + /* S$ = ARGV$( X ) */ + { + /* determine parameter value to the current + * USER DEFINED FUNCTION */ + int Found; + int n; + Found = FALSE; + n = 0; + if (x < 1) + { + /* bad param number */ + } + else if (My->StackHead != NULL) + { + int Loop; + StackType *StackItem; + Loop = TRUE; + for (StackItem = My->StackHead; StackItem != NULL && Loop == TRUE; + StackItem = StackItem->next) + { + if (StackItem->LoopTopLine != NULL) + { + switch (StackItem->LoopTopLine->cmdnum) + { + case C_FUNCTION: + case C_SUB: + /* we have checked all the way to a FUNCTION or SUB boundary */ + /* FOUND */ + { + VariableType *v; + + + for (v = StackItem->local_variable; v != NULL && Loop == TRUE; + v = v->next) + { + if (n == x) + { + if (VAR_IS_STRING (v)) + { + s = v->Value.String->length; + bwb_memcpy (S, v->Value.String->sbuffer, s); + Found = TRUE; + } + else + { + } + Loop = FALSE; + } + n++; + } + } + Loop = FALSE; + break; + } + } + } + } + if (Found == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + } + break; + + case F_ARGV_X_N: + /* S$ = ARGV( X ) */ + { + /* determine parameter value to the current USER DEFINED FUNCTION */ + int Found; + int n; + Found = FALSE; + n = 0; + if (x < 1) + { + /* bad param number */ + } + else if (My->StackHead != NULL) + { + int Loop; + StackType *StackItem; + Loop = TRUE; + for (StackItem = My->StackHead; StackItem != NULL && Loop == TRUE; + StackItem = StackItem->next) + { + if (StackItem->LoopTopLine != NULL) + { + switch (StackItem->LoopTopLine->cmdnum) + { + case C_FUNCTION: + case C_SUB: + /* we have checked all the way to a FUNCTION or SUB boundary */ + /* FOUND */ + { + VariableType *v; + + + for (v = StackItem->local_variable; v != NULL && Loop == TRUE; + v = v->next) + { + if (n == x) + { + if (VAR_IS_STRING (v)) + { + } + else + { + N = *v->Value.Number; + Found = TRUE; + } + Loop = FALSE; + } + n++; + } + } + Loop = FALSE; + break; + } + } + } + } + if (Found == FALSE) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + } + break; + case F_BASE_N: + /* N = BASE */ + { + /* PNONE */ + N = My->CurrentVersion->OptionBaseInteger; /* implicit lower bound */ + } + break; + case F_RESIDUE_N: + /* N = RESIDUE */ + { + /* PNONE */ + N = My->RESIDUE; /* Residue of the last integer divide */ + } + case F_DIGITS_X_N: + /* N = DIGITS( X ) */ + { + /* P1BYT */ + if (x == 0) + { + /* default */ + x = SIGNIFICANT_DIGITS; + } + if (x < MINIMUM_DIGITS || x > MAXIMUM_DIGITS) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + My->OptionDigitsInteger = x; + } + } + break; + case F_SCALE_X_N: + case F_PRECISION_X_N: + /* N = SCALE( X ) */ + /* N = PRECISION( X ) */ + { + /* P1BYT */ + if (x < MINIMUM_SCALE || x > MAXIMUM_SCALE) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + My->OptionScaleInteger = x; + } + } + break; + case F_DIGITS_X_Y_N: + /* N = DIGITS( X, Y ) */ + { + /* P1BYT | P2BYT */ + if (x == 0) + { + /* default */ + x = SIGNIFICANT_DIGITS; + } + if (x < MINIMUM_DIGITS || x > MAXIMUM_DIGITS) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (y < MINIMUM_SCALE || y > MAXIMUM_SCALE) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + My->OptionDigitsInteger = x; + My->OptionScaleInteger = y; + } + } + break; + case F_ASC_A_N: + case F_ASCII_A_N: + case F_CODE_A_N: + /* N = ASC( A$ ) */ + /* N = ASCII( A$ ) */ + /* N = CODE( A$ ) */ + { + /* P1BYT */ + N = A[0]; + } + break; + case F_ASC_A_X_N: + /* N = ASC( A$, X ) */ + { + /* P1BYT|P2POS */ + x--; /* BASIC -> C */ + if (x < a) + { + N = A[x]; + } + else + { + WARN_ILLEGAL_FUNCTION_CALL; + } + } + break; + case F_CDBL_X_N: + /* N = CDBL( X ) */ + { + /* P1DBL */ + N = X; + } + break; + case F_CSNG_X_N: + /* N = CSNG( X ) */ + { + /* P1FLT */ + N = X; + } + break; + case F_CCUR_X_N: + /* N = CCUR( X ) */ + { + /* P1CUR */ + N = bwb_rint (X); + } + break; + case F_CLNG_X_N: + /* N = CLNG( X ) */ + { + /* P1LNG */ + N = bwb_rint (X); + } + break; + case F_CINT_X_N: + /* N = CINT( X ) */ + { + /* P1INT */ + N = bwb_rint (X); + } + break; + case F_MKD4_X_S: + /* S$ = MKD$( X ) */ + { + /* P1DBL */ + DoubleType x; + x = (DoubleType) X; + s = sizeof (DoubleType); + bwb_memcpy (S, &x, s); + } + break; + case F_MKS4_X_S: + /* S$ = MKS$( X ) */ + { + /* P1FLT */ + SingleType x; + x = (SingleType) X; + s = sizeof (SingleType); + bwb_memcpy (S, &x, s); + } + break; + case F_MKI4_X_S: + /* S$ = MKI$( X ) */ + { + /* P1INT */ + IntegerType x; + x = (IntegerType) bwb_rint (X); + s = sizeof (IntegerType); + bwb_memcpy (S, &x, s); + } + break; + case F_MKL4_X_S: + /* S$ = MKL$( X ) */ + { + /* P1LNG */ + LongType x; + x = (LongType) bwb_rint (X); + s = sizeof (LongType); + bwb_memcpy (S, &x, s); + } + break; + case F_MKC4_X_S: + /* S$ = MKC$( X ) */ + { + /* P1CUR */ + CurrencyType x; + x = (CurrencyType) bwb_rint (X); + s = sizeof (CurrencyType); + bwb_memcpy (S, &x, s); + } + break; + case F_CVD_A_N: + /* N = CVD( A$ ) */ + { + /* P1DBL */ + DoubleType n; + a = sizeof (DoubleType); + bwb_memcpy (&n, A, a); + N = n; + } + break; + case F_CVS_A_N: + /* N = CVS( X$ ) */ + { + /* P1FLT */ + SingleType n; + a = sizeof (SingleType); + bwb_memcpy (&n, A, a); + N = n; + } + break; + case F_CVI_A_N: + /* N = CVI( X$ ) */ + { + /* P1INT */ + IntegerType n; + a = sizeof (IntegerType); + bwb_memcpy (&n, A, a); + N = n; + } + break; + case F_CVL_A_N: + /* N = CVL( X$ ) */ + { + /* P1LNG */ + LongType n; + a = sizeof (LongType); + bwb_memcpy (&n, A, a); + N = n; + } + break; + case F_CVC_A_N: + /* N = CVC( X$ ) */ + { + /* P1CUR */ + CurrencyType n; + a = sizeof (CurrencyType); + bwb_memcpy (&n, A, a); + N = n; + } + break; + case F_ENVIRON4_A_S: + /* S$ = ENVIRON$( A$ ) */ + { + /* P1BYT */ + char *CharPointer; + + CharPointer = getenv (A); + if (CharPointer == NULL) + { + /* empty string */ + } + else + { + s = bwb_strlen (CharPointer); + if (s > MAXLEN) + { + WARN_STRING_TOO_LONG; /* F_ENVIRON4_A_S */ + s = MAXLEN; + } + if (s == 0) + { + /* empty string */ + } + else + { + bwb_memcpy (S, CharPointer, s); + } + } + } + break; + case F_ENVIRON_A_N: + /* ENVIRON A$ */ + { + /* P1BYT */ + + char *CharPointer; + + CharPointer = bwb_strchr (A, '='); + if (CharPointer == NULL) + { + /* missing required '=' */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + if (putenv (A) == -1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + /* OK */ + N = 0; + } + } + } + break; + + case F_OPEN_A_X_B_Y_N: + /* OPEN "I"|"O"|"R"|"A", [#]n, filename [,rlen] */ + { + /* P1STR|P2NUM|P3STR|P4NUM */ + /* P1BYT|P2INT|P3BYT|P4INT */ + + while (*A == ' ') + { + A++; /* LTRIM$ */ + } + bwb_file_open (*A, x, B, y); + } + break; + case F_OPEN_A_X_B_N: + /* default LEN is 128 for RANDOM, 0 for all others */ + /* OPEN "I"|"O"|"R"|"A", [#]n, filename [,rlen] */ + { + /* P1STR|P2NUM|P3STR|P4NUM */ + /* P1BYT|P2INT|P3BYT|P4INT */ + y = 0; + while (*A == ' ') + { + A++; /* LTRIM$ */ + } + if (bwb_toupper (*A) == 'R') + { + /* default RANDOM record size */ + y = 128; + } + bwb_file_open (*A, x, B, y); + } + break; + case F_LOC_X_N: + /* N = LOC( X ) */ + { + /* P1INT */ + if (x <= 0) + { + /* Printer and Console */ + N = 0; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + N = 0; + } + else if (F == My->SYSOUT) + { + N = 0; + } + else if (F == My->SYSPRN) + { + N = 0; + } + else + { + FILE *fp; + fp = F->cfp; + N = ftell (fp); + if (My->CurrentVersion->OptionVersionValue & (G65 | G67 | G74)) + { + /* byte position, regardless of 'mode' */ + } + else if (F->DevMode == DEVMODE_RANDOM) + { + /* record number */ + if (F->width == 0) + { + /* byte position */ + } + else + { + N /= F->width; + } + } + else if (F->DevMode == DEVMODE_BINARY) + { + /* byte position */ + } + else + { + /* byte positiion / 128 */ + N /= 128; + } + N = floor (N); + N++; /* C to BASIC */ + } + } + } + break; + case F_SEEK_X_N: + /* N = SEEK( X ) */ + { + /* P1INT */ + if (x <= 0) + { + /* Printer and Console */ + N = 0; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + N = 0; + } + else if (F == My->SYSOUT) + { + N = 0; + } + else if (F == My->SYSPRN) + { + N = 0; + } + else + { + FILE *fp; + fp = F->cfp; + N = ftell (fp); + if (F->DevMode == DEVMODE_RANDOM) + { + /* record number */ + if (F->width > 0) + { + N /= F->width; + } + } + else + { + /* byte positiion */ + } + N = floor (N); + N++; /* C to BASIC */ + } + } + } + break; + case F_SEEK_X_Y_N: + /* SEEK X, Y */ + { + /* P1INT|P2INT */ + if (x <= 0) + { + /* Printer and Console */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSOUT) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSPRN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (y < 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + long offset; + offset = y; + offset--; /* BASIC to C */ + if (F->DevMode == DEVMODE_RANDOM) + { + if (F->width > 0) + { + offset *= F->width; + } + } + if (fseek (F->cfp, offset, SEEK_SET) != 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + /* OK */ + N = 0; + } + } + } + } + break; + case F_LOF_X_N: + /* N = LOF( X ) */ + { + /* P1INT */ + if (x <= 0) + { + /* Printer and Console */ + N = 0; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + N = 0; + } + else if (F == My->SYSOUT) + { + N = 0; + } + else if (F == My->SYSPRN) + { + N = 0; + } + else + { + /* file size in bytes */ + FILE *fp; + long current; + long total; + fp = F->cfp; + current = ftell (fp); + fseek (fp, 0, SEEK_END); + total = ftell (fp); + if (total == current) + { + /* EOF */ + } + else + { + fseek (fp, current, SEEK_SET); + } + N = total; + } + } + } + break; + case F_EOF_X_N: + /* N = EOF( X ) */ + { + /* P1INT */ + if (x <= 0) + { + /* Printer and Console */ + N = 0; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + N = 0; + } + else if (F == My->SYSOUT) + { + N = 0; + } + else if (F == My->SYSPRN) + { + N = 0; + } + else + { + /* are we at the end? */ + N = bwb_is_eof (F->cfp); + } + } + } + break; + case F_FILEATTR_X_Y_N: + /* N = FILEATTR( X, Y ) */ + { + /* P1INT|P2INT */ + + if (x <= 0) + { + /* Printer and Console */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (y == 1) + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + /* normal CLOSED file */ + N = 0; + } + else + { + /* normal OPEN file */ + N = F->DevMode; + } + } + else if (y == 2) + { + N = 0; + } + else + { + WARN_ILLEGAL_FUNCTION_CALL; + } + } + break; + case F_CLOSE_X_N: + /* CLOSE X */ + { + /* P1INT */ + if (x <= 0) + { + /* Printer and Console */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSOUT) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSPRN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + field_close_file (F); + file_clear (F); + N = 0; + } + } + } + break; + case F_RESET_N: + case F_CLOSE_N: + /* RESET */ + /* CLOSE */ + { + /* PNONE */ + FileType *F; + + for (F = My->FileHead; F != NULL; F = F->next) + { + field_close_file (F); + file_clear (F); + } + } + break; + case F_FREEFILE_N: + /* N = FREEFILE */ + { + /* PNONE */ + FileType *F; + + x = 0; + y = 0; + for (F = My->FileHead; F != NULL; F = F->next) + { + if (F->DevMode != DEVMODE_CLOSED) + { + if (F->FileNumber > x) + { + x = F->FileNumber; + } + y++; + } + } + /* 'x' is the highest FileNumber that is currently open */ + /* 'y' is the number of files that are currently open */ + x++; + if (y >= MAXDEV) + { + /* no more slots available */ + x = 0; + } + N = x; + } + break; + case F_GET_X_Y_N: + /* GET X, Y */ + { + /* P1INT|P2INT */ + if (x <= 0) + { + /* Printer and Console */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSOUT) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSPRN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F->DevMode != DEVMODE_RANDOM) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (y < 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + long offset; + offset = y; + offset--; /* BASIC to C */ + if (F->DevMode == DEVMODE_RANDOM) + { + if (F->width > 0) + { + offset *= F->width; + } + } + if (fseek (F->cfp, offset, SEEK_SET) != 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + int i; + for (i = 0; i < F->width; i++) + { + F->buffer[i] = fgetc (F->cfp); + } + field_get (F); + N = 0; + } + } + } + } + break; + case F_GET_X_N: + if (My->CurrentVersion->OptionVersionValue & (D73)) + { + /* GET( X ) == ASC(INKEY$), X is ignored */ + /* P1ANY */ + int c; + + c = fgetc (My->SYSIN->cfp); + N = c; + } + else + { + /* GET X */ + /* P1INT */ + if (x <= 0) + { + /* Printer and Console */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSOUT) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSPRN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F->DevMode != DEVMODE_RANDOM) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + { + int i; + for (i = 0; i < F->width; i++) + { + F->buffer[i] = fgetc (F->cfp); + } + field_get (F); + N = 0; + } + } + } + } + break; + case F_PUT_X_Y_N: + /* PUT X, Y */ + { + /* P1INT|P2INT */ + if (x <= 0) + { + /* Printer and Console */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSOUT) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSPRN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F->DevMode != DEVMODE_RANDOM) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (y < 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + long offset; + offset = y; + offset--; /* BASIC to C */ + if (F->DevMode == DEVMODE_RANDOM) + { + if (F->width > 0) + { + offset *= F->width; + } + } + if (fseek (F->cfp, offset, SEEK_SET) != 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + int i; + field_put (F); + for (i = 0; i < F->width; i++) + { + fputc (F->buffer[i], F->cfp); + F->buffer[i] = ' '; /* flush */ + } + N = 0; + } + } + } + } + break; + case F_PUT_X_N: + if (My->CurrentVersion->OptionVersionValue & (D73)) + { + /* PUT( X ) == PRINT CHR$(X); */ + /* P1BYT */ + fputc (x, My->SYSOUT->cfp); + N = x; + } + else + { + /* PUT X */ + /* P1INT */ + if (x <= 0) + { + /* Printer and Console */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSIN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSOUT) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F == My->SYSPRN) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (F->DevMode != DEVMODE_RANDOM) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + { + int i; + field_put (F); + for (i = 0; i < F->width; i++) + { + fputc (F->buffer[i], F->cfp); + F->buffer[i] = ' '; /* flush */ + } + N = 0; + } + } + } + } + break; + case F_WIDTH_X_N: + /* WIDTH X */ + { + /* P1BYT */ + /* console is #0 */ + My->SYSIN->width = x; + My->SYSIN->col = 1; + My->SYSOUT->width = x; + My->SYSOUT->col = 1; + N = 0; + } + break; + case F_WIDTH_X_Y_N: + /* WIDTH X, Y */ + { + /* WIDTH #file, cols */ + /* P1INT|PB2YT */ + if (x == 0) + { + My->SYSIN->width = y; + My->SYSOUT->width = y; + N = 0; + } + else if (x < 0) + { + My->SYSPRN->width = y; + N = 0; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + /* WIDTH rows, cols */ + My->SCREEN_ROWS = x; + My->SYSIN->width = y; + My->SYSIN->col = 1; + My->SYSOUT->width = y; + My->SYSOUT->col = 1; + N = 0; + } + else if (F->DevMode == DEVMODE_RANDOM) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + /* WIDTH # file, cols */ + F->width = y; + F->col = 1; + N = 0; + } + } + } + break; + case F_INSTR_X_A_B_N: + case F_INSTR_A_B_X_N: + /* N = INSTR( X, A$, B$ ) */ + /* N = INSTR( A$, B$, X ) */ + { + /* P1POS */ + if (a == 0) + { + /* empty searched */ + } + else if (b == 0) + { + /* empty pattern */ + } + else if (b > a) + { + /* pattern is longer than searched */ + } + else + { + /* search */ + int i; + int n; + n = a - b; /* last valid search position */ + n++; + + x--; /* BASIC to C */ + A += x; /* advance to the start + * position */ + for (i = x; i < n; i++) + { + if (bwb_memcmp (A, B, b) == 0) + { + /* FOU ND */ + i++; /* C to BASIC */ + N = i; + i = n; /* exit for */ + } + A++; + } + } + } + break; + case F_INSTR_A_B_N: + case F_INDEX_A_B_N: + /* N = INSTR( A$, B$ ) */ + /* N = INDEX( A$, B$ ) */ + { + if (a == 0) + { + /* empty searched */ + } + else if (b == 0) + { + /* empty pattern */ + } + else if (b > a) + { + /* pattern is longer than searched */ + } + else + { + /* search */ + int i; + int n; + n = a - b; /* last valid search + * position */ + n++; + /* search */ + for (i = 0; i < n; i++) + { + if (bwb_memcmp (A, B, b) == 0) + { + /* FOU ND */ + i++; /* C to BASIC */ + N = i; + i = n; /* exit for */ + } + A++; + } + } + } + break; + case F_SPACE4_X_S: + case F_SPACE_X_S: + case F_SPA_X_S: + /* S$ = SPACE$( X ) */ + /* S$ = SPACE( X ) */ + /* S$ = SPA( X ) */ + { + /* P1LEN */ + if (x == 0) + { + /* no copies */ + } + else + { + bwb_memset (S, (char) ' ', x); + s = x; + } + } + break; + case F_STRING4_X_Y_S: + case F_STRING_X_Y_S: + case F_STR_X_Y_S: + /* S$ = STRING$( X, Y ) */ + /* S$ = STRING( X, Y ) */ + /* S$ = STR( X, Y ) */ + { + /* P1LEN|P2BYT */ + if (x == 0) + { + /* no copies */ + } + else + { + bwb_memset (S, (char) y, x); + s = x; + } + } + break; + case F_STRING4_X_A_S: + /* S$ = STRING$( X, A$ ) */ + { + /* P1LEN|P2BYT */ + if (x == 0) + { + /* no copies */ + } + else + { + bwb_memset (S, (char) A[0], x); + s = x; + } + } + break; + case F_LIN_X_S: + /* S$ = LIN( X ) */ + { + /* P1LEN */ + if (x == 0) + { + /* no copies */ + } + else + { + bwb_memset (S, (char) '\n', x); + s = x; + } + } + break; + case F_MID4_A_X_S: + case F_MID_A_X_S: + /* S$ = MID$( A$, X ) */ + /* S$ = MID( A$, X ) */ + { + /* P1ANY|P2POS */ + if (a == 0) + { + /* empty string */ + } + else if (x > a) + { + /* start beyond length */ + } + else + { + x--; /* BASIC to C */ + a -= x; /* nummber of characters to + * copy */ + A += x; /* pointer to first character + * to copy */ + bwb_memcpy (S, A, a); + s = a; + } + } + break; + case F_MID4_A_X_Y_S: + case F_MID_A_X_Y_S: + case F_SEG4_A_X_Y_S: + case F_SEG_A_X_Y_S: + /* S$ = MID$( A$, X, Y ) */ + /* S$ = MID( A$, X, Y ) */ + /* S$ = SEG$( A$, X, Y ) */ + /* S$ = SEG( A$, X, Y ) */ + { + /* P1ANY|P2POS|P3LEN */ + if (a == 0) + { + /* empty string */ + } + else if (x > a) + { + /* start beyond length */ + } + else if (y == 0) + { + /* empty string */ + } + else + { + x--; /* BASIC to C */ + a -= x; + /* maximum nummber of characters to + * copy */ + a = MIN (a, y); + A += x; + /* pointer to first character to copy */ + bwb_memcpy (S, A, a); + s = a; + } + } + break; + case F_LEFT4_A_X_S: + case F_LEFT_A_X_S: + /* S$ = LEFT$( A$, X ) */ + /* S$ = LEFT( A$, X ) */ + { + /* P1ANY|P2LEN */ + if (a == 0) + { + /* empty string */ + } + else if (x == 0) + { + /* empty string */ + } + else + { + a = MIN (a, x); + bwb_memcpy (S, A, a); + s = a; + } + } + break; + case F_RIGHT4_A_X_S: + case F_RIGHT_A_X_S: + /* S$ = RIGHT$( A$, X ) */ + /* S$ = RIGHT( A$, X ) */ + { + /* P1ANY|P2LEN */ + if (a == 0) + { + /* empty string */ + } + else if (x == 0) + { + /* empty string */ + } + else + { + x = MIN (a, x); + A += a; + A -= x; + bwb_memcpy (S, A, x); + s = x; + } + } + break; + case F_HEX_A_N: + /* N = HEX( A$ ) */ + { + if (a == 0) + { + /* empty string */ + } + else + { + N = strtoul (A, (char **) NULL, 16); + } + } + break; + case F_HEX4_X_S: + /* S$ = HEX$( X ) */ + { + /* P1NUM */ + /* P1INT */ + sprintf (S, "%X", x); + s = bwb_strlen (S); + } + break; + case F_HEX4_X_Y_S: + /* S$ = HEX$( X, Y ) */ + { + /* P1NUM | P2NUM */ + /* P1INT | P2BYT */ + if (y == 0) + { + /* empty string */ + } + else + { + sprintf (S, "%0*X", y, x); + s = bwb_strlen (S); + if (y < s) + { + A = S; + a = s - y; /* number of characters to trim */ + A += a; + bwb_strcpy (S, A); + } + } + } + break; + case F_OCT4_X_S: + /* S$ = OCT$( X ) */ + { + /* P1NUM */ + /* P1INT */ + sprintf (S, "%o", x); + s = bwb_strlen (S); + } + break; + case F_OCT4_X_Y_S: + /* S$ = OCT$( X, Y ) */ + { + /* P1NUM | P2NUM */ + /* P1INT | P2BYT */ + if (y == 0) + { + /* empty string */ + } + else + { + sprintf (S, "%0*o", y, x); + s = bwb_strlen (S); + if (y < s) + { + A = S; + a = s - y; /* number of characters to trim */ + A += a; + bwb_strcpy (S, A); + } + } + } + break; + case F_BIN4_X_S: + /* S$ = BIN$( X ) */ + { + /* P1NUM */ + /* P1INT */ + /* + ** + ** we break this problem into two parts: + ** 1. generate the default string + ** 2. trim leading zeroes on the left + ** + */ + unsigned long z; + z = (unsigned long) x; + A = My->NumLenBuffer; + a = sizeof (z) * CHAR_BIT; + s = a; + bwb_memset (A, '0', a); + A[a] = NulChar; + while (a) + { + /* look at the Least Significant Bit */ + a--; + if (z & 1) + { + A[a] = '1'; + } + z /= 2; + } + /* bwb_strcpy( S, A ); */ + /* same as HEX$(X) and OCT$(X), trim leading zeroes */ + while (*A == '0') + { + A++; + } + if (*A) + { + bwb_strcpy (S, A); + } + else + { + /* special case (x == 0), we trimmed all the zeroes above */ + S[0] = '0'; + s = 1; + } + } + break; + case F_BIN4_X_Y_S: + /* S$ = BIN$( X, Y ) */ + { + /* P1NUM | P2NUM */ + /* P1INT | P2BYT */ + /* + ** + ** we break this problem into two parts: + ** 1. generate the default string + ** 2. pad or trim on the left + ** + */ + if (y == 0) + { + /* empty string */ + } + else + { + unsigned long z; + z = (unsigned long) x; + A = My->NumLenBuffer; + a = sizeof (z) * CHAR_BIT; + s = a; + bwb_memset (A, '0', a); + A[a] = NulChar; + while (a) + { + /* look at the Least Significant Bit */ + a--; + if (z & 1) + { + A[a] = '1'; + } + z /= 2; + } + /* bwb_strcpy( S, A ); */ + if (y > s) + { + /* pad left */ + a = y - s; /* number of characters to pad (at least one) */ + bwb_memset (S, '0', a); + S[a] = NulChar; + bwb_strcat (S, A); + } + else + { + /* trim left (y <= s) */ + a = s - y; /* number of characters to trim (may be zero) */ + A += a; + bwb_strcpy (S, A); + } + s = y; + } + } + break; + case F_EDIT4_A_X_S: + /* S$ = EDIT$( A$, X ) */ + { + /* P1ANY|P2INT */ + if (x < 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (a == 0) + { + /* empty string */ + } + else if (x == 0) + { + /* no changes */ + bwb_memcpy (S, A, a); + s = a; + } + else + { + int n; + char IsSuppress; + char LastC; + n = a; + a = 0; + IsSuppress = NulChar; + LastC = NulChar; + + if (x & 8) + { + /* discard leading spaces and tabs */ + while (A[a] == ' ' || A[a] == '\t') + a++; + } + while (a < n) + { + char C; + + C = A[a]; + if (x & 256) + { + /* + ** suppress editing for characters within quotes. + */ + if (IsSuppress) + { + if (C == IsSuppress) + IsSuppress = NulChar; + goto VERBATIM; + } + if (C == '"') + { + IsSuppress = C; + goto VERBATIM; + } + if (C == '\'') + { + IsSuppress = C; + goto VERBATIM; + } + } + /* edit the character */ + if (x & 1) + { + /* discard parity bit */ + C = C & 0x7F; + } + if (x & 2) + { + /* discard all spaces and tabs */ + if (C == ' ') + goto SKIP; + if (C == '\t') + goto SKIP; + } + if (x & 4) + { + /* discard all carriage returns, line feeds, form feeds, deletes, escapes and nulls */ + if (C == '\r') + goto SKIP; + if (C == '\n') + goto SKIP; + if (C == '\f') + goto SKIP; + if (C == 127) + goto SKIP; + if (C == 26) + goto SKIP; + if (C == 0) + goto SKIP; + } + if (x & 16) + { + /* convert multiple spaces and tabs to one space */ + if (C == '\t') + C = ' '; + if (C == ' ' && LastC == ' ') + goto SKIP; + } + if (x & 32) + { + /* convert lower case to upper case */ + C = bwb_toupper (C); + } + if (x & 64) + { + /* convert left brackets to left parentheses and right brackes to right parentheses */ + if (C == '[') + C = '('; + if (C == ']') + C = ')'; + } + /* save results of editing */ + VERBATIM: + S[s] = C; + s++; + SKIP: + LastC = C; + a++; + } + if (x & 128) + { + /* discard trailing spaces and tabs */ + while (s > 0 && (S[s - 1] == ' ' || S[s - 1] == '\t')) + s--; + } + } + } + break; + case F_CHR_X_S: + case F_CHR4_X_S: + case F_CHAR4_X_S: + /* S$ = CHR( X ) */ + /* S$ = CHR$( X ) */ + /* S$ = CHAR$( X ) */ + + /* P1ANY */ + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* IBM System/360 & System/370 BASIC dialects: the opposite of N = NUM( A$ ) */ + FormatBasicNumber (X, S); + s = bwb_strlen (S); + } + else + { + if (x < MINBYT || x > MAXBYT) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + S[0] = (char) x; + s = 1; + } + } + break; + case F_CHAR_X_Y_S: + /* S$ = CHAR( X, Y ) ' same as STRING$(Y,X) */ + { + /* P1BYT|P2LEN */ + if (y == 0) + { + /* no copies */ + } + else + { + bwb_memset (S, (char) x, y); + s = y; + } + } + break; + case F_LEN_A_N: + /* N = LEN( A$ ) */ + { + N = a; + } + break; + case F_POS_A_B_N: + /* N = POS( A$, B$ ) */ + { + if (b == 0) + { + /* empty pattern */ + N = 1; + } + else if (a == 0) + { + /* empty searched */ + } + else if (b > a) + { + /* pattern is longer than searched */ + } + else + { + /* search */ + int i; + int n; + n = a - b; /* last valid search + * position */ + n++; + /* search */ + for (i = 0; i < n; i++) + { + if (bwb_memcmp (A, B, b) == 0) + { + /* FOU ND */ + i++; /* C to BASIC */ + N = i; + i = n; /* exit for */ + } + A++; + } + } + } + break; + case F_MATCH_A_B_X_N: + /* N = POS( A$, B$, X ) */ + { + N = str_match (A, a, B, b, x); + } + break; + case F_POS_A_B_X_N: + /* N = POS( A$, B$, X ) */ + { + if (b == 0) + { + /* empty pattern */ + N = 1; + } + else if (a == 0) + { + /* empty searched */ + } + else if (b > a) + { + /* pattern is longer than searched */ + } + else + { + /* search */ + int i; + int n; + n = a - b; /* last valid search position */ + n++; + + /* search */ + x--; /* BASIC to C */ + A += x; /* advance to the start + * position */ + for (i = x; i < n; i++) + { + if (bwb_memcmp (A, B, b) == 0) + { + /* FOUND */ + N = i + 1; /* C to BASIC */ + i = n; /* exit for */ + } + A++; + } + } + } + break; + case F_VAL_A_N: + case F_NUM_A_N: + /* N = VAL( A$ ) */ + /* N = NUM( A$ ) */ + { + /* P1ANY */ + int n; /* number of characters read */ + DoubleType Value; + + n = 0; + if (sscanf (A, DecScanFormat, &Value, &n) == 1) + { + /* OK */ + N = Value; + } + else + { + /* not a number */ + if (My->CurrentVersion->OptionFlags & OPTION_BUGS_ON ) /* VAL("X") = 0 */ + { + /* IGNORE */ + N = 0; + } + else + { + /* ERROR */ + WARN_ILLEGAL_FUNCTION_CALL; + } + } + } + break; + case F_STR4_X_S: + case F_NUM4_X_S: + /* S$ = STR$( X ) */ + /* S$ = NUM$( X ) */ + { + /* P1ANY */ + FormatBasicNumber (X, S); + s = bwb_strlen (S); + } + break; + case F_DATE_N: + /* N = DATE ' YYYYDDD */ + { + /* PNONE */ + + /* ECMA-116 */ + time (&t); + lt = localtime (&t); + N = lt->tm_year; + N *= 1000; + N += lt->tm_yday; + N += 1; + } + break; + case F_DATE4_X_S: + case F_DATE4_S: + case F_DAT4_S: + /* S$ = DATE$( X ) ' value of X is ignored */ + /* S$ = DATE$ */ + /* S$ = DAT$ */ + { + /* PNONE */ + if (!is_empty_string (My->CurrentVersion->OptionDateFormat)) + { + time (&t); + lt = localtime (&t); + s = strftime (S, MAXLEN, My->CurrentVersion->OptionDateFormat, lt); + } + } + break; + case F_CLK_X_S: + case F_CLK4_S: + case F_TI4_S: + case F_TIME4_S: + case F_TIME4_X_S: + /* S$ = CLK(X) ' the value of paameter X is ignored */ + /* S$ = CLK$ */ + /* S$ = TI$ */ + /* S$ = TIME$ */ + /* S$ = TIME$(X) ' the value of paameter X is ignored */ + { + /* PNONE */ + if (!is_empty_string (My->CurrentVersion->OptionTimeFormat)) + { + time (&t); + lt = localtime (&t); + s = strftime (S, MAXLEN, My->CurrentVersion->OptionTimeFormat, lt); + } + } + break; + case F_TI_N: + case F_TIM_N: + case F_TIME_N: + case F_TIME_X_N: + case F_TIMER_N: + /* N = TI */ + /* N = TIM */ + /* N = TIME */ + /* N = TIME( X ) ' value of X is ignored */ + /* N = TIMER */ + /* N = CPU */ + { + /* PNONE */ + time (&t); + lt = localtime (&t); + if (My->CurrentVersion->OptionVersionValue & (G67 | G74)) + { + N = lt->tm_hour; + N *= 60; + N += lt->tm_min; + N *= 60; + N += lt->tm_sec; + /* number of seconds since midnight */ + N -= My->StartTimeInteger; + /* elapsed run time */ + } + else + { + N = lt->tm_hour; + N *= 60; + N += lt->tm_min; + N *= 60; + N += lt->tm_sec; + /* number of seconds since midnight */ + } + } + break; + case F_CLK_X_N: + /* N = CLK( X ) ' value of X is ignored */ + { + /* PNONE */ + time (&t); + lt = localtime (&t); + N = lt->tm_hour; + N *= 60; + N += lt->tm_min; + N *= 60; + N += lt->tm_sec; + N /= 3600; + /* decimal hours: 3:30 PM = 15.50 */ + } + break; + + case F_TIM_X_N: + /* N = TIM( X ) */ + { + /* P1BYT */ + time (&t); + lt = localtime (&t); + + if (My->CurrentVersion->OptionVersionValue & (G65 | G67 | G74)) + { + /* value of 'X' is ignored */ + N = lt->tm_hour; + N *= 60; + N += lt->tm_min; + N *= 60; + N += lt->tm_sec; + /* number of seconds since midnight */ + N -= My->StartTimeInteger; + /* elapsed run time */ + } + else + { + switch (x) + { + case 0: + /* TIM(0) == minute (0..59) */ + N += lt->tm_min; + break; + case 1: + /* TIM(1) == hour (0..23) */ + N = lt->tm_hour; + break; + case 2: + /* TIM(2) == day of year (1..366) */ + N = 1 + lt->tm_yday; + break; + case 3: + /* TIM(3) == year since 1900 (0..) */ + N = lt->tm_year; + break; + default: + WARN_ILLEGAL_FUNCTION_CALL; + } + } + } + break; + case F_COMMAND4_S: + /* S$ = COMMAND$ */ + { + S[0] = NulChar; + for (x = 0; x < 10 && My->COMMAND4[x] != NULL; x++) + { + if (x > 0) + { + bwb_strcat (S, " "); + } + bwb_strcat (S, My->COMMAND4[x]); + } + s = bwb_strlen (S); + } + break; + case F_COMMAND4_X_S: + /* S$ = COMMAND$(X) */ + if (x < 0 || x > 9) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + if (My->COMMAND4[x] == NULL) + { + s = 0; + } + else + { + bwb_strcpy (S, My->COMMAND4[x]); + s = bwb_strlen (My->COMMAND4[x]); + } + } + break; + case F_COSH_X_N: + case F_CSH_X_N: + case F_HCS_X_N: + /* N = COSH( X ) */ + /* N = CSH( X ) */ + /* N = HCS( X ) */ + { + /* P1ANY */ + N = cosh (X); + } + break; + case F_SINH_X_N: + case F_SNH_X_N: + case F_HSN_X_N: + /* N = SINH( X ) */ + /* N = SNH( X ) */ + /* N = HSN( X ) */ + { + /* P1ANY */ + N = sinh (X); + } + break; + case F_TANH_X_N: + case F_HTN_X_N: + /* N = TANH( X ) */ + /* N = HTN( X ) */ + { + /* P1ANY */ + N = tanh (X); + } + break; + case F_CLG_X_N: + case F_CLOG_X_N: + case F_LOG10_X_N: + case F_LGT_X_N: + /* N = CLG( X ) */ + /* N = CLOG( X ) */ + /* N = LOG10( X ) */ + /* N = LGT( X ) */ + { + /* P1GTZ */ + N = log10 (X); + } + break; + case F_SLEEP_X_N: + case F_WAIT_X_N: + case F_PAUSE_X_N: + /* N = SLEEP( X ) */ + /* N = WAIT( X ) */ + /* N = PAUSE( X ) */ + { + /* P1ANY */ + X = X * My->OptionSleepDouble; + if (X <= 0 || X > MAXINT) + { + /* do nothing */ + } + else + { + x = (int) bwb_rint (X); + sleep (x); + } + } + break; + case F_LOG2_X_N: + case F_LTW_X_N: + /* N = LOG2( X ) */ + /* N = LTW( X ) */ + { + /* P1GTZ */ + N = log (X) / log ((DoubleType) 2); + } + break; + case F_ACOS_X_N: + case F_ACS_X_N: + case F_ARCCOS_X_N: + /* N = ACOS( X ) */ + /* N = ACS( X ) */ + /* N = ARCCOS( X ) */ + { + /* P1ANY */ + if (X < -1 || X > 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = acos (X); + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + N = FromRadiansToDegrees (N); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + N = FromRadiansToGradians (N); + } + } + } + break; + case F_ACSD_X_N: + /* N = ACSD( X ) */ + { + /* P1ANY */ + if (X < -1 || X > 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = acos (X); + /* result is always in DEGREES, regardless of OPTION ANGLE setting */ + N = FromRadiansToDegrees (N); + } + } + break; + case F_ACSG_X_N: + /* N = ACSG( X ) */ + { + /* P1ANY */ + if (X < -1 || X > 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = acos (X); + /* result is always in GRADIANS, regardless of OPTION ANGLE setting */ + N = FromRadiansToGradians (N); + } + } + break; + + case F_ASIN_X_N: + case F_ASN_X_N: + case F_ARCSIN_X_N: + /* N = ASIN( X ) */ + /* N = ASN( X ) */ + /* N = ARCSIN( X ) */ + { + /* P1ANY */ + if (X < -1 || X > 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = asin (X); + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + N = FromRadiansToDegrees (N); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + N = FromRadiansToGradians (N); + } + } + } + break; + + + case F_ASND_X_N: + /* N = ASND( X ) */ + { + /* P1ANY */ + if (X < -1 || X > 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = asin (X); + /* result is always in DEGREES, regardless of OPTION ANGLE setting */ + N = FromRadiansToDegrees (N); + } + } + break; + case F_ASNG_X_N: + /* N = ASNG( X ) */ + { + /* P1ANY */ + if (X < -1 || X > 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = asin (X); + /* result is always in GRADIANS, regardless of OPTION ANGLE setting */ + N = FromRadiansToGradians (N); + } + } + break; + + + case F_COT_X_N: + /* N = COT( X ) ' = 1 / TAN( X ) */ + { + /* P1ANY */ + DoubleType T; + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + X = FromDegreesToRadians (X); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + X = FromGradiansToRadians (X); + } + T = tan (X); + if (T == 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = 1.0 / T; + } + } + break; + case F_CSC_X_N: + /* N = CSC( X ) ' = 1 / SIN( X ) */ + { + /* P1ANY */ + DoubleType T; + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + X = FromDegreesToRadians (X); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + X = FromGradiansToRadians (X); + } + T = sin (X); + if (T == 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = 1.0 / T; + } + } + break; + case F_SEC_X_N: + /* N = SEC( X ) ' = 1 / COS( X ) */ + { + /* P1ANY */ + DoubleType T; + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + X = FromDegreesToRadians (X); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + X = FromGradiansToRadians (X); + } + T = cos (X); + if (T == 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = 1.0 / T; + } + } + break; + case F_UCASE4_A_S: + case F_UPPER4_A_S: + /* S$ = UCASE$( A$ ) */ + /* S$ = UPPER$( A$ ) */ + { + /* P1ANY */ + if (a == 0) + { + /* empty string */ + } + else + { + int i; + bwb_memcpy (S, A, a); + s = a; + /* BASIC allows embedded NULL + * characters */ + for (i = 0; i < a; i++) + { + S[i] = bwb_toupper (S[i]); + } + } + } + break; + case F_LCASE4_A_S: + case F_LOWER4_A_S: + /* S$ = LCASE$( A$ ) */ + /* S$ = LOWER$( A$ ) */ + { + /* P1ANY */ + if (a == 0) + { + /* empty string */ + } + else + { + int i; + bwb_memcpy (S, A, a); + s = a; + /* BASIC allows embedded NULL + * characters */ + for (i = 0; i < a; i++) + { + S[i] = bwb_tolower (S[i]); + } + } + } + break; + case F_ANGLE_X_Y_N: + /* N = ANGLE( X, Y ) */ + { + /* P1ANY|P2ANY */ + if (X == 0 && Y == 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = atan2 (Y, X); + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + N = FromRadiansToDegrees (N); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + N = FromRadiansToGradians (N); + } + } + } + break; + case F_CEIL_X_N: + /* N = CEIL( X ) */ + { + /* P1ANY */ + N = ceil (X); + } + break; + case F_DET_N: + /* N = DET */ + { + /* PNONE */ + N = My->LastDeterminant; + } + break; + case F_NUM_N: + /* N = NUM */ + { + /* PNONE */ + N = My->LastInputCount; + } + break; + case F_DEG_N: + case F_DEGREE_N: + /* N = DEG */ + /* N = DEGREE */ + { + /* PNONE */ + My->CurrentVersion->OptionFlags |= OPTION_ANGLE_DEGREES; + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_GRADIANS; + N = 0; + } + break; + case F_RAD_N: + case F_RADIAN_N: + /* N = RAD */ + /* N = RADIAN */ + { + /* PNONE */ + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_DEGREES; + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_GRADIANS; + N = 0; + } + break; + case F_GRAD_N: + case F_GRADIAN_N: + /* N = GRAD */ + /* N = GRADIAN */ + { + /* PNONE */ + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_DEGREES; + My->CurrentVersion->OptionFlags |= OPTION_ANGLE_GRADIANS; + N = 0; + } + break; + case F_DEG_X_N: + case F_DEGREE_X_N: + /* N = DEG( X ) */ + /* N = DEGREE( X ) */ + { + /* P1ANY */ + if (My->CurrentVersion->OptionVersionValue & (R86)) + { + if (x == 0) + { + /* DEG 0 */ + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_DEGREES; + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_GRADIANS; + } + else + { + /* DEG 1 */ + My->CurrentVersion->OptionFlags |= OPTION_ANGLE_DEGREES; + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_GRADIANS; + } + N = 0; + } + else + { + N = FromRadiansToDegrees (X); + } + } + break; + case F_RAD_X_N: + /* N = RAD( X ) */ + { + /* P1ANY */ + N = FromDegreesToRadians (X); + } + break; + case F_PI_N: + /* N = PI */ + { + /* PNONE */ + N = PI; + } + break; + case F_PI_X_N: + /* N = PI(X) */ + { + /* P1ANY */ + N = PI * X; + } + break; + case F_LTRIM4_A_S: + /* S$ = LTRIM$( A$ ) */ + { + /* P1ANY */ + if (a == 0) + { + /* empty string */ + } + else + { + int i; + /* BASIC allows embedded NULL characters */ + for (i = 0; i < a && A[i] == ' '; i++) + { + /* skip spaces */ + } + /* 'A[ i ]' is first non-space character */ + if (i >= a) + { + /* empty string */ + } + else + { + A += i; + a -= i; + bwb_memcpy (S, A, a); + s = a; + } + } + } + break; + case F_RTRIM4_A_S: + /* S$ = RTRIM$( A$ ) */ + { + /* P1ANY */ + if (a == 0) + { + /* empty string */ + } + else + { + int i; + /* BASIC allows embedded NULL characters */ + for (i = a - 1; i >= 0 && A[i] == ' '; i--) + { + /* skip spaces */ + } + /* 'A[ i ]' is last non-space character */ + if (i < 0) + { + /* empty string */ + } + else + { + a = i + 1; + bwb_memcpy (S, A, a); + s = a; + } + } + } + break; + case F_STRIP4_A_S: + /* S$ = STRIP$( A$ ) */ + { + /* P1ANY */ + if (a == 0) + { + /* empty string */ + } + else + { + int i; + for (i = 0; i < a; i++) + { + S[i] = A[i] & 0x7F; + } + s = a; + S[s] = NulChar; + } + } + break; + case F_TRIM4_A_S: + /* S$ = TRIM$( A$ ) */ + { + /* P1ANY */ + if (a == 0) + { + /* empty string */ + } + else + { + /* + ** + ** LTRIM + ** + */ + int i; + /* BASIC allows embedded NULL characters */ + for (i = 0; i < a && A[i] == ' '; i++) + { + /* skip spaces */ + } + /* 'A[ i ]' is first non-space character */ + if (i >= a) + { + /* empty string */ + } + else + { + A += i; + a -= i; + bwb_memcpy (S, A, a); + s = a; + /* + ** + ** RTRIM + ** + */ + A = S; + a = s; + if (a == 0) + { + /* empty string */ + } + else + { + int i; + /* BASIC allows embedded NULL characters */ + for (i = a - 1; i >= 0 && A[i] == ' '; i--) + { + /* skip spaces */ + } + /* 'A[ i ]' is last non-space character */ + if (i < 0) + { + /* empty string */ + } + else + { + a = i + 1; + /* bwb_memcpy( S, A, a ); */ + s = a; + } + } + } + } + } + break; + case F_MAX_X_Y_N: + /* N = MAX( X, Y ) */ + { + N = MAX (X, Y); + } + break; + case F_MAX_A_B_S: + /* S$ = MAX( A$, B$ ) */ + { + StringType L; + StringType R; + + L.length = a; + R.length = b; + L.sbuffer = A; + R.sbuffer = B; + if (str_cmp (&L, &R) >= 0) + { + /* A >= B */ + bwb_memcpy (S, A, a); + s = a; + } + else + { + /* A < B */ + bwb_memcpy (S, B, b); + s = b; + } + } + break; + case F_MIN_X_Y_N: + /* N = MIN( X, Y ) */ + { + N = MIN (X, Y); + } + break; + case F_MIN_A_B_S: + /* S$ = MIN( A$, B$ ) */ + { + StringType L; + StringType R; + + L.length = a; + R.length = b; + L.sbuffer = A; + R.sbuffer = B; + if (str_cmp (&L, &R) <= 0) + { + /* A <= B */ + bwb_memcpy (S, A, a); + s = a; + } + else + { + /* A > B */ + bwb_memcpy (S, B, b); + s = b; + } + } + break; + case F_FP_X_N: + case F_FRAC_X_N: + /* N = FP( X ) */ + /* N = FRAC( X ) */ + { + DoubleType FP; + DoubleType IP; + FP = modf (X, &IP); + N = FP; + } + break; + case F_IP_X_N: + /* N = IP( X ) */ + { + DoubleType IP; + modf (X, &IP); + N = IP; + } + break; + case F_EPS_X_N: + /* N = EPS( Number ) */ + { + N = DBL_MIN; + } + break; + case F_MAXLVL_N: + /* N = MAXLVL */ + { + N = EXECLEVELS; + } + break; + case F_MAXNUM_N: + /* N = MAXNUM */ + { + N = MAXDBL; + } + break; + case F_MINNUM_N: + /* N = MINNUM */ + { + N = MINDBL; + } + break; + case F_MAXDBL_N: + /* N = MAXDBL */ + { + N = MAXDBL; + } + break; + case F_MINDBL_N: + /* N = MINDBL */ + { + N = MINDBL; + } + break; + case F_MAXSNG_N: + /* N = MAXSNG */ + { + N = MAXSNG; + } + break; + case F_MINSNG_N: + /* N = MINSNG */ + { + N = MINSNG; + } + break; + case F_MAXCUR_N: + /* N = MAXCUR */ + { + N = MAXCUR; + } + break; + case F_MINCUR_N: + /* N = MINCUR */ + { + N = MINCUR; + } + break; + case F_MAXLNG_N: + /* N = MAXLNG */ + { + N = MAXLNG; + } + break; + case F_MINLNG_N: + /* N = MINLNG */ + { + N = MINLNG; + } + break; + case F_MAXINT_N: + /* N = MAXINT */ + { + N = MAXINT; + } + break; + case F_MININT_N: + /* N = MININT */ + { + N = MININT; + } + break; + case F_MAXBYT_N: + /* N = MAXBYT */ + { + N = MAXBYT; + } + break; + case F_MINBYT_N: + /* N = MINBYT */ + { + N = MINBYT; + } + break; + case F_MAXDEV_N: + /* N = MAXDEV */ + { + N = MAXDEV; + } + break; + case F_MINDEV_N: + /* N = MINDEV */ + { + N = MINDEV; + } + break; + + case F_MOD_X_Y_N: + /* N = MOD( X, Y ) */ + { + /* P1ANY|P2NEZ */ + DoubleType IP; + + IP = floor (X / Y); + N = X - (Y * IP); + } + break; + case F_REMAINDER_X_Y_N: + /* REMAINDER( X, Y ) */ + { + /* P1ANY|P2NEZ */ + DoubleType Value; + DoubleType IP; + + Value = X / Y; + modf (Value, &IP); + N = X - (Y * IP); + } + break; + case F_ROUND_X_Y_N: + /* N = ROUND( X, Y ) == INT(X*10^Y+.5)/10^Y */ + { + /* P1ANY | P2INT */ + if (y < -32 || y > 32) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + DoubleType T; /* 10^Y */ + + T = pow (10.0, Y); + if (T == 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = floor (X * T + 0.5) / T; + } + } + } + break; + case F_TRUNCATE_X_Y_N: + /* N = TRUNCATE( X, Y ) == INT(X*10^Y)/10^Y */ + { + /* P1ANY | P2INT */ + if (y < -32 || y > 32) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + DoubleType T; /* 10^Y */ + + T = pow (10.0, Y); + if (T == 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = floor (X * T) / T; + } + } + } + break; + case F_MAXLEN_A_N: + case F_MAXLEN_N: + /* N = MAXLEN( A$ ) */ + /* N = MAXLEN */ + { + N = MAXLEN; + } + break; + case F_ORD_A_N: + /* N = ORD( A$ ) */ + { + /* P1BYT */ + if (a == 1) + { + /* same as ASC(A$) */ + N = A[0]; + } + else + { + /* lookup Acronym */ + N = -1; + for (x = 0; x < NUM_ACRONYMS; x++) + { + if (bwb_stricmp (AcronymTable[x].Name, A) == 0) + { + /* FOUND */ + N = AcronymTable[x].Value; + break; + } + } + if (N < 0) + { + /* NOT FOUND */ + WARN_ILLEGAL_FUNCTION_CALL; + N = 0; + } + } + } + break; + case F_RENAME_A_B_N: + /* N = RENAME( A$, B$ ) */ + { + /* P1BYT | P2BYT */ + if (rename (A, B)) + { + /* ERROR -- return FALSE */ + N = 0; + } + else + { + /* OK -- return TRUE */ + N = -1; + } + } + break; + case F_SIZE_A_N: + /* N = SIZE( A$ ) */ + { + /* P1BYT */ + FILE *F; + + F = fopen (A, "rb"); + if (F != NULL) + { + long n; + + fseek (F, 0, SEEK_END); + n = ftell (F); + bwb_fclose (F); + + if (n > 0) + { + /* round up filesize to next whole kilobyte */ + n += 1023; + n /= 1024; + } + else + { + /* a zero-length file returns 0 */ + n = 0; + } + N = n; + } + /* a non-existing file returns 0 */ + } + break; + case F_REPEAT4_X_Y_S: + /* S$ = REPEAT$( X, Y ) ' X is count, Y is code */ + { + /* P1LEN | P2BYT */ + if (x == 0) + { + /* empty string */ + } + else + { + bwb_memset (S, (char) y, x); + s = x; + } + } + break; + case F_REPEAT4_X_A_S: + /* S$ = REPEAT$( X, A$ ) ' X is count, A$ is code */ + { + /* P1LEN | P2BYT */ + if (x == 0) + { + /* empty string */ + } + else + { + bwb_memset (S, (char) A[0], x); + s = x; + } + } + break; + case F_FIX_X_N: + /* N = FIX( X ) */ + { + /* N = bwb_rint(X); */ + if (X < 0) + { + N = -floor (-X); + } + else + { + N = floor (X); + } + } + break; + case F_ABS_X_N: + /* N = ABS( X ) */ + { + N = fabs (X); + } + break; + case F_ATN_X_N: + case F_ATAN_X_N: + case F_ARCTAN_X_N: + /* N = ATN( X ) */ + /* N = ATAN( X ) */ + /* N = ARCTAN( X ) */ + { + N = atan (X); + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + N = FromRadiansToDegrees (N); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + N = FromRadiansToGradians (N); + } + } + break; + case F_ATND_X_N: + /* N = ATND( X ) */ + { + N = atan (X); + N = FromRadiansToDegrees (N); + } + break; + case F_ATNG_X_N: + /* N = ATNG( X ) */ + { + N = atan (X); + N = FromRadiansToGradians (N); + } + break; + case F_COS_X_N: + /* N = COS( X ) */ + { + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + X = FromDegreesToRadians (X); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + X = FromGradiansToRadians (X); + } + N = cos (X); + } + break; + case F_COSD_X_N: + /* N = COSD( X ) */ + { + X = FromDegreesToRadians (X); + N = cos (X); + } + break; + case F_COSG_X_N: + /* N = COSG( X ) */ + { + X = FromGradiansToRadians (X); + N = cos (X); + } + break; + case F_EXP_X_N: + /* N = EXP( X ) */ + { + N = exp (X); + } + break; + case F_INT_X_N: + /* N = INT( X ) */ + { + N = floor (X); + } + break; + case F_FLOAT_X_N: + case F_INT5_X_N: + /* N = FLOAT( X ) */ + /* N = INT%( X ) */ + { + N = bwb_rint (X); + } + break; + case F_INITIALIZE_N: + /* INITIALIZE */ + { + N = 0; + } + break; + case F_LOG_X_N: + case F_LN_X_N: + case F_LOGE_X_N: + /* N = LOG( X ) */ + /* N = LN( X ) */ + /* N = LOGE( X ) */ + { + /* P1GTZ */ + N = log (X); + } + break; + case F_RND_N: + /* N = RND */ + { + N = rand (); + N /= RAND_MAX; + } + break; + case F_RND_X_N: + /* N = RND( X ) */ + { + N = rand (); + N /= RAND_MAX; + } + break; + case F_SGN_X_N: + /* N = SGN( X ) */ + { + if (X > 0) + { + N = 1; + } + else if (X < 0) + { + N = -1; + } + else + { + N = 0; + } + } + break; + case F_SIN_X_N: + /* N = SIN( X ) */ + { + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + X = FromDegreesToRadians (X); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + X = FromGradiansToRadians (X); + } + N = sin (X); + } + break; + case F_SIND_X_N: + /* N = SIND( X ) */ + { + X = FromDegreesToRadians (X); + N = sin (X); + } + break; + case F_SING_X_N: + /* N = SING( X ) */ + { + X = FromGradiansToRadians (X); + N = sin (X); + } + break; + case F_SQR_X_N: + case F_SQRT_X_N: + /* N = SQR( X ) */ + /* N = SQRT( X ) */ + { + /* P1GEZ */ + N = sqrt (X); + } + break; + case F_TAN_X_N: + /* N = TAN( X ) */ + { + if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_DEGREES) + { + X = FromDegreesToRadians (X); + } + else if (My->CurrentVersion->OptionFlags & OPTION_ANGLE_GRADIANS) + { + X = FromGradiansToRadians (X); + } + N = tan (X); + } + break; + case F_TAND_X_N: + /* N = TAND( X ) */ + { + X = FromDegreesToRadians (X); + N = tan (X); + } + break; + case F_TANG_X_N: + /* N = TANG( X ) */ + { + X = FromGradiansToRadians (X); + N = tan (X); + } + break; + case F_SPC_X_S: + /* S$ = SPC( X ) */ + { + /* P1ANY */ + /* SPECIAL RULES APPLY. PART OF PRINT COMMAND. WIDTH > 0 */ + X = bwb_rint (X); + if (X < 1 || X > 255) + { + if (WARN_OVERFLOW) + { + /* ERROR */ + } + /* CONTINUE */ + X = 1; + } + x = (int) X; + bwb_memset (S, ' ', x); + s = x; + } + break; + case F_TAB_X_S: + /* S$ = TAB( X ) */ + { + /* P1ANY */ + /* SPECIAL RULES APPLY. PART OF PRINT COMMAND. WIDTH > 0 */ + int w; + int c; + + X = bwb_rint (X); + if (X < 1 || X > 255) + { + if (WARN_OVERFLOW) + { + /* ERROR */ + } + /* CONTINUE */ + X = 1; + } + x = (int) X; + if (My->CurrentFile) + { + w = My->CurrentFile->width; + c = My->CurrentFile->col; + } + else + { + w = My->SYSOUT->width; + c = My->SYSOUT->col; + } + if (w > 0) + { + /* WIDTH 80 */ + while (x > w) + { + /* + ** + ** If n is greater than the margin m, then n is + ** reduced by an integral multiple of m so that it is + ** in the range 1 <= n <= m; + ** + */ + x -= w; + } + /* 190 PRINT TAB(A);"X" ' A = 0 */ + if (x == 0) + { + /* use the value of one */ + x = 1; + /* continue processing */ + } + } + if (x < c) + { + S[0] = '\n'; + s = 1; + c = 1; + } + if (c < x) + { + x -= c; + bwb_memset (&(S[s]), ' ', x); + s += x; + } + } + break; + case F_POS_N: + /* N = POS */ + { + /* PNONE */ + N = My->SYSOUT->col; + } + break; + case F_COUNT_N: + /* N = COUNT */ + /* COUNT = POS - 1 */ + { + /* PNONE */ + N = My->SYSOUT->col; + N--; + } + break; + case F_POS_X_N: + /* N = POS( X ) */ + { + /* P1INT */ + if (x == 0) + { + N = My->SYSOUT->col; + } + else if (x < 0) + { + N = My->SYSPRN->col; + } + else + { + FileType *F; + F = find_file_by_number (x); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + N = F->col; + } + } + } + break; + case F_INPUT4_X_Y_S: + /* S$ = INPUT$( X, Y ) */ + { + /* P1LEN|P2INT */ + if (y <= 0) + { + /* Printer and Console */ + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + FileType *F; + + F = find_file_by_number (y); + if (F == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + if ((F->DevMode & DEVMODE_READ) == 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else if (x == 0) + { + /* empty string */ + } + else + { + FILE *fp; + fp = F->cfp; + if (fp == NULL) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + s = fread (S, 1, x, fp); + s = MAX (s, 0); /* if( s < 0 ) s = 0; */ + } + } + } + } + } + break; + case F_ERROR_X_N: + /* ERROR X */ + { + /* P1BYT */ + bwx_Error (x, NULL); + N = 0; + } + break; + case F_ERROR_X_A_N: + /* ERROR X, A$ */ + { + /* P1BYT */ + bwx_Error (x, A); + N = 0; + } + break; + case F_ERR_N: + case F_ERRN_N: + /* N = ERR */ + /* N = ERRN */ + { + /* PNONE */ + N = My->ERR; + } + break; + case F_ERL_N: + case F_ERRL_N: + /* N = ERL */ + /* N = ERRL */ + { + /* PNONE */ + if (My->ERL != NULL) + { + N = My->ERL->number; + } + } + break; + case F_ERR4_S: + case F_ERROR4_S: + /* S = ERR$ */ + /* S = ERROR$ */ + { + /* PNONE */ + s = bwb_strlen (My->ERROR4); + if (s > 0) + { + bwb_strcpy (S, My->ERROR4); + } + } + break; + + + /******************************************************************************************** + ** Keep the platform specific functions together. + *********************************************************************************************/ + case F_INP_X_N: + case F_PIN_X_N: + /* N = INP( X ) */ + /* N = PIN( X ) */ + { + /* P1BYT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_PDL_X_N: + /* N = PDL( X ) */ + { + /* P1BYT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_WAIT_X_Y_N: + /* WAIT X, Y */ + { + /* P1NUM|P2NUM */ + /* P1INT|P2BYT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_WAIT_X_Y_Z_N: + /* WAIT X, Y, Z */ + { + /* P1NUM|P2NUM|P3NUM */ + /* P1INT|P2BYT|P3BYT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_OUT_X_Y_N: + /* OUT X, Y */ + { + /* P1NUM|P2NUM */ + /* P1INT|P2BYT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_PEEK_X_N: + case F_EXAM_X_N: + case F_FETCH_X_N: + case F_DPEEK_X_N: + /* N = PEEK( X ) */ + /* N = EXAM( X ) */ + /* N = FETCH( X ) */ + /* N = DPEEK( X ) */ + { + /* P1INT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_POKE_X_Y_N: + case F_FILL_X_Y_N: + case F_STUFF_X_Y_N: + case F_DPOKE_X_Y_N: + /* POKE X, Y */ + /* FILL X, Y */ + /* STUFF X, Y */ + /* DPOKE X, Y */ + { + /* P1NUM|P2NUM */ + /* P1INT|P2BYT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_LOCK_X_N: + /* LOCK X */ + { + /* P1INT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_UNLOCK_X_N: + /* UNLOCK X */ + { + /* P1INT */ + WARN_ADVANCED_FEATURE; + } + break; + case F_USR_N: + case F_USR0_N: + case F_USR1_N: + case F_USR2_N: + case F_USR3_N: + case F_USR4_N: + case F_USR5_N: + case F_USR6_N: + case F_USR7_N: + case F_USR8_N: + case F_USR9_N: + case F_EXF_N: + case F_UUF_N: + /* N = USR( ... ) */ + /* N = USR0( ... ) */ + /* N = USR1( ... ) */ + /* N = USR2( ... ) */ + /* N = USR3( ... ) */ + /* N = USR4( ... ) */ + /* N = USR5( ... ) */ + /* N = USR6( ... ) */ + /* N = USR7( ... ) */ + /* N = USR8( ... ) */ + /* N = USR9( ... ) */ + /* N = EXF( ... ) */ + /* N = UUF( ... ) */ + { + /* ... */ + WARN_ADVANCED_FEATURE; + } + break; + case F_VARPTR_N: + case F_NAME_N: + case F_PTR_N: + /* N = VARPTR( ... ) */ + /* N = NAME( ... ) */ + /* N = PTR( ... ) */ + { + /* ... */ + WARN_ADVANCED_FEATURE; + } + break; + case F_FRE_N: + case F_FRE_X_N: + case F_FRE_A_N: + case F_FREE_N: + case F_FREE_X_N: + case F_FREE_A_N: + case F_MEM_N: + case F_TOP_N: + /* N = FRE( ) */ + /* N = FRE( X ) */ + /* N = FRE( X$ ) */ + /* N = FREE( ) */ + /* N = FREE( X ) */ + /* N = FREE( X$ ) */ + /* N = MEM( ) */ + /* N = TOP( ) */ + { + N = 32000; /* reasonable value */ + } + break; + case F_CLS_N: + case F_HOME_N: + /* CLS */ + /* HOME */ + { + /* PNONE */ + bwx_CLS (); + } + break; + case F_LOCATE_X_Y_N: + /* LOCATE X, Y */ + { + /* P1NUM|P2NUM */ + /* P1BYT|P2BYT */ + bwx_LOCATE (x, y); + } + break; + case F_CUR_X_Y_S: + /* CUR X, Y */ + { + /* P1NUM|P2NUM */ + /* P1BYT|P2BYT */ + x++; /* 0-based to 1-based row */ + y++; /* 0-based to 1-based col */ + bwx_LOCATE (x, y); + s = 0; + } + break; + case F_VTAB_X_N: + /* VTAB X */ + { + /* P1BYT */ + /* X is 1-based row */ + /* col is 1 */ + bwx_LOCATE (x, 1); + } + break; + case F_COLOR_X_Y_N: + /* COLOR X, Y */ + { + /* P1NUM|P2NUM */ + /* P1BYT|P2BYT */ + /* X is Foreground color */ + /* Y is Background color */ + bwx_COLOR (X, Y); + } + break; + case F_SHELL_A_N: + case F_EXEC_A_N: + /* N = SHELL( A$ ) */ + /* N = EXEC( A$ ) */ + { + /* P1BYT */ + N = system (A); + } + break; + case F_FILES_N: + case F_CATALOG_N: + /* FILES */ + /* CATALOG */ + { + /* PNONE */ + if (is_empty_string (My->OptionFilesString)) + { + WARN_ADVANCED_FEATURE; + } + else + { + N = system (My->OptionFilesString); + } + } + break; + case F_FILES_A_N: + case F_CATALOG_A_N: + /* FILES A$ */ + /* CATALOG A$ */ + { + /* P1BYT */ + if (is_empty_string (My->OptionFilesString)) + { + WARN_ADVANCED_FEATURE; + } + else + { + size_t n; + char *Buffer; + + n = bwb_strlen (My->OptionFilesString) + 1 /* SpaceChar */ + a; + if ((Buffer = + (char *) calloc (n + 1 /* NulChar */ , sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + } + else + { + bwb_strcpy (Buffer, My->OptionFilesString); + bwb_strcat (Buffer, " "); + bwb_strcat (Buffer, A); + N = system (Buffer); + free (Buffer); + Buffer = NULL; + } + } + } + break; + case F_CHDIR_A_N: + /* CHDIR A$ */ + { + /* P1BYT */ +#if DIRECTORY_CMDS + N = chdir (A); +#else + WARN_ADVANCED_FEATURE; +#endif + } + break; + case F_MKDIR_A_N: + /* MKDIR A$ */ + { + /* P1BYT */ +#if DIRECTORY_CMDS +#if MKDIR_ONE_ARG + N = mkdir (A); +#else + N = mkdir (A, PERMISSIONS); +#endif +#else + WARN_ADVANCED_FEATURE; +#endif + } + break; + case F_RMDIR_A_N: + /* RMDIR A$ */ + { + /* P1BYT */ +#if DIRECTORY_CMDS + N = rmdir (A); +#else + WARN_ADVANCED_FEATURE; +#endif + } + break; + case F_KILL_A_N: + case F_UNSAVE_A_N: + /* KILL A$ */ + /* UNSAVE A$ */ + { + /* P1BYT */ + N = remove (A); + } + break; + case F_NAME_A_B_N: + /* NAME A$ AS B$ */ + /* N = NAME( A$, B$ ) */ + { + /* P1BYT|P2BYT */ + N = rename (A, B); + } + break; + case F_INPUT4_X_S: + /* S$ = INPUT$( X ) */ + { + /* P1LEN */ + if (x == 0) + { + /* empty string */ + } + else + { + for (s = 0; s < x; s++) + { + int c; + c = fgetc (My->SYSIN->cfp); + if ((c == EOF) || (c == '\n') || (c == '\r')) + { + break; + } + S[s] = c; + } + S[s] = 0; + } + } + break; + case F_INKEY4_S: + case F_KEY4_S: + case F_KEY_S: + case F_INCH4_S: + /* S$ = INKEY$ */ + /* S$ = KEY$ */ + /* S$ = KEY */ + /* S$ = INCH$ */ + { + /* PNONE */ + int c; + + c = fgetc (My->SYSIN->cfp); + if (c < MINBYT || c > MAXBYT) + { + /* EOF */ + } + else + { + S[s] = c; + s++; + } + S[s] = 0; + } + break; + case F_NULL_X_N: + /* NULL X */ + { + /* P1NUM */ + /* P1BYT */ + My->LPRINT_NULLS = x; + N = 0; + } + break; + case F_LWIDTH_X_N: + /* LWIDTH X */ + { + /* P1NUM */ + /* P1BYT */ + My->SYSPRN->width = x; + My->SYSPRN->col = 1; + N = 0; + } + break; + case F_LPOS_N: + /* N = LPOS */ + { + /* PNONE */ + /* PNONE */ + N = My->SYSPRN->col; + } + break; + case F_TRON_N: + case F_TRACE_N: + case F_FLOW_N: + /* TRON */ + /* TRACE */ + /* FLOW */ + { + /* PNONE */ + fprintf (My->SYSOUT->cfp, "Trace is ON\n"); + ResetConsoleColumn (); + My->IsTraceOn = TRUE; + N = 0; + } + break; + case F_TROFF_N: + case F_NOTRACE_N: + case F_NOFLOW_N: + /* TROFF */ + /* NOTRACE */ + /* NOFLOW */ + { + /* PNONE */ + fprintf (My->SYSOUT->cfp, "Trace is OFF\n"); + ResetConsoleColumn (); + My->IsTraceOn = FALSE; + N = 0; + } + break; + case F_TRACE_X_N: + /* TRACE X */ + { + /* P1BYTE */ + if (x == 0) + { + fprintf (My->SYSOUT->cfp, "Trace is OFF\n"); + ResetConsoleColumn (); + My->IsTraceOn = FALSE; + } + else + { + fprintf (My->SYSOUT->cfp, "Trace is ON\n"); + ResetConsoleColumn (); + My->IsTraceOn = TRUE; + } + N = 0; + } + break; + case F_RANDOMIZE_N: + case F_RAN_N: + case F_RANDOM_N: + /* RANDOMIZE */ + /* RAN */ + /* RANDOM */ + { + /* PNONE */ + /* USE THE CURRENT TIME AS THE SEED */ + time (&t); + lt = localtime (&t); + x = lt->tm_hour * 3600 + lt->tm_min * 60 + lt->tm_sec; + srand (x); + N = 0; + } + break; + case F_RANDOMIZE_X_N: + case F_RAN_X_N: + case F_RANDOM_X_N: + /* RANDOMIZE X */ + /* RAN X */ + /* RANDOM X */ + { + /* P1NUM */ + /* P1ANY */ + /* USE 'X' AS THE SEED */ + x = (int) bwb_rint (X); + srand (x); + N = 0; + } + break; + case F_LNO_X_N: + /* N = LNO( X, Y ) */ + { + /* P1NUM */ + /* P1ANY */ + N = X; + } + break; + case F_PAD_X_N: + case F_SEG_X_N: + /* N = PAD( X ) */ + /* N = SEG( X ) */ + { + /* P1NUM */ + /* P1ANY */ + N = 0; + } + break; + case F_CNTRL_X_Y_N: + /* N = CNTRL( X, Y ) */ + { + /* P1NUM | P2NUM */ + /* P1INT | P2INT */ + switch (x) + { + case 0: + /* + CNTRL 0,line + This specifies a line to go to when the user presses Ctl-B. + */ + break; + case 1: + /* + CNTRL 1,value + This sets the number of digits (1 to 6) to print + */ + if (y == 0) + { + /* default */ + y = SIGNIFICANT_DIGITS; + } + if (y < MINIMUM_DIGITS || y > MAXIMUM_DIGITS) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + My->OptionDigitsInteger = y; + } + break; + case 2: + /* + CNTRL 2,value + This controls the front panel LED display. + */ + break; + case 3: + /* + CNTRL 3,value + This command sets the width of the print zones. + */ + if (y == 0) + { + /* default */ + y = ZONE_WIDTH; + } + if (y < MINIMUM_ZONE || y > MAXIMUM_ZONE) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + My->OptionZoneInteger = y; + } + break; + case 4: + /* + CNTRL 4,value + This command is used to load and unload the main HDOS overlay. + */ + break; + default: + WARN_ILLEGAL_FUNCTION_CALL; + break; + } + N = 0; + } + break; + case F_ZONE_X_N: + /* N = ZONE( X ) */ + { + /* P1NUM */ + /* P1INT */ + if (x == 0) + { + /* default */ + x = ZONE_WIDTH; + } + if (x < MINIMUM_ZONE || x > MAXIMUM_ZONE) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + My->OptionZoneInteger = x; + } + } + break; + case F_ZONE_X_Y_N: + /* N = ZONE( X, Y ) */ + { + /* P1NUM | P2NUM */ + /* P1INT | P2INT */ + /* value of X is ignored */ + if (y == 0) + { + /* default */ + y = ZONE_WIDTH; + } + if (y < MINIMUM_ZONE || y > MAXIMUM_ZONE) + { + WARN_ILLEGAL_FUNCTION_CALL; + } + else + { + My->OptionZoneInteger = y; + } + } + break; + case F_CIN_X_N: + /* N = CIN( X ) */ + { + /* P1INT */ + if (x <= 0) + { + /* Printer and Console */ + N = -1; + } + else + { + FileType *F; + + F = find_file_by_number (x); + if (F == NULL) + { + N = -1; + } + else if (F->DevMode & DEVMODE_READ) + { + N = fgetc (F->cfp); + } + else + { + N = -1; + } + } + } + break; + case F_TRUE_N: + /* N = TRUE */ + { + /* PNONE */ + N = TRUE; + } + break; + case F_FALSE_N: + /* N = FALSE */ + { + /* PNONE */ + N = FALSE; + } + break; + default: + { + /* an unknown function code */ + WARN_INTERNAL_ERROR; + } + } + /* sanity check */ + if (f->ReturnTypeCode == StringTypeCode) + { + /* STRING */ + if ( /* s < 0 || */ s > MAXLEN) + { + WARN_INTERNAL_ERROR; + s = 0; + } + if (S != RESULT_BUFFER) + { + WARN_INTERNAL_ERROR; + S = RESULT_BUFFER; + } + RESULT_LENGTH = s; + RESULT_BUFFER[RESULT_LENGTH] = NulChar; + } + else + { + /* NUMBER */ + if (isnan (N)) + { + /* ERROR */ + /* this means the parameters were not properly checked */ + WARN_INTERNAL_ERROR; + N = 0; + } + else if (isinf (N)) + { + /* Evaluation of an expression results in an + * overflow (nonfatal, the recommended + * recovery procedure is to supply machine + * in- finity with the algebraically correct + * sign and continue). */ + if (N < 0) + { + N = MINDBL; + } + else + { + N = MAXDBL; + } + WARN_OVERFLOW; + } + RESULT_NUMBER = N; + } + return argv; /* released by exp_function() in bwb_elx.c */ +} + +/* EOF */ diff --git a/bwb_inp.c b/bwb_inp.c new file mode 100644 index 0000000..faff2ef --- /dev/null +++ b/bwb_inp.c @@ -0,0 +1,3525 @@ +/*************************************************************** + + bwb_inp.c Input Routines + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + + +static LineType *C77_file_input (LineType * Line, int FileNumber); +static LineType *C77_file_input_finish (LineType * Line); +static LineType *C77_file_input_line (LineType * Line); +static LineType *C77_user_input_line (LineType * Line, char *Prompt, + int IsDisplayQuestionMark); +static void CleanTextInput (char *buffer); +static LineType *D71_GET (LineType * Line); +static LineType *data_if_end (LineType * Line); +static LineType *data_restore (LineType * Line); +static ResultType file_data (VariableType * Variable, char *tbuf, int tlen); +static LineType *file_if_end (LineType * Line); +static LineType *file_input (LineType * Line); +static LineType *file_read_matrix (LineType * Line); +static LineType *file_restore (LineType * Line); +static LineType *H14_GET (LineType * Line); +static ResultType input_data (VariableType * Variable, char *tbuf, int tlen); +static ResultType parse_number (char *buffer, int *position, VariantType * X, + int IsConsoleInput); +static ResultType parse_string (char *buffer, int *position, VariantType * X); +static ResultType parse_string_isquoted (char *buffer, int *position, + VariantType * X); +static ResultType parse_string_unquoted (char *buffer, int *position, + VariantType * X); +static ResultType read_data (VariableType * Variable); +static LineType *read_file (LineType * Line); +static LineType *read_list (LineType * Line); +static LineType *S70_GET (LineType * Line); +static LineType *user_input_loop (LineType * Line); +static ResultType user_input_values (LineType * Line, char *buffer, + int IsReal); + + +int +bwb_is_eof (FILE * fp) +{ + /* + Have you ever wondered why C file I/O is slow? Here is the reason: + feof() is not set until after a file read error occurs; sad but true. + In order to determine whether you are at the end-of-file, + you have to call both ftell() and fseek() twice, + which effectively trashes any I/O cache scheme. + */ + + assert (fp != NULL); + + if (fp != NULL) + { + long current; + long total; + + current = ftell (fp); + fseek (fp, 0, SEEK_END); + total = ftell (fp); + if (total == current) + { + /* EOF */ + return TRUE; + } + else + { + /* NOT EOF */ + fseek (fp, current, SEEK_SET); + return FALSE; + } + } + /* a closed file is always EOF */ + return TRUE; +} + + +static void +CleanTextInput (char *buffer) +{ + /* + ** + ** Clean the TEXT in the INPUT buffer after fgets(). Not for RANDOM or BINARY. + ** + */ + char *E; + + assert (buffer != NULL); + /* + ** + ** some compilers remove CR, but not LF. + ** some compilers remove LF, but not CR. + ** some compilers remove CR/LF but not LF/CR. + ** some compilers remove both CR and LF. + ** some compilers remove the first CR or LF, but not the second LF or CR. + ** some compilers don't remove either CR or LF. + ** and so on. + ** + */ + E = bwb_strchr (buffer, '\r'); + if (E != NULL) + { + *E = NulChar; + } + E = bwb_strchr (buffer, '\n'); + if (E != NULL) + { + *E = NulChar; + } + /* + ** + ** Suppress all control characters. + ** In theory, there should not be any control characters at all. + ** In reality, they occassionally occur. + ** + */ + while (*buffer) + { + if (bwb_isprint (*buffer) == FALSE) + { + *buffer = ' '; + } + buffer++; + } +} + + + +/*************************************************************** + + FUNCTION: bwx_input() + + DESCRIPTION: This function outputs the string pointed + to by 'prompt', then inputs a character + string. + +***************************************************************/ + +extern int +bwx_input (char *prompt, int IsDisplayQuestionMark, char *answer, int MaxLen) +{ + + assert (answer != NULL); + assert(My != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + if (prompt != NULL) + { + while (*prompt) + { + if (*prompt == '\n') + { + My->SYSOUT->col = 0; /* incremented below */ + My->SYSOUT->row++; + } + else + if (My->SYSOUT->width > 0 + && My->SYSOUT->col > My->SYSOUT->width /* && *prompt != '\n' */ ) + { + fputc ('\n', My->SYSOUT->cfp); + My->SYSOUT->col = 0; /* incremented below */ + My->SYSOUT->row++; + } + fputc (*prompt, My->SYSOUT->cfp); + My->SYSOUT->col++; + prompt++; + } + } + if (IsDisplayQuestionMark) + { + fputs ("? ", My->SYSOUT->cfp); + My->SYSOUT->col += 2; + } + fflush (My->SYSOUT->cfp); + /* + ** + ** for PTR or OPTION STDIN ... + ** + */ + if (My->SYSIN->cfp != stdin) + { + /* this file was opened by PTR or OPTION STDIN commands */ + if (fgets (answer, MaxLen, My->SYSIN->cfp)) /* bwx_input */ + { + answer[MaxLen] = NulChar; + CleanTextInput (answer); + fputs (answer, My->SYSOUT->cfp); + fputc ('\n', My->SYSOUT->cfp); + fflush (My->SYSOUT->cfp); + ResetConsoleColumn (); + return TRUE; + } + /* stop reading from PTR or OPTION STDIN once all INPUT lines have been read */ + bwb_fclose (My->SYSIN->cfp); + My->SYSIN->cfp = stdin; + /* INPUT reverts to stdin */ + } + /* My->SYSIN->cfp == stdin */ + /* + ** + ** ... for PTR or OPTION STDIN + ** + */ + /* + ** + ** for automated testing ... + ** + */ + if (My->ExternalInputFile != NULL) + { + /* this file was opened by --TAPE command line parameter */ + if (fgets (answer, MaxLen, My->ExternalInputFile)) /* bwx_input */ + { + answer[MaxLen] = NulChar; + CleanTextInput (answer); + fputs (answer, My->SYSOUT->cfp); + fputc ('\n', My->SYSOUT->cfp); + fflush (My->SYSOUT->cfp); + ResetConsoleColumn (); + return TRUE; + } + /* stop reading from --TAPE once all INPUT lines have been read */ + bwb_fclose (My->ExternalInputFile); + My->ExternalInputFile = NULL; + /* INPUT reverts to My->SYSIN->cfp */ + } + /* + ** + ** ... for automated testing + ** + */ + if (fgets (answer, MaxLen, My->SYSIN->cfp)) /* bwx_input */ + { + /* this is stdin */ + answer[MaxLen] = NulChar; + CleanTextInput (answer); + ResetConsoleColumn (); + return TRUE; + } + /* nothing was read from stdin */ + answer[0] = NulChar; + CleanTextInput (answer); + ResetConsoleColumn (); + return FALSE; +} + + +extern LineType * +bwb_BACKSPACE (LineType * Line) +{ + + + assert (Line != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + My->CurrentFile = My->SYSIN; + + if (line_skip_FilenumChar (Line)) + { + /* BACKSPACE # filenum */ + int FileNumber; + + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (FileNumber < 0) + { + /* "BACKSPACE # -1" is silently ignored */ + return (Line); + } + if (FileNumber == 0) + { + /* "BACKSPACE # 0" is silently ignored */ + return (Line); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if ((My->CurrentFile->DevMode & DEVMODE_READ) == 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + /* not for the console */ + /* if( TRUE ) */ + { + FILE *f; + long Offset; + int DelimiterCount; + int InQuote; + int C; + + f = My->CurrentFile->cfp; + Offset = ftell (f); + Offset--; + DelimiterCount = 0; + InQuote = FALSE; + + AGAIN: + if (Offset <= 0) + { + goto DONE; + } + fseek (f, Offset, SEEK_SET); + C = fgetc (f); + + if (InQuote) + { + if (C == My->CurrentVersion->OptionQuoteChar) + { + InQuote = FALSE; + } + Offset--; + goto AGAIN; + } + + if (C == My->CurrentVersion->OptionQuoteChar) + { + InQuote = TRUE; + Offset--; + goto AGAIN; + } + + + if (C == ',') + { + DelimiterCount++; + if (DelimiterCount > 1) + { + Offset++; + goto DONE; + } + Offset--; + goto AGAIN; + } + + if (C == '\n') + { + DelimiterCount++; + if (DelimiterCount > 1) + { + Offset++; + goto DONE; + } + Offset--; + if (Offset <= 0) + { + goto DONE; + } + fseek (f, Offset, SEEK_SET); + C = fgetc (f); + if (C == '\r') + { + Offset--; + } + goto AGAIN; + } + + if (C == '\r') + { + DelimiterCount++; + if (DelimiterCount > 1) + { + Offset++; + goto DONE; + } + Offset--; + if (Offset <= 0) + { + goto DONE; + } + fseek (f, Offset, SEEK_SET); + C = fgetc (f); + if (C == '\n') + { + Offset--; + } + goto AGAIN; + } + + Offset--; + goto AGAIN; + + DONE: + if (Offset < 0) + { + Offset = 0; + } + fseek (f, Offset, SEEK_SET); + } + } + /* BACKSPACE for console is silently ignored */ + return (Line); +} + + + + +/*************************************************************** + + FUNCTION: bwb_read() + + DESCRIPTION: This function implements the BASIC READ + statement. + + SYNTAX: READ variable[, variable...] + +***************************************************************/ + +static LineType * +C77_file_input (LineType * Line, int FileNumber) +{ + /* + CBASIC-II: SERIAL & RANDOM file reads + READ # FileNumber ; [ scalar [ , ... ] ] ' SERIAL + READ # FileNumber , RecordNumber ; [ scalar [ , ... ] ] ' RANDOM + */ + assert (Line != NULL); + assert(My != NULL); + + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (line_skip_CommaChar (Line) /* comma-specific */ ) + { + /* + READ # FileNumber , RecordNumber ; [ scalar [ , ... ] ] ' RANDOM + */ + /* get the RecordNumber */ + int RecordNumber; + + if ((My->CurrentFile->DevMode & DEVMODE_RANDOM) == 0) + { + WARN_BAD_FILE_MODE; + return (Line); + } + if (My->CurrentFile->width <= 0) + { + WARN_FIELD_OVERFLOW; + return (Line); + } + if (line_read_integer_expression (Line, &RecordNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (RecordNumber <= 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + RecordNumber--; /* BASIC to C */ + /* if( TRUE ) */ + { + long offset; + offset = RecordNumber; + offset *= My->CurrentFile->width; + fseek (My->CurrentFile->cfp, offset, SEEK_SET); + } + } + + if (line_is_eol (Line)) + { + /* READ # filenum */ + /* READ # filenum , recnum */ + return (Line); + } + + if (line_skip_SemicolonChar (Line) /* semicolon specific */ ) + { + /* READ # filenum ; */ + /* READ # filenum , recnum ; */ + } + else + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_is_eol (Line)) + { + return (Line); + } + /* input is not from #0, so branch to file_input() */ + return file_input (Line); +} + +static LineType * +data_if_end (LineType * Line) +{ + WARN_OUT_OF_DATA; + return (Line); +} + +static ResultType +read_data (VariableType * Variable) +{ + /* + ** + ** read one DATA item + ** + */ + ResultType Result; + VariantType Variant; + VariantType *X; + + assert (Variable != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + assert (My->CurrentFile == My->SYSIN); + assert(My->DataLine != NULL); + assert(My->EndMarker != NULL); + + Result = RESULT_UNPARSED; + X = &Variant; + CLEAR_VARIANT (X); + if (My->DataLine == My->EndMarker) + { + return RESULT_UNPARSED; + } + if (My->DataLine->cmdnum != C_DATA) + { + WARN_INTERNAL_ERROR; + return RESULT_UNPARSED; + } + if (VAR_IS_STRING (Variable)) + { + Result = parse_string (My->DataLine->buffer, &My->DataPosition, X); + } + else + { + Result = parse_number (My->DataLine->buffer, &My->DataPosition, X, FALSE); + } + if (Result == RESULT_UNPARSED) + { + WARN_BAD_DATA; + } + if (Result != RESULT_SUCCESS) + { + return Result; + } + /* + ** + ** OK + ** + */ + if (X->VariantTypeCode == StringTypeCode + && My->CurrentVersion->OptionFlags & OPTION_BUGS_ON ) /* DATA allows embedded quote pairs */ + { + int i; + int n; + n = X->Length; + for (i = 0; i < n; i++) + { + if (X->Buffer[i + 0] == My->CurrentVersion->OptionQuoteChar + && X->Buffer[i + 1] == My->CurrentVersion->OptionQuoteChar) + { + bwb_strncpy (&X->Buffer[i + 0], &X->Buffer[i + 1], n - i); + n--; + } + } + X->Length = n; + } + if (var_set (Variable, X) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return RESULT_UNPARSED; + } + /* + ** + ** Note: do NOT free() or RELEASE_VARIANT because 'X->Buffer' points into 'buffer' + ** + */ + if (buff_is_eol (My->DataLine->buffer, &My->DataPosition)) + { + /* at the end of the current DATA statement */ + if (My->CurrentVersion->OptionFlags & OPTION_COVERAGE_ON) + { + /* this line has been READ */ + My->DataLine->LineFlags |= LINE_EXECUTED; + } + My->DataLine = My->DataLine->OtherLine; + My->DataPosition = My->DataLine->Startpos; + return RESULT_SUCCESS; + } + if (buff_skip_char (My->DataLine->buffer, &My->DataPosition, My->CurrentFile->delimit)) /* buff_skip_comma */ + { + return RESULT_SUCCESS; + } + /* garbage after the value we just READ */ + WARN_BAD_DATA; + return RESULT_UNPARSED; +} + +static LineType * +read_list (LineType * Line) +{ + /* READ varlist */ + assert (Line != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + assert (My->CurrentFile == My->SYSIN); + + do + { + VariableType *Variable; + + /* get a variable */ + if ((Variable = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return (Line); + } + /* READ data into the variable */ + if (read_data (Variable) != RESULT_SUCCESS) + { + return data_if_end (Line); + } + } + while (line_skip_seperator (Line)); + return (Line); +} + +static LineType * +read_file (LineType * Line) +{ + /* READ # filenum, varlist */ + int FileNumber; + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + return C77_file_input (Line, FileNumber); + } + /* + SERIAL file reads: + READ # FileNumber + READ # FileNumber [, scalar] + */ + if (line_skip_seperator (Line)) + { + /* required */ + } + else + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (FileNumber < 0) + { + /* "READ # -1" is an error */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (FileNumber > 0) + { + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if ((My->CurrentFile->DevMode & DEVMODE_READ) == 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + /* input is not from #0, so branch to file_input() */ + return file_input (Line); + } + /* "READ # 0, varlist" is the same as "READ varlist" */ + return read_list (Line); +} + +extern LineType * +bwb_READ (LineType * Line) +{ + + + assert (Line != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + My->CurrentFile = My->SYSIN; + + if (line_skip_FilenumChar (Line)) + { + return read_file (Line); + } + return read_list (Line); +} + +/*************************************************************** + + FUNCTION: bwb_data() + + DESCRIPTION: This function implements the BASIC DATA + statement, although at the point at which + DATA statements are encountered, no + processing is done. All actual processing + of DATA statements is accomplished by READ + (bwb_read()). + + SYNTAX: DATA constant[, constant]... + +***************************************************************/ + +extern LineType * +bwb_DATA (LineType * Line) +{ + + assert (Line != NULL); + + if (Line->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (Line); + } + line_skip_eol (Line); + return (Line); +} + + + + + + +/*************************************************************** + + FUNCTION: bwb_restore() + + DESCRIPTION: This function implements the BASIC RESTORE + statement. + + SYNTAX: RESTORE [line number] + +***************************************************************/ + +extern LineType * +bwb_RESET (LineType * Line) +{ + /* RESET filename$ [, ...] */ + VariantType E; + VariantType *e; + + assert (Line != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + e = &E; /* no leaks */ + My->CurrentFile = My->SYSIN; + + do + { + CLEAR_VARIANT (e); + if (line_read_expression (Line, e) == FALSE) /* bwb_RESET */ + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (e->VariantTypeCode == StringTypeCode) + { + /* STRING */ + /* RESET filename$ ... */ + My->CurrentFile = find_file_by_name (e->Buffer); + } + else + { + /* NUMBER -- file must already be OPEN */ + /* RESET filenumber ... */ + My->CurrentFile = find_file_by_number ((int) bwb_rint (e->Number)); + } + RELEASE_VARIANT (e); + if (My->CurrentFile == NULL) + { + /* file not OPEN */ + /* silently ignored */ + } + else if (My->CurrentFile == My->SYSIN) + { + /* silently ignored */ + } + else if (My->CurrentFile == My->SYSOUT) + { + /* silently ignored */ + } + else if (My->CurrentFile == My->SYSPRN) + { + /* silently ignored */ + } + else + { + /* normal file is OPEN */ + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + fseek (My->CurrentFile->cfp, 0, SEEK_SET); + } + } + while (line_skip_seperator (Line)); + return (Line); +} + +extern LineType * +bwb_CLOSE (LineType * Line) +{ + /* CLOSE filename$ ' can be any string expression */ + /* CLOSE filenumber ' can be any numeric expression */ + + assert (Line != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + assert(My->SYSOUT != NULL); + assert(My->SYSOUT->cfp != NULL); + assert(My->SYSPRN != NULL); + assert(My->SYSPRN->cfp != NULL); + + My->CurrentFile = My->SYSIN; + + if (line_is_eol (Line)) + { + /* CLOSE */ + FileType *F; + + for (F = My->FileHead; F != NULL; F = F->next) + { + field_close_file (F); + file_clear (F); + } + return (Line); + } + + do + { + VariantType E; + VariantType *e; + e = &E; + + if (line_read_expression (Line, e) == FALSE) /* bwb_CLOSE */ + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (e->VariantTypeCode == StringTypeCode) + { + /* STRING */ + /* CLOSE filename$ ... */ + My->CurrentFile = find_file_by_name (e->Buffer); + } + else + { + /* CLOSE filenumber */ + My->CurrentFile = find_file_by_number (e->Number); + } + if (My->CurrentFile == NULL) + { + /* file not OPEN */ + /* silently ignored */ + } + else if (My->CurrentFile == My->SYSIN) + { + /* silently ignored */ + } + else if (My->CurrentFile == My->SYSOUT) + { + /* silently ignored */ + } + else if (My->CurrentFile == My->SYSPRN) + { + /* silently ignored */ + } + else + { + /* normal file is OPEN */ + field_close_file (My->CurrentFile); + file_clear (My->CurrentFile); + } + RELEASE_VARIANT (e); + } + while (line_skip_seperator (Line)); + return (Line); +} + +static LineType * +data_restore (LineType * Line) +{ + int LineNumber; + LineType *x; + assert (Line != NULL); + assert(My != NULL); + + if (line_is_eol (Line)) + { + /* RESTORE */ + assert (My->StartMarker != NULL); + My->DataLine = My->StartMarker->OtherLine; + assert (My->DataLine != NULL); + My->DataPosition = My->DataLine->Startpos; + return (Line); + } + if (line_read_integer_expression (Line, &LineNumber)) + { + /* RESTORE linenumber */ + x = find_line_number (LineNumber); /* RESTORE 100 */ + if (x != NULL) + { + for (; x->cmdnum != C_DATA && x != My->EndMarker; x = x->next); + My->DataLine = x; + assert (My->DataLine != NULL); + My->DataPosition = My->DataLine->Startpos; + return (Line); + } + } + WARN_SYNTAX_ERROR; + return (Line); +} +static LineType * +file_restore (LineType * Line) +{ + /* RESTORE # FileNumber */ + int FileNumber; + assert (Line != NULL); + assert(My != NULL); + + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (FileNumber < 0) + { + /* "RESTORE # -1" is silently ignored */ + return (Line); + } + if (FileNumber > 0) + { + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile->DevMode != DEVMODE_CLOSED) + { + My->CurrentFile->DevMode = DEVMODE_CLOSED; + } + if (My->CurrentFile->cfp != NULL) + { + bwb_fclose (My->CurrentFile->cfp); + My->CurrentFile->cfp = NULL; + } + if (My->CurrentFile->buffer != NULL) + { + free (My->CurrentFile->buffer); + My->CurrentFile->buffer = NULL; + } + My->CurrentFile->width = 0; + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + if (is_empty_string (My->CurrentFile->FileName)) + { + WARN_BAD_FILE_NAME; + return (Line); + } + if (bwb_strcmp (My->CurrentFile->FileName, "*") != 0) + { + if ((My->CurrentFile->cfp = + fopen (My->CurrentFile->FileName, "r")) == NULL) + { + WARN_BAD_FILE_NAME; + return (Line); + } + My->CurrentFile->DevMode = DEVMODE_INPUT; + } + /* OK */ + return (Line); + } + /* "RESTORE # 0" is the same as "RESTORE" */ + return data_restore (Line); +} + +extern LineType * +bwb_RESTORE (LineType * Line) +{ + + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + My->CurrentFile = My->SYSIN; + + if (line_skip_FilenumChar (Line)) + { + return file_restore (Line); + } + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* RESTORE [comment] */ + line_skip_eol (Line); + /* fall-thru */ + } + return data_restore (Line); +} + +/*************************************************************** + + FUNCTION: bwb_input() + + DESCRIPTION: This function implements the BASIC INPUT + statement. + + SYNTAX: INPUT [;][prompt$;]variable[$,variable]... + INPUT#n variable[$,variable]... + +***************************************************************/ + +static LineType * +S70_GET (LineType * Line) +{ + /* GET filename$ , scalar [, ...] */ + VariantType E; + VariantType *e; + + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + e = &E; + My->CurrentFile = My->SYSIN; + + if (line_read_expression (Line, e) == FALSE) /* bwb_GET */ + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (e->VariantTypeCode == StringTypeCode) + { + /* STRING */ + /* GET filename$ ... */ + if (is_empty_string (e->Buffer)) + { + /* GET "", ... is an error */ + WARN_BAD_FILE_NAME; + return (Line); + } + My->CurrentFile = find_file_by_name (e->Buffer); + if (My->CurrentFile == NULL) + { + /* implicitly OPEN for reading */ + My->CurrentFile = file_new (); + My->CurrentFile->cfp = fopen (e->Buffer, "r"); + if (My->CurrentFile->cfp == NULL) + { + WARN_BAD_FILE_NAME; + return (Line); + } + My->CurrentFile->FileNumber = file_next_number (); + My->CurrentFile->DevMode = DEVMODE_INPUT; + My->CurrentFile->width = 0; + /* WIDTH == RECLEN */ + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + My->CurrentFile->buffer = NULL; + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = e->Buffer; + e->Buffer = NULL; + } + } + else + { + /* NUMBER -- file must already be OPEN */ + /* GET filenumber ... */ + if (e->Number < 0) + { + /* "GET # -1" is an error */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (e->Number == 0) + { + /* "GET # 0" is an error */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + My->CurrentFile = find_file_by_number ((int) bwb_rint (e->Number)); + if (My->CurrentFile == NULL) + { + /* file not OPEN */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + } + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if ((My->CurrentFile->DevMode & DEVMODE_READ) == 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (line_skip_seperator (Line)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return (Line); + } + return file_input (Line); +} + +static LineType * +D71_GET (LineType * Line) +{ + /* GET # FileNumber [ , RECORD RecordNumber ] */ + int FileNumber; + + assert (Line != NULL); + assert(My != NULL); + + FileNumber = 0; + if (line_skip_FilenumChar (Line)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (FileNumber < 1) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile->DevMode != DEVMODE_RANDOM) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile->width <= 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (line_is_eol (Line)) + { + /* GET # FileNumber */ + } + else + { + /* GET # FileNumber , RECORD RecordNumber */ + int RecordNumber; + long offset; + + RecordNumber = 0; + offset = 0; + if (line_skip_seperator (Line) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_skip_word (Line, "RECORD") == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_read_integer_expression (Line, &RecordNumber) == FALSE) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + if (RecordNumber <= 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + RecordNumber--; /* BASIC to C */ + offset = RecordNumber; + offset *= My->CurrentFile->width; + if (fseek (My->CurrentFile->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + } + /* if( TRUE ) */ + { + int i; + for (i = 0; i < My->CurrentFile->width; i++) + { + int c; + c = fgetc (My->CurrentFile->cfp); + if ( /* EOF */ c < 0) + { + c = NulChar; + } + My->CurrentFile->buffer[i] = c; + } + } + field_get (My->CurrentFile); + /* OK */ + return (Line); +} + +extern int +binary_get_put (VariableType * Variable, int IsPUT) +{ + VariantType variant; + VariantType *Variant; + + assert(My != NULL); + assert (My->CurrentFile != NULL); + assert (My->CurrentFile->cfp != NULL); + assert (My->CurrentFile->DevMode == DEVMODE_BINARY); + + Variant = &variant; + CLEAR_VARIANT (Variant); + if (var_get (Variable, Variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return FALSE; + } + switch (Variant->VariantTypeCode) + { + case ByteTypeCode: + { + ByteType Value; + Value = (ByteType) Variant->Number; + if (IsPUT) + { + if (fwrite (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + else + { + if (fread (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + Variant->Number = Value; + } + break; + case IntegerTypeCode: + { + IntegerType Value; + Value = (IntegerType) Variant->Number; + if (IsPUT) + { + if (fwrite (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + else + { + if (fread (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + Variant->Number = Value; + } + break; + case LongTypeCode: + { + LongType Value; + Value = (LongType) Variant->Number; + if (IsPUT) + { + if (fwrite (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + else + { + if (fread (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + Variant->Number = Value; + } + break; + case CurrencyTypeCode: + { + CurrencyType Value; + Value = (CurrencyType) Variant->Number; + if (IsPUT) + { + if (fwrite (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + else + { + if (fread (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + Variant->Number = Value; + } + break; + case SingleTypeCode: + { + SingleType Value; + Value = (SingleType) Variant->Number; + if (IsPUT) + { + if (fwrite (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + else + { + if (fread (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + Variant->Number = Value; + } + break; + case DoubleTypeCode: + { + DoubleType Value; + Value = (DoubleType) Variant->Number; + if (IsPUT) + { + if (fwrite (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + else + { + if (fread (&(Value), sizeof (Value), 1, My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + Variant->Number = Value; + } + break; + case StringTypeCode: + if (IsPUT) + { +#if FALSE /* keep this ... */ + if (fwrite + (&(Variant->Length), sizeof (Variant->Length), 1, + My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } +#endif + if (fwrite (Variant->Buffer, Variant->Length, 1, My->CurrentFile->cfp) + != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + else + { +#if FALSE /* keep this ... */ + if (fread + (&(Variant->Length), sizeof (Variant->Length), 1, + My->CurrentFile->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } +#endif + if (fread (Variant->Buffer, Variant->Length, 1, My->CurrentFile->cfp) != + 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + Variant->Buffer[Variant->Length] = NulChar; + } + break; + default: + { + WARN_INTERNAL_ERROR; + return FALSE; + } + } + if (IsPUT) + { + /* not needed */ + } + else + { + if (var_set (Variable, Variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return FALSE; + } + } + RELEASE_VARIANT (Variant); + /* OK */ + return TRUE; +} + +static LineType * +H14_GET (LineType * Line) +{ + /* GET # FileNumber [ , RecordNumber ] ' RANDOM */ + /* GET # FileNumber , [ BytePosition ] , scalar [,...] ' BINARY */ + int FileNumber; + + assert (Line != NULL); + assert(My != NULL); + + FileNumber = 0; + if (line_skip_FilenumChar (Line)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (FileNumber < 1) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile->DevMode == DEVMODE_RANDOM) + { + /* GET # FileNumber [ , RecordNumber ] ' RANDOM */ + if (My->CurrentFile->width <= 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (line_is_eol (Line)) + { + /* GET # FileNumber */ + } + else + { + /* GET # FileNumber , RecordNumber */ + int RecordNumber; + long offset; + + RecordNumber = 0; + offset = 0; + if (line_skip_seperator (Line) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_read_integer_expression (Line, &RecordNumber) == FALSE) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + if (RecordNumber <= 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + RecordNumber--; /* BASIC to C */ + offset = RecordNumber; + offset *= My->CurrentFile->width; + if (fseek (My->CurrentFile->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + } + /* if( TRUE ) */ + { + int i; + for (i = 0; i < My->CurrentFile->width; i++) + { + int c; + c = fgetc (My->CurrentFile->cfp); + if ( /* EOF */ c < 0) + { + c = NulChar; + } + My->CurrentFile->buffer[i] = c; + } + } + field_get (My->CurrentFile); + /* OK */ + return (Line); + } + else if (My->CurrentFile->DevMode == DEVMODE_BINARY) + { + /* GET # FileNumber , [ BytePosition ] , scalar [,...] ' BINARY */ + if (line_skip_seperator (Line) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_skip_seperator (Line)) + { + /* BytePosition not provided */ + } + else + { + int RecordNumber; + long offset; + + RecordNumber = 0; + offset = 0; + if (line_read_integer_expression (Line, &RecordNumber) == FALSE) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + if (RecordNumber <= 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + RecordNumber--; /* BASIC to C */ + offset = RecordNumber; + if (fseek (My->CurrentFile->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + if (line_skip_seperator (Line) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + } + do + { + VariableType *v; + + if ((v = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (binary_get_put (v, FALSE) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + } + while (line_skip_seperator (Line)); + /* OK */ + return (Line); + } + WARN_BAD_FILE_MODE; + return (Line); +} + +extern LineType * +bwb_GET (LineType * Line) +{ + + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + return S70_GET (Line); + } + if (My->CurrentVersion->OptionVersionValue & (D71 | T79 | R86)) + { + return D71_GET (Line); + } + if (My->CurrentVersion->OptionVersionValue & (H14)) + { + return H14_GET (Line); + } + WARN_INTERNAL_ERROR; + return (Line); +} + +static ResultType +file_data (VariableType * Variable, char *tbuf, int tlen) +{ + ResultType Result; + VariantType Variant; + VariantType *X; + int p; + + assert (Variable != NULL); + assert (tbuf != NULL); + assert (tlen > 0); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + + Result = RESULT_UNPARSED; + X = &Variant; + p = 0; + CLEAR_VARIANT (X); + if (tbuf[0] == NulChar) + { + /* Get more data */ + if (fgets (tbuf, tlen, My->CurrentFile->cfp)) /* file_data */ + { + tbuf[tlen] = NulChar; + CleanTextInput (tbuf); + } + else + { + return RESULT_UNPARSED; /* causes file_if_end() */ + } + } + if (VAR_IS_STRING (Variable)) + { + Result = parse_string (tbuf, &p, X); + } + else + { + Result = parse_number (tbuf, &p, X, FALSE); + } + if (Result == RESULT_UNPARSED) + { + WARN_BAD_DATA; + } + if (Result != RESULT_SUCCESS) + { + return Result; + } + /* + ** + ** OK + ** + */ + if (X->VariantTypeCode == StringTypeCode + && My->CurrentVersion-> + OptionFlags & OPTION_BUGS_ON /* DATA allows embedded quote pairs */ ) + { + int i; + int n; + n = X->Length; + for (i = 0; i < n; i++) + { + if (X->Buffer[i + 0] == My->CurrentVersion->OptionQuoteChar + && X->Buffer[i + 1] == My->CurrentVersion->OptionQuoteChar) + { + bwb_strncpy (&X->Buffer[i + 0], &X->Buffer[i + 1], n - i); + n--; + } + } + X->Length = n; + } + if (var_set (Variable, X) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return RESULT_UNPARSED; + } + /* + ** + ** Note: do NOT free() or RELEASE_VARIANT because 'X->Buffer' points into 'buffer' + ** + */ + if (buff_is_eol (tbuf, &p)) + { + tbuf[0] = NulChar; + return RESULT_SUCCESS; + } + if (buff_skip_char (tbuf, &p, My->CurrentFile->delimit)) /* buff_skip_comma */ + { + /* shift left past comma */ + bwb_strcpy (tbuf, &tbuf[p]); + return RESULT_SUCCESS; + } + /* garbage after the value we just READ */ + WARN_BAD_DATA; + return RESULT_UNPARSED; +} + +static LineType * +C77_file_input_line (LineType * Line) +{ + /* + CBASIC-II: READ # filenumber [, recnum ] ; LINE variable$ + */ + /* a flavor of LINE INPUT */ + VariableType *v; + assert (Line != NULL); + assert(My != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + if ((v = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (VAR_IS_STRING (v)) + { + + char *tbuf; + int tlen; + + assert (My->ConsoleInput != NULL); + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + /* CBASIC-II: RANDOM files are padded on the right with spaces with a '\n' in the last position */ + if (My->CurrentFile->width > MAX_LINE_LENGTH) + { + if (My->CurrentFile->buffer != NULL) + { + /* use the bigger buffer */ + tbuf = My->CurrentFile->buffer; + tlen = My->CurrentFile->width; + } + } + if (fgets (tbuf, tlen, My->CurrentFile->cfp)) /* C77_file_input_line */ + { + tbuf[tlen] = NulChar; + CleanTextInput (tbuf); + } + else + { + return file_if_end (Line); + } + /* if( TRUE ) */ + { + VariantType variant; + + variant.VariantTypeCode = StringTypeCode; + variant.Buffer = tbuf; + variant.Length = bwb_strlen (variant.Buffer); + if (var_set (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (Line); + } + } + return (Line); + } + WARN_TYPE_MISMATCH; + return (Line); +} + +static LineType * +C77_file_input_finish (LineType * Line) +{ + /* + CBASIC-II: RANDOM file reads always acccess a complete record + */ + long ByteOffset; + assert (Line != NULL); + assert(My != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + /* advance to the end-of-record */ + if (My->CurrentFile->width <= 0) + { + WARN_FIELD_OVERFLOW; + return (Line); + } + ByteOffset = ftell (My->CurrentFile->cfp); + ByteOffset %= My->CurrentFile->width; + if (ByteOffset != 0) + { + long RecordNumber; + RecordNumber = ftell (My->CurrentFile->cfp); + RecordNumber /= My->CurrentFile->width; + RecordNumber++; + RecordNumber *= My->CurrentFile->width; + fseek (My->CurrentFile->cfp, RecordNumber, SEEK_SET); + } + return (Line); +} + + +static LineType * +file_if_end (LineType * Line) +{ + /* IF END # FileNumber THEN LineNumber */ + assert (Line != NULL); + assert(My != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + if (My->CurrentFile->EOF_LineNumber > 0) + { + LineType *x; + + x = find_line_number (My->CurrentFile->EOF_LineNumber); /* not found in the cache */ + if (x != NULL) + { + /* FOUND */ + line_skip_eol (Line); + x->position = 0; + return x; + } + /* NOT FOUND */ + WARN_UNDEFINED_LINE; + return (Line); + } + WARN_INPUT_PAST_END; + return (Line); +} + +static LineType * +file_input (LineType * Line) +{ + /* INPUT # is similar to READ, where each file line is a DATA line */ + char *tbuf; + int tlen; + + + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + if (line_skip_word (Line, "LINE")) + { + return C77_file_input_line (Line); + } + } + + if (My->CurrentFile->width > 0 && My->CurrentFile->buffer != NULL) + { + tlen = My->CurrentFile->width; + tbuf = My->CurrentFile->buffer; + } + tbuf[0] = NulChar; + + /* Process each variable read from the INPUT # statement */ + do + { + VariableType *v; + + /* Read a variable name */ + if ((v = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return (Line); + } + + /* Read a file value */ + if (file_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + return file_if_end (Line); + } + /* OK */ + } + while (line_skip_seperator (Line)); + + if (My->CurrentVersion->OptionVersionValue & (C77) + && My->CurrentFile->DevMode & DEVMODE_RANDOM) + { + return C77_file_input_finish (Line); + } + return (Line); +} + + +/*************************************************************** + + FUNCTION: user_input_*() + + DESCRIPTION: This function does INPUT processing + from a determined string of input + data and a determined variable list + (both in memory). This presupposes + that input has been taken from My->SYSIN, + not from a disk file or device. + +***************************************************************/ +static ResultType +parse_string_isquoted (char *buffer, int *position, VariantType * X) +{ + /* + ** + ** QUOTED STRING + ** + ** Note: do NOT free() or RELEASE_VARIANT because 'X->Buffer' points into 'buffer' + ** + */ + int p; + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + p = *position; + + buff_skip_spaces (buffer, &p); /* keep this */ + if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + int Length; + int Start; + int QuoteCount; + + Length = 0; + QuoteCount = 0; + + QuoteCount++; + p++; + Start = p; + while (buffer[p]) + { + if (buffer[p] == My->CurrentVersion->OptionQuoteChar + && buffer[p + 1] == My->CurrentVersion->OptionQuoteChar + && My->CurrentVersion-> + OptionFlags & OPTION_BUGS_ON /* INPUT allows embedded quote pairs */ + ) + { + /* embedded quote pair "...""..." */ + QuoteCount++; + QuoteCount++; + p++; + p++; + Length++; + Length++; + } + else if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + /* properly terminated string "...xx..." */ + QuoteCount++; + p++; + break; + } + else + { + /* normal character */ + p++; + Length++; + } + } + if (My->CurrentVersion-> + OptionFlags & OPTION_BUGS_ON /* INPUT allows unmatched quotes pairs */ + ) + { + /* silently ignore */ + } + else if (QuoteCount & 1) + { + /* an ODD number of quotes (including embedded quotes) is an ERROR */ + return RESULT_UNPARSED; + } + /* + ** + ** OK + ** + */ + X->VariantTypeCode = StringTypeCode; + X->Buffer = &buffer[Start]; + X->Length = Length; + *position = p; + return RESULT_SUCCESS; + } + return RESULT_UNPARSED; +} +static ResultType +parse_string_unquoted (char *buffer, int *position, VariantType * X) +{ + /* + ** + ** UNQUOTED STRING + ** + ** Note: do NOT free() or RELEASE_VARIANT because 'X->Buffer' points into 'buffer' + ** + */ + int p; + int Length; + int Start; + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + Length = 0; + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + Start = p; + while (buffer[p] != NulChar && buffer[p] != My->CurrentFile->delimit) + { + char C; + C = buffer[p]; + + if (My->CurrentVersion-> + OptionFlags & OPTION_BUGS_ON /* INPUT allows unquoted strings */ ) + { + /* silently ignore */ + } + else if (C == ' ' || C == '+' || C == '-' || C == '.' || bwb_isalnum (C)) + { + /* if was NOT quoted, then the only valid chars are ' ', '+', '-', '.', digit, letter */ + } + else + { + /* ERROR */ + return RESULT_UNPARSED; + } + Length++; + p++; + } + /* RTRIM */ + while (Length > 0 && buffer[Start + Length - 1] == ' ') + { + Length--; + } + /* + ** + ** OK + ** + */ + X->VariantTypeCode = StringTypeCode; + X->Buffer = &buffer[Start]; + X->Length = Length; + *position = p; + return RESULT_SUCCESS; +} + +static ResultType +parse_string (char *buffer, int *position, VariantType * X) +{ + /* + ** + ** STRING + ** + ** Note: do NOT free() or RELEASE_VARIANT because 'X->Buffer' points into 'buffer' + ** + */ + ResultType Result; + int p; + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_is_eol (buffer, &p) + || buff_peek_char (buffer, &p, My->CurrentFile->delimit)) + { + /* process EMPTY response */ + if (My->CurrentVersion-> + OptionFlags & OPTION_BUGS_ON /* INPUT allows empty values */ ) + { + /* silently ignore, value is "" */ + X->VariantTypeCode = StringTypeCode; + X->Buffer = &buffer[p]; + X->Length = 0; + Result = RESULT_SUCCESS; + } + else + { + return RESULT_UNPARSED; + } + } + Result = parse_string_isquoted (buffer, &p, X); + if (Result == RESULT_UNPARSED) + { + Result = parse_string_unquoted (buffer, &p, X); + } + if (Result == RESULT_SUCCESS) + { + *position = p; + } + return Result; +} + +static ResultType +parse_number (char *buffer, int *position, VariantType * X, + int IsConsoleInput) +{ + ResultType Result = RESULT_UNPARSED; + int p; + assert (buffer != NULL); + assert (position != NULL); + assert (X != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_is_eol (buffer, &p) + || buff_peek_char (buffer, &p, My->CurrentFile->delimit)) + { + /* process EMPTY response */ + if (My->CurrentVersion-> + OptionFlags & OPTION_BUGS_ON /* INPUT allows empty values */ ) + { + /* silently ignore, value is 0 */ + X->VariantTypeCode = DoubleTypeCode; + X->Number = 0; + return RESULT_SUCCESS; + } + else + { + return RESULT_UNPARSED; + } + } + Result = buff_read_hexadecimal_constant (buffer, &p, X, IsConsoleInput); + if (Result == RESULT_UNPARSED) + { + Result = buff_read_octal_constant (buffer, &p, X, IsConsoleInput); + } + if (Result == RESULT_UNPARSED) + { + int IsNegative; + + IsNegative = FALSE; + if (buff_skip_PlusChar (buffer, &p)) + { + /* ignore */ + } + else if (buff_skip_MinusChar (buffer, &p)) + { + IsNegative = TRUE; + } + Result = buff_read_decimal_constant (buffer, &p, X, IsConsoleInput); + if (Result == RESULT_SUCCESS) + { + if (IsNegative) + { + X->Number = -X->Number; + } + } + } + if (Result == RESULT_SUCCESS) + { + *position = p; + } + return Result; +} + +static ResultType +user_input_values (LineType * Line, char *buffer, int IsReal) +{ + /* + ** + ** given a response, match with the list of variables + ** + */ + int p; + + assert (Line != NULL); + assert (buffer != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert (My->CurrentFile == My->SYSIN); + + p = 0; + /* Read elements in buffer and assign them to variables in Line */ + do + { + ResultType Result; + VariableType *Variable; + VariantType Variant; + VariantType *X; + + X = &Variant; + CLEAR_VARIANT (X); + + /* get a variable name from the list */ + if ((Variable = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return RESULT_UNPARSED; + } + + /* get a value from the console response */ + Result = RESULT_UNPARSED; + if (VAR_IS_STRING (Variable)) + { + Result = parse_string (buffer, &p, X); + } + else + { + Result = parse_number (buffer, &p, X, TRUE); + } + if (Result != RESULT_SUCCESS) + { + return Result; + } + /* + ** + ** OK + ** + */ + if (IsReal) + { + /* + ** + ** actually assign the value + ** + */ + if (X->VariantTypeCode == StringTypeCode + && My->CurrentVersion-> + OptionFlags & OPTION_BUGS_ON /* INPUT allows embedded quote pairs */ + ) + { + int i; + int n; + n = X->Length; + for (i = 0; i < n; i++) + { + if (X->Buffer[i + 0] == My->CurrentVersion->OptionQuoteChar + && X->Buffer[i + 1] == My->CurrentVersion->OptionQuoteChar) + { + bwb_strncpy (&X->Buffer[i + 0], &X->Buffer[i + 1], n - i); + n--; + } + } + X->Length = n; + } + if (var_set (Variable, X) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return RESULT_UNPARSED; + } + } + /* + ** + ** STRING + ** + ** Note: do NOT free() or RELEASE_VARIANT because 'X->Buffer' points into 'buffer' + ** + */ + } + while (line_skip_seperator (Line) + && buff_skip_char (buffer, &p, My->CurrentFile->delimit)); + + /* verify all variables and values consumed */ + if (line_is_eol (Line) && buff_is_eol (buffer, &p)) + { + /* + ** + ** OK + ** + */ + return RESULT_SUCCESS; + } + /* Count mismatch */ + return RESULT_UNPARSED; +} + +static LineType * +C77_user_input_line (LineType * Line, char *Prompt, int IsDisplayQuestionMark) +{ + /* + ** + ** CBASIC-II: INPUT "prompt" ; LINE variable$ + ** + */ + VariableType *v; + assert (Line != NULL); + assert(My != NULL); + assert (My->CurrentFile != NULL); + assert ((My->CurrentFile->DevMode & DEVMODE_READ) != 0); + + if ((v = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (v->VariableFlags & (VARIABLE_CONSTANT)) + { + WARN_VARIABLE_NOT_DECLARED; + return (Line); + } + if (VAR_IS_STRING (v)) + { + VariantType variant; + char *tbuf; + int tlen; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + bwx_input (Prompt, IsDisplayQuestionMark, tbuf, tlen); + variant.VariantTypeCode = StringTypeCode; + variant.Buffer = tbuf; + variant.Length = bwb_strlen (variant.Buffer); + if (var_set (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (Line); + } + /* OK */ + if (Prompt != NULL) + { + free (Prompt); + /* Prompt = NULL; */ + } + return (Line); + } + WARN_TYPE_MISMATCH; + return (Line); +} + +static LineType * +user_input_loop (LineType * Line) +{ + char *Prompt; + int IsDisplayQuestionMark; + int SavePosition; + assert (Line != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + Prompt = NULL; + IsDisplayQuestionMark = TRUE; + My->CurrentFile = My->SYSIN; + /* + ** + ** Step 1. Determine the prompt + ** Step 2. Verify all variables exist and are not CONST + ** Step 3. Display prompt and get user response + ** Step 4. Assign user response to variables + ** + */ + + /* + ** + ** Step 1. Determine the prompt + ** + */ + /* INPUT , "prompt" A, B, C */ + /* INPUT ; "prompt" A, B ,C */ + /* INPUT : "prompt" A, B, C */ + if (line_skip_seperator (Line)) + { + /* optional */ + IsDisplayQuestionMark = FALSE; + } + + if (line_peek_QuoteChar (Line)) + { + /* get prompt string */ + if (line_read_string_expression (Line, &Prompt) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_skip_seperator (Line) == ',' /* comma-specific */ ) + { + /* optional */ + IsDisplayQuestionMark = FALSE; + } + } + + if (My->CurrentVersion->OptionVersionValue & (C77) + && line_skip_word (Line, "LINE")) + { + /* INPUT "prompt" ; LINE variable$ */ + return C77_user_input_line (Line, Prompt, IsDisplayQuestionMark); + } + /* + ** + ** Step 2. Verify all variables exist and are not CONST + ** + */ + SavePosition = Line->position; + do + { + VariableType *v; + + if ((v = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (v->VariableFlags & (VARIABLE_CONSTANT)) + { + WARN_VARIABLE_NOT_DECLARED; + return (Line); + } + } + while (line_skip_seperator (Line)); + if (line_is_eol (Line)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return (Line); + } + while (TRUE) + { + char *tbuf; + int tlen; + ResultType Result; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + /* + ** + ** Step 3. Display prompt and get user response + ** + */ + bwx_input (Prompt, IsDisplayQuestionMark, tbuf, tlen); + /* + ** + ** Step 4. Assign user response to variables + ** + */ + Line->position = SavePosition; + Result = user_input_values (Line, tbuf, FALSE /* FAKE run */ ); /* bwb_INPUT, user_input_loop */ + if (Result == RESULT_SUCCESS) /* bwb_INPUT */ + { + /* successful input, FAKE run */ + Line->position = SavePosition; + Result = user_input_values (Line, tbuf, TRUE /* REAL run */ ); /* bwb_INPUT, user_input_loop */ + if (Result == RESULT_SUCCESS) + { + /* successful input, REAL run */ + if (Prompt != NULL) + { + free (Prompt); + Prompt = NULL; + } + return (Line); + } + } + /* Result == RESULT_UNPARSED, RETRY */ + fputs ("?Redo from start\n", My->SYSOUT->cfp); /* "*** Retry INPUT ***\n" */ + ResetConsoleColumn (); + } + /* never reached */ + return (Line); +} + +extern LineType * +bwb_INPUT (LineType * Line) +{ + + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + My->CurrentFile = My->SYSIN; + if (line_skip_FilenumChar (Line)) + { + /* INPUT # X */ + int FileNumber; + + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_skip_seperator (Line)) + { + /* required */ + } + else + { + WARN_SYNTAX_ERROR; + return (Line); + } + /* INPUT # X , */ + if (FileNumber < 0) + { + /* "INPUT # -1" is an error */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (FileNumber > 0) + { + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if ((My->CurrentFile->DevMode & DEVMODE_READ) == 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + return file_input (Line); + } + /* "INPUT #0, varlist" is the same as "INPUT varlist" */ + } + /* input is from My->SYSIN */ + return user_input_loop (Line); +} + + + +/*************************************************************** + + FUNCTION: bwb_LINE() + + DESCRIPTION: This function implements the BASIC LINE + INPUT statement. + + SYNTAX: LINE INPUT [[#] device-number,]["prompt string";] string-variable$ + +***************************************************************/ +extern LineType * +bwb_LINE (LineType * Line) +{ + + assert (Line != NULL); + + WARN_SYNTAX_ERROR; + return (Line); +} + +extern LineType * +bwb_INPUT_LINE (LineType * Line) +{ + + assert (Line != NULL); + + return bwb_LINE_INPUT (Line); +} + +extern LineType * +bwb_LINE_INPUT (LineType * Line) +{ + int FileNumber; + VariableType *v; + char *tbuf; + int tlen; + char *Prompt; + + assert (Line != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + assert(My->ConsoleInput != NULL); + assert(MAX_LINE_LENGTH > 1); + + /* assign default values */ + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + Prompt = NULL; + My->CurrentFile = My->SYSIN; + + /* check for leading semicolon */ + if (line_skip_seperator (Line)) + { + /* optional */ + } + if (line_skip_FilenumChar (Line)) + { + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (FileNumber < 0) + { + /* "LINE INPUT # -1" is an error */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (FileNumber > 0) + { + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if ((My->CurrentFile->DevMode & DEVMODE_READ) == 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile->cfp == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + } + /* check for comma */ + if (line_skip_seperator (Line)) + { + /* optional */ + } + } + + /* check for quotation mark indicating prompt */ + if (line_peek_QuoteChar (Line)) + { + /* get prompt string */ + if (line_read_string_expression (Line, &Prompt) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + /* check for comma */ + if (line_skip_seperator (Line)) + { + /* optional */ + } + } + + /* read the variable for assignment */ + if ((v = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (VAR_IS_STRING (v)) + { + /* OK */ + } + else + { + /* ERROR */ + WARN_TYPE_MISMATCH; + return (Line); + } + + /* read a line of text into the bufffer */ + if (My->CurrentFile == My->SYSIN) + { + /* LINE INPUT never displays a '?' regardless of the ',' or ';' */ + bwx_input (Prompt, FALSE, tbuf, tlen); + } + else + { + if (fgets (tbuf, tlen, My->CurrentFile->cfp)) /* bwb_LINE_INPUT */ + { + tbuf[tlen] = NulChar; + CleanTextInput (tbuf); + } + else + { + return file_if_end (Line); + } + } + /* if( TRUE ) */ + { + VariantType variant; + + variant.VariantTypeCode = StringTypeCode; + variant.Buffer = tbuf; + variant.Length = bwb_strlen (variant.Buffer); + if (var_set (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (Line); + } + } + if (Prompt != NULL) + { + free (Prompt); + Prompt = NULL; + } + return (Line); +} + +static LineType * +file_read_matrix (LineType * Line) +{ + /* MAT GET filename$ , matrix [, ...] */ + /* MAT READ arrayname [;|,] */ + /* Array must be 1, 2 or 3 dimensions */ + /* Array may be either NUMBER or STRING */ + VariableType *v; + + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + assert(My->ConsoleInput != NULL); + assert(MAX_LINE_LENGTH > 1); + assert(My->CurrentFile != NULL); + + My->LastInputCount = 0; + do + { + char *tbuf; + int tlen; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + if (My->CurrentFile->width > 0 && My->CurrentFile->buffer != NULL) + { + tlen = My->CurrentFile->width; + tbuf = My->CurrentFile->buffer; + } + tbuf[0] = NulChar; + + My->LastInputCount = 0; + if ((v = line_read_matrix (Line)) == NULL) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (Line); + } + /* variable MUST be an array of 1, 2 or 3 dimensions */ + if (v->dimensions < 1) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (Line); + } + if (v->dimensions > 3) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (Line); + } + + /* READ array */ + switch (v->dimensions) + { + case 1: + { + /* + OPTION BASE 0 + DIM A(5) + ... + MAT READ A + ... + FOR I = 0 TO 5 + READ A(I) + NEXT I + ... + */ + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + if (My->CurrentFile == My->SYSIN) + { + if (read_data (v) != RESULT_SUCCESS) + { + return data_if_end (Line); + } + } + else + { + if (file_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + return file_if_end (Line); + } + } + /* OK */ + My->LastInputCount++; + } + } + break; + case 2: + { + /* + OPTION BASE 0 + DIM B(2,3) + ... + MAT READ B + ... + FOR I = 0 TO 2 + FOR J = 0 TO 3 + READ B(I,J) + NEXT J + PRINT + NEXT I + ... + */ + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + for (v->VINDEX[1] = v->LBOUND[1]; v->VINDEX[1] <= v->UBOUND[1]; + v->VINDEX[1]++) + { + if (My->CurrentFile == My->SYSIN) + { + if (read_data (v) != RESULT_SUCCESS) + { + return data_if_end (Line); + } + } + else + { + if (file_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + return file_if_end (Line); + } + } + /* OK */ + My->LastInputCount++; + } + } + } + break; + case 3: + { + /* + OPTION BASE 0 + DIM C(2,3,4) + ... + MAT READ C + ... + FOR I = 0 TO 2 + FOR J = 0 TO 3 + FOR K = 0 TO 4 + READ C(I,J,K) + NEXT K + PRINT + NEXT J + PRINT + NEXT I + ... + */ + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + for (v->VINDEX[1] = v->LBOUND[1]; v->VINDEX[1] <= v->UBOUND[1]; + v->VINDEX[1]++) + { + for (v->VINDEX[2] = v->LBOUND[2]; v->VINDEX[2] <= v->UBOUND[2]; + v->VINDEX[2]++) + { + if (My->CurrentFile == My->SYSIN) + { + if (read_data (v) != RESULT_SUCCESS) + { + return data_if_end (Line); + } + } + else + { + if (file_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + return file_if_end (Line); + } + } + /* OK */ + My->LastInputCount++; + } + } + } + } + break; + } + /* process the next variable, if any */ + } + while (line_skip_seperator (Line)); + return (Line); +} + +extern LineType * +bwb_MAT_GET (LineType * Line) +{ + /* MAT GET filename$ , matrix [, ...] */ + VariantType E; + VariantType *e; + + assert (Line != NULL); + assert(My != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + e = &E; + My->CurrentFile = My->SYSIN; + if (line_read_expression (Line, e) == FALSE) /* bwb_MAT_GET */ + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (e->VariantTypeCode == StringTypeCode) + { + /* STRING */ + /* MAT GET filename$ ... */ + if (is_empty_string (e->Buffer)) + { + /* MAT GET "" ... is an error */ + WARN_BAD_FILE_NAME; + return (Line); + } + My->CurrentFile = find_file_by_name (e->Buffer); + if (My->CurrentFile == NULL) + { + /* implicitly OPEN for reading */ + My->CurrentFile = file_new (); + My->CurrentFile->cfp = fopen (e->Buffer, "r"); + if (My->CurrentFile->cfp == NULL) + { + WARN_BAD_FILE_NAME; + return (Line); + } + My->CurrentFile->FileNumber = file_next_number (); + My->CurrentFile->DevMode = DEVMODE_INPUT; + My->CurrentFile->width = 0; + /* WIDTH == RECLEN */ + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + My->CurrentFile->buffer = NULL; + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = e->Buffer; + e->Buffer = NULL; + } + } + else + { + /* NUMBER -- file must already be OPEN */ + /* GET filenumber ... */ + if (e->Number < 0) + { + /* "MAT GET # -1" is an error */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (e->Number == 0) + { + /* "MAT GET # 0" is an error */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + /* normal file */ + My->CurrentFile = find_file_by_number ((int) bwb_rint (e->Number)); + if (My->CurrentFile == NULL) + { + /* file not OPEN */ + WARN_BAD_FILE_NUMBER; + return (Line); + } + } + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if ((My->CurrentFile->DevMode & DEVMODE_READ) == 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (line_skip_seperator (Line)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return (Line); + } + return file_read_matrix (Line); +} + + +extern LineType * +bwb_MAT_READ (LineType * Line) +{ + /* MAT READ arrayname [;|,] */ + /* Array must be 1, 2 or 3 dimensions */ + /* Array may be either NUMBER or STRING */ + + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + + My->CurrentFile = My->SYSIN; + My->LastInputCount = 0; + if (line_skip_FilenumChar (Line)) + { + /* MAT READ # filenum, varlist */ + int FileNumber; + + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + + if (line_skip_seperator (Line)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return (Line); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile != My->SYSIN) + { + if ((My->CurrentFile->DevMode & DEVMODE_READ) == 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile->cfp == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + } + /* "MAT READ # 0, varlist" is the same as "MAT READ varlist" */ + } + return file_read_matrix (Line); +} + +static ResultType +input_data (VariableType * Variable, char *tbuf, int tlen) +{ + /* + ** + ** read one INPUT item + ** + */ + int p; + ResultType Result; + VariantType Variant; + VariantType *X; + + assert (Variable != NULL); + assert (tbuf != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + assert(My->CurrentFile != NULL); + assert (My->CurrentFile == My->SYSIN); + + Result = RESULT_UNPARSED; + X = &Variant; + CLEAR_VARIANT (X); + if (tbuf[0] == NulChar) + { + /* Get more data */ + bwx_input ("?", FALSE, tbuf, tlen); + if (tbuf[0] == NulChar) + { + return RESULT_UNPARSED; + } + /* + ** + ** make sure we can parse everything in tbuf + ** + */ + p = 0; + do + { + do + { + if (VAR_IS_STRING (Variable)) + { + Result = parse_string (tbuf, &p, X); + } + else + { + Result = parse_number (tbuf, &p, X, FALSE); + } + } + while (buff_skip_seperator (tbuf, &p) && Result == RESULT_SUCCESS); + /* verify we consumed all user values */ + if (buff_is_eol (tbuf, &p)) + { + /* we reached the end of the user's input */ + } + else + { + /* garbage in user's input */ + Result = RESULT_UNPARSED; + } + if (Result != RESULT_SUCCESS) + { + tbuf[0] = NulChar; + bwx_input ("?Redo", FALSE, tbuf, tlen); + if (tbuf[0] == NulChar) + { + return RESULT_UNPARSED; + } + p = 0; + } + } + while (Result != RESULT_SUCCESS); + /* + ** + ** so, we can parse all of the user's input (everything in tbuf) + ** + */ + } + /* process one value */ + p = 0; + if (VAR_IS_STRING (Variable)) + { + Result = parse_string (tbuf, &p, X); + } + else + { + Result = parse_number (tbuf, &p, X, FALSE); + } + if (Result != RESULT_SUCCESS) + { + WARN_INTERNAL_ERROR; + return RESULT_UNPARSED; + } + if (X->VariantTypeCode == StringTypeCode + && My->CurrentVersion-> + OptionFlags & OPTION_BUGS_ON /* DATA allows embedded quote pairs */ ) + { + int i; + int n; + n = X->Length; + for (i = 0; i < n; i++) + { + if (X->Buffer[i + 0] == My->CurrentVersion->OptionQuoteChar + && X->Buffer[i + 1] == My->CurrentVersion->OptionQuoteChar) + { + bwb_strncpy (&X->Buffer[i + 0], &X->Buffer[i + 1], n - i); + n--; + } + } + X->Length = n; + } + if (var_set (Variable, X) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return RESULT_UNPARSED; + } + /* determine whether all user input was consumed */ + if (buff_is_eol (tbuf, &p)) + { + /* we have consumed the entire buffer */ + tbuf[0] = NulChar; + return RESULT_SUCCESS; + } + if (buff_skip_char (tbuf, &p, My->CurrentFile->delimit)) /* buff_skip_comma */ + { + /* shift the buffer left, just past the comma (,) */ + bwb_strcpy (tbuf, &tbuf[p]); + return RESULT_SUCCESS; + } + /* garbage after the value we just READ */ + WARN_BAD_DATA; + return RESULT_UNPARSED; +} + +extern LineType * +bwb_MAT_INPUT (LineType * Line) +{ + /* MAT INPUT arrayname [;|,] */ + /* Array must be 1, 2 or 3 dimensions */ + /* Array may be either NUMBER or STRING */ + VariableType *v; + + assert (Line != NULL); + assert(My != NULL); + assert(My->CurrentVersion != NULL); + assert(My->SYSIN != NULL); + assert(My->SYSIN->cfp != NULL); + assert(My->ConsoleInput != NULL); + assert(MAX_LINE_LENGTH > 1); + + My->CurrentFile = My->SYSIN; + My->LastInputCount = 0; + if (line_skip_FilenumChar (Line)) + { + /* MAT INPUT # filenum, varlist */ + int FileNumber; + + if (line_read_integer_expression (Line, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + + if (line_skip_seperator (Line)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return (Line); + } + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile != My->SYSIN) + { + if ((My->CurrentFile->DevMode & DEVMODE_READ) == 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile->cfp == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + } + /* "MAT INPUT # 0, varlist" is the same as "MAT INPUT varlist" */ + } + + do + { + char *tbuf; + int tlen; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + if (My->CurrentFile->width > 0 && My->CurrentFile->buffer != NULL) + { + tlen = My->CurrentFile->width; + tbuf = My->CurrentFile->buffer; + } + tbuf[0] = NulChar; + + + My->LastInputCount = 0; + if ((v = line_read_matrix (Line)) == NULL) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (Line); + } + /* variable MUST be an array of 1, 2 or 3 dimensions */ + if (v->dimensions < 1) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (Line); + } + if (v->dimensions > 3) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (Line); + } + + /* INPUT array */ + switch (v->dimensions) + { + case 1: + { + /* + OPTION BASE 0 + DIM A(5) + ... + MAT INPUT A + ... + FOR I = 0 TO 5 + INPUT A(I) + NEXT I + ... + */ + My->LastInputCount = 0; + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + if (My->CurrentFile == My->SYSIN) + { + if (input_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + /* + WARN_INPUT_PAST_END; + */ + return (Line); + } + } + else + { + if (file_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + return file_if_end (Line); + } + } + /* OK */ + My->LastInputCount++; + } + } + break; + case 2: + { + /* + OPTION BASE 0 + DIM B(2,3) + ... + MAT INPUT B + ... + FOR I = 0 TO 2 + FOR J = 0 TO 3 + INPUT B(I,J) + NEXT J + PRINT + NEXT I + ... + */ + My->LastInputCount = 0; + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + for (v->VINDEX[1] = v->LBOUND[1]; v->VINDEX[1] <= v->UBOUND[1]; + v->VINDEX[1]++) + { + if (My->CurrentFile == My->SYSIN) + { + if (input_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + /* + WARN_INPUT_PAST_END; + */ + return (Line); + } + } + else + { + if (file_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + return file_if_end (Line); + } + } + /* OK */ + My->LastInputCount++; + } + } + } + break; + case 3: + { + /* + OPTION BASE 0 + DIM C(2,3,4) + ... + MAT INPUT C + ... + FOR I = 0 TO 2 + FOR J = 0 TO 3 + FOR K = 0 TO 4 + INPUT C(I,J,K) + NEXT K + PRINT + NEXT J + PRINT + NEXT I + ... + */ + My->LastInputCount = 0; + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + for (v->VINDEX[1] = v->LBOUND[1]; v->VINDEX[1] <= v->UBOUND[1]; + v->VINDEX[1]++) + { + for (v->VINDEX[2] = v->LBOUND[2]; v->VINDEX[2] <= v->UBOUND[2]; + v->VINDEX[2]++) + { + if (My->CurrentFile == My->SYSIN) + { + if (input_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + /* + WARN_INPUT_PAST_END; + */ + return (Line); + } + } + else + { + if (file_data (v, tbuf, tlen) != RESULT_SUCCESS) + { + return file_if_end (Line); + } + } + /* OK */ + My->LastInputCount++; + } + } + } + } + break; + } + /* process the next variable, if any */ + } + while (line_skip_seperator (Line)); + return (Line); +} + +/* EOF */ diff --git a/bwb_int.c b/bwb_int.c new file mode 100644 index 0000000..31ec041 --- /dev/null +++ b/bwb_int.c @@ -0,0 +1,4086 @@ +/***************************************************************f + + bwb_int.c Line Interpretation Routines + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + +static int buff_read_keyword (char *buffer, int *position, char *keyword); +static int bwb_chartype (int C); +static int char_is_varfirst (char C); +static char char_is_varhead (char C); +static int char_is_varnext (char C); +static int char_is_vartail (char C); +static int GetKeyword (LineType * l, char *Keyword); +static void internal_DEF8SUB (LineType * l); +static int is_cmd (char *name); +static int is_let (char *buffer); +static int line_read_keyword (LineType * line, char *keyword); + +extern void +buff_skip_spaces (char *buffer, int *position) +{ + /* + skip spaces in 'buffer'. + 'position' is always updated. + */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + + p = *position; + + while (buffer[p] == ' ') + { + p++; + } + + *position = p; +} + +extern void +line_skip_spaces (LineType * line) +{ + + assert (line != NULL); + buff_skip_spaces (line->buffer, &(line->position)); /* keep this */ +} + +extern void +buff_skip_eol (char *buffer, int *position) +{ + /* + skip to the NUL (NulChar) in 'buffer'. + always updates 'position'. + */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + + p = *position; + + while (buffer[p]) + { + p++; + } + + *position = p; +} + +extern void +line_skip_eol (LineType * line) +{ + + assert (line != NULL); + buff_skip_eol (line->buffer, &(line->position)); +} + +extern int +buff_is_eol (char *buffer, int *position) +{ + /* + determines whether 'position' is effectively at the NUL (NulChar) in 'buffer'. + if successful then 'position' is updated and returns TRUE + otherwise returns FALSE. + */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (buffer[p] == NulChar) + { + *position = p; + return TRUE; + } + return FALSE; +} + +extern int +line_is_eol (LineType * line) +{ + + assert (line != NULL); + return buff_is_eol (line->buffer, &(line->position)); +} + +extern int +buff_peek_char (char *buffer, int *position, char find) +{ + /* + determine whether the next non-space character in 'buffer' is 'find'. + if successful then returns TRUE + otherwise returns FALSE. + 'position' is unchanged. + */ + + assert (buffer != NULL); + assert (position != NULL); + + if (find != NulChar && find != ' ') + { + int p; + p = *position; + + buff_skip_spaces (buffer, &p); /* keep this */ + if (buffer[p] == find) + { + return TRUE; + } + } + return FALSE; +} + +#if FALSE /* keep this ... */ +extern int +line_peek_char (LineType * line, char find) +{ + + assert (line != NULL); + return buff_peek_char (line->buffer, &(line->position), find); +} +#endif + +extern int +buff_peek_EqualChar (char *buffer, int *position) +{ + /* + determine whether the next non-space character in 'buffer' is 'find'. + if successful then returns TRUE + otherwise returns FALSE. + 'position' is unchanged. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_peek_char (buffer, position, '='); +} + +extern int +line_peek_EqualChar (LineType * line) +{ + + assert (line != NULL); + return buff_peek_EqualChar (line->buffer, &(line->position)); +} + +extern int +buff_peek_QuoteChar (char *buffer, int *position) +{ + /* + determine whether the next non-space character in 'buffer' is 'find'. + if successful then returns TRUE + otherwise returns FALSE. + 'position' is unchanged. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_peek_char (buffer, position, + My->CurrentVersion->OptionQuoteChar); +} + +extern int +line_peek_QuoteChar (LineType * line) +{ + + assert (line != NULL); + return buff_peek_QuoteChar (line->buffer, &(line->position)); +} + +extern int +buff_peek_LparenChar (char *buffer, int *position) +{ + /* + determine whether the next non-space character in 'buffer' is 'find'. + if successful then returns TRUE + otherwise returns FALSE. + 'position' is unchanged. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_peek_char (buffer, position, + My->CurrentVersion->OptionLparenChar); +} + +extern int +line_peek_LparenChar (LineType * line) +{ + + assert (line != NULL); + return buff_peek_LparenChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_char (char *buffer, int *position, char find) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + 'find' is NOT an alphabetic (A-Z,a-z) character. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + + if (find) + { + int p; + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (buffer[p] == find) + { + p++; + *position = p; + return TRUE; + } + } + return FALSE; +} + +extern int +line_skip_char (LineType * line, char find) +{ + + assert (line != NULL); + return buff_skip_char (line->buffer, &(line->position), find); +} + +extern int +buff_skip_FilenumChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, + My->CurrentVersion->OptionFilenumChar); +} + +extern int +line_skip_FilenumChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_FilenumChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_AtChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, + My->CurrentVersion->OptionAtChar); +} + +extern int +line_skip_AtChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_AtChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_LparenChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, + My->CurrentVersion->OptionLparenChar); +} + +extern int +line_skip_LparenChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_LparenChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_RparenChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, + My->CurrentVersion->OptionRparenChar); +} + +extern int +line_skip_RparenChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_RparenChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_CommaChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, ','); +} + +extern int +line_skip_CommaChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_CommaChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_SemicolonChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, ';'); +} + +extern int +line_skip_SemicolonChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_SemicolonChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_EqualChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, '='); +} + +extern int +line_skip_EqualChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_EqualChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_StarChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, '*'); +} + +extern int +line_skip_StarChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_StarChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_PlusChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, '+'); +} + +extern int +line_skip_PlusChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_PlusChar (line->buffer, &(line->position)); +} + +extern int +buff_skip_MinusChar (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is 'find'. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + + assert (buffer != NULL); + assert (position != NULL); + return buff_skip_char (buffer, position, '-'); +} + +extern int +line_skip_MinusChar (LineType * line) +{ + + assert (line != NULL); + return buff_skip_MinusChar (line->buffer, &(line->position)); +} + +extern char +buff_skip_seperator (char *buffer, int *position) +{ + /* + skip the next non-space character in 'buffer' if it is a seperator (comma, semicolon, or colon). + if successful then 'position' is updated past the character and returns the character skipped + otherwise 'position' is unchanged and returns NulChar. + */ + int p; + char C; + + assert (buffer != NULL); + assert (position != NULL); + + p = *position; + + + buff_skip_spaces (buffer, &p); /* keep this */ + C = buffer[p]; + switch (C) + { + case ',': /* COMMA */ + case ';': /* SEMICOLON */ + case ':': /* COLON */ + p++; + buff_skip_spaces (buffer, &p); /* keep this */ + *position = p; + return C; + } + return NulChar; +} + + +extern char +line_skip_seperator (LineType * line) +{ + + assert (line != NULL); + return buff_skip_seperator (line->buffer, &(line->position)); +} + +static int +char_is_varfirst (char C) +{ + /* + determine whether the character is allowed to be the first character of a BASIC variable name. + if successful then returns TRUE + otherwise returns FALSE. + */ + + if (C == NulChar || C == ' ') + { + return FALSE; /* never allowed */ + } + if (bwb_isalpha (C)) + { + return TRUE; /* always allowed */ + } + /* dialect specific */ + switch (C) + { + case '@': + case '#': + case '$': + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + /* alphabet extenders */ + return TRUE; + } + break; + } + /* NOT FOUND */ + return FALSE; +} + +static int +char_is_varnext (char C) +{ + /* + determine whether the character is allowed to be the second character of a BASIC variable name. + if successful then returns TRUE + otherwise returns FALSE. + */ + + if (C == NulChar || C == ' ') + { + return FALSE; /* never allowed */ + } + if (bwb_isalnum (C)) + { + return TRUE; /* always allowed */ + } + /* dialect specific */ + switch (C) + { + case '.': + case '_': + if (My->CurrentVersion->OptionFlags & (OPTION_BUGS_ON)) /* varname: period and underscore are allowed */ + { + return TRUE; + } + break; + case '@': + case '#': + case '$': + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) /* alphabet extenders */ + { + return TRUE; + } + break; + } + /* NOT FOUND */ + return FALSE; +} + +extern char +TypeCode_to_Char (char TypeCode) +{ + /* + Convert the internal TypeCode value into the dialect-specifc tail character. + if successful then returns the dialect-specifc tail character + otherwise returns NulChar. + */ + switch (TypeCode) + { + case ByteTypeCode: + return My->CurrentVersion->OptionByteChar; + case IntegerTypeCode: + return My->CurrentVersion->OptionIntegerChar; + case LongTypeCode: + return My->CurrentVersion->OptionLongChar; + case CurrencyTypeCode: + return My->CurrentVersion->OptionCurrencyChar; + case SingleTypeCode: + return My->CurrentVersion->OptionSingleChar; + case DoubleTypeCode: + return My->CurrentVersion->OptionDoubleChar; + case StringTypeCode: + return My->CurrentVersion->OptionStringChar; + } + /* NOT FOUND */ + return NulChar; +} + +extern char +Char_to_TypeCode (char C) +{ + /* + Convert the dialect-specifc tail character into the internal TypeCode value. + if successful then returns the internal TypeCode value + otherwise returns NulChar. + */ + + if (C == NulChar || C == ' ') + { + return NulChar; /* never allowed */ + } + /* dialect specific */ + if (C == My->CurrentVersion->OptionByteChar) + { + return ByteTypeCode; + } + if (C == My->CurrentVersion->OptionIntegerChar) + { + return IntegerTypeCode; + } + if (C == My->CurrentVersion->OptionLongChar) + { + return LongTypeCode; + } + if (C == My->CurrentVersion->OptionCurrencyChar) + { + return CurrencyTypeCode; + } + if (C == My->CurrentVersion->OptionSingleChar) + { + return SingleTypeCode; + } + if (C == My->CurrentVersion->OptionDoubleChar) + { + return DoubleTypeCode; + } + if (C == My->CurrentVersion->OptionStringChar) + { + return StringTypeCode; + } + /* NOT FOUND */ + return NulChar; +} + +extern char +var_nametype (char *name) +{ + /* + determine the internal TypeCode associated with the vaariable name. + if successful then returns the internal TypeCode value + otherwise returns NulChar. + */ + + assert (name != NULL); + + if (name == NULL) + { + WARN_INTERNAL_ERROR; + return NulChar; + } + /* look only at the last charactr of the variable name */ + if (*name) + { + while (*name) + { + name++; + } + name--; + } + return Char_to_TypeCode (*name); +} + +static char +char_is_varhead (char C) +{ + /* + determine whether the character is allowed at the head of a variable name. + if successful then returns TRUE + otherwise retuns FALSE. + */ + + if (C == NulChar || C == ' ') + { + return NulChar; + } /* never allowed */ + if (char_is_varfirst (C)) + { + return C; + } + if (char_is_varnext (C)) + { + return C; + } + return NulChar; +} + +static int +char_is_vartail (char C) +{ + /* + determine whether the character is allowed at the tail of a variable name. + if successful then returns TRUE + otherwise retuns FALSE. + */ + + if (C == NulChar || C == ' ') + { + return FALSE; /* never allowed */ + } + if (char_is_varnext (C)) + { + return TRUE; + } + if (Char_to_TypeCode (C)) + { + return TRUE; + } + return FALSE; +} + +#if FALSE /* kepp this ... */ +extern int +buff_peek_word (char *buffer, int *position, char *find) +{ + /* + determine whether the next non-space word in 'buffer' is 'find'; + the word 'find' is not allowed to be a sub-string of a bigger word. + if successful then returns TRUE + otherwise returns FALSE. + 'position' is unchanged. + */ + int p; + int n; + + assert (buffer != NULL); + assert (position != NULL); + assert (find != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_is_eol (buffer, &p)) + { + return FALSE; + } + n = bwb_strlen (find); + if (bwb_strnicmp (&(buffer[p]), find, n) == 0) + { + if (p > 0) + { + if (char_is_varhead (buffer[p - 1])) + { + /* _TO */ + return FALSE; + } + } + if (char_is_vartail (buffer[p + n])) + { + /* TO_ */ + return FALSE; + } + return TRUE; + } + return FALSE; +} +#endif + +#if FALSE /* keep this ... */ +extern int +line_peek_word (LineType * line, char *find) +{ + + assert (line != NULL); + assert (find != NULL); + return buff_peek_word (line->buffer, &(line->position), find); +} +#endif + +extern int +buff_skip_word (char *buffer, int *position, char *find) +{ + /* + skip the next non-space word in 'buffer' if it is 'find'; + the word 'find' is not a sub-string of a bigger word. + if successful then 'position' is updated past 'find' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + int p; + int n; + + assert (buffer != NULL); + assert (position != NULL); + assert (find != NULL); + + p = *position; + + + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_is_eol (buffer, &p)) + { + return FALSE; + } + n = bwb_strlen (find); + if (bwb_strnicmp (&(buffer[p]), find, n) == 0) + { + if (p > 0) + { + if (char_is_varhead (buffer[p - 1])) + { + /* _TO */ + return FALSE; + } + } + if (char_is_vartail (buffer[p + n])) + { + /* TO_ */ + return FALSE; + } + p += n; + *position = p; + return TRUE; + } + return FALSE; +} + +extern int +line_skip_word (LineType * line, char *find) +{ + + assert (line != NULL); + assert (find != NULL); + return buff_skip_word (line->buffer, &(line->position), find); +} + +extern int +buff_read_varname (char *buffer, int *position, char *varname) +{ + /* + read the next non-space word in 'buffer' that conforms to a BASIC variable name into 'varname'. + if successful then 'position' is updated past 'varname' and returns TRUE + otherwise 'position' is unchanged ('varname' is truncated) and returns FALSE. + 'varname' shall be declared "char varname[NameLengthMax + 1]". + */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (varname != NULL); + + p = *position; + + buff_skip_spaces (buffer, &p); /* keep this */ + if (char_is_varfirst (buffer[p])) + { + int i; + i = 0; + + if (i > NameLengthMax) + { + i = NameLengthMax; + } + varname[i] = buffer[p]; + p++; + i++; + while (char_is_varnext (buffer[p])) + { + if (i > NameLengthMax) + { + i = NameLengthMax; + } + varname[i] = buffer[p]; + p++; + i++; + } + if (Char_to_TypeCode (buffer[p])) + { + if (i > NameLengthMax) + { + i = NameLengthMax; + } + varname[i] = buffer[p]; + p++; + i++; + } + varname[i] = NulChar; + *position = p; + return TRUE; + } + varname[0] = NulChar; + return FALSE; +} + +extern int +line_read_varname (LineType * line, char *varname) +{ + + assert (line != NULL); + assert (varname != NULL); + return buff_read_varname (line->buffer, &(line->position), varname); +} + +extern int +buff_read_label (char *buffer, int *position, char *label) +{ + /* + read the next non-space word in 'buffer' that conforms to a BASIC label name into 'label'. + if successful then 'position' is updated past 'label' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + 'label' shall be declared "char label[NameLengthMax + 1]". + */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (label != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (char_is_varfirst (buffer[p])) + { + int i; + i = 0; + + if (i > NameLengthMax) + { + i = NameLengthMax; + } + label[i] = buffer[p]; + p++; + i++; + while (char_is_varnext (buffer[p])) + { + if (i > NameLengthMax) + { + i = NameLengthMax; + } + label[i] = buffer[p]; + p++; + i++; + } + label[i] = NulChar; + *position = p; + return TRUE; + } + return FALSE; +} + +extern int +line_read_label (LineType * line, char *label) +{ + + assert (line != NULL); + assert (label != NULL); + return buff_read_label (line->buffer, &(line->position), label); +} + +static int +buff_read_keyword (char *buffer, int *position, char *keyword) +{ + /* + read the next non-space word in 'buffer' that conforms to a BASIC keyword into 'keyword'. + if successful then 'position' is updated past 'keyword' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + 'label' shall be declared "char keyword[NameLengthMax + 1]". + */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (keyword != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (char_is_varfirst (buffer[p])) + { + int i; + i = 0; + + if (i > NameLengthMax) + { + i = NameLengthMax; + } + keyword[i] = buffer[p]; + p++; + i++; + while (char_is_varnext (buffer[p])) + { + if (i > NameLengthMax) + { + i = NameLengthMax; + } + keyword[i] = buffer[p]; + p++; + i++; + } + if (Char_to_TypeCode (buffer[p]) == StringTypeCode) + { + if (i > NameLengthMax) + { + i = NameLengthMax; + } + keyword[i] = buffer[p]; + p++; + i++; + } + keyword[i] = NulChar; + *position = p; + return TRUE; + } + keyword[0] = NulChar; + return FALSE; +} + +static int +line_read_keyword (LineType * line, char *keyword) +{ + + assert (line != NULL); + assert (keyword != NULL); + return buff_read_keyword (line->buffer, &(line->position), keyword); +} + +extern VariableType * +buff_read_scalar (char *buffer, int *position) +{ + /* + read the next non-space word in 'buffer' that conforms to a BASIC variable name, + including both scalar variables and subscripted array variables. + if successful then 'position' is updated + past 'varname' for scalar variables + (past right parenthesis for subscripted array variables). + and returns a pointer to the variable. + otherwise 'position' is unchanged and returns NULL. + */ + int p; + VariableType *v; + char varname[NameLengthMax + 1]; + + assert (buffer != NULL); + assert (position != NULL); + + + p = *position; + + /* Read a variable name */ + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_read_varname (buffer, &p, varname) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return NULL; + } + if (buff_peek_LparenChar (buffer, &p)) + { + /* MUST be a an array */ + int n; + int n_params; /* number of parameters */ + int pp[MAX_DIMS]; + + /* get parameters because the variable is dimensioned */ + if (buff_read_array_dimensions (buffer, &p, &n_params, pp) == FALSE) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return NULL; + } + /* get the array variable */ + if ((v = var_find (varname, n_params, TRUE)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return NULL; + } + for (n = 0; n < v->dimensions; n++) + { + v->VINDEX[n] = pp[n]; + } + } + else + { + /* simple scalar variable */ + + if ((v = var_find (varname, 0, TRUE)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return NULL; + } + } + *position = p; + return v; +} + +extern VariableType * +line_read_scalar (LineType * line) +{ + + assert (line != NULL); + return buff_read_scalar (line->buffer, &(line->position)); +} + +extern VariableType * +buff_read_matrix (char *buffer, int *position) +{ + /* + read the next non-space word in 'buffer' that conforms to a BASIC matrix name, + including both simple matrix variables and redimensioned matrix variables. + if successful then 'position' is updated + past 'varname' for matrix variables + (past right parenthesis for redimensioned matrix variables). + and returns a pointer to the variable. + otherwise 'position' is unchanged and returns NULL. + */ + int p; + VariableType *v; + char varname[NameLengthMax + 1]; + + assert (buffer != NULL); + assert (position != NULL); + + + p = *position; + + /* Read a variable name */ + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_read_varname (buffer, &p, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return NULL; + } + v = mat_find (varname); + if (v == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return NULL; + } + if (buff_peek_LparenChar (buffer, &p)) + { + /* get requested matrix size, which is <= original matrix size */ + size_t array_units; + int n; + int dimensions; + int LBOUND[MAX_DIMS]; + int UBOUND[MAX_DIMS]; + + if (buff_read_array_redim (buffer, &p, &dimensions, LBOUND, UBOUND) == + FALSE) + { + WARN_SYNTAX_ERROR; + return NULL; + } + /* update array dimensions */ + array_units = 1; + for (n = 0; n < dimensions; n++) + { + if (UBOUND[n] < LBOUND[n]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return FALSE; + } + array_units *= UBOUND[n] - LBOUND[n] + 1; + } + if (array_units > v->array_units) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return FALSE; + } + v->dimensions = dimensions; + for (n = 0; n < dimensions; n++) + { + v->LBOUND[n] = LBOUND[n]; + v->UBOUND[n] = UBOUND[n]; + } + } + *position = p; + return v; +} + +extern VariableType * +line_read_matrix (LineType * line) +{ + + assert (line != NULL); + return buff_read_matrix (line->buffer, &(line->position)); +} + +extern int +buff_read_line_number (char *buffer, int *position, int *linenum) +{ + /* + read the next non-space word in 'buffer' that conforms to a BASIC line number. + if successful then 'position' is updated past 'linenum' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (linenum != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (bwb_isdigit (buffer[p])) + { + int i; + int n; + char label[NameLengthMax + 1]; + + i = 0; + while (bwb_isdigit (buffer[p])) + { + if (i > NameLengthMax) + { + i = NameLengthMax; + } + label[i] = buffer[p]; + p++; + i++; + } + label[i] = NulChar; + n = atoi (label); + *linenum = n; + *position = p; + return TRUE; + } + return FALSE; +} + +extern int +line_read_line_number (LineType * line, int *linenum) +{ + + assert (line != NULL); + assert (linenum != NULL); + return buff_read_line_number (line->buffer, &(line->position), linenum); +} + +extern int +buff_read_line_sequence (char *buffer, int *position, int *head, int *tail) +{ + /* + read the next non-space words in 'buffer' that conforms to a BASIC line number sequnence. + if successful then 'position' is updated past the line number sequence and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + /* + ### head == tail + ### - head to BMAX + ### - ### head to tail + - ### BMIN to tail + */ + int p; /* position */ + int h; /* head */ + int t; /* tail */ + char c; /* line range seperator for BREAK, DELETE and LIST */ + + assert (buffer != NULL); + assert (position != NULL); + assert (head != NULL); + assert (tail != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + c = '-'; + if (My->CurrentVersion->OptionVersionValue & (D70 | H80)) + { + c = ','; + } + + if (buff_skip_char (buffer, &p, c) /* line sequence seperator */ ) + { + /* - ... */ + if (buff_read_line_number (buffer, &p, &t)) + { + /* - ### */ + *head = MINLIN; + *tail = t; + *position = p; + return TRUE; + } + } + else + if (buff_read_line_number (buffer, &p, &h) /* line sequence seperator */ ) + { + /* ### ... */ + if (buff_skip_char (buffer, &p, c)) + { + /* ### - ... */ + if (buff_read_line_number (buffer, &p, &t)) + { + /* ### - ### */ + *head = h; + *tail = t; + *position = p; + return TRUE; + } + else + { + /* ### - */ + *head = h; + *tail = MAXLIN; + *position = p; + return TRUE; + } + } + else + { + /* ### */ + *head = h; + *tail = h; + *position = p; + return TRUE; + } + } + return FALSE; +} + +extern int +line_read_line_sequence (LineType * line, int *head, int *tail) +{ + + assert (line != NULL); + assert (head != NULL); + assert (tail != NULL); + return buff_read_line_sequence (line->buffer, &(line->position), head, + tail); +} + +extern int +buff_read_integer_expression (char *buffer, int *position, int *Value) +{ + /* + read the next non-space words in 'buffer' that conforms to a BASIC integer expression into 'Value'. + if successful then 'position' is updated past 'Value' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + 'Value' shall be declared "int Value". + */ + DoubleType X; + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (Value != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_read_numeric_expression (buffer, &p, &X)) + { + /* we want the rounded value */ + X = bwb_rint (X); + if (INT_MIN <= X && X <= INT_MAX) + { + /* OK */ + *Value = (int) bwb_rint (X); + *position = p; + return TRUE; + } + } + /* ERROR */ + return FALSE; +} + +extern int +line_read_integer_expression (LineType * line, int *Value) +{ + + assert (line != NULL); + assert (Value != NULL); + return buff_read_integer_expression (line->buffer, &(line->position), + Value); +} + + +extern int +buff_read_numeric_expression (char *buffer, int *position, DoubleType * Value) +{ + /* + read the next non-space words in 'buffer' that conforms to a BASIC numeric expression into 'Value'. + if successful then 'position' is updated past 'Value' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + 'Value' shall be declared "DoubleType Value". + */ + int p; + VariantType x; + VariantType *X; + + assert (buffer != NULL); + assert (position != NULL); + assert (Value != NULL); + + X = &x; + p = *position; + CLEAR_VARIANT (X); + + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_read_expression (buffer, &p, X) == FALSE) /* buff_read_numeric_expression */ + { + return FALSE; + } + if (X->VariantTypeCode != StringTypeCode) + { + /* OK */ + *Value = X->Number; + *position = p; + return TRUE; + } + RELEASE_VARIANT (X); + return FALSE; +} + +extern int +line_read_numeric_expression (LineType * line, DoubleType * Value) +{ + + assert (line != NULL); + assert (Value != NULL); + return buff_read_numeric_expression (line->buffer, &(line->position), + Value); +} + +extern int +buff_read_string_expression (char *buffer, int *position, char **Value) +{ + /* + read the next non-space words in 'buffer' that conforms to a BASIC string expression into 'Value'. + if successful then 'position' is updated past 'Value' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + 'Value' shall be declared "char * Value = NULL". + */ + int p; + VariantType x; + VariantType *X; + + assert (buffer != NULL); + assert (position != NULL); + assert (Value != NULL); + + X = &x; + p = *position; + CLEAR_VARIANT (X); + + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_read_expression (buffer, &p, X) == FALSE) /* buff_read_string_expression */ + { + return FALSE; + } + if (X->VariantTypeCode == StringTypeCode) + { + /* OK */ + X->Buffer[X->Length] = NulChar; + *Value = X->Buffer; + *position = p; + return TRUE; + /* the caller is responsible to free() the returned pointer */ + } + return FALSE; +} + +extern int +line_read_string_expression (LineType * line, char **Value) +{ + + assert (line != NULL); + assert (Value != NULL); + return buff_read_string_expression (line->buffer, &(line->position), Value); +} + +extern int +buff_read_index_item (char *buffer, int *position, int Index, int *Value) +{ + /* + read the next non-space words in 'buffer' that conforms to a BASIC integer expression list into 'Value', + selecting the item matching 'Index'. The first 'Index' value is one; + if successful then 'position' is updated past 'Value' and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + 'Value' shall be declared "int Value". + */ + int p; + int i; + + assert (buffer != NULL); + assert (position != NULL); + assert (Value != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_is_eol (buffer, &p)) + { + return FALSE; + } + if (Index < 1) + { + return FALSE; + } + /* Index >= 1 */ + i = 0; + do + { + int v; + + if (buff_read_integer_expression (buffer, &p, &v)) + { + i++; + if (i == Index) + { + *Value = v; + *position = p; + return TRUE; + } + } + else + { + return FALSE; + } + } + while (buff_skip_seperator (buffer, &p)); + return FALSE; +} + +extern int +line_read_index_item (LineType * line, int Index, int *Value) +{ + + assert (line != NULL); + assert (Value != NULL); + return buff_read_index_item (line->buffer, &(line->position), Index, Value); +} + + +extern int +buff_read_letter_sequence (char *buffer, int *position, char *head, + char *tail) +{ + /* + read the next non-space alphabetic character in 'buffer' into 'start'; + if seperated by a hyphen ('-') then read the next non-space alphabetic character into 'end'. + if successful then 'position' is updated past 'start' (or 'end') and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + int p; + char h; + char t; + + assert (buffer != NULL); + assert (position != NULL); + assert (head != NULL); + assert (tail != NULL); + + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + if (bwb_isalpha (buffer[p]) == FALSE) + { + /* character at this position must be a letter */ + return FALSE; + } + h = buffer[p]; + p++; + + /* check for hyphen, indicating sequence of more than one letter */ + if (buff_skip_MinusChar (buffer, &p)) + { + buff_skip_spaces (buffer, &p); /* keep this */ + if (bwb_isalpha (buffer[p]) == FALSE) + { + /* character at this position must be a letter */ + return FALSE; + } + t = buffer[p]; + p++; + } + else + { + t = h; + } + *head = h; + *tail = t; + *position = p; + return TRUE; +} + +extern int +line_read_letter_sequence (LineType * line, char *head, char *tail) +{ + + assert (line != NULL); + assert (head != NULL); + assert (tail != NULL); + return buff_read_letter_sequence (line->buffer, &(line->position), head, + tail); +} + +extern int +buff_read_array_dimensions (char *buffer, int *position, int *n_params, + int params[ /* MAX_DIMS */ ]) +{ + /* + read the next non-space words in 'buffer' that conform to BASIC array index values; + if successful then 'position' is updated past the right parenthesis and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + int p; + int n; + + assert (buffer != NULL); + assert (position != NULL); + assert (n_params != NULL); + assert (params != NULL); + + p = *position; + n = 0; + + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_skip_LparenChar (buffer, &p)) + { + /* matrix */ + do + { + int Value; + + if (n >= MAX_DIMS) + { + /* ERROR */ + return FALSE; + } + /* OK */ + if (buff_read_integer_expression (buffer, &p, &Value) == FALSE) + { + /* ERROR */ + return FALSE; + } + /* OK */ + params[n] = Value; + n++; + } + while (buff_skip_seperator (buffer, &p)); + + if (buff_skip_RparenChar (buffer, &p) == FALSE) + { + /* ERROR */ + return FALSE; + } + } + else + { + /* scalar */ + n = 0; + } + *n_params = n; + *position = p; + return TRUE; +} + +#if FALSE /* keep this ... */ +extern int +line_read_array_dimensions (LineType * line, int *n_params, + int params[ /* MAX_DIMS */ ]) +{ + + assert (line != NULL); + assert (n_params != NULL); + assert (params != NULL); + return buff_read_array_dimensions (line->buffer, &(line->position), + n_params, params); +} +#endif + +extern int +buff_read_array_redim (char *buffer, int *position, int *dimensions, + int LBOUND[ /* MAX_DIMS */ ], + int UBOUND[ /* MAX_DIMS */ ]) +{ + /* + read the next non-space words in 'buffer' that conform to BASIC array index values; + if successful then 'position' is updated past the right parenthesis and returns TRUE + otherwise 'position' is unchanged and returns FALSE. + */ + int p; + int n; + + assert (buffer != NULL); + assert (position != NULL); + assert (dimensions != NULL); + assert (LBOUND != NULL); + assert (UBOUND != NULL); + + p = *position; + n = 0; + + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_skip_LparenChar (buffer, &p)) + { + /* matrix */ + do + { + int Value; + + if (n >= MAX_DIMS) + { + /* ERROR */ + return FALSE; + } + /* OK */ + if (buff_read_integer_expression (buffer, &p, &Value) == FALSE) + { + /* ERROR */ + return FALSE; + } + /* OK */ + if (buff_skip_word (buffer, &p, "TO") == TRUE) + { + LBOUND[n] = Value; /* explicit lower bound */ + if (buff_read_integer_expression (buffer, &p, &Value) == FALSE) + { + /* ERROR */ + return FALSE; + } + /* OK */ + UBOUND[n] = Value; /* explicit upper bound */ + } + else + { + LBOUND[n] = My->CurrentVersion->OptionBaseInteger; /* implicit lower bound */ + UBOUND[n] = Value; /* explicit upper bound */ + } + n++; + } + while (buff_skip_seperator (buffer, &p)); + + if (buff_skip_RparenChar (buffer, &p) == FALSE) + { + /* ERROR */ + return FALSE; + } + } + else + { + /* scalar */ + n = 0; + } + *dimensions = n; + *position = p; + return TRUE; +} + +extern int +line_read_array_redim (LineType * line, int *dimensions, + int LBOUND[ /* MAX_DIMS */ ], + int UBOUND[ /* MAX_DIMS */ ]) +{ + + assert (line != NULL); + assert (dimensions != NULL); + assert (LBOUND != NULL); + assert (UBOUND != NULL); + return buff_read_array_redim (line->buffer, &(line->position), dimensions, + LBOUND, UBOUND); +} + +extern int +buff_peek_array_dimensions (char *buffer, int *position, int *n_params) +{ + /* + peek the next non-space words in 'buffer' that conform to BASIC array index values; + if successful then 'n_params' is updated and returns TRUE + otherwise 'n_params' is unchanged and returns FALSE. + 'position' is always unchanged. + */ + int p; + int ParenLevel; + int NumDimensions; + + assert (buffer != NULL); + assert (position != NULL); + assert (n_params != NULL); + + ParenLevel = 0; + NumDimensions = 1; + p = *position; + buff_skip_spaces (buffer, &p); /* keep this */ + while (buffer[p]) + { + /* check the current character */ + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_skip_LparenChar (buffer, &p)) + { + ParenLevel++; + } + else if (buff_skip_RparenChar (buffer, &p)) + { + ParenLevel--; + if (ParenLevel < 0) + { + return FALSE; + } + if (ParenLevel == 0) + { + *n_params = NumDimensions; + return TRUE; + } + } + else if (buff_skip_seperator (buffer, &p)) + { + if (ParenLevel == 1) + { + NumDimensions++; + } + } + else if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + /* embedded string constant */ + p++; + while ((buffer[p] != My->CurrentVersion->OptionQuoteChar) + && (buffer[p] != NulChar)) + { + p++; + } + if (buffer[p] == My->CurrentVersion->OptionQuoteChar) + { + p++; + } + } + else + { + /* normal character */ + p++; + } + } + return FALSE; +} + +#if FALSE /* keep this ... */ +extern int +line_peek_array_dimensions (LineType * line, int *n_params) +{ + + assert (line != NULL); + assert (n_params != NULL); + return buff_peek_array_dimensions (line->buffer, &(line->position), + n_params); +} +#endif + +extern char +buff_read_type_declaration (char *buffer, int *position) +{ + /* + skip the next non-space words in 'buffer' if it is a BASIC type declaration. + if successful then 'position' is updated past the BASIC type declaration and returns the TypeCode + otherwise 'position' is unchanged and returns NulChar. + */ + int p; + char TypeCode; + + assert (buffer != NULL); + assert (position != NULL); + + + p = *position; + TypeCode = NulChar; + + + buff_skip_spaces (buffer, &p); /* keep this */ + if (buff_is_eol (buffer, &p)) + { + return TypeCode; + } + + if (buff_skip_word (buffer, &p, "AS") == TRUE) + { + /* AS ... */ + + if (buff_skip_word (buffer, &p, "BYTE")) + { + /* AS BYTE */ + TypeCode = ByteTypeCode; + } + else if (buff_skip_word (buffer, &p, "INTEGER")) + { + /* AS INTEGER */ + TypeCode = IntegerTypeCode; + } + else if (buff_skip_word (buffer, &p, "LONG")) + { + /* AS LONG */ + TypeCode = LongTypeCode; + } + else if (buff_skip_word (buffer, &p, "CURRENCY")) + { + /* AS CURRENCY */ + TypeCode = CurrencyTypeCode; + } + else if (buff_skip_word (buffer, &p, "SINGLE")) + { + /* AS SINGLE */ + TypeCode = SingleTypeCode; + } + else if (buff_skip_word (buffer, &p, "DOUBLE")) + { + /* AS DOUBLE */ + TypeCode = DoubleTypeCode; + } + else if (buff_skip_word (buffer, &p, "STRING")) + { + /* AS STRING */ + TypeCode = StringTypeCode; + } + else + { + /* invalid type */ + } + } + if (TypeCode) + { + /* success */ + *position = p; + } + return TypeCode; +} + +extern char +line_read_type_declaration (LineType * line) +{ + + assert (line != NULL); + return buff_read_type_declaration (line->buffer, &(line->position)); +} + + + +/*************************************************************** + + FUNCTION: line_start() + + DESCRIPTION: This function reads a line buffer in + beginning at the position + and attempts to determine (a) + the position of the line number in the + buffer (returned in ), (b) the + line number at this position (returned + in ), (c) the position of the + BASIC command in the buffer (returned + in ), (d) the position of this + BASIC command in the command table + (returned in ), and (e) the + position of the beginning of the rest + of the line (returned in ). + Although must be returned + as a positive integer, the other + searches may fail, in which case FALSE + will be returned in their positions. + is not incremented. + +***************************************************************/ +static void +internal_DEF8SUB (LineType * l) +{ + /* + ** + ** User is executing a function as though it were a command, such as 100 COS X. + ** This applies to both intrinsic functions and user defined functions and subroutines. + ** No special parsing is required, just insert "CALL" before the name and + ** add parentheses around the parameters: + ** 100 fna 1,2,3 -->> 100 CALL fna(1,2,3) + ** + */ + const char *A = "CALL "; + int a; + int n; + char *buffer; + + assert (l != NULL); + + a = bwb_strlen (A); + n = bwb_strlen (l->buffer) + a /* "CALL " */ + 1 /* '(' */ + 1 /* ')' */ ; + buffer = calloc (n + 1 /* NulChar */ , sizeof (char)); + if (buffer == NULL) + { + WARN_OUT_OF_MEMORY; + return; + } + bwb_strcpy (buffer, A); + /* buffer == "CALL " */ + l->position = 0; + if (line_read_varname (l, &(buffer[a])) == FALSE) + { + WARN_SYNTAX_ERROR; + return; + } + /* buffer == "CALL name" */ + line_skip_spaces (l); + if (line_is_eol (l)) + { + /* buffer == "CALL name" */ + } + else + { + /* buffer == "CALL name" */ + bwb_strcat (buffer, "("); + /* buffer == "CALL name(" */ + bwb_strcat (buffer, &(l->buffer[l->position])); + /* buffer == "CALL name(...parameters..." */ + bwb_strcat (buffer, ")"); + /* buffer == "CALL name(...parameters...)" */ + } + /* + printf("%s\n", buffer ); + */ + free (l->buffer); + l->buffer = buffer; + l->position = a; + l->Startpos = a; + l->cmdnum = C_CALL; +} +extern void +line_start (LineType * l) +{ + char tbuf[NameLengthMax + 1]; + + assert (l != NULL); + + + /* set initial values */ + l->cmdnum = 0; /* NOT FOUND */ + l->Startpos = 0; + l->position = 0; + + line_skip_spaces (l); /* keep this */ + + /* handle special cases */ + if (line_is_eol (l)) + { + /* the NUL (0) char must be handled first */ + l->cmdnum = C_REM; + return; + } + if (line_skip_char (l, My->CurrentVersion->OptionCommentChar)) + { + line_skip_eol (l); + l->Startpos = l->position; + l->cmdnum = C_REM; + return; + } + if (line_skip_char (l, My->CurrentVersion->OptionPrintChar)) + { + line_skip_spaces (l); /* keep this */ + l->Startpos = l->position; + l->cmdnum = C_PRINT; + return; + } + if (line_skip_char (l, My->CurrentVersion->OptionInputChar)) + { + line_skip_spaces (l); /* keep this */ + l->Startpos = l->position; + l->cmdnum = C_INPUT; + return; + } + if (line_skip_char (l, My->CurrentVersion->OptionImageChar)) + { + line_skip_spaces (l); /* keep this */ + l->Startpos = l->position; + l->cmdnum = C_IMAGE; + return; + } + if (bwb_strnicmp (&l->buffer[l->position], "REM", 3) == 0) + { + line_skip_eol (l); + l->Startpos = l->position; + l->cmdnum = C_REM; + return; + } + /* not a SPECIAL */ + + /* get the first keyword */ + if (line_read_keyword (l, tbuf) == FALSE) + { + /* ERROR */ + return; + } + line_skip_spaces (l); /* keep this */ + + + /* + ** + ** check for COMMAND + ** + */ + l->cmdnum = is_cmd (tbuf); + if (l->cmdnum) + { + /* + ** + ** NOTE: This is NOT a full parser, this exists only to + ** handle STRUCTURED commands. It is true that we also handle + ** some other easy cases, but remember that this only exists + ** to support STRUCTURED commands. Whether any other commands + ** get processed here is simply because it was easy to do so. + ** + */ + + int cmdnum; + char *xbuf; + int xlen; + + cmdnum = 0; + xbuf = My->ConsoleInput; + xlen = MAX_LINE_LENGTH; + bwb_strcpy (xbuf, tbuf); + + do + { + cmdnum = 0; + l->Startpos = l->position; + if (line_read_keyword (l, tbuf)) + { + int n; + n = bwb_strlen (xbuf) + 1 /* SpaceChar */ + bwb_strlen (tbuf); + if (n < xlen) + { + /* not too long */ + bwb_strcat (xbuf, " "); + bwb_strcat (xbuf, tbuf); + cmdnum = is_cmd (xbuf); + if (cmdnum) + { + /* longer command is valid */ + line_skip_spaces (l); /* keep this */ + l->Startpos = l->position; + l->cmdnum = cmdnum; + } + } + } + } + while (cmdnum); + /* + ** + ** process special cases here + ** + */ + l->position = l->Startpos; + switch (l->cmdnum) + { + case C_CLOAD: + { + if (line_skip_StarChar (l)) + { + /* + ** + ** CLOAD* + ** + */ + line_skip_spaces (l); /* keep this */ + l->Startpos = l->position; + l->cmdnum = C_CLOAD8; + } + } + break; + case C_CSAVE: + { + if (line_skip_StarChar (l)) + { + /* + ** + ** CSAVE* + ** + */ + line_skip_spaces (l); /* keep this */ + l->Startpos = l->position; + l->cmdnum = C_CSAVE8; + } + } + break; + case C_DEF: + if (bwb_strchr (l->buffer, '=') == NULL) + { + /* + ** + ** multi-line DEF ... FNEND + ** + */ + l->cmdnum = C_FUNCTION; + } + /* + ** + ** we look up declared USER functions as we load + ** + */ + UserFunction_add (l); + break; + case C_FEND: + /* + ** + ** this makes bwb_scan() simpler + ** + */ + l->cmdnum = C_END_FUNCTION; + break; + case C_FNEND: + /* + ** + ** this makes bwb_scan() simpler + ** + */ + l->cmdnum = C_END_FUNCTION; + break; + case C_FUNCTION: + /* + ** + ** we look up declared USER functions as we load + ** + */ + UserFunction_add (l); + break; + case C_IF: + /* + ** + ** CLASSIC vs STRUCTURED + ** + */ + if (IsLastKeyword (l, " THEN")) + { + /* + ** + ** STRUCTURED + ** + */ + l->cmdnum = C_IF8THEN; + } + break; + case C_OPEN: + /* + ** + ** CLASSIC vs STRUCTURED + ** + */ + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73 | D71)) + { + /* + ** + ** STRUCTURED + ** + */ + /* OPEN filenum, filename$, INPUT | OUTPUT */ + } + else if (GetKeyword (l, " AS ")) + { + /* + ** + ** STRUCTURED + ** + */ + /* OPEN ... AS ... */ + } + else + { + /* + ** + ** CLASSIC + ** + */ + /* + l->cmdnum = C_DEF8SUB; + l->Startpos = 0; + */ + internal_DEF8SUB (l); + } + break; + case C_SUB: + /* + ** + ** we look up declared USER functions as we load + ** + */ + UserFunction_add (l); + break; + case C_SUBEND: + case C_SUB_END: + /* + ** + ** this makes bwb_scan() simpler + ** + */ + l->cmdnum = C_END_SUB; + break; + case C_SUBEXIT: + case C_SUB_EXIT: + /* + ** + ** this makes bwb_scan() simpler + ** + */ + l->cmdnum = C_EXIT_SUB; + break; + case C_DEF8LBL: + /* + ** + ** we look up declared USER functions as we load + ** + */ + UserFunction_add (l); + break; + } + return; + } + /* not a COMMAND */ + + /* + ** + ** check for implied LET + ** + */ + if (is_let (l->buffer)) + { + /* + ** + ** this is an implied LET, such as: + ** 100 A = 123 + ** + */ + l->Startpos = 0; + l->cmdnum = C_LET; + return; + } + /* not an implied LET */ + + /* + ** + ** check for FUNCTION called as a SUBROUTINE + ** + */ + if (UserFunction_name (tbuf) || IntrinsicFunction_name (tbuf)) + { + /* + ** + ** check for a bogus assignment to a FUNCTION called as a SUBROUTINE, such as: + ** 100 COS = X + ** + */ + if (line_peek_EqualChar (l)) + { + /* SYNTAX ERROR */ + l->cmdnum = 0; + return; + } + /* + ** + ** FUNCTION called as a SUBROUTINE, such as: + ** 100 OUT X, Y + ** + */ + /* + l->Startpos = 0; + l->cmdnum = C_DEF8SUB; + */ + internal_DEF8SUB (l); + return; + } + /* not a FUNCTION */ + + /* + ** + ** check for LABEL + ** + */ + if (My->CurrentVersion->OptionFlags & OPTION_LABELS_ON) /* labels are enabled */ + if (My->CurrentVersion->OptionStatementChar) /* a Statement seperator exists */ + if (line_skip_char (l, My->CurrentVersion->OptionStatementChar)) /* this is a label */ + if (line_is_eol (l)) /* we finish the line */ + { + /* + ** + ** LABEL, such as: + ** 100 MyLabel: + ** + */ + l->Startpos = l->position; + l->cmdnum = C_DEF8LBL; + return; + } + /* not a LABEL */ + + + /* SYNTAX ERROR */ + l->cmdnum = 0; + return; +} + + +/*************************************************************** + + FUNCTION: is_cmd() + + DESCRIPTION: This function determines whether the + string in 'buffer' is a BASIC command + statement, returning 'id' or 0. + + +***************************************************************/ + +static int +is_cmd (char *name) +{ + int i; + + assert (name != NULL); + + +#if THE_PRICE_IS_RIGHT + /* start with the closest command, without going over */ + i = VarTypeIndex (name[0]); + if (i < 0) + { + /* non-alpha, all commands start with an alpha character */ + /* NOT FOUND */ + return 0; + } + i = My->CommandStart[i]; /* first command starting with this letter */ + if (i < 0) + { + /* no command starts with that letter */ + /* NOT FOUND */ + return 0; + } +#else /* THE_PRICE_IS_RIGHT */ + i = 0; +#endif /* THE_PRICE_IS_RIGHT */ + for (; i < NUM_COMMANDS; i++) + { + if (My->CurrentVersion->OptionVersionValue & IntrinsicCommandTable[i]. + OptionVersionBitmask) + { + int result; + result = bwb_stricmp (IntrinsicCommandTable[i].name, name); + if (result == 0) + { + /* FOUND */ + return IntrinsicCommandTable[i].CommandID; + } + if (result > 0 /* found > searched */ ) + { + /* NOT FOUND */ + return 0; + } + /* result < 0 : found < searched */ + } + } + /* NOT FOUND */ + return 0; +} + +static int +is_let (char *buffer) +{ + /* + ** + ** returns TRUE if 'buffer' contains an implied LET statement, + ** which is detected by an unquoted '=' + ** + */ + int n; + + assert (buffer != NULL); + + /* Go through the expression and search for an unquoted assignment operator. */ + + for (n = 0; buffer[n]; n++) + { + if (buffer[n] == '=') + { + return TRUE; + } + if (buffer[n] == My->CurrentVersion->OptionQuoteChar) + { + /* string constant */ + n++; + while (buffer[n] != My->CurrentVersion->OptionQuoteChar) + { + n++; + if (buffer[n] == NulChar) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + } + n++; + } + } + + /* No command name was found */ + + return FALSE; + +} + + +extern int +bwb_freeline (LineType * l) +{ + /* + ** + ** free memory associated with a program line + ** + */ + + + if (l != NULL) + { + /* free arguments if there are any */ + if (l->buffer != NULL) + { + free (l->buffer); + l->buffer = NULL; + } + free (l); + /* l = NULL; */ + My->IsScanRequired = TRUE; /* program needs to be scanned again */ + } + return TRUE; +} + +static int +GetKeyword (LineType * l, char *Keyword) +{ + /* + * + * Returns TRUE if Keyword is found unquoted + * + */ + char *S; + char *C; + int n; + + assert (l != NULL); + assert (Keyword != NULL); + + S = l->buffer; + S += l->position; + C = S; + n = bwb_strlen (Keyword); + + + while (*C) + { + if (bwb_strnicmp (C, Keyword, n) == 0) + { + /* FOUND */ + return TRUE; + } + else if (*C == My->CurrentVersion->OptionQuoteChar) + { + /* skip string constant */ + C++; + while (*C != NulChar && *C != My->CurrentVersion->OptionQuoteChar) + { + C++; + } + if (*C == My->CurrentVersion->OptionQuoteChar) + { + C++; + } + } + else + { + /* skip normal character */ + C++; + } + } + /* NOT FOUND */ + return FALSE; +} + +extern int +IsLastKeyword (LineType * l, char *Keyword) +{ + /* find the end of the line */ + /* backup thru spaces */ + int n; + char *S; + char *C; + + assert (l != NULL); + assert (Keyword != NULL); + + + S = l->buffer; + S += l->position; + C = S; + n = bwb_strlen (Keyword); + S += n; + /* + ** IF x THEN 0 + ** IF x THEN + */ + while (*C) + { + /* skip string constants */ + if (*C == My->CurrentVersion->OptionQuoteChar) + { + /* skip leading quote */ + C++; + while (*C != NulChar && *C != My->CurrentVersion->OptionQuoteChar) + { + C++; + } + /* skip trailing quote */ + if (*C == My->CurrentVersion->OptionQuoteChar) + { + C++; + } + } + else + { + C++; + } + } + if (C > S) + { + C--; + while (C > S && *C == ' ') + { + C--; + } + C++; + if (C > S) + { + C -= n; + if (bwb_strnicmp (C, Keyword, n) == 0) + { + /* FOUND */ + return TRUE; + } + } + } + /* NOT FOUND */ + return FALSE; +} + +/* bitmask values returned by bwb_chartype() */ +#define CHAR_IS_CNTRL 0x01 +#define CHAR_IS_SPACE 0x02 +#define CHAR_IS_PRINT 0x04 +#define CHAR_IS_PUNCT 0x08 +#define CHAR_IS_DIGIT 0x10 +#define CHAR_IS_XDIGIT 0x20 +#define CHAR_IS_UPPER 0x40 +#define CHAR_IS_LOWER 0x80 + +#define CHAR_IS_ALPHA (CHAR_IS_UPPER | CHAR_IS_LOWER) +#define CHAR_IS_ALNUM (CHAR_IS_ALPHA | CHAR_IS_DIGIT) +#define CHAR_IS_GRAPH (CHAR_IS_ALNUM | CHAR_IS_PUNCT) + + +static int +bwb_chartype (int C) +{ + /* returns the the character type bitmask */ + + switch (C) + { + case EOF: + return 0; /* Special Case */ + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + return CHAR_IS_CNTRL | CHAR_IS_SPACE; + case ' ': + return CHAR_IS_PRINT | CHAR_IS_SPACE; + case '!': + case '"': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + return CHAR_IS_PRINT | CHAR_IS_PUNCT; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + return CHAR_IS_PRINT | CHAR_IS_DIGIT | CHAR_IS_XDIGIT; + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + return CHAR_IS_PRINT | CHAR_IS_PUNCT; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + return CHAR_IS_PRINT | CHAR_IS_UPPER | CHAR_IS_XDIGIT; + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + return CHAR_IS_PRINT | CHAR_IS_UPPER; + case '[': + case '\\': + case ']': + case '^': + case '_': + case '`': + return CHAR_IS_PRINT | CHAR_IS_PUNCT; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + return CHAR_IS_PRINT | CHAR_IS_LOWER | CHAR_IS_XDIGIT; + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + return CHAR_IS_PRINT | CHAR_IS_LOWER; + case '{': + case '|': + case '}': + case '~': + return CHAR_IS_PRINT | CHAR_IS_PUNCT; + } + return CHAR_IS_CNTRL; +} + +extern int +bwb_isalnum (int C) +{ + /* + 4.3.1.1 The isalnum function + + Synopsis + + #include + int isalnum(int c); + + Description + + The isalnum function tests for any character for which isalpha or + isdigit is true. + */ + + if (bwb_chartype (C) & CHAR_IS_ALNUM) + { + return TRUE; + } + return FALSE; +} + +int +bwb_isalpha (int C) +{ + /* + 4.3.1.2 The isalpha function + + Synopsis + + #include + int isalpha(int c); + + Description + + The isalpha function tests for any character for which isupper or + islower is true, or any of an implementation-defined set of characters + for which none of iscntrl , isdigit , ispunct , or isspace is true. + In the C locale, isalpha returns true only for the characters for + which isupper or islower is true. + */ + + if (bwb_chartype (C) & CHAR_IS_ALPHA) + { + return TRUE; + } + return FALSE; +} + +#if FALSE /* keep this ... */ +extern int +bwb_iscntrl (int C) +{ + /* + 4.3.1.3 The iscntrl function + + Synopsis + + #include + int iscntrl(int c); + + Description + + The iscntrl function tests for any control character. + */ + + if (bwb_chartype (C) & CHAR_IS_CNTRL) + { + return TRUE; + } + return FALSE; +} +#endif + +extern int +bwb_isdigit (int C) +{ + /* + 4.3.1.4 The isdigit function + + Synopsis + + #include + int isdigit(int c); + + Description + + The isdigit function tests for any decimal-digit character (as + defined in $2.2.1). + */ + + if (bwb_chartype (C) & CHAR_IS_DIGIT) + { + return TRUE; + } + return FALSE; +} + +extern int +bwb_isgraph (int C) +{ + /* + 4.3.1.5 The isgraph function + + Synopsis + + #include + int isgraph(int c); + + Description + + The isgraph function tests for any printing character except space (' '). + */ + + if (bwb_chartype (C) & CHAR_IS_GRAPH) + { + return TRUE; + } + return FALSE; +} + +#if FALSE /* keep this ... */ +extern int +bwb_islower (int C) +{ + /* + 4.3.1.6 The islower function + + Synopsis + + #include + int islower(int c); + + Description + + The islower function tests for any lower-case letter or any of an + implementation-defined set of characters for which none of iscntrl , + isdigit , ispunct , or isspace is true. In the C locale, islower + returns true only for the characters defined as lower-case letters (as + defined in $2.2.1). + */ + + if (bwb_chartype (C) & CHAR_IS_LOWER) + { + return TRUE; + } + return FALSE; +} +#endif + +extern int +bwb_isprint (int C) +{ + /* + 4.3.1.7 The isprint function + + Synopsis + + #include + int isprint(int c); + + Description + + The isprint function tests for any printing character including + space (' '). + */ + + if (bwb_chartype (C) & CHAR_IS_PRINT) + { + return TRUE; + } + return FALSE; +} + +extern int +bwb_ispunct (int C) +{ + /* + 4.3.1.8 The ispunct function + + Synopsis + + #include + int ispunct(int c); + + Description + + The ispunct function tests for any printing character except space + (' ') or a character for which isalnum is true. + */ + + if (bwb_chartype (C) & CHAR_IS_PUNCT) + { + return TRUE; + } + return FALSE; +} + +#if FALSE /* keep this ... */ +extern int +bwb_isspace (int C) +{ + /* + 4.3.1.9 The isspace function + + Synopsis + + #include + int isspace(int c); + + Description + + The isspace function tests for the standard white-space characters + or for any of an implementation-defined set of characters for which + isalnum is false. The standard white-space characters are the + following: space (' '), form feed ('\f'), new-line ('\n'), carriage + return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the + C locale, isspace returns true only for the standard white-space + characters. + */ + + if (bwb_chartype (C) & CHAR_IS_SPACE) + { + return TRUE; + } + return FALSE; +} +#endif + +#if FALSE /* keep this ... */ +extern int +bwb_isupper (int C) +{ + /* + 4.3.1.10 The isupper function + + Synopsis + + #include + int isupper(int c); + + Description + + The isupper function tests for any upper-case letter or any of an + implementation-defined set of characters for which none of iscntrl , + isdigit , ispunct , or isspace is true. In the C locale, isupper + returns true only for the characters defined as upper-case letters (as + defined in $2.2.1). + */ + + if (bwb_chartype (C) & CHAR_IS_UPPER) + { + return TRUE; + } + return FALSE; +} +#endif + +extern int +bwb_isxdigit (int C) +{ + /* + 4.3.1.11 The isxdigit function + + Synopsis + + #include + int isxdigit(int c); + + Description + + The isxdigit function tests for any hexadecimal-digit character (as + defined in $3.1.3.2). + */ + + if (bwb_chartype (C) & CHAR_IS_XDIGIT) + { + return TRUE; + } + return FALSE; +} + +extern int +bwb_tolower (int C) +{ + /* + 4.3.2.1 The tolower function + + Synopsis + + #include + int tolower(int c); + + Description + + The tolower function converts an upper-case letter to the + corresponding lower-case letter. + + Returns + + If the argument is an upper-case letter, the tolower function + returns the corresponding lower-case letter if there is one; otherwise + the argument is returned unchanged. In the C locale, tolower maps + only the characters for which isupper is true to the corresponding + characters for which islower is true. + */ + + switch (C) + { + case 'A': + return 'a'; + case 'B': + return 'b'; + case 'C': + return 'c'; + case 'D': + return 'd'; + case 'E': + return 'e'; + case 'F': + return 'f'; + case 'G': + return 'g'; + case 'H': + return 'h'; + case 'I': + return 'i'; + case 'J': + return 'j'; + case 'K': + return 'k'; + case 'L': + return 'l'; + case 'M': + return 'm'; + case 'N': + return 'n'; + case 'O': + return 'o'; + case 'P': + return 'p'; + case 'Q': + return 'q'; + case 'R': + return 'r'; + case 'S': + return 's'; + case 'T': + return 't'; + case 'U': + return 'u'; + case 'V': + return 'v'; + case 'W': + return 'w'; + case 'X': + return 'x'; + case 'Y': + return 'y'; + case 'Z': + return 'z'; + } + return C; +} + +extern int +bwb_toupper (int C) +{ + /* + 4.3.2.2 The toupper function + + Synopsis + + #include + int toupper(int c); + + Description + + The toupper function converts a lower-case letter to the corresponding upper-case letter. + + Returns + + If the argument is a lower-case letter, the toupper function + returns the corresponding upper-case letter if there is one; otherwise + the argument is returned unchanged. In the C locale, toupper maps + only the characters for which islower is true to the corresponding + characters for which isupper is true. + */ + + switch (C) + { + case 'a': + return 'A'; + case 'b': + return 'B'; + case 'c': + return 'C'; + case 'd': + return 'D'; + case 'e': + return 'E'; + case 'f': + return 'F'; + case 'g': + return 'G'; + case 'h': + return 'H'; + case 'i': + return 'I'; + case 'j': + return 'J'; + case 'k': + return 'K'; + case 'l': + return 'L'; + case 'm': + return 'M'; + case 'n': + return 'N'; + case 'o': + return 'O'; + case 'p': + return 'P'; + case 'q': + return 'Q'; + case 'r': + return 'R'; + case 's': + return 'S'; + case 't': + return 'T'; + case 'u': + return 'U'; + case 'v': + return 'V'; + case 'w': + return 'W'; + case 'x': + return 'X'; + case 'y': + return 'Y'; + case 'z': + return 'Z'; + } + return C; +} + + +extern void * +bwb_memcpy (void *s1, const void *s2, size_t n) +{ + /* + 4.11.2.1 The memcpy function + + Synopsis + + #include + void *memcpy(void *s1, const void *s2, size_t n); + + Description + + The memcpy function copies n characters from the object pointed to + by s2 into the object pointed to by s1 . If copying takes place + between objects that overlap, the behavior is undefined. + + Returns + + The memcpy function returns the value of s1 . + */ + + + if (n > 0) + { + char *Target; + char *Source; + int p; + assert (s1 != NULL); + assert (s2 != NULL); + + + Target = (char *) s1; + Source = (char *) s2; + p = 0; + while (p < n) + { + Target[p] = Source[p]; + p++; + } + } + return s1; +} + +#if FALSE /* keep this ... */ +extern void * +bwb_memmove (void *s1, const void *s2, size_t n) +{ + /* + 4.11.2.2 The memmove function + + Synopsis + + #include + void *memmove(void *s1, const void *s2, size_t n); + + Description + + The memmove function copies n characters from the object pointed to + by s2 into the object pointed to by s1 . Copying takes place as if + the n characters from the object pointed to by s2 are first copied + into a temporary array of n characters that does not overlap the + objects pointed to by s1 and s2 , and then the n characters from the + temporary array are copied into the object pointed to by s1 . + + Returns + + The memmove function returns the value of s1 . + */ + + + if (n > 0) + { + char *Target; + char *Source; + char *Temp; + assert (s1 != NULL); + assert (s2 != NULL); + + Target = (char *) s1; + Source = (char *) s2; + Temp = (char *) malloc (n); + if (Temp != NULL) + { + int p; + + p = 0; + while (p < n) + { + Temp[p] = Source[p]; + p++; + } + p = 0; + while (p < n) + { + Target[p] = Temp[p]; + p++; + } + free (Temp); + Temp = NULL; + } + } + return s1; +} +#endif + +extern char * +bwb_strcpy (char *s1, const char *s2) +{ + /* + 4.11.2.3 The strcpy function + + Synopsis + + #include + char *strcpy(char *s1, const char *s2); + + Description + + The strcpy function copies the string pointed to by s2 (including + the terminating null character) into the array pointed to by s1 . If + copying takes place between objects that overlap, the behavior is + undefined. + + Returns + + The strcpy function returns the value of s1 . + */ + char C; + int p; + + assert (s1 != NULL); + assert (s2 != NULL); + + p = 0; + do + { + C = s2[p]; + s1[p] = C; + p++; + } + while (C); + return s1; +} + + +extern char * +bwb_strncpy (char *s1, const char *s2, size_t n) +{ + /* + 4.11.2.4 The strncpy function + + Synopsis + + #include + char *strncpy(char *s1, const char *s2, size_t n); + + Description + + The strncpy function copies not more than n characters (characters + that follow a null character are not copied) from the array pointed to + by s2 to the array pointed to by s1 ./120/ If copying takes place + between objects that overlap, the behavior is undefined. + + If the array pointed to by s2 is a string that is shorter than n + characters, null characters are appended to the copy in the array + pointed to by s1 , until n characters in all have been written. + + Returns + + The strncpy function returns the value of s1 . + */ + + + if (n > 0) + { + char C; + int p; + assert (s1 != NULL); + assert (s2 != NULL); + + p = 0; + do + { + C = s2[p]; + s1[p] = C; + p++; + } + while (C != NulChar && p < n); + while (p < n) + { + s1[p] = NulChar; + p++; + } + } + return s1; +} + + +extern char * +bwb_strcat (char *s1, const char *s2) +{ + /* + 4.11.3.1 The strcat function + + Synopsis + + #include + char *strcat(char *s1, const char *s2); + + Description + + The strcat function appends a copy of the string pointed to by s2 + (including the terminating null character) to the end of the string + pointed to by s1 . The initial character of s2 overwrites the null + character at the end of s1 . If copying takes place between objects + that overlap, the behavior is undefined. + + Returns + + The strcat function returns the value of s1 . + */ + char *Temp; + + assert (s1 != NULL); + assert (s2 != NULL); + + Temp = bwb_strchr (s1, NulChar); + bwb_strcpy (Temp, s2); + return s1; +} + +#if FALSE /* keep this ... */ +extern char * +bwb_strncat (char *s1, const char *s2, size_t n) +{ + /* + 4.11.3.2 The strncat function + + Synopsis + + #include + char *strncat(char *s1, const char *s2, size_t n); + + Description + + The strncat function appends not more than n characters (a null + character and characters that follow it are not appended) from the + array pointed to by s2 to the end of the string pointed to by s1 . + The initial character of s2 overwrites the null character at the end + of s1 . A terminating null character is always appended to the + result./121/ If copying takes place between objects that overlap, the + behavior is undefined. + + Returns + + The strncat function returns the value of s1 . + */ + char *Temp; + + assert (s1 != NULL); + assert (s2 != NULL); + + Temp = bwb_strchr (s1, NulChar); + bwb_strncpy (Temp, s2, n); + return s1; +} +#endif + +extern int +bwb_memcmp (const void *s1, const void *s2, size_t n) +{ + /* + 4.11.4.1 The memcmp function + + Synopsis + + #include + int memcmp(const void *s1, const void *s2, size_t n); + + Description + + The memcmp function compares the first n characters of the object + pointed to by s1 to the first n characters of the object pointed to by + s2 ./122/ + + Returns + + The memcmp function returns an integer greater than, equal to, or + less than zero, according as the object pointed to by s1 is greater + than, equal to, or less than the object pointed to by s2 . + */ + + + if (n > 0) + { + int p; + char *L; + char *R; + assert (s1 != NULL); + assert (s2 != NULL); + + p = 0; + L = (char *) s1; + R = (char *) s2; + while (p < n) + { + if (L[p] > R[p]) + { + return 1; + } + if (L[p] < R[p]) + { + return -1; + } + /* L[ p ] == R[ p ] */ + p++; + } + } + return 0; +} + + +extern int +bwb_strcmp (const char *s1, const char *s2) +{ + /* + 4.11.4.2 The strcmp function + + Synopsis + + #include + int strcmp(const char *s1, const char *s2); + + Description + + The strcmp function compares the string pointed to by s1 to the + string pointed to by s2 . + + Returns + + The strcmp function returns an integer greater than, equal to, or + less than zero, according as the string pointed to by s1 is greater + than, equal to, or less than the string pointed to by s2 . + */ + char C; + int p; + + assert (s1 != NULL); + assert (s2 != NULL); + + p = 0; + do + { + if (s1[p] > s2[p]) + { + return 1; + } + if (s1[p] < s2[p]) + { + return -1; + } + /* s1[ p ] == s2[ p ] */ + C = s1[p]; + p++; + } + while (C); + return 0; +} + +#if FALSE /* keep this ... */ +extern int +bwb_strncmp (const char *s1, const char *s2, size_t n) +{ + /* + 4.11.4.4 The strncmp function + + Synopsis + + #include + int strncmp(const char *s1, const char *s2, size_t n); + + Description + + The strncmp function compares not more than n characters + (characters that follow a null character are not compared) from the + array pointed to by s1 to the array pointed to by s2 . + + Returns + + The strncmp function returns an integer greater than, equal to, or + less than zero, according as the possibly null-terminated array + pointed to by s1 is greater than, equal to, or less than the possibly + null-terminated array pointed to by s2 . + */ + + + if (n > 0) + { + char C; + int p; + assert (s1 != NULL); + assert (s2 != NULL); + + p = 0; + do + { + if (s1[p] > s2[p]) + { + return 1; + } + if (s1[p] < s2[p]) + { + return -1; + } + /* s1[ p ] == s2[ p ] */ + C = s1[p]; + p++; + } + while (C != NulChar && p < n); + } + return 0; +} +#endif + +#if FALSE /* keep this ... */ +extern void * +bwb_memchr (const void *s, int c, size_t n) +{ + /* + 4.11.5.1 The memchr function + + Synopsis + + #include + void *memchr(const void *s, int c, size_t n); + + Description + + The memchr function locates the first occurrence of c (converted to + an unsigned char ) in the initial n characters (each interpreted as + unsigned char ) of the object pointed to by s . + + Returns + + The memchr function returns a pointer to the located character, or + a null pointer if the character does not occur in the object. + */ + + + if (n > 0) + { + int p; + unsigned char *Check; + unsigned char Find; + assert (s != NULL); + + p = 0; + Check = (unsigned char *) s; + Find = (unsigned char) c; + do + { + if (Check[p] == Find) + { + return (void *) &(Check[p]); + } + p++; + } + while (p < n); + } + return NULL; +} +#endif + +extern char * +bwb_strchr (const char *s, int c) +{ + /* + 4.11.5.2 The strchr function + + Synopsis + + #include + char *strchr(const char *s, int c); + + Description + + The strchr function locates the first occurrence of c (converted to + a char ) in the string pointed to by s . The terminating null + character is considered to be part of the string. + + Returns + + The strchr function returns a pointer to the located character, or + a null pointer if the character does not occur in the string. + */ + int p; + char Find; + char C; + + assert (s != NULL); + + p = 0; + Find = (char) c; + do + { + C = s[p]; + if (C == Find) + { + return (char *) &(s[p]); + } + p++; + } + while (C); + return NULL; +} + + +extern char * +bwb_strrchr (const char *s, int c) +{ + /* + 4.11.5.5 The strrchr function + + Synopsis + + #include + char *strrchr(const char *s, int c); + + Description + + The strrchr function locates the last occurrence of c (converted to + a char ) in the string pointed to by s . The terminating null + character is considered to be part of the string. + + Returns + + The strrchr function returns a pointer to the character, or a null + pointer if c does not occur in the string. + */ + int p; + char Find; + char *Found; + char C; + + assert (s != NULL); + + p = 0; + Find = (char) c; + Found = NULL; + do + { + C = s[p]; + if (C == Find) + { + Found = (char *) &(s[p]); + } + p++; + } + while (C); + return Found; +} + + +extern void * +bwb_memset (void *s, int c, size_t n) +{ + /* + 4.11.6.1 The memset function + + Synopsis + + #include + void *memset(void *s, int c, size_t n); + + Description + + The memset function copies the value of c (converted to an unsigned + char ) into each of the first n characters of the object pointed to by + s . + + Returns + + The memset function returns the value of s . + */ + + + if (n > 0) + { + int p; + unsigned char *Target; + unsigned char Value; + assert (s != NULL); + + p = 0; + Target = (unsigned char *) s; + Value = (unsigned char) c; + do + { + Target[p] = Value; + p++; + } + while (p < n); + } + return s; +} + +extern size_t +bwb_strlen (const char *s) +{ + /* + 4.11.6.3 The strlen function + + Synopsis + + #include + size_t strlen(const char *s); + + Description + + The strlen function computes the length of the string pointed to by s . + + Returns + + The strlen function returns the number of characters that precede + the terminating null character. + */ + size_t p; + + assert (s != NULL); + + p = 0; + while (s[p]) + { + p++; + } + return p; +} + +extern char * +bwb_strdup (char *s) +{ + size_t n; + char *r; + assert (s != NULL); + + /* r = NULL; */ + n = bwb_strlen (s); + r = calloc (n + 1 /* NulChar */ , sizeof (char)); + if (r != NULL) + { + bwb_strcpy (r, s); + } + return r; +} + +extern char * +bwb_strdup2 (char *s, char *t) +{ + size_t n; + char *r; + assert (s != NULL); + assert (t != NULL); + + /* r = NULL; */ + n = bwb_strlen (s) + bwb_strlen (t); + r = calloc (n + 1 /* NulChar */ , sizeof (char)); + if (r != NULL) + { + bwb_strcpy (r, s); + bwb_strcat (r, t); + } + return r; +} + +#if HAVE_UNIX_GCC + +/* these are intrinsic C functions in my environment using -ansi */ + +#else /* ! HAVE_UNIX_GCC */ + +extern unsigned int +sleep (unsigned int X) +{ + /* do nothing */ + return X; +} + +#endif /* ! HAVE_UNIX_GCC */ + + +extern double +bwb_rint (double x) +{ + /* BASIC dialects have different rounding rules */ + double Result; + + + if (x < 0) + { + return -bwb_rint (-x); + } + /* x >= 0 */ + switch (My->OptionRoundType) + { + case C_OPTION_ROUND_BANK: + /* normal financial rounding */ + Result = floor (x + 0.5); + if (x - floor (x) == 0.5) + { + /* midway */ + double Half; + Half = Result / 2.0; + if (Half != floor (Half)) + { + /* odd -> even */ + Result--; + } + } + break; + case C_OPTION_ROUND_MATH: + /* normal mathematical rounding */ + Result = floor (x + 0.5); + break; + case C_OPTION_ROUND_TRUNCATE: + /* simple truncation */ + Result = floor (x); + break; + } + return Result; +} + +extern int +bwb_stricmp (const char *s1, const char *s2) +{ + const unsigned char *p1; + const unsigned char *p2; + + assert (s1 != NULL); + assert (s2 != NULL); + + p1 = (const unsigned char *) s1; + p2 = (const unsigned char *) s2; + while (*p1) + { + char c1; + char c2; + c1 = bwb_toupper (*p1); + c2 = bwb_toupper (*p2); + if (c1 < c2) + { + return -1; + } + if (c1 > c2) + { + return 1; + } + p1++; + p2++; + } + if (*p2 == NulChar) + { + return 0; + } + return -1; +} + +extern int +bwb_strnicmp (const char *s1, const char *s2, size_t n) +{ + const unsigned char *p1; + const unsigned char *p2; + size_t x = 0; + + assert (s1 != NULL); + assert (s2 != NULL); + + p1 = (const unsigned char *) s1; + p2 = (const unsigned char *) s2; + while (x < n) + { + char c1; + char c2; + c1 = bwb_toupper (p1[x]); + c2 = bwb_toupper (p2[x]); + if (c1 < c2) + { + return -1; + } + if (c1 > c2) + { + return 1; + } + if (c1 == NulChar) + { + return 0; + } + x++; + } + return 0; +} + + +/* EOF */ diff --git a/bwb_prn.c b/bwb_prn.c new file mode 100644 index 0000000..25f7a4f --- /dev/null +++ b/bwb_prn.c @@ -0,0 +1,2973 @@ +/*************************************************************** + + bwb_prn.c Print and Error-Handling Commands + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + +static int buff_read_using (char *buffer, int *position, char *format_string, + int format_length); +static LineType *bwb_mat_dump (LineType * l, int IsWrite); +static int bwb_print_at (LineType * l); +static void CleanNumericString (char *prnbuf, int RemoveDot); +static int CountDigits (char *Buffer); +static LineType *D71_PUT (LineType * l); +static LineType *file_write_matrix (LineType * l, char delimit); +static LineType *H14_PUT (LineType * Line); +static void internal_print (LineType * l, int IsCSV); +static int is_magic_number (char *buffer); +static int is_magic_string (char *buffer); +static int line_read_using (LineType * l, char *format_string, + int format_length); +static void next_zone (void); +static int parse_file_number (LineType * l); +static void print_using_number (char *buffer, int *position, VariantType * e); +static void print_using_string (char *buffer, int *position, VariantType * e); +static void print_using_variant (char *buffer, int *position, VariantType * e, + int IsCSV); +static LineType *S70_PUT (LineType * l); +static void xputc1 (char c); +static void xputc2 (char c); +static void xputs (char *buffer); + + +/* +We try to allow as many legacy PRINT USING formats as reasonable. +Many legacy PRINT USING formats are incompatible with one another. +For example: +1) some use '%' for strings, others use '%' for numbers, others consider '%' as a lieral. +2) some count a leading or traling signs in the width, while others do not. +3) when a value requires more digits than the assigned width: + a) some truncate the displayed value to the width, + b) some expand the width, + c) some print a number of '%' or '*', and + d) some halt processing. +There is no perfect solution that will work for all possible dialects. +*/ + + +#define PrintUsingNumberDigit My->CurrentVersion->OptionUsingDigit /* Digit placeholder, usually '#' */ +#define PrintUsingNumberComma My->CurrentVersion->OptionUsingComma /* Comma, such as thousands, usually ',' */ +#define PrintUsingNumberPeriod My->CurrentVersion->OptionUsingPeriod /* Period, such as dollars and cents, usually '.' */ +#define PrintUsingNumberPlus My->CurrentVersion->OptionUsingPlus /* Plus sign, positive value, usually '+' */ +#define PrintUsingNumberMinus My->CurrentVersion->OptionUsingMinus /* Minus sign, negative value, usually '-' */ +#define PrintUsingNumberExponent My->CurrentVersion->OptionUsingExrad /* Exponential format, usually '^' */ +#define PrintUsingNumberDollar My->CurrentVersion->OptionUsingDollar /* Currency symbol, usually '$' */ +#define PrintUsingNumberFiller My->CurrentVersion->OptionUsingFiller /* Print filler, such as checks, usually '*' */ +#define PrintUsingLiteral My->CurrentVersion->OptionUsingLiteral /* The next char is a literal, usually '_' */ +#define PrintUsingStringFirst My->CurrentVersion->OptionUsingFirst /* The first character of the string, usually '!' */ +#define PrintUsingStringAll My->CurrentVersion->OptionUsingAll /* Print the entire string, usually '&' */ +#define PrintUsingStringLength My->CurrentVersion->OptionUsingLength /* Print a substring, usually '%' */ + + +/* +** +** ZoneChar is a MAGIC character code used by file_write_matrix() to request printing by zones. +** ZoneChar can be any character, other than NulChar, that the user will not use as a literal delimiter. +** The user is allowed to specify CHR$(9), '\t', as a literal delimiter. +** +*/ +#define ZoneChar 0x01 /* an unlikely literal delimiter */ + + +int +is_empty_string (char *Buffer) +{ + + + if (Buffer == NULL) + { + return TRUE; + } + while (*Buffer == ' ') + { + Buffer++; + } + if (*Buffer == NulChar) + { + return TRUE; + } + return FALSE; +} + + +FileType * +find_file_by_name (char *FileName) +{ + FileType *F; + + if (is_empty_string (FileName)) + { + /* the rules for Console and Printer vary by command */ + return NULL; + } + /* search the list of OPEN files */ + assert( My != NULL ); + for (F = My->FileHead; F != NULL; F = F->next) + { + assert( F != NULL ); + if (F->DevMode == DEVMODE_CLOSED) + { + } + else if (F->FileName == NULL) + { + } + else if (bwb_stricmp (F->FileName, FileName) == 0) + { + /* FOUND */ + return F; + } + } + /* NOT FOUND */ + return NULL; +} + + +FileType * +find_file_by_number (int FileNumber) +{ + FileType *F; + + + /* handle MAGIC file numbers */ + if (FileNumber <= 0) + { + /* the rules for Console and Printer vary by command */ + return NULL; + } + /* search the list of OPEN files */ + assert( My != NULL ); + for (F = My->FileHead; F != NULL; F = F->next) + { + assert( F != NULL ); + if (F->DevMode != DEVMODE_CLOSED) + { + if (F->FileNumber == FileNumber) + { + /* FOUND */ + return F; + } + } + } + /* NOT FOUND */ + return NULL; +} + + +FileType * +file_new (void) +{ + /* search for an empty slot. If not found, add a new slot. */ + FileType *F; + + assert( My != NULL ); + for (F = My->FileHead; F != NULL; F = F->next) + { + assert( F != NULL ); + if (F->DevMode == DEVMODE_CLOSED) + { + /* FOUND */ + return F; + } + } + /* NOT FOUND */ + if ((F = (FileType *) calloc (1, sizeof (FileType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + assert( F != NULL ); + F->next = My->FileHead; + My->FileHead = F; + return F; +} + + +void +file_clear (FileType * F) +{ + /* clean up a file slot that is no longer needed */ + + assert (F != NULL); + + clear_virtual_by_file (F->FileNumber); + F->FileNumber = 0; + F->DevMode = DEVMODE_CLOSED; /* DEVMODE_ item */ + F->width = 0; /* width for OUTPUT and APPEND; reclen for RANDOM; not used for INPUT or BINARY */ + F->col = 0; /* current column for OUTPUT and APPEND */ + F->row = 0; /* current row for OUTPUT and APPEND */ + F->EOF_LineNumber = 0; /* CBASIC-II: IF END # filenumber THEN linenumber */ + F->delimit = NulChar; /* DELIMIT for READ and WRITE */ + if (F->FileName != NULL) + { + free (F->FileName); + F->FileName = NULL; + } + if (F->cfp != NULL) + { + bwb_fclose (F->cfp); + F->cfp = NULL; + } + if (F->buffer != NULL) + { + free (F->buffer); + F->buffer = NULL; + } + +} + +int +file_next_number (void) +{ + int FileNumber; + FileType *F; + + + FileNumber = 0; + assert( My != NULL ); + for (F = My->FileHead; F != NULL; F = F->next) + { + assert( F != NULL ); + if (F->DevMode != DEVMODE_CLOSED) + { + if (F->FileNumber > FileNumber) + { + FileNumber = F->FileNumber; + } + } + } + /* 'FileNumber' is the highest FileNumber that is currently open */ + FileNumber++; + return FileNumber; +} + + + +/*************************************************************** + + FUNCTION: bwx_putc() + + DESCRIPTION: This function outputs a single character + to the default output device. + +***************************************************************/ + +static void +CleanNumericString (char *prnbuf, int RemoveDot) +{ + /* remove trailing zeroes */ + char *E; + char *D; + + assert (prnbuf != NULL); + + E = bwb_strchr (prnbuf, 'E'); + if (E == NULL) + { + E = bwb_strchr (prnbuf, 'e'); + } + if (E) + { + /* SCIENTIFIC == SCALED notation */ + /* trim leading zeroes in exponent */ + char *F; + char *G; + + F = E; + while (bwb_isalpha (*F)) + { + F++; + } + while (*F == '+' || *F == '-') + { + /* skip sign */ + F++; + } + G = F; + while (*G == '0' || *G == ' ') + { + /* skip leading zeroes or spaces */ + G++; + } + if (G > F) + { + bwb_strcpy (F, G); + } + G = NULL; /* no longer valid */ + *E = NulChar; /* for bwb_strlen() */ + } + D = bwb_strchr (prnbuf, '.'); + if (D) + { + int N; + + N = bwb_strlen (D); + if (N > 1) + { + int M; + + N--; + M = N; + while (D[N] == '0') + { + /* remove trailing zeroes */ + D[N] = '_'; + N--; + } + if (RemoveDot) + { + if (E) + { + /* SCIENTIFIC == SCALED notation */ + /* do NOT remove '.' */ + } + else + { + /* NORMAL == UNSCALED notation */ + /* remove trailing '.' */ + /* this will only occur for integer values */ + while (D[N] == '.') + { + /* _###. POSITIVE INTEGER */ + /* -###. NEGATIVE INTEGER */ + D[N] = '_'; + N--; + } + } + } + if (N < M) + { + if (E) + { + /* SCIENTIFIC == SCALED notation */ + *E = 'E'; + E = NULL; + } + N++; + /* if INTEGER, then N == 0, else N > 0 */ + M++; + /* if SCIENTIFIC, then *M == 'E' else *M == NulChar */ + bwb_strcpy (&(D[N]), &(D[M])); + } + } + } + if (E) + { + /* SCIENTIFIC == SCALED notation */ + *E = 'E'; + E = NULL; + } + if (prnbuf[1] == '0' && prnbuf[2] == '.') + { + /* _0.### POSITIVE FRACTION ==> _.### */ + /* -0.### NEGATIVE FRACTION ==> -.### */ + bwb_strcpy (&(prnbuf[1]), &(prnbuf[2])); + } + if (prnbuf[1] == '.' && prnbuf[2] == 'E') + { + /* _.E POSITIVE ZERO ==> _0 */ + /* -.E NEGATIVE ZERO ==> _0 */ + bwb_strcpy (prnbuf, " 0"); + } +} + +static int +CountDigits (char *Buffer) +{ + int NumDigits; + char *P; + + assert (Buffer != NULL); + + + /* determine the number of significant digits */ + NumDigits = 0; + P = Buffer; + while (*P) + { + if (bwb_isalpha (*P)) + { + /* 'E', 'e', and so on. */ + break; + } + if (bwb_isdigit (*P)) + { + NumDigits++; + } + P++; + } + return NumDigits; +} + +extern void +FormatBasicNumber (DoubleType Input, char *Output /* [ NUMLEN ] */ ) +{ + /******************************************************************************* + + This is essentially sprintf( Output, "%g", Input ), + except the rules for selecting between "%e", "%f", and "%d" are different. + + The C rules depend upon the value of the exponent. + The BASIC rules depend upon the number of significant digits. + + The results of this routine have been verified by the NBS2 test suite, so... + + THINK VERY CAREFULLY BEFORE MAKING ANY CHANGES TO THIS ROUTINE. + + *******************************************************************************/ + char *E; + + assert (Output != NULL); + + assert( My != NULL ); + if (My->OptionScaleInteger >= 1 + && My->OptionScaleInteger <= My->OptionDigitsInteger) + { + /* round */ + DoubleType Scale; + Scale = pow (10, My->OptionScaleInteger); + assert( Scale != 0 ); + Input = bwb_rint (Input * Scale) / Scale; + } + /* print in scientific form first, to determine exponent and significant digits */ + sprintf (Output, "% 1.*E", My->OptionDigitsInteger - 1, Input); + E = bwb_strchr (Output, 'E'); + if (E == NULL) + { + E = bwb_strchr (Output, 'e'); + } + if (E) + { + /* valid */ + int Exponent; + int NumDigits; + int DisplayDigits; + int zz; + char *F; /* pointer to the exponent's value */ + F = E; + while (bwb_isalpha (*F)) + { + F++; + } + Exponent = atoi (F); + CleanNumericString (Output, FALSE); + NumDigits = CountDigits (Output); + DisplayDigits = MIN (NumDigits, My->OptionDigitsInteger); + zz = MAX (Exponent, DisplayDigits - Exponent - 2); + if (zz >= My->OptionDigitsInteger) + { + /* SCIENTIFIC */ + sprintf (Output, "%# 1.*E", DisplayDigits - 1, Input); + } + else if (Input == (int) Input) + { + /* INTEGER */ + sprintf (Output, "% *d", DisplayDigits, (int) Input); + } + else + { + /* FLOAT */ + int Before; /* number of digits before the '.' */ + int After; /* number of digits after the '.' */ + + Before = Exponent + 1; + if (Before < 0) + { + Before = 0; + } + After = My->OptionDigitsInteger - Before; + if (After < 0) + { + After = 0; + } + sprintf (Output, "%# *.*f", Before, After, Input); + } + CleanNumericString (Output, FALSE); + } + else + { + /* ERROR, NAN, INFINITY, ETC. */ + } +} + + + +LineType * +bwb_LPRINT (LineType * l) +{ + int IsCSV; + + assert (l != NULL); + + assert( My != NULL ); + assert( My->SYSPRN != NULL ); + My->CurrentFile = My->SYSPRN; + IsCSV = FALSE; + internal_print (l, IsCSV); + return (l); +} + + +/*************************************************************** + + FUNCTION: bwb_print() + + DESCRIPTION: This function implements the BASIC PRINT + command. + + SYNTAX: PRINT [# device-number,][USING format-string$;] expressions... + +***************************************************************/ + + +static int +bwb_print_at (LineType * l) +{ + int position; + int r; + int c; + + assert (l != NULL); + + + position = 0; + r = 0; + c = 0; + if (line_read_integer_expression (l, &position)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return FALSE; + } + + if (line_skip_seperator (l)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return FALSE; + } + + if (position < 0) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + + + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + if (My->SYSOUT->width <= 0) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + if (My->SCREEN_ROWS <= 0) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + assert( My->CurrentFile == My->SYSOUT ); + /* position is 0-based. 0 is top left, */ + assert( My->CurrentFile != NULL ); + assert( My->CurrentFile->width != 0 ); + r = position / My->CurrentFile->width; + c = position - r * My->CurrentFile->width; + while (r >= My->SCREEN_ROWS) + { + r -= My->SCREEN_ROWS; + } + r++; /* 0-based to 1-based */ + c++; /* 0-based to 1-based */ + bwx_LOCATE (r, c); + return TRUE; +} + + +static int +parse_file_number (LineType * l) +{ + /* ... # FileNumber , ... */ + int FileNumber; + + assert (l != NULL); + + + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + /* + CBASIC-II: SERIAL & RANDOM file writes + PRINT # file_number ; expression [, expression] ' SERIAL write + PRINT # file_number , record_number ; expression [, expression] ' RANDOM write + */ + + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return FALSE; + } + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return FALSE; + } + + + if (line_skip_CommaChar (l) /* comma specific */ ) + { + /* + PRINT # file_number , record_number ; expression [, expression] ' RANDOM write + */ + /* get the RecordNumber */ + int RecordNumber; + + if ((My->CurrentFile->DevMode & DEVMODE_RANDOM) == 0) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (My->CurrentFile->width <= 0) + { + WARN_FIELD_OVERFLOW; + return FALSE; + } + if (line_read_integer_expression (l, &RecordNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + if (RecordNumber <= 0) + { + WARN_BAD_RECORD_NUMBER; + return FALSE; + } + RecordNumber--; /* BASIC to C */ + /* if( TRUE ) */ + { + long offset; + offset = RecordNumber; + offset *= My->CurrentFile->width; + fseek (My->CurrentFile->cfp, offset, SEEK_SET); + } + } + if (line_is_eol (l)) + { + /* PRINT # filenum */ + /* PRINT # filenum , recnum */ + } + else if (line_skip_SemicolonChar (l) /* semicolon specific */ ) + { + /* PRINT # filenum ; */ + /* PRINT # filenum , recnum ; */ + } + else + { + WARN_SYNTAX_ERROR; + return FALSE; + } + return TRUE; + } + /* + SERIAL file writes: + PRINT # file_number + PRINT # file_number [, expression] + */ + if (FileNumber < 0) + { + My->CurrentFile = My->SYSPRN; + } + else if (FileNumber == 0) + { + My->CurrentFile = My->SYSOUT; + } + else + { + /* normal file */ + My->CurrentFile = find_file_by_number (FileNumber); + } + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return FALSE; + } + if ((My->CurrentFile->DevMode & DEVMODE_WRITE) == 0) + { + WARN_BAD_FILE_NUMBER; + return FALSE; + } + if (line_is_eol (l)) + { + /* PRINT # 2 */ + } + else if (line_skip_seperator (l)) + { + /* PRINT # 2 , ... */ + } + else + { + WARN_SYNTAX_ERROR; + return FALSE; + } + return TRUE; +} + +LineType * +bwb_PRINT (LineType * l) +{ + int IsCSV; + + assert (l != NULL); + + IsCSV = FALSE; + assert( My != NULL ); + if (My->IsPrinter == TRUE) + { + My->CurrentFile = My->SYSPRN; + } + else + { + My->CurrentFile = My->SYSOUT; + } + internal_print (l, IsCSV); + return (l); +} + +/*************************************************************** + + FUNCTION: internal_print() + + DESCRIPTION: This function implements the PRINT + command, utilizing a specified file our + output device. + +***************************************************************/ + +static int +buff_read_using (char *buffer, int *position, char *format_string, + int format_length) +{ + int p; + + assert (buffer != NULL); + assert (position != NULL); + assert (format_string != NULL); + + p = *position; + + if (buff_skip_word (buffer, &p, "USING")) + { + buff_skip_spaces (buffer, &p); /* keep this */ + if (bwb_isdigit (buffer[p])) + { + /* PRINT USING ### */ + int n; + int LineNumber; + LineType *x; + char *C; + char *F; + + n = 0; + LineNumber = 0; + x = NULL; + if (buff_read_line_number (buffer, &p, &LineNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + /* check for target label */ + x = find_line_number (LineNumber); /* USING 100 */ + if (x == NULL) + { + WARN_UNDEFINED_LINE; + return FALSE; + } + /* line exists */ + if (x->cmdnum != C_IMAGE) + { + WARN_UNDEFINED_LINE; + return FALSE; + } + /* line contains IMAGE command */ + C = x->buffer; + C += x->Startpos; + F = format_string; + /* look for leading quote in IMAGE "..." */ + while (*C == ' ') + { + C++; + } + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + if (*C == My->CurrentVersion->OptionQuoteChar) + { + /* QUOTED */ + /* skip leading quote */ + C++; + while (*C != NulChar && *C != My->CurrentVersion->OptionQuoteChar) + { + /* copy format string, but not the trailing quote */ + if (n == format_length) + { + WARN_STRING_TOO_LONG; + break; + } + *F = *C; + C++; + F++; + n++; + } + /* skip trailing quote */ + } + else + { + /* UNQUOTED */ + while (*C) + { + /* copy format string verbatim */ + if (n == format_length) + { + WARN_STRING_TOO_LONG; + break; + } + *F = *C; + C++; + F++; + n++; + } + } + /* terminate format string */ + *F = NulChar; + if (buff_skip_seperator (buffer, &p) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + } + else + { + { + char *Value; + + Value = NULL; + if (buff_read_string_expression (buffer, &p, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + if (bwb_strlen (Value) > format_length) + { + WARN_STRING_TOO_LONG; + Value[format_length] = NulChar; + } + bwb_strcpy (format_string, Value); + free (Value); + Value = NULL; + } + if (buff_skip_seperator (buffer, &p) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + } + *position = p; + return TRUE; + } + return FALSE; +} + +static int +line_read_using (LineType * l, char *format_string, int format_length) +{ + assert (l != NULL); + assert (format_string != NULL); + return buff_read_using (l->buffer, &(l->position), format_string, + format_length); +} + +static void +internal_print (LineType * l, int IsCSV) +{ + /* if no arguments, simply print CR and return */ + /* 1980 PRINT , , ,"A" */ + int OutputCR; + char *format_string; + int format_length; + int format_position; + + assert (l != NULL); + + + OutputCR = TRUE; + assert( My != NULL ); + assert( My->ConsoleOutput != NULL ); + assert( MAX_LINE_LENGTH > 1 ); + format_string = My->ConsoleOutput; + format_length = MAX_LINE_LENGTH; + format_position = 0; + format_string[0] = NulChar; + + if (line_skip_FilenumChar (l)) + { + /* PRINT # file, ... */ + if (parse_file_number (l) == FALSE) + { + return; + } + assert( My->CurrentVersion != NULL ); + if (My->CurrentVersion->OptionVersionValue & (C77) + && My->CurrentFile->FileNumber > 0) + { + /* + ** + ** CBASIC-II files are CSV files. + ** + ** Strings are quoted other than PRINT USING. + ** Comma seperator writes a literal comma. + ** Semicolon seperator writes a literal comma. + ** Numbers do NOT have leading or trailing spaces. + ** + */ + IsCSV = TRUE; + } + OutputCR = TRUE; + } + else if (line_skip_AtChar (l)) + { + /* PRINT @ position, ... */ + assert( My->SYSOUT != NULL ); + My->CurrentFile = My->SYSOUT; + if (bwb_print_at (l) == FALSE) + { + return; + } + OutputCR = TRUE; + } + else if (My->CurrentVersion->OptionVersionValue & (B15|T80|HB1|HB2) + && line_skip_word (l, "AT")) + { + /* PRINT AT position, ... */ + assert( My->SYSOUT != NULL ); + My->CurrentFile = My->SYSOUT; + if (bwb_print_at (l) == FALSE) + { + return; + } + OutputCR = TRUE; + } + assert( My->CurrentFile != NULL ); + + while (line_is_eol (l) == FALSE) + { + /* LOOP THROUGH PRINT ELEMENTS */ + VariantType e; + VariantType *E; + + E = &e; + CLEAR_VARIANT (E); + if (line_skip_CommaChar (l) /* comma-specific */ ) + { + if (format_string[0]) + { + /* PRINT USING active */ + } + else if (IsCSV) + { + xputc1 (','); + } + else + { + /* tab over */ + next_zone (); + } + OutputCR = FALSE; + } + else if (line_skip_SemicolonChar (l) /* semicolon-specific */ ) + { + if (format_string[0]) + { + /* PRINT USING active */ + } + else if (IsCSV) + { + xputc1 (','); + } + else + { + /* concatenate strings */ + } + OutputCR = FALSE; + } + else if (line_read_using (l, format_string, format_length)) + { + format_position = 0; + OutputCR = TRUE; + } + else if (line_read_expression (l, E)) /* internal_print */ + { + /* resolve the string */ + if (My->IsErrorPending /* Keep This */ ) + { + /* + ** + ** this might look odd... + ** but we want to abort printing on the first warning. + ** The expression list could include a function with side-effects, + ** so any error should immediately halt further evaluation. + ** + */ + RELEASE_VARIANT (E); + return; + } + print_using_variant (format_string, &format_position, E, IsCSV); + RELEASE_VARIANT (E); + OutputCR = TRUE; + } + else + { + WARN_SYNTAX_ERROR; + return; + } + } + + if (OutputCR == TRUE) + { + /* did not end with ',' or ';' */ + xputc1 ('\n'); + } + if (My->CurrentFile == My->SYSOUT) + { + /* FOR I = 1 TO 1000: PRINT "."; : NEXT I : PRINT */ + fflush (My->SYSOUT->cfp); + } +} + + +/*************************************************************** + + FUNCTION: print_using_variant() + + DESCRIPTION: This function gets the PRINT USING + format string, returning a structure + to the format. + +***************************************************************/ +static void +print_using_number (char *buffer, int *position, VariantType * e) +{ + /* + Format a NUMBER. + 'buffer' points to the beginning of a PRINT USING format string, such as "###.##". + 'position' is the current offset in 'buffer'. + 'e' is the current expression to print. + */ + int width; + int precision; + int exponent; + char HeadChar; + char FillChar; + char CurrChar; + char ComaChar; + char TailChar; + int p; + char *tbuf; + + assert (buffer != NULL); + assert (position != NULL); + assert (e != NULL); + + + + width = 0; + precision = 0; + exponent = 0; + HeadChar = ' '; + FillChar = ' '; + CurrChar = ' '; + ComaChar = ' '; + TailChar = ' '; + assert( My != NULL ); + assert( My->ConsoleInput != NULL ); + tbuf = My->ConsoleInput; + + + p = *position; + while (IS_CHAR (buffer[p], PrintUsingNumberPlus) + || IS_CHAR (buffer[p], PrintUsingNumberMinus)) + { + HeadChar = buffer[p]; + width++; + p++; + } + while (IS_CHAR (buffer[p], PrintUsingNumberFiller) + || IS_CHAR (buffer[p], PrintUsingNumberDollar)) + { + if (IS_CHAR (buffer[p], PrintUsingNumberFiller)) + { + FillChar = PrintUsingNumberFiller; + } + else if (IS_CHAR (buffer[p], PrintUsingNumberDollar)) + { + CurrChar = PrintUsingNumberDollar; + } + width++; + p++; + } + while (IS_CHAR (buffer[p], PrintUsingNumberDigit) + || IS_CHAR (buffer[p], PrintUsingNumberComma)) + { + if (IS_CHAR (buffer[p], PrintUsingNumberComma)) + { + ComaChar = PrintUsingNumberComma; + } + width++; + p++; + } + if (IS_CHAR (buffer[p], PrintUsingNumberPeriod)) + { + while (IS_CHAR (buffer[p], PrintUsingNumberPeriod)) + { + width++; + p++; + } + while (IS_CHAR (buffer[p], PrintUsingNumberDigit)) + { + precision++; + width++; + p++; + } + } + while (IS_CHAR (buffer[p], PrintUsingNumberExponent)) + { + exponent++; + precision++; + width++; + p++; + } + while (IS_CHAR (buffer[p], PrintUsingNumberPlus) + || IS_CHAR (buffer[p], PrintUsingNumberMinus)) + { + TailChar = buffer[p]; + width++; + p++; + } + /* format the number */ + + + /* displaying both a Heading and a Trailing sign is NOT supported */ + if (TailChar == ' ') + { + /* do nothing */ + } + else + if (IS_CHAR (TailChar, PrintUsingNumberPlus) + || IS_CHAR (TailChar, PrintUsingNumberMinus)) + { + /* force the sign to be printed, so we can move it */ + HeadChar = TailChar; + } + else + { + WARN_INTERNAL_ERROR; + return; + } + + + if (HeadChar == ' ') + { + /* only display a '-' sign */ + if (exponent > 0) + { + sprintf (tbuf, "%*.*e", width, precision, e->Number); + } + else + { + sprintf (tbuf, "%*.*f", width, precision, e->Number); + } + } + else + if (IS_CHAR (HeadChar, PrintUsingNumberPlus) + || IS_CHAR (HeadChar, PrintUsingNumberMinus)) + { + /* force a leading sign '+' or '-' */ + if (exponent > 0) + { + sprintf (tbuf, "%+*.*e", width, precision, e->Number); + } + else + { + sprintf (tbuf, "%+*.*f", width, precision, e->Number); + } + } + else + { + WARN_INTERNAL_ERROR; + return; + } + + if (TailChar == ' ') + { + /* do nothing */ + } + else + if (IS_CHAR (TailChar, PrintUsingNumberPlus) + || IS_CHAR (TailChar, PrintUsingNumberMinus)) + { + /* move sign '+' or '-' to end */ + int i; + int n; + + n = bwb_strlen (tbuf); + + for (i = 0; i < n; i++) + { + if (tbuf[i] != ' ') + { + if (IS_CHAR (tbuf[i], PrintUsingNumberPlus)) + { + tbuf[i] = ' '; + if (IS_CHAR (TailChar, PrintUsingNumberPlus)) + { + /* TailChar of '+' does print a '+' */ + bwb_strcat (tbuf, "+"); + } + else if (IS_CHAR (TailChar, PrintUsingNumberMinus)) + { + /* TailChar of '-' does NOT print a '+' */ + bwb_strcat (tbuf, " "); + } + } + else if (IS_CHAR (tbuf[i], PrintUsingNumberMinus)) + { + tbuf[i] = ' '; + bwb_strcat (tbuf, "-"); + } + break; + } + } + if (tbuf[0] == ' ') + { + n = bwb_strlen (tbuf); + /* n > 0 */ + for (i = 1; i < n; i++) + { + tbuf[i - 1] = tbuf[i]; + } + tbuf[n - 1] = NulChar; + } + } + else + { + WARN_INTERNAL_ERROR; + return; + } + + + if (CurrChar == ' ') + { + /* do nothing */ + } + else if (IS_CHAR (CurrChar, PrintUsingNumberDollar)) + { + int i; + int n; + + n = bwb_strlen (tbuf); + + for (i = 0; i < n; i++) + { + if (tbuf[i] != ' ') + { + if (i > 0) + { + if (bwb_isdigit (tbuf[i])) + { + tbuf[i - 1] = CurrChar; + } + else + { + /* sign char */ + tbuf[i - 1] = tbuf[i]; + tbuf[i] = CurrChar; + } + } + break; + } + } + } + else + { + WARN_INTERNAL_ERROR; + return; + } + + if (FillChar == ' ') + { + /* do nothing */ + } + else if (IS_CHAR (FillChar, PrintUsingNumberFiller)) + { + int i; + int n; + + n = bwb_strlen (tbuf); + + for (i = 0; i < n; i++) + { + if (tbuf[i] != ' ') + { + break; + } + tbuf[i] = PrintUsingNumberFiller; + } + } + else + { + WARN_INTERNAL_ERROR; + return; + } + + if (ComaChar == ' ') + { + xputs (tbuf); + } + else if (IS_CHAR (ComaChar, PrintUsingNumberComma)) + { + int dig_pos; + int dec_pos; + int i; + int n; + int commas; + + dig_pos = -1; + dec_pos = -1; + n = bwb_strlen (tbuf); + + for (i = 0; i < n; i++) + { + if ((bwb_isdigit (tbuf[i]) != 0) && (dig_pos == -1)) + { + dig_pos = i; + } + if ((tbuf[i] == PrintUsingNumberPeriod) && (dec_pos == -1)) + { + dec_pos = i; + } + if ((dig_pos != -1) && (dec_pos != -1)) + { + break; + } + } + if (dig_pos == -1) + { + dec_pos = n; + } + if (dec_pos == -1) + { + dec_pos = n; + } + /* count the number of commas */ + commas = 0; + for (i = 0; i < n; i++) + { + if (((dec_pos - i) % 3 == 0) && (i > dig_pos) && (i < dec_pos)) + { + commas++; + } + } + /* now, actually print */ + for (i = 0; i < n; i++) + { + if (i < commas && tbuf[i] == FillChar) + { + /* + Ignore the same number of leading spaces as there are commas. + While not perfect for all possible cases, + it is usually good enough for practical purposes. + */ + } + else + { + if (((dec_pos - i) % 3 == 0) && (i > dig_pos) && (i < dec_pos)) + { + xputc1 (PrintUsingNumberComma); + } + xputc1 (tbuf[i]); + } + } + } + else + { + WARN_INTERNAL_ERROR; + return; + } + *position = p; +} + +static void +print_using_string (char *buffer, int *position, VariantType * e) +{ + /* + Format a STRING. + 'buffer' points to the beginning of a PRINT USING format string, such as "###.##". + 'position' is the current offset in 'buffer'. + 'e' is the current expression to print. + */ + int p; + char *tbuf; + + assert (buffer != NULL); + assert (position != NULL); + assert (e != NULL); + assert( My != NULL ); + assert( My->NumLenBuffer != NULL ); + + p = *position; + + if (e->VariantTypeCode == StringTypeCode) + { + tbuf = e->Buffer; + } + else + { + tbuf = My->NumLenBuffer; + FormatBasicNumber (e->Number, tbuf); + } + + if (IS_CHAR (buffer[p], PrintUsingStringFirst)) + { + /* print first character only */ + int i; + + i = 0; + if (tbuf[i] == NulChar) + { + xputc1 (' '); + } + else + { + xputc1 (tbuf[i]); + i++; + } + p++; + } + else if (IS_CHAR (buffer[p], PrintUsingStringAll)) + { + /* print entire string */ + p++; + xputs (tbuf); + } + else if (IS_CHAR (buffer[p], PrintUsingStringLength)) + { + /* print N characters or spaces */ + int i; + + i = 0; + if (tbuf[i] == NulChar) + { + xputc1 (' '); + } + else + { + xputc1 (tbuf[i]); + i++; + } + p++; + + while (buffer[p] != NulChar && buffer[p] != PrintUsingStringLength) + { + if (tbuf[i] == NulChar) + { + xputc1 (' '); + } + else + { + xputc1 (tbuf[i]); + i++; + } + p++; + } + if (IS_CHAR (buffer[p], PrintUsingStringLength)) + { + if (tbuf[i] == NulChar) + { + xputc1 (' '); + } + else + { + xputc1 (tbuf[i]); + i++; + } + p++; + } + } + *position = p; +} + +static int +is_magic_string (char *buffer) +{ + /* + for the character string pointed to 'buffer': + return TRUE if it is a MagicString sequence, + return FALSE otherwise. + */ + + assert (buffer != NULL); + + + /* 1 character sequences */ + if (IS_CHAR (buffer[0], PrintUsingStringFirst)) + { + /* "!" */ + return TRUE; + } + if (IS_CHAR (buffer[0], PrintUsingStringAll)) + { + /* "&" */ + return TRUE; + } + if (IS_CHAR (buffer[0], PrintUsingStringLength)) + { + /* "%...%" */ + return TRUE; + } + + /* 2 character sequences */ + + /* 3 character sequences */ + + return FALSE; +} + +static int +is_magic_number (char *buffer) +{ + /* + for the character string pointed to 'buffer': + return TRUE if it is a MagicNumber sequence, + return FALSE otherwise. + */ + + assert (buffer != NULL); + + /* 1 character sequences */ + if (IS_CHAR (buffer[0], PrintUsingNumberDigit)) + { + /* "#" */ + return TRUE; + } + + /* 2 character sequences */ + if (IS_CHAR (buffer[0], PrintUsingNumberFiller)) + if (IS_CHAR (buffer[1], PrintUsingNumberFiller)) + { + /* "**" */ + return TRUE; + } + if (IS_CHAR (buffer[0], PrintUsingNumberDollar)) + if (IS_CHAR (buffer[1], PrintUsingNumberDollar)) + { + /* "$$" */ + return TRUE; + } + + if (IS_CHAR (buffer[0], PrintUsingNumberPlus)) + if (IS_CHAR (buffer[1], PrintUsingNumberDigit)) + { + /* "+#" */ + return TRUE; + } + if (IS_CHAR (buffer[0], PrintUsingNumberMinus)) + if (IS_CHAR (buffer[1], PrintUsingNumberDigit)) + { + /* "-#" */ + return TRUE; + } + + /* 3 character sequences */ + if (IS_CHAR (buffer[0], PrintUsingNumberPlus)) + if (IS_CHAR (buffer[1], PrintUsingNumberFiller)) + if (IS_CHAR (buffer[2], PrintUsingNumberFiller)) + { + /* "+**" */ + return TRUE; + } + if (IS_CHAR (buffer[0], PrintUsingNumberPlus)) + if (IS_CHAR (buffer[1], PrintUsingNumberDollar)) + if (IS_CHAR (buffer[2], PrintUsingNumberDollar)) + { + /* "+$$" */ + return TRUE; + } + if (IS_CHAR (buffer[0], PrintUsingNumberMinus)) + if (IS_CHAR (buffer[1], PrintUsingNumberFiller)) + if (IS_CHAR (buffer[2], PrintUsingNumberFiller)) + { + /* "-**" */ + return TRUE; + } + if (IS_CHAR (buffer[0], PrintUsingNumberMinus)) + if (IS_CHAR (buffer[1], PrintUsingNumberDollar)) + if (IS_CHAR (buffer[2], PrintUsingNumberDollar)) + { + /* "-$$" */ + return TRUE; + } + + return FALSE; +} + +static void +print_using_variant (char *buffer, int *position, VariantType * e, int IsCSV) +{ + /* + Format an EXPRESSION. + 'buffer' points to the beginning of a PRINT USING format string, such as "###.##". + 'position' is the current offset in 'buffer'. + 'e' is the current expression to print. + */ + int IsUsed; + + assert (buffer != NULL); + assert (position != NULL); + assert (e != NULL); + assert( My != NULL ); + assert( My->NumLenBuffer != NULL ); + + /* PRINT A, B, C */ + /* PRINT USING "", A, B, C */ + /* PRINT USING "#", A, B, C */ + + IsUsed = FALSE; + if (buffer[0]) + { + /* we have a format string */ + int p; + p = *position; + + if (p > 0 && buffer[p] == NulChar) + { + /* recycle the format string */ + p = 0; + } + while (buffer[p]) + { + if (is_magic_string (&buffer[p])) + { + if (IsUsed) + { + /* stop here, ready for next string value */ + break; + } + if (e->VariantTypeCode != StringTypeCode) + { + /* we are a number value, so we cannot match a magic string */ + break; + } + /* magic and value are both string */ + print_using_string (buffer, &p, e); + IsUsed = TRUE; + } + else if (is_magic_number (&buffer[p])) + { + if (IsUsed) + { + /* stop here, ready for next number value */ + break; + } + if (e->VariantTypeCode == StringTypeCode) + { + /* we are a string value, so we cannot match a magic number */ + break; + } + /* magic and value are both number */ + print_using_number (buffer, &p, e); + IsUsed = TRUE; + } + else if (IS_CHAR (buffer[p], PrintUsingLiteral)) + { + /* print next character as literal */ + p++; + if (buffer[p] == NulChar) + { + /* PRINT USING "_" */ + xputc1 (' '); + } + else + { + /* PRINT USING "_%" */ + xputc1 (buffer[p]); + p++; + } + } + else + { + /* print this character as literal */ + /* PRINT USING "A" */ + xputc1 (buffer[p]); + p++; + } + } + *position = p; + } + + if (IsUsed == FALSE) + { + /* we did not actually print the vlue */ + if (e->VariantTypeCode == StringTypeCode) + { + /* + ** + ** PRINT A$ + ** PRINT USING "";A$ + ** PRINT USING "ABC";A$ + ** + */ + if (IsCSV) + { + xputc1 ('\"'); + xputs (e->Buffer); + xputc1 ('\"'); + } + else + { + xputs (e->Buffer); + } + } + else + { + /* + ** + ** PRINT X + ** PRINT USING "";X + ** PRINT USING "ABC";X + ** + ** [space]number[space] POSITIVE or ZERO + ** [minus]number[space] NEGATIVE + ** + **/ + char *tbuf; + + tbuf = My->NumLenBuffer; + + FormatBasicNumber (e->Number, tbuf); + + if (IsCSV) + { + char *P; + P = tbuf; + while (*P == ' ') + { + P++; + } + xputs (P); + } + else + { + xputs (tbuf); + xputc1 (' '); + } + } + } +} + +/*************************************************************** + + FUNCTION: xputs() + + DESCRIPTION: This function outputs a null-terminated + string to a specified file or output + device. + +***************************************************************/ + +static void +xputs (char *buffer) +{ + + assert (buffer != NULL); + assert( My != NULL ); + assert (My->CurrentFile != NULL); + + if (My->CurrentFile->width > 0) + { + /* check to see if the width will be exceeded */ + int n; + n = My->CurrentFile->col + bwb_strlen (buffer) - 1; + if (n > My->CurrentFile->width) + { + xputc1 ('\n'); + } + } + /* output the string */ + while (*buffer) + { + xputc1 (*buffer); + buffer++; + } +} + + +/*************************************************************** + + FUNCTION: next_zone() + + DESCRIPTION: Advance to the next print zone. + +***************************************************************/ +static void +next_zone (void) +{ + assert( My != NULL ); + assert (My->CurrentFile != NULL); + + if (My->CurrentFile->width > 0) + { + /* + ** + ** check to see if width will be exceeded + ** + */ + int LastZoneColumn; + + LastZoneColumn = 1; + while (LastZoneColumn < My->CurrentFile->width) + { + LastZoneColumn += My->OptionZoneInteger; + } + LastZoneColumn -= My->OptionZoneInteger; + + if (My->CurrentFile->col >= LastZoneColumn) + { + /* + ** + ** width will be exceeded, so advance to a new line + ** + */ + xputc1 ('\n'); + return; + } + } + /* + ** + ** advance to the next print zone + ** + */ + if ((My->CurrentFile->col % My->OptionZoneInteger) == 1) + { + xputc1 (' '); + } + while ((My->CurrentFile->col % My->OptionZoneInteger) != 1) + { + xputc1 (' '); + } +} + +/*************************************************************** + + FUNCTION: xputc1() + + DESCRIPTION: This function outputs a character to a + specified file or output device, checking + to be sure the PRINT width is within + the bounds specified for that device. + +***************************************************************/ + +static void +xputc1 (char c) +{ + assert( My != NULL ); + assert (My->CurrentFile != NULL); + + if (My->CurrentFile->width > 0) + { + /* + ** + ** check to see if width has been exceeded + ** + */ + if (c != '\n') + { + /* + ** + ** REM this should print one line, not two lines + ** WIDTH 80 + ** PRINT SPACE$( 80 ) + ** + */ + if (My->CurrentFile->col > My->CurrentFile->width) + { + xputc2 ('\n'); /* output LF */ + } + } + } + /* + ** + ** output the character + ** + */ + xputc2 (c); +} + +/*************************************************************** + + FUNCTION: xputc2() + + DESCRIPTION: This function sends a character to a + specified file or output device. + +***************************************************************/ + + +static void +xputc2 (char c) +{ + assert( My != NULL ); + assert (My->CurrentFile != NULL); + assert (My->CurrentFile->cfp != NULL); + assert( My->CurrentVersion != NULL ); + + if (c == '\n') + { + /* + ** + ** CBASIC-II: RANDOM files are padded on the right with spaces + ** + */ + if (My->CurrentVersion->OptionVersionValue & (C77)) + if (My->CurrentFile->DevMode & DEVMODE_RANDOM) + if (My->CurrentFile->width > 0) + { +#if HAVE_MSDOS + /* "\n" is converted to "\r\n" */ + while (My->CurrentFile->col < (My->CurrentFile->width - 1)) +#else /* ! HAVE_MSDOS */ + while (My->CurrentFile->col < My->CurrentFile->width) +#endif /* ! HAVE_MSDOS */ + { + fputc (' ', My->CurrentFile->cfp); + My->CurrentFile->col++; + } + } + /* + ** + ** output the character + ** + */ + fputc (c, My->CurrentFile->cfp); + /* + ** + ** NULLS + ** + */ + if (My->LPRINT_NULLS > 0) + if (My->CurrentFile == My->SYSPRN) + if (My->CurrentFile->width > 0) + { + int i; + for (i = 0; i < My->LPRINT_NULLS; i++) + { + fputc (NulChar, My->SYSPRN->cfp); + } + } + /* + ** + ** update current column position + ** + */ + My->CurrentFile->col = 1; + My->CurrentFile->row++; + return; + } + /* + ** + ** output the character + ** + */ + fputc (c, My->CurrentFile->cfp); + /* + ** + ** update current column position + ** + */ + My->CurrentFile->col++; +} + + +extern void +ResetConsoleColumn (void) +{ + assert( My != NULL ); + assert (My->SYSOUT != NULL); + + My->SYSOUT->col = 1; +} + +static LineType * +S70_PUT (LineType * l) +{ + /* PUT filename$ , value [, ...] */ + VariantType e; + VariantType *E; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + assert( My->NumLenBuffer != NULL ); + + E = &e; + CLEAR_VARIANT (E); + if (line_read_expression (l, E) == FALSE) /* bwb_PUT */ + { + goto EXIT; + } + if (E->VariantTypeCode == StringTypeCode) + { + /* STRING */ + /* PUT filename$ ... */ + if (is_empty_string (E->Buffer)) + { + /* PUT "" ... is an error */ + WARN_BAD_FILE_NAME; + goto EXIT; + } + My->CurrentFile = find_file_by_name (E->Buffer); + if (My->CurrentFile == NULL) + { + /* implicitly OPEN for writing */ + My->CurrentFile = file_new (); + My->CurrentFile->cfp = fopen (E->Buffer, "w"); + if (My->CurrentFile->cfp == NULL) + { + WARN_BAD_FILE_NAME; + goto EXIT; + } + My->CurrentFile->FileNumber = file_next_number (); + My->CurrentFile->DevMode = DEVMODE_OUTPUT; + My->CurrentFile->width = 0; + /* WIDTH == RECLEN */ + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + My->CurrentFile->buffer = NULL; + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = E->Buffer; + E->Buffer = NULL; + } + } + else + { + /* NUMBER -- file must already be OPEN */ + /* PUT filenumber ... */ + if (E->Number < 0) + { + /* "PUT # -1" is an error */ + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + if (E->Number == 0) + { + /* "PUT # 0" is an error */ + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + /* normal file */ + My->CurrentFile = find_file_by_number ((int) bwb_rint (E->Number)); + if (My->CurrentFile == NULL) + { + /* file not OPEN */ + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + } + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + if ((My->CurrentFile->DevMode & DEVMODE_WRITE) == 0) + { + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + if (line_is_eol (l)) + { + /* PUT F$ */ + /* PUT #1 */ + xputc1 ('\n'); + goto EXIT; + } + else if (line_skip_seperator (l)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + + /* loop through elements */ + + while (line_is_eol (l) == FALSE) + { + while (line_skip_seperator (l)) + { + /* PUT F$, ,,,A,,,B,,, */ + /* PUT #1, ,,,A,,,B,,, */ + xputc1 (My->CurrentFile->delimit); + } + + if (line_is_eol (l) == FALSE) + { + /* print this item */ + + CLEAR_VARIANT (E); + if (line_read_expression (l, E) == FALSE) /* bwb_PUT */ + { + goto EXIT; + } + if (E->VariantTypeCode == StringTypeCode) + { + /* STRING */ + xputc1 (My->CurrentVersion->OptionQuoteChar); + xputs (E->Buffer); + xputc1 (My->CurrentVersion->OptionQuoteChar); + } + else + { + /* NUMBER */ + char *tbuf; + + tbuf = My->NumLenBuffer; + FormatBasicNumber (E->Number, tbuf); + xputs (tbuf); + } + RELEASE_VARIANT (E); + } + } + /* print LF */ + xputc1 ('\n'); + /* OK */ +EXIT: + RELEASE_VARIANT (E); + return (l); +} + + +static LineType * +D71_PUT (LineType * l) +{ + /* PUT # file_number [ , RECORD record_number ] */ + int file_number; + + assert (l != NULL); + assert( My != NULL ); + + file_number = 0; + if (line_skip_FilenumChar (l)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (l, &file_number) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (file_number < 1) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + My->CurrentFile = find_file_by_number (file_number); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (My->CurrentFile->DevMode != DEVMODE_RANDOM) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (My->CurrentFile->width <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (line_is_eol (l)) + { + /* PUT # file_number */ + } + else + { + /* PUT # file_number , RECORD record_number */ + int record_number; + long offset; + + record_number = 0; + offset = 0; + if (line_skip_seperator (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_word (l, "RECORD") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &record_number) == FALSE) + { + WARN_BAD_RECORD_NUMBER; + return (l); + } + if (record_number <= 0) + { + WARN_BAD_RECORD_NUMBER; + return (l); + } + record_number--; /* BASIC to C */ + offset = record_number; + offset *= My->CurrentFile->width; + if (fseek (My->CurrentFile->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_RECORD_NUMBER; + return (l); + } + } + field_put (My->CurrentFile); + /* if( TRUE ) */ + { + int i; + for (i = 0; i < My->CurrentFile->width; i++) + { + char c; + c = My->CurrentFile->buffer[i]; + fputc (c, My->CurrentFile->cfp); + } + } + /* OK */ + return (l); +} + +static LineType * +H14_PUT (LineType * Line) +{ + /* PUT # FileNumber [ , RecordNumber ] ' RANDOM */ + /* PUT # FileNumber , [ BytePosition ] , scalar [,...] ' BINARY */ + int file_number; + + assert (Line != NULL); + assert( My != NULL ); + + file_number = 0; + if (line_skip_FilenumChar (Line)) + { + /* OPTIONAL */ + } + if (line_read_integer_expression (Line, &file_number) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (file_number < 1) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + My->CurrentFile = find_file_by_number (file_number); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (My->CurrentFile->DevMode == DEVMODE_RANDOM) + { + /* PUT # FileNumber [ , RecordNumber ] ' RANDOM */ + if (My->CurrentFile->width <= 0) + { + WARN_BAD_FILE_NUMBER; + return (Line); + } + if (line_is_eol (Line)) + { + /* PUT # file_number */ + } + else + { + /* PUT # FileNumber , RecordNumber ' RANDOM */ + int record_number; + long offset; + + record_number = 0; + offset = 0; + if (line_skip_seperator (Line) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_read_integer_expression (Line, &record_number) == FALSE) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + if (record_number <= 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + record_number--; /* BASIC to C */ + offset = record_number; + offset *= My->CurrentFile->width; + if (fseek (My->CurrentFile->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + } + field_put (My->CurrentFile); + /* if( TRUE ) */ + { + int i; + for (i = 0; i < My->CurrentFile->width; i++) + { + char c; + c = My->CurrentFile->buffer[i]; + fputc (c, My->CurrentFile->cfp); + } + } + /* OK */ + return (Line); + } + else if (My->CurrentFile->DevMode == DEVMODE_BINARY) + { + /* PUT # FileNumber , [ BytePosition ] , scalar [,...] ' BINARY */ + if (line_skip_seperator (Line) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (line_skip_seperator (Line)) + { + /* BytePosition not provided */ + } + else + { + int RecordNumber; + long offset; + + RecordNumber = 0; + offset = 0; + if (line_read_integer_expression (Line, &RecordNumber) == FALSE) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + if (RecordNumber <= 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + RecordNumber--; /* BASIC to C */ + offset = RecordNumber; + if (fseek (My->CurrentFile->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_RECORD_NUMBER; + return (Line); + } + if (line_skip_seperator (Line) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + } + do + { + VariableType *v; + + if ((v = line_read_scalar (Line)) == NULL) + { + WARN_SYNTAX_ERROR; + return (Line); + } + if (binary_get_put (v, TRUE) == FALSE) + { + WARN_SYNTAX_ERROR; + return (Line); + } + } + while (line_skip_seperator (Line)); + /* OK */ + return (Line); + } + WARN_BAD_FILE_MODE; + return (Line); +} + + +extern LineType * +bwb_PUT (LineType * Line) +{ + + assert (Line != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + if (My->CurrentVersion->OptionVersionValue & (S70 | I70 | I73)) + { + return S70_PUT (Line); + } + if (My->CurrentVersion->OptionVersionValue & (D71 | R86)) + { + return D71_PUT (Line); + } + if (My->CurrentVersion->OptionVersionValue & (H14)) + { + return H14_PUT (Line); + } + WARN_INTERNAL_ERROR; + return (Line); +} + + +/*************************************************************** + + FUNCTION: bwb_write() + + DESCRIPTION: This C function implements the BASIC WRITE + command. + + SYNTAX: WRITE [# device-number,] element [, element ].... + +***************************************************************/ + + +extern LineType * +bwb_WRITE (LineType * l) +{ + int IsCSV; + + assert (l != NULL); + + IsCSV = TRUE; + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + My->CurrentFile = My->SYSOUT; + internal_print (l, IsCSV); + return (l); +} + +static LineType * +file_write_matrix (LineType * l, char delimit) +{ + /* MAT PRINT [ # filenumber , ] matrix [;|,] ... */ + /* MAT WRITE [ # filenumber , ] matrix [;|,] ... */ + /* MAT PUT filename$ , matrix [;|,] ... */ + /* MAT PUT filenumber , matrix [;|,] ... */ + /* Array must be 1, 2 or 3 dimensions */ + /* Array may be either NUMBER or STRING */ + + assert (l != NULL); + + do + { + VariableType *v; + char ItemSeperator; + + /* get matrix name */ + if ((v = line_read_matrix (l)) == NULL) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + + /* variable MUST be an array of 1, 2 or 3 dimensions */ + if (v->dimensions < 1) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + if (v->dimensions > 3) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + /* + ** + ** This may look odd, but MAT PRINT is special. + ** The variable seperator AFTER the variable determines how the variable's values are printed. + ** The number of dimension determines: + ** a) the meaning of comma (,) and semicolon (;) + ** b) the default of row-by-row or col-by-col + ** + */ + ItemSeperator = NulChar; /* concatenate the columns */ + if (line_skip_CommaChar (l) /* comma-specific */ ) + { + /* + ** + ** force printing with the specified delimiter, + ** which is usually a Comma but can be any character. + ** + */ + ItemSeperator = delimit; /* for MAT PRINT this is forced to be a ZoneChar */ + } + else if (line_skip_SemicolonChar (l) /* semicolon-specific */ ) + { + /* + ** + ** force concatenating the columns, + ** ignoring the specified delimiter. + ** + */ + ItemSeperator = NulChar; + } + else + { + /* + ** + ** default the item seperator based upon variable's dimensions + ** + */ + switch (v->dimensions) + { + case 1: + /* by default, a one dimension array is printed row-by-row */ + ItemSeperator = '\n'; + break; + case 2: + /* by default, a two dimension array is printed col-by-col */ + ItemSeperator = delimit; + break; + case 3: + /* by default, a three dimension array is printed col-by-col */ + ItemSeperator = delimit; + break; + } + } + /* print array */ + switch (v->dimensions) + { + case 1: + { + /* + OPTION BASE 0 + DIM A(5) + ... + MAT PRINT A + ... + FOR I = 0 TO 5 + PRINT A(I) + NEXT I + ... + */ + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + if (v->VINDEX[0] > v->LBOUND[0]) + { + switch (ItemSeperator) + { + case NulChar: + break; + case ZoneChar: + next_zone (); + break; + default: + xputc1 (ItemSeperator); + } + } + if (var_get (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + if (variant.VariantTypeCode == StringTypeCode) + { + xputs (variant.Buffer); + } + else + { + char *tbuf; + + tbuf = My->NumLenBuffer; + FormatBasicNumber (variant.Number, tbuf); + xputs (tbuf); + } + } + xputc1 ('\n'); + } + break; + case 2: + { + /* + OPTION BASE 0 + DIM B(2,3) + ... + MAT PRINT B + ... + FOR I = 0 TO 2 + FOR J = 0 TO 3 + PRINT B(I,J), + NEXT J + PRINT + NEXT I + ... + */ + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + for (v->VINDEX[1] = v->LBOUND[1]; v->VINDEX[1] <= v->UBOUND[1]; + v->VINDEX[1]++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + if (v->VINDEX[1] > v->LBOUND[1]) + { + switch (ItemSeperator) + { + case NulChar: + break; + case ZoneChar: + next_zone (); + break; + default: + xputc1 (ItemSeperator); + } + } + if (var_get (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + if (variant.VariantTypeCode == StringTypeCode) + { + xputs (variant.Buffer); + } + else + { + char *tbuf; + + tbuf = My->NumLenBuffer; + FormatBasicNumber (variant.Number, tbuf); + xputs (tbuf); + } + } + xputc1 ('\n'); + } + } + break; + case 3: + { + /* + OPTION BASE 0 + DIM C(2,3,4) + ... + MAT PRINT C + ... + FOR I = 0 TO 2 + FOR J = 0 TO 3 + FOR K = 0 TO 4 + PRINT C(I,J,K), + NEXT K + PRINT + NEXT J + PRINT + NEXT I + ... + */ + for (v->VINDEX[0] = v->LBOUND[0]; v->VINDEX[0] <= v->UBOUND[0]; + v->VINDEX[0]++) + { + for (v->VINDEX[1] = v->LBOUND[1]; v->VINDEX[1] <= v->UBOUND[1]; + v->VINDEX[1]++) + { + for (v->VINDEX[2] = v->LBOUND[2]; v->VINDEX[2] <= v->UBOUND[2]; + v->VINDEX[2]++) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + if (v->VINDEX[2] > v->LBOUND[2]) + { + switch (ItemSeperator) + { + case NulChar: + break; + case ZoneChar: + next_zone (); + break; + default: + xputc1 (ItemSeperator); + } + } + if (var_get (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + if (variant.VariantTypeCode == StringTypeCode) + { + xputs (variant.Buffer); + } + else + { + char *tbuf; + + tbuf = My->NumLenBuffer; + FormatBasicNumber (variant.Number, tbuf); + xputs (tbuf); + } + } + xputc1 ('\n'); + } + xputc1 ('\n'); + } + } + break; + } + /* process the next variable, if any */ + } + while (line_is_eol (l) == FALSE); + return (l); +} + +extern LineType * +bwb_MAT_PUT (LineType * l) +{ + /* MAT PUT filename$ , matrix [;|,] ... */ + /* MAT PUT filenumber , matrix [;|,] ... */ + /* Array must be 1, 2 or 3 dimensions */ + /* Array may be either NUMBER or STRING */ + VariantType x; + VariantType *X; + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + + My->CurrentFile = My->SYSOUT; + X = &x; + CLEAR_VARIANT (X); + if (line_read_expression (l, X) == FALSE) /* bwb_MAT_PUT */ + { + goto EXIT; + } + if (X->VariantTypeCode == StringTypeCode) + { + /* STRING */ + /* MAT PUT filename$ ... */ + if (is_empty_string (X->Buffer)) + { + /* MAT PUT "" ... is an error */ + WARN_BAD_FILE_NAME; + goto EXIT; + } + My->CurrentFile = find_file_by_name (X->Buffer); + if (My->CurrentFile == NULL) + { + /* implicitly OPEN for writing */ + My->CurrentFile = file_new (); + My->CurrentFile->cfp = fopen (X->Buffer, "w"); + if (My->CurrentFile->cfp == NULL) + { + WARN_BAD_FILE_NAME; + goto EXIT; + } + My->CurrentFile->FileNumber = file_next_number (); + My->CurrentFile->DevMode = DEVMODE_OUTPUT; + My->CurrentFile->width = 0; + /* WIDTH == RECLEN */ + My->CurrentFile->col = 1; + My->CurrentFile->row = 1; + My->CurrentFile->delimit = ','; + My->CurrentFile->buffer = NULL; + if (My->CurrentFile->FileName != NULL) + { + free (My->CurrentFile->FileName); + My->CurrentFile->FileName = NULL; + } + My->CurrentFile->FileName = X->Buffer; + X->Buffer = NULL; + } + } + else + { + /* NUMBER -- file must already be OPEN */ + /* MAT PUT filenumber ... */ + if (X->Number < 0) + { + /* "MAT PUT # -1" is an error */ + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + if (X->Number == 0) + { + /* "MAT PUT # 0" is an error */ + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + /* normal file */ + My->CurrentFile = find_file_by_number ((int) bwb_rint (X->Number)); + if (My->CurrentFile == NULL) + { + /* file not OPEN */ + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + } + RELEASE_VARIANT (X); + if (My->CurrentFile == NULL) + { + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + if ((My->CurrentFile->DevMode & DEVMODE_WRITE) == 0) + { + WARN_BAD_FILE_NUMBER; + goto EXIT; + } + if (line_skip_seperator (l)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + goto EXIT; + } + return file_write_matrix (l, My->CurrentFile->delimit); +EXIT: + RELEASE_VARIANT (X); + return (l); +} + +static LineType * +bwb_mat_dump (LineType * l, int IsWrite) +{ + /* MAT PRINT [ # filenumber , ] matrix [;|,] ... */ + /* MAT WRITE [ # filenumber , ] matrix [;|,] ... */ + /* Array must be 1, 2 or 3 dimensions */ + /* Array may be either NUMBER or STRING */ + char delimit; + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + + My->CurrentFile = My->SYSOUT; + if (line_skip_FilenumChar (l)) + { + /* ... # file, ... */ + if (parse_file_number (l) == FALSE) + { + return (l); + } + if (line_is_eol (l)) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + + if (IsWrite) + { + /* MAT WRITE */ + delimit = My->CurrentFile->delimit; + } + else + { + /* MAT PRINT */ + delimit = ZoneChar; + } + return file_write_matrix (l, delimit); +} + +extern LineType * +bwb_MAT_WRITE (LineType * l) +{ + + assert (l != NULL); + + return bwb_mat_dump (l, TRUE); +} + +extern LineType * +bwb_MAT_PRINT (LineType * l) +{ + + assert (l != NULL); + + return bwb_mat_dump (l, FALSE); +} + + + +/* EOF */ diff --git a/bwb_stc.c b/bwb_stc.c new file mode 100644 index 0000000..bc310af --- /dev/null +++ b/bwb_stc.c @@ -0,0 +1,1433 @@ +/*************************************************************** + + bwb_stc.c Commands Related to Structured Programming + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + +static int ErrorMessage (LineType * current); +static LineType *FindParentCommand (int cmdnum, unsigned int Indention, + LineType * Previous[]); +static LineType *find_BottomLineInCode (LineType * l); +static int MissingBottomLine (LineType * current, int cmdnum); +static int scan_readargs (UserFunctionType * f, LineType * l); +static int UserFunction_clear (void); + +/*************************************************************** + + FUNCTION: UserFunction_init() + + DESCRIPTION: This function initializes the FUNCTION-SUB + lookup table. + +***************************************************************/ + +extern int +UserFunction_init (void) +{ + assert( My != NULL ); + + My->UserFunctionHead = NULL; + return TRUE; +} + +/*************************************************************** + + FUNCTION: bwb_scan() + + DESCRIPTION: This function scans all lines of the + program in memory and creates a FUNCTION- + SUB lookup table (fslt) for the program. + +***************************************************************/ + +static int +ErrorMessage (LineType * current) +{ + char tbuf[64]; + + assert (current != NULL); + + switch (current->cmdnum) + { + case C_FOR: + bwb_strcpy (tbuf, "FOR without NEXT"); + break; + case C_EXIT_FOR: + bwb_strcpy (tbuf, "EXIT FOR without FOR"); + break; + case C_NEXT: + bwb_strcpy (tbuf, "NEXT without FOR"); + break; + case C_DO: + bwb_strcpy (tbuf, "DO without LOOP"); + break; + case C_EXIT_DO: + bwb_strcpy (tbuf, "EXIT DO without DO"); + break; + case C_LOOP: + bwb_strcpy (tbuf, "LOOP without DO"); + break; + case C_REPEAT: + bwb_strcpy (tbuf, "REPEAT without UNTIL"); + break; + case C_EXIT_REPEAT: + bwb_strcpy (tbuf, "EXIT REPEAT without REPEAT"); + break; + case C_UNTIL: + bwb_strcpy (tbuf, "UNTIL without REPEAT"); + break; + case C_WHILE: + bwb_strcpy (tbuf, "WHILE without WEND"); + break; + case C_EXIT_WHILE: + bwb_strcpy (tbuf, "EXIT WHILE without WHILE"); + break; + case C_WEND: + bwb_strcpy (tbuf, "WEND without WHILE"); + break; + case C_SUB: + bwb_strcpy (tbuf, "SUB without END SUB"); + break; + case C_EXIT_SUB: + bwb_strcpy (tbuf, "EXIT SUB without SUB"); + break; + case C_END_SUB: + bwb_strcpy (tbuf, "END SUB without SUB"); + break; + case C_FUNCTION: + bwb_strcpy (tbuf, "FUNCTION without END FUNCTION"); + break; + case C_EXIT_FUNCTION: + bwb_strcpy (tbuf, "EXIT FUNCTION without FUNCTION"); + break; + case C_END_FUNCTION: + bwb_strcpy (tbuf, "END FUNCTION without FUNCTION"); + break; + case C_IF8THEN: + bwb_strcpy (tbuf, "IF THEN without END IF"); + break; + case C_ELSEIF: + bwb_strcpy (tbuf, "ELSEIF without IF THEN"); + break; + case C_ELSE: + bwb_strcpy (tbuf, "ELSE without IF THEN"); + break; + case C_END_IF: + bwb_strcpy (tbuf, "END IF without IF THEN"); + break; + case C_SELECT_CASE: + bwb_strcpy (tbuf, "SELECT CASE without END SELECT"); + break; + case C_CASE: + bwb_strcpy (tbuf, "CASE without SELECT CASE"); + break; + case C_CASE_ELSE: + bwb_strcpy (tbuf, "CASE ELSE without SELECT CASE"); + break; + case C_END_SELECT: + bwb_strcpy (tbuf, "END SELECT without SELECT CASE"); + break; + default: + bwb_strcpy (tbuf, "UNKNOWN COMMAND"); + break; + } + fprintf (My->SYSOUT->cfp, "%s: %d %s\n", tbuf, current->number, + current->buffer); + ResetConsoleColumn (); + return FALSE; +} + +static LineType * +find_BottomLineInCode (LineType * l) +{ + + + if (l == NULL) + { + return NULL; + } + while (l->OtherLine != NULL) + { + switch (l->cmdnum) + { + case C_NEXT: + case C_LOOP: + case C_UNTIL: + case C_WEND: + case C_END_SUB: + case C_END_FUNCTION: + case C_END_IF: + case C_END_SELECT: + return l; + } + l = l->OtherLine; + } + /* l->OtherLine == NULL */ + return l; +} + +static int +MissingBottomLine (LineType * current, int cmdnum) +{ + LineType *BottomLineInCode; + + + BottomLineInCode = find_BottomLineInCode (current); + if (BottomLineInCode == NULL) + { + return TRUE; + } + if (BottomLineInCode->cmdnum != cmdnum) + { + return TRUE; + } + return FALSE; +} + +static LineType * +FindParentCommand (int cmdnum, unsigned int Indention, + LineType * Previous[ /* EXECLEVELS */ ]) +{ + + assert (Previous != NULL); + + if (Indention > 0) + { + unsigned int i; + for (i = Indention - 1; /* i >= 0 */ ; i--) + { + if (Previous[i]->cmdnum == cmdnum) + { + /* FOUND */ + return Previous[i]; /* EXIT_FOR->OtherLine == FOR */ + } + if (i == 0) + { + /* NOT FOUND */ + } + } + } + /* NOT FOUND */ + return NULL; +} + +extern int +bwb_scan (void) +{ + /* + STATIC ANALYSIS + + + Background. + This routine began as a way to record the line numbers associated with the cmdnum of FUNCTION, SUB, or LABEL. + + Pretty-printing. + Indention was added for pretty-printing by LIST, based upon the cmdnum (Indetion++, Indention--). + + Mismatched structured commands. + When reviewing a properly indented listing, mismatched structured commands are easier to visually indentify + (FOR without NEXT and so on), so Previous[] was added to record the previous cmdnum at a given Indention. + Comparing Current->cmdnum with Previous->cmdnum allows mismatched structured commands to be detected. + + Reduce stack usage for structured loops. + OtherLine, which was previously determined at runtime for loops, could now be determined during the scan. + Previously all loops used the stack so the EXIT command could find the loop's bottom line. + The EXIT commands could now look in Previous[] to determine their loop's top line and follow that to the loop's bottom line. + As a result, now the FOR loops use the stack to hold the current iteration value, but all other loops do not. + + Reduce stack usaage for structured IF/SELECT. + Previuosly the structured IF/SELECT command used the stack to hold the results of comparisons and intermediate values. + OtherLine is now used to link these commands to their next occurring command. + As a result, the path thru the structure is now chosen at the IF/SELECT command, and the stack is no longer used. + The RESUME command knows about this linkage, so a simple "RESUME" jumps to the "IF THEN" or "SELECT CASE" + and "RESUME NEXT" jumps to the "END IF" or "END SELECT". + + Caching for unstructured commands. + OtherLine was not previously used for any purpose for the unstructured GOTO, GOSUB, IF and ON commands. + It is now used to cache the line last executed by these commands to reduce the time required to find the target line. + The cache reduces execution time because the target line is usually (but not always) the same. + For the simple commands "GOTO 100", "GOSUB 100" and "IF x THEN 100", the cache will always succeed. + For the command "IF x THEN 100 ELSE 200", the cache will succeed for the last taken path. + Because programs are typically written so one path is more likely, the cache usually succeeds. + For the "ON x GOTO ..." and "ON x GOSUB ...", the cache succeeds when the result of the test expression repeats, such as: + FOR I = 1 TO 100 + ON INT(I/10) GOSUB ... + NEXT I + In this example, the cache will succeed 90 times and fail 10 times. + + Checking FOR/NEXT variable names. + If a variable name is provided for a NEXT command, then it is compared against the variable name of the matching FOR command. + This detects the following kind of mismatch: + FOR I = ... + NEXT J + + OtherLine is now used for different purposes depending upon the command. + + For structured IF8THEN and SELECT_CASE, OtherLine is used to form a one-way list: + IF8THEN->OtherLine == next occuring ELSE_IF, ELSE, END_IF + ELSE_IF->Otherline == next occuring ELSE_IF, ELSE, END_IF + ELSE->OtherLine == END_IF + END_IF->OtherLine == NULL + + + For the structured loops, OtherLine is uses as a circular list: + WHILE->OtherLine == WEND + EXIT_WHILE->OtherLine == WHILE + WEND->OtherLine == WHILE + + For unstructured flow-of-control commands, OtherLine is used as a one-entry cache. + It contains a pointer to the Most Recently Used line returned by the command: + + GOTO->OtherLine == MRU target line + GOSUB->OtherLine == MRU target line + IF->OtherLine == MRU target line + ON->OtherLine == MRU target line + + For DATA commands, OtherLine points to the next DATA line (if it exists), otherwise it points to EndMarker. + StartMarker->OtherLine points to the first DATA line (if it exists), otherwise it points to EndMarker. + RESTORE knows about this. + + For other commands, OtherLine is not used. + + Any command which _requires_ OtherLine is not allowed be executed from the console in immediate mode. + + */ + LineType *current; + LineType *prev_DATA; /* previous DATA statement */ + unsigned int Indention; + LineType *Previous[EXECLEVELS]; /* previous part of structured command */ + + + assert( My != NULL ); + assert( My->StartMarker != NULL ); + assert( My->EndMarker != NULL ); + + + prev_DATA = NULL; + if (My->IsScanRequired == FALSE) + { + /* program is clean, no scan required */ + return TRUE; + } + /* program needs to be scanned again, because a line was added or deleted */ + + /* reset these whenever a SCAN occurs */ + My->StartMarker->OtherLine = My->EndMarker; /* default when no DATA statements exist */ + My->DataLine = My->EndMarker; /* default when no DATA statements exist */ + My->DataPosition = My->DataLine->Startpos; + My->ERL = NULL; + My->ContinueLine = NULL; + + + /* first run through the FUNCTION - SUB loopkup table and free any existing memory */ + + UserFunction_clear (); + + + + for (Indention = 0; Indention < EXECLEVELS; Indention++) + { + Previous[Indention] = NULL; + } + Indention = 0; + + for (current = My->StartMarker->next; current != My->EndMarker; + current = current->next) + { + assert( current != NULL ); + current->OtherLine = NULL; + + if (current->cmdnum == C_DATA) + { + if (prev_DATA == NULL) + { + /* I am the first DATA statement */ + My->StartMarker->OtherLine = current; + My->DataLine = current; + My->DataPosition = My->DataLine->Startpos; + } + else + { + /* link the previous DATA statement to me */ + prev_DATA->OtherLine = current; + } + /* I am the last DATA statement so far */ + current->OtherLine = My->EndMarker; + /* I should point at the next DATA statement */ + prev_DATA = current; + } + + switch (current->cmdnum) + { + case C_DEF: + case C_FUNCTION: + case C_SUB: + case C_DEF8LBL: + UserFunction_add (current); + } + + /* verify the 'current' command is consistent with a 'previous' command at a lower indention */ + switch (current->cmdnum) + { + case C_EXIT_FOR: + current->OtherLine = FindParentCommand (C_FOR, Indention, Previous); /* EXIT_FOR->OtherLine == FOR */ + if (current->OtherLine == NULL) + { + return ErrorMessage (current); + } + break; + case C_EXIT_WHILE: + current->OtherLine = FindParentCommand (C_WHILE, Indention, Previous); /* EXIT_WHILE->OtherLine == WHILE */ + if (current->OtherLine == NULL) + { + return ErrorMessage (current); + } + break; + case C_EXIT_REPEAT: + current->OtherLine = FindParentCommand (C_REPEAT, Indention, Previous); /* EXIT_REPEAT->OtherLine == REPEAT */ + if (current->OtherLine == NULL) + { + return ErrorMessage (current); + } + break; + case C_EXIT_FUNCTION: + current->OtherLine = FindParentCommand (C_FUNCTION, Indention, Previous); /* EXIT_FUNCTION->OtherLine == FUNCTION */ + if (current->OtherLine == NULL) + { + return ErrorMessage (current); + } + break; + case C_EXIT_SUB: + current->OtherLine = FindParentCommand (C_SUB, Indention, Previous); /* EXIT_SUB->OtherLine == SUB */ + if (current->OtherLine == NULL) + { + return ErrorMessage (current); + } + break; + case C_EXIT_DO: + current->OtherLine = FindParentCommand (C_DO, Indention, Previous); /* EXIT_DO->OtherLine == DO */ + if (current->OtherLine == NULL) + { + return ErrorMessage (current); + } + break; + } + + + /* verify the 'current' command is consistent with a 'previous' command at the same indention */ + switch (current->cmdnum) + { + case C_NEXT: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_FOR: + /* if( TRUE ) */ + { + /* compare the 'NEXT' variable with the 'FOR' variable */ + current->position = current->Startpos; + Previous[Indention]->position = Previous[Indention]->Startpos; + if (line_is_eol (current)) + { + /* NEXT */ + /* there is no variable to compare */ + } + else + { + /* NEXT variable */ + char NextVarName[NameLengthMax + 1]; + char ForVarName[NameLengthMax + 1]; + + if (line_read_varname (current, NextVarName) == FALSE) + { + return ErrorMessage (current); + } + if (line_read_varname (Previous[Indention], ForVarName) == FALSE) + { + return ErrorMessage (current); + } + if (bwb_stricmp (ForVarName, NextVarName) != 0) + { + return ErrorMessage (current); + } + } + /* MATCHED */ + current->Startpos = current->position; + Previous[Indention]->position = Previous[Indention]->Startpos; + } + /* OK */ + Previous[Indention]->OtherLine = current; /* FOR->OtherLine = NEXT */ + current->OtherLine = Previous[Indention]; /* NEXT->OtherLine = FOR */ + Previous[Indention] = current; /* last command at this level = NEXT */ + break; + default: + return ErrorMessage (current); + } + break; + case C_LOOP: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_DO: + /* OK */ + Previous[Indention]->OtherLine = current; /* DO->OtherLine = LOOP */ + current->OtherLine = Previous[Indention]; /* LOOP->OtherLine = DO */ + Previous[Indention] = current; /* last command at this level = LOOP */ + break; + default: + return ErrorMessage (current); + } + break; + case C_UNTIL: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_REPEAT: + /* OK */ + Previous[Indention]->OtherLine = current; /* REPEAT->OtherLine = UNTIL */ + current->OtherLine = Previous[Indention]; /* UNTIL->OtherLine = REPEAT */ + Previous[Indention] = current; /* last command at this level = UNTIL */ + break; + default: + return ErrorMessage (current); + } + break; + case C_WEND: + if (Indention == 0) + { + fprintf (My->SYSOUT->cfp, "Unmatched command %d %s\n", + current->number, current->buffer); + ResetConsoleColumn (); + return FALSE; + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_WHILE: + /* OK */ + Previous[Indention]->OtherLine = current; /* WHILE->OtherLine = WEND */ + current->OtherLine = Previous[Indention]; /* WEND->OtherLine = WHILE */ + Previous[Indention] = current; /* last command at this level = WEND */ + break; + default: + return ErrorMessage (current); + } + break; + case C_END_SUB: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_SUB: + /* OK */ + Previous[Indention]->OtherLine = current; /* SUB->OtherLine = END_SUB */ + current->OtherLine = Previous[Indention]; /* END_SUB->OtherLine = SUB */ + Previous[Indention] = current; /* last command at this level = END_SUB */ + break; + default: + return ErrorMessage (current); + } + break; + case C_END_FUNCTION: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_FUNCTION: + /* OK */ + Previous[Indention]->OtherLine = current; /* FUNCTION->OtherLine = END_FUNCTION */ + current->OtherLine = Previous[Indention]; /* END_FUNCTION->OtherLine = FUNCTION */ + Previous[Indention] = current; /* last command at this level = END_FUNCTION */ + break; + default: + return ErrorMessage (current); + } + break; + case C_ELSEIF: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_IF8THEN: + /* OK */ + Previous[Indention]->OtherLine = current; /* IF8THEN->OtherLine = ELSEIF */ + Previous[Indention] = current; /* last command at this level = ELSEIF */ + break; + case C_ELSEIF: + /* OK */ + Previous[Indention]->OtherLine = current; /* ELSEIF->OtherLine = ELSEIF */ + Previous[Indention] = current; /* last command at this level = ELSEIF */ + break; + default: + return ErrorMessage (current); + } + break; + case C_ELSE: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_IF8THEN: + /* OK */ + Previous[Indention]->OtherLine = current; /* IF8THEN->OtherLine = ELSE */ + Previous[Indention] = current; /* last command at this level = ELSE */ + break; + case C_ELSEIF: + /* OK */ + Previous[Indention]->OtherLine = current; /* ELSEIF->OtherLine = ELSE */ + Previous[Indention] = current; /* last command at this level = ELSE */ + break; + default: + return ErrorMessage (current); + } + break; + case C_END_IF: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_IF8THEN: + /* OK */ + Previous[Indention]->OtherLine = current; /* IF8THEN->OtherLine = END_IF */ + Previous[Indention] = current; /* last command at this level = END_IF */ + break; + case C_ELSEIF: + /* OK */ + Previous[Indention]->OtherLine = current; /* ELSEIF->OtherLine = END_IF */ + Previous[Indention] = current; /* last command at this level = END_IF */ + break; + case C_ELSE: + /* OK */ + Previous[Indention]->OtherLine = current; /* ELSE->OtherLine = END_IF */ + Previous[Indention] = current; /* last command at this level = END_IF */ + break; + default: + return ErrorMessage (current); + } + break; + case C_CASE: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_SELECT_CASE: + /* OK */ + Previous[Indention]->OtherLine = current; /* C_SELECT_CASE->OtherLine = C_CASE */ + Previous[Indention] = current; /* last command at this level = C_CASE */ + break; + case C_CASE: + /* OK */ + Previous[Indention]->OtherLine = current; /* CASE->OtherLine = C_CASE */ + Previous[Indention] = current; /* last command at this level = C_CASE */ + break; + default: + return ErrorMessage (current); + } + break; + case C_CASE_ELSE: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_CASE: + /* OK */ + Previous[Indention]->OtherLine = current; /* CASE->OtherLine = C_CASE_ELSE */ + Previous[Indention] = current; /* last command at this level = C_CASE_ELSE */ + break; + default: + return ErrorMessage (current); + } + break; + case C_END_SELECT: + if (Indention == 0) + { + return ErrorMessage (current); + } + Indention--; + switch (Previous[Indention]->cmdnum) + { + case C_CASE: + /* OK */ + Previous[Indention]->OtherLine = current; /* CASE->OtherLine = END_SELECT */ + Previous[Indention] = current; /* last command at this level = END_SELECT */ + break; + case C_CASE_ELSE: + /* OK */ + Previous[Indention]->OtherLine = current; /* CASE_ELSE->OtherLine = END_SELECT */ + Previous[Indention] = current; /* last command at this level = END_SELECT */ + break; + default: + return ErrorMessage (current); + } + break; + } + /* OK */ + + current->Indention = Indention; + + /* record the 'current' command as the 'previous' command at this indention */ + switch (current->cmdnum) + { + case C_FUNCTION: + case C_SUB: + /* this 'command' can NOT be inside the structure of another 'command' */ + if (Indention > 0) + { + return ErrorMessage (Previous[Indention - 1]); + } + case C_FOR: + case C_DO: + case C_REPEAT: + case C_WHILE: + case C_IF8THEN: + case C_SELECT_CASE: + if (Previous[Indention] != NULL) + { + /* we are NOT the first command at this indention level */ + /* verify the 'previous' command at this level was properly closed */ + switch (Previous[Indention]->cmdnum) + { + case C_FOR: + case C_DO: + case C_REPEAT: + case C_WHILE: + case C_FUNCTION: + case C_SUB: + case C_IF8THEN: + case C_ELSEIF: + case C_ELSE: + case C_SELECT_CASE: + case C_CASE: + case C_CASE_ELSE: + /* there is an existing unclosed structure */ + return ErrorMessage (Previous[Indention]); + } + } + Previous[Indention] = current; + Indention++; + if (Indention == EXECLEVELS) + { + fprintf (My->SYSOUT->cfp, "Program is nested too deep\n"); + ResetConsoleColumn (); + return FALSE; + } + Previous[Indention] = NULL; + break; + case C_ELSEIF: + case C_ELSE: + case C_CASE: + case C_CASE_ELSE: + /* + Previous[ Indention ] was already checked and assigned above, just indent. + */ + Indention++; + if (Indention == EXECLEVELS) + { + fprintf (My->SYSOUT->cfp, "Program is nested too deep\n"); + ResetConsoleColumn (); + return FALSE; + } + Previous[Indention] = NULL; + break; + } + } + + if (Indention > 0) + { + return ErrorMessage (Previous[Indention - 1]); + } + + /* verify the OtherLine chain terminates correctly; we should find the bottom command */ + for (current = My->StartMarker->next; current != My->EndMarker; + current = current->next) + { + assert( current != NULL ); + switch (current->cmdnum) + { + case C_FOR: + case C_EXIT_FOR: + if (MissingBottomLine (current, C_NEXT)) + { + return ErrorMessage (current); + } + break; + case C_DO: + case C_EXIT_DO: + if (MissingBottomLine (current, C_LOOP)) + { + return ErrorMessage (current); + } + break; + case C_REPEAT: + case C_EXIT_REPEAT: + if (MissingBottomLine (current, C_UNTIL)) + { + return ErrorMessage (current); + } + break; + case C_WHILE: + case C_EXIT_WHILE: + if (MissingBottomLine (current, C_WEND)) + { + return ErrorMessage (current); + } + break; + case C_FUNCTION: + case C_EXIT_FUNCTION: + if (MissingBottomLine (current, C_END_FUNCTION)) + { + return ErrorMessage (current); + } + break; + case C_SUB: + case C_EXIT_SUB: + if (MissingBottomLine (current, C_END_SUB)) + { + return ErrorMessage (current); + } + break; + case C_IF8THEN: + if (MissingBottomLine (current, C_END_IF)) + { + return ErrorMessage (current); + } + break; + case C_SELECT_CASE: + if (MissingBottomLine (current, C_END_SELECT)) + { + return ErrorMessage (current); + } + break; + } + } + + /* return */ + + My->IsScanRequired = FALSE; + return TRUE; + +} + +/*************************************************************** + + FUNCTION: UserFunction_clear() + + DESCRIPTION: This C function clears all existing memory + in the FUNCTION-SUB lookup table. + +***************************************************************/ + +static int +UserFunction_clear (void) +{ + UserFunctionType *current; + + assert( My != NULL ); + + + /* run through table and clear memory */ + for (current = My->UserFunctionHead; current != NULL;) + { + UserFunctionType *next; + + assert( current != NULL ); + next = current->next; + + /* check for local variables and free them */ + if (current->local_variable != NULL) + { + var_free (current->local_variable); + current->local_variable = NULL; + } + + if (current->name != NULL) + { + free (current->name); + current->name = NULL; + } + free (current); + current = next; + } + My->UserFunctionHead = NULL; + return TRUE; +} + +extern int +UserFunction_name (char *name) +{ + /* search USER functions */ + UserFunctionType *L; + + assert (name != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + for (L = My->UserFunctionHead; L != NULL; L = L->next) + { + if (My->CurrentVersion->OptionVersionValue & L->OptionVersionBitmask) + { + if (bwb_stricmp (L->name, name) == 0) + { + return TRUE; + } + } + } + return FALSE; +} + +extern UserFunctionType * +UserFunction_find_exact (char *name, unsigned char ParameterCount, + ParamBitsType ParameterTypes) +{ + /* search USER functions */ + UserFunctionType *L; + + assert (name != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + for (L = My->UserFunctionHead; L != NULL; L = L->next) + { + if (My->CurrentVersion->OptionVersionValue & L->OptionVersionBitmask) + { + if (L->ParameterCount == ParameterCount + && L->ParameterTypes == ParameterTypes) + { + if (bwb_stricmp (L->name, name) == 0) + { + /* FOUND */ + return L; + } + } + } + } + /* NOT FOUND */ + return NULL; +} + +/*************************************************************** + + FUNCTION: UserFunction_add() + + DESCRIPTION: This C function adds an entry to the + FUNCTION-SUB lookup table. + +***************************************************************/ + +extern int +UserFunction_add (LineType * l /* , int *position , int code */ ) +{ + char *name; + UserFunctionType *f; + char TypeCode; + char varname[NameLengthMax + 1]; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + assert( My->DefaultVariableType != NULL ); + + + /* get the element for name */ + switch (l->cmdnum) + { + case C_DEF: + case C_FUNCTION: + case C_SUB: + l->position = l->Startpos; + if (line_read_varname (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + break; + case C_DEF8LBL: + l->position = 0; + if (line_read_label (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + l->position = l->Startpos; + break; + default: + WARN_SYNTAX_ERROR; + return FALSE; + } + + /* get memory for name buffer */ + if ((name = + (char *) calloc (bwb_strlen (varname) + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return FALSE; + } + bwb_strcpy (name, varname); + + /* get memory for fslt structure */ + if ((f = + (UserFunctionType *) calloc (1, sizeof (UserFunctionType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return FALSE; + } + /* fill in structure */ + + f->line = l; + f->name = name; + f->local_variable = NULL; + f->ParameterCount = 0; /* 0..32, 255 == (...) */ + f->ParameterTypes = 0; /* bit 0 is first parameter */ + f->startpos = l->position; + f->OptionVersionBitmask = My->CurrentVersion->OptionVersionValue; + + + + + /* read arguments */ + switch (l->cmdnum) + { + case C_DEF: + case C_FUNCTION: + case C_SUB: + TypeCode = var_nametype (varname); + if (line_peek_LparenChar (l)) + { + if (scan_readargs (f, l)) + { + f->startpos = l->position; + } + } + /* determine function type */ + if (TypeCode == NulChar) + { + /* function has no explicit type char */ + TypeCode = line_read_type_declaration (l); + if (TypeCode == NulChar) + { + /* function has no declared type */ + int i; + i = VarTypeIndex (varname[0]); + if (i < 0) + { + TypeCode = DoubleTypeCode; /* default */ + } + else + { + TypeCode = My->DefaultVariableType[i]; + } + } + } + break; + case C_DEF8LBL: + TypeCode = LongTypeCode; + break; + default: + WARN_SYNTAX_ERROR; + return FALSE; + } + f->ReturnTypeCode = TypeCode; + /* establish linkages */ + f->next = My->UserFunctionHead; + My->UserFunctionHead = f; + + return TRUE; +} + +/*************************************************************** + + FUNCTION: scan_readargs() + + DESCRIPTION: This C function reads arguments (variable + names for an entry added to the FUNCTION- + SUB lookup table. + +***************************************************************/ + +static int +scan_readargs (UserFunctionType * f, LineType * l) +{ + + assert (f != NULL); + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + assert( My->DefaultVariableType != NULL ); + + f->ParameterCount = 0; /* 0..32, 255 == (...) */ + f->ParameterTypes = 0; /* bit 0 is first parameter */ + + /* we should be at begin paren */ + if (line_skip_LparenChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + if (line_skip_RparenChar (l)) + { + /* end of NO argument list */ + /* FUNCTION ABC() */ + return TRUE; + } + if (line_skip_word (l, "...")) + { + /* FUNCTION FRED( ... ) */ + if (line_skip_RparenChar (l)) + { + f->ParameterCount = 0xFF; /* VARIANT */ + f->ParameterTypes = 0; + return TRUE; + } + WARN_SYNTAX_ERROR; + return FALSE; + } + + /* loop through looking for arguments */ + do + { + VariableType *v; + char TypeCode; + char varname[NameLengthMax + 1]; + + /* presume beginning of argument == variable name */ + if (line_read_varname (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return FALSE; + } + /* determine variable type */ + TypeCode = var_nametype (varname); + if (TypeCode == NulChar) + { + /* variable has no explicit type char */ + TypeCode = line_read_type_declaration (l); + if (TypeCode == NulChar) + { + /* variable has no declared type */ + int i; + i = VarTypeIndex (varname[0]); + if (i < 0) + { + TypeCode = DoubleTypeCode; /* default */ + } + else + { + TypeCode = My->DefaultVariableType[i]; + } + } + } + + /* initialize the variable and add it to local chain */ + v = var_new (varname, TypeCode); + UserFunction_addlocalvar (f, v); + if (VAR_IS_STRING (v)) + { + f->ParameterTypes |= (1 << f->ParameterCount); + } + f->ParameterCount++; /* 0..32, 255 == (...) */ + if (f->ParameterCount > MAX_FARGS) + { + /* should have been declared VARIANT */ + WARN_SYNTAX_ERROR; + return FALSE; + } + } + while (line_skip_seperator (l)); + + if (line_skip_RparenChar (l)) + { + /* end of argument list */ + return TRUE; + } + + /* FUNCTION ABC( A$, B$, */ + WARN_SYNTAX_ERROR; + return FALSE; +} + + + +/*************************************************************** + + FUNCTION: UserFunction_addlocalvar() + + DESCRIPTION: This function adds a local variable + to the FUNCTION-SUB lookup table at + a specific level. + +***************************************************************/ + +extern int +UserFunction_addlocalvar (UserFunctionType * f, VariableType * v) +{ + + assert (f != NULL); + assert (v != NULL); + + /* find end of local chain */ + if (f->local_variable == NULL) + { + f->local_variable = v; + } + else + { + VariableType *p; + VariableType *c; + + p = f->local_variable; + for (c = f->local_variable->next; c != NULL; c = c->next) + { + p = c; + } + p->next = v; + } + v->next = NULL; + return TRUE; +} + +LineType * +bwb_DEF8LBL (LineType * l) +{ + /* + ** + ** this command is used for a line that is a user label + ** + */ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + line_skip_eol (l); + return (l); +} + +/*************************************************************** + + FUNCTION: bwb_def() + + DESCRIPTION: This C function implements the BASIC + DEF statement. + + SYNTAX: DEF FNname(arg...)] = expression + + NOTE: It is not a strict requirement that the + function name should begin with "FN". + +***************************************************************/ + +LineType * +bwb_DEF (LineType * l) +{ + + assert (l != NULL); + + if (l->LineFlags & (LINE_USER)) + { + WARN_ILLEGAL_DIRECT; + return (l); + } + + /* this line will be executed by IntrinsicFunction_deffn() in bwb_fnc.c */ + line_skip_eol (l); + + return (l); +} + + + +/*************************************************************** + + FUNCTION: bwb_call() + + DESCRIPTION: This C function implements the BASIC + CALL subroutine command. + + SYNTAX: CALL subroutine-name( param1, param2 ) + +***************************************************************/ + +LineType * +bwb_CALL (LineType * l) +{ + VariantType x; + VariantType *X; + + assert (l != NULL); + + X = &x; + CLEAR_VARIANT (X); + /* Call the expression interpreter to evaluate the function */ + if (line_read_expression (l, X) == FALSE) /* bwb_CALL */ + { + WARN_SYNTAX_ERROR; + goto EXIT; + } +EXIT: + RELEASE_VARIANT (X); + return (l); +} + + +/*************************************************************** + + FUNCTION: find_label() + + DESCRIPTION: This C function finds a program line that + begins with the label included in . + +***************************************************************/ +LineType * +find_line_number (int number) +{ + /* + ** + ** LABELS are resolved to their line number by the expresson parser. + ** However, LABELS usually do not have the LINE_NUMBERED flag set. + ** + */ + assert( My != NULL ); + assert( My->StartMarker != NULL ); + assert( My->EndMarker != NULL ); + + + if (MINLIN <= number && number <= MAXLIN) + { + /* + ** + ** brute force search + ** + */ + LineType *x; + + for (x = My->StartMarker->next; x != NULL && x != My->EndMarker && x->number < number; + x = x->next); + assert( x != NULL ); + if (x->number == number) + { + /* FOUND */ + return x; + } + } + /* NOT FOUND */ + WARN_UNDEFINED_LINE; + return NULL; +} + +extern VariableType * +var_chain (VariableType * argv) +{ + /* create a variable chain */ + VariableType *argn; + + + if (argv == NULL) + { + /* we are the first variable in the chain */ + if ((argn = (VariableType *) calloc (1, sizeof (VariableType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + } + else + { + /* find the end of the chain */ + assert( argv != NULL ); + for (argn = argv; argn->next != NULL; argn = argn->next); + + /* add ourself to the end */ + assert( argn != NULL ); + if ((argn->next = + (VariableType *) calloc (1, sizeof (VariableType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + argn = argn->next; + } + assert( argn != NULL ); + argn->next = NULL; + + /* return pointer to the variable just created */ + return argn; +} + + +/* EOF */ diff --git a/bwb_str.c b/bwb_str.c new file mode 100644 index 0000000..fdf68a8 --- /dev/null +++ b/bwb_str.c @@ -0,0 +1,762 @@ +/*************************************************************** + + bwb_str.c String-Management Routines + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +/*************************************************************** + +BASIC allows embedded NUL (0) characters. C str*() does not. + +ALL the StringType code should use mem*() and ->length. +ALL the StringType code should prevent string overflow. + +***************************************************************/ + + + + +#include "bwbasic.h" + + +static int CharListToSet (char *pattern, int start, int stop); +static int IndexOf (char *buffer, char find, int start); + + +/*************************************************************** + + FUNCTION: str_btob() + + DESCRIPTION: This C function assigns a bwBASIC string + structure to another bwBASIC string + structure. + +***************************************************************/ + +int +str_btob (StringType * d, StringType * s) +{ + + assert (d != NULL); + assert (s != NULL); + /* assert( s->length >= 0 ); */ + assert( My != NULL ); + + if (s->length > MAXLEN) + { + WARN_STRING_TOO_LONG; /* str_btob */ + s->length = MAXLEN; + } + + /* get memory for new buffer */ + if (d->sbuffer != NULL) + { + /* free the destination's buffer */ + if (d->sbuffer == My->MaxLenBuffer) + { + /* + ** this occurs when setting the return value of a multi-line string user function + ** + ** FUNCTION INKEY$ + ** DIM A$ + ** LINE INPUT A$ + ** LET INKEY$ = LEFT$( A$, 1 ) + ** END FUNCTION + ** + */ + } + else if (d->sbuffer == My->ConsoleOutput) + { + /* this should never occur, but let's make sure we don't crash if it does */ + WARN_INTERNAL_ERROR; + /* continue processing */ + } + else if (d->sbuffer == My->ConsoleInput) + { + /* this should never occur, but let's make sure we don't crash if it does */ + WARN_INTERNAL_ERROR; + /* continue processing */ + } + else + { + free (d->sbuffer); + d->sbuffer = NULL; + } + d->sbuffer = NULL; + d->length = 0; + } + if (d->sbuffer == NULL) + { + /* allocate the destination's buffer */ + d->length = 0; + if ((d->sbuffer = + (char *) calloc (s->length + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return FALSE; + } + } + /* write the b string to the b string */ + assert( d->sbuffer != NULL ); + if( s->length > 0 ) + { + assert( s->sbuffer != NULL ); + bwb_memcpy (d->sbuffer, s->sbuffer, s->length); + } + d->length = s->length; + d->sbuffer[d->length] = NulChar; + return TRUE; +} + + +/*************************************************************** + + FUNCTION: str_cmp() + + DESCRIPTION: This C function performs the equivalent + of the C strcmp() function, using BASIC + strings. + +***************************************************************/ + +int +str_cmp (StringType * a, StringType * b) +{ + + assert (a != NULL); + assert (b != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + if (a->length > MAXLEN) + { + WARN_STRING_TOO_LONG; /* str_cmp */ + a->length = MAXLEN; + } + if (b->length > MAXLEN) + { + WARN_STRING_TOO_LONG; /* str_cmp */ + b->length = MAXLEN; + } + if (a->sbuffer == NULL) + { + if (b->sbuffer == NULL) + { + return 0; + } + if (b->length == 0) + { + return 0; + } + return 1; + } + assert( a->sbuffer != NULL ); + a->sbuffer[a->length] = NulChar; + + if (b->sbuffer == NULL) + { + if (a->sbuffer == NULL) + { + return 0; + } + if (a->length == 0) + { + return 0; + } + return -1; + } + assert( b->sbuffer != NULL ); + b->sbuffer[b->length] = NulChar; + + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + /* case insensitive */ + return bwb_stricmp (a->sbuffer, b->sbuffer); /* NOTE: embedded NUL characters terminate comparison */ + } + else + { + /* case sensitive */ + return bwb_strcmp (a->sbuffer, b->sbuffer); /* NOTE: embedded NUL characters terminate comparison */ + } +} + +/*************************************************************** + + MATCH + +***************************************************************/ + +int +str_match (char *A, int A_Length, char *B, int B_Length, int I_Start) +{ + /* + SYNTAX: j% = MATCH( a$, b$, i% ) + + MATCH returns the position of the first occurrence of a$ in b$ + starting with the character position given by the third parameter. + A zero is returned if no MATCH is found. + + The following pattern-matching features are available: + # matches any digit (0-9). + ! matches any upper-or lower-case letter. + ? matches any character. + \ serves as an escape character indicating the following character does not have special meaning. + + For example, a ? signifies any character is a MATCH unless preceded by a \. + a$ and b$ must be strings. + If either of these arguments are numeric, an error occurs. + If i% is real, it is converted to an integer. + If i% is a string, an error occurs. + If i% is negative or zero, a run-time error occurs. + When i% is greater than the length of b$, zero is returned. + If b$ is a null string, a 0 is returned. + If b$ is not null, but a$ is null, a 1 is returned. + + Examples: + MATCH( "is", "Now is the", 1) returns 5 + MATCH( "##", "October 8, 1876", 1) returns 12 + MATCH( "a?", "character", 4 ) returns 5 + MATCH( "\#", "123#45", 1) returns 4 + MATCH( "ABCD", "ABC", 1 ) returns 0 + MATCH( "\#1\\\?", "1#1\?2#", 1 ) returns 2 + */ + + + int a; /* current position in A$ */ + int b; /* current position in B$ */ + + assert (A != NULL); + assert (B != NULL); + + + if (I_Start <= 0) + { + return 0; + } + if (I_Start > B_Length) + { + return 0; + } + if (B_Length <= 0) + { + return 0; + } + if (A_Length <= 0) + { + return 1; + } + I_Start--; /* BASIC to C */ + for (b = I_Start; b < B_Length; b++) + { + int n; /* number of characters in A$ matched with B$ */ + + n = 0; + for (a = 0; a < A_Length; a++) + { + int bn; + bn = b + n; + if (A[a] == '#' && bwb_isdigit (B[bn])) + { + n++; + } + else if (A[a] == '!' && bwb_isalpha (B[bn])) + { + n++; + } + else if (A[a] == '?') + { + n++; + } + else if (a < (A_Length - 1) && A[a] == '\\' && A[a + 1] == B[bn]) + { + n++; + a++; + } + else if (A[a] == B[bn]) + { + n++; + } + else + { + break; + } + } + if (a == A_Length) + { + b++; /* C to BASIC */ + return b; + } + } + return 0; +} + + + +/*************************************************************** + + FUNCTION: str_like() + + DESCRIPTION: This C function performs the equivalent + of the BASIC LIKE operator, using BASIC + strings. + +***************************************************************/ + +/* +inspired by http://www.blackbeltcoder.com/Articles/net/implementing-vbs-like-operator-in-c +*/ + +/* +KNOWN ISSUES: +To match the character '[', use "[[]". +To match the character '?', use "[?]". +To match the character '*', use "[*]". +Does not match "" with "[]" or "[!]". +*/ + +#define CHAR_SET '*' +#define CHAR_CLR ' ' + +static char charList[256]; + +static int +IndexOf (char *buffer, char find, int start) +{ + int buffer_count; + int buffer_length; + + assert (buffer != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + buffer_length = bwb_strlen (buffer); + + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + find = bwb_toupper (find); + } + + for (buffer_count = start; buffer_count < buffer_length; buffer_count++) + { + char theChar; + + theChar = buffer[buffer_count]; + + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + theChar = bwb_toupper (theChar); + } + + + if (theChar == find) + { + /* FOUND */ + return buffer_count; + } + + } + /* NOT FOUND */ + return -1; +} + + +static int +CharListToSet (char *pattern, int start, int stop) +{ + /* + Converts a string of characters to a HashSet of characters. If the string + contains character ranges, such as A-Z, all characters in the range are + also added to the returned set of characters. + */ + int pattern_Count; + + assert (pattern != NULL); + + bwb_memset (charList, CHAR_CLR, 256); + + if (start > stop) + { + /* ERROR */ + return FALSE; + } + /* Leading '-' */ + while (pattern[start] == '-') + { + /* Match character '-' */ + + charList[0x00FF & pattern[start]] = CHAR_SET; + start++; + if (start > stop) + { + /* DONE */ + return TRUE; + } + } + /* Trailing '-' */ + while (pattern[stop] == '-') + { + /* Match character '-' */ + charList[0x00FF & pattern[stop]] = CHAR_SET; + stop--; + if (start > stop) + { + /* DONE */ + return TRUE; + } + } + + + for (pattern_Count = start; pattern_Count <= stop; pattern_Count++) + { + if (pattern[pattern_Count] == '-') + { + /* Character range */ + + char startChar; + char endChar; + char theChar; + + if (pattern_Count > start) + { + startChar = pattern[pattern_Count - 1]; + if (startChar == '-') + { + /* ERROR */ + return FALSE; + } + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + startChar = bwb_toupper (startChar); + } + } + else + { + /* ERROR */ + return FALSE; + } + if (pattern_Count < stop) + { + endChar = pattern[pattern_Count + 1]; + if (endChar == '-') + { + /* ERROR */ + return FALSE; + } + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + endChar = bwb_toupper (endChar); + } + if (endChar < startChar) + { + /* ERROR */ + return FALSE; + } + } + else + { + /* ERROR */ + return FALSE; + } + /* + Although the startChar has already been set, + and the endChar will be set on the next loop, + we go ahead and set them here too. + Not the most efficient, but easy to understand, + and we do not have to do anything special + for edge cases such as [A-A] and [A-B]. + */ + for (theChar = startChar; theChar <= endChar; theChar++) + { + charList[0x00FF & theChar] = CHAR_SET; + } + } + else + { + /* Single character */ + char theChar; + + theChar = pattern[pattern_Count]; + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + theChar = bwb_toupper (theChar); + } + charList[0x00FF & theChar] = CHAR_SET; + } + } + + return TRUE; +} + + + +int +IsLike (char *buffer, int *buffer_count, int buffer_Length, + char *pattern, int *pattern_count, int pattern_Length) +{ + + /* Implement's VB's Like operator logic. */ + + /* + if matched then + buffer_count is updated + pattern_count is updated + returns TRUE + else + returns FALSE + end if + */ + + int bc; + int pc; + + assert (buffer != NULL); + assert (buffer_count != NULL); + assert (pattern != NULL); + assert (pattern_count != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + bc = *buffer_count; + pc = *pattern_count; + + + /* Loop through pattern string */ + while (pc < pattern_Length) + { + + /* Get next pattern character */ + if (pattern[pc] == '[') + { + /* Character list */ + /* [] and [!] are special */ + char IsExclude; + + IsExclude = CHAR_CLR; + pc++; + /* pc is first character after '[' */ + if (pattern[pc] == '!') + { + pc++; + IsExclude = CHAR_SET; + } + /* pc is first character after '[' */ + if (pattern[pc] == ']') + { + /* [] and [!] are special */ + /* pc is first character after '[' and is a ']' */ + pc++; + if (IsExclude == CHAR_CLR) + { + /* [] */ + /* matches "" */ + } + else + { + /* [!] */ + /* same as '?' */ + if (bc >= buffer_Length) + { + /* we have completed the buffer without completing the pattern */ + return FALSE; + } + bc++; + } + } + else + { + /* Build character list */ + /* pc is first character after '[' and is not a ']' */ + int stop_count; + + stop_count = IndexOf (pattern, ']', pc); + /* stop_count is the character ']' */ + if (stop_count < 0) + { + /* NOT FOUND */ + return FALSE; + } + /* pc is first character after '[' */ + /* stop_count is the character ']' */ + CharListToSet (pattern, pc, stop_count - 1); + pc = stop_count + 1; + /* pc is first character after ']' */ + if (bc >= buffer_Length) + { + /* we have completed the buffer without completing the pattern */ + return FALSE; + } + if (charList[0x00FF & buffer[bc]] == IsExclude) + { + /* not matched */ + return FALSE; + } + bc++; + } + } + else if (pattern[pc] == '?' /* LIKE char */ ) + { + /* Matches a single character */ + pc++; + if (bc >= buffer_Length) + { + /* Check for end of string */ + /* we have completed the buffer without completing the pattern */ + return FALSE; + } + bc++; + } + else if (pattern[pc] == '#' /* LIKE digit */ ) + { + /* Matches a single digit */ + pc++; + if (bc >= buffer_Length) + { + /* Check for end of string */ + /* we have completed the buffer without completing the pattern */ + return FALSE; + } + if (bwb_isdigit (buffer[bc])) + { + bc++; + } + else + { + /* not matched */ + return FALSE; + } + } + else if (pattern[pc] == '*' /* LIKE chars */ ) + { + /* Zero or more characters */ + while (pattern[pc] == '*' /* LIKE chars */ ) + { + pc++; + } + if (pc == pattern_Length) + { + /* Matches all remaining characters */ + bc = buffer_Length; + pc = pattern_Length; + break; + } + else + { + int p; + int b; + int IsMatched; + + p = pc; + b = bc; + IsMatched = FALSE; + while (b <= buffer_Length && IsMatched == FALSE) + { + int last_b; + + last_b = b; + IsMatched = + IsLike (buffer, &b, buffer_Length, pattern, &p, pattern_Length); + if (IsMatched == FALSE) + { + /* not matched, try again begining at next buffer position */ + p = pc; + b = last_b + 1; + } + } + if (IsMatched == FALSE) + { + /* not matched */ + return FALSE; + } + pc = p; + bc = b; + } + } + else + { + char pattChar; + char buffChar; + + pattChar = pattern[pc]; + if (bc >= buffer_Length) + { + /* Check for end of string */ + /* we have completed the buffer without completing the pattern */ + return FALSE; + } + buffChar = buffer[bc]; + + if (My->CurrentVersion->OptionFlags & OPTION_COMPARE_TEXT) + { + pattChar = bwb_toupper (pattChar); + buffChar = bwb_toupper (buffChar); + } + + if (pattChar == buffChar) + { + /* matched specified character */ + pc++; + bc++; + } + else + { + /* not matched */ + return FALSE; + } + } + } + /* Return true if all characters matched */ + if (pc < pattern_Length) + { + /* not matched */ + return FALSE; + } + if (bc < buffer_Length) + { + /* not matched */ + return FALSE; + } + /* all characters matched */ + *buffer_count = bc; + *pattern_count = pc; + return TRUE; +} + + +/* EOF */ diff --git a/bwb_tbl.c b/bwb_tbl.c new file mode 100644 index 0000000..a1625d1 --- /dev/null +++ b/bwb_tbl.c @@ -0,0 +1,1156 @@ +/*************************************************************** + + bwb_tbl.c OPTION VERSION table + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" +VersionType bwb_vertable[ /* NUM_VERSIONS */ ] = +{ + { + "BYWATER", /* Name */ + B15, /* OptionVersionBitmask */ + "B15", /* ID */ + "Bywater BASIC 3", /* Description */ + "Bywater BASIC Interpreter, version 3.20", /* Reference Title */ + "by Ted A. Campbell, Jon B. Volkoff, Paul Edwards, et al.", /* Reference Author */ + "(c) 2014-2017, Howard Wulf, AF5NE", /* Reference Copyright */ + "http://wwww.sourceforge.net/bwbasic/", /* Reference URL1 */ + "bwbasic-3.20.zip", /* Reference URL2 */ + OPTION_LABELS_ON | OPTION_BUGS_ON | OPTION_TRACE_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%Y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '@', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '~', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '@', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "BYWATER-2", /* Name */ + B93, /* OptionVersionBitmask */ + "B93", /* ID */ + "Bywater BASIC 2", /* Description */ + "Bywater BASIC Interpreter, version 2.61", /* Reference Title */ + "by Ted A. Campbell, Jon B. Volkoff, Paul Edwards, et al.", /* Reference Author */ + "Copyright (c) 1993-2014, Ted A. Campbell", /* Reference Copyright */ + "http://wwww.sourceforge.net/bwbasic/", /* Reference URL1 */ + "bwbasic-2.61.zip", /* Reference URL2 */ + OPTION_LABELS_ON | OPTION_BUGS_ON | OPTION_ERROR_GOSUB, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%Y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "CALL/360", /* Name */ + S70, /* OptionVersionBitmask */ + "S70", /* ID */ + "SBC CALL/360 Mainframe BASIC", /* Description */ + "CALL/360: BASIC Reference Handbook", /* Reference Title */ + "by International Business Machines Corporation", /* Reference Author */ + "(c) 1970, The Service Bureau Corporation", /* Reference Copyright */ + "http://bitsavers.trailing-edge.com/pdf/ibm/360/os/", /* Reference URL1 */ + "call_360/CALL_360_BASIC_Reference_Handbook_1970.pdf", /* Reference URL2 */ + FALSE, /* OptionFlags */ + 0, /* OptionReclenInteger */ + 1, /* OptionBaseInteger */ + "%Y/%m/%d", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '\0', /* OptionDoubleChar */ + '\0', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '\0', /* OptionLongChar */ + '\0', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + ':', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '\0', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + '\0', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '!', /* OptionUsingExrad */ + '\0', /* OptionUsingDollar */ + '\0', /* OptionUsingFiller */ + '\0', /* OptionUsingLiteral */ + '\0', /* OptionUsingFirst */ + '\0', /* OptionUsingAll */ + '\0', /* OptionUsingLength */ + } + , + { + "CBASIC-II", /* Name */ + C77, /* OptionVersionBitmask */ + "C77", /* ID */ + "CBASIC-II for CP/M", /* Description */ + "CBASIC-II", /* Reference Title */ + "by Compiler Systems", /* Reference Author */ + "(c) 1977, Compiler Systems", /* Reference Copyright */ + "http://bitsavers.trailing-edge.com/pdf/digitalResearch/cb80/", /* Reference URL1 */ + "CBASIC_Version_2_Jan81.pdf", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 0, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%Y/%m/%d", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '\\', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '/', /* OptionUsingLength */ + } + , + { + "DARTMOUTH", /* Name */ + D64, /* OptionVersionBitmask */ + "D64", /* ID */ + "Dartmouth DTSS BASIC", /* Description */ + "BASIC", /* Reference Title */ + "by Computation Center, Dartmouth College", /* Reference Author */ + "(c) 1964, Trustees of Dartmouth College", /* Reference Copyright */ + "http://www.bitsavers.org/pdf/dartmouth/", /* Reference URL1 */ + "BASIC_Oct64.pdf", /* Reference URL2 */ + FALSE, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%y", /* OptionDateFormat */ + "%H:%M", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + ':', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "ECMA-55", /* Name */ + E78, /* OptionVersionBitmask */ + "E78", /* ID */ + "ANSI Minimal BASIC", /* Description */ + "STANDARD ECMA-55: Minimal BASIC", /* Reference Title */ + "by EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION", /* Reference Author */ + "(c) 1978, EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION", /* Reference Copyright */ + "http://www.ecma-international.org/publications/files/", /* Reference URL1 */ + "ECMA-ST-WITHDRAWN/ECMA-55,%201st%20Edition,%20January%201978.pdf", /* Reference URL2 */ + FALSE, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%Y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "ECMA-116", /* Name */ + E86, /* OptionVersionBitmask */ + "E86", /* ID */ + "ANSI Full BASIC", /* Description */ + "STANDARD ECMA-116: Full BASIC", /* Reference Title */ + "by EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION", /* Reference Author */ + "(c) 1986, EUROPEAN COMPUTER MANUFACTURERS ASSOCIATION", /* Reference Copyright */ + "http://www.ecma-international.org/publications/files/", /* Reference URL1 */ + "ECMA-ST-WITHDRAWN/ECMA-116,%201st%20edition,%20June%201986.pdf", /* Reference URL2 */ + OPTION_LABELS_ON | OPTION_STRICT_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 1, /* OptionBaseInteger */ + "%Y-%m-%d", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '!', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "GCOS", /* Name */ + G74, /* OptionVersionBitmask */ + "G74", /* ID */ + "GE 600 Mainframe BASIC", /* Description */ + "TIME-SHARING SYSTEM POCKET GUIDE, SERIES 600/6000 GCOS", /* Reference Title */ + "by Honeywell", /* Reference Author */ + "(c) 1974, Honeywell", /* Reference Copyright */ + "http://www.trailingedge.com/misc/", /* Reference URL1 */ + "GCOS-TSS-PocketGuide.pdf", /* Reference URL2 */ + FALSE, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%y", /* OptionDateFormat */ + "%H:%M", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + ':', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "HAARDT", /* Name */ + H14, /* OptionVersionBitmask */ + "H14", /* ID */ + "bas 2.4 by Michael Haardt", /* Description */ + "BAS", /* Reference Title */ + "by by Michael Haardt", /* Reference Author */ + "(c) 2014, by Michael Haardt", /* Reference Copyright */ + "http://www.moria.de/~michael/bas/", /* Reference URL1 */ + "bas-2.4.tar.gz", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 1, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%Y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '\0', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "HANDBOOK1", /* Name */ + HB1, /* OptionVersionBitmask */ + "HB1", /* ID */ + "The BASIC Handbook, 1st Edition", /* Description */ + "The BASIC Handbook: Encyclopedia of the BASIC Computer Language", /* Reference Title */ + "by David A. Lien", /* Reference Author */ + "(c) 1978, Compusoft Publishing", /* Reference Copyright */ + "ISBN 0-932760-00-7", /* Reference URL1 */ + "(1st Edition) 364 pages", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%Y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '@', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "HANDBOOK2", /* Name */ + HB2, /* OptionVersionBitmask */ + "HB2", /* ID */ + "The BASIC Handbook, 2nd Edition", /* Description */ + "The BASIC Handbook: Encyclopedia of the BASIC Computer Language", /* Reference Title */ + "by David A. Lien", /* Reference Author */ + "(c) 1981, CompuSoft Publishing", /* Reference Copyright */ + "ISBN 0-932760-05-8", /* Reference URL1 */ + "(2nd Edition) 480 pages", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%Y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '@', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "HEATH", /* Name */ + H80, /* OptionVersionBitmask */ + "H80", /* ID */ + "Heath Benton Harbor BASIC", /* Description */ + "Extended Benton Harbor BASIC", /* Reference Title */ + "by Heath Company", /* Reference Author */ + "(c) 1980, Heath Company", /* Reference Copyright */ + "http://www.lesbird.com/sebhc/documentation/software/HDOS-2/", /* Reference URL1 */ + "HDOS_Reference_Chapter6.pdf", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 0, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "", /* OptionDateFormat */ + "", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "MARK-I", /* Name */ + G65, /* OptionVersionBitmask */ + "G65", /* ID */ + "GE 265 Mainframe BASIC", /* Description */ + "BASIC LANGUAGE REFERENCE MANUAL", /* Reference Title */ + "by Time-Sharing Service, Information Service Department, General Electric", /* Reference Author */ + "(c) 1965, Trustees of Dartmouth College", /* Reference Copyright */ + "http://www.bitsavers.org/pdf/ge/MarkI_Timesharing/", /* Reference URL1 */ + "202026A_BASIC_Language_Reference_Manual_Jan1967.pdf", /* Reference URL2 */ + FALSE, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%y", /* OptionDateFormat */ + "%H:%M", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + ':', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "MARK-II", /* Name */ + G67, /* OptionVersionBitmask */ + "G67", /* ID */ + "GE 435 Mainframe BASIC", /* Description */ + "BASIC Language Reference Manual", /* Reference Title */ + "by Time-Sharing Service, Information Service Department, General Electric", /* Reference Author */ + "(c) 1968, General Electric Company and the Trustees of Dartmouth College", /* Reference Copyright */ + "http://www.bitsavers.org/pdf/ge/MarkI_Timesharing/", /* Reference URL1 */ + "711224A_BASICLanguageReferenceManual_Nov1970.pdf", /* Reference URL2 */ + FALSE, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%y", /* OptionDateFormat */ + "%H:%M", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + ':', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "MBASIC", /* Name */ + M80, /* OptionVersionBitmask */ + "M80", /* ID */ + "Microsoft BASIC-80 for Xenix", /* Description */ + "Microsoft BASIC Reference Manual", /* Reference Title */ + "by Microsoft", /* Reference Author */ + "(c) 1982, Microsoft", /* Reference Copyright */ + "http://chiclassiccomp.org/docs/content/computing/Microsoft/", /* Reference URL1 */ + "Microsoft_Basic_8086Xenix_Reference.pdf", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%m/%d/%Y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "PDP-8", /* Name */ + D73, /* OptionVersionBitmask */ + "D73", /* ID */ + "DEC PDP-8 BASIC", /* Description */ + "DEC 8K BASIC", /* Reference Title */ + "by Digital Equipement Corporation", /* Reference Author */ + "(c) 1973, Digital Equipement Corporation", /* Reference Copyright */ + "http://bitsavers.trailing-edge.com/pdf/dec/pdp8/basic/", /* Reference URL1 */ + "DEC-08-LBSMA-A-D_8K_BASIC_Jul73.pdf", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "", /* OptionDateFormat */ + "", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + '\\', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "PDP-11", /* Name */ + D70, /* OptionVersionBitmask */ + "D70", /* ID */ + "DEC PDP-11 BASIC", /* Description */ + "PDP-11 BASIC Programming Manual", /* Reference Title */ + "by Digital Equipement Corporation", /* Reference Author */ + "(c) 1970, Digital Equipement Corporation", /* Reference Copyright */ + "http://bitsavers.trailing-edge.com/pdf/dec/pdp11/basic/", /* Reference URL1 */ + "DEC-11-AJPB-D_PDP-11_BASIC_Programming_Manual_Dec70.pdf", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "", /* OptionDateFormat */ + "", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "RBASIC", /* Name */ + R86, /* OptionVersionBitmask */ + "R86", /* ID */ + "Micronics RBASIC for 6809 FLEX", /* Description */ + "RBASIC User's Manual", /* Reference Title */ + "by R. Jones", /* Reference Author */ + "(c) 1986, Micronics Research Corp.", /* Reference Copyright */ + "http://www.evenson-consulting.com/swtpc/downloads/", /* Reference URL1 */ + "RBASIC.zip", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 0, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%d-%b-%y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '!', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "RSTS-11", /* Name */ + D71, /* OptionVersionBitmask */ + "D71", /* ID */ + "DEC RSTS-11 BASIC-PLUS", /* Description */ + "RSTS-11 User's Guide : BASIC-PLUS Programming Language", /* Reference Title */ + "by Digital Equipment Corporation", /* Reference Author */ + "(c) 1971, Digital Equipment Corporation", /* Reference Copyright */ + "http://bitsavers.trailing-edge.com/pdf/dec/pdp11/rsts/", /* Reference URL1 */ + "PL-11-71-01-01-A-D_RSTS-11UsersGuide_May71.pdf", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 512, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%d-%b-%y", /* OptionDateFormat */ + "%I:%M %p", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '!', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "SYSTEM/360", /* Name */ + I70, /* OptionVersionBitmask */ + "I70", /* ID */ + "IBM System/360 Mainframe BASIC", /* Description */ + "BASIC Language Reference Manual", /* Reference Title */ + "by International Business Machines Corporation", /* Reference Author */ + "(c) 1970, International Business Machines Corporation", /* Reference Copyright */ + "http://bitsavers.org/pdf/ibm/360/os/tso/", /* Reference URL1 */ + "GC28-6837-0_BASIC_Language_Ref_Man_Jun70.pdf", /* Reference URL2 */ + FALSE, /* OptionFlags */ + 0, /* OptionReclenInteger */ + 1, /* OptionBaseInteger */ + "%Y/%m/%d", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '\0', /* OptionDoubleChar */ + '\0', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '\0', /* OptionLongChar */ + '\0', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + ':', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '\0', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + '\0', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '!', /* OptionUsingExrad */ + '\0', /* OptionUsingDollar */ + '\0', /* OptionUsingFiller */ + '\0', /* OptionUsingLiteral */ + '\0', /* OptionUsingFirst */ + '\0', /* OptionUsingAll */ + '\0', /* OptionUsingLength */ + } + , + { + "SYSTEM/370", /* Name */ + I73, /* OptionVersionBitmask */ + "I73", /* ID */ + "IBM System/370 Mainframe BASIC", /* Description */ + "IBM Virtual Machine Facility/370: BASIC Language Reference Manual", /* Reference Title */ + "by International Business Machines Corporation", /* Reference Author */ + "(c) 1973, International Business Machines Corporation", /* Reference Copyright */ + "http://bitsavers.trailing-edge.com/pdf/ibm/370/VM_370/Release_1/", /* Reference URL1 */ + "GC20-1803-1_VM370_BASIC_Language_Reference_Manual_Rel_1_Apr73.pdf", /* Reference URL2 */ + FALSE, /* OptionFlags */ + 0, /* OptionReclenInteger */ + 1, /* OptionBaseInteger */ + "%Y/%m/%d", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '\0', /* OptionDoubleChar */ + '\0', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '\0', /* OptionLongChar */ + '\0', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + '\0', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + ':', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '\0', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + '\0', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '!', /* OptionUsingExrad */ + '\0', /* OptionUsingDollar */ + '\0', /* OptionUsingFiller */ + '\0', /* OptionUsingLiteral */ + '\0', /* OptionUsingFirst */ + '\0', /* OptionUsingAll */ + '\0', /* OptionUsingLength */ + } + , + { + "TRS-80", /* Name */ + T80, /* OptionVersionBitmask */ + "T80", /* ID */ + "TRS-80 Model I/III/4 LBASIC", /* Description */ + "LBASIC USER'S GUIDE", /* Reference Title */ + "by Galactic Software, Ltd.", /* Reference Author */ + "(c) 1981, Galactic Software, Ltd.", /* Reference Copyright */ + "http://www.tim-mann.org/trs80/doc/", /* Reference URL1 */ + "lbasic.txt", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "", /* OptionDateFormat */ + "%m/%d/%y %H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\'', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '@', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '%', /* OptionUsingLength */ + } + , + { + "VINTAGE", /* Name */ + V09, /* OptionVersionBitmask */ + "V09", /* ID */ + "Vintage BASIC 1.0.1", /* Description */ + "Vintage BASIC User's Guide 1.0.1", /* Reference Title */ + "by Lyle Kopnicky", /* Reference Author */ + "(c) 2009, Lyle Kopnicky", /* Reference Copyright */ + "http://www.vintage-basic.net/", /* Reference URL1 */ + "vintage-basic-1.0.1.tar.gz", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 128, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "", /* OptionDateFormat */ + "", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '\0', /* OptionDoubleChar */ + '\0', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '\0', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '\0', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '\0', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , + { + "XBASIC", /* Name */ + T79, /* OptionVersionBitmask */ + "T79", /* ID */ + "TSC XBASIC for 6800 FLEX", /* Description */ + "Extended BASIC User's Manual", /* Reference Title */ + "by Technical Systems Consultants", /* Reference Author */ + "(c) 1979, Technical Systems Consultants", /* Reference Copyright */ + "http://www.swtpc.com/mholley/Setton/", /* Reference URL1 */ + "xbasic.pdf", /* Reference URL2 */ + OPTION_BUGS_ON, /* OptionFlags */ + 0, /* OptionReclenInteger */ + 0, /* OptionBaseInteger */ + "%d-%b-%y", /* OptionDateFormat */ + "%H:%M:%S", /* OptionTimeFormat */ + '$', /* OptionStringChar */ + '#', /* OptionDoubleChar */ + '!', /* OptionSingleChar */ + '\0', /* OptionCurrencyChar */ + '&', /* OptionLongChar */ + '%', /* OptionIntegerChar */ + '\0', /* OptionByteChar */ + '"', /* OptionQuoteChar */ + '\0', /* OptionCommentChar */ + ':', /* OptionStatementChar */ + '?', /* OptionPrintChar */ + '\0', /* OptionInputChar */ + '\0', /* OptionImageChar */ + '(', /* OptionLparenChar */ + ')', /* OptionRparenChar */ + '#', /* OptionFilenumChar */ + '\0', /* OptionAtChar */ + '#', /* OptionUsingDigit */ + ',', /* OptionUsingComma */ + '.', /* OptionUsingPeriod */ + '+', /* OptionUsingPlus */ + '-', /* OptionUsingMinus */ + '^', /* OptionUsingExrad */ + '$', /* OptionUsingDollar */ + '*', /* OptionUsingFiller */ + '_', /* OptionUsingLiteral */ + '!', /* OptionUsingFirst */ + '&', /* OptionUsingAll */ + '\\', /* OptionUsingLength */ + } + , +}; + + +const size_t NUM_VERSIONS = sizeof (bwb_vertable) / sizeof (VersionType); + + +/* EOF */ diff --git a/bwb_var.c b/bwb_var.c new file mode 100644 index 0000000..5f8e62e --- /dev/null +++ b/bwb_var.c @@ -0,0 +1,5068 @@ +/*************************************************************** + + bwb_var.c Variable-Handling Routines + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + + +/* Prototypes for functions visible to this file only */ + +static void clear_virtual (VirtualType * Z); +static void clear_virtual_by_variable (VariableType * Variable); +static int dim_check (VariableType * variable); +static size_t dim_unit (VariableType * v, int *pp); +static LineType *dio_lrset (LineType * l, int rset); +static void field_clear (FieldType * Field); +static FieldType *field_new (void); +static VirtualType *find_virtual_by_variable (VariableType * Variable); +static LineType *internal_swap (LineType * l); +static VariableType *mat_islocal (char *buffer); +static VirtualType *new_virtual (void); +static int var_defx (LineType * l, int TypeCode); +static VariableType *var_islocal (char *buffer, int dimensions); +static void var_link_new_variable (VariableType * v); + +extern int +var_init (void) +{ + assert( My != NULL ); + + My->VariableHead = NULL; + + return TRUE; +} + +extern LineType * +bwb_COMMON (LineType * l) +{ + /* + SYNTAX: COMMON scalar + SYNTAX: COMMON matrix( dimnesions ) ' COMMON A(1), B(2), C(3) + SYNTAX: COMMON matrix( [, [,]] ) ' COMMON A(), B(,), C(,,) + */ + + assert (l != NULL); + + do + { + int dimensions; + VariableType *variable; + char varname[NameLengthMax + 1]; + + dimensions = 0; + /* get variable name and find variable */ + if (line_read_varname (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_skip_LparenChar (l)) + { + line_skip_spaces (l); /* keep this */ + if (bwb_isdigit (l->buffer[l->position])) + { + /* COMMON A(3) : DIM A( 5, 10, 20 ) */ + if (line_read_integer_expression (l, &dimensions) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + else + { + /* COMMON A(,,) : DIM A( 5, 10, 20 ) */ + dimensions++; + while (line_skip_seperator (l)); + { + dimensions++; + } + } + if (line_skip_RparenChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + if ((variable = var_find (varname, dimensions, TRUE)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + /* mark as COMMON */ + variable->VariableFlags |= VARIABLE_COMMON; + } + while (line_skip_seperator (l)); + + return (l); +} + +extern LineType * +bwb_ERASE (LineType * l) +{ + /* + SYNTAX: ERASE variable [, ...] ' ERASE A, B, C + */ + + assert (l != NULL); + assert( My != NULL ); + + do + { + char varname[NameLengthMax + 1]; + + /* get variable name and find variable */ + + if (line_read_varname (l, varname)) + { + /* erase all matching SCALAR and ARRAY variables */ + int dimensions; + + for (dimensions = 0; dimensions < MAX_DIMS; dimensions++) + { + VariableType *variable; + + variable = var_find (varname, dimensions, FALSE); + if (variable != NULL) + { + /* found a variable */ + VariableType *p; /* previous variable in linked list */ + + /* find then previous variable in chain */ + if (variable == My->VariableHead) + { + /* free head */ + My->VariableHead = variable->next; + variable->next = NULL; + var_free (variable); + } + else + { + /* free tail */ + for (p = My->VariableHead; p != NULL && p->next != variable; + p = p->next) + { + ; + } + if (p == NULL) + { + /* this should never happen */ + WARN_INTERNAL_ERROR; + return NULL; + } + if (p->next != variable) + { + /* this should never happen */ + WARN_INTERNAL_ERROR; + return NULL; + } + /* reassign linkage */ + p->next = variable->next; + variable->next = NULL; + var_free (variable); + } + } + } + } + } + while (line_skip_seperator (l)); + return (l); +} + +static LineType * +internal_swap (LineType * l) +{ + VariableType *lhs; + VariableType *rhs; + + assert (l != NULL); + + if (line_skip_LparenChar (l)) + { + /* optional */ + } + + /* get left variable */ + if ((lhs = line_read_scalar (l)) == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + + /* get required comma */ + if (line_skip_seperator (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + /* get right variable */ + if ((rhs = line_read_scalar (l)) == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (line_skip_RparenChar (l)) + { + /* optional */ + } + + /* check to be sure that both variables are compatible */ + if (VAR_IS_STRING (rhs) != VAR_IS_STRING (lhs)) + { + WARN_TYPE_MISMATCH; + return (l); + } + + /* swap the values */ + { + VariantType L; + VariantType R; + CLEAR_VARIANT (&L); + CLEAR_VARIANT (&R); + + if (var_get (lhs, &L) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (var_get (rhs, &R) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + if (var_set (lhs, &R) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (var_set (rhs, &L) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + /* return */ + return (l); +} + +extern LineType * +bwb_EXCHANGE (LineType * l) +{ + /* + SYNTAX: EXCHANGE variable, variable + SYNTAX: EXCHANGE ( variable, variable ) + */ + + assert (l != NULL); + return internal_swap (l); +} + + + +extern LineType * +bwb_SWAP (LineType * l) +{ + /* + SYNTAX: SWAP variable, variable + SYNTAX: SWAP ( variable, variable ) + */ + + assert (l != NULL); + return internal_swap (l); +} + +extern VariableType * +var_free (VariableType * variable) +{ + /* + Release all the memory associated with a specific variable. + This function returns NULL, so you can use it like this: + variable = var_new(...); + ... + variable = var_free( variable ); + */ + + + if (variable != NULL) + { + if (variable->next != NULL) + { + /* This allows variable chains to be easily released. */ + variable->next = var_free (variable->next); + } + /* cleanup this variable */ + field_free_variable (variable); + clear_virtual_by_variable (variable); + if (VAR_IS_STRING (variable)) + { + if (variable->Value.String != NULL) + { + int j; + for (j = 0; j < variable->array_units; j++) + { + if (variable->Value.String[j].sbuffer != NULL) + { + free (variable->Value.String[j].sbuffer); + } + variable->Value.String[j].length = 0; + } + free (variable->Value.String); + variable->Value.String = NULL; + } + } + else + { + if (variable->Value.Number != NULL) + { + free (variable->Value.Number); + variable->Value.Number = NULL; + } + } + free (variable); + } + return NULL; +} + +extern void +var_CLEAR (void) +{ + /* + free all variables except PRESET + */ + VariableType *variable; + assert( My != NULL ); + + + for (variable = My->VariableHead; variable != NULL;) + { + if (variable->VariableFlags & VARIABLE_PRESET) + { + /* keep */ + variable = variable->next; + } + else if (variable == My->VariableHead) + { + /* free head */ + My->VariableHead = variable->next; + variable->next = NULL; + var_free (variable); + variable = My->VariableHead; + } + else + { + /* free tail */ + VariableType *z; + z = variable->next; + variable->next = NULL; + var_free (variable); + variable = z; + } + } +} + +extern LineType * +bwb_CLEAR (LineType * l) +{ + /* + SYNTAX: CLEAR + */ + + assert (l != NULL); + var_CLEAR (); + line_skip_eol (l); + return (l); +} + + +LineType * +bwb_CLR (LineType * l) +{ + + assert (l != NULL); + return bwb_CLEAR (l); +} + +/*********************************************************** + + FUNCTION: var_delcvars() + + DESCRIPTION: This function deletes all variables + in memory except those previously marked + as common. + +***********************************************************/ + +int +var_delcvars (void) +{ + VariableType *v; + + assert( My != NULL ); + + for (v = My->VariableHead; v != NULL;) + { + if (v->VariableFlags & VARIABLE_PRESET) + { + /* keep */ + v = v->next; + } + else if (v->VariableFlags & VARIABLE_COMMON) + { + /* keep */ + v = v->next; + } + else if (v == My->VariableHead) + { + /* free head */ + My->VariableHead = v->next; + v->next = NULL; + var_free (v); + v = My->VariableHead; + } + else + { + /* free tail */ + VariableType *z; /* next variable */ + + z = v->next; + v->next = NULL; + var_free (v); + v = z; + } + } + return TRUE; +} + +/*********************************************************** + + FUNCTION: bwb_mid() + + DESCRIPTION: This function implements the BASIC + MID$ command. + + Same as MID$ function, except it will set + the desired substring and not return its + value. Added by JBV 10/95 + + SYNTAX: MID$( string-variable$, start-position-in-string + [, number-of-spaces ] ) = expression + +***********************************************************/ + +LineType * +bwb_MID4 (LineType * l) +{ + /* MID$( target$, start% [ , length% ] ) = source$ */ + VariableType *variable; + VariantType target; + int start; + int length; + VariantType source; + int maxlen; + + assert (l != NULL); + + CLEAR_VARIANT (&source); + CLEAR_VARIANT (&target); + start = 0; + length = 0; + maxlen = 0; + if (line_skip_LparenChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if ((variable = line_read_scalar (l)) == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (VAR_IS_STRING (variable)) + { + /* OK */ + } + else + { + /* ERROR */ + WARN_TYPE_MISMATCH; + return (l); + } + if (var_get (variable, &target) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (target.VariantTypeCode != StringTypeCode) + { + WARN_TYPE_MISMATCH; + return (l); + } + if (line_skip_seperator (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_integer_expression (l, &start) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (start < 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + if (start > target.Length) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + maxlen = 1 + target.Length - start; + if (line_skip_seperator (l)) + { + if (line_read_integer_expression (l, &length) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (length < 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + } + else + { + length = -1; /* MAGIC */ + } + if (line_skip_RparenChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* skip the equal sign */ + if (line_skip_EqualChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (line_read_expression (l, &source) == FALSE) /* bwb_MID4 */ + { + WARN_SYNTAX_ERROR; + return (l); + } + if (source.VariantTypeCode != StringTypeCode) + { + WARN_TYPE_MISMATCH; + return (l); + } + if (length == -1 /* MAGIC */ ) + { + length = source.Length; + } + length = MIN (length, maxlen); + length = MIN (length, source.Length); + if (length < 0) + { + WARN_INTERNAL_ERROR; + return (l); + } + if (length > 0) + { + int i; + + start--; /* BASIC to C */ + for (i = 0; i < length; i++) + { + target.Buffer[start + i] = source.Buffer[i]; + } + target.Buffer[target.Length] = NulChar; + if (var_set (variable, &target) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + } + RELEASE_VARIANT (&source); + RELEASE_VARIANT (&target); + return (l); +} + + +/*********************************************************** + + FUNCTION: bwb_ddbl() + + DESCRIPTION: This function implements the BASIC + DEFDBL command. + + SYNTAX: DEFDBL letter[-letter](, letter[-letter])... + +***********************************************************/ + +LineType * +bwb_DEFBYT (LineType * l) +{ + /* + DEFBYT letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + var_defx (l, ByteTypeCode); + return (l); +} + +LineType * +bwb_DEFCUR (LineType * l) +{ + /* + DEFCUR letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + var_defx (l, CurrencyTypeCode); + return (l); +} + +LineType * +bwb_DEFDBL (LineType * l) +{ + /* + DEFDBL letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + var_defx (l, DoubleTypeCode); + return (l); +} + +/*********************************************************** + + FUNCTION: bwb_dint() + + DESCRIPTION: This function implements the BASIC + DEFINT command. + + SYNTAX: DEFINT letter[-letter](, letter[-letter])... + +***********************************************************/ + +LineType * +bwb_DEFINT (LineType * l) +{ + /* + DEFINT letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + var_defx (l, IntegerTypeCode); + return (l); +} + +LineType * +bwb_DEFLNG (LineType * l) +{ + /* + DEFLNG letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + var_defx (l, LongTypeCode); + return (l); +} + +/*********************************************************** + + FUNCTION: bwb_dsng() + + DESCRIPTION: This function implements the BASIC + DEFSNG command. + + SYNTAX: DEFSNG letter[-letter](, letter[-letter])... + +***********************************************************/ + +LineType * +bwb_DEFSNG (LineType * l) +{ + /* + DEFSNG letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + var_defx (l, SingleTypeCode); + return (l); +} + +/*********************************************************** + + FUNCTION: bwb_dstr() + + DESCRIPTION: This function implements the BASIC + DEFSTR command. + + SYNTAX: DEFSTR letter[-letter](, letter[-letter])... + +***********************************************************/ + +LineType * +bwb_DEFSTR (LineType * l) +{ + /* + DEFSTR letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + var_defx (l, StringTypeCode); + return (l); +} + +LineType * +bwb_TEXT (LineType * l) +{ + /* + TEXT letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + var_defx (l, StringTypeCode); + return (l); +} + +LineType * +bwb_TRACE (LineType * l) +{ + assert (l != NULL); + + return bwb_TRACE_ON(l); +} + +LineType * +bwb_TRACE_ON (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + fprintf (My->SYSOUT->cfp, "Trace is ON\n"); + ResetConsoleColumn (); + My->IsTraceOn = TRUE; + + return (l); +} + +LineType * +bwb_TRACE_OFF (LineType * l) +{ + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + fprintf (My->SYSOUT->cfp, "Trace is OFF\n"); + ResetConsoleColumn (); + My->IsTraceOn = FALSE; + + return (l); +} + +int +VarTypeIndex (char C) +{ + + switch (C) + { + case 'A': + return 0; + case 'B': + return 1; + case 'C': + return 2; + case 'D': + return 3; + case 'E': + return 4; + case 'F': + return 5; + case 'G': + return 6; + case 'H': + return 7; + case 'I': + return 8; + case 'J': + return 9; + case 'K': + return 10; + case 'L': + return 11; + case 'M': + return 12; + case 'N': + return 13; + case 'O': + return 14; + case 'P': + return 15; + case 'Q': + return 16; + case 'R': + return 17; + case 'S': + return 18; + case 'T': + return 19; + case 'U': + return 20; + case 'V': + return 21; + case 'W': + return 22; + case 'X': + return 23; + case 'Y': + return 24; + case 'Z': + return 25; + case 'a': + return 0; + case 'b': + return 1; + case 'c': + return 2; + case 'd': + return 3; + case 'e': + return 4; + case 'f': + return 5; + case 'g': + return 6; + case 'h': + return 7; + case 'i': + return 8; + case 'j': + return 9; + case 'k': + return 10; + case 'l': + return 11; + case 'm': + return 12; + case 'n': + return 13; + case 'o': + return 14; + case 'p': + return 15; + case 'q': + return 16; + case 'r': + return 17; + case 's': + return 18; + case 't': + return 19; + case 'u': + return 20; + case 'v': + return 21; + case 'w': + return 22; + case 'x': + return 23; + case 'y': + return 24; + case 'z': + return 25; + } + return -1; +} + +/*********************************************************** + + Function: var_defx() + + DESCRIPTION: This function is a generalized DEFxxx handler. + +***********************************************************/ + +static int +var_defx (LineType * l, int TypeCode) +{ + /* + DEFxxx letter[-letter](, letter[-letter])... + */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->DefaultVariableType != NULL ); + + do + { + char firstc; + char lastc; + int first; + int last; + int c; + + /* find a sequence of letters for variables */ + if (line_read_letter_sequence (l, &firstc, &lastc) == FALSE) + { + /* DEFINT 0-9 */ + WARN_SYNTAX_ERROR; + return FALSE; + } + first = VarTypeIndex (firstc); + if (first < 0) + { + /* DEFINT 0-Z */ + WARN_SYNTAX_ERROR; + return FALSE; + } + last = VarTypeIndex (lastc); + if (last < 0) + { + /* DEFINT A-9 */ + WARN_SYNTAX_ERROR; + return FALSE; + } + if (first > last) + { + /* DEFINT Z-A */ + WARN_SYNTAX_ERROR; + return FALSE; + } + for (c = first; c <= last; c++) + { + My->DefaultVariableType[c] = TypeCode; /* var_defx */ + } + } + while (line_skip_seperator (l)); + + return TRUE; + +} + +/*************************************************************** + + FUNCTION: var_find() + + DESCRIPTION: This C function attempts to find a variable + name matching the argument in buffer. If + it fails to find a matching name, it + sets up a new variable with that name. + +***************************************************************/ + +VariableType * +mat_find (char *name) +{ + /* + similar to var_find, but returns the first matrix found + */ + VariableType *v; + assert( My != NULL ); + + + /* check for NULL variable name */ + if (name == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (is_empty_string (name)) + { + WARN_SYNTAX_ERROR; + return NULL; + } + /* check for a local variable at this EXEC level */ + + v = mat_islocal (name); + if (v != NULL) + { + return v; + } + /* now run through the global variable list and try to find a match */ + for (v = My->VariableHead; v != NULL; v = v->next) + { + assert( v != NULL ); + if (v->dimensions > 0) + { + if (bwb_stricmp (v->name, name) == 0) + { + return v; + } + } + } + return NULL; +} + +VariableType * +var_find (char *name, int dimensions, int IsImplicit) +{ + VariableType *v; + int n; + + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + assert( My->DefaultVariableType != NULL ); + + /* check for NULL variable name */ + if (name == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (is_empty_string (name)) + { + WARN_SYNTAX_ERROR; + return NULL; + } + if (dimensions < 0) + { + WARN_INTERNAL_ERROR; + return NULL; + } + + /* check for a local variable at this EXEC level */ + + v = var_islocal (name, dimensions); + if (v != NULL) + { + return v; + } + /* now run through the global variable list and try to find a match */ + for (v = My->VariableHead; v != NULL; v = v->next) + { + assert( v != NULL ); + if (v->dimensions == dimensions) + { + if (bwb_stricmp (v->name, name) == 0) + { + return v; + } + } + } + if (IsImplicit == FALSE) + { + return NULL; + } + if (My->CurrentVersion->OptionFlags & OPTION_EXPLICIT_ON) + { + /* NO implicit creation - all variables must be created via DIM */ + WARN_VARIABLE_NOT_DECLARED; + return NULL; + } + if (My->CurrentVersion->OptionFlags & OPTION_STRICT_ON) + { + if (dimensions > 0) + { + /* Implicit ARRAY is not allowed */ + WARN_VARIABLE_NOT_DECLARED; + return NULL; + } + } + + /* this is a IMPLICIT variable, so initialize it... */ + + /* initialize new variable */ + if ((v = (VariableType *) calloc (1, sizeof (VariableType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + + /* copy the name into the appropriate structure */ + + assert( v != NULL ); + bwb_strcpy (v->name, name); + + /* determine variable TypeCode */ + v->VariableTypeCode = var_nametype (name); + if (v->VariableTypeCode == NulChar) + { + /* variable name has no declared TypeCode */ + n = VarTypeIndex (name[0]); + if (n < 0) + { + v->VariableTypeCode = DoubleTypeCode; /* default */ + } + else + { + v->VariableTypeCode = My->DefaultVariableType[n]; + } + } + v->VariableFlags = 0; + v->dimensions = dimensions; + v->array_units = 1; + for (n = 0; n < v->dimensions; n++) + { + v->LBOUND[n] = My->CurrentVersion->OptionBaseInteger; /* implicit lower bound */ + v->UBOUND[n] = 10; /* implicit upper bound */ + if (v->UBOUND[n] < v->LBOUND[n]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return NULL; + } + v->VINDEX[n] = v->LBOUND[n]; + v->array_units *= v->UBOUND[n] - v->LBOUND[n] + 1; + } + + /* assign array memory */ + if (VAR_IS_STRING (v)) + { + if ((v->Value.String = + (StringType *) calloc (v->array_units, sizeof (StringType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + } + else + { + if ((v->Value.Number = + (DoubleType *) calloc (v->array_units, sizeof (DoubleType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + } + + /* insert variable at the beginning of the variable chain */ + v->next = My->VariableHead; + My->VariableHead = v; + return v; +} + +/*************************************************************** + + FUNCTION: var_new() + + DESCRIPTION: This function assigns memory for a new variable. + +***************************************************************/ + +VariableType * +var_new (char *name, char TypeCode) +{ + VariableType *v; + + + /* get memory for new variable */ + + if (name == NULL) + { + WARN_INTERNAL_ERROR; + return NULL; + } + if (is_empty_string (name)) + { + WARN_SYNTAX_ERROR; + return NULL; + } + if ((v = (VariableType *) calloc (1, sizeof (VariableType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + /* copy the name into the appropriate structure */ + + assert( v != NULL ); + bwb_strcpy (v->name, name); + + /* set memory in the new variable */ + var_make (v, TypeCode); + + /* and return */ + + return v; + +} + + +/*************************************************************** + + FUNCTION: bwb_dim() + + DESCRIPTION: This function implements the BASIC DIM + statement, allocating memory for a + dimensioned array of variables. + + SYNTAX: DIM variable(elements...)[,variable(elements...)] + +***************************************************************/ + +static void +var_link_new_variable (VariableType * v) +{ + /* + We are called by DIM, so this is an explicitly created variable. + There are only two possibilities: + 1. We are a LOCAL variable of a SUB or FUNCTION. + 2. We are a GLOBAL variable. + */ + + assert (v != NULL); + assert( My != NULL ); + + if (My->StackHead != NULL) + { + StackType *StackItem; + for (StackItem = My->StackHead; StackItem != NULL; + StackItem = StackItem->next) + { + if (StackItem->LoopTopLine != NULL) + { + switch (StackItem->LoopTopLine->cmdnum) + { + case C_FUNCTION: + case C_SUB: + /* we have found a FUNCTION or SUB boundary, must be LOCAL */ + v->next = StackItem->local_variable; + StackItem->local_variable = v; + return; + /* break; */ + } + } + } + } + /* no FUNCTION or SUB on the stack, must be GLOBAL */ + v->next = My->VariableHead; + My->VariableHead = v; +} + + +static VirtualType * +new_virtual (void) +{ + VirtualType *Z; + assert( My != NULL ); + + + /* look for an empty slot */ + for (Z = My->VirtualHead; Z != NULL; Z = Z->next) + { + if (Z->Variable == NULL) + { + /* FOUND */ + return Z; + } + } + /* NOT FOUND */ + if ((Z = (VirtualType *) calloc (1, sizeof (VirtualType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + Z->next = My->VirtualHead; + My->VirtualHead = Z; + return Z; +} +static void +clear_virtual (VirtualType * Z) +{ + + assert (Z != NULL); + + Z->Variable = NULL; + Z->FileNumber = 0; + Z->FileOffset = 0; + Z->FileLength = 0; +} +static void +clear_virtual_by_variable (VariableType * Variable) +{ + VirtualType *Z; + + assert (Variable != NULL); + assert( My != NULL ); + + for (Z = My->VirtualHead; Z != NULL; Z = Z->next) + { + if (Z->Variable == Variable) + { + /* FOUND */ + clear_virtual (Z); + } + } +} +extern void +clear_virtual_by_file (int FileNumber) +{ + /* called by file_clear() */ + VirtualType *Z; + + assert( My != NULL ); + + for (Z = My->VirtualHead; Z != NULL; Z = Z->next) + { + if (Z->FileNumber == FileNumber) + { + /* FOUND */ + clear_virtual (Z); + } + } +} +static VirtualType * +find_virtual_by_variable (VariableType * Variable) +{ + VirtualType *Z; + + assert (Variable != NULL); + assert( My != NULL ); + + for (Z = My->VirtualHead; Z != NULL; Z = Z->next) + { + if (Z->Variable == Variable) + { + /* FOUND */ + return Z; + } + } + /* NOT FOUND */ + return NULL; +} + +LineType * +bwb_LOCAL (LineType * l) +{ + /* only supported inside a FUNCTION or SUB */ + + assert (l != NULL); + return bwb_DIM (l); +} + +LineType * +bwb_DIM (LineType * l) +{ + int FileNumber; /* the file might not be OPEN when the variable is declared */ + size_t FileOffset; /* from beginning of file */ + int FileLength; /* sizeof( DoubleType ) or Fixed String Length */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->DefaultVariableType != NULL ); + + + FileNumber = 0; + FileOffset = 0; + FileLength = 0; + if (line_skip_FilenumChar (l)) + { + /* DIM # filenum , ... */ + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (FileNumber <= 0) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (line_skip_seperator (l) == FALSE) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + FileOffset = 0; + FileLength = 0; + } + + do + { + VariableType *v; + int n; + int dimensions; + int LBOUND[MAX_DIMS]; + int UBOUND[MAX_DIMS]; + char TypeCode; + char varname[NameLengthMax + 1]; + + + /* Get variable name */ + if (line_read_varname (l, varname) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + /* read parameters */ + dimensions = 0; + if (line_peek_LparenChar (l)) + { + if (line_read_array_redim (l, &dimensions, LBOUND, UBOUND) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* check array dimensions */ + for (n = 0; n < dimensions; n++) + { + if (UBOUND[n] < LBOUND[n]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return (l); + } + } + } + + /* determine variable TypeCode */ + TypeCode = var_nametype (varname); + if (TypeCode == NulChar) + { + /* variable has no explicit TypeCode char */ + TypeCode = line_read_type_declaration (l); /* AS DOUBLE and so on */ + if (TypeCode == NulChar) + { + /* variable has no declared TypeCode */ + int i; + i = VarTypeIndex (varname[0]); + if (i < 0) + { + TypeCode = DoubleTypeCode; /* default */ + } + else + { + TypeCode = My->DefaultVariableType[i]; + } + } + } + + switch (TypeCode) + { + case ByteTypeCode: + /* DIM # file_num , var_name AS BYTE */ + FileLength = sizeof (ByteType); + break; + case IntegerTypeCode: + /* DIM # file_num , var_name AS INTEGER */ + FileLength = sizeof (IntegerType); + break; + case LongTypeCode: + /* DIM # file_num , var_name AS LONG */ + FileLength = sizeof (LongType); + break; + case CurrencyTypeCode: + /* DIM # file_num , var_name AS CURRENCY */ + FileLength = sizeof (CurrencyType); + break; + case SingleTypeCode: + /* DIM # file_num , var_name AS SINGLE */ + FileLength = sizeof (SingleType); + break; + case DoubleTypeCode: + /* DIM # file_num , var_name AS DOUBLE */ + FileLength = sizeof (DoubleType); + break; + case StringTypeCode: + /* DIM # file_num , var_name AS STRING * fixed_length */ + + FileLength = 16; /* default */ + if (line_skip_StarChar (l) || line_skip_EqualChar (l)) + { + /* optional fixed length */ + if (line_read_integer_expression (l, &FileLength) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (FileLength <= 0) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (FileLength > MAXLEN) + { + WARN_STRING_TOO_LONG; /* bwb_DIM */ + FileLength = MAXLEN; + } + } + break; + default: + { + WARN_INTERNAL_ERROR; + return (l); + } + } + + v = var_find (varname, dimensions, FALSE); + if (v == NULL) + { + /* a new variable */ + if ((v = (VariableType *) calloc (1, sizeof (VariableType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + bwb_strcpy (v->name, varname); + v->VariableTypeCode = TypeCode; + /* assign array dimensions */ + v->dimensions = dimensions; + for (n = 0; n < dimensions; n++) + { + v->LBOUND[n] = LBOUND[n]; + v->UBOUND[n] = UBOUND[n]; + } + /* assign initial array position */ + for (n = 0; n < dimensions; n++) + { + v->VINDEX[n] = v->LBOUND[n]; + } + /* calculate the array size */ + v->array_units = 1; + for (n = 0; n < dimensions; n++) + { + v->array_units *= v->UBOUND[n] - v->LBOUND[n] + 1; + } + /* assign array memory */ + + if (FileNumber > 0) + { + /* the new variable is VIRTUAL */ + v->VariableFlags = VARIABLE_VIRTUAL; + /* if( TRUE ) */ + { + /* OK */ + VirtualType *Z; + Z = find_virtual_by_variable (v); + if (Z == NULL) + { + Z = new_virtual (); + if (Z == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + Z->Variable = v; + } + /* update file information */ + Z->FileNumber = FileNumber; + Z->FileOffset = FileOffset; + Z->FileLength = FileLength; + FileOffset += FileLength * v->array_units; + } + } + else if (VAR_IS_STRING (v)) + { + if ((v->Value.String = + (StringType *) calloc (v->array_units, + sizeof (StringType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + } + else + { + if ((v->Value.Number = + (DoubleType *) calloc (v->array_units, + sizeof (DoubleType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + } + /* set place at beginning of variable chain */ + var_link_new_variable (v); + + /* end of conditional for new variable */ + } + else + { + /* old variable */ + if (v->VariableTypeCode != TypeCode) + { + WARN_TYPE_MISMATCH; + return (l); + } + + /* check to be sure the number of dimensions is the same */ + if (v->dimensions != dimensions) + { + WARN_REDIMENSION_ARRAY; + return (l); + } + /* check to be sure sizes for each dimension are the same */ + for (n = 0; n < dimensions; n++) + { + if (v->LBOUND[n] != LBOUND[n]) + { + WARN_REDIMENSION_ARRAY; + return (l); + } + if (v->UBOUND[n] != UBOUND[n]) + { + WARN_REDIMENSION_ARRAY; + return (l); + } + } + if (FileNumber > 0) + { + /* the existing variable MUST be Virtual */ + if (v->VariableFlags & VARIABLE_VIRTUAL) + { + /* OK */ + VirtualType *Z; + Z = find_virtual_by_variable (v); + if (Z == NULL) + { + Z = new_virtual (); + if (Z == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + Z->Variable = v; + } + /* update file information */ + Z->FileNumber = FileNumber; + Z->FileOffset = FileOffset; + Z->FileLength = FileLength; + FileOffset += FileLength * v->array_units; + } + else + { + /* the existing variable is NOT virtual */ + WARN_TYPE_MISMATCH; + return (l); + } + } + else + { + /* the existing variable CANNOT be Virtual */ + if (v->VariableFlags & VARIABLE_VIRTUAL) + { + /* the existing variable IS virtual */ + WARN_TYPE_MISMATCH; + return (l); + } + else + { + /* OK */ + } + } + /* end of conditional for old variable */ + } + + } + while (line_skip_seperator (l)); + + /* return */ + return (l); +} + + + + +/*************************************************************** + + FUNCTION: dim_unit() + + DESCRIPTION: This function calculates the unit + position for an array. + +***************************************************************/ + +static size_t +dim_unit (VariableType * v, int *pp) +{ + size_t r; + size_t b; + int n; + + assert (v != NULL); + assert (pp != NULL); + + /* Calculate and return the address of the dimensioned array */ + + /* Check EACH dimension for out-of-bounds, AND check correct number + * of dimensions. NBS_P076_0250 errors correctly. */ + + /* + Ux = Upper bound of dimension + Lx = Lower bound of dimension + Ix = Selected idex in dimension + + dimensions b + 0 1 + 1 b0 * ( U0 - L0 + 1 ) + 2 b1 * ( U1 - L1 + 1 ) + 3 b2 * ( U2 - L2 + 1 ) + + + dimensions r + 0 0 + 1 r0 + ( I0 - L0 ) * b0 + 2 r1 + ( I1 - L1 ) * b1 + 3 r2 + ( I2 - L2 ) * b2 + + */ + + r = 0; + b = 1; + for (n = 0; n < v->dimensions; n++) + { + if (pp[n] < v->LBOUND[n] || pp[n] > v->UBOUND[n]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return 0; + } + r += b * (pp[n] - v->LBOUND[n]); + b *= v->UBOUND[n] - v->LBOUND[n] + 1; + } + + + if (r > v->array_units) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return 0; + } + return r; + +} + + +/*************************************************************** + + FUNCTION: bwb_option() + + DESCRIPTION: This function implements the BASIC OPTION + BASE statement, designating the base (1 or + 0) for addressing DIM arrays. + + SYNTAX: OPTION BASE number + +***************************************************************/ + +void +OptionVersionSet (int i) +{ + assert( i >= 0 && i < NUM_VERSIONS ); + assert( My != NULL ); + + My->CurrentVersion = &bwb_vertable[i]; +} + +LineType * +bwb_OPTION (LineType * l) +{ + assert (l != NULL); + + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_ANGLE (LineType * l) +{ + assert (l != NULL); + + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_ANGLE_DEGREES (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION ANGLE DEGREES */ + My->CurrentVersion->OptionFlags |= OPTION_ANGLE_DEGREES; + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_GRADIANS; + return (l); +} + +LineType * +bwb_OPTION_ANGLE_GRADIANS (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION ANGLE GRADIANS */ + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_DEGREES; + My->CurrentVersion->OptionFlags |= OPTION_ANGLE_GRADIANS; + return (l); +} + +LineType * +bwb_OPTION_ANGLE_RADIANS (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION ANGLE RADIANS */ + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_DEGREES; + My->CurrentVersion->OptionFlags &= ~OPTION_ANGLE_GRADIANS; + return (l); +} + +LineType * +bwb_OPTION_ARITHMETIC (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_ARITHMETIC_DECIMAL (LineType * l) +{ + /* OPTION ARITHMETIC DECIMAL */ + assert (l != NULL); + return (l); +} + +LineType * +bwb_OPTION_ARITHMETIC_FIXED (LineType * l) +{ + /* OPTION ARITHMETIC FIXED */ + assert (l != NULL); + return (l); +} + +LineType * +bwb_OPTION_ARITHMETIC_NATIVE (LineType * l) +{ + /* OPTION ARITHMETIC NATIVE */ + assert (l != NULL); + return (l); +} + +LineType * +bwb_OPTION_BASE (LineType * l) +{ + /* OPTION BASE integer */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_range_integer (l, + &(My->CurrentVersion->OptionBaseInteger), + MININT, MAXINT); +} + +LineType * +bwb_OPTION_BUGS (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_BUGS_BOOLEAN (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION BUGS BOOLEAN */ + My->CurrentVersion->OptionFlags |= OPTION_BUGS_BOOLEAN; + return (l); +} + +LineType * +bwb_OPTION_BUGS_ON (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION BUGS ON */ + My->CurrentVersion->OptionFlags |= OPTION_BUGS_ON; + return (l); +} + +LineType * +bwb_OPTION_BUGS_OFF (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION BUGS OFF */ + My->CurrentVersion->OptionFlags &= ~OPTION_BUGS_ON; + My->CurrentVersion->OptionFlags &= ~OPTION_BUGS_BOOLEAN; + return (l); +} + +LineType * +bwb_option_punct_char (LineType * l, char *c) +{ + /* OPTION ... char$ */ + + assert (l != NULL); + assert (c != NULL); + + { + char *Value; + char C; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + C = Value[0]; + free (Value); + /* OK */ + if (bwb_ispunct (C)) + { + /* enable */ + *c = C; + } + else + { + /* disable */ + *c = NulChar; + } + } + return (l); +} + +LineType * +bwb_option_range_integer (LineType * l, int *Integer, int MinVal, int MaxVal) +{ + /* OPTION ... integer */ + + assert (l != NULL); + assert (Integer != NULL); + assert (MinVal < MaxVal); + + { + int Value; + + Value = 0; + if (line_read_integer_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value < MinVal || Value > MaxVal) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + *Integer = Value; + } + return (l); +} + +LineType * +bwb_OPTION_PUNCT_COMMENT (LineType * l) +{ + /* OPTION PUNCT COMMENT char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionCommentChar)); +} + +LineType * +bwb_OPTION_COMPARE (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_COMPARE_BINARY (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION COMPARE BINARY */ + My->CurrentVersion->OptionFlags &= ~OPTION_COMPARE_TEXT; + return (l); +} + +LineType * +bwb_OPTION_COMPARE_DATABASE (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION COMPARE DATABASE */ + My->CurrentVersion->OptionFlags |= OPTION_COMPARE_TEXT; + return (l); +} + +LineType * +bwb_OPTION_COMPARE_TEXT (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION COMPARE TEXT */ + My->CurrentVersion->OptionFlags |= OPTION_COMPARE_TEXT; + return (l); +} + +LineType * +bwb_OPTION_COVERAGE (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_COVERAGE_ON (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION COVERAGE ON */ + My->CurrentVersion->OptionFlags |= OPTION_COVERAGE_ON; + return (l); +} + +LineType * +bwb_OPTION_COVERAGE_OFF (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION COVERAGE OFF */ + My->CurrentVersion->OptionFlags &= ~OPTION_COVERAGE_ON; + return (l); +} + +LineType * +bwb_OPTION_DATE (LineType * l) +{ + /* OPTION DATE format$ */ + char *Value; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + My->CurrentVersion->OptionDateFormat = Value; +#if FALSE /* keep this ... */ + /* + ** Yes, this can theoretically cause a memory leak. + ** No, we are not going to fix it. + ** This command is only supported in the profile. + ** This will only execute at most once, + ** so there is no actual memory leak. + ** + */ + free (Value); +#endif + return (l); +} + +LineType * +bwb_OPTION_DIGITS (LineType * l) +{ + int Value; + + assert (l != NULL); + assert( My != NULL ); + + /* OPTION DIGITS integer */ + Value = 0; + if (line_read_integer_expression (l, &Value)) + { + /* OK */ + if (Value == 0) + { + /* default */ + Value = SIGNIFICANT_DIGITS; + } + if (Value < MINIMUM_DIGITS || Value > MAXIMUM_DIGITS) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + My->OptionDigitsInteger = Value; + } + return (l); +} + +LineType * +bwb_OPTION_DISABLE (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_DISABLE_COMMAND (LineType * l) +{ + /* OPTION DISABLE COMMAND name$ */ + int IsFound; + char *Value; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + + IsFound = FALSE; + Value = NULL; + + /* Get COMMAND */ + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + { + /* Name */ + int i; + for (i = 0; i < NUM_COMMANDS; i++) + { + if (bwb_stricmp (Value, IntrinsicCommandTable[i].name) == 0) + { + /* FOUND */ + /* DISABLE COMMAND */ + IntrinsicCommandTable[i].OptionVersionBitmask &= + ~My->CurrentVersion->OptionVersionValue; + IsFound = TRUE; + } + } + } + free (Value); + if (IsFound == FALSE) + { + /* display warning message */ + fprintf (My->SYSOUT->cfp, "IGNORED: %s\n", l->buffer); + ResetConsoleColumn (); + } + return (l); +} + + +LineType * +bwb_OPTION_DISABLE_FUNCTION (LineType * l) +{ + /* OPTION DISABLE FUNCTION name$ */ + int IsFound; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + + IsFound = FALSE; + /* Get FUNCTION */ + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + { + /* Name */ + int i; + for (i = 0; i < NUM_FUNCTIONS; i++) + { + if (bwb_stricmp (Value, IntrinsicFunctionTable[i].Name) == 0) + { + /* FOUND */ + /* DISABLE FUNCTION */ + IntrinsicFunctionTable[i].OptionVersionBitmask &= + ~My->CurrentVersion->OptionVersionValue; + IsFound = TRUE; + } + } + } + free (Value); + } + if (IsFound == FALSE) + { + /* display warning message */ + fprintf (My->SYSOUT->cfp, "IGNORED: %s\n", l->buffer); + ResetConsoleColumn (); + } + return (l); +} + +LineType * +bwb_OPTION_EDIT (LineType * l) +{ + /* OPTION EDIT string$ */ + char *Value; + + assert (l != NULL); + assert( My != NULL ); + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + My->OptionEditString = Value; +#if FALSE /* keep this ... */ + /* + ** Yes, this can theoretically cause a memory leak. + ** No, we are not going to fix it. + ** This command is only supported in the profile. + ** This will only execute at most once, + ** so there is no actual memory leak. + ** + */ + free (Value); +#endif + return (l); +} + +LineType * +bwb_OPTION_EXTENSION (LineType * l) +{ + /* OPTION EXTENSION ext$ */ + char *Value; + + assert (l != NULL); + assert( My != NULL ); + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + My->OptionExtensionString = Value; +#if FALSE /* keep this ... */ + /* + ** Yes, this can theoretically cause a memory leak. + ** No, we are not going to fix it. + ** This command is only supported in the profile. + ** This command will only execute at most once, + ** so there is no actual memory leak. + ** + */ + free (Value); +#endif + return (l); +} + +LineType * +bwb_OPTION_FILES (LineType * l) +{ + /* OPTION FILES name$ */ + char *Value; + + assert (l != NULL); + assert( My != NULL ); + + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + My->OptionFilesString = Value; +#if FALSE /* keep this ... */ + /* + ** Yes, this can theoretically cause a memory leak. + ** No, we are not going to fix it. + ** This command is only supported in the profile. + ** This will only execute at most once, + ** so there is no actual memory leak. + ** + */ + free (Value); +#endif + return (l); +} + +LineType * +bwb_OPTION_PROMPT (LineType * l) +{ + /* OPTION PROMPT prompt$ */ + char *Value; + + assert (l != NULL); + assert( My != NULL ); + + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + My->OptionPromptString = Value; +#if FALSE /* keep this ... */ + /* + ** Yes, this can theoretically cause a memory leak. + ** No, we are not going to fix it. + ** This command is only supported in the profile. + ** This will only execute at most once, + ** so there is no actual memory leak. + ** + */ + free (Value); +#endif + return (l); +} + +LineType * +bwb_OPTION_RENUM (LineType * l) +{ + /* OPTION RENUM name$ */ + char *Value; + + assert (l != NULL); + assert( My != NULL ); + + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + My->OptionRenumString = Value; +#if FALSE /* keep this ... */ + /* + ** Yes, this can theoretically cause a memory leak. + ** No, we are not going to fix it. + ** This command is only supported in the profile. + ** This will only execute at most once, + ** so there is no actual memory leak. + ** + */ + free (Value); +#endif + return (l); +} + +LineType * +bwb_OPTION_ENABLE (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_ENABLE_COMMAND (LineType * l) +{ + /* OPTION ENABLE COMMAND name$ */ + int IsFound; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + + IsFound = FALSE; + /* Get COMMAND */ + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + { + /* Name */ + int i; + for (i = 0; i < NUM_COMMANDS; i++) + { + if (bwb_stricmp (Value, IntrinsicCommandTable[i].name) == 0) + { + /* FOUND */ + /* ENABLE COMMAND */ + IntrinsicCommandTable[i].OptionVersionBitmask |= + My->CurrentVersion->OptionVersionValue; + IsFound = TRUE; + } + } + } + free (Value); + } + if (IsFound == FALSE) + { + /* display warning message */ + fprintf (My->SYSOUT->cfp, "IGNORED: %s\n", l->buffer); + ResetConsoleColumn (); + } + return (l); +} + +LineType * +bwb_OPTION_ENABLE_FUNCTION (LineType * l) +{ + /* OPTION ENABLE FUNCTION name$ */ + int IsFound; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + + IsFound = FALSE; + /* Get FUNCTION */ + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + { + /* Name */ + int i; + for (i = 0; i < NUM_FUNCTIONS; i++) + { + if (bwb_stricmp (Value, IntrinsicFunctionTable[i].Name) == 0) + { + /* FOUND */ + /* ENABLE FUNCTION */ + IntrinsicFunctionTable[i].OptionVersionBitmask |= + My->CurrentVersion->OptionVersionValue; + IsFound = TRUE; + } + } + } + free (Value); + } + if (IsFound == FALSE) + { + /* display warning message */ + fprintf (My->SYSOUT->cfp, "IGNORED: %s\n", l->buffer); + ResetConsoleColumn (); + } + return (l); +} + +LineType * +bwb_OPTION_ERROR (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_ERROR_GOSUB (LineType * l) +{ + /* OPTION ERROR GOSUB */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + My->CurrentVersion->OptionFlags |= OPTION_ERROR_GOSUB; + return (l); +} + +LineType * +bwb_OPTION_ERROR_GOTO (LineType * l) +{ + /* OPTION ERROR GOTO */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + My->CurrentVersion->OptionFlags &= ~OPTION_ERROR_GOSUB; + return (l); +} + +LineType * +bwb_OPTION_EXPLICIT (LineType * l) +{ + /* OPTION EXPLICIT */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + My->CurrentVersion->OptionFlags |= OPTION_EXPLICIT_ON; + return (l); +} + + +LineType * +bwb_OPTION_PUNCT_IMAGE (LineType * l) +{ + /* OPTION PUNCT IMAGE char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionImageChar)); +} + +LineType * +bwb_OPTION_IMPLICIT (LineType * l) +{ + /* OPTION IMPLICIT */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + My->CurrentVersion->OptionFlags &= ~OPTION_EXPLICIT_ON; + return (l); +} + +LineType * +bwb_OPTION_INDENT (LineType * l) +{ + /* OPTION INDENT integer */ + assert (l != NULL); + assert( My != NULL ); + + return bwb_option_range_integer (l, &(My->OptionIndentInteger), 0, 7); +} + +LineType * +bwb_OPTION_PUNCT_INPUT (LineType * l) +{ + /* OPTION PUNCT INPUT char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionInputChar)); +} + +LineType * +bwb_OPTION_LABELS (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_LABELS_ON (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION LABELS ON */ + My->CurrentVersion->OptionFlags |= OPTION_LABELS_ON; + return (l); +} + +LineType * +bwb_OPTION_LABELS_OFF (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION LABELS OFF */ + My->CurrentVersion->OptionFlags &= ~OPTION_LABELS_ON; + return (l); +} + +LineType * +bwb_OPTION_PUNCT_PRINT (LineType * l) +{ + /* OPTION PUNCT PRINT char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionPrintChar)); +} + +LineType * +bwb_OPTION_PUNCT_QUOTE (LineType * l) +{ + /* OPTION PUNCT QUOTE char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionQuoteChar)); +} + +LineType * +bwb_OPTION_ROUND (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_ROUND_BANK (LineType * l) +{ + /* OPTION ROUND BANK */ + assert (l != NULL); + assert( My != NULL ); + + My->OptionRoundType = C_OPTION_ROUND_BANK; + return (l); +} + +LineType * +bwb_OPTION_ROUND_MATH (LineType * l) +{ + /* OPTION ROUND MATH */ + assert (l != NULL); + assert( My != NULL ); + + My->OptionRoundType = C_OPTION_ROUND_MATH; + return (l); +} + +LineType * +bwb_OPTION_ROUND_TRUNCATE (LineType * l) +{ + /* OPTION ROUND TRUNCATE */ + assert (l != NULL); + assert( My != NULL ); + + My->OptionRoundType = C_OPTION_ROUND_TRUNCATE; + return (l); +} + +LineType * +bwb_OPTION_SCALE (LineType * l) +{ + /* OPTION SCALE integer */ + assert (l != NULL); + assert( My != NULL ); + + return bwb_option_range_integer (l, &(My->OptionScaleInteger), + MINIMUM_SCALE, MAXIMUM_SCALE); +} + + +LineType * +bwb_OPTION_SLEEP (LineType * l) +{ + /* OPTION SLEEP number */ + assert (l != NULL); + assert( My != NULL ); + + if (line_read_numeric_expression (l, &My->OptionSleepDouble) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + return (l); +} + +LineType * +bwb_OPTION_STDERR (LineType * l) +{ + /* OPTION STDERR filename$ */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSPRN != NULL ); + assert( My->SYSPRN->cfp != NULL ); + + + if (line_is_eol (l)) + { + bwb_fclose (My->SYSPRN->cfp); + My->SYSPRN->cfp = stderr; + } + else + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + if (is_empty_string (Value)) + { + bwb_fclose (My->SYSPRN->cfp); + My->SYSPRN->cfp = stderr; + } + else + { + bwb_fclose (My->SYSPRN->cfp); + My->SYSPRN->cfp = fopen (Value, "w+"); + if (My->SYSPRN->cfp == NULL) + { + /* sane default */ + My->SYSPRN->cfp = stderr; + WARN_BAD_FILE_NAME; + } + } + free (Value); + } + return (l); +} + +LineType * +bwb_OPTION_STDIN (LineType * l) +{ + /* OPTION STDIN filename$ */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSIN != NULL ); + assert( My->SYSIN->cfp != NULL ); + + if (line_is_eol (l)) + { + bwb_fclose (My->SYSIN->cfp); + My->SYSIN->cfp = stdin; + } + else + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + if (is_empty_string (Value)) + { + bwb_fclose (My->SYSIN->cfp); + My->SYSIN->cfp = stdin; + } + else + { + bwb_fclose (My->SYSIN->cfp); + My->SYSIN->cfp = fopen (Value, "r"); + if (My->SYSIN->cfp == NULL) + { + /* sane default */ + My->SYSIN->cfp = stdin; + WARN_BAD_FILE_NAME; + } + } + free (Value); + } + return (l); +} + +LineType * +bwb_OPTION_STDOUT (LineType * l) +{ + /* OPTION STDOUT filename$ */ + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + if (line_is_eol (l)) + { + bwb_fclose (My->SYSOUT->cfp); + My->SYSOUT->cfp = stdout; + } + else + { + char *Value; + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + if (is_empty_string (Value)) + { + bwb_fclose (My->SYSOUT->cfp); + My->SYSOUT->cfp = stdout; + } + else + { + bwb_fclose (My->SYSOUT->cfp); + My->SYSOUT->cfp = fopen (Value, "w+"); + if (My->SYSOUT->cfp == NULL) + { + /* sane default */ + My->SYSOUT->cfp = stdout; + WARN_BAD_FILE_NAME; + } + } + free (Value); + } + return (l); +} + +LineType * +bwb_OPTION_PUNCT_STATEMENT (LineType * l) +{ + /* OPTION PUNCT STATEMENT char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, + &(My->CurrentVersion->OptionStatementChar)); +} + +LineType * +bwb_OPTION_STRICT (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_STRICT_ON (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION STRICT ON */ + My->CurrentVersion->OptionFlags |= OPTION_STRICT_ON; + return (l); +} + +LineType * +bwb_OPTION_STRICT_OFF (LineType * l) +{ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + /* OPTION STRICT OFF */ + My->CurrentVersion->OptionFlags &= ~OPTION_STRICT_ON; + return (l); +} + +LineType * +bwb_OPTION_PUNCT (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_PUNCT_STRING (LineType * l) +{ + /* OPTION PUNCT STRING char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionStringChar)); +} + +LineType * +bwb_OPTION_PUNCT_DOUBLE (LineType * l) +{ + /* OPTION PUNCT DOUBLE char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionDoubleChar)); +} + +LineType * +bwb_OPTION_PUNCT_SINGLE (LineType * l) +{ + /* OPTION PUNCT SINGLE char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionSingleChar)); +} + +LineType * +bwb_OPTION_PUNCT_CURRENCY (LineType * l) +{ + /* OPTION PUNCT CURRENCY char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionCurrencyChar)); +} + +LineType * +bwb_OPTION_PUNCT_LONG (LineType * l) +{ + /* OPTION PUNCT LONG char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionLongChar)); +} + +LineType * +bwb_OPTION_PUNCT_INTEGER (LineType * l) +{ + /* OPTION PUNCT INTEGER char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionIntegerChar)); +} + +LineType * +bwb_OPTION_PUNCT_BYTE (LineType * l) +{ + /* OPTION PUNCT BYTE char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionByteChar)); +} + +LineType * +bwb_OPTION_PUNCT_LPAREN (LineType * l) +{ + /* OPTION PUNCT LPAREN char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionLparenChar)); +} + +LineType * +bwb_OPTION_PUNCT_RPAREN (LineType * l) +{ + /* OPTION PUNCT RPAREN char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionRparenChar)); +} + +LineType * +bwb_OPTION_PUNCT_FILENUM (LineType * l) +{ + /* OPTION PUNCT FILENUM char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionFilenumChar)); +} + +LineType * +bwb_OPTION_PUNCT_AT (LineType * l) +{ + /* OPTION PUNCT AT char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionAtChar)); +} + +LineType * +bwb_OPTION_RECLEN (LineType * l) +{ + /* OPTION RECLEN integer */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_range_integer (l, + &(My->CurrentVersion->OptionReclenInteger), + 0, MAXINT); +} + +LineType * +bwb_OPTION_TERMINAL (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_TERMINAL_NONE (LineType * l) +{ + /* OPTION TERMINAL NONE */ + assert (l != NULL); + assert( My != NULL ); + + My->OptionTerminalType = C_OPTION_TERMINAL_NONE; + return (l); +} + +LineType * +bwb_OPTION_TERMINAL_ADM (LineType * l) +{ + /* OPTION TERMINAL ADM-3A */ + assert (l != NULL); + assert( My != NULL ); + + My->OptionTerminalType = C_OPTION_TERMINAL_ADM; + return (l); +} + +LineType * +bwb_OPTION_TERMINAL_ANSI (LineType * l) +{ + /* OPTION TERMINAL ANSI */ + assert (l != NULL); + assert( My != NULL ); + + My->OptionTerminalType = C_OPTION_TERMINAL_ANSI; + return (l); +} + +LineType * +bwb_OPTION_TIME (LineType * l) +{ + /* OPTION TIME format$ */ + char *Value; + + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + Value = NULL; + if (line_read_string_expression (l, &Value) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (Value == NULL) + { + WARN_SYNTAX_ERROR; + return (l); + } + /* OK */ + My->CurrentVersion->OptionTimeFormat = Value; +#if FALSE /* keep this ... */ + /* + ** Yes, this can theoretically cause a memory leak. + ** No, we are not going to fix it. + ** This command is only supported in the profile. + ** This will only execute at most once, + ** so there is no actual memory leak. + ** + */ + free (Value); +#endif + return (l); +} + +LineType * +bwb_OPTION_TRACE (LineType * l) +{ + + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_TRACE_ON (LineType * l) +{ + /* OPTION TRACE ON */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + My->CurrentVersion->OptionFlags |= OPTION_TRACE_ON; + return (l); +} + +LineType * +bwb_OPTION_TRACE_OFF (LineType * l) +{ + /* OPTION TRACE OFF */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + My->CurrentVersion->OptionFlags &= ~OPTION_TRACE_ON; + return (l); +} + +LineType * +bwb_OPTION_USING (LineType * l) +{ + assert (l != NULL); + WARN_SYNTAX_ERROR; + return (l); +} + +LineType * +bwb_OPTION_USING_DIGIT (LineType * l) +{ + /* OPTION USING DIGIT char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingDigit)); +} + +LineType * +bwb_OPTION_USING_COMMA (LineType * l) +{ + /* OPTION USING COMMA char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingComma)); +} + +LineType * +bwb_OPTION_USING_PERIOD (LineType * l) +{ + /* OPTION USING PERIOD char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingPeriod)); +} + +LineType * +bwb_OPTION_USING_PLUS (LineType * l) +{ + /* OPTION USING PLUS char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingPlus)); +} + +LineType * +bwb_OPTION_USING_MINUS (LineType * l) +{ + /* OPTION USING MINUS char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingMinus)); +} + +LineType * +bwb_OPTION_USING_EXRAD (LineType * l) +{ + /* OPTION USING EXRAD char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingExrad)); +} + +LineType * +bwb_OPTION_USING_DOLLAR (LineType * l) +{ + /* OPTION USING DOLLAR char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingDollar)); +} + +LineType * +bwb_OPTION_USING_FILLER (LineType * l) +{ + /* OPTION USING FILLER char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingFiller)); +} + +LineType * +bwb_OPTION_USING_LITERAL (LineType * l) +{ + /* OPTION USING LITERAL char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingLiteral)); +} + +LineType * +bwb_OPTION_USING_FIRST (LineType * l) +{ + /* OPTION USING FIRST char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingFirst)); +} + +LineType * +bwb_OPTION_USING_ALL (LineType * l) +{ + /* OPTION USING ALL char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingAll)); +} + +LineType * +bwb_OPTION_USING_LENGTH (LineType * l) +{ + /* OPTION USING LENGTH char$ */ + assert (l != NULL); + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + return bwb_option_punct_char (l, &(My->CurrentVersion->OptionUsingLength)); +} + +extern LineType * +bwb_OPTION_VERSION (LineType * l) +{ + /* OPTION VERSION [version$] */ + char *Name; + int i; + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + + Name = NULL; + if (line_is_eol (l)) + { + /* OPTIONAL */ + } + else if (line_read_string_expression (l, &Name)) + { + if (is_empty_string (Name) == FALSE) + { + /* a version was specified */ + for (i = 0; i < NUM_VERSIONS; i++) + { + if (bwb_stricmp (Name, bwb_vertable[i].Name) == 0) + { + /* FOUND */ + OptionVersionSet (i); + return (l); + } + } + /* NOT FOUND */ + fprintf (My->SYSOUT->cfp, "OPTION VERSION \"%s\" IS INVALID\n", Name); + } + } + fprintf (My->SYSOUT->cfp, "VALID CHOICES ARE:\n"); + for (i = 0; i < NUM_VERSIONS; i++) + { + char *tbuf; + + tbuf = My->ConsoleOutput; + bwb_strcpy (tbuf, "\""); + bwb_strcat (tbuf, bwb_vertable[i].Name); + bwb_strcat (tbuf, "\""); + fprintf (My->SYSOUT->cfp, "OPTION VERSION %-16s ' %s\n", tbuf, + bwb_vertable[i].Description); + } + ResetConsoleColumn (); + line_skip_eol (l); + return (l); +} + +LineType * +bwb_OPTION_ZONE (LineType * l) +{ + /* OPTION ZONE integer */ + int Value; + + assert (l != NULL); + assert( My != NULL ); + + Value = 0; + if (line_read_integer_expression (l, &Value)) + { + /* OK */ + if (Value == 0) + { + /* default */ + Value = ZONE_WIDTH; + } + if (Value < MINIMUM_ZONE || Value > MAXIMUM_ZONE) + { + WARN_ILLEGAL_FUNCTION_CALL; + return (l); + } + My->OptionZoneInteger = Value; + } + return (l); +} + + + +int +var_get (VariableType * variable, VariantType * variant) +{ + size_t offset; + + /* check sanity */ + if (variable == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + if (variant == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + + /* Check subscripts */ + if (dim_check (variable) == FALSE) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return FALSE; + } + + /* Determine offset from array base ( for scalars the offset is always zero ) */ + offset = dim_unit (variable, variable->VINDEX); + + CLEAR_VARIANT (variant); + + /* Force compatibility */ + variant->VariantTypeCode = variable->VariableTypeCode; + + if (variable->VariableTypeCode == StringTypeCode) + { + /* Variable is a STRING */ + StringType Value; + + Value.sbuffer = NULL; + Value.length = 0; + /* both STRING */ + + if (variable->VariableFlags & VARIABLE_VIRTUAL) /* var_get() */ + { + /* get file information */ + VirtualType *Z; + FileType *F; + + Z = find_virtual_by_variable (variable); + if (Z == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + offset *= Z->FileLength; /* Byte offset */ + offset += Z->FileOffset; /* Beginning of this data */ + /* update file information */ + F = find_file_by_number (Z->FileNumber); + if (F == NULL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (F->DevMode != DEVMODE_VIRTUAL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (F->cfp == NULL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (fseek (F->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + Value.length = Z->FileLength; + if ((Value.sbuffer = + (char *) calloc (Value.length + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return FALSE; + } + if (fread (Value.sbuffer, Value.length, 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + else + { + StringType *string; + + string = variable->Value.String; + if (string == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + string += offset; + if (str_btob (&Value, string) == FALSE) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + } + variant->Buffer = Value.sbuffer; + variant->Length = Value.length; + } + else + { + /* Variable is a NUMBER */ + DoubleType Value; + /* both NUMBER */ + + if (variable->VariableFlags & VARIABLE_VIRTUAL) /* var_get() */ + { + /* get file information */ + VirtualType *Z; + FileType *F; + + Z = find_virtual_by_variable (variable); + if (Z == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + offset *= Z->FileLength; /* Byte offset */ + offset += Z->FileOffset; /* Beginning of this data */ + /* update file information */ + F = find_file_by_number (Z->FileNumber); + if (F == NULL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (F->DevMode != DEVMODE_VIRTUAL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (F->cfp == NULL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (fseek (F->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + switch (variable->VariableTypeCode) + { + case ByteTypeCode: + { + ByteType X; + if (fread (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + Value = X; + } + break; + case IntegerTypeCode: + { + IntegerType X; + if (fread (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + Value = X; + } + break; + case LongTypeCode: + { + LongType X; + if (fread (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + Value = X; + } + break; + case CurrencyTypeCode: + { + CurrencyType X; + if (fread (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + Value = X; + } + break; + case SingleTypeCode: + { + SingleType X; + if (fread (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + Value = X; + } + break; + case DoubleTypeCode: + { + DoubleType X; + if (fread (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + Value = X; + } + break; + case StringTypeCode: + { + WARN_INTERNAL_ERROR; + return FALSE; + } + /* break; */ + default: + { + WARN_INTERNAL_ERROR; + return FALSE; + } + } + } + else + { + DoubleType *number; + + number = variable->Value.Number; + if (number == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + number += offset; + /* copy value */ + Value = *number; + } + + /* VerifyNumeric */ + if (isnan (Value)) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; + } + if (isinf (Value)) + { + /* - Evaluation of an expression results in an overflow + * (nonfatal, the recommended recovery procedure is to supply + * machine in- finity with the algebraically correct sign and + * continue). */ + if (Value < 0) + { + Value = MINDBL; + } + else + { + Value = MAXDBL; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + return FALSE; + } + /* CONTINUE */ + } + /* OK */ + switch (variable->VariableTypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + /* integer values */ + Value = bwb_rint (Value); + break; + case SingleTypeCode: + case DoubleTypeCode: + /* float values */ + break; + default: + /* ERROR */ + WARN_INTERNAL_ERROR; + return FALSE; + /* break; */ + } + variant->Number = Value; + } + return TRUE; +} + +int +var_set (VariableType * variable, VariantType * variant) +{ + size_t offset; + + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + /* check sanity */ + if (variable == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + if (variant == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + + /* check CONST */ + if (variable->VariableFlags & (VARIABLE_CONSTANT)) + { + /* attempting to assign to a constant */ + WARN_VARIABLE_NOT_DECLARED; + return FALSE; + } + + /* Check subscripts */ + if (dim_check (variable) == FALSE) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return FALSE; + } + + /* Determine offset from array base ( for scalars the offset is always zero ) */ + offset = dim_unit (variable, variable->VINDEX); + + /* Verify compatibility */ + if (variable->VariableTypeCode == StringTypeCode) + { + /* Variable is a STRING */ + StringType Value; + + /* Verify value is a STRING */ + if (variant->VariantTypeCode != StringTypeCode) + { + WARN_TYPE_MISMATCH; + return FALSE; + } + Value.sbuffer = variant->Buffer; + Value.length = variant->Length; + /* both STRING */ + + if (variable->VariableFlags & VARIABLE_VIRTUAL) /* var_set() */ + { + /* get file information */ + VirtualType *Z; + FileType *F; + int count; + + Z = find_virtual_by_variable (variable); + if (Z == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + offset *= Z->FileLength; /* Byte offset */ + offset += Z->FileOffset; /* Beginning of this data */ + /* update file information */ + F = find_file_by_number (Z->FileNumber); + if (F == NULL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (F->DevMode != DEVMODE_VIRTUAL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (F->cfp == NULL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (fseek (F->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + count = MIN (Value.length, Z->FileLength); + if (fwrite (Value.sbuffer, sizeof (char), count, F->cfp) != count) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + /* PADR */ + while (count < Z->FileLength) + { + if (fputc (' ', F->cfp) == EOF) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + count++; + } + } + else + { + StringType *string; + + string = variable->Value.String; + if (string == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + string += offset; + if (str_btob (string, &Value) == FALSE) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + } + if (variable->VariableFlags & VARIABLE_DISPLAY) /* var_set() */ + { + if (My->ThisLine) /* var_set() */ + { + if (My->ThisLine->LineFlags & (LINE_USER)) /* var_set() */ + { + /* immediate mode */ + } + else + { + fprintf (My->SYSOUT->cfp, "#%d %s=%s\n", My->ThisLine->number, variable->name, variant->Buffer); /* var_set() */ + ResetConsoleColumn (); + } + } + } + } + else + { + /* Variable is a NUMBER */ + DoubleType Value; + + /* Verify value is a NUMBER */ + if (variant->VariantTypeCode == StringTypeCode) + { + WARN_TYPE_MISMATCH; + return FALSE; + } + + /* both NUMBER */ + + /* VerifyNumeric */ + if (isnan (variant->Number)) + { + /*** FATAL - INTERNAL ERROR - SHOULD NEVER HAPPEN ***/ + WARN_INTERNAL_ERROR; + return FALSE; + } + if (isinf (variant->Number)) + { + /* - Evaluation of an expression results in an overflow + * (nonfatal, the recommended recovery procedure is to supply + * machine in- finity with the algebraically correct sign and + * continue). */ + if (variant->Number < 0) + { + variant->Number = MINDBL; + } + else + { + variant->Number = MAXDBL; + } + if (WARN_OVERFLOW) + { + /* ERROR */ + return FALSE; + } + /* CONTINUE */ + } + /* OK */ + switch (variable->VariableTypeCode) + { + case ByteTypeCode: + variant->Number = bwb_rint (variant->Number); + if (variant->Number < MINBYT) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MINBYT; + } + else if (variant->Number > MAXBYT) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MAXBYT; + } + break; + case IntegerTypeCode: + variant->Number = bwb_rint (variant->Number); + if (variant->Number < MININT) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MININT; + } + else if (variant->Number > MAXINT) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MAXINT; + } + break; + case LongTypeCode: + variant->Number = bwb_rint (variant->Number); + if (variant->Number < MINLNG) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MINLNG; + } + else if (variant->Number > MAXLNG) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MAXLNG; + } + break; + case CurrencyTypeCode: + variant->Number = bwb_rint (variant->Number); + if (variant->Number < MINCUR) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MINCUR; + } + else if (variant->Number > MAXCUR) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MAXCUR; + } + break; + case SingleTypeCode: + if (variant->Number < MINSNG) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MINSNG; + } + else if (variant->Number > MAXSNG) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MAXSNG; + } + break; + case DoubleTypeCode: + if (variant->Number < MINDBL) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MINDBL; + } + else if (variant->Number > MAXDBL) + { + if (WARN_OVERFLOW) + { + return FALSE; + } + variant->Number = MAXDBL; + } + break; + default: + WARN_INTERNAL_ERROR; + return FALSE; + /* break; */ + } + Value = variant->Number; + if (variable->VariableFlags & VARIABLE_VIRTUAL) /* var_set() */ + { + /* get file information */ + VirtualType *Z; + FileType *F; + + Z = find_virtual_by_variable (variable); + if (Z == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + offset *= Z->FileLength; /* Byte offset */ + offset += Z->FileOffset; /* Beginning of this data */ + /* update file information */ + F = find_file_by_number (Z->FileNumber); + if (F == NULL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (F->DevMode != DEVMODE_VIRTUAL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (F->cfp == NULL) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + if (fseek (F->cfp, offset, SEEK_SET) != 0) + { + WARN_BAD_FILE_MODE; + return FALSE; + } + switch (variable->VariableTypeCode) + { + case ByteTypeCode: + { + ByteType X; + X = Value; + if (fwrite (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + break; + case IntegerTypeCode: + { + IntegerType X; + X = Value; + if (fwrite (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + break; + case LongTypeCode: + { + LongType X; + X = Value; + if (fwrite (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + break; + case CurrencyTypeCode: + { + CurrencyType X; + X = Value; + if (fwrite (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + break; + case SingleTypeCode: + { + SingleType X; + X = Value; + if (fwrite (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + break; + case DoubleTypeCode: + { + DoubleType X; + X = Value; + if (fwrite (&X, sizeof (X), 1, F->cfp) != 1) + { + WARN_DISK_IO_ERROR; + return FALSE; + } + } + break; + case StringTypeCode: + { + WARN_INTERNAL_ERROR; + return FALSE; + } + /* break; */ + default: + { + WARN_INTERNAL_ERROR; + return FALSE; + } + } + } + else + { + DoubleType *number; + number = variable->Value.Number; + if (number == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + number += offset; + *number = Value; + } + if (variable->VariableFlags & VARIABLE_DISPLAY) /* var_set() */ + { + if (My->ThisLine) /* var_set() */ + { + if (My->ThisLine->LineFlags & (LINE_USER)) /* var_set() */ + { + /* immediate mode */ + } + else + { + FormatBasicNumber (Value, My->NumLenBuffer); + fprintf (My->SYSOUT->cfp, "#%d %s=%s\n", My->ThisLine->number, variable->name, My->NumLenBuffer); /* var_set() */ + ResetConsoleColumn (); + } + } + } + } + return TRUE; +} + +/*************************************************************** + + FUNCTION: dim_check() + + DESCRIPTION: This function checks subscripts of a + specific variable to be sure that they + are within the correct range. + +***************************************************************/ + +static int +dim_check (VariableType * variable) +{ + /* Check for validly allocated array */ + int n; + + assert (variable != NULL); + + + if (variable->VariableFlags & VARIABLE_VIRTUAL) /* var_set() */ + { + if (variable->Value.String != NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + if (variable->Value.Number != NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + } + else if (VAR_IS_STRING (variable)) + { + if (variable->Value.String == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + } + else + { + if (variable->Value.Number == NULL) + { + WARN_INTERNAL_ERROR; + return FALSE; + } + } + /* Now check subscript values */ + for (n = 0; n < variable->dimensions; n++) + { + if (variable->VINDEX[n] < variable->LBOUND[n] + || variable->VINDEX[n] > variable->UBOUND[n]) + { + WARN_SUBSCRIPT_OUT_OF_RANGE; + return FALSE; + } + } + /* No problems found */ + return TRUE; +} + +/*************************************************************** + + FUNCTION: var_make() + + DESCRIPTION: This function initializes a variable, + allocating necessary memory for it. + +***************************************************************/ + +int +var_make (VariableType * variable, char TypeCode) +{ + /* ALL variables are created here */ + + assert (variable != NULL); + + switch (TypeCode) + { + case ByteTypeCode: + case IntegerTypeCode: + case LongTypeCode: + case CurrencyTypeCode: + case SingleTypeCode: + case DoubleTypeCode: + case StringTypeCode: + /* OK */ + break; + default: + /* ERROR */ + WARN_TYPE_MISMATCH; + return FALSE; + } + + variable->VariableTypeCode = TypeCode; + + /* get memory for array */ + + /* First cleanup the joint (JBV) */ + if (variable->Value.Number != NULL) + { + free (variable->Value.Number); + variable->Value.Number = NULL; + } + if (variable->Value.String != NULL) + { + /* Remember to deallocate those far-flung branches! (JBV) */ + StringType *sp; /* JBV */ + int n; /* JBV */ + + sp = variable->Value.String; + for (n = 0; n < (int) variable->array_units; n++) + { + if (sp[n].sbuffer != NULL) + { + free (sp[n].sbuffer); + sp[n].sbuffer = NULL; + } + sp[n].length = 0; + } + free (variable->Value.String); + variable->Value.String = NULL; + } + + variable->dimensions = 0; + variable->array_units = 1; + + if (VAR_IS_STRING (variable)) + { + if ((variable->Value.String = + calloc (variable->array_units, sizeof (StringType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return FALSE; + } + } + else + { + if ((variable->Value.Number = + calloc (variable->array_units, sizeof (DoubleType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return FALSE; + } + } + return TRUE; + +} + +/*************************************************************** + + FUNCTION: var_islocal() + + DESCRIPTION: This function determines whether the string + pointed to by 'buffer' has the name of + a local variable at the present EXEC stack + level. + +***************************************************************/ + +static VariableType * +mat_islocal (char *buffer) +{ + /* + similar to var_islocal, but returns first matrix found. + */ + + assert (buffer != NULL); + assert( My != NULL ); + + if (My->StackHead != NULL) + { + StackType *StackItem; + for (StackItem = My->StackHead; StackItem != NULL; + StackItem = StackItem->next) + { + if (StackItem->LoopTopLine != NULL) + { + switch (StackItem->LoopTopLine->cmdnum) + { + case C_DEF: + case C_FUNCTION: + case C_SUB: + /* we have found a FUNCTION or SUB boundary */ + { + VariableType *variable; + + for (variable = StackItem->local_variable; variable != NULL; + variable = variable->next) + { + if (variable->dimensions > 0) + { + if (bwb_stricmp (variable->name, buffer) == 0) + { + /* FOUND */ + return variable; + } + } + } + } + /* we have checked all the way to a FUNCTION or SUB boundary */ + /* NOT FOUND */ + return NULL; + /* break; */ + } + } + } + } + /* NOT FOUND */ + return NULL; +} + + +static VariableType * +var_islocal (char *buffer, int dimensions) +{ + + assert (buffer != NULL); + assert( My != NULL ); + + if (My->StackHead != NULL) + { + StackType *StackItem; + for (StackItem = My->StackHead; StackItem != NULL; + StackItem = StackItem->next) + { + if (StackItem->LoopTopLine != NULL) + { + switch (StackItem->LoopTopLine->cmdnum) + { + case C_DEF: + case C_FUNCTION: + case C_SUB: + /* we have found a FUNCTION or SUB boundary */ + { + VariableType *variable; + + for (variable = StackItem->local_variable; variable != NULL; + variable = variable->next) + { + if (variable->dimensions == dimensions) + { + if (bwb_stricmp (variable->name, buffer) == 0) + { + /* FOUND */ + return variable; + } + } + } + } + /* we have checked all the way to a FUNCTION or SUB boundary */ + /* NOT FOUND */ + return NULL; + /* break; */ + } + } + } + } + /* NOT FOUND */ + return NULL; +} + +/*************************************************************** + + FUNCTION: bwb_vars() + + DESCRIPTION: This function implements the Bywater- + specific debugging command VARS, which + gives a list of all variables defined + in memory. + +***************************************************************/ + + +LineType * +bwb_VARS (LineType * l) +{ + VariableType *variable; + + assert (l != NULL); + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + /* run through the variable list and print variables */ + + + fprintf (My->SYSOUT->cfp, "%-*s %-6s %-4s %s\n", NameLengthMax, "Name", + "Type", "Dims", "Value"); + + for (variable = My->VariableHead; variable != NULL; + variable = variable->next) + { + VariantType variant; + CLEAR_VARIANT (&variant); + + if (var_get (variable, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + if (variant.VariantTypeCode == StringTypeCode) + { + fprintf (My->SYSOUT->cfp, "%-*s %-6s %-4d %s\n", NameLengthMax, + variable->name, "STRING", variable->dimensions, + variant.Buffer); + } + else + { + FormatBasicNumber (variant.Number, My->NumLenBuffer); + fprintf (My->SYSOUT->cfp, "%-*s %-6s %-4d %s\n", NameLengthMax, + variable->name, "NUMBER", variable->dimensions, + My->NumLenBuffer); + } + RELEASE_VARIANT (&variant); + } + ResetConsoleColumn (); + return (l); +} + +/*************************************************************** + + FUNCTION: bwb_field() + + DESCRIPTION: This C function implements the BASIC + FIELD command. + +***************************************************************/ + +static void +field_clear (FieldType * Field) +{ + int i; + + assert (Field != NULL); + + Field->File = NULL; + Field->FieldOffset = 0; + Field->FieldLength = 0; + Field->Var = NULL; + for (i = 0; i < MAX_DIMS; i++) + { + Field->VINDEX[i] = 0; + } +} + +static FieldType * +field_new (void) +{ + /* search for an empty slot */ + FieldType *Field; + + assert( My != NULL ); + + for (Field = My->FieldHead; Field != NULL; Field = Field->next) + { + if (Field->File == NULL || Field->Var == NULL) + { + field_clear (Field); + return Field; + } + } + /* not found */ + if ((Field = calloc (1, sizeof (FieldType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + Field->next = My->FieldHead; + My->FieldHead = Field; + return Field; +} + +void +field_close_file (FileType * File) +{ + /* a CLOSE of a file is in progress, release associated fields */ + FieldType *Field; + + assert (File != NULL); + assert( My != NULL ); + + for (Field = My->FieldHead; Field != NULL; Field = Field->next) + { + if (Field->File == File) + { + Field->File = NULL; + Field->Var = NULL; + } + } +} +void +field_free_variable (VariableType * Var) +{ + /* an ERASE of a variable is in progress, release associated fields */ + FieldType *Field; + + assert (Var != NULL); + assert( My != NULL ); + + for (Field = My->FieldHead; Field != NULL; Field = Field->next) + { + if (Field->Var == Var) + { + Field->File = NULL; + Field->Var = NULL; + } + } +} + + +void +field_get (FileType * File) +{ + /* a GET of the RANDOM file is in progress, update variables from FILE buffer */ + FieldType *Field; + + assert( My != NULL ); + + if (File == NULL) + { + WARN_BAD_FILE_NUMBER; + return; + } + if (File->buffer == NULL) + { + WARN_BAD_FILE_MODE; + return; + } + for (Field = My->FieldHead; Field != NULL; Field = Field->next) + { + if (Field->File == File && Field->Var != NULL) + { + /* from file to variable */ + VariantType variant; + CLEAR_VARIANT (&variant); + + if (Field->FieldOffset < 0) + { + WARN_FIELD_OVERFLOW; + return; + } + if (Field->FieldLength <= 0) + { + WARN_FIELD_OVERFLOW; + return; + } + if ((Field->FieldOffset + Field->FieldLength) > File->width) + { + WARN_FIELD_OVERFLOW; + return; + } + variant.VariantTypeCode = StringTypeCode; + variant.Length = Field->FieldLength; + if ((variant.Buffer = + (char *) calloc (variant.Length + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return; + } + /* if( TRUE ) */ + { + int i; + + for (i = 0; i < Field->Var->dimensions; i++) + { + Field->Var->VINDEX[i] = Field->VINDEX[i]; + } + } + /* if( TRUE ) */ + { + int i; + char *Buffer; + + Buffer = File->buffer; + Buffer += Field->FieldOffset; + for (i = 0; i < variant.Length; i++) + { + variant.Buffer[i] = Buffer[i]; + } + variant.Buffer[variant.Length] = NulChar; + } + if (var_set (Field->Var, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return; + } + RELEASE_VARIANT (&variant); + } + } +} +void +field_put (FileType * File) +{ + /* a PUT of the RANDOM file is in progress, update FILE buffer from variables */ + FieldType *Field; + + assert( My != NULL ); + + if (File == NULL) + { + WARN_BAD_FILE_NUMBER; + return; + } + if (File->buffer == NULL) + { + WARN_BAD_FILE_MODE; + return; + } + for (Field = My->FieldHead; Field != NULL; Field = Field->next) + { + if (Field->File == File && Field->Var != NULL) + { + /* from variable to file */ + VariantType variant; + CLEAR_VARIANT (&variant); + + if (Field->FieldOffset < 0) + { + WARN_FIELD_OVERFLOW; + return; + } + if (Field->FieldLength <= 0) + { + WARN_FIELD_OVERFLOW; + return; + } + if ((Field->FieldOffset + Field->FieldLength) > File->width) + { + WARN_FIELD_OVERFLOW; + return; + } + /* if( TRUE ) */ + { + int i; + + for (i = 0; i < Field->Var->dimensions; i++) + { + Field->Var->VINDEX[i] = Field->VINDEX[i]; + } + } + if (var_get (Field->Var, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return; + } + if (variant.VariantTypeCode != StringTypeCode) + { + WARN_TYPE_MISMATCH; + return; + } + /* if( TRUE ) */ + { + int i; + int n; + char *Buffer; + + i = 0; + n = 0; + Buffer = File->buffer; + Buffer += Field->FieldOffset; + + if (variant.Buffer != NULL) + { + n = MIN (variant.Length, Field->FieldLength); + } + for (i = 0; i < n; i++) + { + Buffer[i] = variant.Buffer[i]; + } + for (i = n; i < Field->FieldLength; i++) + { + /* Pad on the right with spaces */ + Buffer[i] = ' '; + } + } + RELEASE_VARIANT (&variant); + } + } +} + + +LineType * +bwb_FIELD (LineType * l) +{ + FileType *File; + int FileNumber; + int FieldOffset; + + assert (l != NULL); + + FileNumber = 0; + FieldOffset = 0; + + /* first read device number */ + if (line_skip_FilenumChar (l)) + { + /* optional */ + } + if (line_read_integer_expression (l, &FileNumber) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (FileNumber <= 0) + { + /* FIELD # 0 is an error */ + WARN_BAD_FILE_NUMBER; + return (l); + } + File = find_file_by_number (FileNumber); + if (File == NULL) + { + WARN_BAD_FILE_NUMBER; + return (l); + } + if (File->DevMode != DEVMODE_RANDOM) + { + WARN_BAD_FILE_MODE; + return (l); + } + /* loop to read variables */ + + + /* read the comma and advance beyond it */ + while (line_skip_seperator (l)) + { + int FieldLength; + VariableType *variable; + VariantType variant; + + CLEAR_VARIANT (&variant); + + /* first find the size of the field */ + FieldLength = 0; + if (line_read_integer_expression (l, &FieldLength) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + if (FieldLength <= 0) + { + WARN_SYNTAX_ERROR; + return (l); + } + + /* read the AS */ + if (line_skip_word (l, "AS") == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + /* read the string variable name */ + if ((variable = line_read_scalar (l)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + + if (VAR_IS_STRING (variable)) + { + /* OK */ + } + else + { + WARN_TYPE_MISMATCH; + return (l); + } + /* check for overflow of record length */ + if ((FieldOffset + FieldLength) > File->width) + { + WARN_FIELD_OVERFLOW; + return (l); + } + /* set buffer */ + variant.VariantTypeCode = StringTypeCode; + /* if( TRUE ) */ + { + FieldType *Field; + int i; + + Field = field_new (); + if (Field == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + Field->File = File; + Field->FieldOffset = FieldOffset; + Field->FieldLength = FieldLength; + Field->Var = variable; + for (i = 0; i < variable->dimensions; i++) + { + Field->VINDEX[i] = variable->VINDEX[i]; + } + variant.Length = FieldLength; + if ((variant.Buffer = + (char *) calloc (variant.Length + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + WARN_OUT_OF_MEMORY; + return (l); + } + bwb_memset (variant.Buffer, ' ', variant.Length); + variant.Buffer[variant.Length] = NulChar; + } + if (var_set (variable, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + RELEASE_VARIANT (&variant); + FieldOffset += FieldLength; + } + /* return */ + return (l); +} + +/*************************************************************** + + FUNCTION: bwb_lset() + + DESCRIPTION: This C function implements the BASIC + LSET command. + + SYNTAX: LSET string-variable$ = expression + +***************************************************************/ + +LineType * +bwb_LSET (LineType * l) +{ + + assert (l != NULL); + return dio_lrset (l, FALSE); +} + +/*************************************************************** + + FUNCTION: bwb_rset() + + DESCRIPTION: This C function implements the BASIC + RSET command. + + SYNTAX: RSET string-variable$ = expression + +***************************************************************/ + +LineType * +bwb_RSET (LineType * l) +{ + + assert (l != NULL); + return dio_lrset (l, TRUE); +} + +/*************************************************************** + + FUNCTION: dio_lrset() + + DESCRIPTION: This C function implements the BASIC + RSET and LSET commands. + +***************************************************************/ + +static LineType * +dio_lrset (LineType * l, int rset) +{ + /* LSET and RSET */ + VariantType variant; + int n; + int i; + int startpos; + VariableType *v; + VariantType t; + VariantType *T; + + assert (l != NULL); + + T = &t; + CLEAR_VARIANT (T); + CLEAR_VARIANT (&variant); + /* get the variable */ + if ((v = line_read_scalar (l)) == NULL) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + if (VAR_IS_STRING (v) == FALSE) + { + WARN_TYPE_MISMATCH; + return (l); + } + + /* skip the equals sign */ + if (line_skip_EqualChar (l) == FALSE) + { + WARN_SYNTAX_ERROR; + return (l); + } + + /* get the value */ + if (line_read_expression (l, T) == FALSE) /* dio_lrset */ + { + WARN_SYNTAX_ERROR; + return (l); + } + if (T->VariantTypeCode != StringTypeCode) + { + WARN_TYPE_MISMATCH; + return (l); + } + if (var_get (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* determine starting position */ + startpos = 0; + if (rset == TRUE && T->Length < variant.Length) + { + /* + LET A$ = "123_456" ' variant.Length = 7 + LET B$ = "789" ' T->Length = 3 + RSET A$ = B$ ' startpos = 4 + PRINT "[";A$;"]" ' [123_789] + */ + startpos = variant.Length - T->Length; + } + /* write characters to new position */ + for (n = startpos, i = 0; + (n < (int) variant.Length) && (i < (int) T->Length); n++, i++) + { + variant.Buffer[n] = T->Buffer[i]; + } + if (var_set (v, &variant) == FALSE) + { + WARN_VARIABLE_NOT_DECLARED; + return (l); + } + /* OK */ + RELEASE_VARIANT (T); + RELEASE_VARIANT (&variant); + + return (l); +} + +/* EOF */ diff --git a/bwbasic.c b/bwbasic.c new file mode 100644 index 0000000..4549495 --- /dev/null +++ b/bwbasic.c @@ -0,0 +1,3639 @@ +/*************************************************************** + + bwbasic.c Main Program File + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + +static void break_handler (void); +static void break_mes (int x); +static int bwb_init (void); +static void bwb_initialize_warnings (void); +static void bwb_interact (void); +static int bwb_ladd (char *buffer, LineType * p, int IsUser); +static void bwb_single_step (char *buffer); +static void bwb_xtxtline (char *buffer); +static int bwx_signon (void); +static void execute_profile (char *FileName); +static void execute_program (char *FileName); +static char *FindClassicStatementEnd (char *C); +static int FixQuotes (char *tbuf); +static void ImportClassicIfThenElse (char *InBuffer); +static int is_ln (char *buffer); +static int is_numconst (char *buffer); +static void mark_preset_variables (void); +static FILE *nice_open (char *BaseName); +static void process_basic_line (char *buffer); + +GlobalType *My = NULL; + +static char *Banner[] = { + "######## ## ## ## ## ### ######## ######## ######## ", + "## ## ## ## ## ## ## ## ## ## ## ## ## ", + "## ## #### ## ## ## ## ## ## ## ## ## ", + "######## ## ## ## ## ## ## ## ###### ######## ", + "## ## ## ## ## ## ######### ## ## ## ## ", + "## ## ## ## ## ## ## ## ## ## ## ## ", + "######## ## ### ### ## ## ## ######## ## ## ", + " ", + " ", + " ######## ### ###### #### ###### ", + " ## ## ## ## ## ## ## ## ##", + " ## ## ## ## ## ## ## ", + " ######## ## ## ###### ## ## ", + " ## ## ######### ## ## ## ", + " ## ## ## ## ## ## ## ## ##", + " ######## ## ## ###### #### ###### ", + " ", + "Bywater BASIC Interpreter, version 3.20 ", + "Copyright (c) 1993, Ted A. Campbell ", + "Copyright (c) 1995-1997, Jon B. Volkoff ", + "Copyright (c) 2014-2017, Howard Wulf, AF5NE ", + " ", + NULL +}; + +#define NUM_WARNINGS 80 + +static char *ERROR4[NUM_WARNINGS]; + +static void +bwb_initialize_warnings (void) +{ + int i; + for (i = 0; i < NUM_WARNINGS; i++) + { + ERROR4[i] = NULL; + } + ERROR4[1] = "NEXT without FOR"; + ERROR4[2] = "Syntax error"; + ERROR4[3] = "RETURN without GOSUB"; + ERROR4[4] = "Out of DATA"; + ERROR4[5] = "Illegal function call"; + ERROR4[6] = "Overflow"; + ERROR4[7] = "Out of memory"; + ERROR4[8] = "Undefined line"; + ERROR4[9] = "Subscript out of range"; + ERROR4[10] = "Redimensioned array"; + ERROR4[11] = "Division by zero"; + ERROR4[12] = "Illegal direct"; + ERROR4[13] = "Type mismatch"; + ERROR4[14] = "Out of string space"; + ERROR4[15] = "String too long"; + ERROR4[16] = "String formula too complex"; + ERROR4[17] = "Can't continue"; + ERROR4[18] = "Undefined user function"; + ERROR4[19] = "No RESUME"; + ERROR4[20] = "RESUME without error"; + ERROR4[21] = "Unprintable error"; + ERROR4[22] = "Missing operand"; + ERROR4[23] = "Line buffer overflow"; + ERROR4[26] = "FOR without NEXT"; + ERROR4[27] = "Bad DATA"; + ERROR4[29] = "WHILE without WEND"; + ERROR4[30] = "WEND without WHILE"; + ERROR4[31] = "EXIT FUNCTION without FUNCTION"; + ERROR4[32] = "END FUNCTION without FUNCTION"; + ERROR4[33] = "EXIT SUB without SUB"; + ERROR4[34] = "END SUB without SUB"; + ERROR4[35] = "EXIT FOR without FOR"; + ERROR4[50] = "Field overflow"; + ERROR4[51] = "Internal error"; + ERROR4[52] = "Bad file number"; + ERROR4[53] = "File not found"; + ERROR4[54] = "Bad file mode"; + ERROR4[55] = "File already open"; + ERROR4[57] = "Disk I/O error"; + ERROR4[58] = "File already exists"; + ERROR4[61] = "Disk full"; + ERROR4[62] = "Input past end"; + ERROR4[63] = "Bad record number"; + ERROR4[64] = "Bad file name"; + ERROR4[66] = "Direct statement in file"; + ERROR4[67] = "Too many files"; + ERROR4[70] = "Variable Not Declared"; + ERROR4[73] = "Advanced Feature"; +} + +/*************************************************************** + + FUNCTION: bwx_terminate() + + DESCRIPTION: This function terminates program execution. + +***************************************************************/ + +void +bwx_terminate (void) +{ + + exit (0); +} + + + +/*************************************************************** + + FUNCTION: break_handler() + + DESCRIPTION: This function is called by break_mes() + and handles program interruption by break + (or by the STOP command). + +***************************************************************/ +static void +break_handler (void) +{ + /* + ** + ** + */ + assert( My != NULL ); + + My->AutomaticLineNumber = 0; + My->AutomaticLineIncrement = 0; + + if (My->IsInteractive) + { + /* INTERACTIVE: terminate program */ + + /* reset all stack counters */ + bwb_clrexec (); + SetOnError (0); + + My->ERR = -1; /* in break_handler() */ + + + /* reset the break handler */ + signal (SIGINT, break_mes); + + longjmp (My->mark, -1); + + + return; + } + /* NOT INTERACTIVE: terminate immediately */ + bwx_terminate (); +} + +/*************************************************************** + + FUNCTION: break_mes() + + DESCRIPTION: This function is called (a) by a SIGINT + signal or (b) by bwb_STOP via bwx_STOP. + It prints an error message then calls + break_handler() to terminate the program. + +***************************************************************/ + +static void +break_mes (int x /* Parameter 'x' is never used */ ) +{ + /* + ** + ** break_mes is FATAL. + ** x == SIGINT for control-C + ** x == 0 for bwx_STOP + ** + */ + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + assert( My->CurrentVersion != NULL ); + + + if (My->ERR < 0) /* in break_mes(), do not make a bad situation worse */ + { + /* an error has already ben reported */ + } + else + { + fputc ('\n', My->SYSOUT->cfp); + ResetConsoleColumn (); + if (My->CurrentVersion->OptionVersionValue & (C77)) + { + if (is_empty_string (My->ProgramFilename) == FALSE) + { + fprintf (My->SYSOUT->cfp, "FILE:%s, ", My->ProgramFilename); + } + } + fprintf (My->SYSOUT->cfp, "Program interrupted"); + if (My->ThisLine) /* break_mes */ + { + if (My->ThisLine->LineFlags & (LINE_USER)) /* break_mes */ + { + /* don't print the line number */ + } + else + { + fprintf (My->SYSOUT->cfp, " at line %d", My->ThisLine->number); /* break_mes */ + } + } + fputc ('\n', My->SYSOUT->cfp); + ResetConsoleColumn (); + fflush (My->SYSOUT->cfp); + } + break_handler (); +} + +extern void +bwx_STOP (int IsShowMessage) +{ + + if (IsShowMessage) + { + break_mes (0); + } + else + { + break_handler (); + } +} + +static int +bwx_signon (void) +{ + /* + ** + ** Display a sign-on banner. + ** NOT called if a file is provided on the command line. + ** + */ + int i; + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + + for (i = 0; Banner[i] != NULL; i++) + { + fprintf (My->SYSOUT->cfp, "%s\n", Banner[i]); + } + ResetConsoleColumn (); + return TRUE; +} + + + +DoubleType +bwx_TIMER (DoubleType Seconds) +{ + /* + ** + ** Return a number representing Seconds in the future. Seconds >= 0. + ** Seconds may be non-integer, such as 0.001 or 86399.999. The + ** maximum allowed Seconds is MAXDBL. This is used two ways: + ** + ** 1) in bwb_TIMER(), the ON TIMER count (>0) is used to determine + ** the expiration time. In this case, simply return what the value + ** will be in the future. Note that ON TIMER enforces + ** Seconds > (1 / CLOCKS_PER_SEC), and + ** + ** 2) in bwb_execline(), zero (=0) is used to determine the current + ** time and compare it to #1. In this case, simply return what the + ** value is now. + ** + ** Both the resolution of the timer, and the frequency of update, + ** are implementation defined. + ** + */ + + if (Seconds < 0) + { + WARN_INTERNAL_ERROR; + return 0; + } + else + { + DoubleType Result; + Result = clock (); + assert (CLOCKS_PER_SEC > 0); + Result /= CLOCKS_PER_SEC; + if (Seconds > 0) + { + Result += Seconds; + } + return Result; + } +} + +void +CleanLine (char *buffer) +{ + /* + ** + ** cleanup the line, so it is easier to parse + ** + */ + char *newbuffer; + + + + if (is_empty_string (buffer)) + { + /* do nothing */ + return; + } + + /* remove CR/LF */ + newbuffer = bwb_strchr (buffer, '\r'); + if (newbuffer != NULL) + { + *newbuffer = NulChar; + } + newbuffer = bwb_strchr (buffer, '\n'); + if (newbuffer != NULL) + { + *newbuffer = NulChar; + } + + /* remove ALL embedded control characters */ + /* if you want a control character, then use CHR$ */ + newbuffer = buffer; + while (*newbuffer != NulChar) + { + if (bwb_isprint (*newbuffer)) + { + /* OK */ + } + else + { + *newbuffer = ' '; + } + newbuffer++; + } + /* LTRIM$ */ + newbuffer = buffer; + if (*newbuffer != NulChar) + { + /* not an empty line, so remove one (or more) leading spaces */ + while (*newbuffer == ' ') + { + newbuffer++; + } + if (newbuffer > buffer) + { + bwb_strcpy (buffer, newbuffer); + } + } + /* RTRIM$ */ + newbuffer = buffer; + if (*newbuffer != NulChar) + { + /* not an empty line, so remove one (or more) trailing spaces */ + char *E; + + E = bwb_strchr (newbuffer, NulChar); + E--; + while (E >= newbuffer && *E == ' ') + { + *E = NulChar; + E--; + } + } +} + +static int +bwb_init (void) +{ + /* + ** + ** initialize Bywater BASIC + ** + */ + int n; + static char start_buf[] = ""; + static char end_buf[] = ""; + + /* Memory allocation */ + if ((My = (GlobalType *) calloc (1, sizeof (GlobalType))) == NULL) + { + return FALSE; + } + if ((My->MaxLenBuffer = + (char *) calloc (MAXLEN + 1 /* NulChar */ , sizeof (char))) == NULL) + { + return FALSE; + } + if ((My->NumLenBuffer = + (char *) calloc (NUMLEN + 1 /* NulChar */ , sizeof (char))) == NULL) + { + return FALSE; + } + if ((My->ConsoleOutput = + (char *) calloc (MAX_LINE_LENGTH + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + return FALSE; + } + if ((My->ConsoleInput = + (char *) calloc (MAX_LINE_LENGTH + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + return FALSE; + } + if ((My->SYSIN = (FileType *) calloc (1, sizeof (FileType))) == NULL) + { + return FALSE; + } + if ((My->SYSOUT = (FileType *) calloc (1, sizeof (FileType))) == NULL) + { + return FALSE; + } + if ((My->SYSPRN = (FileType *) calloc (1, sizeof (FileType))) == NULL) + { + return FALSE; + } + if ((My->StartMarker = (LineType *) calloc (1, sizeof (LineType))) == NULL) + { + return FALSE; + } + if ((My->UserMarker = (LineType *) calloc (1, sizeof (LineType))) == NULL) + { + return FALSE; + } + if ((My->EndMarker = (LineType *) calloc (1, sizeof (LineType))) == NULL) + { + return FALSE; + } + if ((My->EndMarker = (LineType *) calloc (1, sizeof (LineType))) == NULL) + { + return FALSE; + } + if ((My->ERROR4 = + (char *) calloc (MAX_ERR_LENGTH + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + return FALSE; + } + + My->CurrentVersion = &bwb_vertable[0]; + My->IsInteractive = TRUE; + My->OptionSleepDouble = 1; + My->OptionIndentInteger = 2; + My->OptionTerminalType = C_OPTION_TERMINAL_NONE; + My->OptionRoundType = C_OPTION_ROUND_BANK; + My->NextValidLineNumber = MINLIN; + My->IncludeLevel = 0; /* %INCLUDE */ + My->IsCommandLineFile = FALSE; + My->ExternalInputFile = NULL; /* for automated testing, --TAPE command line parameter */ + My->IsPrinter = FALSE; /* CBASIC-II: CONSOLE and LPRINTER commands */ + My->OptionPromptString = DEF_PROMPT; + My->OptionEditString = DEF_EDITOR; + My->OptionFilesString = DEF_FILES; + My->OptionRenumString = DEF_RENUM; + My->OptionExtensionString = DEF_EXTENSION; + My->OptionScaleInteger = 0; + My->OptionDigitsInteger = SIGNIFICANT_DIGITS; + My->OptionZoneInteger = ZONE_WIDTH; + My->UseParameterString = NULL; + My->ProgramFilename = NULL; + + My->StartMarker->number = MINLIN - 1; + My->StartMarker->next = My->EndMarker; + My->StartMarker->position = 0; + My->StartMarker->buffer = start_buf; + + My->EndMarker->number = MAXLIN + 1; + My->EndMarker->next = My->EndMarker; + My->EndMarker->position = 0; + My->EndMarker->buffer = end_buf; + + My->UserMarker->number = MINLIN - 1; + My->UserMarker->next = My->EndMarker; + My->UserMarker->position = 0; + My->UserMarker->buffer = NULL; + + My->DataLine = My->EndMarker; + My->DataPosition = 0; + + My->StackHead = NULL; + My->StackDepthInteger = 0; + + My->FieldHead = NULL; + + My->VirtualHead = NULL; + My->FileHead = NULL; + My->ThisLine = My->StartMarker; /* bwb_init */ + + My->SYSIN->DevMode = DEVMODE_INPUT; + My->SYSIN->width = 80; + My->SYSIN->col = 1; + My->SYSIN->row = 1; + My->SYSIN->delimit = ','; + My->SYSIN->cfp = stdin; + + My->SYSOUT->DevMode = DEVMODE_OUTPUT; + My->SYSOUT->width = 80; + My->SYSOUT->col = 1; + My->SYSOUT->row = 1; + My->SYSOUT->delimit = ','; + My->SYSOUT->cfp = stdout; + + My->SYSPRN->DevMode = DEVMODE_OUTPUT; + My->SYSPRN->width = 80; + My->SYSPRN->col = 1; + My->SYSPRN->row = 1; + My->SYSPRN->delimit = ','; + My->SYSPRN->cfp = stderr; + + My->LPRINT_NULLS = 0; + My->SCREEN_ROWS = 24; + + /* OPEN #0 is an ERROR. */ + /* CLOSE #0 is an ERROR. */ + /* WIDTH #0, 80 is the same as WIDTH 80. */ + /* LPRINT and LLIST are sent to bwx_LPRINT() */ + + /* default variable type */ + for (n = 0; n < 26; n++) + { + My->DefaultVariableType[n] = DoubleTypeCode; + } + /* default COMMAND$(0-9) */ + for (n = 0; n < 10; n++) + { + My->COMMAND4[n] = NULL; + } + + /* initialize tables of variables, functions */ + bwb_initialize_warnings (); + SortAllCommands (); + SortAllFunctions (); + SortAllOperators (); + var_init (); + IntrinsicFunction_init (); + UserFunction_init (); + OptionVersionSet (0); + /* OK */ + return TRUE; +} + +/*************************************************************** + + FUNCTION: main() + + DESCRIPTION: As in any C program, main() is the basic + function from which the rest of the + program is called. Some environments, + however, provide their own main() functions + (Microsoft Windows (tm) is an example). + In these cases, the following code will + have to be included in the initialization + function that is called by the environment. + +***************************************************************/ + +static void +process_basic_line (char *buffer) +{ + CleanLine (buffer); + if (is_empty_string (buffer)) + { + /* empty -- do nothing */ + } + else if (is_ln (buffer) == FALSE) + { + /* If there is no line number, then execute the line as received */ + /* RUN */ + WARN_CLEAR; /* process_basic_line */ + SetOnError (0); + bwb_xtxtline (buffer); /* process_basic_line */ + } + else if (is_numconst (buffer) == TRUE) + { + /*-----------------------------------------------------------------*/ + /* Another possibility: if buffer is a numeric constant, */ + /* then delete the indicated line number (JBV) */ + /*-----------------------------------------------------------------*/ + /* 100 */ + int LineNumber; + LineNumber = atoi (buffer); + WARN_CLEAR; /* process_basic_line */ + SetOnError (0); + sprintf (buffer, "delete %d", LineNumber); + bwb_xtxtline (buffer); /* process_basic_line */ + } + else + { + /* If there is a line number, then add it to the BASIC program */ + /* 100 REM */ + bwb_ladd (buffer, My->StartMarker, FALSE); + } +} +static void +bwb_single_step (char *buffer) +{ + assert( My != NULL ); + assert (buffer != NULL); + + process_basic_line (buffer); + while (My->StackHead != NULL) + { + bwb_execline (); + } +} + +static void +mark_preset_variables (void) +{ + /* mark all existing variables as preset */ + /* this includes all variables declared in any PROFILE */ + VariableType *v; + assert( My != NULL ); + + + for (v = My->VariableHead; v != NULL; v = v->next) + { + v->VariableFlags |= VARIABLE_PRESET; + v->VariableFlags |= VARIABLE_COMMON; + } +} + + +static void +execute_profile (char *FileName) +{ + FILE *profile; + assert( My != NULL ); + assert (FileName != NULL); + + My->NextValidLineNumber = MINLIN; + profile = fopen (FileName, "r"); + if (profile == NULL) + { + /* NOT FOUND */ + /* OPTIONAL */ + return; + } + /* FOUND */ + if (My->IsInteractive) + { + /* + ** + ** set a buffer for jump: program execution returns to this point in + ** case of a jump (error, interrupt, or finish program) + ** + */ + My->program_run = 0; + signal (SIGINT, break_mes); + setjmp (My->mark); + if (My->program_run > 0) + { + /* error in PROFILE */ + exit (1); + } + My->program_run++; + } + + /* + The profile only exists to allow executing OPTION ... commands. No other use is supported. + */ + { + char *tbuf; + int tlen; + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + while (fgets (tbuf, tlen, profile)) /* execute_profile */ + { + tbuf[tlen] = NulChar; + bwb_single_step (tbuf); /* in execute_profile() */ + } + bwb_fclose (profile); + mark_preset_variables (); + } +} + + + +static void +execute_program (char *FileName) +{ + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + + assert (FileName != NULL); + + My->NextValidLineNumber = MINLIN; + My->IsCommandLineFile = TRUE; + if (bwb_fload (FileName) == FALSE) + { + fprintf (My->SYSOUT->cfp, "Failed to open file %s\n", FileName); + /* the file load has failed, so do NOT run the program */ + exit (1); + } + if (My->ERR < 0 /* in execute_program(), file load failed */ ) + { + /* the file load has failed, so do NOT run the program */ + exit (1); + } + bwb_RUN (My->StartMarker); +} + +extern int +main (int argc, char **argv) +{ + int i; + assert (argc >= 0); + assert (argv != NULL); + + if (bwb_init () == FALSE) + { + /* FATAL */ + puts ("Out of memory"); + return 1; + } + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + assert( My->SYSIN != NULL ); + assert( My->SYSIN->cfp != NULL ); + + /* Signon message banner */ + if (argc < 2) + { + /* no parameters */ + if (My->IsInteractive) + { + bwx_signon (); + } + else + { + /* if INTERACTIVE is FALSE, then we must have a program file */ + fputs ("Program file not specified\n", My->SYSOUT->cfp); + return 1; + } + } + + if (My->IsInteractive) + { + /* + ** + ** set a buffer for jump: program execution returns to this point in + ** case of a jump (error, interrupt, or finish program) + ** + */ + My->program_run = 0; + signal (SIGINT, break_mes); + setjmp (My->mark); + if (My->program_run > 0) + { + /* error in profile */ + return 1; + } + My->program_run++; + } + +#if PROFILE + execute_profile (PROFILENAME); +#endif + + /* check to see if there is a program file: but do this only the first time around! */ + for (i = 1; i < argc; i++) + { + /* + SYNTAX: bwbasic [ --profile profile.bas ] [ --tape tapefile.inp ] [ program.bas ] + */ + if (bwb_stricmp (argv[i], "--profile") == 0 + || bwb_stricmp (argv[i], "-p") == 0 + || bwb_stricmp (argv[i], "/profile") == 0 + || bwb_stricmp (argv[i], "/p") == 0) + { + i++; + if (i < argc) + { + /* --profile profile.bas */ + execute_profile (argv[i]); + } + } + else + if (bwb_stricmp (argv[i], "--tape") == 0 + || bwb_stricmp (argv[i], "-t") == 0 + || bwb_stricmp (argv[i], "/tape") == 0 + || bwb_stricmp (argv[i], "/t") == 0) + { + i++; + if (i < argc) + { + /* --tape tapefile.inp */ + My->ExternalInputFile = fopen (argv[i], "r"); + } + } + else + { + /* program.bas */ + { + int j; + int n; + + j = i; + for (n = 0; n < 10 && j < argc; n++, j++) + { + My->COMMAND4[n] = argv[j]; + } + } + execute_program (argv[i]); + break; + } + } + + if (My->IsInteractive) + { + /* + ** + ** set a buffer for jump: program execution returns to this point in + ** case of a jump (error, interrupt, or finish program) + ** + */ + My->program_run = 0; + signal (SIGINT, break_mes); + setjmp (My->mark); + if (My->program_run > 0) + { + /* error in console mode */ + } + My->program_run++; + } + + /* main program loop */ + My->NextValidLineNumber = MINLIN; + while (!feof (My->SYSIN->cfp)) /* condition !feof( My->SYSIN->cfp ) added in v1.11 */ + { + bwb_mainloop (); + } + + bwx_terminate (); /* allow ^D (Unix) exit with grace */ + + return 0; +} + + + +/*************************************************************** + + FUNCTION: bwb_interact() + + DESCRIPTION: This function gets a line from the user + and processes it. + +***************************************************************/ + +static void +bwb_interact (void) +{ + char *tbuf; + int tlen; + assert( My != NULL ); + + + tbuf = My->ConsoleInput; + tlen = MAX_LINE_LENGTH; + My->NextValidLineNumber = MINLIN; + /* take input from keyboard */ + if (My->AutomaticLineNumber > 0 && My->AutomaticLineIncrement > 0) + { + /* AUTO 100, 10 */ + char *zbuf; /* end of the prompt, start of the response */ + int zlen; /* length of the prompt */ + char LineExists; + LineType *l; + + LineExists = ' '; + for (l = My->StartMarker->next; l != My->EndMarker; l = l->next) + { + if (l->number == My->AutomaticLineNumber) + { + /* FOUND */ + LineExists = '*'; + break; + } + else if (l->number > My->AutomaticLineNumber) + { + /* NOT FOUND */ + LineExists = ' '; + break; + } + } + sprintf (tbuf, "%d%c", My->AutomaticLineNumber, LineExists); + zbuf = bwb_strchr (tbuf, NulChar); + zlen = bwb_strlen (tbuf); + bwx_input (tbuf, FALSE, zbuf, tlen - zlen); + zbuf[-1] = ' '; /* remove LineExists indicator */ + CleanLine (zbuf); /* JBV */ + if (is_empty_string (zbuf)) + { + /* empty response */ + if (LineExists == '*') + { + /* + An empty response with an existing line, + causes AUTO to continue with the next line, + leaving the current line intact. + */ + My->AutomaticLineNumber += My->AutomaticLineIncrement; + } + else + { + /* + An empty response with a non-existing line, + causes AUTO to terminate. + */ + My->AutomaticLineNumber = 0; + My->AutomaticLineIncrement = 0; + } + } + else + { + /* non-empty response */ + if (bwb_stricmp (zbuf, "MAN") == 0) + { + /* MAN terminates AUTO mode */ + My->AutomaticLineNumber = 0; + My->AutomaticLineIncrement = 0; + } + else + { + /* overwrite any existing line */ + bwb_ladd (tbuf, My->StartMarker, FALSE); + My->AutomaticLineNumber += My->AutomaticLineIncrement; + } + } + } + else + { + bwx_input (My->OptionPromptString, FALSE, tbuf, tlen); + process_basic_line (tbuf); + } +} + + + +/*************************************************************** + + FUNCTION: bwb_fload() + + DESCRIPTION: This function loads a BASIC program + file into memory given a FILE pointer. + +***************************************************************/ + +static int +FixQuotes (char *tbuf) +{ + /* fix unbalanced quotes */ + /* 'tbuf' shall be declared "char tbuf[ tlen + 1]". */ + int p; + int QuoteCount; + int tlen; + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + assert (tbuf != NULL); + + QuoteCount = 0; + tlen = MAX_LINE_LENGTH; + tbuf[tlen] = NulChar; + p = 0; + while (tbuf[p]) + { + if (tbuf[p] == My->CurrentVersion->OptionQuoteChar) + { + QuoteCount++; + } + p++; + } + if (QuoteCount & 1) + { + /* odd == missing trailing quote */ + if (p < tlen) + { + /* we have room to put the missig quote */ + tbuf[p] = My->CurrentVersion->OptionQuoteChar; + p++; + tbuf[p] = NulChar; + } + else + { + /* we cannot fix it */ + return FALSE; + } + } + /* OK */ + return TRUE; +} + +static FILE * +nice_open (char *BaseName) +{ + FILE *file; + assert( My != NULL ); + + if (BaseName == NULL) + { + BaseName = My->ProgramFilename; + } + if (is_empty_string (BaseName)) + { + WARN_BAD_FILE_NAME; + return NULL; + } + + file = fopen (BaseName, "r"); + if (file == NULL) + if (is_empty_string (My->OptionExtensionString) == FALSE) + { + char *FileName; + + FileName = bwb_strdup2 (BaseName, My->OptionExtensionString); + if (FileName == NULL) + { + WARN_OUT_OF_MEMORY; + return NULL; + } + file = fopen (FileName, "r"); + if (file == NULL) + { + free (FileName); + } + else if (BaseName == My->ProgramFilename) + { + if (My->ProgramFilename != NULL) + { + free (My->ProgramFilename); + } + My->ProgramFilename = FileName; + } + } + return file; +} + +extern int +bwb_fload (char *FileName) +{ + /* + ** + ** Load a BASIC program from the specified 'FileName'. + ** If 'FileName' is NULL, then load from My->ProgramFilename, + ** + */ + char *Magic_Word; /* SYNTAX: %INCLUDE literal.file.name */ + int Magic_Length; + FILE *file; + char *tbuf; + int tlen; + + + + + Magic_Word = "%INCLUDE "; /* SYNTAX: %INCLUDE literal.file.name */ + Magic_Length = bwb_strlen (Magic_Word); + tbuf = My->MaxLenBuffer; + tlen = MAXLEN; + + + /* + Just in case you are wondering... + Although this handles the most common cases, it does not handle all possible cases. + The correct solution is to provide the actual filename (with extension), + as it exists in the operating system. + */ + file = nice_open (FileName); + if (file == NULL) + { + WARN_BAD_FILE_NAME; + return FALSE; + } + My->NextValidLineNumber = MINLIN; + while (fgets (tbuf, tlen, file)) /* bwb_fload */ + { + tbuf[tlen] = NulChar; + CleanLine (tbuf); + if (is_empty_string (tbuf)) + { + /* ignore */ + } + else if (bwb_strnicmp (tbuf, Magic_Word, Magic_Length) == 0) + { + /* %iNCLUDE */ + int Result; + int p; + char varname[NameLengthMax + 1]; + + p = Magic_Length; + if (buff_read_varname (tbuf, &p, varname) == FALSE) + { + fprintf (My->SYSOUT->cfp, "%s Filename\n", Magic_Word); + ResetConsoleColumn (); + return FALSE; + } + My->IncludeLevel++; /* %INCLUDE */ + Result = bwb_fload (varname); + My->IncludeLevel--; /* %INCLUDE */ + if (Result == FALSE) + { + fprintf (My->SYSOUT->cfp, "%s %s Failed\n", Magic_Word, varname); + ResetConsoleColumn (); + return FALSE; + } + } + else + { + /* normal */ + bwb_ladd (tbuf, My->StartMarker, FALSE); + } + } + + /* close file stream */ + + bwb_fclose (file); /* file != NULL */ + + My->NextValidLineNumber = MINLIN; + + return TRUE; +} + + +static char * +FindClassicStatementEnd (char *C) +{ + /* + ** find the end of the current statement + */ + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + + assert (C != NULL); + + + if (My->CurrentVersion->OptionStatementChar == NulChar + && My->CurrentVersion->OptionCommentChar == NulChar) + { + /* DO NOTHING: Multi-statment lines are not possible */ + return NULL; + } + /* skip line number */ + while (bwb_isdigit (*C)) + { + C++; + } + /* skip spaces */ + while (*C == ' ') + { + C++; + } + if (IS_CHAR (*C, My->CurrentVersion->OptionCommentChar)) + { + /* The entire line is a comment */ + return NULL; + } + if (bwb_strnicmp (C, "REM", 3) == 0) + { + /* The entire line is a comment */ + return NULL; + } + if ((My->CurrentVersion->OptionFlags & OPTION_LABELS_ON) + && (My->CurrentVersion->OptionStatementChar != NulChar)) + { + /* determine if this line is a LABEL */ + int p; + char label[NameLengthMax + 1]; + + p = 0; + if (buff_read_label (C, &p, label)) + { + if (buff_skip_char (C, &p, My->CurrentVersion->OptionStatementChar)) + { + if (buff_is_eol (C, &p)) + { + /* The entire line is a label */ + /* LABEL : \0 */ + return NULL; + } + } + } + } + /* not a special case, so split on the first unquoted OptionCommentChar or OptionStatementChar */ + while (*C != NulChar) + { + if (*C == My->CurrentVersion->OptionQuoteChar) + { + /* skip leading quote */ + C++; + while (*C != NulChar && *C != My->CurrentVersion->OptionQuoteChar) + { + /* skip string constant */ + C++; + } + if (*C == My->CurrentVersion->OptionQuoteChar) + { + /* skip trailing quote */ + C++; + } + } + else if (IS_CHAR (*C, My->CurrentVersion->OptionCommentChar) /* ', ! */ ) + { + /* FOUND */ + return C; + } + else + if (IS_CHAR (*C, My->CurrentVersion->OptionStatementChar) /* :, \ */ ) + { + /* FOUND */ + return C; + } + else + { + C++; + } + } + /* NOT FOUND */ + return NULL; +} + + +static void +ImportClassicIfThenElse (char *InBuffer) +{ +/* +** +** Determine the type of IF command: +** +** a) STANDARD: +** IF x THEN line ELSE line +** +** b) CLASSIC: +** IF x THEN stmt(s) ELSE stmt(s) +** +** c) STRUCTURED: +** IF x THEN +** stmts +** ELSE +** stmts +** END IF +** +** The STANDARD and STRUCTURED forms +** are natively supported. +** +** The CLASSIC form is converted to +** the STRUCTURED form. +** +*/ + + int i; + + int nIF = 0; + int nTHEN = 0; + int nELSE = 0; + int nENDIF = 0; + +#define NO_COMMAND 0 +#define IF_COMMAND 1 +#define THEN_COMMAND 2 +#define ELSE_COMMAND 3 +#define ENDIF_COMMAND 4 + int LastCommand = NO_COMMAND; + + const char *REM = "REM "; + const char *IF = "IF "; + const char *THEN = "THEN "; + const char *THEN2 = "THEN"; + const char *ELSE = "ELSE "; + const char *ENDIF = "END IF"; + const char *GOTO = "GOTO "; + const char *DATA = "DATA "; + const char *CASE = "CASE "; + char *OutBuffer = My->ConsoleOutput; + char *Input; + char *Output; + char LastChar = My->CurrentVersion->OptionStatementChar; + + int REM_len = bwb_strlen (REM); + int IF_len = bwb_strlen (IF); + int THEN_len = bwb_strlen (THEN); + int THEN2_len = bwb_strlen (THEN2); + int ELSE_len = bwb_strlen (ELSE); + int ENDIF_len = bwb_strlen (ENDIF); + int GOTO_len = bwb_strlen (GOTO); + int DATA_len = bwb_strlen (DATA); + int CASE_len = bwb_strlen (CASE); + +#define OUTPUTCHAR( c ) { *Output = c; Output++; } +#define COPYCHAR { LastChar = *Input; *Output = *Input; Output++; Input++; } +#define COPY_LINENUMBER while( bwb_isdigit( *Input ) ) COPYCHAR; +#define COPY_SPACES while( *Input == ' ' ) COPYCHAR; +#define COPY_IF for( i = 0; i < IF_len; i++ ) COPYCHAR; +#define COPY_THEN for( i = 0; i < THEN_len; i++ ) COPYCHAR; +#define COPY_THEN2 for( i = 0; i < THEN2_len; i++ ) COPYCHAR; +#define COPY_ELSE for( i = 0; i < ELSE_len; i++ ) COPYCHAR; +#define COPY_ENDIF for( i = 0; i < ENDIF_len; i++ ) COPYCHAR; +#define FORCE_ENDIF for( i = 0; i < ENDIF_len; i++ ) OUTPUTCHAR( ENDIF[ i ] ); +#define FORCE_GOTO for( i = 0; i < GOTO_len; i++ ) OUTPUTCHAR( GOTO[ i ] ); +#define FORCE_COLON if( LastChar != My->CurrentVersion->OptionStatementChar ) OUTPUTCHAR( My->CurrentVersion->OptionStatementChar ); + + assert( My != NULL ); + assert( My->CurrentVersion != NULL ); + assert (InBuffer != NULL); + + + Input = InBuffer; + Output = OutBuffer; + + + + + + if (My->CurrentVersion->OptionStatementChar == NulChar) + { + /* DO NOTHING: All IFs must be STANDARD or STRUCTURED */ + return; + } + + + COPY_LINENUMBER; + COPY_SPACES; + LastChar = My->CurrentVersion->OptionStatementChar; + + + while (*Input != NulChar) + { + if (*Input == My->CurrentVersion->OptionCommentChar) + { + /* comment */ + break; + } + else if (*Input == My->CurrentVersion->OptionQuoteChar) + { + /* string constant */ + COPYCHAR; + while (*Input != NulChar + && *Input != My->CurrentVersion->OptionQuoteChar) + { + COPYCHAR; + } + if (*Input == My->CurrentVersion->OptionQuoteChar) + { + COPYCHAR; + } + else + { + /* add missing Quote */ + OUTPUTCHAR (My->CurrentVersion->OptionQuoteChar); + } + COPY_SPACES; + } + else if (bwb_isalnum (LastChar)) + { + /* can NOT be the start of a command */ + COPYCHAR; + } + else if (!bwb_isalpha (*Input)) + { + /* can NOT be the start of a command */ + COPYCHAR; + } + else if (bwb_strnicmp (Input, REM, REM_len) == 0) + { + break; + } + else if (bwb_strnicmp (Input, DATA, DATA_len) == 0) + { + /* DATA ... */ + break; + } + else if (bwb_strnicmp (Input, CASE, CASE_len) == 0) + { + /* CASE ... */ + break; + } + else if (bwb_strnicmp (Input, IF, IF_len) == 0) + { + /* IF */ + LastCommand = IF_COMMAND; + nIF++; + COPY_IF; + COPY_SPACES; + } + else if (bwb_strnicmp (Input, GOTO, GOTO_len) == 0 && nIF > nTHEN) + { + /* IF x GOTO line ELSE line */ + LastCommand = THEN_COMMAND; + nTHEN++; + COPY_THEN; + COPY_SPACES; + COPY_LINENUMBER; + COPY_SPACES; + if (bwb_strnicmp (Input, ELSE, ELSE_len) == 0) + { + /* ELSE line */ + COPY_ELSE; + COPY_SPACES; + COPY_LINENUMBER; + COPY_SPACES; + } + /* IS STANDARD, NOT CLASSIC */ + nENDIF++; + LastCommand = ENDIF_COMMAND; + } + else if (bwb_strnicmp (Input, THEN, THEN_len) == 0) + { + /* THEN */ + LastCommand = THEN_COMMAND; + nTHEN++; + COPY_THEN; + COPY_SPACES; + if (bwb_isdigit (*Input)) + { + /* STANDARD: IF x THEN line ELSE line */ + char *SavedInput; + char *SavedOutput; + SavedInput = Input; + SavedOutput = Output; + + COPY_LINENUMBER; + COPY_SPACES; + if (bwb_strnicmp (Input, ELSE, ELSE_len) == 0) + { + /* ELSE line */ + COPY_ELSE; + COPY_SPACES; + if (bwb_isdigit (*Input)) + { + COPY_LINENUMBER; + COPY_SPACES; + /* IS STANDARD, NOT CLASSIC */ + nENDIF++; + LastCommand = ENDIF_COMMAND; + } + else + { + /* IF x THEN line ELSE stmts */ + Input = SavedInput; + Output = SavedOutput; + FORCE_COLON; + FORCE_GOTO; + COPY_LINENUMBER; + COPY_SPACES; + } + } + else + { + /* IS STANDARD, NOT CLASSIC */ + nENDIF++; + LastCommand = ENDIF_COMMAND; + } + } + else + if (*Input == My->CurrentVersion->OptionCommentChar + || *Input == NulChar) + { + /* IS STRUCTURED, NOT CLASSIC */ + nENDIF++; + LastCommand = ENDIF_COMMAND; + } + else + { + /* CLASSIC: IF x THEN stmts ELSE stmts */ + } + FORCE_COLON; + } + else if (bwb_strnicmp (Input, THEN2, THEN2_len) == 0) + { + /* trailing THEN ? */ + char *PeekInput; + + PeekInput = Input; + PeekInput += THEN2_len; + while (*PeekInput == ' ') + { + PeekInput++; + } + if (*PeekInput == My->CurrentVersion->OptionCommentChar + || *PeekInput == NulChar) + { + /* IS STRUCTURED, NOT CLASSIC */ + nTHEN++; + COPY_THEN2; + nENDIF++; + LastCommand = ENDIF_COMMAND; + FORCE_COLON; + } + else + { + /* THEN line */ + } + } + else if (bwb_strnicmp (Input, ELSE, ELSE_len) == 0) + { + /* ELSE */ + if (LastCommand == ELSE_COMMAND) + { + /* we need an ENDIF here */ + FORCE_COLON; + FORCE_ENDIF; + FORCE_COLON; + nENDIF++; + } + LastCommand = ELSE_COMMAND; + nELSE++; + FORCE_COLON; + COPY_ELSE; + FORCE_COLON; + COPY_SPACES; + if (bwb_isdigit (*Input)) + { + /* IF x THEN stmts ELSE line */ + FORCE_GOTO; + COPY_LINENUMBER; + COPY_SPACES; + } + FORCE_COLON; + } + else if (bwb_strnicmp (Input, ENDIF, ENDIF_len) == 0) + { + /* ENDIF */ + LastCommand = ENDIF_COMMAND; + nENDIF++; + COPY_ENDIF; + FORCE_COLON; + } + else + { + /* was NOT the start of a command */ + COPYCHAR; + } + } + /* end of input */ + if (nENDIF < nIF) + { + while (nENDIF < nIF) + { + /* we need trailing ENDIF's */ + nENDIF++; + FORCE_COLON; + FORCE_ENDIF; + } + } + /* fixup trailing REMark command */ + if (bwb_strnicmp (Input, REM, REM_len) == 0) + { + /* REMark */ + /* 100 A=1 REMark */ + /* 100 A=1:REMark */ + /* 100 A=1'REMark */ + FORCE_COLON; + } + /* copy the comments */ + while (*Input != NulChar) + { + COPYCHAR; + /* cppcheck: (style) Variable 'LastChar' is assigned a value that is never used. */ + } + OUTPUTCHAR (NulChar); + bwb_strcpy (InBuffer, OutBuffer); +} + + +/*************************************************************** + + FUNCTION: bwb_ladd() + + DESCRIPTION: This function adds a new line (in the + buffer) to the program in memory. + +***************************************************************/ +static int +bwb_ladd (char *buffer, LineType * p, int IsUser) +{ + LineType *l; + LineType *previous; + char *newbuffer; + char *NextStatement; + char *ThisStatement; + int Replace; + char BreakChar; + + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + assert( My->CurrentVersion != NULL ); + assert (buffer != NULL); + assert (p != NULL); + + + Replace = TRUE; + BreakChar = NulChar; + CleanLine (buffer); + if (is_empty_string (buffer)) + { + /* silengtly ignore blank lines */ + return FALSE; + } + /* + from here, the line WILL be added so the user can EDIT it, + we just complain and refuse to run if any error is detected. + */ + My->IsScanRequired = TRUE; /* program needs to be scanned again */ + + /* AUTO-FIX UNBALANCED QUOTES */ + if (FixQuotes (buffer) == FALSE) + { + /* ERROR */ + fprintf (My->SYSOUT->cfp, "UNBALANCED QUOTES: %s\n", buffer); + ResetConsoleColumn (); + My->ERR = -1; /* bwb_ladd, UNBALANCED QUOTES */ + } + + if (IS_CHAR (*buffer, My->CurrentVersion->OptionStatementChar)) + { + /* part of a multi-statement line */ + } + else if (IS_CHAR (*buffer, My->CurrentVersion->OptionCommentChar)) + { + /* part of a multi-statement line */ + } + else + { + ImportClassicIfThenElse (buffer); + } + ThisStatement = buffer; + NextStatement = NULL; + BreakChar = NulChar; + + do + { + if (BreakChar == NulChar) + { + /* first pass thru the do{} while loop, do nothing */ + } + else if (IS_CHAR (BreakChar, My->CurrentVersion->OptionCommentChar)) + { + /* ThisStatment will turn out to be the last */ + *ThisStatement = My->CurrentVersion->OptionCommentChar; + } + else if (IS_CHAR (BreakChar, My->CurrentVersion->OptionStatementChar)) + { + /* we are NOT the last statement, skip over the OptionStatementChar */ + ThisStatement++; + } + else + { + /* Internal Error */ + } + + if (BreakChar == NulChar + && IS_CHAR (*buffer, My->CurrentVersion->OptionStatementChar)) + { + /* first pass thru and line begins with colon */ + /* part of a multi-statement line */ + NextStatement = NULL; + if (My->NextValidLineNumber > 1) + { + My->NextValidLineNumber--; + } + Replace = FALSE; + } + else + if (BreakChar == NulChar + && IS_CHAR (*buffer, My->CurrentVersion->OptionCommentChar)) + { + /* first pass thru and line begins with apostrophe */ + /* part of a multi-statement line */ + NextStatement = NULL; + if (My->NextValidLineNumber > 1) + { + My->NextValidLineNumber--; + } + Replace = FALSE; + } + else + { + NextStatement = FindClassicStatementEnd (ThisStatement); + } + + if (NextStatement == NULL) + { + /* we are the last statement */ + } + else + { + /* another statement follows */ + BreakChar = *NextStatement; + *NextStatement = NulChar; + } + CleanLine (ThisStatement); + if (is_empty_string (ThisStatement) == FALSE) + { + + /* get memory for this line */ + if ((l = (LineType *) calloc (1, sizeof (LineType))) == NULL) + { + /* ERROR */ + fprintf (My->SYSOUT->cfp, "Out of memory\n"); + ResetConsoleColumn (); + My->ERR = -1; /* bwb_ladd, Out of memory */ + return FALSE; + } + + /* this line has not been executed or numbered */ + l->LineFlags = 0; + if (IsUser) + { + l->LineFlags |= LINE_USER; + } + l->IncludeLevel = My->IncludeLevel; /* %INCLUDE */ + l->position = 0; + + /* + ** + ** ALL lines have a line number. + ** If a line number is not provided, + ** then the next available line number is assigned. + ** + */ + newbuffer = ThisStatement; + l->number = My->NextValidLineNumber; + + if (buff_read_line_number (newbuffer, &(l->position), &l->number)) + { + if (l->number < My->NextValidLineNumber) + { + /* ERROR */ + fprintf (My->SYSOUT->cfp, "%d < %d - LINE OUT OF ORDER: %s\n", + l->number, My->NextValidLineNumber, buffer); + ResetConsoleColumn (); + My->ERR = -1; /* bwb_ladd, LINE OUT OF ORDER */ + l->number = My->NextValidLineNumber; /* sane default */ + } + else if (l->number < MINLIN || l->number > MAXLIN) + { + /* ERROR */ + fprintf (My->SYSOUT->cfp, "INVALID LINE NUMBER: %s\n", buffer); + ResetConsoleColumn (); + My->ERR = -1; /* bwb_ladd, INVALID LINE NUMBER */ + l->number = My->NextValidLineNumber; /* sane default */ + } + else + { + /* OK */ + My->NextValidLineNumber = l->number; + l->LineFlags |= LINE_NUMBERED; /* line was manually numbered */ + } + /* A SPACE IS REQUIRED AFTER THE LINE NUMBER -- NO EXCEPTIONS */ + if (newbuffer[l->position] != ' ') + { + /* ERROR */ + fprintf (My->SYSOUT->cfp, "MISSING SPACE AFTER LINE NUMBER: %s\n", + buffer); + ResetConsoleColumn (); + My->ERR = -1; /* bwb_ladd, MISSING SPACE AFTER LINE NUMBER */ + } + /* newuffer does NOT contain the line number */ + newbuffer += l->position; + } + /* the next valid line number is this line number plus one */ + CleanLine (newbuffer); + if (*newbuffer != NulChar + && *newbuffer == My->CurrentVersion->OptionStatementChar) + { + /* this is part of a multi-statement line */ + newbuffer++; + CleanLine (newbuffer); + } + /* + ** + ** copy into the line buffer + ** + */ + if (l->buffer != NULL) + { + free (l->buffer); + l->buffer = NULL; /* JBV */ + } + if ((l->buffer = + (char *) calloc (bwb_strlen (newbuffer) + 1 /* NulChar */ , + sizeof (char))) == NULL) + { + /* ERROR */ + fprintf (My->SYSOUT->cfp, "Out of memory\n"); + ResetConsoleColumn (); + My->ERR = -1; /* bwb_ladd, Out of memory */ + return FALSE; /* we cannot determine the command */ + } + bwb_strcpy (l->buffer, newbuffer); + /* + ** + ** determine command + ** + */ + line_start (l); + if (l->cmdnum) + { + /* OK */ + } + else + { + /* ERROR */ + fprintf (My->SYSOUT->cfp, + "ILLEGAL COMMAND AFTER LINE NUMBER: %d %s\n", l->number, + l->buffer); + ResetConsoleColumn (); + My->ERR = -1; /* bwb_ladd, ILLEGAL COMMAND AFTER LINE NUMBER */ + } + /* + ** + ** add the line to the linked-list of lines + ** + */ + for (previous = p; previous != My->EndMarker; previous = previous->next) + { + if (previous->number == l->number) + { + if (Replace == TRUE) + { + /* REPLACE 'previous' */ + while (previous->number == l->number) + { + LineType *z; + + z = previous; + previous = previous->next; + bwb_freeline (z); + } + l->next = previous; + p->next = l; + + } + else + { + /* APPEND after 'previous' */ + while (previous->next->number == l->number) + { + previous = previous->next; + } + l->next = previous->next; + previous->next = l; + } + break; + } + else + if (previous->number < l->number + && l->number < previous->next->number) + { + /* INSERT BETWEEN 'previous' AND 'previous->next' */ + l->next = previous->next; + previous->next = l; + break; + } + p = previous; + } + + } + /* another statement may follow */ + ThisStatement = NextStatement; + Replace = FALSE; + } + while (ThisStatement != NULL); + My->NextValidLineNumber++; + return TRUE; +} + +/*************************************************************** + + FUNCTION: bwb_xtxtline() + + DESCRIPTION: This function executes a text line, i.e., + places it in memory and then relinquishes + control. + +***************************************************************/ + +static void +bwb_xtxtline (char *buffer) +{ + assert( My != NULL ); + assert (buffer != NULL); + + /* remove old program from memory */ + bwb_xnew (My->UserMarker); + + CleanLine (buffer); + if (is_empty_string (buffer)) + { + /* silengtly ignore blank lines */ + return; + } + + /* add to the user line list */ + bwb_ladd (buffer, My->UserMarker, TRUE); + + /* execute the line as BASIC command line */ + if (bwb_incexec ()) + { + My->StackHead->line = My->UserMarker->next; /* and set current line in it */ + My->StackHead->ExecCode = EXEC_NORM; + } +} + +/*************************************************************** + + FUNCTION: bwb_incexec() + + DESCRIPTION: This function increments the EXEC + stack counter. + +***************************************************************/ + +int +bwb_incexec (void) +{ + StackType *StackItem; + assert( My != NULL ); + + + if (My->StackDepthInteger >= EXECLEVELS) + { + WARN_OUT_OF_MEMORY; + return FALSE; + } + if ((StackItem = (StackType *) calloc (1, sizeof (StackType))) == NULL) + { + WARN_OUT_OF_MEMORY; + return FALSE; + } + StackItem->ExecCode = EXEC_NORM; /* sane default */ + StackItem->line = My->ThisLine; /* bwb_incexec */ + StackItem->LoopTopLine = NULL; + StackItem->local_variable = NULL; + StackItem->OnErrorGoto = 0; + StackItem->next = My->StackHead; + My->StackHead = StackItem; + My->StackDepthInteger++; + return TRUE; +} + +/*************************************************************** + + FUNCTION: bwb_decexec() + + DESCRIPTION: This function decrements the EXEC + stack counter. + +***************************************************************/ +void +bwb_clrexec (void) +{ + assert( My != NULL ); + + while (My->StackHead != NULL) + { + bwb_decexec (); + } +} + +void +bwb_decexec (void) +{ + StackType *StackItem; + assert( My != NULL ); + + + if (My->StackHead == NULL) + { + WARN_RETURN_WITHOUT_GOSUB; + return; + } + StackItem = My->StackHead; + My->StackHead = StackItem->next; + free (StackItem); + My->StackDepthInteger--; +} + +/*************************************************************** + + FUNCTION: bwb_mainloop() + + DESCRIPTION: This C function performs one iteration + of the interpreter. In a non-preemptive + scheduler, this function should be called + by the scheduler, not by bwBASIC code. + +***************************************************************/ + +void +bwb_mainloop (void) +{ + assert( My != NULL ); + + + if (My->StackHead) + { + /* BASIC program running */ + bwb_execline (); /* execute one line of program */ + return; + } + /* BASIC program completed */ + + if (My->ExternalInputFile != NULL) + { + /* for automated testing, --TAPE command line parameter */ + if (bwb_is_eof (My->ExternalInputFile) == FALSE) + { + /* --TAPE command line parameter is active */ + bwb_interact (); /* get user interaction */ + return; + } + } + /* TAPE command inactive or completed */ + + if (My->IsCommandLineFile) + { + /* BASIC program was started from command line */ + bwx_terminate (); + return; + } + /* BASIC program was not started from command line */ + + if (My->IsInteractive) + { + /* interactive */ + bwb_interact (); /* get user interaction */ + return; + } + /* non-interactive */ + + bwx_terminate (); +} + +/*************************************************************** + + FUNCTION: bwb_execline() + + DESCRIPTION: This function executes a single line of + a program in memory. This function is + called by bwb_mainloop(). + +***************************************************************/ + +extern int +bwx_Error (int ERR, char *ErrorMessage) +{ + /* + ERR is the error number + ErrorMessage is used to override the default error message, and is usually NULL + */ + assert( My != NULL ); + + switch (ERR) + { + case 0: + /* + ** + ** Clear any existing error + ** + */ + My->IsErrorPending = FALSE; /* bwx_Error, ERR == 0 */ + My->ERR = 0; /* bwx_Error, ERR == 0 */ + My->ERL = NULL; /* bwx_Error, ERR == 0 */ + bwb_strcpy (My->ERROR4, ""); /* bwx_Error, ERR == 0 */ + return FALSE; + case 6: /* WARN_OVERFLOW */ + case 11: /* WARN_DIVISION_BY_ZERO */ + case 15: /* WARN_STRING_TOO_LONG */ + /* + ** + ** Behavior depends upon whether an Error handler is active. + ** + */ + if (GetOnError () == 0) + { + /* + ** + ** Error handler is NOT active. + ** Do NOT set ERL, ERR, and ERROR$. + ** Continue processing. + ** + */ + if (ErrorMessage == NULL) + { + /* use the default error message */ + if (ERR > 0 && ERR < NUM_WARNINGS) + { + ErrorMessage = ERROR4[ERR]; + } + } + if (ErrorMessage != NULL) + { + if (bwb_strlen (ErrorMessage) > 0) + { + fprintf (My->SYSOUT->cfp, "%s\n", ErrorMessage); + ResetConsoleColumn (); + } + } + return FALSE; /* continue processing */ + } + /* + ** + ** Error handler IS active. + ** Fall-thru to set ERL, ERR, and ERROR$. + ** Abort processing. + ** + */ + } + if (My->IsErrorPending == FALSE) /* no errors pending */ + { + /* + ** + ** only keep the first pending error to occur + ** + */ + My->IsErrorPending = TRUE; /* bwx_Error, ERR != 0 */ + My->ERR = ERR; /* bwx_Error, ERR != 0 */ + My->ERL = NULL; /* bwx_Error, ERR != 0 */ + bwb_strcpy (My->ERROR4, ""); /* bwx_Error, ERR != 0 */ + if (My->StackHead) + { + My->ERL = My->StackHead->line; + } + if (ErrorMessage == NULL) + { + /* use the default error message */ + if (ERR > 0 && ERR < NUM_WARNINGS) + { + ErrorMessage = ERROR4[ERR]; + } + } + if (ErrorMessage != NULL) + { + if (bwb_strlen (ErrorMessage) > MAX_ERR_LENGTH) + { + ErrorMessage[MAX_ERR_LENGTH] = NulChar; + } + bwb_strcpy (My->ERROR4, ErrorMessage); + } + } + return TRUE; /* abort processing */ +} + +void +bwb_execline (void) +{ + LineType *r, *l; + assert( My != NULL ); + assert( My->SYSOUT != NULL ); + assert( My->SYSOUT->cfp != NULL ); + assert( My->CurrentVersion != NULL ); + + if (My->StackHead == NULL) /* in bwb_execline(), FATAL ERROR PENDING */ + { + return; + } + + l = My->StackHead->line; + + /* if the line is My->EndMarker, then break out of EXEC loops */ + if (l == NULL || l == My->EndMarker || My->ERR < 0) /* in bwb_execline(), FATAL ERROR PENDING */ + { + bwb_clrexec (); + return; + } + + My->ThisLine = l; /* bwb_execline */ + + /* Print line number if trace is on */ + if (My->IsTraceOn == TRUE) + { + if (l->LineFlags & (LINE_USER)) + { + /* USER line in console */ + } + else if (l->number > 0) + { + fprintf (My->SYSOUT->cfp, "[ %d %s ]", l->number, l->buffer); + } + } + l->position = l->Startpos; + + /* if there is a BASIC command in the line, execute it here */ + if (l->cmdnum) + { + /* OK */ + } + else + { + WARN_ILLEGAL_DIRECT; + l->cmdnum = C_REM; + } + /* l->cmdnum != 0 */ + + if (l->LineFlags & LINE_BREAK) + { + /* BREAK line */ + l->LineFlags &= ~LINE_BREAK; + My->ContinueLine = l; + bwx_STOP (TRUE); + return; + } + + /* advance beyond whitespace */ + line_skip_spaces (l); /* keep this */ + + /* execute the command vector */ + if (My->CurrentVersion->OptionFlags & (OPTION_COVERAGE_ON)) + { + /* We do this here so "END" and "STOP" are marked */ + if (l->cmdnum == C_DATA) + { + /* DATA lines are marked when they are READ */ + } + else + { + /* this line was executed */ + l->LineFlags |= LINE_EXECUTED; + } + } + r = bwb_vector (l); + if (r == NULL) + { + WARN_INTERNAL_ERROR; + return; + } + assert (r != NULL); + + if (My->ERR < 0) /* in bwb_execline(), FATAL ERROR PENDING */ + { + /* FATAL */ + bwb_clrexec (); + return; + } + + if (My->IsErrorPending /* Keep This */ ) + { + /* we are probably not at the end-of-the-line */ + } + else if (r == l) + { + /* we should be at the end-of-the-line */ + if (line_is_eol (l)) + { + /* OK */ + } + else + { + WARN_SYNTAX_ERROR; + return; + } + } + else + { + /* we are probably not at the end-of-the-line */ + } + + if (My->IsErrorPending /* Keep This */ ) + { + /* + ** + ** a NON-FATAL ERROR has occurred. ERR, ERL, and ERROR$ were + ** already set using bwb_warning(ERR,ERROR$) + ** + */ + int err_gotol; + My->IsErrorPending = FALSE; /* Error Recognized */ + err_gotol = GetOnError (); + if (l->LineFlags & (LINE_USER)) + { + /* + ** + ** ------------------------------------------------------------------------- + ** USER line in console + ** ------------------------------------------------------------------------- + ** + ** fall thru to the DEFAULT ERROR HANDLER + ** + */ + } + else if (l->number == 0) + { + /* fall thru to the DEFAULT ERROR HANDLER */ + } + else if (My->ERL == NULL) + { + /* fall thru to the DEFAULT ERROR HANDLER */ + } + else if (My->ERL->number == 0) + { + /* fall thru to the DEFAULT ERROR HANDLER */ + } + else if (err_gotol == -1) + { + /* + ** + ** ------------------------------------------------------------------------- + ** ON ERROR RESUME NEXT + ** ------------------------------------------------------------------------- + ** + */ + assert (r != NULL); + assert (r->next != NULL); + + r->next->position = 0; + assert (My->StackHead != NULL); + My->StackHead->line = r->next; + return; + } + else if (err_gotol == 0) + { + /* + ** + ** ------------------------------------------------------------------------- + ** ON ERROR GOTO 0 + ** ------------------------------------------------------------------------- + ** + ** fall thru to the DEFAULT ERROR HANDLER + ** + */ + } + else if (err_gotol == My->ERL->number) + { + /* + ** + ** ------------------------------------------------------------------------- + ** RECURSION + ** ------------------------------------------------------------------------- + ** + ** For example: + ** 10 ON ERROR GOTO 20 + ** 20 ERROR 1 + ** + ** fall thru to the DEFAULT ERROR HANDLER + ** + */ + } + else + { + /* USER ERROR HANDLER SPECIFIED */ + /* find the user-specified error handler and jump there */ + LineType *x; + for (x = My->StartMarker->next; x != My->EndMarker; x = x->next) + { + if (x->number == err_gotol) + { + /* FOUND */ + if (My->CurrentVersion->OptionFlags & (OPTION_ERROR_GOSUB)) + { + /* + ** + ** ------------------------------------------------------------------------- + ** OPTION ERROR GOSUB + ** ------------------------------------------------------------------------- + ** + ** RETURN should act like RESUME NEXT... + ** Execution resumes at the statement immediately following the one which caused the error. + ** For structured commands, this is the bottom line of the structure. + ** + */ + switch (l->cmdnum) + { + case C_IF8THEN: + /* skip to END_IF */ + assert (l->OtherLine != NULL); + for (l = l->OtherLine; l->cmdnum != C_END_IF; l = l->OtherLine); + break; + case C_SELECT_CASE: + /* skip to END_SELECT */ + assert (l->OtherLine != NULL); + for (l = l->OtherLine; l->cmdnum != C_END_SELECT; + l = l->OtherLine); + break; + default: + l = l->next; + } + l->position = 0; + My->StackHead->line = l; + if (bwb_incexec ()) + { + x->position = 0; + assert (My->StackHead != NULL); + My->StackHead->line = x; + My->StackHead->ExecCode = EXEC_GOSUB; + } + else + { + /* ERROR -- OUT OF MEMORY */ + assert (My->StackHead != NULL); + My->StackHead->line = My->EndMarker; + } + } + else + { + /* + ** + ** ------------------------------------------------------------------------- + ** OPTION ERROR GOTO + ** ------------------------------------------------------------------------- + ** + */ + x->position = 0; /* start of line */ + assert (My->StackHead != NULL); + My->StackHead->line = x; + } + return; + } + } + /* NOT FOUND */ + /* fall thru to the DEFAULT ERROR HANDLER */ + } + /* + ** + ** ------------------------------------------------------------------------- + ** DEFAULT ERROR HANDLER (FATAL) + ** ------------------------------------------------------------------------- + ** + */ + /* + ** + ** display error message + ** + */ + if (l->LineFlags & (LINE_USER) || l->number <= 0) + { + /* USER line in console */ + fprintf (My->SYSOUT->cfp, "\nERROR: %s\n", My->ERROR4); + ResetConsoleColumn (); + } + else + { + /* BASIC program line */ + fprintf (My->SYSOUT->cfp, "\nERROR in line %d: %s\n", l->number, + My->ERROR4); + ResetConsoleColumn (); + /* + ** + ** display stack trace + ** + */ + if (My->CurrentVersion->OptionFlags & (OPTION_TRACE_ON)) + { + /* + ** Dump the BASIC stack trace when a FATAL error occurs. + ** First line is the TOP of the stack. + ** Last line is the BOTTOM of the stack. + */ + StackType *StackItem; + fprintf (My->SYSOUT->cfp, "\nSTACK TRACE:\n"); + for (StackItem = My->StackHead; StackItem != NULL; + StackItem = StackItem->next) + { + LineType *l; + + l = StackItem->line; + if (l != NULL) + { + if (MINLIN <= l->number && l->number <= MAXLIN) + { + /* BASIC program line */ + if (l->buffer == NULL) + { + fprintf (My->SYSOUT->cfp, "%d\n", l->number); + } + else + { + fprintf (My->SYSOUT->cfp, "%d:%s\n", l->number, l->buffer); + } + } + } + } + ResetConsoleColumn (); + } + } + + My->AutomaticLineNumber = 0; + My->AutomaticLineIncrement = 0; + + if (My->IsInteractive) + { + /* INTERACTIVE: terminate program */ + + /* reset all stack counters */ + bwb_clrexec (); + SetOnError (0); + + My->ERR = -1; /* in bwb_execline(), default error handler */ + + + /* reset the break handler */ + signal (SIGINT, break_mes); + + + return; + } + /* NOT INTERACTIVE: terminate immediately */ + bwx_terminate (); + return; /* never reached */ + } + if (l->number > 0) + { + /* These events only occur in running programs */ + if (My->IsTimerOn) + { + /* TIMER ON */ + if (My->OnTimerCount > 0) + { + if (bwx_TIMER (0) > My->OnTimerExpires) + { + My->IsTimerOn = FALSE; + if (My->OnTimerLineNumber > 0) + { + /* ON TIMER( My->OnTimerCount ) GOSUB My->OnTimerLineNumber */ + LineType *x; + + for (x = My->StartMarker->next; x != My->EndMarker; x = x->next) + { + if (x->number == My->OnTimerLineNumber) + { + /* FOUND */ + /* save current stack level */ + assert (My->StackHead != NULL); + My->StackHead->line = r; + /* increment exec stack */ + if (bwb_incexec ()) + { + /* set the new position to x and return x */ + x->position = 0; + assert (My->StackHead != NULL); + My->StackHead->line = x; + My->StackHead->ExecCode = EXEC_GOSUB; + } + else + { + /* ERROR */ + assert (My->StackHead != NULL); + My->StackHead->line = My->EndMarker; + } + return; + } + } + /* NOT FOUND */ + } + } + } + } + } + /* check for end of line: if so, advance to next line and return */ + if (r == l) + { + /* advance to the next line */ + l->next->position = 0; + r = l->next; + } + else if (line_is_eol (r)) + { + /* we could be at the end-of-the-line, added for RETURN */ + /* advance to the next line */ + r->next->position = 0; + r = r->next; + } + /* else reset with the value in r */ + assert (My->StackHead != NULL); + My->StackHead->line = r; +} + +/*************************************************************** + + FUNCTION: is_ln() + + DESCRIPTION: This function determines whether a program + line (in buffer) begins with a line number. + +***************************************************************/ + +static int +is_ln (char *buffer) +{ + int position; + + assert (buffer != NULL); + + position = 0; + buff_skip_spaces (buffer, &position); /* keep this */ + if (bwb_isdigit (buffer[position])) + { + return TRUE; + } + return FALSE; +} + +/*************************************************************** + + FUNCTION: is_numconst() + + DESCRIPTION: This function reads the string in + and returns TRUE if it is a numerical + constant and FALSE if it is not. At + this point, only decimal (base 10) + constants are detected. + +***************************************************************/ + +static int +is_numconst (char *buffer) +{ + char *p; + + assert (buffer != NULL); + + /* Return FALSE for empty buffer */ + + if (buffer[0] == NulChar) + { + return FALSE; + } + /* else check digits */ + + p = buffer; + while (*p != NulChar) + { + switch (*p) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + break; + default: + return FALSE; + } + p++; + } + + /* only numerical characters detected */ + + return TRUE; + +} + +/* SWITCH */ +LineType * +bwb_vector( LineType *l ) +{ + LineType *r; + assert (l != NULL); + switch( l->cmdnum ) + { + case C_DEF8LBL: + r = bwb_DEF8LBL( l ); + break; + case C_APPEND: + r = bwb_APPEND( l ); + break; + case C_AS: + r = bwb_AS( l ); + break; + case C_AUTO: + r = bwb_AUTO( l ); + break; + case C_BACKSPACE: + r = bwb_BACKSPACE( l ); + break; + case C_BREAK: + r = bwb_BREAK( l ); + break; + case C_BUILD: + r = bwb_BUILD( l ); + break; + case C_BYE: + r = bwb_BYE( l ); + break; + case C_CALL: + r = bwb_CALL( l ); + break; + case C_CASE: + r = bwb_CASE( l ); + break; + case C_CASE_ELSE: + r = bwb_CASE_ELSE( l ); + break; + case C_CHAIN: + r = bwb_CHAIN( l ); + break; + case C_CHANGE: + r = bwb_CHANGE( l ); + break; + case C_CLEAR: + r = bwb_CLEAR( l ); + break; + case C_CLOAD: + r = bwb_CLOAD( l ); + break; + case C_CLOAD8: + r = bwb_CLOAD8( l ); + break; + case C_CLOSE: + r = bwb_CLOSE( l ); + break; + case C_CLR: + r = bwb_CLR( l ); + break; + case C_CMDS: + r = bwb_CMDS( l ); + break; + case C_COMMON: + r = bwb_COMMON( l ); + break; + case C_CONSOLE: + r = bwb_CONSOLE( l ); + break; + case C_CONST: + r = bwb_CONST( l ); + break; + case C_CONT: + r = bwb_CONT( l ); + break; + case C_CONTINUE: + r = bwb_CONTINUE( l ); + break; + case C_COPY: + r = bwb_COPY( l ); + break; + case C_CREATE: + r = bwb_CREATE( l ); + break; + case C_CSAVE: + r = bwb_CSAVE( l ); + break; + case C_CSAVE8: + r = bwb_CSAVE8( l ); + break; + case C_DATA: + r = bwb_DATA( l ); + break; + case C_DEC: + r = bwb_DEC( l ); + break; + case C_DEF: + r = bwb_DEF( l ); + break; + case C_DEFBYT: + r = bwb_DEFBYT( l ); + break; + case C_DEFCUR: + r = bwb_DEFCUR( l ); + break; + case C_DEFDBL: + r = bwb_DEFDBL( l ); + break; + case C_DEFINT: + r = bwb_DEFINT( l ); + break; + case C_DEFLNG: + r = bwb_DEFLNG( l ); + break; + case C_DEFSNG: + r = bwb_DEFSNG( l ); + break; + case C_DEFSTR: + r = bwb_DEFSTR( l ); + break; + case C_DELETE: + r = bwb_DELETE( l ); + break; + case C_DELIMIT: + r = bwb_DELIMIT( l ); + break; + case C_DIM: + r = bwb_DIM( l ); + break; + case C_DISPLAY: + r = bwb_DISPLAY( l ); + break; + case C_DO: + r = bwb_DO( l ); + break; + case C_DOS: + r = bwb_DOS( l ); + break; + case C_DSP: + r = bwb_DSP( l ); + break; + case C_EDIT: + r = bwb_EDIT( l ); + break; + case C_ELSE: + r = bwb_ELSE( l ); + break; + case C_ELSEIF: + r = bwb_ELSEIF( l ); + break; + case C_END: + r = bwb_END( l ); + break; + case C_END_FUNCTION: + r = bwb_END_FUNCTION( l ); + break; + case C_END_IF: + r = bwb_END_IF( l ); + break; + case C_END_SELECT: + r = bwb_END_SELECT( l ); + break; + case C_END_SUB: + r = bwb_END_SUB( l ); + break; + case C_ERASE: + r = bwb_ERASE( l ); + break; + case C_EXCHANGE: + r = bwb_EXCHANGE( l ); + break; + case C_EXIT: + r = bwb_EXIT( l ); + break; + case C_EXIT_DO: + r = bwb_EXIT_DO( l ); + break; + case C_EXIT_FOR: + r = bwb_EXIT_FOR( l ); + break; + case C_EXIT_FUNCTION: + r = bwb_EXIT_FUNCTION( l ); + break; + case C_EXIT_REPEAT: + r = bwb_EXIT_REPEAT( l ); + break; + case C_EXIT_SUB: + r = bwb_EXIT_SUB( l ); + break; + case C_EXIT_WHILE: + r = bwb_EXIT_WHILE( l ); + break; + case C_FEND: + r = bwb_FEND( l ); + break; + case C_FIELD: + r = bwb_FIELD( l ); + break; + case C_FILE: + r = bwb_FILE( l ); + break; + case C_FILES: + r = bwb_FILES( l ); + break; + case C_FLEX: + r = bwb_FLEX( l ); + break; + case C_FNCS: + r = bwb_FNCS( l ); + break; + case C_FNEND: + r = bwb_FNEND( l ); + break; + case C_FOR: + r = bwb_FOR( l ); + break; + case C_FUNCTION: + r = bwb_FUNCTION( l ); + break; + case C_GET: + r = bwb_GET( l ); + break; + case C_GO: + r = bwb_GO( l ); + break; + case C_GO_SUB: + r = bwb_GO_SUB( l ); + break; + case C_GO_TO: + r = bwb_GO_TO( l ); + break; + case C_GOODBYE: + r = bwb_GOODBYE( l ); + break; + case C_GOSUB: + r = bwb_GOSUB( l ); + break; + case C_GOTO: + r = bwb_GOTO( l ); + break; + case C_HELP: + r = bwb_HELP( l ); + break; + case C_IF: + r = bwb_IF( l ); + break; + case C_IF_END: + r = bwb_IF_END( l ); + break; + case C_IF_MORE: + r = bwb_IF_MORE( l ); + break; + case C_IF8THEN: + r = bwb_IF8THEN( l ); + break; + case C_IMAGE: + r = bwb_IMAGE( l ); + break; + case C_INC: + r = bwb_INC( l ); + break; + case C_INPUT: + r = bwb_INPUT( l ); + break; + case C_INPUT_LINE: + r = bwb_INPUT_LINE( l ); + break; + case C_LET: + r = bwb_LET( l ); + break; + case C_LINE: + r = bwb_LINE( l ); + break; + case C_LINE_INPUT: + r = bwb_LINE_INPUT( l ); + break; + case C_LIST: + r = bwb_LIST( l ); + break; + case C_LISTNH: + r = bwb_LISTNH( l ); + break; + case C_LLIST: + r = bwb_LLIST( l ); + break; + case C_LOAD: + r = bwb_LOAD( l ); + break; + case C_LOCAL: + r = bwb_LOCAL( l ); + break; + case C_LOOP: + r = bwb_LOOP( l ); + break; + case C_LPRINT: + r = bwb_LPRINT( l ); + break; + case C_LPRINTER: + r = bwb_LPRINTER( l ); + break; + case C_LPT: + r = bwb_LPT( l ); + break; + case C_LSET: + r = bwb_LSET( l ); + break; + case C_MAINTAINER: + r = bwb_MAINTAINER( l ); + break; + case C_MAINTAINER_CMDS: + r = bwb_MAINTAINER_CMDS( l ); + break; + case C_MAINTAINER_CMDS_HTML: + r = bwb_MAINTAINER_CMDS_HTML( l ); + break; + case C_MAINTAINER_CMDS_ID: + r = bwb_MAINTAINER_CMDS_ID( l ); + break; + case C_MAINTAINER_CMDS_MANUAL: + r = bwb_MAINTAINER_CMDS_MANUAL( l ); + break; + case C_MAINTAINER_CMDS_SWITCH: + r = bwb_MAINTAINER_CMDS_SWITCH( l ); + break; + case C_MAINTAINER_CMDS_TABLE: + r = bwb_MAINTAINER_CMDS_TABLE( l ); + break; + case C_MAINTAINER_DEBUG: + r = bwb_MAINTAINER_DEBUG( l ); + break; + case C_MAINTAINER_DEBUG_OFF: + r = bwb_MAINTAINER_DEBUG_OFF( l ); + break; + case C_MAINTAINER_DEBUG_ON: + r = bwb_MAINTAINER_DEBUG_ON( l ); + break; + case C_MAINTAINER_FNCS: + r = bwb_MAINTAINER_FNCS( l ); + break; + case C_MAINTAINER_FNCS_HTML: + r = bwb_MAINTAINER_FNCS_HTML( l ); + break; + case C_MAINTAINER_FNCS_ID: + r = bwb_MAINTAINER_FNCS_ID( l ); + break; + case C_MAINTAINER_FNCS_MANUAL: + r = bwb_MAINTAINER_FNCS_MANUAL( l ); + break; + case C_MAINTAINER_FNCS_SWITCH: + r = bwb_MAINTAINER_FNCS_SWITCH( l ); + break; + case C_MAINTAINER_FNCS_TABLE: + r = bwb_MAINTAINER_FNCS_TABLE( l ); + break; + case C_MAINTAINER_MANUAL: + r = bwb_MAINTAINER_MANUAL( l ); + break; + case C_MAINTAINER_STACK: + r = bwb_MAINTAINER_STACK( l ); + break; + case C_MARGIN: + r = bwb_MARGIN( l ); + break; + case C_MAT: + r = bwb_MAT( l ); + break; + case C_MAT_GET: + r = bwb_MAT_GET( l ); + break; + case C_MAT_INPUT: + r = bwb_MAT_INPUT( l ); + break; + case C_MAT_PRINT: + r = bwb_MAT_PRINT( l ); + break; + case C_MAT_PUT: + r = bwb_MAT_PUT( l ); + break; + case C_MAT_READ: + r = bwb_MAT_READ( l ); + break; + case C_MAT_WRITE: + r = bwb_MAT_WRITE( l ); + break; + case C_MERGE: + r = bwb_MERGE( l ); + break; + case C_MID4: + r = bwb_MID4( l ); + break; + case C_MON: + r = bwb_MON( l ); + break; + case C_NAME: + r = bwb_NAME( l ); + break; + case C_NEW: + r = bwb_NEW( l ); + break; + case C_NEXT: + r = bwb_NEXT( l ); + break; + case C_OF: + r = bwb_OF( l ); + break; + case C_OLD: + r = bwb_OLD( l ); + break; + case C_ON: + r = bwb_ON( l ); + break; + case C_ON_ERROR: + r = bwb_ON_ERROR( l ); + break; + case C_ON_ERROR_GOSUB: + r = bwb_ON_ERROR_GOSUB( l ); + break; + case C_ON_ERROR_GOTO: + r = bwb_ON_ERROR_GOTO( l ); + break; + case C_ON_ERROR_RESUME: + r = bwb_ON_ERROR_RESUME( l ); + break; + case C_ON_ERROR_RESUME_NEXT: + r = bwb_ON_ERROR_RESUME_NEXT( l ); + break; + case C_ON_ERROR_RETURN: + r = bwb_ON_ERROR_RETURN( l ); + break; + case C_ON_ERROR_RETURN_NEXT: + r = bwb_ON_ERROR_RETURN_NEXT( l ); + break; + case C_ON_TIMER: + r = bwb_ON_TIMER( l ); + break; + case C_OPEN: + r = bwb_OPEN( l ); + break; + case C_OPTION: + r = bwb_OPTION( l ); + break; + case C_OPTION_ANGLE: + r = bwb_OPTION_ANGLE( l ); + break; + case C_OPTION_ANGLE_DEGREES: + r = bwb_OPTION_ANGLE_DEGREES( l ); + break; + case C_OPTION_ANGLE_GRADIANS: + r = bwb_OPTION_ANGLE_GRADIANS( l ); + break; + case C_OPTION_ANGLE_RADIANS: + r = bwb_OPTION_ANGLE_RADIANS( l ); + break; + case C_OPTION_ARITHMETIC: + r = bwb_OPTION_ARITHMETIC( l ); + break; + case C_OPTION_ARITHMETIC_DECIMAL: + r = bwb_OPTION_ARITHMETIC_DECIMAL( l ); + break; + case C_OPTION_ARITHMETIC_FIXED: + r = bwb_OPTION_ARITHMETIC_FIXED( l ); + break; + case C_OPTION_ARITHMETIC_NATIVE: + r = bwb_OPTION_ARITHMETIC_NATIVE( l ); + break; + case C_OPTION_BASE: + r = bwb_OPTION_BASE( l ); + break; + case C_OPTION_BUGS: + r = bwb_OPTION_BUGS( l ); + break; + case C_OPTION_BUGS_BOOLEAN: + r = bwb_OPTION_BUGS_BOOLEAN( l ); + break; + case C_OPTION_BUGS_OFF: + r = bwb_OPTION_BUGS_OFF( l ); + break; + case C_OPTION_BUGS_ON: + r = bwb_OPTION_BUGS_ON( l ); + break; + case C_OPTION_COMPARE: + r = bwb_OPTION_COMPARE( l ); + break; + case C_OPTION_COMPARE_BINARY: + r = bwb_OPTION_COMPARE_BINARY( l ); + break; + case C_OPTION_COMPARE_DATABASE: + r = bwb_OPTION_COMPARE_DATABASE( l ); + break; + case C_OPTION_COMPARE_TEXT: + r = bwb_OPTION_COMPARE_TEXT( l ); + break; + case C_OPTION_COVERAGE: + r = bwb_OPTION_COVERAGE( l ); + break; + case C_OPTION_COVERAGE_OFF: + r = bwb_OPTION_COVERAGE_OFF( l ); + break; + case C_OPTION_COVERAGE_ON: + r = bwb_OPTION_COVERAGE_ON( l ); + break; + case C_OPTION_DATE: + r = bwb_OPTION_DATE( l ); + break; + case C_OPTION_DIGITS: + r = bwb_OPTION_DIGITS( l ); + break; + case C_OPTION_DISABLE: + r = bwb_OPTION_DISABLE( l ); + break; + case C_OPTION_DISABLE_COMMAND: + r = bwb_OPTION_DISABLE_COMMAND( l ); + break; + case C_OPTION_DISABLE_FUNCTION: + r = bwb_OPTION_DISABLE_FUNCTION( l ); + break; + case C_OPTION_DISABLE_OPERATOR: + r = bwb_OPTION_DISABLE_OPERATOR( l ); + break; + case C_OPTION_EDIT: + r = bwb_OPTION_EDIT( l ); + break; + case C_OPTION_ENABLE: + r = bwb_OPTION_ENABLE( l ); + break; + case C_OPTION_ENABLE_COMMAND: + r = bwb_OPTION_ENABLE_COMMAND( l ); + break; + case C_OPTION_ENABLE_FUNCTION: + r = bwb_OPTION_ENABLE_FUNCTION( l ); + break; + case C_OPTION_ENABLE_OPERATOR: + r = bwb_OPTION_ENABLE_OPERATOR( l ); + break; + case C_OPTION_ERROR: + r = bwb_OPTION_ERROR( l ); + break; + case C_OPTION_ERROR_GOSUB: + r = bwb_OPTION_ERROR_GOSUB( l ); + break; + case C_OPTION_ERROR_GOTO: + r = bwb_OPTION_ERROR_GOTO( l ); + break; + case C_OPTION_EXPLICIT: + r = bwb_OPTION_EXPLICIT( l ); + break; + case C_OPTION_EXTENSION: + r = bwb_OPTION_EXTENSION( l ); + break; + case C_OPTION_FILES: + r = bwb_OPTION_FILES( l ); + break; + case C_OPTION_IMPLICIT: + r = bwb_OPTION_IMPLICIT( l ); + break; + case C_OPTION_INDENT: + r = bwb_OPTION_INDENT( l ); + break; + case C_OPTION_LABELS: + r = bwb_OPTION_LABELS( l ); + break; + case C_OPTION_LABELS_OFF: + r = bwb_OPTION_LABELS_OFF( l ); + break; + case C_OPTION_LABELS_ON: + r = bwb_OPTION_LABELS_ON( l ); + break; + case C_OPTION_PROMPT: + r = bwb_OPTION_PROMPT( l ); + break; + case C_OPTION_PUNCT: + r = bwb_OPTION_PUNCT( l ); + break; + case C_OPTION_PUNCT_AT: + r = bwb_OPTION_PUNCT_AT( l ); + break; + case C_OPTION_PUNCT_BYTE: + r = bwb_OPTION_PUNCT_BYTE( l ); + break; + case C_OPTION_PUNCT_COMMENT: + r = bwb_OPTION_PUNCT_COMMENT( l ); + break; + case C_OPTION_PUNCT_CURRENCY: + r = bwb_OPTION_PUNCT_CURRENCY( l ); + break; + case C_OPTION_PUNCT_DOUBLE: + r = bwb_OPTION_PUNCT_DOUBLE( l ); + break; + case C_OPTION_PUNCT_FILENUM: + r = bwb_OPTION_PUNCT_FILENUM( l ); + break; + case C_OPTION_PUNCT_IMAGE: + r = bwb_OPTION_PUNCT_IMAGE( l ); + break; + case C_OPTION_PUNCT_INPUT: + r = bwb_OPTION_PUNCT_INPUT( l ); + break; + case C_OPTION_PUNCT_INTEGER: + r = bwb_OPTION_PUNCT_INTEGER( l ); + break; + case C_OPTION_PUNCT_LONG: + r = bwb_OPTION_PUNCT_LONG( l ); + break; + case C_OPTION_PUNCT_LPAREN: + r = bwb_OPTION_PUNCT_LPAREN( l ); + break; + case C_OPTION_PUNCT_PRINT: + r = bwb_OPTION_PUNCT_PRINT( l ); + break; + case C_OPTION_PUNCT_QUOTE: + r = bwb_OPTION_PUNCT_QUOTE( l ); + break; + case C_OPTION_PUNCT_RPAREN: + r = bwb_OPTION_PUNCT_RPAREN( l ); + break; + case C_OPTION_PUNCT_SINGLE: + r = bwb_OPTION_PUNCT_SINGLE( l ); + break; + case C_OPTION_PUNCT_STATEMENT: + r = bwb_OPTION_PUNCT_STATEMENT( l ); + break; + case C_OPTION_PUNCT_STRING: + r = bwb_OPTION_PUNCT_STRING( l ); + break; + case C_OPTION_RECLEN: + r = bwb_OPTION_RECLEN( l ); + break; + case C_OPTION_RENUM: + r = bwb_OPTION_RENUM( l ); + break; + case C_OPTION_ROUND: + r = bwb_OPTION_ROUND( l ); + break; + case C_OPTION_ROUND_BANK: + r = bwb_OPTION_ROUND_BANK( l ); + break; + case C_OPTION_ROUND_MATH: + r = bwb_OPTION_ROUND_MATH( l ); + break; + case C_OPTION_ROUND_TRUNCATE: + r = bwb_OPTION_ROUND_TRUNCATE( l ); + break; + case C_OPTION_SCALE: + r = bwb_OPTION_SCALE( l ); + break; + case C_OPTION_SLEEP: + r = bwb_OPTION_SLEEP( l ); + break; + case C_OPTION_STDERR: + r = bwb_OPTION_STDERR( l ); + break; + case C_OPTION_STDIN: + r = bwb_OPTION_STDIN( l ); + break; + case C_OPTION_STDOUT: + r = bwb_OPTION_STDOUT( l ); + break; + case C_OPTION_STRICT: + r = bwb_OPTION_STRICT( l ); + break; + case C_OPTION_STRICT_OFF: + r = bwb_OPTION_STRICT_OFF( l ); + break; + case C_OPTION_STRICT_ON: + r = bwb_OPTION_STRICT_ON( l ); + break; + case C_OPTION_TERMINAL: + r = bwb_OPTION_TERMINAL( l ); + break; + case C_OPTION_TERMINAL_ADM: + r = bwb_OPTION_TERMINAL_ADM( l ); + break; + case C_OPTION_TERMINAL_ANSI: + r = bwb_OPTION_TERMINAL_ANSI( l ); + break; + case C_OPTION_TERMINAL_NONE: + r = bwb_OPTION_TERMINAL_NONE( l ); + break; + case C_OPTION_TIME: + r = bwb_OPTION_TIME( l ); + break; + case C_OPTION_TRACE: + r = bwb_OPTION_TRACE( l ); + break; + case C_OPTION_TRACE_OFF: + r = bwb_OPTION_TRACE_OFF( l ); + break; + case C_OPTION_TRACE_ON: + r = bwb_OPTION_TRACE_ON( l ); + break; + case C_OPTION_USING: + r = bwb_OPTION_USING( l ); + break; + case C_OPTION_USING_ALL: + r = bwb_OPTION_USING_ALL( l ); + break; + case C_OPTION_USING_COMMA: + r = bwb_OPTION_USING_COMMA( l ); + break; + case C_OPTION_USING_DIGIT: + r = bwb_OPTION_USING_DIGIT( l ); + break; + case C_OPTION_USING_DOLLAR: + r = bwb_OPTION_USING_DOLLAR( l ); + break; + case C_OPTION_USING_EXRAD: + r = bwb_OPTION_USING_EXRAD( l ); + break; + case C_OPTION_USING_FILLER: + r = bwb_OPTION_USING_FILLER( l ); + break; + case C_OPTION_USING_FIRST: + r = bwb_OPTION_USING_FIRST( l ); + break; + case C_OPTION_USING_LENGTH: + r = bwb_OPTION_USING_LENGTH( l ); + break; + case C_OPTION_USING_LITERAL: + r = bwb_OPTION_USING_LITERAL( l ); + break; + case C_OPTION_USING_MINUS: + r = bwb_OPTION_USING_MINUS( l ); + break; + case C_OPTION_USING_PERIOD: + r = bwb_OPTION_USING_PERIOD( l ); + break; + case C_OPTION_USING_PLUS: + r = bwb_OPTION_USING_PLUS( l ); + break; + case C_OPTION_VERSION: + r = bwb_OPTION_VERSION( l ); + break; + case C_OPTION_ZONE: + r = bwb_OPTION_ZONE( l ); + break; + case C_PAUSE: + r = bwb_PAUSE( l ); + break; + case C_PDEL: + r = bwb_PDEL( l ); + break; + case C_POP: + r = bwb_POP( l ); + break; + case C_PRINT: + r = bwb_PRINT( l ); + break; + case C_PTP: + r = bwb_PTP( l ); + break; + case C_PTR: + r = bwb_PTR( l ); + break; + case C_PUT: + r = bwb_PUT( l ); + break; + case C_QUIT: + r = bwb_QUIT( l ); + break; + case C_READ: + r = bwb_READ( l ); + break; + case C_RECALL: + r = bwb_RECALL( l ); + break; + case C_REM: + r = bwb_REM( l ); + break; + case C_RENAME: + r = bwb_RENAME( l ); + break; + case C_RENUM: + r = bwb_RENUM( l ); + break; + case C_RENUMBER: + r = bwb_RENUMBER( l ); + break; + case C_REPEAT: + r = bwb_REPEAT( l ); + break; + case C_REPLACE: + r = bwb_REPLACE( l ); + break; + case C_RESET: + r = bwb_RESET( l ); + break; + case C_RESTORE: + r = bwb_RESTORE( l ); + break; + case C_RESUME: + r = bwb_RESUME( l ); + break; + case C_RETURN: + r = bwb_RETURN( l ); + break; + case C_RSET: + r = bwb_RSET( l ); + break; + case C_RUN: + r = bwb_RUN( l ); + break; + case C_RUNNH: + r = bwb_RUNNH( l ); + break; + case C_SAVE: + r = bwb_SAVE( l ); + break; + case C_SCRATCH: + r = bwb_SCRATCH( l ); + break; + case C_SELECT: + r = bwb_SELECT( l ); + break; + case C_SELECT_CASE: + r = bwb_SELECT_CASE( l ); + break; + case C_STEP: + r = bwb_STEP( l ); + break; + case C_STOP: + r = bwb_STOP( l ); + break; + case C_STORE: + r = bwb_STORE( l ); + break; + case C_SUB: + r = bwb_SUB( l ); + break; + case C_SUB_END: + r = bwb_SUB_END( l ); + break; + case C_SUB_EXIT: + r = bwb_SUB_EXIT( l ); + break; + case C_SUBEND: + r = bwb_SUBEND( l ); + break; + case C_SUBEXIT: + r = bwb_SUBEXIT( l ); + break; + case C_SWAP: + r = bwb_SWAP( l ); + break; + case C_SYSTEM: + r = bwb_SYSTEM( l ); + break; + case C_TEXT: + r = bwb_TEXT( l ); + break; + case C_THEN: + r = bwb_THEN( l ); + break; + case C_TIMER: + r = bwb_TIMER( l ); + break; + case C_TIMER_OFF: + r = bwb_TIMER_OFF( l ); + break; + case C_TIMER_ON: + r = bwb_TIMER_ON( l ); + break; + case C_TIMER_STOP: + r = bwb_TIMER_STOP( l ); + break; + case C_TLOAD: + r = bwb_TLOAD( l ); + break; + case C_TO: + r = bwb_TO( l ); + break; + case C_TRACE: + r = bwb_TRACE( l ); + break; + case C_TRACE_OFF: + r = bwb_TRACE_OFF( l ); + break; + case C_TRACE_ON: + r = bwb_TRACE_ON( l ); + break; + case C_TSAVE: + r = bwb_TSAVE( l ); + break; + case C_TTY: + r = bwb_TTY( l ); + break; + case C_TTY_IN: + r = bwb_TTY_IN( l ); + break; + case C_TTY_OUT: + r = bwb_TTY_OUT( l ); + break; + case C_UNTIL: + r = bwb_UNTIL( l ); + break; + case C_USE: + r = bwb_USE( l ); + break; + case C_VARS: + r = bwb_VARS( l ); + break; + case C_WEND: + r = bwb_WEND( l ); + break; + case C_WHILE: + r = bwb_WHILE( l ); + break; + case C_WRITE: + r = bwb_WRITE( l ); + break; + default: + WARN_INTERNAL_ERROR; + r = l; + break; + } + return r; +} + +/* EOF */ diff --git a/bwbasic.doc b/bwbasic.doc new file mode 100644 index 0000000..2c37ba9 --- /dev/null +++ b/bwbasic.doc @@ -0,0 +1,1156 @@ + + Bywater BASIC Interpreter, version 3.20 + --------------------------------------------- + + Copyright (c) 1993, Ted A. Campbell + for bwBASIC version 2.10, 11 October 1993 + + Copyright (c) 2014-2015, Howatd Wulf, AF5NE + for bwBASIC version 3.00, 12 May 2015 + + Copyright (c) 2015-2016, Howatd Wulf, AF5NE + for bwBASIC version 3.10, 27 July 2016 + + Copyright (c) 2016-2017, Howatd Wulf, AF5NE + for bwBASIC version 3.20, 4 June 2017 + +CONTENTS: + + + 1. DESCRIPTION + 2. TERMS OF USE + 3. QUICK REFERENCE LIST OF COMMANDS, FUNCTIONS AND OPERATORS + 4. GENERAL NOTES ON USAGE + 5. PREDEFINED VARIABLES + 6. UNIMPLEMENTED COMMANDS AND FUNCTIONS + and AGENDA FOR DEVELOPMENT + 7. THE STORY OF Bywater BASIC + 8. COMMUNICATIONS + 9. EXPANDED REFERENCE FOR COMMANDS, FUNCTIONS AND OPERATORS + + The author wishes to express his thanks to Mr. David MacKenzie, + who assisted in the development Unix installation and configuration + for this version. + +1. DESCRIPTION + + + The Bywater BASIC Interpreter (bwBASIC) implements a large superset + of the ANSI Standard for Minimal BASIC (X3.60-1978) and a significant + subset of the ANSI Standard for Full BASIC (X3.113-1987), and many + classic BASIC dialects in C. + + bwBASIC can be configured to enable commands, functions, operators + and punctuation characters available in many classic dialects of BASIC; + these are controlled by various OPTION commands. bwBASIC does not attempt + bug-level compatibility with any particular BASIC dialect nor does it + currently support graphics. bwBASIC seeks to be as portable as possible. + + The interpreter is fairly slow. Whenever faced with a choice + between conceptual clarity and speed, I have consistently chosen the + former. The interpreter is the simplest design available, and + utilizes no system of intermediate code, which could speed up + considerably its operation. As it is, each line has only one + command. Multi-statement lines are internally broken into distinct + lines as they are loaded. + + +2. TERMS OF USE: + + + This version of Bywater BASIC is released under the terms of the + GNU General Public License (GPL), which is distributed with this + software in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + + +3. QUICK REFERENCE LIST OF COMMANDS, FUNCTIONS AND OPERATORS + + + The complete list of over 500 commands, functions and operators is + in the file "ALL.txt" in the DOCS directory. Documentation for each + BASIC dialect is in the other text files in the DOCS directory. + + A BASIC dialect is a selection of commands, functions, operators, + punctuation characters and other behaviors. The OPTION VERSION + command is used to choose a specific BASIC dialect. Additional + OPTION commands are available to fine-tune the behavior. + + In bwBASIC, any function can be executed as a command. For example, + the function "OUT(X, Y)" can be executed as the command "OUT X, Y". + You can overload functions by parameter signature (the number + and types of parameters), and user defined functions can replace + any instrinsic function, including INP, OUT, PEEK, POKE, and WAIT. + + +4. GENERAL NOTES ON USAGE: + + + 4.a. Interactive Environment + + + An interactive environment is provided if the flag INTERACTIVE + is defined as TRUE in bwBASIC.h, so that a line with a + line number can be entered at the bwBASIC prompt and it will be + added to the program in memory. + + Line numbers are not strictly required, but are useful if the + interactive enviroment is used for programming. For longer + program entry one might prefer to use an ASCII text editor, and + in this case lines can be entered without numbers. See also the + documentation below for the pseudo-command EDIT, in section 5. + + + 4.b. Naming Conventions + + + Command, function, label, and variable names are not case sensitive, + so that "Run" and "RUN" and "run" are equivalent. + + The characters allowed in variable names depends upon the specific + BASIC dialect selected with the OPTION VERSION command. Usually, + variable names can use any alphabetic characters, the period + and underscore characters and decimal digits (but not in the + first position) and they can be terminated with the various numeric + type characters (!,@,#,%,&,~) or the string type character ($). + + + 4.c. Numerical Constants + + + Numerical constants may begin with a digit 0-9 (decimal), with + the "&H" or "&h" (hexadecimal) or the "&o" or "&O" (octal). + Numerical constants may include 'E' or 'e' followed by an + exponent number to denote exponential notation. Numerical + constants may also be terminated by the various numeric type + characters (!,@,#,%,&,~). + + + 4.d. Command-Line Execution + + + A filename can be specified on the command line and will be + loaded and executed immediately, so that the command line + + bwBASIC prog.bas + + will load and execute "prog.bas". If a program is executed + from the command line, control is returned to the operating + system when the program terminates. + + + 4.e. Program Storage + + + All programs are stored as ASCII text files. + + + 4.f. TRUE and FALSE + + + TRUE is defined as -1 and FALSE is defined as 0 in the default + distribution of bwBASIC. Alhtough these definitions can be changed + by those compiling bwBASIC (see file bwBASIC.h), any other values + are not supported. + + + 4.g. Assignments + + + Assignment must be made to variables. This differs from some + implementations of BASIC where assignment can be made to a + function. Implication: "INSTR( 3, x$, y$ ) = z$" will not + work under bwBASIC. The command "MID$(X$,...) = ..." is + implemented and should be used instead. + + Some BASIC dialects allow the multiple variable assignments, + such as: + 100 LET A = B = C = 0 + In bwBASIC, only the first '=' is considered an assignment. + All other '=' are considered comparison operators. To resolve + this issue, use commas to seperate the variables, such as: + 100 LET A, B, C = 0 + If these statements are only used to initialize the variable + values, then they may not needed in bwBASIC, since all numeric + variables are initialized to zero (0) and all string variables + are initialized to the empty string (""). + + + 4.h. Operators and Precedence + + + The available operators are determined by the OPTION VERSION + setting. bwBASIC recognizes many operators, with their level of + precedence fixed. The precedence levels chosen for the various + operators in bwBASIC were selected to be compatible with many + dialects of BASIC. If your application requires a specific order + of evaluation, then use parentheses. + + The collating sequence (ASCII, EBCDIC, and so on) is determined + by the C compiler. As a consequenece, the results of string + comparisons may vary. A simple check for collating sequence is + shown in the following example: + + 100 REM Purpose: Verify collating sequence (sort order) + 110 REM Author: Howard Wulf, AF5NE + 120 REM Date: 2015-11-28 + 130 REM + 200 IF "1" < "A" THEN 300 + 210 PRINT "EBCDIC" + 220 GOTO 999 + 300 PRINT "ASCII" + 999 END + + + 4.i. Numerical Precision (NOT) + + + bwBASIC utilizes numbers with only one level of precision. + All numbers are internally represented using a C double. + + The various numeric type suffix characters (!,@,#,%,&,~), + just like the string type suffix character ($), are part + of the variable name. + + This version also supports type declarations, such as: + 100 DIM X AS INTEGER + 110 FUNCTION ABC( X AS INTEGER ) AS INTEGER + 120 LET ABC = X * 2 + 130 END FUNCTION + + For each type character there is an equivalent type declaration. + Type Equivalent + Char declaration + ==== =========== + $ STRING + # DOUBLE + ! SINGLE + @ CURRENCY + & LONG + % INTEGER + ~ BYTE + + However, combining both a type suffix character and a type + declaration in the same statement is not supported. + 100 DIM A$ AS INTEGER ' this is not supported + + The type of a variable is used to range-check the values. + This allows many programs to run correctly, but does not + handle all possible cases. The current implementation is not + complete for all possible uses of numeric type declarations. + + In the current version, the type of numeric values is used + to select the appropriate operation. As a consequence, + integer division is used when dividing two integer values. + The MOD and \ operators use the rounded integer values of + their parameters and return a rounded integer result. + + Within an expression, the result of an operation is promoted + to the greater of: + the type of the left parameter, + the type of the right parameter, and + the type required to hold the result. + + In bwBASIC, numeric constants are DOUBLE by default. If you + wish to coerce a numeric constant, then add the appropriate + numeric type character immediately after the numeric digits. + Many BASIC dialects that allow numeric constants to have a + numeric type character adopt this convention. + + + 4.j. OPTION VERSION and so on + + + OPTION commands change how a BASIC program is parsed. All OPTION commands + should be in "profile.bas" so they are effective when a BASIC program + is loaded. The first OPTION command should be OPTION VERSION to select a + specific BASIC dialect. Additional OPTION commands fine-tune the available + commands, functions, operators, punctuation characters and so on to support + programs written in many different BASIC dialects. All other OPTION commands + must follow the OPTION VERSION command. Conflicting and pathological OPTION + combinations are not supported. + + The OPTION VERSION command selects a specific BASIC dialect. + OPTION VERSION "BYWATER" ' Bywater BASIC 3 + OPTION VERSION "BYWATER-2" ' Bywater BASIC 2 + OPTION VERSION "CALL/360" ' SBC CALL/360 Mainframe BASIC + OPTION VERSION "CBASIC-II" ' CBASIC-II for CP/M + OPTION VERSION "DARTMOUTH" ' Dartmouth DTSS BASIC + OPTION VERSION "ECMA-55" ' ANSI Minimal BASIC + OPTION VERSION "ECMA-116" ' ANSI Full BASIC + OPTION VERSION "GCOS" ' GE 600 Mainframe BASIC + OPTION VERSION "HAARDT" ' bas 2.4 by Michael Haardt + OPTION VERSION "HANDBOOK1" ' The BASIC Handbook, 1st Edition + OPTION VERSION "HANDBOOK2" ' The BASIC Handbook, 2nd Edition + OPTION VERSION "HEATH" ' Heath Benton Harbor BASIC + OPTION VERSION "MARK-I" ' GE 265 Mainframe BASIC + OPTION VERSION "MARK-II" ' GE 435 Mainframe BASIC + OPTION VERSION "MBASIC" ' Microsoft BASIC-80 for Xenix + OPTION VERSION "PDP-8" ' DEC PDP-8 BASIC + OPTION VERSION "PDP-11" ' DEC PDP-11 BASIC + OPTION VERSION "RBASIC" ' Micronics RBASIC for 6809 FLEX + OPTION VERSION "RSTS-11" ' DEC RSTS-11 BASIC-PLUS + OPTION VERSION "SYSTEM/360" ' IBM System/360 Mainframe BASIC + OPTION VERSION "SYSTEM/370" ' IBM System/370 Mainframe BASIC + OPTION VERSION "TRS-80" ' TRS-80 Model I/III/4 LBASIC + OPTION VERSION "VINTAGE" ' Vintage BASIC 1.0.1 + OPTION VERSION "XBASIC" ' TSC XBASIC for 6800 FLEX + + For example, MOD is a function in OPTION VERSION "ECMA-116", + MOD is an operator in OPTION VERSION "MBASIC", and + MOD is a valid variable name in OPTION VERSION "CALL/360". + + The OPTION VERSION command also sets the following OPTION commands: + OPTION STRICT ON | OFF + OPTION ANGLE DEGREES | RADIANS | GRADIANS + OPTION BUGS ON | OFF + OPTION LABELS ON | OFF + OPTION COMPARE BINARY | DATABASE | TEXT + OPTION BASE integer + OPTION RECLEN integer + OPTION COVERAGE ON | OFF + OPTION TRACE ON | OFF + OPTION ERROR GOTO | GOSUB + OPTION DATE "format" + OPTION TIME "format" + OPTION PUNCT COMMENT "char" + OPTION PUNCT STATEMENT "char" + OPTION PUNCT PRINT "char" + OPTION PUNCT IMAGE "char" + OPTION PUNCT INPUT "char" + OPTION USING DIGIT "char" + OPTION USING COMMA "char" + OPTION USING PERIOD "char" + OPTION USING PLUS "char" + OPTION USING MINUS "char" + OPTION USING EXRAD "char" + OPTION USING DOLLAR "char" + OPTION USING FILLER "char" + OPTION USING LITERAL "char" + OPTION USING FIRST "char" + OPTION USING ALL "char" + OPTION USING LENGTH "char" + OPTION PUNCT QUOTE "char" + OPTION PUNCT STRING "char" + OPTION PUNCT DOUBLE "char" + OPTION PUNCT SINGLE "char" + OPTION PUNCT CURRENCY "char" + OPTION PUNCT LONG "char" + OPTION PUNCT INTEGER "char" + OPTION PUNCT BYTE "char" + OPTION PUNCT LPAREN "char" + OPTION PUNCT RPAREN "char" + OPTION PUNCT FILENUM "char" + OPTION PUNCT AT "char" + + The commands, functions, operators and settings for each BASIC dialect + is documented in the text files in the DOCS directory. + + OPTION DISABLE COMMAND + Disable a specific command. + + OPTION DISABLE FUNCTION + Disable a specific function. + + OPTION DISABLE OPERATOR + Disable a specific operator. + + OPTION ENABLE COMMAND + Enable a specific command. + + OPTION ENABLE FUNCTION + Enable a specific function. + + OPTION ENABLE OPERATOR + Enable a specific operator. + + OPTION ERROR GOSUB + The program will GOSUB to the error handler. + The error handler exits with the RETURN command. + + OPTION ERROR GOTO + The program will GOTO to the error handler. + The error handler exits with the RESUME command. + + OPTION LABELS OFF + Disables textual labels. + + OPTION LABELS ON + Enables textual labels. + + Regardless of the OPTION LABELS setting, statements of the form + IF x THEN label + are not allowed, instead use the form + IF x THEN GOTO label + The reason for this rule is because + IF x THEN y + is considered to be the same as + IF x THEN + y + END IF + where "y" is a command, function, or subroutine. Many BASIC dialects + that allow textual labels adopt this convention. + + OPTION ROUND controls how floating point values are converted to + whole number values. OPTION ROUNG MATH rounds toward the nearest + whole number, with halves rounding up to the next larger whole number, + as commonly expected by many scientific applications. OPTION ROUND + BANK rounds halves to the even whole numbers, as commonly expected + by many financial applications. OPTION ROUND TRUNCATE truncates to + the next smaller whole number, as commonly expected by many + applications written for an integer BASIC. The selected rounding + method is used whenever a whole number is required, including: + a) selection value for ON ... GOTO and ON ... GOSUB + b) any function parameter requiring a whole number + c) array subscripts and dimensions + d) string positions and lengths + e) CINT() and similar + The OPTION ROUND command does not change the results of INT() or FIX(). + The default rounding method is OPTION ROUND BANK. + + A comparison of the different OPTION ROUND settings upon the results of CINT() + + BANK MATH TRUNCATE + X int(X) fix(X) cint(X) cint(X) cint(X) + -2.0 -2 -2 -2 -2 -2 + -1.6 -2 -1 -2 -2 -1 + -1.5 -2 -1 -2 -2 -1 + -1.4 -2 -1 -1 -1 -1 + -1.0 -1 -1 -1 -1 -1 + -0.6 -1 0 -1 -1 0 + -0.5 -1 0 0 -1 0 + -0.4 -1 0 0 0 0 + 0.0 0 0 0 0 0 + 0.4 0 0 0 0 0 + 0.5 0 0 0 1 0 + 0.6 0 0 1 1 0 + 1.0 1 1 1 1 1 + 1.4 1 1 1 1 1 + 1.5 1 1 2 2 1 + 1.6 1 1 2 2 1 + 2.0 2 2 2 2 2 + + The OPTION BUGS command determines the behavior of a number of BASIC keywords. + BASIC programs which rely on these behaviors are non-portable and non-standard. + I have considered several different names for this command, but have not yet + thought of a better short name. + + OPTION BUGS ON disables the ANSI/ECMA/ISO standard behavior: + + FOR ... ' values are evaluated left-to-right + GOTO X OF ... ' an invalid value for X falls thru without ERROR + GOSUB X OF ... ' an invalid value for X falls thru without ERROR + ON X GOTO ... ' an invalid value for X falls thru without ERROR + ON X GOSUB ... ' an invalid value for X falls thru without ERROR + X = VAL("X") ' returns zero without ERROR + INPUT X ' empty string returns zero without ERROR + INPUT X$ ' empty string returns "" without ERROR + INPUT X$ ' allows unquoted character strings + variable names ' period and underscore are allowed + variable types ' the type characters #!@&% are allowed + PRINT "a" X ' string concatenation is implied + 1.2% is 1 ' the type characters #!@&% are allowed + 1D1 is ERROR ' 'D' is not allowed as exponent seperator + + OPTION BUGS OFF enables the ANSI/ECMA/ISO standard behavior: + + FOR ... ' values are evaluated according to standard + GOTO X OF ... ' an invalid value for X is an ERROR + GOSUB X OF ... ' an invalid value for X is an ERROR + ON X GOTO ... ' an invalid value for X is an ERROR + ON X GOSUB ... ' an invalid value for X is an ERROR + X = VAL("X") ' raises an illegal function call (ERROR 5) + INPUT X ' empty string retries input + INPUT X$ ' empty string retries input + INPUT X$ ' unquoted character strings retries input + variable names ' period and underscore are not allowed + variable types ' the type characters #!@&% are not allowed + PRINT "a";X ' string concatenation is not implied + 1.2% is ERROR ' the type characters #!@&% are not allowed + 1D1 is ERROR ' 'D' is not allowed as exponent seperator + + + 4.k. ERROR handling + + + bwBASIC implements a simplified error handling strategy. + Errors are seperated into two categories: + + a) Fatal errors. These errors include: + - Unknown command + - FOR without NEXT + - NEXT without FOR + - WHILE without WEND + - WEND without WHILE + - and so on. + The program is scanned prior to running and if any of these errors is + detected, then the program is not allowed to run. If these errors + occur as the result of a DELETE or MERGE in a running program, then the + program is terminated. + + b) Non-fatal errors. If an error handler exists, then it is executed, + otherwise the default behaivor is performed. The correct action to + take in an error handler depends upon the specific application. + - Overflow (ERROR 6) + - the default behavior is to display a warning message. + - Division by zero (ERROR 11) + - the default behavior is to display a warning message. + - String too long (ERROR 15) + - the default behavior is to display a warning message. + - All other non-fatal errors + - the default behavior is to terminate the program. + + bwBASIC 2.61 used ON ERROR GOSUB for error trapping. + This version defaults to ON ERROR GOTO instead. + + + 4.l. Implementation rules for functions and commands + + + In many BASIC dialects, keywords are seperated into three distinct groups: + Commands, Statements, and Functions. In bwBASIC, keywords are seperated + into only two groups: Commands and Functions. A keyword documented as a + Command or Statament in a specific BASIC dialect may have been implemented + in bwBASIC as a Function. This is merely an implementation decision, which + may change in the future. Each keyword should only be used as described in + the reference document. The following rules are considered when deciding + whether a BASIC keyword is implemented as a command or a function: + + a) If the keyword requires significant parsing, + then it is implemented as a command. An example is "PRINT". + + b) If the keyword requires access to variables BYREF, + then it is implemented as a command. An example is "SWAP". + + c) If the keyword changes the flow of control, + then it is implemented as a command. An example is "GOTO". + + d) A function may be used as though it were a command, + but a command cannot be used as though it were a function. + + e) The BASIC program can redefine a function, + but the BASIC program cannot redefine a command. + + f) The BASIC program can overload a function, + but the BASIC program cannot overload a command. + + g) Other than semantics, there is no practical difference + between a BASIC function and a BASIC subroutine. The + return value of a BASIC subroutine, when called as a + function, is zero. Calling a BASIC function as if it + were a subroutine simply discards the return value. + + These rules were chosen to maintain compatibility with + many BASIC dialects. + + An example of the results of the above rules is "OUT". + Since "OUT" is implemented as a function, you may: + a) call it as a subroutine like this: + 100 OUT X, Y + b) call it as a function like this: + 100 LET N = OUT( X, Y ) ' N = 0 + c) redefine it as a subroutine like this: + SUB OUT( X, Y ) + REM ... + END SUB + d) redefine it as a function like this: + FUNCTION OUT( X, Y ) + REM ... + END FUNCTION + e) overload it using subroutines like these: + SUB OUT( X, Y ) + REM ... + END SUB + SUB OUT( X, A$ ) + REM ... + END SUB + SUB OUT( A$, X ) + REM ... + END SUB + SUB OUT( A$, B$ ) + REM ... + END SUB + f) overload it using functions like these: + FUNCTION OUT( X, Y ) + REM ... + END FUNCTION + FUNCTION OUT( X, A$ ) + REM ... + END FUNCTION + FUNCTION OUT( A$, X ) + REM ... + END FUNCTION + FUNCTION OUT( A$, B$ ) + REM ... + END FUNCTION + + + 4.m. Reference documentation + + + bwBASIC is preconfigured to support a number of specific BASIC dialects which were + implemented using the following references, however bwBASIC does not attempt to be + bug-level compatible and does not implement non-portable design choices. A manual + for each dialect is in the DOCS directory to make you aware that a specific keyword + is implemented, however you should refer to the reference document for a proper + understanding of how to use each keyword. There are many other good books which + describe these BASIC dialects in detail. + + OPTION VERSION "BYWATER" ' Bywater BASIC 3 + MANUAL: + BYWATER.TXT + + OPTION VERSION "BYWATER-2" ' Bywater BASIC 2 + MANUAL: + BYWATER-2.TXT + NOT IMPLEMENTED: + DO NUM, DO UNNUM + NOTES: + SUB MAIN is not automatically called. + CALL requires parentheses around the function/subroutine parameters, + so instead of + CALL abc 1, 2, 3 + use + CALL abc( 1, 2, 3 ) + + OPTION VERSION "CALL/360" ' SBC CALL/360 Mainframe BASIC + MANUAL: + CALL-360.TXT + NOT IMPLEMENTED: + MAT PRINT USING. + NOTES: + The APPENDIXES are implementation specific and are not supported. + + OPTION VERSION "CBASIC-II" ' CBASIC-II for CP/M + MANUAL: + CBASIC-II.TXT + ADDITIONAL INFORMATION: + "CBASIC Language Reference Manual, 2nd Edition" + by Diigital Research + (c) 1982, Diigital Research + http://bitsavers.trailing-edge.com/pdf/digitalResearch/cb80/ + CBASIC_Language_Reference_Manual_Oct82.pdf + NOT IMPLEMENTED: + CONSTAT%, CONCHAR% and compiler directives. + NOTES: + The APPENDIXES are implementation specific and are not supported. + The %INCLUDE directive is implemented, but only supports literal + unquoted filesnames without drive or directory, such as: + %INCLUDE LIBRARY.BAS + Note that the %INCLUDE directive is executed as a file is being loaded, + and as a result the %INCLUDE does not appear in the resulting listing. + Machine language functions and commands are not supported. + The parsing of command line parameters is implementation defined. + The specification of an array in a COMMON statement is the same as + the specification in a DIM statement. + The SIZE() function assumes 1024 bytes and does not support wild-cards; + if the file does not exist then SIZE() returns zero, otherwise SIZE() + returns the number of 1024 bytes blocks required to contain the file; + an existing file of zero bytes returns a value of 1. + + OPTION VERSION "DARTMOUTH" ' Dartmouth DTSS BASIC + MANUAL: + DARTMOUTH.TXT + NOTES: + The APPENDICES are implementation specific and are not supported. + Sections 4.2 and 4.3 are implementation specific and are not supported. + Lines containing data to be READ must have a line number and a DATA command. + NOT IMPLEMENTED: + Card punch codes are not supported, use a comma or semicolon instead. + + OPTION VERSION "ECMA-55" ' ANSI Minimal BASIC + MANUAL: + ECMA-55.TXT + NOTES: + The APPENDICES are implementation specific and are not supported. + DIM is an executed statement in bwBASIC. + This is a design decision to support the following example. + 100 INPUT "How many?"; N + 110 DIM A$(N) + + OPTION VERSION "ECMA-116" ' ANSI Full BASIC + MANUAL: + ECMA-116.TXT + NOT IMPLEMENTED: + Graphic commands, chapters 11 thru 15. + NOTES: + The APPENDICES are implementation specific and are not supported. + WORK-IN-PROGRESS. + + OPTION VERSION "GCOS" ' GE 600 Mainframe BASIC + MANUAL: + GCOS.TXT + NOT IMPLEMENTED: + HPS, LIN, RESTORE*, RESTORE$, VPS and binary files. + NOTES: + The APPENDIXES are implementation specific and are not supported. + Local variables in a multiline DEF are declared using DIM. + Line numbers are not written to, nor read from, data files. + FILES does not support passwords. + Literal values for file names are not supported, use string values instead. + This is a design decision to support the following: + 100 INPUT "Which files?"; A$, B$, C$ + 110 FILES A$, B$, C$ + + OPTION VERSION "HAARDT" ' bas 2.4 by Michael Haardt + MANUAL: + HAARDT.TXT + NOT IMPLEMENTED: + BBC syntax, use ANSI syntax instead. + ON ERROR statement(s) is not supported, use ON ERROR GOTO instead. + ON ERROR OFF, use ON ERROR GOTO 0 instead. + MAT REDIM, OPTION RUN, OPTION STOP, TRUNCATE, UNNUM and XREF. + DEC$(X,A$), ENVIRON$(X), FIND$(A$[,X]) and INSTR(A$,B$,X,Y). + NOTES: + POS and TAB are 1-based instead of 0-based. + ON ERROR GOTO 0 does not cause any error to occur, instead + ON ERROR GOTO 0 removes the current error handler and clears + ERL, ERR and ERROR$. + + OPTION VERSION "HANDBOOK1" ' The BASIC Handbook, 1st Edition + MANUAL: + HANDBOOK1.TXT + NOT IMPLEMENTED: + Abbreviated commands (such as A.) and graphic commands. + NOTES: + The APPENDICES are implementation specific and are not supported. + The ERR function returns different values. + + OPTION VERSION "HANDBOOK2" ' The BASIC Handbook, 2nd Edition + MANUAL: + HANDBOOK2.TXT + NOT IMPLEMENTED: + Abbreviated commands (such as A.) and graphic commands. + NOTES: + The APPENDICES are implementation specific and are not supported. + The ERR function returns different values. + + OPTION VERSION "HEATH" ' Heath Benton Harbor BASIC + NOT IMPLEMENTED: + FREEZE, UNFREEZE, LOCK, UNLOCK, STEP + NOTES: + The APPENDICES are implementation specific and are not supported. + PRINT #-1 is sent to the printer. + INPUT #-1 is an ERROR. + + OPTION VERSION "MARK-I" ' GE 265 Mainframe BASIC + MANUAL: + MARK-I.TXT + ADDITIONAL REFERENCE: + "Time-Sharing Service BASIC LANGUAGE EXTENSIONS Reference Manual" + by Time-Sharing Service, Information Service Department, General Electric + (c) 1968, General Electric Company and Trustees of Dartmouth College + http://www.bitsavers.org/pdf/ge/MarkI_Timesharing/ + 802207A_Time-SharingServiceBASICLanguageExtensionsReferenceManual_Feb1968.pdf + NOTES: + The APPENDIXES are implementation specific and are not supported. + NOT IMPLEMENTED: + A series of variables seperated by equal signs is not supported, + use a series of variables seperated by commas instead. + Literal values for file names are not supported, use string values instead. + This is a design decision to support the following: + 100 INPUT "Which files?"; A$, B$, C$ + 110 FILES A$, B$, C$ + CALL, to execute another compiled program, is not supported, use SHELL instead. + + OPTION VERSION "MARK-II" ' GE 435 Mainframe BASIC + MANUAL: + MARK-II.TXT + ADDITIONAL INFORMATION: + "Basic Software Library" (Volumes 1 to 8) + by R. W. Brown + (c) 1977, Scientific Research Inst. + NOT IMPLEMENTED: + HPS, LIN, RESTORE*, RESTORE$, VPS and binary files. + NOTES: + The APPENDIXES are implementation specific and are not supported. + Local variables in a multiline DEF are declared using DIM. + Line numbers are not written to, nor read from, data files. + Literal values for file names are not supported, use string values instead. + This is a design decision to support the following: + 100 INPUT "Which files?"; A$, B$, C$ + 110 FILES A$, B$, C$ + FILES does not support passwords. + + OPTION VERSION "MBASIC" ' Microsoft BASIC-80 for Xenix + MANUAL: + MBASIC.TXT + NOTES: + The APPENDICES are implementation specific and are not supported. + The ERR function returns different values. + Specifying "D" in the exponent is not supported, instead use "E". + + OPTION VERSION "PDP-8" ' DEC PDP-8 BASIC + MANUAL: + PDP-8.TXT + NOT IMPLEMENTED: + NO RUBOUTS, RUBOUTS + NOTES: + The APPENDICES are implementation specific and are not supported. + + OPTION VERSION "PDP-11" ' DEC PDP-11 BASIC + MANUAL: + PDP-11.TXT + NOTES: + The APPENDICES are implementation specific and are not supported. + + OPTION VERSION "RBASIC" ' Micronics RBASIC for 6809 FLEX + MANUAL: + RBASIC.TXT + NOT IMPLEMENTED: + "+" command, COMPILE, CVT$, CVTF$, CVT$%, CVT$F + NOTES: + The APPENDICES are implementation specific and are not supported. + The ERR function returns different values. + + OPTION VERSION "RSTS-11" ' DEC RSTS-11 BASIC-PLUS + MANUAL: + RSTS-11.TXT + ADDITIONAL INFORMATION: + "BASIC-PLUS Language Manual : for use with RSTS-11 (PDP-11 Resource Time-Sharing System)" + by Digital Equipment Corporation + (c) 1972, Digital Equipment Corporation + http://bitsavers.trailing-edge.com/pdf/dec/pdp11/rsts/V04/ + DEC-11-ORBPA-A-D_BASIC-PLUS_LangMan_Oct72.pdf + ADDITIONAL INFORMATION: + "PDP-11 : BASIC-PLUS Language Manual" + by Digital Equipment Corporation + (c) 1975, Digital Equipment Corporation + http://bitsavers.trailing-edge.com/pdf/dec/pdp11/rsts/V06/ + DEC-11-ORBPB-A-D_BASIC-PLUS_LangMan_Jul75.pdf + NOT IMPLEMENTED: + HELLO, RENAME, REPLACE, COMPILE, LENGTH, TAPE, KEY, ASSIGN, DEASSIGN. + FOR ... WHILE, FOR ... UNTIL, statement modifiers. + NOTES: + The APPENDIXES are implementation specific and are not supported. + The ERR function returns different values. + The statemnet NAME ... AS does not support the specifier. + + OPTION VERSION "SYSTEM/360" ' IBM System/360 Mainframe BASIC + MANUAL: + SYSTEM-360.TXT + ADDITIONAL INFORMATION: + "IBM System/360 0S(TS0) ITF:BASIC Terminal User's Guide" + by International Business Machines Corporation + (c) 1971, International Business Machines Corporation + http://bitsavers.org/pdf/ibm/360/os/tso/ + SC28-6840-0_TSO_ITF_BASIC_Terminal_UG_Apr71.pdf + NOT IMPLEMENTED: + MAT PRINT USING. + NOTES: + The APPENDIXES are implementation specific and are not supported. + + OPTION VERSION "SYSTEM/370" ' IBM System/370 Mainframe BASIC + MANUAL: + SYSTEM-370.TXT + NOT IMPLEMENTED: + MAT PRINT USING. + NOTES: + The APPENDIXES are implementation specific and are not supported. + + OPTION VERSION "TRS-80" ' TRS-80 Model I/III/4 LBASIC + MANUAL: + TRS-80.TXT + NOT IMPLEMENTED: + CMD, SET EOF, cassette I/O. + NOTES: + The APPENDICES are implementation specific and are not supported. + The ERR function returns different values. + For the TRS-80 Model I use "WIDTH 16,64" in "profile.bas". + For the TRS-80 Model III use "WIDTH 16,64" in "profile.bas". + For the TRS-80 Model 4 use "WIDTH 24,80" in "profile.bas". + bwBASIC requires a space around all keywords, so the LINEINPUT + command must be written as LINE INPUT, and so on. + PRINT #-1 is sent to the printer. + INPUT #-1 is an ERROR. + + OPTION VERSION "VINTAGE" ' Vintage BASIC 1.0.1 + MANUAL: + VINTAGE.TXT + NOTES: + The APPENDICES are implementation specific and are not supported. + + OPTION VERSION "XBASIC" ' TSC XBASIC for 6800 FLEX + MANUAL: + XBASIC.TXT + NOT IMPLEMENTED: + "+" command, COMPILE, CVT$, CVTF$, CVT$%, CVT$F + NOTES: + The APPENDICES are implementation specific and are not supported. + The ERR function returns different values. + + +5. PREDEFINED VARIABLES - no longer exist + + + BWB.EDITOR$ + BWB.FILES$ + BWB.PROMPT$ + BWB.IMPLEMENTATION$ + + These preset variables no longer exist in bwBASIC. They have + been replaced with OPTION EDIT, OPTION FILES and OPTION PROMPT + commands. + + The commands EDIT and FILES are pseudo-commands that launch + shell programs set by OPTION EDIT and OPTION FILES commands, + respectively. The default values for these commands can + be changed in bwBASIC.h (DEF_EDITOR and DEF_FILES), and they + can be changed on the fly by the user. It is expected that + the user will add the appropriate commands to "profile.bas" + for their specific implementation; OPTION FILES "ls -l" on Unix + systems and OPTION FILES "dir" on DOS systems. + + The command OPTION PROMPT can be used to set the prompt + string for bwBASIC. Again, it is suggested that a user- + selected prompt can be set up in a "profile.bas" to be + initialized each time bwBASIC starts. Note that special + characters can be added to the prompt string, e.g., + + OPTION PROMPT "Ok"+CHR$(10) + + will give an "Ok" prompt followed by a linefeed. + + In previous versions, the preset variable BWB.IMPLEMENTATION$ + would return "TTY" (IMP_IDSTRING) for the bwx_tty implementation. + In previous versions of bwBASIC, the existance of the keywords CLS, + COLOR and LOCATE were determined at compile and BWB.IMPLEMENTATION$ + was used at runtime to determine whether these keywords existed. + In the current version, these keywords always exist and are now + controlled at runtime using the OPTION TERMINAL commands. With + OPTION TERMINAL NONE these keywords output nothing. + + +6. UNIMPLEMENTED COMMANDS AND FUNCTIONS, and AGENDA FOR DEVELOPMENT + + + There are some items not implemented that have been so long + a part of some BASIC dialects that their absence may seem surprising. + In each case, though, their implementation would require + operating-system-specific functions or terminal-specific functions + that cannot be universally provided. Some specific examples are + detailed below. + + + INP reads a value from a hardware port. In the current version, + using INP() will generate ERROR 73. It is expected that you will + provide a suitable implementation for your specific application. + For example: + FUNCTION INP( X ) + REM Return whatever value your application requires + INP = 0 + END FUNCTION + + + OUT writes a value to a hardware port. In the current version, + using OUT() will generate ERROR 73. It is expected that you will + provide a suitable implementation for your specific application. + For example: + SUB OUT( X, Y ) + REM do whatever your application requires + END SUB + + + PEEK reads a value from a memory location. In the current version, + using PEEK() will generate ERROR 73. It is expected that you will + provide a suitable implementation for your specific application. + For example: + FUNCTION PEEK( X ) + REM Return whatever value your application requires + PEEK = 0 + END FUNCTION + + + POKE writes a value to a memory location. In the current version, + using POKE() will generate ERROR 73. It is expected that you will + provide a suitable implementation for your specific application. + For example: + SUB POKE( X, Y ) + REM do whatever your application requires + END SUB + + + WAIT reads a value from a hardware port. In the current version, + using WAIT() will generate ERROR 73. It is expected that you will + provide a suitable implementation for your specific application. + For example: + SUB WAIT( X, Y ) + REM do whatever your application requires + END SUB + SUB WAIT( X, Y, Z ) + REM do whatever your application requires + END SUB + + + USR executes a machine code routine. In the current version, + using USR() will generate ERROR 73. It is expected that you will + provide a suitable implementation for your specific application. + For example: + FUNCTION USR( ... ) + REM Return whatever value your application requires + USR = 0 + END FUNCTION + + + VARPTR reads a value from a memory location. In the current version, + using VARPTR() will generate ERROR 73. It is expected that you will + provide a suitable implementation for your specific application. + For example: + FUNCTION VARPTR( ... ) + REM Return whatever value your application requires + VARPTR = 0 + END FUNCTION + + + There are other commands, functions, and implementation details + that I am working on, and which are on the agenda list for future + versions of bwBASIC. These agenda include: + + + PARACT i.e., the ability to execute PARallel ACTions. This + is described in ANSI BASIC, although I have not seen it + implemented before. It will offer a rough, non-preemptive + form of multitasking within the scope of a BASIC program. + Programmers will note that the global My pointer provides + one possible hook mechanism for PARACT in bwBASIC. In the + interim, you might use the "ON TIMER" command to implement + a simple multitasking BASIC program. + + + XMEM PC-type computers usually are able to use extended + memory. If we could use extended memory for program + lines, variables, and function defitions, we could + write much longer programs. This would entail, + however, a fairly serious rewriting of the program + to utilize memory handles for these storage features + instead of direct memory pointers. In the interim, + you might use a "DOS Extender" which hooks calloc() + and free() to enable transparent access to EMS or XMS + memory. + + + Windows The addition of memory handles in addition to the + non-preemptive execution of program lines (in a + crude form, already present) will make it possible + to develop implementations for Windows and perhaps + for other graphical user interfaces. But what form + should this take? I have in mind presently a BASIC + that would run in the background, appearing only + as an icon in the GUI space, with pop-up editors + and output windows. Thus, the interpreted language + would serve a purpose something like 'cron' (a task + scheduler) under Unix systems. You may have some + reflections that would help me in this. + + + Graphics Here we face fairly critical differences in different + styles and implementations of graphics, e.g., between + GWBASIC, ANSI BASIC, VisualBASIC, etc. But it's + possible that Graphics commands and functions could + be added. These would all be OPTION VERSION specific. + In the interim, you might consider using ReGIS or Tektronix + graphics (ESC codes) with xterm. + + + The ANSI Standard for full BASIC does not specify which particular + commands or functions must be implemented, and in fact the standard + is very robust. Perhaps no implementation of BASIC would ever + include all of the items, but some ANSI commands and functions which + remain unimplemented are: + + ACCESS + AREA + ARRAY + ASK + BSTR + BVAL + CELLS + CLIP + COLLATE + CONNECT + DATUM + DEBUG + DECLARE + DEVICE + DISCONNECT + DISPLAY + DOT + DRAW + ERASE + EVENT + EXCEPTION + GRAPH + HANDLER + IMAGE + KEY + LINES + MIX + MULTIPOINT + OUTIN + OUTPUT + PARACT + PICTURE + PIXEL + PLOT + POINTS + RECEIVE + RENUMBER + REWRITE + ROTATE + SEIZE + SEND + SHIFT + TIMEOUT + TRACE + TRANSFORM + VIEWPORT + WAIT + VIEWPORT + ZONEWIDTH + + +7. THE STORY OF Bywater BASIC + + + This program was originally begun in 1982 by my grandmother, Mrs. + Verda Spell of Beaumont, TX. She was writing the program using + an ANSI C compiler on an Osborne I CP/M computer and although my + grandfather (Lockwood Spell) had bought an IBM PC with 256k of + RAM my grandmother would not use it, paraphrasing George Herbert + to the effect that "He who cannot in 64k program, cannot in 512k." + She had used Microsoft BASIC and although she had nothing against + it she said repeatedly that she didn't understand why Digital + Research didn't "sue the socks off of Microsoft" for version 1.0 + of MSDOS and so I reckon that she hoped to undercut Microsoft's + entire market and eventually build a new software empire on + the North End of Beaumont. Her programming efforts were cut + tragically short when she was thrown from a Beaumont to Port + Arthur commuter train in the summer of 1986. I found the source + code to bwBASIC on a single-density Osborne diskette in her knitting + bag and eventually managed to have it all copied over to a PC + diskette. I have revised it slightly prior to this release. You + should know, though, that I myself am an historian, not a programmer. + + +8. COMMUNICATIONS: + + + email: tcamp@delphi.com + + +9. EXPANDED REFERENCE FOR COMMANDS, FUNCTIONS AND OPERATORS + + + bwBASIC provides a simple "HELP" command to refresh your memory + regarding the appropriate syntax for a specific command or function. + In the DOCS directory are text files which provide brief descriptions + of every intrinsic command, function and operator available in BASIC + dialect available in bwBASIC; these files are not intented to be an + authoritative or exhaustive reference. Refer to the reference document + for each dialect for details regarding each keyword. + + +THE END diff --git a/bwbasic.h b/bwbasic.h new file mode 100644 index 0000000..57854d5 --- /dev/null +++ b/bwbasic.h @@ -0,0 +1,3050 @@ +/*************************************************************** + + bwbasic.h Header File + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + +#define TRUE -1 +#define FALSE 0 +#define NDEBUG 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/*************************************************************** + + Definitions + +***************************************************************/ + +/*************************************************************** + + Define Major Hardware Implementation + + TTY is the default implementation. + It is the most minimal, but the most + universal hardware implementation. + + If you use TTY then check the settings + in bwx_tty.c for your system. + + +***************************************************************/ + + + +/* +** +** Here is where you should #include any implementation +** specific files to #define your preferences +** +** +#include "bwb_user.h" +** +** +** +** +*/ + +/* +** +** Attempt to detect the Operating System +** +*/ +#if defined(HAVE_UNIX) +/* +** +** UNIX-style Operating Systems +** +*/ +#elif defined(HAVE_MSDOS) +/* +** +** MSDOS-style Operating Systems +** +*/ +#elif defined(HAVE_CMS) +/* +** +** GCC 3 for CMS on Hercules +** +*/ +#elif defined(HAVE_MVS) +/* +** +** GCC 3 for MVS on Hercules +** +*/ +#elif defined(__CMS__) + +#define HAVE_CMS TRUE + +#elif defined(__MVS__) + +#define HAVE_MVS TRUE + +#elif defined(_DOS) + +#define HAVE_MSDOS TRUE + +#elif defined(_WIN16) + +#define HAVE_MSDOS TRUE + +#elif defined(_WIN32) + +#define HAVE_MSDOS TRUE + +#elif defined(_WIN64) + +#define HAVE_MSDOS TRUE + +#elif defined(__unix__) + +#define HAVE_UNIX TRUE + +#elif defined(__unix) + +#define HAVE_UNIX TRUE + +#elif defined(__APPLE__) + +#define HAVE_UNIX TRUE + +#elif defined(__MACH__) + +#define HAVE_UNIX TRUE + +#elif defined(__BORLANDC__) + +#define HAVE_MSDOS TRUE + +#elif defined(__DMC__) + +#define HAVE_MSDOS TRUE + +#elif defined(__WATCOM__) + +#define HAVE_MSDOS TRUE + +#else +/* +** +** Unable to detect the operaating syystem +** +*/ +#endif + +/*------------------------------------------------------------- + ENVIRONMENT specific configuration +-------------------------------------------------------------*/ + +#if HAVE_UNIX +/* +** +** UNIX-style Operating Systems +** +*/ +/* +** +** If I understand correctly, my development environment is +** GCC 4.9 for Linux via CCTools for Android in a BusyBox +** environment under a Java simulation of an ARM processor +** on a Barnes & Noble $69 Nook Tablet. What could possibly +** go wrong? When you finish laughing, it actually works. +** +** I compile with: gcc -ansi -o bwbasic bw*.c +** +*/ +#include +#include + +#ifndef DIRECTORY_CMDS +#define DIRECTORY_CMDS TRUE +#endif /* DIRECTORY_CMDS */ + +#ifndef MKDIR_ONE_ARG +#define MKDIR_ONE_ARG FALSE +#endif /* MKDIR_ONE_ARG */ + +#ifndef PERMISSIONS +#define PERMISSIONS 0x0644 +#endif /* PERMISSIONS */ + +#ifndef DEF_EDITOR +#define DEF_EDITOR "nano" +#endif /* DEF_EDITOR */ + +#ifndef HAVE_UNIX_GCC +#if __GNUC__ +#define HAVE_UNIX_GCC TRUE +#else +#define HAVE_UNIX_GCC FALSE +#endif /* __GNUC__ */ +#endif /* HAVE_UNIX_GCC */ + +#endif /* HAVE_UNIX */ + +/*-----------------------------------------------------------*/ + +#if HAVE_MSDOS +/* +** +** MSDOS-style Operating Systems +** +*/ +#if __WATCOM__ +#include /* OpenWatcom 1.9 for DOS */ +#else +#include /* all others */ +#endif /* __WATCOM__ */ + +#ifndef DIRECTORY_CMDS +#define DIRECTORY_CMDS TRUE +#endif /* DIRECTORY_CMDS */ + +#ifndef MKDIR_ONE_ARG +#define MKDIR_ONE_ARG TRUE +#endif /* MKDIR_ONE_ARG */ + +#ifndef PERMISSIONS +#define PERMISSIONS 0 +#endif /* PERMISSIONS */ + +#ifndef DEF_EDITOR +#define DEF_EDITOR "edit" +#endif /* DEF_EDITOR */ + +#ifndef DEF_FILES +#define DEF_FILES "dir /w" +#endif /* DEF_FILES */ + +#ifndef HAVE_UNIX_GCC +#define HAVE_UNIX_GCC FALSE +#endif /* HAVE_UNIX_GCC */ + +#endif /* HAVE_MSDOS */ + +/*-----------------------------------------------------------*/ + +#if HAVE_CMS +/* +** +** GCC 3 for CMS on Hercules +** +*/ +#include "bwd_six.h" + +#ifndef PROFILENAME +#define PROFILENAME "PROFILE BAS" +#endif /* PROFILENAME */ + +#if FALSE +/* +** +** bwBASIC 3.10: OPTION STDERR "LPRINT OUT" +** +*/ +#ifndef LPRINTFILENAME +#define LPRINTFILENAME "LPRINT OUT" +#endif /* LPRINTFILENAME */ +#endif /* FALSE */ + +#if FALSE +/* +** +** bwBASIC 3.10: OPTION STDERR "ERROR OUT" +** +*/ +#ifndef ERRFILE +#define ERRFILE "ERROR OUT" +#endif /* ERRFILE */ +#endif /* FALSE */ + +#if FALSE +/* +** +** bwBASIC 3.20: OPTION PROMPT "bwBASIC:" + CHR$(10) +** +*/ +#ifndef DEF_PROMPT +#define DEF_PROMPT "bwBASIC:\n" +#endif /* DEF_PROMPT */ +#endif /* FALSE */ + +#ifndef DEF_EXTENSION +#define DEF_EXTENSION " BAS" +#endif /* DEF_EXTENSION */ + +#ifndef DIRECTORY_CMDS +#define DIRECTORY_CMDS FALSE +#endif /* DIRECTORY_CMDS */ + +#ifndef HAVE_UNIX_GCC +#define HAVE_UNIX_GCC FALSE +#endif /* HAVE_UNIX_GCC */ + +#endif /* HAVE_CMS */ + +/*---------------------------------------------------------------*/ + +#ifdef HAVE_MVS +/* +** +** GCC 3 for MVS on Hercules +** +*/ +#include "bwd_six.h" + +#ifndef PROFILENAME +#define PROFILENAME "dd:profile" +#endif /* PROFILENAME */ + +#if FALSE +/* +** +** bwBASIC 3.10: OPTION STDERR "dd:lprint" +** +*/ +#ifndef LPRINTFILENAME +#define LPRINTFILENAME "dd:lprint" +#endif /* LPRINTFILENAME */ +#endif /* FALSE */ + +#if FALSE +/* +** +** bwBASIC 3.10: OPTION STDERR "dd:errout" +** +*/ +#ifndef ERRFILE +#define ERRFILE "dd:errout" +#endif /* ERRFILE */ +#endif /* FALSE */ + +#if FALSE +/* +** +** bwBASIC 3.20: OPTION PROMPT "bwBASIC:" + CHR$(10) +** +*/ +#ifndef DEF_PROMPT +#define DEF_PROMPT "bwBASIC:\n" +#endif /* DEF_PROMPT */ +#endif /* FALSE */ + +#ifndef DEF_EXTENSION +#define DEF_EXTENSION "" +#endif /* DEF_EXTENSION */ + +#ifndef DIRECTORY_CMDS +#define DIRECTORY_CMDS FALSE +#endif /* DIRECTORY_CMDS */ + +#ifndef HAVE_UNIX_GCC +#define HAVE_UNIX_GCC FALSE +#endif /* HAVE_UNIX_GCC */ + +#endif /* HAVE_MVS */ + + +/*************************************************************** + + This ends the section of definitions that + users of bwBASIC might want to specify. + The following are internally defined. + + Note that you might want to #define the default + FILES command and the default EDITOR above. + +***************************************************************/ + + + +/* +** +** +** If you want to change any of these values, +** then you should #define them above. +** +** +*/ + +#ifndef HAVE_UNIX_GCC +/* +** TRUE: +** sleep() is an intrinsic C functions in GCC using -ansi +** FALSE: +** sleep() is defined in bwb_int.c to do nothing +** +*/ +#define HAVE_UNIX_GCC FALSE +#endif /* HAVE_UNIX_GCC */ + +#ifndef PROFILE +/* +** +** TRUE: +** automatically execute PROFILENAME line-by-line before parsing command line parameters +** FALSE: +** do not automatically execute PROFILENAME +** +*/ +#define PROFILE TRUE +#endif /* PROFILE */ + +#ifndef PROFILENAME +/* +** +** Filename for PROFILE, only used when PROFILE == TRUE +** This file contains the various OPTION commands +** +*/ +#define PROFILENAME "profile.bas" +#endif /* PROFILENAME */ + +#if FALSE +/* +** +** bwBASIC 3.10: OPTION STDERR "err.out" +** bwBASIC 3.10: OPTION STDERR "LPRINT.OUT" +** +*/ +#ifndef REDIRECT_STDERR +/* +** +** redirect STDERR +** +*/ +#define REDIRECT_STDERR FALSE +#endif /* REDIRECT_STDERR */ +#ifndef ERRFILE +/* +** +** Filename for redirected stderr +** +*/ +#define ERRFILE "err.out" +#endif /* ERRFILE */ +#ifndef LPRINTFILENAME +/* +** +** Filename for LPRINT output +** +*/ +#define LPRINTFILENAME "LPRINT.OUT" +#endif /* LPRINTFILENAME */ +#endif /* FALSE */ + +#ifndef DIRECTORY_CMDS +/* +** +** enable MKDIR, CHDIR, RMDIR +** +*/ +#define DIRECTORY_CMDS TRUE +#endif /* DIRECTORY_CMDS */ + +#ifndef MKDIR_ONE_ARG +/* +** +** TRUE if your mkdir has one argument +** only used when DIRECTORY_CMDS == TRUE +** +*/ +#define MKDIR_ONE_ARG FALSE +#endif /* MKDIR_ONE_ARG */ + +#ifndef PERMISSIONS +/* +** +** permissions to set in a Unix-type system +** only used when MKDIR_ONE_ARG == FALSE +** +*/ +#define PERMISSIONS 0x0644 +#endif /* PERMISSIONS */ + +#if FALSE +/* +** +** bwBASIC 3.20: OPTION PROMPT "bwBASIC: " +** +*/ +#ifndef DEFVNAME_PROMPT +/* +** +** variable name for PROMPT +** +*/ +#define DEFVNAME_PROMPT "BWB.PROMPT$" +#endif /* DEFVNAME_PROMPT */ +#endif /* FALSE */ + +#ifndef DEF_PROMPT +/* +** +** default value for OPTION PROMPT +** +*/ +#define DEF_PROMPT "bwBASIC: " +#endif /* DEF_PROMPT */ + +#ifndef DEF_EXTENSION +/* +** +** default value for OPTION EXTENSION +** +*/ +#define DEF_EXTENSION ".bas" +#endif /* DEF_EXTENSION */ + +#if FALSE +/* +** +** bwBASIC 3.20: OPTION EDIT "vi" +** +*/ +#ifndef DEFVNAME_EDITOR +/* +** +** variable name for EDIT command +** +*/ +#define DEFVNAME_EDITOR "BWB.EDITOR$" +#endif /* DEFVNAME_EDITOR */ +#endif /* FALSE */ + +#ifndef DEF_EDITOR +/* +** +** default value for OPTION EDIT +** +**/ +#define DEF_EDITOR "vi" +#endif /* DEF_EDITOR */ + +#if FALSE +/* +** +** bwBASIC 3.20: OPTION FILES "ls -Fx" +** +*/ +#ifndef DEFVNAME_FILES +/* +** +** variable name for FILES command +** +*/ +#define DEFVNAME_FILES "BWB.FILES$" +#endif /* DEFVNAME_FILES */ +#endif /* FALSE */ + +#ifndef DEF_FILES +/* +** +** default value for OPTION FILES +** +*/ +#define DEF_FILES "ls -Fx" +#endif /* DEF_FILES */ + +#if FALSE +/* +** +** bwBASIC 3.20: not used +** +*/ +#ifndef DEFVNAME_COLORS +/* +** +** variable name for COLORS +** +*/ +#define DEFVNAME_COLORS "BWB.COLORS" +#endif /* DEFVNAME_COLORS */ +#ifndef DEF_COLORS +/* +** +** default value for COLORS +** +*/ +#define DEF_COLORS 256 +#endif /* DEF_COLORS */ +#endif /* FALSE */ + +#if FALSE +/* +** +** bwBASIC 3.20: not used +** +*/ +#ifndef DEFVNAME_IMPL +/* +** +** variable name for IMPLEMENTATION +** +*/ +#define DEFVNAME_IMPL "BWB.IMPLEMENTATION$" +#endif /* DEFVNAME_IMPL */ +#ifndef IMP_IDSTRING +/* +** +** default value for IMPLEMENTATION +** +*/ +#define IMP_IDSTRING "TTY" +#endif /* IMP_IDSTRING */ +#endif /* FALSE */ + +#if FALSE +/* +** +** bwBASIC 3.20: OPTION RENUM "renum" +** +*/ +#ifndef DEFVNAME_RENUM +/* +** +** variable name for RENUM command +** +*/ +#define DEFVNAME_RENUM "BWB.RENUM$" +#endif /* DEFVNAME_RENUM */ +#endif /* FALSE */ + +#ifndef DEF_RENUM +/* +** +** default value for OPTION RENUM +** +*/ +#define DEF_RENUM "renum" +#endif /* DEF_RENUM */ + +#ifndef EXECLEVELS +/* +** +** maximum EXEC stack levels +** only used to prevent run away recursion, such as: +** 100 GOSUB 100 +** +*/ +#define EXECLEVELS 255 +#endif /* EXECLEVELS */ + +#ifndef MAX_DIMS +/* +** +** maximum number of array dimensions +** +*/ +#define MAX_DIMS 3 +#endif /* MAX_DIMS */ + +#if FALSE +/* +** +** bwBASIC 3.10: not used +** +*/ +#ifndef ESTACKSIZE +/* +** +** maximum number of elements in expression stack +** +*/ +#define ESTACKSIZE 64 +#endif /* ESTACKSIZE */ +#endif /* FALSE */ + +/* +** ============================================================ +** +** +** UNLESS YOU ARE WORKING ON THE INTERNALS, +** YOU SHOULD NOT GO BEYOND HERE. +** CHANGING ANY OF THESE VALUES IS NOT SUPPORTED. +** +** ============================================================ +*/ + + + +/* +The relationship of numeric values is REQUIRED to be: + + MAXDBL >= MAXSNG >= MAXCUR >= MAXLNG >= MAXINT > MAXLEN >= MAXBYT > 0 + MINDBL <= MINSNG <= MINCUR <= MINLNG <= MININT < 0 + MINLEN == MINBYT == MINDEV == 0 + + MAXDEV > 0 + MAXBYT == 255 + MAXINT >= 32000 + MININT <= -32000 + MAXSNG >= 1E37 + MINSNG <= -1E37 +*/ + +/* + + switch( TypeCode ) + { + case ByteTypeCode: + break; + case IntegerTypeCode: + break; + case LongTypeCode: + break; + case CurrencyTypeCode: + break; + case SingleTypeCode: + break; + case DoubleTypeCode: + break; + case StringTypeCode: + break; + default: + { WARN_INTERNAL_ERROR; return ...; } + } + +*/ + + +/*------------------------------------------------------------- + BASIC BYTE + OPTION PUNCT BYTE "~" +-------------------------------------------------------------*/ +#ifndef ByteTypeCode +typedef unsigned char ByteType; +#define MINBYT 0 +#define MAXBYT ( UCHAR_MAX ) +#define ByteTypeCode '1' +#endif /* ByteTypeCode */ + +/*------------------------------------------------------------- + BASIC INTEGER + OPTION PUNCT INTEGER "%" +-------------------------------------------------------------*/ +#ifndef IntegerTypeCode +typedef int IntegerType; +#define MININT ( INT_MIN ) +#define MAXINT ( INT_MAX ) +/* +** +** minimum USER line number +** must be > 0 +** +*/ +#define MINLIN 1 +/* +** +** maximum USER line number +** must be < MAXINT +** +*/ +#define MAXLIN ( MAXINT - 1 ) +/* +** +** number of digits for line numbers +** line numbers 1 to 99999 use 5 digits +** +*/ +#define LineNumberDigits 5 +/* +** +** default maximum line length, must be < MAXINT +** OPTION LINE 255 +** +*/ +#define MAX_LINE_LENGTH 255 +#define IntegerTypeCode '2' +#endif /* IntegerTypeCode */ + +/*------------------------------------------------------------- + BASIC LONG + OPTION PUNCT LONG "&" +-------------------------------------------------------------*/ +#ifndef LongTypeCode +typedef long LongType; +#define MINLNG ( LONG_MIN ) +#define MAXLNG ( LONG_MAX ) + +#define HexScanFormat "%lx%n" +#define OctScanFormat "%lo%n" +#define LongTypeCode '3' +#endif /* LongTypeCode */ + +/*------------------------------------------------------------- + BASIC CURRENCY + OPTION PUNCT CURRENCY "@" +-------------------------------------------------------------*/ +#ifndef CurrencyTypeCode +/* +** +** Deprecated, to be removed in bwBASIC 3.30 +** +*/ +typedef long CurrencyType; +#define MINCUR ( LONG_MIN ) +#define MAXCUR ( LONG_MAX ) +#define CurrencyTypeCode '4' +#endif /* CurrencyTypeCode */ + +/*------------------------------------------------------------- + BASIC SINGLE + OPTION PUNCT SINGLE "!" +-------------------------------------------------------------*/ +#ifndef SingleTypeCode +typedef float SingleType; +#define MINSNG ( -FLT_MAX ) +#define MAXSNG ( FLT_MAX ) +#define SingleTypeCode '5' +#endif /* SingleTypeCode */ + +/*------------------------------------------------------------- + BASIC DOUBLE + OPTION PUNCT DOUBLE "#" +-------------------------------------------------------------*/ +#ifndef DoubleTypeCode +typedef double DoubleType; +#define MINDBL ( -DBL_MAX ) +#define MAXDBL ( DBL_MAX ) +#define DecScanFormat "%lg%n" +#define DoubleTypeCode '6' +#endif /* DoubleTypeCode */ + +/*------------------------------------------------------------- + BASIC STRING + OPTION PUNCT STRING "$" +-------------------------------------------------------------*/ +#ifndef StringTypeCode +/* +** +** minimum length of a BASIC string +** must be zero +** +*/ +#define MINLEN 0 +/* +** +** maximum length of a BASIC string +** must be < MAXINT +*/ +#define MAXLEN 255 +#define StringTypeCode '7' +#endif /* StringTypeCode */ + + +/*------------------------------------------------------------- + BASIC DEVICE +-------------------------------------------------------------*/ +#ifndef MINDEV +/* +** +** minimum numbwe of OPEN files +** must be zero +** +*/ +#define MINDEV 0 +#endif /* MINDEV */ + +#ifndef MAXDEV +/* +** +** maximum numbwe of OPEN files +** not counting stdin, stdout, stderr +** +*/ +#define MAXDEV ( FOPEN_MAX - 3 ) +#endif /* MAXDEV */ + +#if FALSE +/* +** +** bwBASIC 3.20: OPTION PUNCT FILENUM "#" +** +*/ +#ifndef FileNumberPrefix +#define FileNumberPrefix '#' +#endif /* FileNumberPrefix */ +#endif /* FALSE */ + + +/*------------------------------------------------------------- + BASIC MISCELLANEOUS +-------------------------------------------------------------*/ + + +#ifndef NameLengthMax +/* +** +** maximum BASIC keyword length +** Applies to ALL keywords in BASIC, incuding: +** variables, functions, subroutines, commands and labels. +** +*/ +#define NameLengthMax 40 +#endif /* NameLengthMax */ + +#ifndef SIGNIFICANT_DIGITS +/* +** +** default setting for OPTION DIGITS +** minimum is 6 for BASIC +** OPTION DIGITS 6 +** +*/ +#define SIGNIFICANT_DIGITS 6 +#endif /* SIGNIFICANT_DIGITS */ + +#ifndef EXPONENT_DIGITS +/* +** +** number of exrad digits +** minimum value is 2 for BASIC +** +*/ +#if (DBL_MAX_10_EXP) < 100 +/* +** +** Exponenet range is within 1E-99 to 1E+99 +** ANSI C89 requires at least 1E-37 to 1E+37 +** +*/ +#define EXPONENT_DIGITS 2 +#elif (DBL_MAX_10_EXP) < 1000 +/* +** +** Exponenet range is within 1E-999 to 1E+999 +** includes ANSI/IEEE Std 754-1985 +** +*/ +#define EXPONENT_DIGITS 3 +#elif (DBL_MAX_10_EXP) < 10000 +/* +** +** Exponenet range is within 1E-9999 to 1E+9999 +** +*/ +#define EXPONENT_DIGITS 4 +#elif (DBL_MAX_10_EXP) < 100000 +/* +** +** Exponenet range is within 1E-99999 to 1E+99999 +** +*/ +#define EXPONENT_DIGITS 5 +#else +/* +** +** Exponenet range is within 1E-999999 to 1E+999999 +** +*/ +#define EXPONENT_DIGITS 6 +#endif +#endif /* EXPONENT_DIGITS */ + +#ifndef ZONE_WIDTH +/* +** +** default setting for OPTION ZONE +** ECMA-55, Section 14.4 +** +*/ +#define ZONE_WIDTH ( SIGNIFICANT_DIGITS + EXPONENT_DIGITS + 6 ) +#endif /* ZONE_WIDTH */ + +#ifndef MINIMUM_DIGITS +/* +** +** minimum setting for OPTION DIGITS +** +*/ +#define MINIMUM_DIGITS 1 +#endif /* MINIMUM_DIGITS */ + +#ifndef MAXIMUM_DIGITS +/* +** +** maximum setting for OPTION DIGITS +** +*/ +#define MAXIMUM_DIGITS ( DBL_DIG ) +#endif /* MAXIMUM_DIGITS */ + +#ifndef MINIMUM_SCALE +/* +** +** minimum setting for OPTION SCALE +** zero disables scaling +** +*/ +#define MINIMUM_SCALE 0 +#endif /* MINIMUM_SCALE */ + +#ifndef MAXIMUM_SCALE +/* +** +** maximum setting for OPTION SCALE +** +*/ +#define MAXIMUM_SCALE ( DBL_DIG ) +#endif /* MAXIMUM_SCALE */ + +#ifndef MINIMUM_ZONE +/* +** +** minimum setting for OPTION ZONE +** +*/ +#define MINIMUM_ZONE 1 +#endif /* MINIMUM_ZONE */ + +#ifndef MAXIMUM_ZONE +/* +** +** maximum setting for OPTION ZONE +** +*/ +#define MAXIMUM_ZONE 79 +#endif /* MAXIMUM_ZONE */ + +#ifndef NUMLEN +/* +** +** small buffer for converting numbers to strings +** FormatBasicNumber, sprintf("%f"), sprintf("%d") and so on +** +*/ +#define NUMLEN 64 +#endif /* NUMLEN */ + +#ifndef MAX_ERR_LENGTH +/* +** +** maximum length of ERROR$ +** +*/ +#define MAX_ERR_LENGTH 63 +#endif /* MAX_ERR_LENGTH */ + +#ifndef MIN +/* +** +** minimum of two numbers +** +*/ +#define MIN( X, Y ) ( (X) < (Y) ? (X) : (Y) ) +#endif /* MIN */ + +#ifndef MAX +/* +** +** maximum of two numbers +** +*/ +#define MAX( X, Y ) ( (X) > (Y) ? (X) : (Y) ) +#endif /* MAX */ + +#if FALSE +/* +** +** bwBASIC 3.20: not used +** +*/ +#ifndef PRN_SPC +/* +** +** internal code for SPC(X), next character is X. +** +*/ +#define PRN_SPC 0x01 +#endif /* PRN_SPC */ +#endif /* FALSE */ + +#if FALSE +/* +** +** bwBASIC 3.20: not used +** +*/ +#ifndef PRN_TAB +/* +** +** internal code for TAB(X), next character is X. +** +*/ +#define PRN_TAB 0x02 +#endif /* PRN_TAB */ +#endif /* FALSE */ + +#ifndef NulChar +/* +** +** the character that terminates a C string, commonly CHR$(0) +** +*/ +#define NulChar '\0' /* NUL */ +#endif /* NulChar */ + +#ifndef THE_PRICE_IS_RIGHT +/* +** +** enable various simple techinques to improve execution speed +** +*/ +#define THE_PRICE_IS_RIGHT TRUE +#endif /* THE_PRICE_IS_RIGHT */ + +#ifndef MAINTAINER_BUFFER_LENGTH +/* +** +** The length of buffers for MAINTINER commands +** +**/ +#define MAINTAINER_BUFFER_LENGTH 1023 +#endif /* MAINTAINER_BUFFER_LENGTH */ + +/*------------------------------------------------------------- + FUNCTION PARAMETER TYPES +-------------------------------------------------------------*/ +/* +** Bit 0 is the first parameter, bit 31 is the 32nd parameter. +** If the parameter is a string then the bit is set. +** If the parameter is a number then the bit is clear. +*/ +typedef unsigned long ParamBitsType; + +#ifndef MAX_FARGS +#define MAX_FARGS ( sizeof( ParamBitsType ) * CHAR_BIT / 1 ) +#endif /* MAX_FARGS */ + + +#define PSTR( N ) ( 1 << ( N - 1 ) ) /* STRING parameter # 1 is bit 0 SET */ +#define PNUM( N ) ( 0 ) /* NUMBER parameter # 1 is bit 0 CLR */ +#define PNONE ( 0 ) /* function has no parameters */ + +#define P1STR PSTR(1) +#define P2STR PSTR(2) +#define P3STR PSTR(3) +#define P4STR PSTR(4) + +#define P1NUM PNUM(1) +#define P2NUM PNUM(2) +#define P3NUM PNUM(3) +#define P4NUM PNUM(4) + + +/*------------------------------------------------------------- + FUNCTION PARAMETER TESTS +-------------------------------------------------------------*/ +/* +** Nibble 0 is the first parameter, +** Nibble 7 is the 8th parameter. +** Each nibble is P1ANY and so on. +*/ +typedef unsigned long ParamTestType; +#define MAX_TESTS ( sizeof( ParamTestType ) * CHAR_BIT / 4 ) + +/* 0x87654321 <- Parameter Number (max # of Range-Checked parameters to INTRINSIC functions is 8) */ +#define P1ERR 0X00000000 /* INTERNAL ERROR */ +#define P1ANY 0X00000001 /* X is any valid number , A$ is any valid string */ +#define P1BYT 0x00000002 /* MIN_BYT <= X <= MAX_BYT , LEN(A$) >= sizeof(char) */ +#define P1INT 0x00000003 /* SHRT_MIN <= X <= SHRT_MAX, LEN(A$) >= sizeof(int) */ +#define P1LNG 0x00000004 /* LONG_MIN <= X <= LONG_MAX, LEN(A$) >= sizeof(long) */ +#define P1CUR 0x00000005 /* LONG_MIN <= X <= LONG_MAX, LEN(A$) >= sizeof(long) */ +#define P1FLT 0x00000006 /* MIN_FLT <= X <= MAX_FLT , LEN(A$) >= sizeof(float) */ +#define P1DBL 0x00000007 /* MIN_DBL <= X <= MAX_DBL , LEN(A$) >= sizeof(double) */ +#define P1DEV 0x00000008 /* RESERVED , RESERVED */ +#define P1LEN 0x00000009 /* MIN_STR <= X <= MAX_STR , RESERVED */ +#define P1POS 0x0000000A /* MIN_STR < X <= MAX_STR , RESERVED */ +#define P1COM 0x0000000B /* X in (1,2,3,4) COMx , RESERVED */ +#define P1LPT 0x0000000C /* X in (0,1,2,3) PRN,LPTx , RESERVED */ +#define P1GTZ 0x0000000D /* X > 0 , RESERVED */ +#define P1GEZ 0x0000000E /* X >= 0 , RESERVED */ +#define P1NEZ 0x0000000F /* X <> 0 , RESERVED */ + +#define P2ERR (P1ERR << 4) +#define P2ANY (P1ANY << 4) +#define P2BYT (P1BYT << 4) +#define P2INT (P1INT << 4) +#define P2LNG (P1LNG << 4) +#define P2CUR (P1CUR << 4) +#define P2FLT (P1FLT << 4) +#define P2DBL (P1DBL << 4) +#define P2DEV (P1DEV << 4) +#define P2LEN (P1LEN << 4) +#define P2POS (P1POS << 4) +#define P2COM (P1COM << 4) +#define P2LPT (P1LPT << 4) +#define P2GTZ (P1GTZ << 4) +#define P2GEZ (P1GEZ << 4) +#define P2NEZ (P1NEZ << 4) + +#define P3ERR (P1ERR << 8) +#define P3ANY (P1ANY << 8) +#define P3BYT (P1BYT << 8) +#define P3INT (P1INT << 8) +#define P3LNG (P1LNG << 8) +#define P3CUR (P1CUR << 8) +#define P3FLT (P1FLT << 8) +#define P3DBL (P1DBL << 8) +#define P3DEV (P1DEV << 8) +#define P3LEN (P1LEN << 8) +#define P3POS (P1POS << 8) +#define P3COM (P1COM << 8) +#define P3LPT (P1LPT << 8) +#define P3GTZ (P1GTZ << 8) +#define P3GEZ (P1GEZ << 8) +#define P3NEZ (P1NEZ << 8) + +#define P4ERR (P1ERR << 12) +#define P4ANY (P1ANY << 12) +#define P4BYT (P1BYT << 12) +#define P4INT (P1INT << 12) +#define P4LNG (P1LNG << 12) +#define P4CUR (P1CUR << 12) +#define P4FLT (P1FLT << 12) +#define P4DBL (P1DBL << 12) +#define P4DEV (P1DEV << 12) +#define P4LEN (P1LEN << 12) +#define P4POS (P1POS << 12) +#define P4COM (P1COM << 12) +#define P4LPT (P1LPT << 12) +#define P4GTZ (P1GTZ << 12) +#define P4GEZ (P1GEZ << 12) +#define P4NEZ (P1NEZ << 12) + + + + + +/*************************************************************** + + Structures + +***************************************************************/ + +/*------------------------------------------------------------- + OPTION VERSION bitmask +-------------------------------------------------------------*/ +typedef unsigned long OptionVersionType; /* upto 32 BASIC dialects */ + +/*------------------------------------------------------------- + Result of attempt to parse +-------------------------------------------------------------*/ +typedef enum +{ + RESULT_UNPARSED = 1, + RESULT_ERROR, + RESULT_SUCCESS +} ResultType; + +/*------------------------------------------------------------- + STRINGS +-------------------------------------------------------------*/ +struct StringStructure +{ + size_t length; /* length of string */ + char *sbuffer; /* pointer to string buffer */ +}; +typedef struct StringStructure StringType; + + +/*------------------------------------------------------------- + VARIABLES +-------------------------------------------------------------*/ +union ValuePtrUnion +{ + DoubleType *Number; /* memory for number */ + StringType *String; /* memory for string */ +}; +typedef union ValuePtrUnion ValuePtrType; + +struct VariableStructure +{ + struct VariableStructure *next; /* next variable in chain */ + char name[NameLengthMax + 1]; /* name */ + ValuePtrType Value; /* memory for values */ + size_t array_units; /* total number of units of memory */ + int LBOUND[MAX_DIMS]; /* lower bound for each dimension */ + int UBOUND[MAX_DIMS]; /* upper bound for each dimension */ + int VINDEX[MAX_DIMS]; /* current index in each dimension */ + int dimensions; /* number of dimensions, 0 == scalar */ + unsigned char VariableFlags; /* VARIABLE_... */ + char VariableTypeCode; /* StringTypeCode and so on */ +}; +typedef struct VariableStructure VariableType; +#define VAR_IS_STRING( v ) ( v->VariableTypeCode == StringTypeCode ) +/* VariableFlags */ +#define VARIABLE_RESERVED_01 0x01 /* reserved for future use */ +#define VARIABLE_RESERVED_02 0x02 /* reserved for future use */ +#define VARIABLE_RESERVED_04 0x04 /* reserved for future use */ +#define VARIABLE_CONSTANT 0x08 /* CONST variable: value cannot be changed again */ +#define VARIABLE_VIRTUAL 0x10 /* VIRTUAL variable: values are stored in disk file */ +#define VARIABLE_DISPLAY 0x20 /* DSP variable: display every assignment */ +#define VARIABLE_PRESET 0x40 /* preset variable: CLEAR should not delete */ +#define VARIABLE_COMMON 0x80 /* COMMON variable: available to CHAINed program */ + + +/*------------------------------------------------------------- + LINES +-------------------------------------------------------------*/ +struct LineStructure +{ + struct LineStructure *next; /* pointer to next line in chain */ + struct LineStructure *OtherLine; /* pointer to other line in loops */ + char *buffer; /* buffer to hold the line */ + int number; /* line number */ + int position; /* current position in line */ + int cmdnum; /* C_... */ + int Startpos; /* start of rest of line read from buffer */ + int Indention; /* structure command indention level */ + int IncludeLevel; /* %INCLUDE file level */ + unsigned char LineFlags; /* LINE_... */ +}; +typedef struct LineStructure LineType; +/* LineFlags */ +#define LINE_EXECUTED 0x01 /* line was executed */ +#define LINE_NUMBERED 0x02 /* line was manually numbered */ +#define LINE_BREAK 0x04 /* BREAK line */ +#define LINE_USER 0x08 /* USER line executing from console */ +#define LINE_RESERVED_10 0x10 /* reserved for future use */ +#define LINE_RESERVED_20 0x20 /* reserved for future use */ +#define LINE_RESERVED_40 0x40 /* reserved for future use */ +#define LINE_RESERVED_80 0x80 /* reserved for future use */ + + +/*------------------------------------------------------------- + USER FUNCTIONS, SUBS and LABELS +-------------------------------------------------------------*/ +struct UserFunctionStructure +{ + struct UserFunctionStructure *next; + char *name; + char ReturnTypeCode; /* StringTypeCode and so on */ + unsigned char ParameterCount; /* 0..MAX_FARGS, 255 == VARIANT (...) */ + ParamBitsType ParameterTypes; /* parameter signature, must hold MAX_FARGS bits */ + LineType *line; /* points to the FUNCTION, SUB, or LABEL line */ + int startpos; /* starting position in line */ + VariableType *local_variable; /* local variables for this function or sub */ + OptionVersionType OptionVersionBitmask; /* OPTION VERSION bitmask */ +}; +typedef struct UserFunctionStructure UserFunctionType; + + +/*------------------------------------------------------------- + INTRINSIC FUNCTIONS +-------------------------------------------------------------*/ +struct IntrinsicFunctionStructure +{ + const int FunctionID; /* F_... */ + const char *Syntax; /* the syntax of the function */ + const char *Description; /* the description of the function */ + const char *Name; /* the name of the function, such as "MID$" */ + const char ReturnTypeCode; /* StringTypeCode and so on */ + const unsigned char ParameterCount; /* 0..MAX_FARGS, 255 == VARIANT (...) */ + const ParamBitsType ParameterTypes; /* parameter signature, holds MAX_FARGS bits */ + const ParamTestType ParameterTests; /* parameter checks, must hold 8 nibbles, only first 8 parameters */ + OptionVersionType OptionVersionBitmask; /* OPTION VERSION bitmask */ +}; +typedef struct IntrinsicFunctionStructure IntrinsicFunctionType; +extern IntrinsicFunctionType IntrinsicFunctionTable[ /* NUM_FUNCTIONS */ ]; +extern const size_t NUM_FUNCTIONS; + + +/*------------------------------------------------------------- + INTRINSIC COMMANDS +-------------------------------------------------------------*/ +struct CommandStructure +{ + const int CommandID; /* C_... */ + const char *Syntax; /* the syntax of the command */ + const char *Description; /* the description of the command */ + const char *name; /* the name of the command, such as "PRINT" */ + OptionVersionType OptionVersionBitmask; /* OPTION VERSION bitmask */ +}; +typedef struct CommandStructure CommandType; +extern CommandType IntrinsicCommandTable[ /* NUM_COMMANDS */ ]; +extern const size_t NUM_COMMANDS; + + +/*------------------------------------------------------------- + FILES +-------------------------------------------------------------*/ +struct FileStructure +{ + struct FileStructure *next; + int FileNumber; /* 1-based file number used to OPEN the file ( 0 for SYSIN/SYSOUT, -1 for SYSPRN */ + int DevMode; /* DEVMODE_... */ + int width; /* 1-based width for OUTPUT and APPEND; reclen for RANDOM; not used for INPUT or BINARY */ + int col; /* 1-based current column for OUTPUT and APPEND */ + int row; /* 1-based current row for OUTPUT and APPEND */ + int EOF_LineNumber; /* IF END # filenumber THEN EOF_linenumber */ + FILE *cfp; /* C file pointer for this device */ + char *buffer; /* pointer to character buffer for RANDOM */ + char delimit; /* DELIMIT for READ and WRITE */ + char *FileName; /* File Name */ +}; +typedef struct FileStructure FileType; +/* DevMode */ +#define DEVMODE_CLOSED 0x00 +#define DEVMODE_INPUT 0x01 +#define DEVMODE_OUTPUT 0x02 +#define DEVMODE_RANDOM 0x04 +#define DEVMODE_APPEND 0x08 +#define DEVMODE_VIRTUAL 0x10 +#define DEVMODE_BINARY 0x20 +#define DEVMODE_X40 0x40 /* reserved for future use */ +#define DEVMODE_X80 0x80 /* reserved for future use */ +#define DEVMODE_READ (DEVMODE_INPUT | DEVMODE_RANDOM | DEVMODE_BINARY ) +#define DEVMODE_WRITE (DEVMODE_OUTPUT | DEVMODE_RANDOM | DEVMODE_APPEND | DEVMODE_BINARY ) + + +/*------------------------------------------------------------- + FIELDS in a RANDOM file +-------------------------------------------------------------*/ +struct FieldStructure +{ + /* only used for RANDOM files in dialects with a FIELD command */ + struct FieldStructure *next; + FileType *File; + int FieldOffset; + int FieldLength; + VariableType *Var; + int VINDEX[MAX_DIMS]; /* current position in array */ +}; +typedef struct FieldStructure FieldType; + + +/*------------------------------------------------------------- + VIRTUAL VARIABLES +-------------------------------------------------------------*/ +struct VirtualStructure +{ + /* only used for VIRTUAL variables in dialects with a DIM # command */ + struct VirtualStructure *next; + int FileNumber; /* note: the file can be opened AFTER the variable is declared */ + size_t FileOffset; /* byte offset from the beginning of the file */ + int FileLength; /* sizeof( DoubleType ) or Fixed String Length */ + VariableType *Variable; /* the variable */ +}; +typedef struct VirtualStructure VirtualType; + + +/*------------------------------------------------------------- + STACK +-------------------------------------------------------------*/ +struct StackStructure +{ + struct StackStructure *next; + LineType *line; /* line for execution */ + int ExecCode; /* EXEC_... */ + VariableType *local_variable; /* local variables of FUNCTION and variable of FOR */ + DoubleType for_step; /* STEP value of FOR */ + DoubleType for_target; /* TO value of FOR */ + LineType *LoopTopLine; /* top line of FOR, DO, WHILE, UNTIL */ + int OnErrorGoto; /* ON ERROR GOTO line */ +}; +typedef struct StackStructure StackType; +/* ExecCode */ +#define EXEC_NORM 0 +#define EXEC_GOSUB 1 +#define EXEC_FOR 2 +#define EXEC_FUNCTION 3 +#define EXEC_POPPED 4 + + +/*------------------------------------------------------------- + VERSION +-------------------------------------------------------------*/ +struct VersionStructure +{ + const char *Name; /* OPTION VERSION name$ */ + const OptionVersionType OptionVersionValue; /* ( D64 ,...) */ + const char *ID; /* ("D64",...) */ + const char *Description; /* short description of this dialect */ + const char *ReferenceTitle; /* Reference document */ + const char *ReferenceAuthor; /* Reference document */ + const char *ReferenceCopyright; /* Reference document */ + const char *ReferenceURL1; /* Reference document */ + const char *ReferenceURL2; /* Reference document */ + unsigned short OptionFlags; + int OptionReclenInteger; /* OPTION RECLEN integer: Default RANDOM record length */ + int OptionBaseInteger; /* OPTION BASE integer: Default lower bound for arrays */ + char *OptionDateFormat; /* OPTION DATE format$: strftime() format for DATE$ */ + char *OptionTimeFormat; /* OPTION TIME format$: strftime() format for TIME$ */ + char OptionStringChar; /* OPTION STRING char$: Suffix for StringTypeCode , commonly '$' */ + char OptionDoubleChar; /* OPTION DOUBLE char$: Suffix for DoubleTypeCode , commonly '#' */ + char OptionSingleChar; /* OPTION SINGLE char$: Suffix for SingleTypeCode , commonly '!' */ + char OptionCurrencyChar; /* OPTION CURRENCY char$: Suffix for CurrencyTypeCode, commonly '@' */ + char OptionLongChar; /* OPTION LONG char$: Suffix for LongTypeCode , commonly '&' */ + char OptionIntegerChar; /* OPTION INTEGER char$: Suffix for IntegerTypeCode , commonly '%' */ + char OptionByteChar; /* OPTION BYTE char$: Suffix for ByteTypeCode , commonly '~' */ + char OptionQuoteChar; /* OPTION QUOTE char$: Quote, commonly a double-quote */ + char OptionCommentChar; /* OPTION COMMENT char$: Comment, commonly a single-quote */ + char OptionStatementChar; /* OPTION STATEMENT char$: Statement Seperator, commonly ':' */ + char OptionPrintChar; /* OPTION PRINT char$: PRINT Statement, commonly '?' */ + char OptionInputChar; /* OPTION INPUT char$: INPUT Statement, commonly '!' */ + char OptionImageChar; /* OPTION IMAGE char$: IMAGE Statement, commonly ':' */ + char OptionLparenChar; /* OPTION LPAREN char$: Left Parenthesis, commonly '(' */ + char OptionRparenChar; /* OPTION RPAREN char$: Right Parenthesis, commonly ')' */ + char OptionFilenumChar; /* OPTION FILENUM char$: File Number, commonly '#' */ + char OptionAtChar; /* OPTION AT char$: PRINT AT, commonly '@' */ + char OptionUsingDigit; /* OPTION USING DIGIT char$: PRINT USING Digit placeholder, commonly '#' */ + char OptionUsingComma; /* OPTION USING COMMA char$: PRINT USING Comma, such as thousands and millions, commonly ',' */ + char OptionUsingPeriod; /* OPTION USING PERIOD char$: PRINT USING Period, such as between dollars and cents, commonly '.' */ + char OptionUsingPlus; /* OPTION USING PLUS char$: PRINT USING Plus sign, positive value, commonly '+' */ + char OptionUsingMinus; /* OPTION USING MINUS char$: PRINT USING Minus sign, negative value, commonly '-' */ + char OptionUsingExrad; /* OPTION USING EXRAD char$: PRINT USING Exponential format, commonly '^' */ + char OptionUsingDollar; /* OPTION USING DOLLAR char$: PRINT USING Currency symbol, such as dollar, commonly '$' */ + char OptionUsingFiller; /* OPTION USING FILLER char$: PRINT USING Filler, such as payroll checks, commonly '*' */ + char OptionUsingLiteral; /* OPTION USING LITERAL char$: PRINT USING Literal, commonly '_' */ + char OptionUsingFirst; /* OPTION USING FIRST char$: PRINT USING First character of a string, commonly '!' */ + char OptionUsingAll; /* OPTION USING ALL char$: PRINT USING All of a string, commonly '&' */ + char OptionUsingLength; /* OPTION USING LENGTH char$: PRINT USING Length of a string, commonly '%' */ +}; +typedef struct VersionStructure VersionType; +extern VersionType bwb_vertable[ /* NUM_VERSIONS */ ]; /* table of predefined versions */ +extern const size_t NUM_VERSIONS; /* upto 32 BASIC dialects */ +/* OptionVersionValue */ +#define B15 (1UL<< 0) /* Bywater */ +#define S70 (1UL<< 1) /* CALL/360 */ +#define C77 (1UL<< 2) /* CBASIC-II */ +#define D64 (1UL<< 3) /* Dartmouth */ +#define E78 (1UL<< 4) /* ECMA-55 */ +#define E86 (1UL<< 5) /* ECMA-116 */ +#define G74 (1UL<< 6) /* GCOS */ +#define HB1 (1UL<< 7) /* Handbook1 */ +#define HB2 (1UL<< 8) /* Handbook2 */ +#define H80 (1UL<< 9) /* Heath */ +#define G65 (1UL<<10) /* Mark-I */ +#define G67 (1UL<<11) /* Mark-II */ +#define M80 (1UL<<12) /* MBASIC */ +#define D73 (1UL<<13) /* PDP-8 */ +#define D70 (1UL<<14) /* PDP-11 */ +#define R86 (1UL<<15) /* RBASIC */ +#define D71 (1UL<<16) /* RSTS-11 */ +#define I70 (1UL<<17) /* System/360 */ +#define I73 (1UL<<18) /* System/370 */ +#define T80 (1UL<<19) /* TRS-80 */ +#define V09 (1UL<<20) /* Vintage */ +#define T79 (1UL<<21) /* XBASIC */ +#define H14 (1UL<<22) /* Haart */ +#define B93 (1UL<<23) /* Bywater-2 */ + +/* OptionFlags */ +#define OPTION_STRICT_ON 0x0001 /* Do NOT allow implicit DIM */ +#define OPTION_ANGLE_DEGREES 0x0002 /* Use degrees instead of radians */ +#define OPTION_BUGS_ON 0x0004 /* ON ... , FOR ..., VAL("X") */ +#define OPTION_LABELS_ON 0x0008 /* Labels allowed */ +#define OPTION_COMPARE_TEXT 0x0010 /* Case-Insensitive string comparison */ +#define OPTION_BUGS_BOOLEAN 0x0020 /* Boolean returns 1 or 0 instead of bitwise */ +#define OPTION_COVERAGE_ON 0x0040 /* track BASIC lines actually executed */ +#define OPTION_TRACE_ON 0x0080 /* dump BASIC stack trace when FATAL error */ +#define OPTION_ERROR_GOSUB 0X0100 /* error causes GOSUB instead of GOTO */ +#define OPTION_EXPLICIT_ON 0x0200 /* all variables must be declared via DIM */ +#define OPTION_ANGLE_GRADIANS 0x0400 /* Use gradians instead of radians */ +#define OPTION_RESERVED_0800 0x0800 /* reserved for future use */ +#define OPTION_RESERVED_1000 0x1000 /* reserved for future use */ +#define OPTION_RESERVED_2000 0x2000 /* reserved for future use */ +#define OPTION_RESERVED_4000 0x4000 /* reserved for future use */ +#define OPTION_RESERVED_8000 0x8000 /* reserved for future use */ +#define IS_CHAR( X, Y ) ( (X) == (Y) && (Y) != NulChar ) /* used with the Option...Char settings */ + + +/*------------------------------------------------------------- + VARIANT +-------------------------------------------------------------*/ +struct VariantStructure +{ + char VariantTypeCode; /* StringTypeCode and so on, NulChar == unknown */ + DoubleType Number; /* only when VariamtTypeCode != StringTypeCode */ + size_t Length; /* only when VariantTypeCode == StringTypeCode */ + char *Buffer; /* only when VariantTypeCode == StringTypeCode */ +}; +typedef struct VariantStructure VariantType; +#define CLEAR_VARIANT( X ) bwb_memset( (X), 0, sizeof( VariantType ) ) +#define RELEASE_VARIANT( X ) if( (X)->Buffer != NULL ) { free( (X)->Buffer ); (X)->Buffer = NULL; (X)->Length = 0; } +/* +any routine changing the TypeCode is required to calloc() or free() the Buffer, +this is checked by is_string_type() and is_number_type() in bwb_exp.c +*/ + + +/*------------------------------------------------------------- + GLOBAL +-------------------------------------------------------------*/ +struct GlobalStruct +{ + /* these values are not changed by OPTION VERSION */ + jmp_buf mark; /* break_handler() jumps here */ + int program_run; /* has the command-line program been run? */ + VersionType *CurrentVersion; /* OPTION VERSION */ + LineType *ThisLine; /* currently executing line */ + int IsScanRequired; /* TRUE == program needs to be rescanned */ + int IsTraceOn; /* TRUE == TRON, FALSE == TROFF */ + int IsInteractive; /* always TRUE */ + int IsCommandLineFile; /* TRUE == executing a program from the Operating System command line */ + int IsErrorPending; /* TRUE == ERR, ERL and ERROR$ have been set */ + int IsTimerOn; /* TRUE == ON TIMER ... GOSUB ... enabled */ + int IsPrinter; /* CBASIC-II: LPRINTER sets to TRUE, CONSOLE sets to FALSE */ + int LPRINT_NULLS; /* LPRINT_FILE_NUMBER */ + int SCREEN_ROWS; /* CONSOLE_FILE_NUMBER */ + int AutomaticLineNumber; /* AUTO */ + int AutomaticLineIncrement; /* AUTO */ + int LastInputCount; /* 0 == none */ + int LastLineNumber; /* LIST, LLIST */ + int LastFileNumber; /* 0 == none */ + int StartTimeInteger; /* seconds after midnight when RUN was executed */ + int NextValidLineNumber; /* verify line number order */ + int StackDepthInteger; /* stack depth count */ + LineType *DataLine; /* current DATA line for READ */ + int DataPosition; /* current position in DataLine */ + int ERR; /* ERR */ + LineType *ERL; /* ERL */ + char *ERROR4; /* ERROR$ */ + DoubleType LastDeterminant; /* 0 == error */ + DoubleType RESIDUE; /* for RBASIC's RESIDUE function */ + FILE *ExternalInputFile; /* --TAPE tapefile.inp */ + int OnTimerLineNumber; /* ON TIMER ... GOSUB ... */ + DoubleType OnTimerCount; /* ON TIMER ... GOSUB ... */ + DoubleType OnTimerExpires; /* ON TIMER ... GOSUB ... */ + LineType *ContinueLine; /* CONT */ + int IncludeLevel; /* %INCLUDE */ + DoubleType OptionSleepDouble; /* OPTION SLEEP double */ + int OptionIndentInteger; /* OPTION INDENT integer */ + int OptionTerminalType; /* OPTION TERMINAL type */ + int OptionRoundType; /* OPTION ROUND type */ + char *OptionEditString; /* OPTION EDIT string$ */ + char *OptionFilesString; /* OPTION FILES string$ */ + char *OptionRenumString; /* OPTION RENUM string$ */ + char *OptionPromptString; /* OPTION PROMPT string$ */ + char *OptionExtensionString; /* OPTION EXTENSION string$ */ + int OptionScaleInteger; /* OPTION SCALE integer */ + int OptionDigitsInteger; /* OPTION DIGITS integer */ + int OptionZoneInteger; /* OPTION ZONE integer */ + LineType *StartMarker; /* BASIC program starting marker */ + LineType *UserMarker; /* USER (immediate mode) starting marker */ + LineType *EndMarker; /* ending marker for both StartMarker and UserMarker */ + char *MaxLenBuffer; /* MAXLEN, for bwb_exp.c */ + char *NumLenBuffer; /* NUMLEN, for FormatBasicNumber(), sprintf("%d") and so on */ + char *ConsoleOutput; /* MAX_LINE_LENGTH, usually prompts and error messages */ + char *ConsoleInput; /* MAX_LINE_LENGTH, usually console and INPUT */ + VariableType *VariableHead; /* USER Variable list */ + UserFunctionType *UserFunctionHead; /* USER function-sub-label list */ + StackType *StackHead; /* USER Stack list */ + FileType *FileHead; /* USER file list (not SYSIN, SYSOUT, or SYSPRN) */ + FieldType *FieldHead; /* USER field list */ + VirtualType *VirtualHead; /* USER Virtual cross-reference list */ + FileType *SYSIN; /* FileNumber = 0, INPUT, usually stdin, OPTION SYSIN */ + FileType *SYSOUT; /* FileNumber = 0, PRINT, usually stdout, OPTION SYSOUT */ + FileType *SYSPRN; /* FileNumber < 0, LPRINT, usually stderr, OPTION SYSPRN */ + FileType *CurrentFile; /* current file for PRINT or INPUT */ + char *UseParameterString; /* CHAIN ... USE */ + int DefaultVariableType[26]; /* VariableTypeCode, A-Z */ +#if THE_PRICE_IS_RIGHT + int CommandStart[26]; /* IntrinsicCommandTable->name[0], A-Z */ + int IntrinsicFunctionStart[26]; /* IntrinsicFunctionTable->name[0], A-Z */ +#endif /* THE_PRICE_IS_RIGHT */ + char *COMMAND4[10]; /* command line parameters, COMMAND$(0-9) */ + char *ProgramFilename; /* last BASIC program filename */ +}; +typedef struct GlobalStruct GlobalType; +extern GlobalType *My; + +#define PARAM_NUMBER *argn->Value.Number +#define PARAM_LENGTH argn->Value.String->length +#define PARAM_BUFFER argn->Value.String->sbuffer +#define RESULT_NUMBER *argv->Value.Number +#define RESULT_BUFFER argv->Value.String->sbuffer +#define RESULT_LENGTH argv->Value.String->length + + +/*************************************************************** + + Compiler Specific Prototypes + +***************************************************************/ + + +#if __WATCOM__ +/* +** +** OpenWatcom 1.9 for DOS does not declare putenv() +** +*/ +extern int putenv (const char *buffer); +#endif /* __WATCOM__ */ + +#if HAVE_UNIX_GCC +/* +** +** sleep() is an intrinsic C functions in GCC using -ansi +** +*/ +#else +/* +** +** sleep() is defined in bwb_int.c to do nothing +** +*/ +extern unsigned int sleep (unsigned int X); +#endif /* HAVE_UNIX_GCC */ + +#ifndef isnan +#define isnan(x) (x != x) +#endif + +#ifndef isinf +#define isinf(x) (!isnan(x) && isnan(x - x)) +#endif + +/*************************************************************** + + Function Prototypes + +***************************************************************/ + +/*------------------------------------------------------------- + BASIC COMMANDS +-------------------------------------------------------------*/ +extern LineType *bwb_APPEND (LineType * l); +extern LineType *bwb_AS (LineType * L); +extern LineType *bwb_AUTO (LineType * L); +extern LineType *bwb_BACKSPACE (LineType * Line); +extern LineType *bwb_BREAK (LineType * l); +extern LineType *bwb_BUILD (LineType * L); +extern LineType *bwb_BYE (LineType * l); +extern LineType *bwb_CALL (LineType * l); +extern LineType *bwb_CASE (LineType * l); +extern LineType *bwb_CASE_ELSE (LineType * l); +extern LineType *bwb_CHAIN (LineType * l); +extern LineType *bwb_CHANGE (LineType * l); +extern LineType *bwb_CLEAR (LineType * l); +extern LineType *bwb_CLOAD (LineType * Line); +extern LineType *bwb_CLOAD8 (LineType * l); +extern LineType *bwb_CLOSE (LineType * Line); +extern LineType *bwb_CLR (LineType * l); +extern LineType *bwb_CMDS (LineType * l); +extern LineType *bwb_COMMON (LineType * l); +extern LineType *bwb_CONSOLE (LineType * l); +extern LineType *bwb_CONST (LineType * L); +extern LineType *bwb_CONT (LineType * l); +extern LineType *bwb_CONTINUE (LineType * l); +extern LineType *bwb_COPY (LineType * Line); +extern LineType *bwb_CREATE (LineType * l); +extern LineType *bwb_CSAVE (LineType * Line); +extern LineType *bwb_CSAVE8 (LineType * l); +extern LineType *bwb_DATA (LineType * Line); +extern LineType *bwb_DEC (LineType * L); +extern LineType *bwb_DEF (LineType * l); +extern LineType *bwb_DEF8LBL (LineType * l); +extern LineType *bwb_DEFBYT (LineType * l); +extern LineType *bwb_DEFCUR (LineType * l); +extern LineType *bwb_DEFDBL (LineType * l); +extern LineType *bwb_DEFINT (LineType * l); +extern LineType *bwb_DEFLNG (LineType * l); +extern LineType *bwb_DEFSNG (LineType * l); +extern LineType *bwb_DEFSTR (LineType * l); +extern LineType *bwb_DELETE (LineType * l); +extern LineType *bwb_DELIMIT (LineType * l); +extern LineType *bwb_DIM (LineType * l); +extern LineType *bwb_DISPLAY (LineType * Line); +extern LineType *bwb_DO (LineType * l); +extern LineType *bwb_DOS (LineType * l); +extern LineType *bwb_DSP (LineType * l); +extern LineType *bwb_EDIT (LineType * Line); +extern LineType *bwb_ELSE (LineType * l); +extern LineType *bwb_ELSEIF (LineType * l); +extern LineType *bwb_END (LineType * l); +extern LineType *bwb_END_FUNCTION (LineType * l); +extern LineType *bwb_END_IF (LineType * l); +extern LineType *bwb_END_SELECT (LineType * l); +extern LineType *bwb_END_SUB (LineType * l); +extern LineType *bwb_ERASE (LineType * l); +extern LineType *bwb_EXCHANGE (LineType * l); +extern LineType *bwb_EXIT (LineType * l); +extern LineType *bwb_EXIT_DO (LineType * l); +extern LineType *bwb_EXIT_FOR (LineType * l); +extern LineType *bwb_EXIT_FUNCTION (LineType * l); +extern LineType *bwb_EXIT_REPEAT (LineType * l); +extern LineType *bwb_EXIT_SUB (LineType * l); +extern LineType *bwb_EXIT_WHILE (LineType * l); +extern LineType *bwb_FEND (LineType * l); +extern LineType *bwb_FIELD (LineType * l); +extern LineType *bwb_FILE (LineType * l); +extern LineType *bwb_FILES (LineType * l); +extern LineType *bwb_FLEX (LineType * l); +extern LineType *bwb_FNCS (LineType * l); +extern LineType *bwb_FNEND (LineType * l); +extern LineType *bwb_FOR (LineType * l); +extern LineType *bwb_FUNCTION (LineType * l); +extern LineType *bwb_GET (LineType * Line); +extern LineType *bwb_GO (LineType * L); +extern LineType *bwb_GOODBYE (LineType * l); +extern LineType *bwb_GOSUB (LineType * l); +extern LineType *bwb_GOTO (LineType * l); +extern LineType *bwb_GO_SUB (LineType * l); +extern LineType *bwb_GO_TO (LineType * l); +extern LineType *bwb_HELP (LineType * l); +extern LineType *bwb_IF (LineType * l); +extern LineType *bwb_IF8THEN (LineType * l); +extern LineType *bwb_IF_END (LineType * l); +extern LineType *bwb_IF_MORE (LineType * l); +extern LineType *bwb_IMAGE (LineType * L); +extern LineType *bwb_INC (LineType * L); +extern LineType *bwb_INPUT (LineType * Line); +extern LineType *bwb_INPUT_LINE (LineType * Line); +extern LineType *bwb_LET (LineType * L); +extern LineType *bwb_LINE (LineType * Line); +extern LineType *bwb_LINE_INPUT (LineType * Line); +extern LineType *bwb_LIST (LineType * l); +extern LineType *bwb_LISTNH (LineType * l); +extern LineType *bwb_LLIST (LineType * l); +extern LineType *bwb_LOAD (LineType * Line); +extern LineType *bwb_LOCAL (LineType * l); +extern LineType *bwb_LOOP (LineType * l); +extern LineType *bwb_LPRINT (LineType * l); +extern LineType *bwb_LPRINTER (LineType * l); +extern LineType *bwb_LPT (LineType * l); +extern LineType *bwb_LSET (LineType * l); +extern LineType *bwb_MAINTAINER (LineType * l); +extern LineType *bwb_MAINTAINER_CMDS (LineType * l); +extern LineType *bwb_MAINTAINER_CMDS_HTML (LineType * l); +extern LineType *bwb_MAINTAINER_CMDS_ID (LineType * l); +extern LineType *bwb_MAINTAINER_CMDS_MANUAL (LineType * l); +extern LineType *bwb_MAINTAINER_CMDS_SWITCH (LineType * l); +extern LineType *bwb_MAINTAINER_CMDS_TABLE (LineType * l); +extern LineType *bwb_MAINTAINER_DEBUG (LineType * l); +extern LineType *bwb_MAINTAINER_DEBUG_OFF (LineType * l); +extern LineType *bwb_MAINTAINER_DEBUG_ON (LineType * l); +extern LineType *bwb_MAINTAINER_FNCS (LineType * l); +extern LineType *bwb_MAINTAINER_FNCS_HTML (LineType * l); +extern LineType *bwb_MAINTAINER_FNCS_ID (LineType * l); +extern LineType *bwb_MAINTAINER_FNCS_MANUAL (LineType * l); +extern LineType *bwb_MAINTAINER_FNCS_SWITCH (LineType * l); +extern LineType *bwb_MAINTAINER_FNCS_TABLE (LineType * l); +extern LineType *bwb_MAINTAINER_MANUAL (LineType * l); +extern LineType *bwb_MAINTAINER_STACK (LineType * l); +extern LineType *bwb_MARGIN (LineType * l); +extern LineType *bwb_MAT (LineType * l); +extern LineType *bwb_MAT_GET (LineType * Line); +extern LineType *bwb_MAT_INPUT (LineType * Line); +extern LineType *bwb_MAT_PRINT (LineType * l); +extern LineType *bwb_MAT_PUT (LineType * l); +extern LineType *bwb_MAT_READ (LineType * Line); +extern LineType *bwb_MAT_WRITE (LineType * l); +extern LineType *bwb_MERGE (LineType * l); +extern LineType *bwb_MID4 (LineType * l); +extern LineType *bwb_MON (LineType * l); +extern LineType *bwb_NAME (LineType * l); +extern LineType *bwb_NEW (LineType * l); +extern LineType *bwb_NEXT (LineType * l); +extern LineType *bwb_OF (LineType * L); +extern LineType *bwb_OLD (LineType * Line); +extern LineType *bwb_ON (LineType * l); +extern LineType *bwb_ON_ERROR (LineType * l); +extern LineType *bwb_ON_ERROR_GOSUB (LineType * l); +extern LineType *bwb_ON_ERROR_GOTO (LineType * l); +extern LineType *bwb_ON_ERROR_RESUME (LineType * l); +extern LineType *bwb_ON_ERROR_RESUME_NEXT (LineType * l); +extern LineType *bwb_ON_ERROR_RETURN (LineType * l); +extern LineType *bwb_ON_ERROR_RETURN_NEXT (LineType * l); +extern LineType *bwb_ON_TIMER (LineType * l); +extern LineType *bwb_OPEN (LineType * l); +extern LineType *bwb_OPTION (LineType * l); +extern LineType *bwb_OPTION_ANGLE (LineType * l); +extern LineType *bwb_OPTION_ANGLE_DEGREES (LineType * l); +extern LineType *bwb_OPTION_ANGLE_GRADIANS (LineType * l); +extern LineType *bwb_OPTION_ANGLE_RADIANS (LineType * l); +extern LineType *bwb_OPTION_ARITHMETIC (LineType * l); +extern LineType *bwb_OPTION_ARITHMETIC_DECIMAL (LineType * l); +extern LineType *bwb_OPTION_ARITHMETIC_FIXED (LineType * l); +extern LineType *bwb_OPTION_ARITHMETIC_NATIVE (LineType * l); +extern LineType *bwb_OPTION_PUNCT_AT (LineType * l); +extern LineType *bwb_OPTION_BASE (LineType * l); +extern LineType *bwb_OPTION_BUGS (LineType * l); +extern LineType *bwb_OPTION_BUGS_BOOLEAN (LineType * l); +extern LineType *bwb_OPTION_BUGS_OFF (LineType * l); +extern LineType *bwb_OPTION_BUGS_ON (LineType * l); +extern LineType *bwb_OPTION_PUNCT_BYTE (LineType * l); +extern LineType *bwb_OPTION_PUNCT_COMMENT (LineType * l); +extern LineType *bwb_OPTION_COMPARE (LineType * l); +extern LineType *bwb_OPTION_COMPARE_BINARY (LineType * l); +extern LineType *bwb_OPTION_COMPARE_DATABASE (LineType * l); +extern LineType *bwb_OPTION_COMPARE_TEXT (LineType * l); +extern LineType *bwb_OPTION_COVERAGE (LineType * l); +extern LineType *bwb_OPTION_COVERAGE_OFF (LineType * l); +extern LineType *bwb_OPTION_COVERAGE_ON (LineType * l); +extern LineType *bwb_OPTION_PUNCT_CURRENCY (LineType * l); +extern LineType *bwb_OPTION_DATE (LineType * l); +extern LineType *bwb_OPTION_DIGITS (LineType * l); +extern LineType *bwb_OPTION_DISABLE (LineType * l); +extern LineType *bwb_OPTION_DISABLE_COMMAND (LineType * l); +extern LineType *bwb_OPTION_DISABLE_FUNCTION (LineType * l); +extern LineType *bwb_OPTION_DISABLE_OPERATOR (LineType * l); +extern LineType *bwb_OPTION_PUNCT_DOUBLE (LineType * l); +extern LineType *bwb_OPTION_EDIT (LineType * l); +extern LineType *bwb_OPTION_ENABLE (LineType * l); +extern LineType *bwb_OPTION_ENABLE_COMMAND (LineType * l); +extern LineType *bwb_OPTION_ENABLE_FUNCTION (LineType * l); +extern LineType *bwb_OPTION_ENABLE_OPERATOR (LineType * l); +extern LineType *bwb_OPTION_ERROR (LineType * l); +extern LineType *bwb_OPTION_ERROR_GOSUB (LineType * l); +extern LineType *bwb_OPTION_ERROR_GOTO (LineType * l); +extern LineType *bwb_OPTION_EXPLICIT (LineType * l); +extern LineType *bwb_OPTION_PUNCT_FILENUM (LineType * l); +extern LineType *bwb_OPTION_FILES (LineType * l); +extern LineType *bwb_OPTION_PUNCT_IMAGE (LineType * l); +extern LineType *bwb_OPTION_IMPLICIT (LineType * l); +extern LineType *bwb_OPTION_INDENT (LineType * l); +extern LineType *bwb_OPTION_PUNCT_INPUT (LineType * l); +extern LineType *bwb_OPTION_PUNCT_INTEGER (LineType * l); +extern LineType *bwb_OPTION_LABELS (LineType * l); +extern LineType *bwb_OPTION_LABELS_OFF (LineType * l); +extern LineType *bwb_OPTION_LABELS_ON (LineType * l); +extern LineType *bwb_OPTION_PUNCT_LONG (LineType * l); +extern LineType *bwb_OPTION_PUNCT_LPAREN (LineType * l); +extern LineType *bwb_OPTION_PUNCT_PRINT (LineType * l); +extern LineType *bwb_OPTION_PROMPT (LineType * l); +extern LineType *bwb_OPTION_PUNCT_QUOTE (LineType * l); +extern LineType *bwb_OPTION_RECLEN (LineType * l); +extern LineType *bwb_OPTION_RENUM (LineType * l); +extern LineType *bwb_OPTION_ROUND (LineType * l); +extern LineType *bwb_OPTION_ROUND_BANK (LineType * l); +extern LineType *bwb_OPTION_ROUND_MATH (LineType * l); +extern LineType *bwb_OPTION_ROUND_TRUNCATE (LineType * l); +extern LineType *bwb_OPTION_PUNCT_RPAREN (LineType * l); +extern LineType *bwb_OPTION_SCALE (LineType * l); +extern LineType *bwb_OPTION_PUNCT_SINGLE (LineType * l); +extern LineType *bwb_OPTION_SLEEP (LineType * l); +extern LineType *bwb_OPTION_PUNCT_STATEMENT (LineType * l); +extern LineType *bwb_OPTION_STDERR (LineType * l); +extern LineType *bwb_OPTION_STDIN (LineType * l); +extern LineType *bwb_OPTION_STDOUT (LineType * l); +extern LineType *bwb_OPTION_STRICT (LineType * l); +extern LineType *bwb_OPTION_STRICT_OFF (LineType * l); +extern LineType *bwb_OPTION_STRICT_ON (LineType * l); +extern LineType *bwb_OPTION_PUNCT_STRING (LineType * l); +extern LineType *bwb_OPTION_TERMINAL (LineType * l); +extern LineType *bwb_OPTION_TERMINAL_ADM (LineType * l); +extern LineType *bwb_OPTION_TERMINAL_ANSI (LineType * l); +extern LineType *bwb_OPTION_TERMINAL_NONE (LineType * l); +extern LineType *bwb_OPTION_TIME (LineType * l); +extern LineType *bwb_OPTION_TRACE (LineType * l); +extern LineType *bwb_OPTION_TRACE_OFF (LineType * l); +extern LineType *bwb_OPTION_TRACE_ON (LineType * l); +extern LineType *bwb_OPTION_USING (LineType * l); +extern LineType *bwb_OPTION_USING_ALL (LineType * l); +extern LineType *bwb_OPTION_USING_COMMA (LineType * l); +extern LineType *bwb_OPTION_USING_DIGIT (LineType * l); +extern LineType *bwb_OPTION_USING_DOLLAR (LineType * l); +extern LineType *bwb_OPTION_USING_EXRAD (LineType * l); +extern LineType *bwb_OPTION_USING_FILLER (LineType * l); +extern LineType *bwb_OPTION_USING_FIRST (LineType * l); +extern LineType *bwb_OPTION_USING_LENGTH (LineType * l); +extern LineType *bwb_OPTION_USING_LITERAL (LineType * l); +extern LineType *bwb_OPTION_USING_MINUS (LineType * l); +extern LineType *bwb_OPTION_USING_PERIOD (LineType * l); +extern LineType *bwb_OPTION_USING_PLUS (LineType * l); +extern LineType *bwb_OPTION_VERSION (LineType * l); +extern LineType *bwb_OPTION_ZONE (LineType * l); +extern LineType *bwb_PAUSE (LineType * l); +extern LineType *bwb_PDEL (LineType * l); +extern LineType *bwb_POP (LineType * l); +extern LineType *bwb_PRINT (LineType * l); +extern LineType *bwb_PTP (LineType * l); +extern LineType *bwb_PTR (LineType * l); +extern LineType *bwb_PUT (LineType * Line); +extern LineType *bwb_QUIT (LineType * l); +extern LineType *bwb_READ (LineType * Line); +extern LineType *bwb_RECALL (LineType * l); +extern LineType *bwb_REM (LineType * L); +extern LineType *bwb_RENAME (LineType * l); +extern LineType *bwb_RENUM (LineType * Line); +extern LineType *bwb_RENUMBER (LineType * Line); +extern LineType *bwb_REPEAT (LineType * l); +extern LineType *bwb_REPLACE (LineType * Line); +extern LineType *bwb_RESET (LineType * Line); +extern LineType *bwb_RESTORE (LineType * Line); +extern LineType *bwb_RESUME (LineType * l); +extern LineType *bwb_RETURN (LineType * l); +extern LineType *bwb_RSET (LineType * l); +extern LineType *bwb_RUN (LineType * L); +extern LineType *bwb_RUNNH (LineType * L); +extern LineType *bwb_SAVE (LineType * l); +extern LineType *bwb_SCRATCH (LineType * l); +extern LineType *bwb_SELECT (LineType * l); +extern LineType *bwb_SELECT_CASE (LineType * l); +extern LineType *bwb_STEP (LineType * L); +extern LineType *bwb_STOP (LineType * l); +extern LineType *bwb_STORE (LineType * l); +extern LineType *bwb_SUB (LineType * l); +extern LineType *bwb_SUBEND (LineType * l); +extern LineType *bwb_SUBEXIT (LineType * l); +extern LineType *bwb_SUB_END (LineType * l); +extern LineType *bwb_SUB_EXIT (LineType * l); +extern LineType *bwb_SWAP (LineType * l); +extern LineType *bwb_SYSTEM (LineType * l); +extern LineType *bwb_TEXT (LineType * l); +extern LineType *bwb_THEN (LineType * L); +extern LineType *bwb_TIMER (LineType * l); +extern LineType *bwb_TIMER_OFF (LineType * l); +extern LineType *bwb_TIMER_ON (LineType * l); +extern LineType *bwb_TIMER_STOP (LineType * l); +extern LineType *bwb_TLOAD (LineType * Line); +extern LineType *bwb_TO (LineType * L); +extern LineType *bwb_TRACE (LineType * l); +extern LineType *bwb_TRACE_OFF (LineType * l); +extern LineType *bwb_TRACE_ON (LineType * l); +extern LineType *bwb_TSAVE (LineType * Line); +extern LineType *bwb_TTY (LineType * l); +extern LineType *bwb_TTY_IN (LineType * l); +extern LineType *bwb_TTY_OUT (LineType * l); +extern LineType *bwb_UNTIL (LineType * l); +extern LineType *bwb_USE (LineType * l); +extern LineType *bwb_VARS (LineType * l); +extern LineType *bwb_vector (LineType * l); +extern LineType *bwb_WEND (LineType * l); +extern LineType *bwb_WHILE (LineType * l); +extern LineType *bwb_WRITE (LineType * l); +extern LineType *bwb_OPTION_PUNCT (LineType * l); +extern LineType *bwb_OPTION_EXTENSION (LineType * l); + +/*------------------------------------------------------------- + INTERNALS +-------------------------------------------------------------*/ +extern int binary_get_put (VariableType * Variable, int IsPUT); +extern int buff_is_eol (char *buffer, int *position); +extern int buff_peek_array_dimensions (char *buffer, int *position, + int *n_params); +extern int buff_peek_char (char *buffer, int *position, char find); +extern int buff_peek_EqualChar (char *buffer, int *position); +extern int buff_peek_LparenChar (char *buffer, int *position); +extern int buff_peek_QuoteChar (char *buffer, int *position); +#if FALSE /* kepp this ... */ +extern int buff_peek_word (char *buffer, int *position, char *find); +#endif +extern int buff_read_array_dimensions (char *buffer, int *position, + int *n_params, int params[]); +extern int buff_read_array_redim (char *buffer, int *position, + int *dimensions, int LBOUND[], + int UBOUND[]); +extern ResultType buff_read_decimal_constant (char *buffer, int *position, + VariantType * X, + int IsConsoleInput); +extern int buff_read_expression (char *buffer, int *position, + VariantType * X); +extern ResultType buff_read_hexadecimal_constant (char *buffer, int *position, + VariantType * X, + int IsConsoleInput); +extern int buff_read_index_item (char *buffer, int *position, int Index, + int *Value); +extern int buff_read_integer_expression (char *buffer, int *position, + int *Value); +extern int buff_read_label (char *buffer, int *position, char *label); +extern int buff_read_letter_sequence (char *buffer, int *position, char *head, + char *tail); +extern int buff_read_line_number (char *buffer, int *position, int *linenum); +extern int buff_read_line_sequence (char *buffer, int *position, int *head, + int *tail); +extern VariableType *buff_read_matrix (char *buffer, int *position); +extern int buff_read_numeric_expression (char *buffer, int *position, + DoubleType * Value); +extern ResultType buff_read_octal_constant (char *buffer, int *position, + VariantType * X, + int IsConsoleInput); +extern VariableType *buff_read_scalar (char *buffer, int *position); +extern int buff_read_string_expression (char *buffer, int *position, + char **Value); +extern char buff_read_type_declaration (char *buffer, int *position); +extern int buff_read_varname (char *buffer, int *position, char *varname); +extern int buff_skip_AtChar (char *buffer, int *position); +extern int buff_skip_char (char *buffer, int *position, char find); +extern int buff_skip_CommaChar (char *buffer, int *position); +extern void buff_skip_eol (char *buffer, int *position); +extern int buff_skip_EqualChar (char *buffer, int *position); +extern int buff_skip_FilenumChar (char *buffer, int *position); +extern int buff_skip_LparenChar (char *buffer, int *position); +extern int buff_skip_MinusChar (char *buffer, int *position); +extern int buff_skip_PlusChar (char *buffer, int *position); +extern int buff_skip_RparenChar (char *buffer, int *position); +extern int buff_skip_SemicolonChar (char *buffer, int *position); +extern char buff_skip_seperator (char *buffer, int *position); +extern void buff_skip_spaces (char *buffer, int *position); +extern int buff_skip_StarChar (char *buffer, int *position); +extern int buff_skip_word (char *buffer, int *position, char *find); +extern void bwb_clrexec (void); +extern void bwb_decexec (void); +extern void bwb_execline (void); +extern void bwb_fclose (FILE * file); +extern void bwb_file_open (char A, int x, char *B, int y); +extern int bwb_fload (char *FileName); +extern int bwb_freeline (LineType * l); +extern int bwb_incexec (void); +extern int bwb_isalnum (int C); +extern int bwb_isalpha (int C); +#if FALSE /* keep this ... */ +extern int bwb_iscntrl (int C); +#endif +extern int bwb_isdigit (int C); +extern int bwb_isgraph (int C); +#if FALSE /* keep this ... */ +extern int bwb_islower (int C); +#endif +extern int bwb_isprint (int C); +extern int bwb_ispunct (int C); +#if FALSE /* keep this ... */ +extern int bwb_isspace (int C); +#endif +#if FALSE /* keep this ... */ +extern int bwb_isupper (int C); +#endif +extern int bwb_isxdigit (int C); +extern int bwb_is_eof (FILE * fp); +extern void bwb_mainloop (void); +#if FALSE /* keep this ... */ +extern void *bwb_memchr (const void *s, int c, size_t n); +#endif +extern int bwb_memcmp (const void *s1, const void *s2, size_t n); +extern void *bwb_memcpy (void *s1, const void *s2, size_t n); +#if FALSE /* keep this ... */ +extern void *bwb_memmove (void *s1, const void *s2, size_t n); +#endif +extern void *bwb_memset (void *s, int c, size_t n); +extern LineType *bwb_option_punct_char (LineType * l, char *c); +extern LineType *bwb_option_range_integer (LineType * l, int *Integer, + int MinVal, int MaxVal); +extern double bwb_rint (double x); +extern int bwb_scan (void); +extern char *bwb_strcat (char *s1, const char *s2); +extern char *bwb_strchr (const char *s, int c); +extern int bwb_strcmp (const char *s1, const char *s2); +extern char *bwb_strcpy (char *s1, const char *s2); +extern char *bwb_strdup (char *s); +extern char *bwb_strdup2 (char *s, char *t); +extern int bwb_stricmp (const char *s1, const char *s2); +extern size_t bwb_strlen (const char *s); +#if FALSE /* keep this ... */ +extern char *bwb_strncat (char *s1, const char *s2, size_t n); +#endif +#if FALSE /* keep this ... */ +extern int bwb_strncmp (const char *s1, const char *s2, size_t n); +#endif +extern char *bwb_strncpy (char *s1, const char *s2, size_t n); +extern int bwb_strnicmp (const char *s1, const char *s2, size_t n); +extern char *bwb_strrchr (const char *s, int c); +extern int bwb_tolower (int C); +extern int bwb_toupper (int C); +extern void bwb_xnew (LineType * l); +extern void bwx_CLS (void); +extern void bwx_COLOR (int Fore, int Back); +extern int bwx_Error (int ERR, char *ErrorMessage); +extern int bwx_input (char *prompt, int IsDisplayQuestionMark, char *answer, + int MaxLen); +extern void bwx_LOCATE (int Row, int Col); +extern void bwx_STOP (int IsShowMessage); +extern void bwx_terminate (void); +extern DoubleType bwx_TIMER (DoubleType Seconds); +extern char Char_to_TypeCode (char C); +extern void CleanLine (char *buffer); +extern void clear_virtual_by_file (int FileNumber); +extern void Determinant (VariableType * v); +extern void DumpAllCommandHtmlTable (FILE * file); +extern void DumpAllCommandSwitchStatement (FILE * file); +extern void DumpAllCommandSyntax (FILE * file, int IsXref, + OptionVersionType OptionVersionValue); +extern void DumpAllCommandTableDefinitions (FILE * file); +extern void DumpAllCommandUniqueID (FILE * file); +extern void DumpAllFuctionTableDefinitions (FILE * file); +extern void DumpAllFunctionHtmlTable (FILE * file); +extern void DumpAllFunctionSwitch (FILE * file); +extern void DumpAllFunctionSyntax (FILE * file, int IsXref, + OptionVersionType OptionVersionValue); +extern void DumpAllFunctionUniqueID (FILE * file); +extern void DumpAllOperatorSyntax (FILE * file, int IsXref, + OptionVersionType OptionVersionValue); +extern void DumpHeader (FILE * file); +extern void DumpOneCommandSyntax (FILE * file, int IsXref, int n); +extern void DumpOneFunctionSyntax (FILE * file, int IsXref, int n); +extern void DumpOneOperatorSyntax (FILE * file, int IsXref, int n); +extern void field_close_file (FileType * File); +extern void field_free_variable (VariableType * Var); +extern void field_get (FileType * File); +extern void field_put (FileType * File); +extern void file_clear (FileType * F); +extern FileType *file_new (void); +extern int file_next_number (void); +extern FileType *find_file_by_name (char *FileName); +extern FileType *find_file_by_number (int FileNumber); +extern LineType *find_line_number (int number); +extern void FixDescription (FILE * file, const char *left, const char *right); +extern void FormatBasicNumber (DoubleType Input, char *Output); +extern int GetOnError (void); +extern void IntrinsicFunctionDefinitionCheck (IntrinsicFunctionType * f); +extern void IntrinsicFunctionSyntax (IntrinsicFunctionType * f, char *Syntax); +extern void IntrinsicFunctionUniqueID (IntrinsicFunctionType * f, + char *UniqueID); +extern VariableType *IntrinsicFunction_deffn (int argc, VariableType * argv, + UserFunctionType * f); +extern VariableType *IntrinsicFunction_execute (int argc, VariableType * argv, + IntrinsicFunctionType * f); +extern IntrinsicFunctionType *IntrinsicFunction_find_exact (char *name, + int + ParameterCount, + ParamBitsType + ParameterTypes); +extern int IntrinsicFunction_init (void); +extern int IntrinsicFunction_name (char *name); +extern int InvertMatrix (VariableType * vOut, VariableType * vIn); +extern int IsLastKeyword (LineType * l, char *Keyword); +extern int IsLike (char *buffer, int *buffer_count, int buffer_Length, + char *pattern, int *pattern_count, int pattern_Length); +extern int is_empty_string (char *Buffer); +extern int line_is_eol (LineType * line); +#if FALSE /* kepp this ... */ +extern int line_peek_array_dimensions (LineType * line, int *n_params); +#endif +#if FALSE /* kepp this ... */ +extern int line_peek_char (LineType * line, char find); +#endif +extern int line_peek_EqualChar (LineType * line); +extern int line_peek_LparenChar (LineType * line); +extern int line_peek_QuoteChar (LineType * line); +#if FALSE /* kepp this ... */ +extern int line_peek_word (LineType * line, char *find); +#endif +#if FALSE /* kepp this ... */ +extern int line_read_array_dimensions (LineType * line, int *n_params, + int params[]); +#endif +extern int line_read_array_redim (LineType * line, int *dimensions, + int LBOUND[], int UBOUND[]); +extern int line_read_expression (LineType * line, VariantType * X); +extern int line_read_index_item (LineType * line, int Index, int *Value); +extern int line_read_integer_expression (LineType * line, int *Value); +extern int line_read_label (LineType * line, char *label); +extern int line_read_letter_sequence (LineType * line, char *head, + char *tail); +extern int line_read_line_number (LineType * line, int *linenum); +extern int line_read_line_sequence (LineType * line, int *head, int *tail); +extern VariableType *line_read_matrix (LineType * line); +extern int line_read_numeric_expression (LineType * line, DoubleType * Value); +extern VariableType *line_read_scalar (LineType * line); +extern int line_read_string_expression (LineType * line, char **Value); +extern char line_read_type_declaration (LineType * line); +extern int line_read_varname (LineType * line, char *varname); +extern int line_skip_AtChar (LineType * line); +extern int line_skip_char (LineType * line, char find); +extern int line_skip_CommaChar (LineType * line); +extern void line_skip_eol (LineType * line); +extern int line_skip_EqualChar (LineType * line); +extern int line_skip_FilenumChar (LineType * line); +extern int line_skip_LparenChar (LineType * line); +extern int line_skip_MinusChar (LineType * line); +extern int line_skip_PlusChar (LineType * line); +extern int line_skip_RparenChar (LineType * line); +extern int line_skip_SemicolonChar (LineType * line); +extern char line_skip_seperator (LineType * line); +extern void line_skip_spaces (LineType * line); +extern int line_skip_StarChar (LineType * line); +extern int line_skip_word (LineType * line, char *find); +extern void line_start (LineType * l); +extern int main (int argc, char **argv); +extern VariableType *mat_find (char *name); +extern int NumberValueCheck (ParamTestType ParameterTests, DoubleType X); +extern void OptionVersionSet (int i); +extern void ResetConsoleColumn (void); +extern void SetOnError (int LineNumber); +extern void SortAllCommands (void); +extern void SortAllFunctions (void); +extern void SortAllOperators (void); +extern int StringLengthCheck (ParamTestType ParameterTests, int s); +extern int str_btob (StringType * d, StringType * s); +extern int str_cmp (StringType * a, StringType * b); +extern int str_match (char *A, int A_Length, char *B, int B_Length, + int I_Start); +extern char TypeCode_to_Char (char TypeCode); +extern int UserFunction_add (LineType * l); +extern int UserFunction_addlocalvar (UserFunctionType * f, VariableType * v); +extern UserFunctionType *UserFunction_find_exact (char *name, + unsigned char + ParameterCount, + ParamBitsType + ParameterTypes); +extern int UserFunction_init (void); +extern int UserFunction_name (char *name); +extern int VarTypeIndex (char C); +extern VariableType *var_chain (VariableType * argv); +extern void var_CLEAR (void); +extern int var_delcvars (void); +extern VariableType *var_find (char *name, int dimensions, int IsImplicit); +extern VariableType *var_free (VariableType * variable); +extern int var_get (VariableType * variable, VariantType * variant); +extern int var_init (void); +extern int var_make (VariableType * variable, char TypeCode); +extern char var_nametype (char *name); +extern VariableType *var_new (char *name, char TypeCode); +extern int var_set (VariableType * variable, VariantType * variant); + + +/*------------------------------------------------------------- + COMMANDS (CommandID) +-------------------------------------------------------------*/ +#define C_DEF8LBL -1 /* DEF*LBL */ +/* COMMANDS */ +#define C_APPEND 1 /* APPEND */ +#define C_AS 2 /* AS */ +#define C_AUTO 3 /* AUTO */ +#define C_BACKSPACE 4 /* BACKSPACE */ +#define C_BREAK 5 /* BREAK */ +#define C_BUILD 6 /* BUILD */ +#define C_BYE 7 /* BYE */ +#define C_CALL 8 /* CALL */ +#define C_CASE 9 /* CASE */ +#define C_CASE_ELSE 10 /* CASE ELSE */ +#define C_CHAIN 11 /* CHAIN */ +#define C_CHANGE 12 /* CHANGE */ +#define C_CLEAR 13 /* CLEAR */ +#define C_CLOAD 14 /* CLOAD */ +#define C_CLOAD8 15 /* CLOAD* */ +#define C_CLOSE 16 /* CLOSE */ +#define C_CLR 17 /* CLR */ +#define C_CMDS 18 /* CMDS */ +#define C_COMMON 19 /* COMMON */ +#define C_CONSOLE 20 /* CONSOLE */ +#define C_CONST 21 /* CONST */ +#define C_CONT 22 /* CONT */ +#define C_CONTINUE 23 /* CONTINUE */ +#define C_COPY 24 /* COPY */ +#define C_CREATE 25 /* CREATE */ +#define C_CSAVE 26 /* CSAVE */ +#define C_CSAVE8 27 /* CSAVE* */ +#define C_DATA 28 /* DATA */ +#define C_DEC 29 /* DEC */ +#define C_DEF 30 /* DEF */ +#define C_DEFBYT 31 /* DEFBYT */ +#define C_DEFCUR 32 /* DEFCUR */ +#define C_DEFDBL 33 /* DEFDBL */ +#define C_DEFINT 34 /* DEFINT */ +#define C_DEFLNG 35 /* DEFLNG */ +#define C_DEFSNG 36 /* DEFSNG */ +#define C_DEFSTR 37 /* DEFSTR */ +#define C_DELETE 38 /* DELETE */ +#define C_DELIMIT 39 /* DELIMIT */ +#define C_DIM 40 /* DIM */ +#define C_DISPLAY 41 /* DISPLAY */ +#define C_DO 42 /* DO */ +#define C_DOS 43 /* DOS */ +#define C_DSP 44 /* DSP */ +#define C_EDIT 45 /* EDIT */ +#define C_ELSE 46 /* ELSE */ +#define C_ELSEIF 47 /* ELSEIF */ +#define C_END 48 /* END */ +#define C_END_FUNCTION 49 /* END FUNCTION */ +#define C_END_IF 50 /* END IF */ +#define C_END_SELECT 51 /* END SELECT */ +#define C_END_SUB 52 /* END SUB */ +#define C_ERASE 53 /* ERASE */ +#define C_EXCHANGE 54 /* EXCHANGE */ +#define C_EXIT 55 /* EXIT */ +#define C_EXIT_DO 56 /* EXIT DO */ +#define C_EXIT_FOR 57 /* EXIT FOR */ +#define C_EXIT_FUNCTION 58 /* EXIT FUNCTION */ +#define C_EXIT_REPEAT 59 /* EXIT REPEAT */ +#define C_EXIT_SUB 60 /* EXIT SUB */ +#define C_EXIT_WHILE 61 /* EXIT WHILE */ +#define C_FEND 62 /* FEND */ +#define C_FIELD 63 /* FIELD */ +#define C_FILE 64 /* FILE */ +#define C_FILES 65 /* FILES */ +#define C_FLEX 66 /* FLEX */ +#define C_FNCS 67 /* FNCS */ +#define C_FNEND 68 /* FNEND */ +#define C_FOR 69 /* FOR */ +#define C_FUNCTION 70 /* FUNCTION */ +#define C_GET 71 /* GET */ +#define C_GO 72 /* GO */ +#define C_GO_SUB 73 /* GO SUB */ +#define C_GO_TO 74 /* GO TO */ +#define C_GOODBYE 75 /* GOODBYE */ +#define C_GOSUB 76 /* GOSUB */ +#define C_GOTO 77 /* GOTO */ +#define C_HELP 78 /* HELP */ +#define C_IF 79 /* IF */ +#define C_IF_END 80 /* IF END */ +#define C_IF_MORE 81 /* IF MORE */ +#define C_IF8THEN 82 /* IF*THEN */ +#define C_IMAGE 83 /* IMAGE */ +#define C_INC 84 /* INC */ +#define C_INPUT 85 /* INPUT */ +#define C_INPUT_LINE 86 /* INPUT LINE */ +#define C_LET 87 /* LET */ +#define C_LINE 88 /* LINE */ +#define C_LINE_INPUT 89 /* LINE INPUT */ +#define C_LIST 90 /* LIST */ +#define C_LISTNH 91 /* LISTNH */ +#define C_LLIST 92 /* LLIST */ +#define C_LOAD 93 /* LOAD */ +#define C_LOCAL 94 /* LOCAL */ +#define C_LOOP 95 /* LOOP */ +#define C_LPRINT 96 /* LPRINT */ +#define C_LPRINTER 97 /* LPRINTER */ +#define C_LPT 98 /* LPT */ +#define C_LSET 99 /* LSET */ +#define C_MAINTAINER 100 /* MAINTAINER */ +#define C_MAINTAINER_CMDS 101 /* MAINTAINER CMDS */ +#define C_MAINTAINER_CMDS_HTML 102 /* MAINTAINER CMDS HTML */ +#define C_MAINTAINER_CMDS_ID 103 /* MAINTAINER CMDS ID */ +#define C_MAINTAINER_CMDS_MANUAL 104 /* MAINTAINER CMDS MANUAL */ +#define C_MAINTAINER_CMDS_SWITCH 105 /* MAINTAINER CMDS SWITCH */ +#define C_MAINTAINER_CMDS_TABLE 106 /* MAINTAINER CMDS TABLE */ +#define C_MAINTAINER_DEBUG 107 /* MAINTAINER DEBUG */ +#define C_MAINTAINER_DEBUG_OFF 108 /* MAINTAINER DEBUG OFF */ +#define C_MAINTAINER_DEBUG_ON 109 /* MAINTAINER DEBUG ON */ +#define C_MAINTAINER_FNCS 110 /* MAINTAINER FNCS */ +#define C_MAINTAINER_FNCS_HTML 111 /* MAINTAINER FNCS HTML */ +#define C_MAINTAINER_FNCS_ID 112 /* MAINTAINER FNCS ID */ +#define C_MAINTAINER_FNCS_MANUAL 113 /* MAINTAINER FNCS MANUAL */ +#define C_MAINTAINER_FNCS_SWITCH 114 /* MAINTAINER FNCS SWITCH */ +#define C_MAINTAINER_FNCS_TABLE 115 /* MAINTAINER FNCS TABLE */ +#define C_MAINTAINER_MANUAL 116 /* MAINTAINER MANUAL */ +#define C_MAINTAINER_STACK 117 /* MAINTAINER STACK */ +#define C_MARGIN 118 /* MARGIN */ +#define C_MAT 119 /* MAT */ +#define C_MAT_GET 120 /* MAT GET */ +#define C_MAT_INPUT 121 /* MAT INPUT */ +#define C_MAT_PRINT 122 /* MAT PRINT */ +#define C_MAT_PUT 123 /* MAT PUT */ +#define C_MAT_READ 124 /* MAT READ */ +#define C_MAT_WRITE 125 /* MAT WRITE */ +#define C_MERGE 126 /* MERGE */ +#define C_MID4 127 /* MID$ */ +#define C_MON 128 /* MON */ +#define C_NAME 129 /* NAME */ +#define C_NEW 130 /* NEW */ +#define C_NEXT 131 /* NEXT */ +#define C_OF 132 /* OF */ +#define C_OLD 133 /* OLD */ +#define C_ON 134 /* ON */ +#define C_ON_ERROR 135 /* ON ERROR */ +#define C_ON_ERROR_GOSUB 136 /* ON ERROR GOSUB */ +#define C_ON_ERROR_GOTO 137 /* ON ERROR GOTO */ +#define C_ON_ERROR_RESUME 138 /* ON ERROR RESUME */ +#define C_ON_ERROR_RESUME_NEXT 139 /* ON ERROR RESUME NEXT */ +#define C_ON_ERROR_RETURN 140 /* ON ERROR RETURN */ +#define C_ON_ERROR_RETURN_NEXT 141 /* ON ERROR RETURN NEXT */ +#define C_ON_TIMER 142 /* ON TIMER */ +#define C_OPEN 143 /* OPEN */ +#define C_OPTION 144 /* OPTION */ +#define C_OPTION_ANGLE 145 /* OPTION ANGLE */ +#define C_OPTION_ANGLE_DEGREES 146 /* OPTION ANGLE DEGREES */ +#define C_OPTION_ANGLE_GRADIANS 147 /* OPTION ANGLE GRADIANS */ +#define C_OPTION_ANGLE_RADIANS 148 /* OPTION ANGLE RADIANS */ +#define C_OPTION_ARITHMETIC 149 /* OPTION ARITHMETIC */ +#define C_OPTION_ARITHMETIC_DECIMAL 150 /* OPTION ARITHMETIC DECIMAL */ +#define C_OPTION_ARITHMETIC_FIXED 151 /* OPTION ARITHMETIC FIXED */ +#define C_OPTION_ARITHMETIC_NATIVE 152 /* OPTION ARITHMETIC NATIVE */ +#define C_OPTION_BASE 153 /* OPTION BASE */ +#define C_OPTION_BUGS 154 /* OPTION BUGS */ +#define C_OPTION_BUGS_BOOLEAN 155 /* OPTION BUGS BOOLEAN */ +#define C_OPTION_BUGS_OFF 156 /* OPTION BUGS OFF */ +#define C_OPTION_BUGS_ON 157 /* OPTION BUGS ON */ +#define C_OPTION_COMPARE 158 /* OPTION COMPARE */ +#define C_OPTION_COMPARE_BINARY 159 /* OPTION COMPARE BINARY */ +#define C_OPTION_COMPARE_DATABASE 160 /* OPTION COMPARE DATABASE */ +#define C_OPTION_COMPARE_TEXT 161 /* OPTION COMPARE TEXT */ +#define C_OPTION_COVERAGE 162 /* OPTION COVERAGE */ +#define C_OPTION_COVERAGE_OFF 163 /* OPTION COVERAGE OFF */ +#define C_OPTION_COVERAGE_ON 164 /* OPTION COVERAGE ON */ +#define C_OPTION_DATE 165 /* OPTION DATE */ +#define C_OPTION_DIGITS 166 /* OPTION DIGITS */ +#define C_OPTION_DISABLE 167 /* OPTION DISABLE */ +#define C_OPTION_DISABLE_COMMAND 168 /* OPTION DISABLE COMMAND */ +#define C_OPTION_DISABLE_FUNCTION 169 /* OPTION DISABLE FUNCTION */ +#define C_OPTION_DISABLE_OPERATOR 170 /* OPTION DISABLE OPERATOR */ +#define C_OPTION_EDIT 171 /* OPTION EDIT */ +#define C_OPTION_ENABLE 172 /* OPTION ENABLE */ +#define C_OPTION_ENABLE_COMMAND 173 /* OPTION ENABLE COMMAND */ +#define C_OPTION_ENABLE_FUNCTION 174 /* OPTION ENABLE FUNCTION */ +#define C_OPTION_ENABLE_OPERATOR 175 /* OPTION ENABLE OPERATOR */ +#define C_OPTION_ERROR 176 /* OPTION ERROR */ +#define C_OPTION_ERROR_GOSUB 177 /* OPTION ERROR GOSUB */ +#define C_OPTION_ERROR_GOTO 178 /* OPTION ERROR GOTO */ +#define C_OPTION_EXPLICIT 179 /* OPTION EXPLICIT */ +#define C_OPTION_EXTENSION 180 /* OPTION EXTENSION */ +#define C_OPTION_FILES 181 /* OPTION FILES */ +#define C_OPTION_IMPLICIT 182 /* OPTION IMPLICIT */ +#define C_OPTION_INDENT 183 /* OPTION INDENT */ +#define C_OPTION_LABELS 184 /* OPTION LABELS */ +#define C_OPTION_LABELS_OFF 185 /* OPTION LABELS OFF */ +#define C_OPTION_LABELS_ON 186 /* OPTION LABELS ON */ +#define C_OPTION_PROMPT 187 /* OPTION PROMPT */ +#define C_OPTION_PUNCT 188 /* OPTION PUNCT */ +#define C_OPTION_PUNCT_AT 189 /* OPTION PUNCT AT */ +#define C_OPTION_PUNCT_BYTE 190 /* OPTION PUNCT BYTE */ +#define C_OPTION_PUNCT_COMMENT 191 /* OPTION PUNCT COMMENT */ +#define C_OPTION_PUNCT_CURRENCY 192 /* OPTION PUNCT CURRENCY */ +#define C_OPTION_PUNCT_DOUBLE 193 /* OPTION PUNCT DOUBLE */ +#define C_OPTION_PUNCT_FILENUM 194 /* OPTION PUNCT FILENUM */ +#define C_OPTION_PUNCT_IMAGE 195 /* OPTION PUNCT IMAGE */ +#define C_OPTION_PUNCT_INPUT 196 /* OPTION PUNCT INPUT */ +#define C_OPTION_PUNCT_INTEGER 197 /* OPTION PUNCT INTEGER */ +#define C_OPTION_PUNCT_LONG 198 /* OPTION PUNCT LONG */ +#define C_OPTION_PUNCT_LPAREN 199 /* OPTION PUNCT LPAREN */ +#define C_OPTION_PUNCT_PRINT 200 /* OPTION PUNCT PRINT */ +#define C_OPTION_PUNCT_QUOTE 201 /* OPTION PUNCT QUOTE */ +#define C_OPTION_PUNCT_RPAREN 202 /* OPTION PUNCT RPAREN */ +#define C_OPTION_PUNCT_SINGLE 203 /* OPTION PUNCT SINGLE */ +#define C_OPTION_PUNCT_STATEMENT 204 /* OPTION PUNCT STATEMENT */ +#define C_OPTION_PUNCT_STRING 205 /* OPTION PUNCT STRING */ +#define C_OPTION_RECLEN 206 /* OPTION RECLEN */ +#define C_OPTION_RENUM 207 /* OPTION RENUM */ +#define C_OPTION_ROUND 208 /* OPTION ROUND */ +#define C_OPTION_ROUND_BANK 209 /* OPTION ROUND BANK */ +#define C_OPTION_ROUND_MATH 210 /* OPTION ROUND MATH */ +#define C_OPTION_ROUND_TRUNCATE 211 /* OPTION ROUND TRUNCATE */ +#define C_OPTION_SCALE 212 /* OPTION SCALE */ +#define C_OPTION_SLEEP 213 /* OPTION SLEEP */ +#define C_OPTION_STDERR 214 /* OPTION STDERR */ +#define C_OPTION_STDIN 215 /* OPTION STDIN */ +#define C_OPTION_STDOUT 216 /* OPTION STDOUT */ +#define C_OPTION_STRICT 217 /* OPTION STRICT */ +#define C_OPTION_STRICT_OFF 218 /* OPTION STRICT OFF */ +#define C_OPTION_STRICT_ON 219 /* OPTION STRICT ON */ +#define C_OPTION_TERMINAL 220 /* OPTION TERMINAL */ +#define C_OPTION_TERMINAL_ADM 221 /* OPTION TERMINAL ADM */ +#define C_OPTION_TERMINAL_ANSI 222 /* OPTION TERMINAL ANSI */ +#define C_OPTION_TERMINAL_NONE 223 /* OPTION TERMINAL NONE */ +#define C_OPTION_TIME 224 /* OPTION TIME */ +#define C_OPTION_TRACE 225 /* OPTION TRACE */ +#define C_OPTION_TRACE_OFF 226 /* OPTION TRACE OFF */ +#define C_OPTION_TRACE_ON 227 /* OPTION TRACE ON */ +#define C_OPTION_USING 228 /* OPTION USING */ +#define C_OPTION_USING_ALL 229 /* OPTION USING ALL */ +#define C_OPTION_USING_COMMA 230 /* OPTION USING COMMA */ +#define C_OPTION_USING_DIGIT 231 /* OPTION USING DIGIT */ +#define C_OPTION_USING_DOLLAR 232 /* OPTION USING DOLLAR */ +#define C_OPTION_USING_EXRAD 233 /* OPTION USING EXRAD */ +#define C_OPTION_USING_FILLER 234 /* OPTION USING FILLER */ +#define C_OPTION_USING_FIRST 235 /* OPTION USING FIRST */ +#define C_OPTION_USING_LENGTH 236 /* OPTION USING LENGTH */ +#define C_OPTION_USING_LITERAL 237 /* OPTION USING LITERAL */ +#define C_OPTION_USING_MINUS 238 /* OPTION USING MINUS */ +#define C_OPTION_USING_PERIOD 239 /* OPTION USING PERIOD */ +#define C_OPTION_USING_PLUS 240 /* OPTION USING PLUS */ +#define C_OPTION_VERSION 241 /* OPTION VERSION */ +#define C_OPTION_ZONE 242 /* OPTION ZONE */ +#define C_PAUSE 243 /* PAUSE */ +#define C_PDEL 244 /* PDEL */ +#define C_POP 245 /* POP */ +#define C_PRINT 246 /* PRINT */ +#define C_PTP 247 /* PTP */ +#define C_PTR 248 /* PTR */ +#define C_PUT 249 /* PUT */ +#define C_QUIT 250 /* QUIT */ +#define C_READ 251 /* READ */ +#define C_RECALL 252 /* RECALL */ +#define C_REM 253 /* REM */ +#define C_RENAME 254 /* RENAME */ +#define C_RENUM 255 /* RENUM */ +#define C_RENUMBER 256 /* RENUMBER */ +#define C_REPEAT 257 /* REPEAT */ +#define C_REPLACE 258 /* REPLACE */ +#define C_RESET 259 /* RESET */ +#define C_RESTORE 260 /* RESTORE */ +#define C_RESUME 261 /* RESUME */ +#define C_RETURN 262 /* RETURN */ +#define C_RSET 263 /* RSET */ +#define C_RUN 264 /* RUN */ +#define C_RUNNH 265 /* RUNNH */ +#define C_SAVE 266 /* SAVE */ +#define C_SCRATCH 267 /* SCRATCH */ +#define C_SELECT 268 /* SELECT */ +#define C_SELECT_CASE 269 /* SELECT CASE */ +#define C_STEP 270 /* STEP */ +#define C_STOP 271 /* STOP */ +#define C_STORE 272 /* STORE */ +#define C_SUB 273 /* SUB */ +#define C_SUB_END 274 /* SUB END */ +#define C_SUB_EXIT 275 /* SUB EXIT */ +#define C_SUBEND 276 /* SUBEND */ +#define C_SUBEXIT 277 /* SUBEXIT */ +#define C_SWAP 278 /* SWAP */ +#define C_SYSTEM 279 /* SYSTEM */ +#define C_TEXT 280 /* TEXT */ +#define C_THEN 281 /* THEN */ +#define C_TIMER 282 /* TIMER */ +#define C_TIMER_OFF 283 /* TIMER OFF */ +#define C_TIMER_ON 284 /* TIMER ON */ +#define C_TIMER_STOP 285 /* TIMER STOP */ +#define C_TLOAD 286 /* TLOAD */ +#define C_TO 287 /* TO */ +#define C_TRACE 288 /* TRACE */ +#define C_TRACE_OFF 289 /* TRACE OFF */ +#define C_TRACE_ON 290 /* TRACE ON */ +#define C_TSAVE 291 /* TSAVE */ +#define C_TTY 292 /* TTY */ +#define C_TTY_IN 293 /* TTY IN */ +#define C_TTY_OUT 294 /* TTY OUT */ +#define C_UNTIL 295 /* UNTIL */ +#define C_USE 296 /* USE */ +#define C_VARS 297 /* VARS */ +#define C_WEND 298 /* WEND */ +#define C_WHILE 299 /* WHILE */ +#define C_WRITE 300 /* WRITE */ + + +/*------------------------------------------------------------- + FUNCTIONS (FunctionID) +-------------------------------------------------------------*/ + +/* FUNCTIONS */ +#define F_ABS_X_N 1 /* N = ABS( X ) */ +#define F_ACOS_X_N 2 /* N = ACOS( X ) */ +#define F_ACS_X_N 3 /* N = ACS( X ) */ +#define F_ACSD_X_N 4 /* N = ACSD( X ) */ +#define F_ACSG_X_N 5 /* N = ACSG( X ) */ +#define F_ANGLE_X_Y_N 6 /* N = ANGLE( X, Y ) */ +#define F_ARCCOS_X_N 7 /* N = ARCCOS( X ) */ +#define F_ARCSIN_X_N 8 /* N = ARCSIN( X ) */ +#define F_ARCTAN_X_N 9 /* N = ARCTAN( X ) */ +#define F_ARGC_N 10 /* N = ARGC */ +#define F_ARGT4_X_S 11 /* S$ = ARGT$( X ) */ +#define F_ARGV_X_N 12 /* N = ARGV( X ) */ +#define F_ARGV4_X_S 13 /* S$ = ARGV$( X ) */ +#define F_ASC_A_N 14 /* N = ASC( A$ ) */ +#define F_ASC_A_X_N 15 /* N = ASC( A$, X ) */ +#define F_ASCII_A_N 16 /* N = ASCII( A$ ) */ +#define F_ASIN_X_N 17 /* N = ASIN( X ) */ +#define F_ASN_X_N 18 /* N = ASN( X ) */ +#define F_ASND_X_N 19 /* N = ASND( X ) */ +#define F_ASNG_X_N 20 /* N = ASNG( X ) */ +#define F_ATAN_X_N 21 /* N = ATAN( X ) */ +#define F_ATN_X_N 22 /* N = ATN( X ) */ +#define F_ATND_X_N 23 /* N = ATND( X ) */ +#define F_ATNG_X_N 24 /* N = ATNG( X ) */ +#define F_BASE_N 25 /* N = BASE */ +#define F_BIN4_X_S 26 /* S$ = BIN$( X ) */ +#define F_BIN4_X_Y_S 27 /* S$ = BIN$( X, Y ) */ +#define F_CATALOG_N 28 /* N = CATALOG */ +#define F_CATALOG_A_N 29 /* N = CATALOG( A$ ) */ +#define F_CCUR_X_N 30 /* N = CCUR( X ) */ +#define F_CDBL_X_N 31 /* N = CDBL( X ) */ +#define F_CEIL_X_N 32 /* N = CEIL( X ) */ +#define F_CHAR_X_Y_S 33 /* S$ = CHAR( X, Y ) */ +#define F_CHAR4_X_S 34 /* S$ = CHAR$( X ) */ +#define F_CHDIR_A_N 35 /* N = CHDIR( A$ ) */ +#define F_CHR_X_S 36 /* S$ = CHR( X ) */ +#define F_CHR4_X_S 37 /* S$ = CHR$( X ) */ +#define F_CIN_X_N 38 /* N = CIN( X ) */ +#define F_CINT_X_N 39 /* N = CINT( X ) */ +#define F_CLG_X_N 40 /* N = CLG( X ) */ +#define F_CLK_X_N 41 /* N = CLK( X ) */ +#define F_CLK_X_S 42 /* S$ = CLK( X ) */ +#define F_CLK4_S 43 /* S$ = CLK$ */ +#define F_CLNG_X_N 44 /* N = CLNG( X ) */ +#define F_CLOG_X_N 45 /* N = CLOG( X ) */ +#define F_CLOSE_N 46 /* N = CLOSE */ +#define F_CLOSE_X_N 47 /* N = CLOSE( X ) */ +#define F_CLS_N 48 /* N = CLS */ +#define F_CNTRL_X_Y_N 49 /* N = CNTRL( X, Y ) */ +#define F_CODE_A_N 50 /* N = CODE( A$ ) */ +#define F_COLOR_X_Y_N 51 /* N = COLOR( X, Y ) */ +#define F_COMMAND4_S 52 /* S$ = COMMAND$ */ +#define F_COMMAND4_X_S 53 /* S$ = COMMAND$( X ) */ +#define F_COS_X_N 54 /* N = COS( X ) */ +#define F_COSD_X_N 55 /* N = COSD( X ) */ +#define F_COSG_X_N 56 /* N = COSG( X ) */ +#define F_COSH_X_N 57 /* N = COSH( X ) */ +#define F_COT_X_N 58 /* N = COT( X ) */ +#define F_COUNT_N 59 /* N = COUNT */ +#define F_CSC_X_N 60 /* N = CSC( X ) */ +#define F_CSH_X_N 61 /* N = CSH( X ) */ +#define F_CSNG_X_N 62 /* N = CSNG( X ) */ +#define F_CUR_X_Y_S 63 /* S$ = CUR( X, Y ) */ +#define F_CVC_A_N 64 /* N = CVC( A$ ) */ +#define F_CVD_A_N 65 /* N = CVD( A$ ) */ +#define F_CVI_A_N 66 /* N = CVI( A$ ) */ +#define F_CVL_A_N 67 /* N = CVL( A$ ) */ +#define F_CVS_A_N 68 /* N = CVS( A$ ) */ +#define F_DAT4_S 69 /* S$ = DAT$ */ +#define F_DATE_N 70 /* N = DATE */ +#define F_DATE4_S 71 /* S$ = DATE$ */ +#define F_DATE4_X_S 72 /* S$ = DATE$( X ) */ +#define F_DEG_N 73 /* N = DEG */ +#define F_DEG_X_N 74 /* N = DEG( X ) */ +#define F_DEGREE_N 75 /* N = DEGREE */ +#define F_DEGREE_X_N 76 /* N = DEGREE( X ) */ +#define F_DET_N 77 /* N = DET */ +#define F_DIGITS_X_N 78 /* N = DIGITS( X ) */ +#define F_DIGITS_X_Y_N 79 /* N = DIGITS( X, Y ) */ +#define F_DIM_N 80 /* N = DIM( ... ) */ +#define F_DPEEK_X_N 81 /* N = DPEEK( X ) */ +#define F_DPOKE_X_Y_N 82 /* N = DPOKE( X, Y ) */ +#define F_EDIT4_A_X_S 83 /* S$ = EDIT$( A$, X ) */ +#define F_ENVIRON_A_N 84 /* N = ENVIRON( A$ ) */ +#define F_ENVIRON4_A_S 85 /* S$ = ENVIRON$( A$ ) */ +#define F_EOF_X_N 86 /* N = EOF( X ) */ +#define F_EPS_X_N 87 /* N = EPS( X ) */ +#define F_ERL_N 88 /* N = ERL */ +#define F_ERR_N 89 /* N = ERR */ +#define F_ERR4_S 90 /* S$ = ERR$ */ +#define F_ERRL_N 91 /* N = ERRL */ +#define F_ERRN_N 92 /* N = ERRN */ +#define F_ERROR_X_N 93 /* N = ERROR( X ) */ +#define F_ERROR_X_A_N 94 /* N = ERROR( X, A$ ) */ +#define F_ERROR4_S 95 /* S$ = ERROR$ */ +#define F_EXAM_X_N 96 /* N = EXAM( X ) */ +#define F_EXEC_A_N 97 /* N = EXEC( A$ ) */ +#define F_EXF_N 98 /* N = EXF( ... ) */ +#define F_EXP_X_N 99 /* N = EXP( X ) */ +#define F_FALSE_N 100 /* N = FALSE */ +#define F_FETCH_X_N 101 /* N = FETCH( X ) */ +#define F_FILEATTR_X_Y_N 102 /* N = FILEATTR( X, Y ) */ +#define F_FILES_N 103 /* N = FILES */ +#define F_FILES_A_N 104 /* N = FILES( A$ ) */ +#define F_FILL_X_Y_N 105 /* N = FILL( X, Y ) */ +#define F_FIX_X_N 106 /* N = FIX( X ) */ +#define F_FLOAT_X_N 107 /* N = FLOAT( X ) */ +#define F_FLOW_N 108 /* N = FLOW */ +#define F_FP_X_N 109 /* N = FP( X ) */ +#define F_FRAC_X_N 110 /* N = FRAC( X ) */ +#define F_FRE_N 111 /* N = FRE */ +#define F_FRE_A_N 112 /* N = FRE( A$ ) */ +#define F_FRE_X_N 113 /* N = FRE( X ) */ +#define F_FREE_N 114 /* N = FREE */ +#define F_FREE_X_N 115 /* N = FREE( X ) */ +#define F_FREE_A_N 116 /* N = FREE( A$ ) */ +#define F_FREEFILE_N 117 /* N = FREEFILE */ +#define F_GET_X_N 118 /* N = GET( X ) */ +#define F_GET_X_Y_N 119 /* N = GET( X, Y ) */ +#define F_GRAD_N 120 /* N = GRAD */ +#define F_GRADIAN_N 121 /* N = GRADIAN */ +#define F_HCS_X_N 122 /* N = HCS( X ) */ +#define F_HEX_A_N 123 /* N = HEX( A$ ) */ +#define F_HEX4_X_S 124 /* S$ = HEX$( X ) */ +#define F_HEX4_X_Y_S 125 /* S$ = HEX$( X, Y ) */ +#define F_HOME_N 126 /* N = HOME */ +#define F_HSN_X_N 127 /* N = HSN( X ) */ +#define F_HTN_X_N 128 /* N = HTN( X ) */ +#define F_INCH4_S 129 /* S$ = INCH$ */ +#define F_INDEX_A_B_N 130 /* N = INDEX( A$, B$ ) */ +#define F_INITIALIZE_N 131 /* N = INITIALIZE */ +#define F_INKEY4_S 132 /* S$ = INKEY$ */ +#define F_INP_X_N 133 /* N = INP( X ) */ +#define F_INPUT4_X_S 134 /* S$ = INPUT$( X ) */ +#define F_INPUT4_X_Y_S 135 /* S$ = INPUT$( X, Y ) */ +#define F_INSTR_A_B_N 136 /* N = INSTR( A$, B$ ) */ +#define F_INSTR_A_B_X_N 137 /* N = INSTR( A$, B$, X ) */ +#define F_INSTR_X_A_B_N 138 /* N = INSTR( X, A$, B$ ) */ +#define F_INT_X_N 139 /* N = INT( X ) */ +#define F_INT5_X_N 140 /* N = INT%( X ) */ +#define F_IP_X_N 141 /* N = IP( X ) */ +#define F_KEY_S 142 /* S$ = KEY */ +#define F_KEY4_S 143 /* S$ = KEY$ */ +#define F_KILL_A_N 144 /* N = KILL( A$ ) */ +#define F_LBOUND_N 145 /* N = LBOUND( ... ) */ +#define F_LCASE4_A_S 146 /* S$ = LCASE$( A$ ) */ +#define F_LEFT_A_X_S 147 /* S$ = LEFT( A$, X ) */ +#define F_LEFT4_A_X_S 148 /* S$ = LEFT$( A$, X ) */ +#define F_LEN_A_N 149 /* N = LEN( A$ ) */ +#define F_LGT_X_N 150 /* N = LGT( X ) */ +#define F_LIN_X_S 151 /* S$ = LIN( X ) */ +#define F_LN_X_N 152 /* N = LN( X ) */ +#define F_LNO_X_N 153 /* N = LNO( X ) */ +#define F_LOC_X_N 154 /* N = LOC( X ) */ +#define F_LOCATE_X_Y_N 155 /* N = LOCATE( X, Y ) */ +#define F_LOCK_X_N 156 /* N = LOCK( X ) */ +#define F_LOF_X_N 157 /* N = LOF( X ) */ +#define F_LOG_X_N 158 /* N = LOG( X ) */ +#define F_LOG10_X_N 159 /* N = LOG10( X ) */ +#define F_LOG2_X_N 160 /* N = LOG2( X ) */ +#define F_LOGE_X_N 161 /* N = LOGE( X ) */ +#define F_LOWER4_A_S 162 /* S$ = LOWER$( A$ ) */ +#define F_LPOS_N 163 /* N = LPOS */ +#define F_LTRIM4_A_S 164 /* S$ = LTRIM$( A$ ) */ +#define F_LTW_X_N 165 /* N = LTW( X ) */ +#define F_LWIDTH_X_N 166 /* N = LWIDTH( X ) */ +#define F_MATCH_A_B_X_N 167 /* N = MATCH( A$, B$, X ) */ +#define F_MAX_A_B_S 168 /* S$ = MAX( A$, B$ ) */ +#define F_MAX_X_Y_N 169 /* N = MAX( X, Y ) */ +#define F_MAXBYT_N 170 /* N = MAXBYT */ +#define F_MAXCUR_N 171 /* N = MAXCUR */ +#define F_MAXDBL_N 172 /* N = MAXDBL */ +#define F_MAXDEV_N 173 /* N = MAXDEV */ +#define F_MAXINT_N 174 /* N = MAXINT */ +#define F_MAXLEN_N 175 /* N = MAXLEN */ +#define F_MAXLEN_A_N 176 /* N = MAXLEN( A$ ) */ +#define F_MAXLNG_N 177 /* N = MAXLNG */ +#define F_MAXLVL_N 178 /* N = MAXLVL */ +#define F_MAXNUM_N 179 /* N = MAXNUM */ +#define F_MAXSNG_N 180 /* N = MAXSNG */ +#define F_MEM_N 181 /* N = MEM */ +#define F_MID_A_X_S 182 /* S$ = MID( A$, X ) */ +#define F_MID_A_X_Y_S 183 /* S$ = MID( A$, X, Y ) */ +#define F_MID4_A_X_S 184 /* S$ = MID$( A$, X ) */ +#define F_MID4_A_X_Y_S 185 /* S$ = MID$( A$, X, Y ) */ +#define F_MIN_X_Y_N 186 /* N = MIN( X, Y ) */ +#define F_MIN_A_B_S 187 /* S$ = MIN( A$, B$ ) */ +#define F_MINBYT_N 188 /* N = MINBYT */ +#define F_MINCUR_N 189 /* N = MINCUR */ +#define F_MINDBL_N 190 /* N = MINDBL */ +#define F_MINDEV_N 191 /* N = MINDEV */ +#define F_MININT_N 192 /* N = MININT */ +#define F_MINLNG_N 193 /* N = MINLNG */ +#define F_MINNUM_N 194 /* N = MINNUM */ +#define F_MINSNG_N 195 /* N = MINSNG */ +#define F_MKC4_X_S 196 /* S$ = MKC$( X ) */ +#define F_MKD4_X_S 197 /* S$ = MKD$( X ) */ +#define F_MKDIR_A_N 198 /* N = MKDIR( A$ ) */ +#define F_MKI4_X_S 199 /* S$ = MKI$( X ) */ +#define F_MKL4_X_S 200 /* S$ = MKL$( X ) */ +#define F_MKS4_X_S 201 /* S$ = MKS$( X ) */ +#define F_MOD_X_Y_N 202 /* N = MOD( X, Y ) */ +#define F_NAME_A_B_N 203 /* N = NAME( A$, B$ ) */ +#define F_NAME_N 204 /* N = NAME( ... ) */ +#define F_NOFLOW_N 205 /* N = NOFLOW */ +#define F_NOTRACE_N 206 /* N = NOTRACE */ +#define F_NULL_X_N 207 /* N = NULL( X ) */ +#define F_NUM_N 208 /* N = NUM */ +#define F_NUM_A_N 209 /* N = NUM( A$ ) */ +#define F_NUM4_X_S 210 /* S$ = NUM$( X ) */ +#define F_OCT4_X_S 211 /* S$ = OCT$( X ) */ +#define F_OCT4_X_Y_S 212 /* S$ = OCT$( X, Y ) */ +#define F_OPEN_A_X_B_N 213 /* N = OPEN( A$, X, B$ ) */ +#define F_OPEN_A_X_B_Y_N 214 /* N = OPEN( A$, X, B$, Y ) */ +#define F_ORD_A_N 215 /* N = ORD( A$ ) */ +#define F_OUT_X_Y_N 216 /* N = OUT( X, Y ) */ +#define F_PAD_X_N 217 /* N = PAD( X ) */ +#define F_PAUSE_X_N 218 /* N = PAUSE( X ) */ +#define F_PDL_X_N 219 /* N = PDL( X ) */ +#define F_PEEK_X_N 220 /* N = PEEK( X ) */ +#define F_PI_N 221 /* N = PI */ +#define F_PI_X_N 222 /* N = PI( X ) */ +#define F_PIN_X_N 223 /* N = PIN( X ) */ +#define F_POKE_X_Y_N 224 /* N = POKE( X, Y ) */ +#define F_POS_N 225 /* N = POS */ +#define F_POS_X_N 226 /* N = POS( X ) */ +#define F_POS_A_B_N 227 /* N = POS( A$, B$ ) */ +#define F_POS_A_B_X_N 228 /* N = POS( A$, B$, X ) */ +#define F_PRECISION_X_N 229 /* N = PRECISION( X ) */ +#define F_PTR_N 230 /* N = PTR( ... ) */ +#define F_PUT_X_N 231 /* N = PUT( X ) */ +#define F_PUT_X_Y_N 232 /* N = PUT( X, Y ) */ +#define F_RAD_N 233 /* N = RAD */ +#define F_RAD_X_N 234 /* N = RAD( X ) */ +#define F_RADIAN_N 235 /* N = RADIAN */ +#define F_RAN_N 236 /* N = RAN */ +#define F_RAN_X_N 237 /* N = RAN( X ) */ +#define F_RANDOM_N 238 /* N = RANDOM */ +#define F_RANDOM_X_N 239 /* N = RANDOM( X ) */ +#define F_RANDOMIZE_N 240 /* N = RANDOMIZE */ +#define F_RANDOMIZE_X_N 241 /* N = RANDOMIZE( X ) */ +#define F_REMAINDER_X_Y_N 242 /* N = REMAINDER( X, Y ) */ +#define F_RENAME_A_B_N 243 /* N = RENAME( A$, B$ ) */ +#define F_REPEAT4_X_A_S 244 /* S$ = REPEAT$( X, A$ ) */ +#define F_REPEAT4_X_Y_S 245 /* S$ = REPEAT$( X, Y ) */ +#define F_RESET_N 246 /* N = RESET */ +#define F_RESIDUE_N 247 /* N = RESIDUE */ +#define F_RIGHT_A_X_S 248 /* S$ = RIGHT( A$, X ) */ +#define F_RIGHT4_A_X_S 249 /* S$ = RIGHT$( A$, X ) */ +#define F_RMDIR_A_N 250 /* N = RMDIR( A$ ) */ +#define F_RND_N 251 /* N = RND */ +#define F_RND_X_N 252 /* N = RND( X ) */ +#define F_ROUND_X_Y_N 253 /* N = ROUND( X, Y ) */ +#define F_RTRIM4_A_S 254 /* S$ = RTRIM$( A$ ) */ +#define F_SCALE_X_N 255 /* N = SCALE( X ) */ +#define F_SEC_X_N 256 /* N = SEC( X ) */ +#define F_SEEK_X_N 257 /* N = SEEK( X ) */ +#define F_SEEK_X_Y_N 258 /* N = SEEK( X, Y ) */ +#define F_SEG_X_N 259 /* N = SEG( X ) */ +#define F_SEG_A_X_Y_S 260 /* S$ = SEG( A$, X, Y ) */ +#define F_SEG4_A_X_Y_S 261 /* S$ = SEG$( A$, X, Y ) */ +#define F_SGN_X_N 262 /* N = SGN( X ) */ +#define F_SHELL_A_N 263 /* N = SHELL( A$ ) */ +#define F_SIN_X_N 264 /* N = SIN( X ) */ +#define F_SIND_X_N 265 /* N = SIND( X ) */ +#define F_SING_X_N 266 /* N = SING( X ) */ +#define F_SINH_X_N 267 /* N = SINH( X ) */ +#define F_SIZE_A_N 268 /* N = SIZE( A$ ) */ +#define F_SIZE_N 269 /* N = SIZE( ... ) */ +#define F_SLEEP_X_N 270 /* N = SLEEP( X ) */ +#define F_SNH_X_N 271 /* N = SNH( X ) */ +#define F_SPA_X_S 272 /* S$ = SPA( X ) */ +#define F_SPACE_X_S 273 /* S$ = SPACE( X ) */ +#define F_SPACE4_X_S 274 /* S$ = SPACE$( X ) */ +#define F_SPC_X_S 275 /* S$ = SPC( X ) */ +#define F_SQR_X_N 276 /* N = SQR( X ) */ +#define F_SQRT_X_N 277 /* N = SQRT( X ) */ +#define F_STR_X_Y_S 278 /* S$ = STR( X, Y ) */ +#define F_STR4_X_S 279 /* S$ = STR$( X ) */ +#define F_STRING_X_Y_S 280 /* S$ = STRING( X, Y ) */ +#define F_STRING4_X_A_S 281 /* S$ = STRING$( X, A$ ) */ +#define F_STRING4_X_Y_S 282 /* S$ = STRING$( X, Y ) */ +#define F_STRIP4_A_S 283 /* S$ = STRIP$( A$ ) */ +#define F_STUFF_X_Y_N 284 /* N = STUFF( X, Y ) */ +#define F_TAB_X_S 285 /* S$ = TAB( X ) */ +#define F_TAN_X_N 286 /* N = TAN( X ) */ +#define F_TAND_X_N 287 /* N = TAND( X ) */ +#define F_TANG_X_N 288 /* N = TANG( X ) */ +#define F_TANH_X_N 289 /* N = TANH( X ) */ +#define F_TI_N 290 /* N = TI */ +#define F_TI4_S 291 /* S$ = TI$ */ +#define F_TIM_N 292 /* N = TIM */ +#define F_TIM_X_N 293 /* N = TIM( X ) */ +#define F_TIME_N 294 /* N = TIME */ +#define F_TIME_X_N 295 /* N = TIME( X ) */ +#define F_TIME4_S 296 /* S$ = TIME$ */ +#define F_TIME4_X_S 297 /* S$ = TIME$( X ) */ +#define F_TIMER_N 298 /* N = TIMER */ +#define F_TOP_N 299 /* N = TOP */ +#define F_TRACE_N 300 /* N = TRACE */ +#define F_TRACE_X_N 301 /* N = TRACE( X ) */ +#define F_TRIM4_A_S 302 /* S$ = TRIM$( A$ ) */ +#define F_TROFF_N 303 /* N = TROFF */ +#define F_TRON_N 304 /* N = TRON */ +#define F_TRUE_N 305 /* N = TRUE */ +#define F_TRUNCATE_X_Y_N 306 /* N = TRUNCATE( X, Y ) */ +#define F_UBOUND_N 307 /* N = UBOUND( ... ) */ +#define F_UCASE4_A_S 308 /* S$ = UCASE$( A$ ) */ +#define F_UNLOCK_X_N 309 /* N = UNLOCK( X ) */ +#define F_UNSAVE_A_N 310 /* N = UNSAVE( A$ ) */ +#define F_UPPER4_A_S 311 /* S$ = UPPER$( A$ ) */ +#define F_USR_N 312 /* N = USR( ... ) */ +#define F_USR0_N 313 /* N = USR0( ... ) */ +#define F_USR1_N 314 /* N = USR1( ... ) */ +#define F_USR2_N 315 /* N = USR2( ... ) */ +#define F_USR3_N 316 /* N = USR3( ... ) */ +#define F_USR4_N 317 /* N = USR4( ... ) */ +#define F_USR5_N 318 /* N = USR5( ... ) */ +#define F_USR6_N 319 /* N = USR6( ... ) */ +#define F_USR7_N 320 /* N = USR7( ... ) */ +#define F_USR8_N 321 /* N = USR8( ... ) */ +#define F_USR9_N 322 /* N = USR9( ... ) */ +#define F_UUF_N 323 /* N = UUF( ... ) */ +#define F_VAL_A_N 324 /* N = VAL( A$ ) */ +#define F_VARPTR_N 325 /* N = VARPTR( ... ) */ +#define F_VTAB_X_N 326 /* N = VTAB( X ) */ +#define F_WAIT_X_N 327 /* N = WAIT( X ) */ +#define F_WAIT_X_Y_N 328 /* N = WAIT( X, Y ) */ +#define F_WAIT_X_Y_Z_N 329 /* N = WAIT( X, Y, Z ) */ +#define F_WIDTH_X_N 330 /* N = WIDTH( X ) */ +#define F_WIDTH_X_Y_N 331 /* N = WIDTH( X, Y ) */ +#define F_ZONE_X_N 332 /* N = ZONE( X ) */ +#define F_ZONE_X_Y_N 333 /* N = ZONE( X, Y ) */ + +/*------------------------------------------------------------- + WARNINGS +-------------------------------------------------------------*/ +#define WARN_CLEAR bwx_Error( 0, NULL ) +#define WARN_NEXT_WITHOUT_FOR bwx_Error( 1, NULL ) +#define WARN_SYNTAX_ERROR bwx_Error( 2, NULL ) +#define WARN_RETURN_WITHOUT_GOSUB bwx_Error( 3, NULL ) +#define WARN_OUT_OF_DATA bwx_Error( 4, NULL ) +#define WARN_ILLEGAL_FUNCTION_CALL bwx_Error( 5, NULL ) +#define WARN_OVERFLOW bwx_Error( 6, NULL ) +#define WARN_OUT_OF_MEMORY bwx_Error( 7, NULL ) +#define WARN_UNDEFINED_LINE bwx_Error( 8, NULL ) +#define WARN_SUBSCRIPT_OUT_OF_RANGE bwx_Error( 9, NULL ) +#define WARN_REDIMENSION_ARRAY bwx_Error( 10, NULL ) +#define WARN_DIVISION_BY_ZERO bwx_Error( 11, NULL ) +#define WARN_ILLEGAL_DIRECT bwx_Error( 12, NULL ) +#define WARN_TYPE_MISMATCH bwx_Error( 13, NULL ) +#define WARN_OUT_OF_STRING_SPACE bwx_Error( 14, NULL ) +#define WARN_STRING_TOO_LONG bwx_Error( 15, NULL ) +#define WARN_STRING_FORMULA_TOO_COMPLEX bwx_Error( 16, NULL ) +#define WARN_CANT_CONTINUE bwx_Error( 17, NULL ) +#define WARN_UNDEFINED_USER_FUNCTION bwx_Error( 18, NULL ) +#define WARN_NO_RESUME bwx_Error( 19, NULL ) +#define WARN_RESUME_WITHOUT_ERROR bwx_Error( 20, NULL ) +#define WARN_UNPRINTABLE_ERROR bwx_Error( 21, NULL ) +#define WARN_MISSING_OPERAND bwx_Error( 22, NULL ) +#define WARN_LINE_BUFFER_OVERFLOW bwx_Error( 23, NULL ) +#define WARN_FOR_WITHOUT_NEXT bwx_Error( 26, NULL ) +#define WARN_BAD_DATA bwx_Error( 27, NULL ) /* NEW in bwBASIC 3.20 */ +#define WARN_UNASSIGNED_28 bwx_Error( 28, NULL ) +#define WARN_WHILE_WITHOUT_WEND bwx_Error( 29, NULL ) +#define WARN_WEND_WITHOUT_WHILE bwx_Error( 30, NULL ) +#define WARN_EXIT_FUNCTION_WITHOUT_FUNCTION bwx_Error( 31, NULL ) +#define WARN_END_FUNCTION_WITHOUT_FUNCTION bwx_Error( 32, NULL ) +#define WARN_EXIT_SUB_WITHOUT_SUB bwx_Error( 33, NULL ) +#define WARN_END_SUB_WITHOUT_SUB bwx_Error( 34, NULL ) +#define WARN_EXIT_FOR_WITHOUT_FOR bwx_Error( 35, NULL ) +#define WARN_FIELD_OVERFLOW bwx_Error( 50, NULL ) +#define WARN_INTERNAL_ERROR bwx_Error( 51, NULL ) +#define WARN_BAD_FILE_NUMBER bwx_Error( 52, NULL ) +#define WARN_FILE_NOT_FOUND bwx_Error( 53, NULL ) +#define WARN_BAD_FILE_MODE bwx_Error( 54, NULL ) +#define WARN_FILE_ALREADY_OPEN bwx_Error( 55, NULL ) +#define WARN_UNASSIGNED_56 bwx_Error( 56, NULL ) +#define WARN_DISK_IO_ERROR bwx_Error( 57, NULL ) +#define WARN_FILE_ALREADY_EXISTS bwx_Error( 58, NULL ) +#define WARN_UNASSIGNED_59 bwx_Error( 59, NULL ) +#define WARN_UNASSIGNED_60 bwx_Error( 60, NULL ) +#define WARN_DISK_FULL bwx_Error( 61, NULL ) +#define WARN_INPUT_PAST_END bwx_Error( 62, NULL ) +#define WARN_BAD_RECORD_NUMBER bwx_Error( 63, NULL ) +#define WARN_BAD_FILE_NAME bwx_Error( 64, NULL ) +#define WARN_UNASSIGNED_65 bwx_Error( 65, NULL ) +#define WARN_DIRECT_STATEMENT_IN_FILE bwx_Error( 66, NULL ) +#define WARN_TOO_MANY_FILES bwx_Error( 67, NULL ) +#define WARN_UNASSIGNED_68 bwx_Error( 68, NULL ) +#define WARN_VARIABLE_NOT_DECLARED bwx_Error( 70, NULL ) +#define WARN_ADVANCED_FEATURE bwx_Error( 73, NULL ) + + + + +/* EOF */ diff --git a/bwbasic.mak b/bwbasic.mak new file mode 100644 index 0000000..1627117 --- /dev/null +++ b/bwbasic.mak @@ -0,0 +1,85 @@ +PROJ =BWBASIC +DEBUG =0 +CC =qcl +CFLAGS_G = /AL /W3 /Za /DMSDOS +CFLAGS_D = /Zd /Gi$(PROJ).mdt /Od +CFLAGS_R = /O /Ot /Gs /DNDEBUG +CFLAGS =$(CFLAGS_G) $(CFLAGS_R) +LFLAGS_G = /CP:0xffff /NOI /NOE /SE:0x80 /ST:0x1fa0 +LFLAGS_D = /INCR +LFLAGS_R = +LFLAGS =$(LFLAGS_G) $(LFLAGS_R) +RUNFLAGS = +OBJS_EXT = +LIBS_EXT = + +all: $(PROJ).exe + +bwbasic.obj: bwbasic.c + +bwb_cmd.obj: bwb_cmd.c + +bwb_cnd.obj: bwb_cnd.c + +bwb_dio.obj: bwb_dio.c + +bwb_elx.obj: bwb_elx.c + +bwb_exp.obj: bwb_exp.c + +bwb_fnc.obj: bwb_fnc.c + +bwb_inp.obj: bwb_inp.c + +bwb_int.obj: bwb_int.c + +bwb_mth.obj: bwb_mth.c + +bwb_ops.obj: bwb_ops.c + +bwb_par.obj: bwb_par.c + +bwb_prn.obj: bwb_prn.c + +bwb_stc.obj: bwb_stc.c + +bwb_str.obj: bwb_str.c + +bwb_tbl.obj: bwb_tbl.c + +bwb_var.obj: bwb_var.c + +bwx_tty.obj: bwx_tty.c + +$(PROJ).exe: bwbasic.obj bwb_cmd.obj bwb_cnd.obj bwb_dio.obj bwb_elx.obj bwb_exp.obj \ + bwb_fnc.obj bwb_inp.obj bwb_int.obj bwb_mth.obj bwb_ops.obj bwb_par.obj bwb_prn.obj \ + bwb_stc.obj bwb_str.obj bwb_tbl.obj bwb_var.obj bwx_tty.obj $(OBJS_EXT) + echo >NUL @<<$(PROJ).crf +bwbasic.obj + +bwb_cmd.obj + +bwb_cnd.obj + +bwb_dio.obj + +bwb_elx.obj + +bwb_exp.obj + +bwb_fnc.obj + +bwb_inp.obj + +bwb_int.obj + +bwb_mth.obj + +bwb_ops.obj + +bwb_par.obj + +bwb_prn.obj + +bwb_stc.obj + +bwb_str.obj + +bwb_tbl.obj + +bwb_var.obj + +bwx_tty.obj + +$(OBJS_EXT) +$(PROJ).exe + +$(LIBS_EXT); +<< + link $(LFLAGS) @$(PROJ).crf + +run: $(PROJ).exe + $(PROJ) $(RUNFLAGS) + diff --git a/bwbasic1.jcl b/bwbasic1.jcl new file mode 100644 index 0000000..8def5b0 --- /dev/null +++ b/bwbasic1.jcl @@ -0,0 +1,9 @@ +//BWBGEN JOB CLASS=C,REGION=0K +//IDCAMS EXEC PGM=IDCAMS +//SYSPRINT DD SYSOUT=* +//SYSIN DD * + DEFINE ALIAS (NAME(BWBASIC) RELATE(SYS1.UCAT.TSO)) - + CATALOG(SYS1.VMASTCAT/SECRET) + SET MAXCC=0 +/* +// diff --git a/bwbasic2.jcl b/bwbasic2.jcl new file mode 100644 index 0000000..1cda0a8 --- /dev/null +++ b/bwbasic2.jcl @@ -0,0 +1,35 @@ +//BWBGEN JOB CLASS=C,REGION=0K +//* +//CREATE PROC BWBPREF='BWBASIC' +//DELETE EXEC PGM=IEFBR14 +//DD1 DD DSN=&BWBPREF..SOURCE,DISP=(MOD,DELETE), +// UNIT=SYSALLDA,SPACE=(TRK,(0)) +//DD2 DD DSN=&BWBPREF..INCLUDE,DISP=(MOD,DELETE), +// UNIT=SYSALLDA,SPACE=(TRK,(0)) +//DD3 DD DSN=&BWBPREF..NCALIB,DISP=(MOD,DELETE), +// UNIT=SYSALLDA,SPACE=(TRK,(0)) +//DD4 DD DSN=&BWBPREF..LINKLIB,DISP=(MOD,DELETE), +// UNIT=SYSALLDA,SPACE=(TRK,(0)) +//DD5 DD DSN=&BWBPREF..JCL,DISP=(MOD,DELETE), +// UNIT=SYSALLDA,SPACE=(TRK,(0)) +//* +//ALLOC EXEC PGM=IEFBR14 +//DD1 DD DSN=&BWBPREF..SOURCE,DISP=(,CATLG), +// DCB=(RECFM=VB,LRECL=255,BLKSIZE=6233), +// SPACE=(6233,(180,180,44)),UNIT=SYSALLDA +//DD2 DD DSN=&BWBPREF..INCLUDE,DISP=(,CATLG), +// DCB=(RECFM=VB,LRECL=255,BLKSIZE=6233), +// SPACE=(6233,(26,26,44)),UNIT=SYSALLDA +//DD3 DD DSN=&BWBPREF..NCALIB,DISP=(,CATLG), +// DCB=(RECFM=U,LRECL=0,BLKSIZE=6144), +// SPACE=(6144,(130,130,44)),UNIT=SYSALLDA +//DD4 DD DSN=&BWBPREF..LINKLIB,DISP=(,CATLG), +// DCB=(RECFM=U,LRECL=0,BLKSIZE=6144), +// SPACE=(6144,(130,130,44)),UNIT=SYSALLDA +//DD5 DD DSN=&BWBPREF..JCL,DISP=(,CATLG), +// DCB=(RECFM=FB,LRECL=80,BLKSIZE=6080), +// SPACE=(6080,(130,130,44)),UNIT=SYSALLDA +// PEND +//* +//S1 EXEC CREATE +// diff --git a/bwbasic3.jcl b/bwbasic3.jcl new file mode 100644 index 0000000..a07da5f --- /dev/null +++ b/bwbasic3.jcl @@ -0,0 +1,22 @@ +//BWBGEN JOB CLASS=C,REGION=0K +//* +//TRANSFER PROC BWBPREF='BWBASIC',PDPPREF='PDPCLIB' +//DELETE EXEC PGM=IEFBR14 +//DD1 DD DSN=&BWBPREF..ALLZIPS,DISP=(MOD,DELETE), +// UNIT=SYSALLDA,SPACE=(TRK,(0)) +//* +//COPY EXEC PGM=COPYFILE,PARM='-bb dd:in dd:out' +//STEPLIB DD DSN=&PDPPREF..LINKLIB,DISP=SHR +//IN DD DSN=HERC02.IN,DISP=OLD, +// UNIT=TAPE,VOL=SER=PCTOMF,LABEL=(1,NL), +// DCB=(RECFM=U,LRECL=0,BLKSIZE=32760) +//OUT DD DSN=&BWBPREF..ALLZIPS,DISP=(,CATLG), +// SPACE=(6233,(220,220),RLSE),UNIT=SYSALLDA, +// DCB=(RECFM=U,LRECL=0,BLKSIZE=6233) +//SYSIN DD DUMMY +//SYSPRINT DD SYSOUT=* +//SYSTERM DD SYSOUT=* +// PEND +//* +//S1 EXEC TRANSFER +// diff --git a/bwbasic4.jcl b/bwbasic4.jcl new file mode 100644 index 0000000..3ba3868 --- /dev/null +++ b/bwbasic4.jcl @@ -0,0 +1,32 @@ +//BWBGEN JOB CLASS=C,REGION=0K +//* +//CREATE EXEC PGM=IEFBR14 +//DD1 DD DSN=&&ZIPS,DISP=(,PASS), +// DCB=(RECFM=U,LRECL=0,BLKSIZE=6233), +// SPACE=(6233,(220,220,44)),UNIT=SYSALLDA +//* +//UNZIP1 PROC MINPREF='MINIZIP',BWBPREF='BWBASIC' +//MINI EXEC PGM=MINIUNZ,PARM='dd:input dd:output' +//STEPLIB DD DSN=&MINPREF..LINKLIB,DISP=SHR +//INPUT DD DSN=&BWBPREF..ALLZIPS,DISP=SHR +//OUTPUT DD DSN=&&ZIPS,DISP=(OLD,PASS) +//SYSIN DD DUMMY +//SYSPRINT DD SYSOUT=* +//SYSTERM DD SYSOUT=* +// PEND +//* +//UNZIP2 PROC IN=,OUT=,MINPREF='MINIZIP',BWBPREF='BWBASIC' +//MINI EXEC PGM=MINIUNZ,PARM='-a dd:input dd:output' +//STEPLIB DD DSN=&MINPREF..LINKLIB,DISP=SHR +//INPUT DD DSN=&&ZIPS(&IN),DISP=(OLD,PASS) +//OUTPUT DD DSN=&BWBPREF..&OUT,DISP=SHR +//SYSIN DD DUMMY +//SYSPRINT DD SYSOUT=* +//SYSTERM DD SYSOUT=* +// PEND +//* +//S1 EXEC UNZIP1 +//S2 EXEC UNZIP2,IN='BWBSRC',OUT='SOURCE' +//S3 EXEC UNZIP2,IN='BWBINC',OUT='INCLUDE' +//S4 EXEC UNZIP2,IN='BWBJCL',OUT='JCL' +// diff --git a/bwbasic5.jcl b/bwbasic5.jcl new file mode 100644 index 0000000..982964e --- /dev/null +++ b/bwbasic5.jcl @@ -0,0 +1,64 @@ +//BWBGEN JOB CLASS=C,REGION=0K +//* +//BWBCMP PROC BWBPREF='BWBASIC',MEMBER='',GCCPREF='GCC', +// PDPPREF='PDPCLIB', +// COS1='-Os -S -ansi', +// COS2='-o dd:out -' +//* +//COMP EXEC PGM=GCC, +// PARM='&COS1 &COS2' +//STEPLIB DD DSN=&GCCPREF..LINKLIB,DISP=SHR +//SYSIN DD DSN=&BWBPREF..SOURCE(&MEMBER),DISP=SHR +//INCLUDE DD DSN=&BWBPREF..INCLUDE,DISP=SHR,DCB=BLKSIZE=32720 +// DD DSN=&PDPPREF..INCLUDE,DISP=SHR +//SYSINCL DD DSN=&BWBPREF..INCLUDE,DISP=SHR,DCB=BLKSIZE=32720 +// DD DSN=&PDPPREF..INCLUDE,DISP=SHR +//OUT DD DSN=&&TEMP1,DISP=(,PASS),UNIT=SYSALLDA, +// DCB=(LRECL=80,BLKSIZE=6080,RECFM=FB), +// SPACE=(6080,(500,500)) +//SYSPRINT DD SYSOUT=* +//SYSTERM DD SYSOUT=* +//* +//ASM EXEC PGM=ASMA90, +// PARM='DECK,NOLIST', +// COND=(4,LT,COMP) +//SYSLIB DD DSN=SYS1.MACLIB,DISP=SHR +// DD DSN=&PDPPREF..MACLIB,DISP=SHR +//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(20,10)) +//SYSUT2 DD UNIT=SYSALLDA,SPACE=(CYL,(20,10)) +//SYSUT3 DD UNIT=SYSALLDA,SPACE=(CYL,(2,1)) +//SYSPRINT DD SYSOUT=* +//SYSLIN DD DUMMY +//SYSGO DD DUMMY +//SYSPUNCH DD DSN=&&OBJSET,UNIT=SYSALLDA,SPACE=(80,(240,200)), +// DISP=(,PASS) +//SYSIN DD DSN=&&TEMP1,DISP=(OLD,DELETE) +//* +//LKED EXEC PGM=IEWL,PARM='NCAL', +// COND=((4,LT,COMP),(0,LT,ASM)) +//SYSLIN DD DSN=&&OBJSET,DISP=(OLD,DELETE) +//SYSLMOD DD DSN=&BWBPREF..NCALIB(&MEMBER),DISP=SHR +//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(2,1)) +//SYSPRINT DD SYSOUT=* +// PEND +//* +//BWBASIC EXEC BWBCMP,MEMBER=BWBASIC +//BWB@INT EXEC BWBCMP,MEMBER=BWB@INT +//BWB@TBL EXEC BWBCMP,MEMBER=BWB@TBL +//BWB@CMD EXEC BWBCMP,MEMBER=BWB@CMD +//BWB@PRN EXEC BWBCMP,MEMBER=BWB@PRN +//BWB@EXP EXEC BWBCMP,MEMBER=BWB@EXP +//BWB@VAR EXEC BWBCMP,MEMBER=BWB@VAR +//BWB@INP EXEC BWBCMP,MEMBER=BWB@INP +//BWB@FNC EXEC BWBCMP,MEMBER=BWB@FNC +//BWB@CND EXEC BWBCMP,MEMBER=BWB@CND +//BWB@DIO EXEC BWBCMP,MEMBER=BWB@DIO +//BWB@STR EXEC BWBCMP,MEMBER=BWB@STR +//BWB@STC EXEC BWBCMP,MEMBER=BWB@STC +//BWX@TTY EXEC BWBCMP,MEMBER=BWX@TTY +//BWD@CMD EXEC BWBCMP,MEMBER=BWD@CMD +//BWD@FUN EXEC BWBCMP,MEMBER=BWD@FUN +//UNIXIO EXEC BWBCMP,MEMBER=UNIXIO +//RENUM EXEC BWBCMP,MEMBER=RENUM +//* +// diff --git a/bwbasic6.jcl b/bwbasic6.jcl new file mode 100644 index 0000000..a97e1d6 --- /dev/null +++ b/bwbasic6.jcl @@ -0,0 +1,38 @@ +//BWBGEN JOB CLASS=C,REGION=0K +//LINK PROC BWBPREF='BWBASIC',PDPPREF='PDPCLIB',EXE='' +//LKED EXEC PGM=IEWL,PARM='MAP,LIST,SIZE=(999424,65536)' +//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(30,10)) +//SYSPRINT DD SYSOUT=* +//SYSLIB DD DSN=&PDPPREF..NCALIB,DISP=SHR,DCB=BLKSIZE=32760 +// DD DSN=&BWBPREF..NCALIB,DISP=SHR +//SYSLMOD DD DSN=&BWBPREF..LINKLIB(&EXE),DISP=SHR +// PEND +//DOLINK1 EXEC LINK,EXE=BWBASIC +//LKED.SYSLIN DD * + INCLUDE SYSLIB(BWBASIC) + INCLUDE SYSLIB(BWB@INT) + INCLUDE SYSLIB(BWB@TBL) + INCLUDE SYSLIB(BWB@CMD) + INCLUDE SYSLIB(BWB@PRN) + INCLUDE SYSLIB(BWB@EXP) + INCLUDE SYSLIB(BWB@VAR) + INCLUDE SYSLIB(BWB@INP) + INCLUDE SYSLIB(BWB@FNC) + INCLUDE SYSLIB(BWB@CND) + INCLUDE SYSLIB(BWB@DIO) + INCLUDE SYSLIB(BWB@STR) + INCLUDE SYSLIB(BWB@STC) + INCLUDE SYSLIB(BWX@TTY) + INCLUDE SYSLIB(BWD@CMD) + INCLUDE SYSLIB(BWD@FUN) + INCLUDE SYSLIB(UNIXIO) + ENTRY @@MAIN +/* +//* +//DOLINK2 EXEC LINK,EXE=RENUM +//LKED.SYSLIN DD * + INCLUDE SYSLIB(RENUM) + ENTRY @@MAIN +/* +//* +// diff --git a/bwbasic7.jcl b/bwbasic7.jcl new file mode 100644 index 0000000..a2e164b --- /dev/null +++ b/bwbasic7.jcl @@ -0,0 +1,45 @@ +//BWBGEN JOB CLASS=C,REGION=0K +//* +//RUNBW PROC BWBPREF='BWBASIC' +//BWBASIC EXEC PGM=BWBASIC,PARM='DD:INPUT' +//STEPLIB DD DSN=&BWBPREF..LINKLIB,DISP=SHR +//SYSIN DD DUMMY +//SYSPRINT DD SYSOUT=* +//SYSTERM DD SYSOUT=* +// PEND +//* +//RUNRE PROC BWBPREF='BWBASIC' +//BWBASIC EXEC PGM=RENUM,PARM='DD:INPUT' +//STEPLIB DD DSN=&BWBPREF..LINKLIB,DISP=SHR +//SYSIN DD DUMMY +//SYSPRINT DD SYSOUT=* +//SYSTERM DD SYSOUT=* +// PEND +//* +//CLEAN PROC BWBPREF='BWBASIC' +//DELETE EXEC PGM=IEFBR14 +//DD0 DD DSN=&BWBPREF..ALLZIPS,DISP=(MOD,DELETE), +// UNIT=SYSALLDA,SPACE=(TRK,(0)) +//DD3 DD DSN=&BWBPREF..NCALIB,DISP=(MOD,DELETE), +// UNIT=SYSALLDA,SPACE=(TRK,(0)) +// PEND +//* +//S1 EXEC RUNBW +//INPUT DD * +x = 1 +print "hello, world",x +x = 2 +print "hello, world",x +end +/* +//* +//S2 EXEC RUNRE +//INPUT DD * +5 hi +7 folks +9 there +/* +//EDITFL DD SYSOUT=* +//* +//S3 EXEC CLEAN +// diff --git a/bwd_cmd.c b/bwd_cmd.c new file mode 100644 index 0000000..a0993e2 --- /dev/null +++ b/bwd_cmd.c @@ -0,0 +1,2627 @@ +/*************************************************************** + + bwd_cmd.c Command Table + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + +/* COMMAND TABLE */ + +#include "bwbasic.h" + +CommandType IntrinsicCommandTable[ /* NUM_COMMANDS */ ] = +{ +{ + C_APPEND, /* UniqueID */ + "APPEND filename$", /* Syntax */ + "Merges the BASIC program in filename$ into the current BASIC " + "program; lines in filename$ replace any matching lines in the " + "current program.", /* Description */ + "APPEND", /* Name */ + B15 | HB2 | R86 | T79 /* OptionVersionBitmask */ +}, +{ + C_APPEND, /* UniqueID */ + "APPEND # filenumber", /* Syntax */ + "Positions filenumber at EOF and sets the file to writing; filenumber " + "<= 0 is ignored.", /* Description */ + "APPEND", /* Name */ + D64 | G74 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_AS, /* UniqueID */ + "AS", /* Syntax */ + "Syntax Error.", /* Description */ + "AS", /* Name */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_AUTO, /* UniqueID */ + "AUTO [start [, increment]]", /* Syntax */ + "Automatic line numbering for manual program entry. If the line " + "already exists, then an asterisk is displayed and pressing ENTER " + "leaves the line as-is. If the line does not exist, then an asterisk " + "is not displayed and pressing ENTER terminates AUTO mode. Regardless " + "whether the line exists, entering the command MAN will terminate " + "AUTO mode. AUTO mode is also terminated by any ERROR or by pressing " + "control-C.", /* Description */ + "AUTO", /* Name */ + B15 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_BACKSPACE, /* UniqueID */ + "BACKSPACE # X", /* Syntax */ + "Points the file to the previous item.", /* Description */ + "BACKSPACE", /* Name */ + D64 | G74 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_BREAK, /* UniqueID */ + "BREAK line [, ...]]", /* Syntax */ + "Diagnostic command to stop execution at the specified line(s). " + " BREAK only applies to user-numbered lines. For multi-statement " + "lines, BREAK only applies to the first statement. BREAK effectively " + "inserts a hidden STOP command immediately after the line number. " + " Once a BREAK occurrs on a specified line, it is automatically " + "removed. To remove all existing BREAKs, execute BREAK without " + "any line numbers.", /* Description */ + "BREAK", /* Name */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + C_BUILD, /* UniqueID */ + "BUILD [start [, increment]]", /* Syntax */ + "Automatic line numbering for manual program entry. If the line " + "already exists, then an asterisk is displayed and pressing ENTER " + "leaves the line as-is. If the line does not exist, then an asterisk " + "is not displayed and pressing ENTER terminates BUILD mode. Regardless " + "whether the line exists, entering the command MAN will terminate " + "BUILD mode. BUILD mode is also terminated by any ERROR or by " + "pressing control-C.", /* Description */ + "BUILD", /* Name */ + H80 /* OptionVersionBitmask */ +}, +{ + C_BYE, /* UniqueID */ + "BYE", /* Syntax */ + "Exits to the operating system.", /* Description */ + "BYE", /* Name */ + B15 | D64 | G74 | H14 | HB2 | H80 | G65 | G67 | D73 | D70 | D71 /* OptionVersionBitmask */ +}, +{ + C_CALL, /* UniqueID */ + "CALL subname( [parameter [, ...] ] )", /* Syntax */ + "Calls a subroutine that was defined by SUB and END SUB.", /* Description */ + "CALL", /* Name */ + B15 | B93 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + C_CASE, /* UniqueID */ + "CASE constant [TO constant]", /* Syntax */ + "Introduces an element of a SELECT CASE statement. Multiple tests " + "must be seperated a comma. For example: CASE 1, 2 TO 3, IS " + "> 4, IF < 5", /* Description */ + "CASE", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_CASE, /* UniqueID */ + "CASE IF operator constant", /* Syntax */ + "Introduces an element of a SELECT CASE statement. Multiple tests " + "must be seperated a comma. For example: CASE 1, 2 TO 3, IS " + "> 4, IF < 5", /* Description */ + "CASE", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_CASE, /* UniqueID */ + "CASE IS operator constant", /* Syntax */ + "Introduces an element of a SELECT CASE statement. Multiple tests " + "must be seperated a comma. For example: CASE 1, 2 TO 3, IS " + "> 4, IF < 5", /* Description */ + "CASE", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_CASE_ELSE, /* UniqueID */ + "CASE ELSE", /* Syntax */ + "Introduces a default SELECT CASE element.", /* Description */ + "CASE ELSE", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_CHAIN, /* UniqueID */ + "CHAIN filename$ [, linenumber]", /* Syntax */ + "Load and execute another BASIC program, without clearing common " + "variables. For System/370, the syntax is CHAIN filename$,parameter$.", /* Description */ + "CHAIN", /* Name */ + B15 | B93 | S70 | C77 | G74 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_CHANGE, /* UniqueID */ + "CHANGE A$ TO X", /* Syntax */ + "Changes a string to a numeric array.", /* Description */ + "CHANGE", /* Name */ + B15 | D64 | G74 | HB2 | G65 | G67 | D71 /* OptionVersionBitmask */ +}, +{ + C_CHANGE, /* UniqueID */ + "CHANGE X TO A$", /* Syntax */ + "Changes a numeric array to a string.", /* Description */ + "CHANGE", /* Name */ + B15 | D64 | G74 | HB2 | G65 | G67 | D71 /* OptionVersionBitmask */ +}, +{ + C_CLEAR, /* UniqueID */ + "CLEAR", /* Syntax */ + "Sets all numeric variables to 0, and all string variables to " + "empty strings.", /* Description */ + "CLEAR", /* Name */ + B15 | B93 | H14 | HB1 | HB2 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_CLOAD, /* UniqueID */ + "CLOAD [filename$]", /* Syntax */ + "Loads an ASCII BASIC program into memory.", /* Description */ + "CLOAD", /* Name */ + B15 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_CLOAD8, /* UniqueID */ + "CLOAD* arrayname", /* Syntax */ + "Loads a numeric array from a file saved using CSAVE*.", /* Description */ + "CLOAD*", /* Name */ + B15 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_CLOSE, /* UniqueID */ + "CLOSE", /* Syntax */ + "Closes all files.", /* Description */ + "CLOSE", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_CLOSE, /* UniqueID */ + "CLOSE filename$ [, ...]", /* Syntax */ + "Closes a file.", /* Description */ + "CLOSE", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_CLOSE, /* UniqueID */ + "CLOSE filenumber [, ...]", /* Syntax */ + "Closes a file.", /* Description */ + "CLOSE", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_CLR, /* UniqueID */ + "CLR", /* Syntax */ + "Sets all numeric variables to 0, and all string variables to " + "empty strings.", /* Description */ + "CLR", /* Name */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + C_CMDS, /* UniqueID */ + "CMDS", /* Syntax */ + "Prints a list of all implemented BASIC commands.", /* Description */ + "CMDS", /* Name */ + B15 | B93 /* OptionVersionBitmask */ +}, +{ + C_COMMON, /* UniqueID */ + "COMMON variable [, ...]", /* Syntax */ + "Designates variables to be passed to a CHAINed program.", /* Description */ + "COMMON", /* Name */ + B15 | B93 | C77 | E86 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_CONSOLE, /* UniqueID */ + "CONSOLE [WIDTH width]", /* Syntax */ + "Directs the output of PRINT commands to the console (stdout), " + "and optionally changes the console width.", /* Description */ + "CONSOLE", /* Name */ + C77 /* OptionVersionBitmask */ +}, +{ + C_CONST, /* UniqueID */ + "CONST variable [, ...] = value", /* Syntax */ + "Assigns the value to variable. Any later assignment to the variable " + "causus a VARIABLE NOT DECLARED error.", /* Description */ + "CONST", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_CONT, /* UniqueID */ + "CONT", /* Syntax */ + "Continue a BASIC program after a STOP has been executed. Program " + "resumes at the line after the STOP.", /* Description */ + "CONT", /* Name */ + B15 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_CONTINUE, /* UniqueID */ + "CONTINUE", /* Syntax */ + "Continue a BASIC program after a STOP has been executed. Program " + "resumes at the line after the STOP.", /* Description */ + "CONTINUE", /* Name */ + H80 /* OptionVersionBitmask */ +}, +{ + C_COPY, /* UniqueID */ + "COPY source$ TO target$", /* Syntax */ + "Copy an exisitng file.", /* Description */ + "COPY", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_CREATE, /* UniqueID */ + "CREATE filename$ [ RECL reclen ] AS filenum\n[ BUFF number ] [ " + "RECS size ]", /* Syntax */ + "Creates the file and opens it. If the file already exists, then " + "it is ereased. If the file cannot be created, then an error " + "occurs.", /* Description */ + "CREATE", /* Name */ + C77 /* OptionVersionBitmask */ +}, +{ + C_CSAVE, /* UniqueID */ + "CSAVE [filename$]", /* Syntax */ + "Saves the current program into the file filename$ in ASCII format.", /* Description */ + "CSAVE", /* Name */ + B15 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_CSAVE8, /* UniqueID */ + "CSAVE* ArrayName", /* Syntax */ + "Saves a numeric array into a file for later loading by CLOAD*.", /* Description */ + "CSAVE*", /* Name */ + B15 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_DATA, /* UniqueID */ + "DATA constant [, ...]", /* Syntax */ + "Stores numeric and string constants to be accessed by READ.", /* Description */ + "DATA", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_DEC, /* UniqueID */ + "DEC variable [,...]", /* Syntax */ + "Decrement a numeric variable.", /* Description */ + "DEC", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_DEF, /* UniqueID */ + "DEF FNname[( arg [,...] )] = value", /* Syntax */ + "Defines a single-line function. Single-line functions require " + "an equal sign.", /* Description */ + "DEF", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_DEF, /* UniqueID */ + "DEF FNname[( arg [,...] )]", /* Syntax */ + "Defines a multiline function. Multi-line DEF functions do not " + "have an equal sign and must end with FNEND.", /* Description */ + "DEF", /* Name */ + B15 | S70 | G74 | HB1 | HB2 | H80 | G67 | D73 | D70 | D71 | I70 | I73 | T80 /* OptionVersionBitmask */ +}, +{ + C_DEFBYT, /* UniqueID */ + "DEFBYT letter[-letter] [, ...]", /* Syntax */ + "Declares variables with single-letter names as numeric variables.", /* Description */ + "DEFBYT", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_DEFCUR, /* UniqueID */ + "DEFCUR letter[-letter] [, ...]", /* Syntax */ + "Declares variables with single-letter names as numeric variables.", /* Description */ + "DEFCUR", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_DEFDBL, /* UniqueID */ + "DEFDBL letter[-letter] [, ...]", /* Syntax */ + "Declares variables with single-letter names as numeric variables.", /* Description */ + "DEFDBL", /* Name */ + B15 | B93 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_DEFINT, /* UniqueID */ + "DEFINT letter[-letter] [, ...]", /* Syntax */ + "Declares variables with single-letter names as numeric variables.", /* Description */ + "DEFINT", /* Name */ + B15 | B93 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_DEFLNG, /* UniqueID */ + "DEFLNG letter[-letter] [, ...]", /* Syntax */ + "Declares variables with single-letter names as numeric variables.", /* Description */ + "DEFLNG", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_DEFSNG, /* UniqueID */ + "DEFSNG letter[-letter] [, ...]", /* Syntax */ + "Declares variables with single-letter names as numeric variables.", /* Description */ + "DEFSNG", /* Name */ + B15 | B93 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_DEFSTR, /* UniqueID */ + "DEFSTR letter[-letter] [, ...]", /* Syntax */ + "Declares variables with single-letter names as string variables.", /* Description */ + "DEFSTR", /* Name */ + B15 | B93 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_DELETE, /* UniqueID */ + "DELETE filenumber", /* Syntax */ + "Closes and deletes the file OPEN as filenumber.", /* Description */ + "DELETE", /* Name */ + C77 /* OptionVersionBitmask */ +}, +{ + C_DELETE, /* UniqueID */ + "DELETE line [- line]", /* Syntax */ + "Deletes program lines indicated by the argument(s). All program " + "lines have a number, which is visible with the LIST command. " + " If line numbers are not provided, they are assigned beginning " + "with 1. Deleting a non-existing line does not cause an error.", /* Description */ + "DELETE", /* Name */ + B15 | B93 | H14 | HB1 | HB2 | H80 | M80 | D73 | D70 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_DELIMIT, /* UniqueID */ + "DELIMIT # X, A$", /* Syntax */ + "Sets the delimiter for READ # and WRITE #.", /* Description */ + "DELIMIT", /* Name */ + G74 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_DIM, /* UniqueID */ + "DIM [# filenum,] variable([ lower TO ] upper)", /* Syntax */ + "Declares variables and specifies the dimensions of array variables. " + " For array variables, if the lower bound is not provided, then " + "the OPTION BASE value is used. If filenum is provided, then " + "the variable is virtual.", /* Description */ + "DIM", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_DISPLAY, /* UniqueID */ + "DISPLAY source$", /* Syntax */ + "Display an exisitng text file.", /* Description */ + "DISPLAY", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_DO, /* UniqueID */ + "DO UNTIL value", /* Syntax */ + "Top of a DO - LOOP structure. Exits when value is non-zero.", /* Description */ + "DO", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_DO, /* UniqueID */ + "DO", /* Syntax */ + "Top of a DO - LOOP structure. If the loop is not terminated " + "by EXIT DO or LOOP UNTIL or LOOP WHILE, then it will loop forever.", /* Description */ + "DO", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_DO, /* UniqueID */ + "DO WHILE value", /* Syntax */ + "Top of a DO - LOOP structure. Exits when value is zero.", /* Description */ + "DO", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_DOS, /* UniqueID */ + "DOS", /* Syntax */ + "Exits to the operating system.", /* Description */ + "DOS", /* Name */ + R86 /* OptionVersionBitmask */ +}, +{ + C_DSP, /* UniqueID */ + "DSP variable [, ...]]", /* Syntax */ + "Diagnostic command to display the value every time the variable " + "is assigned. To remove all existing DSPs, execute DSP without " + "any variables.", /* Description */ + "DSP", /* Name */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + C_EDIT, /* UniqueID */ + "EDIT", /* Syntax */ + "implementation defined.", /* Description */ + "EDIT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_ELSE, /* UniqueID */ + "ELSE", /* Syntax */ + "Introduces a default condition in a multi-line IF statement.", /* Description */ + "ELSE", /* Name */ + B15 | B93 | C77 | E86 | H14 | HB1 | HB2 | H80 | M80 | D73 | D70 | R86 | D71 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_ELSEIF, /* UniqueID */ + "ELSEIF", /* Syntax */ + "Introduces a secondary condition in a multi-line IF statement.", /* Description */ + "ELSEIF", /* Name */ + B15 | B93 | C77 | E86 | H14 | HB1 | HB2 | H80 | M80 | D73 | D70 | R86 | D71 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_END, /* UniqueID */ + "END", /* Syntax */ + "Terminates program execution. If the BASIC program was executed " + "from the operating system level, then control returns to the " + "operating system, oterwise control reuturns to the BASIC prompt.", /* Description */ + "END", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_END_FUNCTION, /* UniqueID */ + "END FUNCTION", /* Syntax */ + "Specifies the last line of a multi-line FUNCTION definition.", /* Description */ + "END FUNCTION", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_END_IF, /* UniqueID */ + "END IF", /* Syntax */ + "Specifies the last line of a multi-line IF definition.", /* Description */ + "END IF", /* Name */ + B15 | B93 | C77 | E86 | H14 | HB1 | HB2 | H80 | M80 | D73 | D70 | R86 | D71 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_END_SELECT, /* UniqueID */ + "END SELECT", /* Syntax */ + "Specifies the last line of a multi-line SELECT CASE definition.", /* Description */ + "END SELECT", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_END_SUB, /* UniqueID */ + "END SUB", /* Syntax */ + "Specifies the last line of a multi-line SUB definition.", /* Description */ + "END SUB", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_ERASE, /* UniqueID */ + "ERASE variable [, ...]", /* Syntax */ + "Eliminates arrayed variables from a program.", /* Description */ + "ERASE", /* Name */ + B15 | B93 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_EXCHANGE, /* UniqueID */ + "EXCHANGE variable, variable", /* Syntax */ + "Swaps the values of two variables. Both variables must be of " + "the same type.", /* Description */ + "EXCHANGE", /* Name */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + C_EXIT, /* UniqueID */ + "EXIT", /* Syntax */ + "Syntax Error.", /* Description */ + "EXIT", /* Name */ + B15 | B93 | E86 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + C_EXIT_DO, /* UniqueID */ + "EXIT DO", /* Syntax */ + "Immediately exits the inner-most DO-LOOP strucure.", /* Description */ + "EXIT DO", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_EXIT_FOR, /* UniqueID */ + "EXIT FOR", /* Syntax */ + "Immediately exits the inner-most FOR-NEXT strucure.", /* Description */ + "EXIT FOR", /* Name */ + B15 | B93 | E86 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + C_EXIT_FUNCTION, /* UniqueID */ + "EXIT FUNCTION", /* Syntax */ + "Immediately exits the inner-most multi-line FUNCTION strucure.", /* Description */ + "EXIT FUNCTION", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_EXIT_REPEAT, /* UniqueID */ + "EXIT REPEAT", /* Syntax */ + "Exit a REPEAT - UNTIL structure.", /* Description */ + "EXIT REPEAT", /* Name */ + B15 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + C_EXIT_SUB, /* UniqueID */ + "EXIT SUB", /* Syntax */ + "Immediately exits the inner-most multi-line SUB strucure.", /* Description */ + "EXIT SUB", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_EXIT_WHILE, /* UniqueID */ + "EXIT WHILE", /* Syntax */ + "Immediately exits the inner-most WHILE-END strucure.", /* Description */ + "EXIT WHILE", /* Name */ + B15 | B93 | E86 /* OptionVersionBitmask */ +}, +{ + C_FEND, /* UniqueID */ + "FEND", /* Syntax */ + "Specifies the last line of a multi-line DEF function.", /* Description */ + "FEND", /* Name */ + C77 /* OptionVersionBitmask */ +}, +{ + C_FIELD, /* UniqueID */ + "FIELD [#] filenum, number AS variable$ [, ...]", /* Syntax */ + "Assigns number bytes in the buffer of random file filenum to " + "the variable variable$. GET will automatically update the variable, " + "and PUT will automatically use the variable.", /* Description */ + "FIELD", /* Name */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_FILE, /* UniqueID */ + "FILE filename$ [( reclen )]", /* Syntax */ + "Opens the file in READ mode.", /* Description */ + "FILE", /* Name */ + C77 /* OptionVersionBitmask */ +}, +{ + C_FILE, /* UniqueID */ + "FILE # X, A$", /* Syntax */ + "If A$ is \"*\" then closes file # X. If A$ is not \"*\" then opens " + "the file named A$ in READ mode.", /* Description */ + "FILE", /* Name */ + C77 | D64 | G74 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_FILES, /* UniqueID */ + "FILES A$[, ...]", /* Syntax */ + "If A$ is not \"*\" opens the file named A$ in READ mode. The first " + "filename of the first FILES command is assocated with file number " + "1. Note that multiple FILES commands accumulate.", /* Description */ + "FILES", /* Name */ + D64 | G74 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_FLEX, /* UniqueID */ + "FLEX", /* Syntax */ + "Exits to the operating system.", /* Description */ + "FLEX", /* Name */ + T79 /* OptionVersionBitmask */ +}, +{ + C_FNCS, /* UniqueID */ + "FNCS", /* Syntax */ + "Prints a list of all pre-defined BASIC functions.", /* Description */ + "FNCS", /* Name */ + B15 | B93 /* OptionVersionBitmask */ +}, +{ + C_FNEND, /* UniqueID */ + "FNEND", /* Syntax */ + "Specifies the last line of a multi-line DEF function.", /* Description */ + "FNEND", /* Name */ + B15 | S70 | G74 | HB1 | HB2 | H80 | G67 | D73 | D70 | D71 | I70 | I73 | T80 /* OptionVersionBitmask */ +}, +{ + C_FOR, /* UniqueID */ + "FOR variable = start TO finish [STEP increment]", /* Syntax */ + "Top of a FOR - NEXT structure. The loop will continue a fixed " + "number of times, which is determined by the values of start, " + "finish, and increment.", /* Description */ + "FOR", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_FUNCTION, /* UniqueID */ + "FUNCTION [ ( parameter [, ... ] ) ]", /* Syntax */ + "Top line of a multi-line FUNCTION definition. The variable names " + "specified are local to the FUNCTION definition, and are initialized " + "BYVAL when the function is invoked by another routine.", /* Description */ + "FUNCTION", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_GET, /* UniqueID */ + "GET # file_number , [ byte_number ] , scalar [,...]", /* Syntax */ + "Gets one (or more) values from a BINARY file.", /* Description */ + "GET", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_GET, /* UniqueID */ + "GET # file_number [ , RECORD record_number ]", /* Syntax */ + "Gets one (or more) values from a file.", /* Description */ + "GET", /* Name */ + R86 | D71 | T79 /* OptionVersionBitmask */ +}, +{ + C_GET, /* UniqueID */ + "GET # file_number [ , RECORD record_number ]", /* Syntax */ + "Gets one (or more) values from a file.", /* Description */ + "GET", /* Name */ + R86 | D71 | T79 /* OptionVersionBitmask */ +}, +{ + C_GET, /* UniqueID */ + "GET filename$ , scalar [, ...]", /* Syntax */ + "Gets one (or more) values from a file.", /* Description */ + "GET", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_GET, /* UniqueID */ + "GET # file_number [ , record_number ]", /* Syntax */ + "Gets one (or more) values from a RANDOM file.", /* Description */ + "GET", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_GO, /* UniqueID */ + "GO", /* Syntax */ + "Syntax Error.", /* Description */ + "GO", /* Name */ + B15 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_GO_SUB, /* UniqueID */ + "GO SUB line", /* Syntax */ + "Initiates a subroutine call to the line specified. The subroutine " + "must end with RETURN. The line may be a number or a label.", /* Description */ + "GO SUB", /* Name */ + B15 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_GO_TO, /* UniqueID */ + "GO TO line", /* Syntax */ + "Branches program execution to the specified line. The line may " + "be a number or a label.", /* Description */ + "GO TO", /* Name */ + B15 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_GOODBYE, /* UniqueID */ + "GOODBYE", /* Syntax */ + "Exits to the operating system.", /* Description */ + "GOODBYE", /* Name */ + B15 | D64 | G74 | HB2 | G65 | G67 | D71 /* OptionVersionBitmask */ +}, +{ + C_GOSUB, /* UniqueID */ + "GOSUB line", /* Syntax */ + "Initiates a subroutine call to the line specified. The subroutine " + "must end with RETURN. The line may be a number or a label.", /* Description */ + "GOSUB", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_GOTO, /* UniqueID */ + "GOTO line", /* Syntax */ + "Branches program execution to the specified line. The line may " + "be a number or a label.", /* Description */ + "GOTO", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_HELP, /* UniqueID */ + "HELP name", /* Syntax */ + "Provides help on the specified name which is a command name or " + "function name.", /* Description */ + "HELP", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_IF, /* UniqueID */ + "IF value THEN line1 [ELSE line2]", /* Syntax */ + "Single line standard IF command. If the value is non-zero, then " + "branh to line1. If the value is zero and ELSE is provided, then " + "branch to line2. Otherwise continue to the next line. LABELS " + "are not allowed.", /* Description */ + "IF", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_IF_END, /* UniqueID */ + "IF END # filenum THEN line1 [ELSE line2]", /* Syntax */ + "Single line standard IF command. If the file is at EOF , then " + "branch to line1. If the file is not at EOF and ELSE is provided, " + "then branch to line2. Otherwise continue to the next line. " + "LABELS are not allowed.", /* Description */ + "IF END", /* Name */ + C77 | D64 | G74 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_IF_MORE, /* UniqueID */ + "IF MORE # filenum THEN line1 [ELSE line2]", /* Syntax */ + "Single line standard IF command. If the file is not at EOF , " + "then branch to line1. If the file is at EOF and ELSE is provided, " + "then branch to line2. Otherwise continue to the next line. " + "LABELS are not allowed.", /* Description */ + "IF MORE", /* Name */ + D64 | G74 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_IF8THEN, /* UniqueID */ + "IF value THEN", /* Syntax */ + "Top of a multi-line IF - END IF structure. If the value is non-zero, " + "then the program lines upto the next ELSE or ELSE IF command " + "are executed, otherwise the program branches to the next ELSE " + "or ELSE IF command.", /* Description */ + "IF*THEN", /* Name */ + B15 | B93 | C77 | E86 | H14 | HB1 | HB2 | H80 | M80 | D73 | D70 | R86 | D71 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_IMAGE, /* UniqueID */ + "IMAGE \"format string\" ", /* Syntax */ + "Provides format string for PRINT USING linenum.", /* Description */ + "IMAGE", /* Name */ + S70 | H14 | HB1 | HB2 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_INC, /* UniqueID */ + "INC variable [,...]", /* Syntax */ + "Increment a numeric variable.", /* Description */ + "INC", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_INPUT, /* UniqueID */ + "INPUT \"prompt string\" , variable [, ...]", /* Syntax */ + "Reads input from the terminal after displaying a prompt.", /* Description */ + "INPUT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_INPUT, /* UniqueID */ + "INPUT # filenum , variable [, ...]s", /* Syntax */ + "Reads input from the file specified by filenum.", /* Description */ + "INPUT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_INPUT, /* UniqueID */ + "INPUT variable [, ...]", /* Syntax */ + "Reads input from the terminal.", /* Description */ + "INPUT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_INPUT_LINE, /* UniqueID */ + "INPUT LINE variable$", /* Syntax */ + "Reads entire line from the terminal into variable$.", /* Description */ + "INPUT LINE", /* Name */ + B15 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_INPUT_LINE, /* UniqueID */ + "INPUT LINE # filenum , variable$", /* Syntax */ + "Reads entire line from a file into variable$.", /* Description */ + "INPUT LINE", /* Name */ + B15 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_INPUT_LINE, /* UniqueID */ + "INPUT LINE \"prompt string\" , variable$", /* Syntax */ + "Reads entire line from the terminal into variable$ after displaying " + "a prompt", /* Description */ + "INPUT LINE", /* Name */ + B15 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_LET, /* UniqueID */ + "[LET] variable [, ...] = value", /* Syntax */ + "Assigns the value to the variable. The LET keyword is optional.", /* Description */ + "LET", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_LINE, /* UniqueID */ + "LINE", /* Syntax */ + "Syntax Error.", /* Description */ + "LINE", /* Name */ + B15 | B93 | H14 | HB2 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_LINE_INPUT, /* UniqueID */ + "LINE INPUT [[#] filenum,][\"prompt string\";] variable$", /* Syntax */ + "Reads entire line from the keyboard or a file into variable$.", /* Description */ + "LINE INPUT", /* Name */ + B15 | B93 | H14 | HB2 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_LIST, /* UniqueID */ + "LIST line1 [- line2]", /* Syntax */ + "Lists BASIC program lines from line1 to line2 to the console " + "on stdout.", /* Description */ + "LIST", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_LISTNH, /* UniqueID */ + "LISTNH line1 [- line2]", /* Syntax */ + "Lists BASIC program lines from line1 to line2 to the console " + "on stdout.", /* Description */ + "LISTNH", /* Name */ + B15 | S70 | C77 | D64 | G74 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_LLIST, /* UniqueID */ + "LLIST line1 [- line2]", /* Syntax */ + "Lists BASIC program lines from line1 to line2 to the printer " + "on stderr.", /* Description */ + "LLIST", /* Name */ + B15 | C77 | H14 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_LOAD, /* UniqueID */ + "LOAD [filename$]", /* Syntax */ + "Loads an ASCII BASIC program into memory.", /* Description */ + "LOAD", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_LOCAL, /* UniqueID */ + "LOCAL [# filenum,] variable([ lower TO ] upper)", /* Syntax */ + "Declares variables and specifies the dimensions of array variables. " + " For array variables, if the lower bound is not provided, then " + "the OPTION BASE value is used. If filenum is provided, then " + "the variable is virtual. Only supported inside a FUNCTION or " + "SUB.", /* Description */ + "LOCAL", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_LOOP, /* UniqueID */ + "LOOP UNTIL value", /* Syntax */ + "Bottom of a DO - LOOP structure. Exits when value is nonz-zero.", /* Description */ + "LOOP", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_LOOP, /* UniqueID */ + "LOOP WHILE value", /* Syntax */ + "Bottom of a DO - LOOP structure. Exits when value is zero.", /* Description */ + "LOOP", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_LOOP, /* UniqueID */ + "LOOP", /* Syntax */ + "Bottom of a DO - LOOP structure. If the loop is not terminated " + "by EXIT DO or DO UNTIL or DO WHILE, then it will loop forever.", /* Description */ + "LOOP", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_LPRINT, /* UniqueID */ + "LPRINT [USING format-string$;] value ...", /* Syntax */ + "Send output to the printer (stderr).", /* Description */ + "LPRINT", /* Name */ + B15 | S70 | E78 | E86 | H14 | HB2 | M80 | D71 | I70 | I73 | T80 /* OptionVersionBitmask */ +}, +{ + C_LPRINTER, /* UniqueID */ + "LPRINTER [WIDTH width]", /* Syntax */ + "Directs the output of PRINT commands to the printer (stderr), " + "and optionally changes the printer width.", /* Description */ + "LPRINTER", /* Name */ + C77 /* OptionVersionBitmask */ +}, +{ + C_LPT, /* UniqueID */ + "LPT [filename$]", /* Syntax */ + "Directs the PRINT commands to write to the printer (stderr), " + "or optionally to the specified file.", /* Description */ + "LPT", /* Name */ + D73 /* OptionVersionBitmask */ +}, +{ + C_LSET, /* UniqueID */ + "LSET variable$ = value", /* Syntax */ + "Left-aligns the value into variable$. If the length of the value " + "is too short, then it is padded on the right with spaces. If " + "the length of the value is too long, then it is truncated on " + "the right. This is only for use with variables assigned to a " + "random access buffer with FIELD command.", /* Description */ + "LSET", /* Name */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER, /* UniqueID */ + "MAINTAINER", /* Syntax */ + "This command is reserved for use by the Bywater BASIC maintainer. " + " It is not for the BASIC programmer.", /* Description */ + "MAINTAINER", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_CMDS, /* UniqueID */ + "MAINTAINER CMDS", /* Syntax */ + "Syntax Error.", /* Description */ + "MAINTAINER CMDS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_CMDS_HTML, /* UniqueID */ + "MAINTAINER CMDS HTML", /* Syntax */ + "Dump COMMAND vs VERSION as HTML table", /* Description */ + "MAINTAINER CMDS HTML", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_CMDS_ID, /* UniqueID */ + "MAINTAINER CMDS ID", /* Syntax */ + "Dump COMMAND #define.", /* Description */ + "MAINTAINER CMDS ID", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_CMDS_MANUAL, /* UniqueID */ + "MAINTAINER CMDS MANUAL", /* Syntax */ + "Dump COMMAND manual.", /* Description */ + "MAINTAINER CMDS MANUAL", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_CMDS_SWITCH, /* UniqueID */ + "MAINTAINER CMDS_SWITCH", /* Syntax */ + "Dump COMMAND switch.", /* Description */ + "MAINTAINER CMDS SWITCH", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_CMDS_TABLE, /* UniqueID */ + "MAINTAINER CMDS TABLE", /* Syntax */ + "Dump COMMAND table.", /* Description */ + "MAINTAINER CMDS TABLE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_DEBUG, /* UniqueID */ + "MAINTAINER DEBUG", /* Syntax */ + "Syntax Error.", /* Description */ + "MAINTAINER DEBUG", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_DEBUG_OFF, /* UniqueID */ + "MAINTAINER DEBUG OFF", /* Syntax */ + "Disable degug tracing.", /* Description */ + "MAINTAINER DEBUG OFF", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_DEBUG_ON, /* UniqueID */ + "MAINTAINER DEBUG ON", /* Syntax */ + "Enable degug tracing.", /* Description */ + "MAINTAINER DEBUG ON", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_FNCS, /* UniqueID */ + "MAINTAINER FNCS", /* Syntax */ + "Syntax Error.", /* Description */ + "MAINTAINER FNCS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_FNCS_HTML, /* UniqueID */ + "MAINTAINER FNCS HTML", /* Syntax */ + "Dump FUNCTION vs VERSION as HTML table.", /* Description */ + "MAINTAINER FNCS HTML", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_FNCS_ID, /* UniqueID */ + "MAINTAINER FNCS ID", /* Syntax */ + "Dump FUNCTION #define.", /* Description */ + "MAINTAINER FNCS ID", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_FNCS_MANUAL, /* UniqueID */ + "MAINTAINER FNCS MANUAL", /* Syntax */ + "Dump FUNCTION manual.", /* Description */ + "MAINTAINER FNCS MANUAL", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_FNCS_SWITCH, /* UniqueID */ + "MAINTAINER FNCS SWITCH", /* Syntax */ + "Dump FUNCTION switch.", /* Description */ + "MAINTAINER FNCS SWITCH", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_FNCS_TABLE, /* UniqueID */ + "MAINTAINER FNCS TABLE", /* Syntax */ + "Dump FUNCTION table.", /* Description */ + "MAINTAINER FNCS TABLE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_MANUAL, /* UniqueID */ + "MAINTAINER MANUAL", /* Syntax */ + "Dump manual for the currently selected OPTION VERSION.", /* Description */ + "MAINTAINER MANUAL", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MAINTAINER_STACK, /* UniqueID */ + "MAINTAINER STACK", /* Syntax */ + "Dump the BASIC stack.", /* Description */ + "MAINTAINER STACK", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_MARGIN, /* UniqueID */ + "MARGIN # filenumber, width", /* Syntax */ + "Sets the file margin for writing; filenumber <= 0 is ignored.", /* Description */ + "MARGIN", /* Name */ + B15 | D64 | G74 | HB2 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_MAT, /* UniqueID */ + "MAT arrayname = value", /* Syntax */ + "Matrix operations:\nMAT A = CON\nMAT A = IDN\nMAT A = ZER\nMAT A " + "= INV B\nMAT A = TRN B\nMAT A = (k) * B\nMAT A = B\nMAT A = B + C\nMAT " + "A = B - C\nMAT A = B * C", /* Description */ + "MAT", /* Name */ + S70 | D64 | G74 | H14 | HB1 | HB2 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_MAT_GET, /* UniqueID */ + "MAT GET filename$, arrayname", /* Syntax */ + "Matrix get.", /* Description */ + "MAT GET", /* Name */ + S70 | G74 | G65 | G67 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_MAT_INPUT, /* UniqueID */ + "MAT INPUT arrayname", /* Syntax */ + "Matrix input.", /* Description */ + "MAT INPUT", /* Name */ + S70 | D64 | G74 | H14 | HB1 | HB2 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_MAT_PRINT, /* UniqueID */ + "MAT PRINT arrayname", /* Syntax */ + "Matrix print.", /* Description */ + "MAT PRINT", /* Name */ + S70 | D64 | G74 | H14 | HB1 | HB2 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_MAT_PUT, /* UniqueID */ + "MAT PUT filename$, arrayname", /* Syntax */ + "Matrix put.", /* Description */ + "MAT PUT", /* Name */ + S70 | G74 | G65 | G67 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_MAT_READ, /* UniqueID */ + "MAT READ arrayname", /* Syntax */ + "Matrix read.", /* Description */ + "MAT READ", /* Name */ + S70 | D64 | G74 | H14 | HB1 | HB2 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_MAT_WRITE, /* UniqueID */ + "MAT WRITE arrayname", /* Syntax */ + "Matrix write.", /* Description */ + "MAT WRITE", /* Name */ + D64 | G74 | H14 | HB1 | HB2 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_MERGE, /* UniqueID */ + "MERGE filename$", /* Syntax */ + "Merges the BASIC program in filename$ into the current BASIC " + "program. Lines in filename$ replace any matching lines in the " + "current program.", /* Description */ + "MERGE", /* Name */ + B15 | B93 | C77 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_MID4, /* UniqueID */ + "MID$( variable$, start [, count ] ) = value", /* Syntax */ + "Replaces a subtring of variable$ with value.", /* Description */ + "MID$", /* Name */ + B15 | B93 | C77 | H14 | H80 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_MON, /* UniqueID */ + "MON", /* Syntax */ + "Exits to the operating system.", /* Description */ + "MON", /* Name */ + R86 /* OptionVersionBitmask */ +}, +{ + C_NAME, /* UniqueID */ + "NAME old$ AS new$", /* Syntax */ + "Changes the name of an existing file.", /* Description */ + "NAME", /* Name */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_NEW, /* UniqueID */ + "NEW", /* Syntax */ + "Deletes the program in memory and clears all variables.", /* Description */ + "NEW", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_NEXT, /* UniqueID */ + "NEXT [variable]", /* Syntax */ + "The bottom line of a FOR - NEXT structure.", /* Description */ + "NEXT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OF, /* UniqueID */ + "OF", /* Syntax */ + "Syntax Error.", /* Description */ + "OF", /* Name */ + B15 | S70 | C77 | D64 | E78 | E86 | G74 | HB1 | HB2 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_OLD, /* UniqueID */ + "OLD [filename$]", /* Syntax */ + "Loads an ASCII BASIC program into memory.", /* Description */ + "OLD", /* Name */ + D64 | G74 | H80 | G65 | G67 | D73 | D70 | D71 /* OptionVersionBitmask */ +}, +{ + C_ON, /* UniqueID */ + "ON value GOSUB line [, ...]", /* Syntax */ + "Calls based on the rounded value.", /* Description */ + "ON", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_ON, /* UniqueID */ + "ON value GOTO line [, ...]", /* Syntax */ + "Branches based on the rounded value.", /* Description */ + "ON", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_ON_ERROR, /* UniqueID */ + "ON ERROR", /* Syntax */ + "Syntax Error.", /* Description */ + "ON ERROR", /* Name */ + B15 | B93 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_ON_ERROR_GOSUB, /* UniqueID */ + "ON ERROR GOSUB errline", /* Syntax */ + "When a trappable error occurs, execute GOSUB errline. The error " + "handler must terminate with a RETURN command. If the line number " + "is 0 (zerp), then use the default error handler. Valid when " + "OPTION ERROR GOSUB.", /* Description */ + "ON ERROR GOSUB", /* Name */ + B15 | B93 /* OptionVersionBitmask */ +}, +{ + C_ON_ERROR_GOTO, /* UniqueID */ + "ON ERROR GOTO errline", /* Syntax */ + "When a trappable error occurs, execute GOTO errline. The error " + "handler must terminate with a RESUME command. If the line number " + "is 0 (zerp), then use the default error handler. Valid when " + "OPTION ERROR GOTO.", /* Description */ + "ON ERROR GOTO", /* Name */ + B15 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_ON_ERROR_RESUME, /* UniqueID */ + "ON ERROR RESUME", /* Syntax */ + "Syntax Error.", /* Description */ + "ON ERROR RESUME", /* Name */ + B15 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_ON_ERROR_RESUME_NEXT, /* UniqueID */ + "ON ERROR RESUME NEXT", /* Syntax */ + "When a trappable error occurs, execution continues with the next " + "line. Valid when OPTION ERROR GOTO.", /* Description */ + "ON ERROR RESUME NEXT", /* Name */ + B15 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_ON_ERROR_RETURN, /* UniqueID */ + "ON ERROR RETURN", /* Syntax */ + "Syntax Error.", /* Description */ + "ON ERROR RETURN", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_ON_ERROR_RETURN_NEXT, /* UniqueID */ + "ON ERROR RETURN NEXT", /* Syntax */ + "When a trappable error occurs, execution continues with the next " + "line. Valid when OPTION ERROR GOSUB.", /* Description */ + "ON ERROR RETURN NEXT", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_ON_TIMER, /* UniqueID */ + "ON TIMER count GOSUB line", /* Syntax */ + "Specifies a line (or label) to gosub when count seconds have " + "elaspsed after TIMER ON is executed. The interrupt routine should " + "end with a RETURN command. Timer events only occur in running " + "BASIC programs. The resolution of the clock is implementation " + "defined.", /* Description */ + "ON TIMER", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_OPEN, /* UniqueID */ + "OPEN NEW|OLD|VIRTUAL filename$\nAS filenumber", /* Syntax */ + "Opens a file for use.", /* Description */ + "OPEN", /* Name */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPEN, /* UniqueID */ + "OPEN filename$\nFOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL\nAS [#] " + "fileenumber\n[LEN [=] record-length]", /* Syntax */ + "Opens a file for use.\nRANDOM requires LEN.", /* Description */ + "OPEN", /* Name */ + B15 | B93 | H14 | HB2 | M80 | T80 /* OptionVersionBitmask */ +}, +{ + C_OPEN, /* UniqueID */ + "OPEN filename$\nFOR INPUT|OUTPUT|APPEND|BINARY|RANDOM|VIRTUAL\nAS FILE " + "filenumber\n[ ,RECORDSIZE ignored ]\n[ ,CLUSTERSIZE ignored ]\n[ " + ",MODE ignored ]", /* Syntax */ + "Opens a file for use.", /* Description */ + "OPEN", /* Name */ + D71 /* OptionVersionBitmask */ +}, +{ + C_OPEN, /* UniqueID */ + "OPEN filename\nFOR READ|WRITE|VIRTUAL\nAS FILE filenumber", /* Syntax */ + "Opens a file for use.", /* Description */ + "OPEN", /* Name */ + H80 /* OptionVersionBitmask */ +}, +{ + C_OPEN, /* UniqueID */ + "OPEN filename$\n[ RECL reclen ]\nAS filenumber\n[ BUFF ignored ]\n[ " + "RECS ignored ]", /* Syntax */ + "Opens a file for use.", /* Description */ + "OPEN", /* Name */ + C77 /* OptionVersionBitmask */ +}, +{ + C_OPEN, /* UniqueID */ + "OPEN filenumber,\nfilename$,\nINPUT|OUTPUT|APPEND|VIRTUAL", /* Syntax */ + "Opens a file for use.", /* Description */ + "OPEN", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_OPTION, /* UniqueID */ + "OPTION", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ANGLE, /* UniqueID */ + "OPTION ANGLE", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION ANGLE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ANGLE_DEGREES, /* UniqueID */ + "OPTION ANGLE DEGREES", /* Syntax */ + "Configures these math functions to accept and return angles in " + "degrees: ACOS, ACS, ANGLE, ARCSIN, ASIN, ASN, ARCTAN, ATN, ATAN, " + "COS, COT, CSC, SEC, SIN and TAN.", /* Description */ + "OPTION ANGLE DEGREES", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ANGLE_GRADIANS, /* UniqueID */ + "OPTION ANGLE GRADIANS", /* Syntax */ + "Configures these math functions to accept and return angles in " + "gradians: ACOS, ANGLE, ASIN, ASN, ATN, ATAN, COS, COT, CSC, " + "SEC, SIN and TAN.", /* Description */ + "OPTION ANGLE GRADIANS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ANGLE_RADIANS, /* UniqueID */ + "OPTION ANGLE RADIANS", /* Syntax */ + "Configures these math functions to accept and return angles in " + "radians: ACOS, ANGLE, ASIN, ASN, ATN, ATAN, COS, COT, CSC, SEC, " + "SIN and TAN.", /* Description */ + "OPTION ANGLE RADIANS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ARITHMETIC, /* UniqueID */ + "OPTION ARITHMETIC", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION ARITHMETIC", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ARITHMETIC_DECIMAL, /* UniqueID */ + "OPTION ARITHMETIC DECIMAL", /* Syntax */ + "Currently has no effect.", /* Description */ + "OPTION ARITHMETIC DECIMAL", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ARITHMETIC_FIXED, /* UniqueID */ + "OPTION ARITHMETIC FIXED", /* Syntax */ + "Currently has no effect.", /* Description */ + "OPTION ARITHMETIC FIXED", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ARITHMETIC_NATIVE, /* UniqueID */ + "OPTION ARITHMETIC NATIVE", /* Syntax */ + "Currently has no effect.", /* Description */ + "OPTION ARITHMETIC NATIVE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_BASE, /* UniqueID */ + "OPTION BASE integer", /* Syntax */ + "Sets the default lowest array subscript.", /* Description */ + "OPTION BASE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_BUGS, /* UniqueID */ + "OPTION BUGS", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION BUGS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_BUGS_BOOLEAN, /* UniqueID */ + "OPTION BUGS BOOLEAN", /* Syntax */ + "Boolean results are 1 or 0 instead of bitwise.", /* Description */ + "OPTION BUGS BOOLEAN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_BUGS_OFF, /* UniqueID */ + "OPTION BUGS OFF", /* Syntax */ + "Disables bugs commonly found in many BASIC dialects.", /* Description */ + "OPTION BUGS OFF", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_BUGS_ON, /* UniqueID */ + "OPTION BUGS ON", /* Syntax */ + "Enables bugs commonly found in many BASIC dialects.", /* Description */ + "OPTION BUGS ON", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_COMPARE, /* UniqueID */ + "OPTION COMPARE", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION COMPARE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_COMPARE_BINARY, /* UniqueID */ + "OPTION COMPARE BINARY", /* Syntax */ + "Causes string comparisons to be case-sensitive.", /* Description */ + "OPTION COMPARE BINARY", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_COMPARE_DATABASE, /* UniqueID */ + "OPTION COMPARE DATABASE", /* Syntax */ + "Causes string comparisons to be case-insensitive.", /* Description */ + "OPTION COMPARE DATABASE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_COMPARE_TEXT, /* UniqueID */ + "OPTION COMPARE TEXT", /* Syntax */ + "Causes string comparisons to be case-insensitive.", /* Description */ + "OPTION COMPARE TEXT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_COVERAGE, /* UniqueID */ + "OPTION COVERAGE", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION COVERAGE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_COVERAGE_OFF, /* UniqueID */ + "OPTION COVERAGE OFF", /* Syntax */ + "Disables BASIC code coverage recording, displayed using the LIST " + "command.", /* Description */ + "OPTION COVERAGE OFF", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_COVERAGE_ON, /* UniqueID */ + "OPTION COVERAGE ON", /* Syntax */ + "Enables BASIC code coverage recording, displayed using the LIST " + "command.", /* Description */ + "OPTION COVERAGE ON", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_DATE, /* UniqueID */ + "OPTION DATE format$", /* Syntax */ + "Sets the date format string used by C strftime() for DATE$.", /* Description */ + "OPTION DATE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_DIGITS, /* UniqueID */ + "OPTION DIGITS integer", /* Syntax */ + "Sets the number of significant digits for PRINT. Setting the " + "value to zero restores the default.", /* Description */ + "OPTION DIGITS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_DISABLE, /* UniqueID */ + "OPTION DISABLE", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION DISABLE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_DISABLE_COMMAND, /* UniqueID */ + "OPTION DISABLE COMMAND name$", /* Syntax */ + "Disables the specified BASIC command.", /* Description */ + "OPTION DISABLE COMMAND", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_DISABLE_FUNCTION, /* UniqueID */ + "OPTION DISABLE FUNCTION name$", /* Syntax */ + "Disables the specified BASIC function.", /* Description */ + "OPTION DISABLE FUNCTION", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_DISABLE_OPERATOR, /* UniqueID */ + "OPTION DISABLE OPERATOR name$", /* Syntax */ + "Disables the specified BASIC operator.", /* Description */ + "OPTION DISABLE OPERATOR", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_EDIT, /* UniqueID */ + "OPTION EDIT string$", /* Syntax */ + "Sets the program name used by the EDIT command.", /* Description */ + "OPTION EDIT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ENABLE, /* UniqueID */ + "OPTION ENABLE", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION ENABLE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ENABLE_COMMAND, /* UniqueID */ + "OPTION ENABLE COMMAND name$", /* Syntax */ + "Enables the specified BASIC command.", /* Description */ + "OPTION ENABLE COMMAND", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ENABLE_FUNCTION, /* UniqueID */ + "OPTION ENABLE FUNCTION name$", /* Syntax */ + "Enables the specified BASIC function.", /* Description */ + "OPTION ENABLE FUNCTION", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ENABLE_OPERATOR, /* UniqueID */ + "OPTION ENABLE OPERATOR name$", /* Syntax */ + "Enables the specified BASIC operator.", /* Description */ + "OPTION ENABLE OPERATOR", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ERROR, /* UniqueID */ + "OPTION ERROR", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION ERROR", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ERROR_GOSUB, /* UniqueID */ + "OPTION ERROR GOSUB", /* Syntax */ + "When an error occurs, GOSUB to the error handler. The error " + "handler exits with RETURN.", /* Description */ + "OPTION ERROR GOSUB", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ERROR_GOTO, /* UniqueID */ + "OPTION ERROR GOTO", /* Syntax */ + "When an error occurs, GOTO to the error handler. The error handler " + "exits with RESUME.", /* Description */ + "OPTION ERROR GOTO", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_EXPLICIT, /* UniqueID */ + "OPTION EXPLICIT", /* Syntax */ + "All variables must be declared using DIM.", /* Description */ + "OPTION EXPLICIT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_EXTENSION, /* UniqueID */ + "OPTION EXTENSION string$", /* Syntax */ + "Sets the BASIC filename extension, commonly \".bas\".", /* Description */ + "OPTION EXTENSION", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_FILES, /* UniqueID */ + "OPTION FILES string$", /* Syntax */ + "Sets the program name used by the FILES command.", /* Description */ + "OPTION FILES", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_IMPLICIT, /* UniqueID */ + "OPTION IMPLICIT", /* Syntax */ + "Variables need not be declared using DIM, provided arrays have " + "no more that 10 elements. This is the opposite of OPTION EXPLICIT, " + "and is the default for all versions of BASIC.", /* Description */ + "OPTION IMPLICIT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_INDENT, /* UniqueID */ + "OPTION INDENT integer", /* Syntax */ + "Sets indention level for LIST. Zero means no indention. Default " + "is 2.", /* Description */ + "OPTION INDENT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_LABELS, /* UniqueID */ + "OPTION LABELS", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION LABELS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_LABELS_OFF, /* UniqueID */ + "OPTION LABELS OFF", /* Syntax */ + "Disables text labels.", /* Description */ + "OPTION LABELS OFF", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_LABELS_ON, /* UniqueID */ + "OPTION LABELS ON", /* Syntax */ + "Enables text labels.", /* Description */ + "OPTION LABELS ON", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PROMPT, /* UniqueID */ + "OPTION PROMPT string$", /* Syntax */ + "Sets the BASIC prompt.", /* Description */ + "OPTION PROMPT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT, /* UniqueID */ + "OPTION PUNCT", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION PUNCT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_AT, /* UniqueID */ + "OPTION PUNCT AT char$", /* Syntax */ + "Sets the PRINT AT character, commonly \"@\".", /* Description */ + "OPTION PUNCT AT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_BYTE, /* UniqueID */ + "OPTION PUNCT BYTE char$", /* Syntax */ + "Sets the suffix character that indicates a variable is of type " + "BYTE, commonly \"~\".", /* Description */ + "OPTION PUNCT BYTE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_COMMENT, /* UniqueID */ + "OPTION PUNCT COMMENT char$", /* Syntax */ + "Sets the shortcut COMMENT character.", /* Description */ + "OPTION PUNCT COMMENT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_CURRENCY, /* UniqueID */ + "OPTION PUNCT CURRENCY char$", /* Syntax */ + "Sets the suffix character that indicates a variable is of type " + "CURRENCY, commonly \"@\".", /* Description */ + "OPTION PUNCT CURRENCY", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_DOUBLE, /* UniqueID */ + "OPTION PUNCT DOUBLE char$", /* Syntax */ + "Sets the suffix character that indicates a variable is of type " + "DOUBLE, commonly \"#\".", /* Description */ + "OPTION PUNCT DOUBLE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_FILENUM, /* UniqueID */ + "OPTION PUNCT FILENUM char$", /* Syntax */ + "Sets the FILE NUMBER prefix character, commonly \"#\".", /* Description */ + "OPTION PUNCT FILENUM", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_IMAGE, /* UniqueID */ + "OPTION PUNCT IMAGE char$", /* Syntax */ + "Sets the shortcut IMAGE character, commonly \":\".", /* Description */ + "OPTION PUNCT IMAGE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_INPUT, /* UniqueID */ + "OPTION PUNCT INPUT char$", /* Syntax */ + "Sets the shortcut INPUT character, commonly \"!\".", /* Description */ + "OPTION PUNCT INPUT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_INTEGER, /* UniqueID */ + "OPTION PUNCT INTEGER char$", /* Syntax */ + "Sets the suffix character that indicates a variable is of type " + "INTEGER, commonly \"%\".", /* Description */ + "OPTION PUNCT INTEGER", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_LONG, /* UniqueID */ + "OPTION PUNCT LONG char$", /* Syntax */ + "Sets the suffix character that indicates a variable is of type " + "LONG, commonly \"&\".", /* Description */ + "OPTION PUNCT LONG", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_LPAREN, /* UniqueID */ + "OPTION PUNCT LPAREN char$", /* Syntax */ + "Sets the LEFT PARENTHESIS character, commonly \"(\".", /* Description */ + "OPTION PUNCT LPAREN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_PRINT, /* UniqueID */ + "OPTION PUNCT_PRINT char$", /* Syntax */ + "Sets the shortcut PRINT character, commonly \"?\".", /* Description */ + "OPTION PUNCT PRINT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_QUOTE, /* UniqueID */ + "OPTION PUNCT QUOTE char$", /* Syntax */ + "Sets the QUOTE character, commonly \"\"\"", /* Description */ + "OPTION PUNCT QUOTE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_RPAREN, /* UniqueID */ + "OPTION PUNCT RPAREN char$", /* Syntax */ + "Sets the RIGHT PARENTHESIS character, commonly \")\".", /* Description */ + "OPTION PUNCT RPAREN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_SINGLE, /* UniqueID */ + "OPTION PUNCT SINGLE char$", /* Syntax */ + "Sets the suffix character that indicates a variable is of type " + "SINGLE, commonly \"!\".", /* Description */ + "OPTION PUNCT SINGLE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_STATEMENT, /* UniqueID */ + "OPTION PUNCT STATEMENT char$", /* Syntax */ + "Sets the statement seperator character, commonly \":\".", /* Description */ + "OPTION PUNCT STATEMENT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_PUNCT_STRING, /* UniqueID */ + "OPTION PUNCT STRING char$", /* Syntax */ + "Sets the suffix character that indicates a variable is of type " + "STRING, commonly \"$\".", /* Description */ + "OPTION PUNCT STRING", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_RECLEN, /* UniqueID */ + "OPTION RECLEN integer", /* Syntax */ + "Sets the default RANDOM record length.", /* Description */ + "OPTION RECLEN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_RENUM, /* UniqueID */ + "OPTION RENUM string$", /* Syntax */ + "Sets the program name used by the RENUM command.", /* Description */ + "OPTION RENUM", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ROUND, /* UniqueID */ + "OPTION ROUND", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION ROUND", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ROUND_BANK, /* UniqueID */ + "OPTION ROUND BANK", /* Syntax */ + "Round using the Banker rule.", /* Description */ + "OPTION ROUND BANK", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ROUND_MATH, /* UniqueID */ + "OPTION ROUND MATH", /* Syntax */ + "Round using mathematical rules.", /* Description */ + "OPTION ROUND MATH", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ROUND_TRUNCATE, /* UniqueID */ + "OPTION ROUND TRUNCATE", /* Syntax */ + "Round using truncation.", /* Description */ + "OPTION ROUND TRUNCATE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_SCALE, /* UniqueID */ + "OPTION SCALE integer", /* Syntax */ + "Sets the number of digits to round after the decimal point for " + "PRINT. Setting the value to zero disables rounding.", /* Description */ + "OPTION SCALE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_SLEEP, /* UniqueID */ + "OPTION SLEEP double", /* Syntax */ + "Sets multiplier for SLEEP and WAIT. Zero means no waiting. " + "Default is 1.", /* Description */ + "OPTION SLEEP", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_STDERR, /* UniqueID */ + "OPTION STDERR filename$", /* Syntax */ + "Sets the file used for STDERR, which is used by LPRINT commands.", /* Description */ + "OPTION STDERR", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_STDIN, /* UniqueID */ + "OPTION STDIN filename$", /* Syntax */ + "Sets the file used for STDIN, which is used by INPUT commands.", /* Description */ + "OPTION STDIN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_STDOUT, /* UniqueID */ + "OPTION STDOUT filename$", /* Syntax */ + "Sets the file used for STDOUT, which is used by PRINT commands.", /* Description */ + "OPTION STDOUT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_STRICT, /* UniqueID */ + "OPTION STRICT", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION STRICT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_STRICT_OFF, /* UniqueID */ + "OPTION STRICT OFF", /* Syntax */ + "Disables checking for implicit array creation without using the " + "DIM command.", /* Description */ + "OPTION STRICT OFF", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_STRICT_ON, /* UniqueID */ + "OPTION STRICT ON", /* Syntax */ + "Enables checking for implicit array creation without using the " + "DIM command.", /* Description */ + "OPTION STRICT ON", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_TERMINAL, /* UniqueID */ + "OPTION TERMINAL", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION TERMINAL", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_TERMINAL_ADM, /* UniqueID */ + "OPTION TERMINAL ADM", /* Syntax */ + "Enables ADM-3A terminal control codes for CLS, COLOR, and LOCATE.", /* Description */ + "OPTION TERMINAL ADM", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_TERMINAL_ANSI, /* UniqueID */ + "OPTION TERMINAL ANSI", /* Syntax */ + "Enables ANSI terminal control codes for CLS, COLOR, and LOCATE.", /* Description */ + "OPTION TERMINAL ANSI", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_TERMINAL_NONE, /* UniqueID */ + "OPTION TERMINAL NONE", /* Syntax */ + "Disables terminal control codes for CLS, COLOR, and LOCATE.", /* Description */ + "OPTION TERMINAL NONE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_TIME, /* UniqueID */ + "OPTION TIME format$", /* Syntax */ + "Sets the time format string used by C strftime() for TIME$.", /* Description */ + "OPTION TIME", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_TRACE, /* UniqueID */ + "OPTION TRACE", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION TRACE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_TRACE_OFF, /* UniqueID */ + "OPTION TRACE OFF", /* Syntax */ + "Disables displaying a stack trace when an ERROR occurs.", /* Description */ + "OPTION TRACE OFF", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_TRACE_ON, /* UniqueID */ + "OPTION TRACE ON", /* Syntax */ + "Enables displaying a stack trace when an ERROR occurs.", /* Description */ + "OPTION TRACE ON", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING, /* UniqueID */ + "OPTION USING", /* Syntax */ + "Syntax Error.", /* Description */ + "OPTION USING", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_ALL, /* UniqueID */ + "OPTION USING ALL char$", /* Syntax */ + "Specifies the magic ALL character for the PRINT USING command. " + " A common value is \"&\".", /* Description */ + "OPTION USING ALL", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_COMMA, /* UniqueID */ + "OPTION USING COMMA char$", /* Syntax */ + "Specifies the magic COMMA character for the PRINT USING command. " + " A common value is \",\".", /* Description */ + "OPTION USING COMMA", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_DIGIT, /* UniqueID */ + "OPTION USING DIGIT char$", /* Syntax */ + "Specifies the magic DIGIT character for the PRINT USING command. " + " A common value is \"#\".", /* Description */ + "OPTION USING DIGIT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_DOLLAR, /* UniqueID */ + "OPTION USING DOLLAR char$", /* Syntax */ + "Specifies the magic DOLLAR character for the PRINT USING command. " + " A common value is \"$\".", /* Description */ + "OPTION USING DOLLAR", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_EXRAD, /* UniqueID */ + "OPTION USING EXRAD char$", /* Syntax */ + "Specifies the magic EXRAD character for the PRINT USING command. " + " A common value is \"^\".", /* Description */ + "OPTION USING EXRAD", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_FILLER, /* UniqueID */ + "OPTION USING FILLER char$", /* Syntax */ + "Specifies the magic FILLER character for the PRINT USING command. " + " A common value is \"*\".", /* Description */ + "OPTION USING FILLER", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_FIRST, /* UniqueID */ + "OPTION USING FIRST char$", /* Syntax */ + "Specifies the magic FIRST character for the PRINT USING command. " + " A common value is \"!\".", /* Description */ + "OPTION USING FIRST", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_LENGTH, /* UniqueID */ + "OPTION USING LENGTH char$", /* Syntax */ + "Specifies the magic LENGTH character for the PRINT USING command. " + " A common value is \"\\\".", /* Description */ + "OPTION USING LENGTH", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_LITERAL, /* UniqueID */ + "OPTION USING LITERAL char$", /* Syntax */ + "Specifies the magic LITERAL character for the PRINT USING command. " + " A common value is \"_\".", /* Description */ + "OPTION USING LITERAL", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_MINUS, /* UniqueID */ + "OPTION USING MINUS char$", /* Syntax */ + "Specifies the magic MINUS character for the PRINT USING command. " + " A common value is \"-\".", /* Description */ + "OPTION USING MINUS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_PERIOD, /* UniqueID */ + "OPTION USING PERIOD char$", /* Syntax */ + "Specifies the magic PERIOD character for the PRINT USING command. " + " A common value is \".\".", /* Description */ + "OPTION USING PERIOD", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_USING_PLUS, /* UniqueID */ + "OPTION USING PLUS char$", /* Syntax */ + "Specifies the magic PLUS character for the PRINT USING command. " + " A common value is \"+\".", /* Description */ + "OPTION USING PLUS", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_VERSION, /* UniqueID */ + "OPTION VERSION version$", /* Syntax */ + "Selects a specific BASIC version, which is a " + "combination of OPTION settings, commands, " + "functions and operators. If no version is specified, displays " + "a list of the available versions.", /* Description */ + "OPTION VERSION", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_OPTION_ZONE, /* UniqueID */ + "OPTION ZONE integer", /* Syntax */ + "Sets the PRINT zone width. Setting the value to zero restores " + "the default.", /* Description */ + "OPTION ZONE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_PAUSE, /* UniqueID */ + "PAUSE [comment]", /* Syntax */ + "Pauses processing until the ENTER key is presseed.", /* Description */ + "PAUSE", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_PDEL, /* UniqueID */ + "PDEL line [- line]", /* Syntax */ + "Deletes program lines indicated by the argument(s). All program " + "lines have a number, which is visible with the LIST command. " + " If line numbers are not provided, they are assigned beginning " + "with 1. Deleting a non-existing line does not cause an error. " + "", /* Description */ + "PDEL", /* Name */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + C_POP, /* UniqueID */ + "POP", /* Syntax */ + "Pops one GOSUB from the return stack.", /* Description */ + "POP", /* Name */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + C_PRINT, /* UniqueID */ + "PRINT # filenum , [USING format$;] value ...", /* Syntax */ + "Sends output to a file.", /* Description */ + "PRINT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_PRINT, /* UniqueID */ + "PRINT [USING format$;] value ...", /* Syntax */ + "Sends output to the screen.", /* Description */ + "PRINT", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_PTP, /* UniqueID */ + "PTP [filename$]", /* Syntax */ + "Directs the PRINT commands to write to the paper tape punch file " + "(\"PTP\"), or optionally to the specified file.", /* Description */ + "PTP", /* Name */ + D73 /* OptionVersionBitmask */ +}, +{ + C_PTR, /* UniqueID */ + "PTR [filename$]", /* Syntax */ + "Directs the INPUT commands to read from the paper tape reader " + "file (\"PTR\"), or optionally from the specified file.", /* Description */ + "PTR", /* Name */ + D73 /* OptionVersionBitmask */ +}, +{ + C_PUT, /* UniqueID */ + "PUT # file_number , [ byte_number ] , scalar [,...]", /* Syntax */ + "Puts one (or more) values into a BINARY file.", /* Description */ + "PUT", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_PUT, /* UniqueID */ + "PUT filename$ , value [, ...]", /* Syntax */ + "Puts one (or more) values into a file.", /* Description */ + "PUT", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_PUT, /* UniqueID */ + "PUT # file_number [ , RECORD record_number ]", /* Syntax */ + "Puts one (or more) values into a file.", /* Description */ + "PUT", /* Name */ + R86 | D71 | T79 /* OptionVersionBitmask */ +}, +{ + C_PUT, /* UniqueID */ + "PUT # file_number [ , record_number ]", /* Syntax */ + "Puts one (or more) values into a RANDOM file.", /* Description */ + "PUT", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_QUIT, /* UniqueID */ + "QUIT", /* Syntax */ + "Exits to the operating system.", /* Description */ + "QUIT", /* Name */ + B15 | S70 | C77 | D64 | E78 | E86 | G74 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_READ, /* UniqueID */ + "READ variable [, ...]", /* Syntax */ + "Reads values from DATA statements.", /* Description */ + "READ", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_RECALL, /* UniqueID */ + "RECALL ArrayName", /* Syntax */ + "Loads a numeric array from a file saved using STORE.", /* Description */ + "RECALL", /* Name */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + C_REM, /* UniqueID */ + "REM ...", /* Syntax */ + "Remark.", /* Description */ + "REM", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_RENAME, /* UniqueID */ + "RENAME from$ TO to$", /* Syntax */ + "Rename a file.", /* Description */ + "RENAME", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_RENAME, /* UniqueID */ + "RENAME [filename$]", /* Syntax */ + "Changes the file name which will be used by SAVE. Does not save " + "the file.", /* Description */ + "RENAME", /* Name */ + D64 | G74 | G65 | G67 | D71 /* OptionVersionBitmask */ +}, +{ + C_RENUM, /* UniqueID */ + "RENUM", /* Syntax */ + "Implementation defined.", /* Description */ + "RENUM", /* Name */ + B15 | B93 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RENUMBER, /* UniqueID */ + "RENUMBER", /* Syntax */ + "Implementation defined.", /* Description */ + "RENUMBER", /* Name */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + C_REPEAT, /* UniqueID */ + "REPEAT", /* Syntax */ + "Top of a REPEAT - UNTIL structure.", /* Description */ + "REPEAT", /* Name */ + B15 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + C_REPLACE, /* UniqueID */ + "REPLACE [filename$]", /* Syntax */ + "Saves the current program into the file filename$ in ASCII format.", /* Description */ + "REPLACE", /* Name */ + H80 /* OptionVersionBitmask */ +}, +{ + C_RESET, /* UniqueID */ + "RESET filename$ [, ...]", /* Syntax */ + "Positions an input or output file to the bcginning.", /* Description */ + "RESET", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_RESTORE, /* UniqueID */ + "RESTORE [line]", /* Syntax */ + "Resets the line used for the next READ statement. line may be " + "either a number or a label.", /* Description */ + "RESTORE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_RESUME, /* UniqueID */ + "RESUME", /* Syntax */ + "Used in an error handler to specify the next line to execute. " + " Branch to ERL.", /* Description */ + "RESUME", /* Name */ + B15 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RESUME, /* UniqueID */ + "RESUME line", /* Syntax */ + "Used in an error handler to specify the next line to execute. " + " Branch to the specified line.", /* Description */ + "RESUME", /* Name */ + B15 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RESUME, /* UniqueID */ + "RESUME NEXT", /* Syntax */ + "Used in an error handler to specify the next line to execute. " + " Branch to the line after ERL.", /* Description */ + "RESUME", /* Name */ + B15 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RESUME, /* UniqueID */ + "RESUME 0", /* Syntax */ + "Used in an error handler to specify the next line to execute. " + " Branch to ERL.", /* Description */ + "RESUME", /* Name */ + B15 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RETURN, /* UniqueID */ + "RETURN", /* Syntax */ + "Concludes a subroutine called by GOSUB.", /* Description */ + "RETURN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_RSET, /* UniqueID */ + "RSET variable$ = value", /* Syntax */ + "Right-aligns the value into variable$. If the length of the " + "value is too short, then it is padded on the left with spaces. " + " If the length of the value is too long, then it is truncated " + "on the right. This is only for use with variables assigned to " + "a random access buffer with FIELD command.", /* Description */ + "RSET", /* Name */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RUN, /* UniqueID */ + "RUN filename$", /* Syntax */ + "Loads a new BAASIC program and executes the program from the " + "start.", /* Description */ + "RUN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RUN, /* UniqueID */ + "RUN line", /* Syntax */ + "Executes the program in memory beginning at line.", /* Description */ + "RUN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RUN, /* UniqueID */ + "RUN", /* Syntax */ + "Executes the program in memory from the start.", /* Description */ + "RUN", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_RUNNH, /* UniqueID */ + "RUNNH line", /* Syntax */ + "Executes the program in memory beginning at line.", /* Description */ + "RUNNH", /* Name */ + B15 | S70 | C77 | D64 | G74 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_RUNNH, /* UniqueID */ + "RUNNH filename$", /* Syntax */ + "Loads a new BAASIC program and executes the program from the " + "start.", /* Description */ + "RUNNH", /* Name */ + B15 | S70 | C77 | D64 | G74 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_RUNNH, /* UniqueID */ + "RUNNH", /* Syntax */ + "Executes the program in memory from the start.", /* Description */ + "RUNNH", /* Name */ + B15 | S70 | C77 | D64 | G74 | G65 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_SAVE, /* UniqueID */ + "SAVE [filename$]", /* Syntax */ + "Saves the current program into the file filename$ in ASCII format.", /* Description */ + "SAVE", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_SCRATCH, /* UniqueID */ + "SCRATCH [# X]", /* Syntax */ + "SCRATCH Deletes the program in memory and clears all variables. " + " SCRATCH # X Sets the file mode to writing.", /* Description */ + "SCRATCH", /* Name */ + G74 | HB2 | H80 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + C_SELECT, /* UniqueID */ + "SELECT", /* Syntax */ + "Syntax Error.", /* Description */ + "SELECT", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_SELECT_CASE, /* UniqueID */ + "SELECT CASE value", /* Syntax */ + "Introduces a multi-line conditional selection statement.", /* Description */ + "SELECT CASE", /* Name */ + B15 | B93 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + C_STEP, /* UniqueID */ + "STEP", /* Syntax */ + "Syntax Error.", /* Description */ + "STEP", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_STOP, /* UniqueID */ + "STOP", /* Syntax */ + "Interrupts program execution and displays the line number of " + "the STOP command. For use when debugging BASIC programs. Whether " + "STOP issues a SIGINT signal is implementation defined.", /* Description */ + "STOP", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_STORE, /* UniqueID */ + "STORE ArrayName", /* Syntax */ + "Saves a numeric array into a file for later loading by RECALL.", /* Description */ + "STORE", /* Name */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + C_SUB, /* UniqueID */ + "SUB name [ ( parameter [,...] ) ]", /* Syntax */ + "Top line of a multi-line SUB definition. The variable names " + "specified are local to the SUB definition, and are initialized " + "BYVAL when the subroutine is invoked by another routine.", /* Description */ + "SUB", /* Name */ + B15 | B93 | E86 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + C_SUB_END, /* UniqueID */ + "SUB END", /* Syntax */ + "Specifies the last line of a multi-line SUB definition. Same " + "as END SUB.", /* Description */ + "SUB END", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_SUB_EXIT, /* UniqueID */ + "SUB EXIT", /* Syntax */ + "Immediately exits the inner-most multi-line SUB strucure. Same " + "as EXIT SUB.", /* Description */ + "SUB EXIT", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_SUBEND, /* UniqueID */ + "SUBEND", /* Syntax */ + "Specifies the last line of a multi-line SUB definition. Same " + "as END SUB.", /* Description */ + "SUBEND", /* Name */ + B15 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + C_SUBEXIT, /* UniqueID */ + "SUBEXIT", /* Syntax */ + "Immediately exits the inner-most multi-line SUB strucure. Same " + "as EXIT SUB.", /* Description */ + "SUBEXIT", /* Name */ + H14 /* OptionVersionBitmask */ +}, +{ + C_SWAP, /* UniqueID */ + "SWAP variable, variable", /* Syntax */ + "Swaps the values of two variables. Both variables must be of " + "the same type.", /* Description */ + "SWAP", /* Name */ + B15 | B93 | H14 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + C_SYSTEM, /* UniqueID */ + "SYSTEM", /* Syntax */ + "Exits to the operating system.", /* Description */ + "SYSTEM", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | G65 | G67 | M80 | D71 | I70 | I73 | T80 | V09 /* OptionVersionBitmask */ +}, +{ + C_TEXT, /* UniqueID */ + "TEXT letter[-letter] [, ...]", /* Syntax */ + "Declares variables with single-letter names as string variables.", /* Description */ + "TEXT", /* Name */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + C_THEN, /* UniqueID */ + "THEN", /* Syntax */ + "Syntax Error.", /* Description */ + "THEN", /* Name */ + B15 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_TIMER, /* UniqueID */ + "TIMER", /* Syntax */ + "Syntax Error.", /* Description */ + "TIMER", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_TIMER_OFF, /* UniqueID */ + "TIMER OFF", /* Syntax */ + "TIMER OFF terminates the timer interrupt.", /* Description */ + "TIMER OFF", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_TIMER_ON, /* UniqueID */ + "TIMER ON", /* Syntax */ + "TIMER ON enables the timer interrupt. When the specified seconds " + "have elapsed, TIMER STOP is internaly executed before the interrupt " + "is taken. TIMER ON should be executed just before the RETURN " + "command if you want the interrupt to occur again.", /* Description */ + "TIMER ON", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_TIMER_STOP, /* UniqueID */ + "TIMER STOP", /* Syntax */ + "TIMER STOP disables the interrupt, but the count continues.", /* Description */ + "TIMER STOP", /* Name */ + B15 /* OptionVersionBitmask */ +}, +{ + C_TLOAD, /* UniqueID */ + "TLOAD [filename$]", /* Syntax */ + "Loads an ASCII BASIC program into memory.", /* Description */ + "TLOAD", /* Name */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + C_TO, /* UniqueID */ + "TO", /* Syntax */ + "Syntax Error.", /* Description */ + "TO", /* Name */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + C_TRACE, /* UniqueID */ + "TRACE", /* Syntax */ + "Enables tracing.", /* Description */ + "TRACE", /* Name */ + G74 | HB1 | HB2 | G67 /* OptionVersionBitmask */ +}, +{ + C_TRACE_OFF, /* UniqueID */ + "TRACE OFF", /* Syntax */ + "Disables tracing.", /* Description */ + "TRACE OFF", /* Name */ + G74 | HB1 | HB2 | G67 /* OptionVersionBitmask */ +}, +{ + C_TRACE_ON, /* UniqueID */ + "TRACE ON", /* Syntax */ + "Enables tracing.", /* Description */ + "TRACE ON", /* Name */ + G74 | HB1 | HB2 | G67 /* OptionVersionBitmask */ +}, +{ + C_TSAVE, /* UniqueID */ + "TSAVE [filename$]", /* Syntax */ + "Saves the current program into the file filename$ in ASCII format.", /* Description */ + "TSAVE", /* Name */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + C_TTY, /* UniqueID */ + "TTY", /* Syntax */ + "Directs the PRINT commands to write to the console (stdout), " + "and the INPUT commands to read from.the console (stdin). This " + "cancels LPT, PTP and PTR.", /* Description */ + "TTY", /* Name */ + D73 /* OptionVersionBitmask */ +}, +{ + C_TTY_IN, /* UniqueID */ + "TTY IN", /* Syntax */ + "Directs the INPUT commands to read from.the console (stdin). " + " This cancels PTR. It does not cancel LPT or PTP.", /* Description */ + "TTY IN", /* Name */ + D73 /* OptionVersionBitmask */ +}, +{ + C_TTY_OUT, /* UniqueID */ + "TTY OUT", /* Syntax */ + "Directs the PRINT commands to write to the console (stdout). " + " This cancels LPT or PTP. It does not cancel PTR.", /* Description */ + "TTY OUT", /* Name */ + D73 /* OptionVersionBitmask */ +}, +{ + C_UNTIL, /* UniqueID */ + "UNTIL value", /* Syntax */ + "Bottom of a REPEAT - UNTIL. If the value is non-zero, then the " + "loop is terminated.", /* Description */ + "UNTIL", /* Name */ + B15 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + C_USE, /* UniqueID */ + "USE parameter$", /* Syntax */ + "Receives the value from the calling CHAINing program.", /* Description */ + "USE", /* Name */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + C_VARS, /* UniqueID */ + "VARS", /* Syntax */ + "Prints a list of all global variables.", /* Description */ + "VARS", /* Name */ + B15 | B93 /* OptionVersionBitmask */ +}, +{ + C_WEND, /* UniqueID */ + "WEND", /* Syntax */ + "Bottom of a WHILE - WEND structure.", /* Description */ + "WEND", /* Name */ + B15 | B93 | C77 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_WHILE, /* UniqueID */ + "WHILE value", /* Syntax */ + "Top of a WHILE - WEND structure. If the value is non-zero, then " + "the loop is terminated.", /* Description */ + "WHILE", /* Name */ + B15 | B93 | C77 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_WRITE, /* UniqueID */ + "WRITE # filenum, value [, .... ]", /* Syntax */ + "Outputs value to a file. Strings are quoted and each value " + "is seperated by a omma.", /* Description */ + "WRITE", /* Name */ + B15 | B93 | G74 | H14 | G65 | G67 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + C_WRITE, /* UniqueID */ + "WRITE value [, .... ]", /* Syntax */ + "Outputs value to the screen. Strings are quoted and each value " + "is seperated by a comma.", /* Description */ + "WRITE", /* Name */ + B15 | B93 | G74 | H14 | G65 | G67 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +}; + +const size_t NUM_COMMANDS = + sizeof (IntrinsicCommandTable) / sizeof (CommandType); + + +/* EOF */ diff --git a/bwd_fun.c b/bwd_fun.c new file mode 100644 index 0000000..ccc91f5 --- /dev/null +++ b/bwd_fun.c @@ -0,0 +1,4014 @@ +/*************************************************************** + + bwd_fun.c Function Table + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + +/* FUNCTION TABLE */ + +#include "bwbasic.h" + +IntrinsicFunctionType IntrinsicFunctionTable[ /* NUM_FUNCTIONS */ ] = +{ +{ + F_ABS_X_N, /* UniqueID */ + "N = ABS( X )", /* Syntax */ + "The absolute value of X.", /* Description */ + "ABS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_ACOS_X_N, /* UniqueID */ + "N = ACOS( X )", /* Syntax */ + "The arccosine of X in radians, where 0 <= ACOS(X) <= PI. X shall " + "be in the range -1 <= X <= 1.", /* Description */ + "ACOS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_ACS_X_N, /* UniqueID */ + "N = ACS( X )", /* Syntax */ + "The arccosine of X in radians, where 0 <= ACS(X) <= PI. X shall " + "be in the range -1 <= X <= 1.", /* Description */ + "ACS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | HB2 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_ACSD_X_N, /* UniqueID */ + "N = ACSD( X )", /* Syntax */ + "The arccosine of X in degrees, where 0 <= ACSD(X) <= 180. X " + "shall be in the range -1 <= X <= 1.", /* Description */ + "ACSD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ACSG_X_N, /* UniqueID */ + "N = ACSG( X )", /* Syntax */ + "The arccosine of X in gradians, where 0 <= ACS(X) <= 200. X " + "shall be in the range -1 <= X <= 1.", /* Description */ + "ACSG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ANGLE_X_Y_N, /* UniqueID */ + "N = ANGLE( X, Y )", /* Syntax */ + "The angle in radians between the positive x-axis and the vector " + "joining the origin to the point with coordinates (X, Y), where " + "-PI < ANGLE(X,Y) <= PI. X and Y must not both be 0. Note that " + "the counterclockwise is positive, e.g., ANGLE(1,1) = 45 degrees.", /* Description */ + "ANGLE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1ANY | P2ANY, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_ARCCOS_X_N, /* UniqueID */ + "N = ARCCOS( X )", /* Syntax */ + "The arccosine of X in radians, where 0 <= ARCCOS(X) <= PI. X " + "shall be in the range -1 <= X <= 1.", /* Description */ + "ARCCOS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_ARCSIN_X_N, /* UniqueID */ + "N = ARCSIN( X )", /* Syntax */ + "The arcsine of X in radians, where -PI/2 <= ARCSIN(X) <= PI/2; " + "X shall be in the range -1 <= X <= 1.", /* Description */ + "ARCSIN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 | R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_ARCTAN_X_N, /* UniqueID */ + "N = ARCTAN( X )", /* Syntax */ + "The arctangent of X in radians, i.e. the angle whose tangent " + "is X, where -PI/2 < ARCTAN(X) < PI/2.", /* Description */ + "ARCTAN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB1 | HB2 | R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_ARGC_N, /* UniqueID */ + "N = ARGC", /* Syntax */ + "The number of parameters passed to a FUNCTION or SUB. If not " + "in a FUNCTION or SUB, returns -1.", /* Description */ + "ARGC", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_ARGT4_X_S, /* UniqueID */ + "S$ = ARGT$( X )", /* Syntax */ + "The type of the Xth parameter to a FUNCTION or SUB. If the Xth " + "parameter is a string, then return value is \"$\". If the Xth " + "parameter is a number, then return value is not \"$\". X in [1,ARGC].", /* Description */ + "ARGT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_ARGV_X_N, /* UniqueID */ + "N = ARGV( X )", /* Syntax */ + "The numeric value of the Xth parameter to a FUNCTION or SUB. " + " X in [1,ARGC] and ARGT$( X ) <> \"$\".", /* Description */ + "ARGV", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_ARGV4_X_S, /* UniqueID */ + "S$ = ARGV$( X )", /* Syntax */ + "The string value of the Xth parameter to a FUNCTION or SUB. " + "X in [1,ARGC] and ARGT$( X ) = \"$\".", /* Description */ + "ARGV$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_ASC_A_N, /* UniqueID */ + "N = ASC( A$ )", /* Syntax */ + "The numeric code for the first letter in A$. For example, ASC(\"ABC\") " + "returns 65 on ASCII systems.", /* Description */ + "ASC", /* Name */ + ByteTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_ASC_A_X_N, /* UniqueID */ + "N = ASC( A$, X )", /* Syntax */ + "The numeric code of the Xth character in A$. Same as ASC(MID$(A$,X)).", /* Description */ + "ASC", /* Name */ + ByteTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2NUM, /* ParameterTypes */ + P1BYT | P2POS, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ASCII_A_N, /* UniqueID */ + "N = ASCII( A$ )", /* Syntax */ + "The numeric code for the first letter in A$. For example, ASCII(\"ABC\") " + "returns 65 on ASCII systems.", /* Description */ + "ASCII", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_ASIN_X_N, /* UniqueID */ + "N = ASIN( X )", /* Syntax */ + "The arcsine of X in radians, where -PI/2 <= ASIN(X) <= PI/2; " + "X shall be in the range -1 <= X <= 1.", /* Description */ + "ASIN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_ASN_X_N, /* UniqueID */ + "N = ASN( X )", /* Syntax */ + "The arcsine of X in radians, where -PI/2 <= ASN(X) <= PI/2; X " + "shall be in the range -1 <= X <= 1.", /* Description */ + "ASN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | HB1 | HB2 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_ASND_X_N, /* UniqueID */ + "N = ASND( X )", /* Syntax */ + "The arcsine of X in degrees, where -90 <= ASN(X) <= 90; X shall " + "be in the range -1 <= X <= 1.", /* Description */ + "ASND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ASNG_X_N, /* UniqueID */ + "N = ASNG( X )", /* Syntax */ + "The arcsine of X in gradians, where -100 <= ASNG(X) <= 100; X " + "shall be in the range -1 <= X <= 1.", /* Description */ + "ASNG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ATAN_X_N, /* UniqueID */ + "N = ATAN( X )", /* Syntax */ + "The arctangent of X in radians, i.e. the angle whose tangent " + "is X, where -PI/2 < ATAN(X) < PI/2.", /* Description */ + "ATAN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ATN_X_N, /* UniqueID */ + "N = ATN( X )", /* Syntax */ + "The arctangent of X in radians, i.e. the angle whose tangent " + "is X, where -PI/2 < ATN(X) < PI/2.", /* Description */ + "ATN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_ATND_X_N, /* UniqueID */ + "N = ATND( X )", /* Syntax */ + "The arctangent of X in degrees, i.e. the angle whose tangent " + "is X, where -90 < ATND(X) < 90.", /* Description */ + "ATND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ATNG_X_N, /* UniqueID */ + "N = ATNG( X )", /* Syntax */ + "The arctangent of X in gradians, i.e. the angle whose tangent " + "is X, where -100 < ATND(X) < 100.", /* Description */ + "ATNG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_BASE_N, /* UniqueID */ + "N = BASE", /* Syntax */ + "The current OPTION BASE setting.", /* Description */ + "BASE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_BIN4_X_S, /* UniqueID */ + "S$ = BIN$( X )", /* Syntax */ + "The the binary (base 2) representation of X.", /* Description */ + "BIN$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_BIN4_X_Y_S, /* UniqueID */ + "S$ = BIN$( X, Y )", /* Syntax */ + "The the binary (base 2) representation of X. The result will " + "be at least Y digits long. ", /* Description */ + "BIN$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2BYT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_CATALOG_N, /* UniqueID */ + "N = CATALOG", /* Syntax */ + "Displays all the file names.", /* Description */ + "CATALOG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + D64 | G74 | G65 | G67 | D71 /* OptionVersionBitmask */ +}, +{ + F_CATALOG_A_N, /* UniqueID */ + "N = CATALOG( A$ )", /* Syntax */ + "Displays all the file names matching A$.", /* Description */ + "CATALOG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + D64 | G74 | G65 | G67 | D71 /* OptionVersionBitmask */ +}, +{ + F_CCUR_X_N, /* UniqueID */ + "N = CCUR( X )", /* Syntax */ + "The currency (64-bit) integer value of X.", /* Description */ + "CCUR", /* Name */ + CurrencyTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1CUR, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_CDBL_X_N, /* UniqueID */ + "N = CDBL( X )", /* Syntax */ + "The double-precision value of X.", /* Description */ + "CDBL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1DBL, /* ParameterTests */ + B15 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_CEIL_X_N, /* UniqueID */ + "N = CEIL( X )", /* Syntax */ + "The smallest integer not less than X.", /* Description */ + "CEIL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_CHAR_X_Y_S, /* UniqueID */ + "S$ = CHAR( X, Y )", /* Syntax */ + "The string Y bytes long consisting of CHR$(X). Same as STRING$(Y,X).", /* Description */ + "CHAR", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1BYT | P2LEN, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CHAR4_X_S, /* UniqueID */ + "S$ = CHAR$( X )", /* Syntax */ + "The one-character string with the character corresponding to " + "the numeric code X. On ASCII systems, CHAR$(65) returns \"A\".", /* Description */ + "CHAR$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CHDIR_A_N, /* UniqueID */ + "N = CHDIR( A$ )", /* Syntax */ + "Changes to the directory named to A$.", /* Description */ + "CHDIR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_CHR_X_S, /* UniqueID */ + "S$ = CHR( X )", /* Syntax */ + "The one-character string with the character corresponding to " + "the numeric code X. On ASCII systems, CHR(65) returns \"A\".", /* Description */ + "CHR", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CHR_X_S, /* UniqueID */ + "S$ = CHR( X )", /* Syntax */ + "The output of PRINT X. A$ = CHR(X) is the opposite of X = NUM(A$).", /* Description */ + "CHR", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_CHR4_X_S, /* UniqueID */ + "S$ = CHR$( X )", /* Syntax */ + "The one-character string with the character corresponding to " + "the numeric code X. On ASCII systems, CHR$(65) returns \"A\".", /* Description */ + "CHR$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | D71 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_CIN_X_N, /* UniqueID */ + "N = CIN( X )", /* Syntax */ + "If file # X is <= 0 then returns -1. If file # X is not opened " + "for reading then returns -1. If file # X is at EOF then returns " + "-1, Otherwise returns the next byte value read from file X.", /* Description */ + "CIN", /* Name */ + IntegerTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + H80 /* OptionVersionBitmask */ +}, +{ + F_CINT_X_N, /* UniqueID */ + "N = CINT( X )", /* Syntax */ + "The short (16-bit) integer value of X.", /* Description */ + "CINT", /* Name */ + IntegerTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_CLG_X_N, /* UniqueID */ + "N = CLG( X )", /* Syntax */ + "The common logarithm of X; X shall be greater than zero.", /* Description */ + "CLG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CLK_X_N, /* UniqueID */ + "N = CLK( X )", /* Syntax */ + "The time elapsed since the previous midnight, expressed in hours; " + "e.g., the value of CLK at 3:15 PM is 15.25. If there is no clock " + "available, then the value of CLK shall be -1. The value of CLK " + "at midnight shall be zero (not 24). The value of X is ignored.", /* Description */ + "CLK", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + G74 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + F_CLK_X_S, /* UniqueID */ + "S$ = CLK( X )", /* Syntax */ + "The time of day in 24-hour notation according to ISO 3307. For " + "example, the value of CLK at 11:15 AM is \"11:15:00\". If there " + "is no clock available, then the value of CLK shall be \"99:99:99\". " + " The value of TIME$ at midnight is \"00:00:00\". The value of " + "parameter X is ignored.", /* Description */ + "CLK", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CLK4_S, /* UniqueID */ + "S$ = CLK$", /* Syntax */ + "The time of day in 24-hour notation according to ISO 3307. For " + "example, the value of TIME$ at 11:15 AM is \"11:15:00\". If there " + "is no clock available, then the value of TIME$ shall be \"99:99:99\". " + " The value of TIME$ at midnight is \"00:00:00\".", /* Description */ + "CLK$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | G74 | HB1 | HB2 | G67 /* OptionVersionBitmask */ +}, +{ + F_CLNG_X_N, /* UniqueID */ + "N = CLNG( X )", /* Syntax */ + "The long (32-bit) integer value of X.", /* Description */ + "CLNG", /* Name */ + LongTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LNG, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_CLOG_X_N, /* UniqueID */ + "N = CLOG( X )", /* Syntax */ + "The common logarithm of X; X shall be greater than zero.", /* Description */ + "CLOG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CLOSE_N, /* UniqueID */ + "N = CLOSE", /* Syntax */ + "Close all open files.", /* Description */ + "CLOSE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | H14 | H80 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_CLOSE_X_N, /* UniqueID */ + "N = CLOSE( X )", /* Syntax */ + "Close file number X.", /* Description */ + "CLOSE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | C77 | H14 | HB2 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_CLS_N, /* UniqueID */ + "N = CLS", /* Syntax */ + "Clears the screen. Cursor is positioned at row 1, column 1.", /* Description */ + "CLS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | H14 | HB1 | HB2 | M80 | T80 /* OptionVersionBitmask */ +}, +{ + F_CNTRL_X_Y_N, /* UniqueID */ + "N = CNTRL( X, Y )", /* Syntax */ + "CNTRL 1,Y sets the number of significant digits to print. CNTRL " + "3,Y sets the width of the print zones.", /* Description */ + "CNTRL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2INT, /* ParameterTests */ + H80 /* OptionVersionBitmask */ +}, +{ + F_CODE_A_N, /* UniqueID */ + "N = CODE( A$ )", /* Syntax */ + "The numeric code for the first letter in A$. For example, CODE(\"ABC\") " + "returns 65 on ASCII systems.", /* Description */ + "CODE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + F_COLOR_X_Y_N, /* UniqueID */ + "N = COLOR( X, Y )", /* Syntax */ + "Sets the foreground text color to X, and the background text " + "color to Y.", /* Description */ + "COLOR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1BYT | P2BYT, /* ParameterTests */ + B15 | H14 | M80 | T80 /* OptionVersionBitmask */ +}, +{ + F_COMMAND4_S, /* UniqueID */ + "S$ = COMMAND$", /* Syntax */ + "All command line parameters, concatenated with one space between " + "each. Support for parameters varies by operating system, compiler, " + "and so on.", /* Description */ + "COMMAND$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_COMMAND4_X_S, /* UniqueID */ + "S$ = COMMAND$( X )", /* Syntax */ + "The command line parameters. COMMAND$(0) is the BASIC program " + "name. COMMAND$(1) is the first parameter after the BASIC program " + "name, and so on. Support for parameters varies by operating " + "system, compiler, and so on. X in [0..9] ", /* Description */ + "COMMAND$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | C77 | H14 /* OptionVersionBitmask */ +}, +{ + F_COS_X_N, /* UniqueID */ + "N = COS( X )", /* Syntax */ + "The cosine of X, where X is in radians.", /* Description */ + "COS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_COSD_X_N, /* UniqueID */ + "N = COSD( X )", /* Syntax */ + "The cosine of X, where X is in degrees.", /* Description */ + "COSD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_COSG_X_N, /* UniqueID */ + "N = COSG( X )", /* Syntax */ + "The cosine of X, where X is in gradians.", /* Description */ + "COSG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_COSH_X_N, /* UniqueID */ + "N = COSH( X )", /* Syntax */ + "The hyperbolic cosine of X.", /* Description */ + "COSH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_COT_X_N, /* UniqueID */ + "N = COT( X )", /* Syntax */ + "The cotangent of X, where X is in radians.", /* Description */ + "COT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | E86 | G74 | G67 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_COUNT_N, /* UniqueID */ + "N = COUNT", /* Syntax */ + "The current cursor position in the line.", /* Description */ + "COUNT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CSC_X_N, /* UniqueID */ + "N = CSC( X )", /* Syntax */ + "The cosecant of X, where X is in radians.", /* Description */ + "CSC", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | E86 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_CSH_X_N, /* UniqueID */ + "N = CSH( X )", /* Syntax */ + "The hyperbolic cosine of X.", /* Description */ + "CSH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CSNG_X_N, /* UniqueID */ + "N = CSNG( X )", /* Syntax */ + "The single-precision value of X.", /* Description */ + "CSNG", /* Name */ + SingleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1FLT, /* ParameterTests */ + B15 | B93 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_CUR_X_Y_S, /* UniqueID */ + "S$ = CUR( X, Y )", /* Syntax */ + "Locates the cursor to row X, column Y.", /* Description */ + "CUR", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1BYT | P2BYT, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_CVC_A_N, /* UniqueID */ + "N = CVC( A$ )", /* Syntax */ + "The currency (64-bit) integer value in A$, which was created " + "by MKC$.", /* Description */ + "CVC", /* Name */ + CurrencyTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1CUR, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_CVD_A_N, /* UniqueID */ + "N = CVD( A$ )", /* Syntax */ + "The double-precision value in A$, which was created by MKD$.", /* Description */ + "CVD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1DBL, /* ParameterTests */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_CVI_A_N, /* UniqueID */ + "N = CVI( A$ )", /* Syntax */ + "The short (16-bit) integer value in A$, which was created by " + "MKI$.", /* Description */ + "CVI", /* Name */ + IntegerTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_CVL_A_N, /* UniqueID */ + "N = CVL( A$ )", /* Syntax */ + "The long (32-bit) integer value in A$, which was created by MKL$.", /* Description */ + "CVL", /* Name */ + LongTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1LNG, /* ParameterTests */ + B15 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_CVS_A_N, /* UniqueID */ + "N = CVS( A$ )", /* Syntax */ + "The single-precision value in A$, which was created by MKS$.", /* Description */ + "CVS", /* Name */ + SingleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1FLT, /* ParameterTests */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_DAT4_S, /* UniqueID */ + "S$ = DAT$", /* Syntax */ + "The current date based on the internal clock as a string in the " + "format set by OPTION DATE.", /* Description */ + "DAT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + G74 | G67 /* OptionVersionBitmask */ +}, +{ + F_DATE_N, /* UniqueID */ + "N = DATE", /* Syntax */ + "The current date in decimal form YYYDDD, where YYY are the number " + "of years since 1900 and DDD is the ordinal number of the current " + "day of the year; e.g., the value of DATE on May 9, 1977 was 77129. " + " If there is no calendar available, then the value of DATE shall " + "be -1.", /* Description */ + "DATE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_DATE4_S, /* UniqueID */ + "S$ = DATE$", /* Syntax */ + "The current date based on the internal clock as a string in the " + "format set by OPTION DATE.", /* Description */ + "DATE$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | E86 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_DATE4_X_S, /* UniqueID */ + "S$ = DATE$( X )", /* Syntax */ + "The current date based on the internal clock as a string in the " + "format set by OPTION DATE. The value of parameter X is ignored.", /* Description */ + "DATE$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + D71 /* OptionVersionBitmask */ +}, +{ + F_DEG_N, /* UniqueID */ + "N = DEG", /* Syntax */ + "Configures the math functions to accept and return angles in " + "degrees.", /* Description */ + "DEG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_DEG_X_N, /* UniqueID */ + "N = DEG( X )", /* Syntax */ + "When X is zero sets RADIANS. When X is non-zero sets DEGREES.", /* Description */ + "DEG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + R86 /* OptionVersionBitmask */ +}, +{ + F_DEG_X_N, /* UniqueID */ + "N = DEG( X )", /* Syntax */ + "The number of degrees in X radians.", /* Description */ + "DEG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | E86 | H14 | HB1 | HB2 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_DEGREE_N, /* UniqueID */ + "N = DEGREE", /* Syntax */ + "Configures the math functions to accept and return angles in " + "degrees.", /* Description */ + "DEGREE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_DEGREE_X_N, /* UniqueID */ + "N = DEGREE( X )", /* Syntax */ + "The number of degrees in X radians.", /* Description */ + "DEGREE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_DET_N, /* UniqueID */ + "N = DET", /* Syntax */ + "The determinant of the last MAT INV. Zero means error.", /* Description */ + "DET", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | S70 | G74 | H14 | HB2 | G67 | D71 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_DIGITS_X_N, /* UniqueID */ + "N = DIGITS( X )", /* Syntax */ + "X is the number of significiant digits to print for numbers (0..17). " + " If X = 0 then disabled. ", /* Description */ + "DIGITS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_DIGITS_X_Y_N, /* UniqueID */ + "N = DIGITS( X, Y )", /* Syntax */ + "X is the number of significiant digits to print for numbers (0..17). " + " If X = 0 then disabled. Y is the number of decimal places to " + "round (0..17). If Y = 0 then disabled.", /* Description */ + "DIGITS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1BYT | P2BYT, /* ParameterTests */ + HB2 | R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_DIM_N, /* UniqueID */ + "N = DIM( ... )", /* Syntax */ + "DIM( arrayname ). The total number of dimensions of the array.", /* Description */ + "DIM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_DPEEK_X_N, /* UniqueID */ + "N = DPEEK( X )", /* Syntax */ + "The value read from hardware address X. Causes ERROR 73.", /* Description */ + "DPEEK", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LNG, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_DPOKE_X_Y_N, /* UniqueID */ + "N = DPOKE( X, Y )", /* Syntax */ + "Sends Y to hardware address X. Causes ERROR 73.", /* Description */ + "DPOKE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LNG | P2INT, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_EDIT4_A_X_S, /* UniqueID */ + "S$ = EDIT$( A$, X )", /* Syntax */ + "Edits the characters of A$, according to the bits set in X.\n1 " + "= discard parity bit.\n2 = discard all spaces.\n4 = discard all " + "carriage returns, line feeds, form feeds, deletes, escapes and " + "nulls.\n8 = discard leading spaces.\n16 = replace multiple spaces " + "with one space.\n32 = change lower case to upper case.\n64 = change " + "[ to ( and change ] to ).\n128 = discard trailing spacess.\n256 " + "= suppress editing within quotes.\nThe order in which edits occur " + "is implementation defined.", /* Description */ + "EDIT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2NUM, /* ParameterTypes */ + P1ANY | P2INT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_ENVIRON_A_N, /* UniqueID */ + "N = ENVIRON( A$ )", /* Syntax */ + "Sends the environment variable expression contained in A$ to " + "the host operating system. A$ must contain the \"=\" character.", /* Description */ + "ENVIRON", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_ENVIRON4_A_S, /* UniqueID */ + "S$ = ENVIRON$( A$ )", /* Syntax */ + "The value of the environment variable named A$.", /* Description */ + "ENVIRON$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_EOF_X_N, /* UniqueID */ + "N = EOF( X )", /* Syntax */ + "If device number X is at the end-of-file, then -1, otherwise " + "0.", /* Description */ + "EOF", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | H14 | H80 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_EPS_X_N, /* UniqueID */ + "N = EPS( X )", /* Syntax */ + "The maximum of (X-X1,X2-X, sigma) where X1 and X2 are the predecessor " + "and successor of X and signma is the smallest positive value " + "representable. If X has no predecessor the X1=X and if X has " + "no successor the X2=X. Note EPS(0) is the smallest positive " + "number representable by the implementation, and is therefor implementation-defined. " + " Note also that EPS may produce different results for different " + "arithmetic options (see OPTION ARITHMETIC).", /* Description */ + "EPS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_ERL_N, /* UniqueID */ + "N = ERL", /* Syntax */ + "The line number of the most recent error.", /* Description */ + "ERL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_ERR_N, /* UniqueID */ + "N = ERR", /* Syntax */ + "The error number of the most recent error.", /* Description */ + "ERR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | H14 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_ERR4_S, /* UniqueID */ + "S$ = ERR$", /* Syntax */ + "The last error message.", /* Description */ + "ERR$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_ERRL_N, /* UniqueID */ + "N = ERRL", /* Syntax */ + "The line number of the most recent error.", /* Description */ + "ERRL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ERRN_N, /* UniqueID */ + "N = ERRN", /* Syntax */ + "The error number of the most recent error.", /* Description */ + "ERRN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ERROR_X_N, /* UniqueID */ + "N = ERROR( X )", /* Syntax */ + "Simulate the error number in X.", /* Description */ + "ERROR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_ERROR_X_A_N, /* UniqueID */ + "N = ERROR( X, A$ )", /* Syntax */ + "Simulate the error number in X, with a custom message in A$.", /* Description */ + "ERROR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2STR, /* ParameterTypes */ + P1BYT | P2ANY, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_ERROR4_S, /* UniqueID */ + "S$ = ERROR$", /* Syntax */ + "The last error message.", /* Description */ + "ERROR$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_EXAM_X_N, /* UniqueID */ + "N = EXAM( X )", /* Syntax */ + "The value read from hardware address X. Causes ERROR 73.", /* Description */ + "EXAM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LNG, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_EXEC_A_N, /* UniqueID */ + "N = EXEC( A$ )", /* Syntax */ + "The exit code resulting from the execution of an operating system " + "command.", /* Description */ + "EXEC", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_EXF_N, /* UniqueID */ + "N = EXF( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "EXF", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + D70 /* OptionVersionBitmask */ +}, +{ + F_EXP_X_N, /* UniqueID */ + "N = EXP( X )", /* Syntax */ + "The exponential value of X, i.e., the value of the base of natural " + "logarithms (e = 2.71828) raised to the power of X; if EXP(X) " + "is less that machine infinitesimal, then its value shall be replaced " + "with zero.", /* Description */ + "EXP", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_FALSE_N, /* UniqueID */ + "N = FALSE", /* Syntax */ + "The value of FALSE.", /* Description */ + "FALSE", /* Name */ + IntegerTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_FETCH_X_N, /* UniqueID */ + "N = FETCH( X )", /* Syntax */ + "The value read from hardware address X. Causes ERROR 73.", /* Description */ + "FETCH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LNG, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_FILEATTR_X_Y_N, /* UniqueID */ + "N = FILEATTR( X, Y )", /* Syntax */ + "For file X, if Y = 1 then returns open mode, otherwise returns " + "zero.", /* Description */ + "FILEATTR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2INT, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_FILES_N, /* UniqueID */ + "N = FILES", /* Syntax */ + "Displays all the file names.", /* Description */ + "FILES", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_FILES_A_N, /* UniqueID */ + "N = FILES( A$ )", /* Syntax */ + "Displays all the file names matching A$.", /* Description */ + "FILES", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_FILL_X_Y_N, /* UniqueID */ + "N = FILL( X, Y )", /* Syntax */ + "Sends Y to hardware address X. Causes ERROR 73.", /* Description */ + "FILL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LNG | P2BYT, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_FIX_X_N, /* UniqueID */ + "N = FIX( X )", /* Syntax */ + "The truncated integer, part of X. FIX (X) is equivalent to SGN(X)*INT(ABS(X)). " + "The major difference between FIX and INT is that FIX does not " + "return the next lower number for negative X.", /* Description */ + "FIX", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | G65 | G67 | M80 | D71 | I70 | I73 | T80 /* OptionVersionBitmask */ +}, +{ + F_FLOAT_X_N, /* UniqueID */ + "N = FLOAT( X )", /* Syntax */ + "The rounded integer valuet of X.", /* Description */ + "FLOAT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + C77 /* OptionVersionBitmask */ +}, +{ + F_FLOW_N, /* UniqueID */ + "N = FLOW", /* Syntax */ + "Turn tracing ON", /* Description */ + "FLOW", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_FP_X_N, /* UniqueID */ + "N = FP( X )", /* Syntax */ + "The fractional part of X, i.e. X - IP(X).", /* Description */ + "FP", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + F_FRAC_X_N, /* UniqueID */ + "N = FRAC( X )", /* Syntax */ + "The fractional part of X, i.e. X - IP(X).", /* Description */ + "FRAC", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + F_FRE_N, /* UniqueID */ + "N = FRE", /* Syntax */ + "The number of bytes of available memory. This function is provided " + "for backward compatibility only and it always returns a fixed " + "value of 32000.", /* Description */ + "FRE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | C77 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_FRE_A_N, /* UniqueID */ + "N = FRE( A$ )", /* Syntax */ + "The number of bytes of available memory. This function is provided " + "for backward compatibility only and it always returns a fixed " + "value of 32000.The value of A$ is ignored.", /* Description */ + "FRE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_FRE_X_N, /* UniqueID */ + "N = FRE( X )", /* Syntax */ + "The number of bytes of available memory. This function is provided " + "for backward compatibility only and it always returns a fixed " + "value of 32000. The value of X is ignored.", /* Description */ + "FRE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB1 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_FREE_N, /* UniqueID */ + "N = FREE", /* Syntax */ + "The number of bytes of available memory. This function is provided " + "for backward compatibility only and it always returns a fixed " + "value of 32000.", /* Description */ + "FREE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + HB1 | HB2 | H80 /* OptionVersionBitmask */ +}, +{ + F_FREE_X_N, /* UniqueID */ + "N = FREE( X )", /* Syntax */ + "The number of bytes of available memory. This function is provided " + "for backward compatibility only and it always returns a fixed " + "value of 32000. The value of X is ignored.", /* Description */ + "FREE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_FREE_A_N, /* UniqueID */ + "N = FREE( A$ )", /* Syntax */ + "The number of bytes of available memory. This function is provided " + "for backward compatibility only and it always returns a fixed " + "value of 32000.The value of A$ is ignored.", /* Description */ + "FREE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_FREEFILE_N, /* UniqueID */ + "N = FREEFILE", /* Syntax */ + "The next available file number.", /* Description */ + "FREEFILE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | H14 /* OptionVersionBitmask */ +}, +{ + F_GET_X_N, /* UniqueID */ + "N = GET( X )", /* Syntax */ + "For file X, gets the next available record.", /* Description */ + "GET", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_GET_X_N, /* UniqueID */ + "N = GET( X )", /* Syntax */ + "Get character code from input. The value of X is ignored. Similar " + "to ASC(INKEY$).", /* Description */ + "GET", /* Name */ + IntegerTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + D73 /* OptionVersionBitmask */ +}, +{ + F_GET_X_Y_N, /* UniqueID */ + "N = GET( X, Y )", /* Syntax */ + "For file X, gets record number Y. The first record number is " + "1.", /* Description */ + "GET", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2INT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_GRAD_N, /* UniqueID */ + "N = GRAD", /* Syntax */ + "Configures the math functions to accept and return angles in " + "gradians.", /* Description */ + "GRAD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_GRADIAN_N, /* UniqueID */ + "N = GRADIAN", /* Syntax */ + "Configures the math functions to accept and return angles in " + "gradians.", /* Description */ + "GRADIAN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_HCS_X_N, /* UniqueID */ + "N = HCS( X )", /* Syntax */ + "The hyperbolic cosine of X.", /* Description */ + "HCS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_HEX_A_N, /* UniqueID */ + "N = HEX( A$ )", /* Syntax */ + "The numeric value of the hexadecimal string in A$. For example, " + "HEX(\"FFFF\") returns 65535.", /* Description */ + "HEX", /* Name */ + ByteTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_HEX4_X_S, /* UniqueID */ + "S$ = HEX$( X )", /* Syntax */ + "The the hexadecimal (base 16) representation of X.", /* Description */ + "HEX$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_HEX4_X_Y_S, /* UniqueID */ + "S$ = HEX$( X, Y )", /* Syntax */ + "The the hexadecimal (base 16) representation of X. The result " + "will be at least Y digits long. ", /* Description */ + "HEX$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2BYT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_HOME_N, /* UniqueID */ + "N = HOME", /* Syntax */ + "Clears the screen. Cursor is positioned at row 1, column 1.", /* Description */ + "HOME", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | H14 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_HSN_X_N, /* UniqueID */ + "N = HSN( X )", /* Syntax */ + "The hyperbolic sine of X.", /* Description */ + "HSN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_HTN_X_N, /* UniqueID */ + "N = HTN( X )", /* Syntax */ + "The hyperbolic tangent of X.", /* Description */ + "HTN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_INCH4_S, /* UniqueID */ + "S$ = INCH$", /* Syntax */ + "The keypress, if available. If a keypress is not available, then " + "immediately returns an empty string. If not supported by the " + "platform, then always returns an empty string, so use INPUT$(1) " + "instead.", /* Description */ + "INCH$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_INDEX_A_B_N, /* UniqueID */ + "N = INDEX( A$, B$ )", /* Syntax */ + "The position at which B$ occurs in A$, beginning at position " + "1.", /* Description */ + "INDEX", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2STR, /* ParameterTypes */ + P1ANY | P2ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_INITIALIZE_N, /* UniqueID */ + "N = INITIALIZE", /* Syntax */ + "This function is provided for backward compatibility only and " + "it always returns a fixed value of 0.", /* Description */ + "INITIALIZE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + C77 /* OptionVersionBitmask */ +}, +{ + F_INKEY4_S, /* UniqueID */ + "S$ = INKEY$", /* Syntax */ + "The keypress, if available. If a keypress is not available, then " + "immediately returns an empty string. If not supported by the " + "platform, then always returns an empty string, so use INPUT$(1) " + "instead.", /* Description */ + "INKEY$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_INP_X_N, /* UniqueID */ + "N = INP( X )", /* Syntax */ + "The value read from machine port X. Causes ERROR 73.", /* Description */ + "INP", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | C77 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_INPUT4_X_S, /* UniqueID */ + "S$ = INPUT$( X )", /* Syntax */ + "The string of X characters, read from the terminal.", /* Description */ + "INPUT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LEN, /* ParameterTests */ + B15 | H14 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_INPUT4_X_Y_S, /* UniqueID */ + "S$ = INPUT$( X, Y )", /* Syntax */ + "The string of X characters, read from file Y.", /* Description */ + "INPUT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LEN | P2INT, /* ParameterTests */ + B15 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_INSTR_A_B_N, /* UniqueID */ + "N = INSTR( A$, B$ )", /* Syntax */ + "The position at which B$ occurs in A$, beginning at position " + "1.", /* Description */ + "INSTR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2STR, /* ParameterTypes */ + P1ANY | P2ANY, /* ParameterTests */ + B15 | B93 | H14 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_INSTR_A_B_X_N, /* UniqueID */ + "N = INSTR( A$, B$, X )", /* Syntax */ + "The position at which B$ occurs in A$, beginning at position " + "X.", /* Description */ + "INSTR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1STR | P2STR | P3NUM, /* ParameterTypes */ + P1ANY | P2ANY | P3POS, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_INSTR_X_A_B_N, /* UniqueID */ + "N = INSTR( X, A$, B$ )", /* Syntax */ + "The position at which B$ occurs in A$, beginning at position " + "X.", /* Description */ + "INSTR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1NUM | P2STR | P3STR, /* ParameterTypes */ + P1POS | P2ANY | P3ANY, /* ParameterTests */ + B15 | B93 | H14 | HB2 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_INT_X_N, /* UniqueID */ + "N = INT( X )", /* Syntax */ + "The largest integer not greater than X; e.g. INT(1.3) = 1 and " + "INT(-1.3) = 2.", /* Description */ + "INT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_INT5_X_N, /* UniqueID */ + "N = INT%( X )", /* Syntax */ + "The rounded integer valuet of X.", /* Description */ + "INT%", /* Name */ + LongTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + C77 | H14 /* OptionVersionBitmask */ +}, +{ + F_IP_X_N, /* UniqueID */ + "N = IP( X )", /* Syntax */ + "The integer part of X, i.e., SGN(X)*INT(ABS(X)).", /* Description */ + "IP", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + F_KEY_S, /* UniqueID */ + "S$ = KEY", /* Syntax */ + "The keypress, if available. If a keypress is not available, then " + "immediately returns an empty string. If not supported by the " + "platform, then always returns an empty string, so use INPUT$(1) " + "instead.", /* Description */ + "KEY", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_KEY4_S, /* UniqueID */ + "S$ = KEY$", /* Syntax */ + "The keypress, if available. If a keypress is not available, then " + "immediately returns an empty string. If not supported by the " + "platform, then always returns an empty string, so use INPUT$(1) " + "instead.", /* Description */ + "KEY$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_KILL_A_N, /* UniqueID */ + "N = KILL( A$ )", /* Syntax */ + "Removes the file named in A$.", /* Description */ + "KILL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_LBOUND_N, /* UniqueID */ + "N = LBOUND( ... )", /* Syntax */ + "LBOUND( arrayname [, dimension] ). The lower bound of the array. " + " The dimension defaults to 1. dimension in [1,DIM(arrayname)]", /* Description */ + "LBOUND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_LCASE4_A_S, /* UniqueID */ + "S$ = LCASE$( A$ )", /* Syntax */ + "The string of characters from the value associatedwith A$ by " + "replacing each upper-case-letter in the string by its lower-case " + "version.", /* Description */ + "LCASE$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | C77 | E86 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_LEFT_A_X_S, /* UniqueID */ + "S$ = LEFT( A$, X )", /* Syntax */ + "The X left-most characters of A$, beginning from postion 1.", /* Description */ + "LEFT", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2NUM, /* ParameterTypes */ + P1ANY | P2LEN, /* ParameterTests */ + HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_LEFT4_A_X_S, /* UniqueID */ + "S$ = LEFT$( A$, X )", /* Syntax */ + "The X left-most characters of A$, beginning from postion 1.", /* Description */ + "LEFT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2NUM, /* ParameterTypes */ + P1ANY | P2LEN, /* ParameterTests */ + B15 | B93 | C77 | E86 | H14 | HB1 | HB2 | H80 | M80 | D71 | T80 | V09 /* OptionVersionBitmask */ +}, +{ + F_LEN_A_N, /* UniqueID */ + "N = LEN( A$ )", /* Syntax */ + "The length of A$.", /* Description */ + "LEN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_LGT_X_N, /* UniqueID */ + "N = LGT( X )", /* Syntax */ + "The common logarithm of X; X shall be greater than zero.", /* Description */ + "LGT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + S70 | HB1 | HB2 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_LIN_X_S, /* UniqueID */ + "S$ = LIN( X )", /* Syntax */ + "The string X bytes long of newline characters.", /* Description */ + "LIN", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LEN, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_LN_X_N, /* UniqueID */ + "N = LN( X )", /* Syntax */ + "The natural logarithm of X; X shall be greater than zero.", /* Description */ + "LN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_LNO_X_N, /* UniqueID */ + "N = LNO( X )", /* Syntax */ + "Returns X.", /* Description */ + "LNO", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + H80 /* OptionVersionBitmask */ +}, +{ + F_LOC_X_N, /* UniqueID */ + "N = LOC( X )", /* Syntax */ + "The location of file X; the next record that GET or PUT statements " + "will use.", /* Description */ + "LOC", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | E86 | G74 | H14 | G65 | G67 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_LOCATE_X_Y_N, /* UniqueID */ + "N = LOCATE( X, Y )", /* Syntax */ + "Locates the cursor to row X, column Y.", /* Description */ + "LOCATE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1BYT | P2BYT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_LOCK_X_N, /* UniqueID */ + "N = LOCK( X )", /* Syntax */ + "Lock file number X. Causes ERROR 73.", /* Description */ + "LOCK", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_LOF_X_N, /* UniqueID */ + "N = LOF( X )", /* Syntax */ + "The length of file X.", /* Description */ + "LOF", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | E86 | G74 | H14 | G65 | G67 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_LOG_X_N, /* UniqueID */ + "N = LOG( X )", /* Syntax */ + "The natural logarithm of X; X shall be greater than zero.", /* Description */ + "LOG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_LOG10_X_N, /* UniqueID */ + "N = LOG10( X )", /* Syntax */ + "The common logarithm of X; X shall be greater than zero.", /* Description */ + "LOG10", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + B15 | E86 | H14 | HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_LOG2_X_N, /* UniqueID */ + "N = LOG2( X )", /* Syntax */ + "The base 2 logarithm of X; X shall be greater than zero.", /* Description */ + "LOG2", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + B15 | E86 | H14 /* OptionVersionBitmask */ +}, +{ + F_LOGE_X_N, /* UniqueID */ + "N = LOGE( X )", /* Syntax */ + "The natural logarithm of X; X shall be greater than zero.", /* Description */ + "LOGE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_LOWER4_A_S, /* UniqueID */ + "S$ = LOWER$( A$ )", /* Syntax */ + "The string of characters from the value associatedwith A$ by " + "replacing each upper-case-letter in the string by its lower-case " + "version.", /* Description */ + "LOWER$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_LPOS_N, /* UniqueID */ + "N = LPOS", /* Syntax */ + "The current cursor position in the line for the printer.", /* Description */ + "LPOS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_LTRIM4_A_S, /* UniqueID */ + "S$ = LTRIM$( A$ )", /* Syntax */ + "The string of characters resulting from the value associated " + "with A$ by deleting all leading space characters.", /* Description */ + "LTRIM$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_LTW_X_N, /* UniqueID */ + "N = LTW( X )", /* Syntax */ + "The base 2 logarithm of X; X shall be greater than zero.", /* Description */ + "LTW", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GTZ, /* ParameterTests */ + S70 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_LWIDTH_X_N, /* UniqueID */ + "N = LWIDTH( X )", /* Syntax */ + "For printer, sets the line width to X. Zero means no wrapping " + "will occur.", /* Description */ + "LWIDTH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_MATCH_A_B_X_N, /* UniqueID */ + "N = MATCH( A$, B$, X )", /* Syntax */ + "The character position, within the value assocated with A$, of " + "the first character of the first occurence of the value associated " + "with B$, starting at the Xth character of A$. If there is not " + "such occurence, then the value returned is zero.", /* Description */ + "MATCH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1STR | P2STR | P3NUM, /* ParameterTypes */ + P1ANY | P2ANY | P3POS, /* ParameterTests */ + C77 | H14 | H80 /* OptionVersionBitmask */ +}, +{ + F_MAX_A_B_S, /* UniqueID */ + "S$ = MAX( A$, B$ )", /* Syntax */ + "The larger of the parameters.", /* Description */ + "MAX", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2STR, /* ParameterTypes */ + P1ANY | P2ANY, /* ParameterTests */ + B15 | S70 | HB2 | H80 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_MAX_X_Y_N, /* UniqueID */ + "N = MAX( X, Y )", /* Syntax */ + "The larger of the parameters.", /* Description */ + "MAX", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1ANY | P2ANY, /* ParameterTests */ + B15 | S70 | E86 | H14 | HB2 | H80 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_MAXBYT_N, /* UniqueID */ + "N = MAXBYT", /* Syntax */ + "The largest finite positive number representable as a BYTE; implementation-defined.", /* Description */ + "MAXBYT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MAXCUR_N, /* UniqueID */ + "N = MAXCUR", /* Syntax */ + "The largest finite positive number representable as a CURRENCY; " + "implementation-defined.", /* Description */ + "MAXCUR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MAXDBL_N, /* UniqueID */ + "N = MAXDBL", /* Syntax */ + "The largest finite positive number representable as a DOUBLE; " + "implementation-defined.", /* Description */ + "MAXDBL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MAXDEV_N, /* UniqueID */ + "N = MAXDEV", /* Syntax */ + "The largest finite positive number useable as a FILE NUMBER; " + "implementation-defined.", /* Description */ + "MAXDEV", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MAXINT_N, /* UniqueID */ + "N = MAXINT", /* Syntax */ + "The largest finite positive number representable as an INTEGER; " + "implementation-defined.", /* Description */ + "MAXINT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MAXLEN_N, /* UniqueID */ + "N = MAXLEN", /* Syntax */ + "The maximum string length.", /* Description */ + "MAXLEN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_MAXLEN_A_N, /* UniqueID */ + "N = MAXLEN( A$ )", /* Syntax */ + "The maximum length associated with the simple-string-variable " + "A$.", /* Description */ + "MAXLEN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_MAXLNG_N, /* UniqueID */ + "N = MAXLNG", /* Syntax */ + "The largest finite positive number representable as a LONG; implementation-defined.", /* Description */ + "MAXLNG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MAXLVL_N, /* UniqueID */ + "N = MAXLVL", /* Syntax */ + "The maximum stack level; implementation-defined.", /* Description */ + "MAXLVL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MAXNUM_N, /* UniqueID */ + "N = MAXNUM", /* Syntax */ + "The largest finite positive number representable and manipulable " + "by the implementation; implementation-defined. MAXNUM may represent " + "diffent number for different arithmetic options (see OPTION ARITHMETIC).", /* Description */ + "MAXNUM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_MAXSNG_N, /* UniqueID */ + "N = MAXSNG", /* Syntax */ + "The largest finite positive number representable as a SINGLE; " + "implementation-defined.", /* Description */ + "MAXSNG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MEM_N, /* UniqueID */ + "N = MEM", /* Syntax */ + "The number of bytes of available memory. This function is provided " + "for backward compatibility only and it always returns a fixed " + "value of 32000.", /* Description */ + "MEM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_MID_A_X_S, /* UniqueID */ + "S$ = MID( A$, X )", /* Syntax */ + "The characters of A$, starting from postion X.", /* Description */ + "MID", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2NUM, /* ParameterTypes */ + P1ANY | P2POS, /* ParameterTests */ + HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_MID_A_X_Y_S, /* UniqueID */ + "S$ = MID( A$, X, Y )", /* Syntax */ + "The Y characters of A$, starting from postion X.", /* Description */ + "MID", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1STR | P2NUM | P3NUM, /* ParameterTypes */ + P1ANY | P2POS | P3LEN, /* ParameterTests */ + HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_MID4_A_X_S, /* UniqueID */ + "S$ = MID$( A$, X )", /* Syntax */ + "The characters of A$, starting from postion X.", /* Description */ + "MID$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2NUM, /* ParameterTypes */ + P1ANY | P2POS, /* ParameterTests */ + B15 | B93 | C77 | E86 | H14 | HB1 | HB2 | H80 | M80 | R86 | D71 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_MID4_A_X_Y_S, /* UniqueID */ + "S$ = MID$( A$, X, Y )", /* Syntax */ + "The Y characters of A$, starting from postion X.", /* Description */ + "MID$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1STR | P2NUM | P3NUM, /* ParameterTypes */ + P1ANY | P2POS | P3LEN, /* ParameterTests */ + B15 | B93 | C77 | E86 | H14 | HB1 | HB2 | H80 | M80 | R86 | D71 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_MIN_X_Y_N, /* UniqueID */ + "N = MIN( X, Y )", /* Syntax */ + "The smaller of the parameters.", /* Description */ + "MIN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1ANY | P2ANY, /* ParameterTests */ + B15 | S70 | E86 | H14 | HB2 | H80 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_MIN_A_B_S, /* UniqueID */ + "S$ = MIN( A$, B$ )", /* Syntax */ + "The smaller of the parameters.", /* Description */ + "MIN", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2STR, /* ParameterTypes */ + P1ANY | P2ANY, /* ParameterTests */ + B15 | S70 | HB2 | H80 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_MINBYT_N, /* UniqueID */ + "N = MINBYT", /* Syntax */ + "The largest finite negative number representable as a BYTE; implementation-defined.", /* Description */ + "MINBYT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MINCUR_N, /* UniqueID */ + "N = MINCUR", /* Syntax */ + "The largest finite negative number representable as a CURRENCY; " + "implementation-defined.", /* Description */ + "MINCUR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MINDBL_N, /* UniqueID */ + "N = MINDBL", /* Syntax */ + "The largest finite negative number representable as a DOUBLE; " + "implementation-defined.", /* Description */ + "MINDBL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MINDEV_N, /* UniqueID */ + "N = MINDEV", /* Syntax */ + "The largest finite negative number useable as a FILE NUMBER; " + "implementation-defined.", /* Description */ + "MINDEV", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MININT_N, /* UniqueID */ + "N = MININT", /* Syntax */ + "The largest finite negative number representable as an INTEGER; " + "implementation-defined.", /* Description */ + "MININT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MINLNG_N, /* UniqueID */ + "N = MINLNG", /* Syntax */ + "The largest finite negative number representable as a LONG; implementation-defined.", /* Description */ + "MINLNG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MINNUM_N, /* UniqueID */ + "N = MINNUM", /* Syntax */ + "The largest finite negative number representable and manipulable " + "by the implementation; implementation-defined. MINNUM may represent " + "diffent number for different arithmetic options (see OPTION ARITHMETIC).", /* Description */ + "MINNUM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MINSNG_N, /* UniqueID */ + "N = MINSNG", /* Syntax */ + "The largest finite negative number representable as a SINGLE; " + "implementation-defined.", /* Description */ + "MINSNG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MKC4_X_S, /* UniqueID */ + "S$ = MKC$( X )", /* Syntax */ + "The internal representation of the currency (64-bit) integer " + "X as a string.", /* Description */ + "MKC$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1CUR, /* ParameterTests */ + B15 /* OptionVersionBitmask */ +}, +{ + F_MKD4_X_S, /* UniqueID */ + "S$ = MKD$( X )", /* Syntax */ + "The internal representation of X as a string.", /* Description */ + "MKD$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1DBL, /* ParameterTests */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_MKDIR_A_N, /* UniqueID */ + "N = MKDIR( A$ )", /* Syntax */ + "Makes the directory named in A$.", /* Description */ + "MKDIR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_MKI4_X_S, /* UniqueID */ + "S$ = MKI$( X )", /* Syntax */ + "The internal representation of the short (16-bit) integer X as " + "a string.", /* Description */ + "MKI$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_MKL4_X_S, /* UniqueID */ + "S$ = MKL$( X )", /* Syntax */ + "The internal representation of the long (32-bit) integer X as " + "a string.", /* Description */ + "MKL$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LNG, /* ParameterTests */ + B15 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_MKS4_X_S, /* UniqueID */ + "S$ = MKS$( X )", /* Syntax */ + "The internal representation of X as a string.", /* Description */ + "MKS$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1FLT, /* ParameterTests */ + B15 | B93 | H14 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_MOD_X_Y_N, /* UniqueID */ + "N = MOD( X, Y )", /* Syntax */ + "X modulo Y, i.e., X-Y*INT(X/Y). Y shall not equal zero.", /* Description */ + "MOD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1ANY | P2NEZ, /* ParameterTests */ + E86 /* OptionVersionBitmask */ +}, +{ + F_NAME_A_B_N, /* UniqueID */ + "N = NAME( A$, B$ )", /* Syntax */ + "Rename the file named A$ into B$.", /* Description */ + "NAME", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2STR, /* ParameterTypes */ + P1BYT | P2BYT, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_NAME_N, /* UniqueID */ + "N = NAME( ... )", /* Syntax */ + "Returns hardware address of variable. Causes ERROR 73.", /* Description */ + "NAME", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_NOFLOW_N, /* UniqueID */ + "N = NOFLOW", /* Syntax */ + "Turn tracing OFF", /* Description */ + "NOFLOW", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_NOTRACE_N, /* UniqueID */ + "N = NOTRACE", /* Syntax */ + "Turn tracing OFF", /* Description */ + "NOTRACE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_NULL_X_N, /* UniqueID */ + "N = NULL( X )", /* Syntax */ + "Appends X null characters after each line printed by LPRINT or " + "LLIST.", /* Description */ + "NULL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_NUM_N, /* UniqueID */ + "N = NUM", /* Syntax */ + "The number of values processed by the last MAT INPUT. Zero means " + "error.", /* Description */ + "NUM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | G74 | HB2 | G67 /* OptionVersionBitmask */ +}, +{ + F_NUM_A_N, /* UniqueID */ + "N = NUM( A$ )", /* Syntax */ + "The value of the numeric-constant associated with A$, if the " + "string associated with A$ is a numeric-constant. Leading and " + "trailing spaces in the string are ignored. If the evaluation " + "of the numeric-constant would result in a value which causes " + "an underflow, then the value returned shall be zero. For example, " + "NUM( \" 123.5 \" ) = 123.5, NUM( \"2.E-99\" ) could be zero, and " + "NUM( \"MCMXVII\" ) causes an exception.", /* Description */ + "NUM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | HB2 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_NUM4_X_S, /* UniqueID */ + "S$ = NUM$( X )", /* Syntax */ + "The string generated by the print-statement as the numeric-representation " + "of the value associated with X.", /* Description */ + "NUM$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | D64 | E78 | E86 | G74 | HB1 | HB2 | G65 | G67 | M80 | D71 | I70 | I73 | T80 /* OptionVersionBitmask */ +}, +{ + F_OCT4_X_S, /* UniqueID */ + "S$ = OCT$( X )", /* Syntax */ + "The the octal (base 8) representation of X.", /* Description */ + "OCT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_OCT4_X_Y_S, /* UniqueID */ + "S$ = OCT$( X, Y )", /* Syntax */ + "The the octal (base 8) representation of X. The result will " + "be at least Y digits long. ", /* Description */ + "OCT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2BYT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_OPEN_A_X_B_N, /* UniqueID */ + "N = OPEN( A$, X, B$ )", /* Syntax */ + "Open file number X. A$ is the mode: \"I\", \"O\", \"A\", \"R\". B$ " + "is the file name. Default the record length.", /* Description */ + "OPEN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1STR | P2NUM | P3STR, /* ParameterTypes */ + P1BYT | P2INT | P3BYT, /* ParameterTests */ + B15 | B93 | H14 | H80 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_OPEN_A_X_B_Y_N, /* UniqueID */ + "N = OPEN( A$, X, B$, Y )", /* Syntax */ + "Open file number X. A$ is the mode: \"I\", \"O\", \"A\", \"R\". B$ " + "is the file name. Y is the record length.", /* Description */ + "OPEN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 4, /* ParameterCount */ + P1STR | P2NUM | P3STR | P4NUM, /* ParameterTypes */ + P1BYT | P2INT | P3BYT | P4INT, /* ParameterTests */ + B15 | B93 | H14 | H80 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_ORD_A_N, /* UniqueID */ + "N = ORD( A$ )", /* Syntax */ + "The ordinal position of the character named by the string associated " + "with A$ in the collating sequence of ASCII character set, where " + "the first member of the character set is in position zero. The " + "acceptable values for the standard character set are shown in " + "Table 1.", /* Description */ + "ORD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_OUT_X_Y_N, /* UniqueID */ + "N = OUT( X, Y )", /* Syntax */ + "Sends Y to hardware port X. Causes ERROR 73.", /* Description */ + "OUT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2BYT, /* ParameterTests */ + B15 | C77 | H14 | HB1 | HB2 | H80 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_PAD_X_N, /* UniqueID */ + "N = PAD( X )", /* Syntax */ + "Returns zero.", /* Description */ + "PAD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + H80 /* OptionVersionBitmask */ +}, +{ + F_PAUSE_X_N, /* UniqueID */ + "N = PAUSE( X )", /* Syntax */ + "The program pauses for X times the value of OPTION SLEEP seconds. " + " If the result is zero, negative, or more than INT_MAX then PAUSE " + "does nothing. The resolution is implementation defined.", /* Description */ + "PAUSE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 | H80 /* OptionVersionBitmask */ +}, +{ + F_PDL_X_N, /* UniqueID */ + "N = PDL( X )", /* Syntax */ + "The value read from machine port X. Causes ERROR 73.", /* Description */ + "PDL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_PEEK_X_N, /* UniqueID */ + "N = PEEK( X )", /* Syntax */ + "The value read from hardware address X. Causes ERROR 73.", /* Description */ + "PEEK", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LNG, /* ParameterTests */ + B15 | C77 | H14 | HB1 | HB2 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_PI_N, /* UniqueID */ + "N = PI", /* Syntax */ + "The constant 3.14159 which is the ratio of the circumference " + "of a circle to its diameter.", /* Description */ + "PI", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | E86 | H14 | HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_PI_X_N, /* UniqueID */ + "N = PI( X )", /* Syntax */ + "The constant 3.14159 which is the ratio of the circumference " + "of a circle to its diameter, times X.", /* Description */ + "PI", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_PIN_X_N, /* UniqueID */ + "N = PIN( X )", /* Syntax */ + "The value read from machine port X. Causes ERROR 73.", /* Description */ + "PIN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + HB1 | HB2 | H80 /* OptionVersionBitmask */ +}, +{ + F_POKE_X_Y_N, /* UniqueID */ + "N = POKE( X, Y )", /* Syntax */ + "Sends Y to hardware address X. Causes ERROR 73.", /* Description */ + "POKE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LNG | P2BYT, /* ParameterTests */ + B15 | C77 | H14 | HB1 | HB2 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_POS_N, /* UniqueID */ + "N = POS", /* Syntax */ + "The current cursor position in the line.", /* Description */ + "POS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | C77 | H14 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_POS_X_N, /* UniqueID */ + "N = POS( X )", /* Syntax */ + "The current cursor position in the line for file X.", /* Description */ + "POS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | H14 | HB2 | H80 | M80 | R86 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_POS_A_B_N, /* UniqueID */ + "N = POS( A$, B$ )", /* Syntax */ + "The character position, within the value assocated with A$, of " + "the first character of the first occurence of the value associated " + "with B$, starting at the first character of A$. If there is " + "not such occurence, then the value returned is zero.", /* Description */ + "POS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2STR, /* ParameterTypes */ + P1ANY | P2ANY, /* ParameterTests */ + B15 | E86 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + F_POS_A_B_X_N, /* UniqueID */ + "N = POS( A$, B$, X )", /* Syntax */ + "The character position, within the value assocated with A$, of " + "the first character of the first occurence of the value associated " + "with B$, starting at the Xth character of A$. If there is not " + "such occurence, then the value returned is zero.", /* Description */ + "POS", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1STR | P2STR | P3NUM, /* ParameterTypes */ + P1ANY | P2ANY | P3POS, /* ParameterTests */ + B15 | E86 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + F_PRECISION_X_N, /* UniqueID */ + "N = PRECISION( X )", /* Syntax */ + "X is the number of decimal places to round (0..17). If X = 0 " + "then disabled.", /* Description */ + "PRECISION", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + HB2 /* OptionVersionBitmask */ +}, +{ + F_PTR_N, /* UniqueID */ + "N = PTR( ... )", /* Syntax */ + "Returns hardware address of variable. Causes ERROR 73.", /* Description */ + "PTR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_PUT_X_N, /* UniqueID */ + "N = PUT( X )", /* Syntax */ + "Send character code to output. Returns the value of X. Similar " + "to PRINT CHR$(X).", /* Description */ + "PUT", /* Name */ + IntegerTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + D73 /* OptionVersionBitmask */ +}, +{ + F_PUT_X_N, /* UniqueID */ + "N = PUT( X )", /* Syntax */ + "For file X, puts the next available record.", /* Description */ + "PUT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_PUT_X_Y_N, /* UniqueID */ + "N = PUT( X, Y )", /* Syntax */ + "For file X, puts record number Y. The first record number is " + "1.", /* Description */ + "PUT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2INT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_RAD_N, /* UniqueID */ + "N = RAD", /* Syntax */ + "Configures the math functions to accept and return angles in " + "radians.", /* Description */ + "RAD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_RAD_X_N, /* UniqueID */ + "N = RAD( X )", /* Syntax */ + "The number of radians in X degrees.", /* Description */ + "RAD", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | E86 | H14 | HB2 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_RADIAN_N, /* UniqueID */ + "N = RADIAN", /* Syntax */ + "Configures the math functions to accept and return angles in " + "radians.", /* Description */ + "RADIAN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_RAN_N, /* UniqueID */ + "N = RAN", /* Syntax */ + "Seeds the pseudo-random number generator with TIME.", /* Description */ + "RAN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_RAN_X_N, /* UniqueID */ + "N = RAN( X )", /* Syntax */ + "Seeds the pseudo-random number generator with X.", /* Description */ + "RAN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_RANDOM_N, /* UniqueID */ + "N = RANDOM", /* Syntax */ + "Seeds the pseudo-random number generator with TIME.", /* Description */ + "RANDOM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + D64 | G74 | HB1 | HB2 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + F_RANDOM_X_N, /* UniqueID */ + "N = RANDOM( X )", /* Syntax */ + "Seeds the pseudo-random number generator with X.", /* Description */ + "RANDOM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_RANDOMIZE_N, /* UniqueID */ + "N = RANDOMIZE", /* Syntax */ + "Seeds the pseudo-random number generator with TIME.", /* Description */ + "RANDOMIZE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | D71 | I70 | I73 | T80 | V09 /* OptionVersionBitmask */ +}, +{ + F_RANDOMIZE_X_N, /* UniqueID */ + "N = RANDOMIZE( X )", /* Syntax */ + "Seeds the pseudo-random number generator with X.", /* Description */ + "RANDOMIZE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D71 | I70 | I73 | T80 /* OptionVersionBitmask */ +}, +{ + F_REMAINDER_X_Y_N, /* UniqueID */ + "N = REMAINDER( X, Y )", /* Syntax */ + "The remainder function, i.e., X-Y*IP(X/Y). Y shall not equal " + "zero.", /* Description */ + "REMAINDER", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1ANY | P2NEZ, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_RENAME_A_B_N, /* UniqueID */ + "N = RENAME( A$, B$ )", /* Syntax */ + "Rename file A$ to B$. If successful, the returns -1 else returns " + "0.", /* Description */ + "RENAME", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2STR, /* ParameterTypes */ + P1BYT | P2BYT, /* ParameterTests */ + C77 | R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_REPEAT4_X_A_S, /* UniqueID */ + "S$ = REPEAT$( X, A$ )", /* Syntax */ + "The string consisting of X copies of LEFT$(A$,1); X > 0.", /* Description */ + "REPEAT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2STR, /* ParameterTypes */ + P1LEN | P2BYT, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_REPEAT4_X_Y_S, /* UniqueID */ + "S$ = REPEAT$( X, Y )", /* Syntax */ + "The string consisting of X copies of CHR$(Y); X > 0.", /* Description */ + "REPEAT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LEN | P2BYT, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_RESET_N, /* UniqueID */ + "N = RESET", /* Syntax */ + "Close all open files.", /* Description */ + "RESET", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_RESIDUE_N, /* UniqueID */ + "N = RESIDUE", /* Syntax */ + "The residue of the last Integer Divide operation. The RESIDUE " + "of -17 / 5 is -2. For X / Y, RESIDUE = CINT( X - Y * CINT( X " + "/ Y ) ).", /* Description */ + "RESIDUE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + R86 /* OptionVersionBitmask */ +}, +{ + F_RIGHT_A_X_S, /* UniqueID */ + "S$ = RIGHT( A$, X )", /* Syntax */ + "The right-most X characters of A$.", /* Description */ + "RIGHT", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2NUM, /* ParameterTypes */ + P1ANY | P2LEN, /* ParameterTests */ + HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_RIGHT4_A_X_S, /* UniqueID */ + "S$ = RIGHT$( A$, X )", /* Syntax */ + "The right-most X characters of A$.", /* Description */ + "RIGHT$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1STR | P2NUM, /* ParameterTypes */ + P1ANY | P2LEN, /* ParameterTests */ + B15 | B93 | C77 | E86 | H14 | HB1 | HB2 | H80 | M80 | R86 | D71 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_RMDIR_A_N, /* UniqueID */ + "N = RMDIR( A$ )", /* Syntax */ + "Removes the directory named in A$.", /* Description */ + "RMDIR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_RND_N, /* UniqueID */ + "N = RND", /* Syntax */ + "The next pseudo-random number in an implementation-defined sequence " + "of pseudo-random numbers uniformly distributed in the range 0 " + "<= RND < 1.", /* Description */ + "RND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_RND_X_N, /* UniqueID */ + "N = RND( X )", /* Syntax */ + "Returns a pseudorandom number in the range [0,1]. The value " + "of X is ignored.", /* Description */ + "RND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_ROUND_X_Y_N, /* UniqueID */ + "N = ROUND( X, Y )", /* Syntax */ + "The value of X rounded to Y decimal digits to the right of the " + "decimal point (or -Y digits to the left if Y < 0); i.e., INT(X*10^Y+.5)/10^Y. " + " Y must be in [-32,32].", /* Description */ + "ROUND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1ANY | P2INT, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_RTRIM4_A_S, /* UniqueID */ + "S$ = RTRIM$( A$ )", /* Syntax */ + "The string of characters resulting from the value associated " + "with A$ by deleting all trailing space characters.", /* Description */ + "RTRIM$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_SCALE_X_N, /* UniqueID */ + "N = SCALE( X )", /* Syntax */ + "X is the number of decimal places to round (0..17). If X = 0 " + "then disabled.", /* Description */ + "SCALE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + R86 | T79 /* OptionVersionBitmask */ +}, +{ + F_SEC_X_N, /* UniqueID */ + "N = SEC( X )", /* Syntax */ + "The secant of X, where X is in radians.", /* Description */ + "SEC", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | S70 | E86 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_SEEK_X_N, /* UniqueID */ + "N = SEEK( X )", /* Syntax */ + "The location of file X; the next record that GET or PUT statements " + "will use.", /* Description */ + "SEEK", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + B15 | E86 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_SEEK_X_Y_N, /* UniqueID */ + "N = SEEK( X, Y )", /* Syntax */ + "For file X, move to record number Y; the first record number " + "is 1.", /* Description */ + "SEEK", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2INT, /* ParameterTests */ + B15 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_SEG_X_N, /* UniqueID */ + "N = SEG( X )", /* Syntax */ + "Returns zero.", /* Description */ + "SEG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + H80 /* OptionVersionBitmask */ +}, +{ + F_SEG_A_X_Y_S, /* UniqueID */ + "S$ = SEG( A$, X, Y )", /* Syntax */ + "The Y characters of A$, starting from postion X.", /* Description */ + "SEG", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1STR | P2NUM | P3NUM, /* ParameterTypes */ + P1ANY | P2POS | P3LEN, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_SEG4_A_X_Y_S, /* UniqueID */ + "S$ = SEG$( A$, X, Y )", /* Syntax */ + "The Y characters of A$, starting from postion X.", /* Description */ + "SEG$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1STR | P2NUM | P3NUM, /* ParameterTypes */ + P1ANY | P2POS | P3LEN, /* ParameterTests */ + B15 | H14 | HB2 /* OptionVersionBitmask */ +}, +{ + F_SGN_X_N, /* UniqueID */ + "N = SGN( X )", /* Syntax */ + "The sign of X: -1 if X < 0, 0 if X = 0, and +1 if X > 0.", /* Description */ + "SGN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_SHELL_A_N, /* UniqueID */ + "N = SHELL( A$ )", /* Syntax */ + "The exit code resulting from the execution of an operating system " + "command.", /* Description */ + "SHELL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_SIN_X_N, /* UniqueID */ + "N = SIN( X )", /* Syntax */ + "The sine of X, where X is in radians.", /* Description */ + "SIN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_SIND_X_N, /* UniqueID */ + "N = SIND( X )", /* Syntax */ + "The sine of X, where X is in degrees.", /* Description */ + "SIND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_SING_X_N, /* UniqueID */ + "N = SING( X )", /* Syntax */ + "The sine of X, where X is in gradians.", /* Description */ + "SING", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_SINH_X_N, /* UniqueID */ + "N = SINH( X )", /* Syntax */ + "The hyperbolic sine of X.", /* Description */ + "SINH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 | HB2 /* OptionVersionBitmask */ +}, +{ + F_SIZE_A_N, /* UniqueID */ + "N = SIZE( A$ )", /* Syntax */ + "The total number of 1KB blockes required to contain the file.", /* Description */ + "SIZE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + C77 /* OptionVersionBitmask */ +}, +{ + F_SIZE_N, /* UniqueID */ + "N = SIZE( ... )", /* Syntax */ + "SIZE( arrayname ). The total number of items in the array.", /* Description */ + "SIZE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + E86 /* OptionVersionBitmask */ +}, +{ + F_SLEEP_X_N, /* UniqueID */ + "N = SLEEP( X )", /* Syntax */ + "The program pauses for X times the value of OPTION SLEEP seconds. " + " If the result is zero, negative, or more than INT_MAX then SLEEP " + "does nothing. The resolution is implementation defined.", /* Description */ + "SLEEP", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | H14 | HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_SNH_X_N, /* UniqueID */ + "N = SNH( X )", /* Syntax */ + "The hyperbolic sine of X.", /* Description */ + "SNH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_SPA_X_S, /* UniqueID */ + "S$ = SPA( X )", /* Syntax */ + "The string of X blank spaces.", /* Description */ + "SPA", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LEN, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_SPACE_X_S, /* UniqueID */ + "S$ = SPACE( X )", /* Syntax */ + "The string of X blank spaces.", /* Description */ + "SPACE", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LEN, /* ParameterTests */ + HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_SPACE4_X_S, /* UniqueID */ + "S$ = SPACE$( X )", /* Syntax */ + "The string of X blank spaces.", /* Description */ + "SPACE$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1LEN, /* ParameterTests */ + B15 | B93 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_SPC_X_S, /* UniqueID */ + "S$ = SPC( X )", /* Syntax */ + "The string of X spaces. Only for use within the PRINT command.", /* Description */ + "SPC", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_SQR_X_N, /* UniqueID */ + "N = SQR( X )", /* Syntax */ + "The non-negative square root of X; X shall be non-negative.", /* Description */ + "SQR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GEZ, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_SQRT_X_N, /* UniqueID */ + "N = SQRT( X )", /* Syntax */ + "The non-negative square root of X; X shall be non-negative.", /* Description */ + "SQRT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1GEZ, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_STR_X_Y_S, /* UniqueID */ + "S$ = STR( X, Y )", /* Syntax */ + "The string X bytes long consisting of CHR$(Y).", /* Description */ + "STR", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LEN | P2BYT, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_STR4_X_S, /* UniqueID */ + "S$ = STR$( X )", /* Syntax */ + "The string generated by the print-statement as the numeric-representation " + "of the value associated with X.", /* Description */ + "STR$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_STRING_X_Y_S, /* UniqueID */ + "S$ = STRING( X, Y )", /* Syntax */ + "The string X bytes long consisting of CHR$(Y).", /* Description */ + "STRING", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LEN | P2BYT, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_STRING4_X_A_S, /* UniqueID */ + "S$ = STRING$( X, A$ )", /* Syntax */ + "The string X bytes long consisting of the first character of " + "A$.", /* Description */ + "STRING$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2STR, /* ParameterTypes */ + P1LEN | P2BYT, /* ParameterTests */ + B15 | B93 | E86 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_STRING4_X_Y_S, /* UniqueID */ + "S$ = STRING$( X, Y )", /* Syntax */ + "The string X bytes long consisting of CHR$(Y).", /* Description */ + "STRING$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LEN | P2BYT, /* ParameterTests */ + B15 | B93 | E86 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_STRIP4_A_S, /* UniqueID */ + "S$ = STRIP$( A$ )", /* Syntax */ + "Return the string with the eighth bit of each character cleared.", /* Description */ + "STRIP$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_STUFF_X_Y_N, /* UniqueID */ + "N = STUFF( X, Y )", /* Syntax */ + "Sends Y to hardware address X. Causes ERROR 73.", /* Description */ + "STUFF", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1LNG | P2BYT, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_TAB_X_S, /* UniqueID */ + "S$ = TAB( X )", /* Syntax */ + "The string required to advance to column X. Only for use within " + "the PRINT command.", /* Description */ + "TAB", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_TAN_X_N, /* UniqueID */ + "N = TAN( X )", /* Syntax */ + "The tangent of X, where X is in radians.", /* Description */ + "TAN", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | D73 | D70 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_TAND_X_N, /* UniqueID */ + "N = TAND( X )", /* Syntax */ + "The tangent of X, where X is in degrees.", /* Description */ + "TAND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_TANG_X_N, /* UniqueID */ + "N = TANG( X )", /* Syntax */ + "The tangent of X, where X is in gradians.", /* Description */ + "TANG", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 /* OptionVersionBitmask */ +}, +{ + F_TANH_X_N, /* UniqueID */ + "N = TANH( X )", /* Syntax */ + "The hyperbolic tangent of X.", /* Description */ + "TANH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 | HB2 /* OptionVersionBitmask */ +}, +{ + F_TI_N, /* UniqueID */ + "N = TI", /* Syntax */ + "The time elapsed since the previous midnight, expressed in seconds; " + "e.g., the value of TIME at 11:15 AM is 40500. If there is no " + "clock available, then the value of TIME shall be -1. The value " + "of TIME at midnight shall be zero (not 86400).", /* Description */ + "TI", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_TI4_S, /* UniqueID */ + "S$ = TI$", /* Syntax */ + "The time of day in 24-hour notation according to ISO 3307. For " + "example, the value of TIME$ at 11:15 AM is \"11:15:00\". If there " + "is no clock available, then the value of TIME$ shall be \"99:99:99\". " + " The value of TIME$ at midnight is \"00:00:00\".", /* Description */ + "TI$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_TIM_N, /* UniqueID */ + "N = TIM", /* Syntax */ + "The time elapsed since the previous midnight, expressed in seconds; " + "e.g., the value of TIME at 11:15 AM is 40500. If there is no " + "clock available, then the value of TIME shall be -1. The value " + "of TIME at midnight shall be zero (not 86400).", /* Description */ + "TIM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + S70 | G74 | HB1 | HB2 | G67 | I70 | I73 /* OptionVersionBitmask */ +}, +{ + F_TIM_X_N, /* UniqueID */ + "N = TIM( X )", /* Syntax */ + "If X is 0, returns minutes in current hour. If X is 1, returns " + "hours in current day. If X is 2, returns days in current year. " + " If X is 3, returns years since 1900. Any other value for X " + "is an ERROR.", /* Description */ + "TIM", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + G74 | HB1 | HB2 | G65 | G67 /* OptionVersionBitmask */ +}, +{ + F_TIME_N, /* UniqueID */ + "N = TIME", /* Syntax */ + "The time elapsed since the previous midnight, expressed in seconds; " + "e.g., the value of TIME at 11:15 AM is 40500. If there is no " + "clock available, then the value of TIME shall be -1. The value " + "of TIME at midnight shall be zero (not 86400).", /* Description */ + "TIME", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | E86 | H14 | HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_TIME_X_N, /* UniqueID */ + "N = TIME( X )", /* Syntax */ + "The time elapsed since the previous midnight, expressed in seconds; " + "e.g., the value of TIME at 11:15 AM is 40500. If there is no " + "clock available, then the value of TIME shall be -1. The value " + "of TIME at midnight shall be zero (not 86400). The value of " + "the parameter X is ignored.", /* Description */ + "TIME", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_TIME4_S, /* UniqueID */ + "S$ = TIME$", /* Syntax */ + "The time of day in 24-hour notation according to ISO 3307. For " + "example, the value of TIME$ at 11:15 AM is \"11:15:00\". If there " + "is no clock available, then the value of TIME$ shall be \"99:99:99\". " + " The value of TIME$ at midnight is \"00:00:00\".", /* Description */ + "TIME$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | E86 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_TIME4_X_S, /* UniqueID */ + "S$ = TIME$( X )", /* Syntax */ + "The time of day in 24-hour notation according to ISO 3307. For " + "example, the value of TIME$ at 11:15 AM is \"11:15:00\". If there " + "is no clock available, then the value of TIME$ shall be \"99:99:99\". " + " The value of TIME$ at midnight is \"00:00:00\". The value of " + "X is ignored.", /* Description */ + "TIME$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_TIMER_N, /* UniqueID */ + "N = TIMER", /* Syntax */ + "The time in the system clock in seconds elapsed since midnight.", /* Description */ + "TIMER", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_TOP_N, /* UniqueID */ + "N = TOP", /* Syntax */ + "The address of the top of available memory. This function is " + "provided for backward compatibility only and it always returns " + "a fixed value of 32000.", /* Description */ + "TOP", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + HB2 /* OptionVersionBitmask */ +}, +{ + F_TRACE_N, /* UniqueID */ + "N = TRACE", /* Syntax */ + "Turn tracing ON", /* Description */ + "TRACE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_TRACE_X_N, /* UniqueID */ + "N = TRACE( X )", /* Syntax */ + "When X is zero turn tracing off. When X is non-zero turn tracing " + "ON", /* Description */ + "TRACE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + R86 /* OptionVersionBitmask */ +}, +{ + F_TRIM4_A_S, /* UniqueID */ + "S$ = TRIM$( A$ )", /* Syntax */ + "The string resulting from removing both leading and trailing " + "spaces from A$.", /* Description */ + "TRIM$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | E86 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_TROFF_N, /* UniqueID */ + "N = TROFF", /* Syntax */ + "Turn tracing OFF", /* Description */ + "TROFF", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | E86 | H14 | HB1 | HB2 | M80 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_TRON_N, /* UniqueID */ + "N = TRON", /* Syntax */ + "Turn tracing ON", /* Description */ + "TRON", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | B93 | E86 | H14 | HB1 | HB2 | M80 | D71 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_TRUE_N, /* UniqueID */ + "N = TRUE", /* Syntax */ + "The value of TRUE.", /* Description */ + "TRUE", /* Name */ + IntegerTypeCode, /* ReturnTypeCode */ + 0, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_TRUNCATE_X_Y_N, /* UniqueID */ + "N = TRUNCATE( X, Y )", /* Syntax */ + "The value of X truncated to Y decimal digits to the right of " + "the decimal point (or -Y digits to the left if Y < 0); i.e., " + "IP(X*10^Y)/10^Y. Y in [-32,32].", /* Description */ + "TRUNCATE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1ANY | P2INT, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_UBOUND_N, /* UniqueID */ + "N = UBOUND( ... )", /* Syntax */ + "UBOUND( arrayname [, dimension] ). The upper bound of the array. " + " The dimension defaults to 1. dimension in [1,DIM(arrayname)]", /* Description */ + "UBOUND", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + B15 | E86 /* OptionVersionBitmask */ +}, +{ + F_UCASE4_A_S, /* UniqueID */ + "S$ = UCASE$( A$ )", /* Syntax */ + "The string of characters resulting from the value associated " + "with A$ by replacing each lower-case-letter in the string by " + "its upper-case version.", /* Description */ + "UCASE$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | C77 | E86 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_UNLOCK_X_N, /* UniqueID */ + "N = UNLOCK( X )", /* Syntax */ + "Unlock file number X. Causes ERROR 73.", /* Description */ + "UNLOCK", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_UNSAVE_A_N, /* UniqueID */ + "N = UNSAVE( A$ )", /* Syntax */ + "Removes the file named in A$.", /* Description */ + "UNSAVE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + D64 | G74 | H80 | G65 | G67 | D71 /* OptionVersionBitmask */ +}, +{ + F_UPPER4_A_S, /* UniqueID */ + "S$ = UPPER$( A$ )", /* Syntax */ + "The string of characters resulting from the value associated " + "with A$ by replacing each lower-case-letter in the string by " + "its upper-case version.", /* Description */ + "UPPER$", /* Name */ + StringTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_USR_N, /* UniqueID */ + "N = USR( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR0_N, /* UniqueID */ + "N = USR0( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR0", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR1_N, /* UniqueID */ + "N = USR1( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR1", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR2_N, /* UniqueID */ + "N = USR2( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR2", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR3_N, /* UniqueID */ + "N = USR3( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR3", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR4_N, /* UniqueID */ + "N = USR4( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR4", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR5_N, /* UniqueID */ + "N = USR5( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR5", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR6_N, /* UniqueID */ + "N = USR6( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR6", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR7_N, /* UniqueID */ + "N = USR7( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR7", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR8_N, /* UniqueID */ + "N = USR8( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR8", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_USR9_N, /* UniqueID */ + "N = USR9( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "USR9", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 | R86 | T80 | T79 /* OptionVersionBitmask */ +}, +{ + F_UUF_N, /* UniqueID */ + "N = UUF( ... )", /* Syntax */ + "Execute hardware program. Causes ERROR 73.", /* Description */ + "UUF", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + D73 /* OptionVersionBitmask */ +}, +{ + F_VAL_A_N, /* UniqueID */ + "N = VAL( A$ )", /* Syntax */ + "The value of the numeric-constant associated with A$, if the " + "string associated with A$ is a numeric-constant. Leading and " + "trailing spaces in the string are ignored. If the evaluation " + "of the numeric-constant would result in a value which causes " + "an underflow, then the value returned shall be zero. For example, " + "VAL( \" 123.5 \" ) = 123.5, VAL( \"2.E-99\" ) could be zero, and " + "VAL( \"MCMXVII\" ) causes an exception.", /* Description */ + "VAL", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1STR, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | S70 | C77 | D64 | E78 | E86 | G74 | H14 | HB1 | HB2 | H80 | G65 | G67 | M80 | R86 | D71 | I70 | I73 | T80 | V09 | T79 /* OptionVersionBitmask */ +}, +{ + F_VARPTR_N, /* UniqueID */ + "N = VARPTR( ... )", /* Syntax */ + "Returns hardware address of variable. Causes ERROR 73.", /* Description */ + "VARPTR", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 255, /* ParameterCount */ + PNONE, /* ParameterTypes */ + PNONE, /* ParameterTests */ + M80 /* OptionVersionBitmask */ +}, +{ + F_VTAB_X_N, /* UniqueID */ + "N = VTAB( X )", /* Syntax */ + "Savme as LOCATE X, 1.", /* Description */ + "VTAB", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + HB1 | HB2 /* OptionVersionBitmask */ +}, +{ + F_WAIT_X_N, /* UniqueID */ + "N = WAIT( X )", /* Syntax */ + "The program pauses for X times the value of OPTION SLEEP seconds. " + " If the result is zero, negative, or more than INT_MAX then WAIT " + "does nothing. The resolution is implementation defined.", /* Description */ + "WAIT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1ANY, /* ParameterTests */ + B15 | HB1 | HB2 | D71 /* OptionVersionBitmask */ +}, +{ + F_WAIT_X_Y_N, /* UniqueID */ + "N = WAIT( X, Y )", /* Syntax */ + "Waits for the value of (INP(X) AND Y) to become nonzero. Causes " + "ERROR 73.", /* Description */ + "WAIT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2BYT, /* ParameterTests */ + B15 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_WAIT_X_Y_Z_N, /* UniqueID */ + "N = WAIT( X, Y, Z )", /* Syntax */ + "Waits for the value of ((INP(X) XOR Z) AND Y) to become nonzero. " + " Causes ERROR 73.", /* Description */ + "WAIT", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 3, /* ParameterCount */ + P1NUM | P2NUM | P3NUM, /* ParameterTypes */ + P1INT | P2BYT | P3BYT, /* ParameterTests */ + B15 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_WIDTH_X_N, /* UniqueID */ + "N = WIDTH( X )", /* Syntax */ + "For console, sets the line width to X. Zero means no wrapping " + "will occur.", /* Description */ + "WIDTH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1BYT, /* ParameterTests */ + B15 | B93 | H14 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_WIDTH_X_Y_N, /* UniqueID */ + "N = WIDTH( X, Y )", /* Syntax */ + "If X = 0, sets the console width to Y.\nIf X < 0, sets the printer " + "width to Y.\nIf X is an open file number, sets the file line width " + "to Y.\nOtherwise sets the console rows to X and the line width " + "to Y.\nA value of zero for Y means no wrapping will occur.", /* Description */ + "WIDTH", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2BYT, /* ParameterTests */ + B15 | B93 | H14 | HB1 | HB2 | M80 | D71 | T80 /* OptionVersionBitmask */ +}, +{ + F_ZONE_X_N, /* UniqueID */ + "N = ZONE( X )", /* Syntax */ + "Sets the width of the print zones.", /* Description */ + "ZONE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 1, /* ParameterCount */ + P1NUM, /* ParameterTypes */ + P1INT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +{ + F_ZONE_X_Y_N, /* UniqueID */ + "N = ZONE( X, Y )", /* Syntax */ + "X is ignored. Y sets the width of the print zones.", /* Description */ + "ZONE", /* Name */ + DoubleTypeCode, /* ReturnTypeCode */ + 2, /* ParameterCount */ + P1NUM | P2NUM, /* ParameterTypes */ + P1INT | P2INT, /* ParameterTests */ + H14 /* OptionVersionBitmask */ +}, +}; + +const size_t NUM_FUNCTIONS = + sizeof (IntrinsicFunctionTable) / sizeof (IntrinsicFunctionType); + + +/* EOF */ diff --git a/bwd_six.h b/bwd_six.h new file mode 100644 index 0000000..26fd1d7 --- /dev/null +++ b/bwd_six.h @@ -0,0 +1,564 @@ +/*************************************************************** + + bwd_cmd.c Unique short names for CMS/MVS + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +/* Unique Short Name Definitions */ + + +#define Char_to_TypeCode X00000 +#define CleanLine X00001 +#define Determinant X00002 +#define DumpAllCommandHtmlTable X00003 +#define DumpAllCommandSwitchStatement X00004 +#define DumpAllCommandSyntax X00005 +#define DumpAllCommandTableDefinitions X00006 +#define DumpAllCommandUniqueID X00007 +#define DumpAllFuctionTableDefinitions X00008 +#define DumpAllFunctionHtmlTable X00009 +#define DumpAllFunctionSwitch X0000A +#define DumpAllFunctionSyntax X0000B +#define DumpAllFunctionUniqueID X0000C +#define DumpAllOperatorSyntax X0000D +#define DumpHeader X0000E +#define DumpOneCommandSyntax X0000F +#define DumpOneFunctionSyntax X00010 +#define DumpOneOperatorSyntax X00011 +#define FixDescription X00012 +#define FormatBasicNumber X00013 +#define GetOnError X00014 +#define IntrinsicCommandTable X00015 +#define IntrinsicFunctionDefinitionCheck X00016 +#define IntrinsicFunctionSyntax X00017 +#define IntrinsicFunctionTable X00018 +#define IntrinsicFunctionUniqueID X00019 +#define IntrinsicFunction_deffn X0001A +#define IntrinsicFunction_execute X0001B +#define IntrinsicFunction_find_exact X0001C +#define IntrinsicFunction_init X0001D +#define IntrinsicFunction_name X0001E +#define InvertMatrix X0001F +#define IsLastKeyword X00020 +#define IsLike X00021 +#define My X00022 +#define NUM_COMMANDS X00023 +#define NUM_FUNCTIONS X00024 +#define NUM_VERSIONS X00025 +#define NumberValueCheck X00026 +#define OptionVersionSet X00027 +#define ResetConsoleColumn X00028 +#define SetOnError X00029 +#define SortAllCommands X0002A +#define SortAllFunctions X0002B +#define SortAllOperators X0002C +#define StringLengthCheck X0002D +#define TypeCode_to_Char X0002E +#define UserFunction_add X0002F +#define UserFunction_addlocalvar X00030 +#define UserFunction_find_exact X00031 +#define UserFunction_init X00032 +#define UserFunction_name X00033 +#define VarTypeIndex X00034 +#define binary_get_put X00035 +#define buff_is_eol X00036 +#define buff_peek_EqualChar X00037 +#define buff_peek_LparenChar X00038 +#define buff_peek_QuoteChar X00039 +#define buff_peek_array_dimensions X0003A +#define buff_peek_char X0003B +#define buff_peek_word X0003C +#define buff_read_array_dimensions X0003D +#define buff_read_array_redim X0003E +#define buff_read_decimal_constant X0003F +#define buff_read_expression X00040 +#define buff_read_hexadecimal_constant X00041 +#define buff_read_index_item X00042 +#define buff_read_integer_expression X00043 +#define buff_read_label X00044 +#define buff_read_letter_sequence X00045 +#define buff_read_line_number X00046 +#define buff_read_line_sequence X00047 +#define buff_read_matrix X00048 +#define buff_read_numeric_expression X00049 +#define buff_read_octal_constant X0004A +#define buff_read_scalar X0004B +#define buff_read_string_expression X0004C +#define buff_read_type_declaration X0004D +#define buff_read_varname X0004E +#define buff_skip_AtChar X0004F +#define buff_skip_CommaChar X00050 +#define buff_skip_EqualChar X00051 +#define buff_skip_FilenumChar X00052 +#define buff_skip_LparenChar X00053 +#define buff_skip_MinusChar X00054 +#define buff_skip_PlusChar X00055 +#define buff_skip_RparenChar X00056 +#define buff_skip_SemicolonChar X00057 +#define buff_skip_StarChar X00058 +#define buff_skip_char X00059 +#define buff_skip_eol X0005A +#define buff_skip_seperator X0005B +#define buff_skip_spaces X0005C +#define buff_skip_word X0005D +#define bwb_APPEND X0005E +#define bwb_AS X0005F +#define bwb_AUTO X00060 +#define bwb_BACKSPACE X00061 +#define bwb_BREAK X00062 +#define bwb_BUILD X00063 +#define bwb_BYE X00064 +#define bwb_CALL X00065 +#define bwb_CASE X00066 +#define bwb_CASE_ELSE X00067 +#define bwb_CHAIN X00068 +#define bwb_CHANGE X00069 +#define bwb_CLEAR X0006A +#define bwb_CLOAD X0006B +#define bwb_CLOAD8 X0006C +#define bwb_CLOSE X0006D +#define bwb_CLR X0006E +#define bwb_CMDS X0006F +#define bwb_COMMON X00070 +#define bwb_CONSOLE X00071 +#define bwb_CONST X00072 +#define bwb_CONT X00073 +#define bwb_CONTINUE X00074 +#define bwb_COPY X00075 +#define bwb_CREATE X00076 +#define bwb_CSAVE X00077 +#define bwb_CSAVE8 X00078 +#define bwb_DATA X00079 +#define bwb_DEC X0007A +#define bwb_DEF X0007B +#define bwb_DEF8LBL X0007C +#define bwb_DEFBYT X0007D +#define bwb_DEFCUR X0007E +#define bwb_DEFDBL X0007F +#define bwb_DEFINT X00080 +#define bwb_DEFLNG X00081 +#define bwb_DEFSNG X00082 +#define bwb_DEFSTR X00083 +#define bwb_DELETE X00084 +#define bwb_DELIMIT X00085 +#define bwb_DIM X00086 +#define bwb_DISPLAY X00087 +#define bwb_DO X00088 +#define bwb_DOS X00089 +#define bwb_DSP X0008A +#define bwb_EDIT X0008B +#define bwb_ELSE X0008C +#define bwb_ELSEIF X0008D +#define bwb_END X0008E +#define bwb_END_FUNCTION X0008F +#define bwb_END_IF X00090 +#define bwb_END_SELECT X00091 +#define bwb_END_SUB X00092 +#define bwb_ERASE X00093 +#define bwb_EXCHANGE X00094 +#define bwb_EXIT X00095 +#define bwb_EXIT_DO X00096 +#define bwb_EXIT_FOR X00097 +#define bwb_EXIT_FUNCTION X00098 +#define bwb_EXIT_REPEAT X00099 +#define bwb_EXIT_SUB X0009A +#define bwb_EXIT_WHILE X0009B +#define bwb_FEND X0009C +#define bwb_FIELD X0009D +#define bwb_FILE X0009E +#define bwb_FILES X0009F +#define bwb_FLEX X000A0 +#define bwb_FNCS X000A1 +#define bwb_FNEND X000A2 +#define bwb_FOR X000A3 +#define bwb_FUNCTION X000A4 +#define bwb_GET X000A5 +#define bwb_GO X000A6 +#define bwb_GOODBYE X000A7 +#define bwb_GOSUB X000A8 +#define bwb_GOTO X000A9 +#define bwb_GO_SUB X000AA +#define bwb_GO_TO X000AB +#define bwb_HELP X000AC +#define bwb_IF X000AD +#define bwb_IF8THEN X000AE +#define bwb_IF_END X000AF +#define bwb_IF_MORE X000B0 +#define bwb_IMAGE X000B1 +#define bwb_INC X000B2 +#define bwb_INPUT X000B3 +#define bwb_INPUT_LINE X000B4 +#define bwb_LET X000B5 +#define bwb_LINE X000B6 +#define bwb_LINE_INPUT X000B7 +#define bwb_LIST X000B8 +#define bwb_LISTNH X000B9 +#define bwb_LLIST X000BA +#define bwb_LOAD X000BB +#define bwb_LOCAL X000BC +#define bwb_LOOP X000BD +#define bwb_LPRINT X000BE +#define bwb_LPRINTER X000BF +#define bwb_LPT X000C0 +#define bwb_LSET X000C1 +#define bwb_MAINTAINER X000C2 +#define bwb_MAINTAINER_CMDS X000C3 +#define bwb_MAINTAINER_CMDS_HTML X000C4 +#define bwb_MAINTAINER_CMDS_ID X000C5 +#define bwb_MAINTAINER_CMDS_MANUAL X000C6 +#define bwb_MAINTAINER_CMDS_SWITCH X000C7 +#define bwb_MAINTAINER_CMDS_TABLE X000C8 +#define bwb_MAINTAINER_DEBUG X000C9 +#define bwb_MAINTAINER_DEBUG_OFF X000CA +#define bwb_MAINTAINER_DEBUG_ON X000CB +#define bwb_MAINTAINER_FNCS X000CC +#define bwb_MAINTAINER_FNCS_HTML X000CD +#define bwb_MAINTAINER_FNCS_ID X000CE +#define bwb_MAINTAINER_FNCS_MANUAL X000CF +#define bwb_MAINTAINER_FNCS_SWITCH X000D0 +#define bwb_MAINTAINER_FNCS_TABLE X000D1 +#define bwb_MAINTAINER_MANUAL X000D2 +#define bwb_MAINTAINER_STACK X000D3 +#define bwb_MARGIN X000D4 +#define bwb_MAT X000D5 +#define bwb_MAT_GET X000D6 +#define bwb_MAT_INPUT X000D7 +#define bwb_MAT_PRINT X000D8 +#define bwb_MAT_PUT X000D9 +#define bwb_MAT_READ X000DA +#define bwb_MAT_WRITE X000DB +#define bwb_MERGE X000DC +#define bwb_MID4 X000DD +#define bwb_MON X000DE +#define bwb_NAME X000DF +#define bwb_NEW X000E0 +#define bwb_NEXT X000E1 +#define bwb_OF X000E2 +#define bwb_OLD X000E3 +#define bwb_ON X000E4 +#define bwb_ON_ERROR X000E5 +#define bwb_ON_ERROR_GOSUB X000E6 +#define bwb_ON_ERROR_GOTO X000E7 +#define bwb_ON_ERROR_RESUME X000E8 +#define bwb_ON_ERROR_RESUME_NEXT X000E9 +#define bwb_ON_ERROR_RETURN X000EA +#define bwb_ON_ERROR_RETURN_NEXT X000EB +#define bwb_ON_TIMER X000EC +#define bwb_OPEN X000ED +#define bwb_OPTION X000EE +#define bwb_OPTION_ANGLE X000EF +#define bwb_OPTION_ANGLE_DEGREES X000F0 +#define bwb_OPTION_ANGLE_GRADIANS X000F1 +#define bwb_OPTION_ANGLE_RADIANS X000F2 +#define bwb_OPTION_ARITHMETIC X000F3 +#define bwb_OPTION_ARITHMETIC_DECIMAL X000F4 +#define bwb_OPTION_ARITHMETIC_FIXED X000F5 +#define bwb_OPTION_ARITHMETIC_NATIVE X000F6 +#define bwb_OPTION_BASE X000F7 +#define bwb_OPTION_BUGS X000F8 +#define bwb_OPTION_BUGS_BOOLEAN X000F9 +#define bwb_OPTION_BUGS_OFF X000FA +#define bwb_OPTION_BUGS_ON X000FB +#define bwb_OPTION_COMPARE X000FC +#define bwb_OPTION_COMPARE_BINARY X000FD +#define bwb_OPTION_COMPARE_DATABASE X000FE +#define bwb_OPTION_COMPARE_TEXT X000FF +#define bwb_OPTION_COVERAGE X00100 +#define bwb_OPTION_COVERAGE_OFF X00101 +#define bwb_OPTION_COVERAGE_ON X00102 +#define bwb_OPTION_DATE X00103 +#define bwb_OPTION_DIGITS X00104 +#define bwb_OPTION_DISABLE X00105 +#define bwb_OPTION_DISABLE_COMMAND X00106 +#define bwb_OPTION_DISABLE_FUNCTION X00107 +#define bwb_OPTION_DISABLE_OPERATOR X00108 +#define bwb_OPTION_EDIT X00109 +#define bwb_OPTION_ENABLE X0010A +#define bwb_OPTION_ENABLE_COMMAND X0010B +#define bwb_OPTION_ENABLE_FUNCTION X0010C +#define bwb_OPTION_ENABLE_OPERATOR X0010D +#define bwb_OPTION_ERROR X0010E +#define bwb_OPTION_ERROR_GOSUB X0010F +#define bwb_OPTION_ERROR_GOTO X00110 +#define bwb_OPTION_EXPLICIT X00111 +#define bwb_OPTION_EXTENSION X00112 +#define bwb_OPTION_FILES X00113 +#define bwb_OPTION_IMPLICIT X00114 +#define bwb_OPTION_INDENT X00115 +#define bwb_OPTION_LABELS X00116 +#define bwb_OPTION_LABELS_OFF X00117 +#define bwb_OPTION_LABELS_ON X00118 +#define bwb_OPTION_PROMPT X00119 +#define bwb_OPTION_PUNCT X0011A +#define bwb_OPTION_PUNCT_AT X0011B +#define bwb_OPTION_PUNCT_BYTE X0011C +#define bwb_OPTION_PUNCT_COMMENT X0011D +#define bwb_OPTION_PUNCT_CURRENCY X0011E +#define bwb_OPTION_PUNCT_DOUBLE X0011F +#define bwb_OPTION_PUNCT_FILENUM X00120 +#define bwb_OPTION_PUNCT_IMAGE X00121 +#define bwb_OPTION_PUNCT_INPUT X00122 +#define bwb_OPTION_PUNCT_INTEGER X00123 +#define bwb_OPTION_PUNCT_LONG X00124 +#define bwb_OPTION_PUNCT_LPAREN X00125 +#define bwb_OPTION_PUNCT_PRINT X00126 +#define bwb_OPTION_PUNCT_QUOTE X00127 +#define bwb_OPTION_PUNCT_RPAREN X00128 +#define bwb_OPTION_PUNCT_SINGLE X00129 +#define bwb_OPTION_PUNCT_STATEMENT X0012A +#define bwb_OPTION_PUNCT_STRING X0012B +#define bwb_OPTION_RECLEN X0012C +#define bwb_OPTION_RENUM X0012D +#define bwb_OPTION_ROUND X0012E +#define bwb_OPTION_ROUND_BANK X0012F +#define bwb_OPTION_ROUND_MATH X00130 +#define bwb_OPTION_ROUND_TRUNCATE X00131 +#define bwb_OPTION_SCALE X00132 +#define bwb_OPTION_SLEEP X00133 +#define bwb_OPTION_STDERR X00134 +#define bwb_OPTION_STDIN X00135 +#define bwb_OPTION_STDOUT X00136 +#define bwb_OPTION_STRICT X00137 +#define bwb_OPTION_STRICT_OFF X00138 +#define bwb_OPTION_STRICT_ON X00139 +#define bwb_OPTION_TERMINAL X0013A +#define bwb_OPTION_TERMINAL_ADM X0013B +#define bwb_OPTION_TERMINAL_ANSI X0013C +#define bwb_OPTION_TERMINAL_NONE X0013D +#define bwb_OPTION_TIME X0013E +#define bwb_OPTION_TRACE X0013F +#define bwb_OPTION_TRACE_OFF X00140 +#define bwb_OPTION_TRACE_ON X00141 +#define bwb_OPTION_USING X00142 +#define bwb_OPTION_USING_ALL X00143 +#define bwb_OPTION_USING_COMMA X00144 +#define bwb_OPTION_USING_DIGIT X00145 +#define bwb_OPTION_USING_DOLLAR X00146 +#define bwb_OPTION_USING_EXRAD X00147 +#define bwb_OPTION_USING_FILLER X00148 +#define bwb_OPTION_USING_FIRST X00149 +#define bwb_OPTION_USING_LENGTH X0014A +#define bwb_OPTION_USING_LITERAL X0014B +#define bwb_OPTION_USING_MINUS X0014C +#define bwb_OPTION_USING_PERIOD X0014D +#define bwb_OPTION_USING_PLUS X0014E +#define bwb_OPTION_VERSION X0014F +#define bwb_OPTION_ZONE X00150 +#define bwb_PAUSE X00151 +#define bwb_PDEL X00152 +#define bwb_POP X00153 +#define bwb_PRINT X00154 +#define bwb_PTP X00155 +#define bwb_PTR X00156 +#define bwb_PUT X00157 +#define bwb_QUIT X00158 +#define bwb_READ X00159 +#define bwb_RECALL X0015A +#define bwb_REM X0015B +#define bwb_RENAME X0015C +#define bwb_RENUM X0015D +#define bwb_RENUMBER X0015E +#define bwb_REPEAT X0015F +#define bwb_REPLACE X00160 +#define bwb_RESET X00161 +#define bwb_RESTORE X00162 +#define bwb_RESUME X00163 +#define bwb_RETURN X00164 +#define bwb_RSET X00165 +#define bwb_RUN X00166 +#define bwb_RUNNH X00167 +#define bwb_SAVE X00168 +#define bwb_SCRATCH X00169 +#define bwb_SELECT X0016A +#define bwb_SELECT_CASE X0016B +#define bwb_STEP X0016C +#define bwb_STOP X0016D +#define bwb_STORE X0016E +#define bwb_SUB X0016F +#define bwb_SUBEND X00170 +#define bwb_SUBEXIT X00171 +#define bwb_SUB_END X00172 +#define bwb_SUB_EXIT X00173 +#define bwb_SWAP X00174 +#define bwb_SYSTEM X00175 +#define bwb_TEXT X00176 +#define bwb_THEN X00177 +#define bwb_TIMER X00178 +#define bwb_TIMER_OFF X00179 +#define bwb_TIMER_ON X0017A +#define bwb_TIMER_STOP X0017B +#define bwb_TLOAD X0017C +#define bwb_TO X0017D +#define bwb_TRACE X0017E +#define bwb_TRACE_OFF X0017F +#define bwb_TRACE_ON X00180 +#define bwb_TSAVE X00181 +#define bwb_TTY X00182 +#define bwb_TTY_IN X00183 +#define bwb_TTY_OUT X00184 +#define bwb_UNTIL X00185 +#define bwb_USE X00186 +#define bwb_VARS X00187 +#define bwb_WEND X00188 +#define bwb_WHILE X00189 +#define bwb_WRITE X0018A +#define bwb_clrexec X0018B +#define bwb_decexec X0018C +#define bwb_execline X0018D +#define bwb_fclose X0018E +#define bwb_file_open X0018F +#define bwb_fload X00190 +#define bwb_freeline X00191 +#define bwb_incexec X00192 +#define bwb_is_eof X00193 +#define bwb_isalnum X00194 +#define bwb_isalpha X00195 +#define bwb_iscntrl X00196 +#define bwb_isdigit X00197 +#define bwb_isgraph X00198 +#define bwb_islower X00199 +#define bwb_isprint X0019A +#define bwb_ispunct X0019B +#define bwb_isspace X0019C +#define bwb_isupper X0019D +#define bwb_isxdigit X0019E +#define bwb_mainloop X0019F +#define bwb_memchr X001A0 +#define bwb_memcmp X001A1 +#define bwb_memcpy X001A2 +#define bwb_memmove X001A3 +#define bwb_memset X001A4 +#define bwb_option_punct_char X001A5 +#define bwb_option_range_integer X001A6 +#define bwb_rint X001A7 +#define bwb_scan X001A8 +#define bwb_strcat X001A9 +#define bwb_strchr X001AA +#define bwb_strcmp X001AB +#define bwb_strcpy X001AC +#define bwb_strdup X001AD +#define bwb_strdup2 X001AE +#define bwb_stricmp X001AF +#define bwb_strlen X001B0 +#define bwb_strncat X001B1 +#define bwb_strncmp X001B2 +#define bwb_strncpy X001B3 +#define bwb_strnicmp X001B4 +#define bwb_strrchr X001B5 +#define bwb_tolower X001B6 +#define bwb_toupper X001B7 +#define bwb_vector X001B8 +#define bwb_vertable X001B9 +#define bwb_xnew X001BA +#define bwx_CLS X001BB +#define bwx_COLOR X001BC +#define bwx_Error X001BD +#define bwx_LOCATE X001BE +#define bwx_STOP X001BF +#define bwx_TIMER X001C0 +#define bwx_input X001C1 +#define bwx_terminate X001C2 +#define clear_virtual_by_file X001C3 +#define field_close_file X001C4 +#define field_free_variable X001C5 +#define field_get X001C6 +#define field_put X001C7 +#define file_clear X001C8 +#define file_new X001C9 +#define file_next_number X001CA +#define find_file_by_name X001CB +#define find_file_by_number X001CC +#define find_line_number X001CD +#define is_empty_string X001CE +#define line_is_eol X001CF +#define line_peek_EqualChar X001D0 +#define line_peek_LparenChar X001D1 +#define line_peek_QuoteChar X001D2 +#define line_peek_array_dimensions X001D3 +#define line_peek_char X001D4 +#define line_peek_word X001D5 +#define line_read_array_dimensions X001D6 +#define line_read_array_redim X001D7 +#define line_read_expression X001D8 +#define line_read_index_item X001D9 +#define line_read_integer_expression X001DA +#define line_read_label X001DB +#define line_read_letter_sequence X001DC +#define line_read_line_number X001DD +#define line_read_line_sequence X001DE +#define line_read_matrix X001DF +#define line_read_numeric_expression X001E0 +#define line_read_scalar X001E1 +#define line_read_string_expression X001E2 +#define line_read_type_declaration X001E3 +#define line_read_varname X001E4 +#define line_skip_AtChar X001E5 +#define line_skip_CommaChar X001E6 +#define line_skip_EqualChar X001E7 +#define line_skip_FilenumChar X001E8 +#define line_skip_LparenChar X001E9 +#define line_skip_MinusChar X001EA +#define line_skip_PlusChar X001EB +#define line_skip_RparenChar X001EC +#define line_skip_SemicolonChar X001ED +#define line_skip_StarChar X001EE +#define line_skip_char X001EF +#define line_skip_eol X001F0 +#define line_skip_seperator X001F1 +#define line_skip_spaces X001F2 +#define line_skip_word X001F3 +#define line_start X001F4 +#define mat_find X001F5 +#define str_btob X001F6 +#define str_cmp X001F7 +#define str_match X001F8 +#define var_CLEAR X001F9 +#define var_chain X001FA +#define var_delcvars X001FB +#define var_find X001FC +#define var_free X001FD +#define var_get X001FE +#define var_init X001FF +#define var_make X00200 +#define var_nametype X00201 +#define var_new X00202 +#define var_set X00203 + + +/* EOF */ diff --git a/bwx_tty.c b/bwx_tty.c new file mode 100644 index 0000000..08607ab --- /dev/null +++ b/bwx_tty.c @@ -0,0 +1,137 @@ +/*************************************************************** + + bwx_tty.c TTY front-end + for Bywater BASIC Interpreter + + Copyright (c) 1993, Ted A. Campbell + Bywater Software + + email: tcamp@delphi.com + + Copyright and Permissions Information: + + All U.S. and international rights are claimed by the author, + Ted A. Campbell. + + This software is released under the terms of the GNU General + Public License (GPL), which is distributed with this software + in the file "COPYING". The GPL specifies the terms under + which users may copy and use the software in this distribution. + + A separate license is available for commercial distribution, + for information on which you should contact the author. + +***************************************************************/ + +/*---------------------------------------------------------------*/ +/* NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, */ +/* 11/1995 (eidetics@cerf.net). */ +/* */ +/* Those additionally marked with "DD" were at the suggestion of */ +/* Dale DePriest (daled@cadence.com). */ +/* */ +/* Version 3.00 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.10 by Howard Wulf, AF5NE */ +/* */ +/* Version 3.20 by Howard Wulf, AF5NE */ +/* */ +/*---------------------------------------------------------------*/ + + + +#include "bwbasic.h" + + +extern void +bwx_LOCATE (int Row, int Col) +{ + /* position the cursor to Row and Col */ + /* Row is 1 based, 1..24 */ + /* Col is 1 based, 1..80 */ + assert (My != NULL); + assert (My->SYSOUT != NULL); + assert (My->SYSOUT->cfp != NULL); + + + if (Row < 1 || Col < 1) + { + WARN_ILLEGAL_FUNCTION_CALL; + return; + } + switch (My->OptionTerminalType) + { + case C_OPTION_TERMINAL_NONE: + break; + case C_OPTION_TERMINAL_ADM: + fprintf (My->SYSOUT->cfp, "%c=%c%c", 27, Row + 32, Col + 32); + break; + case C_OPTION_TERMINAL_ANSI: + fprintf (My->SYSOUT->cfp, "%c[%d;%dH", 27, Row, Col); + break; + default: + WARN_ADVANCED_FEATURE; + break; + } + fflush (My->SYSOUT->cfp); + My->SYSOUT->row = Row; + My->SYSOUT->col = Col; +} + +extern void +bwx_CLS (void) +{ + /* clear screen */ + assert (My != NULL); + assert (My->SYSOUT != NULL); + assert (My->SYSOUT->cfp != NULL); + switch (My->OptionTerminalType) + { + case C_OPTION_TERMINAL_NONE: + break; + case C_OPTION_TERMINAL_ADM: + fprintf (My->SYSOUT->cfp, "%c", 26); + break; + case C_OPTION_TERMINAL_ANSI: + fprintf (My->SYSOUT->cfp, "%c[2J", 27); + break; + default: + WARN_ADVANCED_FEATURE; + break; + } + bwx_LOCATE (1, 1); +} + +extern void +bwx_COLOR (int Fore, int Back) +{ + /* set foreground and background color */ + /* Fore is 0 based, 0..15 */ + /* Back is 0 based, 0..15 */ + assert (My != NULL); + assert (My->SYSOUT != NULL); + assert (My->SYSOUT->cfp != NULL); + if (Fore < 0 || Back < 0) + { + WARN_ILLEGAL_FUNCTION_CALL; + return; + } + switch (My->OptionTerminalType) + { + case C_OPTION_TERMINAL_NONE: + break; + case C_OPTION_TERMINAL_ADM: + break; + case C_OPTION_TERMINAL_ANSI: + fprintf (My->SYSOUT->cfp, "%c[%d;%dm", 27, 30 + Fore, 40 + Back); + break; + default: + WARN_ADVANCED_FEATURE; + break; + } + fflush (My->SYSOUT->cfp); +} + + + +/* EOF */ diff --git a/cms.bas b/cms.bas new file mode 100644 index 0000000..b157233 --- /dev/null +++ b/cms.bas @@ -0,0 +1,108 @@ +rem Purpose: re-define externals to only 6 characters for CMS +rem Author: Howard Wulf, AF5NE +rem Date: 2015-02-10 +rem Usage: implementation defined +rem Example: +rem ~/bwbasic cms.bas +rem +rem ------------------------------------------------------------------------------- +rem File File Name IN/OUT Description +rem #1 "bwbasic.h" INPUT read looking for "extern" statements +rem #2 "cms.h" OUTPUT written with "#define" statements +rem ------------------------------------------------------------------------------- +rem Variable Description +rem N The number of "extern" statements so far processed +rem E$ The constant value "extern " +rem E The length of E$ +rem L$ The input line read from "bwbasic.h" +rem M$ The next line from "bwbasic.h" when L$ does not contain a semicolon +rem X The location of special characters in L$ +rem H$ The hexadecimal value of N +rem ------------------------------------------------------------------------------- +rem +let N = 0 +let E$ = "extern " +let E = len( E$ ) +open "bwbasic.h" for input as #1 +open "cms.txt" for output as #2 +while not eof( #1 ) + line input #1, L$ + L$ = trim$( L$ ) + if left$( L$, E ) = E$ then + rem extern .... + while instr( L$, ";" ) = 0 + ' read more lines until we get a semicolon + line input #1, M$ + M$ = trim$( M$ ) + L$ = L$ + " " + M$ + wend + rem extern ...; + L$ = trim$(mid$( L$, E + 1 )) + ' truncate trailing semicolon + X = instr( L$, ";" ) + if X > 0 then + L$ = trim$(left$( L$, X - 1 )) + end if + ' truncate trailing parenthesis + X = instr( L$, "(" ) + if X > 0 then + L$ = trim$(left$( L$, X - 1 )) + end if + ' truncate trailing bracket + X = instr( L$, "[" ) + if X > 0 then + L$ = trim$(left$( L$, X - 1 )) + end if + ' find the last word + X = instr(L$, " " ) + while X > 0 + L$ = trim$(mid$( L$, X + 1 )) + X = instr(L$, " " ) + wend + ' skip leading asterick + while left$( L$, 1 ) = "*" + L$ = trim$(mid$( L$, 2 )) + wend + if L$ = "main" or L$ = "putenv" or L$="sleep" then + ' ignore magic function name + else + ' pad for alignment + REM L$ = L$ + space$(32) + REM L$ = left$( L$, 32 ) + REM H$ = "00000" + hex$(N) + REM H$ = right$( H$, 5 ) + REM print #2, "#define ";L$;" X";H$ + REM N = N + 1 + if len( L$ ) > 0 then + print #2, L$ + end if + end if + end if +wend +close #2 +close #1 +REM sort before assigning value +if shell( "sort < cms.txt > cms.out" ) = 0 then + N = 0 + open "cms.out" for input as #1 + open "cms.h" for output as #2 + while not eof(#1) + line input #1, L$ + L$ = trim$(L$) + if len(L$) then + ' pad for alignment + L$ = L$ + space$(32) + L$ = left$( L$, 32 ) + H$ = "00000" + hex$(N) + H$ = right$( H$, 5 ) + print #2, "#define ";L$;" X";H$ + N = N + 1 + end if + wend + close #2 + close #1 + rem Cleanup temporary files + kill "cms.txt" + kill "cms.out" +end if +end diff --git a/compile.bat b/compile.bat new file mode 100644 index 0000000..4a59e47 --- /dev/null +++ b/compile.bat @@ -0,0 +1,23 @@ +del bwbasic.exe +del *.o +del *.obj + +call stdcomp bwbasic.c +call stdcomp bwb_int.c +call stdcomp bwb_tbl.c +call stdcomp bwb_cmd.c +call stdcomp bwb_prn.c +call stdcomp bwb_exp.c +call stdcomp bwb_var.c +call stdcomp bwb_inp.c +call stdcomp bwb_fnc.c +call stdcomp bwb_cnd.c +call stdcomp bwb_dio.c +call stdcomp bwb_str.c +call stdcomp bwb_stc.c +call stdcomp bwx_tty.c +call stdcomp bwd_cmd.c +call stdcomp bwd_fun.c + +rem gcc -mno-cygwin -s -o bwbasic.exe *.o +bcc32 -O -ebwbasic.exe *.obj diff --git a/compile.exec b/compile.exec new file mode 100644 index 0000000..b52178b --- /dev/null +++ b/compile.exec @@ -0,0 +1,65 @@ +* Usage - COMPILE + +* This script compiles all the files on SRC disk (default is A) +* and copies the resultant modules to the EXE disk (default B) + +&SRC = A +&EXE = B + + +&IF &INDEX EQ 0 &GOTO -FINARGS +&SRC = &1 +&ARGS &2 &3 &4 &5 &6 &7 &8 &9 + +&IF &INDEX EQ 0 &GOTO -FINARGS +&EXE = &1 + +-FINARGS + + +EXEC GCCE BWBASIC C &SRC (PARM STDBWB +EXEC GCCE BWB_INT C &SRC (PARM STDBWB +EXEC GCCE BWB_TBL C &SRC (PARM STDBWB +EXEC GCCE BWB_CMD C &SRC (PARM STDBWB +EXEC GCCE BWB_PRN C &SRC (PARM STDBWB +EXEC GCCE BWB_EXP C &SRC (PARM STDBWB +EXEC GCCE BWB_VAR C &SRC (PARM STDBWB +EXEC GCCE BWB_INP C &SRC (PARM STDBWB +EXEC GCCE BWB_FNC C &SRC (PARM STDBWB +EXEC GCCE BWB_CND C &SRC (PARM STDBWB +EXEC GCCE BWB_DIO C &SRC (PARM STDBWB +EXEC GCCE BWB_STR C &SRC (PARM STDBWB +EXEC GCCE BWB_STC C &SRC (PARM STDBWB +EXEC GCCE BWX_TTY C &SRC (PARM STDBWB +EXEC GCCE BWD_CMD C &SRC (PARM STDBWB +EXEC GCCE BWD_FUN C &SRC (PARM STDBWB +EXEC GCCE UNIXIO C &SRC (PARM STDBWB + + +&STACK HT +LOAD BWBASIC (NOAUTO +INCLUDE BWB_INT (NOAUTO +INCLUDE BWB_TBL (NOAUTO +INCLUDE BWB_CMD (NOAUTO +INCLUDE BWB_PRN (NOAUTO +INCLUDE BWB_EXP (NOAUTO +INCLUDE BWB_VAR (NOAUTO +INCLUDE BWB_INP (NOAUTO +INCLUDE BWB_FNC (NOAUTO +INCLUDE BWB_CND (NOAUTO +INCLUDE BWB_DIO (NOAUTO +INCLUDE BWB_STR (NOAUTO +INCLUDE BWB_STC (NOAUTO +INCLUDE BWX_TTY (NOAUTO +INCLUDE BWD_CMD (NOAUTO +INCLUDE BWD_FUN (NOAUTO +&STACK RT +INCLUDE UNIXIO (NOAUTO + +GENMOD BWBASIC +COPY BWBASIC MODULE &SRC = = &EXE (REPLACE +COPY PROFILE BAS &SRC = = &EXE (REPLACE + + +* Quick test of bwbasic +BWBASIC "EXAMPLE BAS" diff --git a/config.status b/config.status new file mode 100755 index 0000000..3da220d --- /dev/null +++ b/config.status @@ -0,0 +1,55 @@ +#!/bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host texto-plano.xyz: +# +# configure + +for arg +do + case "$arg" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + exec /bin/sh configure ;; + *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; + esac +done + +trap 'rm -f Makefile; exit 1' 1 3 15 +CC='gcc' +CPP='${CC-cc} -E' +INSTALL='/usr/bin/install -c' +INSTALL_PROGRAM='$(INSTALL)' +INSTALL_DATA='$(INSTALL) -m 644' +LIBS='' +srcdir='.' +DEFS=' -DHAVE_STRING=1 -DHAVE_STDLIB=1 -DHAVE_UNISTD=1 -DHAVE_RAISE=1' +prefix='' +exec_prefix='' +prsub='' + +top_srcdir=$srcdir +for file in .. Makefile; do if [ "x$file" != "x.." ]; then + srcdir=$top_srcdir + # Remove last slash and all that follows it. Not all systems have dirname. + dir=`echo $file|sed 's%/[^/][^/]*$%%'` + if test "$dir" != "$file"; then + test "$top_srcdir" != . && srcdir=$top_srcdir/$dir + test ! -d $dir && mkdir $dir + fi + echo creating $file + rm -f $file + echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file + sed -e " +$prsub +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@INSTALL@%$INSTALL%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@LIBS@%$LIBS%g +s%@srcdir@%$srcdir%g +s%@DEFS@%$DEFS% +" $top_srcdir/${file}.in >> $file +fi; done + diff --git a/configure b/configure new file mode 100644 index 0000000..173df74 --- /dev/null +++ b/configure @@ -0,0 +1,317 @@ +#!/bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf. +# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create] +# [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET] +# Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and +# --with-PACKAGE unless this script has special code to handle it. + +##---------------------------------------------------------------## +## NOTE: Modifications marked "JBV" were made by Jon B. Volkoff, ## +## 11/1995 (eidetics@cerf.net). ## +##---------------------------------------------------------------## + +for arg +do + # Handle --exec-prefix with a space before the argument. + if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix= + # Handle --host with a space before the argument. + elif test x$next_host = xyes; then next_host= + # Handle --prefix with a space before the argument. + elif test x$next_prefix = xyes; then prefix=$arg; next_prefix= + # Handle --srcdir with a space before the argument. + elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir= + else + case $arg in + # For backward compatibility, also recognize exact --exec_prefix. + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*) + exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e) + next_exec_prefix=yes ;; + + -gas | --gas | --ga | --g) ;; + + -host=* | --host=* | --hos=* | --ho=* | --h=*) ;; + -host | --host | --hos | --ho | --h) + next_host=yes ;; + + -nfp | --nfp | --nf) ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no) + no_create=1 ;; + + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + next_prefix=yes ;; + + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*) + srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s) + next_srcdir=yes ;; + + -with-* | --with-*) + package=`echo $arg|sed 's/-*with-//'` + # Delete all the valid chars; see if any are left. + if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then + echo "configure: $package: invalid package name" >&2; exit 1 + fi + eval "with_`echo $package|sed s/-/_/g`=1" ;; + + *) ;; + esac + fi +done + +trap 'rm -f conftest* core; exit 1' 1 3 15 + +rm -f conftest* +compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +unique_file=bwb_cmd.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + srcdirdefaulted=yes + # Try the directory containing this script, then `..'. + prog=$0 + confdir=`echo $prog|sed 's%/[^/][^/]*$%%'` + test "X$confdir" = "X$prog" && confdir=. + srcdir=$confdir + if test ! -r $srcdir/$unique_file; then + srcdir=.. + fi +fi +if test ! -r $srcdir/$unique_file; then + if test x$srcdirdefaulted = xyes; then + echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2 + else + echo "configure: Can not find sources in \`${srcdir}'." 1>&2 + fi + exit 1 +fi +# Preserve a srcdir of `.' to avoid automounter screwups with pwd. +# But we can't avoid them for `..', to make subdirectories work. +case $srcdir in + .|/*|~*) ;; + *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute. +esac + +if test -z "$CC"; then + echo checking for gcc + saveifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc; then + CC="gcc" + break + fi + done + IFS="$saveifs" +fi +test -z "$CC" && CC="cc" + +# Find out if we are using GNU C, under whatever name. +cat > conftest.c < conftest.out 2>&1 +if egrep yes conftest.out >/dev/null 2>&1; then + GCC=1 # For later tests. +fi +rm -f conftest* + +echo checking how to run the C preprocessor +if test -z "$CPP"; then + CPP='${CC-cc} -E' + cat > conftest.c < +EOF +err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +if test -z "$err"; then + : +else + CPP=/lib/cpp +fi +rm -f conftest* +fi + +# Make sure to not get the incompatible SysV /etc/install and +# /usr/sbin/install, which might be in PATH before a BSD-like install, +# or the SunOS /usr/etc/install directory, or the AIX /bin/install, +# or the AFS install, which mishandles nonexistent args. (Sigh.) +if test -z "$INSTALL"; then + echo checking for install + saveifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + test -z "$dir" && dir=. + case $dir in + /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;; + *) + if test -f $dir/install; then + if grep dspmsg $dir/install >/dev/null 2>&1; then + : # AIX + else + INSTALL="$dir/install -c" + INSTALL_PROGRAM='$(INSTALL)' + INSTALL_DATA='$(INSTALL) -m 644' + break + fi + fi + ;; + esac + done + IFS="$saveifs" +fi +INSTALL=${INSTALL-cp} +INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'} +INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'} + +echo checking for size_t in sys/types.h +echo '#include ' > conftest.c +eval "$CPP $DEFS conftest.c > conftest.out 2>&1" +if egrep "size_t" conftest.out >/dev/null 2>&1; then + : +else + DEFS="$DEFS -Dsize_t=unsigned" +fi +rm -f conftest* + +echo checking for string.h +cat > conftest.c < +EOF +err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +if test -z "$err"; then + DEFS="$DEFS -DHAVE_STRING=1" +fi +rm -f conftest* + +echo checking for stdlib.h +cat > conftest.c < +EOF +err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +if test -z "$err"; then + DEFS="$DEFS -DHAVE_STDLIB=1" +fi +rm -f conftest* + +# unistd.h checking added by JBV +echo checking for unistd.h +cat > conftest.c < +EOF +err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"` +if test -z "$err"; then + DEFS="$DEFS -DHAVE_UNISTD=1" +fi +rm -f conftest* + +echo checking for raise +cat > conftest.c < +#include +main() { exit(0); } +t() { raise(1); } +EOF +if eval $compile; then + DEFS="$DEFS -DHAVE_RAISE=1" +fi +rm -f conftest* + +if test -n "$prefix"; then + test -z "$exec_prefix" && exec_prefix='${prefix}' + prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" +fi +if test -n "$exec_prefix"; then + prsub="$prsub +s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%\ +exec_prefix\\1=\\2$exec_prefix%" +fi + +trap 'rm -f config.status; exit 1' 1 3 15 +echo creating config.status +rm -f config.status +cat > config.status </dev/null`: +# +# $0 $* + +for arg +do + case "\$arg" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + exec /bin/sh $0 $* ;; + *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; + esac +done + +trap 'rm -f Makefile; exit 1' 1 3 15 +CC='$CC' +CPP='$CPP' +INSTALL='$INSTALL' +INSTALL_PROGRAM='$INSTALL_PROGRAM' +INSTALL_DATA='$INSTALL_DATA' +LIBS='$LIBS' +srcdir='$srcdir' +DEFS='$DEFS' +prefix='$prefix' +exec_prefix='$exec_prefix' +prsub='$prsub' +EOF +cat >> config.status <<\EOF + +top_srcdir=$srcdir +for file in .. Makefile; do if [ "x$file" != "x.." ]; then + srcdir=$top_srcdir + # Remove last slash and all that follows it. Not all systems have dirname. + dir=`echo $file|sed 's%/[^/][^/]*$%%'` + if test "$dir" != "$file"; then + test "$top_srcdir" != . && srcdir=$top_srcdir/$dir + test ! -d $dir && mkdir $dir + fi + echo creating $file + rm -f $file + echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file + sed -e " +$prsub +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@INSTALL@%$INSTALL%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@LIBS@%$LIBS%g +s%@srcdir@%$srcdir%g +s%@DEFS@%$DEFS% +" $top_srcdir/${file}.in >> $file +fi; done + +EOF +chmod +x config.status +test -n "$no_create" || ./config.status + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..8baa146 --- /dev/null +++ b/configure.in @@ -0,0 +1,12 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(bwb_cmd.c) +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_SIZE_T +AC_HEADER_CHECK(string.h, AC_DEFINE(HAVE_STRING)) +AC_HEADER_CHECK(stdlib.h, AC_DEFINE(HAVE_STDLIB)) +AC_HEADER_CHECK(unistd.h, AC_DEFINE(HAVE_UNISTD)) +AC_COMPILE_CHECK(raise, [#include +#include ], [raise(1);], AC_DEFINE(HAVE_RAISE)) +AC_OUTPUT(Makefile) diff --git a/example.bas b/example.bas new file mode 100644 index 0000000..981fe13 --- /dev/null +++ b/example.bas @@ -0,0 +1,6 @@ + x = 1 + print "hello, world",x + x = 2 + print "hello, world",x + end + diff --git a/makefile.qcl b/makefile.qcl new file mode 100644 index 0000000..c236876 --- /dev/null +++ b/makefile.qcl @@ -0,0 +1,60 @@ +# Microsoft QuickC Makefile for Bywater BASIC Interpreter +# +# This makefile is for line-oriented QuickC only, not for +# the QuickC integrated environment. To make the program: +# type "nmake -f makefile.qcl". +# +# 2015-04-25 Updated for version 3.00 by Howard Wulf, AF5NE +# +PROJ= bwbasic +CC= qcl + +# +# These are the normal flags I used to compile bwBASIC: +# +CFLAGS= -O -AL -W3 -Za -DHAVE_MSDOS +# +# The following flags can be used for debugging: +# +#CFLAGS= -Od -AL -W3 -Za -Zr -Zi -DHAVE_MSDOS + +LFLAGS= /NOE /ST:8192 + +OFILES= bwbasic.obj bwb_cmd.obj bwb_cnd.obj bwb_dio.obj\ + bwb_exp.obj bwb_fnc.obj bwb_inp.obj bwb_int.obj\ + bwb_prn.obj bwb_stc.obj bwb_str.obj bwb_tbl.obj\ + bwb_var.obj bwd_cmd.obj bwd_fun.obj bwx_tty.obj + +HFILES= bwbasic.h + +all: $(PROJ).exe + +$(OFILES): $(HFILES) makefile.qcl + +$(PROJ).exe: $(OFILES) + echo >NUL @<<$(PROJ).crf +bwbasic.obj + +bwb_cmd.obj + +bwb_cnd.obj + +bwb_dio.obj + +bwb_exp.obj + +bwb_fnc.obj + +bwb_inp.obj + +bwb_int.obj + +bwb_prn.obj + +bwb_stc.obj + +bwb_str.obj + +bwb_tbl.obj + +bwb_var.obj + +bwd_cmd.obj + +bwd_fun.obj + +bwx_tty.obj + +$(OBJS_EXT) +$(PROJ).exe + +$(LIBS_EXT); +<< + link $(LFLAGS) @$(PROJ).crf + erase $(PROJ).crf + +# EOF diff --git a/makefile.wcl386 b/makefile.wcl386 new file mode 100644 index 0000000..4c86457 --- /dev/null +++ b/makefile.wcl386 @@ -0,0 +1,96 @@ +# Open Watcom C (http://www.openwatcom.org) Makefile +# for Bywater BASIC Interpreter +# +# Adapted from makefile.qcl +# by Bill Chatfield +# +# 2015-04-25 Updated for version 3.00 by Howard Wulf, AF5NE +# +# To make the program type: wmake -f makefile.wcl386 +# +# The WATCOM environment variable should have been set +# to the top directory of the Open Watcom C installation. +# It is used below, so it needs to be set. + +# +# Watcom looks a the INCLUDE variable to find its include +# files. +# +.BEFORE + set INCLUDE=$(%WATCOM)\h;$(%WATCOM)\h\nt + + +PROJ= bwbasic +CC= wcl386 +LINK= wlink + +# +# Open Watcom options +# -bc Build a console application +# -c Compile only; no link +# -d2 Generate code for the debugger +# -ox Optimize at maximum level +# -q Quiet operation +# -wx Display warnings at maximum level +# -za ANSI C syntax only; no language extensions +# +CFLAGS= -bc -c -ox -q -wx -za -DHAVE_MSDOS -D__WATCOM__ + +LFLAGS= OPTION QUIET + +OFILES= bwbasic.obj bwb_cmd.obj bwb_cnd.obj bwb_dio.obj & + bwb_exp.obj bwb_fnc.obj bwb_inp.obj bwb_int.obj & + bwb_prn.obj bwb_stc.obj bwb_str.obj bwb_tbl.obj & + bwb_var.obj bwd_cmd.obj bwd_fun.obj bwx_tty.obj + +HFILES= bwbasic.h + +ZFILES= bwbasic.exe bwbasic.doc INSTALL COPYING README + +all: $(PROJ).exe + +$(PROJ).exe: $(OFILES) + $(LINK) $(LFLAGS) FILE $(OFILES: =,) NAME $@ + +clean: .SYMBOLIC + del $(OFILES) *.err $(PROJ).exe + +dist: .SYMBOLIC + zip bwbasic-3.00-win32.zip $(ZFILES) + +.c.obj: .AUTODEPEND + $(CC) $(CFLAGS) $[@ + +bwbasic.obj: bwbasic.c $(HFILES) $(__MAKEFILES__) + +bwb_cmd.obj: bwb_cmd.c $(HFILES) $(__MAKEFILES__) + +bwb_cnd.obj: bwb_cnd.c $(HFILES) $(__MAKEFILES__) + +bwb_dio.obj: bwb_dio.c $(HFILES) $(__MAKEFILES__) + +bwb_exp.obj: bwb_exp.c $(HFILES) $(__MAKEFILES__) + +bwb_fnc.obj: bwb_fnc.c $(HFILES) $(__MAKEFILES__) + +bwb_inp.obj: bwb_inp.c $(HFILES) $(__MAKEFILES__) + +bwb_int.obj: bwb_int.c $(HFILES) $(__MAKEFILES__) + +bwb_prn.obj: bwb_prn.c $(HFILES) $(__MAKEFILES__) + +bwb_stc.obj: bwb_stc.c $(HFILES) $(__MAKEFILES__) + +bwb_str.obj: bwb_str.c $(HFILES) $(__MAKEFILES__) + +bwb_tbl.obj: bwb_tbl.c $(HFILES) $(__MAKEFILES__) + +bwb_var.obj: bwb_var.c $(HFILES) $(__MAKEFILES__) + +bwd_cmd.obj: bwd_cmd.c $(HFILES) $(__MAKEFILES__) + +bwd_fun.obj: bwd_fun.c $(HFILES) $(__MAKEFILES__) + +bwx_tty.obj: bwx_tty.c $(HFILES) $(__MAKEFILES__) + +# EOF diff --git a/profile.bas b/profile.bas new file mode 100644 index 0000000..88c07bb --- /dev/null +++ b/profile.bas @@ -0,0 +1 @@ +option version "bywater" diff --git a/renum b/renum new file mode 100755 index 0000000..baa8a32 Binary files /dev/null and b/renum differ diff --git a/renum.c b/renum.c new file mode 100644 index 0000000..4340dd0 --- /dev/null +++ b/renum.c @@ -0,0 +1,580 @@ +/*-------------------------------------------------------------------*/ +/* renum.c -- Renumbers a BASIC program in an ASCII file. */ +/* Originally written in HP 2000 BASIC by David Lance Robinson, 1977 */ +/* Adapted to MS BASIC and translated to C 4/1995 by Jon B. Volkoff */ +/* (eidetics@cerf.net) */ +/*-------------------------------------------------------------------*/ + +#include +#include + +#define MAX_LINE_LENGTH 255 +#define MAX_LINE_COUNT 1500 + +int instr(); +char *midstr1(); +char *midstr2(); +void binary_search(void); + +int f2, l2, n, x; +int sidx[MAX_LINE_COUNT][2]; +char rstr[MAX_LINE_LENGTH]; + +main(argc, argv) + int argc; + char *argv[]; +{ + int f, d, s, p, s1, t, l, g; + int c, f1, c1, i, f8, r, l1, l3; + int v1, f6, l6, b, f9, x9, b1, p8, p9, a, d9; + char pstr[MAX_LINE_LENGTH]; + char sstr[MAX_LINE_LENGTH]; + char f9str[MAX_LINE_LENGTH]; + char s9str[MAX_LINE_LENGTH]; + char tempstr[MAX_LINE_LENGTH]; + FILE *fdin; + FILE *fdout; + int skip, bp, temp, getout, disp_msg; + + f = 1; + + if (argc > 1) strcpy(pstr, argv[1]); + else + { + printf("Program in file? "); + fgets(pstr,MAX_LINE_LENGTH, stdin); + } + if (strlen(pstr) == 0) strcpy(pstr, "0.doc"); + + fdin = fopen(pstr, "r"); + if (fdin == NULL) + { + printf("Unable to open input file\n"); + exit(1); + } + strcpy(f9str, pstr); + +#if defined(__MVS__) || defined(__CMS__) + strcpy(pstr, "dd:editfl"); +#else + strcpy(pstr, "editfl"); +#endif + fdout = fopen(pstr, "w"); + if (fdout == NULL) + { + printf("Unable to open editfl output file\n"); + exit(1); + } + + /* Main program begins here */ + s = 0; l2 = 0; d = 0; + f2 = 10000; + printf ("PLEASE WAIT A FEW SECONDS!\n"); + while (fgets(pstr, MAX_LINE_LENGTH, fdin) != NULL) + { + pstr[strlen(pstr) - 1] = '\0'; + p = instr(pstr, " "); + if (p != 0 && p <= 5) + { + n = atoi(midstr2(pstr, 1, p)); + if (n != 0) + { + s++; + if( s < MAX_LINE_COUNT ) + { + /* OK */ + } + else + { + printf("Too many lines\n"); + exit(1); + } + sidx[s][0] = n; + s1 = s; + while (s1 >= 2) + { + s1--; + if (sidx[s1][0] < sidx[s1 + 1][0]) break; + if (sidx[s1][0] == sidx[s1 + 1][0]) + { + printf("ERROR !!! MORE THAN ONE STATEMENT FOR A "); + printf("STATEMENT NUMBER\n"); + exit(1); + } + + t = sidx[s1][0]; + sidx[s1][0] = sidx[s1 + 1][0]; + sidx[s1 + 1][0] = t; + } + } + } + } + fclose(fdin); + + strcpy(pstr, ""); + + if (s == 0) + { + printf("NO PROGRAM IS IN THE FILE!\n"); + exit(1); + } + + for (l = 1; l <= s; l++) + sidx[l][1] = sidx[l][0]; + g = 1; + disp_msg = 1; + + /*------------------------------------------------------------------------*/ + /* Find out how and what to renumber (using HP BASIC renumber parameters) */ + /* MS BASIC renumber is: RENUM (newnum) (,(oldnum) (,increment)) */ + /*------------------------------------------------------------------------*/ + + while(1) + { + if (disp_msg == 1) + { + printf("RENUMBER (-starting number (,interval (,first statement "); + printf("(,last))))\n"); + disp_msg = 0; + } + + skip = 0; + bp = 0; + printf("RENUMBER-"); + fgets(pstr,MAX_LINE_LENGTH,stdin); + p = strlen(pstr); + + if (g == 0) + { + if (strlen(pstr) == 0) break; + if (p == 0) skip = 1; + else + { + t = atoi(midstr2(pstr, 1, 1)); + if (t == 0) break; + } + } + + if (strlen(pstr) == 0) skip = 1; + + if (skip == 0) + { + c = instr(pstr, ","); + temp = 0; if (c != 0) temp = -1; + f1 = atoi(midstr2(pstr, 1, p + temp*(p - c + 1))); + if (f1 == 0) bp = 1; + if (c == 0) skip = 2; + } + + if (skip == 0 && bp == 0) + { + c1 = instr(midstr1(pstr, c + 1), ",") + c; + temp = 0; if (c1 != c) temp = -1; + i = atoi(midstr2(pstr, c + 1, p + temp*(p - c1 + 1) - c)); + if (i == 0) bp = 1; + if (c1 == c) skip = 3; + } + + if (skip == 0 && bp == 0) + { + c = instr(midstr1(pstr, c1 + 1), ",") + c1; + temp = 0; if (c != c1) temp = -1; + f8 = atoi(midstr2(pstr, c1 + 1, p + temp*(p - c + 1) - c1)); + if (f8 == 0) bp = 1; + if (c == c1) skip = 4; + } + + if (skip == 0 && bp == 0) + { + l = atoi(midstr1(pstr, c + 1)); + if (l == 0) bp = 1; + } + + if (bp == 0) switch (skip) + { + case 1: + f1 = 10; + i = 10; + f8 = 1; + l = 99999; + break; + + case 2: + i = 10; + f8 = 1; + l = 99999; + break; + + case 3: + f8 = 1; + l = 99999; + break; + + case 4: + l = 99999; + break; + } + + if (f1 < 1 || i == 0 || f8 < 1 || l < 1) bp = 1; + + if (f1 > 99999 || i > 99999 || f8 > 99999 || l > 99999 || f8 > l) + bp = 1; + + c = 0; + for (r = 1; r <= s; r++) + if (sidx[r][0] >= f8 && sidx[r][0] <= l) c = c + 1; + if (c == 0) + { + printf("There is nothing to renumber !!\n"); + disp_msg = 1; + } + + /*------------------------------------*/ + /* Make list of new statement numbers */ + /*------------------------------------*/ + + l1 = f1 + (c - 1)*i; + if (l1 < 1 || l1 > 99999) bp = 1; + + x = 0; c = 0; + if (bp == 0 && disp_msg == 0) for (r = 1; r <= s; r++) + { + if (sidx[r][0] < f8 || sidx[r][0] > l) + if (sidx[r][1] >= f1 && sidx[r][1] <= l1) + { + printf("SEQUENCE NUMBER OVERLAP\n"); + exit(1); + } + else {} + else + { + if (sidx[r][0] != f1 + c*i) + { + if (x == 0) + { + if (r < f2) f2 = r; + x = 1; + } + + if (r > l2) l2 = r; + } + + sidx[r][1] = f1 + c*i; + c++; + l3 = r; + } + } + + if (bp == 0 && disp_msg == 0) g = 0; + + if (bp == 1) printf("BAD PARAMETER\n"); + } + + /*-------------------*/ + /* Start renumbering */ + /*-------------------*/ + + if (l2 == 0) + { + printf("NOTHING RENUMBERED!\n"); + exit(1); + } + + printf("RENUMBERING\n"); +/* for (r = 1; r <= s; r ++) + printf("%d -> %d\n", sidx[r][0], sidx[r][1]); */ + + printf("VERIFY? "); + fgets(pstr,MAX_LINE_LENGTH,stdin); + v1 = 0; + if (strcmp(midstr2(pstr, 1, 1), "N") == 0) v1 = 1; + + fdin = fopen(f9str, "r"); + if (fdin == NULL) + { + printf("Unable to open input file\n"); + exit(1); + } + + f6 = sidx[f2][0]; + l6 = sidx[l2][0]; + + while (fgets(pstr, MAX_LINE_LENGTH, fdin) != NULL) + { + pstr[strlen(pstr) - 1] = '\0'; + b = instr(pstr, " "); + if (b != 0) + { + n = atoi(midstr2(pstr, 1, b)); + if (n != 0) + { + if (n >= f6 && n <= l6) + { + binary_search(); + if (x == 0) + { + strcat(rstr, midstr1(pstr, b)); + strcpy(pstr, rstr); + b = instr(pstr, " "); + } + } + b++; + + /*-------------------------------------------------------------*/ + /* There are differences, of course, between processing for HP */ + /* BASIC and MS BASIC. */ + /* */ + /* CONVERT, PRINT USING, and MAT PRINT USING changes are not */ + /* applicable in MS BASIC. */ + /* */ + /* Had to also add capability for multiple statements here. */ + /*-------------------------------------------------------------*/ + + while(1) + { + if (strcmp(midstr2(pstr, b, 3), "REM") == 0 || + strcmp(midstr2(pstr, b, 1), "'") == 0) break; + + f9 = 0; + skip = 0; + for (x9 = b; x9 <= strlen(pstr); x9++) + { + if ((char)(*midstr2(pstr, x9, 1)) == 34) + { + if (f9 == 0) + f9 = 1; + else + f9 = 0; + } + else if (strcmp(midstr2(pstr, x9, 1), ":") == 0 && + f9 == 0) + { + b1 = x9 - 1; + skip = 1; + break; + } + } + if (skip == 0) b1 = strlen(pstr); + + t = instr("GOSGOTIF ON RESRET", midstr2(pstr, b, 3)); + + temp = (t + 5)/3; + if (temp != 1) + { + if (temp == 2 || temp == 3 || temp == 4 || temp == 6 || + temp == 7) + { + /*-------------------------------------------------*/ + /* Change GOSUB, GOTO, IF, RESTORE, RESUME, RETURN */ + /* routine. */ + /* Go word by word through the statement. */ + /*-------------------------------------------------*/ + getout = 0; + p8 = b; + strcpy(s9str, " "); + } + else if (temp == 5) + { + /*---------------------------------------------------*/ + /* Change ON event/expression GOSUB/GOTO routine. */ + /* Find starting point appropriate to this statement */ + /* type. */ + /*---------------------------------------------------*/ + getout = 1; + for (x9 = b1; x9 >= b; x9--) + { + if (strcmp(midstr2(pstr, x9, 1), " ") == 0) + { + p8 = x9 + 1; + getout = 0; + break; + } + } + + if (getout == 0) strcpy(s9str, ","); + } + + /* Start looping here */ + if (getout == 0) while(1) + { + f9 = 0; + skip = 0; + for (x9 = p8; x9 <= b1; x9++) + { + if ((char)(*midstr2(pstr, x9, 1)) == 34) + { + if (f9 == 0) + f9 = 1; + else + f9 = 0; + } + else if (strcmp(midstr2(pstr, x9, 1), s9str) == 0 && + f9 == 0) + { + p9 = x9 - 1; + skip = 1; + break; + } + } + if (skip == 0) p9 = b1; + + skip = 0; + for (x9 = p8; x9 <= p9; x9++) + { + a = (char)(*midstr2(pstr, x9, 1)); + if (a < 48 || a > 57) + { + skip = 1; + break; + } + } + + if (skip == 0) + { + /*---------------------*/ + /* Found a line number */ + /*---------------------*/ + n = atoi(midstr2(pstr, p8, p9 - p8 + 1)); + if (n != 0) + { + if (n >= f6 && n <= l6) + { + binary_search(); + if (x == 0) + { + if (p9 == strlen(pstr)) + { + strcpy(tempstr, midstr2(pstr, 1, p8 - 1)); + strcat(tempstr, rstr); + strcpy(pstr, tempstr); + } + else + { + strcpy(tempstr, midstr2(pstr, 1, p8 - 1)); + strcat(tempstr, rstr); + strcat(tempstr, midstr1(pstr, p9 + 1)); + strcpy(pstr, tempstr); + } + + /*-----------------------------------*/ + /* Adjust indices to account for new */ + /* substring length, if any. */ + /*-----------------------------------*/ + d9 = strlen(rstr) - (p9 - p8 + 1); + p9 = p9 + d9; + b1 = b1 + d9; + } + } + } + } + + p8 = p9 + 2; + if (p8 > b1) break; + } + } + + /*--------------------------------------------------*/ + /* No more words to process in the statement, go to */ + /* next statement. */ + /*--------------------------------------------------*/ + if (b1 == strlen(pstr)) break; + b = b1 + 2; + } + } + } + + fprintf(fdout, "%s\n", pstr); + if (v1 == 0) printf("%s\n", pstr); + } + + fclose(fdin); + fclose(fdout); +#if !defined(__MVS__) && !defined(__CMS__) + sprintf(tempstr, "mv editfl %s\0", f9str); + system(tempstr); +#endif + return (0); +} + + +int instr(astr, bstr) + char *astr, *bstr; +{ + char *p; + int q; + + p = strstr(astr, bstr); + if (p == NULL) + { + q = 0; + } + else + { + q = (p - astr) + 1; + } + return q; +} + + +char *midstr1(astr, start) + char *astr; + int start; +{ + static char tempstr[MAX_LINE_LENGTH]; + char *startptr; + + strcpy(tempstr, astr); + startptr = (char *)((long)(tempstr) + start - 1); + + return startptr; +} + + +char *midstr2(astr, start, len) + char *astr; + int start, len; +{ + static char tempstr[MAX_LINE_LENGTH]; + char *startptr, *endptr; + + strcpy(tempstr, astr); + startptr = (char *)((long)(tempstr) + start - 1); + endptr = (char *)((long)(tempstr) + start + len - 1); + strcpy(endptr, "\0"); + + return startptr; +} + + +void binary_search(void) +{ + int f5, l5; + + f5 = f2; + l5 = l2 + 1; + + while(1) + { + int m; + + m = (f5 + l5)/2; + + if (sidx[m][0] == n) + { + sprintf(rstr, "%d\0", sidx[m][1]); + x = 0; + return; + } + + if (m == f5 || m == l5) + { + x = 1; + return; + } + + if (sidx[m][0] < n) + f5 = m; + else + l5 = m; + } +} diff --git a/stdbwb.parm b/stdbwb.parm new file mode 100644 index 0000000..eea6614 --- /dev/null +++ b/stdbwb.parm @@ -0,0 +1 @@ +-Os -S -ansi -o dd:out - diff --git a/stdcomp.bat b/stdcomp.bat new file mode 100644 index 0000000..4772824 --- /dev/null +++ b/stdcomp.bat @@ -0,0 +1,3 @@ +rem gcc -w -c -ansi -mno-cygwin -I . %1 %2 %3 %4 %5 %6 %7 %8 %9 +bcc32 -O -w- -A -c -I. %1 %2 %3 %4 %5 %6 %7 %8 %9 +rem gccmvs -Os -S -ansi -nostdinc -I ../pdos/pdpclib -I . %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/subjobs.bat b/subjobs.bat new file mode 100644 index 0000000..11ecec5 --- /dev/null +++ b/subjobs.bat @@ -0,0 +1,9 @@ +del alljcl.jcl +type bwbasic1.jcl >>alljcl.jcl +type bwbasic2.jcl >>alljcl.jcl +type bwbasic3.jcl >>alljcl.jcl +type bwbasic4.jcl >>alljcl.jcl +type bwbasic5.jcl >>alljcl.jcl +type bwbasic6.jcl >>alljcl.jcl +type bwbasic7.jcl >>alljcl.jcl +call runmvs alljcl.jcl output.txt all.zip diff --git a/unixio.c b/unixio.c new file mode 100644 index 0000000..ec235b9 --- /dev/null +++ b/unixio.c @@ -0,0 +1,170 @@ +/*********************************************************************/ +/* */ +/* This Program Written By Paul Edwards. */ +/* Released to the public domain. */ +/* */ +/*********************************************************************/ +/*********************************************************************/ +/* */ +/* unixio - Unix I/O functions written in terms of standard C */ +/* functions. */ +/* */ +/*********************************************************************/ + +#include + +#ifdef fileno +#undef fileno +#endif + +#include "unixio.h" + +static FILE *files[FOPEN_MAX]; +/*char *environ[] = { NULL };*/ + +int open(const char *fnm, int mode, ...) +{ + int x; + char *modestr; + + for (x = 3; x < FOPEN_MAX; x++) + { + if (files[x] == NULL) + { + break; + } + } + if (x == FOPEN_MAX) + { + return (-1); + } + if (mode == O_RDONLY) + { + modestr = "r"; + } + else if (mode == O_WRONLY) + { + modestr = "w"; + } + else if (mode == O_RDWR) + { + modestr = "r+"; + } + files[x] = fopen(fnm, modestr); + if (files[x] == NULL) + { + return (-1); + } + return (x); +} + +int read(int fno, void *buf, size_t bytes) +{ + size_t rb; + + if (fno < 3) + { + rb = fread(buf, 1, bytes, stdin); + } + else + { + rb = fread(buf, 1, bytes, files[fno]); + } + return ((int)rb); +} + +int write(int fno, const void *buf, size_t bytes) +{ + size_t wb = 0; + + if (fno == 1) + { + wb = fwrite(buf, 1, bytes, stdout); + } + else if (fno == 2) + { + wb = fwrite(buf, 1, bytes, stderr); + } + else if (fno > 2) + { + wb = fwrite(buf, 1, bytes, files[fno]); + } + return ((int)wb); +} + +int close(int fno) +{ + if (fno >= 3) + { + fclose(files[fno]); + files[fno] = NULL; + } + return (0); +} + +char *getcwd(char *buf, int len) +{ + if (len != 0) + { + *buf = '\0'; + } + return (buf); +} + +void unlink(char *f) +{ + remove(f); + return; +} + +int stat(char *f, struct stat *buf) +{ + memset(buf, '\0', sizeof *buf); + return (0); +} + +int fileno(FILE *fp) +{ + return (0); +} + +int access(char *f, int n) +{ + return (1); +} + +int fstat(int fh, struct stat *buf) +{ + memset(buf, '\0', sizeof *buf); + return (0); +} + +int pwait(int a, int *b, int c) +{ + return (0); +} + +int putenv(char *x) +{ + return (0); +} + +char *mktemp(char *s) +{ + return (tmpnam(s)); +} + +int chdir(char *path) +{ + return (0); +} + +int rmdir(char *path) +{ + return (0); +} + +int mkdir(char *path, int permissions) +{ + return (0); +} diff --git a/unixio.h b/unixio.h new file mode 100644 index 0000000..bc0a86c --- /dev/null +++ b/unixio.h @@ -0,0 +1,41 @@ +/* written by Paul Edwards */ +/* released to the public domain */ + +#ifndef UNIXIO_INCLUDED +#define UNIXIO_INCLUDED + +#include + +#define S_IFBLK 0x3000 +#define S_IFDIR 0x4000 +#define S_IFREG 0x8000 +#define S_IFMT 0xf000 + +#ifndef ENOENT +#define ENOENT 2002 +#endif +#ifndef ENOTDIR +#define ENOTDIR 2045 +#endif + +#define O_RDONLY 1 +#define O_WRONLY 2 +#define O_RDWR 4 +#define O_CREAT 0x100 +#define O_TRUNC 0x200 + +struct stat { + long st_size; + long st_mode; + long st_ino; + long st_dev; + long st_mtime; +}; + +int open(const char *fnm, int mode, ...); +int read(int fno, void *buf, size_t bytes); +int write(int fno, const void *buf, size_t bytes); +int close(int fno); +char *mktemp(char *s); + +#endif diff --git a/zipcms.bat b/zipcms.bat new file mode 100644 index 0000000..6ad5530 --- /dev/null +++ b/zipcms.bat @@ -0,0 +1,2 @@ +del all.zip +zip -0 -X -ll -j all *.c *.h *.exec *.bas *.parm README COPYING bwbasic.doc diff --git a/zipmvs.bat b/zipmvs.bat new file mode 100644 index 0000000..1508bc5 --- /dev/null +++ b/zipmvs.bat @@ -0,0 +1,9 @@ +del bwbinc.zip +del bwbsrc.zip +del bwbjcl.zip +del all.zip +del alljcl.jcl +zip -9 -X -ll -j bwbsrc.zip *.c +zip -9 -X -ll -j bwbinc.zip *.h +zip -9 -X -ll -j bwbjcl.zip *.jcl README COPYING bwbasic.doc +zip -9 -X all *.zip -- cgit v1.2.3