home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / DBASE / REXL210.ZIP / REXL.DOC < prev    next >
Text File  |  1992-05-16  |  236KB  |  5,647 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                           RExL  Version 2.10
  11.  
  12.  
  13.           A Rule-based Applications Development Environment
  14.  
  15.                                  From
  16.  
  17.  
  18.                          The Software Loft,
  19.                          Lough Guitane,
  20.                          Killarney,
  21.                          Co. Kerry,
  22.                          Ireland.            Tel: [+353] 64-54014
  23.  
  24.                Internet:      softloft@iruccvax.ucc.ie
  25.  
  26.                Compuserve:    100042,1237
  27.  
  28.  
  29.  
  30.  
  31.                    -- Part I -- The Main Manual --
  32.  
  33.  
  34.  
  35.  
  36.      Information in this  document is subject  to change  without
  37.      notice and does  not represent a commitment  on the part  of
  38.      The Software Loft.   The software  described in this  manual
  39.      may be  used and  copied within  the  terms of  the  license
  40.      agreement.
  41.  
  42.      Turbo C, Turbo Pascal and Sidekick are registered trademarks
  43.      of  Borland  International.    dBase  III+  and  dBase   are
  44.      registered trademarks of Ashton-Tate.
  45.  
  46.      (C)  Copyright,  The  Software  Loft,  1992.    All   rights
  47.      reserved.  If you have  any difficulties, please contact  us
  48.      at the following address:
  49.  
  50.                The Software Loft
  51.                Lough Guitane
  52.                Killarney
  53.                Co. Kerry
  54.                Ireland             Telephone: [+353] 64-54014
  55.  
  56.                Internet:      softloft@iruccvax.ucc.ie
  57.  
  58.                Compuserve:    100042,1237
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.                             Contents
  97.  
  98.  
  99.  
  100.           Chapter 1  Introduction                          3
  101.              1.1  What is RExL . . . . . . . . . . . . . . 3
  102.              1.2  System requirements  . . . . . . . . . . 4
  103.              1.3  Installation . . . . . . . . . . . . . . 4
  104.              1.4  Features . . . . . . . . . . . . . . . . 4
  105.                 1.4.1  Editor  . . . . . . . . . . . . . . 5
  106.                 1.4.2  Runtime-Debugger  . . . . . . . . . 6
  107.                 1.4.3  Language  . . . . . . . . . . . . . 6
  108.              1.5  The Manual . . . . . . . . . . . . . . . 7
  109.  
  110.           Chapter 2  Language                              9
  111.              2.1  Variables  . . . . . . . . . . . . . . . 9
  112.              2.2  Constants  . . . . . . . . . . . . . .  10
  113.              2.3  Arrays . . . . . . . . . . . . . . . .  11
  114.              2.4  Operators  . . . . . . . . . . . . . .  12
  115.                 2.4.1  Mathematical Operators  . . . . .  12
  116.                 2.4.2  Comparison Operators  . . . . . .  14
  117.              2.5  Functions  . . . . . . . . . . . . . .  14
  118.              2.6  Expressions  . . . . . . . . . . . . .  16
  119.              2.7  Assignments  . . . . . . . . . . . . .  18
  120.              2.8  Statements . . . . . . . . . . . . . .  19
  121.              2.9  Inference  . . . . . . . . . . . . . .  19
  122.              2.10  Rules and Execution . . . . . . . . .  20
  123.              2.11  Subrules  . . . . . . . . . . . . . .  21
  124.              2.12  Rule Modifiers  . . . . . . . . . . .  22
  125.                 2.12.1  BackTo . . . . . . . . . . . . .  23
  126.                 2.12.2  Not  . . . . . . . . . . . . . .  23
  127.                 2.12.3  While  . . . . . . . . . . . . .  23
  128.                 2.12.4  Multi  . . . . . . . . . . . . .  24
  129.                 2.12.5  Single . . . . . . . . . . . . .  24
  130.                 2.12.6  Zap  . . . . . . . . . . . . . .  24
  131.              2.13  Other Modifiers . . . . . . . . . . .  24
  132.  
  133.           Chapter 3  Quick Start                          27
  134.              3.1  Introduction . . . . . . . . . . . . .  27
  135.              3.2  Creating an Application  . . . . . . .  28
  136.              3.3  Running the Application  . . . . . . .  29
  137.              3.4  Expanding the Application  . . . . . .  30
  138.  
  139.  
  140.                                   i
  141.  
  142.  
  143.  
  144.              3.5  Debugging the Application  . . . . . .  32
  145.  
  146.           Chapter 4  The Editor                           35
  147.              4.1  Introduction . . . . . . . . . . . . .  35
  148.              4.2  Interface Conventions  . . . . . . . .  36
  149.              4.3  Editor Basics  . . . . . . . . . . . .  39
  150.                 4.3.1  File menu . . . . . . . . . . . .  41
  151.                 4.3.2  Edit menu . . . . . . . . . . . .  43
  152.                 4.3.3  Run menu  . . . . . . . . . . . .  43
  153.                 4.3.4  Lists menu  . . . . . . . . . . .  44
  154.                 4.3.5  Options menu  . . . . . . . . . .  46
  155.                 4.3.6  Import menu . . . . . . . . . . .  47
  156.              4.4  Using the Editor . . . . . . . . . . .  49
  157.                 4.4.1  Entering Statements . . . . . . .  50
  158.                 4.4.2  Entering Rules  . . . . . . . . .  51
  159.                 4.4.3  Entering Screens  . . . . . . . .  52
  160.              4.5  Editor Lists . . . . . . . . . . . . .  52
  161.                 4.5.1  Reference List  . . . . . . . . .  53
  162.                 4.5.2  Rule List . . . . . . . . . . . .  53
  163.                 4.5.3  Screen List . . . . . . . . . . .  53
  164.                 4.5.4  Unused Rule List  . . . . . . . .  54
  165.                 4.5.5  Unused Screen List  . . . . . . .  54
  166.                 4.5.6  Variable List . . . . . . . . . .  54
  167.                 4.5.7  Function List . . . . . . . . . .  55
  168.              4.6  Other Functions  . . . . . . . . . . .  56
  169.                 4.6.1  Graphic Rule Display  . . . . . .  56
  170.                 4.6.2  Miscellaneous keystrokes  . . . .  57
  171.                    4.6.2.1  Cut and paste  . . . . . . .  57
  172.                    4.6.2.2  Editing keys . . . . . . . .  57
  173.                    4.6.2.3  Other keys . . . . . . . . .  58
  174.  
  175.           Chapter 5  Screens in RExL                      59
  176.              5.1  Introduction . . . . . . . . . . . . .  59
  177.              5.2  Fields . . . . . . . . . . . . . . . .  60
  178.                 5.2.1  Introduction  . . . . . . . . . .  60
  179.                    5.2.1.1  Field Properties . . . . . .  60
  180.                 5.2.2  Output Fields . . . . . . . . . .  61
  181.                 5.2.3  Input Fields  . . . . . . . . . .  61
  182.                 5.2.4  Toggle List Fields  . . . . . . .  61
  183.                 5.2.5  Check Box Fields  . . . . . . . .  62
  184.                 5.2.6  Radio Button Fields . . . . . . .  62
  185.                 5.2.7  Menu Fields . . . . . . . . . . .  63
  186.              5.3  Screen Types . . . . . . . . . . . . .  63
  187.                 5.3.1  Dialog Screen . . . . . . . . . .  65
  188.                 5.3.2  Display Screen  . . . . . . . . .  65
  189.                 5.3.3  Help Screen . . . . . . . . . . .  66
  190.                 5.3.4  Menu Screen . . . . . . . . . . .  66
  191.                 5.3.5  Print Screen  . . . . . . . . . .  67
  192.  
  193.  
  194.                                   ii
  195.  
  196.  
  197.  
  198.                 5.3.6  Subscreens  . . . . . . . . . . .  67
  199.  
  200.           Chapter 6  Using the Screen Designer            69
  201.              6.1  Starting the Screen Designer . . . . .  69
  202.              6.2  Basic Design . . . . . . . . . . . . .  70
  203.              6.3  Fields in the Screen Designer  . . . .  71
  204.                    6.3.0.1  Output . . . . . . . . . . .  73
  205.                    6.3.0.2  Input  . . . . . . . . . . .  73
  206.                    6.3.0.3  Toggle . . . . . . . . . . .  73
  207.                    6.3.0.4  Check  . . . . . . . . . . .  74
  208.                    6.3.0.5  Radio  . . . . . . . . . . .  74
  209.                    6.3.0.6  Menu . . . . . . . . . . . .  74
  210.              6.4  Block Operations . . . . . . . . . . .  75
  211.                 6.4.1  Block Painting  . . . . . . . . .  75
  212.                 6.4.2  Align . . . . . . . . . . . . . .  76
  213.                 6.4.3  Box . . . . . . . . . . . . . . .  76
  214.                 6.4.4  Delete  . . . . . . . . . . . . .  77
  215.                 6.4.5  Move  . . . . . . . . . . . . . .  77
  216.                 6.4.6  Copy  . . . . . . . . . . . . . .  78
  217.                 6.4.7  Fill  . . . . . . . . . . . . . .  78
  218.                 6.4.8  Save  . . . . . . . . . . . . . .  79
  219.                 6.4.9  Under shadow  . . . . . . . . . .  79
  220.              6.5  Sub-screens  . . . . . . . . . . . . .  79
  221.              6.6  Field control menu . . . . . . . . . .  80
  222.                    6.6.0.1  Active color . . . . . . . .  81
  223.                    6.6.0.2  Inactive color . . . . . . .  81
  224.                    6.6.0.3  Delete . . . . . . . . . . .  82
  225.                    6.6.0.4  Expression . . . . . . . . .  82
  226.                    6.6.0.5  Recalc . . . . . . . . . . .  82
  227.                    6.6.0.6  Justify  . . . . . . . . . .  82
  228.                    6.6.0.7  Width  . . . . . . . . . . .  82
  229.                    6.6.0.8  Necessary  . . . . . . . . .  83
  230.                    6.6.0.9  Precision  . . . . . . . . .  83
  231.                    6.6.0.10  Validation  . . . . . . . .  83
  232.              6.7  Miscellaneous Functions  . . . . . . .  83
  233.                    6.7.0.1  Changing Field Types . . . .  83
  234.                    6.7.0.2  Field Utility Keys . . . . .  84
  235.                    6.7.0.3  Line Drawing . . . . . . . .  84
  236.                    6.7.0.4  Other Editing Keys . . . . .  86
  237.                    6.7.0.5  Lists in the Screen
  238.                             Designer . . . . . . . . . .  86
  239.                    6.7.0.6  Miscellaneous Keys . . . . .  87
  240.  
  241.           Chapter 7  The Runtime-Debugger                 89
  242.              7.1  Introduction . . . . . . . . . . . . .  89
  243.              7.2  Debugger Basics  . . . . . . . . . . .  89
  244.                 7.2.1  File menu . . . . . . . . . . . .  91
  245.                 7.2.2  Debug menu  . . . . . . . . . . .  91
  246.  
  247.  
  248.                                  iii
  249.  
  250.  
  251.  
  252.                 7.2.3  Lists menu  . . . . . . . . . . .  92
  253.                 7.2.4  Options menu  . . . . . . . . . .  94
  254.              7.3  Using the Debugger . . . . . . . . . .  95
  255.                 7.3.1  Step  . . . . . . . . . . . . . .  96
  256.                 7.3.2  Trace . . . . . . . . . . . . . .  97
  257.                 7.3.3  Watch . . . . . . . . . . . . . .  97
  258.                 7.3.4  Expression Evaluate . . . . . . .  98
  259.                 7.3.5  Animation . . . . . . . . . . . .  98
  260.                 7.3.6  To Here . . . . . . . . . . . . .  99
  261.              7.4  Miscellaneous keystrokes . . . . . . .  99
  262.              7.5  Command Line Parameters  . . . . . . . 100
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.                                   iv
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.                              Tables
  313.  
  314.  
  315.           Table 2.1: Valid and Invalid Variable Names  . .10
  316.           Table 2.2: Numeric and String Constants  . . . .11
  317.           Table 2.3: Array Subscription  . . . . . . . . .12
  318.           Table 2.4: RExL Math Operators . . . . . . . . .13
  319.           Table 2.5: Logical Operators . . . . . . . . . .14
  320.           Table 2.6: Comparison Operators  . . . . . . . .14
  321.           Table 2.7: Function Families . . . . . . . . . .15
  322.           Table 2.8: Some Expressions  . . . . . . . . . .16
  323.           Table 2.9: Operator Precedence . . . . . . . . .17
  324.           Table 2.10: Examples of Operator Precedence  . .18
  325.           Table 2.11: Examples of Assignments  . . . . . .19
  326.           Table 2.12: Rule Modifiers . . . . . . . . . . .23
  327.           Table 2.13: Other Modifiers  . . . . . . . . . .25
  328.           Table 2.14: Expression Truth Values  . . . . . .25
  329.           Table 4.1: ASCII Color Translation Table . . . .48
  330.           Table 4.2: Function Parameter Abbreviations  . .55
  331.           Table 5.1: Screen Types  . . . . . . . . . . . .64
  332.           Table 5.2: Valid Combinations of Screen and Field
  333.                      Type  . . . . . . . . . . . . . . . .64
  334.           Table 6.1: Screen Designer Cursor Keys . . . . .71
  335.           Table 6.2: Valid Field Sizes . . . . . . . . . .72
  336.           Table 6.3: Valid Field Attributes  . . . . . . .81
  337.           Table 6.4: Keys in Line Draw Mode  . . . . . . .86
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.                                   v
  357.            - Main Manual.                    Page: 3 -
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.                               Chapter 1
  367.  
  368.                              Introduction
  369.  
  370.  
  371.      This chapter  provides a  brief  introduction to  RExL,  its
  372.      system requirements, installation and capabilities and quick
  373.      signpost to the rest of the manual.
  374.  
  375.  
  376.      1.1  What is RExL
  377.  
  378.  
  379.      RExL, short  for  Rule-base  EXpert  Language  is  a  fourth
  380.      generation language  product  for  PC  compatible  computers
  381.      which  is  based  upon   the  `expert  system'   programming
  382.      paradigm. It allows the applications developer to  prototype
  383.      applications rapidly and easily, while producing code  which
  384.      is easy to follow and  understand. RExL comprises an  editor
  385.      for creating and modifying applications and a runtime module
  386.      with incorporated  debugger  for  testing  and  running  the
  387.      resulting application.
  388.  
  389.      RExL was developed with the following goals in mind:
  390.  
  391.          o  Ease of  use: Menus  and pop-up  lists are  available
  392.             times through hotkeys for experienced users, and  via
  393.             pulldown menus for those  not so familiar with  RExL.
  394.             Online context-sensitive,  cross referenced  help  is
  395.             available at all times to the user.
  396.  
  397.          o  Integrity: RExL was conceived as a single unit,  with
  398.             all features   intimately connected together,  unlike
  399.             traditional languages  where   editors and  debuggers
  400.             are general  purpose  tools  and not  tailored    for
  401.             specific languages.
  402.  
  403.          o  Power: RExL not only has a powerful internal language
  404.             with 178  functions available  but also  has a  fully
  405.             integrated  screen  designer  and  dBase   compatible
  406.             database module.
  407.  
  408.  
  409.  
  410.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  411.            - Main Manual.                    Page: 4 -
  412.  
  413.  
  414.      1.2  System requirements
  415.  
  416.  
  417.      RExL will run on the IBM PS/2, PC/AT, PC/XT, PC, PC/Jr,  and
  418.      on IBM PC clones. The minimum requirements are:
  419.  
  420.          o  256 KB of memory, although  RExL can use as much  low
  421.             DOS memory as is available.
  422.  
  423.          o  PC-DOS 3.0 or greater or MS-DOS 3.0 or greater.
  424.  
  425.          o  One high  density 5.25"  or  one 720k  3.5"  diskette
  426.             drive, although a hard drive with at least 600k  free
  427.             is recommended.
  428.  
  429.          o  An 80-column video card and monitor.
  430.  
  431.          o  REXL.EXE, the  editor  and REXLRD.EXE,  the  runtime-
  432.             debugger module.
  433.  
  434.  
  435.      1.3  Installation
  436.  
  437.  
  438.      If you are installing the Shareware version, installation of
  439.      RExL is  accomplished  easily.  Copy the  single  executable
  440.      file, REXL200.EXE into the directory where you want to  keep
  441.      it and run the file by issuing the DOS command
  442.  
  443.                                rexl200
  444.  
  445.      The installation will proceed automatically and will require
  446.      about 1Mb of disk space.
  447.  
  448.      If you are  installing the full  registered version,  insert
  449.      the first distribution disk in your disk drive, log onto it,
  450.      issue the DOS command
  451.  
  452.                                install
  453.  
  454.      and follow the prompts.
  455.  
  456.  
  457.      1.4  Features
  458.  
  459.  
  460.      The RExL package comes in three main parts:
  461.  
  462.  
  463.  
  464.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  465.            - Main Manual.                    Page: 5 -
  466.  
  467.  
  468.          o  The editor which is  used for creating and  modifying
  469.             applications written in RExL,
  470.  
  471.          o  The runtime-debugger module which is used to run  and
  472.             debug applications.
  473.  
  474.          o  The supplementary  utilities,  not available  in  the
  475.             Shareware  version,  which  complete  the  suite   of
  476.             development tools.
  477.  
  478.      The next two sections provide a brief overview of both these
  479.      modules. The final  section in  this chapter  gives a  quick
  480.      introduction to RExL's internal language.
  481.  
  482.      1.4.1  Editor
  483.  
  484.      RExL's editor uses the concept of `folding text' to make the
  485.      programmer's  job   easier.   In  any   computer   language,
  486.      applications are  built  up  in a  pyramidal  manner,  using
  487.      procedures within procedures: this  gives the program a  two
  488.      dimensional structure which has been ignored by  traditional
  489.      flat file editors. RExL on  the other hand understands  this
  490.      structure and  allows the  programmer to  access  procedures
  491.      immediately, without having to  do searches or large  cursor
  492.      movements.    Lists   of  all  entities   defined  in   your
  493.      application are available  at all times  within the  editor,
  494.      and most entity lists have cross reference facilities.
  495.  
  496.      The screen designer  is an integral part  of the editor  and
  497.      features the following:
  498.  
  499.          o  Block mark,  copy,  move,  delete,  color,  fill  and
  500.             alignment,
  501.  
  502.          o  Box and line drawing,
  503.  
  504.          o  Subscreen manipulation,
  505.  
  506.          o  IO fields : numeric input and output, character input
  507.             and output, radio buttons, check boxes, toggle  lists
  508.             and menus,
  509.  
  510.          o  Screen compression within single screen files.
  511.  
  512.      The cross referenced help system  is available at all  times
  513.      while within  the editor  and contains  almost six  thousand
  514.      lines of  context sensitive  help.  All RExL  functions  are
  515.  
  516.  
  517.  
  518.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  519.            - Main Manual.                    Page: 6 -
  520.  
  521.  
  522.      fully explained in the help and come complete with  examples
  523.      of their use.
  524.  
  525.      1.4.2  Runtime-Debugger
  526.  
  527.      RExL's debugger and runtime module feature line step,  trace
  528.      and   instruction   animation   using   industry    standard
  529.      keystrokes.  A   full  watch   facility  and   comprehensive
  530.      expression evaluator  can be  used  to check  variables  and
  531.      expressions during execution of an application. As with  the
  532.      editor, all features are available via debugger hotkeys  and
  533.      pull down menus.
  534.  
  535.      As in  the editor,  on-the-fly macro  definition, store  and
  536.      retrieval is also featured.
  537.  
  538.      1.4.3  Language
  539.  
  540.      RExL's internal  language  has  been  designed  to  resemble
  541.      BASIC. It supplies all the normal mathematical operators  of
  542.      division, multiplication,  addition, subtraction,  negation,
  543.      exponentiation and logical OR, AND and NOT. The language has
  544.      one hundred and  seventy-eight functions  which are  grouped
  545.      under the following headings:
  546.  
  547.          o  Database:  The   integral  database   is  dBase   III
  548.             compatible and  supports the  use of  standard  index
  549.             files. There  are thirty-nine  functions  controlling
  550.             the database  module. The  number of  data files  and
  551.             index files open concurrently is limited only by DOS.
  552.  
  553.          o  Date-Time: There  is  a full  set  of date  and  time
  554.             handling functions.  These  can  use the  three  most
  555.             common date and time formats  of the USA, Europe  and
  556.             Japan. There are eighteen functions in this category.
  557.  
  558.          o  DOS: The thirteen DOS interface functions perform the
  559.             most commonly required procedures, such as file copy,
  560.             rename,  delete,  directory  maintenance  and  system
  561.             identification.
  562.  
  563.          o  Math: There  are  forty  mathematical  and  financial
  564.             functions (not  including  the math  functions  which
  565.             operate on arrays and databases). The math  functions
  566.             cover all  the standard  trigonometric functions,  as
  567.             well as random number generation, boolean algebra and
  568.             ASCII character manipulation. The financial functions
  569.             cover the areas of loans and annuities.
  570.  
  571.  
  572.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  573.            - Main Manual.                    Page: 7 -
  574.  
  575.  
  576.          o  Array  handling:  There  are  nine  functions   which
  577.             operate on RExL  arrays.   Arrays may  be numeric  or
  578.             string in type and can have up to three dimensions.
  579.  
  580.          o  Miscellaneous:    There    are    forty-six     other
  581.             miscellaneous  functions   which  control   character
  582.             string manipulation, error  handling, simple  numeric
  583.             and string screen  IO and  keyboard handling,  binary
  584.             and logical operations and arithmetic.
  585.  
  586.      The language  itself is  based upon  the concept  of  rules,
  587.      which are  equivalent  to  procedures in  more  conventional
  588.      programming languages. Rules are  made up of logical  blocks
  589.      of lines, known  as AND-blocks,  which execute  in much  the
  590.      same manner  as  Prolog  predicates.  The  lines  themselves
  591.      within the rule can be built up of executable statements, in
  592.      RExL's internal language, or be made up of other rules.
  593.  
  594.      Screens generated using the screen designer are accessed  in
  595.      much the same  manner as rules.  The screen designer  allows
  596.      numeric and character IO,  dialog screen generation,  online
  597.      help and printer access.
  598.  
  599.  
  600.      1.5  The Manual
  601.  
  602.  
  603.      Where keystrokes  are  specified,  the shift,  alt  or  ctrl
  604.      segment is written  first with the  combination key  second.
  605.      For example, to call up  language help, the keystroke is  as
  606.      follows: Press down  the <Ctrl> key  and while  it is  down,
  607.      press the <F1> key.  This keystroke is written as <Ctrl-F1>.
  608.  
  609.      The plan of the manual is :
  610.  
  611.          o  General introduction to RExL
  612.  
  613.          o  General guide to RExL's language
  614.  
  615.          o  Quick start guide
  616.  
  617.          o  In-depth guide to the editor
  618.  
  619.          o  In-depth guide to the screen designer (two chapters)
  620.  
  621.          o  In-depth guide to the debugger
  622.  
  623.          o  Appendices
  624.  
  625.  
  626.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  627.            - Main Manual.                    Page: 8 -
  628.  
  629.  
  630.                 -  Guide to Function Families
  631.  
  632.                 -  Database Programming
  633.  
  634.                 -  Function reference
  635.  
  636.                 -  Keystroke reference
  637.  
  638.                 -  Afterword
  639.  
  640.      It is recommended  that at the very  least, you should  read
  641.      the language guide and the quick start guide.
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  681.            - Main Manual.                    Page: 9 -
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.                               Chapter 2
  691.  
  692.                                Language
  693.  
  694.  
  695.      RExL's language  was designed  to  resemble BASIC,  so  that
  696.      users who had experience in this language would have  little
  697.      difficulty  in  switching  to  RExL.    This  chapter   will
  698.      introduce all of  the basic  concepts which  you'll need  to
  699.      understand before you can begin to program in RExL.
  700.  
  701.      If you have  programmed before,  then a  quick read  through
  702.      this  chapter  should  be   adequate,  since  the   concepts
  703.      presented are common across most programming languages.
  704.  
  705.  
  706.      2.1  Variables
  707.  
  708.  
  709.      A variable is a name which is used to refer to a location in
  710.      memory which stores a retrievable value.  In RExL, there are
  711.      two types of variable:
  712.  
  713.          *  Numeric variables which contain numeric  information.
  714.             These variables  can  range  in absolute  value  from
  715.             2.225074x10^-308  to  9.7693x10^308   and  can   hold
  716.             numbers accurate to about  fifteen decimal digits  of
  717.             precision.
  718.  
  719.          *  String variables which contain character information.
  720.             These have a maximum length of eighty characters.
  721.  
  722.      RExL variable  names  follow  the standard  conventions  for
  723.      variable names in most languages.  These are that they  must
  724.      consist of  a letter  followed by  an unbroken  sequence  of
  725.      letters, digits or the underscore  character, _.  Note  that
  726.      for compatibility with future  RExL products, an  underscore
  727.      is not allowed as the initial letter of a variable name.  To
  728.      distinguish between string and numeric variables, all string
  729.      variable names have a dollar sign, $, as the last letter  in
  730.      their name.
  731.  
  732.  
  733.  
  734.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  735.            - Main Manual.                    Page: 10 -
  736.  
  737.  
  738.      The following list gives some typical variable names:
  739.  
  740.              Table 2.1: Valid and Invalid Variable Names
  741.  
  742.      name$     String  variable
  743.      my_age    Numeric variable
  744.      1st       Invalid : initial character is not a letter
  745.      my age    Invalid : space included in the middle of the name
  746.      co$t      Invalid : characters after the dollar sign
  747.      addr$$    Invalid : double dollar at end
  748.  
  749.  
  750.      2.2  Constants
  751.  
  752.  
  753.      A constant is an invariable numeric or string value. Numeric
  754.      constants are simply numbers such  as 0, 10, 123.456 and  so
  755.      on. They  have  the  same  range of  value  as  the  numeric
  756.      variables above.    For  large  numbers  above  one  million
  757.      trillion, RExL uses the standard computer format  scientific
  758.      notation.   This  format  is almost  identical  to  that  of
  759.      scientific notation and consists of a mantissa which can  be
  760.      up to  fifteen  digits  long and  contains  the  significant
  761.      digits of the number, expressed as a number between one  and
  762.      ten.   The mantissa  is  followed by  the  letter E  (or  e,
  763.      standing for exponent)  followed by a  plus or minus  symbol
  764.      followed by a  number between 15  and 308, representing  the
  765.      power of ten  with which the mantissa  is to be  multiplied.
  766.      There are no spaces in between the different sections of the
  767.      number and  a plus  sign is  assumed  if the  plus or  minus
  768.      symbol is omitted.  Thus  the average distance from the  sun
  769.      to the earth can be expressed in this format as 5.8925E+12 =
  770.      5.8925x10^12 inches.
  771.  
  772.      String  (or  character)  constants   are  simply  lists   of
  773.      characters.  They are delimited at either end by the  double
  774.      quotation mark ", and may contain any ASCII character except
  775.      that of zero, used internally.
  776.  
  777.      The following table lists a  few typical string and  numeric
  778.      constants.
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  789.            - Main Manual.                    Page: 11 -
  790.  
  791.  
  792.                Table 2.2: Numeric and String Constants
  793.  
  794.      1e+6      Numeric value of one million
  795.      5e-3      Numeric value of five thousandths
  796.      1e+-376   Illegal: confusion over plus/minus and the exponent
  797.                is greater than 308
  798.      "Hello"   The string `Hello'
  799.      "Whoops   Illegal: no closing double quotation mark
  800.  
  801.  
  802.      2.3  Arrays
  803.  
  804.  
  805.      Some  applications  require  lists  of  string  or   numeric
  806.      information.  For example, the list of monthly sales figures
  807.      for a single  year would require  a list  of twelve  numeric
  808.      variables, one  for each  month. RExL  supports the  use  of
  809.      arrays of string and numeric variables to store this type of
  810.      information.   An individual  number or  string item  in  an
  811.      array is known as an element of that array.
  812.  
  813.      Arrays more complex than simple lists are also possible,  in
  814.      fact arrays may have up to three dimensions specified.   For
  815.      example, if the sales figures for a single year for a number
  816.      of different departments were stored, although they could be
  817.      stored as  above  in a  one  dimensional  list, it  is  more
  818.      convenient to store them as a two dimensional list or array:
  819.      one dimension  to  locate the  month  and one  dimension  to
  820.      locate the department number.   Similarly three  dimensional
  821.      arrays could be used to store the monthly sales figures  for
  822.      different   departments   across   different   years.    Two
  823.      dimensional arrays can be thought of as a (numeric or string
  824.      type) grid  with the  dimensions specified  relating to  the
  825.      rows and columns of the  grid. Three dimensional arrays  can
  826.      be thought of  as a  stack of these  grids.   It is  clearly
  827.      immaterial to  RExL  whether  the any  particular  dimension
  828.      refers to  the  row number,  column  number  or depth  of  a
  829.      particular element, however,  to keep things  clear in  your
  830.      mind, you should adopt a  standard method of reference.   We
  831.      suggest the convention  that the first  dimension is  column
  832.      number, the second is the row number and the third dimension
  833.      is the depth. This convention is used elsewhere in RExL  and
  834.      conforms to the standard (x,y,z) notation used in  Cartesian
  835.      geometry.
  836.  
  837.      To reference a particular element in an array, RExL needs to
  838.      know its position  within the array.   This is specified  by
  839.      placing the  `co-ordinates' of  the element  of interest  in
  840.  
  841.  
  842.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  843.            - Main Manual.                    Page: 12 -
  844.  
  845.  
  846.      square brackets  immediately after  the array's  name.   The
  847.      co-ordinates of a particular element are known as the  array
  848.      element subscripts and are based  at zero, meaning that  the
  849.      first element of an array is indexed by a subscript of zero,
  850.      the second by  a value of  one and so  on.1In two and  three
  851.      dimensional arrays, the separate subscripts are separated by
  852.      commas. Note  that  an  array must  by  subscripted  by  the
  853.      correct number of subscripts.
  854.  
  855.      The following  table  give  a  few  examples  of  addressing
  856.      individual elements of arrays.
  857.  
  858.                     Table 2.3: Array Subscription
  859.  
  860.      name$[0]       Returns first element in name$[]
  861.      age[6]         Returns seventh element in age[]
  862.      sales[3,0]     Returns the number in the first row of the fourth
  863.                     column of the two dimensional array sales[]
  864.      ____________________________________________________________
  865.      1. This behaviour is compatible with  the C language and  is
  866.         adhered to throughout RExL where all co-ordinates, string
  867.         indexes and so on are zero based.
  868.  
  869.      By default,  all arrays  are  dimensioned to  ten  elements.
  870.      This  can  be  changed  through  the  variable   dictionary,
  871.      described in the chapter on the editor.  When you are  using
  872.      three dimensional  arrays, be  aware that  large amounts  of
  873.      memory are consumed.   As a guide  to determining the  exact
  874.      amount  used,  each  element  of  a  numeric  array  of  any
  875.      dimension uses eight bytes of  storage.  For string  arrays,
  876.      each element uses four  bytes (when the application  starts)
  877.      and a  further eighty-one  bytes when  an element  is  first
  878.      accessed.    This  behaviour  for  string  arrays  helps  to
  879.      conserve memory if not all elements in an array are used, as
  880.      is usually the case.
  881.  
  882.  
  883.      2.4  Operators
  884.  
  885.  
  886.      2.4.1  Mathematical Operators
  887.  
  888.      An operator is a symbol  which performs some action upon  an
  889.      operand (or operands)  and returns  a value.   The  standard
  890.      mathematical symbols + - x and / with which most people  are
  891.      familiar are supported in RExL,  along with number of  extra
  892.      ones.
  893.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  894.            - Main Manual.                    Page: 13 -
  895.  
  896.  
  897.      They are listed in the following table:
  898.  
  899.                     Table 2.4: RExL Math Operators
  900.  
  901.           *    Multiplication      ^    Exponentiation
  902.           /    Division            &    Logical AND
  903.           +    Addition            |    Logical OR
  904.           -    Subtraction         !    Logical NOT
  905.  
  906.      Note that the minus sign can also be used to denote a  unary
  907.      minus, that is one which  changes the sign of its  immediate
  908.      operand.
  909.  
  910.      The four  operators in  the right  hand  column may  not  be
  911.      familiar to  you.  The  first operator,  the  exponentiation
  912.      operator a caret, ^, is  used to raise the first operand  to
  913.      the power of the second. Thus, 2^2=4 and 3^2=9.
  914.  
  915.      The logical AND  operator, the ampersand  symbol &,  returns
  916.      the result of a  logical AND of the  both operands. This  is
  917.      equal to one  if both operands are  non zero, otherwise  the
  918.      result is zero. So, 1&1 gives 1 but 1&0 returns 0.
  919.  
  920.      The logical OR  operator, the piping  symbol |, returns  the
  921.      result of a logical  OR of both operands.  This is equal  to
  922.      one if either of the two operands are non zero, otherwise it
  923.      is zero. So, 0|1 gives 1 but 0|0 gives 0.
  924.  
  925.      The final logical operator  symbol, the exclamation mark  !,
  926.      performs a  logical inversion  of its  single operand.  This
  927.      means that it will reverse the logical meaning of the  value
  928.      to which it is applied. Thus !1 returns 0 and !0 returns 1.
  929.  
  930.      When dealing with the logical  operators &, | and !, it  may
  931.      help you to  think of a  value of zero  meaning False and  a
  932.      non-zero value  meaning True.   Thus,  !1 is  equivalent  to
  933.      !True, giving False  and 1&0 is equivalent  to True &  False
  934.      giving False.
  935.  
  936.      The  following  table  lists  the  results  of  the  logical
  937.      operations of Not, Or and And applied to a pair of True  and
  938.      False operands.
  939.  
  940.      These logical operators are sometimes referred to as boolean
  941.      operators, after the Irish mathematician, George Boole,  who
  942.      developed the algebra  of logic.  A  number of more  complex
  943.      logical  operations   are  available   as  function   calls,
  944.      including exclusive-or, implication and equivalence.
  945.  
  946.  
  947.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  948.            - Main Manual.                    Page: 14 -
  949.  
  950.  
  951.                      Table 2.5: Logical Operators
  952.  
  953.           A         B         !A             A&B       A|B
  954.           0         0         1              0         0
  955.           0         1         1              0         1
  956.           1         0         0              0         1
  957.           1         1         0              1         1
  958.  
  959.      2.4.2  Comparison Operators
  960.  
  961.      The final set of RExL symbols are the comparison  operators,
  962.      which are used  to compare one string  or number value  with
  963.      another value of  the same  type. There  are six  comparison
  964.      operators which are listed below:
  965.  
  966.                    Table 2.6: Comparison Operators
  967.  
  968.           =    Test for equality
  969.           >    Test for greater than
  970.           <>   Test for inequality
  971.           <=   Test for less than or equal to
  972.           <    Test for less than
  973.           >=   Test for greater than or equal to
  974.  
  975.      These operators  are defined  for  both string  and  numeric
  976.      types.  When applied to string type operands, RExL uses  the
  977.      ASCII character  set to  determine if  one string  is  `less
  978.      than' or `greater than' another.  Refer to appendix F for an
  979.      table of ASCII characters.
  980.  
  981.  
  982.      2.5  Functions
  983.  
  984.  
  985.      A function is an in-built  part of RExL's internal  language
  986.      which performs some action,  or calculation on some  values,
  987.      and then  returns  a value  of  some  specific type.    Like
  988.      variables, the type of the value they return is indicated by
  989.      the presence or absence of  a dollar sign.  In general,  the
  990.      return type of a function is not related to its  parameters,
  991.      the value or  values which the  function operates upon.  The
  992.      process of  using a  function is  generally referred  to  as
  993.      calling that  function.  The  values  which  are  given  (or
  994.      passed) to the function are known as parameters.
  995.  
  996.      You are probably familiar  with some functions already:  the
  997.      mathematical functions  log,  tan,  cos and  so  forth,  are
  998.      functions (and  available in  RExL), since  they are  passed
  999.  
  1000.  
  1001.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1002.            - Main Manual.                    Page: 15 -
  1003.  
  1004.  
  1005.      some value  and return  the value  of the  function at  that
  1006.      particular point.  Thus, the value of the tan function at pi
  1007.      radians evaluates as zero.   This could be coded in RExL  as
  1008.      tan(3.1416).
  1009.  
  1010.      Every RExL  function  uses  a fixed  number  of  parameters,
  1011.      generally of fixed  type.  For  example, the math  functions
  1012.      above require the use of numeric parameters since trying  to
  1013.      find the logarithm of a string is meaningless. The DISPLAY()
  1014.      function will write  a string on the  screen to the  current
  1015.      cursor location. This function  takes only one parameter,  a
  1016.      string.  To write the  string "Hello, world" on the  screen,
  1017.      we could write a RExL line such as DISPLAY("Hello, world").
  1018.  
  1019.      Passing arrays to functions is rather more complex:  Because
  1020.      some functions taking  arrays require arrays  of a  specific
  1021.      dimension, dummy  subscripts  must  be passed  in  place  of
  1022.      numeric ones (the dummy subscript  used is the hash  symbol,
  1023.      #).  The dummy subscripts are mainly for the benefit of  the
  1024.      internal syntax checker which checks  to make sure that  you
  1025.      are not passing a one dimensional array to a function  which
  1026.      requires a two dimensional array.  For example, to call  the
  1027.      function  ARavg(),  which  averages  the  values  of  a  one
  1028.      dimensional array and requires the name of an array and  two
  1029.      numbers,   the   function   call   could   be   written   as
  1030.      ARavg(numarr[#],0,9).
  1031.  
  1032.      RExL's function  list  is  divided into  six  `families'  of
  1033.      functions, each of which is used for some different  aspect.
  1034.      To make the functions easier  to locate and remember,  every
  1035.      function  in   a   particular   family   (except   for   the
  1036.      miscellaneous functions  family!) start  with the  same  two
  1037.      letters, both of which are capitalised.
  1038.  
  1039.      The following table lists the function families:
  1040.  
  1041.                      Table 2.7: Function Families
  1042.  
  1043.      Letter Abbreviation      Uses of Family
  1044.           AR                  Array handling
  1045.           BT                  Binary bit operations
  1046.           DB                  Database handling
  1047.           DT                  Date operations
  1048.           ER                  Error handling
  1049.           KB                  Keyboard handling
  1050.           OS                  Operating system functions
  1051.  
  1052.  
  1053.  
  1054.  
  1055.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1056.            - Main Manual.                    Page: 16 -
  1057.  
  1058.  
  1059.      In the current  release of RExL, there  are one hundred  and
  1060.      seventy-eight  functions  available.     The   miscellaneous
  1061.      functions have no special initial letters.
  1062.  
  1063.  
  1064.      2.6  Expressions
  1065.  
  1066.  
  1067.      An expression  combines  constants, variables  and  function
  1068.      call return values  using RExL's  mathematical operators  to
  1069.      produce a  single result.  For example,  the expression  2+2
  1070.      produces the result 4.
  1071.  
  1072.      As a  general rule,  the type  (string  or numeric)  of  the
  1073.      result of an expression is the same as that of the  elements
  1074.      of the expression, although there  is one exception to  this
  1075.      rule.  This  is as follows:  when strings  are compared,  or
  1076.      more properly, operated  upon by  the comparison  operators,
  1077.      the return result  is a numeric  value.   This at first  may
  1078.      seem strange, but it makes sense when you apply the  earlier
  1079.      suggestion that non-zero values can  be thought of as  being
  1080.      `true' and zero  values being False .  Thus, if two  strings
  1081.      are compared for  equality, we would expect  a `true' to  be
  1082.      returned if they  were equal and a  `False ' otherwise.  The
  1083.      same convention holds true for comparison of numeric values.
  1084.      In RExL, a true expression is assigned the value of one  and
  1085.      a False  expression is assigned a value of zero.
  1086.  
  1087.      When using numeric expressions, all the operators previously
  1088.      defined are valid.   When  using strings  however, the  only
  1089.      valid mathematical operator is the  + sign, used for  string
  1090.      concatenation or  addition.    It  should  be  obvious  that
  1091.      attempting to  subtract, multiply,  divide, take  powers  or
  1092.      perform logical  operations  upon  strings has  no  meaning.
  1093.      Examine the following expressions and satisfy yourself  that
  1094.      they do what they say they do:
  1095.  
  1096.                      Table 2.8: Some Expressions
  1097.  
  1098.      a*10                Returns the result of the multiplication of
  1099.                          the numeric variable a and the number 10
  1100.      time[0]*speed[0]    Returns the result of the multiplication of
  1101.                          the first element of the array time[] and
  1102.                          the first element of the array speed[]
  1103.      a$+"end"            Returns the value of a$ with the string
  1104.                          constant "end" appended to it.
  1105.  
  1106.  
  1107.  
  1108.  
  1109.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1110.            - Main Manual.                    Page: 17 -
  1111.  
  1112.  
  1113.      There is, however, a problem in evaluating expressions  when
  1114.      there is more  than one operator: This  is to determine  the
  1115.      order in which the sub-expressions (within the expression as
  1116.      a whole) are to be evaluated.  For example is the expression
  1117.      1+2*3 to be  evaluated as 1+(2*3) or  (1+2)*3?  To  overcome
  1118.      this problem, every operator has a precedence, so that  sub-
  1119.      expressions  having  operators  of  higher  precedence   are
  1120.      evaluated  before  those  of  low  precedence.    When   two
  1121.      operators have the same  precedence, the expression will  be
  1122.      evaluated from  left  to right,  as  you would  expect.  The
  1123.      complete list of operator precedence is given at the end  of
  1124.      this section.
  1125.  
  1126.      There is one final  operator, the assignment operator  which
  1127.      is denoted by the symbol of colon followed by an equals sign
  1128.      :=.  It  is used  for assigning  a variable  to some  value.
  1129.      This will be covered in  the next section and is  introduced
  1130.      here so that  it can be  included in  the table of  operator
  1131.      precedence.
  1132.  
  1133.                     Table 2.9: Operator Precedence
  1134.  
  1135.      Precedence     Operator  Meaning
  1136.      8              ()        Bracketing of sub-expressions
  1137.      7              ! ^       Logical NOT and exponentiation
  1138.      6              * /       Multiply and divide
  1139.      5              + -       Add and subtract
  1140.      4              < > <>
  1141.                     = <= >=   String and numeric comparison
  1142.      3              &         Logical AND
  1143.      2              |         Logical OR
  1144.      1              :=        Assignment
  1145.  
  1146.      From the table above it can be deduced that for the  example
  1147.      given earlier, the expression would be evaluated as  1+(2*3)
  1148.      rather than the simple left-to-right parsing of (1+2)*3.
  1149.  
  1150.      The following  table  gives  some  examples  of  expressions
  1151.      without brackets and the equivalent bracketed expressions to
  1152.      demonstrate how  the operator  precedence table  is used  to
  1153.      determine the exact order of evaluation.
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1164.            - Main Manual.                    Page: 18 -
  1165.  
  1166.  
  1167.              Table 2.10: Examples of Operator Precedence
  1168.  
  1169.           Expression          Evaluated as   Result
  1170.           1+2*3               1+(2*3)        7
  1171.           1*2+3               (1*2)+3        5
  1172.           1+2*3^4             1+(2*(3^4))    163
  1173.           2*TAN(3.1416/4)     2*TAN(0.786)   2
  1174.           2*(10=20)           2*(0)          0
  1175.           2*10=20             (2*10)=20      1
  1176.           "a"="b"                            0
  1177.           "a"<"b"                            1
  1178.  
  1179.      Don't proceed until you understand all of the results above,
  1180.      since the basic ideas presented there are present throughout
  1181.      RExL.  Note  particularly, the final  two expressions  which
  1182.      are  not  intuitively  obvious  since  they  depend  on  the
  1183.      comparison operators, and thus return numeric results.   The
  1184.      second  of  the  two  examples  involving  string  constants
  1185.      requires knowledge of  the ASCII  character set.   For  more
  1186.      information on  this,  consult  the  ASCII  table  given  in
  1187.      appendix F.
  1188.  
  1189.  
  1190.      2.7  Assignments
  1191.  
  1192.  
  1193.      An assignment  is  a special  case  of  an expression.    It
  1194.      assigns the value  of some expression  to a variable,  which
  1195.      can be either be simple or array type, using the  assignment
  1196.      operator :=. The  return type of an  expression must be  the
  1197.      same type as  the variable  whose value  is being  assigned.
  1198.      Thus it is  not possible  to assign  a string  to a  numeric
  1199.      variable or vice versa. The general format of an  assignment
  1200.      is as follows:
  1201.  
  1202.                       <variable> := <expression>
  1203.  
  1204.      The <variable> above is sometimes referred to as an  LValue,
  1205.      short for Left hand Value.  When using non-array  variables,
  1206.      the LValue is  simply the name  of the  variable.   However,
  1207.      when using array  type variables,  you must  tell RExL  what
  1208.      element you are trying to assign a value to.  Thus, you must
  1209.      include the relevant  array element  subscripts in  brackets
  1210.      after the array variable's name.
  1211.  
  1212.      The  following  table  gives   some  examples  of   variable
  1213.      assignment statements:
  1214.  
  1215.  
  1216.  
  1217.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1218.            - Main Manual.                    Page: 19 -
  1219.  
  1220.  
  1221.                  Table 2.11: Examples of Assignments
  1222.  
  1223.      Expression          Result of operation
  1224.      a:=5                a is assigned the value of 5
  1225.      t$:="test"          t$ is assigned the string "test"
  1226.      a:=a+1              a is assigned the value of a plus 1, ie: 6
  1227.      t$:=t$+" string"    " string" is appended to the old value of t$
  1228.                          to give a new t$ value of "test string"
  1229.      ar[0]:=10           The first element of the numeric array ar[]
  1230.                          is assigned a value of 10
  1231.      ar[a]:=a+4          The seventh element of ar[] is assigned 10
  1232.      str$[1]:=t$         The second element of str$[] is assigned
  1233.                          the string "test string"
  1234.  
  1235.      Note particularly,  the third  and fourth  statements  which
  1236.      seem rather  counter-intuitive.   Recall from  the table  of
  1237.      operator precedence  that the  assignment operator  has  the
  1238.      lowest  precedence,  and  thus   will  be  evaluated   after
  1239.      everything else.  Thus, the meaning of the statement becomes
  1240.      `add one to  the variable a  and assign  the result of  this
  1241.      addition to  the variable  a.'   An assignment  will  always
  1242.      returns a `true' value of one.
  1243.  
  1244.  
  1245.      2.8  Statements
  1246.  
  1247.  
  1248.      `Statement' is a generic term  for a complete expression  or
  1249.      assignment in RExL.   In other  words, it  forms a  complete
  1250.      RExL `sentence' which can be interpreted and executed.
  1251.  
  1252.      When an application  is created, it  consists of  a list  of
  1253.      executable statements,  each  of  which returns  some  value
  1254.      (since they are  expressions). RExL uses  this return  value
  1255.      from a statement to determine  its next action:  Whether  to
  1256.      execute the next statement in the current list or to jump to
  1257.      some other location in the  application.  This will be  more
  1258.      fully explained in the section on rules.
  1259.  
  1260.  
  1261.      2.9  Inference
  1262.  
  1263.  
  1264.      Inference is the process of drawing a conclusion from a  set
  1265.      of propositions, each of which can be either true or False .
  1266.      RExL operates using  an inference engine:   This is used  to
  1267.      execute the  application and  to draw  conclusions from  its
  1268.  
  1269.  
  1270.  
  1271.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1272.            - Main Manual.                    Page: 20 -
  1273.  
  1274.  
  1275.      individual lines, each of which will evaluate as either true
  1276.      or False  and are therefore equivalent to propositions.
  1277.  
  1278.  
  1279.      2.10  Rules and Execution
  1280.  
  1281.  
  1282.      A rule  is  the  fundamental  building  block  of  all  RExL
  1283.      applications and  is roughly  equivalent to  a procedure  in
  1284.      conventional programming  languages. Rules  are made  up  of
  1285.      blocks of  lines  which  may be  executable  statements,  or
  1286.      further rules.
  1287.  
  1288.      Every non-blank line  in a  RExL application  has a  leading
  1289.      connector. This is a  logical `preposition' which tells  the
  1290.      inference engine how to link up this line with the  previous
  1291.      and following lines  in its rule.   In the current  release,
  1292.      there are three connectors:  AND, If and OR.  The use is  an
  1293.      application of  these connectors  is best  illustrated by  a
  1294.      simple example.
  1295.  
  1296.      If   The temperature is ok
  1297.      And  It is not raining
  1298.      And  Tell user to go for a walk
  1299.  
  1300.      Or   Tell user to stay inside and play a game of chess
  1301.  
  1302.      The meaning of  this should be fairly  clear:  The  computer
  1303.      will tell the user to go for a walk if the temperature is ok
  1304.      and it is not raining,  or else, the computer will tell  the
  1305.      user to play chess.  What actually happens during  execution
  1306.      is this:  the inference engine starts on the first line  and
  1307.      asks the user  `Is the temperature  ok ?'  (for the  moment,
  1308.      don't worry about how the computer asks this question or how
  1309.      it gets the reply). If  the answer to this question is  yes,
  1310.      that is True, then the  inference engine will let  execution
  1311.      pass to the next line and ask the question `Is it  raining?'
  1312.      If the answer  is again true, then  the computer will  `draw
  1313.      the conclusion' (or  more properly, execute  the line)  that
  1314.      the user should go for  a walk.  If  on the other hand,  the
  1315.      user had replied  no, or False, to  either of the  questions
  1316.      then the  inference engine  would have  determined that  the
  1317.      conditions for a walk were not present, passed execution  to
  1318.      the or clause  and therefore  suggested that  the user  play
  1319.      chess instead.
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1326.            - Main Manual.                    Page: 21 -
  1327.  
  1328.  
  1329.      Whether the user is advised to stay inside or to go out, the
  1330.      result of the  rule as  a whole  is the  same: It  succeeds,
  1331.      since it has successfully drawn a conclusion.
  1332.  
  1333.      RExL inserts the connectors itself. The rules for connectors
  1334.      can be generalised as follows: The first line in an unbroken
  1335.      sequence of lines will have  the connector OR, unless it  is
  1336.      the first non-blank line in  a rule, which will always  have
  1337.      the connector If (the meaning  of If and OR is  functionally
  1338.      identical). All  other  lines  in the  rule  will  have  the
  1339.      connector AND.   It is for  this reason  that the blocks  of
  1340.      lines are sometimes referred to as And-Blocks.
  1341.  
  1342.      The rules which the  inference engine follows for  execution
  1343.      are as follows:  In any rule,  execution will  begin at  the
  1344.      first non-blank line of the first AND-block within the rule,
  1345.      that is the line with the If as its connector. It  continues
  1346.      sequentially through the block  until one of two  conditions
  1347.      occur:  Either a line returns the value zero (for False), in
  1348.      which case execution will jump and continue at the start  of
  1349.      the  next  AND  block  in  the  rule.    Or  else  execution
  1350.      successfully reaches the end of an AND block, in which  case
  1351.      the  rule  returns  the  value  True  without  any   further
  1352.      statement execution  within that  rule.   If, on  the  other
  1353.      hand, a line returns False, and execution tries to  continue
  1354.      at the beginning of  the next AND block  when there is  none
  1355.      present, then the rule will return False.
  1356.  
  1357.  
  1358.      2.11  Subrules
  1359.  
  1360.  
  1361.      If we decided to make the application objective in assessing
  1362.      the temperature, rather than relying  on the user to do  so,
  1363.      we could as  the user whether  the temperature  is within  a
  1364.      certain range to find out whether it is really `ok' or  not.
  1365.      We  would  therefore  expand  the  definition  of  the   The
  1366.      temperature  is  ok  rule.    Instead  of  being  a   simple
  1367.      unexpanded line,  this rule  would then  `contain'  subrules
  1368.      such as the following:
  1369.  
  1370.      If   The temperature is more than 10 degrees
  1371.      And  The temperature is less than 40 degrees
  1372.  
  1373.      Therefore, when the application is started, instead of  RExL
  1374.      simply asking  the question  `Is  the temperature  ok?',  it
  1375.      would  instead  ask  the  two  more  specific  questions  to
  1376.  
  1377.  
  1378.  
  1379.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1380.            - Main Manual.                    Page: 22 -
  1381.  
  1382.  
  1383.      determine if  the  temperature  is  between  ten  and  forty
  1384.      degrees (Celsius!).
  1385.  
  1386.      During execution what actually  happens is that RExL  checks
  1387.      to see if the rule being  executed can be expanded.  If  so,
  1388.      then execution passes to the expanded portion, but remembers
  1389.      where the  rule was  `called' from.   It  then executes  the
  1390.      lines within the expanded rule and eventually returns a True
  1391.      or False value to the original caller of the rule.
  1392.  
  1393.      So, going back  to the example,  when execution reaches  the
  1394.      rule `Is the temperature ok?', it expands the definition and
  1395.      asks `Is the  temperature more than  10 degrees  ?'  If  the
  1396.      answer is `yes'  or True, then the  next question is  asked,
  1397.      `Is the temperature less than 40 degrees?'  If the answer is
  1398.      again True, then  both conditions in  the expanded rule  are
  1399.      True and so the the rule would succeed, return True and RExL
  1400.      will then ask whether it is raining or not, continuing  from
  1401.      where it left  off in  the parent rule.   If,  on the  other
  1402.      hand, the  user replies  `no' or  False,  to either  of  the
  1403.      questions about temperature,  then the  expanded rule  fails
  1404.      and returns  False  to  the parent  rule,  thus  making  the
  1405.      conditions for a walk unavailable, and therefore  suggesting
  1406.      that the user play chess.
  1407.  
  1408.      Every application has  a master rule  (sometimes known as  a
  1409.      `main rule') which  is called by  RExL when the  application
  1410.      starts. In the current release of RExL, this rule is  called
  1411.      Main Program and  cannot be changed.   All  other rules  can
  1412.      therefore be considered as subrules of the main rule.
  1413.  
  1414.      It is  very important  that  you understand  thoroughly  the
  1415.      action of the inference engine in RExL, and how it  executes
  1416.      rules and returns  values. All RExL  applications are  based
  1417.      upon the ideas presented in  this and the previous  section.
  1418.      You should reread them if you are not happy with them.
  1419.  
  1420.  
  1421.      2.12  Rule Modifiers
  1422.  
  1423.  
  1424.      The rules in  the previous  two sections  were basic  rules.
  1425.      That is, that  they acted as  rule calls  and were  executed
  1426.      every time the application called them.  There are, however,
  1427.      a number of  different variations  upon this  theme.   These
  1428.      rule modifiers perform some action other than a simple  rule
  1429.      call.  The six rule modifiers are as follows:
  1430.  
  1431.  
  1432.  
  1433.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1434.            - Main Manual.                    Page: 23 -
  1435.  
  1436.  
  1437.                       Table 2.12: Rule Modifiers
  1438.  
  1439.      Abbreviation   Used for
  1440.      BackTo         Rule recall
  1441.      Not            Return inversion of rule call
  1442.      While          Continuously execute rule while true
  1443.      Multi          Make rule multi-pass
  1444.      Single         Make rule single-pass
  1445.      Zap            Reset status of single-pass rule
  1446.  
  1447.      In the editor, the modifiers  are placed between the  line's
  1448.      connector and the name of the rule.  The function of the six
  1449.      modifiers are explained in the next six subsections.
  1450.  
  1451.      2.12.1  BackTo
  1452.  
  1453.      Whenever a rule is called by an application, RExL stores the
  1454.      place in the  listing where the  rule was  called from in  a
  1455.      special area known as the call stack (so called because rule
  1456.      calls are `stacked' there).  The BackTo modifier is used  to
  1457.      clear the  call stack  back to  the  last instance  of  some
  1458.      previous rule.  This can be used when for example, when  the
  1459.      user selects a  menu option to  restart an application,  the
  1460.      application could contain a line such as:
  1461.  
  1462.      And BackTo Main Program
  1463.  
  1464.      BackTo may also come in useful when an error occurs and  the
  1465.      program needs  to restart  the  execution from  some  point.
  1466.      Note that if  the rule specified doesn't  exist in the  call
  1467.      stack, then the application will end, since it can't  locate
  1468.      any place to restart from.
  1469.  
  1470.      2.12.2  Not
  1471.  
  1472.      When Not  is applied  to a  rule,  it reverses  the  logical
  1473.      return value of the rule.  Thus, if rule call returns  True,
  1474.      but the rule  is modified  by the  Not, then  the rule  will
  1475.      evaluate as  False.  The Not  modifier  is mostly  used  for
  1476.      logical tests  which are  easier to  evaluate as  True  than
  1477.      False (and vice versa).
  1478.  
  1479.      2.12.3  While
  1480.  
  1481.      The function  of the  While modifier  is to  execute a  rule
  1482.      continuously while its return value is True.  This could  be
  1483.      useful for doing some work in a database, where the rule  is
  1484.      designed to fail when the end of the database is reached.  A
  1485.  
  1486.  
  1487.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1488.            - Main Manual.                    Page: 24 -
  1489.  
  1490.  
  1491.      rule call  which  is  prefixed by  While  will  always  fail
  1492.      because of the nature of the modifier.
  1493.  
  1494.      2.12.4  Multi
  1495.  
  1496.      By default, all RExL rules are multi-pass rules.  This means
  1497.      that a rule is expanded and evaluated each and every time it
  1498.      is called (although this is not standard for expert systems,
  1499.      where all rules are  single-pass). However, it is  sometimes
  1500.      useful to have  rules which are  not reevaluated every  time
  1501.      they are called, but save their status from one call to  the
  1502.      next. These rules are known as single-pass rules.  The Multi
  1503.      modifier is used  to make  a single-pass  rule a  multi-pass
  1504.      rule.
  1505.  
  1506.      2.12.5  Single
  1507.  
  1508.      The Single modifier performs the  reverse of what the  Multi
  1509.      modifier does:    It  makes  a  multi-pass  rule  (the  RExL
  1510.      default) into a single-pass rule.
  1511.  
  1512.      2.12.6  Zap
  1513.  
  1514.      When a one-pass rule is  set up and has been evaluated,  but
  1515.      for some reason, needs to be to be reevaluated (because, for
  1516.      example, of some  changed condition) then  the Zap  modifier
  1517.      can be used  to reset  the status  of the  one-pass rule  to
  1518.      unknown, and thus  the rule will  be reexecuted  when it  is
  1519.      next called.
  1520.  
  1521.  
  1522.      2.13  Other Modifiers
  1523.  
  1524.  
  1525.      Every line,  other than  a simple  rule  call, must  have  a
  1526.      modifier attached to  it. We  have already  some across  the
  1527.      list of the six modifiers for rules in the previous section.
  1528.      That list is  now completed with the  list of modifiers  for
  1529.      the other line types:
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1542.            - Main Manual.                    Page: 25 -
  1543.  
  1544.  
  1545.                      Table 2.13: Other Modifiers
  1546.  
  1547.      Modifier       Applicable to
  1548.      [Expr ]        Statements
  1549.      [Dialg]        Input and output
  1550.      [Dsply]        Screens
  1551.      [Help ]        Screens
  1552.      [Menu ]        Screens
  1553.      [Print]        Screens
  1554.  
  1555.      Note that all  non-rule modifiers are  surrounded in  square
  1556.      brackets.  This is to  help the programmer distinguish at  a
  1557.      glance whether the line is a rule or screen/statement.   The
  1558.      final five modifiers  in the  table are  applicable only  to
  1559.      screens and  are dealt  with in  the chapter  on the  screen
  1560.      designer.
  1561.  
  1562.      The [Expr] modifier  at the  beginning of  a line  indicates
  1563.      that the  line  is  a statement  (either  an  assignment  or
  1564.      expression).   Expressions,  as  noted  before,  can  return
  1565.      either a zero value for False or a non-zero value for  True,
  1566.      while assignments  will always  return  True.   Examine  the
  1567.      following list of statements and satisfy yourself that  they
  1568.      return the values indicated.
  1569.  
  1570.                  Table 2.14: Expression Truth Values
  1571.  
  1572.      Statement                Returns
  1573.           1                   True
  1574.           0                   False
  1575.           123*23              True
  1576.           10-10               False
  1577.           a:=10               True
  1578.           a=10*("h"="h")      True
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1596.            - Main Manual.                    Page: 26 -
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1650.            - Main Manual.                    Page: 27 -
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.                               Chapter 3
  1660.  
  1661.                              Quick Start
  1662.  
  1663.  
  1664.      3.1  Introduction
  1665.  
  1666.  
  1667.      In this chapter, we'll go through the process of creating  a
  1668.      small application in RExL.   First, we'll use the editor  to
  1669.      create it, and then  the runtime module to  run it.  In  the
  1670.      final section, we'll  use the integrated  debugger to  debug
  1671.      the application.  If you haven't read the chapter on  RExL's
  1672.      language, you  should  do  so  now,  since  the  application
  1673.      developed there will be created  here, and the editor  won't
  1674.      make much sense unless you understand the language.
  1675.  
  1676.      Every RExL application is stored  on disk in two parts,  the
  1677.      first part is  the application image.   This is the  listing
  1678.      which you can edit using the editor. The second part is  the
  1679.      screen  file   which  stores   the  screens   used  in   the
  1680.      application.    The  application  image  file  has  a   file
  1681.      extension of ".RXL" while the screen file has one of ".SCR".
  1682.      Changes to the screen  file are included immediately,  while
  1683.      those to the application listing are saved only when RExL is
  1684.      instructed to do so.  It is for this reason that you  should
  1685.      not modify any  screens in an  application without  updating
  1686.      the application image  on disk, since the  two files may  go
  1687.      out of synchronisation.
  1688.  
  1689.      The RExL system also  comes in two parts.   The first  part,
  1690.      the  editor,  is  used  for  creating  and  maintaining  the
  1691.      application and  for  designing the  application's  screens.
  1692.      The second part  is the  runtime-debugger which  is used  to
  1693.      execute and debug the application.   This two part  approach
  1694.      is used because it maximises the amount of memory  available
  1695.      to each module.  The two modules are linked, so that you can
  1696.      run and debug  you application without  having to exit  from
  1697.      the editor and explicitly run the debugger.
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1704.            - Main Manual.                    Page: 28 -
  1705.  
  1706.  
  1707.      3.2  Creating an Application
  1708.  
  1709.  
  1710.      Start the editor by typing rexl at the DOS prompt and  press
  1711.      <Enter>.  After a second or two, the editor screen  appears.
  1712.      If any error  messages appear, just press  a key and  ignore
  1713.      them.
  1714.  
  1715.      The menu bar across the top of the screen uses the  standard
  1716.      menu keys  of <Left  Arrow> and  <Right Arrow>  to move  the
  1717.      hilite bar and  <Enter> to select  an option.   The  hilited
  1718.      letters in the menu titles (ie  `F' in File) can be used  to
  1719.      select an option as can a combination of the Alt key and the
  1720.      letter (ie <Alt-O> to select the options menu).  We want  to
  1721.      edit the application,  so select  the Edit  option from  the
  1722.      main menu and press <Enter>.
  1723.  
  1724.      The first line in the central edit window will be hilited in
  1725.      gray, the connector `If' will appear at the left end of  the
  1726.      hilite bar and the cursor will be placed a few characters in
  1727.      from this.   The  first line  of  our application  was  `The
  1728.      temperature is ok', so just  type this in to the editor  and
  1729.      press <Enter>.  The cursor and hilite bar will then jump  to
  1730.      the next  line and  an `And'  connector will  appear at  the
  1731.      start, in  the same  position as  the `If'  of the  previous
  1732.      line.  The rules for  the automatic insertion of  connectors
  1733.      will be explained shortly.
  1734.  
  1735.      Enter in the  next line  of text,  `It is  not raining'  and
  1736.      again press <Enter> to  go to the next  line (You can  press
  1737.      <Down-Arrow> to proceed if you want to, just be careful  not
  1738.      to insert blank lines, since  these will change the  meaning
  1739.      of the rule as we  will soon see).   The final line of  this
  1740.      And-Block is `Tell  the user  to go  for a  walk', so  enter
  1741.      this.
  1742.  
  1743.      The first  And-Block of  our mini-application  has now  been
  1744.      finished.  We now need to enter the final line, telling  the
  1745.      user what to do.   Place the hilite  bar over the `Tell  the
  1746.      user to go for  a walk' rule and  press the <Tab> key.  This
  1747.      will expand  the rule.    Note that  the  rule name  is  now
  1748.      displayed on  the line  underneath the  main menu  bar.   To
  1749.      display  the  RExL's  advice,  we'll  use  the   `DISPLAY()'
  1750.      function which we met earlier.  We'll need to tell RExL that
  1751.      what we are entering is a statement, so press the <F4>  key.
  1752.      This will generate the `[Expr]'  line modifier and place  it
  1753.      immediately after the `If' line connector.  If the  modifier
  1754.      were omitted, RExL would assume that the line was a rule and
  1755.  
  1756.  
  1757.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1758.            - Main Manual.                    Page: 29 -
  1759.  
  1760.  
  1761.      not an expression.   With the modifier  in place, enter  the
  1762.      expression `DISPLAY("You should  go out and  have a  walk")'
  1763.      This completes the first section of our application.   Press
  1764.      <Shift-Tab> to return from the  sub rule to the parent  rule
  1765.      (note that the rule name display area now displays the  name
  1766.      `Main Program').
  1767.  
  1768.      Press <Down-Arrow> (or <Enter>) twice, so that a blank  line
  1769.      now exists between the first  AND-block and the hilite  bar.
  1770.      You'll notice that  the connector  at the  beginning of  the
  1771.      line has now become `Or'.   The rule which RExL follows  for
  1772.      generating connectors  is simple.   Every  line begins  with
  1773.      `And', unless one of two conditions is true: The first  line
  1774.      of an AND-block  will have  the connector  `Or', unless  the
  1775.      line is  the first  line  in the  rule,  in which  case  the
  1776.      connector will be `If'.  All other non-blank lines will have
  1777.      the connector `And', while blank lines have no connector.
  1778.  
  1779.      Type in the text for  the `Or' condition: `Tell the user  to
  1780.      stay inside  and play  a game  of  chess'.   Press <Tab>  to
  1781.      expand the rule and then enter the expression `DISPLAY("Stay
  1782.      inside and play a game of chess")', not forgetting to  press
  1783.      <F4> to specify the `[Expr]' modifier.
  1784.  
  1785.  
  1786.      3.3  Running the Application
  1787.  
  1788.  
  1789.      The application is now ready to run.  Press <F2> to save  it
  1790.      and select the `Run' option from the main menu (by  pressing
  1791.      <Alt-R>, or <Esc> to return  to the main menu and using  the
  1792.      cursor keys to  select).  Select  the first  option in  that
  1793.      menu, `Run', and press <Enter>.   Within a few seconds,  the
  1794.      application should begin running.
  1795.  
  1796.      The screen will change to  a light gray background with  two
  1797.      cyan boxes in the  center of the screen.   The upper of  the
  1798.      two boxes will  contain the name  of the  first rule in  the
  1799.      application, `The  temperature  is  ok'.   Underneath  this,
  1800.      there is  a small  menu with  two options,  true and  false.
  1801.      When one of these options is selected, its value returned to
  1802.      RExL  directly.    Recall   from  the  explanation  of   the
  1803.      application in the previous chapter, that the user would  be
  1804.      advised to go for a walk if `the temperature was ok' and `it
  1805.      is not raining'. Therefore, for this conclusion to be drawn,
  1806.      the first reply must be true (select the `True' option  from
  1807.      the menu) as well as the second option (`True' again).  When
  1808.      both conditions have been  satisfied, RExL will display  the
  1809.  
  1810.  
  1811.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1812.            - Main Manual.                    Page: 30 -
  1813.  
  1814.  
  1815.      string `You should go for a walk' on the monitor.  Selecting
  1816.      a value of  false for either  of the  conditions will  cause
  1817.      RExL to draw the other conclusion, that the user should play
  1818.      a game of  chess.   When RExL  has printed  its advice,  the
  1819.      application will terminate and you  will be returned to  the
  1820.      editor.   If this  happens too  quickly to  see the  result,
  1821.      press <Alt-F5> from within the edit window in the editor  to
  1822.      display the user screen, the screen as it existed before the
  1823.      editor was loaded.
  1824.  
  1825.      You should  run this  application a  few times  and  satisfy
  1826.      yourself that you understand what it is doing.
  1827.  
  1828.  
  1829.      3.4  Expanding the Application
  1830.  
  1831.  
  1832.      We will  now expand  the  application using  custom  screens
  1833.      designed using the screen designer.
  1834.  
  1835.      Recall from the  language chapter that we  wished to make  a
  1836.      more objective assessment of whether the temperature was  ok
  1837.      by adding two  sub rules  to that  rule.   Instead of  doing
  1838.      this, we shall instead add an input screen to get the actual
  1839.      temperature from the user and to perform numeric comparisons
  1840.      upon it directly.
  1841.  
  1842.      Expand the definition  of the `The  temperature is ok'  rule
  1843.      and type in  the following `Input  a value for  temperature'
  1844.      and press <F10>.  A small menu will appear with six  options
  1845.      on it (these are the different screen types available).   We
  1846.      want the  program  to  perform some  input  and  output,  or
  1847.      dialog, with the  user, so  select the  `Dialog' option  and
  1848.      press <Enter>.   The editor screen  disappears and you  will
  1849.      see the start up screen  of screen designer which is  filled
  1850.      with  the  quarter  tone  character  `░'.    Move  somewhere
  1851.      slightly to the left  of the center of  the screen and  type
  1852.      `Enter the temperature :'
  1853.  
  1854.      We now want to define an  input field, so that the user  can
  1855.      input a value to  RExL.  Press <Ctrl-I>  to start the  field
  1856.      definition,  press  <Tab>  once   to  make  the  field   ten
  1857.      characters wide, and press <Enter>  to accept that size.   A
  1858.      box will appear asking for  an `input expression'.  As  with
  1859.      assignments, this  must  be  an  proper  LValue.    Type  in
  1860.      `Temperature'.  This  will the  name of  the variable  which
  1861.      we'll use to  store the value  of the  temperature in  (note
  1862.      that the  variable  doesn't end  in  a  dollar sign  and  is
  1863.  
  1864.  
  1865.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1866.            - Main Manual.                    Page: 31 -
  1867.  
  1868.  
  1869.      therefore  a   numeric   variable,  suitable   for   storing
  1870.      temperature values).   Press  <Enter> to  accept this  input
  1871.      expression.  The field will  now be replaced by a series  of
  1872.      ten question  marks  which are  used  to indicate  an  input
  1873.      field.  Press <F2> to save the screen and <Esc> to exit from
  1874.      the screen designer and return to the editor.  Note that the
  1875.      line's modifier  has  now  become `[Dialg]'  to  indicate  a
  1876.      dialog screen.
  1877.  
  1878.      Move  to   the   next   line  and   enter   the   expression
  1879.      `Temperature>10' and on the  following line, the  expression
  1880.      `Temperature<40',  remembering  to  press  <F4>  each  time.
  1881.      Press <Shift-Tab>  to return  to the  main rule,  enter  the
  1882.      `Tell user to go for a walk' rule, place the hilite bar over
  1883.      the `DISPLAY()' statement and press <Ctrl-Y> (or <Alt-D>) to
  1884.      delete the  line.   Type the  string `Go  for walk  screen',
  1885.      press <F10> and select the `Display' option from the  screen
  1886.      menu.  The `Display' screen type is used to display a screen
  1887.      and then  wait for  a key  to  be pressed,  it's useful  for
  1888.      displaying some information and then pausing until the  user
  1889.      has read it.  When in the screen designer, press <Alt-M>  to
  1890.      begin marking a block.  Move to the bottom right hand corner
  1891.      of the screen  using the arrow  keys (<End>  and <PgDn>  can
  1892.      also be used to do  it in two keystrokes) and press  <Enter>
  1893.      to select the block.  The block menu will now appear: Select
  1894.      the `Paint'  option to  color the  marked block.   Use  <Up-
  1895.      Arrow> and  <Down-Arrow>  to  change the  foreground  (text)
  1896.      color and <PgUp> and <PgDn> to change the background (paper)
  1897.      color.   Change it  to something  that  looks nice  on  your
  1898.      monitor.  When you have  finished painting the block,  press
  1899.      <Enter> to  accept.   Press  <Alt-R>  to remark  the  block,
  1900.      select the `Box' option from the menu and select one of  the
  1901.      box types from  the new menu which  appears. Make sure  that
  1902.      the  first  option  on  this  menu  is  `overlay'  and   not
  1903.      overwrite, otherwise the text you  typed in earlier will  be
  1904.      deleted.  You might like to try this a few times to see  the
  1905.      different types of box available.
  1906.  
  1907.      Move to  the center  of the  screen,  type the  string  `You
  1908.      should go for  a walk'  and save  the screen  using <F2>  as
  1909.      before.  Using  the same procedure  again, delete the  other
  1910.      occurrence of  `DISPLAY()' and  replace  it with  a  display
  1911.      screen.
  1912.  
  1913.      When you have  done this, run the  application again.   This
  1914.      time, instead of RExL asking  you `Is the temperature  ok?',
  1915.      it will ask for a  temperature value. Enter some value.   If
  1916.      the value was between 10 and 40 then both of the  comparison
  1917.  
  1918.  
  1919.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1920.            - Main Manual.                    Page: 32 -
  1921.  
  1922.  
  1923.      expressions entered after the screen in the temperature rule
  1924.      will be evaluated as true  and hence the rule will  succeed.
  1925.      RExL will then enquire, using the true/false menu, about the
  1926.      next condition for a walk, whether it is raining or not.  As
  1927.      before, if true is selected, RExL will display the `Go for a
  1928.      walk' screen, otherwise it will display the other result.
  1929.  
  1930.      Run this  application a  few times  to  make sure  that  you
  1931.      understand how it works.
  1932.  
  1933.  
  1934.      3.5  Debugging the Application
  1935.  
  1936.  
  1937.      When you are developing an  application in RExL, it is  very
  1938.      useful to be able to follow the thread of execution to  make
  1939.      sure that the application is doing what is you expect it to.
  1940.      The debugger, which is incorporated into the portion of RExL
  1941.      which runs the applications  (known as the runtime  module),
  1942.      can be used to do just that.
  1943.  
  1944.      Run your  application  again,  but  this  time,  instead  of
  1945.      selecting the `Run'  option from  the run  menu, select  the
  1946.      `Debug System' option.   After a  few seconds, the  debugger
  1947.      will appear.  The interface is much the same as that of  the
  1948.      editor  and  where   the  comparison   is  meaningful,   the
  1949.      keystrokes  are  the  same,   so  you  shouldn't  have   any
  1950.      difficulty using it.
  1951.  
  1952.      The screen  layout is  slightly different  from the  editor.
  1953.      The main differences are as follows:
  1954.  
  1955.          o  To the immediate left of the connector of every  non-
  1956.             blank line, there  is a status  character.  This  can
  1957.             assume  one  of  three  values,  `?',  `√'  and  `X',
  1958.             depending upon what  the logical status  of the  line
  1959.             is.  `?' for unknown or unevaluated, `√' for  logical
  1960.             true and `X' for logical false.
  1961.  
  1962.          o  The line about to be executed by RExL is indicated by
  1963.             an arrow  between the  line modifier  and the  line's
  1964.             text.
  1965.  
  1966.      Press <F7>.  This will trace the application.  Depending  on
  1967.      the current line type, tracing has different results: If  it
  1968.      is over a rule, then the debugger will enter the rule, as if
  1969.      you had pressed <Tab>, and it will place the debugger on the
  1970.      first non-blank line of that rule.  If the line is a screen,
  1971.  
  1972.  
  1973.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  1974.            - Main Manual.                    Page: 33 -
  1975.  
  1976.  
  1977.      then the  screen  will  be activated  and  control  will  be
  1978.      returned to the debugger when the screen terminates.  If the
  1979.      line is an expression, then  the line will be evaluated  and
  1980.      control again returned to the debugger afterwards. There are
  1981.      a few more  conditions which trace  controls, these will  be
  1982.      covered in the chapter on the debugger.
  1983.  
  1984.      When you pressed <F7>, the  hilite bar entered the rule  and
  1985.      was placed over the first line in it (which is the  screen).
  1986.      Press <F7> again  to execute the screen.   Enter some  value
  1987.      for the temperature  in the  prompt box  which appears  (try
  1988.      30).  When you press <Enter>, the screen terminates and  the
  1989.      debugger regains control of execution.  We will now place  a
  1990.      watch  on  the  variable  `temperature'.    A  watch  is  an
  1991.      expression which is evaluated  (or watched) every time  that
  1992.      RExL executes a line of code.   The watch can be entered  in
  1993.      one of  two  ways:  The  easiest  is  to  place  the  cursor
  1994.      somewhere in the word `temperature' on the debugger's screen
  1995.      and then press <Ctrl-W> (<Ctrl-F7> also works).  When  there
  1996.      is  one  present,  the  debugger  will  pull  a  word   from
  1997.      underneath the cursor  and place  it into  whatever box  you
  1998.      call up, in this case the watch expression box.  If the word
  1999.      appears, just press <Enter> to accept it, otherwise, type in
  2000.      the word `temperature'  and press <Enter>.   The  expression
  2001.      will be placed in the  `watch window', the box on the  lower
  2002.      portion  of  the  screen.    Following  the  expression  you
  2003.      entered, there will be a colon followed by the current value
  2004.      of that expression, in this case, the value you typed in  in
  2005.      the screen.   You can  set a watch  on any  valid string  or
  2006.      numeric expression.
  2007.  
  2008.      Press <F7> again  to execute  the line.   If  you entered  a
  2009.      value of 30 for the  temperature above, then this line  will
  2010.      be true, and the line  status indicator at the left edge  of
  2011.      the line will display a `√', if you entered some other value
  2012.      causing the line to fail,  then the status will be false  as
  2013.      indicated by a `X'.   Assuming you entered 30, the  debugger
  2014.      places the hilite  bar on the  final non-blank  line in  the
  2015.      rule which you can now trace.  The hilite bar should now  be
  2016.      beyond the last  line, to indicate  that the  rule has  been
  2017.      evaluated and that execution is about to return to where the
  2018.      rule was called from.  Trace again and see this happen.  The
  2019.      status indicator  of  the first  rule  in the  main  program
  2020.      should now be `√' to indicate that it was evaluated as true.
  2021.  
  2022.      We will step the next two lines.  Stepping is much the  same
  2023.      as tracing, the only difference being that if the line being
  2024.      stepped is a rule, then the debugger will not enter the rule
  2025.  
  2026.  
  2027.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2028.            - Main Manual.                    Page: 34 -
  2029.  
  2030.  
  2031.      definition, it as it does in trace.  Press <F8> to step  the
  2032.      application.   You'll now  be  presented with  the  familiar
  2033.      true/false menu  screen.   Select false  and note  that  the
  2034.      debugger has filled in an  `X' as the logical status of  the
  2035.      failed rule and  left the  status of  the last  rule in  the
  2036.      first AND-block as unspecified, using  `?'.  The hilite  bar
  2037.      will now be placed upon  the first line of the  alternative,
  2038.      the second  `AND'-block, so  press <F8>  to  step it.    The
  2039.      debugger  will  not  immediately   regain  control  of   the
  2040.      application since  the  screen  type being  displayed  is  a
  2041.      `display' screen and so requires a key press to end it.
  2042.  
  2043.      The hilite bar will now be on the final (empty) line of  the
  2044.      application. Press one  of the execute  keys (<F7>, <F8>  or
  2045.      space) to  terminate  the  application  and  return  to  the
  2046.      editor.
  2047.  
  2048.      Debug the application a few more times to make sure that you
  2049.      understand how stepping, tracing and watching work.  If  you
  2050.      want to delete a watch  expression, press <F6> to switch  to
  2051.      the watch window  and then <Del>  or <Alt-D>  to delete  the
  2052.      watch.  Press <F6> again to return to the code window.
  2053.  
  2054.      There are three other useful features in the debugger  which
  2055.      were not covered  above.  These  are the  `Execute To'  key,
  2056.      <F4>, the `Evaluate Expression' key, <Ctrl-E>, or  <Ctrl-F4>
  2057.      and the `Breakpoint' key, <Ctrl-F8>.  When you press <F4> on
  2058.      a non-blank line, the application will run until it  reaches
  2059.      that line. This is useful  when you are somewhere within  an
  2060.      application in  the  code  window  and you  wish  to  set  a
  2061.      temporary breakpoint.  For a full discussion of the features
  2062.      in the debugger, consult the chapter on the debugger.
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2082.            - Main Manual.                    Page: 35 -
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.                               Chapter 4
  2092.  
  2093.                               The Editor
  2094.  
  2095.  
  2096.      This chapter covers  the functions and  capabilities of  the
  2097.      editor in depth. Because of its size, the screen designer is
  2098.      documented in  a chapter  of its  own, rather  than in  this
  2099.      chapter.   You  should  have  read  the  chapter  on  RExL's
  2100.      language before you use the editor, since the two are linked
  2101.      very closely.
  2102.  
  2103.  
  2104.      4.1  Introduction
  2105.  
  2106.  
  2107.      RExL's editor uses the concept of `folding text' to make the
  2108.      programmer's job easier.  As  was explained in the  previous
  2109.      chapter on the structure of RExL programs, applications  are
  2110.      built up  in  a pyramidal  manner,  using rules  which  call
  2111.      further rules and so on.   This gives the application a  two
  2112.      dimensional structure which  has been  generally ignored  by
  2113.      traditional `flat file' editors.   RExL, on the other  hand,
  2114.      understands  this  hierarchical  structure  and  allows  the
  2115.      programmer to access procedures immediately, without  having
  2116.      to  do  searches  or  large  cursor  movements.    You  must
  2117.      understand this folding-text approach before you progress to
  2118.      the more complex aspects of the editor.
  2119.  
  2120.      The editor `understands' RExL's  language:  Whenever a  line
  2121.      of RExL code is entered,  RExL will check the line's  syntax
  2122.      to determine if the line is syntactically valid.  If it  is,
  2123.      then the text will be  scanned for variables which are  then
  2124.      be placed into the variable list. The syntax analyser checks
  2125.      not only for  errors such as  incorrect parameter lists  and
  2126.      invalid mathematical operations, but  also for less  obvious
  2127.      mistakes such as arrays with incorrect number of dimensions.
  2128.      When a new rule is defined, it is placed into the rule list,
  2129.      which can  then be  used to  locate  it rapidly.  A  similar
  2130.      procedure applies to screens which also have their own list.
  2131.  
  2132.  
  2133.  
  2134.  
  2135.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2136.            - Main Manual.                    Page: 36 -
  2137.  
  2138.  
  2139.      RExL's editor user interface  is based loosely on  Borland's
  2140.      integrated editor, as present  in Turbo Pascal versions  4.0
  2141.      to 5.5 and Turbo  C, versions 1.0 to  2.01.  Anyone who  has
  2142.      used these editors should have no difficulty using RExL.
  2143.  
  2144.  
  2145.      4.2  Interface Conventions
  2146.  
  2147.  
  2148.      There are a number of keystrokes and conventions which  RExL
  2149.      adheres to throughout the system. These are documented here.
  2150.  
  2151.          o  Cursor: The  cursor can  assume  one of  two  shapes,
  2152.             depending on  whether it  is in  insert or  overwrite
  2153.             modes.  When in insert  mode, the cursor will be  the
  2154.             same size  as the  character block  and text  entered
  2155.             will be inserted  into the  current cursor  location,
  2156.             pushing the text  to the right of  the cursor off  to
  2157.             the right, possibly  losing some  at the  end of  the
  2158.             input area.  When in overwrite mode, the cursor  will
  2159.             be two pixels  high and placed at  the bottom of  the
  2160.             character box.   Text  entered  will erase  any  text
  2161.             which was previously present at the cursor  position.
  2162.             The <Ins> key  is used to  toggle between insert  and
  2163.             overwrite modes.
  2164.  
  2165.          o  Cursor Movement: The  <Left> and  <Right> arrow  keys
  2166.             move  one  character  left  and  right  respectively.
  2167.             <Ctrl-Left> and <Ctrl-Right> move  one word left  and
  2168.             right.  <Home>  and <End> move  to the beginning  and
  2169.             end of the input area, unless in the screen designer,
  2170.             where they move to the  left hand edge and the  right
  2171.             hand edge of  the screen. <PgUp>  and <PgDn> move  up
  2172.             and down by the size of the current window, unless in
  2173.             the screen designer, where they  are used to move  to
  2174.             the top and  bottom of the  screen. <Backspace>  will
  2175.             delete the  character  to  the left  of  the  cursor,
  2176.             moving the text  to the  right (and  the cursor)  one
  2177.             character  to  the  left.    <Del>  will  delete  the
  2178.             character underneath the cursor,  moving the text  to
  2179.             the right one character to the left.
  2180.  
  2181.          o  Input: When  RExL  requests  string input,  there  is
  2182.             generally a default value which is hilited in  yellow
  2183.             text on  magenta background  within the  dialog  box.
  2184.             RExL interprets the  first keystroke  pressed in  the
  2185.             dialog box as  follows:  Pressing  one of the  cursor
  2186.             movement keys will deselect  this default so that  it
  2187.  
  2188.  
  2189.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2190.            - Main Manual.                    Page: 37 -
  2191.  
  2192.  
  2193.             may be edited.   A non-extended keystroke (these  are
  2194.             the letters A  to Z, the digits  0 to 9,  punctuation
  2195.             marks  and  all  characters  whose  ASCII  codes  are
  2196.             greater than 128) will  cause the selected string  to
  2197.             disappear and the keystroke entered to appear as  the
  2198.             first character of  the string.  Any other  keystroke
  2199.             (<Up>, <Down>,  <PgUp>,  <PgDn>, the  function  keys,
  2200.             <Alt-> and  <Ctrl->  keystroke  combinations  and  so
  2201.             forth) will terminate  the dialog and  return you  to
  2202.             the place from where it originated.  Once the  dialog
  2203.             has been  deselected, input  can continue  using  the
  2204.             standard editing  keys.   In the  current release  of
  2205.             RExL, the  string entered  cannot be  wider than  its
  2206.             input area.
  2207.  
  2208.          o  Scrap Buffer: The  scrap buffer is  a small one  line
  2209.             buffer which  can be  used to  copy and  paste  small
  2210.             chunks of text from one  input area to another.   The
  2211.             contents of the  scrap buffer  are displayed  between
  2212.             the curly  brackets  {} on  the  status line  at  the
  2213.             bottom of  the editor  screen.   If the  buffer  area
  2214.             would overflow on account of the length of the string
  2215.             placed  in  it,  RExL  will  display  the  first  six
  2216.             characters of  the  string  followed by  an  ellipsis
  2217.             (three dots) followed by  the last six characters  of
  2218.             the text.
  2219.  
  2220.             Text is entered  into the  scrap using  <Shift-Enter>
  2221.             and pasted  from the  scrap using  <Shift-Ins>.   The
  2222.             scrap may be used, even  when it not displayed,  such
  2223.             as when in the screen  designer.  Note that when  you
  2224.             terminate  RExL  lists   by  pressing  <Enter>,   the
  2225.             previously hilited  item  will  be  pasted  into  the
  2226.             scrap.  Terminating  by pressing any  other key  will
  2227.             not perform the paste.  Note that inserting text from
  2228.             the scrap will overwrite any text to the right of the
  2229.             cursor.
  2230.  
  2231.          o  Undo: In  all  string  input  areas,  you  can  press
  2232.             <Ctrl-U> to undo any changes to the original string.
  2233.  
  2234.          o  Help: On line help is available at all times in RExL.
  2235.             There are two forms of  help.  The first is  context-
  2236.             sensitive, meaning  that the  help which  appears  is
  2237.             relevant to whatever you are currently trying to  do.
  2238.             This help  is activated  by  pressing the  <F1>  key.
  2239.             Language help will bring up a help screen related  to
  2240.             the language keyword which the cursor is placed over.
  2241.  
  2242.  
  2243.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2244.            - Main Manual.                    Page: 38 -
  2245.  
  2246.  
  2247.             This is  activated by  pressing  <Ctrl-F1>.   At  any
  2248.             time, the last  help screen  to be  displayed can  be
  2249.             re-displayed by pressing <Alt-F1>.
  2250.  
  2251.          o  Window Move: Most windows  in RExL are movable  using
  2252.             the standard arrow keys when <Scroll-Lock> is active.
  2253.             This key is normally located at the top right of your
  2254.             keyboard.  Note that no windows may be moved over the
  2255.             status line at the bottom of the screen nor the  menu
  2256.             bar at the top of the screen.
  2257.  
  2258.          o  Macro Recording: You  can record macros  `on-the-fly'
  2259.             from anywhere within  RExL.  A macro  is a series  of
  2260.             keystrokes which can be `recorded' and `played back'.
  2261.             To switch  on  the  macro recording  facility,  press
  2262.             <Alt-Equals>.  A  dialog box will  pop up  requesting
  2263.             the name of  the macro which you  are about to  start
  2264.             recording.  If  you don't want to  assign it a  name,
  2265.             just press  <Enter>.    RExL  will  then  ask  for  a
  2266.             keystroke to  attach the  macro  to (press  <Esc>  to
  2267.             abort the record).  While you are  recording, an  `R'
  2268.             will appear  in  the  top left  hand  corner  of  the
  2269.             display, press <Alt-Equals> again  to turn the  macro
  2270.             record off.   You can save the  macros to disk  using
  2271.             the Options/Save  macros  menu  option.   Macros  can
  2272.             record and replay up 512 keystrokes.
  2273.  
  2274.             The list  of  macros  defined  can  be  displayed  by
  2275.             pressing <Alt-Minus>.  To  play back a macro,  hilite
  2276.             the name  with  the  hilite bar  and  press  <Enter>.
  2277.             While a macro  is playing, a `P'  will appear in  the
  2278.             top left corner of the display.
  2279.  
  2280.          o  Helix Searching: When using menus in RExL, there  are
  2281.             two methods  which  can  be used  to  select  options
  2282.             quicker than using the cursor keys.
  2283.  
  2284.                 -  Initial letter:  Most fixed size menus in RExL
  2285.                    have initial letter searching.  In this  mode,
  2286.                    all you need do is type the initial letter  of
  2287.                    the menu option and  it will be  automatically
  2288.                    selected.    The  initial  letter  is  usually
  2289.                    hilited in light blue.
  2290.  
  2291.                 -  Helix searching When the number of items in  a
  2292.                    list or menu  is variable, for  example as  in
  2293.                    the rule list, the  hilite bar can be  brought
  2294.                    to an option incrementally by typing the  name
  2295.  
  2296.  
  2297.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2298.            - Main Manual.                    Page: 39 -
  2299.  
  2300.  
  2301.                    of the  item  you  are  searching  for.    The
  2302.                    portion of the  item entered is  hilited in  a
  2303.                    slightly  differrent  color  from  the  normal
  2304.                    hilite bar. The  hilite bar will  move to  the
  2305.                    next item  which matches  the letters  entered
  2306.                    already,  with  those  letters  being  colored
  2307.                    black  on  a  light  gray  background.   Press
  2308.                    <Backspace> to delete  letters from the  helix
  2309.                    search list.
  2310.  
  2311.                    For example,  if you  had  a menu  with  three
  2312.                    items in  it, One,  Two  and Three,  when  the
  2313.                    letter T is pressed,  the hilite bar moves  to
  2314.                    the second option, and the first character  in
  2315.                    the menu bar becomes black on gray.  When h is
  2316.                    then pressed, the menu  bar moves to the  next
  2317.                    option and hilites the letters Th.
  2318.  
  2319.          o  File Name Input: Whenever RExL requests a file  name,
  2320.             such as  when  selecting  a file  to  load  into  the
  2321.             editor, you  may either  enter  a proper  file  name,
  2322.             otherwise  you   can  enter   a  file   specification
  2323.             including any of  the wild-card characters,  ? or  *.
  2324.             When using the wild-cards, RExL will give you a  menu
  2325.             listing   those   files   which   match   the    file
  2326.             specification  entered.    Any  directories  in   the
  2327.             current search directory  are also  displayed in  the
  2328.             list and you  can change to any  one by selecting  it
  2329.             from the list.  The  list of files matching the  file
  2330.             specification  will  be  regenerated  from  the   new
  2331.             current directory. For all directories other than the
  2332.             root (when performing wild card file selections)  the
  2333.             first option  on the  menu will  be "..\".  Selecting
  2334.             this  directory  will  being  you  to  the  directory
  2335.             directly above the current one.
  2336.  
  2337.             You can  terminate  the  menu  file  name  select  by
  2338.             pressing <Enter> to select a  file name, or <Esc>  to
  2339.             abort the selection.
  2340.  
  2341.  
  2342.      4.3  Editor Basics
  2343.  
  2344.  
  2345.      The editor is  started by typing `rexl'  at the DOS  prompt.
  2346.      You can  optionally  supply  a filename  for  RExL  to  load
  2347.      immediately into  the  editor.   Ther  is one  command  line
  2348.      option  which may be passed to the editor, the `-l'  option.
  2349.  
  2350.  
  2351.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2352.            - Main Manual.                    Page: 40 -
  2353.  
  2354.  
  2355.      This is used to tell the editor that it is running on an LCD
  2356.      display.  Once the `-l'  option has been specified, it  will
  2357.      be saved  to  the configuration  file,  so  it need  not  be
  2358.      specified again.
  2359.  
  2360.      The editor  does  two things  before  it becomes  ready  for
  2361.      input.  Firstly, it attempts to load the RExL  configuration
  2362.      file, REXL.CFG.  If there is no configuration file  present,
  2363.      RExL  proceeds   without   comment.     Secondly,   if   the
  2364.      configuration is so set up,  the editor will load the  index
  2365.      for the help file, if it  is unable to do so, an error  will
  2366.      be displayed.    The configuration  file stores  information
  2367.      about the position and colors  of the windows in \rexl,  the
  2368.      beeping, help,  function  case,  window  explosion,  bracket
  2369.      matching, list  size,  LCD  and DOS  screen  storage  status
  2370.      flags. When searching  for the  help file,  RExL will  first
  2371.      search  the  current  directory   and  then  the   directory
  2372.      specified by the REXL environment variable.
  2373.  
  2374.      The editor uses only one  command line parameter, -l.   This
  2375.      is used  to  tell RExL  that  an  LCD monochrome  screen  is
  2376.      attached to the computer which  it is running on and to  set
  2377.      the screen colors  accordingly.   Note that  the editor  can
  2378.      autodetect a  standard monochrome  screen,  but not  an  LCD
  2379.      monochrome since the hardware does not permit it.  Once  the
  2380.      -l option has been specified once, RExL will store it in its
  2381.      configuration file along  with the  rest of  the colors  and
  2382.      various other configuration data.
  2383.  
  2384.      Once the above  procedure has  been completed,  you will  be
  2385.      presented with the main editor  screen (note that you  can't
  2386.      have all the menus pulled down at once, as they are in  this
  2387.      figure!   The  dots  indicate where  the  menu  is  normally
  2388.      displayed):
  2389.  
  2390.                    [Figure omitted in disk manual]
  2391.  
  2392.      The bar at the top of  the screen has five pull down  menus.
  2393.      These can be activated by pressing the left and right  arrow
  2394.      keys to move from  one to the next,  and pressing the  enter
  2395.      key to select the hilited menu. Once selected, the menu will
  2396.      drop down  and a  standard selection  menu appears.  To  the
  2397.      right of the six menu titles,  is the name of the RExL  file
  2398.      which is  currently being  edited. If  the editor  has  been
  2399.      started with no application name given on the command  line,
  2400.      then this file name will be NONAME.RXL.  Note that if a file
  2401.      of this name exists in the current directory exists already,
  2402.      then it will be loaded.
  2403.  
  2404.  
  2405.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2406.            - Main Manual.                    Page: 41 -
  2407.  
  2408.  
  2409.      The bottom line of the screen is the status line, and it  is
  2410.      here that RExL posts the status of the editor as well as any
  2411.      error messages which are generated.  On the left hand end of
  2412.      the status line, between the  braces {} is the scrap  buffer
  2413.      display, as explained earlier in this chapter.
  2414.  
  2415.      The `Memory :' display on  the status line shows the  amount
  2416.      of available memory  in the  editor. If  this becomes  lower
  2417.      than about  20000 bytes,  you  may run  into  lack-of-memory
  2418.      problems.
  2419.  
  2420.      The `Level :' field displays the current rule `depth'  which
  2421.      the editor has reached.  We will cover rule depth in  detail
  2422.      further ahead in  this chapter. This  has a  maximum of  100
  2423.      levels which is more than enough for most applications.
  2424.  
  2425.      The six menus on the main horizontal menu bar have  contents
  2426.      as follows:
  2427.  
  2428.      4.3.1  File menu
  2429.  
  2430.                               ┌───────────────┐
  2431.                               │ Load          │
  2432.                               │ New file      │
  2433.                               │ Save          │
  2434.                               │ Write to      │
  2435.                               │ Remove        │
  2436.                               │ Change dir    │
  2437.                               │ Default drive │
  2438.                               │ OS shell      │
  2439.                               │ Quit          │
  2440.                               └───────────────┘
  2441.  
  2442.      The file menu has the following nine options:
  2443.  
  2444.         1.  Load:   This   option   controls   the   loading   of
  2445.             applications into RExL. When this is selected, a file
  2446.             name dialog box  (as explained  above) appears.  This
  2447.             will have as an initial value, the string "*.RXL".
  2448.  
  2449.         2.  New file: This option is  used to clear the  contents
  2450.             of the editor,  as if the  editor had been  restarted
  2451.             from the DOS prompt.  `NONAME.RXL' will be loaded  if
  2452.             is present in the current directory.
  2453.  
  2454.         3.  Save: When this option  is selected, the  application
  2455.             currently in  memory will  be  saved under  the  name
  2456.             displayed on the top line of the screen.  As a  short
  2457.  
  2458.  
  2459.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2460.            - Main Manual.                    Page: 42 -
  2461.  
  2462.  
  2463.             cut keystroke,  you can  press <F2>  from within  the
  2464.             main editor window.
  2465.  
  2466.         4.  Write to: This option allows the name of the  current
  2467.             application to  be changed.   When  it is  chosen,  a
  2468.             dialog box  will appear  requesting  a name  for  the
  2469.             current application to be written to. If a valid name
  2470.             is entered, the application  in memory will be  saved
  2471.             to disk under the new  name and the screen file  will
  2472.             be copied.
  2473.  
  2474.             If there is not enough disk space on the current disk
  2475.             drive for  the new  files,  then the  operation  will
  2476.             fail.  The  next menu option  may be  used to  remove
  2477.             unwanted files from disk.
  2478.  
  2479.         5.  Remove: This choice allows you to delete a file  from
  2480.             disk. You may need to do  this is you want to save  a
  2481.             file on disk, but are unable to do so through a  lack
  2482.             of disk space.
  2483.  
  2484.         6.  Change Dir: This option will allow you to change  the
  2485.             active directory.  The format  used here is much  the
  2486.             same as that used in the file name input routine, the
  2487.             only  differences  being  that  no  file  names   are
  2488.             displayed in  the list  and that  the current  active
  2489.             path  (drive  name  with  full  directory)  will   be
  2490.             displayed on the  status line  at the  bottom of  the
  2491.             screen.
  2492.  
  2493.         7.  Default Drive:  When this  option is  chosen, a  menu
  2494.             will pop up displaying the list of available DOS disk
  2495.             drives. As with  the directory  selection above,  the
  2496.             current  active  path  is  displayed  on  the  status
  2497.             display line at the bottom of the screen.
  2498.  
  2499.         8.  OS Shell: If you  want to run a  DOS command, but  do
  2500.             not wish to exit from the editor permanently,  choose
  2501.             this option to go into a DOS shell.  While you are in
  2502.             the shell, you should  not, under any  circumstances,
  2503.             run any T&SR programs (such as Sidekick, ScrGrab  and
  2504.             so forth), since these programs change critical  area
  2505.             of the computer's memory which may cause it to  crash
  2506.             unpredictably when you return to RExL.
  2507.  
  2508.             When you are  finished in the  shell, type `exit'  at
  2509.             the DOS prompt to return to RExL.
  2510.  
  2511.  
  2512.  
  2513.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2514.            - Main Manual.                    Page: 43 -
  2515.  
  2516.  
  2517.         9.  Quit:  This option terminates RExL and returns you to
  2518.             DOS. If the application currently in memory has  been
  2519.             altered, then  RExL  will prompt  you  to see  if  it
  2520.             should be saved. Selecting either of the options will
  2521.             perform the  action  and  then  return  you  to  DOS,
  2522.             pressing any other key will return you to the menu.
  2523.  
  2524.      4.3.2  Edit menu
  2525.  
  2526.                          ┌────────────────────────────────┐
  2527.                          │ Edit                           │
  2528.                          │ Default screen: <None>         │
  2529.                          └────────────────────────────────┘
  2530.  
  2531.      The edit menu  contains two  options.   Selecting the  first
  2532.      option, `Edit' will bring you directly into the edit  window
  2533.      to begin creation or editing  of your application. The  edit
  2534.      window will  be  covered in  detail  further ahead  in  this
  2535.      chapter.
  2536.  
  2537.      The second option, `Default screen:' is used for setting the
  2538.      name of the screen which is to be preloaded into the  screen
  2539.      designer.  When  this option  is selected,  the screen  list
  2540.      will be generated and a screen may be chosen to be made  the
  2541.      default. If a valid choice is made, then the screen designer
  2542.      will be started  so that the  default screen  itself may  be
  2543.      edited.  Default screens are most useful when all screens in
  2544.      an application must have the same set of colors, have a  few
  2545.      fixed fields or whatever.
  2546.  
  2547.      To clear name  of the default screen  from the listing,  the
  2548.      first option  in the  screen list,  `Clear default  screen',
  2549.      should be selected.
  2550.  
  2551.      4.3.3  Run menu
  2552.  
  2553.                               ┌───────────────────┐
  2554.                               │ Run               │
  2555.                               │ Debug application │
  2556.                               └───────────────────┘
  2557.  
  2558.      The run menu has the following two options:
  2559.  
  2560.         1.  Run: When  this  option  is  selected,  you  will  be
  2561.             requested to save the application which is  currently
  2562.             in memory (if necessary) and the runtime module  will
  2563.             be called to run it. Unlike the function of the  next
  2564.             option in this menu, the debugger will not be enabled
  2565.  
  2566.  
  2567.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2568.            - Main Manual.                    Page: 44 -
  2569.  
  2570.  
  2571.             when the application starts. Note that you can  enter
  2572.             the full  screen  debugger  at any  time  during  the
  2573.             running of  an application  by pressing  the  <Alt-D>
  2574.             keystroke (stands for Debug).
  2575.  
  2576.             When attempting  to locate  the runtime  module,  the
  2577.             editor first searches the current directory, then the
  2578.             directory specified by the RExL environment variable,
  2579.             and finally, the entire DOS  path, if one exists.  If
  2580.             the editor is unable to locate the runtime module, an
  2581.             error to this effect will be generated and the editor
  2582.             will continue running.
  2583.  
  2584.         2.  Debug application: As with the previous menu  option,
  2585.             the application  in  memory  will be  saved  and  the
  2586.             runtime  module   called   if  possible.   The   only
  2587.             difference  from  the  previous  menu  is  that   the
  2588.             debugger will be started  in full screen debug  mode,
  2589.             as if <Alt-D> had been pressed upon initiation of the
  2590.             application within the runtime.
  2591.  
  2592.      4.3.4  Lists menu
  2593.  
  2594.                               ┌────────────────────┐
  2595.                               │ Rule list          │
  2596.                               │ Screen list        │
  2597.                               │ Unused rule list   │
  2598.                               │ Unused screen list │
  2599.                               │ Variable list      │
  2600.                               │ Function list      │
  2601.                               └────────────────────┘
  2602.  
  2603.      This menu  gives you  access to  all the  lists of  entities
  2604.      which are defined the current application. Most of the lists
  2605.      have special  `hot-links' to  other, more  specific,  lists.
  2606.      These are mentioned  briefly at the  end of this  subsection
  2607.      and covered in  more detail further on.  All of these  lists
  2608.      are also available via hot-keys from within the main  editor
  2609.      window.  Consult  the  section  on  editor  keys  for   more
  2610.      information on this.
  2611.  
  2612.      The lists run menu has the following six options:
  2613.  
  2614.         1.  Rule list: This list contains the names of all of the
  2615.             rules   which   are   currently   defined   in   your
  2616.             application.
  2617.  
  2618.  
  2619.  
  2620.  
  2621.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2622.            - Main Manual.                    Page: 45 -
  2623.  
  2624.  
  2625.         2.  Screen list:  This list  contains  the names  of  all
  2626.             screens defined in the currently active screen file.
  2627.  
  2628.         3.  Unused rule list:  This list shows  all rules  which,
  2629.             although defined in the normal way, are not  actually
  2630.             referenced  by  the  application.  Pressing   <Alt-D>
  2631.             within this list will delete the unused rule from the
  2632.             application.2
  2633.  
  2634.         4.  Unused screen list: This list gives all screens which
  2635.             are not  referenced in  the current  application.  As
  2636.             with the  unused rule  list above,  press <Alt-D>  to
  2637.             delete the unused  screen from the  list and free  up
  2638.             the space it occupies within the screen file.
  2639.  
  2640.         5.  Variable list: This list contains all variables.  The
  2641.             status line at the bottom of the screen displays  the
  2642.             type of the variable, whether numeric or string,  and
  2643.             whether it's an array or a simple variable.
  2644.  
  2645.         6.  Function list: This list  contains all the  functions
  2646.             available in RExL.  Press <Ctrl-F1> for  help on  the
  2647.             hilited function.
  2648.  
  2649.         7.  Graphic rule  display: This  displays the  rule  call
  2650.             tree for the current rule.   This is covered in  more
  2651.             detail in its own section.
  2652.  
  2653.      All the list windows are movable by pressing  <Scroll-Lock>,
  2654.      using the  arrow  keys  to position  and  pressing  <Enter>,
  2655.      <Scroll-Lock> or <Esc>  to terminate the  window move.  Note
  2656.      that all lists in RExL feature helix searching. You can also
  2657.      output the contents of any  list to a file (or the  printer)
  2658.      by pressing <Ctrl-P>, as in DOS.
  2659.  
  2660.      If you terminate any of the lists by pressing <Enter>,  then
  2661.      the choice which you selected from that menu will be  placed
  2662.      into the scrap buffer, ready  for pasting using the  <Shift-
  2663.      Insert> keystroke.
  2664.  
  2665.  
  2666.  
  2667.  
  2668.      ____________________________________________________________
  2669.      2. Note that deeply recursive rules (those which do not have
  2670.         a  reference  to   themselves  in   the  immediate   rule
  2671.         definition) which are  not used  by other  rules are  not
  2672.         currently detected as being unused.
  2673.  
  2674.  
  2675.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2676.            - Main Manual.                    Page: 46 -
  2677.  
  2678.  
  2679.      4.3.5  Options menu
  2680.  
  2681.                          ┌───────────────────────┐
  2682.                          │ Load macros           │
  2683.                          │ Save macros           │
  2684.                          │ Beep off              │
  2685.                          │ Function lower case   │
  2686.                          │ Exploding windows off │
  2687.                          │ Dictionary size:  500 │
  2688.                          │ Help fast             │
  2689.                          │ Bracket match on      │
  2690.                          └───────────────────────┘
  2691.  
  2692.      The options  menu  controls  various system  parameters  and
  2693.      features not directly connected to the editor per se.
  2694.  
  2695.         1.  Load macros: Any macro definitions you define in  the
  2696.             editor may be saved to disk for later retrieval using
  2697.             this menu option. The  macro file format is  constant
  2698.             across the RExL product range, so that macros defined
  2699.             in the editor may be  used in the debugger or in  the
  2700.             database manager and so on.  Macros are explained  in
  2701.             more detail at the beginning of this chapter.
  2702.  
  2703.         2.  Save macros:  This option  allows you to save  macros
  2704.             which can then be reloaded at some future time  using
  2705.             the load option above.
  2706.  
  2707.         3.  Beep  off:    By  default,  RExL  beeps  whenever  it
  2708.             encounters an error. This  beeping can be toggled  on
  2709.             and off by selecting this option.
  2710.  
  2711.         4.  Function lower  case: By  default, all  functions  in
  2712.             RExL are displayed  in their natural  case.  This  is
  2713.             that functions  which  are  members of  families  are
  2714.             displayed  with  the  first  two  or  three   letters
  2715.             capitalised, while  the miscellaneous  functions  are
  2716.             entirely capitalised.  This option is used to  toggle
  2717.             between upper (or partially upper) case function name
  2718.             display and lower case.
  2719.  
  2720.         5.  Exploding windows  off:  In  its default  state,  all
  2721.             windows in RExL open instantaneously upon activation.
  2722.             This option can  be used  to make  windows `grow'  to
  2723.             full size  on the  screen.   This  is only  a  visual
  2724.             effect  and  has  no  effect  upon  the  application.
  2725.             Selecting the  option a  second  time will  turn  the
  2726.             option off again.
  2727.  
  2728.  
  2729.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2730.            - Main Manual.                    Page: 47 -
  2731.  
  2732.  
  2733.         6.  Dictionary size: The dictionary  size is the size  of
  2734.             all lists in RExL.   This defaults to a list size  of
  2735.             500 items, but can be  changed by using this  option.
  2736.             Each list entry  consumes four bytes  of memory.   If
  2737.             you   are   dealing   with   a   particularly   large
  2738.             application, you  may want  to  make this  list  size
  2739.             smaller to conserve memory.
  2740.  
  2741.         7.  Help fast: As explained earlier in this chapter,  the
  2742.             editor loads in the help  file index when it  starts.
  2743.             This is done so that  the help can respond  instantly
  2744.             to requests.  However,  the help file index  requires
  2745.             about 9000 bytes of  memory, so again, if  developing
  2746.             large applications,  you  may  wish  to  disable  the
  2747.             automatic loading. The help will then load the  index
  2748.             for every request which will slow it down somewhat.
  2749.  
  2750.         8.  Bracket match on:   When  entering expressions,  RExL
  2751.             will automatically hilite matching brackets.  This is
  2752.             to help you  locate incorrect  bracketing in  complex
  2753.             expressions.    You  can   toggle  this  feature   by
  2754.             selecting this option.
  2755.  
  2756.      4.3.6  Import menu
  2757.  
  2758.                               ┌─────────────────┐
  2759.                               │ Save to ASCII   │
  2760.                               │ Load from ASCII │
  2761.                               │ ASCII Options   │
  2762.                               └─────────────────┘
  2763.  
  2764.      RExL will import and  export properly formatted RExL  source
  2765.      files in ASCII format.  This is mainly done for purposes  of
  2766.      documentation and hard copy archival.  All attributes of  an
  2767.      application are  saved, including  screen colors,  text  and
  2768.      screen fields.  The ASCII  file can become large because  of
  2769.      the amount of  information contained in  it, typically,  the
  2770.      size of the listing file is  seven to ten times the size  of
  2771.      the combined listing and screen files.
  2772.  
  2773.      The foreground  and  background  colors of  screens  in  the
  2774.      application are saved in the  ASCII listing file as  letters
  2775.      which map  directly  to colors.  The  colors are  mapped  as
  2776.      follows:
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2784.            - Main Manual.                    Page: 48 -
  2785.  
  2786.  
  2787.                Table 4.1: ASCII Color Translation Table
  2788.  
  2789.      Letter    Color          Letter    Color
  2790.      0         Black          1         Dark gray
  2791.      B         Blue           b         Light blue
  2792.      G         Green          g         Light green
  2793.      C         Cyan           c         Light cyan
  2794.      R         Red            r         Light red
  2795.      M         Magenta        m         Light magenta
  2796.      Y         Brown          y         Yellow
  2797.      W         Light gray     w         White
  2798.  
  2799.      The  listing  file  will   save  the  contents  of   screens
  2800.      correctly, but certain  characters, such as  the ASCII  end-
  2801.      of-file marker, character 26, may confuse other DOS programs
  2802.      which read and write ASCII files, notably Sidekick, WordStar
  2803.      and so  on,  although RExL  will  load the  file  correctly.
  2804.      Furthermore,  the   ASCII   newline  and   carriage   return
  2805.      characters,  characters   10   and  13   respectively,   may
  2806.      unsynchronize the  listing file  so that  it will  not  load
  2807.      properly.
  2808.  
  2809.      There are two  active options  and one  sub-menu within  the
  2810.      Import Menu.  These are as follows:
  2811.  
  2812.          o  Save to ASCII:  The application  currently in  memory
  2813.             will be saved to disk as an ASCII listing file.   The
  2814.             file name  will be  the same  as that  of the  parent
  2815.             application, but with  an extension of  .LST.   While
  2816.             the listing  is being  saved,  its progress  will  be
  2817.             posted on the screen.
  2818.  
  2819.          o  Load from ASCII: A standard file name input box  will
  2820.             pop up  when you  select this  option.   The  default
  2821.             input string is  "*.LST" which  you can  edit in  the
  2822.             usual manner.  When you have selected a file to load,
  2823.             RExL will being to process  the file.  Note that  the
  2824.             format of the file is  very strict and you  shouldn't
  2825.             edit the ASCII  listing, in case  the editor  doesn't
  2826.             accept it.   The listing file  will be  saved in  the
  2827.             current directory (irrespective of where the  listing
  2828.             file is)  under  the  same file  name,  but  with  an
  2829.             extension for the application  image of .RXL and  one
  2830.             for the  screen file  of .SCR.   If  either of  these
  2831.             files already  exist, then  they will  be backed  up:
  2832.             The application  image being  given an  extension  of
  2833.             .BAK and the screen file one of .BKS.
  2834.  
  2835.  
  2836.  
  2837.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2838.            - Main Manual.                    Page: 49 -
  2839.  
  2840.  
  2841.          o  During the  loading  process,  all  executable  lines
  2842.             (that is screen fields  and lines in the  application
  2843.             image) will  be displayed  in  a box  underneath  the
  2844.             progress box which  also displays  the percentage  of
  2845.             the lising file loaded,  for your convenience.   This
  2846.             is done  so that  when an  error  occurs, it  can  be
  2847.             displayed on screen and edited.
  2848.  
  2849.          o  ASCII Options: This is a sub-menu which contains  the
  2850.             following two options  related to  ASCII loading  and
  2851.             saving.
  2852.  
  2853.                 -  Strip unused  vars: This  is a  yes/no  toggle
  2854.                    option. When set  to yes  all variables  which
  2855.                    are listed  in  the  ASCII listing  file,  but
  2856.                    which are not used in  the actual code of  the
  2857.                    application, are discarded  and not placed  in
  2858.                    the newly generated variable list. When set to
  2859.                    no, these unused variables are not removed.
  2860.  
  2861.                 -  Emit screen  codes:  This  is  another  yes/no
  2862.                    toggle option.  When it  is  set to  yes,  the
  2863.                    color codes for the screens in the listing are
  2864.                    emitted along  with the  text of  the  screen.
  2865.                    For purposes  of  system  documentation,  this
  2866.                    information is generally not needed, and  this
  2867.                    option can therefore be set to no.
  2868.  
  2869.  
  2870.      4.4  Using the Editor
  2871.  
  2872.  
  2873.      Once you have selected the  Edit option from the main  menu,
  2874.      RExL is ready  for you to  start creating your  application.
  2875.      All lines entered are  either statements, rules or  screens.
  2876.      The rules for entering  each line type are  laid out in  the
  2877.      next three sections.
  2878.  
  2879.      The editor will  automatically assign  the line  connectors,
  2880.      If, AND and OR according to the rules for block  connection.
  2881.      That is, the  first non-blank line  in a  rule uses If,  the
  2882.      first lines in the remainder of the and-blocks use OR, while
  2883.      all remaining non-blank lines use AND.  Blank lines have  no
  2884.      connector.
  2885.  
  2886.      A rule  may be  declared as  one pass  by pressing  <Ctrl-O>
  2887.      within the edit window.  Since the one-pass modifier applies
  2888.      to the rule as a whole, the modifier [OnePass] is  displayed
  2889.  
  2890.  
  2891.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2892.            - Main Manual.                    Page: 50 -
  2893.  
  2894.  
  2895.      in the rule name box at the top of the edit window.  As with
  2896.      the rule type modifiers, <Ctrl-O> toggles its modifier.
  2897.  
  2898.      4.4.1  Entering Statements
  2899.  
  2900.      Statements,  which  include  both  assignments  and  logical
  2901.      expressions, are the simplest to specify, by pressing <F4>.
  2902.  
  2903.      However, before RExL  will accept  a statement,  it must  be
  2904.      syntactically valid.  The statement syntax checker scans the
  2905.      line for invalid syntax, incorrectly dimensioned arrays  and
  2906.      incorrectly used functions and variables. When it encounters
  2907.      an error, it signals the location of the error on the  input
  2908.      line with  an red  indicator.   A keystroke  will clear  the
  2909.      error and return control to the editor, where the error  can
  2910.      be corrected.
  2911.  
  2912.      If the  line is  syntactically correct,  the syntax  checker
  2913.      will recover all variables from the line and add them to the
  2914.      variable list, available on <Alt-V>.   Any new arrays  found
  2915.      in the statement will be dimensioned to ten elements in  all
  2916.      their declared  dimensions,  although  this can  be  changed
  2917.      through the variable list, explained shortly.
  2918.  
  2919.      In certain  cases,  when  comparing strings  and  using  the
  2920.      logical return values,  you may need  to bracket the  string
  2921.      sub-expression to avoid incorrect  parsing. For example,  an
  2922.      expression such  as  a:=10+"a"=a$  will  require  bracketing
  2923.      since the  sub-expression 10+"a"  will be  evaluated  first,
  2924.      since addition has a higher precedence than equality.
  2925.  
  2926.      When the line has been passed as correct, the syntax checker
  2927.      then converts the text into symbolic tokens which are stored
  2928.      more efficiently  in memory  than text  alone.   This has  a
  2929.      number of side effects:
  2930.  
  2931.          o  Variables  are   converted   to   internal   variable
  2932.             reference numbers:  It is for this reason that when a
  2933.             variable is entered a second time, the case in  which
  2934.             it finally appears will be the same as that in  which
  2935.             was first  entered.  For  example, if  you  enter  an
  2936.             expression such  as MyAge:=10  (where MyAge  has  not
  2937.             been defined  previously)  and  later  on  enter  the
  2938.             expression myaGE=12, then  the string  myaGE will  be
  2939.             converted to the earlier occurrence of MyAge.
  2940.  
  2941.          o  Numbers are stored in one of four forms, depending on
  2942.             their size.  Whole  integers  between -127  and  +127
  2943.  
  2944.  
  2945.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  2946.            - Main Manual.                    Page: 51 -
  2947.  
  2948.  
  2949.             inclusive are  stored exactly  as one  byte  numbers,
  2950.             whole integers between -32767  and +32767 are  stored
  2951.             exactly as two byte integers, whole integers  between
  2952.             -2147483647 and  +2147483647  are stored  exactly  as
  2953.             four byte numbers.  All  other numbers are stored  as
  2954.             as eight byte  double precision real  numbers, to  an
  2955.             accuracy of approximately fifteen digits.
  2956.  
  2957.             When you enter  a number, it  will be converted  into
  2958.             the appropriate internal format.  Any superfluous, or
  2959.             unstorable decimal places will be discarded.
  2960.  
  2961.      4.4.2  Entering Rules
  2962.  
  2963.      Rules are the simplest entities to enter in RExL:  Any  line
  2964.      without a modifier defaults to a rule.  When an unknown rule
  2965.      is entered, it  is entered into  the rule list  immediately.
  2966.      As with variables,  rules are stored  by reference, so  that
  2967.      once a rule has been entered, its case cannot be changed.
  2968.  
  2969.      The text of rules themselves  may be edited, and the  editor
  2970.      will change all  references to  reflect the  new edition  of
  2971.      that rule.
  2972.  
  2973.      Rules can take  any of  the modifiers,  BackTo, Not,  While,
  2974.      Multi, Single,  Zap  or a  blank  modifier.   Each  modifier
  2975.      modifies the meaning of the rule as explained in the chapter
  2976.      on the language,  a blank  modifier simply  means `call  the
  2977.      rule' and do not modify its return value.
  2978.  
  2979.      To set the  line's modifier, press  <Ctrl-> followed by  the
  2980.      initial letter of the modifier.  Thus <Ctrl-Z> will generate
  2981.      a Zap  modifier.  Pressing the  key  again will  remove  the
  2982.      modifier and return  the rule  to its  unaltered state.  The
  2983.      full list of modifiers and keystrokes is given at the end of
  2984.      this chapter in the key reference.
  2985.  
  2986.      To expand  the definition  of a  rule to  include  subrules,
  2987.      statements, screens and so forth, press <Tab>.  The name  of
  2988.      the expanded rule will be placed in the rule name box at the
  2989.      top of the  edit window  and the  hilite bar  placed on  the
  2990.      first line of the rule.  Press <Shift-Tab> to return to  the
  2991.      parent rule.
  2992.  
  2993.      Since all rules are stored by reference, the  capitalization
  2994.      of a rule name is set when the rule is initially entered, it
  2995.      cannot be changed after this. Whenever the name of a rule is
  2996.      changed  (by  editing   it),  all  references   to  it   are
  2997.  
  2998.  
  2999.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3000.            - Main Manual.                    Page: 52 -
  3001.  
  3002.  
  3003.      automatically updated.  The editor  will not allow the  name
  3004.      of a rule to be  changed to one which exists already,  since
  3005.      it can't determine which rule is referred to.
  3006.  
  3007.      4.4.3  Entering Screens
  3008.  
  3009.      A screen can be one of five types, [Dialg], [Dsply], [Help],
  3010.      [Menu] or [Print].  The meanings each of these modifiers  is
  3011.      explained in the chapter on the screen designer.
  3012.  
  3013.      As with rules, the name of a screen can be changed and  will
  3014.      be updated  automatically in  the screen  file as  will  all
  3015.      references to  it  in  the application  being  edited.    As
  3016.      before, the new name cannot be one which already exists.
  3017.  
  3018.      To enter a  screen, press <Tab> or  <F10> when hiliting  the
  3019.      name of the screen in the edit window.  If the named  screen
  3020.      does not exist in the screen file already, then you will  be
  3021.      prompted to select a screen type from a pop up menu.
  3022.  
  3023.      Because the screen designer is a major and large feature  in
  3024.      RExL, it is documented in a chapter of its own.
  3025.  
  3026.  
  3027.      4.5  Editor Lists
  3028.  
  3029.  
  3030.      At all times,  the editor  maintains lists  of all  entities
  3031.      defined within RExL.  These are the lists of used and unused
  3032.      rules, used and unused screens  and variables.  Most of  the
  3033.      lists have `hot-links', or special keystrokes which  produce
  3034.      lists specific to the item  hilited in the first list.   The
  3035.      following three subsections tell how these lists are used.
  3036.  
  3037.      When a list is activated, a window, the width of the  screen
  3038.      is displayed. The window extends to the second last line  of
  3039.      the  screen  if  there  are  enough  elements  to  fill  it,
  3040.      otherwise it sizes itself to  produce a window large  enough
  3041.      to hold all items.  If all the elements cannot be displayed,
  3042.      a scroll bar will be displayed on the right hand edge of the
  3043.      list. The <Scroll-lock> key can  be used to move the  window
  3044.      using the arrow keys while the contents of the window may be
  3045.      written  to  a  file  or  the  printer  using  the  <Ctrl-P>
  3046.      keystroke. All lists containing  rules have a hot-link  tied
  3047.      to the <Tab> key. When this is pressed, the editor will quit
  3048.      the list and enter and expand the definition of the  hilited
  3049.      rule.  This  keystroke is present in  the normal and  unused
  3050.      rule lists, the screen list,  and all rule reference  lists.
  3051.  
  3052.  
  3053.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3054.            - Main Manual.                    Page: 53 -
  3055.  
  3056.  
  3057.      If a  list  is  terminated by  pressing  <Enter>,  the  last
  3058.      hilited item  in the  list will  be  pasted into  the  scrap
  3059.      buffer. Terminating the list any other way (say by  pressing
  3060.      <Esc>, <Left-Arrow>, <Right-Arrow> and so on) will not alter
  3061.      the contents of the scrap.
  3062.  
  3063.      4.5.1  Reference List
  3064.  
  3065.      The reference list of a rule is the list of the rules  which
  3066.      reference, or call,  the rule currently  being edited.   The
  3067.      only hot-link in the reference  list is the <Tab> key,  used
  3068.      to enter a rule's definition.  Reference lists are available
  3069.      in the screen  list, the rule  list and  the variable  list.
  3070.      All reference lists are generated by pressing <Ctrl-R>.
  3071.  
  3072.      The <Ctrl-R> keystroke can also be used to generate the list
  3073.      of rules which  call the current rule.   This list  performs
  3074.      the same  operations  as  the generic  rule  reference  list
  3075.      above.
  3076.  
  3077.      4.5.2  Rule List
  3078.  
  3079.      The rule list is the most  commonly used list of all and  it
  3080.      is for this reason that  it is attached to the keystroke  of
  3081.      <Alt-Z> or  <Shift-F2>.   The rule  list contains  two  hot-
  3082.      links, the first is the  <Tab> link as explained above,  and
  3083.      the second link, tied to <Ctrl-R>, which generates the  rule
  3084.      reference list,  the  list  of  rules  which  reference  the
  3085.      hilited rule.
  3086.  
  3087.      4.5.3  Screen List
  3088.  
  3089.      The screen list  gives the names of  all screens defined  in
  3090.      the application  and is  generated  by pressing  <Alt-S>  or
  3091.      <Shift-F3>.    This  list  includes  both  used  and  unused
  3092.      screens.  This  list has two  hot links,  the first tied  to
  3093.      <Ctrl-R>, generates  a screen  reference list,  the list  of
  3094.      rules which use the hilited screen.  This reference list has
  3095.      the  normal  hot-link  key  of  <Tab>  to  enter  a   rule's
  3096.      definition.  The second hot-link in the screen list is  tied
  3097.      to <Tab>: When pressed, the editor will immediately jump  to
  3098.      the first  occurrence  of  the  hilited  screen  within  the
  3099.      application.
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3108.            - Main Manual.                    Page: 54 -
  3109.  
  3110.  
  3111.      4.5.4  Unused Rule List
  3112.  
  3113.      The unused  rule list  gives the  list  of rules  which  are
  3114.      unused in  the  current  application  and  is  generated  by
  3115.      pressing <Alt-U> or <Shift-F4>.
  3116.  
  3117.      There are a few minor quirks  which you need to be aware  of
  3118.      when using this  list.  Firstly, the  list will not  contain
  3119.      rules  which  are  used  by  unused  rules  but  are  unused
  3120.      elsewhere within the application.  Secondly, rules which are
  3121.      recursive, or use  the modified rules  from deeper than  the
  3122.      first call  level of  the rule  will  not be  included.   To
  3123.      clarify the last point, if  a rule called Top Rule called  a
  3124.      rule Second Rule  which then called Top  Rule, all of  which
  3125.      were unused by the rest of the application, the unused  rule
  3126.      list would not  determine that neither  Top Rule nor  Second
  3127.      Rule were unused. On the other hand, if Second Rule did  not
  3128.      call Top Rule,  then Top  Rule alone  would be  found to  be
  3129.      unused and placed in the list.
  3130.  
  3131.      If you  wish to  remove unused  rules from  the  application
  3132.      altogether, press <Alt-D> (or  <Ctrl-Y>).  The hilited  rule
  3133.      will be removed  from memory and  `forgotten' by  RExL.   If
  3134.      there are rules which were only used by newly deleted unused
  3135.      rules, then  these can  be listed  by exiting  from and  re-
  3136.      entering the list.
  3137.  
  3138.      To enter the definition of an unused rule, press <Tab>  when
  3139.      hiliting the  rule.    When you  are  finished  editing  the
  3140.      definition of an unused rule, press <Shift-Tab> to return to
  3141.      the main rule.
  3142.  
  3143.      4.5.5  Unused Screen List
  3144.  
  3145.      The unused screen list  is generated by pressing  <Shift-F5>
  3146.      and is  much the  same as  the  unused rule  list, with  the
  3147.      exception that screens  which are used  by unused rules  are
  3148.      said to be  used. Press <Alt-D>  or <Ctrl-Y>  to delete  the
  3149.      screen from the screen file.
  3150.  
  3151.      4.5.6  Variable List
  3152.  
  3153.      The variable  list,  on  <Alt-V> and  <Shift-F6>  lists  all
  3154.      variables defined within your application.  When the list is
  3155.      active, the status  line at the  bottom of  the screen  will
  3156.      display the type of the variable and its dimensions, if  the
  3157.      hilited variable is an array.
  3158.  
  3159.  
  3160.  
  3161.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3162.            - Main Manual.                    Page: 55 -
  3163.  
  3164.  
  3165.      There is  one  hot-link  in the  variable  list:    Pressing
  3166.      <Ctrl-R> will generate a list  of the rules which  reference
  3167.      the hilited variable.  Note that the variable reference list
  3168.      does  not  list  the  rules  which  contain  screens   which
  3169.      reference the variable.   As with  all reference lists,  you
  3170.      can go directly  to a hilited  rule by  pressing <Tab>  from
  3171.      within the reference list.
  3172.  
  3173.      You can alter the size of an array variable from within  the
  3174.      variable list  by pressing  <Tab> when  hiliting the  array.
  3175.      The cursor will reappear on the variable status line in  the
  3176.      first of the array's dimensions,  where the value there  can
  3177.      edited.  By default, all arrays are dimensioned to a size of
  3178.      ten in all the array's dimensions.
  3179.  
  3180.      4.5.7  Function List
  3181.  
  3182.      This list  contains  all  internal  RExL  functions  and  is
  3183.      generated by pressing <Ctrl-F> or <Shift-F7>.  The arguments
  3184.      which the function requires are listed on the status line at
  3185.      the bottom  of the  screen. There  are twelve  abbreviations
  3186.      which are  used for  the  twelve different  parameter  types
  3187.      which may be passed to RExL's function.
  3188.  
  3189.              Table 4.2: Function Parameter Abbreviations
  3190.  
  3191.      Abbreviation        Meaning
  3192.      number              Numeric expression
  3193.      string              String expression
  3194.      variant             Numeric or string expression
  3195.      arraynv             Variable size string or numeric array
  3196.      array1v             One dimensional string or numeric array
  3197.      array2v             Two dimensional string or numeric array
  3198.      array3v             Three dimensional string or numeric array
  3199.      arrayn$             Variable size string array
  3200.      array1$             One dimensional string array
  3201.      array2$             Two dimensional string array
  3202.      array3$             Three dimensional string array
  3203.      arrayn              Variable size numeric array
  3204.      array1              One dimensional numeric array
  3205.      array2              Two dimensional numeric array
  3206.      array3              Three dimensional numeric array
  3207.  
  3208.      Press  <Ctrl-F1>  to  get  language  help  on  the  function
  3209.      currently hilited.
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3216.            - Main Manual.                    Page: 56 -
  3217.  
  3218.  
  3219.      4.6  Other Functions
  3220.  
  3221.  
  3222.      The editor  has a  number of  other functions  which do  not
  3223.      easily fall into any of the categories listed before.  These
  3224.      are given here.
  3225.  
  3226.      4.6.1  Graphic Rule Display
  3227.  
  3228.      The graphic  rule display,  generated by  pressing  <Alt-G>,
  3229.      lists the dependencies of rules upon each other in an  easy-
  3230.      to-understand graphic format.  When in the display, you  can
  3231.      move the  hilite bar  up  and down  by  in the  normal  way.
  3232.      Pressing <Tab>  will  expand  the currently  hilited  rule's
  3233.      definition while pressing <Enter> will paste the name of the
  3234.      hilited rule into the scrap buffer.
  3235.  
  3236.      The easiest way to understand the graphic rule display is to
  3237.      look at an example.
  3238.  
  3239.                 [Figure not available in disk manual]
  3240.  
  3241.      When the graphic rule display was called, the editor was  in
  3242.      the main rule, the root of the application, so therefore the
  3243.      entire dependency tree  will be displayed.    In this  case,
  3244.      the Main Program consists of three rules linked as follows:
  3245.  
  3246.      If    First rule
  3247.      And   Second rule
  3248.      And   Restart the application
  3249.  
  3250.      In the graphic display, rules connected by AND's are  linked
  3251.      by vertical bars, hence the  bar on the extreme left of  the
  3252.      display connecting these three  rules.  First Rule  contains
  3253.      the following:
  3254.  
  3255.      If    First sub rule of 1st rule
  3256.      And   Second sub rule of 1st rule
  3257.  
  3258.      Or    Or This sub rule of the 1st rule
  3259.  
  3260.      As with the  main rule,  the first  two lines  in the  first
  3261.      and-block are linked  by a vertical bar.   When the  display
  3262.      generator  reaches  an  OR  connector,  it  terminates   the
  3263.      vertical bar and begins a new one.  In the case of the First
  3264.      rule, there is only one line in the second and-block, so the
  3265.      vertical bar cannot  extend beyond the  current line, so  it
  3266.      will collapse to give a horizontal bar.  The same  procedure
  3267.  
  3268.  
  3269.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3270.            - Main Manual.                    Page: 57 -
  3271.  
  3272.  
  3273.      applies to the Second rule which has the same format as  the
  3274.      previous one.
  3275.  
  3276.      Normal rules are  colored light gray,  while recursive  rule
  3277.      calls or rules prefixed with the BackTo modifier are hilited
  3278.      in yellow.   In  the example  above, all  rules are  colored
  3279.      light gray, except  for the third  last rule  and the  final
  3280.      rule in the  display, both of which  are prefixed by  BackTo
  3281.      and are therefore colored yellow.
  3282.  
  3283.      As with all lists, this can  be printed to a file or  device
  3284.      by pressing <Ctrl-P> and entering a file name.
  3285.  
  3286.      4.6.2  Miscellaneous keystrokes
  3287.  
  3288.      4.6.2.1  Cut and paste
  3289.  
  3290.      Beginning with version 2.10 of  RExL, blocks of text can  be
  3291.      moved around in  the editor using  the concept  of the  line
  3292.      buffer.  The line  buffer operates in a  similar way to  the
  3293.      scrap buffer on the bottom line of the screen.
  3294.  
  3295.      To copy  a block  of  text, it  must  be selected  and  then
  3296.      inserted into the  line buffer.   The  <Alt-M> keystroke  is
  3297.      used to set the `anchor' point and further movements of  the
  3298.      cursor keys will  extend the block  in the direction  moved.
  3299.      When the desired block has been marked it can be deleted, or
  3300.      cut, to the line buffer by pressing <Shift-Del> or copied to
  3301.      the line buffer by pressing <Alt-M> again.
  3302.  
  3303.      When the line buffer contains text, the triple bar character
  3304.      _≡_, is placed  at the left  hand end  of the editor  status
  3305.      bar, just to the  left of the normal  scrap buffer. Text  is
  3306.      copied to,  or  pasted from,  the  line buffer  by  pressing
  3307.      <Alt-C>.
  3308.  
  3309.      The editor will not  allow text to be  deleted to the  scrap
  3310.      buffer if the current rule exists already in the rule stack.
  3311.  
  3312.      4.6.2.2  Editing keys
  3313.  
  3314.      <Alt-B> places a blank line before the current line, pushing
  3315.      those lines  after the  current line,  down one  line.   The
  3316.      connector on the line pushed down will change to OR, in line
  3317.      with the rules for connectors.
  3318.  
  3319.      <Alt-D> will  delete the  current  line, pulling  all  lines
  3320.      after the current  line up one line.   The line's  connector
  3321.  
  3322.  
  3323.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3324.            - Main Manual.                    Page: 58 -
  3325.  
  3326.  
  3327.      will be changed if necessary.  The more normal keystroke  of
  3328.      <Ctrl-Y> performs the same function as <Alt-D>
  3329.  
  3330.      <Enter> will act in the same manner as <Down-Arrow>.
  3331.  
  3332.      <Ctrl-Home> moves the hilite bar  to the top of the  screen,
  3333.      while <Ctrl-End> moves it to the bottom of the screen or the
  3334.      last line in  the rule,  whichever is  nearer.   <Ctrl-PgUp>
  3335.      moves the hilite bar to the first line in the rule.
  3336.  
  3337.      4.6.2.3  Other keys
  3338.  
  3339.      <Alt-X> will attempt to terminate the editor and return  you
  3340.      to DOS.  If the file being edited has been changed since  it
  3341.      was last saved, then you will be prompted to save the file.
  3342.  
  3343.      <Alt-F5> displays the DOS screen, as it was when the  editor
  3344.      first started up.
  3345.  
  3346.      <Ctrl-F8> toggles a runtime breakpoint at the current  line.
  3347.      The breakpoint will be signalled by a breakpoint  character,
  3348.      ≡.
  3349.  
  3350.      <F2> will save the current application while <F3> will  load
  3351.      a new one.
  3352.  
  3353.      <F9>  runs  the  application  and  calls  up  the  debugger,
  3354.      prompting the user  to save the  application if  it has  not
  3355.      already been done.   <Ctrl-F9> runs the application  without
  3356.      calling up the debugger.
  3357.  
  3358.      <F10> will enter  the screen designer,  popping up a  screen
  3359.      type selection menu if the screen specified on the line does
  3360.      not already exist in the screen file.
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3378.            - Main Manual.                    Page: 59 -
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386.  
  3387.                               Chapter 5
  3388.  
  3389.                            Screens in RExL
  3390.  
  3391.  
  3392.      5.1  Introduction
  3393.  
  3394.  
  3395.      This  chapter  documents   the  screen   designer  and   the
  3396.      capabilities of screens  in RExL.   Screens are an  integral
  3397.      part of RExL as a whole  and are used for input, output  and
  3398.      dialog in general with the outside world.  The documentation
  3399.      on the screen designer is divided up into two chapters,  the
  3400.      first dealing with the different types of screens  available
  3401.      and their specific purpose with the system, while the second
  3402.      deals with the  specifics of  using the  screen designer  to
  3403.      produce the screens.
  3404.  
  3405.      Any modifications to a screen in an application are  written
  3406.      immediately to  disk in  the disk  based screen  file.  This
  3407.      allows for  screen files  which  can be  arbitrarily  large.
  3408.      However, if  changes are  made to  the screen  file, and  in
  3409.      particular, if the position of  a screen changes within  the
  3410.      screen file, then  the old  backup copy  of the  application
  3411.      image on disk (the ".RXL"  file) will not hold a valid  copy
  3412.      of your application.   The reason for  this is that  screens
  3413.      are  stored  in  application  image  files  using  reference
  3414.      numbers.   If  a screen's  position  is changed  within  the
  3415.      screen file, then the reference  number for the screen  will
  3416.      be invalidated, and because  of the algorithm for  squeezing
  3417.      screens into screen files, other screens may be  invalidated
  3418.      also. The upshot of this is that whenever a change has  been
  3419.      made to a screen file, you should press <F2> from within the
  3420.      edit window to update the  application image on disk.   This
  3421.      is not strictly necessary, but  if you live in an area  with
  3422.      frequent power  outages,  a  `dirty' power  supply  or  just
  3423.      simply wish to keep a valid backup at all times, then you do
  3424.      it.
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3432.            - Main Manual.                    Page: 60 -
  3433.  
  3434.  
  3435.      5.2  Fields
  3436.  
  3437.  
  3438.      5.2.1  Introduction
  3439.  
  3440.      A screen  field is  an area  of  the screen  which has  some
  3441.      special property or meaning when the screen is activated  in
  3442.      the application.  There are  five different types of  field,
  3443.      some of which are possible in only some types of screen.   A
  3444.      table at the end of this section gives the legal and illegal
  3445.      combinations of fields and screens.  All fields have certain
  3446.      properties associated with them  which modify the  behaviour
  3447.      of the field  in some manner.   The  various properties  are
  3448.      covered in the next few paragraphs.
  3449.  
  3450.      5.2.1.1  Field Properties
  3451.  
  3452.      Fields have two colors attached  to them.  The first is  the
  3453.      active color, the color in which a field will appear when it
  3454.      becomes the active field on  a screen.  The second color  is
  3455.      the inactive color which is the color in which they will  be
  3456.      displayed at all  other times, when they  are inactive.   By
  3457.      default, all fields have the same active and inactive colors
  3458.      (except for menu fields where one color is the `reverse'  of
  3459.      the other,  and  output fields,  which  can have  no  active
  3460.      state).  The combination of foreground and background  color
  3461.      of a location on screen is generally known as its attribute,
  3462.      to avoid confusion with the less precise term `color'  which
  3463.      can be used to refer to the foreground color, the background
  3464.      color or the combination of both.
  3465.  
  3466.      All fields  which can  display changing  information can  be
  3467.      specified as left justified (the default), in which case the
  3468.      information to be displayed will be placed flush against the
  3469.      left hand end  of the field,  or right  justified where  the
  3470.      information is placed flush  right.  The justification  mode
  3471.      can be selected from the field control menu.
  3472.  
  3473.      The controlling  variable of  all fields  must be  a  proper
  3474.      LValue, except for output fields  where it can be any  valid
  3475.      expression.  While  the screen is being  run by the  runtime
  3476.      module, the values of the various fields is rigorously  kept
  3477.      up to date by global recalculation of all field values.  The
  3478.      result of this is that  whenever a value is specified for  a
  3479.      field,  the  value  is   stored  immediately  and  all   the
  3480.      expressions in the  fields in the  screen are  recalculated.
  3481.      However, if an  application contains a  screen with a  large
  3482.      number of  fields,  this  recalculation may  slow  down  the
  3483.  
  3484.  
  3485.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3486.            - Main Manual.                    Page: 61 -
  3487.  
  3488.  
  3489.      screen.    To   get  around   this  problem,   there  is   a
  3490.      recalculation flag  attached to  fields to  specify  whether
  3491.      that field should be recalculated every time.  As with field
  3492.      justification, the recalculation state can be selected  from
  3493.      the field control menu.
  3494.  
  3495.      In the  screen  designer,  the  different  field  types  are
  3496.      displayed using special characters which are removed  before
  3497.      display during  execution.    The following  six  paragraphs
  3498.      outline briefly the functions of each of the different field
  3499.      types and how  they are displayed  on screen  in the  screen
  3500.      designer.
  3501.  
  3502.      Where possible, the  initial value of  a field  will be  the
  3503.      value of the field's LValue upon entry to the screen.
  3504.  
  3505.      5.2.2  Output Fields
  3506.  
  3507.      Output fields are the most common form of fields.  They  are
  3508.      used to output either string or numeric information at fixed
  3509.      positions and within fixed boundaries.  For numeric  output,
  3510.      the decimal precision  of the  output can  be specified  and
  3511.      defaults to  zero places  of decimals.   Output  fields  are
  3512.      displayed on the screen using  hash symbols, #.  The  output
  3513.      field  expression  can  be  any  valid  numeric  or   string
  3514.      expression.   Note that  string results  are output  without
  3515.      quotation marks unlike the debugger expression evaluator and
  3516.      watch facility.
  3517.  
  3518.      5.2.3  Input Fields
  3519.  
  3520.      Input fields  are  used  for input  of  string  and  numeric
  3521.      information.  Like all other fields except output, the input
  3522.      field expression must  be a  proper LValue.   Numeric  input
  3523.      fields can have a decimal precision specified for input.  By
  3524.      default, the precision is zero places of decimals but it can
  3525.      be altered via the field control menu.
  3526.  
  3527.      Input fields  can be  specified as  being required,  meaning
  3528.      that for strings a non-blank  string must be entered,  while
  3529.      for numbers,  a  non-zero number  must  be entered.    Input
  3530.      fields are  displayed  on screen  as  a series  of  question
  3531.      marks, ?, extending to the width of the input area.
  3532.  
  3533.      5.2.4  Toggle List Fields
  3534.  
  3535.      A toggle list  field is a list  of string constants  through
  3536.      which the end-user can move  by pressing <Space> or  <Right>
  3537.  
  3538.  
  3539.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3540.            - Main Manual.                    Page: 62 -
  3541.  
  3542.  
  3543.      to go to the next, or  <Backspace> or <Left> to move to  the
  3544.      previous choice.  There can be a maximum of 100 choices in a
  3545.      single toggle list.  Toggle  lists are preferable to  string
  3546.      input where there are only  a small number of valid  strings
  3547.      which may be  entered.  Toggle  list fields  can use  either
  3548.      numeric or string  LValues.  Toggle  lists are displayed  on
  3549.      screen as a  series of piping symbols,  |, extending to  the
  3550.      width of the field.
  3551.  
  3552.      5.2.5  Check Box Fields
  3553.  
  3554.      A check box is a  field which only take  on a True or  False
  3555.      value.  Check boxes are useful when you have to implement  a
  3556.      boolean choice, for example:  whether the user wants to back
  3557.      up  some  data.  String   and  numeric  LValues  are   valid
  3558.      expressions for check boxes. The value returned to RExL  for
  3559.      a checked check box is 1.0 for a numeric LValue and "Y"  for
  3560.      a string LValue, while an unchecked check box returns 0.0 to
  3561.      a numeric LValue and "N" to a string LValue.
  3562.  
  3563.      If the  check box  expression is  of string  type, then  the
  3564.      initial character in  the string  is used  to determine  the
  3565.      initial value of  the check box  field. The characters  "Y",
  3566.      "T", "y" and "t" are all  taken to mean True and all  others
  3567.      are taken as False.
  3568.  
  3569.      A check box is displayed on screen as an open square bracket
  3570.      followed by a space and a close square bracket character:  [
  3571.      ].  When  a check box  is checked, the  space in the  center
  3572.      will be replaced by a tick mark √.  The value in a check box
  3573.      is toggled by pressing <Space>.
  3574.  
  3575.      5.2.6  Radio Button Fields
  3576.  
  3577.      A radio button field is  a vertical list of choices, one  of
  3578.      which must be chosen (it  is for this reason that the  field
  3579.      is known as  a radio button).  This field  type is used  for
  3580.      input of information similar to that in a toggle list field.
  3581.      Radio button fields are displayed as a three character  wide
  3582.      column, each  line  consisting  of  an  opening  parentheses
  3583.      followed by a space and a closing parentheses.  The  current
  3584.      choice of the radio button is denoted by a solid dot  placed
  3585.      between one of the sets of parentheses: ().
  3586.  
  3587.      When activated, <Up> and <Backspace> are used to move to the
  3588.      previous member of the radio button list, while <Space>  and
  3589.      <Down> are used  to move to the  next member.   Alphanumeric
  3590.      keystrokes (letters  and digits)  bring  the cursor  to  the
  3591.  
  3592.  
  3593.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3594.            - Main Manual.                    Page: 63 -
  3595.  
  3596.  
  3597.      first  button  whose  label's  initial  letter  matches  the
  3598.      keystroke. Labels are considered to  be to the right of  the
  3599.      radio button list.
  3600.  
  3601.      Consider the following radio button list:
  3602.  
  3603.           ( ) First Choice
  3604.           ( ) Second Choice
  3605.           ( ) Third Choice
  3606.           ( ) Fourth Choice
  3607.  
  3608.      On entry  the radio  button will  indicate the  label  First
  3609.      Choice.  Pressing the letter `S' will bring move the  cursor
  3610.      to the second choice, since the initial letter of the  label
  3611.      is `S'.   Pressing  `F' once  brings  the indicator  to  the
  3612.      fourth choice, while pressing it again brings it back to the
  3613.      first choice.
  3614.  
  3615.      5.2.7  Menu Fields
  3616.  
  3617.      Menu fields are the simplest type of field available in RExL
  3618.      and can only  occur in menu  screens.   They are defined  as
  3619.      retangular areas of any size. When in use, the user switches
  3620.      from one field to the next  in the same manner as in  input,
  3621.      check box, toggle  list and radio  button fields.   As  with
  3622.      radio buttons above, entering  letters will move the  hilite
  3623.      bar to the  first field after the  currently hilited one  to
  3624.      contain  the  letter  pressed  in  its  uppermost  and  left
  3625.      position.
  3626.  
  3627.      Unlike the other field types, menu fields may contain  other
  3628.      fields.  You  can thus create menus  with variable items  by
  3629.      placing menu  fields over  output fields  which display  the
  3630.      item values.   If you  so wish,  you can  place menu  fields
  3631.      within one another to give a moving bar type display.
  3632.  
  3633.      Menu screens return a value  to the LValue attached to  that
  3634.      screen. Internally, the LValue is stored as the first  field
  3635.      in the menu  screen and  can only  be changed  when you  are
  3636.      entering the screen designer, and not from within the screen
  3637.      designer itself.
  3638.  
  3639.  
  3640.      5.3  Screen Types
  3641.  
  3642.  
  3643.      There are five different types of screen, each designed  for
  3644.      a specific purpose.  As  explained in the Language  chapter,
  3645.  
  3646.  
  3647.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3648.            - Main Manual.                    Page: 64 -
  3649.  
  3650.  
  3651.      each screen has an associated modifier which instructs  RExL
  3652.      what to do  with the  screen when  it encounters  it in  the
  3653.      application.
  3654.  
  3655.                        Table 5.1: Screen Types
  3656.  
  3657.      Abbreviation   Used for
  3658.      [Dialg]        Basic input and output
  3659.      [Dsply]        Output with pause
  3660.      [Help ]        On-line user application help display
  3661.      [Menu ]        Menu choice display
  3662.      [Print]        Hard copy output
  3663.  
  3664.      Because modifiers are  attached to  individual lines  rather
  3665.      than to the screens per se, a single screen can be used with
  3666.      more than  one  modifier. A  typical  example is  a  results
  3667.      output screen which  can be  displayed as  a dialog  screen,
  3668.      using the  [Dialg]  modifier and  then  printed as  a  print
  3669.      screen using [Print].
  3670.  
  3671.      As noted  above,  not  all  field types  are  valid  in  all
  3672.      screens.  The following  table lists the valid  combinations
  3673.      of field types and screen types.
  3674.  
  3675.         Table 5.2: Valid Combinations of Screen and Field Type
  3676.  
  3677.                Output    Input     Toggle    Check     Radio     Menu
  3678.      Dialog    Yes       Yes       Yes       Yes       Yes
  3679.      Menu      Yes                                               Yes
  3680.      Print     Yes
  3681.      Help      Yes
  3682.      Display   Yes
  3683.  
  3684.      If you try to use a field in a screen which does not support
  3685.      that field type,  you may get  spurious results.   As  noted
  3686.      above, menu screens store their LValue in the first field in
  3687.      the screen, thus if you try to convert a non-menu screen  to
  3688.      a menu screen, the menu's LValue will become the  expression
  3689.      entered for  the first  field in  the non-menu  screen.   In
  3690.      general, you should  only mix  screen types  which have  the
  3691.      same field types available.
  3692.  
  3693.      The next five  subsections give details on  the use of  each
  3694.      screen type.
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3702.            - Main Manual.                    Page: 65 -
  3703.  
  3704.  
  3705.      5.3.1  Dialog Screen
  3706.  
  3707.      The dialog screen is the most used of all the screen  types.
  3708.      It is the only screen  which can contain numeric and  string
  3709.      input, check boxes, radio buttons and toggle lists.
  3710.  
  3711.      Input starts from the top of the screen and proceeds to  the
  3712.      right and down  the screen.   When in  the screen  designer,
  3713.      pressing <Ctrl-S> displays the field sequence number of  the
  3714.      field underneath  the  cursor.   The  sequence  numbers  are
  3715.      updated whenever a field is moved, created or copied.
  3716.  
  3717.      <Tab>, <Down-Arrow> and <Enter> are used to move forward one
  3718.      field and <Shift-Tab> and <Up-Arrow> to move back one field.
  3719.      If there is a field directly above and touching the  current
  3720.      field, then <Up-Arrow> will move to that field, instead of a
  3721.      field to the right of the upper field. <Down-Arrow> works in
  3722.      the same  way.    This  makes  block  areas  of  input  more
  3723.      intuitive to use.
  3724.  
  3725.      To terminate the dialog screen, press <Enter> when the final
  3726.      field on  the screen  is active,  or <Ctrl-Enter>  from  any
  3727.      field.
  3728.  
  3729.      In numeric and string input fields,  <End> moves the  cursor
  3730.      to the right hand  end while <Home> moves  to the left  hand
  3731.      end.  <Ctrl-Left> and <Ctrl-Right> move the cursor one  word
  3732.      to the left and right respectively while <Ctrl-U> undoes any
  3733.      changes to numeric and string input areas.
  3734.  
  3735.      If there are a  large number of fields  on the screen,  then
  3736.      you may want  to turn off  automatic field recalculation  to
  3737.      speed up processing of the screen.
  3738.  
  3739.      If there are  any string or numeric  input fields which  are
  3740.      defined as being necessary but are not filled (non-zero  for
  3741.      numeric fields),  then  a message  to  this effect  will  be
  3742.      displayed at the bottom of the screen and the missing  field
  3743.      will be filled  with X's which  are removed  with the  error
  3744.      message when a key is pressed.
  3745.  
  3746.      5.3.2  Display Screen
  3747.  
  3748.      Display screens are used to display information and to pause
  3749.      for a keystroke.   This  is to get  around having  to use  a
  3750.      dialog screen  with no  active fields  in it  followed by  a
  3751.      KBread() statement. The keyboard buffer is not emptied  when
  3752.  
  3753.  
  3754.  
  3755.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3756.            - Main Manual.                    Page: 66 -
  3757.  
  3758.  
  3759.      this screen type  is used, so  you may  need to precede  the
  3760.      screen with a KBclear() statement.
  3761.  
  3762.      5.3.3  Help Screen
  3763.  
  3764.      Help screens are  used to implement  context sensitive  help
  3765.      during screen dialog.  The number of help screens  available
  3766.      to the user is not  limited, although there can only be  one
  3767.      help screen available at any one time. Whenever the  runtime
  3768.      module encounters a help screen, an internal variable  saves
  3769.      the name of the screen, then any subsequent <F1>  keystrokes
  3770.      will cause  this screen  to be  displayed.   When  the  help
  3771.      screen has been  displayed, RExL waits  for a keystroke  and
  3772.      then restores the contents of the screen as they were before
  3773.      <F1> was pressed.
  3774.  
  3775.      Once a screen  has been saved  as the  current help  screen,
  3776.      that screen will remain current until the next occurrence of
  3777.      a help screen.
  3778.  
  3779.      5.3.4  Menu Screen
  3780.  
  3781.      Menu screens return a value  to a numeric variable  attached
  3782.      to the  screen and  can be  used to  implement block  menus.
  3783.      Menu fields, which can only be used in this type of  screen,
  3784.      can be of  any size  and may  be nested  inside one  another
  3785.      unlike other field types.  When a menu field is defined, the
  3786.      field's inactive color  is set  as described  above but  the
  3787.      field's active color is set to the `reverse' of the inactive
  3788.      color (for the computer literate, the active color is xor'ed
  3789.      with 7Fh to generate the  reverse attribute).  This is  done
  3790.      so that the end-user of the system can tell which menu field
  3791.      is currently active.
  3792.  
  3793.      When a menu area has been defined on screen, a vertical line
  3794.      of piping symbols, |, is  placed on the left hand and  right
  3795.      hand sides  of the  area. When  the  menu is  active on  the
  3796.      screen, the piping symbols are replaced by blanks, to give a
  3797.      margin one character wide at either end of the area.
  3798.  
  3799.      When in use, the keys of <Up>, <Down>, <Tab> and <Shift-Tab>
  3800.      may be used to switch between menu fields in the normal way.
  3801.      As with the radio button field as explained above,  pressing
  3802.      letters will move the active  menu to the field whose  first
  3803.      character (starting  from  the top  left  of the  field  and
  3804.      moving right and down) matches the keystroke typed.
  3805.  
  3806.  
  3807.  
  3808.  
  3809.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3810.            - Main Manual.                    Page: 67 -
  3811.  
  3812.  
  3813.      If there  are no  menu fields  in  a menu  screen, then  the
  3814.      screen is displayed and  execution continues without  pause.
  3815.      As mentioned  above, the  first field  in a  menu screen  is
  3816.      reserved for the menu screen's LValue.  you should bear this
  3817.      in mind when trying to turn a menu screen into another  type
  3818.      of screen (or vice versa).
  3819.  
  3820.      5.3.5  Print Screen
  3821.  
  3822.      Print screens are used to send output to the printing device
  3823.      attached to your  computer, which by default is the DOS file
  3824.      PRN file. This default can be  changed by using the OUTPUT()
  3825.      command. A print screen may only contain output  fields.
  3826.  
  3827.      Although RExL has no  intrinsic support for printer  effects
  3828.      such as italics,   bold and so forth,  you can send  control
  3829.      sequences to  the  printer by  using   output  fields  which
  3830.      output the required characters.
  3831.  
  3832.      When  RExL  is  printing  a  screen,  it  omits  all   lines
  3833.      containing spaces from the   bottom of the screen, to  avoid
  3834.      having large blank spaces in  the printout. If  you want  to
  3835.      have print screens of fixed  lengths, then you should  place
  3836.      some  nonblank  character at the final  line of the  screen.
  3837.      For example,  if you  wish   to  print out  labels of  fixed
  3838.      height of (say)  9 lines, irrespective of  the  contents  of
  3839.      the screen,  then  you  should place  some  unprintable  but
  3840.      nonblank  character  on the final  line. The tab  character,
  3841.      CHR$(9), is ideal for this and   could be placed in its  own
  3842.      output field  on the  last line  of the  label, or  in   the
  3843.      inter-label space.
  3844.  
  3845.      5.3.6  Subscreens
  3846.  
  3847.      Subscreens are identical  in function  to ordinary  screens,
  3848.      the only difference  being that they do not occupy the  full
  3849.      size of the screen. Subscreens  are  slightly cumbersome  to
  3850.      define: By default,  when the screen designer  is asked   to
  3851.      design a  new screen,  it assumes  that the  full screen  is
  3852.      required. To get   around  this, a  temporary screen  (which
  3853.      will be  dumped  later)  must  be  created    and  then  the
  3854.      subscreen designed and  saved as  a block  using the  !Save!
  3855.      option  in the block menu.
  3856.  
  3857.      The procedure to define a  subscreen is as follows. Type  in
  3858.      some temporary and  unique  screen name into the editor  and
  3859.      press <F10> to select the screen  type. The screen can  then
  3860.      be designed as normal. When the design has been   completed,
  3861.  
  3862.  
  3863.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3864.            - Main Manual.                    Page: 68 -
  3865.  
  3866.  
  3867.      the area of  the subscreen can  be marked  out and saved  to
  3868.      disk as   the appropriate screen  type. As  this point,  the
  3869.      screen designer can be   terminated and control returned  to
  3870.      the editor. Since the screen  was not saved,  the line  will
  3871.      have reverted to  being a rule  which can  then be  deleted,
  3872.      since  it  was only  temporary anyway.  The subscreen  saved
  3873.      from within  the screen   designer  is  now present  in  the
  3874.      screen list  and  can  be inserted  into  the    application
  3875.      listing as a  normal screen. To force  the screen type,  the
  3876.      screen   designer will  have to  be re-entered  by  pressing
  3877.      <F10> on the screen name  and  by selecting the  appropriate
  3878.      screen type.
  3879.  
  3880.      If  changes  are  made  within  the  screen  designer  to  a
  3881.      previously defined  subscreen, then  upon exit or saving  of
  3882.      the screen, the screen designer  will  ask if the screen  is
  3883.      to be saved at its previous size or at full screen size.
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.  
  3906.  
  3907.  
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.  
  3914.  
  3915.  
  3916.  
  3917.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3918.            - Main Manual.                    Page: 69 -
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.                               Chapter 6
  3928.  
  3929.                       Using the Screen Designer
  3930.  
  3931.  
  3932.      6.1  Starting the Screen Designer
  3933.  
  3934.  
  3935.      The screen designer is fully integrated into the editor  and
  3936.      can be accessed through the <F10> key.
  3937.  
  3938.      Before you  can  enter  the screen  designer  and  create  a
  3939.      screen, you must supply a screen name for the screen so that
  3940.      it can be entered into the screen file on disk immediately.
  3941.  
  3942.      Once a new  screen name has  been entered,  the screen  type
  3943.      must be defined using the  screen type menu on <F10>.   This
  3944.      is a five  item pop-up menu which  lists the five  different
  3945.      screen types.  The  items are listed in  the order in  which
  3946.      they are most commonly used.
  3947.  
  3948.                               ┌───────────┐
  3949.                               │ Dialog    │
  3950.                               │ Menu      │
  3951.                               │ Print     │
  3952.                               │ Help      │
  3953.                               │ Display   │
  3954.                               └───────────┘
  3955.  
  3956.      The screen type  is selected in the  normal manner by  using
  3957.      the up and down arrow keys and pressing <Enter>.
  3958.  
  3959.      When a  screen  has  been  saved  and  the  screen  designer
  3960.      terminated, the normal editor  screen will reappear and  the
  3961.      screen name previously entered will be prefixed with one  of
  3962.      the five screen modifiers as described above.  The action of
  3963.      the <F10> key is slightly  different when applied to a  line
  3964.      containing the name of a  screen and the type of the  screen
  3965.      as reported by the line's modifier.  In this situation,  the
  3966.      screen designer is activated directly without going  through
  3967.      the screen type  menu.   In order to  change the  type of  a
  3968.      screen (for  example  from  a  display  screen  to  a  print
  3969.  
  3970.  
  3971.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  3972.            - Main Manual.                    Page: 70 -
  3973.  
  3974.  
  3975.      screen), you  must enter  the name  of  the screen  with  no
  3976.      modifier and then press <F10>.
  3977.  
  3978.      Once the line modifier has been entered, the screen designer
  3979.      can be reactivated  by pressing  <Tab> on  the screen  name,
  3980.      since the editor knows that this line refers to a screen and
  3981.      not a rule.
  3982.  
  3983.      If the menu  screen type has been  selected from the  screen
  3984.      type menu, a dialog box will be displayed prompting for  the
  3985.      menu  variable  (which  can  be  any  proper  RExL   LValue)
  3986.      associated with that screen.   As explained above, when  the
  3987.      menu screen terminates, the  screen's menu variable will  be
  3988.      set to the field number of the field which was current  when
  3989.      <Enter> was  pressed.    When the  menu  variable  has  been
  3990.      entered, the screen designer will start.
  3991.  
  3992.      When the screen designer is entered for the first time,  the
  3993.      screen will be  filled with the  half-tone character  (ASCII
  3994.      177) colored in light gray on a black background (unless the
  3995.      `Print' screen type was selected,  in which case the  screen
  3996.      will be blank).  The the cursor will be in the top left hand
  3997.      corner of the  screen and screen designer  is now ready  for
  3998.      input.  If  there is a default  screen defined (through  the
  3999.      Edit|Default screen menu  option) then the  contents of  the
  4000.      screen will be loaded automatically.
  4001.  
  4002.      If the screen designer is started with a previously  defined
  4003.      screen, the screen designer  will remove fields which  would
  4004.      be invalid in the newly chosen screen type.  For example, if
  4005.      a screen which  was previously of type  `Menu', and it  were
  4006.      then opened as a `Dialog' screen, then the menu variable and
  4007.      the menu fields  would be stripped  from the  screen.   This
  4008.      feature should be  borne in mind  when saving  screens.   In
  4009.      general, cross-type screen
  4010.      translation should be avoided for this reason.
  4011.  
  4012.  
  4013.      6.2  Basic Design
  4014.  
  4015.  
  4016.      The cursor  is  moved  in  the  screen  designer  using  the
  4017.      standard arrow keys  <Up>, <Down>, <Left>  and <Right>.   In
  4018.      addition to these keys are the following:
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4026.            - Main Manual.                    Page: 71 -
  4027.  
  4028.  
  4029.                 Table 6.1: Screen Designer Cursor Keys
  4030.  
  4031.      Key            Moves cursor
  4032.      <Home>         to start of line
  4033.      <End>          to end of line
  4034.      <PgUp>         to top of screen
  4035.      <PgDn>         to bottom of screen
  4036.      <Ctrl-Left>    left one word
  4037.      <Ctrl-Right>   right one word
  4038.      <Ctrl-Home>    to top of screen
  4039.      <Ctrl-End>     to bottom of screen
  4040.      <Ctrl-PgUp>    to top left hand corner of screen
  4041.      <Ctrl-PgDn>    to bottom right hand corner of screen
  4042.      <Tab>          right ten characters
  4043.      <Shift-Tab>    left ten characters
  4044.      <Enter>        to beginning of line
  4045.  
  4046.      The action of the <Enter> key is slightly more complex  than
  4047.      simply moving to the start of the next line:  If there is  a
  4048.      box character on the next line underneath and to the left of
  4049.      the cursor, then the cursor will be placed on the right hand
  4050.      side of the box character.   This behaviour makes it  easier
  4051.      to enter text in boxes on the screen.
  4052.  
  4053.  
  4054.      6.3  Fields in the Screen Designer
  4055.  
  4056.  
  4057.      The screen designer supports the use of six different  types
  4058.      of fields as explained in the previous chapter.  In general,
  4059.      a field definition can be  initiated by pressing <Ctrl>  and
  4060.      the initial  letter of  the field  type  which you  wish  to
  4061.      define (for example output fields are attached to <Ctrl-O>).
  4062.      A field definition menu is attached to <Ctrl-F>, from  where
  4063.      you can  select  the field  type  to  define, if  you  can't
  4064.      remember the different field types.
  4065.  
  4066.      When defining a field, the area marked out on the screen  is
  4067.      painted  in  `reverse'  colors  to  hilite  it  against  the
  4068.      background.    The  location  on  screen  where  the   field
  4069.      definition was  initiated acts  as an  `anchor' point  which
  4070.      remains fixed  while the  field is  defined. Initially,  the
  4071.      cursor is placed on the anchor point and can be moved  about
  4072.      the screen using the arrow  keys plus the four other  cursor
  4073.      keys <Home>, <End>, <PgUp> and  <PgDn>.  <Enter> is used  to
  4074.      terminate the field definition.
  4075.  
  4076.  
  4077.  
  4078.  
  4079.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4080.            - Main Manual.                    Page: 72 -
  4081.  
  4082.  
  4083.      The menu  field is  the  only field  type  which can  be  of
  4084.      arbitrary size so in all  other field type definitions,  the
  4085.      movements of  the  cursor  are  limited  to  avoid  creating
  4086.      improper fields.  The following table lists the valid  sizes
  4087.      of fields:
  4088.  
  4089.                      Table 6.2: Valid Field Sizes
  4090.  
  4091.                Vertical Movement        Horizontal Movement
  4092.      Output    Fixed height of one      Yes
  4093.      Input     Fixed height of one      Yes
  4094.      Toggle    Yes                      Fixed width of 3
  4095.      Check     Fixed height of one      Fixed width of 3
  4096.      Radio     Yes                      Fixed width of 3
  4097.      Menu      Yes                      Yes
  4098.  
  4099.      When the field  has been defined, a  dialog box will  appear
  4100.      (not applicable to  menu fields) into  which the  expression
  4101.      associated with that field is entered. While in this  dialog
  4102.      box, you are free  to use the scrap  buffer as normal,  even
  4103.      though it  is  not displayed.    The function  and  variable
  4104.      dictionaries are also available.
  4105.  
  4106.      Every field on the screen has a field number associated with
  4107.      it.  This number codes for the order in which the fields are
  4108.      to be  evaluated  when the  screen  is  run by  the  runtime
  4109.      module.   The fields  are numbered  sequentially from  zero,
  4110.      increasing moving to  the right  and then  down the  screen.
  4111.      This behaviour is  compatible with the  IBM- and  MicroSoft-
  4112.      defined CUA standard for user interfaces.  Whenever a  field
  4113.      is created, moved or deleted, the screen sequencing  numbers
  4114.      are recalculated, this  may cause delays of  the order of  a
  4115.      half a second or  so on XT-class machines.   In the  current
  4116.      release, there is  no way to alter  the sequencing order  of
  4117.      fields in the screen.
  4118.  
  4119.      In any one  screen there may  be up to  128 fields.   Beyond
  4120.      this limit, the amount of  time required for processing  the
  4121.      fields becomes noticeable.  It should also be noted that any
  4122.      screen which uses more than 128 fields will be cluttered and
  4123.      should be redesigned to use less fields.
  4124.  
  4125.      The methods for entering the various fields are presented in
  4126.      the next six sections.
  4127.  
  4128.  
  4129.  
  4130.  
  4131.  
  4132.  
  4133.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4134.            - Main Manual.                    Page: 73 -
  4135.  
  4136.  
  4137.      6.3.0.1  Output
  4138.  
  4139.      <Ctrl-O> is used  to define an  output field. Output  fields
  4140.      can be  up  to eighty  characters  wide,  the width  of  the
  4141.      screen, and are  one character in  height.  Only  horizontal
  4142.      movement is permitted while defining an output field.
  4143.  
  4144.      When the field has been marked out, a dialog box will appear
  4145.      prompting for an output expression.   This can be any  valid
  4146.      RExL expression  and it  will be  syntax checked  before  it
  4147.      being accepted by the designer.  When a valid expression has
  4148.      been entered, the  marked area  will be  replaced with  hash
  4149.      symbols, #, to denote an output field.
  4150.  
  4151.      6.3.0.2  Input
  4152.  
  4153.      <Ctrl-I> is used to define an input field.  Input fields can
  4154.      be up to  eighty characters wide  and are  one character  in
  4155.      height.   The input  expression must  be a  properly  formed
  4156.      LValue.  As with output  expressions, the designer will  not
  4157.      accept an improper expression.  Input fields are denoted  by
  4158.      question marks, ?.
  4159.  
  4160.      6.3.0.3  Toggle
  4161.  
  4162.      <Ctrl-T> is used to define a toggle field.  These fields can
  4163.      be between  seventy  seven  characters  and  six  characters
  4164.      (inclusive) in width and are  one character in height.   The
  4165.      toggle expression must be a proper LValue.
  4166.  
  4167.      You can have up to one hundred choices occupying up to  four
  4168.      thousand characters  of  storage  in  an  individual  toggle
  4169.      choice field.  When the  field has been defined, two  dialog
  4170.      boxes will appear, the upper one for the toggle list  LValue
  4171.      and the lower for the list of choices. A field LValue, which
  4172.      can be either string or numeric, must be entered before  the
  4173.      individual choices can be.  As before, you are not permitted
  4174.      to enter  an invalid  LValue.   When  a valid  one has  been
  4175.      entered, the cursor  will move to  the second box,  labelled
  4176.      Choices.
  4177.  
  4178.      The second box will be of the same width as the toggle  list
  4179.      field, so that strings which would not fit in the field  are
  4180.      not allowed.  The strings are entered in the order in  which
  4181.      they are to appear  in the field when  it is activated.   An
  4182.      individual toggle  list  item  can be  deleted  by  pressing
  4183.      <Alt-D> or  <Ctrl-Y>.    The list  entry  is  terminated  by
  4184.      pressing <Enter> on an  empty list item and  it is for  this
  4185.  
  4186.  
  4187.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4188.            - Main Manual.                    Page: 74 -
  4189.  
  4190.  
  4191.      reason that empty  toggle list items are  not allowed.   The
  4192.      cursor can be toggled between the two windows by using <Tab>
  4193.      and <Shift-Tab>.
  4194.  
  4195.      When the field  has been defined,  the marked  area will  be
  4196.      replaced by a series of piping symbols, |.
  4197.  
  4198.      6.3.0.4  Check
  4199.  
  4200.      }<Ctrl-C> is used to define  a check box field.  Since  this
  4201.      field can have only one size of three characters wide by one
  4202.      high,  the  LValue  dialog   box  will  appear   immediately
  4203.      prompting for  an  LValue  which may  be  either  string  or
  4204.      numeric in type.
  4205.  
  4206.      When the  LValue has  been entered,  the marked  are on  the
  4207.      screen will  be  displayed  as  a  set  of  square  brackets
  4208.      separated by a tick, [√].
  4209.  
  4210.      6.3.0.5  Radio
  4211.  
  4212.      <Ctrl-R> is used  to define an  radio button  field.   Radio
  4213.      button fields have fixed widths of three characters but  may
  4214.      be as  high as  twenty-five characters,  the height  of  the
  4215.      screen.
  4216.  
  4217.      The radio button LValue must be a numeric expression and not
  4218.      a string expression.  When  the field has been defined,  the
  4219.      marked area will be replaced by a vertical block of sets  of
  4220.      parentheses separated by the center dot character.
  4221.  
  4222.      6.3.0.6  Menu
  4223.  
  4224.      <Ctrl-M> is used to define a menu field and can only be used
  4225.      in menu screens.  Menu fields can be  of arbitrary size  and
  4226.      may be nested  within one  another, unlike  all other  field
  4227.      types.
  4228.  
  4229.      Since, in menu screens, the menu expression is entered  when
  4230.      the screen itself is entered  and is therefore constant  for
  4231.      all  fields,  there  is   no  menu  expression  dialog   box
  4232.      associated with menu fields.   So, when the menu area  block
  4233.      mark has been terminated  by pressing <Enter>, the  vertical
  4234.      edges of the  block will be marked  with piping symbols,  |,
  4235.      and  control  will  return  to  the  main  screen   designer
  4236.      directly.
  4237.  
  4238.  
  4239.  
  4240.  
  4241.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4242.            - Main Manual.                    Page: 75 -
  4243.  
  4244.  
  4245.      6.4  Block Operations
  4246.  
  4247.  
  4248.      Blocks are  rectangular areas  of the  screen which  can  be
  4249.      defined and then  used for various operations.   A block  is
  4250.      marked by pressing <Alt-M> and then moving the cursor in the
  4251.      same manner as that used during field definition. For  those
  4252.      more familiar with  Sidekick and  the Borland-type  editors,
  4253.      the keys <F7> and  <F8> may be used  to start and end  block
  4254.      definition.  When a block has been defined, the block  menu,
  4255.      which contains nine items, will appear in the top left  hand
  4256.      corner of the screen (unless it has been moved).
  4257.  
  4258.      There are nine separate operations selectable from the block
  4259.      menu which may  be carried out on  marked blocks, and  these
  4260.      are covered  in the  next nine  sections. Note  that if  the
  4261.      block contains a portion of a field, then certain operations
  4262.      are not  allowed  since  they would  have  no  meaning  when
  4263.      applied in  those  circumstances  (for example,  moving  and
  4264.      copying portions of a field).  If these are attempted,  then
  4265.      the screen designer will display an error to the effect that
  4266.      the area crosses fields.
  4267.  
  4268.      Once a  block  has been  defined  and some  block  operation
  4269.      carried out  upon  it,  it  may  be  re-marked  for  further
  4270.      operations by pressing <Alt-R>.   Typically, this is  useful
  4271.      when a box has been drawn which then needs to be painted.
  4272.  
  4273.      6.4.1  Block Painting
  4274.  
  4275.      This option is  used for  setting the  foreground (ink)  and
  4276.      background (paper) colors of the  defined block.  When  this
  4277.      option is selected, the following paint box appears:
  4278.  
  4279.      [Figure missing in disk manual]
  4280.  
  4281.      The color of  the foreground is altered  using the <Up>  and
  4282.      <Down> keys and is tracked in the left pane of the paint box
  4283.      window by a  gray square.  The  background color tracked  in
  4284.      the right hand  pane with two center  dot characters and  is
  4285.      changed with the <PgUp> and <PgDn> keys.
  4286.  
  4287.      The row of  `x' characters at  the bottom  of the paint  box
  4288.      display the combined foreground  and background colors.   On
  4289.      the EGA, VGA and most  CGA systems, the screen designer  can
  4290.      make use of the flash-intensity bit.  This allows the use of
  4291.      sixteen background colors instead  of eight, at the  expense
  4292.      of flashing. This bit can be toggled on and off by  pressing
  4293.  
  4294.  
  4295.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4296.            - Main Manual.                    Page: 76 -
  4297.  
  4298.  
  4299.      <Alt-T>.   If the  system which  the  editor is  running  on
  4300.      supports this feature,  then the lower  eight colors in  the
  4301.      right hand  pane will  be `brightened'.  These can  then  be
  4302.      selected in the same  manner as ordinary background  colors.
  4303.      Note, however, that some early  CGA adapters do not  support
  4304.      this, with the result that  what should have been  displayed
  4305.      in intense background will in fact be displayed as flashing.
  4306.      The <Alt-T> keystroke can be used anywhere within the screen
  4307.      designer and is not limited to the paint box.
  4308.  
  4309.      If the block area being painted covers a field or part of  a
  4310.      field, then the attributes of  the field will be updated  to
  4311.      the new colors. As with  all windows in RExL, the paint  box
  4312.      can be  moved  by  pressing the  <Scroll-Lock>  key,  if  it
  4313.      obscuring something.
  4314.  
  4315.      When the desired  combination of  foreground and  background
  4316.      colors has been  reached, <Enter> will  terminate the  paint
  4317.      and make the colors permanent.
  4318.  
  4319.      6.4.2  Align
  4320.  
  4321.      When the align option is  selected, the marked area will  be
  4322.      moved from its old location and placed at the horizontal and
  4323.      vertical center of  the screen from  where it  can be  moved
  4324.      using the normal arrow keys. Pressing <Enter> will make  the
  4325.      alteration permanent.
  4326.  
  4327.      In all cases  where blocks are  moved from  one location  to
  4328.      another in the screen designer, the attributes of the screen
  4329.      underneath the  original block  are left  untouched and  are
  4330.      copied, along  with  the  character information  inside  the
  4331.      block, to the new location for the block.
  4332.  
  4333.      It is not possible to align blocks which contain portions of
  4334.      a field.
  4335.  
  4336.      6.4.3  Box
  4337.  
  4338.      The box option is used to draw boxes around the marked  area
  4339.      on screen.  On selection, the following box menu appears:
  4340.  
  4341.      [Figure not included in disk manual]
  4342.  
  4343.      The first option in the  menu selects whether the box is  to
  4344.      overwrite the  contents of  the box  (but leave  the  fields
  4345.      inside intact) or whether the box is to overlaid around  the
  4346.      edge of the area leaving the interior untouched. The  option
  4347.  
  4348.  
  4349.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4350.            - Main Manual.                    Page: 77 -
  4351.  
  4352.  
  4353.      can be toggled by  pressing <Enter> on it.   If the  overlay
  4354.      option is selected, then, if possible, the box will link  up
  4355.      with any boxes which impinge upon the marked area.
  4356.  
  4357.      To draw a box of a particular type, hilite a suitable border
  4358.      type and  press <Enter>.   The  box  will then  be drawn  on
  4359.      screen.  If the  screen is destined for  use with a  printer
  4360.      (such as a  print screen), then,  unless all printers  which
  4361.      may be used with the system support them, the first five box
  4362.      edge types  should  not  be  selected,  since  few  printers
  4363.      support the line draw characters in their native mode.
  4364.  
  4365.      When defining  a  block for  use  with  this option,  it  is
  4366.      permissible to include portions of a field within the block,
  4367.      although those parts of the  box which would cut the  fields
  4368.      are removed.
  4369.  
  4370.      Alternatively, boxes  can be  drawn  directly by  using  the
  4371.      <Alt-B> keystroke.   When  this  keystroke is  pressed,  the
  4372.      screen designer again enters  its block-define mode and  the
  4373.      extent of the box is drawn on the screen.  When the  desired
  4374.      box has been drawn, it is selected using <Enter> and the box
  4375.      type selection menu appears as before.
  4376.  
  4377.      6.4.4  Delete
  4378.  
  4379.      The delete option is used to delete a marked block.  As with
  4380.      the align and move options, the attributes of the originally
  4381.      marked area remain unaltered after the operation.
  4382.  
  4383.      Any fields which are fully within the block are also deleted
  4384.      and the remaining fields are re-sequenced to take account of
  4385.      the new field layout.
  4386.  
  4387.      While the  block is  being marked,  the <Alt-D>,  <Del>  and
  4388.      <Ctrl-Y>  keystrokes  may  be  used  to  delete  the   block
  4389.      immediately, without having to go through the block menu.
  4390.  
  4391.      6.4.5  Move
  4392.  
  4393.      The move option is used to move a marked block.  The  marked
  4394.      area cannot  cross any  fields since  attempting to  move  a
  4395.      portion of a fields has no meaning. When the option has been
  4396.      selected, the cursor will disappear and the screen  designer
  4397.      enters its block move mode.
  4398.  
  4399.      The block may  be moved using the  <Up>, <Down>, <Left>  and
  4400.      <Right> keys. Pressing <Enter> will terminate the move.
  4401.  
  4402.  
  4403.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4404.            - Main Manual.                    Page: 78 -
  4405.  
  4406.  
  4407.      If the area  where the block  is to  be placed contains  any
  4408.      fields, then  the  fields  will be  deleted  and  the  field
  4409.      sequence will  be  regenerated.   If  the area  crosses  any
  4410.      fields, then the move will be terminated with an error.
  4411.  
  4412.      When the block has  been placed successfully, the  character
  4413.      information is removed  from the old  location of the  block
  4414.      while the attributes are left as they are.
  4415.  
  4416.      6.4.6  Copy
  4417.  
  4418.      The copy  option  is  substantially the  same  as  the  move
  4419.      operation above, with  the single difference  that when  the
  4420.      destination is selected, the contents of the original  block
  4421.      are left  unchanged  and  new  fields  are  created  in  the
  4422.      destination.
  4423.  
  4424.      If there are a  large number of fields  on the screen,  then
  4425.      care should be  taken that the  limit of  128 fields is  not
  4426.      reached while copying  blocks.  If  it is  reached, then  an
  4427.      error  to  this  effect  will  be  displayed  and  the  copy
  4428.      terminated with the fields remaining to be copied being left
  4429.      uncopied.
  4430.  
  4431.      6.4.7  Fill
  4432.  
  4433.      The fill option in the block menu is used to fill a  defined
  4434.      area with  a  particular  character.   When  the  option  is
  4435.      selected, the character  fill selection box  appears on  the
  4436.      screen, again, in  the top left  hand corner  of the  screen
  4437.      unless it has been specifically moved.
  4438.  
  4439.      [Figure not included in disk manual]
  4440.  
  4441.      The character  to fill  the block  is  hilited in  the  fill
  4442.      selection box in yellow foreground on a magenta  background.
  4443.      The normal arrow  keys are used  to move  the selection  bar
  4444.      around the list  while <PgUp> and  <PgDn> are  used to  move
  4445.      from one group  of 64 characters  to the  previous and  next
  4446.      pages respectively.
  4447.  
  4448.      <Enter> is used to select the character to fill the  defined
  4449.      block with.   If the block contains  any fields, then  these
  4450.      will be redrawn  when the fill operation  is finished.   The
  4451.      foreground and  background  colors  are  left  unchanged  by
  4452.      filling the block.
  4453.  
  4454.  
  4455.  
  4456.  
  4457.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4458.            - Main Manual.                    Page: 79 -
  4459.  
  4460.  
  4461.      6.4.8  Save
  4462.  
  4463.      This option is  used to  save a  block to  the screen  file.
  4464.      This feature is  mainly used for  creating pop-up menu  type
  4465.      displays.
  4466.  
  4467.      When this  option is  selected, a  dialog box  will  appear,
  4468.      prompting for a name under  which to store the block in  the
  4469.      screen file.   When  a name  has  been entered,  the  screen
  4470.      designer checks to  see if that name  already exists in  the
  4471.      screen file.  If the name is unique, then the block is saved
  4472.      immediately, otherwise, a  yes/no menu  will appear,  asking
  4473.      whether  the  previous  version  of  the  screen  should  be
  4474.      overwritten with the  new one.   Selecting the `yes'  option
  4475.      from this menu will cause the marked block to be written  to
  4476.      the screen file in place of the old one.
  4477.  
  4478.      Once the screen has been saved, it can be read and  modified
  4479.      like any other full sized screen.
  4480.  
  4481.      Detailed information on the use  of small screen blocks  can
  4482.      be found in  the section on sub-screens  further on in  this
  4483.      chapter.
  4484.  
  4485.      6.4.9  Under shadow
  4486.  
  4487.      The final  option in  the block  menu  is used  for  drawing
  4488.      `shadows' which  appear `underneath'  marked blocks  on  the
  4489.      screen.  This option is most commonly used for hiliting some
  4490.      important information in a box  on the screen by making  the
  4491.      box stand out against the background.
  4492.  
  4493.      The undershadow effect is achieved  by painting the area  to
  4494.      the right of  and below  the marked  block in  a light  gray
  4495.      foreground color  on a  black background.   The  undershadow
  4496.      effect works  best  when  applied on  a  bright  background.
  4497.      Overuse of this effect should be avoided since it loses  its
  4498.      emphasis easily.
  4499.  
  4500.  
  4501.      6.5  Sub-screens
  4502.  
  4503.  
  4504.      Sub-screens are created  using the save  block procedure  as
  4505.      described in the previous section.  They are mainly used for
  4506.      creating pop-up menus and other types of pop-up queries.
  4507.  
  4508.  
  4509.  
  4510.  
  4511.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4512.            - Main Manual.                    Page: 80 -
  4513.  
  4514.  
  4515.      The easiest  method  to create  a  pop-up sub-screen  is  as
  4516.      follows: Enter the screen designer  at the screen where  the
  4517.      pop-up will appear and create the pop-up, mark the area  and
  4518.      then save it as a block.  Exit from the screen designer, but
  4519.      do not save the parent screen permanently when requested to.
  4520.      Return to the location in the listing where this pop-up will
  4521.      be used and then call it as a normal screen.
  4522.  
  4523.      When the runtime module runs  the saved block of screen,  it
  4524.      will only load that portion, leaving the rest of the  screen
  4525.      as it was  before the screen was  called, thus creating  the
  4526.      effect of a pop-up screen.
  4527.  
  4528.      The screen designer treats sub-screens in almost exactly the
  4529.      same  manner  as   normal  full-sized   screens,  the   only
  4530.      differences being as  follows.  Firstly,  upon entering  the
  4531.      screen designer with  a sub-screen, the  sub-screen will  be
  4532.      loaded at  the same  co-ordinates on  the screen  as it  was
  4533.      saved from, while  the rest of  the screen  will be  painted
  4534.      with the normal background half-tone character.
  4535.  
  4536.      Secondly, when exiting from the screen designer, instead  of
  4537.      the normal `Do you  want to save the  screen ?' prompt,  the
  4538.      prompt `Screen  was  originally  smaller.   Save  as:'  will
  4539.      appear.  This menu has  three options in it: Original  area,
  4540.      Full screen, and  Return to editor.   The first option  will
  4541.      save the original screen block to disk, the second saves the
  4542.      entire screen to disk in  place of the original  sub-screen,
  4543.      while the final  option quits the  screen designer  entirely
  4544.      and return control to the editor without saving the screen.
  4545.  
  4546.      A minor  point to  note is  that  attempting to  print  sub-
  4547.      screens will  not produce  the expected  results, since  the
  4548.      rest of the  screen currently  on display  will be  included
  4549.      with the output.
  4550.  
  4551.  
  4552.      6.6  Field control menu
  4553.  
  4554.  
  4555.      <Ctrl-F> has two uses in  the screen designer, which one  is
  4556.      used depends on whether the  cursor is over a field or  not.
  4557.      When the cursor is placed on a field, <Ctrl-F> will bring up
  4558.      the field  modification  menu,  described in  this  section.
  4559.      When the cursor is not over a field, then <Ctrl-F> will  pop
  4560.      up the field  type definition  menu, described  in the  next
  4561.      section, listing the six field  types from which one can  be
  4562.      chosen.
  4563.  
  4564.  
  4565.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4566.            - Main Manual.                    Page: 81 -
  4567.  
  4568.  
  4569.      The field control menu, popped up by a keystroke of <Ctrl-F>
  4570.      while  the  cursor  is   hiliting  a  field,  controls   the
  4571.      properties attached to that field.   The field control  menu
  4572.      is slightly different for each field type on account of  the
  4573.      differing requirements for each.   In total, there are  nine
  4574.      properties  which  may  be  attached  to  each  of  the  six
  4575.      different field types as indicated as follows:
  4576.  
  4577.                   Table 6.3: Valid Field Attributes
  4578.  
  4579.                     Input     Output    Toggle    Check     Radio     Menu
  4580.      Active color   Yes       Yes       Yes       Yes       Yes       Yes
  4581.      Inactive color Yes                 Yes       Yes       Yes       Yes
  4582.      Delete         Yes       Yes       Yes       Yes       Yes       Yes
  4583.      Expression     Yes       Yes       Yes       Yes       Yes
  4584.      Recalc         Yes       Yes       Yes       Yes       Yes
  4585.      Justify        Yes       Yes       Yes
  4586.      Width          Yes       Yes       Yes                           Yes
  4587.      Necessary      Yes
  4588.      Precision      Yes       Yes
  4589.      Validate       Yes
  4590.  
  4591.      The field control menu for a particular field type  consists
  4592.      of the  options ticked  in the  table above  underneath  the
  4593.      fields.  The next nine subsections give the meanings of  the
  4594.      items in the field control menu:
  4595.  
  4596.      6.6.0.1  Active color
  4597.  
  4598.      The active color of a  field is the attribute which is  used
  4599.      to color the contents of a field when that field is  active.
  4600.      All fields, except output fields, have active colors.
  4601.  
  4602.      When this option is chosen from the menu, the standard paint
  4603.      box appears and  the field  attribute can  be selected  from
  4604.      this.
  4605.  
  4606.      6.6.0.2  Inactive color
  4607.  
  4608.      The inactive color of a field is the attribute which is used
  4609.      to color  the  contents  of  a  field  when  that  field  is
  4610.      inactive.  All fields, including output fields, have  active
  4611.      colors.
  4612.  
  4613.      When this option is chosen from the menu, the standard paint
  4614.      box appears and  the field  attribute can  be selected  from
  4615.      this.
  4616.  
  4617.  
  4618.  
  4619.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4620.            - Main Manual.                    Page: 82 -
  4621.  
  4622.  
  4623.      6.6.0.3  Delete
  4624.  
  4625.      This option will  delete the hilited  field from the  screen
  4626.      and perform a screen  field resequencing.  Pressing  <Alt-D>
  4627.      while hiliting a field in  the screen designer has the  same
  4628.      effect as choosing this option.
  4629.  
  4630.      6.6.0.4  Expression
  4631.  
  4632.      The expression attached to a  field can be edited when  this
  4633.      option is selected.   The  edited field  expression will  be
  4634.      checked for  correct syntax  before it  can be  accepted  by
  4635.      RExL.  When  the cursor is  hiliting a  field, <F10> can  be
  4636.      used as a shortcut keystroke for this function, while  <Alt-
  4637.      F> will simply display the field expression on the bottom of
  4638.      the screen.
  4639.  
  4640.      For toggle fields, the choices may also be altered.
  4641.  
  4642.      6.6.0.5  Recalc
  4643.  
  4644.      Under  normal   circumstances,  the   runtime  module   will
  4645.      automatically recalculate all  fields in  a screen  whenever
  4646.      the contents of one field are modified.  If there are  large
  4647.      number of fields in the screen, then this may slow down  the
  4648.      operation of the  screen designer. Toggling  this option  on
  4649.      and off will enable and disable the automatic  recalculation
  4650.      of the hilited field.
  4651.  
  4652.      6.6.0.6  Justify
  4653.  
  4654.      Normally, the contents  of fields are  left justified,  that
  4655.      is, placed flush  against the left  hand end  of the  field.
  4656.      This option can be used as a toggle to toggle the  placement
  4657.      between the left and right ends of fields.
  4658.  
  4659.      Note that during numeric input  in input fields, the  number
  4660.      is always justified  right.  When input  is finished in  the
  4661.      field, the result  will be  justified as  specified by  this
  4662.      flag.
  4663.  
  4664.      6.6.0.7  Width
  4665.  
  4666.      The width of a field can be altered using this option.  When
  4667.      it is selected,  a block will  appear of  the same size  and
  4668.      shape of the field.   This can then  be changed in the  same
  4669.      manner as ordinary block definition.
  4670.  
  4671.  
  4672.  
  4673.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4674.            - Main Manual.                    Page: 83 -
  4675.  
  4676.  
  4677.      When a suitable  size has been chosen  and <Enter> has  been
  4678.      pressed, the screen designer will  check to ensure that  the
  4679.      new field does not cross any earlier fields.
  4680.  
  4681.      6.6.0.8  Necessary
  4682.  
  4683.      String and  numeric  input fields  my  be defined  as  being
  4684.      `necessary' for the  proper completion  of the  screen.   If
  4685.      this flag  has been  set, then  a  zero value,  for  numeric
  4686.      fields, and an empty string  value, for string fields,  will
  4687.      not be  allowed as  valid input.   The  runtime module  will
  4688.      hilite the unfinished  field in red,  fill it  with X's  and
  4689.      post an error message on the bottom of the screen and return
  4690.      the end-user to the field.
  4691.  
  4692.      6.6.0.9  Precision
  4693.  
  4694.      Numeric input and output fields can have an optional decimal
  4695.      precision supplied.   This  will be  the number  of  decimal
  4696.      places to  be displayed  or input  when the  runtime  module
  4697.      processes the field.
  4698.  
  4699.      6.6.0.10  Validation
  4700.  
  4701.      Numeric and string input fields may be validated as date and
  4702.      time strings by toggling the validation type between `None',
  4703.      `Date' and `Time'.   If the  user enters  a string, then  it
  4704.      will be checked for validity  by the runtime module. If  the
  4705.      string is  found  to be  invalid,  then execution  will  not
  4706.      proceed until a valid string is entered.  The format checked
  4707.      will be the format current  on your machine, or that set  up
  4708.      by a call to the DTformat() command.
  4709.  
  4710.      Note that the null  date string, "00/00/0000" is  considered
  4711.      to be a valid date.   If you want  to filter out this  date,
  4712.      then you should set the `necessary' flag.
  4713.  
  4714.  
  4715.      6.7  Miscellaneous Functions
  4716.  
  4717.  
  4718.      6.7.0.1  Changing Field Types
  4719.  
  4720.      The <Ctrl-> key combinations noted above for defining fields
  4721.      also have another use in  changing a field from one type  to
  4722.      another.  For example, pressing <Ctrl-O> when the cursor  is
  4723.      hiliting an input field will  change that input field to  an
  4724.      output field.  The exact procedure is as follows:  When  the
  4725.  
  4726.  
  4727.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4728.            - Main Manual.                    Page: 84 -
  4729.  
  4730.  
  4731.      <Ctrl-> key  combination  is  pressed, the  screen  designer
  4732.      looks to see if the cursor is placed over a field, if it is,
  4733.      then the  field type  is changed  to that  specified by  the
  4734.      keystroke and the  field definition routine  is called.  The
  4735.      width of the  field can  then be  changed. Pressing  <Enter>
  4736.      will terminate the width definition  and bring up the  field
  4737.      expression dialog box (or both of them if the new field is a
  4738.      toggle field).
  4739.  
  4740.      The field changing facility is  most useful when changing  a
  4741.      screenful of input fields to output fields.
  4742.  
  4743.      6.7.0.2  Field Utility Keys
  4744.  
  4745.      <F10> is used to edit a field expression, when the cursor is
  4746.      on a field. This function is placed on a special key of  its
  4747.      own, since it is used regularly.  If the cursor is not  over
  4748.      a field, then this key has no effect. The <Alt-F>  keystroke
  4749.      can be used  to display the  expression associated with  the
  4750.      cursor field.  When this  keystroke is used, the  expression
  4751.      is only displayed and cannot be modified.
  4752.  
  4753.      <Alt-D> is used to delete  the field underneath the  cursor.
  4754.      As with <F10>, this keystroke  has no effect if there is  no
  4755.      field underneath the cursor.
  4756.  
  4757.      The <Ctrl-S> keystroke is used to display the screen  status
  4758.      on the  bottom  line of  the  screen.   The  status  display
  4759.      contains four items of  information: Displayed from left  to
  4760.      right, these are the current cursor position in (x,y) format
  4761.      with (0,0) at the top left  hand corner.  The next two  sets
  4762.      of coordinates give the size of the currently defined  block
  4763.      (if no  block has  been defined,  then  the full  screen  is
  4764.      used).   The `Fields'  display gives  the number  of  fields
  4765.      defined in the  screen (the  second digit)  while the  first
  4766.      digit gives the sequence number of the field underneath  the
  4767.      cursor, or 0 if there  is no field there.   The type of  the
  4768.      hilited field is displayed  beside the sequence number.  The
  4769.      final display gives  the amount of free  memory left to  the
  4770.      screen designer. For proper operation, this figure should be
  4771.      above 10k.
  4772.  
  4773.      6.7.0.3  Line Drawing
  4774.  
  4775.      The line drawing feature of  the screen designer is used  to
  4776.      draw lines  on the  screen using  the IBM  ASCII  characters
  4777.      between 179 and 218 inclusive.  When <Alt-L> is pressed, the
  4778.      designer enters line draw mode and the cursor is backed by a
  4779.  
  4780.  
  4781.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4782.            - Main Manual.                    Page: 85 -
  4783.  
  4784.  
  4785.      `reverse' attribute  block to  emphasise the  fact that  the
  4786.      screen designer has changed mode.
  4787.  
  4788.      When <Alt-L> is pressed, the  line draw menu appears in  the
  4789.      top left hand corner of the screen:
  4790.  
  4791.      [Figure not included in disk manual]
  4792.  
  4793.      The first option  in the  menu toggles  between overlay  and
  4794.      overwrite modes (explained  below) while  the other  options
  4795.      specify the type of line to be drawn.
  4796.  
  4797.      The normal arrow keys and  <Space>, to move right, are  used
  4798.      to move the head of the line about the screen. When  drawing
  4799.      a line, the character underneath  the cursor is not  updated
  4800.      until the cursor is  moved.  This needs  to be done  because
  4801.      the exact character required  depends on the next  direction
  4802.      of travel of the cursor.
  4803.  
  4804.      The line draw mode can operate in one of three modes:
  4805.  
  4806.          o  Overwrite mode, where the  line being drawn does  not
  4807.             link up with any previous line on the screen.
  4808.  
  4809.          o  Overlay mode, where the line does link up with  lines
  4810.             already existing on  the screen.   Note that not  all
  4811.             combinations of line draw characters can be displayed
  4812.             using the ASCII  character set, in  these cases,  the
  4813.             current line  draw  type  will take  precedence  over
  4814.             older lines.
  4815.  
  4816.          o  Delete  mode,  where  the  character  underneath  the
  4817.             cursor is  deleted. This  option is  most useful  for
  4818.             deleting old lines from the screen.
  4819.  
  4820.      The  <Ins>  key  is  used  to  toggle  between  overlay  and
  4821.      overwrite modes,  with  the  cursor being  an  underline  in
  4822.      overlay mode and a half-box in overwrite mode. The <Del> key
  4823.      is used to toggle delete mode  on and off.  In delete  mode,
  4824.      the cursor is placed in the upper half of the character box.
  4825.  
  4826.      While the line is being  drawn, the shape of the line  being
  4827.      draw may be changed using the <Alt> key in combination  with
  4828.      the digits 1 to 4.
  4829.  
  4830.      The following table summarizes the keystrokes valid in  line
  4831.      draw mode:
  4832.  
  4833.  
  4834.  
  4835.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4836.            - Main Manual.                    Page: 86 -
  4837.  
  4838.  
  4839.                   Table 6.4: Keys in Line Draw Mode
  4840.  
  4841.      <Up>                Move up
  4842.      <Down>              Move down
  4843.      <Left>              Move left
  4844.      <Right>, <Space>    Move right
  4845.      <Enter>, <Esc>      Terminate line draw mode
  4846.      <Ins>               Toggle overlay and overwrite mode
  4847.      <Del>               Toggle delete mode
  4848.      <Alt-1>             Set horizontal line emphasis to one line
  4849.      <Alt-2>             Set horizontal line emphasis to two lines
  4850.      <Alt-3>             Set vertical line emphasis to one line
  4851.      <Alt-4>             Set vertical line emphasis to two lines
  4852.  
  4853.      6.7.0.4  Other Editing Keys
  4854.  
  4855.      <Ctrl-Y>, used to delete lines, has two functions.  When  it
  4856.      is first pressed,  it deletes all  characters and fields  to
  4857.      the left and right of  the cursor up to, but not  including,
  4858.      the  nearest  box  characters.    If  it  is  pressed  again
  4859.      immediately, then  the entire  screen line  will be  deleted
  4860.      from  the  left  edge  to  the  right  edge  and  the  lines
  4861.      underneath will be  pulled up by one  character.  Note  that
  4862.      <Ctrl-Y>  must  be  pressed  twice  in  succession  with  no
  4863.      intervening keystrokes for the entire line to be deleted.
  4864.  
  4865.      <Del> is used to delete the character underneath the cursor.
  4866.      All  characters  up  to  but  not  including  the  next  box
  4867.      character to  the  right of  the  cursor  will be  move  one
  4868.      character to  the left.   If  <Del>  is pressed  over a  box
  4869.      character then the box character itself will be deleted.
  4870.  
  4871.      <Backspace> deletes the character to the left of the  cursor
  4872.      and moves the cursor one  character to the left, moving  all
  4873.      characters to its right, up to but not including the nearest
  4874.      box character, one character left.
  4875.  
  4876.      6.7.0.5  Lists in the Screen Designer
  4877.  
  4878.      The  editor's  three  most  commonly  used  lists  are  also
  4879.      available in the  screen designer.   These are the  variable
  4880.      list on <Alt-V> and <Shift-F6>, the rule list on <Alt-Z> and
  4881.      <Shift-F2> and the  screen list on  <Alt-S> and  <Shift-F3>.
  4882.      The hotkey reference lists which  are available in the  main
  4883.      editor are not available when  these lists are requested  in
  4884.      the screen designer.
  4885.  
  4886.  
  4887.  
  4888.  
  4889.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4890.            - Main Manual.                    Page: 87 -
  4891.  
  4892.  
  4893.      6.7.0.6  Miscellaneous Keys
  4894.  
  4895.      The <F2> keystroke will save the screen to the screen  file.
  4896.      If the screen  was originally a  sub-screen and  not a  full
  4897.      sized  screen,  then  the  prompt  `Screen  was   originally
  4898.      smaller.  Save  as:' will appear with  a three option  menu,
  4899.      instead of the  normal `Do you  want to  save the screen  ?'
  4900.      prompt.  This  feature is explained in  the section on  sub-
  4901.      screens.
  4902.  
  4903.      <Alt-X> and <Esc> are used to exit from the screen  designer
  4904.      and to return to the main editor.  As before, if the  screen
  4905.      has been altered, then you'll be prompted to save it  before
  4906.      continuing.
  4907.  
  4908.      All keystrokes greater or equal  to the space character  and
  4909.      less than  or equal  to  an ASCII  code  of 255  are  placed
  4910.      directly onto the  screen.  If insert  mode is active,  then
  4911.      all characters to the right of the cursor will be moved  one
  4912.      character to the right,  with the rightmost character  being
  4913.      lost. If  insert  mode is  not  active, then  the  character
  4914.      underneath the cursor will be deleted.
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4944.            - Main Manual.                    Page: 88 -
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  4998.            - Main Manual.                    Page: 89 -
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.                               Chapter 7
  5008.  
  5009.                          The Runtime-Debugger
  5010.  
  5011.  
  5012.      7.1  Introduction
  5013.  
  5014.  
  5015.      This chapter covers  the functions and  capabilities of  the
  5016.      debugger module in depth (when  we refer to the debugger  in
  5017.      this chapter,  we  mean  the runtime-debugger  module  as  a
  5018.      whole).  The interface used in the debugger is much the same
  5019.      as that in  the editor, so you  shouldn't have much  trouble
  5020.      using it.  The debugger-specific keystrokes are largely  the
  5021.      same as those used by  the Borland integrated debuggers,  so
  5022.      if you  have used  those, then  a  quick read  through  this
  5023.      chapter should be sufficient.
  5024.  
  5025.  
  5026.      7.2  Debugger Basics
  5027.  
  5028.  
  5029.      The debugger  is  started  by typing  `rexlrd'  at  the  DOS
  5030.      prompt.  Contrary  to the  requirements of  the editor,  you
  5031.      must supply a file name on the command line. If you omit the
  5032.      file name,  then  a few  lines  of  command line  help  will
  5033.      appear. In the current release, there are three command line
  5034.      parameters which can be supplied to the debugger, these will
  5035.      be covered at the  end of the chapter.   Unlike the  editor,
  5036.      the debugger does not read or generate a configuration file.
  5037.  
  5038.      The debugger can run in either  of two modes:  The first  is
  5039.      run mode,  in  which  the application  is  executed  without
  5040.      stopping between rule  calls, statements and  screens.   The
  5041.      second mode is debug mode, in which the full screen debugger
  5042.      controls the execution of the system.  Debug mode is used if
  5043.      you select the option Debug application from the Run menu in
  5044.      the editor, or if you press <Alt-D> while the application is
  5045.      executing in run mode.
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5052.            - Main Manual.                    Page: 90 -
  5053.  
  5054.  
  5055.      There are a  few terms which you  need to understand  before
  5056.      you continue  with the  rest of  this  chapter.   These  are
  5057.      explained here:
  5058.  
  5059.          o  Step and Trace: An  application is stepped or  traced
  5060.             when the runtime portion of the module gains  control
  5061.             of the application and executes some portion of it.
  5062.  
  5063.          o  Watch: A watch is an expression, visible in the watch
  5064.             window  at  the  bottom  of  the  screen,  which   is
  5065.             evaluated every  time the  debugger module  is  given
  5066.             control of application execution.
  5067.  
  5068.      When you enter  debug mode, you will  be presented with  the
  5069.      main debugger screen (note that you can't have all the menus
  5070.      pulled down at once, as they are here!  The dots and  arrows
  5071.      indicate where the menu is normally displayed):
  5072.  
  5073.      [Figure not included in disk manual]
  5074.  
  5075.      The bar at the top of  the screen has four pull down  menus.
  5076.      In the same manner as the editor, these can be activated  by
  5077.      pressing the left and right  arrow keys to move from one  to
  5078.      the next, and pressing the  enter key to select the  hilited
  5079.      menu.  Press  <Esc> to return  to the  code window from  the
  5080.      menus.
  5081.  
  5082.      To the right  of the four  menu titles, is  the name of  the
  5083.      RExL file which is currently being debugged.  The third last
  5084.      line on the  screen is the debugger  status line, which  has
  5085.      the same function and features as the editor status line  in
  5086.      the editor.
  5087.  
  5088.      Underneath the  debugger status  line  is the  watch  window
  5089.      (blank above)  where watches  are kept.   On  start-up,  the
  5090.      watch window is one character  high, but this will grow  and
  5091.      contract as watches are added and removed.  The bottom  line
  5092.      of the display lists some of the short-cut keystrokes  which
  5093.      can be used in the debugger.
  5094.  
  5095.      The Code Window  is above the status  line and displays  the
  5096.      rule currently being executed.  Cursor movement in the  code
  5097.      window uses the same keys as in the editor.
  5098.  
  5099.      The four menus on the main horizontal menu bar have contents
  5100.      as follows:
  5101.  
  5102.  
  5103.  
  5104.  
  5105.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5106.            - Main Manual.                    Page: 91 -
  5107.  
  5108.  
  5109.      7.2.1  File menu
  5110.  
  5111.                          ┌────────────────────────┐
  5112.                          │ Return to editor       │
  5113.                          │ OS shell               │
  5114.                          │ Quit                   │
  5115.                          └────────────────────────┘
  5116.  
  5117.      The file menu has the following seven options:
  5118.  
  5119.          o  Return to editor: This option will return control  to
  5120.             the editor, loading  the application currently  being
  5121.             debugged.
  5122.  
  5123.          o  OS Shell: If you  want to run a  DOS command, but  do
  5124.             not wish  to  exit  from  the  debugger  permanently,
  5125.             choose this option to go into a DOS shell.  While you
  5126.             are  in  the  shell,   you  should  not,  under   any
  5127.             circumstances,  run  any   T&SR  programs  (such   as
  5128.             Sidekick, ScrGrab and so forth), since these programs
  5129.             change critical area of  the computer's memory  which
  5130.             may cause it to  crash unpredictably when you  return
  5131.             to RExL.   When you are finished  in the shell,  type
  5132.             `exit' at the DOS prompt to return to RExL.
  5133.  
  5134.          o  Quit: This  choice will  quit from  the debugger  and
  5135.             return you directly to  DOS, irrespective of  whether
  5136.             you started the  debugger from within  the editor  or
  5137.             not.
  5138.  
  5139.      7.2.2  Debug menu
  5140.  
  5141.                          ┌───────────────────┐
  5142.                          │ Watch             │
  5143.                          │ Evaluate          │
  5144.                          │ Run               │
  5145.                          │ Step              │
  5146.                          │ Trace             │
  5147.                          │ Halt here         │
  5148.                          │ Breakpoint        │
  5149.                          │ Animate           │
  5150.                          └───────────────────┘
  5151.  
  5152.      All of the options in  this menu are also available  through
  5153.      hot-key  short-cuts.  When  you  become  familiar  with  the
  5154.      debugger's keystroke map,  you'll probably not  need to  use
  5155.      this menu.   There are eight options in this menu:
  5156.  
  5157.  
  5158.  
  5159.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5160.            - Main Manual.                    Page: 92 -
  5161.  
  5162.  
  5163.          o  Watch: This option, which  is also available via  the
  5164.             hot-key
  5165.  
  5166.          o  <Ctrl-F7> or  <Ctrl-W>,  controls  the entry  of  new
  5167.             expression watches  into  the  watch  window  at  the
  5168.             bottom of  the screen.   The  procedure for  entering
  5169.             watches is covered in detail in the next section.
  5170.  
  5171.          o  Evaluate:  Selecting  this  option,  also   available
  5172.             through <Ctrl-F4> or  <Ctrl-E>, causes an  expression
  5173.             evaluation box to  appear.  This  is also covered  in
  5174.             the next section.
  5175.  
  5176.          o  Run: This choice will return the debugger to run mode
  5177.             and will not return  control to the debugger,  unless
  5178.             it meets a breakpoint or you press <Alt-D>.  Pressing
  5179.             <F9> is equivalent to selecting this choice.
  5180.  
  5181.          o  Step: This menu choice is identical to pressing <F8>.
  5182.  
  5183.          o  Trace: This choice is identical to pressing <F7>.
  5184.  
  5185.          o  Halt here: This  option, also  available by  pressing
  5186.             <F4>, will  set a  temporary breakpoint  at the  line
  5187.             currently hilited in the code window.  When execution
  5188.             reaches the line,  the debugger  will regain  control
  5189.             and the breakpoint will be cleared.
  5190.  
  5191.          o  Breakpoint: This  option  (also on  <Ctrl-F8>)sets  a
  5192.             breakpoint at the  line hilited in  the code  window.
  5193.             Whenever execution  reaches this  line, the  debugger
  5194.             will regain control.
  5195.  
  5196.          o  Animate: This choice  (also on  <Alt-F4>) will  cause
  5197.             the debugger to emit a trace instruction at  variable
  5198.             intervals, so that  the debugger  appears to  control
  5199.             itself.  Pressing any key while animating will return
  5200.             control to the user.
  5201.  
  5202.      7.2.3  Lists menu
  5203.  
  5204.                          ┌────────────────────┐
  5205.                          │ Rule list          │
  5206.                          │ Screen list        │
  5207.                          │ Unused rule list   │
  5208.                          │ Unused screen list │
  5209.                          │ Variable list      │
  5210.                          │ Function list      │
  5211.  
  5212.  
  5213.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5214.            - Main Manual.                    Page: 93 -
  5215.  
  5216.  
  5217.                          │ Call stack         │
  5218.                          └────────────────────┘
  5219.  
  5220.      This menu  gives you  access to  all the  lists of  entities
  5221.      which are defined the current application. Most of the lists
  5222.      have special  `hot-links' to  other, more  specific,  lists.
  5223.      These are mentioned  briefly at the  end of this  subsection
  5224.      and covered in  more detail further on.  All of these  lists
  5225.      are also available via hot-keys from within the main  editor
  5226.      window.  Consult  the  section  on  editor  keys  for   more
  5227.      information on this.
  5228.  
  5229.      The lists run menu has the following six options:
  5230.  
  5231.          o  Rule list: This list contains the names of all of the
  5232.             rules   which   are   currently   defined   in   your
  5233.             application.
  5234.  
  5235.          o  Screen list:  This list  contains  the names  of  all
  5236.             screens defined in the currently active screen file.
  5237.  
  5238.          o  Unused rule list:  This list shows  all rules  which,
  5239.             although defined in the normal way, are not  actually
  5240.             referenced  by  the  application.  Pressing   <Alt-D>
  5241.             within this list will delete the unused rule from the
  5242.             application.
  5243.  
  5244.          o  Unused screen list: This list gives all screens which
  5245.             are not  referenced in  the current  application.  As
  5246.             with the  unused rule  list above,  press <Alt-D>  to
  5247.             delete the unused  screen from the  list and free  up
  5248.             the space it occupies within the screen file.
  5249.  
  5250.          o  Variable list: This list contains all variables.  The
  5251.             status line at the bottom of the screen displays  the
  5252.             type of the variable, whether numeric or string,  and
  5253.             whether it's an array or a simple variable.
  5254.  
  5255.          o  Function list: This list  contains all the  functions
  5256.             available in RExL.  Press <Ctrl-F1> for  help on  the
  5257.             hilited function.
  5258.  
  5259.          o  Call stack: The call stack is the list of rules which
  5260.             are currently executing.  The most recent call is  at
  5261.             the bottom of the list.   The `Main Program' rule  is
  5262.             always at the top of the list.
  5263.  
  5264.  
  5265.  
  5266.  
  5267.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5268.            - Main Manual.                    Page: 94 -
  5269.  
  5270.  
  5271.      All the list windows are movable by pressing  <Scroll-Lock>,
  5272.      using the  arrow  keys  to position  and  pressing  <Enter>,
  5273.      <Scroll-Lock> or <Esc>  to terminate the  window move.  Note
  5274.      that all lists  in RExL feature  helix searching.   You  can
  5275.      also output  the contents  of any  list  to a  file (or  the
  5276.      printer) by pressing <Ctrl-P>, as in DOS.
  5277.  
  5278.      If you terminate any of the lists by pressing <Enter>,  then
  5279.      the choice which you selected from that menu will be  placed
  5280.      into the scrap buffer, ready  for pasting using the  <Shift-
  5281.      Insert> keystroke.
  5282.  
  5283.      7.2.4  Options menu
  5284.  
  5285.                          ┌───────────────────────┐
  5286.                          │ Load macros           │
  5287.                          │ Save macros           │
  5288.                          │ Beep off              │
  5289.                          │ Function lower case   │
  5290.                          │ Exploding windows off │
  5291.                          │ Screen swap: smart    │
  5292.                          │ Repaint screen        │
  5293.                          └───────────────────────┘
  5294.  
  5295.      The options  menu  controls  various system  parameters  and
  5296.      features not directly connected to the editor per se.
  5297.  
  5298.          o  Load macros: Any macro definitions you define in  the
  5299.             editor may be saved to disk for later retrieval using
  5300.             this menu option. The  macro file format is  constant
  5301.             across the RExL product range, so that macros defined
  5302.             in the editor may be  used in the debugger or in  the
  5303.             database manager and so on.  Macros are explained  in
  5304.             more detail at the beginning of this chapter.
  5305.  
  5306.          o  Save macros: This  option allows you  to save  macros
  5307.             which can then be reloaded at some future time  using
  5308.             the load option above.
  5309.  
  5310.          o  Beep  off:    By  default,  RExL  beeps  whenever  it
  5311.             encounters an error. This  beeping can be toggled  on
  5312.             and off by selecting this option.
  5313.  
  5314.          o  Function lower  case: By  default, all  functions  in
  5315.             RExL are displayed  in their natural  case.  This  is
  5316.             that functions  which  are  members of  families  are
  5317.             displayed  with  the  first  two  or  three   letters
  5318.             capitalised, while  the miscellaneous  functions  are
  5319.  
  5320.  
  5321.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5322.            - Main Manual.                    Page: 95 -
  5323.  
  5324.  
  5325.             entirely capitalised.  This option is used to  toggle
  5326.             between upper (or partially upper) case function name
  5327.             display and lower case.
  5328.  
  5329.          o  Exploding windows  off:  In  its  normal  state,  all
  5330.             windows in RExL open instantaneously upon activation.
  5331.             This option can  be used  to make  windows `grow'  to
  5332.             full size  on the  screen.   This  is only  a  visual
  5333.             effect and has no effect upon the application.
  5334.  
  5335.          o  Screen swap on: Whenever  the debugger is stepped  or
  5336.             traced, the debugger  will swap its  own screen  with
  5337.             that of the  application running underneath  it.   If
  5338.             your application does not access the screen, then you
  5339.             can toggle  this  option  to `None'  to  disable  the
  5340.             screen swap. 
  5341.  
  5342.          o  Alternatively, you can set the mode to `Smart',  when
  5343.             RExL  will check  the  line   about  to  execute   to
  5344.             determine if  the line  contains an expression  which
  5345.             could change  the  screen.    If  this  is  so,  then
  5346.             the screen will be swapped, but not otherwise.  Smart
  5347.             screen swapping is the default screen swap mode.
  5348.  
  5349.             If,  when  screen  swap  is  off,  your   application
  5350.             accesses the screen, the change will be lost when the
  5351.             debugger regains control of execution, possibly  with
  5352.             a garbled screen.
  5353.  
  5354.          o  Repaint screen: This  option is used  to restore  the
  5355.             debugger    screen     after    it     has     become
  5356.             corrupted. Corruption of the debugger screen  happens
  5357.             when screen swap  has been disabled  during a  screen
  5358.             access by the application.
  5359.  
  5360.  
  5361.      7.3  Using the Debugger
  5362.  
  5363.  
  5364.      The familiar keystrokes of <Up>, <Down>, <Tab>,  <Shift-Tab>
  5365.      and so on, are all supported in the debugger as they are  in
  5366.      the editor. While designing the  debugger, we have tried  to
  5367.      strike a balance between its functionality and size.  It  is
  5368.      for  this  reason  that,  although  the  <Alt-Z>   keystroke
  5369.      generates the  rules list  as in  the editor,  there are  no
  5370.      hot-links to the other features, such as rule reference  and
  5371.      so forth.
  5372.  
  5373.  
  5374.  
  5375.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5376.            - Main Manual.                    Page: 96 -
  5377.  
  5378.  
  5379.      The following is a typical debugger screen:
  5380.  
  5381.      [Figure not included in disk manual]
  5382.  
  5383.      As with the editor, the status line (this time on the  third
  5384.      last line) shows the amount of memory remaining free for the
  5385.      runtime module to use.   To the right  of this is the  level
  5386.      display, showing the depth which the debugger has reached.
  5387.  
  5388.      There are two differences to the layout of rules in the code
  5389.      window.  The  first difference is  the current line  pointer
  5390.      character, ASCII 16.  This points to the line which will  be
  5391.      executed as soon  as the runtime  module regains control  of
  5392.      execution. The line pointer character is placed between  the
  5393.      line's modifier and  the actual text  of the  line.  In  the
  5394.      example above, the line pointer points to the final line  in
  5395.      the code  window.    In practice,  this  character  will  be
  5396.      colored yellow to make it visible above the background.
  5397.  
  5398.      The second difference  is the character on  the far left  of
  5399.      the line.   This  character  indicates the  current  logical
  5400.      status of  the line,  X, for  False, √  for True  and ?  for
  5401.      unknown.  On  start-up, all lines  are assigned  a value  of
  5402.      unknown, but as the application executes, the lines' logical
  5403.      values are filled in.  When a line is about to be  executed,
  5404.      its status is set to unknown.
  5405.  
  5406.      Other than the differences from the editor noted above,  the
  5407.      only  features  to  be   understood  in  the  debugger   are
  5408.      application step,  trace and  the  function of  watches  and
  5409.      breakpoints. These are covered in the next four subsections.
  5410.  
  5411.      7.3.1  Step
  5412.  
  5413.      When the application is stepped, the runtime module is given
  5414.      control of execution and it will run the line which was last
  5415.      hilited in the debugger's code  window.  RExL uses the  <F8>
  5416.      keystroke to step.
  5417.  
  5418.      If the line was a  statement, then it will be evaluated  and
  5419.      the value returned  will be assigned  to the line's  logical
  5420.      status as indicated by the character at the far left of  the
  5421.      line.
  5422.  
  5423.      If the line was a rule,  then the rule in its entirety  will
  5424.      be executed and control returned when the rule has  returned
  5425.      True or False to the caller.
  5426.  
  5427.  
  5428.  
  5429.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5430.            - Main Manual.                    Page: 97 -
  5431.  
  5432.  
  5433.      If the line was a  screen, then the screen will execute  and
  5434.      return True.
  5435.  
  5436.      7.3.2  Trace
  5437.  
  5438.      Trace works in the same manner as step does above, with  one
  5439.      important difference:  When you  trace a rule, the  debugger
  5440.      will expand the definition  and place the debugger's  hilite
  5441.      bar on the first non-blank line of the rule.
  5442.  
  5443.      <F7> or <Space> is used to trace a line.
  5444.  
  5445.      7.3.3  Watch
  5446.  
  5447.      As explained  above,  a  watch is  an  expression  which  is
  5448.      `watched' by both you and the debugger.  The expression  can
  5449.      be either string or numeric in type and is displayed in  the
  5450.      watch window, underneath the code window.
  5451.  
  5452.      Watches are  entered  by  pressing  the  <Ctrl-F7>  key  (or
  5453.      <Ctrl-W>).    A  dialog   box  appears,  prompting  for   an
  5454.      expression to  watch.   The syntax  will be  checked and  if
  5455.      valid, will be entered into  the watch list.  The format  of
  5456.      the watch is simple:  It consists of the expression entered,
  5457.      followed by a colon  and a space, followed  by the value  of
  5458.      the expression you entered.
  5459.  
  5460.      If the cursor  is placed  over some  alphanumeric symbol  in
  5461.      your source, then that symbol will be entered in the  dialog
  5462.      box.
  5463.  
  5464.      You can move the hilite bar to the watch window by  pressing
  5465.      <F6>, although this will not  be allowed if you do not  have
  5466.      any watches in the watch  window. When in the watch  window,
  5467.      you can add  new ones by pressing  <Ctrl-F7> or <Ctrl-W>  as
  5468.      before.  Watches can be deleted by pressing <Del> or  <Ctrl-
  5469.      Y> or <Alt-D>.
  5470.  
  5471.      Watches are more powerful (and  dangerous) than they may  at
  5472.      first seem:  Since you  are allowed to enter any  expression
  5473.      as a  watch,  this  may  clearly  include  expressions  like
  5474.      DBnext(), CLS()  (and  so  on), functions  which  alter  the
  5475.      status of RExL.  Entering expressions such as these can have
  5476.      various unwanted side-effects  in debugging  sessions.   The
  5477.      final point to note is that only those expressions which are
  5478.      visible in the watch window are actually evaluated at  every
  5479.      cycle.  You  can have  at most  ten watches  visible in  the
  5480.      watch window at any one time.
  5481.  
  5482.  
  5483.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5484.            - Main Manual.                    Page: 98 -
  5485.  
  5486.  
  5487.      7.3.4  Expression Evaluate
  5488.  
  5489.      Expression evaluation is a `shortened' version of  watching.
  5490.      It allows you  to enter an expression  and RExL will  return
  5491.      the value of that expression either string or numeric.
  5492.  
  5493.      Evaluation, however, has one major difference from  watching
  5494.      in  that  it  allows  you  to  enter  a  new  value  for  an
  5495.      expression, if that expression is a valid LValue.
  5496.  
  5497.      [Figure not available in disk manual]
  5498.  
  5499.      When the expression  evaluation box  initially appears,  the
  5500.      cursor will be  in the  Evaluate pane.   If  the cursor  was
  5501.      placed on a word within  the window, then that word will  be
  5502.      pasted into the box.   The expression which  you want to  be
  5503.      evaluated is then entered.
  5504.  
  5505.      The expression will then be  syntax checked.  If the  syntax
  5506.      is not  correct,  then  the  you will  be  returned  to  the
  5507.      evaluate pane, otherwise  the expression  will be  evaluated
  5508.      and the result displayed  in the Result pane.   If RExL  has
  5509.      determined that the expression is a modifiable LValue,  then
  5510.      the result of the expression  will also be displayed in  the
  5511.      New Value pane (whose  border will change color),  otherwise
  5512.      that pane will remain empty and the border color of the  new
  5513.      value pane will remain unchanged.
  5514.  
  5515.      If the expression is an LValue, then you can press <Tab>  to
  5516.      bring the cursor to the new value pane where you can enter a
  5517.      new value  for the  expression. This  new value  can be  any
  5518.      valid expression which returns a result of the same type  as
  5519.      the initial expression.   Again, this  expression is  syntax
  5520.      checked and  evaluated and  the result  is assigned  to  the
  5521.      expression in the evaluate pane.
  5522.  
  5523.      7.3.5  Animation
  5524.  
  5525.      You can  `animate'  the  execution of  your  application  by
  5526.      pressing <Alt-F4>. During animation, the debugger  simulates
  5527.      the pressing of the trace key at a definable interval.
  5528.  
  5529.      When you  press  <Alt-F4>,  a numeric  dialog  box  appears,
  5530.      prompting for  an animate  delay, measured  in tenths  of  a
  5531.      second.  This value can range from 0, where there will be no
  5532.      delay, to 600,  where there will  be a  delay of one  minute
  5533.      between successive steps.
  5534.  
  5535.  
  5536.  
  5537.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5538.            - Main Manual.                    Page: 99 -
  5539.  
  5540.  
  5541.      Press any key to stop  the debugger animating the  execution
  5542.      of the application.
  5543.  
  5544.      7.3.6  To Here
  5545.  
  5546.      The debugger  can  execute  an application  to  the  current
  5547.      cursor line, `to here', when  you press <F4>.  This  feature
  5548.      is sometimes known  as temporary  break-pointing, since  the
  5549.      effect is to  place a  breakpoint at  the line  and run  the
  5550.      application until either execution reaches a breakpoint, the
  5551.      application terminates or you press  <Alt-D>:  In any  case,
  5552.      the breakpoint will be cleared.
  5553.  
  5554.  
  5555.      7.4  Miscellaneous keystrokes
  5556.  
  5557.  
  5558.      <Ctrl-Home> moves the hilite bar  to the top of the  screen,
  5559.      while <Ctrl-End> moves it to the bottom of the screen or the
  5560.      last line in  the rule,  whichever is  nearer.   <Ctrl-PgUp>
  5561.      moves the hilite bar to the first line in the rule.
  5562.  
  5563.      <Alt-X> will attempt  to terminate the  debugger and  return
  5564.      you to the editor, if the debugger was called from there.
  5565.  
  5566.      <F4> sets up a temporary breakpoint on the currently hilited
  5567.      line.
  5568.  
  5569.      <Ctrl-F4> and <Ctrl-E>  bring up  the expression  evaluation
  5570.      box.
  5571.  
  5572.      <Alt-F5> displays the start-up screen of the editor.
  5573.  
  5574.      <Ctrl-F8> toggles a  breakpoint at  the current  line.   The
  5575.      breakpoint will be signalled by a breakpoint character, ≡.
  5576.  
  5577.      <Alt-F4> animates the debugger. You will be prompted for  an
  5578.      animation delay.
  5579.  
  5580.      <Ctrl-F7> and <Ctrl-W> enter a new watch expression.
  5581.  
  5582.      Entity lists are (as in the editor) as follows:
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5592.            - Main Manual.                    Page: 100 -
  5593.  
  5594.  
  5595.      Rule list:          on <Alt-Z> and <Shift-F2>
  5596.      Screen list:        on <Alt-S> and <Shift-F3>
  5597.      Unused rule list:   on <Alt-U> and <Shift-F4>
  5598.      Unused screen list: on <Shift-F5>
  5599.      Variable list:      on <Alt-V> and <Shift-F6>
  5600.      Function list:      on <Ctrl-F> and <Shift-F7>
  5601.  
  5602.  
  5603.      7.5  Command Line Parameters
  5604.  
  5605.  
  5606.      The debugger accepts  the use of  a number  of command  line
  5607.      parameters.  These are letters (preceded by minus signs,  -,
  5608.      or forward slashes /) which  alter some internal default  of
  5609.      the debugger.   The current command  line parameters are  as
  5610.      follows:
  5611.  
  5612.          o  -d: The  `d' parameter  will  cause the  debugger  to
  5613.             start up in  debug mode, as if  the user had  pressed
  5614.             <Alt-D> during  loading  of  the application.    This
  5615.             switch is  passed  invisibly  by the  editor  to  the
  5616.             debugger whenever  the  debugger  is called  via  the
  5617.             Debug application  option  in  the Run  menu  in  the
  5618.             editor.
  5619.  
  5620.          o  -e: The `e' option will return control to the  editor
  5621.             when the debugger  terminates.   Whenever the  editor
  5622.             calls the debugger, this option is silently passed to
  5623.             the debugger, so that the debugger will return to the
  5624.             editor when it terminates.
  5625.  
  5626.          o  -k: This  `k'  option is  used  to tell  the  runtime
  5627.             module not to  watch out  for the  two keystrokes  of
  5628.             <Alt-D> and  <Esc>,  which  are  normally  monitored.
  5629.             (<Alt-D> will interrupt the run module and relinquish
  5630.             control to the  debugger while  pressing <Esc>  twice
  5631.             will terminate the application.)
  5632.  
  5633.  
  5634.  
  5635.  
  5636.  
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.       - RExL  Version 2.10  Copyright 1992, The Software Loft -
  5646.  
  5647.