




















                                  The JORF(R) Manual



              This manual comes with the JORF Interpreter and Tutorial 

                    Free Shareware Version             Free On Disk
                    Registered Version                 $85  Printed
                    Registered w/ Link Libraries       $170 Printed
                    JORF Developer's Kit               $TBA Printed

                                         from

                                   The JORF Company
                                  25858 Elwood Road
                                  Colton, OR  97017

                                    (503) 824-5673



                        Copyright(c) 1992 by The JORF Company.
                                 All Rights Reserved.

          JORF(R) is  a Registered  Trademark of The  JORF Company.   Other
          JORF Company products are trademarks  of The JORF Company.  Other
          brand  and product  names  are  trademarks  of  their  respective
          holders.



                         Please print this on recycled paper






















                              The JORF License Agreement

          COPYRIGHT.   The JORF Interpreter and  JORF Language Tutorial are
          owned  by The  JORF Company  and are  protected by  United States
          copyright laws and treaty provisions.  By using this software you
          are agreeing to be bound by the terms of this license.  If you do
          not agree with  this license, you may return all materials to The
          JORF Company for a full refund.

          GRANT OF  LICENSE.  The JORF Company grants  you the right to use
          one  copy of the  software for each  paid registration.   You may
          install the software on more  than one computer, but you  may use
          only one  copy at  a time.   You must  register each copy  of the
          software that you use at any one time to create new programs.  

          TRIAL  COPIES.  The  JORF Interpreter and  JORF Language Tutorial
          may be copied and  distributed on a trial basis.   If you use the
          software  to create  programs then  trial  is over  and you  must
          register your  copy with The JORF  Company.  You may  freely give
          copies to your  friends so they  can try it.   If they use  it to
          create new programs they must register it.  

          RUNTIME MODULE.   The  JORF Company grants  you the  royalty free
          right  to  distribute  the  runtime  module  JORF.EXE  with  your
          programs  provided that;  (a)  your  program  does  not  directly
                    ________
          compete with  JORF Company products; (b) your  program displays a
          copyright  message that includes  the word "Copyright",  a "(C)",
          the year, your name and the phrase "All Rights Reserved"; and (c)
          you  agree  to  indemnify, hold  harmless,  and  defend The  JORF
          Company  from and  against  any  claims  or  lawsuits,  including
          attorney's   fees,  that  arise   or  result  from   the  use  or
          distribution of your program.

          OTHER  RESTRICTIONS.  Persons  or corporations involved  with the
          production of biological, chemical or nuclear weapons may not use
          JORF Company Products.  JORF Company  Products may not be used in
          any type of weapons system.  
































                                   LIMITED WARRANTY
                                   LIMITED WARRANTY

          LIMITED  WARRANTY.  The  JORF Company warrants  that the software
          will perform  substantially in  accordance with  the accompanying
          written  materials for  a  period of  90  days from  the  date of
          receipt.  Any  implied warranties on the software  are limited to
          90 days.  Some states do not  allow limitations on duration of an
          implied warranty, so the above limitation may not apply to you.

          CUSTOMER REMEDIES.  The JORF Company's  entire liability and your
          exclusive  remedy shall be, at The  JORF Company's option, either
          (a) return of the price paid or (b) repair or replacement  of the
          software  that does not meet  The JORF Company's Limited Warranty
          and which  is returned to  The JORF Company  with a copy  of your
          receipt.    This Limited  Warranty  is  void  if failure  of  the
          software has  resulted from  accident, abuse,  or misapplication.
          Any replacement software will  be warranted for the remainder  of
          the original warranty period or 30 days, whichever is longer.

          NO OTHER  WARRANTIES.    THE  JORF COMPANY  DISCLAIMS  ALL  OTHER
          _____________________
          WARRANTIES,  EITHER  EXPRESSED  OR  IMPLIED,  INCLUDING  BUT  NOT
          LIMITED  TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
          A PARTICULAR PURPOSE,  WITH RESPECT TO THE JORF  SOFTWARE AND THE
          ACCOMPANYING  WRITTEN MATERIALS.  THIS LIMITED WARRANTY GIVES YOU
          SPECIFIC LEGAL RIGHTS; YOU MAY  HAVE OTHERS WHICH VARY FROM STATE
          TO STATE.

          NO LIABILITY  FOR CONSEQUENTIAL DAMAGES.   IN NO EVENT  SHALL THE
          ________________________________________
          JORF  COMPANY  OR  ITS  SUPPLIERS  BE  LIABLE  FOR   ANY  DAMAGES
          WHATSOEVER  (INCLUDING,  WITHOUT  LIMITATION,  SPECIAL,  INDIRECT
          INCIDENTAL OR CONSEQUENTIAL DAMAGES, DAMAGES FOR LOSS OF BUSINESS
          PROFITS, BUSINESS INTERRUPTION, LOSS  OF BUSINESS INFORMATION, OR
          OTHER PECUNIARY LOSS) ARISING OUT  OF THE USE OF OR  INABILITY TO
          USE THIS PRODUCT, EVEN  IF THE JORF COMPANY  HAS BEEN ADVISED  OF
          THE  POSSIBILITY OF  SUCH DAMAGES.   BECAUSE  SOME STATES  DO NOT
          ALLOW  THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL
          OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.






























                                     Installation

                                     Description

          The JORF Language  is a tool for building  business  applications
          for MS-DOS and Microsoft Windows  and for learning how to program
          in  an  object  oriented  environment.    The  distribution  disk
          contains two  versions of an  Interpreter that let you  run, edit
          and debug programs written in The JORF Language. 

          One  version is JORF.EXE  that runs under  DOS, and the  other is
          JORFWIN.EXE that runs under Microsoft  Windows.  Also on the disk
          is a JORF Tutorial,  a Help system, and  some sample programs  to
          demonstrates the power  of JORF, while teaching the techniques of
          Object Oriented Programming. 

                                     Requirements

          The DOS version of JORF runs  on IBM PC style computers including
          the XT, AT, 386 and 486.  It requires DOS 2.0 or higher with 640K
          of RAM and a hard disk.  

          The Windows version of JORF runs under Windows 3.0 or above using
          Standard or 386 Enhanced mode.  There must be at least 512 K free
          after Windows is running to run JORFWIN. 

                                     Installation

          The distribution has one 3  " disk, and if you requested you also
          have  two  5  "  disks.    To  install,  create   an  appropriate
          subdirectory, copy all files to that subdirectory, and unpack the
          files that are appropriate.

               Create a JORF subdirectory:             MD \JORF
                                                       MD \JORF
               Copy files to that subdirectory:        COPY A:*.* 
                                                       COPY A:*.*
               Either unpack DOS interpreter:          PKUNZIP JORFDOS
                                                       PKUNZIP JORFDOS
               and/or Windows interpreter:             PKUNZIP JORFWIN
                                                       PKUNZIP JORFWIN
               Always unpack sample files:             PKUNZIP JORF
                                                       PKUNZIP JORF
               Save space by deleting the Zip files:   DEL *.ZIP
                                                       DEL *.ZIP

          (PKUNZIP.EXE is a shareware program  produced by PKWare Inc.  The
          JORF Company has  purchased the right to  distribute this version
          of  PKUNZIP.EXE.    You  should  not  redistribute  this  or  any
          shareware program  without  registration or  permission from  the
          creators of that program.)








          Installation                                                    1















                               Installation Batch Files

          If  you can place  the installation disk in  floppy drive A:, and
                                                                    A:
          you have a hard disk drive C with about 1 Megabyte  free, you can
                                     C
          use INSTDOS.BAT or  INSTWIN.BAT.  These files  create a directory
              INSTDOS.BAT     INSTWIN.BAT
          called  C:\JORF  and   places  the  appropriate  files   in  that
                  C:\JORF
          directory.

               a.   Place the floppy disk in drive A: 
               b.   Type A: to log to drive A.
                         A:
               c.   Type INSTDOS to install the DOS version.
                         INSTDOS
               d.   Type INSTWIN to install the Windows version.
                         INSTWIN
               e.   If  installing from  5 "  disks,  insert  Disk  2  when
               prompted.


                             To Run The JORF Interpreter

          You can run  the DOS  version of  interpreter by  logging to  the
          appropriate directory and typing JORF.  If you  used INSTDOS.BAT,
                                           JORF                INSTDOS.BAT
          log to the JORF directory by typing CD \JORF, then type JORF. 
                                              CD \JORF            JORF

          To  run the Windows version of the  interpreter, you must add the
          JORFWIN application in the Program  Manager.  From the File menu,
                                                                 File
          select   New  Application.     Type  JORF   for  the   name,  and
                   New  Application            JORF
          C:\JORF\JORFWIN.EXE (using  the appropriate  disk and  directory)
          C:\JORF\JORFWIN.EXE
          for   the  file  to  run.    Click  Done  to  finish  adding  the
                                              Done
          application. 

          The first time you run JORF, you should select TUTORIAL.J to load
                                                         TUTORIAL.J
          and run the JORF Tutorial.

                          To Exit from The JORF Interpreter

          Pressing Alt-X  will exit from  any JORF  program.  You  can exit
                   Alt-X
          from the current screen by pressing the Esc key. 
                                                  Esc

                             The JORF Initialization file

          If you have any problems with screen colors or display in the DOS
          version, you  should turn to  Appendix D to adjust  your JORF.INI
          file.   To  gain  speed on  DOS systems,  JORF uses  direct video
          access.  Some systems, notably EGA systems and non-standard video
          cards may  not work  properly.   To change JORF  to use  standard
          video functions, to turn off  the mouse, to set monochrome colors
          even on a CGA monitor all require you modify the JORF.INI file.






          The JORF Manual (Disk Version)                                  2














                                  Table of Contents

          Installation

          Chapter One 
               Welcome to JORF                                            1
               Who, What, Why                                             5

          Chapter Two
               Intro to Object Oriented Programming                       7
               Classes                                                    9
               Methods                                                   10
               Encapsulation                                             10
               Inheritance                                               11
               Polymorphism                                              12

          Chapter Three
               The JORF Language                                         13
               Program Logic and Flow                                    14
               Class, Method and Variable Names                          15
               Writing JORF Programs                                     18
               The JORF Debugger                                         19
               Using The JORF Editor                                     20
               Using an Outside Editor                                   21
               Translating JORF Language Programs                        21
               Indexes                                                   22
               Object-Attribute-Value Triplets                           23
               Probability                                               24
               String Keys                                               24

          Chapter Four
               JORF Math                                                 26
               Order of Operations                                       27
               Math Functions Reference                                  28

          Chapter Five
               Window Manager Reference                                  42

          Chapter Six
               Library Functions Reference                               56

          Appendix
                                                                        168

          Index
                                                                        182







          Installation                                                    3

































                                     Chapter One 


                                   Welcome to JORF

          JORF is an acronym for Josephine's Recipe Filer.  It is an object
          JORF                   Josephine's Recipe Filer
          oriented programming language suited  to creating data processing
          applications.  It  has artificial intelligence features,  such as
          an integrated rule based system manager, as well as powerful word
          parsing commands  you can use  to create text translators.   This
          combination  makes  JORF  an  ideal  tool to  use  to  learn  the
          techniques of OOP; to create powerful business applications using
          this  technique; and to  introduce expert systems  and artificial
          intelligence techniques to standard applications.

          JORF Version  2.0 enables  you to write  "same source  same data"
          applications for Microsoft Windows and  DOS computers.  It is one
          of  the easiest  WinApp languages  currently  available, and  the
          support of DOS systems is an added bonus.  This version also adds
          a powerful screen format handler that enables you to program pull
          down and pop up menus,  radio buttons, check boxes, hypertext and
          input fields with ease.

          The  JORF  Language  is  a data  slinging  language  for business
          applications  and expert systems.   JORF features  simplified key
          words, functions and  punctuation.  JORF is not  a modified third
          generation  language like  C++ or  object oriented  Pascal, or  a
          relational  data  base manager  that stores  data in  records and
          files.   It is a  simple OOP language  with data base  and expert
          systems capabilities.  JORF is tailored for business applications
          that  use  data   entry  screens,  data  processing   and  report
          generation.    The language  is  designed  to most  efficient  in


          Installation                                                    1














          handling  large  files  that contain  accounting  data,  text and
          knowledge data bases.

          The JORF Language uses a single data type,  called a jorf pointer
                                 a single data type            jorf pointer
          that  can hold  integers, floating  point  numbers, strings,  and
          blocks  of text.    Object-oriented classes  are  defined by  the
                                              classes
          programmer,  and may include  structures, objects with  more than
                                        structures
          one  element.   Structure  elements  are referenced  by  name, so
          location and order is irrelevant when assigning structure values.

                                  Data Base Manager

          The JORF Interpreter is a transparent data base manager. Whenever
                                    transparent data base manager
          you index  data to be retrieved,  the interpreter stores it  in a
          disk  file.      The   structure  definition  acts  as  a  record
          definition, with the different elements  acting as fields.   Both
          data  and indexes  are  stored  together in  a  single file,  and
          contain relative  pointers so the  file name and location  may be
          changed.  

          The data base files are not particularly space efficient, but are
          speed efficient, especially for very  large data bases.  The file
          size limit  is 64 times the  4 Gigabyte limit  imposed by current
          operating systems  and disk  drives. A single  file may  not span
          devices,   but  JORF  Language  applications  can  use  files  on
          different devices simultaneously. 

          Records are expressed  as class structures and can  contain up to
          2024 elements.  Each element can  also be a structure, so  record
          linkages can be  quite large.  Data linkages  are stored, instead
          of the data, so record size is  not particularly relevant.  There
          is no "white space" stored in the data file.

                                  Rule Based System

          The    JORF     language    includes     indexing    based     on
          Object-Attribute-Value  rule triplets.   This system is  used for
          Object-Attribute-Value
          data base indexing and  forward and backward chaining  rule based
          systems.   The rules also  contain probability and  a conditional
                                             probability        conditional
          pointer for flexibility in expert systems applications.  The JORF
          pointer
          interpreter uses the rule system internally to index all methods,
          classes, and inheritance tables.

          The efficiency of JORF language data files is different from most
          data base products.   In general, the system  is inefficient with
          small  data  files,  and  is  efficient with  large  ones.    For
          instance,  paragraph text is automatically compressed and gets an
          average  30% space  reduction,  but storing  a  single letter  or
          number  takes a  minimum of  ten  bytes.   Duplicate strings  are
          stored only  once, so  data bases that  contain large  amounts of
          duplicate information, like names, cities and tabled descriptions
          are stored efficiently.

          The JORF Manual (Disk Version)                                  2















                             C Language Library Functions

          The  C Language introduced  a new idea  to programming languages;
          Limited  key words  supplemented by  a standard  library.   The C
          Limited  key words                     standard  library
          language contains  only about 25  key words like  "if", "return",
          and  "int"  used  in  programming.    The standard  library  adds
          hundreds of functions that supplement  the key words and give the
          language full  power and  flexibility.   The  simplicity of  this
          system makes C very easy to use because the key words are easy to
          remember.  

          The  JORF  language uses  a  similar  system.   For  machine  and
          operating  system  calls, JORF  uses  standard  library functions
                                                standard  library functions
          written in  the C  language.  These  perform tasks  like creating
          windows on the screen, direct  program flow control, and print to
          files  and  output  devices.    The  JORF  library  contains many
          functions that are  embedded in  other languages.   For instance,
          the functions  If, While  and Return  are library  functions, not
                         If  While      Return
          embedded commands.

          Programmers may  add new functions  using the C or  C++ languages
          and The  JORF Developer's kit.  The Developer's Kit gives you low
          level  access  to a  high level  language.   This  allows  you to
          optimize a particular function, while maintaining the ease-of-use
          and versatility  of a  high level language.   The  combination of
          general high  level language  abilities with  specific low  level
          language functions makes The JORF Language a powerful programming
          tool.

                                     System Speed

          In 1951, Grace Murray Hopper conceived of a new type of  computer
          programming system called  "automatic programming".   This system
          involved  a program that  scanned ordinary text  and mathematical
          symbols  and converted  this into  binary code for  the computer.
          Programmers  eschewed it because  automatic programming used more
          computer time than the existing techniques.

          It was seven years later  that Captain Hopper's system was became
          popular as  the Fortran  language.  By  then, the  name automatic
                                                                  automatic
          programming had been changed to the name  used today.  What Grace
          programming
          proposed is  now called a  compiler and is  an essential  tool to
                                     compiler
          convert  high level  languages into binary  machine code.   Those
          high minded programmers wrote binary machine code by hand because
          they thought compilers were too slow.

          The JORF Language is slow.  It is slower than any language I have
          ever seen.   As  this story suggests,  you can  either code  in a
          lower  level  language   or  decide  that  perhaps   speed  isn't
          everything.   JORF is  not a language  that draws  it's advantage
          from being compatible with computer chip architecture.   In fact,

          Chapter One - Introduction                                      3














          it's  advantage  is the  opposite.    JORF  is farther  from  the
          computer chip, and therefore must do more to compensate.

                                   Translating to C

          The speed  of JORF Language  programs may be greatly  enhanced by
          translating the code to C and linking it using the JORF  Link Kit
                                                             JORF  Link Kit
          ($85 plus registered version).  In  addition to the kit, you must
          also use  a Borland compiler  to compile the  code.  If  you only
          want  to compile  the  DOS version,  you can  use any  version of
          Borland Turbo C   Turbo  C++.   To compile for  Windows you  need
          Borland Turbo C++ For windows, or Borland C++.  

          The translated code is  not pretty to look  at, nor is it a  good
          way for you to learn  the C language.   The single data type  and
          polymorphism in JORF are handled using special  function calls in
          The JORF Language, that insure that the JORF Kernel knows what is
          going on in the C program stack.  

          The JORF Developer's Kit (not  yet available) gives you the extra
          The JORF Developer's Kit
          information  you  need  to  get  down  and  dirty  with  directly
          connecting C and  C++ functions to JORF language  commands.  This
          kit includes source  code for many JORF functions,  shows how the
          system  converts the JORF data type to  the various C data types,
          and how to manage memory so it can be flushed at will.  With this
          kit,  you can  program  on  the JORF  level  to create  functions
          quickly, the C level to make them faster, and the assembler level
          to make critical functions fly. 

                                 Windows Programming

          For some  reason, the  "Powers-That-Be" are  using the  Microsoft
          Windows environment  to force  use of  non-procedural programming
          techniques.   In  Windows you  can now  click another  window and
          start a process that is not procedurally related to your original
          window.   However,  this  is no  reason to  replace  the ease  of
          standard procedural  techniques with  a billowing  cloud of  free
          floating functions.

          The   Windows  implementation  of   JORF  is  a   subset  of  the
          opportunities available under  Microsoft Windows.  Windows  is so
          complicated  that  not  even full  time  programmers  learn every
          command  and every  subsystem.   This  leaves no  time for  these
          programmers   to  learn  what  computer  users  want  from  their
          application.   The  legacy of  Windows looks  like the  legacy of
          UNIX; expensive techies, weak programs.

                             JORF Programming in Windows

          The  JORF Language supports  the Windows "Look"  while supporting
          just a small subset of  Windows functions.  Complexity is reduced


          The JORF Manual (Disk Version)                                  4














          by eliminating  complex functions  and limiting  the look  of the
          functions available.  

          The Key to JORF programming under Windows is that it is just like
                                                                  just like
          JORF  programming under  DOS.    There are  no  new paradigms  or
          JORF  programming under  DOS
          endless  point and  click  set-ups.   The  JORF Win:Add  function
          handles  window formats, including  pull down  and pop  up menus,
          hypertext  prompts, radio buttons, check boxes, data entry fields
          and text.  The JORF Event system  handles keystrokes, but, for an
          event driven system it is pretty simple to understand. 

          Under Microsoft Windows,  JORF Programs use the  Windows graphics
          look,  and support moveable and resizable windows with Title Bars
          and Minimize  and  Maximize  buttons.   When  you  click  another
          application,  JORF programs  run in  background until  the hit  a
          prompt,  at which time  they go to  sleep.  You  can run multiple
          JORF Programs at the same time, even ones that read the same data
          files.

          The same JORF programs runs  identically under DOS, with the same
          buttons, menus, mouse capability, and data structure.  This means
          that people who  have slower and smaller computers  can still run
          your programs.   Programs run considerably  faster under DOS  but
          are not as pretty. 

                                    Who, What, Why

          JORF  is an acronym for Josephine's Recipe Filer.  Josephine is a
                                  Josephine's Recipe Filer
          tan pygmy goat who lives at the  foot of the Cascade Mountains in
          Oregon.  She does not file  recipes, instead she dances and plays
          in the sunshine.  Her message is  simple; Lighten up, eat, dance,
          Baaaah.  Jo does not have to work for a living.

          People laugh  at Recipe Filers.  What a stupid use for computers,
          they say.  But if  you spend a minute you realize the  joke is on
          you.  Recipes  are trivial everyday items that  we all understand
          and  use.  But  they lack  the structure  necessary to  file them
          using  a  Relational Data  Base.    Recipes  are not  numeric  so
          Spreadsheets  don't work,  and they  need to  be indexed  so Word
          Processors can't be used.   Instead of being trivial, recipes are
          an analogy for data that most languages cannot handle. 

          To effectively file recipes, you need a tool that can handle data
          with a loose structure.  Something that  can index the files in a
          variety  of  ways,  and can  easily  access  linked  concepts, or
          recipes within recipes.   This variety of needs  can only be  met
          using an Object Oriented Programming language that is linked to a
          Expert System style  rule base.  This  is the basis for  the JORF
          Language.

          The JORF Language was designed by  me, Wayland Bruns.  In my  ten
          years  of  applications  programming, I've  become  disgusted  at

          Chapter One - Introduction                                      5














          languages created by engineers and  mathematicians.  Sure you can
          create beautiful bubble  sorts in  C, but my  clients pay me  for
          working applications  programs, not  beautiful bubble  sorts.   I
          want a language that does my sorting, indexing, file handling and
          memory management, and  leaves me the job of applications design.
          That is my goal for JORF.















































          The JORF Manual (Disk Version)                                  6


































                                     Chapter Two


                         Intro to Object Oriented Programming

          This chapter is  a really short  introduction to Object  Oriented
          Programming  for  non-programmers and  non-OOP  programmers.   It
          provides  background information for  The JORF Language  notes in
          the next chapter.  If you already know about OOP, or just want to
          wing it, skip this chapter - see if I care!

                                  The Origins of OOP

          In the  computer medieval era, when room sized racks held rows of
          vacuum  tubes,  programmers coded  programs in  machine language.
          These pour  souls laboriously  translated each  command into  its
          binary equivalent, and toggled the binary number into the system.
          Computer languages were invented to replace this technique.  They
          Computer languages
          allowed programmers  to write computer  instructions using  words
          and phrases instead of machine code digits.  This was good.

          As computers became  faster, programs became bigger.   The Second
          Law  of Thermodynamics  took effect.    This law  states that  as
          objects grow in complexity, they tend towards increasing entropy,
                                                                   entropy
          or randomness.   Large  programs have  a  marked tendency  toward
          entropy,  especially when maintained by more than one programmer.
          Entropy in program code grew to  crisis proportions, because most
          programs were large and maintained by many programmers. 

          A  decade ago,  into  the  darkening cloud  of  entropy, rode  an
          innovative  technique called Structured  Programming.  Instead of
                                       Structured  Programming
          using  GOTO  statements  to transfer  control,  we  started using

          Chapter One - Introduction                                      7














          Subroutines.   Instead of starting at the top of the program, and
          Subroutines
          working our way  down, we  started to plan  ahead, and break  our
          programs  into well  defined  subsystems.   The smaller  and well
          planned routines  are  less  subject  to  entropy  than  the  big
          unstructured  programs.    Using   the  technique  of  structured
          programming,  we could create  even bigger programs,  that worked
          better  and  did  more  things, without  having  them  become too
          complex.  This was good.

          Now, computers are  everywhere!  Everyone is using  them!  Worse,
          every application developer in  the world is competing  by adding
          more and more features to their programs.   Structured techniques
          are  no  match for  entropy  in  programs  fragmented by  rampant
          feature-creep.  Large  applications still contain dark  swamps of
          chaotic program code, right in  the most critical sections of the
          application.   Programs are bombing, programmers are quitting and
          the operators are saying  "I put it in the computer,  why can't I
          get it back out?"  

          And  now  comes  Object  Oriented  Programming,  a  technique  of
                           Object  Oriented  Programming
          structuring routines according to the  data they handle.  In OOP,
          Subroutines are message  passers and package handlers,  while the
          Data controls  how the  program flows and  what routines  will be
          used.  Subroutines are more  strict than structured programs, and
          are tied  to the  data they handle.   When you  print a  piece of
          Data,  the language  will  pass  control  the  appropriate  print
          command  for that data.  If the data  is a number, it will call a
          number printing routine, and  if it is a text  paragraph, it will
          call a text printing routine. 

                               The Revolution Continues

          Just  as   Languages  replaced   binary  coding   and  Structured
                     Languages                                   Structured
          Programming   replaced   linear  programming,   Object   Oriented
          Programming                                     Object   Oriented
          Programming will soon  replace earlier techniques.   This is  not
          Programming
          because  computer science academics  think they can  confuse more
          students, or because Microsoft thinks it can make $500 every time
          you change languages.   It is because OOP  makes tougher problems
          easier to  handle.  It  encourages a standard system  of chunking
          program complexity.  With better chunking, programs become easier
          to build and maintain, bugs are easier  to find, and you are more
          likely to re-use your chunks for your next programming task. 

                                   OOP Terminology

          Object Oriented Programming  implies a new way  of thinking about
          programming.  To mark this  transition, the lingo of OOP contains
          some specific  expressions for  what are now  concise ideas.   To
          make things simple,  because I like simple things,  I have boiled
          OOP  down into just a few expressions.  These are important words
          so -pay close attention.  The expressions of OOP are:


          The JORF Manual (Disk Version)                                  8














          Class          An OOP data type.  All data belongs to a class. 
          Class
          Structure      (In Smalltalk: Set)  A Class w/ multiple elements.
          Structure
          Method         The OOP name for a Function or Subroutine.
          Method
          Encapsulation  A Class and it's Methods can be packaged.
          Encapsulation
          Object         An instance of a Class and it's Methods.  
          Object
          Inheritance    Objects can inherit neat stuff from other Objects.
          Inheritance
          Polymorphism   Calling same-name methods in different Objects.
          Polymorphism

                                       Classes

          Before  OOP, languages supplied  built-in data definitions.   For
          instance, the  BASIC language  supplied data  types for  Strings,
          Integers and Floating point numbers.
          These  classes are  directly related  to data  types the  CPU can
          handle.  

          In Object  Oriented languages,  these  CPU data  types are  still
          available.   But you can  also invent your  own data types.   For
          instance,  you  can create  a  Boolean  data type  that  contains
          nothing  but  True or  False.   Or  maybe a  Date data  type that
          contains valid  dates.  OOP  languages let you define  these data
          types so they can be handled in a similar way to the original CPU
          data types.

                                      Structures
                                      Structures

          Computers would not be a viable  tool if the CPU did not  already
          handle an  effective range of  primitive data types.   But Pascal
          and C  languages, introduced a  way to create complex  data types
          called Structures.  A structure is a data type that contains more
                 Structures
          than one primitive  type and can even contain  other structures. 
          These elements of the structure  are packaged into a single unit.
          This is a lot like traveling with suitcases.

          When you fly to  Boston you must transfer  the shirts, shoes  and
          socks that  you require for  your trip.   If you were  check your
          shirts, shoes and socks individually,  when you arrived you would
          have to claim  them shirt by shirt,  sock by sock in  the baggage
          claim area.  

          If everyone did  as you did, your  chances of picking up  a wrong
          sock or  losing a shirt  would be high.   Instead, you  pack your
          shoes, socks  and shirt in  a suitcase, and  check just  that one
          item when you travel.  When you  arrive, you need only claim your
          suitcase  to know  that  all  your shirts  shoes  and socks  have
          arrived.  

          By packaging the data in a structure, only the routines that need
          the  structure have  to deal  with the  individual items.   Other
          routines simply pass the structure around, like a baggage handler
          loading   baggage,  without  concern  for  the  contents  of  the
          structure.

          Chapter Two, Intro To OOP                                       9














          Data base  tools use  a type  of structure  called a  record.   A
          record  contains  individual  fields, just  like  the  C language
          structure  contains individual elements.  The  fields in a record
          must  be either atomic  data types,  or a  link field  to another
          records.   The entire culture  of Relational data base management
          is built on this fundamental limitation.

          Object-oriented structures,  in particular  JORF structures,  are
          not  limited  to primitive  elements.    Any  element in  a  JORF
          structure can be another structure,  an array, or a multiple line
          text.   JORF uses a  hierarchical style data base,  where records
          have pointers directly  to related records of  different classes.
          This style  cannot be  considered relational,  because it  allows
          freer access (an you can  hang yourself better) than a relational
          data base. 

                                       Methods

          In  traditional structured languages, programs are written in the
          form of subroutines or functions.  These functions can call other
                  subroutines    functions
          functions, which perform a task.  When the task is completed, the
          subroutine returns,  which means  it passes control  back to  the
                     returns
          calling function.    In  the BASIC  language,  these  are  called
          GOSUBs, short for GO SUBroutines.

          In Object Oriented Languages these subroutines are called Methods
                                                                    Methods
          and they  are handled somewhat differently.   The Method is not a
          primary thing  in OOP like  a Subroutine is  in BASIC.   Instead,
          every Method is subordinate to the  data type, or Class, that  it
                                                            Class
          belongs to.   A method  cannot be created without identifying the
          class that owns it.  

                                    Encapsulation

          A structure definition in JORF  is packaged with the methods that
            structure
          relate to  that structure.   The packaging  of these  together is
          called Encapsulation.   This  is an  essential feature  of object
                 Encapsulation
          oriented programming.

          In  the following JORF Language example, the methods are declared
          using the  class name to identify  them.  The first  parameter in
          the method is  expected to  be an  instance of  the named  class.
          Additional parameters may be of any class type.  

          In JORF,  class declarations prefix items and are separated using
          a colon.   In this example, the  class "Dog" is created  with the
          statement  class:dog.    This  class  is  a  structure  with  two
                     class:dog
          elements,  name and age.   These  elements do  not belong  to any
                     name     age
          specific  class.  Unless otherwise indicated, they are assumed to
          belong to the default class Jorf.
                                      Jorf



          The JORF Manual (Disk Version)                                 10














                                                    The first method shown,
                      Dog Years in JORF
                      Dog Years in JORF
                                                    Dog:Start     has    no
                                                    Dog:Start
                                                    parameters.  The second
            Class:Dog (Name, Age)
                                                    method,   Dog:CalcYears
                                                              Dog:CalcYears
                                                    is  called  using   one
            Dog:Start
                                                    parameter,  which  must
              New (Dog:D)
                                                    be an  instance of  the
              D->Age = 7
                                                    class DOG.  
              Str:Put ("Age={CalcYearsFor(D)}")

                                                    The New  command  is  a
                                                        New
            Dog:CalcYearsFor (DD)
                                                    JORF   Library  command
              Return (DD->Age * 7)
                                                    that  allocates  a  new
                                                    instance of  an object.
                                                    The    first    command
          allocates a new instance of class Dog named "D", 
                                            Dog

          When OOP academics get together, they sometimes debate the degree
          of encapsulation in an OOP language.  Some languages restrict the
          object so  only methods  that belong  to the  object can  see the
          elements of the structure.  This is  called "data hiding".  Other
          languages, like JORF allow any  method to examine the elements of
          the structure.    Although JORF does not require data  be hidden,
          it  is  still a  good practice  to  follow when  speed is  not an
          issue.

                                     Inheritance

          Objects  may  inherit  methods  from  other  objects.    This  is
          important because  it is  common to declare  a new class  that is
          very similar to an existing class.   For instance, a Vendor class
                                                               Vendor
          may  share all of its Address fields with  an Address class.   By
                                                        Address
          sharing the basic  Address methods, you save the  time that would
          be needed to rewrite routines  that print address labels and form
          letters.

          A class can "inherit" structure elements and methods from another
          class.   In JORF,  this is  done simply  by declaring  the parent
          class in the element list of a  class definition.  Here is a Name
          and Address class:

           Class:Address ( Name, Addr1, Addr2, City, State, Zip, Tel, FAX )

          And here is a class that might inherit from it:

           Class:Vendor ( Address:Addr, Description, Products )

          The Vendor  class inherits  address handling  fields and  methods
          from the Address class, and has the additional fields Description
                                                                Description
          and Products.
              Products




          Chapter Two, Intro To OOP                                      11














          Note:   with the exception  of the colon, punctuation  is ignored
          class definitions.  You can  also make a multiple line definition
          that allows you to add comments.  The following two examples work
          exactly the same as the Vendor class definition above.

               Class:Vendor Address:Addr Description Products

               Class:Vendor
                   Address:Addr         | Name, Co, C/S/Z
                   Description          |  Distributer/Retail/Dealer or . .
          .
                   Products             | Products we buy from this vendor

          In JORF, a class can have more than one parent, in which case the
          order the  parents are declared  is significant.  This  is called
          multiple  inheritance.  When  a method  is requested,  the system
          multiple  inheritance
          will search for the  method name in the current class,  and if it
          is not  found, will search  in each parent  class.  If  there are
          parents in  those classes  (grandparents) they  will be  searched
          before searching the next parent in the current class.  

                                     Polymorphism

          Method names take on  new importance in OOP.  In third generation
          Method
          languages,  functions   and  subroutines  stand   alone  and  are
          referenced specifically by name.  The names cannot be  duplicated
          in such a system, because there is no way to decide which name is
          the right  routine  and  which is  the  wrong routine.    In  the
              right                               wrong
          original  version of  the BASIC  language,  the subroutines  were
          referred to by line number, which guaranteed that no method would
          be duplicated.  In the C Language,  the compiler will insure that
          only one routine of a given name is compiled into the program. 

          Object-oriented  languages  reuse the  same  name for  equivalent
          methods in different classes.  For instance, in JORF, each object
          should have a Show method that  the debugger can use when showing
                        Show
          stack values.  The stack displays screen takes each variable, and
          commands  it to  show.   Polymorphism says  that if  the variable
          belongs   to  the  class  Address  then   the  system  will  call
                                    Address
          Address:Show,  but if the  variable belongs to  the Vendor class,
          Address:Show                                        Vendor
          the  system will  call Vendor:Show.   In  The JORF  Language, the
                                 Vendor:Show
          class for a method is prefixed to the name using a colon.  When a
          polymorphic method is called, the class of the first parameter of
                                                               parameter
          the call will be the class for the method name called. 

          The  system of deciding the right method  by looking at the class
          of a variable is polymorphism.   Really polymorphism is a sign of
                           polymorphism
          good  OOP technique,  and also a  sign that  you are ready  for a
          vacation.  If you do not understand how this works now, just wait
          and  start  programming.   When  you need  polymorphism  you will
          suddenly  understand how  powerful this  feature can  be.   Until
          then, why make your life more complex. 

          The JORF Manual (Disk Version)                                 12



































                                    Chapter Three

                                  The JORF Language

                                  The JORF Data Type
                                  The JORF Data Type

          Early  computers were  intended  to be  fancy  calculators.   The
          purpose of ENIAC, a computer built  in the 1940s, was to  perform
          calculations  for   missile   trajectories.     At   that   time,
          calculations  were  done  by "Computors",  people  who  added and
          checked  equations using paper and pencil. The scientists working
          on  ENIAC felt  that  three such  machines  could accomplish  the
          computing tasks for the entire country.  

          Fifty years later, a $10  calculator is more powerful than ENIAC,
          and 10 million personal computers are sold each  year in the U.S.
          alone.    Oddly,  the  basic  design   of  the  computer  remains
          unchanged.    Computers  are  calculating  machines  that  handle
          integers and floating point numbers. 

          For  a  data processing  tool,  a computer  is not  very  good at
          handling what we would call data; data entry items and text.   In
          order  to  handle these,  the  computer  has  to be  fooled  into
          thinking it is handling numbers.  That is why ASCII code is used.
          The ASCII  code is  a standard  way to  turn each  letter of  the
          alphabet into a number.  The size of an ASCII letter is one Byte.
          So to compare two words to see if they are the same, the computer
          must be fooled into thinking it is comparing two sets of bytes:

                        A computer can't compare Bear to Boo.
                                                 Bear    Boo


          Chapter Two, Intro To OOP                                      13














                 Instead it compares  66 101 97 114  to  66 111 111.
                                      66 101 97 114      66 111 111

          Most  computer languages  are  oriented to  Math,  just like  the
          computers.   It  is  interesting  to  note,  however,  that  most
          personal computers are  used for data  processing, and not  math.
          Most notable is the  tendency in these languages to  stick to the
          fundamental data types that the CPU can handle.  For instance, in
          the  overly hyped  C++ language,  an integer  is still  a 16  bit
          binary number, that will overflow if greater than 65535.

          The JORF Language  steps away from these machine  data types, and
          replace them with  a single type.   The JORF Pointer is  the only
          data type in JORF, and can hold all the different types  that are
          available  in C++.    Having one  data type  frees  you from  the
          responsibility of  declaring a particular  type, only to  have it
          overflow or become corrupted because your data doesn't match your
          original  declaration.   In years  past,  when I  designed a  new
          application, deciding and  assigning data types in  my structures
          took hours and  even days.  Now, with JORF, I don't have to waste
          this time accommodating  the math oriented CPU.   Instead, I just
          assign JORF Pointers, and let the JORF Interpreter handle storing
          my data in the most efficient way. 

          The JORF Pointer can represent an integer value, a floating point
                                            integer value    floating point
          number,  a string,  a structure,  an array,  and a  multiple line
          number     string     structure      array          multiple line
          block of text.  It is the responsibility  of The JORF Interpreter
          block of text
          to decide which form  is the best for a given piece of data.  The
          interpreter does all the bounds checking necessary to insure that
          a number is  not truncated because  it is too  large, and that  a
          string value is properly assigned to null.

          JORF pointers  are temporary until  they are written to  file, or
          become linked  to a Rule.   The rule  system is equivalent  to an
          "Index" in a data base.  When a JORF Pointer is linked to a Rule,
          by being a  member of  the Rule, it  is automatically written  to
          file for permanent storage.  

          When a JORF Pointer  is saved, it is written in  the current data
          file.  Any number  of files may be declared,  using the Jorf:File
          function.   These files  are not  "Opened" and  the  data is  not
          "Read".  Instead, you give the  file name using Jorf:File and the
          interpreter will open and use that file.  There is no distinction
          between program and data in the file, and indexes are stored with
          the data  that is indexed.   Internal pointers are  relative, and
          files are  self sufficient, so  linked files may be  freely moved
          and mixed without integrity problems.

                                Program Logic and Flow

          There are  three key words  in The JORF Language;  Class, Parent,
                                                             Class  Parent
          and Jorf.  These key words are supplemented with Standard Library
              Jorf                                         Standard Library
          Functions written  in the C  language and compiled into  The JORF
          Functions

          The JORF Manual (Disk Version)                                 14














          Interpreter.   This is  how If, While,  Win:Add, and  Move:To are
                                      If  While   Win:Add       Move:To
          implemented.   The library functions  are much like key  words in
          that they are a  fixed part of the system.  But  they are not key
          words  because  programmers  with The  JORF  Developer's  Kit can
          change and augment these functions. 

          JORF is  a data  slinging language.   Its  strength  lies in  its
          ability  to automatically  handle  complex  data  structures  and
          implied indexes  to those  structures.  Its  weakness is  in this
          same accomplishment.   In order to handle  these structures, JORF
          is disk based, and therefore slower  than memory based languages.


                                Spaces and Indentation

          Most computer  languages have  indentation customs  that are  not
          enforced.  In  JORF, indentation actually controls  program flow,
          so  it  is  required.    This eliminates  any  need  for  bracket
          punctuation or "END" statements. 

          Both  Pascal and C use specific  punctuation characters to direct
          program flow  even though  indentation is also  customary.   This
          program  fragment,  written in  the  C Language,  shows  a common
          problem     with     indentation.
          Although   the   rules   of   the
          language say  the else  statement
                            else                 Misleading indentation
          belongs  to   the  preceding   if
                                         if         In the C language
          statement,     the    indentation
          indicates that  the else  belongs
                              else                if (a > b)
          to the first if statement.   Even
                       if                              if (b > c)
          experienced  C   programmers  get                 a=c;
          frustrated  by   this   type   of       else a=b;
          problem  because  they   look  at
          spacing  and  not  the  semicolon
          positions    of    the    various
          statements.  

          The rules  on spacing in JORF replace  the end of line characters
          that  make C  and Pascal  difficult to read.   In  addition, good
          program  structure  and  is  required  for  the  program  to  run
          properly.  JORF generally ignores punctuation characters like the
          semi-colons used in  the C Language, so the  program sample above
          would run  just  fine  in  JORF.   But,  because  JORF  uses  the
          indentation  to  direct program  flow,  the else  command  is the
                                                      else
          alternate to the first if command and not the second.
                                 if


                          Class, Method and Variable Names 

          JORF labels are  not case  sensitive.   "Rose" is a  "rose" is  a
          "RoSe".  This applies to methods, classes and variable names.  It
          is not  legal to  use punctuation characters  in Method  or Class

          Chapter Three - The JORF Data Type                             15














          names.   These  names must begin  with a letter,  but may include
          numbers. The underscore character _ is treated like a letter.
                                            _

               Legal Names              Illegal Names

               Move_Disk                Move-Disk
               Jorf:A                   Jorf:
               Integer:_1               Integer:21
               _Special:Say             *Special:Say

          Variable names  may not be the same as any Method names.  Nor may
          they use the  names of any C library functions.  Method names may
          not be quoted except for method declarations.  

          Methods  that have  parameters,  must  have  the  parameter  list
          enclosed in parentheses.   If there are no  parentheses, a method
          will  be  called  without parameters,  even  though  valid fields
          follow the method call.

                                    (Parentheses)

          Remember in  Math class how  Parentheses were used to  change the
          order of operations.  Say you have an equation like:

                                      4 + 6 * 2

          If you think  of it as 4 +  6, which is 10, times  2, you get the
          answer 20.   But if you think  of it as 4,  plus 6 * 2  (which is
          12),  you get 16.  So which is  it, 20 or 16?  My teacher thought
          that "Order of Operations" was  more important than going left to
          right.   But I think that going left  to right is more consistent
          and intuitive.   (Why  do mathematicians  make things  needlessly
          complex?)   Anyway, the  teacher and I  agreed that you  can make
          this very clear by adding parentheses:

                              (4 + 6) * 2    is always 20
                              4 + (6 * 2)    is always 16

          Parentheses  put items together to avoid  any confusion about the
          order in  which to  do things.   Computer programming  languages,
          including JORF,  use this  system because it  is clear  and easy.
          Parentheses are used to group elements of  a command to avoid any
          confusion.  

          Parentheses are  also used  to enclose the  parameter list  for a
          method.  If there  are no parentheses, the function is assumed to
          have  no  parameters.   Many  JORF function  are  commonly called
          without parameters, because the default values are appropriate.

               Event:Add (Null,'Key',Here)   | Set a  null event (To  block
          lower events)
               Event:Add           | Same thing, because of the defaults

          The JORF Manual (Disk Version)                                 16














               Str:PutLine (Null)       | Put a null line (to print cr-lf)
               Str:PutLine              | Same thing



                                  Structure Pointers

          Since Objects can be packaged into structures, it is important to
          be able  to Unpackage them when needed.  The way to do this is to
                      Unpackage
          use the structure pointer operator  ->.  This operator is created
                                              ->
          using a minus sign  and a right angle bracket to  make a pointer.
          Although this looks  pretty silly when printed in  the manual, it
          looks good on the screen.

          You pronounce  the structure  pointer like  the possessive  's in
                                                                      's
          english.  So "Bear->Sire->Name" is read as Bear's Sire's Name.

               Class:Dog Name Age Dog:Sire Dog:Dame

               Dog->Name="Bear"
               Dog->Age=2

          The class dog has four elements, name, age, sire and dame (mother
          and father).  The sire and dame are also dogs.  Think of "dog" as
          a package,  usually, you can  pass it around without  knowing the
          elements.  But when you  do want the elements, use the  Structure
          Pointer to name the element that you want.

                                        Arrays

          Arrays are referenced using [square brackets].  Inside the square
          brackets must be a number that indicates an offset in an array.  

               Goat[1] = "Festus"
               Goat[2] = "Josephine"

          JORF arrays are  not declared, and have  no scope.  The  array is
          created just by  using it.   The  index must be  a long  integer.
          Arrays are held in memory in blocks of 16 elements.  Unlike other
          languages, Arrays in JORF are not limited by available memory. 


                                      Parameters

          Parameters are passed by  value for single values and  constants,
                                by  value
          and  by reference  for structures.   Methods  can use  the Return
               by reference                                          Return
          function to return a value or  structure.  Multiple values can be
          returned by passing a structure to the method.

          When parameters are missing, they are passed to the called method
          as null.   It is  never an error in JORF to omit  parameters, and


          Chapter Three - The JORF Data Type                             17














          it is  typical for methods to have default values for any missing
          values.  Parameter lists must be enclosed in parentheses. 
                                 Casting Method Names

          In JORF, it  is customary  to put  a class prefix  on almost  all
          method  calls.    Without  the  prefix, a  method  name  will  be
          considered  to  be  polymorphic,  and  the  class  of  the  first
          parameter decides which class method to use.   


                                Writing JORF Programs

          The JORF Source Level Debugger is the easiest way to edit methods
          and  create  programs.   The  debugger  lets  you  trace  through
          programs, examine  stack values,  and change methods  on-the-fly.
                                                                on-the-fly
          The editor includes a class browser that makes it easy to  find a
                                class browser
          method by selecting it off the browse  lists.   Both the debugger
          and  the editor  are written  in The  JORF Language, so  they are
          living proof of the potential for JORF language programming. 

          You also  can use an  outside editor to  edit a class  file, then
          read that  file back  into the interpreter.   Since  you use  the
          editor of  your choice,  you have  word processing commands  that
          suit your own style.   When you have finished editing, just start
          the  interpreter  with  the  file  name,  and  your  changes  are
          automatically loaded.


                                  JORF Project Files

          JORF does  not use  program source files  directly.   Instead, it
          reads them,  parses the  data and stores  them in  project files.
          These files usually have a  ".JRF" extension.  For instance, JORF
          is  distributed, the project file TUTORIAL.JRF contains all class
                                            TUTORIAL.JRF
          definitions  and methods  used by the  Tutorial system.   Another
          project file,  HELP.JRF holds text  screens specific to  the help
                         HELP.JRF
          system.   These files  may be erased  when you are  done with the
          tutorial  without  affecting  the functionality  of  the  program
          editing system.

          While the interpreter runs, it creates a temporary project called
          SWAPFILE.JRF that holds items flushed  out of memory.  The system
          SWAPFILE.JRF
          automatically erases this file when you finish.  If your computer
          locks  up or is  reset while running  JORF, the next  CHKDSK will
          uncover this file and give it  a different name.  Just erase  it,
          the  swap  file  is  only  valid  for  the  current  run  of  the
          interpreter.






          The JORF Manual (Disk Version)                                 18














                                  The JORF Debugger

          The source  level debugger is  a JORF language program  that lets
          you watch  your program  run, examine variable  values, and  edit
          methods on-the-fly.   Most  debuggers just let  you look  at your
          program run, but JORF lets you  change it as it goes along.   The
          JORF Debugger  is  a true  source  level debugger,  that  doesn't
          revert to ugly assembler or hexadecimal notation.  

                                Starting the Debugger
                                Starting the Debugger

          To start  the debugger, press Ctrl-Break at any time.  (Hold down
                                        Ctrl-Break
          the control key, while hitting the Break key.  On an XT keyboard,
                                             Break
          the break key may be labeled Scroll Lock Break or Scroll Lock and
                                       Scroll Lock Break    Scroll Lock
          is  usually located next  to the  Num Lock  key above  the number
                                            Num Lock
          pad.)  On an AT keyboard, it is also labeled Pause.  The debugger
                                                       Pause
          uses  a  second screen  and  automatically swaps  just  like T.V.
          football  where they  switch  between  the  commentator  and  the
          action.   The debugger  has a series  of options to  allow you to
          edit the program,  examine the stack, or trace  through the code.
          Break points are set using the edit function. 

          The debugger is menu driven,  and the menu remembers whatever you
          last chose.  So if you were last in Trace mode, then the debugger
          starts back in trace mode.  Trace  mode goes from line to line as
                                      Trace  mode
          the  interpreter runs  them.   To trace  into a  particular line,
          choose Do Line.   To step over a  line that may contain a  method
                 Do Line
          call, choose  Next Line.  You also can  view the Other Screen and
                        Next Line                          Other Screen
          the view stack using Show Stack.   Pressing Escape is the same as
                               Show Stack
          Continue, which exits the debugger.
          Continue

          Break points are  set using the  editor.  To  set a break  point,
          Break points
          position the cursor on  a line, and press  F2.  The line  will be
                                                     F2
          highlighted.  If the breakpoint  is already set, then it  will be
          released.  After a break point is set, you can exit the debugger.
          When that line is encountered,  the debugger will started just as
          if you hit Ctrl-Break on that line.
                     Ctrl-Break

                            So how come a toy programming
                        language has a source level debugger?

          While most languages  have external debuggers added  on, the JORF
          language  is designed to  have one integrated  into the language.
          JORF internal functions are aware  of the debugger, like the line
          input  command   that   automatically   checks   and   highlights
          breakpoints and stack pointer positions.  

          Each  JORF program stack  level is a  JORF structure.   The first
          element has  the class  Method  and is  the current  line of  the
                                  Method
          current method.   If this  element is changed, the  program stack
          pointer is changed.   This is what allows the debugger to Back Up
                                                                    Back Up
          the current line pointer.  The  second element has the class From
                                                                       From

          Chapter Three - The JORF Data Type                             19














          and  is the  previous stack  level.   The  next elements  are the
          parameters  that  were  passed  to  the stack,  and  finally  any
          temporary values  of the stack.   If  you examine the  Show Stack
                                                                 Show Stack
          method  of the  debugger, you  will quickly  see that  the stack,
          class  definitions, and structures are  all stored using the same
          internal mechanism.

          Someday,  someone important  will realize how  really nice  it is
          that a simple programming  language allows such twisty access  to
          its own operating parameters.  Not only can JORF methods read and
          write themselves, they can examine and change their own stack and
          calling parameters.   Although Smalltalk  can come close  to this
          ability,  to program Smalltalk on the multiple processor level is
          quite  complicated.   The JORF  Language  is so  simple that  the
          entire debugger takes less than 25K of Source Code!

                                Using The JORF Editor

          The JORF Editor is contained within  the debugger and you can use
          the options to Add Method, Edit Method, and Method Browse to edit
                         Add Method  Edit Method      Method Browse
          a method.   Whenever you are in the editor, you  can press F10 to
          get available  keystrokes,  and  Alt-F10  to  get  help  for  the
          Debugger Alt keys.   Remember the  Alt keys!   They allow you  to
                               Remember the  Alt keys!
          browse  and call up another method, even  as you edit the current
          one.  When you get used to debugging from a live  editing screen,
          and  editing  in   a  live  debugger,  you  will   find  the  old
          Edit-Compile-Link-Debug sequence has two steps too many.
          Edit-Compile-Link-Debug

          The editor uses both WordStar(R) and WordPerfect(R) editing keys.
          The WordStar  keys are all  control sequences that are  known and
          loved by programmers  and hated by everyone else.   The advantage
          of WordStar  keys is  that you  can move  the cursor  and do  all
          editing  without moving  your  hands  from the  home  row in  the
          keyboard.

          WordPerfect keys simply  do the functions that are  marked on the
          IBM  PC keyboard.   (Up arrow for  Up, PgDn for  Page Down, etc.)
          Although this seems more intuitive, WordPerfect  keys tend to get
          rather obscure  for functions that  are not clearly  marked, like
          Home-PgUp  for "Top of  Form", and Control-Right  arrow for "next
          word".   Anyway,  these  keys  are sufficient  to  type and  edit
          methods which is why we are here.

          To test this out, try adding the  following method.  It is really
          a repeat of the first program  in the Tutorial, but it will  give
          you some experience adding a new method to the system.   From the
          DOS prompt, start  JORF.  When prompted for a  project name, type
          Test.   When at  the Debugger Menu, select Add Method and add the
          Test                                       Add Method
          following text:




          The JORF Manual (Disk Version)                                 20














                              Test:Start
                                Msg:Add 
                                   Hello <Your Name>! 
                                   Welcome to JORF
                                Return 

          Fill your name where is says <Your Name>.  Finish the  new method
                                       <Your Name>
          and run it by pressing F9 on the debugger menu.  When the program
                                 F9
          is done, you will be returned to the debugger.
                                     Edit Methods

          The  Edit  Method  menu  option  lets you  edit  the  top  method
               Edit  Method
          currently being displayed.  Editing a method is just  the same as
          adding it.  Simply make your changes  and when you are done, exit
          and save the method.  Your changes take effect immediately.

                                     The Browser

          The Browser is  a really neat way  of finding a method  even when
          you don't know the name.  It works by displaying a browse list of
          available classes, and when you  select a class, it lists methods
          for that class.  Note that these browse menus scroll, so  be sure
          to  use the page down key  to see all the  elements.  The browser
          system must build each list the  first time you see it, but  this
          is not repeated.

                               Using an Outside Editor

          To use an  outside editor, you must  write the source code  as an
          ASCII file, edit it, and the reload it appropriate .JRF file.  To
          write the source code, use Alt-W or the Write Classes option from
                                     Alt-W        Write Classes
          the Debugger menu.  

          When  you exit  from JORF, you  will find the  source file nicely
          waiting on your JORF  directory.  The file  names will have  ".J"
          extensions.  So the Haiku class  will be in "HAIKU.J".  When  you
                              Haiku
          return to  the interpreter  and start  the file,  the interpreter
          will see that  the time has changed  on the file and  will reload
          it.

                          Translating JORF Language Programs
           
          The JORF to C language translator is in the JORF.EXE interpreter.
           There is  a button option  to create stand-alone files,  and you
          can also translate using the command line option /T.  
                    JORF /THAIKU        | Creates Haiku.C
                    JORF /THAIKU

          Translated programs that are to  be library files needs a C  flag
                                                                    C
          set,  and  another delimiter  so  that  the  flags and  name  are
          separated.  "C" was chosen because most C compilers use this flag
          to indicate a library compile. 


          Chapter Three - The JORF Data Type                             21














                    JORF /TC/DEBUGGER
                    JORF /TC/DEBUGGER

          If you  compile a small  JORF language program, the  finished EXE
          file will still be quite  large.  The Hello.J file that  displays
          one window compiles to be a 240K exe file.  Most of this overhead
          is  used by  the  interpreter and  JORF  stack functions,  screen
          handling system,  file handling  and caching  system, and  editor
          support functions.   To put this  another way, the JORF kernel is
          about 230K, and small programs add only marginally to this.  

                                       Indexes

          The  JORF language  features  automatic  indexing  based  on  the
          structure  definition, and also features  a rule based system you
          can use to create forward  and backward chaining indexes required
          by expert system applications

          The easiest way to index records is to use the Index  key word in
                                                         Index
          a structure  definition. The JORF interpreter  will automatically
          add,  delete  and  change the  indexes  whenever  you change  the
          fields.   This allows you to  write complete applications without
          any other reference to indexes.    The following class definition
          has three automatic indexes:

               Class:Address
                 Index:Name
                 Addr1
                 Addr2
                 Index:City
                 State
                 Index:Zip

          The three indexes will be Name, City, and Zip.  The three indexes
                                    Name  City      Zip
          are maintained  in the same file as the address, so no additional
          files  are  needed.    Indexes  in the  JORF  language  are  case
          insensitive, so upper and lower case do not matter.  When defined
          in a structure like this,  indexes are automatically updated when
          the  record  is saved.      No entry  is  made  for an  index  is
          completely blank.

          Although you  cannot define a  multiple field index, you  can use
          JORF commands to  put multiple field values into  a special index
          field.    By indexing on this  composite field, you get  the same
          effect as if you had a true multiple field index.

          There is  currently a  limit of 20  significant characters  for a
          structure  definition index.    If  two  records  have  identical
          indexes  for the  first 20  characters,  but differ  in the  21st
          character, they may appear in the wrong order.  

          For  a  detailed  example  of  structure  indexes,  look  at  the
          CONTACT.J  sample file.   This  file uses  five indexes  to store

          The JORF Manual (Disk Version)                                 22














          contacts by first name, last name,  company name, work phone, and
          zip code.   


                           Object-Attribute-Value Triplets

          JORF also contains  indexes are based on a MYCIN style rule based
          system.  MYCIN was an  expert system research project at Stanford
          University  in  the 1970s.   One  result of  the project  was the
          codification  of   a  generalized   format  for   logic  oriented
          knowledge.        Logical    statements     are    parsed    into
          Object-Attribute-Value triplets, that can be used for forward and
          backward  rule chaining.   The Object-Attribute-Value  Triplet is
          the basis of all JORF index operations.

          The names "Object",  "Attribute", and "Value" are  meaningless in
          JORF.  Originally they had various meanings, but in JORF they are
          simply  a way  to avoid  saying "Thingy  One", "Thingy  Two", and
          "Thingy Three".  It is unfortunate that the Rule "Object" and the
          OOP "Object" are different things.  This comes from combining two
          different  technologies in  one product,  and I  don't see  a way
          around it.

          The effectiveness of an  index system is based  on the number  of
          partial  key  searches  that  can  be  performed, and  how  those
          searches  can  be  used.    The  OAV  Rule  system  allows  great
          flexibility in partial key searches.

          The    JORF    "Triplet"    actually   has    more    than   just
          Object-Attribute-Value.   The complete Rule also includes a Type,
          a Probability, and a Pointer.

                 Type         | A Number       Indicates Type
                 Obj          | JORF Pointer   Object 
                 Att          | JORF Pointer   Attribute
                 Prob         | A Number    For AI Probability Calculations
                 Val          | JORF Pointer   Value
                 Ptr          | JORF Pointer   A Pointer to Data

          The Type is  a number between 1  and 120 that indicates  an index
          type.  Using one index  files for different purposes creates data
          conflicts.   This  Type  indicator  allows  rules  for  different
          purposes  to be kept separate to  avoid any conflicts.  Types 121
          through 127 are used internally by JORF, and the eighth bit (128-
          255) is automatically added to String Keys.

          The  Object,  Attribute,  Value  and  Pointer,  are  simply  JORF
          pointers.  They may be integers, floating point numbers, strings,
          or blocks  of text.  JORF Pointers  that are integers, or strings
          less than 8 bytes long  are stored in ascending sequential order.
          This is because they are stored  within the JORF pointer and  are
          entirely  held  in the  Rule.    Strings  8 characters  or  more,

          Chapter Three - The JORF Data Type                             23














          floating point numbers, and blocks  of text, must be stored  in a
          different  location,  and  the JORF  pointer  holds  a reference.
          Reference values have no particular order.  

                                     Probability

          I included  a Probability byte  in my rule structure  without any
          particular dogma on how it is used.   There are many  ways to use
          and  calculate probability  factors and  you must build  your own
          system using The JORF Language.

          The Probability  field must  be a  number from  127 to  -127.   I
          suggest that you only  use a factor between 1 and 100, indicating
          a percent.   Probability can be searched by using  full values in
          the  Type, Object and  Attribute fields, and  leaving Probability
          and Value blank.  The  system will return the Highest probability
                                                        Highest
          entry with the  matching fields, and if looping  through the next
          function, the next lower probability will be found.  

          You cannot search  for a full  rule with  the Probability set  to
          zero.   However, you can  search for a partial,  and then compare
          Value to  obtain a  full key with  a partial  probability.   This
          technique is outlined in the next section String Keys.
                                                    String Keys

          Generally, I always set a probability of 100 to indicate 100%.  I
          assume that people  who wish to use probability  factors will set
          up their own system for searching and calculating these factors.

                                     String Keys

          Partial strings can be searched,  if they are seven characters or
          less.  Often, Keys that need partial string searches  have one or
          more element that is a string truncated to the seventh character.
          To retain  the integrity  of the  item, the full  string is  also
          stored, thus wasting an element of the rule.  

          One alternative is to use the String Key system.  This  is simply
                                        String Key
          an adaptation of the Rule system where the Attribute, Probability
          and Value is replaced by String. 

                 Type         | A Number      Indicates Type
                 Obj          | JORF Pointer  Object 
                 Str          | A String      Value 
                 Ptr          | JORF Pointer  A Pointer to Data

          The Type is still a number between 1 and 120. (JORF automatically
          adds  the  eight bit  to  differentiate String  Keys  from normal
          Rules.)   The  String  element is  automatically truncated  at 21
          characters.  Key searches are useless beyond these lengths.




          The JORF Manual (Disk Version)                                 24














          Now before you howl about your databases that have names that are
          thirty characters or longer that  must be indexed, let me explain
          how to get around the seeming rigidity of this structure.

          Say  you have  an address  database with  a class  structure like
          this:

                      Class:Address Name Address City State Zip

          And you  need to index  the records to  allow searching  by Name.
          Saving the Rule is quite straight forward:

                    Address:Save (Address)
                      New Rule:Rule
                      Rule->Type = 1
                      Rule->Obj = "My DataBase"
                      Rule->Str = Address->Name
                      Rule->Ptr = Address
                      Rule:Add (Rule)

          The problem  is getting the  data back.   The solution is  to not
          only  search for the  String value, but  to check it  against the
          value  in the  database, and go  next through the  file until the
          right one is found:

                    Address:Find (Name)
                      New Rule:Rule Address:Address
                      Rule->Type = 1
                      Rule->Obj = "My DataBase"
                      Rule->Str = Name
                      Rule:Find (Rule)
                      While (Rule->Fnd)
                        If (Rule->Str=Name)
                           | Found it!
                           Return (Rule:Ptr)
                        | Otherwise, try next one
                        Rule:Next (Rule)

          One feature that  is built in the Next Rule system is the ability
          to look for a change in the key being searched.  If the next Rule
          does not match the key length  of the original, then Rule->Fnd is
                                                               Rule->Fnd
          will be set to False.  











          Chapter Three - The JORF Data Type                             25


































                                    Chapter Four 


                                      JORF Math

          Many Object  Oriented Languages  treat math  operators as  Method
          Calls.   This is really  cute when you  use "+" to  concatenate a
          structures, and "=" to assign them.  However, this is not easy to
          implement  and leads  to a  host of  problems.  For  instance, to
          implement  "+", you  have  to create  a  language syntax  between
                                                                    between
          operators.    This is  the  reason  Smalltalk  program lines  are
          scrambled, and C++ has an involved "Friend" system. 

          When  this is all done, it is hard  to figure out how to handle a
          "+" between different types  of objects.  You can create a method
          for Dog + Dog, but what about Dog + Penguin?  Is that a Doguin or
              Dog + Dog                 Dog + Penguin             Doguin
          a Pog?  And you have slowed down all regular math processing just
            Pog
          to implement this difficult to use feature.

          For about two months, JORF used  this math technique.  But  there
          were  so many  kludges to  make the  syntax work,  keep order  of
          operations,  and enhance  speed that  the entire  system was  not
          simple  and intuitive.   So, I dumped  the concept and  went to a
          stack  oriented math  system like  that  in BASIC,  PASCAL and  C
          language.  

          The  JORF  system  solves math  operations  automatically  as the
          programming line is executed.  The line is executed from Right to
                                                                   Right to
          Left (the opposite of how you read).  As each Method  or Function
          Left
          is called, any adjacent Math expressions are completed.



          The JORF Manual (Disk Version)                                 26














               Win:Add  (To:Caps(Title),  LastRow+2,  LastColumn+5,  0,  0,
          Here)

          JORF  first performs Here.   Then it  reads the line  back to the
                               Here
          To:Caps function.   Before performing it,  it evaluates the  math
          To:Caps
          expressions LastRow+2  and  LastColumn+5  even  though  they  are
                      LastRow+2       LastColumn+5
          unrelated to  To:Caps.   Until JORF calls  a function  it doesn't
                        To:Caps
          know how many parameters that function takes.  To:Caps Title will
                                                         To:Caps Title
          return the contents of  Title capitalized.  Finally, the  Win:Add
                                                                    Win:Add
          function is called. 

                                 Order of Operations

          Mathematic  operations are handled in  the following order.  This
          is essentially the same as the C language:

                    ->                  Pointer References
                    []                  Array References
                    - ! ~ ++ --         Unary operations
                    * / %               Multiplication
                    + -                 Addition
                    < > <= >=           Evaluation
                    == !=               Equality
                    & ^ ?               Bitwise operators
                    && ?? And Or        Logical AND and OR
                    =                   Assignment



























          Chapter Four - JORF Math                                       27
















                               Math Functions Reference


                                     Addition (+)



          Symbol    +

          Purpose   Add numbers, concatenate strings. 

          Notes     The  plus sign adds numbers  if both sides are numbers,
                    and if one  or both operands are strings  then they are
                    concatenated.    Although it would make sense, multiple
                    line Texts are not concatenated, and are handle only as
                    the current line of  text.  Also structures and  arrays
                    are not concatenated.

          Examples
                    1 + 5 = 6
                    2 + 78.8 = 80.8
                    5 + "A"  = 5A
                    To:Str(3) + To:Str(3) = "33"
                    65535 + 1 = 65536


                                    Assignment (=)



          Symbol    =

          Purpose   Assign a value to a variable. 

          Notes     Assigns  the value  of the  right operand  to the  left
                    operand.  Usually, only  the value is assigned  and not
                    the  class.  If the destination  has no declared class,
                    and  the source does, the destination will take on both
                    the class and value of the source.  

                    Assignment  may  be  made  to  structure  elements  and
                    arrays.    You  cannot assign  "To"  a  constant value.
                    Single data items are assigned by value, but structures
                    and text are assigned by reference.

          Examples

          A = 6                         | A is now equal to 6
          Addr->Addr1="2343 Main Street"  | Sets the Addr1 element of Addr
          Addr[4] = Addr                | Sets the fourth array element

          The JORF Manual (Disk Version)                                 28














          "Three" = 2                   | Nonsense!  Three is a constant
          Three = 2                     | If three is a variable, O.K.



                                   Bitwise AND (&)



          Symbol    &

          Purpose   AND the bits of two integers. 

          Notes     You  have to  be into  Bitwise arithmetic  to  use this
                    command.   And you have  to understand how  numbers are
                    handled in  hexadecimal.   Basically,  two numbers  are
                    tested bit by bit to see if the same bit is set.  If it
                    is, then  it remains  in the  result.   If  not, it  is
                    eliminated from the result.

                    A common  use of  this command is  to test  whether two
                    logical  values are true.   For this  test, I recommend
                    using the Logical AND, and not the Bitwise AND.

                    Floating  point  numbers  are  converted  to  integers.
                    Strings  like "55" are converted to their numeric value
                    before testing.

          Examples
                    4 & 7 = 4      | Binary   0100 Anded to 0111 is 0100
                    9 & 7 = 1      | Binary   1001 Anded to 0111 is 0001



                                    Bitwise OR (?)



          Symbol    ?

          Purpose   OR the bits of two integers.

          Notes     Ok, I assume  by now you are sadistic  and like working
                    with bits.  You  should use the  Logical OR if you  are
                    testing logical  values (True/False).   Floating  point
                    numbers are converted  to integers.  Strings  like "55"
                    are converted to their numeric value before testing.

                    While most math symbols are  from the C language, the |
                    symbol  is used  to demark  comments in  JORF.   So the
                    question mark ? is used for "Or".


          Chapter Four - JORF Math                                       29














          Examples
                    4 ? 7 = 7      | Binary   0100 Ored to 0111 is 0111
                    9 ? 7 = 15     | Binary   1001 Ored to 0111 is 1111



                                   Bitwise XOR (^)



          Symbol    ^

          Purpose   Exclusive OR of two integer values. 

          Notes     The uses of  XOR are specialized, and you  know who you
                    are.  Bits  are set here if  they are set in  Either of
                    the source operands, but not both.

                    Oddly, Exclusive OR is commonly used for bitmap images.
                    When you  XOR an  image once it  is displayed,  and the
                    second time  erases it.   Other than  in graphics,  and
                    deep CPU  processes, I  have not seen  XOR used  in any
                    "Real" programming.  

                    I am  a consistency buff, and  since I gave you  AND, I
                    have to give you OR and XOR.  That is all.

          Examples
                    4 ^ 7 = 3      | Binary   0100 Xored to 0111 is 0011
                    9 ^ 7 = 14     | Binary   1001 Xored to 0111 is 1110



                                    Decrement (--)



          Symbol    --

          Purpose   Subtract one from a number. 

          Notes     It  is a  common  operation in  programs  to have  loop
                    counters  that count up by one,  or down by one.  These
                    are so common in assembler that there are real assembly
                    instructions to do just these operations.  

                    I'm afraid the JORF Translate and compile system is not
                    efficient  enough to compile to the assembler decrement
                    instruction, but  it  is still  a  good concept  and  a
                    logical part of the language.



          The JORF Manual (Disk Version)                                 30














                    The Decrement operator must be IN FRONT of the operand,
                    and  not behind  as allowed  in the  C language.   This
                    operator simply subtracts one from the operand.

          Examples
                    Num = Num - 1            | Normal Decrementing
                    --Num                    | But -- is shorter, easier.

                    Decr:Start
                      New Num
                      Win:Add ("Showing Decrement", 4,4,12,30, Here)
                      Num = 10
                      While (Num > 0)             | Loop until zero
                        Str:PutLine("Number = " + Num) | Put 'Number = 10'
                        --Num
                      Str:PutLine ("Done")
                      Win:Pause
                      Return


                                     Division (/)



          Symbol    /

          Purpose   Divide two numbers. 

          Notes     You remember how  to do long division don't  you?  Well
                    the computer does, and this is what you need to do it.

                    The JORF language  is unusual in that it  does the type
                    conversions necessary when division yields a fractional
                    result.   Most languages truncate the result of integer
                    division.   You should be especially careful when using
                    division to  calculate  screen  position,  because  the
                    fractional  result is  not the  same  as the  truncated
                    result:

                         Move:To (2, (30-Str:Len "Hi Jo")/2)  
                    becomes  Move:To (2, (30-5)/2)  
                    becomes  Move:To (2, 25/2)
                    becomes  Move:To (2, 12.5)
                    becomes  Move:To (2, 13)
                    Not  Move:To (2, 12)     as it would in C or Pascal.

          Examples
                    12 / 2 = 5
                    60000 / 100 = 600
                    12.5 / .5 = 25



          Chapter Four - JORF Math                                       31















                                  Equality (= or ==)



          Symbol    = or ==

          Purpose   Check to see if two numbers, strings or structures  are
                    equal.  Checks text only  for the current line, not the
                    whole text. 

          Notes     Returns TRUE if the left  operand is equal to the right
                    operand.  

                    When I  was a BASIC  programmer, I could  never discern
                    the  difference  between  checking  for  Equality,  and
                    assigning a value.  To me, the both were "Equals".  

                    The C  language not only  warns of this  ambiguity, but
                    does  not  work  correctly at  all  if  you ignore  the
                    warnings.  It does exactly what you tell it, assigns or
                    checks, and not what you want it to do.

                    So JORF treads the line.   For BASIC programmers, the =
                    sign  can be used  for both equality  checking and also
                    for   assignment.    For  C  programmers,  use  ==  for
                    equality,  and =  for assignment.   In all  examples, I
                    will use == because it is more robust.

          Examples
                    A = 1               | Assignment of 1 to A
                    If (A == 2)         | Check equality, is A equal to 2?
                      Str:PutLine ("A is 2")
                    Else
                      Str:PutLine ("A is Not 2")  | Will print this line




                                    Increment (++)



          Symbol    ++

          Purpose   Add one to a counter. 

          Notes     It  is a  common  operation in  programs  to have  loop
                    counters that  count up by one, or  down by one.  These
                    are so common in assembler that there are real assembly
                    instructions to do just these operations.  


          The JORF Manual (Disk Version)                                 32














                    I'm afraid the JORF Translate and compile system is not
                    efficient enough to compile to the  assembler decrement
                    instruction,  but it  is  still a  good  concept and  a
                    logical part of the language.

                    The Increment operator must be IN FRONT of the operand,
                    and  not behind  as allowed  in the  C language.   This
                    operator simply adds one to operand.


          Examples
                    Num = Num + 1            | Normal Decrementing
                    ++Num                    | But -- is shorter, easier.

                    Incr:Start
                      New Num
                      Win:Add ("Showing Increment", 4,4,12,30, Here)
                      Num = 0
                      While (Num < 10)            | Loop until zero
                        ++Num
                        Str:PutLine ("Number = "+Num)  | Put 'Number = 1'
                      Str:PutLine ("Done")
                      Win:Pause
                      Return


                                Inequality (!= or <>)


          Symbol    != or <>

          Purpose   Test to see if two numbers are not equal. 

          Notes     I could never decide whether I like the BASIC <> or the
                    C  language != better.  I know  that I hate the Clipper
                    ambiguity  where they are  slightly different.   So, in
                    JORF they are exactly the  same, but you can use either
                    symbol.  Since  learning C brings higher  salaries than
                    learning BASIC,  I usually use  the != (! means  Not, =
                    Means Equals; Not-Equals) in my examples.  


          Examples
                    A = 1               | Assignment of 1 to A
                    If (A != 2)         | Check equality, is A equal to 2?
                      Str:PutLine ("A is not 2")  | Will print this line







          Chapter Four - JORF Math                                       33















                                   Greater Than (>)



          Symbol    >

          Purpose   Test to  see if the  first operand is greater  than the
                    second.

          Notes     Returns True if the  First operand is greater  than the
                    second.   Type conversion  is the  same as  assignment.
                    Numbers  are  compared  numerically,  and  strings  are
                    compared as  strings.   String comparison  is not  case
                    sensitive. 

          Examples
                    1 > 5          False
                    "B" > "A"      True
                    "B" > "a"      True
                    "B" > 1        True because 1 is converted to "1"
                    "33" > 111     True because "33" is converted to 33



                            Greater Than or Equal To (>=)



          Symbol    >=

          Purpose   Test to see if the first operand is greater or equal to
                    the second.

          Notes     Returns True if  the First operand  is greater than  or
                    equal to  the second.   Type conversion is the  same as
                    assignment.    Numbers  are compared  numerically,  and
                    strings  are compared as strings.  String comparison is
                    not case sensitive. 

                    Reversing the symbols to be => has no meaning in JORF.

          Examples
                    1 >= 5         False
                    "B" >= "A"     True
                    "B" >= "b"     True
                    "B" >= 1       True because 1 is converted to "1"
                    "33" >= 33     True because "33" is converted to 33





          The JORF Manual (Disk Version)                                 34















                                    Less Than (<)



          Symbol    <

          Purpose   Test  to see  if the  first  operand is  less than  the
                    second.

          Notes     Returns  True  if the  First operand  is less  than the
                    second.   Type conversion  is the  same as  assignment.
                    Numbers  are  compared  numerically,  and  strings  are
                    compared as  strings.   String comparison  is not  case
                    sensitive. 

          Examples
                    1 < 5          True
                    "B" < "A"      False
                    "B" < "a"      False
                    "B" < 1        False because 1 is converted to "1"
                    "33" < 111     False because "33" is converted to 33



                              Less Than or Equal To (<=)



          Symbol    <=

          Purpose   Test to see if the first operand is less  than or equal
                    to the second.

          Notes     Returns True if the First operand is less than or equal
                    to  the  second.    Type  conversion  is  the  same  as
                    assignment.    Numbers  are compared  numerically,  and
                    strings  are compared as strings.  String comparison is
                    not case sensitive. 

                    Reversing  the symbol  has no  meaning  in the  current
                    version.  There is no =< operation.

          Examples
                    1 <= 5         True
                    "B" <= "A"     False
                    "B" <= "b"     True
                    "B" <= 1       False because 1 is converted to "1"
                    "33" > 111     False because "33" is converted to 33




          Chapter Four - JORF Math                                       35















                                   Logical AND (&&)



          Symbol    && or And

          Purpose   Test whether two logical values are both True. 

          Notes     An If statement uses the  Logical And to make two tests
                    at once.   Each operand may be a  test for equality, or
                    may be a  test for null.  In JORF, Null, FALSE and Zero
                    are exactly the same.

                    The word "And" may now be used as a synonym for &&.  It
                    looks better, but gives And a funny  status as kinda-a-
                    key-word.

                    The AND statement always  evaluates both sides, without
                    shortcuts as in the C language.

          Example

          AndTest:Start
            New A, B
            A = 4
            B = 2
            Win:Add ("And Test", 0, 0, 10, 60, Here)
            If (A And B)
               Str:PutLine ("Test 1, Both A and B have values")
            If (A & B)
               Str:PutLine ("Test 2, Logical And/Bitwise & are different")
            If (A < 5 And B > 4)
               Str:PutLine ("Test 3, Use And to connect compound tests")
            Win:Pause
            Return



                                 Logical NEGATION (!)



          Symbol    ! or Not

          Purpose   Test whether a logical values is not true. 

          Notes     You can reverse  a logical statement using  the logical
                    NOT.   It  is usually  more  desirable to  reverse  the
                    logical test,  especially if  mixing Not,  And and  OR.
                    Returns true if the operand is FALSE, Null or Zero.


          The JORF Manual (Disk Version)                                 36














                    The word "Not" may  now be used as a synonym for !.  It
                    looks better, but gives And a  funny status as kinda-a-
                    key-word.

          Example
                    NotTest:Start
                      New A, B
                      A = 4
                      B = 0
                      Win:Add ("Not Test", 0, 0, 10, 60, Here)
                      If (Not A)
                         Str:PutLine ("Test 1, A is not 'True'")
                      If (Not A And Not B)
                         Str:PutLine ("Test 2, Not can be ambiguous")
                      If Not (A < 5 And B < 5)
                         Str:PutLine ("Test 3, Use Not to reverse a test")
                      Win:Pause
                      Return



                                   Logical OR (??)



          Symbol    ?? or Or

          Purpose   Test whether one or the other of two logical values are
                    True. 

          Notes          An  If statement uses  the Logical Or  to make two
                         tests at  once.   Each operand may  be a  test for
                         equality, or  may be  a test for  null.   In JORF,
                         Null, FALSE and Zero are exactly the same.

                    The word "Or" may now be used as a synonym  for ??.  It
                    looks better, but gives And  a funny status as kinda-a-
                    key-word.

                    You should  be careful  mixing And and  Or in  the same
                    expression.  Doing so can make the statement ambiguous.
                    To  avoid this,  use  parentheses  so  that  each  test
                    contains just one And or one Or. 

          Example

          OrTest:Start
            New A, B, C
            A = 4
            B = 0
            C = 6
            Win:Add ("Or Test", 0, 0, 10, 60, Here)

          Chapter Four - JORF Math                                       37














            If (A Or B)
               Str:PutLine ("Test 1, One of A or B has a values")
            If (A Or B And C)
               Str:PutLine ("Test 2, Mixing can be ambiguous")
            If ((A Or B) And C)
               Str:PutLine ("Test 3, But Parentheses makes it clear")
            Win:Pause
            Return



                                     Modulus (%)



          Symbol    %

          Purpose   Return the Integer remainder of Integer division. 

          Notes     The  Modulus  operator  is  used  in  conjunction  with
                    counters to create cycles.  A cycle is a  set of values
                    that loop.  To turn a numeric counter into the cycle 0,
                    1, 2, 3,  4, 0, 1, 2, 3,  4, 0, 1, 2, 3,  4 you use the
                    modulus of 5. 

                         0 % 5 = 0   7 % 5  = 2   14 % 5 = 4
                         1 % 5 = 1   8 % 5  = 3   15 % 5 = 0
                         2 % 5 = 2   9 % 5  = 4   16 % 5 = 1
                         3 % 5 = 3 10 % 5 = 0     17 % 5 = 2
                         4 % 5 = 4 11 % 5 = 1     18 % 5 = 3
                         5 % 5 = 0 12 % 5 = 2     19 % 5 = 4
                         6 % 5 = 1 13 % 5 = 3     20 % 5 = 0

          Examples  My favorite is the use  of modulus in the ASCII.J file.
                    This program  uses modulus start a new  line every 16th
                    character. 

                    Ascii:Start 
                      New Char 
                      Win:Add("ASCII TABLE", 4, 4, 19, 74, Here) 
           
                      For (Char = 0 Thru 15) 
                        Move:To(1,(Char*4)+10) 
                        Str:Put(To:Str(Char)) 
                        Move:To(Char+3,1) 
                        Str:Put(To:Str(Char*16)) 
                
                      Move:To(2,1) 
                      Win:Attr("Lo") 
                      For (Char = 0 Thru 255) 
                        If (Char % 16) == 0 
                          Move:By(1,0) 

          The JORF Manual (Disk Version)                                 38














                          Move:To(0,10) 
                        Char:Put(Char) 
                        Move:By(0,3) 
                      Win:Msg("Press Enter to Continue") 
                      Win:Pause 
                    Return



                                  Multiplication (*)


          Symbol    *

          Purpose   Multiply numbers. 

          Notes          Two  numbers are multiplied.   If the  numbers are
                         integers, and  the result is very large, it may be
                         converted  to floating  point.   Multiplication of
                         floating  point numbers  can result in  an integer
                         result. 

          Examples
                    20 * 55.5 = 1110
                    22.4 * 4  = 89.2 


                                     Negation (-)



          Symbol    -

          Purpose   Negates a number. 

          Notes          Unary negation is done by preceding any expression
                         with a minus sign.  This symbol negates the value.
                          Parentheses  are recommended  to avoid  ambiguity
                         with the subtraction operation.

                    The most common  use is to pass a negative  number to a
                    function.  Negative numbers.  

          Examples  The Windows program  displays a few windows.   Positive
                    Row and  Column positions are offsets from the top left
                    corner.   Negative Row and Column positions are offsets
                    from  the  bottom right  corner. No  matter how  big or
                    small the  screen, these boxes  will be  placed in  the
                    same relative positions.

                    Windows:Start 
                      Win:Add ("Big", 2, 2, -2, -2) 

          Chapter Four - JORF Math                                       39














                      Win:Add ("Top Right", 3, 3, 3, 15) 
                      Win:Add ("Bottom Right",-3, 3, 3, 15) 
                      Win:Add ("Bottom Left", -3, -3, 3, 15) 
                      Win:Add ("Top Left", 3, -3, 3, 15) 
                      Win:Add ("Tall", 3, 45, -4, 10) 
                      Win:Add ("Wide", 10, 3, 3, -4) 
                      Win:Pause 
                      Return Ok



                                 One's Complement (~)

          Symbol    ~

          Purpose   Turn all on-bits off, and off-bits on. 

          Notes          This is the  last of the Bit  Twiddling functions,
                         that goes with  the other bitwise functions.   The
                         use for this symbol is to  create a negative mask,
                         used to  unset a  bit.  In  a high  level language
                         like JORF, this use is not common.

                    Floating  point  numbers  are  converted  to  integers.
                    Strings  like "55" are converted to their numeric value
                    before testing.

          Examples

               7              | Binary   0111
               ~7             | Binary   1000
               14 &~ 4 = 10        | Binary   1110 Anded to 1011 is 1010
               9 &~ 7 = 1          | Binary   1001 Anded to 1000 is 1000


                                   Subtraction (-)



          Symbol    -

          Purpose   Subtract two numbers. 

          Notes          The  plus  sign  adds numbers  if  both  sides are
                         numbers, and if  one or both operands  are strings
                         then  they are concatenated.    Although  it would
                         make   sense,   multiple   line   Texts  are   not
                         concatenated, and are  handle only as  the current
                         line  of text.  Also structures and arrays are not
                         concatenated.

          Examples

          The JORF Manual (Disk Version)                                 40














                         1 - 5 = -4
                         78.8 - 2 = 76.8
                         65536 - 1 = 65535


















































          Chapter Four - JORF Math                                       41




































                                    Chapter Five 


                               Window Manager Reference

          The biggest change in Version 2.0 of JORF was the introduction of
          a  Window Management  system for  handling pull  down and  pop up
          menus,  hypertext prompts, radio  buttons, check boxes,  and data
          entry fields.

          Like  many other  features  in  the JORF  language,  there is  no
          prototype for  the syntax of  this system in any  other language.
          Instead, it  has been  born out  of six  months of evolution  and
          development.  Even as it is  now released, this system is subject
          to change.

          The  impetus for this system is simple.  The sample programs that
          had any real data entry were much to large to be  viable programs
          for novices.  And even experts should resent the time it takes in
          any  language to do a redundant task like handle a menu or a data
          entry prompt.   The addition of more complex  menu types, buttons
          and  check boxes  in Microsoft Windows  only serve  to complicate
          this task. 

          The JORF window management system is  handled entirely within the
          Win:Add  function.   The  syntax of  the  JORF window  management
          system uses  one command line for each  data entry feature on the
          screen.   Command lines start  with a command  word and a  quoted
          prompt string.   Various values can be added on the same line, or
          on indented  lines  below the  command.   Different commands  use

          The JORF Manual (Disk Version)                                 42














          different  values.    Data  entry  will be  in the  order  of the
          command lines. 

               Event:Add ("EditKey")
               Win:Add ("Title", Row, Col, Len, Wid, Level)
                 Command:"Prompt", Option:"value", Option:"value"
                   Option:"More Values can be Indented"
                   Option:"For as many lines as necessary"
                 Command:"Prompt", Option:"value", Option:"value"
                 Command:"Prompt", Option:"value", Option:"value"
                 You can also place a text paragraph at the bottom.  The 
                 system looks for the keyword and colon (:) character and
                 if they are absent will print the rest of the indented
                 screen definition as a text paragraph.

                 You can embed commands within text by enclosing some
                 commands in {Command:"Curly brackets, Option:"value"}.
                 This can be used for hypertext prompts and buttons that
                 are embedded in the text.
               Return

          You can  see in the above example, there  are a number of complex
          rules for declaring comments.  

               Indented Text is subordinate to the Win:Add  command.  There
               Indented Text
               can be  additional indentations,  but the  window definition
               ends  at the  end of  the  function or  the next  unindented
               command. 

               The Command section is always  the first section in a window
                   Command section
               definition.  It continues as long as there is a Colon in the
                                                               Colon
               first expression  of the line.   If the expression  is not a
               valid command word an error is displayed.

               The Text Section begins  on the first line where there is No
                   Text Section                                          No
               Colon.   Some commands, notably  the Prompt command  that is
               Colon
               used for hypertext,  can be included in the  text section if
               it is surrounded by Curly Brackets.
                                   Curly Brackets

          Commands   are  denoted  with  colon  characters,  but  they  are
          unrelated  to class  definitions  found  elsewhere  in  the  JORF
          language.  After months of experimentation with other characters,
          it  was decided that you are  probably used to seeing colons, and
          they  maintain a  normal "look"  in this  language.   Prompts and
          commands are handled as JORF language values.  They are quoted if
          they are  strings, but  not if  they are  numeric.   If they  are
          unquoted, they are assumed to be stack values.

          The following is a summary of command values:

               Array:""            An array pick list
               Button:"Prompt"          A button

          Chapter Five - Window Manager Reference                        43














               ChBox:"Prompt"      A check box
               Group:"Prompt"           A group box (single line box)
               Input:"Prompt"           A data entry field
               List:""                  A record pick list
               Menu:"Prompt"            A menu bar option 
               MLine:"Prompt"      A menu line option
               Prompt:"Prompt"          A hypertext prompt
               Radio:"Prompt"           A radio button
               String:"String to Display"    A string (no data entry)
               Text:""                  A data entry field 

          Keystroke handling is  done by a combination of  event system and
          automatic  commands.  Every keystroke is first passed through the
          even handling  system.   There is an  event class  called EditKey
                                                                    EditKey
          built into the interpreter that is the default  key handler.  For
          your window to  operate properly, you must set  the Editkey class
                                                              Editkey
          using the Event:Add command.
                    Event:Add

                    Event:Add ("EditKey")

          This  handler takes  care  of all  letters  and numbers,  handles
          WordStar style control key  functions, handles WordPerfect  style
          Home, End  and Page keys, and  handles Arrow Keys.   This handler
          also calls  Jorf:Help when  you hit F1,  and finishes  the screen
          when you hit F10.  Finally, the handler passes all Alt  keys back
                                                             Alt
          to JORF so they can be handled automatically. 

          You can create  a substitute handler for  some or all keys.   The
          advantage of the  Event handling system is that you can layer key
          definitions,  allowing you  to  change defaults  for  a few  keys
          without having  to redefine an  entirely new handler.   You might
          make a handler that makes the F7  key save the screen, instead of
          F10.  To  use it  you simply create  a new class  and define  the
          routines. 

          MyKeys:F7_Key
            Return (EditKey:FinishEdit ("Save"))| Execute Finish and Return

          MyKeys:F10_Key
            Return ('F10_Key')          | Block F10 from further processing

          The first  method does  what F10 would  normally do,  execute the
          FinishEdit  function  to  save  the data.    (The  alternative is
          FinishEdit "Quit" which is called by the Escape key.)  The second
          method  simply  blocks  the  F10  key  from  further  processing.
          Keystrokes continue processing  through event methods as  long as
          they return Null, even  if they did take other actions.   As soon
          as an event returns  a value, even if it is the same value as the
          original key, event processing is completed. 




          The JORF Manual (Disk Version)                                 44














          The above definition is a  complete event class that redefines to
          keystrokes.  To use this  class, layered above the normal Editkey
          class, means you use the Event:Add function twice:
                                   Event:Add

                    Event:Add ("EditKey")    | Normal Key Processing
                    Event:Add ("MyKey") | Substitute for F7, F10
                    Win:Add ("Title", . . .)
                      ...
                    Return

          You can use this  system to trap and change any  keystroke.  This
          layering allows  you to add  new functionality to any  key, above
          what is already defined.   This is especially useful for defining
          special Function keys that do application specific functions.

          The complete EditKey class is given in source code form  with the
          JORF  Link Libraries.  Having this code gives you the source code
          you need to  create your own word processing system.  This source
          code  is written  in the  JORF  language, and  is translated  and
          compiled to the C language.  

                                Windows Function keys
                                Windows Function keys

          Handling of keystrokes  between fields conforms basically  to the
          CUA  standard supported by  Microsoft Windows.   That means there
          are pre-defined keys that you should use in  your programs.  Here
          is a list of keys built into JORF.


               Key            Function                 Who does it

               F1             Help                     You program this.
               F10            Menu Bar                 Automatic
               F3             "Save"                   Automatic (Editkey)
               Tab            Next Input or Button     Automatic (Editkey)
               Back-Tab       Previ Input or Button    Automatic
               Alt-Keys       Jump to menu/button      Automatic
               Arrow Keys     Up and Down              Automatic (Editkey)
               Enter Key on Button Executes Button     Automatic
               Enter Key on Field  Goes to next field  Automatic (Editkey)
               Space bar on radio  Toggles button      Automatic
               Escape Key          Exits Window        Automatic (Editkey)
               Ctrl-F4 Key         Exits Window        Automatic (Hotkey)
               Alt-X               Exits Application   Automatic (Hotkey)
               Alt-F4 Key          Exits Application   Automatic (Hotkey)

          Items marked "Editkey" and  "Hotkey" have methods in  the editkey
          and hotkey  classes.  You  can create another  keystroke handling
          class that  redefines these  keys.  Those  labeled Automatic  are
          hard-coded in  the  system  and you  cannot  change them.      As
          mentioned  above, you  can use  the  event system  to change  the


          Chapter Five - Window Manager Reference                        45














          actions of  these keys to conform  to the standard,  or to create
          your own system.



                                   Windows Alt Keys
                                   Windows Alt Keys

          You can include  an ampersand (&) character within  any prompt to
          create an Alt key  accelerator.  In the JORF language,  these are
          handled automatically  by the  window management  system.   Under
          DOS, Alt keys  are highlighted, and in Windows  programs they are
          underlined when in menus, and highlighted when in screens. 

          Windows programmers may  note that under  windows, JORF uses  the
          Windows menu handling system.  However, the dialog box system was
          not flexible  enough to match to the  DOS system, so JORF handles
          data  entry  fields  without using  the  Default  windows system.
          Radio  Buttons and  Check boxes  are  a weird  hybrid, where  the
          buttons are  defined as  child windows, but  the prompts  and Alt
          keys are handled entirely by JORF and not by Windows. 

          In  addition  to  highlighted prompts,  you  can  create keyboard
          Accelerators.  These  are simply extra keystroke prompts in menus
          Accelerators
          that  perform  functions  without  invoking the  menu.    In  the
          debugger, most of the debugger commands have accelerators like F8
          to step to the next line, instead  of Alt-D, Alt-S that you would
                                                Alt-D  Alt-S
          have to use to invoke the menu option. 

          To  define an  accelerator,  you  must use  a  key handler  class
          layered above the normal Editkey  class.  For the debugger, there
          is a debugger  class that contains a Debugger:F8_Key  method just
                                               Debugger:F8_Key
          for handling  the "Step" option.   To define an  accelerator in a
          menu, you must have  at least two  spaces between the prompt  and
          the notation for the accelerator  and you should right align your
          accelerator prompts by hand.  

                          Alt Keys within Data Entry Windows
                          Alt Keys within Data Entry Windows

          You can  highlight Alt  key prompts for  every data  entry field,
                             Alt
          group  box, or radio  button on a  screen.   As a person  who has
          designed such  screens  for  almost 10  years,  this  ability  is
          provides greatest ease of access I have ever experienced.  

          Any screen that grows larger than 8 prompts gets to be  a pain to
          change.  Most programs start your cursor on the top, and you have
          to arrow down through  the fields to get  to the one you  want to
          change.   In  the last  two years,  I have  done some  contracted
          modifications  to a program  that has more than  18 fields on the
          first screen, and  the most common  to change are often  the last
          seven.   Every time an  operator needs to  change this one field,
          they must press the down arrow at least 10 times!


          The JORF Manual (Disk Version)                                 46














          If you  use your  Alt keys  and group  boxes, you  can make  this
                            Alt
          cursor  movement unnecessary.   Pressing Alt and  the highlighted
                                                   Alt
          letter  of an  input prompt  will bring  you immediately  to that
          prompt.  If there are too many prompts,  group similar ones using
          group boxes that  themselves have a highlighted letter.   You can
          see an example of that in the contact manager program CONTACT.J



                                        Array


          Command   Array:""

          Purpose   A pick list of array elements.  

          Options   Row:10         Set Row
                    Col:10         Set Column
                    Wid:10         Set Width of List
                    Len:3          Set Length of List
                    After:"Expr"   Expression is executed after list.. 
                    Before:"Expr"  Expression is executed.  If false cannot
                                   pick from list. 
                    Field:"Fldname"     Command to execute for Next Record
                    Choice:"Field" Command to execute for Prev Record

          Defaults  Row       One row  below  previous  command.    If  the
                              previous command is  a Group  Box, then  Row,
                              Col,  Wid  and  Len  default  to  the  inside
                              dimensions of the box.
                    Col       Same column as previous command.
                    Wid       30
                    Len       1

          Highlight Arrays  are highlighted  like  menus.    No  cursor  is
                    displayed, even when the array has focus.

          See Also  List.

          Notes     This  command works  like List,  but  operates only  on
                    arrays and is  much faster.  The fact that  it works on
                    arrays limits  the size of  the data you can  edit, but
                    this is a good vehicle for pick lists up  to a thousand
                    elements.  

          Example   See the File Open routine in CONTACT.J
                                                 CONTACT.J







          Chapter Five - Window Manager Reference                        47















                                        ChBox



          Command   ChBox:"&Prompt"

          Purpose   A Check Box.  

          Options   Row:10         Set row.
                    Col:10         Set column.
                    Wid:20         Set width of highlighted prompt.
                    Check:"Expr"   Box is checked if Expression is True.
                    Action:"Expr"  Expression  is  executed   when  box  is
          selected. 
                    Before:"Expr"  Expression  is  executed. If  false  box
                                   cannot be selected.

          Defaults  Row       One row below previous command.
                    Col       Same column as previous command.  If previous
                              command as Group, column is incremented to be
                              inside of the group box.
                    Wid       Prompt width

          Highlight Prompt is highlighted  when box is selected.   Pressing
                    Enter will check the box.   Pressing the space bar will
                    advance the cursor without checking the box. 

          See Also  Radio

          Notes     Check  boxes are boxes  that contain an  X if selected,
                    and are empty if not  selected.  They are commonly used
                    for  selections that  are  cumulative.   Radio  buttons
                    should  be used when selections are mutually exclusive.


                    Default  Row is  the row  below  the previous  command.
                    Default column is the same as the pre



                                        Button



          Command   Button:"&Prompt"

          Purpose   A Button.  

          Options   Row:10         Set Row
                    Col:10         Set Column
                    Wid:10         Set Width of Button

          The JORF Manual (Disk Version)                                 48














                    Len:3          Set Length of Button
                    Action:"Expr"  Expression  is  executed   when  box  is
          selected. 
                    Before:"Expr"  Expression  is  executed. If  false  box
                                   cannot be selected.

          Defaults  Row       One row below previous command.
                    Col       Same column as previous command.  If previous
                              command as Group, column is incremented to be
                              inside of the group box.
                    Wid       Prompt width plus two spaces on each side.
                    Len       3.

          Highlight In  the  DOS   version,  the  button  is   highlighted.
                    Pressing  Enter will select  the button.   Pressing the
                    space bar will advance the cursor without selecting the
                    button.  I have not yet discovered how to highlight the
                    Windows Button. 

          Notes     Buttons are used to complete screens or to select major
                    options.   They are not  generally used for  data entry
                    purposes.  The minimum length for a button in JORF is 3
                    lines.  You cannot create "little" buttons.  



                                        Group



          Command   Group:"&Prompt"

          Purpose   A Group Box.  

          Options   Row:10         Set Row
                    Col:10         Set Column
                    Wid:40         Set Width of Box
                    Len:6          Set Length of Box

          Defaults  Row       One row below previous command.
                    Col       Same column as previous command.  If previous
                              command as Group, column is incremented to be
                              inside of the group box.

          Highlight Group  boxes can  never  be  selected,  and  are  never
                    highlighted.  If a group box has an Alt key letter, and
                                                        Alt
                    that key is pressed,  the first field within  the group
                    box is highlighted. 

          Notes     A  Group box is a single line box that surrounds one or
                    more data  entry fields.   They  are commonly  used for


          Chapter Five - Window Manager Reference                        49














                    surrounding   related  fields,   and  for   surrounding
                    multiple line text fields. 

                    A feature  of the group boxes in JORF  is to be able to
                    use an Alt key to move to the first field of the box.
                           Alt



                                        Input



          Command   Input:"&Prompt"

          Purpose   An Input Field.  

          Options   Row:10         Set Row
                    Col:10         Set Column
                    Wid:10         Set Width of Data Entry
                    Len:3          Set Length of Data Entry
                    After:"Expr"   Expression is executed after input.. 
                    Before:"Expr"  Expression is  executed. If  false input
                                   is skipped. 
                    Field:"Value"  Field Value to be entered. 

          Defaults  Row       One row below previous command.
                    Col       Same column as previous command.  If previous
                              command as Group, column is incremented to be
                              inside of the group box.
                    Wid       30
                    Len       1

          Highlight Input  fields are highlighted with attribute 4 when not
                    active, and  attribute 5  when they  are being  edited.
                    Also,  the  cursor  is displayed  when  they  are being
                    edited.  The prompt is never highlighted.

          See Also  Text.

          Notes     Input  is used to  enter single line  prompts and small
                    multi  line prompts.  Data entry fields are highlighted
                    both during entry and when displayed on the screen. 











          The JORF Manual (Disk Version)                                 50















                                         List


          Command   List:""

          Purpose   A pick list of records.  

          Options   Row:10         Set Row
                    Col:10         Set Column
                    Wid:10         Set Width of List
                    Len:3          Set Length of List
                    After:"Expr"   Expression is executed after list.. 
                    Before:"Expr"  Expression is executed.  If false cannot
                                   pick from list. 
                    Next:"Expr"    Command to execute for Next Record
                    Prev:"Expr"    Command to execute for Prev Record
                    Show:"Expr"    Command to execute to display entry


          Defaults  Row       One  row  below  previous  command.   If  the
                              previous command  is a  Group Box, then  Row,
                              Col,  Wid  and  Len  default  to  the  inside
                              dimensions of the box.
                    Col       Same column as previous command.
                    Wid       30
                    Len       1

          Highlight Lists  are highlighted  like  menus.    When  the  list
                    position is changed using the mouse or arrow  keys, the
                    screen  is automatically  redisplayed.    No cursor  is
                    displayed, even when the list has focus.

          See Also  Array.

          Notes     This has  got to be  my favorite window feature.   This
                    command   is  used  to   display  information  that  is
                    contained in different records, where an Array list can
                    only display  arrays.  Since  you control the  next and
                    prev functions, it is easy to make the list indexed, to
                    filter it, and to format the displayed text. 

                    Lists  are relatively  slow,  since  it  takes  several
                    record  reads to  display several  records.   For  this
                    reason, you should keep your lists as short as you can,
                    since this limits the number  of records required for a
                    display operation.   

          Example   See CONTACT.J, especially what happens  when you change
                        CONTACT.J
                    your index to the Zip code index.



          Chapter Five - Window Manager Reference                        51















                                         Menu



          Command   Menu:"&Prompt"

          Purpose   A Menu Bar or Menu Line.  

          Options   Action:"Expr"       Expression    to    execute    when
                                        selected. 
                      Menu:"&Prompt"    (Indented) SubMenu Options

          See Also  MLine.

          Notes     The Menu command is used  for Menu bars and  associated
                    pull  down  menu  boxes.   Each  menu  command contains
                    either  an Action, or it has indented sub-menu commands
                    below.  A menu option cannot have both.

                    The top level menu is assumed  to be a menu bar on  the
                    top of the current window.  To force top level menu  to
                    be  menu lines,  use  MLine.    All  indented  sub-menu
                    commands are menu  lines, even when declared  using the
                    Menu command. 



                                        MLine



          Command   MLine:"&Prompt"

          Purpose   A Menu Line.  

          Options   Action:"Expr"       Expression    to    execute    when
                                        selected. 
                      Menu:"&Prompt"    (Indented) SubMenu Options

          See Also  Menu.

          Notes     The  MLine command is used to  force a menu to use menu
                    lines, even  when it  is a top  level menu.   For  Menu
                    bars, use Menu. 








          The JORF Manual (Disk Version)                                 52















                                        Prompt



          Command   Prompt:"&Prompt"

          Purpose   A Highlightable Prompt.  

          Options   Row:10         Set Row
                    Col:10         Set Column
                    Wid:30         Set Width of highlight area. 
                    Action:"Expr"  Executes Expression when selected.
                    Before:"Expr"  Executes  Expression,  If  false  prompt
                                   cannot be selected.

          Defaults  Row       One row below  previous command.  If  used in
                              brackets in  text, defaults  to current  text
                              position.
                    Col       Same column as previous command.  If previous
                              command as Group, column is incremented to be
                              inside of the group box.  If used in brackets
                              in text, defaults to current text position.

          Highlight Prompts are highlighted when they are active.  Pressing
                    Enter  when   highlighted  will   select  the   prompt.
                    Pressing the space bar will move the cursor downward. 

          See Also  String.

          Notes     Prompts  are used  primarily for  Hypertext.   In  this
                    case,  they are  commonly defined  within  the text  in
                    curly   brackets.     For   prompts   that  are   never
                    highlighted, like screen subtitles or text, see String.

                    Prompts may also be aligned  in a row, producing a menu
                    bar menu  in the middle of a text  screen.  You can see
                    an example of  this usage in the opening  screen of The
                    JORF Tutorial, where the last six options are a "Prompt
                    Menu" 



                                        Radio



          Command   Radio:"&Prompt"

          Purpose   A Radio Button.  

          Options   Row:10         Set row.

          Chapter Five - Window Manager Reference                        53














                    Col:10         Set column.
                    Wid:20         Set width of highlighted prompt.
                    Check:"Expr"   Box is checked if Expression is True.
                    Action:"Expr"  Expression  is  executed   when  box  is
                                   selected. 
                    Before:"Expr"  Expression  is  executed. If  false  box
                                   cannot be selected.

          Defaults  Row       One row below previous command.
                    Col       Same column as previous command.  If previous
                              command as Group, column is incremented to be
                              inside of the group box.
                    Wid       Prompt width

          Highlight Prompt is highlighted  when box is selected.   Pressing
                    Enter will check the box.   Pressing the space bar will
                    advance the cursor without checking the box. 

          See Also  ChBox

          Notes     Radio buttons are circular boxes that contain a  dot if
                    selected and  are  empty if  not  selected.   They  are
                    commonly used for  selections that are exclusive.   Use
                    Check boxes for selections that are cumulative. 



                                        String



          Command   String:"&Prompt"

          Purpose   An unhighlited prompt. 

          Options   Row:10         Set Row
                    Col:10         Set Column

          Defaults  Row       One row below  previous command.  If  used in
                              brackets  in text,  defaults to  current text
                              position.
                    Col       Same column as previous command.  If previous
                              command as Group, column is incremented to be
                              inside of the group box.  If used in brackets
                              in text, defaults to current text position.

          Highlight Strings are never highlighted.  If  they contain an Alt
                                                                        Alt
                    key  selection, and  that  key  is  pressed,  the  next
                    following entry item is highlighted. 

          See Also  Prompt.


          The JORF Manual (Disk Version)                                 54














          Notes     Strings are used to place plain text at certain row and
                    column  positions on data  entry screens.   Strings are
                    never highlighted.


                                         Text



          Command   Text:""

          Purpose   A text input area. 

          Options   Row:10         Set Row
                    Col:10         Set Column
                    Wid:60         Set Width of Data Entry
                    Len:6          Set Length of Data Entry
                    After:"Expr"   Expression is executed after input.. 
                    Before:"Expr"  Expression is  executed. If  false input
                                   is skipped. 
                    Field:"Value"  Field Value to be entered. 

          Defaults  Row       One row below previous command.  
                    Col       Same column as previous command.  If previous
                              command as Group, column is incremented to be
                              inside of the group box.
                    Wid       If previous command was a group box, width is
                              set to the inside width of the group box.
                    Len       If previous command was  a group box,  length
                              is set to the inside length of the group box.

          Highlight Text  fields are  not  highlighted like  input  fields.
                    They remain  the normal  background color,  even during
                    data entry.  The cursor is displayed when a text box is
                    being edited.   It is  not common to prompt  Text input
                    fields. 

          See Also  Input.

          Notes     Text fields are similar to input fields, except for the
                    highlighting.   Word processing is usually easier using
                    the normal screen color, instead of the field highlight
                    color.  Text input uses the screen color.










          Chapter Five - Window Manager Reference                        55

































                                     Chapter Six 

                             Library Functions Reference

          In JORF, as in  all object oriented languages,  a Method for  one
          object often invokes  a method for another object.   This process
          continues  until finally,  a low level  object invokes  a library
          routine.   For  example the  command Print integer:A  invokes the
          Integer:Print Method that may then invoke the Number:Print Method
          that invokes the  Jorf:Print Method.  At some  point, control  is
          passed to the underlying system that prints the data.

          The JORF Function library is implemented in the C language.  This
          library is not object oriented nor is it interpreted so there  is
          no ability for  polymorphism or inheritance on this  level.  JORF
          Library  calls  are   made  without  any   regard  to  class   or
          inheritance.   All  parameters passed  into C language  calls are
          treated as generic  JORF pointers, and return values  take on the
          class of the first parameter that was passed in.

          Originally,  JORF followed  the Smalltalk  model where  functions
          were  numbered,   and  direct   calls  to   the  functions   were
          discouraged.    Instead  of  calling   functions  directly,  each
          function  was  aliased  by  creating  a  method that  called  the
          function.  Instead of using  numbers, I assigned all functions to
          the class Function.  In the  prototype version of JORF, to add  a
                    Function
          window, you used Function:WindowAdd.  
                           Function:WindowAdd

          The indirect function access in the Smalltalk model gives a minor
          advantage of flexibility, for a major cost in speed.   To enhance
          speed,  I  changed  the  system  to  encourage  direct  calls  to
          functions,  and  dropped the  "Function"  class.   By  the  first
          general release of  JORF, the command to add a  window had become

          The JORF Manual (Disk Version)                                 56














          WindowAdd.  Methods,  JORF language subroutines, had  a different
          WindowAdd
          syntax because  they are  still tied to  classes.   For instance,
          TextWindow:Add  is the add routine for  objects of the TextWindow
          TextWindow:Add
          class.

          The  JORF to C language translator has changed the nature of this
          distinction.  The C language  routines like WindowAdd are part of
                                                      WindowAdd
          the standard library,  and not an  embedded part of  JORF.  In  a
          way, they  are semi-embedded, because they are a standard feature
          of the  language, and  any developer  who replaces  the functions
          will supply functions  of the same purpose.   Like the C language
          strlen(  ) command,  developers can  change it,  but it  would be
          strlen(  )
          silly to something other than return the length of a string.  (My
          version of strlen returns 0 if passed a null pointer.)

          When JORF Methods are translated to C and compiled, they become C
          language functions just like the standard library.  Although  the
          call  remains the  same, TextWindow:Add  can call a  translated C
                                   TextWindow:Add
          language  function.   There  is  no  longer  any reason  for  the
          distinction between a call  to a JORF Language method and  a call
          to  a C  language  function.   It  is natural  for the  WindowAdd
                                                                  WindowAdd
          function  to be changed to "Method" syntax and become Window:Add.
                                                                Window:Add


          Function names in JORF have  also been shortened.  Function names
          were   originally  designed   to   make   programs  readable   by
          discouraging  abbreviations.    But  readability  is  a  relative
          factor,   and   programmers   can   easily   recognize   standard
          constructions made of "unreadably" terse bits of code.

          I  have been especially annoyed with the WindowStructure command,
                                                   WindowStructure
          which  is commonly used in  keystroke handling routines to obtain
          information about the  editing window.  It just  takes to long to
          type this command, and it makes program lines really long. 

          Since functions were going to  be renamed to make them consistent
          with compiled methods, I have taken the opportunity to abbreviate
          the commands.  The old WindowAdd  command is now Win:Add.   Where
                                 WindowAdd                 Win:Add
          there is a JORF and a C language function that do the same thing,
          the  JORF function follows  the C convention,  so StringLength is
                                                            StringLength
          now Str:Len and corresponds to the C language strlen( ).
              Str:Len                                   strlen( )

                           Function name evolution in JORF 
                           Function name evolution in JORF 

          Version        A New Window             Length of a String

          Version 0.1    Function:WindowAdd       Function:StringLength
          Version 0.2    WindowAdd                StringLength
          Not Released   Window:Add               String:Length
          Version 1.2    Win:Add                  Str:Len
          Version 2.0    Win:Add                  Str:Len


          Chapter Six - Library Functions Reference                      57














           

                                       Arr:Del



          Function  Arr:Del ( Array, Position, Count ) 
                              _____  ________  _____

          Purpose   Delete Count  elements  from Array,  starting with  the
                    indicated Position. 

          Returns   Array.

          See Also  Arr:Ins

          Notes     Array   handling  is   usually   done  by   referencing
                    individual  array  items.   Arrays  do not  need  to be
                    declared, and are  created simply by setting  values to
                    their elements.   Arr functions are used  to change the
                                      Arr
                    whole array, without reference to the elements. 

                    The Arr:Del command  may be used to delete  one or more
                    elements  in the middle of  an array.  It automatically
                    decrements succeeding elements so  the array shrinks in
                    size by the number of elements deleted. 



                                       Arr:Dir



          Function  Arr:Dir ( WildCard, Ext_Exclusion_List ) 

          Purpose   Return an Array of files on the current directory  that
                    match  the designated  WildCard  but  are  not  in  the
                    Extension Exclusion List. 
          Returns   Array.

          See Also  Arr:Sort, Arr:Pick, File:ChgDir.

          Notes     The easiest way to  get and display a list of  files on
                    the current directory.  Arr:Dir with no parameters will
                    get a list of all files on the current directory. 

                    Files may be read according to the designated wildcard.
                    This may be any valid  DOS wildcard symbol, just as you
                    would use from DOS.  The following command makes a list
                    of all the text files on a directory:

                                   Arr:Dir "*.TXT"


          The JORF Manual (Disk Version)                                 58














                    Files  with  certain  extensions  can  be  excluded  by
                    including them in  the extension exclusion list.   This
                    list is a string with a list of extensions separated by
                    commas.   Two  commas  together indicate  files without
                    extensions.   The following command will collect a list
                    of all files  except those with .BAK, .OBJ,  .INI or no
                    extension. 

                                   Arr:Dir "*.*", "BAK,OBJ,INI,,"     

                    The Arr:Del command  may be used to delete  one or more
                    elements  in the middle of an  array.  It automatically
                    decrements  succeeding elements so the array shrinks in
                    size by the number of elements deleted. 

                    If the WildCard has the  value "Subdir", then the  file
                    list will  be a list of subdirectories.   Otherwise, it
                    will only contain files.  

          Example

          TextEdit:About
            Msg:Add ("About TextEdit", "Ok")
              Josephine's Text Editor is a sample program &
              included with the JORF Interpreter.  It &
              provides many of the functions as other &
              text editors, and is written in only 100 &
              lines of program code.

              Version 1.0                   August 25, 1991
                Copyright (C) 1991 by The JORF Company
            Return Ok

          TextEdit:Load
            New (Array, Pos, Name Text)
            Win:Add ('Reading')
              Reading and Sorting directory
            Array = Arr:Sort (Arr:Dir ("*.*","EXE,COM,BAK,OBJ,LIB,,JRF"))
            Win:Del
            Event:Add
            While (Name=Null)
              Pos   = Arr:Pick (Array,Null,"Files", 0, 0, 10, 1)
              If (Pos='Esc_Key')
                Return (Null)
              Name  = Str:At (Array[Pos], 1, Str:In (Array[Pos] " "))
              If (Name)
                EditKey:FinishEdit
                Jorf:Del (Win:Ptr->Edit)
                Win:Ptr->Name = Name
                Win:Ptr->Edit = TextEdit:Read (Name)
            Return Text


          Chapter Six - Library Functions Reference                      59














          TextEdit:Read (FileName)
            If (FileName)
              If (File:Access (FileName))
                Win:Add ('Reading')
                  Loading file "{FileName}"
                Return (File:Load (FileName))
              Else
                Msg:Add ('Error', 'Ok')
                  Cannot Access File "{FileName}"
            Return (Text:Add)

          TextEdit:Save
            TextEdit:Write (Win:Ptr->Name, Win:Ptr->Edit)
            Jorf:Del (Win:Ptr->Copy)
            Return Ok

          TextEdit:ReName
            New Key, FileName

            FileName = Win:Ptr->Name
            Win:Add ('File Name')
              Input:'File Name to Save ', Wid:30, Field:'FileName'
            Wnd:Del
            If (Key:Got != 'Esc_Key' And FileName != Null)
              If (File:Access (FileName) != 0)
                Key=Msg:Add ('File Already Exists' 'No')
             File "{FileName}" Already Exists!
             Do you want to overwrite it?
                If (Key:Got==Null)
             FileName=Null
              If (FileName)
                Win:Ptr->Name = FileName
            Return Ok

          TextEdit:Start FileName
            New Win
            Win->Name  = FileName
            Win->Edit  = TextEdit:Read (FileName)
            Win->Title = "Josephine's Tex& Editor"
            Win->Magic = False
            Win->FLRCO = "Off"
            Win->Idle  = "Editkey:Message"
            Win->After = "Editkey:FinishEdit"
            Win->Save  = "TextEdit:Write (Win:Ptr->Name, Win:Ptr->Edit)"
            Win->Text  = Text:Ptr
              Menu:'&About'               Action:'TextEdit:About'
              Menu:'&Load'                Action:'TextEdit:Load'
              Menu:'&Save'                Action:'TextEdit:Save'
              Menu:'&Rename'              Action:'TextEdit:ReName'
              Menu:'&Key Help'            Action:'Editkey:Ctrl_F1_Key'
              Menu:'&DOS Shell'           Action:'Jorf:System'
              Menu:'E&xit'                Action:'Return "Esc_Key"'

          The JORF Manual (Disk Version)                                 60














              Text:'Notes', Field:'Win:Ptr->Edit'
            Event:Add ('Editkey','Key',Here)
            Win:Add (Win, 1, 1, -1, -1, Here)
            Jorf:Exit

          TextEdit:Write (FileName, Text)
            If (FileName And Text)
              Win:Add ('Writing')
                Saving file "{FileName}"
              File:Save (FileName, Text)
            Return Ok



                                       Arr:Ins



          Function  Arr:Ins ( Array, Position, Count ) 
                              _____  ________  _____

          Purpose   Insert  Count  elements into  Array, starting  with the
                    indicated Position. 
          Returns   Array.

          See Also  Arr:Del

          Notes     Array   handling  is   usually   done  by   referencing
                    individual  array items.    Arrays do  not  need to  be
                    declared, and are  created simply by setting  values to
                    their  elements.  Arr functions are  used to change the
                                      Arr
                    whole array, without reference to the elements. 

                    The Arr:Ins command  may be used to insert  one or more
                    elements in the middle of  an array.  It  automatically
                    increments succeeding elements  so the  array grows  in
                    size by the number of elements inserted. 


                                       Arr:Len



          Function  Arr:Len ( Array ) 
                              _____

          Purpose   Returns the highest offset in the array. 

          Returns   Integer Offset.

          See Also  Word:Len

          Notes     Returns the length of an  array.  Actually, returns the
                    offset  of the highest  element of the  array, which is

          Chapter Six - Library Functions Reference                      61














                    also the length if the  first element is element number
                    1. 

                    Arrays  may  contain  element  0,  and  also   negative
                    elements.  If  this is the case, the  actual length may
                    be longer than the value of this command. 

          Example

          Dump:Start
            New WildCard, FileList, Choice
            New FileName, Char, Length, Pos, Col

            While (Ok)
              | First get a wildcard for dir command
              Win:Add ("Dump a File")
                Input:"Directory WildCard: ", Field:"WildCard"
              If (Key:Got = 'Esc_Key')
                Return

              | Read the directory
              Win:Add("Reading Directory")
                One Moment Please . . .
              FileList  = Arr:Dir(WildCard)
              If Arr:Len(FileList) < 1
                Msg:Add
                  No Files match the WildCard!
              Else
                | Sort the list
                Win:Add ("Sorting Directory")
                  One Moment Please . . .
                FileList = Arr:Sort(FileList)

                While FileList != Null
                  | And ask to pick a file
                  Choice= Arr:Pick(FileList,Null,"Dump File",0,0,0, Choice)
                  If Key:Got = 'Esc_Key'
                    Break

                  | Got a file name!
                  FileName = FileList[Choice]
                  FileName = Str:At (FileName 1, Str:In(FileName," "))
                  Length   = File:Len (FileName)
                  Pos      = 0

                  Win:Add (FileName, 2, 8, (Length/16)+2, 78, Here)

                  While (Pos < Length)
                    Col = (Pos % 16)     | Set column position
                    If (Col == 0)        | If beginning new line
                      If (Pos > 0)       | If after first line
                        Move:By (1,0)    | Start a new line

          The JORF Manual (Disk Version)                                 62














                        Move:To (0,1)    |
                      Str:Put (To:Str(Pos,"0000:0000",16))
                    ++Pos
                    | Read One Character
                    Char = File:Read (FileName Here 1 Pos)
                    | And Display It . . .
                    Move:To (0,13+(Col*3))
                    Str:Put (To:Str(To:Ascii(Char),'00',16))
                    Move:To (0,62+Col)
                    Char:Put (To:Ascii(Char))
                    If Key:Hit           | If key hit
                      Char = Key:Get     | See What it is
                      If Char = "Esc_Key"| If Escape
                        Break            |      Break
                      Win:Pause          |   Pause
                  Str:PutLine            | One more line
                  Str:PutLine            | One more line
                  Win:Msg("End of File") | Done!
                  Win:Pause              | Wait
                  Win:Del                | Delete window
                Win:Del
              Win:Del
              Win:Del
            Return                       | Exit



                                       Arr:Pick



          Function  Arr:Pick  (  Array  Command  Title  Row  Column  Length
                                 _____
                    Default ) 

          Purpose   Display a browser  menu of array  items with Title,  at
                    Row  and Column, no longer than Length and highlighting
                    Default.

          Returns   Integer offset of selection or "Esc_Key".

          See Also  Arr:Sort

          Notes     One  of the more  powerful JORF  command, this  is what
                    displays   the  file  list  when  you  start  the  JORF
                    interpreter, and also what  displays the debugger Alt-B
                                                                      Alt-B
                    browser lists. 

                    This command returns Null, if  Array is blank or not an
                    array.  All other parameters may be omitted.

                    The  Length is  only the  maximum to  display.   If the
                    array is  shorter,  then the  menu length  will be  the

          Chapter Six - Library Functions Reference                      63














                    length of the array.   If the array is longer,  then it
                    will scroll automatically. 

                    The  Array pick does not set or block keystroke events,
                    and  existing   events  often   interfere  with   array
                    selection.  To  prevent this, it is  typical to include
                    do  Event:Add  with  no  parameters, prior  to  calling
                    Arr:Pick.     Adding  a  null  keystroke  event  blocks
                    processing from  searching  down the  stack to  process
                    lower level keystroke events.

                    Menu options are  displayed as strings.   Both Arr:Pick
                    and Arr:Sort make  use of a polymorphic Command  to get
                    the value  of these strings.   If command is  Null, the
                    normal  string value is  used. For structures,  you can
                    set up a method that  returns a string that  represents
                    that structure.   for  instance, the  Address structure
                    may show Name, City and State:

             Class:Address, Name, Addr1, Addr2, City, State, Zip

             Address:Show(Addr)
               Return (Str:Pad(Addr->Name,30)+" "+Addr->City+","+Addr->Zip)

          Example


          TextEdit:About
            Msg:Add ("About TextEdit", "Ok")
              Josephine's Text Editor is a sample program &
              included with the JORF Interpreter.  It &
              provides many of the functions as other &
              text editors, and is written in only 100 &
              lines of program code.

              Version 1.0                   August 25, 1991
                Copyright (C) 1991 by The JORF Company
            Return Ok

          TextEdit:Load
            New (Array, Pos, Name Text)
            Win:Add ('Reading')
              Reading and Sorting directory
            Array = Arr:Sort (Arr:Dir ("*.*","EXE,COM,BAK,OBJ,LIB,,JRF"))
            Win:Del
            Event:Add
            While (Name=Null)
              Pos   = Arr:Pick (Array,Null,"Files", 0, 0, 10, 1)
              If (Pos='Esc_Key')
                Return (Null)
              Name  = Str:At (Array[Pos], 1, Str:In (Array[Pos] " "))
              If (Name)

          The JORF Manual (Disk Version)                                 64














                EditKey:FinishEdit
                Jorf:Del (Win:Ptr->Edit)
                Win:Ptr->Name = Name
                Win:Ptr->Edit = TextEdit:Read (Name)
            Return Text

          TextEdit:Read (FileName)
            If (FileName)
              If (File:Access (FileName))
                Win:Add ('Reading')
                  Loading file "{FileName}"
                Return (File:Load (FileName))
              Else
                Msg:Add ('Error', 'Ok')
                  Cannot Access File "{FileName}"
            Return (Text:Add)

          TextEdit:Save
            TextEdit:Write (Win:Ptr->Name, Win:Ptr->Edit)
            Jorf:Del (Win:Ptr->Copy)
            Return Ok

          TextEdit:ReName
            New Key, FileName

            FileName = Win:Ptr->Name
            Win:Add ('File Name')
              Input:'File Name to Save ', Wid:30, Field:'FileName'
            Wnd:Del
            If (Key:Got != 'Esc_Key' And FileName != Null)
              If (File:Access (FileName) != 0)
                Key=Msg:Add ('File Already Exists' 'No')
             File "{FileName}" Already Exists!
             Do you want to overwrite it?
                If (Key:Got==Null)
             FileName=Null
              If (FileName)
                Win:Ptr->Name = FileName
            Return Ok

          TextEdit:Start FileName
            New Win
            Win->Name  = FileName
            Win->Edit  = TextEdit:Read (FileName)
            Win->Title = "Josephine's Text Editor"
            Win->Magic = False
            Win->FLRCO = "Off"
            Win->Idle  = "Editkey:Message"
            Win->After = "Editkey:FinishEdit"
            Win->Save  = "TextEdit:Write (Win:Ptr->Name, Win:Ptr->Edit)"
            Win->Text  = Text:Ptr
              Menu:'&About'               Action:'TextEdit:About'

          Chapter Six - Library Functions Reference                      65














              Menu:'&Load'                Action:'TextEdit:Load'
              Menu:'&Save'                Action:'TextEdit:Save'
              Menu:'&Rename'              Action:'TextEdit:ReName'
              Menu:'&Key Help'            Action:'Editkey:Ctrl_F1_Key'
              Menu:'&DOS Shell'           Action:'Jorf:System'
              Menu:'E&xit'                Action:'Return "Esc_Key"'
              Text:'Notes', Field:'Win:Ptr->Edit'
            Event:Add ('Editkey','Key',Here)
            Win:Add (Win, 1, 1, -1, -1, Here)
            Jorf:Exit

          TextEdit:Write (FileName, Text)
            If (FileName And Text)
              Win:Add ('Writing')
                Saving file "{FileName}"
              File:Save (FileName, Text)
            Return Ok



                                     Arr:Printers



          Function  Arr:Printers

          Purpose   Return an Array of available printers. 
          Returns   Array.

          See Also  Arr:Pick,  Jorf:Printer and  JORF.INI documentation  in
                    Appendix D.
                    Appendix D

          Notes     This command reads the printers listed in your JORF.INI
                    or JORFWIN.INI file and creates  an array.  You can use
                    this array on a data  entry screen or with the Arr:Pick
                    function.  

                    Each entry can be assumed  to be a string that contains
                    a description, and a printer designation.   The printer
                    is assumed to be the last word of the command.

          Example

          Jorf:Printer
            New (PrintList,PrintChoice,Dest)

            Event:Add()
            PrintList = Arr:Printers()
            Win:Add("Select Printer")
              Group:"&Printers", Row:1 Col:1 Len:6 Wid:22
              Array:"" Field:"PrintList" Choice:"PrintChoice"


          The JORF Manual (Disk Version)                                 66














              Button:"   &Go   " Row:1 Col:32
                Action:"Dest=PrintList[PrintChoice]"
              Button:" &Cancel " Row:4 Col:32 Action:"Return ('Esc_Key')"
            If (Dest='Esc_Key' Or Kbd:Got='Esc_Key')
              Dest=Null
            Return(Dest)



                                       Arr:Sort



          Function  Arr:Sort ( Array Command Direction ) 
                               _____

          Purpose   Sort the elements of an array. 

          Returns   Array. 

          Notes     The only sort command  in the JORF language.   Normally
                    sorts  elements in  ascending  order.    You  can  sort
                    descending  by specifying  a  Direction  of  "Down"  or
                    "Descending"  (or anything that  begins with the letter
                    'D'). 

                    Arr:Sort makes use of a polymorphic Command to get  the
                    string value  of the  array element.   If this  is Null
                    then  the string  value is  used.  For structures,  you
                    should set  up a method  that returns a string  to sort
                    by. 

                    Class:Address, Name, Addr1, Addr2, City, State, Zip

                    Address:SortString(Addr)
                         Return (Addr->Name)



          Example   See Arr:Sort.



                                       Char:Del



          Function  Char:Del ( Count ) 
                               _____

          Purpose   Delete  Count characters in  the current window  at the
                    current cursor position.

          Returns   None.

          Chapter Six - Library Functions Reference                      67














          See Also  Char:Ins

          Notes     This  command does two specific things;   1) it deletes
                    Count characters at the current location in the current
                    window, and 2)  it deletes Count characters in the line
                    currently  being edited.    The  line  edit  buffer  is
                    separate from the screen, although they usually reflect
                    the same data.

                    The line and  paragraph may rewrap if  the window Magic
                    is True and the window FLRCO is not "Off".

          Example


          CharEx:Start 
            New Count, Str1, Str2 
            Str1="This Text will Disappear" 
            Str2="This Text will Appear" 
            Win:Add ("Char Example", 10, 25, 30, 2, Here)
            Str:Put (Str1)          | Show Str1 
            Win:Pause (20)          | And pause for Effect 
            Count = Str:Len (Str1)  | Set Counter 
            While (Count > 0)       | While GT Zero 
              Move:To (1,1)         |   First line 
              Char:Del (1)          |   Take 1 Away 
              Move:To (2,1)         |   Second line 
              Char:Ins (1)          |   Add one, Add char 
              Char:Put (To:Ascii (Str:At (Str2, Count, 1)))
              --Count               |   Decrement Count 
              Win:Pause(5)          |   Pause 5/100 seconds 
            Win:Pause               | Done! 
            Return                  | Bye 



                                       Char:Get



          Function  Char:Get

          Purpose   Gets a character displayed on the current window.  

          Returns   ASCII decimal value of the character.

          See Also  Char:Put.

          Notes     It is atypical  for a JORF Language function  to return
                    the   value  of  a  character,  rather  than  a  string
                    containing the character.   However, this is  done here
                    to maintain symmetry with Char:Put.

          The JORF Manual (Disk Version)                                 68

















                                       Char:Ins



          Function  Char:Ins ( Count ) 
                               _____

          Purpose   Insert  Count spaces  in  the  current  window  at  the
                    current cursor position.

          Returns   None.

          See Also  Char:Del

          Notes     This command  does two specific things;   1) it inserts
                    Count spaces  at the  current location  in the  current
                    window,  and 2)  it inserts  Count spaces  in the  line
                    currently  being edited.    The  line  edit  buffer  is
                    separate from the screen, although they usually reflect
                    the same data.

                    If the  line length  exceeds the  window boundary,  and
                    window  is in  one  of  the wrap  modes,  the line  and
                    paragraph will  be reformatted.  This  formatting takes
                    place only on the screen, and not in the edit buffer.

          Example   See Char:Del. 




                                       Char:Put



          Function  Char:Put ( Value ) 
                               _____

          Purpose   Put an  ASCII character  on the current  window at  the
                    current cursor location.

          Returns   None.

          See Also  Char:Get, Str:Put.

          Notes     It  is  atypical for  a JORF  Language function  to use
                    ASCII values for  characters.  Usually,  characters are
                    strings and are displayed using Str:Put.  However, some
                    graphics characters  are easier  to display as  numbers
                    because they have no letter equivalent.  


          Chapter Six - Library Functions Reference                      69














          Example


          Ascii:Start
            New Char
            Win:Add("ASCII TABLE", 4, 4, 19, 74, Here)

            For (Char = 0 Thru 15)
              Move:To(1,(Char*4)+10)
              Str:Put(To:Str(Char))
              Move:To(Char+3,1)
              Str:Put(To:Str(Char*16))

            Move:To(2,1)
            Win:Attr("Lo")
            For (Char = 0 Thru 255)
              If ((Char % 16) == 0)
                Move:By(1,0)
                Move:To(0,10)
              Char:Put(Char)
              Move:By(0,3)
            Win:Msg("Press Enter to Continue")
            Win:Pause



                                       Class:At


          Function  Class:At ( Structure Position ) 
                               _________ ________

          Purpose   Returns class of  word in parsed command line, or label
                    of a structure member. 

          Returns   Class.

          See Also  Class:AtPut, Word:At.

          Notes     Structures, Arrays, the  JORF stack, and lines  of text
                    are  all stored  as arrays  of  Class:Word pairs.   The
                    number  of words  in the  array can  be  obtained using
                    Word:Len.

                                      Structures
                                      Structures

                    Normally,  you  access  structure  elements  using  the
                    pointer operator (->).  However, you  can also use this
                    command to referencing the elements directly.  

                                        Stack
                                        Stack



          The JORF Manual (Disk Version)                                 70














                    Each level  of the stack  (each method call)  creates a
                    new structure.  The first element  has the class Method
                                                                     Method
                    and is  the current program  line.  The  second element
                    has the  class From  and is the  previous level  of the
                                   From
                    stack.   The next  elements are  the parameters in  the
                    order they were  passed.  Then, any  New variables with
                                                         New
                    the variable name standing for the class name.

                                      New Values
                                      New Values

                    New values that are structures contain a pointer to the
                    class  definition in  the  first  element.   Subsequent
                    elements are various values in the order that they were
                    referenced.  

                                        Arrays
                                        Arrays

                    Array  elements  are  normally  accessed  using  square
                    brackets  [].   But if  you  find reason,  you can  use
                    Word:At to get  the element.  Unlike  Structures, array
                    Word:At
                    elements have  no label, so  the class  will always  be
                    null.   Using Class:At is legal, but will always return
                                  Class:At
                    null unless you used Class:AtPut to put a value there.
                    null                 Class:AtPut

                                         Text
                                         Text

                    Text lines  may be  examined to  obtain  the class  and
                    values  of   items  on   that  line.     The   line  is
                    automatically  parsed when Class:At is used.  The parse
                    will automatically  separate all words  and punctuation
                    characters.  Each punctuation character is treated as a
                    separate word.   If the parsed line  contains JORF-like
                    Class:Word pairs, then the class values will be set for
                    Class:At.
                    Class:At




                                     Class:AtPut


          Function  Class:AtPut ( Structure, Position, Class ) 
                                  _________  ________  _____

          Purpose   Changes the class of a word in a member of a structure.


          Returns   None.

          See Also  Class:At, Word:AtPut.

          Notes     Structures, Arrays, the  JORF Stack and text  lines are
                    all stored as an array of Class:Word pairs.  The number

          Chapter Six - Library Functions Reference                      71














                    of  words can  be obtained  using  Word:Len.   Although
                    Class:At   works   for   both   text  and   structures,
                    Class:AtPut works  only on structures, not  text lines.
                    To  change  a  text  line,  you  must  use  the  String
                    functions.

                    Class:AtPut can be used to  change an element name in a
                    structure, or a variable name in the stack.  




                                       Class:In


          Function  Class:In ( Structure, Class ) 
                               _________  _____

          Purpose   Searches for the existence of Class in a structure, and
                    returns the position  if it is found.   Returns zero if
                    Class is not found.

          Returns   Position of Class or zero if not found.

          See Also  Class:At, Word:In.

          Notes     Both structures  and text lines are stored  as an array
                    of  Class:Word  pairs.   The  number  of  words  can be
                    obtained using Word:Len.  ClassIn can be used to see if
                    a  member  exists  in a  structure,  without  using the
                    structure pointer operator.



                                      Class:Read


          Function  Class:Read ( Name ) 
                                 ____

          Purpose   Read class information from Name.  

          Returns   None.

          See Also  Class:Write.

          Notes     In  large applications that you are editing outside the
                    JORF editor, it may be necessary to load several files.
                    Instead of using  a big command line, you  can use this
                    function to load class files.  

                    The class name and the file name must be the same.  The
                    source file must have a ".J" extension.


          The JORF Manual (Disk Version)                                 72















                                     Class:Write


          Function  Class:Write ( ClassName, FileName ) 

          Purpose   Writes a class  to file.  If ClassName is omitted or is
                    Null,  and FileName is  available, all classes  will be
                    written to FileName.  

          Returns   None.

          See Also  Class:Read, Class:Check.

          Notes     Class:Write displays an "Action"  window.  This  window
                    displays the method names as they are written.

                    Each  file is  backed up  to a ".BAK"  extension before
                    writing.     Because  of   the  eight   character  name
                    limitation in  DOS, classes  that start  with the  same
                    eight letters will end up in the same file.



                                      Event:Add


          Function  Event:Add ( Class, Type, Level ) 

          Purpose   Add an Event Class.

          Returns   None.

          See Also  Event:Do, Event:Del.

          Notes     The Event  system is  a way of  performing a  method in
                        Event
                    response   to  an  event   that  occurs  during  normal
                    processing.  This is a way of saying "If such  and such
                    happens  while this program runs, then  do this to take
                    care of it".

                    Three types of events set up in the JORF system are the
                    key, trace and error events.  Key events occur whenever
                    key  trace     error
                    the  operator  enters  a keystroke.    This  allows the
                    system   to   evaluate   the   key   and   to   respond
                    appropriately.   Trace events  are used for  trace mode
                                     Trace
                    debugging,  and will  be executed  at particular  times
                    during  while a  method is  begin  interpreted.   Error
                                                                      Error
                    events  occurs when is  an error.   It is automatically
                    called,  in hopes that error  recovery is possible.  Of
                    these, Key events are by far the most common. 


          Chapter Six - Library Functions Reference                      73














                    Event:Add adds a new Class  name to the event stack for
                    event  Type  tied to  the current  program Level.   The
                    event classes  form a  stack so that  the new  entry is
                    simply  the top one  of many that  might be  used.  The
                    level lets the system know what method is declaring the
                    new class, and will automatically clear this entry when
                    that method is completed.

                    The types  Error and Key  are already used by  JORF for
                               Error     Key
                    error and keystroke  handling.  Other types  may be any
                    name later used by Event:Do.

                    When  events are performed, the event stack is searched
                    from top (most recent) to  bottom.  When a valid method
                    is found,  it is executed.   If the method  returns any
                                                 If the method  returns any
                    value, the search is completed.  If  the method returns
                    value                            If  the method returns
                    null, the search is continued  down the event stack.  A
                    null
                    null  class can  be used  to block the  search function
                    from going any lower on the event stack.

                    If this  is not complicated  enough, there  is a  "Hot"
                    event system.  If you declare an event with a Level  of
                    zero, then you create a  hot event.  Once declared, Hot
                    events are permanent.   Normal events are  cleared when
                    the method that declared them is ended.  Hot events are
                    checked after  the first  event level,  but before  the
                    "Else" clause is checked.  Hot events give a way to set
                    default   key  values,  like  Alt-X  for  exit  in  the
                                                  Alt-X
                    debugger. 

                    The Level value should always be Here.


          Example


          EditIni:About
            Msg:Add ("About EditIni", "Ok")
              EditIni is a program designed to allow &
              you to change the JORF.INI initialization &
              file.  This program is a sample program &
              included with the JORF Interpreter.

              Version 1.0                   December 6, 1991
                Copyright (C) 1991 by The JORF Company
            Return

          EditIni:Start
            New FileName,Text
            FileName   = Str:At(Mem:Ptr->Args,1,Str:In(Mem:Ptr->Args, '.'))
            FileName   = FileName + 'INI'
            If (File:Access (FileName))

          The JORF Manual (Disk Version)                                 74














              Text     = File:Load (FileName)
            Else
              Msg:Add ('Error', 'Ok')
                Cannot Access File "{FileName}"
              Return

            Win:Add ('Editing "{To:Ucs(FileName)}"',2,6,-2,-6,Here)
              Menu:'&About'               Action:'EditIni:About'
              Menu:'&Edit Keys'           Action:'EditKey:Ctrl_F1_Key'
              Menu:'E&xit'                Action:'Return "Esc_Key"'

            Event:Add ('Editkey','Key',Here)
            Win:Ptr->Magic = False
            Win:Ptr->FLRCO = "Off"
            Win:Ptr->Save  = "EditIni:Write (FileName)"
            Win:Ptr->Idle  = "Editkey:Message"
            Win:Ptr->After = "Editkey:FinishEdit('Save')"
            Win:Ptr->Text  = Text
            Line:Inp ("Win:Ptr->Text", 1, 1, Win:Ptr->Len-1, Win:Ptr->Wid)
            Return Ok

          EditIni:Write (FileName)
            If (File:Backup (FileName))
              File:Save (FileName,Win:Ptr->Text)
            Return




                                      Event:Del


          Function  Event:Del ( Type ) 

          Purpose   Deletes  the last  event Class  for  event function  of
                    designated Type.

          Returns   None.

          See Also  Event:Add, Event:Do.

          Notes     This  function is rarely used because usually the Event
                    Classes are  deleted automatically when the method that
                    creates them is ended.  The sole use of this command is
                    to try  to circumvent that  system.  You should  try to
                    work  with the automatic  delete system, because  it is
                    more robust.   However,  if you  insist, this  function
                    will delete the last event class entry with this Type.





          Chapter Six - Library Functions Reference                      75















                                       Event:Do


          Function  Event:Do ( Method, Type ) 
                               ______

          Purpose   Performs an event.  

          Returns   If  an event  method is  found, executed and  returns a
                    value, then that value is returned by Event:Do.

          See Also  Event:Add, Event:Del.

          Notes     The most confusing thing here  is to figure out how the
                    system  is creating  the method  name to  call when  an
                    event is performed.  The inclination is to look at this
                    command  and  assume  that   the  method  will  perform
                    Type:Method.   Instead,  the type  is used to  down the
                    Type:Method
                    event  stack for  the appropriate  Class  that was  set
                    using  Event:Add.    It  is  this   class  used  to  do
                    Class:Method.
                    Class:Method

                    Each class of  the correct type is attempted.   If that
                    fails, then  the system  looks for  an Else  method for
                    that class.  The Else  methods are a default method for
                    the event type.  If this is not found, the system looks
                    down the  event stack  to the next  lower class  of the
                    correct Type.

                    This system allows a layering of event actions.  It was
                    designed  primarily  for  keystroke handling,  where  a
                    certain screen  may need  to reassign  only four  keys,
                    while  maintaining the functions  of other keys.   Many
                    key handling systems remap all keys.   This is unwieldy
                    if only four keys have different definition.  But,  for
                    events other  than keystrokes, this overlay ability may
                    be too complicated and unnecessary.  Liberal use of the
                    Else  method is recommended  to avoid the  stack search
                    and resulting confusion.

                             Special Notes for Key Events
                             Special Notes for Key Events

                    For  text  entry,  data   entry  and  menu   selection,
                    keystrokes from  the  operator are  translated  by  the
                    system using  the KeyClass  stack.   The  names in  the
                    stack interpret  the current keystroke.   The keystroke
                    is converted to  a string value  and the method  called
                    that  corresponds to  the appropriate class  and value.
                    For instance, pressing  the Escape key with  a KeyClass
                    of "MenuKey" will invoke the method MenuKey:Escape_Key.



          The JORF Manual (Disk Version)                                 76














                    Normal  letters have "_Key" appended, so hitting B will
                    return  "B_Key".   Alternate and  Control  keys have  a
                    prefix appended to create "Alt_B_Key" and "Ctrl_B_Key".
                    Special  keys return  special  values like  "Home_Key",
                    "F1_Key" and "Ctrl_Right_Arrow_Key".  A list of special
                    key values is in Appendix B.
                                     Appendix B

                            Special notes for Error Events
                            Special notes for Error Events

                    Error events are  called like the key  events using the
                    error number as the method  name.  If the called method
                    needs more information, it may call Jorf:Ptr to  fill a
                    structure with the error values.

                    Fatal errors  do not  call the  event system.   Usually
                    these errors show that something has happened that will
                    not  allow   further  action   in  The   JORF  Language
                    interpreter, and  the  program  must  halt  immediately
                    before data integrity can be lost.

                            Special notes for Trace Events
                            Special notes for Trace Events

                    When  trace  mode  is on,  the  interpreter  stops just
                    before  executing  a  line, and  invokes  the  Trace Do
                                                                   Trace Do
                    event.   Typically, this event  switches program stacks
                    to  the debugger  stack, and  starts  up the  debugger.
                    Trace mode is turned off as soon as the Trace  event is
                                                            Trace
                    called.   If  you  want to  continue  tracing you  must
                    execute  Trace:On before  you  return  from  the  Trace
                                                                      Trace
                    event.   So  trace  mode doesn't  "stay  on" like  most
                    debuggers.   Instead, it  must be continually  reset by
                    the debugger for the next programming line.  



                                        False


          Function  False

          Purpose   Used to test for Logical False.

          Returns   Null.  

          See Also  True.

          Notes     Most programming  language express  results of  logical
                    equations  as  zero  to  indicate  False,  and  one  to
                    indicate True.  These values are called Boolean values.




          Chapter Six - Library Functions Reference                      77














                    This  function was created  in the interest  of program
                    clarity.  It simply returns Null.  Due to the automatic
                    type  conversions inherent  to Jorf  Pointers, this  is
                    exactly the same as the integer zero.



                                     File:Access


          Function  File:Access ( FileName Command )  
                                  ________

          Purpose   Checks  file   existence,  read  permission   or  write
                    permission. 

          Returns   True or False.

          See Also  Other File functions.

          Notes     This  function is the  JORF language equivalent  to the
                    UNIX C language access() function.  Command may be Null
                                    access()
                    or "Exist" to check for existence.

                    Command may be  "Read" or "Write" to  check for network
                    read and write access to the file.  

          Example   See Event:Add.


                                     File:Backup


          Function  File:Backup ( FileName )  
                                  ________

          Purpose   Renames FileName to have an extension of .BAK.

          Returns   None.

          See Also  Other File functions.

          Notes     This  function makes  a backup  of  a file,  presumably
                    before  calling a command that might overwrite the file
                    like File:Save. 

          Example   See Arr:Pick.








          The JORF Manual (Disk Version)                                 78















                                      File:ChDir


          Function  File:ChDir ( NewDir )  

          Purpose   Change current directory or Return current directory.

          Returns   If  NewDir  is  Null, returns  current  Directory.   If
                    present, returns Ok if successful, False if not. 

          See Also  Other File functions.

          Notes     This function is the equivalent  of the DOS ChDir or CD
                    command.   Like ChDir,  it can  be used  two ways.   By
                    itself, it  simply  returns the  disk and  path of  the
                    current working directory.  If followed by a new  path,
                    it changes to that path.

                    Unlike  DOS ChDir,  File:ChDir will change  drives too,
                    simply by specifying the file to change to. 


                                       File:Del


          Function  File:Del ( Name )  
                               ____

          Purpose   Delete a file from disk.

          Returns   Ok if file is deleted, Null if not.

          See Also  Other File functions.

          Notes     All information in the file  will be destroyed.  If the
                    file is currently opened, it  will be closed.  Does not
                    give an error if the file is absent. 


                                       File:Len


          Function  File:Len ( Name ) 
                               ____

          Purpose   Get Length of file on disk.

          Returns   Length of file in Bytes.

          See Also  Other File functions.




          Chapter Six - Library Functions Reference                      79














          Notes     Returns the  current length of  the file in bytes.   If
                    the  file is not found, the length  will be 0, the same
                    as if the file is empty.

          Example   See File:Read


                                      File:Load


          Function  File:Load ( Name )  
                                ____

          Purpose   Load a text file into a text pointer.

          Returns   Text pointer.

          See Also  File:Save, File:Read.

          Notes     Loads a text file wholesale into swap storage, which is
                    much faster  than trying  to read  it line-by-line  and
                    adding the  lines using Text:Add.   Use  this for  text
                    file editors like the JORF.INI editor.

          Example   See Event:Add.



                                       File:Map


          Function  File:Map ( Name, Level, Type, Class, Map ) 
                               ____  _____  ____  _____  ___

          Purpose   Map a file in a foreign format for reading and writing.

          Returns   None.

          See Also  File:Read, File:Write.

          Notes     Map a file for use with File:Read and File:Write.  When
                    you map a  file you map structures and  fields to write
                    different file types.

                    The parameter name is sets the file name.  Once mapped,
                    all reads and writes to that file will be influenced by
                    the mapping.

                    The  parameter type  sets the  type of  the file  to be
                    mapped.    Available  types are  DLM,  SDF,  FIXED, and
                    DBASE.

                    DLM  stands for  comma  delimited.   This  is the  most
                    common  type.   Fields  are  quoted  and  separated  by

          The JORF Manual (Disk Version)                                 80














                    commas.  There is a fixed number of fields per records.
                    Records end in a carriage return line feed pair.

                    FIXED stands for  fixed length record format.   This is
                    the most common proprietary format.

                    SDF stands for  system data format.  This  type is very
                    close to FIXED but records in an SDF file must end in a
                    carriage return-line feed pair.

                    DBASE stands  for DBASE  III format  files.   Currently
                    (March 1992)  this format  is not  fully supported  and
                    separate DBT  files are  not supported.   This  support
                    should  be  added soon,  as  well as  DBASE  IV format.
                    Until then, it is best if you dump  your dBase files as
                    DLM files and use the DLM type to read the data.

                    The  last parameter is usually an indented section that
                    contains the field mapping.   Each line of this section
                    relates to a single field in the mapping.  You must map
                    every field, even if you don't want the data.   You can
                    map several  fields into one  so if you create  a field
                    that is called "junk" and  put all extra fields into it
                    you will fulfil the mapping requirement.

                    The simplest mapping is for a delimited file, where you
                    merely have to list the field names.

                    Contact:CvtDlm
                      New (Contact:Contact,FName,Counter)
                      FName="MyFile.Dat"

                      | Add a window to show what is happening
                      Win:Add ("Reading {FName}", 0, 0, 10, 76, Here)
                      File:Map (Fname,Here,"DLM","Contact")
                        Company
                        Addr1
                        Addr2
                        Addr3
                        Junk
                        FullName
                        Zip
                        Junk
                      While (File:Ok(Fname))
                        Contact=File:Read(Fname,Here)
                        ++Counter
                        If (Contact->FullName==Null)
                          Contact->FullName = Contact->Company
                        | Put record stuff in window 
                        Str:Put (Str:Pad(Counter,4))
                        Str:Put (Str:Pad(Contact->Company,30))
                        Str:Put (Str:Pad(Contact->FullName,30))

          Chapter Six - Library Functions Reference                      81














                        Str:PutLine
                        Jorf:Write(Contact)
                      Return Ok

                    The next simplest  is for a  FIXED or SDF file.   These
                    formats  are very similar  because they are  both fixed
                    length  format.  The  only difference is  that you must
                    include the record length when you read a FIXED  length
                    file.  You don't  need a record length when you  read a
                    DLM file.  If you map wrong, your fields will be split.
                    If you really map wrong, excess  fields are ignored and
                    not enough  fields will result  in blank fields  in the
                    JORF structure.

                    In a fixed  length format, you must  specify the length
                    of each field.

                    Contact:CvtFIXED
                      New (Contact:Contact,FName,Counter)
                      FName="MyFile.Dat"
                      | Add a window to show what is happening
                      Win:Add ("Reading {FName}", 0, 0, 10, 76, Here)
                      File:Map (Fname,Here,"FIXED","Contact")
                        Company   Len:40
                        Addr1     Len:40
                        Addr2     Len:40
                        Addr3     Len:40
                        Junk      Len:20
                        FullName  Len:40
                        Zip       Len:10
                        Junk      Len:2
                      While (File:Ok(Fname))
                        Contact=File:Read(Fname,Here,232)  | Rec len is 232
                        ++Counter
                        If (Contact->FullName==Null)
                          Contact->FullName = Contact->Company
                        | Put record stuff in window 
                        Str:Put (Str:Pad(Counter,4))
                        Str:Put (Str:Pad(Contact->Company,30))
                        Str:Put (Str:Pad(Contact->FullName,30))
                        Str:PutLine
                        Jorf:Write(Contact)
                      Return Ok

                    The last format is for dBase files.  If all you want to
                    do  is read a dBASE file, you  only need to map fields.
                    If you want to write,  you must also include the length
                    and dBase data type for  the fields.  When you map  the
                    fields to read the order of the fields is not necessary
                    because the fields  are also defined  in the header  of
                    the dBASE file.   Memo fields are handled  as JORF text
                    fields.

          The JORF Manual (Disk Version)                                 82














                    It is generally best to define the Len, dName (the name
                    of  the field in the dBase file).   You can also define
                    the  Dec for  decimal  point, and  dtype for  the dBase
                    field type.   If  you do not  define these  the decimal
                    places will default to zero, and the dType will default
                    to 'C' for the dBase Character type.


                    Contact:CvtDBASE
                      New (Contact:Contact,FName,Counter)
                      FName="MyFile.Dat"
                      | Add a window to show what is happening
                      Win:Add ("Reading {FName}", 0, 0, 10, 76, Here)
                      File:Map (Fname,Here,"DBASE","Contact")
                        Company   Len:40 dName:COMPANY
                        Addr1     Len:40 dName:ADDR1
                        Addr2     Len:40 dName:ADDR2
                        Addr3     Len:40 dName:CITSTZ
                        Junk      Len:20 dName:CODES
                        FullName  Len:40 dName:CONTACT
                        Zip       Len:10 dName:ZIP
                      While (File:Ok(Fname))
                        Contact=File:Read(Fname,Here)  | No record length
                        ++Counter
                        If (Contact->FullName==Null)
                          Contact->FullName = Contact->Company
                        | Put record stuff in window 
                        Str:Put (Str:Pad(Counter,4))
                        Str:Put (Str:Pad(Contact->Company,30))
                        Str:Put (Str:Pad(Contact->FullName,30))
                        Str:PutLine
                        Jorf:Write(Contact)
                      Return Ok

                    One can write a whole book on reading and writing files
                    in various formats.  In fact,  I have one on order that
                    is  to be published  in May  of 1992  that I  hope will
                    disclose the changes for dBASE  IV.  I haven't begun to
                    address Paradox and other formats, or the index formats
                    for NDX and  NTX files.  More  work will be  done here,
                    and if  you  have  any problems  please  give  a  call.
                    Perhaps I have  an update that has  stronger processing
                    of these file formats.










          Chapter Six - Library Functions Reference                      83















                                     File:MoveTo


          Function  File:MoveTo ( Name, Level, Position ) 
                                  ____  _____  ________

          Purpose   Go to the front or back of a file.

          Returns   None.

          See Also  File:Read.

          Notes     Can be used to  "Rewind" a file to the beginning, or to
                    "Append"  after rewinding.  Position must be the string
                    value "Beginning" or  "End".  Only the  first letter is
                    used, but three letters are recommended for clarity.



                                       File:Ok


          Function  File:Ok 

          Purpose   Check for End of File while reading.

          Returns   False if  End of File  has been reached  while reading,
                    otherwise True. 

          See Also  File:Read, File:Len.

          Notes     This command is  used in conjunction with  File:Read to
                    create a loop that ends when the last line or record of
                    the file has been read.   This test is the  opposite of
                    the normal C function eof(), because I like testing "If
                    Ok" rather than "If Not EOF".

          Example   See File:Map.


                                      File:Print



          Function  File:Print ( File Printer ) 
                                 ____ _______

          Purpose   Print a File on a printer.

          Returns   None.

          See Also  Arr:Printers


          The JORF Manual (Disk Version)                                 84














          Notes     Printer output  is always a  chore, and never  gets any
                    easier.   Even  after IBM  creates  the great  parallel
                    interface,  that is  standard  and  needs  no  set  up,
                    companies like Hewlett Packard create printers like the
                    original Laserjet that only support serial output.

                    The adjustment to  MS-Windows has caused the  Str:Print
                    and  Char:Print  commands  to be  eliminated,  and this
                    command put in their place.   Support for character-by-
                    character output  to printers was  just too slow  to be
                    tolerable.  

                    This command  prints File  to  the designated  printer.
                    The printer is usually the output from the Jorf:Printer
                    function.  The file can also be SCREEN, FILE, PRN, AUX,
                                                    SCREEN, FILE, PRN  AUX
                    LPT1,  LPT2, COM1, or  COM2  indicate  screen, print to
                    LPT1   LPT2  COM1      COM2
                    file, default printer, auxiliary,  line printer one and
                    two and serial printer  one and two respectively.   The
                    different printing mechanisms are distinct.

                    The of the printer options, the easiest and most robust
                    is to print to  PRN, the default  printer.  To test  to
                                    PRN
                    see  if  your printer  is  working, use  the  DOS PRINT
                                                                      PRINT
                    command to print a small  file.  If it prints normally,
                    you  should  have  no  problems  using  Str:Print "PRN"
                    String.   DOS lets  you  redirect PRN  to any  printer,
                                                      PRN
                    including serial printers.  

                    The next  most robust  is LPT1 and  LPT2.  These  use a
                                              LPT1      LPT2
                    different BIOS call than PRN  so they may not work even
                                             PRN
                    when PRN works  just fine.  These commands  send output
                         PRN
                    to  parallel  printers.    Parallel  printers  may   be
                    identified   by   having   a    thick   cable   and   a
                    bigger-than-normal  connector on the printer end of the
                    cable.  

                    The most difficult type of printer to use is the serial
                    printer.   Serial  ports  COM1  and  COM2  are  general
                                              COM1       COM2
                    communications  ports, and the RS232 standard is not as
                    standard as I would like.   As always, try to get  your
                    printer to work  using the DOS  Print command, and  not
                    with the  JORF interpreter.   If you cannot  print from
                    DOS, I guarantee that you will not print from JORF.

                    You  cannot set  the  speed  of the  port  in the  JORF
                    interpreter.  Instead, use the  DOS MODE command.  Most
                    printers default to 9600  baud, 8 bits, no  parity, one
                    stop bit, that can be set with the following command:

                                   C>Mode Com1:9600,n,8,1,p



          Chapter Six - Library Functions Reference                      85














                    If this works,  put it in your AUTOEXEC.BAT  file so it
                    sets the  port up every  time the computer starts.   If
                    this doesn't  work, check  your printer  manual to  see
                    that the printer and the serial port mode agree.

                    In theory,  the File:Print  supports COM1  to COM9  and
                                                         COM1     COM9
                    LPT1 to  LPT9.   However,  DOS  and Windows  your  BIOS
                    LPT1     LPT9
                    probably don't.   Windows  is especially notorious  for
                    not  handling COM3 and  COM4 correctly, even  when they
                    work under DOS.

                    JORF  does not yet  support any printer  control codes,
                                                any
                    even  under windows.   Your file will  be printed using
                    the  default font  on your  printer.   Page  breaks are
                    respected, and even if your  document does not end with
                    a page break, a formfeed will be added.

                    This  command is  still pretty  basic,  so expect  some
                    refinements soon.

          Example

          Contact:MergeLetter
            New (Dest,Letter,CurrContact)
            Time:Get(Mem:Ptr)

            Letter=File:Load(Contact:GetLetter)
            If (Letter!=Null)
              Dest=Jorf:Printer()
              If (Dest)
                CurrContact=Mem:Ptr->Contact
                Mem:Ptr->Contact=Null
                Win:Add("Printing")
                  Printing . . .
                Rep:Add ("Merge Letter", 5, 5, 60, 75,Here)
                  Header:"" Row:1
                  Next:"Contact:NextRecord('Next')"
                  Text:"Letter"
                File:Print("JREPORT.LST",Dest)
                Mem:Ptr->Contact=CurrContact
            Return (Ok)












          The JORF Manual (Disk Version)                                 86















                                      File:Read


          Function  File:Read ( Name, Level, Size, Offset ) 
                                ____  _____

          Purpose   Read a line of text or a record from a disk file.

          Returns   The line or record that was read.

          See Also  Other File Functions.

          Notes     The File:Read and File:Write commands handle both ASCII
                    and binary files without making any distinction between
                    them.  Name  is required.  Normally  this command reads
                    the next  line  of input  terminated by  the line  feed
                    character.   The line feed character is eliminated from
                    the input text.

                    If Size is  specified then the a binary  file read will
                    take place where  the record is Size bytes.   Offset is
                    specified  then read will  take place at  that position
                    offset.   If not  specified, the current  file position
                    will be used.

                    You  can  return to  the  beginning of  the  file using
                    File:MoveTo  and  can  go  to  a  byte  position  using
                    File:Read with a record size of 1.

                    Reading a  file in  comma delimited,  fixed length  and
                    dBase  format may be  influenced by using  the File:Map
                    function. 

          Example   See Arr:Sort



                                      File:Save


          Function  File:Save ( Name, Text )  
                                ____  ____

          Purpose   Save text to a file. 

          Returns   None.

          See Also  File:Load, File:Backup.

          Notes     Saves a text file wholesale from swap storage, which is
                    much faster than trying to write it line-by-line.  Does
                    not automatically make a backup so if you want one, use
                    File:Backup.

          Chapter Six - Library Functions Reference                      87

















                                      File:Write


          Function  File:Write ( Name, Level, Line, Size, Offset ) 
                                 ____  _____  ____

          Purpose   Write a Record to a disk file.

          Returns   None.

          See Also  Other File Commands.

          Notes     Writes to  the file  for sequential  or binary  output.
                    Name is required.  The file is always opened for update
                    and append.  If you want to create a file, use File:Del
                    to insure that the file is new.

                    If Size is  specified then Line will be  null padded or
                    truncated to the length specified then written to file.
                    If  Offset is specified  then write will  take place at
                    that position offset.   If not  specified, a line  feed
                    character  is appended  and  the  line  is  written  in
                    sequential mode.  

                    You can move  to any byte  position in a file  by using
                    File:Read with a record size of 1.  You can move to the
                    front or back of a file using File:MoveTo.

                    Reading a  file in  comma delimited,  fixed length  and
                    dBase  format may be  influenced by using  the File:Map
                    function. 



                                    For/Thru/Step


          Function  For/Thru/Step 

          Purpose   A counting loop. 

          Returns   None.

          See Also  While.

          Notes     A  specialized loop based on a  numeric counter.  Based
                    on  the BASIC  For/Next loop,  there is  no need  for a
                    "Next"  here   because  indentation   makes  the   loop
                    structure clear.  


          The JORF Manual (Disk Version)                                 88














                    For ( Value = 1 Thru 10 Step 2 ) 
                          _____
                        Lines to do 

                    The BASIC key word "To"  has been changed to "Thru" for
                    the sake of  accuracy.  If  computers are literal,  the
                    commands must  also be literal.   (The BASIC  loop uses
                    "To" but actually goes "Through" the value.)

                    You  can  use Break  to  break out  of a  For  loop, or
                    Continue to continue the loop, just like a While loop.

          Example   For  loops always replace  While loops as  this example
                    shows:

                    For Loop                 While loop equivalent.

                    OnetoTen:Start           OnetoTen:Start
                      New Num                  New Num
                      Win:Add ("One to Ten")   Win:Add ("One to Ten")
                      |                        Num = 1
                      For (Num = 1 thru 10)    While (Num <= 10)
                           Str:PutLine (Num)     Str:PutLine (Num)
                      |                          ++Num

                    In this case,  the first time the loop  is entered, Num
                    is initialized  to 1.   It is  the incremented  by one,
                    until it is greater than  10.  The loop then continues.
                    reaches 10.  

                    You  can see in the above  example that the initializer
                    and  ending condition  are in  a  single line,  and the
                    incrementer is implied, so the For loop is contained in
                    a single  line.  The  while loop takes the  usual three
                    lines  to specify the initializer, ending condition and
                    incrementer.

                    There is one variation on the For loop,  and that is to
                    have  it  increment by  something  other than  1.   For
                    instance, maybe  we want to  count by threes,  or count
                    backwards from  10 to  1.   To do  this,  simply add  a
                    "Step" command to the For loop:


                    For Loop                      While loop equivalent.

                    ByTwos:Start                  ByTwos:Start
                      New Num                       New Num
                      Win:Add ("One to Ten")        Win:Add ("One to Ten")
                      |                             Num = 1
                      For (Num = 1 thru 10 Step 2)    While (Num <= 10)
                           Str:PutLine (Num)          Str:PutLine (Num)
                      |                               Num = Num + 2

          Chapter Six - Library Functions Reference                      89














                      Return                      Return

                    For Loop                      While loop equivalent.
                    TentoOne:Start                TentoOne:Start
                      New Num                       New Num
                      Win:Add ("One to Ten")        Win:Add ("One to Ten")
                      |                             Num = 10
                      For (Num = 1 thru 10 Step -1)   While (Num >= 1)
                           Str:PutLine (Num)          Str:PutLine (Num)
                      |                               --Num
                      Return                        Return



                                         Here


          Function  Here

          Purpose   Return the current method location.

          Returns   The current method location.

          See Also  Win:Add, Event:Add.

          Notes     Returns  the  current  stack position  as  an  unsigned
                    integer.  When  the interpreter is started,  this value
                    is 1,  and each  nested method  increases the  level by
                    one.  The  highest stack  level that  can be  expressed
                    this  way is 65,535  (Hexadecimal ffff).   This command
                    provides  a simple way  of marking windows,  files, and
                    events so The JORF Interpreter can automatically delete
                    them when you are done.

                    The complete display method for a window may be  nested
                    several levels deep.   Usually, the call to the  method
                    uses Here, and the various methods pass that value as a
                    parameter called Level.

                    It is not kosher to  manipulate this value by adding or
                    subtracting  from  it.    Doing  so  will  confuse  the
                    automatic  clearing  mechanism,  which  may  clear  too
                    little or too much.

          Example   See Jorf:Write.








          The JORF Manual (Disk Version)                                 90















                                       If/Else


          Function  If/Else

          Purpose   A conditional branch.

          Returns   None.

          See Also  Switch, While.

          Notes     Tests  the value of  a parameter and  executes indented
                    code sections based on that value. 

                    If ( TestValue ) 
                         _________
                      Lines to do if True
                    Else
                      Lines to do if False

                    Else is optional.

                    The If function tests a condition and branches based on
                        If
                    that condition.   If  the condition  is true,  then the
                    indented section is performed.  If the condition is not
                    true, then program flow skips  to the Else command.  If
                                                          Else
                    there is an Else command on the same indentation level,
                                Else
                    then  the indented section  under that command  will be
                    performed.

                             If (A=2)
                                B=4
                             Else 
                                B=6

                    The condition does not have to be a logical comparison.
                    A single variable may be used instead, in which case it
                    will be True  if it has any  value, and False if  it is
                    null.

                            If (Word)
                              Str:Put (Word)
                            Else
                              Str:Put ("(Null)")

                    The  condition may  be  a complex  comparison involving
                    both logical and value elements

                            If (Counter > 3 && Word)
                              Str:Put ("Counter too large for {Word}")
                            Else
                              ++Counter

          Chapter Six - Library Functions Reference                      91














                    Parentheses around the If test  is optional.  I tend to
                                           If
                    include them, but this is a holdover from my C language
                    days.



                                       Jorf:Cls


          Function  Jorf:Cls

          Purpose   Clear the DOS Screen.  Does nothing under Windows. 

          Returns   None. 

                    Both  the DOS and  the Windows  versions of  JORF place
                    windows on the previous screen contents.  Although this
                    is traditional for Windows programs, most DOS  programs
                    clear the screen instead.   To allow you to follow this
                    custom, this command will  clear the screen in  the DOS
                    version of JORF. 

                    If you clear  the screen while  some windows have  been
                    displayed,  you will get some really weird results when
                    those windows are  later "erased".   Be  sure there are
                    no windows displayed when you clear the screen.



                                       Jorf:Del


          Function  Jorf:Del ( Item ) 
                               ____

          Purpose   Deletes data. 

          Returns   None.

          See Also  Jorf:Add.

          Notes     Deletes the data  associated with Item.  This  may be a
                    Structure or  block of  text.  To  delete a  method use
                    Method:Del.

                    The  system automatically saves data when it is indexed
                    to the Rule system, and  when you use the Jorf:Copy and
                    Jorf:Add commands.  The Data is a permanent part of the
                    data file until it is deleted with this function.

                    There is no  harm in doing  a precautionary delete  for
                    item that has not been saved.


          The JORF Manual (Disk Version)                                 92














          Example

          TextEdit:About
            Msg:Add ("About TextEdit", "Ok")
              Josephine's Text Editor is a sample program &
              included with the JORF Interpreter.  It &
              provides many of the functions as other &
              text editors, and is written in only 100 &
              lines of program code.

              Version 1.0                   August 25, 1991
                Copyright (C) 1991 by The JORF Company
            Return Ok

          TextEdit:Load
            New (Array, Pos, Name Text)
            Win:Add ('Reading')
              Reading and Sorting directory
            Array = Arr:Sort (Arr:Dir ("*.*","EXE,COM,BAK,OBJ,LIB,,JRF"))
            Win:Del
            Event:Add
            While (Name=Null)
              Pos   = Arr:Pick (Array,Null,"Files", 0, 0, 10, 1)
              If (Pos='Esc_Key')
                Return (Null)
              Name  = Str:At (Array[Pos], 1, Str:In (Array[Pos] " "))
              If (Name)
                EditKey:FinishEdit
                Jorf:Del (Win:Ptr->Edit)
                Win:Ptr->Name = Name
                Win:Ptr->Edit = TextEdit:Read (Name)
            Return Text

          TextEdit:Read (FileName)
            If (FileName)
              If (File:Access (FileName))
                Win:Add ('Reading')
                  Loading file "{FileName}"
                Return (File:Load (FileName))
              Else
                Msg:Add ('Error', 'Ok')
                  Cannot Access File "{FileName}"
            Return (Text:Add)

          TextEdit:Save
            TextEdit:Write (Win:Ptr->Name, Win:Ptr->Edit)
            Jorf:Del (Win:Ptr->Copy)
            Return Ok

          TextEdit:ReName
            New Key, FileName


          Chapter Six - Library Functions Reference                      93














            FileName = Win:Ptr->Name
            Win:Add ('File Name')
              Input:'File Name to Save ', Wid:30, Field:'FileName'
            Wnd:Del
            If (Key:Got != 'Esc_Key' And FileName != Null)
              If (File:Access (FileName) != 0)
                Key=Msg:Add ('File Already Exists' 'No')
             File "{FileName}" Already Exists!
             Do you want to overwrite it?
                If (Key:Got==Null)
             FileName=Null
              If (FileName)
                Win:Ptr->Name = FileName
            Return Ok

          TextEdit:Start FileName
            New Win
            Win->Name  = FileName
            Win->Edit  = TextEdit:Read (FileName)
            Win->Title = "Josephine's Text Editor"
            Win->Magic = False
            Win->FLRCO = "Off"
            Win->Idle  = "Editkey:Message"
            Win->After = "Editkey:FinishEdit"
            Win->Save  = "TextEdit:Write (Win:Ptr->Name, Win:Ptr->Edit)"
            Win->Text  = Text:Ptr
              Menu:'&About'               Action:'TextEdit:About'
              Menu:'&Load'                Action:'TextEdit:Load'
              Menu:'&Save'                Action:'TextEdit:Save'
              Menu:'&Rename'              Action:'TextEdit:ReName'
              Menu:'&Key Help'            Action:'Editkey:Ctrl_F1_Key'
              Menu:'&DOS Shell'           Action:'Jorf:System'
              Menu:'E&xit'                Action:'Return "Esc_Key"'
              Text:'Notes', Field:'Win:Ptr->Edit'
            Event:Add ('Editkey','Key',Here)
            Win:Add (Win, 1, 1, -1, -1, Here)
            Jorf:Exit

          TextEdit:Write (FileName, Text)
            If (FileName And Text)
              Win:Add ('Writing')
                Saving file "{FileName}"
              File:Save (FileName, Text)
            Return Ok









          The JORF Manual (Disk Version)                                 94















                                       Jorf:Do


          Function  Jorf:Do ( MethodName ) 
                              __________

          Purpose   Interpret a string as a command. 

          Returns   Return value of command.

          See Also  Event:Do.

          Notes     Interprets  a string as if it were  a command.  This is
                    used to execute a command that has been assembled using
                    string  values.  This  ability allows the  assembly and
                    execution  of new  commands and  methods  by a  program
                    which then immediately calls them.  

          Example




                                       Jorf:Dup


          Function  Jorf:Dup ( Item ) 
                               ____

          Purpose   Make a copy of a Text or Structure.

          Returns   A duplicate copy of Item.

          See Also  Jorf:Del.

          Notes     This command is used to create a duplicate copy of Item
                    so  you can change  it without affecting  the original.
                    This  command will automatically  write both  copies to
                    the current  project file,  so if  they are  temporary,
                    they must be deleted using Jorf:Del.

          Example   See Jorf:Del.


                                      Jorf:Exit


          Function  Jorf:Exit ( Status, Message, Command ) 

          Purpose   Exit from The JORF Interpreter.

          Returns   Does not return.


          Chapter Six - Library Functions Reference                      95














          See Also  Jorf:System.

          Notes     Flushes  disk caches and memory items, closes all files
                    and  windows,  exits  to the  operating  system.   This
                    function  is called  involuntarily when  a fatal  error
                    occurs.  

                    If  Status  has  a  value,  this  is  returned  to  the
                    operating system.  

                    Message  and  Command  may  only  be used  in  the  DOS
                    version.  If Message has a value, it is displayed after
                    the original screen is restored.  Generally, Message is
                    used only to report fatal errors.

                    The Command may be used to chain to other programs.   I
                    have had difficulty making  this work consistently with
                    all files  because various versions of DOS are a little
                    quirky.  In  general, you can chain to  any batch file,
                    .COM  file  or  .EXE  file,  and  can  pass  up  to  10
                    parameters (or 110  bytes whichever is longer)  to that
                    file.   Programmers may note that I prefix your command
                    with "Command " to invoke a DOS shell and preserve path
                         "Command "
                    and batch file capabilities.

          Example

          MsgBoxes:YesNo
            New Result
            Result=Msg:Add ("Yes/No", "Yes")
              This is a yes-No Box!
            If (Result)
              Msg:Add
                you picked yes
            else
              Msg:Add
                you picked no
            Return Ok

          MsgBoxes:NoYes
            New Result
            Result=Msg:Add ("No/Yes", "No")
              This is a No-Yes Box!
            If (Result)
              Msg:Add
                you picked yes
            else
              Msg:Add
                you picked no
            Return Ok

          MsgBoxes:OkBox

          The JORF Manual (Disk Version)                                 96














            New Result
            Result=Msg:Add ("Ok", "Ok")
              This is an Ok Box!
            If (Result)
              Msg:Add
                You picked Ok
            else
              Msg:Add
                You hit the escape key.
            Return Ok


          MsgBoxes:Cancel
            New Result
            Result=Msg:Add ("Cancel", "Cancel")
              This is an Cancel Box!
            If (Result)
              Msg:Add
                You picked Ok
            else
              Msg:Add
                You Canceled
            Return Ok

          MsgBoxes:Start
            Win:Add ("Message Test")
              MLine:"&Yes",   Action:"MsgBoxes:YesNo"
              MLine:"&No",    Action:"MsgBoxes:NoYes"
              MLine:"&Cancel",Action:"MsgBoxes:Cancel"
              MLine:"&Ok",    Action:"MsgBoxes:OkBox"
              MLine:"&Exit",  Action:"Jorf:Exit"





                                      Jorf:File


          Function  Jorf:File ( Name Level ) 

          Purpose   Declares  a project  file, gets  the  name of  existing
                    project file.

          Returns   Previous project file name.

          Notes     Project  files  hold  indexes  and  data,  classes  and
                    methods.   All of a  JORF language application  can run
                    out   of  a  single  project  file.    However,  it  is
                    advantageous to split     various types of  information
                    into various files.   Jorf:File declares a  new file to
                    be used by the interpreter.

          Chapter Six - Library Functions Reference                      97














                    The new  file is tied  to the stack using  Level, which
                    must be the value  of Here from the calling method.  If
                    the  name  and  level are  absent,  this  function just
                    returns the current file.  If they are present, the new
                    file is used by the interpreter.

                    Methods are searched in the  current file, and then  in
                    the  base  project  METHODS.JRF.     The  system   also
                    allocates a  project  called  SWAPFILE.JRF  for  memory
                    swapping.  Indexed data is searched only in the current
                    file.

                    I  created this  use  of  files  without  precedent  or
                    experience.  It  much looser than any file definition I
                    have  ever seen  in  a computer  system.   However,  it
                    works,  and it has  some redeeming features.   For one,
                    the files  are established  in relative  positions, and
                    may be freely moved or renamed without compromising the
                    data in  those files.   A file  may even be  shipped to
                    another  system, and used  without any further  set up.
                    This  works  because the  interpreter insures  that the
                    data and  indexes in  a given project  file are  always
                    synchronized.

                    The  other redeeming feature  is the simplicity  of the
                    scheme.   You don't really open the  file, allocate it,
                    expand  it or  close it.   This command  basically says
                    "Use this file for a while" and the interpreter does. 

          Also Note When  creating   a   program  in   the  debugger,   the
                    interpreter automatically does a Jorf:File for the file
                                                     Jorf:File
                    you are  working on.   For instance, when you  load the
                    Haiku.J source file, the interpreter executes Jorf:File
                    Haiku.J                                       Jorf:File
                    "Haiku.Jrf"  Here before it runs the program.  However,
                    "Haiku.Jrf"  Here
                    if you translate  your program to  the C language,  and
                    compile it, the interpreter is no longer available, and
                    you must open the file yourself. 

                    The best  explanation of  how this  system works  comes
                    from running  the interpreter with the  Memory Info=Yes
                                                            Memory Info=Yes
                    flag set in the JORF.INI  file.  This creates a display
                    of memory usage and current file information.  

                    If  you  run the  tutorial,  you can  watch  the system
                    switch to  the tutorial file,  and the help  file, when
                    you enter those menus. 

          Example   See Jorf:Write.





          The JORF Manual (Disk Version)                                 98















                                      Jorf:Flush


          Function  Jorf:Flush ( Size ) 

          Purpose   Flushes memory to disk. 

          Returns   None.

          Notes     If Size is present and not zero, checks to see if  that
                    much  memory (in kilobytes) is available.   If so, then
                    does  nothing.  If  not, then flushes  memory to obtain
                    space.  Always flushes if Size is zero or absent.  This
                    command  may  be  used  to  insure  that  a  particular
                    procedure,  like  obtaining  entry  from  a data  input
                    screen, can be completed without unnecessary delays due
                    to memory flushes.

                    Items  that  are   flushed  generally  fall   into  two
                    categories; items that are needed again, and items that
                    are not.   Those  which are needed  again will  be read
                    from   disk   resulting  in   spectacular   performance
                    degradation.   Those which  are not  will stay  on disk
                    where they belong.

                    JORF  uses this command internally whenever it runs out
                    of memory.   It is supplied here as  a Function because
                    some  Methods may see improved performance if memory is
                    checked and flushed before or after they are invoked.  



                                      Jorf:Pack


          Function  Jorf:Pack 

          Purpose   Packs a JORF file. 

          Returns   None.

          See Also  Jorf:Rebuild.

          Notes     Converts the  current JORF file to a special ASCII file
                    format.   This format retains  all data, but  omits any
                    indexes.    It  also   contains  offsets  to  recursive
                    structures  and sparse structures such as large arrays.
                    Packed files have the extension JPK.

                    Because  the packed format does not contain indexes, it
                    is usually half  the size of the .JRF file.   This file

          Chapter Six - Library Functions Reference                      99














                    can be  used to rebuild a .JRF file.   The file must be
                    rebuilt with the appropriate class definitions, so that
                    indexes are added properly.



                                     Jorf:Printer



          Function  Jorf:Printer

          Purpose   Displays a preprogrammed printer selection box.
          ]
          Returns   None.

          See Also  Arr:Printers, File:Print

          Notes     This command displays a standard pre-programmed printer
                    selection box to save you the time of creating one.  It
                    is  really  a  JORF  language routine,  translated  and
                    compiled  into the JORF interpreter.  The example below
                    shows the actual code for this routine.

          Example

          Jorf:Printer
            New (PrintList,PrintChoice,Dest)

            Event:Add()
            PrintList = Arr:Printers()
            Win:Add("Select Printer")
              Group:"&Printers", Row:1 Col:1 Len:6 Wid:22
              Array:"" Field:"PrintList" Choice:"PrintChoice"

              Button:"   &Go   " Row:1 Col:32
                Action:"Dest=PrintList[PrintChoice]"
              Button:" &Cancel " Row:4 Col:32 Action:"Return ('Esc_Key')"
            If (Dest='Esc_Key' Or Kbd:Got='Esc_Key')
              Dest=Null
            Return(Dest)












          The JORF Manual (Disk Version)                                100















                                       Jorf:Ptr


          Function  Jorf:Ptr

          Purpose   Get Stack top and last error information. 

          Returns   None.

          See Also  Mem:Ptr, Win:Ptr.

          Notes     Returns  Mem:Ptr with various elements reset to current
                    values.    This function  is  a catchall  to  pass some
                    quirky internal values to JORF language programs.

                    Values returned are:

                    Jorf:Ptr->NumFiles  | Number of files open
                    Jorf:Ptr->MemFree   | Current free memory
                    Jorf:Ptr->StackLevel  | Current stack nesting level
                    Jorf:Ptr->StackTop  | Top of stack 
                    Jorf:Ptr->WinTop    | Top Window Structure

                    | In an error event, the following values are set
                    Jorf:Ptr->ErrNum    | Error Number
                    Jorf:Ptr->ErrMsg    | Error Message
                    Jorf:Ptr->ErrLine   | Line in interpreter at Last Error




                                     Jorf:Rebuild


          Function  Jorf:Rebuild 

          Purpose   Packs and rebuilds a JORF file. 

          Returns   None.

          See Also  Jorf:Pack.

          Notes     Rebuilds  a .JRF  file  by  copying  data to  an  ASCII
                    format,  erasing the  original, and  reading the  ASCII
                    data  back in.   Indexes  are not  copied, and  are re-
                    created after the data is read.

                    To rebuild a file, you must not be using any methods or
                    data  in that file.   The rebuild will  tell you if you
                    have any  live pointers,  and you will  not be  able to
                    rebuild.

          Chapter Six - Library Functions Reference                     101














                    You  can rebuild  from the  command line  using the  -R
                                                                         -R
                    option.  You must first specify  the file that contains
                    the class definitions, and then -R and then the file(s)
                                                    -R
                    you want rebuilt.

             JORF Contact -R Contact.Dat     Rebuilds the contact file.
             JORF Contact -R Contact.Dat





                                      Jorf:Sound


          Function  Jorf:Sound ( Frequency, Duration ) 

          Purpose   Make beautiful music together. 

          Returns   None.

          Notes     The  built in  sound  capability in  the  IBM PC  style
                    computer  is very primitive.  You cannot control volume
                    at all, and  the system uses a square  wave that sounds
                    real mechanical. 

                    This command makes  a sound at the  specified Frequency
                    for at  least the  specified Duration  (in  18ths of  a
                    second).   The sound must  end when the  duration ends,
                    and on many speakers this produces an audible click. 

          Example

          Boing:Sound
            Jorf:Sound(220, 16)
            Jorf:Sound(180, 10)
            Return

          Boing:start
            New Row, Col, Len, Wid, Char, RowDir, ColDir
            Win:Add ("Boing", 0, 0, 10, 50, Here)
            Char = 1
            RowDir = Num:Rand (-1, 1)
            ColDir = Num:Rand (-1, 1)
            Row = 10
            Col = 40
            Len = Win:Ptr->Len
            Wid = Win:Ptr->Wid
            Move:To (Len,1)
            Str:PutLine ("Press any key to Re-Boing.  Press Escape to
          Exit")
            While Ok
              If Key:Hit

          The JORF Manual (Disk Version)                                102














                If Key:Get == 'Esc_Key'
                  Break
                RowDir = Num:Rand (-1,1)
                ColDir = Num:Rand (-1,1)
                Boing:Sound
              Move:To (Row, Col)
              Char:Put (' ')
              Row = Row + RowDir
              Col = Col + ColDir
              Move:To(Row,Col)
              Char:Put(Char)
              Move:To (Len,1)
              Switch
                Case (Row >= Len-1)
                  Boing:Sound
                  RowDir = (-1)
                Case (Row < 2)
                  Boing:Sound
                  RowDir = 1
              Switch
                Case (Col >= Wid)
                  Boing:Sound
                  ColDir = (-1)
                Case (Col < 2)
                  Boing:Sound
                  ColDir = 1
            Return







                                     Jorf:System


          Function  Jorf:System ( Command ) 

          Purpose   Execute DOS shell or DOS command.

          Returns   None.

          See Also  Jorf:Exit.

          Notes     Under DOS, this command executes the DOS shell.  In the
                    Windows  version, this command  does nothing.   I guess
                    Microsoft wants  you to click  other windows to  get to
                    the  shell,  rather than  letting  programmers  like me
                    arrange it for you. 



          Chapter Six - Library Functions Reference                     103














                    If Command  is not  used or is  Null then  the operator
                    will  be transferred to  an operating system  shell and
                    must type  EXIT to return to  JORF.  To obtain  as much
                    memory  as  possible,  the system  automatically  calls
                    Jorf:Flush  before executing  this call.   You  usually
                    have about 200K in the shell.



                                      Jorf:Write


          Function  Jorf:Write ( Item ) 
                                 ____

          Purpose   Write an item to current Data file. 

          Returns   None.

          See Also  Jorf:Del.

          Notes     Writes Item to the current project file.  Normally, the
                    interpreter saves  data when  it is  indexed using  the
                    rule  system.   However,  there  are times  when  it is
                    advantageous to "permanize" an item by hand. 

                    In particular, Arrays are  considered temporary if they
                    are based  on a temporary  item.  When the  method that
                    creates the  array ends,  the array  is cleaned  by the
                    interpreter unless it  is permanized. You can  make the
                    array permanent using  Jorf:Write to write it  to file.
                    In  doing so, you  are taking responsibility  for later
                    deleting it.

          Example

          Class:Haiku Text Arts Adjs Nouns Verbs Preps

          Haiku:Array (Text)
            | Text may be multiple lines of comma delimited words
            | Need to create an array with these words, write it, and
            | return it.
            New Line, CurWord, Word, WordCount, Arr, ArrCount
            New Spaces
            Line = Text
            Spaces = Str:Ind(Line)
            While (Line)
              WordCount = 0
              While (WordCount <= Word:Len (Line))
                ++WordCount
                CurWord = Word:At (Line, WordCount)
                If (CurWord = ',' Or Curword = Null)
                  ++ArrCount

          The JORF Manual (Disk Version)                                104














                  Arr[ArrCount]=Word
                  Word=Null
                Else
             If (Word)
                    Word = Word + " "
                  Word = Word + CurWord
              Line = Text:Next (Line)
              If (Str:Ind(Line) < Spaces)
                 Break
            Jorf:Add (Arr)
            Return Arr

          Haiku:Display (Haiku, Level, Text)
            New Spaces CurLine CurWord Pos
            New NewWord NewLine NewText
            New TextWin:Win
            Spaces = Str:Ind (Text)
            While Text
              Pos = Word:Len (Text)
              While Pos > 0
                CurWord = Word:At (Text, Pos)
                Switch CurWord
                  Case 'Art'
               NewWord = Haiku:Word (Haiku->Arts)
                    If NewWord = "a"
                 If (Str:Aft (NewLine,"aeiou") < 2)
                        NewWord = "an"
                  Case 'Noun'
               NewWord = Haiku:Word (Haiku->Nouns)
                  Case 'Adj'
               NewWord = Haiku:Word (Haiku->Adjs)
                  Case 'Verb'
               NewWord = Haiku:Word (Haiku->Verbs)
                  Case 'Prep'
               NewWord = Haiku:Word (Haiku->Preps)
                  Else
                    NewWord = CurWord
                If Pos = 1
             NewWord = To:Caps (NewWord)
                NewLine = NewWord + NewLine
                --Pos
              NewText = Text:Add (NewLine, NewText)
              NewLine = Null
              Text = Text:Next (Text)
              If (Spaces > Str:Ind (Text))
                Break
            Win->Level = Level
            Win->Text  = Text:Top (NewText)
            Win:Add (Win)

          Haiku:Else (Key)
            Return (Key)

          Chapter Six - Library Functions Reference                     105














          Haiku:Ini
            New Rule:Rule Haiku:Haiku
            Rule->Type = 1
            Rule->Obj  = 'Haiku'
            Rule:Find (Rule)
            If (Rule->Fnd)
              Haiku=Rule->Ptr
            Else
              Haiku->Arts = Haiku:Array
                a, the
              Haiku->Adjs = Haiku:Array
                autumn, hidden, bitter, misty, silent, empty
                dry, dark, sighing, delicate, quiet
                white, cool, frigid, winter, dappled
                twilight, afternoon, crimson, wispy, azure
                blue, billowing, broken, cold, damp, falling
                frosty, tawny, long, late, lingering
                little, morning, leafy, billowing
                still, small, sparkling, cloudy
                wandering, withered, wild, black, young
              Haiku->Nouns = Haiku:Array
                waterfall, mist, breeze, moon
                rain, wind, sea, morning, snow, glitter, forest
                Josephine, cloud, meadow, sun, glade, bird, brook
                butterfly, tove, dew, savannah, meadow
                flower, firefly, feather, grass, haze, mountain
                night, goat, shade, snowflake
                silence, lily, sky, shape, surf, thunder
                violet, water, wildflower, wave
              Haiku->Verbs = Haiku:Array
                drifts, has stopped, blusters, raps
                shlepped over, races, did gyre and gimble, stretches
                flutters, has risen, is drifting, is trickling
                murmers, is floating, twas brilling
              Haiku->Preps = Haiku:Array
                on, in, beneath, over, near, of
              Jorf:Add (Haiku)
              Jorf:Global->Haiku = Haiku
              Rule->Ptr=Haiku
              Rule:Add (Rule)
            Return (Haiku)

          Haiku:Start
            New Haiku:Haiku Count
            Event:Add ("Haiku", "Key", Here)
            Jorf:File ("Haiku", Here)
            Haiku=Haiku:Ini
            While (Ok)
              While Count < 10
                Switch Num:Rand (1, 4)
                  Case 1
               Haiku:Display (Haiku, Here)

          The JORF Manual (Disk Version)                                106














                      Art Adj Noun . . .
                      Art noun verb prep art noun
                      Adj Adj Noun
                  Case 2
               Haiku:Display (Haiku, Here)
                      Noun Prep Art Noun
                      Art Adj Noun Prep Art Noun
                      Adj Noun
                  Case 3
               Haiku:Display (Haiku, Here)
                      Art Adj Noun
                      Art Adj Noun
                      Art Noun Verb
                  Case 4
               Haiku:Display (Haiku, Here)
                      Art Adj Noun Verb
                      Art Adj Noun
                      Prep Art Adj Noun
                If (Key:Hit)
             If (Key:Get = "Esc_Key")
                    Jorf:Exit
                ++Count
              While (Win:Ptr)
                Win:Del
              Count = 0
            Jorf:Exit

          Haiku:Word (Arr)
            New Word Off
            Off = Num:Rand (1, Word:Len (Arr))
            Word = Arr[Off]
            Return Word + " "



                                       Kbd:Bye


          Function  Kbd:Bye

          Purpose   Clear keyboard stream. 

          Returns   None.

          See Also  Kbd:Get.

          Notes     Kbd:Bye does not read or process the keys, it just gets
                    rid of them.





          Chapter Six - Library Functions Reference                     107















                                       Kbd:Get


          Function  Kbd:Get ( CursorSize ) 

          Purpose   Get a Keystroke from the Keyboard.

          Returns   Keystroke value.

          See Also  Kbd:Hit, Kbd:Got, Kbd:Put, Line:Inp.

          Notes     Waits until  the operator  hits a key  and returns  the
                    value  of that character.   If CursorSize is "None", no
                    cursor  is displayed.    If it  is  "Little", then  the
                    cursor will be a blinking line, and if it is "Big", the
                    cursor will be a blinking block.  Only the first letter
                    is significant.   If it is absent or  null, "Little" is
                    assumed.

                    The return value is always a string indicating  the key
                    that was hit.   This is a departure  from most language
                    that returns  an integer  value.    The key  values are
                    outlined in Appendix C.  
                                Appendix C

                    The Event  System processes  keystrokes using  Event:Do
                    Value "Key".  This  processing may change the value  of
                    the   key,  display  a  message,  or  move  the  cursor
                    location.    It  is especially  important  during field
                    input  and text  input  to  remember  that  the  cursor
                    location may change during a Key:Get.  

          Example

          WhatKey:Start
            | Sample for: Key:Get, Event:Add
            New Key
            Win:Add ("What Key?", 5, 15, 10, 50)
            Win:Msg ("Press Alt-X to Quit")

            While (Ok)
              Str:Put ("Press a Key: ")
              Key = Kbd:Get ("Big")
              Str:PutLine ('That was the "' + Key + '".')
            Jorf:Exit








          The JORF Manual (Disk Version)                                108















                                       Kbd:Got


          Function  Kbd:Got

          Purpose   Find out what the last Keystroke was. 

          Returns   Keystroke value.

          See Also  Kbd:Hit, Kbd:Get, Line:Inp.

          Notes     Returns  the value  of  the  last  keystroke.    Always
                    returns the  key value,  even if  the event system  may
                    have caused Kbd:Get to return a different key value. 
                                Kbd:Get

                    The return value is always a string indicating the  key
                    that was hit.  The  key values are outlined in Appendix
                                                                   Appendix
                    C.  
                    C



                                       Kbd:Hit


          Function  Kbd:Hit

          Purpose   Check to see if a key has been hit.

          Returns   True if a key has been hit.  Otherwise False.

          See Also  Kbd:Get.

          Notes     Kbd:Hit does not read or  process the keystroke in  any
                    way.  To find out what key was hit, use Kbd:Get. 


                                       Kbd:Put


          Function  Kbd:Put ( Value ) 
                              _____

          Purpose   Stuff the keyboard buffer with keys. 

          Returns   None.

          See Also  Kbd:Get.

          Notes     This function allows  you to stuff any  keys, including
                    mouse keys, into the input buffer.  There are two basic
                    formats you can use:


          Chapter Six - Library Functions Reference                     109














                         1. An individual keystroke command.
                         2. A string of characters to stuff.

                    It is common  to mix these two formats.   For instance,
                    to stuff the  keyboard to fill three data entry fields,
                    you might use the following six commands:

                         Kbd:Put ("This goes into Field 1")
                         Kbd:Put ("Enter_Key")
                         Kbd:Put ("This goes into Field 2")
                         Kbd:Put ("Enter_Key")
                         Kbd:Put ("This goes into Field 3")
                         Kbd:Put ("F10_Key")

                    After keys are  stuffed, the JORF language  cannot tell
                    them from keys that are  input.  The keyboard  handling
                    system as  a dynamically  reallocating buffer,  that is
                    limited only by  the size of your near memory.  You can
                    generally  stuff  more  than  1000  keystrokes  without
                    running out of memory. 

                    You can  use this  facility to run  programs that  read
                    entry from batch  files.  Just create a  way to specify
                    the file name, and then read the file into the keyboard
                    buffer.



                                       Key:Add


          Function  Key:Add ( RuleStructure ) 
                              _____________

          Purpose   Add a String Key to the data base.

          Returns   None.

          See Also  Rule:Add.

          Notes     RuleStructure  must be  a compound  structure with  the
                    elements Type,  Obj, Str,  Ptr, Fnd  (found), and  KLen
                    (Key Length).   The last  two elements are used  by Key
                    "Find"  to get next key in  a series.  The elements Att
                    and Val used by Rule:Find are replaced here by Str.   

                    Key:Add adds a new string  key valued Obj and Str, with
                    the  associated data  in Ptr.    Probability cannot  be
                    added as  with the Rule:Add  function.  The key  may be
                    found again by specifying the correct Obj, and by doing
                    a partial or whole key search on the Str value.



          The JORF Manual (Disk Version)                                110















                                       Key:Del


          Function  Key:Del ( RuleStructure ) 
                              _____________

          Purpose   Deletes an existing string key.

          Returns   None.  RuleStructure->Fnd will be True if key was found
                    and deleted.

          See Also  Key:Find.

          Notes     Deletes an existing  string key.   This command may  be
                    called with a partial key  value, in which case it will
                    delete the first entry by that value.  

                    After an entry is deleted, you are still able to go the
                    "next" entry.  
          Example   See Key:Add.



                                       Key:Find


          Function  Key:Find ( RuleStructure ) 
                               _____________

          Purpose   Find a key.

          Returns   None.

          See Also  Rule:Find, Key:Next.

          Notes     In this  function, parameters  may be  empty, in  which
                    case the first  matching index entry will  be returned.
                    Parameters must be  empty from left to  right, that is,
                    if Str has a value then Obj also must have a value.  If
                    a "hole" is left, then nothing will ever be found.

                    When a key is found,  the structure will be filled with
                    the values of that key and Fnd will be set to True.  If
                    Key:Next is called with these values set, then the next
                                                                       next
                    key value  is returned.  This process  may be continued
                    until the value  of the current key does  not match the
                    value of the original partial  key.  This length is put
                                 original partial  key
                    in  KLen after  every  successful  search  and  may  be
                    modified.

                    Although this process appears quirky, in practice it is
                    easy  and intuitive.   Generally,  string  keys have  a
                    "type" in Obj.  Commonly, the first key of that type is

          Chapter Six - Library Functions Reference                     111














                    searched, and  then all subsequent keys displayed since
                    they have the same  type.  When the type changes in the
                    index, the list has been completed.

                        Efficiency Notes for Technical People
                        Efficiency Notes for Technical People

                    I  use a B-Tree  algorithm with  a branching  factor of
                    about 20.   This type  of index is most  efficient when
                    handling indexes with more than 1000 keys.  This is the
                    opposite  approach as that  used by dBASE  and Clipper,
                    which is most efficient for smaller indexes.

                    The algorithm always uses at  least half the node.  The
                    node size  is 1 Kilobyte.   The average keys used  in a
                    node  is about 15.   So the efficiency  of this tree is
                    expressed as powers of 15:

                         One Read               15 Keys
                         Two Reads             225 Keys
                         Three Reads         3,375 Keys
                         Four Reads         50,625 Keys
                         Five Reads        759,375 Keys
                         Six Reads      11,390,625 Keys
                         Seven Read          s
                                       170,859,375 Keys
                         Eight Reads 2,562,890,625 Keys

                    JORF uses an internal disk cache for this tree to avoid
                    repeated disk reads.  Usually, the first two levels are
                    cached giving access  to up  to 225  nodes without  any
                    disk reads at all.   Other recently read nodes are also
                    cached  because indexes  are  often read  sequentially.
                    The  largest  tree  shown  here  would  require 166,854
                    Megabytes of disk space.



                                       Key:Next


          Function  Key:Next ( RuleStructure ) 
                               _____________

          Purpose   Find next key in sequence.

          Returns   None.

          See Also  Key:Find, Chapter Six.

          Notes     If RuleStructure->KLen is zero, then this command works
                    just like KeyFind.   If it  is not zero, then  the next
                    key  in sequence is returned.  When a key is found, the
                    structure will  be filled with  the values of  that key
                    and  Fnd will  be set  to True.   This  process may  be

          The JORF Manual (Disk Version)                                112














                    continued until the  value of the current  key does not
                    match the length specified.  Values for Klen are: 

                    0    Rules with the same Type match
                    1    Rules with the same Type+Obj match
                    2    Rules with the same Type+Obj+(Partial)Str match
                    3    Rules with the same Type+Obj+Str match


                                       Key:Prev


          Function  Key:Prev ( RuleStructure ) 
                               _____________

          Purpose   Find previous index value.

          Returns   None.

          See Also  Key:Find, Key:Next, Chapter Six.

          Notes     This function is the opposite of Key:Next.



                                       Line:Del


          Function  Line:Del ( Count ) 
                               _____

          Purpose   Delete a  Count lines of  text displayed in  an editing
                    window.

          Returns   None.

          See Also  Line:Inp.

          Notes     Deletes Count  lines of  text on  the input  screen and
                    handles appropriate scrolling functions.  The text must
                    have been displayed by a legitimate text input routine.
                    Placing text on  the window "by hand" does  not make it
                    an input structure  appropriate for handling  with this
                    function.

                    Lines will  be inserted if Count is  negative.  Nothing
                    will happen if  it is zero.  If the cursor is in column
                    1, then the line will be appended on the previous line.
                    The  Join ability  makes it  symmetrical with  Line:Ins
                         Join
                    which can Split text lines.
                              Split

          Example



          Chapter Six - Library Functions Reference                     113















                                       Line:Inp


          Function  Line:Inp ( Field, Row, Column, Length, Width )  
                               _____

          Purpose   Input a data entry field or multiple line text.

          Returns   None..

          See Also  Line:Out, Text:Add.

          Notes     This command may now be functionally obsolete, replaced
                    by the powerful  window management Input command.   For
                    the moment, it  does no harm to have  an extra function
                    that allows you to input a single item on a  data entry
                    screen. 

                    To Highlight the field before entry, use Line:Out.



                                       Line:Ins


          Function  Line:Ins ( Count )  
                               _____

          Purpose   Inserts Count lines in current edit window.

          Returns   None.

          See Also  Line:Inp, Line:Del.

          Notes     Inserts  Count lines at the current cursor location and
                    handles appropriate scrolling functions.  Lines will be
                    deleted if Count is  negative.  Nothing will happen  if
                    it is zero.  

          Example   How about the Ctrl-N method from the editor.
                                  Ctrl-N

                    EditKey:Ctrl_N_Key          | Insert Line 
                      Win:Ptr->Prefix=Null           |  ^Q  Prefix  is  now
                    meaningless
                      EditKey:Changed             |  You've ruined it, must
                    show menu
                      Line:Ins (1)              | Insert one line
                      EditKey:Message           | And  show current pos and
                    status





          The JORF Manual (Disk Version)                                114















                                       Line:Out


          Function  Line:Out ( Field, Row, Column, Length, Width )  
                               _____

          Purpose   Output a data entry field or multiple line text.

          Returns   None.

          See Also  Line:Inp, Text:Add.

          Notes     This command may now be functionally obsolete, replaced
                    by the powerful  window management Input command.   For
                    the moment, it  does no harm to have  an extra function
                    that allows you to input a single item on a  data entry
                    screen.     To  highlight,  call  Win:Att  to  set  the
                    attribute, then this  command to display line  or field
                    with that attribute.


                                       Line:Rel


          Function  Line:Rel 

          Purpose   Release  input, forcing  data to  be  re-read from  the
                    field. 

          Returns   None.

          Notes     When data entry  is done, there  is an internal  buffer
                    that temporarily holds the field value.  If a keystroke
                    function  changes  that  value,  this  buffer  must  be
                    released,  so  that  the  value  is  re-read  from  the
                    original field.  This mechanism saves you from worrying
                    about data displayed  on the screen when  you change it
                    underneath. 


                                       Mem:Ptr


          Function  Mem:Ptr

          Purpose   Set or check global values.

          Returns   None. 

          Notes     Global  variables are  values that  may  be tested  and
                    changed by any method.  They  are a key feature of  the
                    BASIC and dBASE languages.  However, I  don't like them

          Chapter Six - Library Functions Reference                     115














                    one bit,  because you can  never really depend  on them
                    holding their values as program flow  passes in and out
                    of other people's subsystems.  

                    The  JORF Language has  only one true  global variable,
                    Mem:Ptr.    This is  a  structure  of the  Jorf  class.
                    Mem:Ptr                                    Jorf
                    Structures  of this  class  are  allowed  to  have  any
                    element,  without any  declaration.   As  you run  your
                    program,  any time  you need  to save  a value,  set it
                    using Mem:Ptr.   Later,  you can  retrieve it  the same
                          Mem:Ptr
                    way: 

                    Mem:Ptr->Test = "Hi Jo"       | Set global value "Test"
                    Str:PutLine Mem:Ptr->Test     | Use global value "Test"

                    You  should  avoid  using  too  many global  variables.
                    Doing   so  is  an  indication  that  your  program  is
                    structured poorly.   You are probably working  too hard
                    kludging  around, when  you should  be  creating a  new
                    class definition to pass values to your methods. 

          Example   See Event:Add.



                                      Method:Add


          Function  Method:Add ( Text )  
                                 ____

          Purpose   Write text including indexes used by the interpreter to
                    call methods. 

          Returns   None.

          See Also  Method:Del.

          Notes     This function  differs from  Jorf:Add only  in that  it
                    looks  for a  method name  on  the first  line, and  if
                    found, adds the  appropriate indexes so the  method may
                    be  found  again.       Methods  are  also  indexed  by
                    Class:Read and Class:Check.  

                    This  command does something  distressing if the method
                    already exists.  If you are editing an existing method,
                    there is no problem.  
                    But  if you  have created  a  new copy  of an  existing
                    method, Method:Write must resolve this so there is only
                    one copy.  What it does is to move your current copy to
                    the  location of  the  existing  copy.    Your  editing
                    changes stick, but  your pointer Text will  be deleted.


          The JORF Manual (Disk Version)                                116














                    Whenever  you use Method:Write,  be aware that  you may
                    lose your pointer.
           


                                      Method:Del


          Function  Method:Del ( Text ) 
                                 ____

          Purpose   Delete text including indexes used for calling method.

          Returns   None.

          See Also  Jorf:Del.

          Notes     This function  differs from  Jorf:Del only  in that  it
                    looks  for a  method name  on  the first  line, and  if
                    found,  deletes  any  index references.    Methods  are
                    indexed  automatically  by Class:Read  and  Method:Add.
                    There is no  harm in passing all text  to this command,
                    it gives no error if the indexes are not found.
           
          Example   See Method:Move.


                                       Msg:Add


          Function  Msg:Add ( Title, Type, Text )  

          Purpose   Show a Dialog Box.

          Returns   True or False.

          See Also  Win:Add.

          Notes     Displays one of  four preset dialog  boxes.  All  boxes
                    have  a message  in the  top  section, and  one or  two
                    buttons on the bottom.  The four box Types are:

                         Ok             The Default, one button says Ok.
                         Yes            A Yes/No box, default is Yes.
                         No             A Yes/No box, default is No.
                         Cancel         An Ok/Cancel box, default is Ok.

                    Message boxes  use the  "Message" background  if it  is
                    defined  in  the  JORF.INI  or  JORFWIN.INI  file  (See
                    Appendix D).   Under Windows, the message system uses a
                    special dialog box that limits access to other windows.
                    To  create  a  message  that uses  a  normal  box,  use
                    Win:Add.

          Chapter Six - Library Functions Reference                     117














          Example

          MsgBoxes:YesNo
            New (Result)
            Result=Msg:Add ("Yes/No", "Yes")
              This is a yes-No Box!
            Switch
              Case Kbd:Got = 'Esc_Key'
                Msg:Add
             You hit the escape key
              Case Result = Ok
                Msg:Add
             You picked yes
              Else
                Msg:Add
             You picked no
            Return Ok

          MsgBoxes:NoYes
            New Result
            Result=Msg:Add ("No/Yes", "No")
              This is a No-Yes Box!
            Switch
              Case Kbd:Got = 'Esc_Key'
                Msg:Add
             You hit the escape key
              Case Result = Ok
                Msg:Add
             You picked yes
              Else
                Msg:Add
             You picked no
            Return Ok

          MsgBoxes:OkBox
            New Result
            Result=Msg:Add ("Ok", "Ok")
              This is an Ok Box!
            If (Result)
              Msg:Add
                You picked Ok
            else
              Msg:Add
                You hit the escape key.
            Return Ok


          MsgBoxes:Cancel
            New Result
            Result=Msg:Add ("Cancel", "Cancel")
              This is an Cancel Box!
            Switch

          The JORF Manual (Disk Version)                                118














              Case Kbd:Got = 'Esc_Key'
                Msg:Add
             You hit the escape key
              Case Result = Ok
                Msg:Add
             You picked Ok
              Else
                Msg:Add
             You canceled
            Return Ok

          MsgBoxes:Start
            Win:Add ("Message Test")
              MLine:"&Yes",   Action:"MsgBoxes:YesNo"
              MLine:"&No",    Action:"MsgBoxes:NoYes"
              MLine:"&Cancel",Action:"MsgBoxes:Cancel"
              MLine:"&Ok",    Action:"MsgBoxes:OkBox"
              MLine:"&Exit",  Action:"Jorf:Exit"






                                       Move:To


          Function  Move:To ( Row, Column ) 

          Purpose   Move cursor in window.

          Returns   None.

          See Also  Move:By.

          Notes     Moves   the  present   position  to   Row   and  Column
                    coordinates in  the current  window.   A position  that
                    exceeds  window boundaries place the cursor next to the
                    boundary.   There  is  no way  to  position the  cursor
                    outside a window.

                    Row may be zero,  in which case the cursor will  not be
                    moved  up or down.  Row  may also be negative, in which
                    case the cursor will be that many lines from the Bottom
                    of the window.  The top  row of a window is Row 1,  and
                    the bottom is WindowPacket->Length.

                    Column may be  zero, in which case the  cursor will not
                    be moved right  or left.  Column may  also be negative,
                    in  which case the cursor  will be that many characters
                    from  the  left  side  of the  window.    The  leftmost


          Chapter Six - Library Functions Reference                     119














                    character  is in  column  1, and  the  rightmost is  in
                    column WindowPacket->Width.

                    A movement  that exceeds window  boundaries places  the
                    cursor  as far  as  possible  without  going  over  the
                    boundary.  There is no  way to move outside the current
                    window.

          Example   See Jorf:Sound.



                                       Move:By


          Function  Move:By ( Row, Column ) 

          Purpose   Move cursor in window.

          Returns   None.

          See Also  Move:To.

          Notes     Works  the same  as  Move:To  Row  Column  except  that
                    movement  is relative to  the current position.   It is
                    common to see negative numbers used in this command  to
                    move back one row or column.  
                    A  movement  that exceeds  window boundaries  place the
                    cursor  as far  as  possible  without  going  over  the
                    boundary.  There is no way to move outside a window.




                                         New


          Function  New ( Variable1, Variable2, Variable3 ) 
                          _________

          Purpose   Creates new variables.

          Returns   None.

          See Also  Chapter Three.

          Notes     Creates a new  instance of an object.   This command is
                    the only way to allocate structures  and new records on
                    disk.  New must be  used at the beginning of a  method,
                    before any other commands.  

                    New variables are automatically deallocated unless: 


          The JORF Manual (Disk Version)                                120














                         They are linked to a rule.
                         They are linked to a structure, linked to a rule.
                         They are linked to Mem:Ptr or Win:Ptr.
                         They are Returned.

                    You can declare more than one variable, by listing them
                    one after another.  Variables names may  be prefixed by
                    a  explicit class, separated  with a colon.   Variables
                    may also  omit the class,  implying they belong  to the
                    Jorf class.   Variables of the Jorf class  will take on
                    Jorf                           Jorf
                    the class of another value that is assigned to them. 

                    Parentheses are not required in the current version.

          Example

          Demo:Start
            New (Rad, Chk, Inp1, Inp2)
            Win:Add ("A Real Screen", 4, 8, 14, 50, Here)
              Menu:"&Help"
                Menu:"&Indented Menu Items"
                  Menu:"&Create Sub Menus"
                    Menu:"&And Even Deeper"
                    Menu:"&Sub Menus"
                  Menu:""
                  Menu:"(Escape to Exit)"
                Menu:"&Jorf Help         F1" Action:"Hotkey:F1_Key"
                Menu:"&Time and Date  Alt-T" Action:"HotKey:Alt_t_Key"
              String:"  Use your Arrow Keys to go up and down.  On"
              String:"  Check Boxes and Radio Buttons, the Enter Key"
              String:"  checks and Space Bar skips.  Be sure to Press"
              String:"  Alt-H to check out the Menus and Submenus!"
              Radio:" Radio &1" Row:6 Col:8
                Check:"Rad==True", Action:"Rad=True"
              Radio:" Radio &2"
                Check:"Rad==False", Action:"Rad=False"
              ChBox:" Check Box &A" Row:6, Col:26
                Check:"Chk==True", Action:"Chk=True"
              ChBox:" Check Box &B"
                Check:"Chk==False", Action:"Chk=False"
              Input:"&Input 1  " Row:9, Col:8 Field:"Inp1"
              Input:"I&nput 2  "              Field:"Inp2"
              Button:"  &Done  "   Row:12, Col:24, Action:"Esc_Key"
            Return









          Chapter Six - Library Functions Reference                     121















                                         Null


          Function  Null

          Purpose   Returns "Nothing".

          Returns   "Nothing".

          See Also  True.

          Notes     Returns a JORF Pointer to nothing.  This is used like a
                    0  is used  in decimal  location.   Sometimes  you need
                    indicate "nothing", but it has  to be something to keep
                    other items aligned. 

                    This is  equivalent to closed quotes ("") or the number
                    zero.   The  JORF Pointers  for zero,  "" and  null are
                    exactly the same.



                                       Num:Abs


          Function  Num:Abs ( Num ) 
                              ___

          Purpose   Returns the absolute value of Num.

          Returns   Num or -Num.

          See Also  Num:Max, Num:Min.

          Notes     The  Absolute  value  is the  same  number,  but always
                    positive.  So  the absolute value of -5  is five, which
                    is also the absolute value of 5.  This function is used
                    to  insure that negative numbers are treated like their
                    positive equivalent.

                    This  function  maintains  the  internal  type  of  the
                    number.   If the number  is a floating point  number, a
                    floating  point  number  is  returned.    If it  is  an
                    integer, an integer is returned.  If it is a string  or
                    text, then the  string is converted to a  number, and a
                    floating point or integer value is returned.







          The JORF Manual (Disk Version)                                122















                                       Num:Btw


          Function  Num:Btw ( Num, A, B ) 
                              ___  _  _

          Purpose   Returns Num between A and B.

          Returns   Num, A or B.

          See Also  Num:Max, Num:Min.

          Notes     Num is between, then the return value is Num.  If it is
                    lower than  A, then A  is returned.   If higher  than B
                    then B is returned.  

                    This function is used to qualify that a value is within
                    a specific range.  


                                       Num:Exp


          Function  Num:Exp ( Num ) 
                              ___

          Purpose   Returns the exponential e to Num.

          Returns   Exponential e to Num.

          See Also   Num:Log.

          Notes     Frankly I don't  really understand what this  is except
                    that e is  a complex number that shows  up in some math
                    algorithms.  Mine  is not to question why,  but to give
                    you the capability.  


                                       Num:Log


          Function  Num:Log ( Num ) 
                              ___

          Purpose   Returns the natural logarithm of Num.

          Returns   The natural logarithm of Num.

          See Also  Num:Sqrt, Num:Pow.

          Notes     The logarithm is  another mathematical concept I  don't
                    fully  understand, but  it was  what  one of  Babbage's
                    great  machines  was   to  calculate  so  it   must  be
                    important.  

          Chapter Six - Library Functions Reference                     123














          Example

          Class:Payment (Amt,Yrs,Int,Pmt,Pmt50,Yrs50)

          Payment:Start
            New (Payment:Pmt)
            Win:Add ("Loan Payment Calculator")
              String:"Calculate your loan payment amount and years"
              String:"to pay if you added just $50 to the payment."
              Input:"&Loan Amount         ", Row:4 Wid:12
                Field:"Pmt->Amt", After:"Payment:Calc(Pmt)"
              Input:"&Years to Pay        ", Row:5 Wid:5
                Field:"Pmt->Yrs", After:"Payment:Calc(Pmt)"
              Input:"&Percent Interest    ", Row:6 Wid:5
                Field:"Pmt->Int", After:"Payment:Calc(Pmt)"
              Input:"Payment             ", Row:7 Wid:10
                Field:"Pmt->Pmt", Before:"Return(Null)"
              Input:"Adding just $50     ", Row:9 Wid:10
                Field:"Pmt->Pmt50", Before:"Return(Null)"
              Input:"Reduces the years to"  Row:10 Wid:5
                Field:"Pmt->Yrs50", Before:"Return(Null)"
              Button:"    &Done    ", Row:12, Col:16
            Return(Ok)

          Payment:Calc(Pmt)
            New (Periods,Per_Int,Payment,Months50)
            Pmt->Pmt = 0
            If (Pmt->Int > 0 And Pmt->Yrs > 0)
              Periods    = Pmt->Yrs*12
              Per_Int    = Pmt->Int/12/100
              Payment    =
                (Pmt->Amt*Per_Int)/(1-Num:Pow(1+Per_Int,(-Periods)))
              Payment    = Num:Int((Payment+.005)*100)/100
              Pmt->Pmt   = Payment
              Pmt->Pmt50 = Payment+50
              Months50   =
                Num:Log(Pmt->Pmt50 / 
                   (Pmt->Pmt50-Pmt->Amt*Per_Int))/Num:Log(1+Per_Int)
              Pmt->Yrs50 = Num:Int((Months50/12)*10)/10
              Win:Dsp
            Return (Ok)












          The JORF Manual (Disk Version)                                124















                                       Num:Max


          Function  Num:Max ( A, B ) 
                              _  _

          Purpose   Returns the higher of A and B.

          Returns   Either A or B.

          See Also  Num:Btw, Num:Min.

          Notes     Corresponds to a common C language macro MAX(A,B).  Use
                    this command to return the Highest of two values.  

                    There  is an odd  paradox that  you commonly  use these
                    numbers to insure  a minimum value.   For instance,  to
                    produce  a number  no lower  than 10, you  call Num:Max
                                                                    Num:Max
                    Number, 10.
                    Number, 10


                                       Num:Min


          Function  Num:Min ( A, B ) 
                              _  _

          Purpose   Returns the lower of A and B.

          Returns   Either A or B.

          See Also  Num:Btw, Num:Max.

          Notes     Corresponds  to a common C language macro MIN(A,B). Use
                    this command to return the Highest of two values.  

                    There  is an  odd paradox  that you commonly  use these
                    numbers to  insure a maximum  value.  For  instance, to
                    produce a number  no higher than  10, you call  Num:Min
                                                                    Num:Min
                    (Number, 10).
                    (Number, 10)



                                       Num:Pow


          Function  Num:Pow ( Num, Pow ) 
                              ___  ___

          Purpose   Returns Num  raised to the Pow power.

          Returns   Power of Num.

          See Also  Num:Sqrt.

          Chapter Six - Library Functions Reference                     125














          Notes     Returns Num raised to the  indicated power.  The result
                    is an integer only  if it fits, and is a floating point
                    if it is fractional or very large.

          Example   See Num:Log


                                       Num:Rand


          Function  Num:Rand ( Low, High ) 
                               ___  ____

          Purpose   Produces a Random Number.

          Returns   A Random Number from Low through High.

          Notes     Produces  a pseudo random  number between High  and Low
                    that are  assumed to  be integer  values.   The  random
                    number seed is  the system clock and  will be different
                    for each run of JORF.  The number may be Low or High or
                    any integer value between. 

          Example   See Jorf:Sound.


                                       Num:Sqrt


          Function  Num:Sqrt ( Num ) 
                               ___

          Purpose   Returns the square root of Num.

          Returns   Square root of Num.

          See Also  Num:Pow.

          Notes     Returns the square root of Num.  The return value is an
                    integer only if it fits.  If  it is fractional, it is a
                    floating  point value.    The square  root  of zero  is
                    returned as zero.



                                          Ok


          Function  Ok

          Purpose   None.

          Returns   1 (integer one).


          The JORF Manual (Disk Version)                                126














          See Also  True.

          Notes     This value  allows you create readable  "Endless" While
                    loops by saying While Ok.
                                    While Ok



                                        Return


          Function  Return (Value )

          Purpose   Return a value.

          Returns   None.

          Notes     Methods may return  a single value using  this command.
                    If no value  is specified, null is returned.   A method
                    that ends  without an  explicit Return  is the  same as
                    Return Null.
                    Return Null

                    If  more  than one  value  needs  to  be returned,  the
                    parameters used to call the function may be changed.  

                    Return may be used at any time, including If statements
                    and While loops. This will end execution of the current
                    method and return control to the calling method.



                                       Rpt:Add


          Function  Rpt:Add ( Title, Row, Col, Len, Wid, Level, Def )  

          Purpose   Write a report or document.

          Returns   None.

          See Also  File:Print.

          Notes     The future of this function is bright, but currently it
                    is but a shadow of what will  come.  The job here is to
                    create a report generating system as easy as the screen
                    system handled item the Win:Add command.

                    The parameter  Title is  not currently  used, but  will
                    probably find its way into  a status box that will show
                    what page and  line is currently being generated.   The
                    parameters  Row, Col, Len and  Wid help define the page
                    size.  


          Chapter Six - Library Functions Reference                     127














                    The  last parameter Def  for definition is  usually the
                    report definition  in  an indented  section below  this
                    command.    The  report  is always written to  the file
                    JREPORT.LST which then can be printed using File:Print.
                     Like  Win:Add, there  are several  key  words used  to
                    define report elements.

                         Header    A page header item
                         Footer    A page footer item
                         Next      Method to get the next record
                         Item      An Item on the report
                         Text      A multiline text in the report

                    This  next example shows a  normal report format.  This
                    report lists  contact names  one after  the other.   It
                    contains a header and a footer.

          Contact:List
            New (Dest)
            Mem:Ptr->IndexName = "FullName"
            Time:Get(Mem:Ptr)
            Mem:Ptr->Page=1

            Dest=Jorf:Printer()
            If (Dest)
              Win:Add("Printing")
                Printing . . .
              Contact:SetFile(Here)
              Rep:Add ("Contact Listing", 5, 5, 60, 75,Here)
                Header:"'Contact Listing Report'"     NewRow:1 Col:30
                Header:"'Page '+Mem:Ptr->Page"       NewRow:1 Col:1
                Header:"'Date '+Mem:Ptr->SDate"               Col:50
                Header:"Str:AtSet(Null,1,'-',80)" NewRow:1 Col:1
                Next:"Struct:Next('Contact', 
                    Mem:Ptr->IndexName, Mem:Ptr->Contact)"
                Item:"Mem:Ptr->Contact->FullName"    NewRow:2 Col:1  n:20
                Item:"Mem:Ptr->Contact->Company "            Col:22 Len:32
                Item:"Mem:Ptr->Contact->WorkPhone"           Col:52 Len:28
                Item:"Mem:Ptr->Contact->Addr1"       NewRow:1 Col:5  Len:30
                Item:"Mem:Ptr->Contact->Addr2"       NewRow:1 Col:5  Len:30
                Item:"Mem:Ptr->Contact->Addr3"       NewRow:1 Col:5  Len:30
                Item:"Null"                          NewRow:1 Col:5  Len:30
                Footer:"'Continued on Page '+Mem:Ptr->Page+1" Row:56 Col:1
              File:Print("Jreport.lst",Dest)
            Return (Ok)

                    If you skip the page definition,  the report will print
                    without headers or footers.   You can use this to print
                    continuous  forms.

          Contact:ContinLabels(Flag)
            New (Dest,CurrContact)

          The JORF Manual (Disk Version)                                128














            Dest=Jorf:Printer()
            Win:Add("Printing")
              Printing . . .

            Contact:SetFile(Here)
            CurrContact        = Mem:Ptr->Contact
            Mem:Ptr->OneContact= CurrContact
            Mem:Ptr->Contact   = Null
            | Report for Continuous labels, 6 lines,  1 line between
            |
            Rep:Add ("Continuous Labels")
              Next:"Contact:Nextlabel(Flag)"
              Item:"'('+Mem:Ptr->Contact->MailCode+')'" NewRow:1 Col:26 
                Before:"Mem:Ptr->Contact->MailCode!=Null"
              Item:"" NewRow:1 Col:26 Wid:12
                Before:"Mem:Ptr->Contact->MailCode==Null"
              Item:"Mem:Ptr->Contact->FullName"    NewRow:1 Col:1  Wid:40
              Item:"Mem:Ptr->Contact->Company"     NewRow:1 Col:1  Wid:40
                Before:"Mem:Ptr->Contact->Company!=Null"
              Item:"Mem:Ptr->Contact->Addr1"       NewRow:1 Col:1  Wid:40
              Item:"Mem:Ptr->Contact->Addr2"       NewRow:1 Col:1  Wid:40
              Item:"Mem:Ptr->Contact->Addr3"       NewRow:1 Col:1  Wid:40
              Item:"" NewRow:1
                Before:"Mem:Ptr->Contact->Company==Null"
            File:Print("JREPORT.LST",Dest)
            Mem:Ptr->Contact=CurrContact
            Return(Null)

                    This last example shows how  you can read an ASCII text
                    file to feed a text item  in the report.  The text  key
                    word takes  the name of  a JORF pointer that  holds the
                    text  to use  for  a format.   Lines  in that  text may
                    contain JORF variables in curly braces. 

                    Contact:MergeLetter
                      New (Dest,Letter,CurrContact)
                      Time:Get(Mem:Ptr)
                      Letter=File:Load(Contact:GetLetter)
                      If (Letter!=Null)
                        Dest=Jorf:Printer()
                        If (Dest)
                          CurrContact=Mem:Ptr->Contact
                          Mem:Ptr->Contact=Null
                          Win:Add("Printing")
                            Printing . . .
                          Rep:Add ("Merge Letter", 5, 5, 60, 75,Here)
                            Header:"" Row:1
                            Next:"Contact:NextRecord('Next')"
                            Text:"Letter"
                          File:Print("JREPORT.LST",Dest)
                          Mem:Ptr->Contact=CurrContact
                      Return (Ok)

          Chapter Six - Library Functions Reference                     129














                    Still  to  be  completed is  multiple  level processing
                    (which will be done using indented sections, of course)
                    and  support for printer  drivers.  Please  contact The
                    JORF Company for  further changes and upgrades  to this
                    command.



                                       Rule:Add


          Function  Rule:Add ( RuleStructure )  
                               _____________

          Purpose   Add a new Rule.

          Returns   None.

          See Also  Key:Add.

          Notes     RuleStructure must  be a  structure  with the  elements
                    Obj, Att,  Val, Prob, Ptr,  Fnd (Found), and  KLen (Key
                    Length).  The  last two elements are used  by Rule:Find
                    to get next rule in a series.   The element Str used by
                    Key:Find are replaced here by Att and Val.   
                    Adds rule valued Obj, Att and Val,  with the associated
                    data in Ptr (Pointer).  The rule may  be found again by
                    doing a partial or whole rule search on RuleStructure.

          Example   The  ISA.J source  file demonstrates  both  forward and
                         ISA.J
                    backward searching using the Rule system. 



                                       Rule:Del


          Function  Rule:Del ( RuleStructure )  
                               _____________

          Purpose   Delete a Rule in the Data Base.

          Returns   None.   Sets  RuleStructure->Fnd to  True  if Rule  was
                    deleted.

          See Also  Key:Del.

          Notes     Deletes an existing  rule.  This command  may be called
                    with a partial  rule, in which case it  will delete the
                    first rule that  begins with that value.   It is highly
                    recommended that this command be called with a complete
                    rule to insure that the correct entry is deleted.  



          The JORF Manual (Disk Version)                                130














                    After a rule is deleted, you can still use Rule:Next go
                    the "next" rule.  



                                      Rule:Find


          Function  Rule:Find ( RuleStructure ) 
                                _____________

          Purpose   Find a Rule in the Data Base.

          Returns   None.   Sets  RuleStructure->Fnd to  True  if Rule  was
                    found.

          See Also  Rule:Add.

          Notes     Find a rule. In this function, parameters may be empty,
                    in which  case the first  matching index entry  will be
                    returned.  Parameters must be empty from left to right,
                    that is, if Att has a  value then Obj must also have  a
                    value.  If a "hole" is left, then nothing will ever  be
                    found.

                    When a rule is found, the structure will be filled with
                    the  values of that  rule and Fnd will  be set to True.
                    If Rule:Next  is called with these values set, then the
                    next  rule value  is  returned.   This  process may  be
                    next
                    continued until the value of the  current rule does not
                    match the  value of the  original partial  rule.   This
                                             original partial  rule
                    length is put in KLen after every successful search and
                    may be modified.

          Example   See Jorf:Write.



                                      Rule:Next


          Function  Rule:Next ( RuleStructure ) 
                                _____________

          Purpose   Find the next Rule in sequence.

          Returns   None.   Sets  RuleStructure->Fnd to  True  if Rule  was
                    found.

          See Also  Rule:Find.

          Notes     If RuleStructure->KLen  is zero,  this works just  like
                    Rule:Find.   If not zero,  this command finds  the next
                    rule in  a  sequence.   This process  may be  continued

          Chapter Six - Library Functions Reference                     131














                    until the  value of  the current  rule within  the Klen
                    changes.  Values for Klen are: 

                    0    Rules with the same Type match
                    1    Rules with the same Type+Obj match
                    2    Rules with the same Type+Obj+Att match
                    3    Rules with the same Type+Obj+Att+Prob+Val match



                                      Rule:Prev


          Function  Rule:Prev ( RuleStructure ) 
                                _____________

          Purpose   Find previous Rule in sequence.

          Returns   None.   Sets  RuleStructure->Fnd to  True  if Rule  was
                    found.

          See Also  Rule:Next.

          Notes     This command is the opposite of Rule:Next.



                                       Str:Aft


          Function  Str:Aft ( String, CharList ) 
                              ______  ________

          Purpose   Get  substring starting  with  the first  character not
                    specified in CharList.

          Returns   The substring.

          See Also  Str:AtChar.

          Notes     Skips over characters specified, and returns the string
                    after  those characters.  The most common example is to
                    specify the string after any leading spaces. 

                    The return value is the substring, not the position.

          Example   See Jorf:Write.








          The JORF Manual (Disk Version)                                132















                                        Str:At


          Function  Str:At ( String, Position, Length ) 
                             ______  ________  ______

          Purpose   Get a substring at specified position in String.

          Returns   The substring.

          See Also  Str:In.

          Notes          Returns  the substring  at the  specified position
                         and  length.    JORF  does  not  think  of  single
                         characters as integers, as in BASIC, C and Pascal.
                         Instead,  JORF  sees   characters  as  one  letter
                         strings.  

                    The first  character of the  string is one (1)  and the
                    last character is the return value of Str:Len.  

                    A  negative Position indicates an offset from the right
                    (end) of  the string.   A  negative Length just  counts
                    backward.  A Position or  Length that are out of bounds
                    returns whatever part of the string is in bounds.

          Example   See Event:Add.



                                      Str:AtChar


          Function  Str:AtChar ( String, CharList ) 
                                 ______  ________

          Purpose   Get  a substring  starting with  one  of characters  in
                    CharList. 

          Returns   The substring.

          See Also  Str:In.

          Notes     Get  a substring  starting with  one  of the  specified
                    characters.   To look for a substring  within a string,
                    use Str:In. 

                    Returns the substring, not the position. 






          Chapter Six - Library Functions Reference                     133















                                      Str:AtCut


          Function  Str:AtCut ( String, Position ) 
                                ______  ________

          Purpose   Get a truncated version of string.

          Returns   The truncated string.

          See Also  Str:AtDel.

          Notes     Truncates  String  at   Position.    This   command  is
                    functionally the same as:

                    Str:AtDel (String, Pos, Str:Len(String)-Pos)

                    If  Position is  less  than one,  or  greater than  the
                    length of String, then nothing will change.  



                                      Str:AtDel


          Function  Str:AtDel ( String, Position, Count ) 
                                ______  ________  _____

          Purpose   Returns a version of String with deleted characters.

          Returns   The modified string.

          See Also  Str:AtCut.

          Notes     Deletes Count characters from a string at Position.  If
                    Count  is zero,  or exceeds the  length of  the string,
                    then the  string will  be truncated  at  Position.   If
                    Position is less  than one, or greater  than the length
                    of String, then nothing will change.  



                                      Str:AtPut


          Function  Str:AtPut ( String, Position, InsertString ) 
                                ______  ________  ____________

          Purpose   Insert a substring within string.

          Returns   The modified string.

          See Also  Str:AtSet.


          The JORF Manual (Disk Version)                                134














          Notes     Inserts  InsertString into  String  at  Position.    If
                    Position is less than  one, or greater than  the length
                    of String, then nothing will change.  This command will
                    not overwrite existing characters.  Instead, it expands
                    the  string  to fit  the  new characters.    To replace
                    characters, first use Str:AtDel.



                                      Str:AtSet


          Function  Str:AtSet ( String, Position, InsertString, Count ) 
                                ______  ________  ____________  _____

          Purpose   Sets a repeated value into String.

          Returns   The modified string.

          See Also  Str:AtPut.

          Notes     Inserts  InsertString,  Count  times,  into  String  at
                    Position.   If Position  is less than  one, or  greater
                    than  the length of  String, then nothing  will change.
                    This command  will not  overwrite existing  characters.
                    Instead,  it  expands   the  string  to  fit   the  new
                    characters.      To  replace   characters,   first  use
                    Str:AtDel.

                    This command is  used to place a repeated  pattern in a
                    string.  It also may   be used to create a buffer  full
                    of a  known value,  like '*************'.   You  cannot
                    create a buffer full of nulls.



                                        Str:In


          Function  Str:In ( String, Substring ) 
                             ______  _________

          Purpose   Returns the position of Substring in String.  

          Returns   A numeric position.  

          See Also  Other String functions.

          Notes     If Substring is not found then returns zero.  Examples:

                    Str:In "Josephine" "ph"  Result 5
                    Str:In "Festus"    "f"   Result 1
                    Str:In "Bear"      "EAR" Result 2
                    Str:In "Josephine" "Z"   Result 0

          Chapter Six - Library Functions Reference                     135
















                                       Str:Len


          Function  Str:Len ( String ) 
                              ______

          Purpose   Get the number of characters in String.

          Returns   The number of characters in String.

          See Also  Text:Len.

          Notes     This function  may be  used to return  the length  of a
                    text line, as well as the length of a string.



                                       Str:NPad


          Function  Str:NPad ( String, Length ) 
                               ______  ______

          Purpose   Pad  the end  of  String  with nulls  until  it is  the
                    specified Length.

          Returns   The modified String.

          See Also  Str:Pad.

          Notes     Not commonly used for  anything but writing specialized
                    file  formats.  Many  file formats require  fields that
                    are null  padded, instead  of space  padded.   Use this
                    command to null pad your strings.

                    Once a  string is null padded, most JORF functions will
                    reconvert the string back to it's smallest format.  You
                    should use this command just prior  to writing a string
                    or buffer to file. 



                                       Str:Pad


          Function  Str:Pad ( String, Length ) 
                              ______  ______

          Purpose   Pad  the end  of String  with spaces,  until it  is the
                    specified Length.

          Returns   The modified String.


          The JORF Manual (Disk Version)                                136














          See Also  Str:NPad.

          Notes     Commonly used to format  consecutive strings for output
                    on the screen  or printer.  By padding,  you can column
                    align values.  If the  string is too long, this command
                    will truncate it to the Pad length. 



                                       Str:Put


          Function  Str:Put ( String ) 
                              ______

          Purpose   Put a string on the window.

          Returns   None.

          See Also  Str:PutLine.

          Notes     Outputs a JORF data pointer to the current window.



                                     Str:PutLine


          Function  Str:PutLine ( Line ) 
                                  ____

          Purpose   Put string on window, then go to next line.

          Returns   None.

          See Also  Str:Put.

          Notes     Outputs a  line to the current window, moves the cursor
                    to the  next line.   This command differs  from Str:Put
                    because it completes the line by moving the cursor.



                                     Struct:Find


          Function  Struct:Find ( Class, Index, Value ) 
                                  _____  _____

          Purpose   Find a structure using an automatic index.

          Returns   Structure. 

          See Also  Struct:Next, Key:Find.


          Chapter Six - Library Functions Reference                     137














          Notes     When  you define a structure with automatic indexes the
                    interpreter will automatically  add, change and  delete
                    that index.  This command allows you to find structures
                    that have  previously been  stored using  this index.  
                    Set Class  to the class name, the  Index to the name of
                    the field that  is indexed, and the Value  to the value
                    you want to  find.  If the  search value is  null, this
                    command returns the first item in the index.

          Example

          Class:Filter
            Index:Name
            Descr
            Method

          Filter:Start
            New (Filter:Filter)
            Jorf:File("FILTER.DAT",Here)
            Event:Add()

            If (Struct:Next('Filter','Name',Null)==Null)
              Filter->Name  = "All"
              Filter->Descr = "All Records"
              Filter->Method= Null
              Jorf:Write(Filter)
              Filter=Null

            Win:Add ("Contact Filters")
              Menu:"&File"
                Menu:"&About Filters"     Action:"Filter:About"
                Menu:"&Rebuild"           Action:"Filter:Rebuild(Filter)"
                Menu:"E&xit       Alt-X"  Action:"HotKey:Alt_X_Key"
              Menu:"&Edit"
                Menu:"&Add        "  Action:"Filter:Edit('Add',Filter)"
                Menu:"&Change     "  Action:"Filter:Edit('Chg',Filter)"
                Menu:"&Delete     "  Action:"Filter:Edit('Del',Filter)"
              Group:"Filters", Row:1, Col:1, Len:8, Wid:42
              String:"Name             Description"
              List:"" Row:3, Col:2, Len:7, Wid:42
                Field:"Filter"
                Next:"Struct:Next ('Filter','Name',Filter)"
                Prev:"Struct:Prev ('Filter','Name',Filter)"
                Show:"Str:Pad(Filter->Name,12)+Str:Pad(Filter->Descr,30)"
              Button:" &Select ",  Row:11 Col:04 Action:"Return(Ok)"
              Button:" &Cancel ",  Row:11 Col:26 Action:"Return('Esc_Key')"
            Mem:Ptr->Filter=Filter
            Return (Ok)

          Filter:Edit(Action,Filter)
            | Add/Edit/Delete Filters
            New (Filter:NewFilter, Result)

          The JORF Manual (Disk Version)                                138














            If (Action=="Add")
              Jorf:Write(NewFilter)
              Filter=NewFilter

            If (Action=='Del')
              Result=Msg:Add('Filter Delete','No')
                Delete this filter

                Name:   {Filter->Name}
                Descr:  {Filter->Descr}
              If (Result)
                Jorf:Del(Filter)
                Win:Dsp
              Return

            Win:Add ("{Action} Filter")
              Input:"Name       ", Row:1 Wid:10, Field:"Filter->Name"
              Input:"Description", Row:2 Wid:30, Field:"Filter->Descr"
              Input:"Command    ", Row:3 Wid:40, Field:"Filter->Method"
            Jorf:Write(Filter)
            Filter=Null
            Win:Dsp
            Return(Null)

          Filter:Rebuild(Filter)
            Filter=Null
            Mem:Ptr->Filter=Null
            Jorf:Rebuild
            Win:Dsp
            Return (Null)



                                     Struct:Next


          Function  Struct:Next ( Class, Index, Value ) 
                                  _____  _____  _____

          Purpose   Find the next structure  in sequence.

          Returns   Structure.

          See Also  Struct:Find.

          Notes     If Value is null this command finds the first structure
                    in the file. Each subsequent call finds the next record
                    in sequence.  This  function is widely used  for Window
                    Lists where the  Next command is used to  find the next
                    record in the list.

                    If there are no more records in the index, this command
                    returns null.

          Chapter Six - Library Functions Reference                     139















                                     Struct:Prev


          Function  Struct:Prev ( Class, Index, Value ) 
                                  _____  _____  _____

          Purpose   Find the previous structure  in sequence.

          Returns   Structure.

          See Also  Struct:Find.

          Notes     If Value is  null this command finds nothing  - not the
                    last structure  in the  index which  is what you  might
                    expect.  This function is  widely used for Window Lists
                    when you use the up arrow to go up through a file.  

                    If the  Value was  already at the  first record  in the
                    index, this function returns null.




                                   Switch/Case/Else


          Function  Switch/Case/Else

          Purpose   A conditional branch.

          Returns   None.

          See Also  If/Else.

          Notes     A conditional  Branch.  Tests the value  of a parameter
                    and  executes indented  code  sections  based  on  that
                    value. 

                         Switch ( TestValue ) 
                                  _________
                           Case Value1
                           Case Value2
                             Performs this section if TestValue is Value1
                             OR Value2
                           Else
                             If no Case was valid this section performed.

                    Tests  a  value  and   performs  commands  in  indented
                    sections.   This  command  was  introduced  for  the  C
                    language,  but was not robust.  I have strengthened the
                    command  by  eliminating  the need  for  explicit Break
                    commands.   I have  changed "Default" to  Else.   And I
                    allow more complex processing on Case lines.

          The JORF Manual (Disk Version)                                140














                    The Switch command does not need a parameter following.
                    If the parameter is absent, the Case lines are expected
                    to be  logical expressions that  can be evaluated.   If
                    the  parameter  is  present,  the  parameter  is  check
                    against the expression in the Case line.

                    Break may not be used,  even by hopeless C  programmers
                    like  myself who  put them  in  anyway.   It was  never
                    robust  to partially reuse  code sections and  K&R must
                    not have  realized the ramifications when  they created
                    the C language switch command.   They required an extra
                    key word  for the common  case and promoted  the unwise
                    programming  practice of  allowing the program  flow to
                    "fall" into another routine.

          Examples  The  Switch command is used to replace multiple If/Else
                         Switch                                     If/Else
                    statements.  It checks a condition, and compares it  to
                    various Case clauses.  It executes the indented section
                            Case
                    under  the  appropriate Case.    It  also has  an  Else
                                            Case                       Else
                    clause,  which  works  just  like  the else  in  an  If
                                                                         If
                    statement.

                    For example:                       Is Replaced By

                    If (A=2)                           Switch (A)
                      B=A+C                              Case 2
                    Else                                   B=A+C
                      If (A=3)                           Case 3
                        B=A+D                              B=A+D
                      Else                               Case 4
                        If (A=4)                           B=A+E
                          B=A+E                          Else
                        Else                               B=A
                          B=A


                    Case functions may be stacked.

                        Switch (Key)                        
                          Case 'a'                          
                          Case 'A'                          
                            Say 'Key is A'                  
                          Case 'b'                          
                          Case 'B'                          
                            Say 'Key is B'                  
                          Else                              
                            Say 'Key is not A or B'  


                    The Switch function  is neater and  easier to use  than
                    multiple If/Else  functions.   The  condition  for  the
                             If/Else


          Chapter Six - Library Functions Reference                     141














                    switch command may  be omitted, and the   Case commands
                                                              Case
                    may be complex comparisons.

                            Switch
                             Case (Key>='a' && Key<='Z')
                             Case (Key>='A' && Key<='Z')
                               Say 'Key is a Letter'
                             Case (Key>='0' && Key<='9')
                               Say 'Key is a Number'
                             Else
                               Say 'Key is Something Else'




                                       Text:Add


          Function  Text:Add ( Line, Text ) 

          Purpose   Append Line to the bottom of Text.

          Returns   Text.

          See Also  Line:Inp, Win:Add.

          Notes     Appends to existing text, or creates a new text.  There
                    are some commands in the system, like Win:Add that need
                    a "text" parameter  even if it is blank.  A normal null
                    pointer  is  not  sufficient  for  these  processes  to
                    operate.  

                    Warning:   If you are  building a multi-line  text, and
                    you get the  parameters to Text:Add backward,  you text
                    will only be the last line you added. 

          Example   See Jorf:Sound.




                                       Text:At


          Function  Text:At ( Text, LineNumber )  
                              ____  __________

          Purpose   Get a specific line of Text.

          Returns   The line of Text.

          See Also  Text:Pos.


          The JORF Manual (Disk Version)                                142














          Notes     Returns the line of Text at LineNumber.  If Text is not
                    a block  of text,  it is  treated as  a single line  of
                    text.  If the LineNumber  is greater than the length of
                    the text this function returns null.

          Example   See Text:Bot



                                       Text:Bot


          Function  Text:Bot ( Text ) 
                               ____

          Purpose   Get the last line of a block of text.

          Returns   The last line of Text.

          See Also  Text:Top, Text:Next, Text:Len.

          Notes     Returns  the last  line  of Text.    If Text  is not  a
                    multiple  line text block,  then returns Text  as if it
                    were a one line text block.

          Example   The following  program demonstrates the  text commands.
                    Note  how  Text:Top  and Text:Bot  return  the  top and
                               Text:Top      Text:Bot
                    bottom of the  whole method.   To find the  top of  the
                    block of text, check the number of leading spaces.

                    Text:Start 
                      | Sample for Text Functions 
                      Text:Sample 
                        This text was passed to 
                        to a method because: 
                        a) The method call 
                           needed a parameter 
                        b) The text was indented 
                      Return 
                     
                    Text:Sample Text 
                      New Win1, Win2 
                      Win1->Text = Text 
                      Win1->Row = 2 
                      Win1->Col = 2 
                      Win:Add (Win1) 
                     
                      Win2->Row=(-2) 
                      Win2->Col=(-2) 
                      Win2->Len=11 
                      Win2->Wid=40 
                      Win:Add (Win2) 
                     

          Chapter Six - Library Functions Reference                     143














                      Str:PutLine ("Text      = "+Text) 
                      Str:PutLine ("Text:Len  = "+Text:Len (Text))
                      Str:PutLine ("Text:Wid  = "+Text:Wid (Text)) 
                      Str:PutLine ("Text:Top  = "+Text:Top (Text)) 
                      Str:PutLine ("Text:Bot  = "+Text:Bot (Text)) 
                      Str:PutLine ("Text:At 2 = "+Text:At (Text, 2))
                      Text = Text:Next (Text) 
                      Str:PutLine ("Text:Next = "+Text)
                      Text = Text:Next (Text) 
                      Str:PutLine ("Text:Next = "+Text)
                      Text = Text:Next (Text) 
                      Str:PutLine ("Text:Next = "+Text)
                      Text = Text:Next (Text) 
                      Str:PutLine ("Text:Next = "+Text) 
                      Str:PutLine ("Text:Pos  = "+Text:Pos (Text))
                      Text = Text:Prev (Text) 
                      Str:PutLine ("Text:Prev = "+Text) 
                      Text = Text:Prev (Text) 
                      Str:PutLine ("Text:Prev = "+Text) 
                      Win:Pause 
                      Return 



                                       Text:Len


          Function  Text:Len ( Text ) 
                               ____

          Purpose   Get number of lines in Text.

          Returns   Returns number of lines.

          See Also  Text:Len, Text:Wid.

          Notes     If Text is  not a text block,  it will be treated  as a
                    single line.

          Example   See Text:Bot



                                      Text:Next


          Function  Text:Next ( Text ) 
                                ____

          Purpose   Gets the next line of Text.

          Returns   A Jorf Pointer to the next line of Text.

          See Also  Text:Prev, Text:Len.

          The JORF Manual (Disk Version)                                144














          Notes     Returns the next line of Text.  If Text is on  the last
                    line, or is not a  block of text, this function returns
                    null.

          Example   See Text:Bot


                                       Text:Pos


          Function  Text:Pos ( Text )  
                               ____

          Purpose   Returns the line number of Text.

          Returns   The previous line of Text.

          See Also  Text:At.

          Notes     Returns the  line number of  Text.   If Text is  on the
                    first line,  or is not  a block of text,  this function
                    returns 1.

          Example   See Text:Bot


                                      Text:Prev


          Function  Text:Prev ( Text ) 
                                ____

          Purpose   Get previous line of Text.

          Returns   The previous line of Text.

          See Also  Text:Next.

          Notes     Returns the previous line of  Text.  If Text is on  the
                    first line,  or is not  a block of text,  this function
                    returns null.

          Example   See Text:Bot












          Chapter Six - Library Functions Reference                     145















                                       Text:Top


          Function  Text:Top ( Text ) 
                               ____

          Purpose   Get a Jorf Pointer to the top of a block of text.

          Returns   A Jorf Pointer to the first line of a block of text.

          See Also  Text:Bot. Text:Next.

          Notes     Returns the first line of Text.  If Text is not  a text
                    block, then Text is returned because it is treated as a
                    one line text block.

          Example   See Text:Bot



                                       Text:Wid


          Function  Text:Wid ( Text ) 
                               ____

          Purpose   Get the width necessary to display this block of text.

          Returns   The width of the widest line of Text.

          See Also  Str:Len.

          Notes     Returns the width of the widest line of Text.   This is
                    used to  calculate the  width of  a window  adequate to
                    display Text without wrapping. 

          Example   See Text:Bot



                                       Time:Get


          Function  Time:Get ( TimeStructure )  
                               _____________

          Purpose   Get system Time.

          Returns   A TimeStructure filled with appropriate values.

          See Also  Time:Set.

          Notes     Gets  the system  time  and  date  from  the  computer.
                    TimeStructure elements are set to the following. 

          The JORF Manual (Disk Version)                                146














                    Time:Get (TimeStructure)
                    TimeStructure->Year           | 4 digit year
                    TimeStructure->Nmonth         | Numeric Month
                    TimeStructure->Day       | Day
                    TimeStructure->24hour         | Hour on 24 hour clock
                    TimeStructure->Hour      | Hour on 12 hour clock
                    TimeStructure->Minute         | Minute
                    TimeStructure->Second         | Second
                    TimeStructure->AMPM      | AM or PM
                    TimeStructure->Stime          | Time as HH:MM:SS
                    TimeStructure->Smonth         | String Month
                    TimeStructure->Sdate          |  String Date  according
          to Format
                    TimeStructure->Ndate          | Numeric Date  according
          to Format

                    If the  computer lacks  a clock, this  date may  not be
                    correct.  One test is to  see if the date is less  than
                    1990.  Most operating systems  boot with a default date
                    before  1990.   If a  clock  is used,  the system  date
                    should be  after 1990.   You can change the  date using
                    Time:Set.

                    Americans  should  be  humbled to  note  that  only one
                    country  in the  world  invented and  sustains  writing
                    dates as Month-Day-Year.   The European  Day-Month-Year
                    and the Oriental  Year-Month-Day both make  more sense.
                    You  wouldn't write  the time  as Minutes-Seconds-Hours
                    would you?

                    To  change the  formats, you  must  change the  default
                    setup values.  These values are:

             TimeStructure->M1     | The name for January
             TimeStructure->M2     | The name for February
                     . . .
             TimeStructure->M12    | The name for December

             TimeStructure->A1     | Letters that mean AM - Default "am"
             TimeStructure->A2     | Letters that mean PM - Default "pm"

             TimeStructure->Yoff   | Offset to change year - Default 0

             TimeStructure->STFormat    | Time Format - Default "h:mm a"
             TimeStructure->SDFormat    | Date Format - Default "m d, yyyy"
             TimeStructure->NDFormat    | Date Format - Default "m/d/y"

                                   Date Formatters
                                   Date Formatters

             m    = Month,                        Caps for Upper Case
             mm   = Month, w/zero                 Caps is ignored
             d    = Day                           Caps is ignored

          Chapter Six - Library Functions Reference                     147














             dd   = Day, w/zero                   Caps is ignored
             y    = Year                          Caps is ignored
             yy   = Two digit year                Caps is ignored
             yyyy = Four digit year               Caps is ignored

                                   Time Formatters
                                   Time Formatters

             h  = Hours                           Caps is military time
             _h = Hours, space in front           Caps is military time
             hh = Hours, zero in front            Caps is military time
             m  = Minutes                         Caps is ignored
             _m = Minutes, space in front         Caps is ignored
             mm = Minutes, zero in front          Caps is ignored
             s  = Seconds                         Caps is ignored
             _s = Seconds, space in front         Caps is ignored
             ss = seconds, zero in front          Caps is ignored
             a  = am or pm,                       Caps for Upper Case

                                       Examples
                                       Examples

                    French              d m, yyyy d-m-yyyy
                    British                       d.m.yyyy
                    Japanese                 y-m-d

                    You may note  that there is an issue,  even in America,
                    about how the numeric date will be written eight  years
                    from now.   Is January 17th, 2001 abbreviated as 2/17/0
                    or 2/17/00 or 2/17/2000?  I bet in our age of  speed an
                    abbreviations  that  we  will use  the  first.   Second
                    question, if the previous decade was "The Eighties" and
                    the  current decade is "The Nineties", what is name the
                    next decade?

          Example   This  program displays a  text box showing  the various
                    time values,  then switches to French (one  of only two
                    foreign languages  I know well  enough to know  all the
                    words, the other  is Japanese, and you  need a graphics
                    screen for that).

                    TimeTest:Start
                      New Time
                      Win:Add ("Time Test", 0, 0, 10, 40, Here)
                      Time:Get (Time)
                      Str:PutLine ("NDate: " +Time->NDate)
                      Str:PutLine ("SDate: " +Time->SDate)
                      Str:PutLine ("STime: " +Time->STime)
                      Str:PutLine ("Switch to French")
                      Time->M1="Janvier"
                      Time->M2="Frevier"
                      Time->M3="Mars"
                      Time->M4="Avril"
                      Time->M5="Mai"

          The JORF Manual (Disk Version)                                148














                      Time->M6="Jun"
                      Time->M7="Juillet"
                      Time->M8="Aout"
                      Time->M9="Septembre"
                      Time->M10="Octobre"
                      Time->M11="Novembre"
                      Time->M12="Decembre"
                      Time->NDFormat = "dd.mm.yy"
                      Time->SDFormat = "d m, y"
                      Time->STFormat = "h.m.s a"
                      Time:Get (Time)
                      Str:PutLine ("NDate: " +Time->NDate)
                      Str:PutLine ("SDate: " +Time->SDate)
                      Str:PutLine ("STime: " +Time->STime)
                      Win:Pause
                      Return



                                       Time:Set


          Function  Time:Set ( TimeStructure ) 
                               _____________

          Purpose   Set DOS clock.

          Returns   None.

          See Also  Time:Get.

          Notes     Sets  the DOS time  and date.   TimeStructure must have
                    the  elements  Year,  Month,  Day,  Hour,  Minute,  and
                    Second.   These  elements will  be  set to  appropriate
                    values.

                    The Date is set only if TimeStructure->Day is not zero.
                    The  time is set  if any  of the  three values  are not
                    zero, but will not  be changed if -TimeStructure->Hour,
                    TimeStructure->Minute and TimeStructure->Second are all
                    zero.

                    Setting the DOS  time and date does  not usually affect
                    the  computer's system clock.  The utility program that
                    resets  the  computer  clock  is  not  a  standard  DOS
                    command.  The  following are different commands  I have
                    seen  that can  set the  clock to  adjust for  daylight
                    savings  time:    CLKINIT,  CLOCK  /I,  and  TIMER  /H.
                    Network clocks must be set on the network server.  





          Chapter Six - Library Functions Reference                     149















                                      Time:Ticks


          Function  Time:Ticks

          Purpose   Gives an accurate timing mechanism.

          Returns   The number of ticks since midnight.

          See Also  Time:Get.

          Notes     Returns  the number clock  ticks since midnight.   This
                    may  be used  to time  methods  and program  processes.
                    This  allows   you  to  time  operations  with  greater
                    precision than  the  seconds in  the  Time:Get  command
                    allows.  The  ticks are somehow  tied to the  operating
                    system  and  the  C compiler  that  I  used  to compile
                    JORF.EXE.  Currently there are  18 ticks per  second on
                    all DOS and Windows based systems. 



                                       To:ASCII


          Function  To:ASCII ( String ) 
                               ______

          Purpose   Get ASCII value of first character of String.

          Returns   Returns the ASCII decimal value.

          See Also  To:Char.

          Notes     Converts a  letter to  its  ASCII decimal  value.   For
                    instance  To:ASCII "A"  returns 41.    Generally String
                              To:ASCII "A"          41
                    contains only one character, but  can be a word or line
                    of text.




                                       To:Caps


          Function  To:Caps ( String ) 
                              ______

          Purpose   Capitalize a string.

          Returns   Returns the capitalized string.

          See Also  To:Ucs.

          The JORF Manual (Disk Version)                                150














          Notes     Insures  that any character following a space in String
                    is  an upper  case letter.   Does  not affect  words or
                    acronyms that are already in capital letters.   This is
                    used to  change the  appearance of  strings for  screen
                    display. 


                                       To:Char


          Function  To:Char ( Value ) 
                              _____

          Purpose   Returns  a  one   character  string  with   the  letter
                    designated by the ASCII Value.

          Returns   Returns the one letter string.

          See Also  To:ASCII.

          Notes     For example, To:Char (41) returns "A".
                                 To:Char (41)


                                        To:Int


          Function  To:Int ( Num ) 
                             ___

          Purpose   Returns the integer value of Num

          Returns   Integer.

          See Also  To:Num.

          Notes     To:Int and To:Num  return the same value  for integers,
                    but  different  values if  there  is a  decimal.   This
                    function truncates  decimals, returning the  next lower
                    integer value.  You cannot  specify a number base using
                    To:Int as you can with To:Num. 


                                        To:Lcs


          Function  To:Lcs ( String ) 
                             ______

          Purpose   Convert a string to lower case.

          Returns   The lower case string.

          See Also  To:Ucs.



          Chapter Six - Library Functions Reference                     151














          Notes     Converts   all  characters,   including  initials   and
                    acronyms, to lower case.  


                                        To:Num


          Function  To:Num ( String, Base ) 
                             ______

          Purpose   Convert String to  its numeric value.   Does not change
                    items that are already numbers.

          Returns   Returns the numeric value.

          See Also  To:Str.

          Notes     I  know I  promised  that  JORF pointers  automatically
                    handle  numeric conversions, and  I am often  guilty of
                    exaggeration  on this  point.   There  is  a time  when
                    strings must be converted to numbers an back.  

                    You  can use another numbering Base for the conversion.
                    The default is 10 for decimal.  Use 16 for Hexadecimal,
                    8 for Octal, or any other number of other bases. 

                    Strings may  be integers,  decimals and  floating point
                    numbers  with  "E"  notation  (ex.  "3.24E-4").    This
                    command  does not  change  values    that  are  already
                    numbers, and  may be  used as  a precautionary  measure
                    when the  value might or  might not  have already  been
                    converted.


                                        To:Str


          Function  To:Str ( Number, Formatter, Base )  
                             ______

          Purpose   Convert  number to  a  string value.   Does  not change
                    items that are already strings.

          Returns   Returns the string value.

          See Also  To:Num.

          Notes     Converts the opposite  way as To:Num.   Used notably to
                    convert values back into strings. 

                    You can  use the Base to change  the number base of the
                    conversion.  The default is 10 for decimal.  You can 16
                    for hexadecimal, 8  for octal, or any  other number for
                    other numbering bases.

          The JORF Manual (Disk Version)                                152














                    You  can use  the Formatter  to apply  a format  to the
                    number.  The formatter  is a string with a mask for the
                    number.  Available digits in the string are:

                    #    Writes a numeric digit
                    0    Writes 0 place holder or the numeric digit
                    -    Writes a - sign if number is negative
                    +    Writes a + sign if positive, - if negative
                    .    Decimal point
                    $,   Any other character will be printed As-Is

          Example

          Binary:Start
            New Char
            Win:Add ("BINARY VALUES", 4, 4, 19, 60, Here)

            For (Char = 0 Thru 255)
              If (Char > 0 and (Char % 16 == 0))
                Win:Pause
                If Key:Got == "Esc_Key"
             Break
              Str:Put("     Character= {To:Str(Char,'000')} Symbol= ")
              Char:Put(Char)
              Str:PutLine("     Binary= {To:Str(Char,'0000 0000',2)}")

            If Key:Got != "Esc_Key"
              Win:Pause
            Jorf:Exit




                                        To:Ucs


          Function  To:Ucs ( String ) 
                             ______

          Purpose   Convert a string to UPPER CASE.

          Returns   The UPPER CASE string.

          See Also  To:Caps.

          Notes     Converts   all  characters,   including  initials   and
                    acronyms, to UPPER CASE. Returns the resulting string.







          Chapter Six - Library Functions Reference                     153















                                         True


          Function  True

          Purpose   Returns a value to indicate Logical True.

          Returns   A JORF Pointer to the integer 1.

          See Also  False.

          Notes     Most  programming language  express results  of logical
                    equations  as  zero  to  indicate  False,  and  one  to
                    indicate True.  These values are called Boolean values.


                    This  function was created  in the interest  of program
                    clarity.  It simply returns the integer value one.




                                 While/Break/Continue


          Function  While/Break/Continue

          Purpose   A Loop

          Returns   None.

          Notes     A loop.   Tests the  value of a parameter  and executes
                    indented code sections based on that value. 

                         While  ( TestValue ) 
                                  _________
                           Does indented section until false
                         Break 
                         Continue

                    Tests  a value and  does commands in  indented sections
                    until that value is zero or false.   The value is often
                    a logical expression in parenthesis.

                    Corresponds exactly  to the  C language  while command.
                    The test  value is  usually a  logical evaluation,  but
                    While True is also  common.  This indicates  an endless
                    loop that will be ended using the Break command.

                    Break ends the execution of a While.  Program flow will
                    resume on the line following the loop.


          The JORF Manual (Disk Version)                                154














                    Continue ends  execution of  the current loop,  returns
                    control to the While  command to test and  executed the
                    loop  again if  the  condition  remains  valid.    This
                    command is used  to simplify code within  complex while
                    loops.  It is not generally used.

          Examples  The  While  statement   creates  a  loop  based   on  a
                         While
                    condition.   This  loop  is  repeated  as long  as  the
                    condition is TRUE.  A Break can be used to break out of
                                          Break
                    the  loop even  if  the  condition is  still  True.   A
                    Continue is used  to shortcut the loop,  restarting the
                    Continue
                    next iteration immediately.

                       Counter=0                       | Initialize Counter
                       While (++Counter <= 5)          | Increment Counter
                         Rule:Find (Rule)              | Find a next rule
                         If (Rule->Fnd=Null)           | If not found
                           Break                          |   break out  of
                    loop
                         If (Rule->Ptr=Null)           | If condition Null
                           Continue                    | Skip rest of loop
                         P=P+"-"+Rule->Pointer         | Add Pointer
                       Str:PutLine (P)                 | Show result 



                                       Win:Add


          Function  Win:Add ( Title, Row, Col, Len, Wid, Level, Text ) 
                    (A WindowStructure may substitute for Title.)

          Purpose   Display a new Window on the screen.

          Returns   None.

          See Also  Chapter Five, Msg:Add, Move:To, Str:Put.

          Notes     Without doubt,  the most complicated  library function.
                    WindowStructure can contain the following elements: 

                    Row            Top Row of Window
                    Col            Left Column of Window
                    Len            Number of rows inside window
                    Wid            Number of columns inside window
                    CurRow         Cursor Row in Window
                    CurCol         Cursor Column in Window
                    MouseRow       Mouse Cursor Row in Window
                    MouseCol       Mouse Cursor Column in Window
                    RowOff         Rows that display is offset
                    ColOff         Columns that display is offset
                    InpRow         Row of Input Field

          Chapter Six - Library Functions Reference                     155














                    InpCol         Column of Input Field
                    InpLen         Length of Input Field
                    InpWid         Width of Input Field
                    Text           Text displayed in Window
                    Type           Window color or type
                    Level          Value of Here 
                    Magic          TRUE if Window interprets Magic Spots
                    Attr           Current Attribute 1 for low - 5 for high
                    FLRCO          Current FLRCO value

                    A window is a  box on the  screen where all output  and
                    input takes  place.  In DOS,  the sides of  the box are
                    one  character width wide and one character width tall.
                    A shadow on  the right side takes two character columns
                    and  on the bottom  takes an additional  character row.
                    Under Microsoft windows, an overlapped window with wide
                    borders is displayed using your default color scheme. 

                    An optional title may be  displayed centered in the top
                    line, and a message may be displayed in the bottom line
                    left side. 

                    DOS  Windows use direct video access unless you specify
                    otherwise in  the JORF.INI file.   DOS windows  have an
                    exploding  speed, which  changes  how the  windows  are
                    displayed. 

                    All console  input and  output takes  place on  the top
                    window displayed on the  screen.  There is  no facility
                    to update  a window that is  not the top window  on the
                    screen, even under MS-Windows.  
                    If Title is specified, it will be displayed centered on
                    the  top of  the window.    If the  width of  the title
                    exceeds  the window width specification then the window
                    width  will  be  increased  to accommodate  the  title.
                    Magic spots in the title will be interpreted.

                    If Text is specified, the window is created exactly the
                    size of  the text  to be  displayed.   If  the text  is
                    greater than  the screen  length or  width, the  window
                    will expand to  the boundaries of the screen.  Commonly
                    the text attribute is passed  as an indented section of
                    the  program.  Any  indented section  is passed  by the
                    interpreter  as  the  last  parameter  to  the  command
                    preceding  the indented section.   Text is  required if
                    this window is to be edited using Line:Inp.

                    If  Row and  Col  are specified,  the  position of  the
                    window will  be moved  to the position  indicated.   If
                    they  are  negative,  then the  window  will  be placed
                    relative to the bottom right corner of the screen.   If
                    the  window dimensions  do  not  entirely  fit  on  the

          The JORF Manual (Disk Version)                                156














                    screen, because Text is too large or Length too long or
                    Width too wide  the Row and Col values  will be changed
                    so that the window will entirely fit on the screen.

                    The Len (Length) and Wid (Width) parameters can be used
                    to set the exact size  of the window.  These parameters
                    will override the size of Text.

                    The Level parameter must  specify the value of here  in
                    the method that  creates the window.   When that method
                    is completed, the window will automatically be erased.

          Example

          Windows:Start
            Win:Add ("Big", 2, 2, -2, -2)
            Win:Add ("Top Right", 3, 3, 3, 15)
            Win:Add ("Bottom Right",-3, 3, 3, 15)
            Win:Add ("Bottom Left", -3, -3, 3, 15)
            Win:Add ("Top Left", 3, -3, 3, 15)
            Win:Add ("Tall", 3, 45, -4, 10)
            Win:Add ("Wide", 10, 3, 3, -4)
            Win:Pause
            Return Ok




                                       Win:Attr


          Function  Win:Attr ( Attribute ) 
                               _________

          Purpose   Sets attribute for text in a window.

          Returns   None.

          Notes     Whenever anyone in the IBM PC world says Attribute, you
                                                             Attribute
                    know  they are  talking about  colors  on the  monitor.
                    This command sets the colors for text to be displayed.

                    The attribute may  be "Hi" for highlighted  text, "Low"
                    for low highlight.  You can also set one of five values
                    for attribute, 1  corresponds to normal, through  5 for
                    high. 

                    You can  set attribute  without using  this command  by
                    setting Win:Ptr->Attr  = Attribute.   This  is now  the
                            Win:Ptr->Attr  = Attribute
                    preferred method for setting attribute, and the command
                    may be eliminated in later versions of JORF.



          Chapter Six - Library Functions Reference                     157















                                      Win:Block


          Function  Win:Block ( Function, Command )  
                                ________

          Purpose   Do some WordStar style block commands.

          Returns   None.

          Notes     JORF Version  2.0 introduces  the same  Block Move  and
                    Copy commands  found in  other Wordstar  style editors.
                    You can access these functions using Win:Block.  

                    Win:Block  "Mark"  Marker.    Places  a  block  marker.
                    Marker can be a number from 0 through 9, "Beginning" or
                    "End".

                    Win:Block  "Goto" Marker.    Move  cursor  to  a  block
                    marker.   Marker  can be  a  number from  0 through  9,
                    "Beginning" or "End".

                    Win:Block "Copy".   Copies  a marked  block to  current
                    cursor location.   Nothing  is copied  if block  is not
                    correctly marked, or if cursor is within the block.

                    Win:Block "Delete" Marker.  Delete the marked block, no
                    matter where the cursor is located. 

                    Win:Block  "Move".  Moves a marked  block by copying it
                    to the  current cursor  location and  then deleting  it
                    from its prior location.

                    Win:Block "Read"  FileName.   Reads a  block from  disk
                    into the  current cursor location.  File  is assumed to
                    be a text file.  This  read adds lines one by one,  and
                    is much slower than File:Load.

                    Win:Block "Write" FileName.   Writes a marked  block to
                    disk.  Does not change block markers.



                                       Win:Del


          Function  Win:Del

          Purpose   Delete top window on screen.

          Returns   None.


          The JORF Manual (Disk Version)                                158














          See Also  Win:Add.

          Notes     Deletes a single window on the  screen.    This command
                    is  not  generally  used  because  windows  are deleted
                    automatically  when the  method  that  creates them  is
                    complete.

          Example   See Arr:Sort.



                                      Win:FLRCO


          Function  Win:FLRCO ( Mode ) 
                                ____

          Purpose   Change wrap mode for text on the window.

          Returns   Previous  wrap mode  as a  string  containing a  single
                    lower case letter "f", "l", "r", "c" or "o".

          See Also  Win:Add.

          Notes     Sets the  current window  mode for  text justification.
                    The name of this command comes from the possible Modes;
                    "Full",  "Left", "Right",  "Center", or  "Off".   "Off"
                    turns  off the  text  wrapping  feature  so  text  that
                    overflows the window  boundary will  not be  displayed.
                    The other modes all  turn on the wrapping  feature that
                    wraps text at the nearest word boundary.

                    You can set FLRCO without using this command by setting
                    Win:Ptr->FLRCO = Attribute.  This is now the  preferred
                    Win:Ptr->FLRCO = Attribute
                    method  for setting  FLRCO,  and  the  command  may  be
                    eliminated in later versions of JORF.


                                      Win:Magic


          Function  Win:Magic ( Mode ) 

          Purpose   Change whether curly brackets  are interpreted in  text
                    on the window.

          Returns   Previous Magic mode True or False. 

          See Also  Win:Add.

          Notes     Sets  the  mode  for "Magic",  whether  {curly bracket}
                    expressions  are interpreted in  text display.  Usually
                    this mode  is True,  allowing all  variable values  and

          Chapter Six - Library Functions Reference                     159














                    input  expressions to  be interpreted.    However, when
                    editing  commands or program  text, you want  this mode
                    off so the that curly brackets are not interpreted. 

                    You also  want to  set FLRCO  "Off" to editing  program
                    text.  Otherwise text  lines will  wrap  at the  window
                    borders.

                    Astute  programmers may note  that variables in windows
                    are replaced,  even when  they are  not in  the current
                    method.  The "Magic" system looks down the entire stack
                    for a named variable, and is not limited by the current
                    method which may just display the window.  

                    You can set Magic without using this command by setting
                    Win:Ptr->Magic = True (or  False).   This  is  now  the
                    Win:Ptr->Magic = True
                    preferred method for setting Magic, and the command may
                    be eliminated in later versions of JORF.


                                       Win:Msg


          Function  Win:Msg ( Message ) 

          Purpose   Display a message in the Window.

          Returns   None.

          See Also  Win:Add.

          Notes     Displays  a message  in the  last line  of  the current
                    window.   If  the message  is absent  or null  then the
                    current message is deleted.  


                                      Win:Pause


          Function  Win:Pause ( Hundredths ) 

          Purpose   Pause.

          Returns   The Key that was hit, if one was hit, to end the pause.

          See Also  Kbd:Get.

          Notes     Pauses  for  the  specified  number  of  Hundredths  of
                    seconds.   Due to the quirky hardware engineering of an
                    IBM  PC, exact Hundredths are  a basic unit, but cannot
                    be  obtained by  a  program.    Generally,  the  finest
                    resolution is about three hundredths  of a second at  a

          The JORF Manual (Disk Version)                                160














                    time.  Anyway,  this command will pause as  close as it
                    can get to the hundredths you specified.

                    If the operator hits any  key, the pause will end.   If
                    Hundredths   is   zero,   the   pause   will   continue
                    indefinitely.  If the pause  is greater than 5 seconds,
                    a "Happy Goat" will be displayed. 

          Example   This  example is  the  much reviled  SayLineByCharacter
                    method  that  is  used  in  the  tutorial  for  program
                    scripts.

                    Script:SayLineByCharacter (j)
                      New I C
                      I=1                      | Start with 1
                      While Ok
                        C=Str:At(J, I, 1)      | Get Character
                        If (C=Null)            | Done?
                          Break
                        Str:Put (C)            | Put it
                        ++I                    | Next Character
                        Win:Pause (1)          | Pause a hundredth 
                      Str:PutLine              | Carriage Return



                                       Win:Ptr


          Function  Win:Ptr

          Purpose   Get the  WindowStructure that  was used  to create  the
                    window.

          Returns   A  pointer  to  the WindowStructure  that  was  used to
                    create the window.  Null if no structure was used.

          See Also  Win:Add.

          Notes     Row,  Column,  Length  and  Width  reflect  the  actual
                    window, and may have changed if the window was adjusted
                    to fit on the screen.

                    Win:Ptr is most often used to pass values to  keystroke
                    handling  methods.    Although  no  parameters  may  be
                    passed,  values attached  to  the window  structure can
                    pass pointers.   This is how  the Editkey methods  find
                    out the location and value of the item they are working
                    on.

                    CurRow and  CurCol will  be set to  the cursor  row and
                    column.  MouseRow and MouseCol are set to current mouse

          Chapter Six - Library Functions Reference                     161














                    position If the mouse pointer is inside the window.  If
                             If the mouse pointer is inside the window
                    the window is  an edit window, then the  CurLine is set
                    to  the currently  executed  line,  and  that  line  is
                    redisplayed   on  the   screen  (some   window  display
                    functions are buffered).  

                    If the  window is an  edit window, Magic is  False, and
                    FLRCO is "Off", then the  window can move right or down
                    to accommodate text that is larger than the window.  In
                    this  case  RowOff  and  ColOff  reflect  the  relative
                    position  of the  top left  corner of  the text  in the
                    window.



                                       Win:Repl


          Function  Win:Repl ( SearchString, ReplaceString, Flags ) 
                               ____________  _____________  _____

          Purpose   Do some WordStar style string replacing commands.

          Returns   None.

          See Also  Win:Search.

          Notes     JORF Version 2.0 introduces the same Search and Replace
                    commands  found in other  WordStar style editors.   You
                    can  access  these   functions  using  Win:Search   and
                    Win:Repl.  

                    Flag values are:

                    B    Search backward to top 
                    G    Global replace
                    N    Do not prompt 
                    U    Case insensitive search 
                    W    Search for Whole Words

                    In addition, you can add a numeric count for the number
                    of items to replace.

                    This  command can only  be used within  an edit window,
                    and  will do  nothing if  used  on a  text that  is not
                    currently being edited in the window.








          The JORF Manual (Disk Version)                                162















                                      Win:Search


          Function  Win:Search ( SearchString, Flags ) 
                                 ____________  _____

          Purpose   Do some WordStar style string search. 

          Returns   None.

          See Also  Win:Repl.

          Notes     JORF Version 2.0 introduces the same Search and Replace
                    commands  found in other  Wordstar style editors.   You
                    can  access   these  functions  using   Win:Search  and
                    Win:Repl.  

                    Flag values are:

                    B    Search backward to top 
                    U    Case insensitive search
                    W    Search for Whole Words

                    In addition, you can add a numeric count for the number
                    of items to search by before stopping. 

                    This command  can only be  used within an  edit window,
                    and will  do nothing  if used  on  a text  that is  not
                    currently being edited in the window.



                                       Word:At


          Function  Word:At ( Structure, Position ) 
                              _________  ________

          Purpose   Returns a  word in parsed  command line, or value  of a
                    member of a structure. 

          Returns   Word.

          See Also  Word:AtPut, Class:At.

          Notes     Both structures and text  lines are stored as an  array
                    of  Class:Word  pairs.   The  number  of words  can  be
                    obtained using Word:Len.

                                      Structures
                                      Structures

                    Normally,   structure  elements   are  accessed   using
                    pointers.   However,  they  may  also  be  accessed  by

          Chapter Six - Library Functions Reference                     163














                    referencing the  elements directly using  this command.
                    This has to be done to examine the stack, because it is
                    not a normal class. 

                                        Stack
                                        Stack

                    Each  level of the  stack (each method  call) creates a
                    new structure.  The first element has the class  Method
                                                                     Method
                    and is  the current program  line.  The  second element
                    has the  class From  and is the  previous level  of the
                                   From
                    stack.  The  next elements  are the  parameters in  the
                    order  they were passed.  Then,  any New variables with
                                                         New
                    the variable name standing for the class name.

                                      New Values
                                      New Values

                    New values that are structures contain a pointer to the
                    class  definition in  the  first element.    Subsequent
                    elements are various values in the order that they were
                    referenced.  

                                        Arrays
                                        Arrays

                    Array  elements  are  normally  accessed  using  square
                    brackets  [].   But if  you  find reason,  you can  use
                    Word:At  to get  the element.  Word:Len-1  will be  the
                    Word:At                        Word:Len-1
                    number of elements used in the array. 

                                         Text
                                         Text

                    Text  lines may  be examined  to  obtain the  class and
                    values  of   items  on   that  line.     The  line   is
                    automatically  parsed when Word:At is used.  Unlike the
                    parse  used  by  the  interpreter,  the  Word:At  parse
                    separates  all punctuation  characters into  individual
                    words, even  if they are two character symbols like the
                    pointer->operator.
                           ->

          Example   See Event:Add.



                                      Word:AtCut


          Function  Word:AtCut ( Structure, Position ) 
                                 _________  ________

          Purpose   Truncates a structure.

          Returns   None.

          See Also  Word:At, Str:AtCut.

          The JORF Manual (Disk Version)                                164














          Notes     I don't  know why!   I've got  this thing  about making
                    commands  symmetrical,  so  just  because  there  is  a
                    Str:AtCut there has to be  a Word:AtCut.  I suppose you
                    could  use  it  to truncate  temporary  values  off the
                    stack.   That's It!   You can write a  JORF interpreter
                    using  JORF and you'll have  to be able  to add and cut
                    values on the stack.

                    Just be real careful, you could easily cut your current
                    variables  right off.   Cutting  a word  also cuts  the
                    adjoining class.


                                      Word:AtDel


          Function  Word:AtDel ( Structure, Position, Count ) 
                                 _________  ________  _____

          Purpose   Squeezes a structure.

          Returns   None.

          See Also  Word:At, Str:AtDel.

          Notes     Squeezes elements  out of  the center  of a  structure.
                    Like  Word:AtCut, uses for this command are limited and
                    rather dangerous.


                                      Word:AtPut


          Function  Word:AtPut ( Structure, Position, Value ) 
                                 _________  ________  _____

          Purpose   Changes the value in a member of a structure. 

          Returns   None.

          See Also  Word:At, Class:AtPut.

          Notes     Both  structures and text lines  are stored as an array
                    of  Class:Word  pairs.   The  number  of words  can  be
                    obtained using  Word:Len.   Although Word:At works  for
                    both text  and  structures, Word:AtPut  works  only  on
                    structures, not text lines.  To change a text line, you
                    must use the String functions.

                    Word:AtPut can  be  used  to  change an  element  in  a
                    structure, or a variable in the stack.  It can  even be
                    used to  move the  program line  pointer, which is  the
                    first element in a stack structure.


          Chapter Six - Library Functions Reference                     165















                                       Word:In


          Function  Word:In ( Structure, Word ) 
                              _________  ____

          Purpose   Searches  for the existence  of Word in  a structure or
                    parsed command line, and returns the position if it  is
                    found.  Returns zero if Class is not found.

          Returns   Position of Word or zero if not found.

          See Also  Word:At, Class:In.

          Notes     Both structures and  text lines are stored  as an array
                    of  Class:Word  pairs.    The number  of  words  can be
                    obtained using Word:Len.   Word:In can  be used to  get
                    the value  of an element  in a structure  without using
                    the structure pointer operator.



                                       Word:Len


          Function  Word:Len ( Structure ) 
                               _________

          Purpose   Returns the number  of elements in a  structure, or the
                    number of words in a parsed text line.

          Returns   Number of words.

          See Also  Word:At, Str:Len.

          Notes     In the  deep past, pieces of the  JORF interpreter were
                    developed as  part of  a Japanese  to English  language
                    translator. But I go so  bogged down in memory and file
                    management  problems (in the C language) that I decided
                    to  create  a  new  language  to  do  my   parsing  and
                    dictionary management.  That tool eventually became The
                    JORF Language.

                    There remains a number of low level  functions that are
                    word oriented,  especially towards  parsing lines  into
                    words.   It doesn't  matter to the  interpreter whether
                    these  lines are English text, or JORF language command
                    lines, the parser works the same.  

                    Word:Len returns the  length of a text line,  as parsed
                    for  Natural  Language  Processing.   Each  punctuation
                    character is handled as a  separate word.  This differs


          The JORF Manual (Disk Version)                                166














                    slightly from the interpreter parse which sees elements
                    like the structure->operator as one word.

                    Structures  also use  the  parsed format,  even  though
                    their Str:Len  is zero.    This is  one way  to tell  a
                    String from a Structure.


                                      Word:Type


          Function  Word:Type ( Structure, Position ) 
                                _________  ________

          Purpose   Returns the type of word at the designated Position.

          Returns   String type of the words.

          Notes     This function is commonly used within the  interpreter,
                    and so  has been added as  a function in hopes  it will
                    help JORF  language programs  that  must parse  command
                    lines.  Possible types are:

                    "String"       A string, may be a quoted number.
                    "Punctuation"  A punctuation character.
                    "Function"     A JORF Function name.
                    "Method"       A JORF Method name.
                    "Number"       A number.
                    "Jorf"         None of the above. 
                                   (A Text or Array pointer for instance.)
























          Chapter Six - Library Functions Reference                     167














                                       Appendix
           
                         Appendix A - JORF Language Reference


                                     Basic Rules

                    Indentation controls program flow.
                    Commands and variable names are not case sensitive.
                    The end of line is the end of the line.
                    The comment character is a pipe symbol (|).
                    Parameter lists are surrounded by Parentheses


                                      Key Words

                    Class          Used to declare a new class.
                    Class
                    Parent         In  a  class  definition,  designates  a
                    Parent
                                   parent class.
                    Jorf The default class for all objects.
                    Jorf
                    Index          Declares an index field within a class
                    Index


                         Math Symbols and Order of Operations

                    ->             Structure Element Pointer
                    []                  Array reference
                    - ~ ++ --      Negation,     Complement,     Increment,
                                   Decrement
                    * / %          Multiplication, Division, Modulus
                    + -            Addition and Subtraction
                    = <> !=        Equality and Inequality
                    > < >= <=      Comparison
                    & ? ^          Bitwise And, Or and Xor
                    && ?? And Or   Logical And, Or
                    =              Assignment of value

















          The JORF Manual (Disk Version)                                168















                            Appendix B - Library Functions

          Function                      Description                 Returns

          Arr:Del (Arr,Pos,Cnt)         Delete Cnt Elements at Pos    Array
                   ___ ___ ___
          Arr:Dir (WildCard,Excl)       Directory minus exclusions    Array
          Arr:Ins (Arr,Pos,Cnt)         Insert Cnt Elements at Pos    Array
                   ___ ___ ___
          Arr:Len (Arr)                 Number of Elements            Count
                   ___
          Arr:Pick (Arr,Cmd,T,R,C,L,Df) Show a Pick Menu               Pick
                    ___
          Arr:Printers                  Returns Printer List          Array
          Arr:Sort (Arr,Cmd,Dir)        Sort Ascending/Descending     Array
                    ___

          Char:Del (Count)              Del Spaces                     None
                    _____
          Char:Get                      Get ASCII value               Value
          Char:Ins (Count)              Ins Spaces                     None
                    _____
          Char:Put (Value)              ASCII value to Screen          None
                    _____
          Char:Print (Prn, Val)         ASCII value to Printer         None
                      ___  ___

          Class:At (Struct,Pos)         Class at Position             Class
                    ______ ___
          C l a s s : A t P u t         ( S t r u c t , P o s , C l a s s )
                                          ____________  ______  __________
                                        Change Class                   None
          Class:In (Struct,Class)       Get Position               Position
                    ______ _____
          Class:Read (Name)             Read Class                     None
                      ____
          Class:Write (Name)            Write one/all Class            None

          Event:Add (Class,Type,Lev)    Add Event Class                None
                     _____ ____ ___
          Event:Del (Type)              Delete Event Class             None
                     ____
          Event:Do (Method,Type)        Do Event Method              Return
                    ______ ____

          False                         Logical False                  Null

          File:Access (Name,Access)     Check Existence/Access        If Ok
                       ____
          File:Backup (Name)            Create a Backup               If Ok
                       ____
          File:Chgdir (Path)            Change Directory              If Ok
                       ____
          File:Copy (From,To)           Copy File                     If Ok
                     ____ __
          File:Del (Name)               Delete File                   If Ok
                    ____
          File:Len (Name)               Get Size of File          Size in K
                    ____
          File:Load (Name)              Load Text File                 Text
                     ____
          F i l e : M a p     ( N m , L e v , C l a s s , T y p e , M a p )
                                ____  ______  __________  ________  ______
                                        Map ASCII or dBASE File        None
          File:MoveTo (Nm,Lev,Pos)      Move to Beg/Ene               If Ok
                       __ ___ ___
          File:Ok (Name)                Not EOF in File:Read          If Ok
                   ____
          File:Read (Nm,Lev,Sz,Off)     Read Line/Record        Line/Record
                     __ ___
          File:Rename (From,To)         Rename File                   If Ok
                       ____ __
          File:Save (Name,Text)         Save Text to File             If Ok
                     ____ ____
          File:Write (Nm,Lev,Ln,Sz,Off) Write Line/Record              None
                      __ ___ __






          Appendix                                                      169














          Function                      Description                 Returns

          For/Thru/Step                 Incrementing Loop              None

          Here                          Return level                  Level

          If/Else                       Conditional Branch             None

          Jorf:Add (Pointer)            Write to File                  None
                    _______
          Jorf:Cls                      Clear DOS Screen               None
          Jorf:Del (Text)               Delete Text                    None
                    ____
          Jorf:Do (MethodName)          Interpret a string           Return
                   __________
          Jorf:Dup (Text)               Copy Text or Struct          A Copy
          Jorf:Exit (Status,Msg,Cmd)    Exit                        Doesn't
          Jorf:File (Name Level)        Current Project                None
                     ____ _____
          Jorf:Flush (Minimum)          Flush memory                   None
          Jorf:Move (Srce,Dest,Class)   Move Buffer                  A Copy
                     ____ ____
          Jorf:Pack                     Pack JORF File                 None
          Jorf:Rebuild                  Rebuild JORF File              None
          Jorf:Sound (Freq,Dur)         Make a Sound                   None
          Jorf:System (Command)         DOS shell                    Return

          Kbd:Bye                       Flush Keyboard Stream          None
          Kbd:Get (CursorSize)          Keyboard Input                  Key
          Kbd:Got                       Last Key Value                  Key
          Kbd:Hit                       Key Waiting?             True/False
          Kbd:Put (Keys)                Stuff Keystrokes               None

          Key:Add (RuleStructure)       Add String Key                 None
                   _____________
          Key:Del (RuleStructure)       Delete String Key        Sets Found
                   _____________
          Key:Find (RuleStructure)      Find String Key          Sets Found
                    _____________
          Key:Next (RuleStructure)      Find Next                Sets Found
                    _____________
          Key:Prev (RuleStructure)      Find Prev                Sets Found
                    _____________

          Line:Att (From,To,Len)        Set Attribute                  None
                    ____ __ ___
          Line:Del (Count)              Delete Lines                   None
                    _____
          Line:Inp (Fld,R,C,L,W)        Input Field/Text         Field/Text
                    ___
          Line:Ins (Count)              Insert Lines                   None
                    _____
          Line:Out (Fld,R,C,L,W)        Output Field/Text              None
                    ___

          Mem:Ptr                       A Global Pointer               None












          The JORF Manual (Disk Version)                                170














          Function                      Description                 Returns

          Move:To (Row,Column)          Move Cursor                    None
          Move:By (Row,Column)          Move Cursor                    None

          Msg:Add (Title,Type,Text)     A Dialog Box             True/False

          New (Class:Var1,Class:Var2)   Create Variables               None
                     ____

          Null                          Nothing                        Null

          Num:Abs (Num)                 Absolute value               Number
                   ___
          Num:Btw (A,B,C)               A, Between B and C           Number
                   _ _ _
          Num:Exp (Num)                 Exponent e to the Num        Number
                   ___
          Num:Log (Num)                 Log of Num                   Number
                   ___
          Num:Max (A,B)                 Higher of A or B             Number
                   _ _
          Num:Min (A,B)                 Lower of A or B              Number
                   _ _
          Num:Pow (Num,Pow)             Num to the Power             Number
                   ___ ___
          Num:Rand (High,Low)           Random Number                Number
                    ____ ___
          Num:Sqrt (Num)                Random Number                Number
                    ___

          Ok                            Ok                                1

          Return (Value)                Return a value                 None

          Rule:Add (RuleStructure)      Add Rule                       None
                    _____________
          Rule:Del (RuleStructure)      Delete Rule              Sets Found
                    _____________
          Rule:Find (RuleStructure)     Find Rule                Sets Found
                     _____________
          Rule:Next (RuleStructure)     Find Next Rule           Sets Found
                     _____________
          Rule:Prev (RuleStructure)     Find Previous Rule       Sets Found
                     _____________

          Str:Aft (String,Chars)        String after chars        Substring
                   ______ _____
          Str:At (String,Pos,Len)       Get Substring             Substring
                  ______ ___ ___
          Str:AtChar (String,Chars)     String up to chars        Substring
                      ______ _____
          Str:AtCut (String,Pos)        Truncate String              String
                     ______ ___
          Str:AtDel (String,Pos,Cnt)    Delete Characters            String
                     ______ ___ ___
          Str:AtPut (String,Pos,Ins)    Insert Characters            String
                     ______ ___ ___
          Str:AtSet (Str,Pos,Ins,Cnt)   Insert Rep Chars             String
                     ___ ___ ___ ___
          Str:In (String,Substring)     Get Substring              Position
                  ______ _________
          Str:Ind (String)              Num of lead Spaces            Count
                   ______
          Str:Len (String)              Number of Chars              Length
                   ______
          Str:Print (Prn,String)        String to Printer              None
                     ___ ______
          Str:Put (String)              Display Text                   None
                   ______
          Str:PutLine (Line)            Display Text, NL               None
                       ____









          Appendix                                                      171














          Function                      Description                 Returns

          Struct:Find (Class,Index,Val) Find record w/ auto index    Record
                       _____ _____
          Struct:Find (Class,Index,Val) Find record w/ auto index    Record
                       _____ _____
          Struct:Find (Class,Index,Val) Find record w/ auto index    Record
                       _____ _____

          Switch/Case/Else              Conditional Branch             None

          Text:Add (Line,Text)          Create text block          New Text
                    ____
          Text:At (Text,Pos)            Text Line at Pos               Line
                   ____ ___
          Text:Bot (Text)               Last Line of Text         Last Line
                    ____
          Text:Len (Text)               Number of lines          Line Count
                    ____
          Text:Next (Text)              Next line of Text         Next Line
                     ____
          Text:Pos (Text)               Line num of Text             Number
                    ____
          Text:Prev (Text)              Prev line of Text         Prev Line
                     ____
          Text:Ptr (Text)               Ptr to ind Text                Text
                    ____
          Text:Top (Text)               First Line of Text       First Line
                    ____
          Text:Wid (Text)               Width of widest Line          Width
                    ____

          Time:Get (TimeStructure)      Get Date,Time         TimeStructure
          Time:Set (TimeStructure)      Set Date,Time                  None
          Time:Ticks                    Get Ticks                     Ticks

          To:ASCII (String)             Get ASCII Value               Value
                    ______
          To:Caps (String)              Cvt to Capitals              String
                   ______
          To:Char (Number)              Cvt to Letter                String
                   ______
          To:Int (Number)               Cvt to Integer              Integer
                  ______
          To:Lcs (String)               Cvt to Lower Case            String
                  ______
          To:Num (String,Base)          Cvt to Number                Number
                  ______
          To:Str (Number,Fmt,Base)      Cvt to String                String
                  ______
          To:Ucs (String)               Cvt to Upper Case            String
                  ______

          True                          Logical True                      1

          While/Break/Continue          A Loop                         None


















          The JORF Manual (Disk Version)                                172














          Function                      Description                 Returns

          Win:Add (T,R,C,L,W,Lv,Txt)    Add new Window                 None
          Win:Add (WindowStruct)        Add new Window                 None
          Win:Attr (Attribute)          Change Attribute               None
                    _________
          Win:Block (Cmd,Fnc)           Do Block Function              Null
          Win:Del                       Delete Window                  None
          Win:FLRCO (Mode)              Change Wrap Mode          Prev Mode
          Win:Magic (Mode)              Change Interpret Mode     Last Mode
          Win:Msg (Message)             Set Message                    None
          Win:Pause (Hundredths)        Pause                           Key
          Win:Ptr                       Get WindowStruct          Structure
          Win:Repl (From,To,Flags)      Replace Strings                None
                    ____ __
          Win:Search (Word,Flags)       Replace Strings                None
                      ____

          Word:At (Struct,Pos)          Word at Pos                    Word
                   ______ ___
          Word:AtCut (Struct,Pos)       Truncate Structure             None
                      ______ ___
          Word:AtDel (Struct,Pos,Cnt)   Squeeze Structure              None
                      ______ ___ ___
          Word:AtPut (Struct,Pos,Word)  Change Word at Pos             None
                      ______ ___ ____
          Word:In (Struct,Word)         Get Position of Word       Position
                   ______ ____
          Word:Len (Struct)             Number of Words               Count
                    ______
          Word:Type (Struct,Pos)        Type of Word                   Type
                     ______ ___































          Appendix                                                      173
















                             Appendix C - Keyboard Values

          Char     Normal     Shift          Ctrl           Alt

          a        A_Key      A_Key          Ctrl_A_Key     Alt_A_Key
          b        B_Key      B_Key          Ctrl_B_Key     Alt_B_Key
          c        C_Key      C_Key          Ctrl_C_Key     Alt_C_Key
          d        D_Key      D_Key          Ctrl_D_Key     Alt_D_Key
          e        E_Key      E_Key          Ctrl_E_Key     Alt_E_Key
          f        F_Key      F_Key          Ctrl_F_Key     Alt_F_Key
          g        G_Key      G_Key          Ctrl_G_Key     Alt_G_Key
          h        H_Key      H_Key          BackSpace_Key  Alt_H_Key
          i        I_Key      I_Key          Tab_Key        Alt_I_Key
          j        J_Key      J_Key          Ctrl_Return_KeyAlt_J_Key
          k        K_Key      K_Key          Ctrl_K_Key     Alt_K_Key
          l        L_Key      L_Key          Ctrl_L_Key     Alt_L_Key
          m        M_Key      M_Key          Return_Key     Alt_M_Key
          n        N_Key      N_Key          Ctrl_N_Key     Alt_N_Key
          o        O_Key      O_Key          Ctrl_O_Key     Alt_O_Key
          p        P_Key      P_Key          Ctrl_P_Key     Alt_P_Key
          q        Q_Key      Q_Key          Ctrl_Q_Key     Alt_Q_Key
          r        R_Key      R_Key          Ctrl_R_Key     Alt_R_Key
          s        S_Key      S_Key          Ctrl_S_Key     Alt_S_Key
          t        T_Key      T_Key          Ctrl_T_Key     Alt_T_Key
          u        U_Key      U_Key          Ctrl_U_Key     Alt_U_Key
          v        V_Key      V_Key          Ctrl_V_Key     Alt_V_Key
          w        W_Key      W_Key          Ctrl_W_Key     Alt_W_Key
          x        X_Key      X_Key          Ctrl_X_Key     Alt_X_Key
          y        Y_Key      Y_Key          Ctrl_Y_Key     Alt_Y_Key
          z        Z_Key      Z_Key          Ctrl_Z_Key     Alt_Z_Key


          0        0_Key                                    Alt_0_Key
          1        1_Key                                    Alt_1_Key
          2        2_Key                                    Alt_2_Key
          3        3_Key                                    Alt_3_Key
          4        4_Key                                    Alt_4_Key
          5        5_Key                                    Alt_5_Key
          6        6_Key                                    Alt_6_Key
          7        7_Key                                    Alt_7_Key
          8        8_Key                                    Alt_8_Key
          9        9_Key                                    Alt_9_Key









          The JORF Manual (Disk Version)                                174














          Char     Normal     Shift          Ctrl           Alt

          F1       F1_Key     Shift-F1_Key   Ctrl_F1_Key    Alt_F1_Key
          F2       F2_Key     Shift-F2_Key   Ctrl_F2_Key    Alt_F2_Key
          F3       F3_Key     Shift-F3_Key   Ctrl_F3_Key    Alt_F3_Key
          F4       F4_Key     Shift-F4_Key   Ctrl_F4_Key    Alt_F4_Key
          F5       F5_Key     Shift-F5_Key   Ctrl_F5_Key    Alt_F5_Key
          F6       F6_Key     Shift-F6_Key   Ctrl_F6_Key    Alt_F6_Key
          F7       F7_Key     Shift-F7_Key   Ctrl_F7_Key    Alt_F7_Key
          F8       F8_Key     Shift-F8_Key   Ctrl_F8_Key    Alt_F8_Key
          F9       F9_Key     Shift-F9_Key   Ctrl_F9_Key    Alt_F9_Key
          F10      F10_Key    Shift-F10_Key  Ctrl_F10_Key   Alt_F10_Key
          F11      F11_Key    Shift-F11_Key  Ctrl_F11_Key   Alt_F11_Key
          F12      F12_Key    Shift-F12_Key  Ctrl_F12_Key   Alt_F12_Key
          Space    Space_Bar
          !        !_Key
          "        "_Key
          #        #_Key
          $        $_Key
          %        %_Key
          &        &_Key
          '        '_Key
          (        (_Key
          )        )_Key
          *        *_Key
          +        +_Key                                    Alt_+_Key
          ,(comma)            ,_Key
          -(minus)            -_Key                         Alt_-_Key
          .(period)           ._Key
          /        /_Key
          :(colon)            :_Key
          ;(semi-colon)   ;_Key
          <        <_Key
          =        =_Key
          >        >_Key
          ?        ?_Key
          @        @_Key                                    Alt_@_Key
          [        [_Key                     Escape_Key
          \        \_Key                     Ctrl_\_Key
          ]        ]_Key                     Ctrl_]_Key
          ^ (carat)           ^_Key                         Ctrl_^_Key
          _        __Key                     Ctrl___Key
          `        `_Key
          {        {_Key
          | (pipe)            |_Key
          }        }_Key
          ~ (tilde)           ~_Key






          Appendix                                                      175














          Char     Normal     Shift          Ctrl           Alt

          Rubout   BackSpace_Key             Ctrl_BackSpace_Key
          Enter    Enter_Key                 Ctrl_Enter_Key
          Tab      Tab_Key
          Escape   Esc_Key
          Back Tab            Back_Tab_Key
          Up Arrow            Up_Arrow_Key
          Down Arrow          Down_Arrow_Key
          Right Arrow         Right_Arrow_Key
          Ctrl_Right_Arrow_Key               Alt_Right_Arrow_Key

          Left Arrow          Left_Arrow_Key Ctrl_Left_Arrow_Key
                                             Alt_Left_Arrow_Key
          Home     Home_Key                  Ctrl_Home_Key  Alt_Home_Key
          Page Up  Page_Up_Key
                                             Ctrl_Page_Up_Key
                                                            Alt_Page_Up_Key
          Page Down           Page_Down_Key                 Ctrl_Page_Down_
                                                            K      e      y
                   A  l  t  _  P  a  g  e  _  D  o  w  n  _  K  e  y

          End      End_Key                   Ctrl_End_Key   Alt_End_Key

          Delete   Del_Key                                  Alt_Ins_Key
          Insert   Ins_Key                                  Alt_Del_Key



























          The JORF Manual (Disk Version)                                176














                            Appendix D - The JORF.INI File


          The  JORF  interpreter uses  a  Windows  style  INI file  to  set
          initialization values.   For  the DOS version,  the file  name is
          JORF.INI.   The windows version  uses a file  called JORFWIN.INI.
          Compiled JORF applications  have use a file with the same name as
          the program, with the extension "INI".  

          There  are three  major  sections of  the  ini file.   The  first
          section  controls  operating  options and  video  handling.   The
          second  section controls printers, and the final section controls
          screen colors.  

                                  Operating Options
                                  Operating Options

          These options control  how the JORF  interpreter operates.   Only
          the first four  letters of the command are used.  You will notice
          that  most  options only  affect  DOS  systems, and  not  Windows
          systems.

          BIOS=No                  DOS Only  Use Bios Screens
          Mouse=Yes                DOS Only  Use Mouse if available
          Scroll=Yes               DOS Only  If No - doesn't use scroll
          Explode=3                DOS Only  Speed of display
          Mono=No                  DOS Only  Use Mono colors 
          Multiuser=No                       Yes for Network Access
          Mem Stats=No                       Memory Details
          Ram Disk=E:\                       Use Ram Disk


          BIOS=No        DOS Only.      Using BIOS  video  display  is  the
          BIOS=No        DOS Only
                         official way to  handle video functions on  IBM PC
                         computers.   Many of  the BIOS  routines are  very
                         slow, however, so  JORF usually uses direct  video
                         access.  Some computers, notably EGA systems, have
                         enough  differences  that  the  video  display  is
                         really  whacked out.  If this happens, try setting
                         BIOS=Yes    to  see if  the  video  starts working
                         BIOS=Yes
                         properly.

          Mouse=Yes      DOS Only.   The JORF interpreter will  know if you
          Mouse=Yes      DOS Only.
                         have a mouse active.  Some mice may have problems,
                         so this is a way to turn  off the mouse in JORF so
                         you can still have a mouse driver loaded.  

          Scroll=Yes     DOS Only.  I recently had a case where I suspected
          Scroll=Yes     DOS Only.
                         a specific VGA card did not handle the BIOS scroll
                         function  properly.    Although  the use  of  this
                         function speeds scrolling, it is not required so I
                         created  an  option  in case  you  also  suspect a
                         problem with scrolling.  You should note that JORF

          Appendix                                                      177














                         uses the  scroll function  primarily to clear  the
                         inside of windows.

          Explode=3      DOS  Only.  Exploding  windows are a  cute feature
          Explode=3      DOS  Only. 
                         found in the  DOS version of  JORF.  An  exploding
                         speed of 3  seems about right for  the right video
                         affect.   Some people dislike this, and should set
                         this  to be  Explode=0   to  have windows  display
                                      Explode=0
                         without exploding.

          Mono=No        DOS Only.   Monochrome video  override.   Normally
          Mono=No        DOS Only.
                         JORF  knows whether you have a monochrome or color
                         monitor.     Some   people  have   portables  with
                         monochrome monitors that display shades  of gray. 
                         On  these  monitors the appearance of  JORF may be
                         enhanced if you  set Mono=Yes to force  the system
                                              Mono=Yes
                         into monochrome mode.

          Multiuser=No   DOS  and Windows.   This one is  really important.
          Multiuser=No   DOS  and Windows
                         If you want to  have multiple access  to   a file,
                         you  must  set  Multiuser=Yes.       This includes
                                         Multiuser=Yes
                         access on DOS systems when you are using a program
                         switcher  like  Software   Carousel,    and   also
                         multiple access using Microsoft Windows.

                         As  soon as you switch Multiuser=Yes you must also
                                                Multiuser=Yes
                         take   other  action.      First,  you  must  load
                         SHARE.EXE  so  that  JORF  can properly  lock  the
                         files.  You  will get a nice message if you do not
                         have share loaded.

                         You should  also have  a disk  cache program  like
                         SMARTDRV  running, because  JORF does  a lot  more
                         file IO  in multiuser  mode (It  must rewrite  the
                         file header after every file activity)   Even with
                         a cache  program running, JORF is just not as fast
                         in multiuser mode as it is in single user mode. 

          Mem Stats=No   DOS  and Windows.   This  option  turns on  memory
          Mem Stats=No   DOS  and Windows.
                         statistics reporting that  I use to help  me debug
                         the  memory swapping system.   When you  turn this
                         mode on, your program will run very slowly.  Every
                         memory   allocation  and   deallocation  will   be
                         registered, so when the program ends it can report
                         any un-deallocated  buffers.   You will  note that
                         usually the ending  is silent, which means  that I
                         am  successful in  my goal  of deallocating  every
                         single buffer  that I  allocate.   This mode  also
                         makes  flushing more  apparent,  and displays  the
                         currently open file.  



          The JORF Manual (Disk Version)                                178














          Swap Disk=E:\  DOS and Windows.  Since JORF uses a swap file, you
          Swap Disk=E:\  DOS and Windows.
                         can optionally place this file on a RAM disk.  The
                         RAM disk should be more  than 100K in size, and is
                         best at 512K or larger.    There is no control  if
                         the  Ram disk  becomes full  and  the errors  will
                         probably  be really ugly. The largest items in the
                         swap  file   are  screen  backgrounds,   but  also
                         misspelled  text,  the  program  stack, and  other
                         space bits may appear here.  On multiuser systems,
                         you may  also use this  to point to a  local drive
                         for the swap file.


                                    Printer Set Up
                                    Printer Set Up

          When distributed  JORF programs come  with my printers.   You can
          easily  change them to be  your own by  modifying the printer set
          up.    Printer  definitions  are  simple:   The  entire  line  is
          displayed on a  printer selection menu, and the last  word is the
          printer designation.  

          Printer = Screen,    SCREEN
          Printer = File,      FILE
          Printer = HP Laser,  COM1:
          Printer = Panasonic, LPT1:

          The options  for SCREEN and  for FILE invoke special  features in
                           SCREEN          FILE
          the File:Print function to display  the file on screen, or rename
          it to a special file name.  

          To  print to a printer, you the last  word of the command must be
          PRN, AUX, LPT1, LPT2, COM1,  or COM2 to indicate default printer,
          PRN  AUX  LPT1  LPT2  COM1      COM2
          auxiliary, line  printer one and  two and serial printer  one and
          two respectively.  

          Under DOS, the different  printing mechanisms are distinct.   The
          easiest and most robust is to print to  PRN, the default printer.
                                                  PRN
          To test to  see if  your printer  is working, use  the DOS  PRINT
                                                                      PRINT
          command to print a small file.   The next most robust is LPT1 and
                                                                   LPT1
          LPT2.   These use a different BIOS  call than PRN so they may not
          LPT2                                          PRN
          work even when  PRN works just fine.  These  commands send output
                          PRN
          to parallel  printers.   Parallel printers  may be  identified by
          having  a thick cable  and a bigger-than-normal  connector on the
          printer end of the cable.    

          Under Microsoft  Windows, you must  reference a printer  that you
          have set  up under  windows.    JORF automatically  searches your
          windows printers, and will not be able to print to a port without
          a windows printer set to that port.




          Appendix                                                      179














                                    Window Colors
                                    Window Colors

          The final  section of  the JORF.INI file  handles the  colors and
          style of the windows.  This section is more extensive in  the DOS
          version, but also exists in the Windows version.  

          I  do not  believe in  allowing  a high  level tool  let  you set
          graphic colors.   There is  always a tradeoff between  wanting to
          set a lot of  really neat colors, and insuring that  your program
          is  usable on unusable on monochrome  monitors.  I have laid down
          the law  here and  it is  that you  will have  limited access  to
          colors, and I will insure readability on all monitors.  

          The colors I  supply are specifically related to the mathematical
          values  of a  pixel on a  color monitor.      Unfortunately these
          colors, especially background colors, are  pretty ugly.   You see
          what  you can do, and compare to other applications that you like
          to use.


          Colors are tied to a window background structure that has a name.
          The  name is  set in  the  first line.   JORF  uses  some special
          backgrounds  for  specific types  of  windows.   Error  boxes use
          "Error", Message boxes use "Message",  and Menu boxes use "Menu".
          You can also specify custom backgrounds using  a window structure
          in the Win:Add function.   The default background is "Text".

          Window=Text                             Background name "Text"
          +Mono/Color=Mono              DOS Only  Normally "Mono"
          +Line Style=double            DOS Only  Double,Single,None
          +Border Color=For/Back        DOS Only  Border Color
          +Title Color=For/Back         DOS Only  Title Color
          +Shadow Color=For/Back        DOS Only  Shadow Color
          +Message Color=For/Back                 Message Color
          +Normal Color=For/Back        DOS Only  Attribute 1
          +Low Color=For/Back                     Attribute 2
          +Medium Color=For/Back                  Attribute 3
          +High Color=For/Back                    Attribute 4
          +Bold Color=For/Back                    Attribute 5

          Window=Text         DOS  and Windows.   Sets  the  name for  this
          Window=Text         DOS  and Windows
                              window background  structure.    All  options
                              within this structure start  with a plus  (+)
                              sign.

          Mono/Color          DOS Only.     If you  wish, yo  u can set  up
          Mono/Color          DOS Only.
                              separate definitions for monochrome and color
                              monitors even if they have the same name.  
          Line Style=         DOS Only.   Sets  the border line style.  The
          Line Style=         DOS Only.
                              style can  be Single, Double, Thick, or None.
                                            Single  Double  Thick     None
                              Even if  you set None  there will still  be a
                                               None


          The JORF Manual (Disk Version)                                180














                              border,  but  it  will   be  made  of   space
                              characters.

          Border Color=       DOS  Only.   Sets the  color  for the  border
          Border Color=       DOS  Only.
                              lines, but not  the title at  the top of  the
                              window.    The mouse  "Close  block" is  also
                              drawn using the border color.   Under Windows
                              the border color is a system control.

          Title Color=        DOS Only.   Sets  the color  for the  title. 
          Title Color=        DOS Only.
                              Under windows this is a system control. 

          Shadow Color=       DOS Only.   Sets  the color for  text in  the
          Shadow Color=       DOS Only.
                              shadow  of a window.  Under windows there are
                              no shadows.   If you set this  to nothing, no
                              shadows are displayed.

          Message Color=      DOS and  Windows.  Sets the color used by the
          Message Color=      DOS and  Windows
                              Win:Msg function for messages.


          Normal Color=       DOS  and Windows.   Sets  the  color used  by
          Normal Color=       DOS  and Windows
                              normal text in the window.

          Low Color=          DOS  and Windows.   Sets  the  color used  by
          Low Color=          DOS  and Windows
                              Win:Att(2),  and  also   by    inactive  menu
                              option  letters.   Under  windows, pull  down
                              menus use the default system colors.

          Medium Color=       DOS  and Windows.   Sets  the  color used  by
          Medium Color=       DOS  and Windows
                              Win:Att(3),  and also  by  lines within menus
                              and group boxes.

          High Color=         DOS  and Windows.   Sets  the  color used  by
          High Color=         DOS  and Windows
                              Win:Att(4),  and also  by  active menu lines,
                              and inactive input fields. 

          Bold Color=         DOS  and Windows.   Sets  the  color used  by
          Bold Color=         DOS  and Windows
                              Win:Att(5),  and also  by  active menu option
                              letters, and active input fields.  

                                  Foreground Colors 
                                  Foreground Colors 

          Black               Blue           Green          Cyan
          Red                 Magenta        Brown          White (Gray)
          Gray (Darker Gray)  Light Blue     Light Green    Light Cyan
          Light Red           Light Magenta  Yellow         Bright White

                                  Background Colors
                                  Background Colors

          Black               Blue           Green          Cyan
          Red                 Magenta        Brown          White (Gray)

          Appendix                                                      181















                                        Index


          Absolute Value             122          AtDelete              165
          Add                                     AtPut                  71
               Method                116          Browser                21
          Adding Methods              20          In                72, 166
          Addition (+)                28          Read                   72
          Array                       47          Write                  73
          Array Delete                58     Clear Screen                92
          Array Directory             58     Continue                   155
          Array Insert                61     Controls                   177
          Array Length                61     Converting files            80
          Array Pick                  63     Copy
          Array Printers              66          Structures, Text       95
          Array Sort                  67     Cursor Position            119
          Arrays                 17, 104     Data Base Manager            2
          ASCII file conversion       80     Date
          ASCII Value       13, 150, 151          Get                   146
          Assignment (=)              28          Set                   149
          B-Tree                     112     dBASE Conversion            80
          B-Tree Indexes              22     Debugger                18, 19
          Backup File                 78     Decrement (--)              30
          Between (Number)           123     Delete
          Binary Files                87          Character              67
          Bitwise                                 Items                  92
               AND (&)                29          Line                  113
               OR (?)                 29          Method                117
               XOR (^)                30     Delete Array elements       58
          Block Copy                 158     Dialog Box                 117
          Block Read                 158     Directory                   58
          Block Write                158     Display String             137
          Bracket Punctuation         15     Division (/)                31
          Break                      154     DLM format files            80
          Browser List                63     DOS Shell                  103
          Button                      48     Duplicate
          Capitalize String          150          Structures, Text       95
          Casting Object Types        18     Editing Methods             18
          Chaining, Program           96     Encapsulation               10
          Changing Methods            21     End of File                 84
          Character                          ENIAC                       13
               Delete                 67     Equality (=)                32
               Get     30, 33-35, 39, 68     Error
               Insert                 69          Event              73, 77
               Print             84, 100          Message               101
               Put                    69          Numbers               101
          ChBox                       48     Event
          Class                                   Add                    73
               About Classes       9, 10          Delete                 75
               At                70, 163          Do                     76
               AtCut                 164     Exit                        95

          The JORF Manual (Disk Version)                                182














          Exponent                   123          Duplicate              95
          False                       77          Global                115
          File                                    INI File              177
               Access             78, 79          Pointer               101
               Check existence of    78,     JORF Language
                                      79          Library Functions       3
               Conversion             80     JORF Pointer                14
               Delete                 79     JORF.INI File              177
               Length                 79     JorfFile                    14
               Map                    80     Josephine's Recipe Filer     5
               MoveTo                 84     Key
               New Project            97          Bye                   107
               Read                   87          Event              73, 76
               Write                  88          Get                   108
          File Backup                 78          Got                   109
          File Directory              58          Hit                   109
          File Efficiency              2          String Keys            24
          File List                   63     Length of Array             61
          File Load               80, 87     Less or Equal To (<=)       35
          File Ok                     84     Less Than (<)               35
          File Print             84, 100     Letter Case                 15
          Flush Memory           99, 102     Line
          For loop                    88          Class of Word    166, 167
          For/Next Loop               88          Delete                113
          Global Values              115          Input                 114
          Greater or Equal To (>=)    34          Length                144
          Greater Than (>)            34     Line Output                115
          Group Boxes                 49     Line Release               115
          Here                        90     List (of records)           51
          Hopper, Grace                3     Load File               80, 87
          Hypertext Prompt            53     Logarithm                  123
          If/Else                     91     Logical
          Increment (++)              32          AND (&&)               36
          Indexes             2, 22, 112          NEGATION (!)           36
          Inequality (!=)             33          OR (??)                37
          Inheritance                 11     Lower Case                 151
          Initialization             177     Map File                    80
          Initialization File        177     Math
          Input Fields            50, 51          Method Calls           27
          Insert                             Menu Bars                   52
               Character              69     Menu Lines                  52
               Line                  114     Message Window             117
          Insert Array                61     Method                      10
          Installation                 1          Add               20, 116
          InString                   135          Browser                21
          Integer                                 Calls                  27
               Max                   125          Delete                117
          Integer Between            123          Names                  16
          Integers                   151     Modulus (%)                 38
          Interpret                   95     Monitor Problems           177
          Jorf                               Move Cursor                119
               Do (Interpret)         95     Multiple Inheritance        12

          Appendix                                                      183














          Multiplication (*)          39          Find        131, 132, 137
          MYCIN                       23          Next                  131
          Negation (-)                39     Rule Based System            2
          Negative Numbers           122     Say String                 137
          New                        120     Screen Colors              177
          Next record in file        139     Screen problems            177
          Null                       122     SDF format files            80
          Number                             Search                     163
               Exponent              123     Sequential Files            87
               Formatting            152     Sort Array                  67
               Logarithm             123     Spaces                      15
               Max                   125     Speed                        3
          Number Between             123     Stack                  70, 164
          Number Power               125     String                      54
          Numeric Conversions        152          After                 132
          Object-Attribute-Value       2          At                    133
          Object-Attribute-Value                  AtChar                133
                    Triplets          23          AtCut                 134
          Ok                         126          AtDelete              134
          One's Compliment (~)        40          AtPut                 134
          Order of Operations         27          AtSet                 135
          Pack Disk File         99, 101          Instring              135
          Parameter Passing           12          Length                136
          Parameters                  17          Put Line              137
          Parentheses                 16     String Key                  24
          Path (Directory)            58          Add                   110
          Payment Calculation        124          Delete                111
          Pick List               47, 63          Efficiency            112
          Polymorphism                12          Find                  111
          Power (of a number)        125          Next                  112
          Previous record in file    140          Previous         109, 113
          Print File             84, 100     Struct Next                139
          Printer List                66     Struct Prev                140
          Probability Factors         24     Structures               9, 17
          Problems                   177     Subroutines                 10
          Programmin Windows           4     Subtraction (-)             40
          Project                     97     Swap file              18, 177
          Project File            14, 18     Switch/Case/Else      140, 141
          Prompt                  53, 54     System                     103
          Quotes                      16     Text
          Radio Buttons               53          At Line               142
          Ram Disk                   177          Class of Word    166, 167
          Random Numbers        125, 126          First Line            146
          Reading files               80          Justification         159
          Rebuild File           99, 101          Last Line             143
          Release Input              115          Length                144
          Replace                    162          Line Length           136
          Return                     127          Line Number           145
          Rule                        14          Next Line             144
               Add              127, 130          Position              145
               Delete                130          Previous Line         145
               Efficiency            112          Width                 146

          The JORF Manual (Disk Version)                                184














          Text Entry                  55
          Text File Load          80, 87
          Time
               Get                   146
               Set                   149
               Ticks                 150
          To
               ASCII                 150
               Capitals         150, 151
               Character             151
               Integer               151
               Lower                 151
               Number                152
               String                152
               Upper                 153
          Trace
               Events                 77
               Mode                   77
          Translating to C            21
          True                       154
          Type Casting                18
          Underscore Character        16
          Upper Case                 153
          Variable Names              16
          Video problems             177
          While/Break/Continue  154, 155
          Window
               Add                   155
               Attribute             157
               Block                 158
               Colors                177
               FLRCO                 159
               Message               160
               Move By               120
               Move To               119
               Pause                 160
               Put Line              137
               Put String            137
               Replace               162
               Search                163
               Structure             161
          Window, Message            117
          Windows Features             4
          Word
               AtCut                 164
               AtDelete              165
               AtPut                 165
          Write
               Item                  104
          Writing files               80
          Writing Programs            18


          Appendix                                                      185







