home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / bwbasic-2.10.sit / bwbasic-2.10 / bwbasic.doc < prev    next >
Text File  |  1996-10-10  |  59KB  |  1,882 lines

  1.  
  2.  
  3.  
  4.  
  5.                Bywater BASIC Interpreter/Shell, version 2.10
  6.                ---------------------------------------------
  7.  
  8.                     Copyright (c) 1993, Ted A. Campbell
  9.                   for bwBASIC version 2.10, 11 October 1993
  10.  
  11.  
  12. CONTENTS:
  13.  
  14.    1. DESCRIPTION
  15.    2. TERMS OF USE
  16.    3. QUICK REFERENCE LIST OF COMMANDS AND FUNCTIONS
  17.    4. GENERAL NOTES ON USAGE
  18.    5. EXPANDED REFERENCE FOR COMMANDS AND FUNCTIONS
  19.    6. PREDEFINED VARIABLES
  20.    7. UNIMPLEMENTED COMMANDS AND FUNCTIONS
  21.       and AGENDA FOR DEVELOPMENT
  22.    8. THE STORY OF BYWATER BASIC
  23.    9. COMMUNICATIONS
  24.  
  25.    The author wishes to express his thanks to Mr. David MacKenzie, 
  26.    who assisted in the development Unix installation and configuration
  27.    for this version.
  28.  
  29.  
  30. 1. DESCRIPTION
  31.  
  32.    The Bywater BASIC Interpreter (bwBASIC) implements a large
  33.    superset of the ANSI Standard for Minimal BASIC (X3.60-1978)
  34.    and a significant subset of the ANSI Standard for Full BASIC
  35.    (X3.113-1987) in C. It also offers shell programming facilities
  36.    as an extension of BASIC. bwBASIC seeks to be as portable
  37.    as possible.
  38.  
  39.    bwBASIC can be configured to emulate features, commands, and
  40.    functions available on different types of BASIC interpreters;
  41.    see the file INSTALL for further installation information.
  42.  
  43.    The interpreter is fairly slow.  Whenever faced with a choice
  44.    between conceptual clarity and speed, I have consistently chosen
  45.    the former.  The interpreter is the simplest design available,
  46.    and utilizes no system of intermediate code, which would speed
  47.    up considerably its operation.  As it is, each line is interpreted
  48.    afresh as the interpreter comes to it.
  49.  
  50.    bwBASIC implements one feature not available in previous BASIC
  51.    interpreters: a shell command can be entered interactively at the
  52.    bwBASIC prompt, and the interpreter will execute it under a
  53.    command shell.  For instance, the command "dir *.bas" can be
  54.    entered in bwBASIC (under DOS, or "ls -l *.bas" under UNIX) and
  55.    it will be executed as from the operating system command line.
  56.    Shell commands can also be given on numbered lines in a bwBASIC
  57.    program, so that bwBASIC can be used as a shell programming
  58.    language. bwBASIC's implementation of the RMDIR, CHDIR, MKDIR,
  59.    NAME, KILL, ENVIRON, and ENVIRON$() commands and functions
  60.    offer further shell-processing capabilities.
  61.  
  62.  
  63. 2. TERMS OF USE:
  64.  
  65.    This version of Bywater BASIC is released under the terms of the 
  66.    GNU General Public License (GPL), which is distributed with this 
  67.    software in the file "COPYING".  The GPL specifies the terms 
  68.    under which users may copy and use the software in this distribution.
  69.  
  70.    A separate license is available for commercial distribution,
  71.    for information on which you should contact the author.
  72.  
  73.  
  74. 3. QUICK REFERENCE LIST OF COMMANDS AND FUNCTIONS
  75.  
  76.    Be aware that many of these commands and functions will not be
  77.    available unless you have set certain flags in the header files
  78.    (see the expanded reference section below for dependencies).
  79.  
  80.    ABS( number )
  81.    ASC( string$ )
  82.    ATN( number )
  83.    CALL subroutine-name
  84.    CASE ELSE | IF partial-expression | constant
  85.    CHAIN [MERGE] file-name [, line-number] [, ALL]
  86.    CHDIR pathname
  87.    CHR$( number )
  88.    CINT( number )
  89.    CLEAR
  90.    CLOSE [[#]file-number]...
  91.    CLS
  92.    COMMON variable [, variable...]
  93.    COS( number )
  94.    CSNG( number )
  95.    CVD( string$ )
  96.    CVI( string$ )
  97.    CVS( string$ )
  98.    DATA constant[,constant]...
  99.    DATE$
  100.    DEF FNname(arg...)] = expression
  101.    DEFDBL letter[-letter](, letter[-letter])...
  102.    DEFINT letter[-letter](, letter[-letter])...
  103.    DEFSNG letter[-letter](, letter[-letter])...
  104.    DEFSTR letter[-letter](, letter[-letter])...
  105.    DELETE line[-line]
  106.    DIM variable(elements...)[variable(elements...)]...
  107.    DO NUM|UNNUM
  108.    DO [WHILE expression]
  109.    EDIT
  110.    ELSE
  111.    ELSEIF
  112.    END IF | FUNCTION | SELECT | SUB
  113.    ENVIRON variable-string = string
  114.    ENVIRON$( variable-string )
  115.    EOF( device-number )
  116.    ERASE variable[, variable]...
  117.    ERL
  118.    ERR
  119.    ERROR number
  120.    EXP( number )
  121.    FIELD [#] device-number, number AS string-variable [, number AS string-variable...]
  122.    FILES filespec$
  123.    FUNCTION
  124.    FOR counter = start TO finish [STEP increment]
  125.    GET [#] device-number [, record-number]
  126.    GOSUB line | label
  127.    GOTO line | label
  128.    HEX$( number )
  129.    IF expression THEN [statement [ELSE statement]]
  130.    INKEY$
  131.    INPUT [# device-number]|[;]["prompt string";]list of variables
  132.    INSTR( [start-position,] string-searched$, string-pattern$ )
  133.    INT( number )
  134.    KILL file-name
  135.    LEFT$( string$, number-of-spaces )
  136.    LEN( string$ )
  137.    LET variable = expression
  138.    LINE INPUT [[#] device-number,]["prompt string";] string-variable$
  139.    LIST line[-line]
  140.    LOAD file-name
  141.    LOC( device-number )
  142.    LOCATE line, column
  143.    LOF( device-number )
  144.    LOG( number )
  145.    LOOP [UNTIL expression]
  146.    LSET string-variable$ = expression
  147.    MERGE file-name
  148.    MID$( string$, start-position-in-string[, number-of-spaces ] )
  149.    MKD$( number )
  150.    MKDIR pathname
  151.    MKI$( number )
  152.    MKS$( number )
  153.    NAME old-file-name AS new-file-name
  154.    NEW
  155.    NEXT [counter]
  156.    OCT$( number )
  157.    ON variable GOTO|GOSUB line[,line,line,...]
  158.    ON ERROR GOSUB line
  159.    OPEN "O"|"I"|"R", [#]device-number, file-name [,record length]
  160.         file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number [LEN = record-length]
  161.    OPTION BASE number
  162.    POS
  163.    PRINT [# device-number,][USING format-string$;] expressions...
  164.    PUT [#] device-number [, record-number]
  165.    QUIT
  166.    RANDOMIZE number
  167.    READ variable[, variable]...
  168.    REM string
  169.    RESTORE line
  170.    RETURN
  171.    RIGHT$( string$, number-of-spaces )
  172.    RMDIR pathname
  173.    RND( number )
  174.    RSET string-variable$ = expression
  175.    RUN [line][file-name]
  176.    SAVE file-name
  177.    SELECT CASE expression
  178.    SGN( number )
  179.    SIN( number )
  180.    SPACE$( number )
  181.    SPC( number )
  182.    SQR( number )
  183.    STOP
  184.    STR$( number )
  185.    STRING$( number, ascii-value|string$ )
  186.    SUB subroutine-name
  187.    SWAP variable, variable
  188.    SYSTEM
  189.    TAB( number )
  190.    TAN( number )
  191.    TIME$
  192.    TIMER
  193.    TROFF
  194.    TRON
  195.    VAL( string$ )
  196.    WEND
  197.    WHILE expression
  198.    WIDTH [# device-number,] number
  199.    WRITE [# device-number,] element [, element ]....
  200.    
  201.  
  202. 4. GENERAL NOTES ON USAGE:
  203.  
  204.    4.a. Interactive Environment
  205.  
  206.    An interactive environment is provided if the flag INTERACTIVE
  207.    is defined as TRUE in bwbasic.h, so that a line with a
  208.    line number can be entered at the bwBASIC prompt and it will be
  209.    added to the program in memory.
  210.  
  211.    Line numbers are not strictly required, but are useful if the
  212.    interactive enviroment is used for programming.  For longer
  213.    program entry one might prefer to use an ASCII text editor, and
  214.    in this case lines can be entered without numbers. One can use
  215.    DO NUM and DO UNNUM to number or unnumber lines. See also the
  216.    documentation below for the pseudo-command EDIT.
  217.  
  218.    4.b. Naming Conventions
  219.  
  220.    Command names and function names are not case sensitive,
  221.    so that "Run" and "RUN" and "run" are equivalent and "abs()"
  222.    and "ABS()" and "Abs()" are equivalent. HOWEVER, variable
  223.    names ARE case sensitive in bwbASIC, so that "d$" and "D$"
  224.    are different variables.  This differs from some BASIC
  225.    implementations where variable names are not case sensitive.
  226.  
  227.    Variable names can use any alphabetic characters, the period
  228.    and underscore characters and decimal digits (but not in the
  229.    first position). They can be terminated with '#' or '!' to
  230.    allow Microsoft-type names, even though the precision is
  231.    irrelevant to bwBASIC.
  232.  
  233.    4.c. Numerical Constants
  234.  
  235.    Numerical constants may begin with a digit 0-9 (decimal), with
  236.    the "&H" or "&h" (hexadecimal) or the "&o" or "&O" (octal).
  237.    Decimal numbers may terminated with 'E', 'e', 'D', or 'd'
  238.    followed by an exponent number to denote exponential notation.
  239.    Decimal constants may also be terminated by the '#' or '!'
  240.    to comply with Microsoft-style precision terminators, although
  241.    the precision specified will be irrelevant to bwBASIC.
  242.  
  243.    4.d. Command-Line Execution
  244.  
  245.    A filename can be specified on the command line and will be
  246.    LOADed and RUN immediately, so that the command line
  247.  
  248.       bwbasic prog.bas
  249.  
  250.    will load and execute "prog.bas".
  251.  
  252.    4.e. Program Storage
  253.  
  254.    All programs are stored as ASCII text files.
  255.  
  256.    4.f. TRUE and FALSE
  257.  
  258.    TRUE is defined as -1 and FALSE is defined as 0 in the default
  259.    distribution of bwBASIC. These definitions can be changed by
  260.    those compiling bwBASIC (see file BWBASIC.H).
  261.  
  262.    4.g. Assignments
  263.  
  264.    Assignment must be made to variables.  This differs from some
  265.    implementations of BASIC where assignment can be made to a
  266.    function.  Implication: "INSTR( 3, x$, y$ ) = z$" will not
  267.    work under bwBASIC.
  268.  
  269.    4.h. Operators and Precedence
  270.  
  271.    bwBASIC recognizes the following operators, with their level
  272.    of precedence given (1 = highest):
  273.  
  274.       ^         1     exponentiation
  275.       *            2     multiplication
  276.       /            2    division
  277.       ¥            3     integer division
  278.       +            5     addition
  279.       -            5     subtraction
  280.       =            6     equality or assignment
  281.       MOD        4    modulus (remainder) arithmetic
  282.       <>        7    inequality
  283.       <            8    less than
  284.       >            9    greater than
  285.       <=        10    less than or equal to
  286.       =<        10    less than or equal to
  287.       >=        11    greater than or equal to
  288.       =>        11    greater than or equal to
  289.       NOT        12    negation
  290.       AND        13    conjunction
  291.       OR        14    disjunction
  292.       XOR        15    exclusive or
  293.       IMP        16    implication
  294.       EQV        17    equivalence
  295.  
  296.    4.h. Numerical Precision (NOT)
  297.  
  298.    bwBASIC utilizes numbers with only one level of precision. If
  299.    the flag NUMBER_DOUBLE is defined as TRUE in bwbasic.h, the
  300.    precision implemented will be that of the C "double" data type;
  301.    otherwise (default) the precision will be that of the C "float"
  302.    type.  At a number of points there are commands (or pseudo-
  303.    commands) that seem to recognize Microsoft-style precision
  304.    distinctions, but for the most part these are just work-around
  305.    aliases to allow Microsoft-style programs to be run.
  306.  
  307.  
  308. 5. EXPANDED REFERENCE FOR COMMANDS AND FUNCTIONS
  309.  
  310.    The "Dependencies" listed in the folowing reference materials
  311.    refers to flags that must be set to TRUE in bwbasic.h for the
  312.    associated command or function to be implemented.  These flags
  313.    are as follows:
  314.  
  315.    (core)        Commands and Functions in any implementation of
  316.                bwBASIC; these are the ANSI Minimal BASIC core
  317.  
  318.    INTERACTIVE        Commands supporting the interactive programming
  319.                environment
  320.  
  321.    COMMON_CMDS        Commands beyond ANSI Minimal BASIC which are common
  322.                to Full ANSI BASIC and Microsoft BASICs
  323.  
  324.    COMMON_FUNCS        Functions beyond the ANSI Mimimal BASIC core, but
  325.                common to both ANSI Full BASIC and Microsoft-style
  326.                BASIC varieties
  327.  
  328.    UNIX_CMDS        Commands which require Unix-style directory and
  329.                environment routines not specified in C
  330.  
  331.    STRUCT_CMDS        Commands related to structured programming; all
  332.                of these are part of the Full ANSI BASIC standard
  333.  
  334.    ANSI_FUNCS        Functions unique to ANSI Full BASIC
  335.  
  336.    MS_CMDS        Commands unique to Microsoft BASICs
  337.  
  338.    MS_FUNCS        Functions unique to Microsoft BASICs
  339.  
  340.  
  341.    ------------------------------------------
  342.  
  343.    Function:     ABS( number )
  344.  
  345.    Description:  ABS returns the absolute value of the argument 'number'.
  346.  
  347.    Dependencies: (core)
  348.  
  349.    ------------------------------------------
  350.  
  351.    Function:     ASC( string$ )
  352.  
  353.    Description:  ASC returns the ASCII code for the first letter in
  354.                  the argument string$.
  355.  
  356.    Dependencies: MS_FUNCS
  357.  
  358.    ------------------------------------------
  359.  
  360.    Function:     ATN( number )
  361.  
  362.    Description:  ATN returns the arctangent value of the argument 'number'
  363.                  in radians.
  364.  
  365.    Dependencies: (core)
  366.  
  367.    ------------------------------------------
  368.  
  369.    Command:      CALL subroutine-name
  370.  
  371.    Description:  CALL calls a named subroutine (see SUB and END SUB).
  372.  
  373.    Dependencies: STRUCT_CMDS
  374.  
  375.    ------------------------------------------
  376.  
  377.    Command:      CASE ELSE | IF partial-expression | constant
  378.  
  379.    Description:  CASE introduces an element of a SELECT CASE statement
  380.                  (see SELECT CASE). CASE IF introduces a conditional
  381.                  SELECT CASE element, and CASE ELSE introduces a
  382.          default SELECT CASE element.
  383.  
  384.    Dependencies: STRUCT_CMDS
  385.  
  386.    ------------------------------------------
  387.  
  388.    Command:      CHAIN [MERGE] file-name [, line-number] [, ALL]
  389.  
  390.    Description:  CHAIN passes control to another BASIC program.
  391.                  Variables declared COMMON (q.v.) will be passed
  392.                  to the new program.
  393.  
  394.    Dependencies: COMMON_CMDS
  395.  
  396.    ------------------------------------------
  397.  
  398.    Command:      CHDIR pathname$
  399.  
  400.    Description:  CHDIR changes the current directory to that indicated
  401.                  by the argument pathname$.
  402.  
  403.    Dependencies: UNIX_CMDS
  404.  
  405.    ------------------------------------------
  406.  
  407.    Function:     CHR$( number )
  408.  
  409.    Description:  CHR$ returns a one-character string with the character
  410.                  corresponding to the ASCII code indicated by argument
  411.                  'number'.
  412.  
  413.    Dependencies: COMMON_FUNCS
  414.  
  415.    ------------------------------------------
  416.  
  417.    Function:     CINT( number )
  418.  
  419.    Description:  CINT returns the truncated integer for the argument
  420.                  'number'.
  421.  
  422.    Dependencies: MS_FUNCS
  423.  
  424.    ------------------------------------------
  425.  
  426.    Command:      CLEAR
  427.  
  428.    Description:  CLEAR sets all numerical variables to 0, and all
  429.                  string variables to null.
  430.  
  431.    Dependencies: COMMON_CMDS
  432.  
  433.    ------------------------------------------
  434.  
  435.    Command:      CLOSE [[#]file-number]...
  436.  
  437.    Description:  CLOSE closes the file indicated by file-number
  438.                  (see OPEN).
  439.  
  440.    Dependencies: COMMON_CMDS
  441.  
  442.    ------------------------------------------
  443.  
  444.    Command:      CLS
  445.  
  446.    Description:  CLS clears the display screen (IBM and compatibles
  447.                  only as of version 2.10).
  448.  
  449.    Dependencies: IMP_IQC and IMP_CMDLOC
  450.  
  451.    ------------------------------------------
  452.  
  453.    Command:      CMDS
  454.  
  455.    Description:  CMDS is a debugging command that prints a list
  456.                  of all implemented bwBASIC commands.
  457.  
  458.    Dependencies: DEBUG
  459.  
  460.    ------------------------------------------
  461.  
  462.    Command:      COMMON variable [, variable...]
  463.  
  464.    Description:  COMMON designates variables to be passed to a CHAINed
  465.                  program (see CHAIN).
  466.  
  467.    Dependencies: COMMON_CMDS
  468.  
  469.    ------------------------------------------
  470.  
  471.    Function:     COS( number )
  472.  
  473.    Description:  COS returns the cosine of the argument 'number'
  474.                  in radians.
  475.  
  476.    Dependencies: (core)
  477.  
  478.    ------------------------------------------
  479.  
  480.    Function:     CSNG( number )
  481.  
  482.    Description:  CSNG is a pseudo-function that has no effect under
  483.                  bwBASIC.  It replicates a Microsoft-type command
  484.                  that would convert the 'number' to single-precision.
  485.  
  486.    Dependencies: MS_FUNCS
  487.  
  488.    ------------------------------------------
  489.  
  490.    Function:     CVD( string$ )
  491.  
  492.    Description:  CVD converts the argument string$ into a bwBASIC
  493.                  number (precision is irrelevant in bwBASIC since
  494.                  bwBASIC numbers have only one precision).
  495.  
  496.    Implenentation-Specific Notes:
  497.  
  498.    CVD(), CVI(), CVS(), MKI$(), MKD$(), MKS$(): These functions
  499.    are implemented, but are dependent on a) the sizes for integer,
  500.    float, and double values on particular systems, and b) how
  501.    particular versions of C store these numerical values. The
  502.    implication is that data files created using these functions
  503.    on a DOS-based microcomputer may not be translated correctly
  504.    by bwBASIC running on a Unix-based computer.  Similarly, data
  505.    files created by bwBASIC compiled by one version of C may not be
  506.    readable by bwBASIC compiled by another version of C (even under
  507.    the same operating system). So be careful with these.
  508.  
  509.    Dependencies: MS_FUNCS
  510.  
  511.    ------------------------------------------
  512.  
  513.    Function:     CVI( string$ )
  514.  
  515.    Description:  CVI converts the argument string$ into a bwBASIC
  516.                  number (precision is irrelevant in bwBASIC since
  517.                  bwBASIC numbers have only one precision; see also
  518.                  the note on CVD).
  519.  
  520.    Dependencies: MS_FUNCS
  521.  
  522.    ------------------------------------------
  523.  
  524.    Function:     CVS( string$ )
  525.  
  526.    Description:  CVI converts the argument string$ into a bwBASIC
  527.                  number (precision is irrelevant in bwBASIC since
  528.                  bwBASIC numbers have only one precision; see also
  529.                  the note on CVD).
  530.  
  531.    Dependencies: MS_FUNCS
  532.  
  533.    ------------------------------------------
  534.  
  535.    Command:      DATA constant[,constant]...
  536.  
  537.    Description:  DATA stores numerical and string constants to be
  538.                  accessed by READ (q.v.).
  539.  
  540.    Dependencies: (core)
  541.  
  542.    ------------------------------------------
  543.  
  544.    Function:     DATE$
  545.  
  546.    Description:  DATE$ returns the current date based on the computer's
  547.                  internal clock as a string in the form "YYYY-MM-DD".
  548.                  As implemented under bwBASIC, DATE$ cannot be used for
  549.                  assignment (i.e., to set the system date).
  550.  
  551.    Note:     bwBASIC presently (v2.10) does not allow assignment
  552.          to a function.
  553.  
  554.    Dependencies: COMMON_FUNCS
  555.  
  556.    ------------------------------------------
  557.  
  558.    Command:      DEF FNname(arg...)] = expression
  559.  
  560.    Description:  DEF defines a user-written function.  This function
  561.                  corresponds to Microsoft-type implementation, although
  562.                  in bwBASIC DEF is a working equivalent of FUNCTION.
  563.  
  564.    Dependencies: (core)
  565.  
  566.    ------------------------------------------
  567.  
  568.    Command:      DEFDBL letter[-letter](, letter[-letter])...
  569.  
  570.    Description:  DEFDBL declares variables with single-letter names
  571.                  as numerical variables (precision is irrelevant in
  572.                  bwBASIC).
  573.  
  574.    Dependencies: MS_CMDS
  575.  
  576.    ------------------------------------------
  577.  
  578.    Command:      DEFINT letter[-letter](, letter[-letter])...
  579.  
  580.    Description:  DEFINT declares variables with single-letter names
  581.                  as numerical variables (precision is irrelevant in
  582.                  bwBASIC).
  583.  
  584.    Dependencies: MS_CMDS
  585.  
  586.    ------------------------------------------
  587.  
  588.    Command:      DEFSNG letter[-letter](, letter[-letter])...
  589.  
  590.    Description:  DEFSNG declares variables with single-letter names
  591.                  as numerical variables (precision is irrelevant in
  592.                  bwBASIC).
  593.  
  594.    Dependencies: MS_CMDS
  595.  
  596.    ------------------------------------------
  597.  
  598.    Command:      DEFSTR letter[-letter](, letter[-letter])...
  599.  
  600.    Description:  DEFSTR declares variables with single-letter names
  601.                  as string variables.
  602.  
  603.    Dependencies: MS_CMDS
  604.  
  605.    ------------------------------------------
  606.  
  607.    Command:      DELETE line[-line]
  608.  
  609.    Description:  DELETE deletes program lines indicated by the
  610.                  argument(s). If you want to use DELETE for non-
  611.                  numbered programs, first use DO NUM, then DELETE,
  612.                  then DO UNNUM.
  613.  
  614.    Dependencies: INTERACTIVE
  615.  
  616.    ------------------------------------------
  617.  
  618.    Command:      DIM variable(elements...)[variable(elements...)]...
  619.  
  620.    Description:  DIM specifies variables that have more than one
  621.                  element in a single dimension, i.e., arrayed
  622.                  variables.
  623.  
  624.    Note:         As implemented under bwBASIC, DIM accepts only
  625.                  parentheses as delimiters for variable fields.
  626.                  (Some BASICs allow the use of square brackets.)
  627.  
  628.    Dependencies: (core)
  629.  
  630.    ------------------------------------------
  631.  
  632.    Command:      DO NUM|UNNUM
  633.  
  634.    Description:  DO NUM numbers all lines in a program.  The first
  635.                  line is given the number 10, and subsequent lines
  636.                  are numbered consecutively in multiples of 10. DO
  637.                  UNNUM removes all line numbers from a program.
  638.                  NOTE that these functions do nothing to line
  639.                  numbers, e.g., following a GOSUB or GOTO statement;
  640.                  these commands cannot be used as a replacement for
  641.                  RENUM (available in some systems, but not bwBASIC).
  642.                  With these commands, however, one can develop
  643.                  unnumbered programs by entering new lines with numbers,
  644.                  then running DO UNNUM to remove the line numbers.
  645.                  Together with LOAD and SAVE (q.v.) one can use
  646.                  bwBASIC as a primitive text editor.
  647.  
  648.    Dependencies: INTERACTIVE
  649.  
  650.    ------------------------------------------
  651.  
  652.    Command:      DO [WHILE expression]
  653.  
  654.    Description:  DO implements a number of forms of program loops.
  655.                  DO...LOOP simply loops; the only way out is by
  656.                  EXIT; DO WHILE...LOOP loops while "expression" is
  657.                  true (this is equivalent to the older WHILE-WEND
  658.                  loop, also implemented in bwBASIC); DO...LOOP UNTIL
  659.                  loops until the expression following UNTIL is true.
  660.  
  661.    Dependencies: STRUCT_CMDS
  662.  
  663.    ------------------------------------------
  664.  
  665.    Command:      EDIT
  666.  
  667.    Description:  EDIT is a pseudo-command which calls the text editor
  668.                  specified in the variable BWB.EDITOR$ to edit the
  669.                  program in memory.  After the call to the text editor,
  670.                  the (edited) prgram is reloaded into memory.  The user
  671.                  normally must specific a valid path and filename in
  672.                  BWB.EDITOR$ before this command will be useful.
  673.  
  674.    Dependencies: COMMON_CMDS
  675.  
  676.    ------------------------------------------
  677.  
  678.    Command:      ELSE
  679.  
  680.    Description:  ELSE introduces a default condition in a multi-line IF
  681.                  statement.
  682.  
  683.    Dependencies: STRUCT_CMDS
  684.  
  685.    ------------------------------------------
  686.  
  687.    Command:      ELSEIF
  688.  
  689.    Description:  ELSEIF introduces a secondary condition in a multi-
  690.                  line IF statement.
  691.  
  692.    Dependencies: STRUCT_CMDS
  693.  
  694.    ------------------------------------------
  695.  
  696.    Command:      END IF | FUNCTION | SELECT | SUB
  697.  
  698.    Description:  END IF ends a multi-line IF statement. END FUNCTION
  699.                  ends a multi-line function definition. END SELECT
  700.                  ends a SELECT CASE statement.  END SUB ends a multi-
  701.                  line subroutine definition.
  702.  
  703.    Dependencies: STRUCT_CMDS
  704.  
  705.    ------------------------------------------
  706.  
  707.    Command:      ENVIRON variable-string$ = string$
  708.  
  709.    Description:  ENVIRON sets the environment variable identified by
  710.                  variable-string$ to string$.
  711.  
  712.                  It might be noted that this differs from the implementation
  713.                  of ENVIRON in some versions of BASIC, but bwBASIC's ENVIRON
  714.                  allows BASIC variables to be used on either side of the equals
  715.                  sign.  Note that the function ENVIRON$() is different from the
  716.                  command, and be aware of the fact that in some operating systems
  717.                  an environment variable set within a program will not be passed
  718.                  to its parent shell.
  719.  
  720.    Dependencies: UNIX_CMDS
  721.  
  722.    ------------------------------------------
  723.  
  724.    Function:     ENVIRON$( variable-string$ )
  725.  
  726.    Description:  ENVIRON$ returns the environment variable associated with
  727.                  the name variable-string$.
  728.  
  729.    Dependencies: MS_FUNCS
  730.  
  731.    ------------------------------------------
  732.  
  733.    Function:     EOF( device-number )
  734.  
  735.    Description:  EOF returns TRUE (-1) if the device associated with
  736.                  device-number is at the end-of-file, otherwise it
  737.                  returns FALSE (0).
  738.  
  739.    Dependencies: MS_FUNCS
  740.  
  741.    ------------------------------------------
  742.  
  743.    Command:      ERASE variable[, variable]...
  744.  
  745.    Description:  ERASE eliminates arrayed variables from a program.
  746.  
  747.    Dependencies: COMMON_CMDS
  748.  
  749.    ------------------------------------------
  750.  
  751.    Function:     ERL
  752.  
  753.    Description:  ERL returns the line number of the most recent error.
  754.  
  755.    Dependencies: MS_FUNCS
  756.  
  757.    ------------------------------------------
  758.  
  759.    Function:     ERR
  760.  
  761.    Description:  ERR returns the error number of the most recent error.
  762.  
  763.                  Note that if PROG_ERRORS has been defined when bwBASIC is
  764.                  compiled, the ERR variable will not be set correctly upon
  765.                  errors.  It only works when standard error messages are used.
  766.  
  767.    Dependencies: MS_FUNCS
  768.  
  769.    ------------------------------------------
  770.  
  771.    Command:      ERROR number
  772.  
  773.    Description:  ERROR simulates an error, i.e., displays the message
  774.                  appropriate for that error. This command is helpful
  775.                  in writing ON ERROR GOSUB routines that can identify
  776.                  a few errors for special treatment and then ERROR ERR
  777.                  (i.e., default handling) for all others.
  778.  
  779.    Dependencies: COMMON_CMDS
  780.  
  781.    ------------------------------------------
  782.  
  783.    Command:      EXIT [FOR]
  784.  
  785.    Description:  EXIT by itself exits from a DO...LOOP loop;
  786.             EXIT FOR exits from a FOR...NEXT loop.
  787.  
  788.    Dependencies: STRUCT_CMDS
  789.  
  790.    ------------------------------------------
  791.  
  792.    Function:     EXP( number )
  793.  
  794.    Description:  EXP returns the exponential value of 'number'.
  795.  
  796.    Dependencies: (core)
  797.  
  798.    ------------------------------------------
  799.  
  800.    Command:      FIELD [#] device-number, number AS string-variable$ [, number AS string-variable$...]
  801.  
  802.    Description:  FIELD allocates space in a random file buffer for device
  803.                  indicated by device-number, allocating 'number' bytes
  804.                  and assigning the bytes at this position to the variable
  805.                  string-variable$.
  806.  
  807.    Dependencies: COMMON_CMDS
  808.  
  809.    ------------------------------------------
  810.  
  811.    Command:      FILES filespec$
  812.  
  813.    Description:  FILES is a pseudocommand that invokes the directory program
  814.                  specified in the variable BWB.FILES$ with the argument
  815.                  filespec$.  Normally, the user must set this variable
  816.                  before FILES can be used.  E.g., for PC-type computers,
  817.  
  818.                     BWB.FILES$ = "DIR"
  819.  
  820.                  will work, for Unix machines,
  821.  
  822.                     BWB.FILES$ = "ls -l"
  823.  
  824.                  etc.
  825.  
  826.    Dependencies: COMMON_CMDS
  827.  
  828.    ------------------------------------------
  829.  
  830.    Command:      FNCS
  831.  
  832.    Description:  CMDS is a debugging command that prints a list
  833.                  of all pre-defined bwBASIC functions.
  834.  
  835.    Dependencies: DEBUG
  836.  
  837.    ------------------------------------------
  838.  
  839.    Command:      FUNCTION
  840.  
  841.    Description:  FUNCTION introduces a function definition, normally
  842.                  ending with END FUNCTION.  In bwBASIC, FUNCTION and
  843.                  DEF are qorking equivalents, so either can be used
  844.                  with single-line function definitions or with multi-
  845.                  line definitions terminated by END FUNCTION.
  846.  
  847.    Dependencies: STRUCT_CMDS
  848.  
  849.    ------------------------------------------
  850.  
  851.    Command:      FOR counter = start TO finish [STEP increment]
  852.  
  853.    Description:  FOR initiates a FOR-NEXT loop with the variable
  854.                  'counter' initially set to 'start' and incrementing
  855.                  in 'increment' steps (default is 1) until 'counter'
  856.                  equals 'finish'.
  857.  
  858.    Dependencies: (core)
  859.  
  860.    ------------------------------------------
  861.  
  862.    Command:      GET [#] device-number [, record-number]
  863.  
  864.    Description:  GET reads the next reacord from a random-access file
  865.                  or device into the buffer associated with that file.
  866.                  If record-number is specified, the GET command reads the
  867.                  specified record.
  868.  
  869.    Dependencies: COMMON_CMDS
  870.  
  871.    ------------------------------------------
  872.  
  873.    Command:      GOSUB line | label
  874.  
  875.    Description:  GOSUB initiates a subroutine call to the line (or label)
  876.                  specified.  The subroutine must end with RETURN.
  877.  
  878.    Dependencies: (core), but STRUCT_CMDS for labels
  879.  
  880.    ------------------------------------------
  881.  
  882.    Command:      GOTO line | label
  883.  
  884.    Description:  GOTO branches program execution to the specified line
  885.                  (or label).
  886.  
  887.    Dependencies: (core), but STRUCT_CMDS for labels
  888.  
  889.    ------------------------------------------
  890.  
  891.    Function:     HEX$( number )
  892.  
  893.    Description:  HEX$ returns a string giving the hexadecimal (base 16)
  894.                  value for the 'number'.
  895.  
  896.    Dependencies: MS_FUNCS
  897.  
  898.    ------------------------------------------
  899.  
  900.    Command:      IF expression THEN [statement [ELSE statement]]
  901.  
  902.    Description:  IF evaluates 'expression' and performs the THEN
  903.                  statement if it is true or (optionally) the
  904.                  ELSE statement if it is FALSE.  If STRUCT_CMDS
  905.                  is set to TRUE, bwBASIC allows multi-line IF
  906.                  statements with ELSE and ELSEIF cases, ending
  907.                  with END IF.
  908.  
  909.    Dependencies: (core), STRUCT_CMDS for multi-line IF statements
  910.  
  911.    ------------------------------------------
  912.  
  913.    Function:     INKEY$
  914.  
  915.    Description:  INKEY$ reads the status of the keyboard, and a single
  916.             keypress, if available. If a keypress is not available,
  917.             then INKEY$ immediately returns a null string ("").
  918.             Currently (v2.10) implemented in bwx_iqc.c only.
  919.  
  920.    Dependencies: IMP_IQC and IMP_CMDLOC
  921.  
  922.    ------------------------------------------
  923.  
  924.    Command:      INPUT [# device-number]|[;]["prompt string";]list of variables
  925.  
  926.    Description:  INPUT allows input from the terminal or a device
  927.                  specified by device-number.  If terminal, the "prompt
  928.                  string" is output, and input is assigned to the
  929.                  appropriate variables specified.
  930.  
  931.                  bwBASIC does not support the optional feature of INPUT
  932.                  that suppresses the carriage-return and line-feed at the end
  933.                  of the input.  This is because C alone does not provide for any
  934.                  means of input other than CR-LF-terminated strings.
  935.  
  936.    Dependencies: (core)
  937.  
  938.    ------------------------------------------
  939.  
  940.    Function:     INSTR( [start-position,] string-searched$, string-pattern$ )
  941.  
  942.    Description:  INSTR returns the position at which string-pattern$
  943.                  occurs in string-searched$, beginning at start-position.
  944.                  As implemented in bwBASIC, INSTR cannot be used for
  945.                  assignments.
  946.  
  947.    Note:     bwBASIC presently (v2.10) does not allow assignment
  948.          to a function.
  949.  
  950.    Dependencies: MS_FUNCS
  951.  
  952.    ------------------------------------------
  953.  
  954.    Function:     INT( number )
  955.  
  956.    Description:  INT returns the largest integer less than or equal to
  957.                  the argument 'number'. NOTE that this is not a "truncated"
  958.                  integer function, for which see CINT.
  959.  
  960.    Dependencies: (core)
  961.  
  962.    ------------------------------------------
  963.  
  964.    Command:      KILL file-name$
  965.  
  966.    Description:  KILL deletes the file specified by file-name$.
  967.  
  968.    Dependencies: UNIX_CMDS
  969.  
  970.    ------------------------------------------
  971.  
  972.    Function:     LEFT$( string$, number-of-spaces )
  973.  
  974.    Description:  LEFT$ returns a substring a string$ with number-of-spaces
  975.                  from the left (beginning) of the string). As implemented
  976.                  under bwBASIC, it cannot be used for assignment.
  977.  
  978.    Dependencies: MS_FUNCS
  979.  
  980.    ------------------------------------------
  981.  
  982.    Function:     LEN( string$ )
  983.  
  984.    Description:  LEN returns the length in bytes of string$.
  985.  
  986.    Dependencies: COMMON_FUNCS
  987.  
  988.    ------------------------------------------
  989.  
  990.    Command:      LET variable = expression
  991.  
  992.    Description:  LET assigns the value of 'expression' to the variable.
  993.                  As currently implemented, bwBASIC supports implied LET
  994.                  statements (e.g., "X = 4.5678" at the beginning of
  995.                  a line or line segment, but does not support assignment
  996.                  to multiple variables (e.g., "x, y, z = 3.141596").
  997.  
  998.    Dependencies: (core)
  999.  
  1000.    ------------------------------------------
  1001.  
  1002.    Command:      LINE INPUT [[#] device-number,]["prompt string";] string-variable$
  1003.  
  1004.    Description:  LINE INPUT reads entire line from the keyboard or a file
  1005.                  or device into string-variable$.  If input is from the
  1006.                  keyboard (stdin), then "prompt string" will be printed
  1007.                  first.  Unlike INPUT, LINE INPUT reads a whole line,
  1008.                  not stopping for comma-delimited data items.
  1009.  
  1010.    Dependencies: COMMON_CMDS
  1011.  
  1012.    ------------------------------------------
  1013.  
  1014.    Command:      LIST line[-line]
  1015.  
  1016.    Description:  LIST lists program lines as specified in its argument.
  1017.  
  1018.    Dependencies: INTERACTIVE
  1019.  
  1020.    ------------------------------------------
  1021.  
  1022.    Command:      LOAD file-name
  1023.  
  1024.    Description:  LOAD loads an ASCII BASIC program into memory.
  1025.  
  1026.    Dependencies: INTERACTIVE
  1027.  
  1028.    ------------------------------------------
  1029.  
  1030.    Function:     LOC( device-number )
  1031.  
  1032.    Description:  LOC returns the next record that GET or PUT statements
  1033.                  will use.
  1034.  
  1035.    Dependencies: MS_FUNCS
  1036.  
  1037.    ------------------------------------------
  1038.  
  1039.    Command:      LOCATE line, column
  1040.  
  1041.    Description:  LOCATE addresses trhe curor to a specified line and
  1042.          column. Currently (v2.10) implemented in bwx_iqc.c only.
  1043.  
  1044.    Dependencies: IMP_IQC and IMP_CMDLOC
  1045.  
  1046.    ------------------------------------------
  1047.  
  1048.    Function:     LOF( device-number )
  1049.  
  1050.    Description:  LOF returns the length of a file (specified by device-number)
  1051.                  in bytes.
  1052.  
  1053.    Dependencies: MS_FUNCS
  1054.  
  1055.    ------------------------------------------
  1056.  
  1057.    Function:     LOG( number )
  1058.  
  1059.    Description:  LOG returns the natural logarithm of the argument 'number'.
  1060.  
  1061.    Dependencies: (core)
  1062.  
  1063.    ------------------------------------------
  1064.  
  1065.    Command:      LOOP [UNTIL expression]
  1066.  
  1067.    Description:  LOOP terminates a program loop:  see DO.
  1068.  
  1069.    Dependencies: STRUCT_CMDS
  1070.  
  1071.    ------------------------------------------
  1072.  
  1073.    Command:      LSET string-variable$ = expression
  1074.  
  1075.    Description:  LSET transfers data from 'expression' to the left-hand
  1076.                  side of a string variable or random access buffer field.
  1077.  
  1078.    Dependencies: COMMON_CMDS
  1079.  
  1080.    ------------------------------------------
  1081.  
  1082.    Command:      MERGE file-name
  1083.  
  1084.    Description:  MERGE adds program lines from 'file-name' to the program
  1085.                  in memory.  Unlike LOAD, it does not clear the program
  1086.                  currently in memory.
  1087.  
  1088.    Dependencies: COMMON_CMDS
  1089.  
  1090.    ------------------------------------------
  1091.  
  1092.    Function:     MID$( string$, start-position-in-string[, number-of-spaces ] )
  1093.  
  1094.    Description:  MID$ returns a substring of string$ beginning at
  1095.                  start-position-in-string and continuing for
  1096.                  number-of-spaces bytes.
  1097.  
  1098.    Dependencies: MS_FUNCS
  1099.  
  1100.    ------------------------------------------
  1101.  
  1102.    Command:      MKDIR pathname$
  1103.  
  1104.    Description:  MKDIR creates a new directory path as specified by
  1105.                  pathname$.
  1106.  
  1107.    Dependencies: UNIX_CMDS
  1108.  
  1109.    ------------------------------------------
  1110.  
  1111.    Function:     MKD$( number )
  1112.  
  1113.    Description:  MKD$, MKI$, and MKS$ are all equivalent in bwBASIC.
  1114.                  They convert the numerical value 'number' into a string
  1115.                  which can be stored in a more compressed form in a file
  1116.                  (especially for random file access).  Since bwBASIC does
  1117.                  not recognize differences in precision, these commands
  1118.                  are effectively equivalent.
  1119.  
  1120.    Dependencies: MS_FUNCS
  1121.  
  1122.    ------------------------------------------
  1123.  
  1124.    Function:     MKI$( number )
  1125.  
  1126.    Description:  Equivalent to MKD$ (q.v.)
  1127.  
  1128.    Dependencies: MS_FUNCS
  1129.  
  1130.    ------------------------------------------
  1131.  
  1132.    Function:     MKS$( number )
  1133.  
  1134.    Description:  Equivalent to MKD$ (q.v.).
  1135.  
  1136.    Dependencies: MS_FUNCS
  1137.  
  1138.    ------------------------------------------
  1139.  
  1140.    Command:      NAME old-file-name AS new-file-name
  1141.  
  1142.    Description:  NAME renames an existing file (old-file-name) as
  1143.                  new-file-name.
  1144.  
  1145.    Dependencies: UNIX_CMDS
  1146.  
  1147.    ------------------------------------------
  1148.  
  1149.    Command:      NEW
  1150.  
  1151.    Description:  NEW deletes the program in memory and clears all
  1152.                  variables.
  1153.  
  1154.    Dependencies: INTERACTIVE
  1155.  
  1156.    ------------------------------------------
  1157.  
  1158.    Command:      NEXT [counter-variable]
  1159.  
  1160.    Description:  NEXT comes at the end of a FOR-NEXT loop; see FOR.
  1161.  
  1162.    Dependencies: (core)
  1163.  
  1164.    ------------------------------------------
  1165.  
  1166.    Function:     OCT$( number )
  1167.  
  1168.    Description:  OCT$ returns a string giving the octal (base 8)
  1169.                  representation of 'number'.
  1170.  
  1171.    Dependencies: MS_FUNCS
  1172.  
  1173.    ------------------------------------------
  1174.  
  1175.    Command:      ON variable GOTO|GOSUB line[,line,line,...]
  1176.  
  1177.    Description:  ON either branches (GOTO) or calls a subroutine
  1178.                  (GOSUB) based on the rounded value of variable;
  1179.                  if it is 1, the first line is called, if 2, the second
  1180.                  line is called, etc.
  1181.  
  1182.    Dependencies: (core)
  1183.  
  1184.    ------------------------------------------
  1185.  
  1186.    Command:      ON ERROR GOSUB line|label
  1187.  
  1188.    Description:  ON ERROR sets up an error handling subroutine. See
  1189.                  also ERROR.
  1190.  
  1191.    Dependencies: COMMON_CMDS, STRUCT_CMDS for labels
  1192.  
  1193.    ------------------------------------------
  1194.  
  1195.    Command:      OPEN "O"|"I"|"R", [#]device-number, file-name [,record length]
  1196.                       file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number [LEN = record-length]
  1197.  
  1198.    Description:  OPEN allocates random access memory for access to a disk
  1199.                  file or other device.  Note that two quite different forms
  1200.                  of the OPEN statement are supported. In the first form,
  1201.                  "O" (note that these letters must be encased in quotation
  1202.                  marks) denotes sequential output, "I" denotes sequential
  1203.                  input, and "R" denotes random-access input and output.
  1204.                  Once OPEN, any number of operations can be performed
  1205.                  on a device (see WRITE #, INPUT #, PRINT #, etc.).
  1206.  
  1207.    Dependencies: COMMON_CMDS
  1208.  
  1209.    ------------------------------------------
  1210.  
  1211.    Command:      OPTION BASE number
  1212.  
  1213.    Description:  OPTION BASE sets the lowest value for array subscripts,
  1214.                  either 0 or 1.
  1215.  
  1216.    Dependencies: (core)
  1217.  
  1218.    ------------------------------------------
  1219.  
  1220.    Function:     POS
  1221.  
  1222.    Description:  POS returns the current cursor position in the line.
  1223.  
  1224.    Dependencies: COMMON_FUNCS
  1225.  
  1226.    ------------------------------------------
  1227.  
  1228.    Command:      PRINT [# device-number,][USING format-string$;] expressions...
  1229.  
  1230.    Description:  PRINT outputs text to the screen or to a file or device
  1231.                  specified by device-number. In the current implementation
  1232.                  of bwBASIC, expressions to be printed must be separated by
  1233.                  the comma (tabbed output), the semicolon (immediate
  1234.                  sequential output) or the plus sign (immediate sequential
  1235.                  output by string concatenation).  Expressions separated
  1236.                  by blanks or tabs are not supported. If USING is specified,
  1237.                  a number of formatting marks may appear in the format
  1238.                  string:
  1239.  
  1240.                     !    prints the first character of a string
  1241.  
  1242.                     ¥¥    prints 2+x characters of a string, where x =
  1243.                         the number of spaces between the backslashes
  1244.  
  1245.                     &    variable-length string field
  1246.  
  1247.                     #    represents a single digit in output format for
  1248.                         a number
  1249.  
  1250.                     .    decimal point in a number
  1251.  
  1252.                     +    sign of a number (will output + or -)
  1253.  
  1254.                     -    trailing minus after a number
  1255.  
  1256.                     **    fill leading spaces with asterisks
  1257.  
  1258.                     $$    output dollar sign in front of a number
  1259.  
  1260.                     ^^    output number in exponential format
  1261.  
  1262.                     _    output next character literally
  1263.  
  1264.                  As currently implemented, the exponential format
  1265.                  will be that used by the C compiler.
  1266.  
  1267.    Dependencies: (core), COMMON_FUNCS for USING
  1268.  
  1269.    ------------------------------------------
  1270.  
  1271.    Command:      PUT [#] device-number [, record-number]
  1272.  
  1273.    Description:  PUT outputs the next available record or the record
  1274.                  specified by record-number to the file or device
  1275.                  denoted by device-number.
  1276.  
  1277.    Dependencies: COMMON_CMDS
  1278.  
  1279.    ------------------------------------------
  1280.  
  1281.    Command:      QUIT
  1282.  
  1283.    Description:  QUIT is a synonym for SYSTEM; with INTERACTIVE
  1284.          environment, it exits the program to the 
  1285.          operating system (or the calling program).
  1286.  
  1287.    Dependencies: INTERACTIVE
  1288.  
  1289.    ------------------------------------------
  1290.  
  1291.    Command:      RANDOMIZE number
  1292.  
  1293.    Description:  RANDOMIZE seeds the random number generator (see RND).
  1294.                  Under bwBASIC, the TIMER function (q.v.) can be used
  1295.                  to supply a 'number' seed for the random number
  1296.                  generator.
  1297.  
  1298.    Dependencies: (core)
  1299.  
  1300.    ------------------------------------------
  1301.  
  1302.    Command:      READ variable[, variable]...
  1303.  
  1304.    Description:  READ reads values from DATA statements and assigns these
  1305.                  values to the named variables.  Variable types in a READ
  1306.                  statement must match the data types in DATA statements
  1307.                  as they are occurred.  See also DATA and RESTORE.
  1308.  
  1309.    Dependencies: (core)
  1310.  
  1311.    ------------------------------------------
  1312.  
  1313.    Command:      REM string
  1314.  
  1315.    Description:  REM allows remarks to be included in a program. As
  1316.                  currently implemented, the entire line following
  1317.                  REM is ignored by the interpreter (thus, even if
  1318.                  MULTISEG_LINES is set, a REM line will not be able
  1319.                  to find a segment delimiter (":") followed by another
  1320.                  line segment with command.  bwBASIC does not currently
  1321.                  implement the Microsoft-style use of the single quotation
  1322.                  mark to denote remarks.
  1323.  
  1324.    Dependencies: (core)
  1325.  
  1326.    ------------------------------------------
  1327.  
  1328.    Command:      RESTORE line
  1329.  
  1330.    Description:  RESTORE resets the line and position counters for DATA
  1331.                  and READ statements to the top of the program file or
  1332.                  to the beginning of the specified line.  (Currently this
  1333.                  must be a line number.)
  1334.  
  1335.    Dependencies: (core)
  1336.  
  1337.    ------------------------------------------
  1338.  
  1339.    Command:      RETURN
  1340.  
  1341.    Description:  RETURN concludes a subroutine called by GOSUB.
  1342.  
  1343.    Dependencies: (core)
  1344.  
  1345.    ------------------------------------------
  1346.  
  1347.    Function:     RIGHT$( string$, number-of-spaces )
  1348.  
  1349.    Description:  RIGHT$ returns a substring a string$ with number-of-spaces
  1350.                  from the right (end) of the string). As implemented
  1351.                  under bwBASIC, it cannot be used for assignment.
  1352.  
  1353.    Dependencies: MS_FUNCS
  1354.  
  1355.    ------------------------------------------
  1356.  
  1357.    Command:      RMDIR pathname
  1358.  
  1359.    Description:  RMDIR deletes the directory path indicated by pathname.
  1360.  
  1361.    Dependencies: UNIX_CMDS
  1362.  
  1363.    ------------------------------------------
  1364.  
  1365.    Function:     RND( number )
  1366.  
  1367.    Description:  RND returns a pseudo-random number.  The 'number' value
  1368.                  is ignored by bwBASIC if supplied. The RANDOMIZE
  1369.                  command (q.v.) reseeds the random-number generator.
  1370.  
  1371.    Dependencies: (core)
  1372.  
  1373.    ------------------------------------------
  1374.  
  1375.    Command:      RSET string-variable$ = expression
  1376.  
  1377.    Description:  RSET transfers data from 'expression' to the right-hand
  1378.                  side of a string variable or random access buffer field.
  1379.  
  1380.    Dependencies: COMMON_CMDS
  1381.  
  1382.    ------------------------------------------
  1383.  
  1384.    Command:      RUN [line][file-name$]
  1385.  
  1386.    Description:  RUN executes the program in memory.  If a file-name$ is
  1387.                  supplied, then the specified file is loaded into memory
  1388.                  and executed.  If a line number is supplied, then execution
  1389.                  begins at that line.
  1390.  
  1391.    Dependencies: INTERACTIVE
  1392.  
  1393.    ------------------------------------------
  1394.  
  1395.    Command:      SAVE file-name$
  1396.  
  1397.    Description:  SAVE saves the program in memory to file-name$. bwBASIC
  1398.                  only saves files in ASCII format.
  1399.  
  1400.    Dependencies: INTERACTIVE
  1401.  
  1402.    ------------------------------------------
  1403.  
  1404.    Command:      SELECT CASE expression
  1405.  
  1406.    Description:  SELECT CASE introduces a multi-line conditional selection
  1407.                  statement.  The expression given as the argument to SELECT
  1408.                  CASE will be evaluated by CASE statements following.  The
  1409.                  SELECT CASE statement conclludes with an END SELECT
  1410.                  statement.
  1411.  
  1412.                  As currently implemented, CASE statements may be followed
  1413.                  by string values, but in this case only simple comparisons
  1414.                  (equals, not equals) can be performed. 
  1415.  
  1416.    Dependencies: STRUCT_CMDS
  1417.  
  1418.    ------------------------------------------
  1419.  
  1420.    Function:     SGN( number )
  1421.  
  1422.    Description:  SGN returns the sign of the argument 'number', +1
  1423.                  for positive numbers, 0 for 0, and -1 for negative numbers.
  1424.  
  1425.    Dependencies: (core)
  1426.  
  1427.    ------------------------------------------
  1428.  
  1429.    Function:     SIN( number )
  1430.  
  1431.    Description:  SIN returns the sine of the argument 'number'
  1432.                  in radians.
  1433.  
  1434.    Dependencies: (core)
  1435.  
  1436.    ------------------------------------------
  1437.  
  1438.    Function:     SPACE$( number )
  1439.  
  1440.    Description:  SPACE$ returns a string of blank spaces 'number'
  1441.                  bytes long.
  1442.  
  1443.    Dependencies: MS_FUNCS
  1444.  
  1445.    ------------------------------------------
  1446.  
  1447.    Function:     SPC( number )
  1448.  
  1449.    Description:  SPC returns a string of blank spaces 'number'
  1450.                  bytes long.
  1451.  
  1452.    Dependencies: MS_FUNCS
  1453.  
  1454.    ------------------------------------------
  1455.  
  1456.    Function:     SQR( number )
  1457.  
  1458.    Description:  SQR returns the square root of the argument 'number'.
  1459.  
  1460.    Dependencies: (core)
  1461.  
  1462.    ------------------------------------------
  1463.  
  1464.    Command:      STOP
  1465.  
  1466.    Description:  STOP interrupts program execution. As implemented under
  1467.                  bwBASIC, STOP issues a SIGINT signal.
  1468.  
  1469.    Dependencies: (core)
  1470.  
  1471.    ------------------------------------------
  1472.  
  1473.    Function:     STR$( number )
  1474.  
  1475.    Description:  STR$ returns a string giving the decimal (base 10)
  1476.                  representation of the argument 'number'.
  1477.  
  1478.    Dependencies: COMMON_FUNCS
  1479.  
  1480.    ------------------------------------------
  1481.  
  1482.    Function:     STRING$( number, ascii-value|string$ )
  1483.  
  1484.    Description:  STRING$ returns a string 'number' bytes long consisting
  1485.                  of either the first character of string$ or the character
  1486.                  answering to the ASCII value ascii-value.
  1487.  
  1488.    Dependencies: MS_FUNCS
  1489.  
  1490.    ------------------------------------------
  1491.  
  1492.    Command:      SUB subroutine-name
  1493.  
  1494.    Description:  SUB introduces a named, multi-line subroutine. The
  1495.                  subroutine is called by a CALL statement, and concludes
  1496.                  with an END SUB statement.
  1497.  
  1498.    Dependencies: STRUCT_CMDS
  1499.  
  1500.    ------------------------------------------
  1501.  
  1502.    Command:      SWAP variable, variable
  1503.  
  1504.    Description:  SWAP swaps the values of two variables. The two variables
  1505.                  must be of the same type (either numerical or string).
  1506.  
  1507.    Dependencies: COMMON_CMDS
  1508.  
  1509.    ------------------------------------------
  1510.  
  1511.    Command:      SYSTEM
  1512.  
  1513.    Description:  SYSTEM exits from bwBASIC to the calling program or
  1514.                  (more usually) the operating system.
  1515.  
  1516.    Dependencies: INTERACTIVE
  1517.  
  1518.    ------------------------------------------
  1519.  
  1520.    Function:     TAB( number )
  1521.  
  1522.    Description:  TAB outputs spaces until the column indicated by
  1523.                  'number' has been reached.
  1524.  
  1525.    Dependencies: (core)
  1526.  
  1527.    ------------------------------------------
  1528.  
  1529.    Function:     TAN( number )
  1530.  
  1531.    Description:  TAN returns the tangent of the argument 'number'
  1532.                  in radians.
  1533.  
  1534.    Dependencies: (core)
  1535.  
  1536.    ------------------------------------------
  1537.  
  1538.    Function:     TIME$
  1539.  
  1540.    Description:  TIME$ returns the current time based on the computer's
  1541.                  internal clock as a string in the form "HH-MM-SS".
  1542.                  As implemented under bwBASIC, TIME$ cannot be used for
  1543.                  assignment (i.e., to set the system time).
  1544.  
  1545.    Note:     bwBASIC presently (v2.10) does not allow assignment
  1546.          to a function.
  1547.  
  1548.    Dependencies: COMMON_FUNCS
  1549.  
  1550.    ------------------------------------------
  1551.  
  1552.    Function:     TIMER
  1553.  
  1554.    Description:  TIMER returns the time in the system clock in seconds
  1555.                  elapsed since midnight.
  1556.  
  1557.    Dependencies: MS_FUNCS
  1558.  
  1559.    ------------------------------------------
  1560.  
  1561.    Command:      TROFF
  1562.  
  1563.    Description:  TROFF turns of the trace facility; see TRON.
  1564.  
  1565.    Dependencies: COMMON_CMDS
  1566.  
  1567.    ------------------------------------------
  1568.  
  1569.    Command:      TRON
  1570.  
  1571.    Description:  TRON turns on the trace facility. This facility will print
  1572.                  each line number in square brackets as the program is
  1573.                  executed.  This is useful in debugging programs with
  1574.                  line numbers.  To debug an unnumbered program with
  1575.                  TRON, call DO NUM first, but remember to call DO UNNUM
  1576.                  before you save the program later.
  1577.  
  1578.    Dependencies: COMMON_CMDS
  1579.  
  1580.    ------------------------------------------
  1581.  
  1582.    Function:     VAL( string$ )
  1583.  
  1584.    Description:  VAL returns the numerical value of the string$.
  1585.  
  1586.    Dependencies: COMMON_FUNCS
  1587.  
  1588.    ------------------------------------------
  1589.  
  1590.    Command:      VARS
  1591.  
  1592.    Description:  VARS is a debugging command which prints a list of
  1593.                  all variables defined which have global scope.
  1594.  
  1595.    Dependencies: DEBUG
  1596.  
  1597.    ------------------------------------------
  1598.  
  1599.    Command:      WEND
  1600.  
  1601.    Description:  WEND concludes a WHILE-WEND loop; see WHILE.
  1602.  
  1603.    Dependencies: COMMON_CMDS
  1604.  
  1605.    ------------------------------------------
  1606.  
  1607.    Command:      WHILE expression
  1608.  
  1609.    Description:  WHILE initiates a WHILE-WEND loop.  The loop ends with
  1610.                  WEND, and execution reiterates through the loop as
  1611.                  long as the 'expression' is TRUE (-1).
  1612.  
  1613.    Dependencies: COMMON_CMDS
  1614.  
  1615.    ------------------------------------------
  1616.  
  1617.    Command:      WIDTH [# device-number,] number
  1618.  
  1619.    Description:  WIDTH sets screen or device output to 'number'
  1620.                  columns.  device-number specifies the device
  1621.                  or file for oputput.
  1622.  
  1623.    Dependencies: COMMON_CMDS
  1624.  
  1625.    ------------------------------------------
  1626.  
  1627.    Command:      WRITE [# device-number,] element [, element ]....
  1628.  
  1629.    Description:  WRITE outputs variables to the screen or to a file
  1630.                  or device specified by device-number.  Commas
  1631.                  are inserted between expressions output, and strings
  1632.                  are enclosed in quotation marks.
  1633.  
  1634.    Dependencies: COMMON_CMDS
  1635.  
  1636.    ------------------------------------------
  1637.  
  1638.  
  1639. 6. PREDEFINED VARIABLES
  1640.  
  1641.    BWB.EDITOR$
  1642.    BWB.FILES$
  1643.    BWB.PROMPT$
  1644.    BWB.IMPLEMENTATION$
  1645.  
  1646.    The commands EDIT and FILES are pseudo-commands that launch
  1647.    shell programs named in the variables BWB.EDITOR$ and BWB.FILES$,
  1648.    respectively.  The default values for these variables can
  1649.    be changed in bwbasic.h (DEF_EDITOR and DEF_FILES), or they
  1650.    can be changed on the fly by the user.  An idea might be to
  1651.    initialize these variables in "profile.bas" for specific
  1652.    implementations; for instance, BWB.FILES$ might be defined as
  1653.    "ls -l" on Unix systems or "dir" on DOS systems.
  1654.  
  1655.    The preset variable BWB.PROMPT$ can be used to set the prompt
  1656.    string for bwBASIC.  Again, it is suggested that a user-
  1657.    selected promptcan be set up in a "profile.bas" to be
  1658.    initialized each time bwBASIC starts.  Note that special
  1659.    characters can be added to the prompt string, e.g.,
  1660.  
  1661.       BWB.PROMPT$ = "Ok"+CHR$(10)
  1662.  
  1663.    will give an "Ok" prompt followed by a linefeed.
  1664.  
  1665.    The preset variable BWB.IMPLEMENTATION$ will return "TTY" for
  1666.    the bwx_tty implementation and will return "IQC" for the
  1667.    IBM PC or Compatibles with QuickC (bwx_iqc) implementation.
  1668.    This may be useful in determing which commands and functions
  1669.    (specifically CLS, LOCATE, and INKEY$) may be available. 
  1670.  
  1671.  
  1672. 7. UNIMPLEMENTED COMMANDS AND FUNCTIONS, and AGENDA FOR DEVELOPMENT
  1673.  
  1674.    There are some items not implemented that have been so long
  1675.    a part of standard BASICs that their absence will seem surprising.
  1676.    In each case, though, their implementation would require opera-
  1677.    ting-system-specific functions or terminal-specific functions
  1678.    that cannot be universally provided. Some specific examples:
  1679.  
  1680.    CLOAD    Relies on CP/M or MSDOS conventions for binary
  1681.                 executable files. 
  1682.  
  1683.    CONT        See RESUME below (programmer ignorance?).
  1684.  
  1685.    DEF USR    Relies on CP/M or MSDOS conventions for binary
  1686.                 executable files. 
  1687.  
  1688.    FRE()    The ability to report the amount of free memory
  1689.         remaining is system-specific due to varying patterns
  1690.         of memory allocation and access; consequently this
  1691.         ability is not present in ANSI or earlier versions 
  1692.                 of C and this function is not available in bwBASIC.
  1693.  
  1694.    INPUT$()    C by itself is not able to read unechoed keyboard 
  1695.         input, and can read keyboard input only after a 
  1696.         Carriage-Return has been entered.
  1697.  
  1698.    INP        Calls to hardware ports, like machine-language
  1699.            routines, are highly system-specific and cannot
  1700.            be implemented in C alone.
  1701.  
  1702.    LLIST    See LPRINT below.
  1703.  
  1704.    LPOS        See LPRINT below.
  1705.  
  1706.    LPRINT    and LLIST, etc., require access to a printer device,
  1707.            and this varies from one system to another. Users
  1708.            might try OPENing the printer device on their own
  1709.            operating system (e.g., "/dev/lp" on Unix systems,
  1710.            or "PRN" under DOS) and see if printing can be done
  1711.            from bwBASIC in this way.
  1712.  
  1713.    NULL        In this case, I am convinced that NULL is no longer
  1714.         necessary, since very few printers now require NULLs
  1715.         at the end of lines.
  1716.  
  1717.    OUT        See INP above (calls to hardware ports).
  1718.  
  1719.    PEEK()    PEEK and POKE enabled earlier BASICs to address
  1720.            particular memory locations. Although bwBASIC
  1721.            could possibly implement this command (POKE) and
  1722.            this function (PEEK()), the limitation would be
  1723.            highly limited by the different systems for
  1724.            memory access in different systems.
  1725.  
  1726.    POKE        see PEEK() above.
  1727.  
  1728.    RENUM    Since unnumbered lines can be entered and
  1729.            executed under bwBASIC, it would not be
  1730.            possible to implement a RENUM routine.
  1731.            Instead, bwBASIC uses DO NUM and DO UNNUM.
  1732.  
  1733.    RESUME    Is this possible under C? If so, I
  1734.            simply have failed to figure it out yet.
  1735.            Mea culpa (but not maxima).
  1736.  
  1737.    USR        See CALL and DEF USR above (machine language
  1738.            subroutines).
  1739.  
  1740.    VARPTR    See PEEK and POKE above.
  1741.  
  1742.    WAIT        See INP and OUT above.
  1743.  
  1744.    There are other commands, functions, and implementation details
  1745.    that I am working on, and which are on the agenda list for future
  1746.    versions of bwBASIC.  These agenda include:
  1747.  
  1748.    PARACT    i.e., the ability to execute PARallel ACTions. This
  1749.            is described in ANSI BASIC, although I have not seen it
  1750.            implemented before.  It will offer a rough, non-
  1751.            preemptive form of multitasking within the scope
  1752.            of a BASIC program. Programmers will note points at which
  1753.            there are already hooks for PARACT in bwBASIC.
  1754.  
  1755.    XMEM        PC-type computers need to be able to use extended
  1756.            memory.  If we could use extended memory for program
  1757.            lines, variables, and function defitions, we could
  1758.            write much longer programs.  This would entail,
  1759.            however, a fairly serious rewriting of the program
  1760.            to utilize memory handles for these storage features
  1761.            instead of direct memory pointers.
  1762.  
  1763.    Windows    The addition of memory handles in addition to the
  1764.            non-preemptive execution of program lines (in a
  1765.            crude form, already present) will make it possible
  1766.            to develop implementations for Windows and perhaps
  1767.            for other graphical user interfaces.  But what form
  1768.            should this take?  I have in mind presently a BASIC
  1769.            that would run in the background, appearing only
  1770.            as an icon in the GUI space, with pop-up editors
  1771.            and output windows. Thus, the interpreted language
  1772.         would serve a purpose something like 'cron' (a task
  1773.         scheduler) under Unix systems. You may have some
  1774.         reflections that would help me in this.
  1775.  
  1776.    Graphics    Here we face fairly critical differences in different
  1777.            styles and implementations of graphics, e.g., between
  1778.            GWBASIC, ANSI BASIC, VisualBASIC, etc. But it's
  1779.            possible that Graphics commands and functions could
  1780.            be added. These would all be implementation-specific.
  1781.  
  1782.    The ANSI Standard for full BASIC does not specify which particular
  1783.    commands or functions must be implemented, and in fact the standard
  1784.    is very robust.  Perhaps no implementation of BASIC would ever
  1785.    include all of the items, but some ANSI commands and functions which
  1786.    remain unimplemented are:
  1787.  
  1788.    ACCESS
  1789.    ANGLE
  1790.    AREA
  1791.    ARITHMETIC
  1792.    ARRAY
  1793.    ASK
  1794.    BSTR
  1795.    BVAL
  1796.    CEIL
  1797.    CELLS
  1798.    CLIP
  1799.    COLLATE
  1800.    CONNECT
  1801.    COSH
  1802.    DATUM
  1803.    DEBUG
  1804.    DECIMAL
  1805.    DECLARE
  1806.    DEGREES
  1807.    DEVICE
  1808.    DISCONNECT
  1809.    DISPLAY
  1810.    DOT
  1811.    DRAW
  1812.    ERASE
  1813.    EVENT
  1814.    EXCEPTION
  1815.    GRAPH
  1816.    HANDLER
  1817.    IMAGE
  1818.    KEY
  1819.    LCASE
  1820.    LINES
  1821.    LOG10
  1822.    LOG2
  1823.    MAT
  1824.    MIX
  1825.    MULTIPOINT
  1826.    OUTIN
  1827.    OUTPUT
  1828.    PARACT
  1829.    PICTURE
  1830.    PIXEL
  1831.    PLOT
  1832.    POINTS
  1833.    RADIANS
  1834.    RECEIVE
  1835.    RENUMBER
  1836.    REWRITE
  1837.    ROTATE
  1838.    ROUND
  1839.    SEIZE
  1840.    SEND
  1841.    SHIFT
  1842.    SINH
  1843.    TANH
  1844.    TIMEOUT
  1845.    TRACE
  1846.    TRANSFORM
  1847.    TRUNCATE
  1848.    UBOUND
  1849.    UCASE
  1850.    VIEWPORT
  1851.    WAIT
  1852.    VIEWPORT
  1853.    ZONEWIDTH
  1854.  
  1855.  
  1856. 8. THE STORY OF BYWATER BASIC
  1857.  
  1858.    This program was originally begun in 1982 by my grandmother, Mrs.
  1859.    Verda Spell of Beaumont, TX.  She was writing the program using
  1860.    an ANSI C compiler on an Osborne I CP/M computer and although my
  1861.    grandfather (Lockwood Spell) had bought an IBM PC with 256k of
  1862.    RAM my grandmother would not use it, paraphrasing George Herbert
  1863.    to the effect that "He who cannot in 64k program, cannot in 512k."
  1864.    She had used Microsoft BASIC and although she had nothing against
  1865.    it she said repeatedly that she didn't understand why Digital
  1866.    Research didn't "sue the socks off of Microsoft" for version 1.0
  1867.    of MSDOS and so I reckon that she hoped to undercut Microsoft's
  1868.    entire market and eventually build a new software empire on
  1869.    the North End of Beaumont. Her programming efforts were cut
  1870.    tragically short when she was thrown from a Beaumont to Port
  1871.    Arthur commuter train in the summer of 1986. I found the source
  1872.    code to bwBASIC on a single-density Osborne diskette in her knitting
  1873.    bag and eventually managed to have it all copied over to a PC
  1874.    diskette. I have revised it slightly prior to this release. You
  1875.    should know, though, that I myself am an historian, not a programmer.
  1876.  
  1877.  
  1878. 9. COMMUNICATIONS:
  1879.  
  1880.    email:  tcamp@delphi.com
  1881.  
  1882.