home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lb091.zip / COMMANDS.TXT < prev    next >
Text File  |  1995-10-10  |  63KB  |  2,143 lines

  1.  
  2.  
  3. ABS( n )
  4.  
  5. Description:
  6.  
  7.   This function returns  | n |  (the absolute value of n).
  8.  
  9. Usage:
  10.  
  11.   print abs( -5)                   produces:  5
  12.  
  13.   print abs( 6 - 13 )            produces: 7
  14.  
  15. _____________________________________________________________
  16.  
  17.  
  18. ACS( n )
  19.  
  20. Description:
  21.  
  22.   Returns the arc-cosine of the number n.
  23.  
  24. Usage:
  25.  
  26.   .
  27.   .
  28.   for c = 1 to 45
  29.     print "The arc-cosine of "; c; " is "; acs(c)
  30.   next c
  31.   .
  32.   .
  33.  
  34. Note:
  35.  
  36.   See also COS( )
  37.  
  38. ASC( n$ )
  39.  
  40. Description:
  41.  
  42.   This function returns the ASCII value of the first character of string n$.
  43.  
  44. Usage:
  45.  
  46.   print asc( "A" )              produces:  65
  47.  
  48.   let name$ = "Tim"
  49.   firstLetter = asc(name$)
  50.   print firstLetter             produces:  84
  51.  
  52.   print asc( "" )               produces:  0
  53.  
  54. _____________________________________________________________
  55.  
  56. ASN( n )
  57.  
  58. Description:
  59.  
  60.   Returns the arcsine of the number n.
  61.  
  62. Usage:
  63.  
  64.   .
  65.   .
  66.   for c = 1 to 45
  67.     print "The arcsine of "; c; " is "; asn(c)
  68.   next c
  69.   .
  70.   .
  71.  
  72. Note:
  73.  
  74.   See also SIN( )
  75.  
  76. ATN( n )
  77.  
  78. Description:
  79.  
  80.   Returns the arc-tangent of the number n.
  81.  
  82. Usage:
  83.  
  84.   .
  85.   .
  86.   for c = 1 to 45
  87.     print "The arctangent of "; c; " is "; atn(c)
  88.   next c
  89.   .
  90.   .
  91.  
  92. Note:
  93.  
  94.   See also TAN( )
  95.  
  96. _____________________________________________________________
  97.  
  98. BEEP
  99.  
  100. Description:
  101.  
  102.   This command simply rings the system bell, as in CTRL-G
  103.  
  104. Usage:
  105.  
  106.   .
  107.   .
  108. [loop]
  109.   input "Give me a number between 1 and 10?"; number
  110.   if number < 1 or number > 10 then beep : print "Out of range!" : goto [loop]
  111.   print "The square of "; number; " is "; number ^ 2
  112.   .
  113.   .
  114. BMPBUTTON #handle, filespec, return, corner, x, y
  115.  
  116. Description:
  117.  
  118.   This statement lets you add bitmapped buttons to windows that you open.  
  119.   The main program window cannot have buttons added, but any window that
  120.   you create via the OPEN command can have as many buttons as you want.  
  121.  
  122. Usage:
  123.  
  124.   Before you actually OPEN the window, each bitmapped  button must be
  125.   declared with a BMPBUTTON statement.  Here is a brief description for
  126.   each parameter as listed above:
  127.  
  128. #handle - You must use the same handle that will be used for the window 
  129.      that the button will belong to.
  130.  
  131. filespec   - The full pathname of the *.bmp file containing the bitmap for the
  132.       button you are creating.  The button will be the same size as the
  133.       bitmap.
  134.  
  135. return  - Again, use only one word and do not bound it with quotes or use a
  136.       string variable.  If return is set to a valid branch label, then when
  137.       the button is pressed, execution will restart there (just as with
  138.       GOTO or GOSUB), but if return is not a valid branch label, then the 
  139.       value of return is used as input to a specified variable (as in 
  140.       input a$).
  141.  
  142. corner  - UL, UR, LL, or LR specifies which corner of the window to anchor
  143.       the button to.  For example, if LR is used, then the button will 
  144.       appear in the lower right corner.  UL = upper left, UR = upper 
  145.       right, LL = lower left, and LR = lower right
  146.  
  147. x, y  -  These two parameters determine how to place the button relative to
  148.       the corner it has been anchored to.  For example if corner is LR, 
  149.       posx is 5, and posy is 5, then the button will be 5 pixels up and 
  150.       left of the lower right corner.  
  151.  
  152.   A collection of button *.bmp has been included with Liberty BASIC, 
  153.   including blanks.  Windows Paint can be used to edit and make buttons for 
  154.   Liberty BASIC.
  155.  
  156.   Program execution must be halted at an input statement in order for a button
  157.   press to be read and acted upon.
  158.  
  159.  
  160.   See also: BUTTON, MENU
  161.  
  162. _____________________________________________________________
  163.  
  164. BUTTON #handle, label, return, corner, x, y [, w, h]
  165.  
  166. Description:
  167.  
  168.   This statement lets you add buttons to windows that you open.  The main 
  169.   program window cannot have buttons added, but any window that you 
  170.   create via the OPEN command can have as many buttons as you want.
  171.  
  172. Usage:
  173.  
  174.   Before you actually OPEN the window, each button must be declared with a 
  175.   BUTTON statement.  Here is a brief description for each parameter as listed 
  176.   above:
  177.  
  178. #handle - You must use the same handle that will be used for the window 
  179.         that the button will belong to.
  180.  
  181. label   - Type the label desired for the button here.  Do not bound the word
  182.       with quotes, and do not use a string variable.
  183.  
  184. return  - Use only one word and do not bound it with quotes or use a string
  185.       variable.  If return is a valid branch label, then when the button is
  186.       pressed, execution will restart there (just as with GOTO or GOSUB),
  187.       but if return is not a valid branch label, then the value of return is
  188.       used as input to a specified variable (as in input a$).
  189.  
  190. corner  - UL, UR, LL, or LR specifies which corner of the window to anchor
  191.       the button to.  For example, if LR is used, then the button will 
  192.       appear in the lower right corner.  UL = upper left, UR = upper 
  193.       right, LL = lower left, and LR = lower right
  194.  
  195. x, y      - These two parameters determine how to place the button relative
  196.       to the corner it has been anchored to.  For example if corner is LR, 
  197.       posx is 5, and posy is 5, then the button will be 5 pixels up and 
  198.       left of the lower right corner.  Another way to use posx & posy is
  199.       to use values less than one.  For example, if corner is UL, posx
  200.       is .9, and posy is .9, then the button will be positioned 9/10th of 
  201.       the distance of the window in both x and y from the upper left
  202.       corner (and thus appear to be anchored to the lower right corner). 
  203.  
  204. w, h      - These two optional parameters specify the width and height of
  205.       the button.  If w and h are not present, Liberty BASIC will give the
  206.       button a default size designed to fit its label.
  207.  
  208.   Program execution must be halted at an input statement in order for a button
  209.   press to be read and acted upon.  See next page.
  210.  
  211. Here is a sample program:
  212.  
  213.   ' this button will be labeled Bell and will be located
  214.   ' in the lower right corner.  When it is pressed, program
  215.   ' execution will transfer to [bell]
  216.  
  217.   button #graph, Bell, [bell], LR, 37, 20
  218.  
  219.   ' this button will be labeled Quit and will be located
  220.   ' in the lower left corner.  When it is pressed, the string
  221.  
  222. (Listing continues next page...)   ' "quit" will be returned.
  223.  
  224.   button #graph, Quit, quit, LL, 5, 5
  225.  
  226.   ' open a window for graphics
  227.     open "Button Sample" for graphics as #graph
  228.  
  229.   ' print a message in the window
  230.     print #graph, "\\This is a test"
  231.     print #graph, "flush"
  232.  
  233.   ' get button input
  234. [loop]
  235.   input b$   ' stop and wait for a button to be pressed
  236.   if b$ = "quit" then [quit]
  237.   goto [loop]
  238.  
  239.  ' the Bell button has been pressed, ring the terminal bell
  240.  ' and close the window
  241. [bell]
  242.   beep
  243.   close #graph
  244.   end
  245.  
  246.  ' The Quit button has been pressed, close the window
  247.  ' without ringing the bell
  248. [quit]
  249.   close #graph
  250.   end
  251.  
  252.  
  253.  
  254.   See also:  BMPBUTTON, MENU
  255.  
  256. CHECKBOX #handle.ext, "label", [set], [reset], xOrg, yOrg, wide, high
  257.  
  258. Description:
  259.  
  260.   Adds a checkbox control to the window referenced by #handle.  
  261.   Checkboxes have two states, set and reset.  They are useful for getting input
  262.   of on/off  type information.
  263.  
  264.   Here is a description of the parameters of the CHECKBOX statement:
  265.  
  266.         "label"- This contains the visible text of the checkbox
  267.  
  268.     [set]    - This is the branch label to goto when the user sets the 
  269.         checkbox by clicking on it.
  270.  
  271.     [reset]     - This is the branch label to goto when the user resets the
  272.         checkbox by clicking on it.
  273.  
  274.     xOrigin - This is the x position of the checkbox relative to the upper 
  275.         left corner of the window it belongs to.
  276.  
  277.     yOrigin - This is the y position of the checkbox relative to the upper 
  278.         left corner of the window it belongs to.
  279.  
  280.     width    - This is the width of the checkbox control
  281.  
  282.     height    - This is the height of the checkbox control
  283.  
  284. Usage:
  285.  
  286.   See the included program checkbox.bas for an example of how to use
  287.   checkboxes.
  288.  
  289. CHR$( n )
  290.  
  291. Description:
  292.  
  293.   Returns a one character long string, consisting of the character 
  294.   represented on the ASCII table by the value n (0 - 255).
  295.  
  296. Usage:
  297.  
  298.   ' print each seperate word in text$ on its own line
  299.   text$ = "now is the time for all great men to rise"
  300.   for index = 1 to len(text$)
  301.       c$ = mid$(text$, index, 1)
  302.       ' if c$ is a space, change it to a carraige return
  303.       if c$ = chr$(32) then c$ = chr$(13)
  304.       print c$ ;
  305.   next index                            Produces:
  306.  
  307.                 now
  308.                 is
  309.                 the
  310.                 time
  311.                 for
  312.                 all
  313.                 great
  314.                 men
  315.                 to
  316.                 rise
  317.  
  318. _____________________________________________________________
  319.  
  320. CLOSE #handle
  321.  
  322. Description:
  323.  
  324.   This command is used to close files and devices.  This is the last step of 
  325.   a file read and/or write, or to close graphic, spreadsheet, or other 
  326.   windows when finished with them.  If when execution of a program is 
  327.   complete there are any files or devices left open, Liberty BASIC will 
  328.   display a dialog informing you that it found it necessary to close the 
  329.   opened files or devices.  This is designed as an aid for you so that you 
  330.   will be able to correct the problem.  If on the other hand you choose to 
  331.   terminate the program early (this is done by closing the program's main 
  332.   window before the program finishes), then Liberty BASIC will close any 
  333.   open files or devices without posting a notice to that effect.
  334.  
  335. Usage:
  336.  
  337.   open "Graphic" for graphics as #gWindow       ' open a graphics window
  338.   print #gWindow, "home"                ' center the pen
  339.   print #gWindow, "down"                ' put the pen down
  340.   for index = 1 to 100                  ' loop 100 times
  341.     print #gWindow, "go "; index                ' move the pen foreward
  342.     print #gWindow, "turn 63"           ' turn 63 degrees
  343.   next index
  344.   input "Press 'Return'."; r$           ' this appears in main window
  345.   close #gWindow                        ' close graphic window
  346.  
  347. _____________________________________________________________
  348.  
  349. CLS
  350.  
  351. Description:
  352.  
  353.   Clears the main program window of text and sets the cursor back at the 
  354.   upper left hand corner.  Useful  for providing a break to seperate 
  355.   different sections of a program functionally.  Additionally, since the main 
  356.   window doesn't actually discard past information on its own, the CLS 
  357.   command can be used to reclaim memory from your program by forcing the 
  358.   main window to dump old text.
  359.  
  360. Usage:
  361.  
  362.   .
  363.   .
  364.   print "The total is: "; grandTotal
  365.   input "Press 'Return' to continue."; r$
  366.   cls
  367.   print "*** Enter Next Round of Figures ***"
  368.   .
  369.   .
  370.  
  371. _____________________________________________________________
  372.  
  373. CONFIRM string; responseVar
  374.  
  375. Description:
  376.  
  377.   This statement opens a dialog box displaying the contents of string and 
  378.   presenting two buttons marked 'Yes' and 'No'.  When the selection is made, 
  379.   the string "yes" is returned if 'Yes' is pressed, and the string "no" is 
  380.   returned if 'No' is pressed.  The result is placed in responseVar.
  381.  
  382. Usage:
  383.  
  384. [quit]
  385.  
  386.   ' bring up a confirmation box to be sure that
  387.   ' the user wants to quit
  388.   confirm "Are you sure you want to QUIT?"; answer$
  389.   if answer$ = "no" then [mainLoop]
  390.   end
  391.  
  392. COS( n )
  393.  
  394. Description:
  395.  
  396.   Returns the cosine of the number n.
  397.  
  398. Usage:
  399.  
  400.   .
  401.   .
  402.   for c = 1 to 45
  403.     print "The cosine of "; c; " is "; cos(c)
  404.   next c
  405.   .
  406.   .
  407.  
  408. Note:
  409.  
  410.   See also SIN( ) and TAN( )
  411.  
  412. _____________________________________________________________
  413.  
  414. DATE$( )
  415.  
  416. Description:
  417.  
  418.   Instead of adopting MBASIC's date$ variable, we decided to use a function 
  419.   instead, figuring that this might give us additional flexibility later.  
  420.   This function returns the current date in long format.
  421.  
  422. Usage:
  423.  
  424.   print date$( )
  425.  
  426. Produces:
  427.  
  428.   Feb 5, 1995
  429.  
  430. Or you can assign a variable the result:
  431.  
  432.   d$ = date$( )
  433.  
  434. _____________________________________________________________
  435.  
  436. DIM array(size, size)
  437.  
  438. Description:
  439.  
  440.   DIM sets the maximum size of an array.  Any array can be dimensioned to 
  441.   have as many elements as memory allows.  If an array is not DIMensioned 
  442.   explicitly, then the array will be limited to 10 elements, 0 to 9.  Non 
  443.   DIMensioned double subscript arrays will be limited to 100 elements 0 to 9 
  444.   by 0 to 9.
  445.  
  446. Usage:
  447.  
  448.   print "Please enter 10 names."
  449.   for index = 0 to 9
  450.     input names$ : name$(index) = name$
  451.   next index
  452.  
  453.   The FOR . . . NEXT loop in this example is limited to a maximum value of 
  454.   9 because the array names$( ) is not dimensioned, and therefore is limited to 
  455.   10 elements.  To remedy this problem, we can add a DIM statement, like so:
  456.  
  457.   dim names$(20)
  458.   print "Please enter 20 names."
  459.   for index = 0 to 19
  460.     input names$ : names$(index) = name$
  461.   next index
  462.  
  463. Double subscripted arrays can store information more flexibly, like so:
  464.  
  465.   dim customerInfo$(10, 5)
  466.   print "Please enter information for 10 customers."
  467.   for index = 0 to 9
  468.     input "Customer name >"; info$ : customerInfo$(index, 0) = info$
  469.     input "Address >"; info$ : customerInfo$(index, 1) = info$
  470.     input "City >"; info$ : customerInfo$(index, 2) = info$
  471.     input "State >"; info$ : customerInfo$(index, 3) = info$
  472.     input "Zip >"; info$ : customerInfo$(index, 4) = info$
  473.   next index
  474.  
  475. _____________________________________________________________
  476.  
  477. Drives$
  478.  
  479. Description:
  480.  
  481.   Drives$ is a system variable.  You can operate on it like any other
  482.   variable.  Use it in expressions, print it, perform functions on it, etc.  It's
  483.   special in that it contains the drive letters for all the drives installed on
  484.   in the computer in use.
  485.  
  486.   For example:
  487.  
  488.     print Drives$
  489.  
  490.   Would in many cases produce:
  491.  
  492.     a: b: c:
  493.  
  494.   Or you could use it to provide a way to select a drive like this:
  495.  
  496.     'a simple example illustrating the use of the Drives$ variable
  497.     dim letters$(26)
  498.     index = 0
  499.  
  500. (Listing continues next page...)
  501.     while word$(Drives$, index + 1) <> ""
  502.         letters$(index) = word$(Drives$, index + 1)
  503.         index = index + 1
  504.     wend
  505.  
  506.     statictext #select, "Double-click to pick a drive:", 10, 10, 200, 20
  507.     listbox #select.list, letters$(, [selectionMade], 10, 35, 100, 150
  508.     open "Scan drive" for dialog as #select
  509.  
  510.     input r$
  511.  
  512. [selectionMade]
  513.  
  514.     close #select
  515.     end
  516.  
  517. _____________________________________________________________
  518.  
  519. DUMP
  520.  
  521. Description:
  522.  
  523.   Forces anything that has been LPRINTed to be sent to the Print Manager.
  524.  
  525. Usage:
  526.  
  527.   'sample program using LPRINT and DUMP
  528.   open "c:\autoexec.bat" for input as #source
  529.   while eof( #source ) = 0
  530.     line input #source, text$        'print each line
  531.     lprint text$
  532.   wend
  533.   close #source
  534.   dump         'force the print job
  535.   end
  536.  
  537. Note: see also LPRINT
  538. ELSE
  539.  
  540.     See IF . . . THEN . . . ELSE
  541.  
  542. _____________________________________________________________
  543.  
  544. EOF(#handle)
  545.  
  546. Description:
  547.  
  548.   Used to determine when reading from a sequential file whether the end of 
  549.   the file has been reached.  If so, -1 is returned, otherwise 0 is returned.
  550.  
  551. Usage:
  552.  
  553.   open "testfile" for input as #1
  554.   if eof(#1) < 0 then [skipIt]
  555. [loop]
  556.   input #1, text$
  557.   print text$
  558.   if eof(#1) = 0 then [loop]
  559. [skipIt]
  560.   close #1
  561.  
  562. _____________________________________________________________
  563.  
  564. END
  565.  
  566. Description:
  567.  
  568.   Used to immediately terminate execution of a program.  If any files or 
  569.   windows are still open (see CLOSE) when execution is terminated, then 
  570.   Liberty BASIC will close them for you and present you with a dialog 
  571.   expressing this fact.  It is good programming practice to close files and 
  572.   windows before terminating execution.
  573.  
  574.   Note:  The STOP statement is functionally identical to END and is 
  575.   interchangable
  576. Usage:
  577.  
  578.   .
  579.   .
  580.   print "Preliminary Tests Complete."
  581. [askAgain]
  582.   input "Would you like to continue (Y/N) ?"; yesOrNo$
  583.   yesOrNo$ = left$(yesOrNo$, 1)
  584.   if yesOrNo$ = "y" or yesOrNo$ = "Y" then [continueA]
  585.   if yesOrNo$ = 'n" or yesOrNo$ = "N" then end
  586.   print "Please answer Y or N."
  587.   goto [askAgain]
  588. [continueA]
  589.   .
  590.   .
  591.  
  592. _____________________________________________________________
  593.  
  594. EXP( n )
  595.  
  596. Description:
  597.  
  598.   This function returns e ^ n,   e being 2.7182818 . . .
  599.  
  600. Usage:
  601.  
  602.   print exp( 5 )              produces:  148.41315    
  603.  
  604. _____________________________________________________________
  605.  
  606. FIELD #handle, # as varName, # as varName, . . . 
  607.  
  608. Description:
  609.  
  610.   FIELD is used with an OPEN "filename.ext" for random as #handle
  611.   statement to specify the fields of data in each record of the opened file.  For
  612.   example in this program FIELD sets up 6 fields of data, each with an
  613.   appropriate length, and associates each with a string variable that holds the
  614.   data to be stored in that field:
  615.  
  616.   open "custdata.001" for random as #cust len = 70   ' open as random access 
  617.   field #cust, 20 as name$, 20 as street$, 15 as city$, 2 as state$, 10 as zip$
  618.  
  619. [inputLoop] 
  620.   input "Name >"; name$
  621.   input "Street >"; street$
  622.   input "City >"; city$
  623.   input "State >"; state$
  624.   input "Zip Code >"; zip$
  625.  
  626.   confirm "Is this entry correct?"; yesNo$   ' ask if the data is entered correctly
  627.   if  yesNo$ = "no" then [inputLoop]
  628.  
  629.   recNumber = recNumber + 1   ' add 1 to the record # and put the record
  630.   put #cust, recNumber
  631.  
  632.   confirm "Enter more records?"; yesNo$   ' ask whether to enter more
  633.   if yesNo$ = "yes" then [inputLoop]
  634.  
  635.   close #cust   ' end of program, close file
  636.   end
  637.  
  638. Notice that Liberty BASIC permits the use of numeric variables in FIELD
  639. (eg. age), and it allows you to PUT and GET with both string and numeric
  640. variables, automatically, without needing LSET, RSET, MKI$, MKS$, MKD$, CVI, CVS, 
  641. & CVD that are required with Microsoft BASICs.
  642.  
  643. Note: See also PUT and GET
  644.  
  645. FILEDIALOG titleString, templateString, receiverVar$
  646.  
  647. Description:
  648.  
  649.   This command opens a file dialog box.  The titleString is used to
  650.   label the dialog box.  The templateString is used as a filter to
  651.   list only files matching a wildcard, or to place a full suggested
  652.   filename.
  653.  
  654.   The box lets you navigate around the directory structure,
  655.   looking at files that have a specific extension.  You can then select
  656.   one, and the resulting full path specification will be placed into
  657.   receiverVar$, above.
  658.  
  659.   The following example would produce the dialog box below:
  660.  
  661.     filedialog "test it", "*.txt", fileName$
  662.  
  663. If then summary.txt were selected, and OK clicked, then program
  664. execution would resume after placing the string "c:\liberty\summary.txt"
  665. into fileName$.
  666.  
  667. If on the other hand Cancel were clicked, then an empty string
  668. would be placed into fileName$.  Program execution would then resume.
  669.  
  670. Look at the program grapher1.bas for a practical application of 
  671. this command.
  672.  
  673. _____________________________________________________________
  674.  
  675. FILES
  676.  
  677. Description:
  678.  
  679.   The FILES statement collects file and directory information from any
  680.   disk and or directory and fills a double-dimensioned array with the
  681.   information.
  682.  
  683. Usage:
  684.  
  685.   'you must predimension an array, even though FILES will redimension
  686.   'it to fit the information it provides
  687.   dim info$(10, 10)
  688.   .
  689.   .
  690.   .
  691.   files "c:\", info$(
  692.  
  693.   The above FILES statement will fill info$( ) in this fashion:
  694.  
  695.     info$(0, 0) will contain a string specifying the qty of files found
  696.     info$(0, 1) will contain a string specifying the qty of subdirectories found
  697.     info$(0, 2) will contain the drive spec
  698.     info$(0, 3) will contain the directory path
  699.  
  700.   Starting at info$(1, x) you will have file information like so:
  701.  
  702.     info$(1, 0) will contain the file name
  703.     info$(1, 1) will contain the file size
  704.     info$(1, 2) will contain the file date/time stamp
  705.   Knowing from info$(0, 0) how many files we have (call it f), we know that 
  706.   our subdirectory information starts at f+1, so:
  707.  
  708.     info$(f+1, 0) contains the complete path of a directory entry (\work\math)
  709.     info$(f+1, 1) contains just the name of the directory in specified (math)
  710.  
  711.   See the dir.bas example included.
  712.  
  713. _____________________________________________________________
  714.  
  715. FOR . . . NEXT
  716.  
  717. Description:
  718.  
  719.   The FOR . . . NEXT looping construct provides a way to execute code a
  720.   specific amount of times.  A starting and ending value are specified like so:
  721.  
  722.     for var = 1 to 10
  723.       {BASIC code}
  724.     next var
  725.  
  726.   In this case, the {BASIC code} is executed 10 times, with var being 1 the 
  727.   first time, 2 the second, and on through 10 the tenth time.  Optionally 
  728.   (and usually) var is used in some calculation(s) in the {BASIC code}.  
  729.   For example if the {BASIC code} is  print var ^ 2, then a list of squares 
  730.   for var will be displayed upon execution.
  731.  
  732.   The specified range could just as easily be 2 TO 20, instead of 1 TO 10, 
  733.   but since the loop always counts +1 at a time, the first number must be 
  734.   less than the second.  The way around this limitation is to place STEP n 
  735.   at the end of for FOR statement like so:
  736.  
  737.     for index = 20 to 2 step -1
  738.       {BASIC code}
  739.     next index
  740.   This would loop 19 times returning values for index that start with 
  741.   20 and end with 2.  STEP can be used with both positive and and negative 
  742.   numbers and it is not limited to integer values.  For example:
  743.  
  744.     for x = 0 to 1 step .01
  745.       print "The sine of "; x; " is "; sin(x)
  746.     next x
  747.  
  748.   NOTE:  It is not recommended to pass control of a program out of a   FOR
  749.    . . . NEXT loop using GOTO (GOSUB is acceptable).  Liberty BASIC may 
  750.   behave unpredictably.  For example:
  751.  
  752.   for index = 1 to 10
  753.     print "Enter Customer # "; index
  754.     input customer$
  755.     if customer$ = "" then [quitEntry]   ' <- don't cut out of a for ... next loop
  756.     cust$(index) = customer$
  757.   next index
  758.   [quitEntry]
  759.  
  760.    . . . is not allowed!  Rather use while ... wend:
  761.  
  762.   index = 1
  763.   while customer$ <> "" and index <= 10
  764.     print "Enter Customer # "; index
  765.     input customer$
  766.     cust$(index) = customer$
  767.     index = index + 1
  768.   wend
  769.  
  770. GET #handle, recordNumber
  771.  
  772. Description:
  773.  
  774.   GET is used after a random access file is opened to get a record of 
  775.   information (see FIELD) out of the file from a specified position.  For 
  776.   example:
  777.  
  778.  
  779.   open "custdata.001" for random as #cust len = 70   ' open as random access
  780.   field #cust, 20 as name$, 20 as street$, 15 as city$, 2 as state$, 10 as zip$
  781.  
  782.   ' get the data from record 1
  783.   get #cust, 1
  784.  
  785.   print name$
  786.   print street$
  787.   print city$
  788.   print state$
  789.   print zip$
  790.  
  791.   close #cust
  792.   end
  793.  
  794.  
  795. Note:  See also PUT, FIELD
  796.  
  797. _____________________________________________________________
  798.  
  799. GETTRIM #handle, recordNumber
  800.  
  801. Description:
  802.  
  803.   The GETTRIM command is exactly like the GET command, but when data 
  804.   is retrieved, all leading and trailing blank space is removed from all data 
  805.   fields before being committed to variables.
  806. GOSUB label
  807.  
  808. Description:
  809.  
  810.   GOSUB causes execution to proceed to the program code following the 
  811.   label if it exists,  using the form 'GOSUB label'.  The label can be either a 
  812.   traditional line number or a branch label in the format [???????] where the 
  813.   ?'s can be any upper/lowercase letter or digit combination.  Spaces are
  814.   not allowed.
  815.  
  816.   Some valid branch labels:  [mainMenu]  [enterLimits]  [1moreTime]
  817.   Some invalid branch labels:  [enter limits]  mainMenu
  818.  
  819.   After execution is transferred to the point of the branch label, then each 
  820.   statement will be executed in normal fashion until a RETURN is 
  821.   encountered.  When this happens, execution is transferred back to the 
  822.   statement immediately after the GOSUB.  The section of code between a
  823.   GOSUB and its RETURN is known as a 'subroutine.'  One purpose of a 
  824.   subroutine is to save memory by having only one copy of code that is used
  825.   many times throughout a program.
  826.  
  827. Usage:
  828.  
  829.   .
  830.   .
  831.   print "Do you want to continue?"
  832.   gosub [yesOrNo]
  833.   if answer$ = "N" then [quit]
  834.   print "Would you like to repeat the last sequence?"
  835.   gosub [yesOrNo]
  836.   if answer$ = "Y" then [repeat]
  837.   goto [generateNew]
  838.  
  839. [yesOrNo]
  840.   input answer$
  841.   answer$ = left$(answer$, 1)
  842.  
  843. (Listing continues next page...)
  844.   if answer$ = "y" then answer$ = "Y"
  845.   if answer$ = "n" then answer$ = "N"
  846.   if answer$ = "Y" or answer$ = "N" then return
  847.   print "Please answer Y or N."
  848.   goto [yesOrNo]
  849.   .
  850.   .
  851.  
  852.   You can see how using GOSUB [yesOrNo] in this case saves many lines of 
  853.   code in this example.  The subroutine [yesOrNo] could easily be used many 
  854.   other times in such a hypothetical program, saving memory and reducing 
  855.   typing time and effort.  This reduces errors and increases productivity.  See 
  856.   also GOTO
  857.  
  858. ____________________________________________________________
  859.  
  860. GOTO label
  861.  
  862. Description:
  863.  
  864.   GOTO causes Liberty BASIC to proceed to the program code following the
  865.   label if one exists,  using the form 'GOTO label'.  The label can be either a 
  866.   traditional line number or a branch label in the format [???????] where the 
  867.   ?'s can be any upper/lowercase letter combination.  Spaces are not allowed.
  868.  
  869.   Some valid branch labels:  [mainMenu]  [enterLimits]  [1moreTime]
  870.   Some invalid branch labels:  [enter limits]  mainMenu
  871.  
  872. Usage:
  873.  
  874.   .
  875.   .
  876. [repeat]
  877.   .
  878.   .
  879. [askAgain]
  880.   print "Make your selection (m, r, x)."
  881.   input selection$
  882.   if selection$ = "M" then goto [menu]
  883.   if selection$ = "R" then goto [repeat]
  884.   if selection$ = "X" then goto [exit]
  885.   goto [askAgain]
  886.   .
  887.   .
  888. [menu]
  889.   print "Here is the main menu."
  890.   .
  891.   .
  892. [exit]
  893.   print "Okay, bye."
  894.   end
  895.  
  896. Notes:
  897.  
  898.   In the lines containing IF . . . THEN GOTO, the GOTO is optional.  
  899.   The expression IF . . . THEN [menu]  is just as valid as 
  900.   IF . . . THEN GOTO [menu].  But in the line GOTO [askAgain], the GOTO 
  901.   is required. 
  902.  
  903.   See also GOSUB
  904.  
  905. IF expression THEN expression(s)
  906.  
  907. Description:
  908.  
  909.   The purpose of IF . . . THEN is to provide a mechanism for your computer 
  910.   software to make decisions based on the data available.  A decision-making 
  911.   mechanism is used in very simple situations and can be used in 
  912.   combinations to engineer solutions to problems of great complexity.
  913.  
  914.   The expression (see above) is a boolean expression (meaning that it 
  915.   evaluates to a true or false condition).  In this expression we place the 
  916.   logic of our decision-making process.  For example, if we are writing a 
  917.   inventory application, and we need to know when any item drops below a 
  918.   certain level in inventory, then our decision-making logic might look like 
  919.   this:
  920.  
  921.   if level <= reorderLevel then expression(s)
  922.   next BASIC program line
  923.  
  924.   The 'level <= reorderLevel' part of the above expression will evaluate to 
  925.   either true or false.  If the result was true, then the expression(s) part 
  926.   of that line (consisting of a branch label or any valid BASIC statements) 
  927.   will be executed.  Otherwise execution will immediately begin at the next 
  928.   BASIC program line.
  929.  
  930.   The following are permitted:
  931.  
  932.   if a < b then [lessThan]      
  933.  
  934.   This causes program execution to begin at branch label [lessThan]
  935.   if a is less than b.
  936.  
  937.   if sample < lowLimit or sample > highLimit then print"Out of range!"
  938.  
  939.   This causes the message Out of range! to be displayed if sample is less 
  940.   than lowLimit or greater then highLimit.
  941. IF expr THEN expression(s)1 ELSE expression(s)2
  942.  
  943. Description:
  944.  
  945.   This extended form of IF . . . THEN adds expressiveness and simplifies 
  946.   coding of some logical decision-making software.  Here is an example of its 
  947.   usefulness.
  948.  
  949.   Consider:
  950.  
  951. [retry]
  952.   input"Please choose mode, (N)ovice or e(X)pert?"; mode$
  953.   if len(mode$) = 0 then print "Invalid entry! Retry" : goto [retry]
  954.   mode$ = left$(mode$, 1)
  955.   if instr("NnXx", mode$) = 0 then print "Invalid entry! Retry" : goto [retry]
  956.   if instr("Nn", mode$) > 0 then print "Novice mode" : goto [main]
  957.   print "eXpert mode"
  958.  
  959. [main]
  960.   print "Main Selection Menu"
  961.  
  962.   Look at the two lines before the [main] branch label.  The first of these 
  963.   two lines is required to branch over the next line.  These lines can be 
  964.   shortened to one line as follows:
  965.  
  966.   if instr("Nn",mode$)> 0 then print "Novice mode" else print "eXpert mode"
  967.  
  968.   Some permitted forms are as follows:
  969.  
  970.   if a < b then statement else statement
  971.   if a < b then [label] else statement
  972.   if a < b then statement else [label]
  973.   if a < b then statement : statement else statement
  974.   if a < b then statement else statement : statement
  975.   if a < b then statement : goto [label] else statement
  976.   if a < b then gosub [label1] else gosub [label2]
  977.  
  978.   Any number of variations on these formats are permissible.  The a < b 
  979.   boolean expression is of course only a simple example chosen for 
  980.   convenience.  You must replace it with the correct expression to suit your 
  981.   problem.
  982.  
  983. _____________________________________________________________
  984.  
  985. INPUT  #handle  "string expression";  variableName
  986.  
  987. Description:
  988.  
  989.   This command has several forms:
  990.  
  991.   input var
  992.  
  993.         - stop and wait for user to enter data in the program's
  994.         main window and press the 'Return' key, then assign
  995.         the data entered to var.
  996.  
  997.   input "enter data"; var
  998.  
  999.         - display the string "enter data" and then stop
  1000.         and wait for user to enter data in the program's main window
  1001.         and press 'Return', then assign the data entered to var.
  1002.  
  1003.   input #name, var
  1004.  
  1005.         - Get the next data item from the open file or device using 
  1006.         handle named #handle and assign the data to var.  If no device 
  1007.         or file exists that uses the handle named #handle, then return an
  1008.         error.
  1009.  
  1010.   input #name, var1, var2
  1011.  
  1012.         - The next two data items are fetched and assigned to var1 and 
  1013.         var2.  
  1014.  
  1015.   line input #name, var$
  1016.  
  1017.         - The line input statement will read from the file, ignoring 
  1018.         commas in the input stream and completing the data item only at 
  1019.         the next carraige return or at the end of file.  This is useful for 
  1020.         reading text with embedded commas
  1021.  
  1022. Usage:
  1023.  
  1024.   'Display a text file
  1025.   input "Please type a filename >";  filename$
  1026.   open filename$ for input as #text
  1027. [loop]
  1028.   if eof(#text) <> 0 then [quit]
  1029.   input #text, item$
  1030.   print item$
  1031.   goto [loop]
  1032. [quit]
  1033.   close #text
  1034.   print "Done."
  1035.   end
  1036.  
  1037.  
  1038. Note:  In Liberty BASIC, INPUT cannot be used to input data 
  1039. directly into arrays, only into the simpler variables.
  1040.  
  1041.   input a$(1)                    - is illegal
  1042.   input string$ : a$(1) = string$        - use this instead
  1043.  
  1044. _____________________________________________________________
  1045.  
  1046. INPUT (continued)
  1047.  
  1048. Most versions of Microsoft BASIC implement INPUT to automatically place a question
  1049. mark on the display in front of the cursor when the user is prompted for information 
  1050. like so:
  1051.  
  1052.   input "Please enter the upper limit"; limit
  1053.  
  1054.   produces:
  1055.  
  1056.     Please enter the upper limit ? |
  1057.  
  1058. Liberty BASIC permits you the luxury of deciding for yourself whether the 
  1059. question mark appears at all.
  1060.  
  1061.   input "Please enter the upper limit :"; limit
  1062.  
  1063.   produces:
  1064.  
  1065.     Please enter the upper limit: |
  1066.  
  1067.   and:    input limit    produces simply:
  1068.  
  1069.     ? |
  1070.  
  1071. In the simple form input limit, the question mark is inserted automatically,  
  1072. but if you do specify a prompt, as in the above example, only the contents of 
  1073. the prompt are displayed, and nothing more.  If for some reason you wish to 
  1074. input without a prompt and without a question mark, then the following will 
  1075. achieve the desired effect:
  1076.  
  1077.   input ""; limit 
  1078.  
  1079. Additionally, in most Microsoft BASICs, if INPUT expects a numeric value and 
  1080. a non numeric or string value is entered, the user will be faced with a 
  1081. comment something like 'Redo From Start', and be expected to reenter.  
  1082. Liberty BASIC does not automatically do this, but converts the entry to a zero 
  1083. value and sets the variable accordingly.  This is not considered a problem but 
  1084. rather a language feature, allowing you to decide for yourself how your program 
  1085. will respond to the situation.
  1086.  
  1087. One last note:  In Liberty BASIC input prompt$; limit is also valid. Try:
  1088.  
  1089.   prompt$ = "Please enter the upper limit:"
  1090.   input prompt$; limit
  1091. INPUT$(#handle, items)
  1092.  
  1093. Description:
  1094.  
  1095.   Permits the retrieval of a specified number of items from an open file or 
  1096.   device using #handle.  If #handle does not refer to an open file or device 
  1097.   then an error will be reported.
  1098.  
  1099. Usage:
  1100.  
  1101.   'read and display a file one character at a time
  1102.   open "c:\autoexec.bat" for input as #1
  1103. [loop]
  1104.     if eof(#1) <> 0 then [quit]
  1105.     print input$(#1, 1);
  1106.     goto [loop]
  1107. [quit]
  1108.     close #1
  1109.     end
  1110.  
  1111. For other devices (non disk files), one item does not necessarily refer to a 
  1112. single character, but INPUT$( ) may return items more than one character in 
  1113. length.  In most cases, use of INPUT #handle, varName works just as well or 
  1114. better for reading devices.
  1115.  
  1116. _____________________________________________________________
  1117.  
  1118. INSTR(string1, string2 [, starting] )
  1119.  
  1120. Description:
  1121.  
  1122.   This function returns the position of string2 within string1.  If string2 
  1123.   occurs more than once in string 1, then only the position of the leftmost 
  1124.   occurance will be returned.  If the optional parameter starting is included, 
  1125.   then the search for string2 will begin at the position specified by starting.
  1126.  
  1127. Usage:
  1128.  
  1129.   print instr("hello there", "lo")
  1130.  
  1131.   produces:    4
  1132.  
  1133.   print instr("greetings and meetings", "eetin")
  1134.  
  1135.   produces:    3
  1136.  
  1137.   print instr("greetings and meetings", "eetin", 5)
  1138.  
  1139.   produces:    16
  1140.  
  1141. If string2 is not found in string1, then INSTR( ) will return 0.
  1142.  
  1143.   print instr("hello", "el", 3)
  1144.  
  1145.   produces:    0
  1146.  
  1147.   and so does:
  1148.  
  1149.   print instr("hello", "bye")
  1150.  
  1151. _____________________________________________________________
  1152.  
  1153. INT(number)
  1154.  
  1155. Description:
  1156.  
  1157.   This function removes the fractional part of number, leaving only the whole
  1158.   number part behind.
  1159.  
  1160. Usage:
  1161.  
  1162. [retry]
  1163.   input "Enter an integer number>"; i
  1164.   if i <> int(i) then bell: print i; " isn't an integer! Re-enter.": goto [retry]
  1165. KILL "filename.ext"
  1166.  
  1167. Description:
  1168.  
  1169.   This command deletes the file specified by filename.ext.  The filename can 
  1170.   include a complete path specification.
  1171.  
  1172. _____________________________________________________________
  1173.  
  1174. LEFT$(string, number)
  1175.  
  1176. Description:
  1177.  
  1178.   This function returns from string the specified number of characters starting
  1179.   from the left.  So if  string is "hello there", and number is 5, then "hello"
  1180.   would be the result.
  1181.  
  1182. Usage:
  1183.  
  1184.  
  1185. [retry]
  1186.   input "Please enter a sentence>"; sentence$
  1187.   if sentence$ = "" then [retry]
  1188.   for i = 1 to len(sentence$)
  1189.     print left$(sentence$, i)
  1190.   next i
  1191.  
  1192. Produces:
  1193.  
  1194.   Please enter a sentence>That's all folks!
  1195.   T
  1196.   Th
  1197.   Tha
  1198.   That
  1199.   That'
  1200.   That's
  1201.   That's_
  1202.   That's a
  1203.   That's al
  1204.   That's all
  1205.   That's all_
  1206.   That's all f
  1207.   That's all fo
  1208.   That's all fol
  1209.   That's all folk
  1210.   That's all folks
  1211.   That's all folks!
  1212.  
  1213. Note:
  1214.  
  1215.   If number is zero or less, then "" (an empty string) will be returned.  If 
  1216.   the number is greater than or equal to the number of characters in string,
  1217.   then string will be returned.
  1218.  
  1219.   See also MID$( ) and RIGHT$( )
  1220.  
  1221. _____________________________________________________________
  1222.  
  1223. LEN( string )
  1224.  
  1225. Description:
  1226.  
  1227.   This function returns the length in characters of string, which can be any 
  1228.   valid string expression.
  1229.  
  1230. Usage:
  1231.  
  1232.   prompt "What is your name?"; yourName$
  1233.   print "Your name is "; len(yourName$); " letters long"
  1234.  
  1235. LET assignment expression
  1236.  
  1237. Description:
  1238.  
  1239.   LET is an optional prefix for any BASIC assignment expression.  You may 
  1240.   leave the word out of your programs, but some prefer to use it.
  1241.  
  1242. Usage:
  1243.  
  1244.   Either is acceptable:
  1245.  
  1246.   let name$ = "John"    
  1247. or
  1248.   name$ = "John"
  1249.  
  1250.   Or yet again:
  1251.  
  1252.   let c = sqr(a^2 + b^2)
  1253. or
  1254.   c = sqr(a^2 + b^2)
  1255.  
  1256. _____________________________________________________________
  1257.  
  1258. LINE INPUT
  1259.  
  1260. See INPUT
  1261. LOADBMP "name", "filename.bmp"
  1262.  
  1263. Description:
  1264.  
  1265.   This command loads standard Windows *.bmp bitmap file into
  1266.   Liberty BASIC.  The "name" is a string you would choose to
  1267.   describe the bitmap you're loading, and the "filename.bmp" is
  1268.   the actual name of the bitmap file.  Once loaded, the bitmap can
  1269.   then be displayed in a graphics window type.  See the chapter
  1270.   Window Device Commands for more information.
  1271.  
  1272. Usage:
  1273.  
  1274.   See the sample program ttt.bas for an example using LOADBMP.
  1275.  
  1276. _____________________________________________________________
  1277.  
  1278. LOF(#handle)
  1279.  
  1280. Description:
  1281.  
  1282.   Returns the # of bytes contained in the file referenced by #handle.
  1283.  
  1284. Usage:
  1285.  
  1286.     open "\autoexec.bat" for input as #1
  1287.     qtyBytes = lof(#1)
  1288.     for x = 1 to qtyBytes
  1289.         print input$(#1, 1) ;
  1290.     next x
  1291.     close #1
  1292.     end
  1293.  
  1294. _____________________________________________________________
  1295.  
  1296. LOWER$( s$ )
  1297.  
  1298. Description:
  1299.  
  1300.   This function returns an all lowercase version of s$.
  1301.  
  1302. Usage:
  1303.  
  1304.   print lower$( "The Quick Brown Fox" )
  1305.  
  1306.   produces:  the quick brown fox
  1307.  
  1308. _____________________________________________________________
  1309.  
  1310. LPRINT
  1311.  
  1312. Description:
  1313.  
  1314.   This statement is used to send data to the default printer (as determined by
  1315.   the Windows Print Manager).  A series of expressions can follow LPRINT 
  1316.   (there does not  need to be any expression at all), each seperated by a 
  1317.   semicolon.  Each expression is sent in sequence.  When you are finished
  1318.   sending data to the printer, you should commit the print job by using the
  1319.   DUMP statement.  Liberty BASIC will eventually send your print job, but
  1320.   DUMP forces the job to finish.
  1321.  
  1322. Usage:
  1323.  
  1324.   lprint "hello world"        'This prints hello world
  1325.   dump
  1326.  
  1327.   lprint "hello ";               'This also prints hello world
  1328.   lprint "world"
  1329.   dump
  1330.  
  1331.   age = 23
  1332.   lprint "Ed is "; age; " years old"     'This prints Ed is 23 years old
  1333.   dump
  1334.  
  1335. _____________________________________________________________
  1336.  
  1337. MENU #handle, title,   text, branchLabel,   text, branchLabel,  |  , . . .
  1338.  
  1339. Description:
  1340.  
  1341.   Adds a pull down menu to the window at #handle.  Title specifies the title 
  1342.   of the menu, as seen on the menu bar of the window, and each  text,
  1343.   branchLabel  pair after the title adds a menu item to the menu, and tells
  1344.   Liberty BASIC where to branch to when the menu item is chosen.  The  |
  1345.   character can optionally be placed between menu items, to cause a 
  1346.   seperating line to be added between the items with the menu is pulled down.
  1347.  
  1348.   As an example, if you wanted to have a graphics window opened, and then
  1349.   be able to pull down some menus to control color and geometric objects, 
  1350.   your opening code might look like this:
  1351.  
  1352.   menu #geo, &Color, &Red, [setRed], &Green, [setGreen], &Blue, [setBlue]
  1353.   menu #geo, &Shape, &Rectangle, [rect], &Triangle, [triang], &Line, [line]
  1354.   open "Geometric wite-board" for graphics_nsb as #geo
  1355.   input r$  ' stop and wait for a menu item to be chosen
  1356.  
  1357.   Notice that the MENU lines must go before the OPEN statement, and must
  1358.   use the same handle as the window that it will be associated with (#geo in
  1359.   this case).  See that execution must be stopped at an input statement for the 
  1360.   menu choice to be acted upon.  Examine the example program draw1.bas
  1361.   for an example using the MENU command.
  1362.  
  1363.   Notice: The & characters placed in the title and text items for the menu
  1364.   determine accelerator placement for each menu.  Try experimenting!
  1365.  
  1366. _____________________________________________________________
  1367.  
  1368. MID$(string, index [, number] )
  1369.  
  1370. Description:
  1371.  
  1372.   Permits the extraction of a sequence of characters from string starting at 
  1373.   index.  If number is not specified, then all the characters from index to the
  1374.   end of the string are returned.  If number is specified, then only as many
  1375.   characters as number specifies will be returned, starting from index.
  1376.  
  1377. Usage:
  1378.  
  1379.   print mid$("Greetings Earth man!!", 11, 5)
  1380.  
  1381. Produces:   Earth
  1382.  
  1383. And:
  1384.  
  1385.   print mid$("Greetings Earth man!!", 11)
  1386.  
  1387. Produces:   Earth man!!
  1388.  
  1389. And:
  1390.  
  1391.   string = "The quick brown fox jumped over the lazy dog"
  1392.   for i = 1 to len(string$) step 5
  1393.     print mid$(string$, i, 5)
  1394.   next i
  1395. Produces (each _ denotes a space):
  1396.  
  1397.   The_q
  1398.   uick_
  1399.   brown
  1400.   _fox_
  1401.   jumpe
  1402.   d_ove
  1403.   r_the
  1404.   _lazy
  1405.   _dog
  1406.  
  1407.  
  1408. Note:
  1409.  
  1410.   See also LEFT$( ) and RIGHT$( )
  1411.  
  1412. _____________________________________________________________
  1413.  
  1414. NAME stringExpr1 AS stringExpr2
  1415.  
  1416. Description:
  1417.  
  1418.   This command renames the file specified in the string expression 
  1419.   stringExpr1 to stringExpr2.  StringExpr1 can represent any valid filename 
  1420.   that is not a read-only file, and stringExpr2 can be any valid filename as 
  1421.   long as it doesn't specify a file that already exists.
  1422.  
  1423. Usage:
  1424.  
  1425.   'rename the old file as a backup
  1426.   name rootFileName$ + ".fre" as rootFileName$ + ".bak"
  1427.   'open a new file and write data
  1428.   open rootFileName$ + ".fre" for output as #disk
  1429.   .
  1430.   .
  1431.  
  1432.  
  1433. NEXT var
  1434.  
  1435.     see  FOR . . . NEXT
  1436.  
  1437. _____________________________________________________________
  1438.  
  1439. NOMAINWIN
  1440.  
  1441. Description:
  1442.  
  1443.   This command instructs Liberty BASIC not to open a main window for the
  1444.   program that includes this statement.  Some simple programs which do not 
  1445.   use separate windows for graphics, spreadsheet, or text may use only the 
  1446.   main window.  Other programs may not need the main window to do their 
  1447.   thing, and so simply including NOMAINWIN  somewhere in your program 
  1448.   source will prevent the window from opening.
  1449.  
  1450.   If NOMAINWIN is used, when all other windows owned by that program
  1451.   are closed, then the program terminates execution automatically.
  1452.  
  1453.   For examples of the usage of NOMAINWIN, examine the included Liberty
  1454.   BASIC programs (buttons1.bas for example).
  1455.  
  1456. _____________________________________________________________
  1457.  
  1458. NOTICE "string expression"
  1459.  
  1460. Description:
  1461.  
  1462.   This command pops up a dialog box which displays "string expression" and
  1463.   which has a button OK which the user presses after the message is read. 
  1464.   Pressing Enter also closes the dialog box.
  1465.   Two forms are allowed.  If "string expression" has no Cr character (ASCII 
  1466.   13), then the title of the dialog box will be 'Notice' and "string expression" 
  1467.   will be the message displayed inside the dialog box.  If "string expression" 
  1468.   does have a Cr character, then the part of "string expression" before Cr will 
  1469.   be used as the title for the dialog box, and the part of "string expression" 
  1470.   after Cr will be displayed as the message inside.
  1471.  
  1472. Usage:
  1473.  
  1474.     notice "Super Stats is Copyright 1992, Mathware"
  1475.  
  1476. Or:
  1477.  
  1478.     notice "Fatal Error!" + chr$(13) + "The entry buffer is full!"
  1479.   
  1480.  
  1481. _____________________________________________________________
  1482.  
  1483. OPEN string FOR mode AS #handle   LEN = n
  1484.  
  1485. Description:
  1486.  
  1487.   This statement has many functions.  It can be used to open disk files, or to
  1488.   open windows of several kinds.
  1489.  
  1490. Using OPEN with Disk files:
  1491.  
  1492.   A typical OPEN used in disk I/O looks like this:
  1493.  
  1494.   OPEN "\autoexec.bat" for input as #read
  1495.  
  1496.   This example illustrates how we would open the autoexec.bat file for 
  1497.   reading.  As you can see, string in this case is "\autoexec.bat", mode is 
  1498.   input, and #handle is read.
  1499.  
  1500.   string - this must be a valid pathname.  If the file does not exist, it will 
  1501.        be created.
  1502.  
  1503.   mode - can be input, output, append, or random
  1504.  
  1505.   #handle - use a unique descriptive word, but must start with a #.  
  1506.         This special handle is used to identify the open file in later 
  1507.         program statements
  1508.  
  1509.   LEN = n - this is an optional addition for use only when opening a random
  1510.                 access file.  The n determines how many characters long each
  1511.                 record in the file is.  If this is not specified, the default 
  1512.                 length is 128 characters.  See FIELD, GET, and PUT.
  1513.  
  1514. Using OPEN with windows:
  1515.  
  1516.   A typical OPEN used in windows looks like this:
  1517.  
  1518.   OPEN "Customer Statistics Chart" for graphics as #csc
  1519.  
  1520.   This example illustrates how we would open a window for graphics.  Once 
  1521.   the window is open, there are a wide range of commands that can be given 
  1522.   to it.  As you can see, string in this case is "Customer Statistics Chart", 
  1523.   which is used as the title of the window, mode is graphics (open a 
  1524.   window for graphics), and the #handle is #csc (derived from Customer 
  1525.   Statistics Chart), which will be used as an identifier when sending 
  1526.   commands to the window.
  1527.  
  1528.   string  - can be any valid BASIC string.  used to label the window
  1529.  
  1530.   mode  - there are a several of possibilities here: graphics, spreadsheet, or 
  1531.         text, and can end in _fs, _nsb (or other suffixes).  See page 4 - 5.
  1532.  
  1533.   #handle  - as above, must be a unique, descriptive word starting with #
  1534.  
  1535. Note:  Any opened file or window must be closed before program execution is finished.
  1536.   See CLOSE
  1537.  
  1538. _____________________________________________________________
  1539.  
  1540. Platform$
  1541.  
  1542. Description:
  1543.  
  1544.   This variable holds the string "Windows".  When programming with Liberty 
  1545.   BASIC for OS/2, the same variable holds "OS/2".
  1546.  
  1547.   This is useful so that you can take advantage of whatever differences there 
  1548.   are between the two platforms and between the versions of Liberty BASIC.
  1549.  
  1550. Note: see also Version$
  1551.  
  1552. _____________________________________________________________
  1553.  
  1554. PLAYWAVE filename [, mode ]
  1555.  
  1556. Description:
  1557.  
  1558.   Plays a *.wav sound file as specified in filename.  If mode is specified, it
  1559.   must be one of the modes specifed below:
  1560.  
  1561.     sync, synch    wait for the wave file to finish playing (the default)
  1562.     async, asynch    don't wait for the wave file to finish playing
  1563.     loop        an asynch mode.  play over and over and over...
  1564.             until a playwave "" is executed
  1565.  
  1566. *** OS/2 version of LB only rings the system bell when PLAYWAVE is
  1567. executed.  This will be fixed in an upcoming release! ***
  1568.    
  1569. PRINT
  1570.  
  1571. Description:
  1572.  
  1573.   This statement is used to send data to the main window, to a disk file, or 
  1574.   to other windows.  A series of expressions can follow PRINT (there does 
  1575.   not need to be any expression at all), each seperated by a semicolon.  Each 
  1576.   expression is displayed in sequence.  If the data is being sent to a disk 
  1577.   file, or to a window, the format is:  PRINT #handle, expression(s)
  1578.  
  1579. PRINTing to a program's main window:
  1580.  
  1581. Usage:                    Produces:
  1582.  
  1583.   print "hello world"             hello world
  1584.  
  1585.   print "hello ";                hello world
  1586.   print "world"
  1587.  
  1588.   print "hello "                hello
  1589.   print "world"                world
  1590.  
  1591.   age = 23
  1592.   print "Ed is "; age; " years old"        Ed is 23 years old
  1593.  
  1594. When printing to a disk file and in regard to the use of the semicolon at the 
  1595. end of a PRINT statement (the first line of the second example above), the rules 
  1596. are similar (only you don't see it happen because it's sent to a disk file).
  1597.  
  1598. When printing to different kinds of windows, the expressions sent are usually 
  1599. commands to the window (or requests for information from the window).  For more 
  1600. information, see chapter 4, GUI Programming.
  1601.  
  1602. PROMPT string; responseVar
  1603.  
  1604. Description:
  1605.  
  1606.   The PROMPT statement opens a dialog displaying string, and waits for the
  1607.   user to type a response and press 'Enter' (or click on OK).  The entered 
  1608.   information is placed in responseVar.  If Cancel is clicked on, then a string
  1609.   of zero length is returned.  If the value of responseVar is already set when 
  1610.   PROMPT is executed, then that value will become the 'default' or suggested
  1611.   response which can be typed over or accepted by pressing 'Enter'.
  1612.  
  1613. Usage:
  1614.  
  1615.   response$ = "C:"
  1616.   prompt "Search on which Drive? A:, B:, or C:"; response$
  1617.  
  1618. [testResponse]
  1619.   if response$ = "" then [cancelSearch]
  1620.   if len(response$) = 2 and instr("A:B:C:", response$) > 0 then [search]
  1621.   prompt "Unacceptable response.  Please try again. A:, B:, or C:"; again$
  1622.   goto [testResponse]
  1623.  
  1624. [search]
  1625.   print "Starting search . . . "
  1626.  
  1627. _____________________________________________________________
  1628.  
  1629. PUT #handle, recordNumber
  1630.  
  1631. Description:
  1632.  
  1633.   PUT is used after a random access file is opened to place a record of 
  1634.   information (see FIELD) into the file at a specified position.  For example:
  1635.  
  1636.   open "custdata.001" for random as #cust len = 70   ' open as random access
  1637.   field #cust, 20 as name$, 20 as street$, 15 as city$, 2 as state$, 10 as zip$
  1638.  
  1639. (Listing continues next page...)
  1640.   ' enter data into customer variables
  1641.   input name$
  1642.   .
  1643.   .
  1644.  
  1645.   ' put the data into record 1
  1646.   put #cust, 1
  1647.  
  1648.   close #cust
  1649.   end
  1650.  
  1651.  
  1652. Note:  See also GET, FIELD
  1653.  
  1654. _____________________________________________________________
  1655.  
  1656. RADIOBUTTON #handle.ext, "label", [set], [reset], xOrigin, yOrigin, width, height
  1657.  
  1658. Description:
  1659.  
  1660.   Adds a radiobutton control to the window referenced by #handle.  
  1661.   Radiobuttons have two states, set and reset.  They are useful for getting 
  1662.   input of on/off  type information.
  1663.  
  1664.   All radiobuttons on a given window are linked together, so that if you set 
  1665.   one by clicking on it, all the others will be reset.
  1666.  
  1667.   Here is a description of the parameters of the RADIOBUTTON statement:
  1668.  
  1669.         "label"    - This contains the visible text of the radiobutton 
  1670.  
  1671.     [set]    - This is the branch label to goto when the user sets the 
  1672.         radiobutton by clicking on it.
  1673.  
  1674.     [reset]    - This is the branch label to goto when the user resets the
  1675.         radiobutton by clicking on it. (this doesn't actually do anything
  1676.         because radiobuttons can't be reset by clicking on them).
  1677.     xOrigin    - This is the x position of the radiobutton relative to the 
  1678.             upper left corner of the window it belongs to.
  1679.  
  1680.     yOrigin    - This is the y position of the radiobutton relative to the 
  1681.             upper left corner of the window it belongs to.
  1682.  
  1683.     width    - This is the width of the radiobutton control
  1684.  
  1685.     height    - This is the height of the radiobutton control
  1686.  
  1687. Usage:
  1688.  
  1689.   See the included program radiobtn.bas for an example of how to use 
  1690.   radiobuttons.
  1691.  
  1692. See also CHECKBOX
  1693.  
  1694. _____________________________________________________________
  1695.  
  1696. REM comment
  1697.  
  1698. Description:
  1699.  
  1700.   The REM statement is used to place comments inside of code to clearly 
  1701.   explain the purpose of each section of code.  This is useful to both the 
  1702.   programmer who writes the code or to anyone who might later need to 
  1703.   modify the program.  Use REM statements liberally.  There is a shorthand 
  1704.   way of using REM, which is to use the ' (apostrophe) character in place of 
  1705.   the word REM.  This is cleaner to look at, but use whichever you prefer.  
  1706.   Unlike other BASIC statements, with REM you cannot add another 
  1707.   statement after it on the same line using a colon ( : ) to seperate the 
  1708.   statements.  The rest of the line becomes part of the REM statement.
  1709.  
  1710. Usage:
  1711.  
  1712.   rem  let's pretend that this is a comment for the next line
  1713.   print "The mean average is "; meanAverage
  1714. Or:
  1715.  
  1716.   ' let's pretend that this is a comment for the next line
  1717.   print "The strength of the quake was "; magnitude
  1718.  
  1719. This doesn't work:
  1720.  
  1721.   rem  thank the user : print "Thank you for using Super Stats!"
  1722.  
  1723.     (even the print statement becomes part of the REM statement)
  1724.  
  1725.  
  1726. Note:
  1727.  
  1728.   When using ' instead of REM at the end of a line, the statement seperator :
  1729.   is not required to seperate the statement on that line from its comment.  
  1730.  
  1731. For example:
  1732.  
  1733.   print "Total dollar value: "; dollarValue : rem  print the dollar value
  1734.  
  1735. Can also be stated:
  1736.  
  1737.   print "Total dollar value: "; dollarValue  ' print the dollar value
  1738.  
  1739. Notice that the : is not required in the second form.
  1740.  
  1741. _____________________________________________________________
  1742.  
  1743. RETURN
  1744.  
  1745.     See  GOSUB
  1746.  
  1747. RIGHT$(string, number)
  1748.  
  1749. Description:
  1750.  
  1751.   Returns a sequence of characters from the right hand side of string using 
  1752.   number to determine how many characters to return.  If  number is 0, 
  1753.   then "" (an empty string) is returned.  If number is greater than or equal to
  1754.   the number of characters in string, then string will itself be returned.
  1755.  
  1756. Usage:
  1757.  
  1758.   print right$("I'm right handed", 12)
  1759.  
  1760. Produces:
  1761.  
  1762.   right handed
  1763.  
  1764. And:
  1765.  
  1766.   print right$("hello world", 50)
  1767.  
  1768. Produces:
  1769.  
  1770.   hello world
  1771.  
  1772. Note:  See also LEFT$( ) and MID$( )
  1773.  
  1774. _____________________________________________________________
  1775.  
  1776. RND(number)
  1777.  
  1778. Description:
  1779.  
  1780.   This function returns a pseudo random number between 0 and 1.  This can
  1781.   be useful in writing games and some simulations.  The particular formula 
  1782.   used in this release might more accurately be called an arbitrary number 
  1783.   generator (instead of random number generator), since if a distribution 
  1784.   curve of the output of this function were plotted, the results would be quite 
  1785.   uneven.  Nevertheless, this function should prove more than adequate 
  1786.   (especially for game play).
  1787.  
  1788.   In MBASIC it makes a difference what the value of parameter number is, 
  1789.   but in Liberty BASIC, it makes no difference.  The function will always 
  1790.   return an arbitrary number between 0 and 1.
  1791.  
  1792. Usage:
  1793.  
  1794.   ' print ten numbers between one and ten
  1795.   for a = 1 to 10
  1796.       print int(rnd(1)*10) + 1
  1797.   next a
  1798.  
  1799. _____________________________________________________________
  1800.  
  1801. RUN stringExpr1 [, mode ]
  1802.  
  1803. Description:
  1804.  
  1805.   This command runs external programs.  StringExpr1 should represent the 
  1806.   full path and filename of a Windows or DOS executable program or a 
  1807.   *.BAT file.  This is not a SHELL command, so you must provide the name 
  1808.   of a program or batch file, not a DOS command (like DIR, for example).  
  1809.   Execution of an external program does not cause the calling Liberty BASIC 
  1810.   program to cease executing.
  1811.  
  1812.   Here are two examples:
  1813.  
  1814.     RUN "QBASIC.EXE"    ' run Microsoft's QBASIC
  1815.  
  1816.     RUN "WINFILE.EXE", SHOWMAXIMIZED  ' run File Manager 
  1817.  
  1818.   Notice in the second example we can include an additional parameter.  This 
  1819.   is because we are running a Windows program.  Here is a list of the valid 
  1820.   parameters we can include when running Windows programs:
  1821.  
  1822.     HIDE
  1823.     SHOWNORMAL  (this is the default)
  1824.     SHOWMINIMIZED
  1825.     SHOWMAXIMIZED
  1826.     SHOWNOACTIVE
  1827.     SHOW
  1828.     MINIMIZE
  1829.     SHOWMINNOACTIVE
  1830.     SHOWNA
  1831.     RESTORE
  1832.  
  1833. _____________________________________________________________
  1834.  
  1835. SIN(number)
  1836.  
  1837. Description:
  1838.  
  1839.   This function return the sine of number.
  1840.  
  1841. Usage:
  1842.  
  1843.   .
  1844.   .
  1845.   for t = 1 to 45
  1846.     print "The sine of "; t; " is "; sin(t)
  1847.   next t
  1848.   .
  1849.   .
  1850.  
  1851. Note:
  1852.  
  1853.   See also COS( ) and TAN( )
  1854.  
  1855. SORT
  1856.  
  1857. Description:
  1858.  
  1859.   This command sorts both doubleand single dimensioned arrays.  Arrays
  1860.   can be sorted in part or in whole, and with double dimensioned arrays,
  1861.   the specific column to sort by can be declared.  When this option is used,
  1862.   all the rows are sorted against each other according to the items in the
  1863.   specified column.
  1864.  
  1865. Usage:
  1866.  
  1867.   Here is the syntax for the sort command:
  1868.  
  1869.     sort arrayName(, i, j {,n}
  1870.  
  1871.   This sorts the array named arrayName( starting with element i, and ending
  1872.   with element j.  If it is a double dimensioned array then the column
  1873.   parameter tells which nth element to use as a sort key.  Each WHOLE row
  1874.   moves with its corresponding key as it moves during the sort.  So let's say
  1875.   you have a double dimensioned array holding sales rep activity:
  1876.  
  1877.     repActivity(x, y)
  1878.  
  1879.   So you're holding data, one record per x position, and your record keys
  1880.   are in y.  So for example:
  1881.  
  1882.     repActivity(1,1) = "Tom Maloney" : repActivity(1,2) = "01-09-93"
  1883.     repActivity(2,1) = "Mary Burns" : repActivity(2,2) = "01-10-93"
  1884.      .
  1885.      .
  1886.      .
  1887.     repActivity(100,1) = "Ed Dole" : repActivity(100,2) = "01-08-93"
  1888.  
  1889.   So you want to sort the whole 100 items by the date field.  This is how
  1890.   the command would look:
  1891.  
  1892.     sort repActivity(, 1, 100, 2
  1893.   If you wanted to sort by name instead, then change the 2 to a 1, like this:
  1894.  
  1895.     sort repActivity(, 1, 100, 1
  1896.  
  1897. _____________________________________________________________
  1898.  
  1899. STR$(numericExpression)
  1900.  
  1901. Description:
  1902.  
  1903.   This function returns a string expressing the result of  numericExpression.  
  1904.   In MBASIC, this function would always return a string representation of the 
  1905.   expression and it would add a space in front of that string.  For example 
  1906.   in MBASIC:
  1907.  
  1908.   print len(str$(3.14))
  1909.  
  1910.   Would produce the number 5 (a space followed by 3.14 for a total of 5 
  1911.   characters).
  1912.  
  1913.   Liberty BASIC leaves it to you to decide whether you want that space or 
  1914.   not.  If you don't want it, then you need not do anything at all, and if you do 
  1915.   want it, then this expression will produce the same result under Liberty 
  1916.   BASIC:
  1917.  
  1918.   print len(" " + str$(3.14))
  1919.  
  1920. Usage:
  1921.  
  1922. [kids]
  1923.   ' use str$( ) to validate entry
  1924.   input "How many children do you have?"; qtyKids
  1925.   qtyKids$ = str$(qtyKids)
  1926.   ' if the entry contains a decimal point, then the response is no good
  1927.   if instr(qtyKids$, ".") > 0 then print "Bad response. Reenter." : goto [kids]
  1928.   .
  1929.   .
  1930.  
  1931. TAN(number)
  1932.  
  1933. Description:
  1934.  
  1935.   This function return the tangent of number.
  1936.  
  1937. Usage:
  1938.  
  1939.   .
  1940.   .
  1941.   for t = 1 to 45
  1942.     print "The tangent of "; t; " is "; tan(t)
  1943.   next t
  1944.   .
  1945.   .
  1946.  
  1947. Note:
  1948.  
  1949.   See also SIN( ) and COS( )
  1950.  
  1951. _____________________________________________________________
  1952.  
  1953. TIME$( )
  1954.  
  1955. Description:
  1956.  
  1957.   This function returns a string representing the current time of the system 
  1958.   clock in 24 hour format.  This function replaces the time$ variable used in 
  1959.   MBASIC.  See also DATE$( ).
  1960.  
  1961. Usage:
  1962.  
  1963.   .
  1964.   .
  1965.   ' display the opening screen
  1966.   print "Main selection screen             Time now: "; time$( )
  1967.  
  1968. (Listing continues next page...)
  1969.   print
  1970.   print "1. Add new record"
  1971.   print "2. Modify existing record"
  1972.   print "3. Delete record"
  1973.   .
  1974.   .
  1975.  
  1976. _____________________________________________________________
  1977.  
  1978. TRACE number
  1979.  
  1980. Description:
  1981.  
  1982. This statement sets the trace level for its application program.  This is 
  1983. only effective if the program is run using the Debug menu selection 
  1984. (instead of Run).  If Run is used, then any TRACE statements are ignored.
  1985.  
  1986.  There are three trace levels: 0, 1, and 2.  Here are the effects of these 
  1987.  levels:
  1988.  
  1989.   0 = full speed no trace or RUN
  1990.   1 = animated trace or WALK
  1991.   2 = single step mode or STEP
  1992.  
  1993. When any Liberty BASIC program first starts under Debug mode, the trace
  1994. level is always initially 2 (STEP).  You can then click on any of the three 
  1995. buttons (STEP, WALK, RUN) to determine what mode to continue in.   When a TRACE 
  1996. statement is encountered, the trace level is set accordingly, but you can recover 
  1997. from this new trace level by clicking again on the desired button.
  1998.  
  1999. If you are having trouble debugging code at a certain spot, then you can add a 
  2000. TRACE 2 just before that location, run in Debug mode and then click on RUN.  When 
  2001. the TRACE statement is reached, then the debugger will kick in at that point.
  2002.  
  2003. Usage:
  2004.  
  2005.   .
  2006.   .
  2007.   'Here is the trouble spot
  2008.   trace 0  ' kick down to single step mode
  2009.   for index = 1 to int(100*sin(index))
  2010.     print #graph, "go "; index ; " "; int(100*cos(index))
  2011.   next index
  2012.   .
  2013.   .
  2014.  
  2015. _____________________________________________________________
  2016.  
  2017. TRIM$(stringExpression)
  2018.  
  2019. Description:
  2020.  
  2021.   This function removes any spaces from the start and end of the string in 
  2022.   stringExpression.  This can be useful for cleaning up data entry among other 
  2023.   things.
  2024.  
  2025.  
  2026. Usage:
  2027.  
  2028.   sentence$ = "  Greetings  "
  2029.   print len(trim$(sentence$))
  2030.  
  2031. Produces:  9
  2032.  
  2033. _____________________________________________________________
  2034.  
  2035. USING(templateString, numericExpression)
  2036.  
  2037. Description:
  2038.  
  2039.   This function formats numericExpression as a string using templateString.  
  2040.   The rules for the format are like those in MBASIC's PRINT USING 
  2041.   statement, but since USING( ) is a function, it can be used as part of a 
  2042.   larger BASIC expression instead of being useful only for output directly.
  2043.  
  2044.  
  2045. Usage:
  2046.  
  2047.   ' print a column of ten justified numbers
  2048.   for a = 1 to 10
  2049.       print using("####.##",  rnd(1)*1000)
  2050.   next a
  2051.  
  2052. _____________________________________________________________
  2053.  
  2054. VAL(stringExpression)
  2055.  
  2056. Description:
  2057.  
  2058.   This function returns a numeric value for stringExpression is 
  2059.   stringExpression represents a valid numeric value or if it starts out as 
  2060.   one.  If not, then zero is returned.  This function lets your program take 
  2061.   string input from the user and carefully analyze it before turning it into 
  2062.   a numeric value if and when appropriate. 
  2063.  
  2064. Usage:
  2065.  
  2066.   print 2 * val("3.14")         Produces:       6.28
  2067.  
  2068.   print val("hello")            Produces:       0
  2069.  
  2070.   print val("3 blind mice")     Produces:       3
  2071.  
  2072. Version$
  2073.  
  2074. Description:
  2075.  
  2076.   This variable holds the version of Liberty BASIC, in this case "1.2".  This is 
  2077.   useful so that you can take advantage of whatever differences there are 
  2078.   between the different  versions of Liberty BASIC.
  2079.  
  2080. Note: see also Platform$
  2081.  
  2082. _____________________________________________________________
  2083.  
  2084. WHILE expression . . . WEND
  2085.  
  2086. Description:
  2087.  
  2088.   These two statements comprise the start and end of a control loop.  Between 
  2089.   the WHILE and WEND statements place code (optionally) that will be 
  2090.   executed repeatedly while expression evaluates to true.  The code between 
  2091.   any WHILE statement and its associated WEND statement will not execute 
  2092.   even once if the WHILE expression initially evaluates to false.  Once 
  2093.   execution reaches the WEND statement, for as long as the WHILE 
  2094.   expression evaluates to true, then execution will jump back to the WHILE 
  2095.   statement.  Expression can be a boolean, numeric, or string expression.
  2096.  
  2097. Usage:
  2098.  
  2099.   ' loop until a valid response is solicited
  2100.   while val(age$) = 0
  2101.      input "How old are you?"; age$
  2102.      if val(age$) = 0 then print "Invalid response.  Try again."
  2103.   wend
  2104.  
  2105. WORD$( stringExpression, n )
  2106.  
  2107. Description:
  2108.  
  2109.   This function returns the nth word in stringExpression.  The leading and 
  2110.   trailing spaces are stripped from stringExpression and then it is broken 
  2111.   down into 'words' at the remaining spaces inside.  If n is less than 1 or 
  2112.   greater than the number of words in stringExpression, then "" is returned.
  2113.  
  2114. Usage:
  2115.  
  2116.   print word$("The quick brown fox jumped over the lazy dog", 5)
  2117.  
  2118. Produces:
  2119.  
  2120.   jumped
  2121.  
  2122. And:
  2123.  
  2124.   ' display each word of sentence$ on its own line
  2125.   sentence$ = "and many miles to go before I sleep."
  2126.   token$ = "?"
  2127.   while token$ <> ""
  2128.       index = index + 1
  2129.       tokens$ = word$(sentence$, index)
  2130.       print token$
  2131.   wend
  2132.  
  2133. Produces:
  2134.  
  2135.   and
  2136.   many
  2137.   miles
  2138.   to
  2139.   go
  2140.   before
  2141.   I
  2142.   sleep.
  2143.