home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR22 / JORF21_1.ZIP / JORFMAN.TXT < prev   
Text File  |  1993-07-05  |  647KB  |  22,384 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.                                   The JORF(R) Manual
  14.  
  15.  
  16.           As a member of the Association of Shareware Professionals we are
  17.           required to provide a full manual on disk in the shareware
  18.           version.  Please feel free to print this manual on your dot
  19.           matrix or laser printer.  It is about 350 pages long.  
  20.  
  21.           Since the JORF Company has spend considerable time, money and
  22.           effort creating this product, we will be proud to send you a real
  23.           manual, with graphic screen displays, printed and bound, when you
  24.           paty our very reasonable registration fee.  
  25.  
  26.                Free Shareware Version         Free     On Disk
  27.                Registered DOS Only Version     $45     Printed
  28.                Registered DOS/Windows Version  $85     Printed
  29.                JORF Developer's Kit           $170     Printed
  30.  
  31.           Thank you all advance for your support in the development of JORF
  32.           and the success of The JORF Company.
  33.  
  34.                                     Wayland Bruns
  35.                                    The JORF Company
  36.                                   25858 Elwood Road
  37.                                   Colton, OR  97017
  38.  
  39.                                     (503) 824-5673
  40.  
  41.  
  42.                         Copyright(c) 1993 by The JORF Company.
  43.                                  All Rights Reserved.
  44.  
  45.  
  46.           PRINTERS NOTICE:  All legitmate copyies of The JORF Manual are
  47.           printed by the JORF Company and will not carry this notice. 
  48.           Photocopying this manual is a violation of the copyright act.
  49.  
  50.  
  51.           JORF(R) is a Registered Trademark of The JORF Company.  Other
  52.           JORF Company products are trademarks of The JORF Company.  Other
  53.           brand and product names are trademarks of their respective
  54.           holders.
  55.  
  56.                          Please print this on recycled paper
  57.  
  58.  
  59.  
  60.  
  61.  
  62.                               The JORF License Agreement
  63.  
  64.           COPYRIGHT.  The JORF Interpreter and JORF Developer's Kit are
  65.           owned by The JORF Company and are protected by United States
  66.           copyright laws and treaty provisions.  By using this software you
  67.           are agreeing to be bound by the terms of this license.  If you do
  68.           not agree with this license, you may return all materials to The
  69.           JORF Company for a full refund.
  70.  
  71.           GRANT OF LICENSE.  The JORF Company grants you the right to use
  72.           one copy of the software for each paid registration.  You may
  73.           install the software on more than one computer, but you may use
  74.           only one copy at a time.  You must register each copy of the
  75.           software that you use at any one time to create new programs.  
  76.  
  77.           TRIAL COPIES.  The JORF Interpreter and JORF Language Tutorial
  78.           may be copied and distributed on a trial basis.  If you use the
  79.           software to create programs then trial is over and you must
  80.           register your copy with The JORF Company.  You may freely give
  81.           copies to your friends so they can try it.  If they use it to
  82.           create new programs they must register it.  
  83.  
  84.           RUNTIME MODULE.  The JORF Company grants you the royalty free
  85.           right to distribute the runtime module JORF.EXE with your
  86.           programs provided that; (a) your program does not directly
  87.           compete with JORF Company products; (b) your program displays a
  88.           copyright message that includes the word "Copyright", a "(C)",
  89.           the year, your name and the phrase "All Rights Reserved"; and (c)
  90.           you agree to indemnify, hold harmless, and defend The JORF
  91.           Company from and against any claims or lawsuits, including
  92.           attorney's fees, that arise or result from the use or
  93.           distribution of your program.
  94.  
  95.           OTHER RESTRICTIONS.  Persons or corporations involved with the
  96.           production of biological, chemical or nuclear weapons may not use
  97.           JORF Company Products.  JORF Company Products may not be used in
  98.           any type of weapons system.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.                                    LIMITED WARRANTY
  106.  
  107.           LIMITED WARRANTY.  The JORF Company warrants that the software
  108.           will perform substantially in accordance with the accompanying
  109.           written materials for a period of 90 days from the date of
  110.           receipt.  Any implied warranties on the software are limited to
  111.           90 days.  Some states do not allow limitations on duration of an
  112.           implied warranty, so the above limitation may not apply to you.
  113.  
  114.           CUSTOMER REMEDIES.  The JORF Company's entire liability and your
  115.           exclusive remedy shall be, at The JORF Company's option, either
  116.           (a) return of the price paid or (b) repair or replacement of the
  117.           software that does not meet The JORF Company's Limited Warranty
  118.           and which is returned to The JORF Company with a copy of your
  119.           receipt.  This Limited Warranty is void if failure of the
  120.           software has resulted from accident, abuse, or misapplication. 
  121.           Any replacement software will be warranted for the remainder of
  122.           the original warranty period or 30 days, whichever is longer.
  123.  
  124.           NO OTHER WARRANTIES.  THE JORF COMPANY DISCLAIMS ALL OTHER
  125.           WARRANTIES, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  126.           LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  127.           A PARTICULAR PURPOSE, WITH RESPECT TO THE JORF SOFTWARE AND THE
  128.           ACCOMPANYING WRITTEN MATERIALS.  THIS LIMITED WARRANTY GIVES YOU
  129.           SPECIFIC LEGAL RIGHTS; YOU MAY HAVE OTHERS WHICH VARY FROM STATE
  130.           TO STATE.
  131.  
  132.           NO LIABILITY FOR CONSEQUENTIAL DAMAGES.  IN NO EVENT SHALL THE
  133.           JORF COMPANY OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES
  134.           WHATSOEVER (INCLUDING, WITHOUT LIMITATION, SPECIAL, INDIRECT
  135.           INCIDENTAL OR CONSEQUENTIAL DAMAGES, DAMAGES FOR LOSS OF BUSINESS
  136.           PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
  137.           OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO
  138.           USE THIS PRODUCT, EVEN IF THE JORF COMPANY HAS BEEN ADVISED OF
  139.           THE POSSIBILITY OF SUCH DAMAGES.  BECAUSE SOME STATES DO NOT
  140.           ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL
  141.           OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
  142.  
  143.  
  144.  
  145.  
  146.  
  147.                                      Installation
  148.  
  149.           The JORF Company ships three interpreters and a developer's kit. 
  150.           The JORF interpreter is the smallest and fastest version of the
  151.           interpreter.  The JORF386 and JORFWIN interpreters act as a pair
  152.           to provide complete interpreter and debugger facilities in two
  153.           operating system platforms.  Finally, the JORF Developer's Kit
  154.           includes link libraries and batch files that enable you to
  155.           compile your JORF application programs.
  156.  
  157.                                      Requirements
  158.  
  159.           The JORF and JORF386 versions of the interpreter run on IBM PC
  160.           XT, AT 386 and 486 computers.  JORF can be run on a floppy disk
  161.           system but that is really painful; a hard disk is highly
  162.           recommended.  JORF386 requires a 386 computer.   
  163.  
  164.           The JORFWIN version of the interpreter runs under Windows 3.1 and
  165.           above.  It requires a 386 style computers using Windows in 386
  166.           Enhanced mode.  
  167.  
  168.                              Using JORF on a Floppy Drive
  169.  
  170.           You can use JORF on a dual floppy disk system.  To do this, put
  171.           the JORF.EXE program on one floppy disk, and the sample files on
  172.           another.  You will not be able to use ON-Line help.  You may need
  173.           to keep large programs like the TUTORIAL on separate disks.
  174.  
  175.           When starting JORF, please be sure you have 100K free on your
  176.           floppy disk.  That space will be used by the memory-swap file. 
  177.           Your programs can be run from the B drive.  If you need further
  178.           instructions, write or FAX the JORF Company.
  179.  
  180.                                 Hard Disk Installation
  181.  
  182.           The DOS and Windows distribution has two 5 ¼ disks or one 3 ½"
  183.           disk. To install, create an appropriate subdirectory, copy and
  184.           unpack the files that are appropriate.
  185.  
  186.                Create a JORF subdirectory:             MD \JORF
  187.                Copy files to that subdirectory:        COPY A:*.* 
  188.                Unpack standard 386 interpreter:        PKUNZIP JORF386
  189.                and/or Windows interpreter:             PKUNZIP JORFWIN
  190.                Always unpack sample files:             PKUNZIP JORFFILS
  191.                Optional help files:                    PKUNZIP JORFHELP
  192.                Optional Manual-on-disk:                PKUNZIP JORFDOCS
  193.                Save space by deleting the Zip files:   DEL *.ZIP
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.           Installation                                                    i
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.                                Installation Batch File
  208.  
  209.           If you can place the installation disk in floppy drive A:, and
  210.           you have a hard disk drive C with about 2 Megabyte free, you can
  211.           use INSTALL.BAT.  This file creates a directory called C:\JORF
  212.           and places the appropriate files in that directory.
  213.  
  214.                a.   Place the floppy disk in drive A: 
  215.                b.   Type A: to log to drive A.
  216.                c.   Type INSTALL to start the installation.
  217.                d.   Select version to install from the menu.
  218.                e.   If installing from low density disks, insert Disk 2
  219.                when prompted.
  220.  
  221.                              To Run The JORF Interpreter
  222.  
  223.           You can run the DOS version of interpreter by logging to the
  224.           appropriate directory and typing JORF.  To run the 386 version,
  225.           type JORF386.
  226.  
  227.           To run the Windows version of the interpreter, you must add the
  228.           JORFWIN application in the Program Manager.  From the File menu,
  229.           select New Application.  Type JORF for the name, and
  230.           C:\JORF\JORFWIN.EXE (using the appropriate disk and directory)
  231.           for the file to run.  Click Done to finish adding the
  232.           application. 
  233.  
  234.           The first time you run JORF, you should select TUTORIAL.J to load
  235.           and run the JORF Tutorial.
  236.  
  237.                           To Exit from The JORF Interpreter
  238.  
  239.           Pressing Alt-X will exit from any JORF program.  You can exit
  240.           from the current screen by pressing the Esc key. 
  241.  
  242.                              The JORF Initialization file
  243.  
  244.           If you have any problems with screen colors or display in the DOS
  245.           version, you should turn to Appendix D for information about
  246.           adjusting your  JORF.INI file. 
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.           The JORF Manual (Shareware Disk Version)                       ii
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.                               Version 2.1 Release Notes
  267.  
  268.           Version 2.1 was released in March, 1993.  The following notes are
  269.           for people who have used earlier versions so that they know what
  270.           areas have been improved and changed.
  271.  
  272.                 Perils and Pitfalls (Changes that affect working code)
  273.  
  274.           A new keyword Poly must now be used for polymorphic method calls. 
  275.           In prior versions, polymorphic calls were indicated by having no
  276.           class in front of the method name.  For instance, a polymorphic
  277.           call to a print a variable used to be Print(A), but now must be
  278.           changed to Poly:Print(A).  This change was made to increase
  279.           program speed and make polymorphic calls less ambiguous.
  280.  
  281.           The File:Read() and File:Write() functions no longer use the
  282.           Level argument.  All references to these functions in your code
  283.           should be modified to reflect this change.  If you have used
  284.           these functions you probably agree that this argument was
  285.           redundant.  File:Map() now acts more like and "Open" function,
  286.           and a new File:Close() function has been added.  File:Access()
  287.           has been renamed File:Exist().  These changes were introduced to
  288.           make it easier to read and write various types of data files.
  289.  
  290.           The Time:Get() and Time:Set() functions are totally different. 
  291.           Two internal types have been added for time and date. 
  292.           Conversions have been made even more flexible to make it easier
  293.           for stored date fields to be displayed according to the desired
  294.           format of the user.  Time and Date addition and subtraction
  295.           routines have been introduced.
  296.  
  297.           The action of the Tab key has been modified slightly.  When you
  298.           are editing text in a data entry window, you must now use Alt-Tab
  299.           to move the cursor eight spaces.  The Tab key now carries you to
  300.           the next field.  In prior versions, there was no way to Tab out
  301.           of text fields on a data entry screen.
  302.  
  303.                                      New Features
  304.  
  305.           The interpreter runs as much as 10 times faster for some
  306.           processes.  A lot of work has gone into decreasing disk access so
  307.           people can run the JORF interpreter from a floppy disk.  The
  308.           JORF386 interpreter uses 32-bit processing and VROOM to increase
  309.           speed and use high memory.  The JORF386 version must be run from
  310.           a hard disk on a 386 or 486 computer. 
  311.  
  312.           Clipper style DBF/DBT/NTX file support has been added.  Although
  313.           it would seem intuitive to support dBASE IV format, the vote from
  314.           the programmer community indicated that there are far more
  315.           Clipper applications than dBASE IV applications.  The support of
  316.           Clipper files enables programmers to duplicate and add to
  317.  
  318.           Installation                                                  iii
  319.  
  320.  
  321.  
  322.  
  323.  
  324.           existing Clipper applications without making their existing
  325.           programs obsolete.  People who use FoxBase and dBASE files can
  326.           still use JORF, but will have to avoid the Floating Point formats
  327.           and will not be able to use compatible indexes.
  328.  
  329.           The Win:Attr() function now allows you to set any of 16
  330.           background and foreground colors.  The "Blink" attribute has been
  331.           turned off under DOS, yielding 8 more background colors,
  332.           including dark gray and yellow. 
  333.  
  334.           The internal format of the JORF Pointer has been augmented.  New
  335.           types include a date type and a time type.  Partially implemented
  336.           is a BLOB (Binary Large Object) type that will enable developers
  337.           to store large strings and other binary data.  Under the new
  338.           system there is still room for eight more internal data types for
  339.           future expansion.
  340.  
  341.           The Program Editor now features colored syntax highlighting, with
  342.           different colors for functions, constants, numbers, punctuation
  343.           and comments.  This highlighting makes it easier to read the
  344.           code, and gives an instant "syntax check" to be sure you spelled
  345.           everything correctly.
  346.  
  347.           A "Type" and "Format" commands have been added to field input to
  348.           allow data to be type checked and reformatted automatically when
  349.           entered.  This capability allows numbers to be entered in numeric
  350.           format, and automatically redisplayed with commas and decimal
  351.           positioning.
  352.  
  353.           The JORF to C language translator is now a separate program
  354.           JTOC.EXE.  Much work has been done to decrease the size of
  355.           translated modules.  The libraries have been optimized with
  356.           smaller module sizes to increase speed under VROOM.  
  357.  
  358.           The internal storage format of a structure has been modified to
  359.           be more compact.  The format change is automatic when a structure
  360.           is written.  You can reformat a file by rebuilding it. 
  361.           Reformatting the Contact Manager JCM files yields new files that
  362.           are 25% the size of the old files.
  363.  
  364.           New sample programs include a Calendar date picker, a calculator,
  365.           and a screen color setting program.  The Contact manager has
  366.           split into two versions, MAILLIST.J is a simple version, and
  367.           CONTACT.J is more complex.   Some file handling programs have
  368.           been added.  On-Line help has been expanded.
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.           The JORF Manual (Shareware Disk Version)                       iv
  378.  
  379.  
  380.  
  381.  
  382.  
  383.                                   Table of Contents
  384.  
  385.                     Installation
  386.  
  387.                     Chapter One
  388.                          Welcome to JORF                        1
  389.  
  390.                     Chapter Two
  391.                          Getting Started                       15
  392.  
  393.                     Chapter Three
  394.                          JORF Math                             31
  395.  
  396.                     Chapter Four
  397.                          The Window Manager                    51
  398.  
  399.                     Chapter Five
  400.                          JORF Functions                        85
  401.  
  402.  
  403.  
  404.                     Appendix
  405.                                                               330
  406.  
  407.                     Index
  408.                                                               367
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.           Installation                                                    v
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.                                      Chapter One
  450.                                    Welcome to JORF
  451.  
  452.  
  453.  
  454.  
  455.  
  456.                                        Welcome
  457.  
  458.           JORF is an acronym for Josephine's Recipe Filer.  Josephine is a
  459.           tan pygmy goat who lives at the foot of the Cascade Mountains in
  460.           Oregon.  She does not file recipes but instead she dances and
  461.           plays in the sunshine.  Her message is simple; Lighten up, Eat,
  462.           Dance, Baaaah.  
  463.  
  464.           People laugh at Recipe Filers.  What a stupid use for computers
  465.           they say.  If think a moment, you will realize the joke is on
  466.           those that laugh.  Recipes are trivial "programs" that regular
  467.           people can understand and use.  The problem is that they have
  468.           unlimited ingredients and unlimited text, which makes it
  469.           difficult to file them with a relational data base manager. 
  470.           Recipes are not numeric enough to file with a Spreadsheet.  And
  471.           Recipes need to be indexed so you can not file them using a Word
  472.           Processor.  Instead of being trivial recipes are a good example
  473.           of everyday data that is too complex for most currently available
  474.           computer tools.
  475.  
  476.           JORF was written by me, Wayland Bruns, and The JORF Company is
  477.           another name for me and Josephine. We are open only part time,
  478.           Monday through Wednesday from 9-5 Pacific Time.  The phone number
  479.           is (503) 824-5673.
  480.  
  481.           You don't have a serial number, because I keep all registrations
  482.           by name.  Feel free to call or write at any time, and I will be
  483.           happy to talk to you if I have time.  Not that I have much time
  484.           any more, please write if you can. 
  485.  
  486.  
  487.                                      Introduction
  488.  
  489.           The JORF Language is a application building language for people
  490.           want to create DOS and Windows programs.  It is an Object
  491.           Oriented Programming language, featuring one data type, multiple
  492.           inheritance, classes, structures and polymorphism.  JORF brings
  493.           the power of OOP into the hands of people who will never have the
  494.  
  495.           Installation                                                    1
  496.  
  497.  
  498.  
  499.  
  500.  
  501.           time to learn complex OOP languages like C++ and Smalltalk.  JORF
  502.           gives you a way to program for Windows, without having to
  503.           understand the quirks of this complicated computing environment.
  504.  
  505.  
  506.                                      Basic Rules
  507.                    Indentation controls program flow.
  508.                    Labels are not sensitive to letter case.
  509.                    The end of line is the end of the line.
  510.                    Comments begin with a pipe symbol.
  511.                    Parentheses surround parameter lists. 
  512.  
  513.                                       Key Words
  514.                  Jorf The default data type.
  515.                  Class     Declares a structure (record).
  516.                  Parent    Designates a parent class.
  517.                  Index     Designates an index field.
  518.  
  519.  
  520.  
  521.           The JORF Language is not a scripting language.  It is a formal 
  522.           structured language that supports pointers, arrays, local data
  523.           and recursion.  It is the only Windows language (that I have
  524.           seen) that does not require a complex WinProc message handling
  525.           routine.
  526.  
  527.           The JORF Language uses a single data type, called a Jorf Pointer,
  528.           that can hold integers, floating point numbers, strings, and
  529.           blocks of text.  Object Oriented Classes are defined by the
  530.           programmer, and may include Structures, objects with more than
  531.           one element.
  532.  
  533.                                  Windows Programming
  534.  
  535.           The Windows culture is the culture of the WinProc; programs
  536.           dominated by massive unstructured switch statements that handle
  537.           esoteric message flags. As different products convert to Windows,
  538.           they unquestioningly adopt the WinProc culture.  BASIC, the
  539.           language for the beginner, becomes Visual Basic, a language for
  540.           precious few.  C programs become full of global values.  
  541.  
  542.           MS-Windows is so complicated that not even full time programmers
  543.           can learn every command and every subsystem.  This leaves no time
  544.           for Windows programmers to learn about their customers.  They are
  545.           doomed to write programs that cannot meet the particular needs of
  546.           these customer.  The legacy of Windows threatens to be like the
  547.           legacy of UNIX; expensive techies, weak programs.
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.           The JORF Manual (Shareware Disk Version)                        2
  555.  
  556.  
  557.  
  558.  
  559.  
  560.                              JORF Programming in Windows
  561.  
  562.           You won't see a WinProc in a JORF language program.  You won't
  563.           see anything more complicated than a procedural Win:Add function,
  564.           that creates a window with menus, buttons and data entry prompts. 
  565.           The JORF Window functions run identically under both MS-Windows
  566.           and DOS Text mode. 
  567.  
  568.           The Windows implementation of JORF is a subset of the
  569.           opportunities available under Microsoft Windows.   The JORF
  570.           Language supports the Windows "Look" while supporting just a
  571.           small subset of Windows functions.  Complexity is eliminated by
  572.           eliminating complex functions, and limiting the look of the
  573.           functions available.  
  574.  
  575.           The following program HELLO.J runs identically in both DOS and
  576.           Windows:
  577.  
  578.                Hello:Start
  579.                  Msg:Add ("Hello", "Ok")
  580.                    Welcome to the wonderful world of JORF!
  581.                  Return
  582.  
  583.           The program looks like this:
  584.  
  585.                     Under DOS                Under Windows
  586.  
  587.                                      The same JORF
  588.                                      programs runs
  589.                                      identically
  590.                                      under DOS, with
  591.                                      the same
  592.                                      buttons, menus,
  593.           mouse capability, and data structure.  This means that people who
  594.           have slower and smaller computers can still run your programs. 
  595.           Programs run considerably faster under DOS, but are not as pretty
  596.           and multiple programs cannot be run at one time.
  597.  
  598.                                 Program Logic and Flow
  599.  
  600.           There are six key words in The JORF Language; Class, Index,
  601.           Parent, Jorf (the default data type), And and Or.  These are
  602.           supplemented with Standard Library Functions written in the C
  603.           language and compiled into The JORF Interpreter.  This is how If,
  604.           While, Win:Add, and Move:To are implemented.  
  605.  
  606.  
  607.                                   Starting a Program
  608.  
  609.           Programs always start with the Start method.  This method may
  610.           belong to a class with the same name as the source file name, or
  611.           may be Jorf:Start.   
  612.  
  613.           Chapter One - Welcome to JORF                                   3
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.                                         Labels
  621.  
  622.           Class, Method, and Variable names are not case sensitive.  Names
  623.           can use letters, numbers or the underscore character.  Names
  624.           cannot start with a number.  The following table demonstrates
  625.           some legal and illegal names:
  626.  
  627.                Legal Labels        Illegal Labels Reason
  628.  
  629.                MyProgram      My Program     Embedded space not allowed
  630.                Num1           1Num           Cannot begin with a number
  631.                Num_2          Num-2          Punctuation illegal except for 
  632.            
  633.                A_1            A$1            underscore character
  634.                _Foo                          CAN begin with underscore
  635.  
  636.  
  637.                                     (Parentheses)
  638.  
  639.           Parentheses put items together to avoid any confusion about what
  640.           order to do math and other things.  
  641.  
  642.                2 + 3 * 4           | Equals 14
  643.                (2+3) * 4           | Equals  24
  644.  
  645.           Parentheses are also used to enclose the parameter list for a
  646.           method.  If there are no parentheses, the function is assumed to
  647.           have no parameters. 
  648.  
  649.                Win:Add("MyWindow") | Function with parameter
  650.                Win:Add()           | Function without parameter
  651.                Win:Add             | Same thing - empty
  652.                                    | parentheses are optional
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.           The JORF Manual (Shareware Disk Version)                        4
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.                                      Indentation
  680.  
  681.           Indentation controls program flow.  You must use proper
  682.           indentation for your program to work correctly.  That means you
  683.           won't have to type in curly brackets or ENDDO statements at the
  684.           end of your branching and looping structures.
  685.  
  686.           This example shows a For loop and nested If structure.  No "Next"
  687.           is necessary because the loop is closed by the unindented command
  688.           after the loop.
  689.  
  690.                Binary:Start
  691.                  New Char
  692.                  Win:Add ("BINARY VALUES", 4, 4, 19, 60, Here)
  693.  
  694.                  For (Char = 0 Thru 255)
  695.                    If (Char > 0 and (Char % 16 == 0))
  696.                      Win:Pause
  697.                      If Kbd:Got == "Esc_Key"
  698.                        Break
  699.                    Str:Put("     Character= {To:Str(Char,'000')} Symbol= ")
  700.                    Char:Put(Char)
  701.                    Str:PutLine("     Binary= {To:Str(Char,'0000 0000',2)}")
  702.  
  703.                  If Kbd:Got != "Esc_Key"
  704.                    Win:Pause
  705.                  Return (Ok)
  706.  
  707.  
  708.  
  709.           Here is an example of the program
  710.           output from BINARY.J.  This
  711.           counts up from zero to 255
  712.           displaying each character and
  713.           it's equivalent binary
  714.           expression.  Another related
  715.           example is ASCII.J which displays
  716.           a table of ASCII codes.
  717.  
  718.           Windows programmers will note
  719.           that JORF displays the IBM
  720.           character set, not the ANSI
  721.           character set that Microsoft
  722.           wants us all to switch to. 
  723.  
  724.                                       Parameters
  725.  
  726.           Parameters are normally passed by value, so that subroutines can
  727.           freely modify the value without affecting the same in the calling
  728.           routine.  Parameters may also be passed by reference so that the
  729.  
  730.  
  731.           Chapter One - Welcome to JORF                                   5
  732.  
  733.  
  734.  
  735.  
  736.  
  737.           subroutine explicitly modifies the value.  Use this when you need
  738.           more than one return value from a called method.
  739.  
  740.           Unlike the C or Clipper languages, JORF Programs mark variables
  741.           passed by reference in the parameter list of the subroutine. 
  742.           Once a parameter is declared by reference (using an asterisk) no
  743.           further notation is necessary for the data to be modified in the
  744.           calling method. 
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.                ByRef:Start
  752.                  | This test program shows the result of method that
  753.                  | uses a parameter (Foo) that is passed by reference.
  754.                  | Usually, parameters are passed by value, so that any
  755.                  | changes to the variable do not affect the calling
  756.                  | method.  Sometimes you want to affect the variable
  757.                  | in the calling method, which is why you want to
  758.                  | specify a parameter passed by reference.
  759.                  New (Foo,Fee)
  760.                  Foo = 7
  761.                  Fee = 7
  762.                  Win:Add("Example of Passing by Reference",0,0,9,56,Here)
  763.                  Str:PutLIne('In this example, the called method specifies that Foo be')
  764.                  Str:PutLIne('be passed by reference, and Fee be passed normally.')
  765.                  Str:PutLIne()
  766.                  Str:PutLine("   At start            Foo is     {Foo}, Fee is {Fee}")
  767.                  Str:PutLine()
  768.                  ByRef:Increment(Foo, Fee, 8, 8)
  769.                  Str:PutLine("   At end              Foo is now {Foo}, Fee is {Fee}")
  770.                  Win:Pause
  771.                  Return
  772.  
  773.                ByRef:Increment(*Foo,Fee)
  774.                  ++Foo
  775.                  ++Fee
  776.                  Str:PutLine("   In Increment method Foo is now {Foo}, Fee is {Fee}")
  777.                  Str:PutLine()
  778.                  Return (Ok)
  779.  
  780.  
  781.           When you run this program, it looks like this.  You can see that
  782.           Foo and Fee both start out as 7, and they are both incremented to
  783.           8 in the subroutine ByRef:Increment.  The difference comes when
  784.           the subroutine is ended and the program returns to the
  785.           ByRef:Start method.  At this point, Fee is still 7 because it was
  786.           passed by value, and therefore remains unchanged by the
  787.           subroutine.  But Foo has been changed to 8 because it was passed
  788.           by reference.
  789.  
  790.           The JORF Manual (Shareware Disk Version)                        6
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.              Data Base Manager
  798.  
  799.           The JORF Interpreter is
  800.           a transparent data base
  801.           manager.  The structure
  802.           definition acts as a
  803.           record definition, with
  804.           the different elements
  805.           acting as fields.  The
  806.           key word Parent can be
  807.           used to inherit fields and indexes from another class.  The key
  808.           word Index creates an automatic index on a field in a structure.
  809.           Other class names will designate the class of a field, which
  810.           influences the editing and formatting routines that are used.
  811.  
  812.           Class:MyRecord           | Creates new Class called "MyRecord"
  813.                Index:Contact       | Field name "Contact" is an index
  814.                Parent:Addr         | Inherit "Addr" fields and indexes
  815.                Phone:Work          | Field name "Work" is class "Phone"
  816.                Phone:Home          | Field name "Home" is class "Phone"
  817.                Index:PIndex   | Field name "PIndex" is an index.
  818.                Type           | Field name "Type" is Just a field
  819.                Note           | Field name "Note" can even be text
  820.  
  821.  
  822.           It is normal for a single file to contain several classes.  Data
  823.           files also contain the associated indexes for those classes. 
  824.           Each class can have many indexes.  Both data and indexes are
  825.           stored together in a single file, and contain relative pointers
  826.           so the file name and location may be changed.  
  827.  
  828.                Limit                         Real Limit     Practical Limit
  829.  
  830.  
  831.                Records per file              232        500, 5000, 50,000+
  832.                Fields per record             2048           100
  833.                Classes per file              Unlimited      1 - 10
  834.                Indexes per Class             2048           1 - 10
  835.                Parents per Class             2048           1 - 5
  836.                Length of a string field      10K            4048
  837.                Text field length limit       32K Lines      2000 Lines
  838.                Array elements                232             10,000
  839.                Integer size                  long
  840.                Floating point size           double
  841.  
  842.           Structure elements can be Integers, Floating point numbers,
  843.           Strings, Multiple Line Text and Arrays.  Arrays can contain sub-
  844.           arrays or other structures. 
  845.  
  846.           The practical record limit depends on what you are using the
  847.           records for.  If you need lightning fast access, as in list boxes
  848.  
  849.           Chapter One - Welcome to JORF                                   7
  850.  
  851.  
  852.  
  853.  
  854.  
  855.           or quick pick lists, you better keep your files below 500
  856.           records.  There is a discernable slowdown when a file goes over
  857.           about 1500 indexes, or about 500 records in a file that keeps
  858.           three indexes per record.  Seek speed remains under a second for
  859.           larger files, but programs that use large files (over 5000
  860.           records) should avoid long pick list displays since it takes some
  861.           time to read all the records on the list.
  862.  
  863.                                   Memory Management
  864.  
  865.           Why is it my fault when my computer runs out of memory?  It is
  866.           not my memory, why is it my fault?   Why do I have to "Open" a
  867.           file just to read data from it?  What exactly is "Opening"?  Why
  868.           can't I have two records available at the same time? 
  869.  
  870.           The JORF language handles its own memory, and your reward is
  871.           freedom to allocate large structures, arrays and text.  The JORF
  872.           memory can flush variables, methods, windows, internal values,
  873.           and even the program stack to disk whenever memory gets scarce. 
  874.           Data is read from file when you reference it, so there is no need
  875.           to "Read" it, and no difference between a "memory variable" and a
  876.           field in a record.  
  877.  
  878.           Text and Arrays are held in sparse chunks in memory.  Arrays are
  879.           held 16 elements at a time, and Text is held 4096 bytes at a
  880.           time.  Arrays remain fast even as they grow to enormous sizes. 
  881.           Text editing remains reasonably fast for text up to 100K.
  882.  
  883.                                   Object Persistence
  884.  
  885.           The JORF language can handle data storage almost automatically. 
  886.           Most data in JORF is held in Structures, units of data with
  887.           multiple elements.  Structures in JORF are the equivalent of
  888.           records in any data base language, except that in JORF you can
  889.           store more than one structure type in a single data file.
  890.  
  891.           Structures are created as memory variables, and are stored using
  892.           the Jorf:Write function.  Index fields may be declared in the
  893.           structure definition.  When indexes are declared, the interpreter
  894.           automatically handles index maintenance whenever the structure is
  895.           changed.  
  896.  
  897.           The JORF language has some unusual rules for structures in data
  898.           files.  These rules are quite different than those used in
  899.           relational data bases.  All fields in a JORF structure must be
  900.           stored in the same file.  If a structure contains a pointer to
  901.           another structure, both structures must be contained in the same
  902.           file.  If you attempt to point to a structure from another file,
  903.           for instance, an invoice record points to a customer in a
  904.           customer file, a copy is made so the entire customer structure
  905.           will be duplicated in the invoice file.  The only way to store
  906.  
  907.  
  908.           The JORF Manual (Shareware Disk Version)                        8
  909.  
  910.  
  911.  
  912.  
  913.  
  914.           the information in separate files it to create relational "link"
  915.           fields as you do in a relational data base.  
  916.  
  917.           The other rule to remember is simply that all indexes are stored
  918.           in the same file as the structures.  The reason for this is
  919.           simple.  A common problem in application programs happens when a
  920.           user restores one related file without restoring all files
  921.           necessary.  This often results in an Invoice file, for instance,
  922.           referencing customers that don't exist in a restored customer
  923.           file.  By keeping related information together, I hope to help
  924.           people avoid this type of file synchronization problem.
  925.  
  926.                                   Rule Based System
  927.  
  928.           The JORF Language includes indexing based on
  929.           Object-Attribute-Value rule triplets.  This system is used for
  930.           data base indexing and forward and backward chaining rule based
  931.           systems.  The rules also contain probability and a conditional
  932.           pointer for flexibility in expert systems applications.  
  933.  
  934.  
  935.                                  Network Applications
  936.  
  937.           The JORF language was built to create networked applications. 
  938.           (Always strikes me odd and unrealistic when a language like
  939.           db:Fast is introduced as single user only.)  Using JORF in single
  940.           user mode is faster, especially on slow computers, so when you
  941.           first start the system you will be in single user mode.
  942.  
  943.           To switch to multi-user network mode, you need only change your
  944.           JORF.INI or JORFWIN.INI file.  Just change the "MULTIUSER=NO"
  945.           line to "MULTIUSER=YES".  
  946.  
  947.           If you are using JORF on a non-networked drive, you will have to
  948.           load the MS-DOS utility SHARE.  Just put the word SHARE in your
  949.           AUTOEXEC.BAT file.  If you want to get fancy, you can load share
  950.           into high memory using the LOADHIGH command.  Even if you use MS-
  951.           Windows, you must load share.  The JORF interpreter will tell you
  952.           if SHARE is not loaded correctly.
  953.  
  954.           When you switch the MULTIUSER flag, the JORF language
  955.           automatically stops caching and starts file locking for index
  956.           operations.  This will slow the program down unless you have a
  957.           disk cache active (as most networks do).  If you have MS-Windows
  958.           on your system, you are probably using SMARTDRV (from the "If it
  959.           is in the name it isn't true" department of Microsoft).  SMARTDRV
  960.           is adequate to regain the lost speed.  
  961.  
  962.           The other part of Networking is the locking of Structures that
  963.           are being edited.  If Jan is editing a customer structure, you
  964.           must be sure that Bob cannot start editing the same structure at
  965.           the same time.  In a "Windows" type environment, locking is
  966.  
  967.           Chapter One - Welcome to JORF                                   9
  968.  
  969.  
  970.  
  971.  
  972.  
  973.           complicated by the fact that Jan can change a field in a
  974.           structure, and then pop up an entirely different window  and
  975.           start a different operation without leaving the field that she is
  976.           on.  
  977.  
  978.           That means that the programmer must arrange the program so that
  979.           pull down menu and hot key options are only available after the
  980.           structure change is complete and the structure is written to
  981.           disk.  The sample program CONTACT.J shows how to use the
  982.           INPBEFORE and INPAFTER screen commands to check the locking
  983.           before and after every field is changed by the operator.  
  984.  
  985.           In JORF, the record locking functions are Jorf:Lock to lock a
  986.           structure for changing, Jorf:Write to write and unlock the
  987.           structure, and Jorf:Unlock to unlock and re-read a structure when
  988.           an operator decides to abort a change operation.   A proper
  989.           network application will be sure that all change operations are
  990.           made on locked records.  More information on record locking is
  991.           available in the reference areas for these functions. 
  992.  
  993.           The JORF File:Lock function can be used to lock an entire data
  994.           file, and when you are done with changes you can use File:Unlock
  995.           to release the lock.  These functions are best used for text file
  996.           editing and for operations that change every structure in a file. 
  997.           The Jorf:Rebuild function uses a file lock automatically.
  998.  
  999.                                  dBASE/Clipper files
  1000.  
  1001.           Version 2.1 of the JORF language introduces support for dBASE III
  1002.           files and Clipper NTX indexes.  This support is intended to allow
  1003.           Clipper programmers to create utilities and modules for existing
  1004.           Clipper applications.  In theory, with fewer lines, there will be
  1005.           fewer bugs. JORF gives you some access to high level Window
  1006.           Management routines that replace the "By-Hand" data entry
  1007.           checking that dominates many Clipper applications.  The JORF
  1008.           language has true "User Defined Functions" that are currently
  1009.           lacking in FoxPro, and has a reasonable compiled program size (A
  1010.           minimum of 250K, with most applications weighing in at about 500K
  1011.           to 1MB).
  1012.  
  1013.           While the JORF language will never replace the dBASE language as
  1014.           a programming tool, the dBASE file support allows you to
  1015.           experiment with programs while maintaining file compatibility
  1016.           with your existing application.
  1017.  
  1018.                                     Math And Logic
  1019.  
  1020.           Many Object Oriented Languages treat math operators as Method
  1021.           Calls.  This is really cute when you use "+" to concatenate a
  1022.           structures, and "=" to assign them.  However, this is not easy to
  1023.           implement and leads to a host of problems.  Instead, the JORF
  1024.  
  1025.  
  1026.           The JORF Manual (Shareware Disk Version)                       10
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.           Language uses a stack oriented math system like that in BASIC,
  1033.           PASCAL and C language.  
  1034.  
  1035.                                  Order of Operations
  1036.  
  1037.           The operations are handled in the following order:
  1038.  
  1039.                ->             Pointer References
  1040.                []             Array References
  1041.                - ! ~ ++ --    Unary operations
  1042.                * / %          Multiplication
  1043.                + -            Addition
  1044.                < > <= >=      Evaluation
  1045.                = == != <>     Equality
  1046.                && ??          Logical AND and OR
  1047.                =              Assignment
  1048.  
  1049.  
  1050.           Assignment is by value for simple elements and constants, and by
  1051.           reference for structures.  Throughout JORF, structures are
  1052.           handled as pointers.  Structures can be moved as "buffers" using
  1053.           the Jorf:Move function. 
  1054.  
  1055.           The JORF Language sees numbers as numbers, and automatically
  1056.           handles integer and floating point conversions.  Integer
  1057.           division, and integer addition and multiplication of large
  1058.           numbers may yield floating point results.  
  1059.  
  1060.           You can manually convert numbers using the To:Num, To:Str,
  1061.           To:Char and To:ASCII commands.  The Num:Min, Num:Max, Num:Int,
  1062.           Num:Abs, and Num:Pow functions give you extra capabilities with
  1063.           both integer and floating point values.
  1064.  
  1065.                              International Considerations
  1066.  
  1067.           I take this space to remind you, as a programmer, that computers
  1068.           are used the world around.  Although most programs are written in
  1069.           English, and users often become used to english language prompts
  1070.           in a program, the data they enter and use will be in their native
  1071.           formats.  That means that some thought should go into designing
  1072.           Address areas, dates and numeric formats. 
  1073.  
  1074.           To aid in handling date formats, the JORF To:Date and Date:Str
  1075.           functions use a format string that allows you to easily control
  1076.           the format.  The JORF language can store dates in a native data
  1077.           type.  Whenever that date is displayed, however, it can be freely
  1078.           reformatted to suit the desires of the operator.  The formatting
  1079.           system even allows you to change month names and dynastic year
  1080.           origin, so that you can easily accommodate string dates in many
  1081.           languages.
  1082.  
  1083.  
  1084.  
  1085.           Chapter One - Welcome to JORF                                  11
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.           Numeric formats are simpler because Arabic numbers are used for
  1092.           mathematics throughout most of the world.  Some countries,
  1093.           however, use the comma for a decimal point, and the period is an
  1094.           indicator for thousands.  When writing a JORF language program,
  1095.           you will have to write all numbers in the American period-decimal
  1096.           style.  If the user specifies "Decimal=," in the JORF.INI file,
  1097.           however, all numbers displayed and entered will be in the
  1098.           requested comma-decimal style.  
  1099.  
  1100.           This system allows programmers to write in a standard way and
  1101.           still accommodate users who wish to see their numbers notated
  1102.           differently.  See the reference section entries for the Num:Str
  1103.           and To:Num functions, and Appendix D Decimal= section for more
  1104.           information on comma-decimal formatting.
  1105.  
  1106.  
  1107.                                   The Window Manager
  1108.  
  1109.           The biggest feature of the JORF Language is the Window Management
  1110.           system that handles pull down and pop up menus, hypertext
  1111.           prompts, radio buttons, check boxes, and data entry fields.
  1112.  
  1113.           This system is handled entirely within the Win:Add function.  The
  1114.           syntax of the JORF window management system uses one command line
  1115.           for each data entry feature on the screen.  Command lines start
  1116.           with a command word and a quoted prompt string.  Various values
  1117.           can be added on the same line, or on indented lines below the
  1118.           command.  Different commands use different values.   Data entry
  1119.           will be in the order of the command lines. 
  1120.  
  1121.                Event:Add ("EditKey")
  1122.                Win:Add ("Title", Row, Col, Len, Wid, Level)
  1123.                  Command:"Prompt", Option:"value", Option:"value"
  1124.                    Option:"More Values can be Indented"
  1125.                    Option:"For as many lines as necessary"
  1126.                  Command:"Prompt", Option:"value", Option:"value"
  1127.                  Command:"Prompt", Option:"value", Option:"value"
  1128.                  You can also place a text paragraph at the bottom.  The 
  1129.                  system looks for the keyword and colon (:) character and
  1130.                  if they are absent will print the rest of the indented
  1131.                  screen definition as a text paragraph.
  1132.  
  1133.                  You can embed commands within text by enclosing some
  1134.                  commands in {Command:"Curly brackets, Option:"value"}.
  1135.                  This can be used for hypertext prompts and buttons that
  1136.                  are embedded in the text.
  1137.                Return
  1138.  
  1139.           Windows programmers may note that under windows, JORF uses the
  1140.           Windows menu handling system.  However, the JORF interpreter
  1141.           handles data entry fields without using the Windows Dialog box
  1142.           system.  Radio Buttons and Check boxes are a hybrid, where the
  1143.  
  1144.           The JORF Manual (Shareware Disk Version)                       12
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.           buttons are defined as child windows, but the prompts and
  1151.           keystrokes are handled by the JORF interpreter.  
  1152.  
  1153.                            The JORF Programming Environment
  1154.  
  1155.           The JORF interpreter contains a built in program editor and
  1156.           source level debugger.  To start the debugger, press Ctrl-Break
  1157.           at any time.  The debugger has a menu with options to allow you
  1158.           to edit the program, examine the stack, or trace through the
  1159.           code.
  1160.  
  1161.           Both the debugger and the editor are written in the JORF
  1162.           language, and they are a good example of some capabilities in the
  1163.           language.    The debugger allows you to edit live programs,
  1164.           rewind the program pointer, and execute your new code without
  1165.           restarting the program.
  1166.  
  1167.                                Using an Outside Editor
  1168.  
  1169.           You can also use an outside editor to edit JORF programs.  Simply
  1170.           edit the appropriate source file.  The next time you run it the
  1171.           interpreter will automatically reload your changes.
  1172.  
  1173.                                    Translating to C
  1174.  
  1175.           The JORF Company offers a developer's kit that allows you to
  1176.           translate and compile your JORF program code.  With this kit,
  1177.           your code will be translated to C.  You then can use any of the
  1178.           listed compilers below to compile the program to be a true EXE
  1179.           file.  You can also use the kit to link your JORF modules to C
  1180.           program modules to create a combined application program.
  1181.  
  1182.           Cautionary
  1183.           note:     JORF program code does not translate into clean C code
  1184.                     any more than C code translates into clean assembler
  1185.                     code. A JORF variable can be a string, number or
  1186.                     multiple line text, and has an ambiguous data type when
  1187.                     declared.  C language variables are never ambiguous. 
  1188.                     To keep compatibility with the language, a variable in
  1189.                     JORF remains a JORF pointer in C, and is not translated
  1190.                     to the C integer or string data types.  For this
  1191.                     reason, C programs in JORF only get moderate boost
  1192.                     (about 5 times faster) from the compiling process.  
  1193.  
  1194.                     The primary benefit of compiling is that you can
  1195.                     distribute the resulting EXE file without royalty and
  1196.                     without your customer being able to see or modify your
  1197.                     source code.
  1198.  
  1199.           The Developer's kit is ideal if you want to compile small
  1200.           programs (under 100K source code).  It comes equipped with batch
  1201.  
  1202.  
  1203.           Chapter One - Welcome to JORF                                  13
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.           files that make it easy to compile DOS and Windows programs, even
  1210.           if you know nothing about the C language.   
  1211.  
  1212.           If you need to link outside routines in your program you will
  1213.           have to know something about the C language to be successful.  If
  1214.           your program is large (over 100K source code) you will probably
  1215.           have to split it into multiple modules and compile them
  1216.           separately.  This process requires building a Borland Link script
  1217.           and a root module to bring the program together. You will also
  1218.           have to learn about VROOM enough to be sure your modules are
  1219.           loading into Virtual memory under DOS, instead of precious
  1220.           program memory. 
  1221.  
  1222.           The JORF Developer's kit costs $170 and is available only from
  1223.           The JORF Company.  You also need the Borland Turbo C++ (about
  1224.           $105), Turbo C++ for Windows (about $105) or Borland C++ compiler
  1225.           for DOS and Windows (about $395).   Programs compiled using the
  1226.           JORF Developer's kit may be distributed without paying any
  1227.           royalty to the JORF company.
  1228.  
  1229.           Please specify which compiler version you have, Borland has been
  1230.           playing with the object file format.  We normally ship libraries
  1231.           for the current Borland versions. (3.1 as of January 1993).
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.           The JORF Manual (Shareware Disk Version)                       14
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.                                      Chapter Two
  1276.                                    Getting Started
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.                                    Getting Started
  1283.  
  1284.           This chapter introduces the JORF Interpreter, Debugger and Editor
  1285.           that you can use to edit JORF language programs.  If you are an
  1286.           experienced programmer, you will probably just scan through here,
  1287.           and just hack your way through the menus.  If you are new at
  1288.           programming, you might find this chapter covers the debugger a
  1289.           little too quickly.  The JORF Programmer's Workbook goes into a
  1290.           more thorough examination of the Debugger, and shows you how to
  1291.           use each feature in a Step-By-Step fashion.  
  1292.  
  1293.           There are three versions of the JORF Interpreter:
  1294.  
  1295.           JORF      The regular interpreter for DOS PC computers
  1296.  
  1297.                     You can run JORF version by changing to the JORF
  1298.                     directory, and typing JORF:
  1299.  
  1300.                     C>CD \JORF          Change to the JORF directory
  1301.                     C>JORF         Type JORF
  1302.  
  1303.           JORF386   The JORF interpreter for 386 computers that takes
  1304.                     advantage of high memory and 32-bit processing speed.
  1305.  
  1306.                     You can run the JORF386 version by changing to the JORF
  1307.                     directory, and typing JORF:
  1308.  
  1309.                     C>CD \JORF          Change to the JORF directory
  1310.                     C>JORF386      Type JORF386
  1311.  
  1312.           JORFWIN   The Windows interpreter for running under MS-Windows
  1313.                     3.x
  1314.  
  1315.                     From the Program Manager, add the JORFWIN Icon by
  1316.                     selecting File - New.  Select Program Item and press
  1317.                     the OK Button.  Fill out the screen as shown.
  1318.  
  1319.  
  1320.  
  1321.           Chapter One - Welcome to JORF                                  15
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.                     After
  1336.                     pressing OK
  1337.                     again, you
  1338.                     should be able to see the JORFWIN Icon.  After this,
  1339.                     you can run the Windows version simply by clicking the
  1340.                     JORFWIN Icon.
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.                                   Shareware Message
  1362.  
  1363.           I have been experimenting with a Shareware Opening screen.  This
  1364.           screen features a short message about the shareware license for
  1365.           the JORF Interpreter.  This screen is a simple reminder that the
  1366.           interpreter you are running is not registered, and that you must
  1367.           register it if you write new programs using it.  The registered
  1368.           version does not display the message. 
  1369.  
  1370.  
  1371.                                The Editor and Debugger
  1372.  
  1373.           The Editor and Debugger screen is a programming tool to let you
  1374.           add, change and run JORF language programs in the interpreter.  
  1375.  
  1376.           When you first start, the program displays a list of JORF file
  1377.           names for you to run. 
  1378.  
  1379.  
  1380.           The JORF Manual (Shareware Disk Version)                       16
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.           All JORF screens comply to the Common User Access standard which
  1387.           uses the following keystrokes:
  1388.  
  1389.                Tab Key or Down Arrow         Moves to next field or entry area
  1390.                Back-Tab Key or Up Arrow      Moves to previous field or entry area
  1391.                Enter key                     Presses "Default" button
  1392.  
  1393.  
  1394.           Be very careful here not to press the Enter key at the end of a
  1395.           field.  If this standard is not familiar to you, it may seem
  1396.           quite cumbersome.  I personally think the Tab key is too small
  1397.           and far away to be used for such an essential task as ending a
  1398.           data entry prompt.  But this standard is the emerging standard
  1399.           for PC programs, so if you grow accustom to it now, you will soon
  1400.           tire of the Non-standard programs you used before.
  1401.  
  1402.           The program I want you to run first is ASCII.J.  This short
  1403.           program displays a table of ASCII characters on the screen. 
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.           To select ASCII.J, Press the Tab key and arrow through the Files
  1433.           list  so that ASCII.J is highlighted.  Press Enter once to add
  1434.           ASCII.J to the program name field.  Press Enter again to "Run"
  1435.           the program.  
  1436.  
  1437.  
  1438.  
  1439.           Chapter Two - JORF Systems and Structures                      17
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.           When the ASCII.J program runs, it displays this following screen. 
  1448.           There are two buttons, one to exit, and one that displays "Lower"
  1449.           if the upper ASCII characters are showing, and "Upper" if the
  1450.           lower ASCII characters are showing.   Press the Enter key, Alt-U
  1451.           and Alt-L, or use your mouse to see this program run.
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.                     Getting into the debugger a data entry screen
  1486.  
  1487.           To start the debugger, all you need to do is press Ctrl-Break. 
  1488.           The break key is located on the top right corner of your
  1489.           keyboard.  If you have an IBM-PC keyboard, the break key is
  1490.           labeled Scroll-Lock Break.  If you have an IBM-AT keyboard, the
  1491.           key is labeled Pause Break.
  1492.  
  1493.           Programmers may note that Ctrl-C is a valid keystroke in JORF,
  1494.           and is not used as a break key.
  1495.  
  1496.  
  1497.  
  1498.           The JORF Manual (Shareware Disk Version)                       18
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.           When you start the debugger from a data entry screen, the
  1505.           debugger will start by displaying the method that created the
  1506.           screen.  To debug through a button press routine you need to
  1507.           trace into that routine.  The technique of tracing into button is
  1508.           covered in just a couple pages. 
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.           In this example, you can see that the debugger is showing us
  1538.           ASCII:START method.  This is the full program code for the start
  1539.           method of the ASCII.J program.  All this code says to do is to
  1540.           create a windows with a Display routine and two buttons.  There
  1541.           are also two markers around the first button, used to change the
  1542.           button depending on the display.  (If the upper ASCII characters
  1543.           are showing, the button says "Lower" and if the lower ASCII
  1544.           characters are showing, the button says "Upper".
  1545.  
  1546.           The highlighted bar shows the currently executing line.  If you
  1547.           have a color monitor, you will also see that the program text is
  1548.           highlighted in various colors.  Syntax highlighting is useful to
  1549.           help show you syntax and spelling errors.  Functions, methods,
  1550.           numbers, constants and punctuation are highlighted differently.
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.           Chapter Two - JORF Systems and Structures                      19
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.                                 Debugger Menu Options
  1564.  
  1565.           The main debugger screen has menu options for changing the
  1566.           program you are on, editing any method in the program, displaying
  1567.           variables, and tracing through the program.  You can display the
  1568.           pull down menus by holding down the Alt-key and pressing the
  1569.           highlighted letter.  If you have a mouse, you can use your mouse
  1570.           to make the selection.
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.                                   Debugger File Menu
  1590.  
  1591.           Open      Press F4 to open and run a new program.  This brings
  1592.                     you right back to the screen you started with a
  1593.                     selection of available programs to run.  Use your
  1594.                     mouse, tab or arrow keys to select a file name.  Type
  1595.                     in a path name if you wish to change directories.
  1596.            
  1597.  
  1598.                     Run.  Use the Run
  1599.                     button to run the
  1600.                     program. 
  1601.  
  1602.                     Edit.  The edit button
  1603.                     will return you to the
  1604.                     debugger and editor,
  1605.                     without editing the
  1606.                     program.
  1607.  
  1608.                     Re-Read.  Sometimes you
  1609.                     try to run a program,
  1610.                     and nothing happens.  This usually follows an incident
  1611.                     where the program locked up.  The reason this happens
  1612.                     is that the .JRF file that contains the program is
  1613.                     corrupted.  This option erases and re-creates this file
  1614.                     from the source file.  If you have made changes to the
  1615.  
  1616.           The JORF Manual (Shareware Disk Version)                       20
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.                     program, you will lose any changes that were not saved.
  1623.  
  1624.  
  1625.                     Cancel. Pressing the Cancel button or the Escape key
  1626.                     will return you to the main editing screen.
  1627.  
  1628.           Save      When a program is run, the source is read into a .JRF
  1629.                     file.  This file contains the data in a special format
  1630.                     that is much faster to access than the original source
  1631.                     file.  When you make editing changes to the program,
  1632.                     these changes are made only to the .JRF file.  To save
  1633.                     these changes to the source file, you select the Save
  1634.                     option from the menu.
  1635.  
  1636.                     When the debugger saves a file it sets the methods in
  1637.                     the file in a particular order:
  1638.  
  1639.                          1.   Class Definitions alphabetically.
  1640.                          2.   The "Start" Method
  1641.                          3.   All methods alphabetically.
  1642.  
  1643.                     In more complex applications, several source files may
  1644.                     be open.  In this case, when you select Save, the file
  1645.                     that contains the currently displayed method is written
  1646.                     to disk.
  1647.  
  1648.           Save As   This option is the same as Save, but allows you to
  1649.                     specify a new source file name.
  1650.  
  1651.           Go        Press Alt-G at any time to stop editing and run your
  1652.                     program.  Program execution will continue from the
  1653.                     currently executing line.  
  1654.  
  1655.           Print     Use this option to print the program source code.  This
  1656.                     option works by saving all current changes (Same as
  1657.                     Save) and then printing the file from disk.  
  1658.  
  1659.                     Whenever you print from the JORF Interpreter, you will
  1660.                     be given a standard printer menu.  If the printer
  1661.                     options on this menu do not conform to your printer,
  1662.                     you can easily change them.  To change the printer
  1663.                     options, Run the SETUP.J program, or edit the JORF.INI
  1664.                     file according to the directions in Appendix D.  The
  1665.                     JORF.INI file is where the default printer list is
  1666.                     located, and it is really easy to set this up to suit
  1667.                     your system. 
  1668.  
  1669.           Restart   This option restarts your program from the beginning. 
  1670.                     Use it whenever you are changing method names or make
  1671.                     extensive changes in the source code.
  1672.  
  1673.  
  1674.  
  1675.           Chapter Two - JORF Systems and Structures                      21
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.           Re-Read   If your program locks up in the interpreter, you will
  1682.                     probably need this option.  Use it if you try to "Run"
  1683.                     or "Edit" a program and you get a blank screen instead. 
  1684.                     If the program were invalid, you would be told so.  But
  1685.                     if the program file exists in a corrupted state, the
  1686.                     Start method cannot be found, and the Debugger will
  1687.                     show only a blank screen.
  1688.  
  1689.                     This option erases the corrupted .JRF file and re-reads
  1690.                     the source program to re-create it.  Changes made after
  1691.                     your last Save will be lost.  I am constantly working
  1692.                     to a) make JORF so it doesn't lock up and b) make it so
  1693.                     it leaves the file uncorrupted.  However, until I
  1694.                     succeed you will have to use "Re-Read".
  1695.  
  1696.           Exit      Press Alt-X at any time to exit from the Debugger. 
  1697.  
  1698.                     There is a polite "Last Chance" box before you leave. 
  1699.                     If you press OK you will be returned to the DOS prompt
  1700.                     or to the Windows Program manager.
  1701.  
  1702.                                Debugger Edit Dialog Box
  1703.  
  1704.           When you select Edit from the debugger screen, you will see the
  1705.           following dialog box.  This box allows you to select Methods by
  1706.           Class, and enables you to Add, Change and Delete the methods.
  1707.  
  1708.  
  1709.  
  1710.  
  1711.                                  Methods and Classes
  1712.  
  1713.           The JORF language is Object Oriented.  In JORF, all methods
  1714.           (routines) must be prefixed by a class name.  Methods are grouped
  1715.           by class, and on this screen you must select class first, then
  1716.           method.  
  1717.  
  1718.           This system of naming methods does not make much sense with small
  1719.           programs like ASCII.J.  In fact, the whole system was only
  1720.           invented recently, after two decades of computer programming
  1721.           without classes.  In large programs, however, the practice of
  1722.           defining classes and keeping methods tightly bound to those
  1723.           classes has proven to be very efficient.  
  1724.  
  1725.           Generally, you should name a class by the type of data being
  1726.           operated on, and by the general function of the class.  Methods
  1727.           can be any name you want.  A good class has under 30 methods.  A
  1728.           good method has under 30 lines of code.  A good method should do
  1729.           just one task, not three or four.  The size of classes and
  1730.           methods is often specified as "Granularity" and good granularity
  1731.           comes from succinct classes and methods.
  1732.  
  1733.  
  1734.           The JORF Manual (Shareware Disk Version)                       22
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.           Edit      When you have specified a Method name and Class name,
  1767.                     press the Edit button to edit the method.  
  1768.  
  1769.           Cancel    This returns you back from whence you came.  If it did
  1770.                     anything else, the cancel button would not make much
  1771.                     sense, would it?
  1772.  
  1773.           Add       Type in a new method or Class name and press Add to
  1774.                     create that method.  There are two ways of creating a
  1775.                     new method.  One is to use this button to "Add" it, the
  1776.                     other is to use "Copy" to copy an existing method.  
  1777.  
  1778.                     When you add a method, the editor creates the method
  1779.                     beginning and end for you.  
  1780.  
  1781.                          MyMethod:Start
  1782.                               |
  1783.                               Return 
  1784.  
  1785.  
  1786.                     It does this only to avoid "Blank screen syndrome" and
  1787.                     give you a place to start typing.  The comment line in
  1788.                     the center is where you can write a comment about the
  1789.                     purpose of the method, and also type in the lines of
  1790.                     program code that will comprise the method.
  1791.  
  1792.  
  1793.           Chapter Two - JORF Systems and Structures                      23
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.           Delete    To truly get rid of a method, you can select Delete. 
  1800.                     You should be sure to save your program soon after, so
  1801.                     your delete is saved to the source file.
  1802.  
  1803.                     If you use an outside editor:  You will quickly learn
  1804.                     that the JORF interpreter re-reads your program
  1805.                     whenever you make a change.  When re-reading, however,
  1806.                     your changes are merged with the current program
  1807.                     routines in the .JRF file.  That means when you delete
  1808.                     a method in the source file, it will still remain in
  1809.                     the .JRF file.  If you delete a method in the source
  1810.                     file, you should also delete the .JRF file so that the
  1811.                     .JRF file is re-created.
  1812.  
  1813.           Copy      Instead of Adding a blank method, you can copy an
  1814.                     existing method and edit from your copy.  This is
  1815.                     especially useful for keystroke handling methods where
  1816.                     you may want to define several keys to do the same
  1817.                     thing.
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.           The JORF Manual (Shareware Disk Version)                       24
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.                                   Debugger Show Menu
  1860.  
  1861.           The Show menu groups together four options.  One to view the
  1862.           other screen, and three to show you what the interpreter sees in
  1863.           your program.
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.           Other 
  1893.           Screen    Select this option or press Alt-O to see your program
  1894.                     screen.  If you are running in DOS, your program screen
  1895.                     is completely hidden by the debugger screen.  This
  1896.                     option allows you to view your program.  
  1897.  
  1898.                     If you are running in Windows and you have a Super VGA
  1899.                     monitor, you may be able to move your program screen to
  1900.                     one side so you can view it at the same time as the
  1901.                     editor screen.  If not, you can use this option to show
  1902.                     your screen.
  1903.  
  1904.  
  1905.  
  1906.           Show
  1907.           Stack     When you are running a method that is called by a
  1908.                     method this option shows you all the methods that are
  1909.                     being called in order.  
  1910.  
  1911.           Chapter Two - JORF Systems and Structures                      25
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.                     In our little ASCII.J example this is hardly useful,
  1918.                     but in a "real" program you may be nested ten methods
  1919.                     deep, and it is often useful to see exactly which
  1920.                     methods were called to get where you are now.
  1921.  
  1922.           Show 
  1923.           Variables Use this option to see your currently active variables. 
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.                     You will see a short screen that shows:
  1945.  
  1946.                          1) Parameter values for the current method
  1947.                          2) New variables in the current method
  1948.                          3) The Mem:Ptr global variable pointer
  1949.                          4) The Win:Ptr for the current screen
  1950.  
  1951.                     If any value is a Structure, you can highlight it and
  1952.                     press Enter to see the values of that structure.  The
  1953.                     same goes for Mem:Ptr and Win:Ptr.  
  1954.  
  1955.           Add 
  1956.           Watch     Select this option to add a new Watch variable to the
  1957.                     screen as you are tracing.  This option is also
  1958.                     available from the Watches menu (covered in just a
  1959.                     couple pages) and so turn there for more information.
  1960.  
  1961.  
  1962.                                     Debugger Menu
  1963.  
  1964.           The debugger menu gives you the options to trace, rewind, and
  1965.           mark break points in a method.  The JORF debugger, like most
  1966.           Object Oriented debuggers, allows you to change currently
  1967.           executing programs without breaking execution.  When you finish
  1968.           your change, you simply continue the current run of the program. 
  1969.  
  1970.           The JORF Manual (Shareware Disk Version)                       26
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.           Once you get used to the capability of changing a program
  1977.           on-the-fly, you may find that static program debuggers are much
  1978.           less convenient.
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.           Programmers will note two pleasant additions to the usual trace
  1998.           functions.  
  1999.  
  2000.           The Rewind function can move the program pointer back up a
  2001.           routine.  You can use this option to back up over a changed line
  2002.           of code, and then re-execute it to set a variable to a new value. 
  2003.  
  2004.  
  2005.           The Finish function executes the program to the end of the
  2006.           current method, and begins tracing again on the next line.  Use
  2007.           this when you accidentally trace into a method.  By finishing,
  2008.           you will be right back to the spot you would have been if you
  2009.           traced over the method.  
  2010.  
  2011.           Go        Press Alt-G at any time to stop editing and run your
  2012.                     program.  Program execution will continue from the
  2013.                     currently executing line.  
  2014.  
  2015.           Do Line   Does the current line and stop at the next line.  If
  2016.                     this line calls another method, switches to show the
  2017.                     new method and stops on the first executing line of
  2018.                     that method.  
  2019.  
  2020.                     This option differs from Next Line because it traces
  2021.                     into method calls.
  2022.  
  2023.           Next Line Runs the program until the next line.  This option
  2024.                     traces over any method calls in the highlighted line.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.           Chapter Two - JORF Systems and Structures                      27
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.           Rewind    Pressing Alt-R will rewind the program pointer back by
  2036.                     one line.  You can use this to rewind back over a
  2037.                     changed line in the program.  
  2038.  
  2039.                     There is an important
  2040.                     limitation to the rewind
  2041.                     function, you cannot rewind
  2042.                     out of an indented control
  2043.                     function, like If or While.  
  2044.                     As the screen suggests, you
  2045.                     need to move forward until
  2046.                     you are out of the indented
  2047.                     section, then rewind to the
  2048.                     line above the indented
  2049.                     section.
  2050.  
  2051.                     The Rewind function is not
  2052.                     the same as reverse
  2053.                     execution.  Program statements are not "Undone", and
  2054.                     counters and accumulators will not be unset by
  2055.                     rewinding.   The purpose of this command is not to undo
  2056.                     operation, but merely to allow you to fix a bug and re-
  2057.                     execute a section of a method with the fixed code.
  2058.  
  2059.                     Neither Mr. Borland nor Mr. Microsoft can do this
  2060.                     either.  Perhaps they should, since it makes it so easy
  2061.                     to debug code to be able to change it and re-execute
  2062.                     the new code with just a couple keystrokes.
  2063.  
  2064.           Finish 
  2065.           Method    Finishes the current method, and stops at the next
  2066.                     program line.  If you trace into a method using Do
  2067.                     Line, you can use this option to finish the method. 
  2068.                     The program control will stop as if you traced over the
  2069.                     method using Next Line.  Neither Mr. Borland nor Mr.
  2070.                     Microsoft and do this simple but useful function!
  2071.  
  2072.           Trace 
  2073.           Forward   Press Alt-T at any time to begin automatic trace mode. 
  2074.                     You can use this option to watch your program run.  As
  2075.                     it is running you can change the speed at which lines
  2076.                     are executed:
  2077.  
  2078.                               Press F to go faster
  2079.                               Press S to go more slowly
  2080.  
  2081.                     Press any other key to end automatic trace mode.
  2082.  
  2083.                     This mode is useful to get an overview of how a program
  2084.                     runs, and to see which methods are used for a given
  2085.                     function.
  2086.  
  2087.  
  2088.           The JORF Manual (Shareware Disk Version)                       28
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.           Toggle 
  2095.           Break 
  2096.           Point          Use this option to mark a line as a break point. 
  2097.                          When a line is marked as a break point, program
  2098.                          execution will stop just before that line is
  2099.                          executed, as if you pressed Ctrl-Break exactly at
  2100.                          that spot.
  2101.  
  2102.                     In the debugger, you can have up to ten break points. 
  2103.                     Usually, having more than 2 active at once is pretty
  2104.                     confusing.  
  2105.  
  2106.                     This option is a toggle, which means that executing it
  2107.                     once sets the break point on, and a second time sets
  2108.                     the break point off.  
  2109.  
  2110.                                  Debugger Watch Menu
  2111.  
  2112.           The JORF debugger has a special feature called "AutoWatches". 
  2113.           These are special watch variables that are changed and displayed
  2114.           according to the executed program code.  One autowatch will
  2115.           always show the value of the last assigned variable.  The other,
  2116.           shows whether the current conditional statement (If or While) is
  2117.           true.
  2118.  
  2119.           You can also set normal watch variables.  These are values that
  2120.           re-display with each program line so you can examine the status
  2121.           of the program.
  2122.  
  2123.           Add 
  2124.           Watch     Use this to add a watch
  2125.                     variable.  The screen
  2126.                     adjusts to show up to five
  2127.                     watch variables at one time. 
  2128.                     However, since each watch
  2129.                     variable must be
  2130.                     recalculated for every
  2131.                     program line, the more
  2132.                     watches you have, the slower the screen will display.
  2133.  
  2134.           Delete 
  2135.           Watches   This option will delete all program watch variables
  2136.                     except autowatches.  This will make your screen clean
  2137.                     and faster to redisplay.
  2138.  
  2139.           Autowatch
  2140.           On        When autowatch is on, the first watch variable will be
  2141.                     automatically set to be the current conditional value
  2142.                     and the second watch will be the last assigned value.
  2143.  
  2144.  
  2145.  
  2146.  
  2147.           Chapter Two - JORF Systems and Structures                      29
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.                     This Conditional is the result of the current If or
  2154.                     While statement.  In the example above, the if
  2155.                     statement is testing ((Char%8)==7).  (The % function is
  2156.                     read as "Mod", short for modulus, and is used to test
  2157.                     the  remainder of integer division.  In this case, we
  2158.                     are testing to see whether the value of Char divided by
  2159.                     eight leaves a remainder of seven.)
  2160.  
  2161.                     You can see in the screen above that the result is
  2162.                     (Null) so the executing line moved to the Else clause. 
  2163.  
  2164.                     The second watch was set in the For statement to the
  2165.                     variable Char which has a value of 128.  The assignment
  2166.                     watch is set whenever a variable is assigned using the
  2167.                     equals (=) sign.  
  2168.  
  2169.           Autowatch 
  2170.           Off       When I created the Autowatches, I was heartbroken to
  2171.                     find that they are barely usable on an XT style
  2172.                     computer.  This style computer is so slow, that testing
  2173.                     and displaying the Autowatch variables is just painful
  2174.                     to watch.  If you have a slow computer, or feel that
  2175.                     Autowatches are not very useful, you can turn them off. 
  2176.                     Turning off autowatches does not affect your defined
  2177.                     watch variables.
  2178.  
  2179.                                     Debugger Help
  2180.  
  2181.           The Help options on the debugger screen give access to keyboard
  2182.           references and to the context sensitive help system.
  2183.  
  2184.           Editing 
  2185.           Keys      Select this option to get a list of editing keys.  JORF
  2186.                     uses old Wordstar control keys, and also IBM keyboard
  2187.                     arrow and home keys.  
  2188.           Debugger 
  2189.           Keys      Select this option to get a list of debugger Alt
  2190.                     keystrokes.
  2191.  
  2192.           JORF 
  2193.           Help      Select this option, or press F1 to use the JORF context
  2194.                     sensitive help system.   This system uses a file called
  2195.                     HELP.JRF which needs to be on the current directory,
  2196.                     your start up directory, or the \JORF directory of your
  2197.                     current disk drive.  
  2198.  
  2199.                     You can use the context sensitive help by highlighting
  2200.                     program key words.  If the word at the cursor position
  2201.                     is a listed keyword, you will see the help screen
  2202.                     appropriate to that word.  For instance, place the
  2203.                     cursor on Win:Add and press F1 to see the help screen
  2204.                     on the Win:Add function.  
  2205.  
  2206.           The JORF Manual (Shareware Disk Version)                       30
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.                                     Chapter Three
  2220.                                       JORF Math
  2221.  
  2222.  
  2223.  
  2224.  
  2225.                                       JORF Math
  2226.  
  2227.           Many Object Oriented Languages treat math operators as Method
  2228.           Calls.  This is really cute when you use "+" to concatenate a
  2229.           structures, and "=" to assign them.  However, this is not easy to
  2230.           implement and leads to a host of problems.  For instance, to
  2231.           implement "+", you have to create a language syntax between
  2232.           operators.  This is the reason Smalltalk program lines are
  2233.           scrambled, and C++ has an involved "Friend" system. 
  2234.  
  2235.           When this is all done, it is hard to figure out how to handle a
  2236.           "+" between different types of objects.  You can create a method
  2237.           for Dog + Dog, but what about Dog + Penguin?  Is that a Doguin or
  2238.           a Pog?  And you have slowed down all regular math processing just
  2239.           to implement this difficult to use feature.
  2240.  
  2241.           For about two months, JORF used this math technique.  But there
  2242.           were so many kludges to make the syntax work, keep order of
  2243.           operations, and enhance speed that the entire system was not
  2244.           simple and intuitive.  So, I dumped the concept and went to a
  2245.           stack oriented math system like that in BASIC, PASCAL and C
  2246.           language.  
  2247.  
  2248.           The JORF system solves math operations automatically as the
  2249.           programming line is executed.  The line is executed from Right to
  2250.           Left (the opposite of how you read).  As each Method or Function
  2251.           is called, any adjacent Math expressions are completed.
  2252.  
  2253.                Win:Add (To:Caps(Title), LastRow+2, LastColumn+5, 0, 0, Here)
  2254.  
  2255.           JORF first performs Here.  Then it reads the line back to the
  2256.           To:Caps function.  Before performing it, it evaluates the math
  2257.           expressions LastRow+2 and LastColumn+5 even though they are
  2258.           unrelated to To:Caps.  Until JORF calls a function it doesn't
  2259.           know how many parameters that function takes.  To:Caps Title will
  2260.           return the contents of Title capitalized.  Finally, the Win:Add
  2261.           function is called. 
  2262.  
  2263.  
  2264.  
  2265.           Chapter Two - JORF Systems and Structures                      31
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.                                  Order of Operations
  2272.  
  2273.           Mathematic operations are handled in the following order.  This
  2274.           is essentially the same as the C language:
  2275.  
  2276.                     ->                  Pointer References
  2277.                     []                  Array References
  2278.                     - ! ~ ++ --         Unary operations
  2279.                     * / %               Multiplication
  2280.                     + -                 Addition
  2281.                     < > <= >=           Evaluation
  2282.                     == !=               Equality
  2283.                     && ?? And Or        Logical AND and OR
  2284.                     =                   Assignment
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.           The JORF Manual (Shareware Disk Version)                       32
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.                                      Addition (+)
  2332.  
  2333.  
  2334.  
  2335.           Symbol    +
  2336.  
  2337.           Purpose   Add numbers, concatenate strings. 
  2338.  
  2339.           Notes     The plus sign adds numbers if both sides are numbers,
  2340.                     and if one or both operands are strings then they are
  2341.                     concatenated.  
  2342.  
  2343.                     To "Add" text you must use the Text:Add function.  To
  2344.                     "Add" elements of structures, use the strange and
  2345.                     obscure Jorf:Move function.
  2346.  
  2347.           Examples
  2348.                     1 + 5 = 6
  2349.                     2 + 78.8 = 80.8
  2350.                     5 + "A"  = 5A
  2351.                     To:Str(3) + To:Str(3) = "33"
  2352.                     65535 + 1 = 65536
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.           Chapter Three - JORF Math                                      33
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.                                     Assignment (=)
  2391.  
  2392.  
  2393.  
  2394.           Symbol    =
  2395.  
  2396.           Purpose   Assign a value to a variable. 
  2397.  
  2398.           Notes     Assigns the value of the right operand to the left
  2399.                     operand. 
  2400.  
  2401.                      Usually, only the value is assigned and not the class. 
  2402.                     If the destination has no declared class, and the
  2403.                     source does, the destination will take on both the
  2404.                     class and value of the source.  
  2405.  
  2406.                     Assignment may be made to structure elements and
  2407.                     arrays.  You cannot assign "To" a constant value. 
  2408.                     Single data items are assigned by value, but structures
  2409.                     and text are assigned by reference.
  2410.  
  2411.  
  2412.           Examples
  2413.                     A = 6                    | A is now equal to 6
  2414.                     Addr->Addr1 = "2343 N. Main Street"     | Sets the Addr1 element of Addr
  2415.                     Addr[4] = Addr           | Sets the fourth array element
  2416.                     "Three" = 2              | Nonsense!  Three is a constant
  2417.                     Three = 2                | If three is a variable, O.K.
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.           The JORF Manual (Shareware Disk Version)                       34
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.                                     Decrement (--)
  2450.  
  2451.  
  2452.  
  2453.           Symbol    --
  2454.  
  2455.           Purpose   Subtract one from a number. 
  2456.  
  2457.           Notes     It is a common operation in programs to have loop
  2458.                     counters that count up by one, or down by one.  These
  2459.                     are so common in assembler that there are real assembly
  2460.                     instructions to do just these operations.  
  2461.  
  2462.                     I'm afraid the JORF Translate and compile system is not
  2463.                     efficient enough to compile to the assembler decrement
  2464.                     instruction, but it is still a good concept and a
  2465.                     logical part of the language.
  2466.  
  2467.                     The Decrement operator must be IN FRONT of the operand,
  2468.                     and not behind as allowed in the C language.  This
  2469.                     operator simply subtracts one from the operand.
  2470.  
  2471.           Examples
  2472.                     Num = Num - 1            | Normal Decrementing
  2473.                     --Num                    | But -- is shorter, easier.
  2474.  
  2475.                     Decr:Start
  2476.                       New Num
  2477.                       Win:Add ("Showing Decrement", 4,4,12,30, Here)
  2478.                       Num = 10
  2479.                       While (Num > 0)             | Loop until zero
  2480.                         Str:PutLine ("Number = " + Num)     | Put 'Number = 10'
  2481.                         --Num
  2482.                       Str:PutLine ("Done")
  2483.                       Win:Pause
  2484.                       Return
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.           Chapter Three - JORF Math                                      35
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.                                      Division (/)
  2509.  
  2510.  
  2511.  
  2512.           Symbol    /
  2513.  
  2514.           Purpose   Divide two numbers. 
  2515.  
  2516.           Notes     You remember how to do long division don't you?  Well
  2517.                     the computer does, and this is what you need to do it.
  2518.  
  2519.                     The JORF language is unusual in that it does the type
  2520.                     conversions necessary when division yields a fractional
  2521.                     result.  Most languages truncate the result of integer
  2522.                     division.  You should be especially careful when using
  2523.                     division to calculate screen position, because the
  2524.                     fractional result is not the same as the truncated
  2525.                     result:
  2526.  
  2527.                               Move:To (2, (30-Str:Len "Hi Jo")/2)  
  2528.                     becomes   Move:To (2, (30-5)/2)  
  2529.                     becomes   Move:To (2, 25/2)
  2530.                     becomes   Move:To (2, 12.5)
  2531.                     becomes   Move:To (2, 13)
  2532.                     Not       Move:To (2, 12)     as it would in C or
  2533.           Pascal.
  2534.  
  2535.           Examples
  2536.                     12 / 2 = 5
  2537.                     60000 / 100 = 600
  2538.                     12.5 / .5 = 25
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.           The JORF Manual (Shareware Disk Version)                       36
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.                                   Equality (= or ==)
  2568.  
  2569.  
  2570.  
  2571.           Symbol    = or ==
  2572.  
  2573.           Purpose   Check to see if two numbers, strings or structures are
  2574.                     equal.  Checks text only for the current line, not the
  2575.                     whole text. 
  2576.  
  2577.           Notes     Returns TRUE if the left operand is equal to the right
  2578.                     operand.  
  2579.  
  2580.                     When I was a BASIC programmer, I could never discern
  2581.                     the difference between checking for Equality, and
  2582.                     assigning a value.  To me, the both were "Equals".
  2583.  
  2584.                     The C language not only warns of this ambiguity, but
  2585.                     does not work correctly at all if you ignore the
  2586.                     warnings.  It does exactly what you tell it, assigns or
  2587.                     checks, and not what you want it to do.
  2588.  
  2589.                     So JORF treads the line.  For BASIC programmers, the =
  2590.                     sign can be used for both equality checking and also
  2591.                     for assignment.  For C programmers, use == for
  2592.                     equality, and = for assignment.  In all examples, I
  2593.                     will use == because it is more robust.
  2594.  
  2595.           Examples
  2596.                     A = 1                    | Assignment of 1 to A
  2597.                     If (A == 2)              | Check equality, is A equal to 2?
  2598.                       Str:PutLine ("A is 2")
  2599.                     Else
  2600.                       Str:PutLine ("A is Not 2")  | Will print this line
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.           Chapter Three - JORF Math                                      37
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.                                     Increment (++)
  2627.  
  2628.  
  2629.  
  2630.           Symbol    ++
  2631.  
  2632.           Purpose   Add one to a counter. 
  2633.  
  2634.           Notes     It is a common operation in programs to have loop
  2635.                     counters that count up by one, or down by one.  These
  2636.                     are so common in assembler that there are real assembly
  2637.                     instructions to do just these operations.  
  2638.  
  2639.                     I'm afraid the JORF Translate and compile system is not
  2640.                     efficient enough to compile to the assembler decrement
  2641.                     instruction, but it is still a good concept and a
  2642.                     logical part of the language.
  2643.  
  2644.                     The Increment operator must be IN FRONT of the operand,
  2645.                     and not behind as allowed in the C language.  This
  2646.                     operator simply adds one to operand.
  2647.  
  2648.  
  2649.           Examples
  2650.                     Num = Num + 1            | Normal Decrementing
  2651.                     ++Num                    | But -- is shorter, easier.
  2652.  
  2653.                     Incr:Start
  2654.                       New Num
  2655.                       Win:Add ("Showing Increment", 4,4,12,30, Here)
  2656.                       Num = 0
  2657.                       While (Num < 10)       | Loop until zero
  2658.                         ++Num
  2659.                         Str:PutLine ("Number = "+Num) | Put 'Number = 1'
  2660.                       Str:PutLine ("Done")
  2661.                       Win:Pause
  2662.                       Return
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.           The JORF Manual (Shareware Disk Version)                       38
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.                                 Inequality (!= or <>)
  2686.  
  2687.  
  2688.           Symbol    != or <>
  2689.  
  2690.           Purpose   Test to see if two numbers are not equal. 
  2691.  
  2692.           Notes     I could never decide whether I like the BASIC <> or the
  2693.                     C language != better.  I know that I hate the Clipper
  2694.                     ambiguity where they are slightly different.  So, in
  2695.                     JORF they are exactly the same, but you can use either
  2696.                     symbol.  Since learning C brings higher salaries than
  2697.                     learning BASIC, I usually use the != (! means Not, =
  2698.                     Means Equals; Not-Equals) in my examples.  
  2699.  
  2700.  
  2701.           Examples
  2702.                     A = 1               | Assignment of 1 to A
  2703.                     If (A != 2)         | Check equality, is A not equal to 2?
  2704.                       Str:PutLine ("A is not 2")    | Will print this line
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.           Chapter Three - JORF Math                                      39
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.                                    Greater Than (>)
  2745.  
  2746.  
  2747.  
  2748.           Symbol    >
  2749.  
  2750.           Purpose   Test to see if the first operand is greater than the
  2751.                     second.
  2752.  
  2753.           Notes     Returns True if the First operand is greater than the
  2754.                     second.  Type conversion is the same as assignment. 
  2755.                     Numbers are compared numerically, and strings are
  2756.                     compared as strings.  String comparison is not case
  2757.                     sensitive. 
  2758.  
  2759.           Examples
  2760.                     1 > 5          False
  2761.                     "B" > "A"      True
  2762.                     "B" > "a"      True
  2763.                     "B" > 1        True because 1 is converted to "1"
  2764.                     "33" > 111     True because "33" is converted to 33
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.           The JORF Manual (Shareware Disk Version)                       40
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.                             Greater Than or Equal To (>=)
  2804.  
  2805.  
  2806.  
  2807.           Symbol    >=
  2808.  
  2809.           Purpose   Test to see if the first operand is greater or equal to
  2810.                     the second.
  2811.  
  2812.           Notes     Returns True if the First operand is greater than or
  2813.                     equal to the second.  Type conversion is the same as
  2814.                     assignment.  Numbers are compared numerically, and
  2815.                     strings are compared as strings.  String comparison is
  2816.                     not case sensitive. 
  2817.  
  2818.                     Reversing the symbols to be => has no meaning in JORF.
  2819.  
  2820.           Examples
  2821.                     1 >= 5              False
  2822.                     "B" >= "A"          True
  2823.                     "B" >= "b"          True
  2824.                     "B" >= 1            True because 1 is converted to "1"
  2825.                     "33" >= 33          True because "33" is converted to 33
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.           Chapter Three - JORF Math                                      41
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.                                     Less Than (<)
  2863.  
  2864.  
  2865.  
  2866.           Symbol    <
  2867.  
  2868.           Purpose   Test to see if the first operand is less than the
  2869.                     second.
  2870.  
  2871.           Notes     Returns True if the First operand is less than the
  2872.                     second.  Type conversion is the same as assignment. 
  2873.                     Numbers are compared numerically, and strings are
  2874.                     compared as strings.  String comparison is not case
  2875.                     sensitive. 
  2876.  
  2877.           Examples
  2878.                     1 < 5          True
  2879.                     "B" < "A"      False
  2880.                     "B" < "a"      False
  2881.                     "B" < 1        False because 1 is converted to "1"
  2882.                     "33" < 111     False because "33" is converted to 33
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.           The JORF Manual (Shareware Disk Version)                       42
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.                               Less Than or Equal To (<=)
  2922.  
  2923.  
  2924.  
  2925.           Symbol    <=
  2926.  
  2927.           Purpose   Test to see if the first operand is less than or equal
  2928.                     to the second.
  2929.  
  2930.           Notes     Returns True if the First operand is less than or equal
  2931.                     to the second.  Type conversion is the same as
  2932.                     assignment.  Numbers are compared numerically, and
  2933.                     strings are compared as strings.  String comparison is
  2934.                     not case sensitive. 
  2935.  
  2936.                     Reversing the symbol has no meaning in the current
  2937.                     version.  There is no =< operation.
  2938.  
  2939.           Examples
  2940.                     1 <= 5              True
  2941.                     "B" <= "A"          False
  2942.                     "B" <= "b"          True
  2943.                     "B" <= 1       False because 1 is converted to "1"
  2944.                     "33" > 111          False because "33" is converted to 33
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.           Chapter Three - JORF Math                                      43
  2974.  
  2975.  
  2976.  
  2977.  
  2978.  
  2979.  
  2980.                                    Logical AND (&&)
  2981.  
  2982.  
  2983.  
  2984.           Symbol    && or And
  2985.  
  2986.           Purpose   Test whether two logical values are both True. 
  2987.  
  2988.           Notes     An If statement uses the Logical And to make two tests
  2989.                     at once.  Each operand may be a test for equality, or
  2990.                     may be a test for null.  In JORF, Null, FALSE and Zero
  2991.                     are exactly the same.
  2992.  
  2993.                     The word "And" may now be used as a synonym for &&.  It
  2994.                     looks better, but gives And a funny status as kinda-a-
  2995.                     key-word.
  2996.  
  2997.                     The AND statement always evaluates both sides, without
  2998.                     shortcuts as in the C language.
  2999.  
  3000.           Examples
  3001.                     AndTest:Start
  3002.                       New A, B
  3003.                       A = 4
  3004.                       B = 2
  3005.                       Win:Add ("And Test", 0, 0, 10, 60, Here)
  3006.                       If (A And B)
  3007.                          Str:PutLine ("Test 1, Both A and B have values")
  3008.                       If (A & B)
  3009.                          Str:PutLine ("Test 2, Logical And, Bitwise & are different")
  3010.                       If (A < 5 And B > 4)
  3011.                          Str:PutLine ("Test 3, Use And to connect compound tests")
  3012.                       Win:Pause
  3013.                       Return
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.           The JORF Manual (Shareware Disk Version)                       44
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.                                  Logical NEGATION (!)
  3040.  
  3041.  
  3042.  
  3043.           Symbol    ! or Not
  3044.  
  3045.           Purpose   Test whether a logical values is not true. 
  3046.  
  3047.           Notes     You can reverse a logical statement using the logical
  3048.                     NOT.  It is usually more desirable to reverse the
  3049.                     logical test, especially if mixing Not, And and OR. 
  3050.                     Returns true if the operand is FALSE, Null or Zero.
  3051.  
  3052.                     The word "Not" may be used as a synonym for !.  
  3053.  
  3054.           Examples
  3055.                     NotTest:Start
  3056.                       New A, B
  3057.                       A = 4
  3058.                       B = 0
  3059.                       Win:Add ("Not Test", 0, 0, 10, 60, Here)
  3060.                       If (Not A)
  3061.                          Str:PutLine ("Test 1, A is not 'True'")
  3062.                       If (Not A And Not B)
  3063.                          Str:PutLine ("Test 2, Not can be ambiguous")
  3064.                       If Not (A < 5 And B < 5)
  3065.                          Str:PutLine ("Test 3, Use Not to reverse a test")
  3066.                       Win:Pause
  3067.                       Return
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.           Chapter Three - JORF Math                                      45
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.                                    Logical OR (??)
  3099.  
  3100.  
  3101.  
  3102.           Symbol    ?? or Or
  3103.  
  3104.           Purpose   Test whether one or the other of two logical values are
  3105.                     True. 
  3106.  
  3107.           Notes     An If statement uses the Logical Or to make two tests
  3108.                     at once.  Each operand may be a test for equality, or
  3109.                     may be a test for null.  In JORF, Null, FALSE and Zero
  3110.                     are exactly the same.
  3111.  
  3112.                     The word "Or" may now be used as a synonym for ??.  
  3113.  
  3114.                     You should be careful mixing And and Or in the same
  3115.                     expression.  Doing so can make the statement ambiguous. 
  3116.                     To avoid this, use parentheses so that each test
  3117.                     contains just one And or one Or. 
  3118.  
  3119.           Examples
  3120.                     OrTest:Start
  3121.                       New A, B, C
  3122.                       A = 4
  3123.                       B = 0
  3124.                       C = 6
  3125.                       Win:Add ("Or Test", 0, 0, 10, 60, Here)
  3126.                       If (A Or B)
  3127.                          Str:PutLine ("Test 1, One of A or B has a values")
  3128.                       If (A Or B And C)
  3129.                          Str:PutLine ("Test 2, Mixing can be ambiguous")
  3130.                       If ((A Or B) And C)
  3131.                          Str:PutLine ("Test 3, But Parentheses makes it clear")
  3132.                       Win:Pause
  3133.                       Return
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.           The JORF Manual (Shareware Disk Version)                       46
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.                                      Modulus (%)
  3158.  
  3159.  
  3160.  
  3161.           Symbol    %
  3162.  
  3163.           Purpose   Return the Integer remainder of Integer division. 
  3164.  
  3165.           Notes     The Modulus operator is used in conjunction with
  3166.                     counters to create cycles.  A cycle is a set of values
  3167.                     that loop.  To turn a numeric counter into the cycle 0,
  3168.                     1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4 you use the
  3169.                     modulus of 5. 
  3170.  
  3171.                          0 % 5 = 0 7 % 5  = 2     14 % 5 = 4
  3172.                          1 % 5 = 1 8 % 5  = 3     15 % 5 = 0
  3173.                          2 % 5 = 2 9 % 5  = 4     16 % 5 = 1
  3174.                          3 % 5 = 3 10 % 5 = 0     17 % 5 = 2
  3175.                          4 % 5 = 4 11 % 5 = 1     18 % 5 = 3
  3176.                          5 % 5 = 0 12 % 5 = 2     19 % 5 = 4
  3177.                          6 % 5 = 1 13 % 5 = 3     20 % 5 = 0
  3178.  
  3179.  
  3180.           Examples  My favorite is the use of modulus in the ASCII.J file. 
  3181.                     This program uses modulus start a new line every 16th
  3182.                     character. 
  3183.  
  3184.                     Ascii:Show(Base)
  3185.                       New (Char)
  3186.  
  3187.                       Win:Attr("Lo")
  3188.                       Move:To(1,1)
  3189.  
  3190.                       | Display 128 Ascii characters
  3191.                       For (Char = Base Thru 127+Base)
  3192.                         Str:Put(To:Str(Char,"000 "))
  3193.                         Char:Put(Char)
  3194.                         If ((Char %8)==7)
  3195.                           Str:PutLine()
  3196.                         Else
  3197.                           Str:Put("   ")
  3198.                       Win:Attr("No")
  3199.                       Return (Ok)
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.           Chapter Three - JORF Math                                      47
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.                                   Multiplication (*)
  3217.  
  3218.  
  3219.           Symbol    *
  3220.  
  3221.           Purpose   Multiply numbers. 
  3222.  
  3223.           Notes     Two numbers are multiplied.  If the numbers are
  3224.                     integers, and the result is very large, it may be
  3225.                     converted to floating point.  Multiplication of
  3226.                     floating point numbers can result in an integer result.
  3227.  
  3228.  
  3229.           Examples
  3230.                     20 * 55.5 = 1110
  3231.                     22.4 * 4  = 89.2 
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.           The JORF Manual (Shareware Disk Version)                       48
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.                                      Negation (-)
  3276.  
  3277.  
  3278.  
  3279.           Symbol    -
  3280.  
  3281.           Purpose   Negates a number. 
  3282.  
  3283.           Notes     Unary negation is done by preceding any expression with
  3284.                     a minus sign.  This symbol negates the value.  
  3285.                     Parentheses are recommended to avoid ambiguity with the
  3286.                     subtraction operation.
  3287.  
  3288.                     The most common use is to pass a negative number to a
  3289.                     function.  Negative numbers.  
  3290.  
  3291.           Examples  The Windows program displays a few windows.  Positive
  3292.                     Row and Column positions are offsets from the top left
  3293.                     corner.  Negative Row and Column positions are offsets
  3294.                     from the bottom right corner. No matter how big or
  3295.                     small the screen, these boxes will be placed in the
  3296.                     same relative positions.
  3297.  
  3298.                     Windows:Start 
  3299.                       Win:Add ("Big", 2, 2, -2, -2) 
  3300.                       Win:Add ("Top Right", 3, 3, 3, 15) 
  3301.                       Win:Add ("Bottom Right",-3, 3, 3, 15) 
  3302.                       Win:Add ("Bottom Left", -3, -3, 3, 15) 
  3303.                       Win:Add ("Top Left", 3, -3, 3, 15) 
  3304.                       Win:Add ("Tall", 3, 45, -4, 10) 
  3305.                       Win:Add ("Wide", 10, 3, 3, -4) 
  3306.                       Win:Pause 
  3307.                       Return Ok
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.           Chapter Three - JORF Math                                      49
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.                                    Subtraction (-)
  3335.  
  3336.  
  3337.  
  3338.           Symbol    -
  3339.  
  3340.           Purpose   Subtract two numbers. 
  3341.  
  3342.           Notes     The plus sign adds numbers if both sides are numbers,
  3343.                     and if one or both operands are strings then they are
  3344.                     concatenated.   Although it would make sense, multiple
  3345.                     line Texts are not concatenated, and are handle only as
  3346.                     the current line of text.  Also structures and arrays
  3347.                     are not concatenated.
  3348.  
  3349.           Examples
  3350.                          1 - 5 = -4
  3351.                          78.8 - 2 = 76.8
  3352.                          65536 - 1 = 65535
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386.           The JORF Manual (Shareware Disk Version)                       50
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.                                      Chapter Four
  3400.                                   The Window Manager
  3401.  
  3402.  
  3403.            
  3404.  
  3405.  
  3406.                                   The Window Manager
  3407.  
  3408.           The JORF Window Management system handles pull down and pop up
  3409.           menus, hypertext prompts, radio buttons, check boxes, and data
  3410.           entry fields.  Cursor control between fields and mouse control is
  3411.           handled automatically.    
  3412.  
  3413.           The JORF window management system is handled entirely within the
  3414.           Win:Add and Win:Chg functions.  Both functions can be followed by
  3415.           a window definition section of commands.  Each command begins
  3416.           with a command verb, followed by a colon, followed by a quoted
  3417.           prompt.  The commands are defined in detail below.
  3418.  
  3419.           Although command verbs look like the class definition of a method
  3420.           call, they are not calls to JORF language methods.  The use of
  3421.           the colon in the key words is simply for consistency with the
  3422.           "look" of JORF language programs, and should not be mistaken for
  3423.           class oriented functions.
  3424.  
  3425.           A "Prototype" window is shown below:
  3426.  
  3427.                 Event:Add ("EditKey")
  3428.                 Win:Add ("Title", Row, Col, Len, Wid, Level)
  3429.                   Command:"Prompt", Option:"value", Option:"value"
  3430.                     Option:"More Values can be Indented"
  3431.                     Option:"For as many lines as necessary"
  3432.                   Command:"Prompt", Option:"value", Option:"value"
  3433.                   Command:"Prompt", Option:"value", Option:"value"
  3434.                   You can also place a text paragraph at the bottom.  The 
  3435.                   system looks for the keyword and colon (:) character and
  3436.                   if they are absent will print the rest of the indented
  3437.                   screen definition as a text paragraph.
  3438.  
  3439.                   You can embed commands within text by enclosing some
  3440.                   commands in {Command:"Curly brackets, Option:"value"}.
  3441.                   This can be used for hypertext prompts and buttons that
  3442.                   are embedded in the text.
  3443.                 Return
  3444.  
  3445.           Chapter Three - JORF Math                                      51
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.           You can see in the above example, there are a number of complex
  3452.           rules for declaring comments.  
  3453.  
  3454.                 Indented Text is subordinate to the Win:Add command. 
  3455.                 There can be additional indentations, but the window
  3456.                 definition ends at the end of the function or the next
  3457.                 unindented command. 
  3458.  
  3459.                 The Command section is always the first section in a
  3460.                 window definition.  It continues as long as there is a
  3461.                 Colon in the first expression of the line.  If the
  3462.                 expression is not a valid command word an error is
  3463.                 displayed.
  3464.  
  3465.                 The Text Section begins on the first line where there is
  3466.                 No Colon.  Some commands, notably the Prompt command that
  3467.                 is used for hypertext, can be included in the text section
  3468.                 if it is surrounded by Curly Brackets.
  3469.  
  3470.           Prompts and commands are handled as JORF language values.  They
  3471.           are quoted if they are strings, but not if they are numeric.  If
  3472.           they are unquoted, they are assumed to be variable values and
  3473.           must be valid parameters or new variables in the method that
  3474.           creates the window.  
  3475.  
  3476.           The sequence of fields during data entry follows the sequence the
  3477.           fields are declared.  
  3478.  
  3479.           The following is a summary of command values:
  3480.  
  3481.                 Array:""                An array pick list
  3482.                 Button:"Prompt"         A button
  3483.                 ChBox:"Prompt"          A check box
  3484.                 Group:"Prompt"          A group box (single line box)
  3485.                 Input:"Prompt"          A data entry field
  3486.                 List:""                 A record pick list
  3487.                 Marker:"Markername"     A marker section for Win:Chg
  3488.                 Menu:"Prompt"           A menu bar option 
  3489.                 MLine:"Prompt"          A menu line option
  3490.                 Prompt:"Prompt"         A hypertext prompt
  3491.                 Radio:"Prompt"          A radio button
  3492.                 String:"DisplayString"  A string (no data entry)
  3493.                 Text:""                 A data entry field 
  3494.  
  3495.           Keystroke handling is done by a combination of event system and
  3496.           automatic commands.  Every keystroke is first passed through the
  3497.           event handling system.  There is an event class called EditKey
  3498.           built into the interpreter that is the default key handler.  For
  3499.           your window to operate properly, you must set the Editkey class
  3500.           using the Event:Add command.
  3501.  
  3502.                     Event:Add ("EditKey")
  3503.  
  3504.           The JORF Manual (Shareware Disk Version)                       52
  3505.  
  3506.  
  3507.  
  3508.  
  3509.  
  3510.  
  3511.           This handler takes care of all letters and numbers, handles
  3512.           WordStar style control key functions, handles WordPerfect style
  3513.           Home, End and Page keys, and handles Arrow Keys.
  3514.  
  3515.           You can create a substitute handler for some or all keys.  Also,
  3516.           you can layer another handler on top of the existing handler. 
  3517.           This allows you to change defaults for a few keys without having
  3518.           to redefine an entirely new handler.  You might make a handler
  3519.           that makes the F7 key exit  the screen, instead of Alt_F4.  To
  3520.           use it you simply create a new class and define the routines. 
  3521.  
  3522.                 MyKeys:F7_Key
  3523.                   If (Editkey:FinishEdit)         | If OK to finish editing
  3524.                     Jorf:Exit                     |   Exit the program
  3525.                   Return (Ok)                     | Otherwise, return OK
  3526.  
  3527.                 MyKeys:Alt_F4_Key
  3528.                   Return ('Alt_F4_Key')           | Block Alt-F4 from further processing
  3529.  
  3530.           The first method does what Alt-F4 would normally do, execute the
  3531.           FinishEdit function to save the data and then exit.  The second
  3532.           method simply blocks the F10 key from further processing.  
  3533.  
  3534.           When a keystroke method is processed, the return value is
  3535.           critical in specifying further processing.  Possible return
  3536.           values are:
  3537.  
  3538.                 Null               Keystroke is not processed - continue checking event stack
  3539.                 Ok                 Keystroke is processed - processing is complete
  3540.                 The Keystroke      Keystroke is processed - and not changed
  3541.                 Another Keystroke  Keystroke is processed - and changed to this keystroke. 
  3542.                                    Used to change key combination into other printable
  3543.                                    characters.
  3544.  
  3545.  
  3546.           The above definition is a complete event class that redefines to
  3547.           keystrokes.  To use this class, layered above the normal Editkey
  3548.           class, means you use the Event:Add function twice:
  3549.  
  3550.  
  3551.           Event:Add      | A Null event blocks lower keystroke 
  3552.                 Event:Add ("EditKey")   | Normal Key Processing
  3553.                 Event:Add ("MyKey")     | Substitute for F7, F10
  3554.                 Win:Add ("Title", . . .)
  3555.                   ...
  3556.                 Return
  3557.  
  3558.           The event layering system enables you to trap and change any
  3559.           keystroke.  The layering allows you to add new functionality to
  3560.           any key, above what is already defined.  
  3561.  
  3562.  
  3563.           Chapter Four - The Window Manager                              53
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.           The complete EditKey class is given in source code form with the
  3570.           JORF Developer's Kit.  Having this code gives you the source code
  3571.           you need to create your own word processing system.  This source
  3572.           code is written in the JORF language, and is translated and
  3573.           compiled to the C language.  
  3574.  
  3575.                                 Windows Function keys
  3576.  
  3577.           Handling of keystrokes between fields conforms basically to the
  3578.           CUA standard supported by Microsoft Windows.  That means there
  3579.           are pre-defined keys that you should use in your programs.  Here
  3580.           is a list of keys built into JORF.
  3581.  
  3582.           Key                      Function            Who does it
  3583.  
  3584.           F1                       Help                     You do this.
  3585.           F3                       "Save Text"              Editkey
  3586.           Tab                      Next Input or Button     Automatic 
  3587.           Back-Tab                 Previ Input or Button    Automatic
  3588.           Alt-Keys                 Jump to menu/button      Automatic
  3589.           Arrow Keys               Up and Down              Automatic
  3590.           Enter Key on a Button    Executes Button          Automatic
  3591.           Enter Key on a field     Goes to next field       You do this.
  3592.           Space bar on radio       Toggles button           Automatic
  3593.           Escape Key               Exits Window             Automatic 
  3594.           Alt-X                    Exits Application        You do this.
  3595.           Alt-F4 Key               Exits Application        You do this.
  3596.  
  3597.           The F3 key is defined as a "Save" key in the Editkey processor
  3598.           routine.  It is automatically in effect when text is edited.  
  3599.  
  3600.           You must be sure to define F1 and Alt-F4 in Windows programs. 
  3601.           These keystrokes are so standard that you should always set them
  3602.           up.  DOS Programs also have a standard of using F1 as the help
  3603.           key.  DOS programs sometimes exit with Alt-Q instead of Alt-X,
  3604.           but one of these should always be defined.
  3605.  
  3606.           The CUA standard says that when you press the Enter key, the
  3607.           currently  highlighted button is executed.  Before buttons were
  3608.           common in DOS programs, the enter key was commonly used to end
  3609.           data entry in one field and move to the next field.  You can
  3610.           easily change JORF programs to support the DOS-like action, even
  3611.           though your program will be in flagrant violation of CUA
  3612.           standards.  Just use the following routine to change the
  3613.           keystroke:
  3614.  
  3615.                     MyProg:Enter_Key
  3616.                       Return ("Tab_Key")
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.           The JORF Manual (Shareware Disk Version)                       54
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.                                    Windows Alt Keys
  3629.  
  3630.           You can include an ampersand (&) character within any prompt to
  3631.           create an Alt key accelerator.  In the JORF language, these are
  3632.           handled automatically by the window management system.  Under
  3633.           DOS, Alt keys are highlighted, and in Windows programs they are
  3634.           underlined in menus, and highlighted when in screens. 
  3635.  
  3636.           Windows programmers may note that under windows, JORF uses the
  3637.           Windows menu handling system.  Windows data input fields were not
  3638.           amenable to handling by JORF, so JORF data entry fields are
  3639.           highlighted differently and handled differently than true Windows
  3640.           input fields.  One simple advantage of the JORF fields is that
  3641.           they are smaller, so you can fit up to 25 lines of prompts per
  3642.           window, instead of just 15 lines of prompts on a normal Windows
  3643.           screen. Radio Buttons and Check boxes are a hybrid, where the
  3644.           buttons are defined as child windows, but the prompts and Alt
  3645.           keys are handled entirely by JORF and not by Windows. 
  3646.  
  3647.           In addition to highlighted prompts, any menu item can be run by
  3648.           defining a Hotkey definition.  (This is an "Accelerator" in
  3649.           Windows lingo".  Just follow the menu definition by the word
  3650.           Hotkey, a colon, and the keystroke to be used.  Most of the time
  3651.           you also want to indicate the key within the menu prompt.  To
  3652.           define an accelerator in a menu, you must have at least two
  3653.           spaces between the prompt and the notation for the accelerator
  3654.           and you should right align your accelerator prompts by hand.    
  3655.  
  3656.           See the sample program MAILLIST.J printed below for an example of
  3657.           Hotkey accelerators in use.
  3658.  
  3659.                           Alt Keys within Data Entry Windows
  3660.  
  3661.           You can highlight Alt key prompts for every data entry field,
  3662.           group box, or radio button on a screen.  As a person who has
  3663.           designed such screens for almost 10 years, this ability is
  3664.           provides greatest ease of access I have ever experienced.  
  3665.  
  3666.           Any screen that grows larger than 8 prompts gets to be a pain to
  3667.           change.  Most programs start your cursor on the top, and you have
  3668.           to arrow down through the fields to get to the one you want to
  3669.           change.  In the last two years, I have done some contracted
  3670.           modifications to a program that has more than 18 fields on the
  3671.           first screen, and the most common to change are often the last
  3672.           seven.  Every time an operator needs to change this one field,
  3673.           they must press the down arrow at least 10 times!
  3674.  
  3675.           If you use your Alt keys and group boxes, you can make this
  3676.           cursor movement unnecessary.  Pressing Alt and the highlighted
  3677.           letter of an input prompt will bring you immediately to that
  3678.           prompt.  If there are too many prompts, group similar ones using
  3679.  
  3680.  
  3681.           Chapter Four - The Window Manager                              55
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.           group boxes that themselves have a highlighted letter.  You can
  3688.           see an example of that in the contact manager program CONTACT.J
  3689.  
  3690.                                    Windows Settings
  3691.  
  3692.           When a window is created using the Win:Add command, a new Win:Ptr
  3693.           structure is created.  This structure can have many elements that
  3694.           can be set using the same syntax as the commands.
  3695.  
  3696.           Simply by declaring a windowstructure label followed by a colon
  3697.           followed by a value, will set that value within the window before
  3698.           any display takes place.  
  3699.  
  3700.           In this simple example, (HAPPY.J) we can create a window with a
  3701.           yellow background and a message that says "I'm Happy"
  3702.  
  3703.                 Happy:Start
  3704.                   Win:Add
  3705.                     Attr:"Green/Yellow"
  3706.                     Msg:"I'm Happy"
  3707.                     Button:"&Ok" Row:6
  3708.                     How are we doing.
  3709.                   Return (Ok)
  3710.  
  3711.  
  3712.           Each element in the window structure has only one value, as
  3713.           opposed to a Window Command which has values for row, column,
  3714.           field name, and other routines.  The most common elements set in
  3715.           this fashion are Window Before, InpBefore and Display values,
  3716.           that define methods to execute before the window is displayed,
  3717.           before each input is entered, and before the window is
  3718.           redisplayed respectively.  The complete list of values is as
  3719.           follows:
  3720.  
  3721.           Type      Changes the color mode for the window.  You can set up
  3722.                     new color sequences in the JORF.INI file, and then
  3723.                     specify them here.  That way, each type of window in
  3724.                     your application has its own colors. Changes the
  3725.                     default colors and line style
  3726.  
  3727.           Magic     Setting Magic to False will keep the window from trying
  3728.                     to interpret magic spots (fields surrounded by {curly
  3729.                     brackets}).  Normally Magic is TRUE, and any bracket
  3730.                     expression is interpreted.
  3731.  
  3732.           Attr      Setting Attr changes the starting attribute for text
  3733.                     display in the window.  The value can be any legal
  3734.                     value documented in the Win:Attr function.
  3735.  
  3736.           FLRCO     Setting FLRCO changes the current wrap mode.  The
  3737.                     default mode is "L" for left justified text.  
  3738.  
  3739.  
  3740.           The JORF Manual (Shareware Disk Version)                       56
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.           Before    Setting Before specifies a method to be executed before
  3747.                     any data entry takes place on the window.  It can be
  3748.                     used to display additional information for the
  3749.                     operator, or to test input or display parameters.  If
  3750.                     the Before method returns FALSE, the window entry is
  3751.                     ignored.
  3752.  
  3753.           Display   Setting Display is similar to setting Before. The
  3754.                     difference is that the Before method executes before
  3755.                     any part of the window is displayed, but the Display
  3756.                     routine executes after the window box is showing.  The
  3757.                     Display routine can then add visual elements to the
  3758.                     window that are not included in buttons and fields that
  3759.                     make up the rest of the window definition.
  3760.  
  3761.           After     Setting After specifies a method to be executed when
  3762.                     the operator attempts to exit the window using the
  3763.                     Escape key or the window close button.  On text entry
  3764.                     windows, it is common to specify a method to ask
  3765.                     whether to save the changed document before exiting the
  3766.                     window.  If the After method returns False, then the
  3767.                     window remains displayed as if the operator did not
  3768.                     request an exit.
  3769.  
  3770.           InpBefore
  3771.           InpAfter  InpBefore and InpAfter may be used to specify methods
  3772.                     that must be run before and after every input field
  3773.                     (including buttons and check boxes) in the window. 
  3774.                     These methods are commonly used to lock the record, as
  3775.                     well as qualify the operator rights to change the
  3776.                     field.  If the Before method returns False, the
  3777.                     operator will not be able to change the field.  If the
  3778.                     After method returns False, the operator will not be
  3779.                     able to move to another field (presumably until the
  3780.                     operator corrects the field value.)
  3781.  
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790.  
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.           Chapter Four - The Window Manager                              57
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.                                         Array
  3807.  
  3808.  
  3809.           Command   Array:""
  3810.  
  3811.           Purpose   A pick list of array elements.  
  3812.  
  3813.           Options   Row:10              Set Row
  3814.  
  3815.                     Col:10              Set Column
  3816.  
  3817.                     Wid:10              Set Width of List
  3818.  
  3819.                     Len:3               Set Length of List
  3820.  
  3821.                     After:"Expr"        Expression is executed after list..
  3822.  
  3823.  
  3824.                     Before:"Expr"       Expression is executed. If false,
  3825.                                         the operator cannot pick from list.
  3826.  
  3827.  
  3828.                     Field:"Fldname"     Command to execute for Next Record
  3829.  
  3830.                     Choice:"Field"      Command to execute for Previous
  3831.                                         Record
  3832.  
  3833.           Defaults  Row            One row below previous command.  If the
  3834.                                    previous command is a Group Box, then
  3835.                                    Row, Col, Wid and Len default to the
  3836.                                    inside dimensions of the box.
  3837.  
  3838.                     Col            Same column as previous command.
  3839.  
  3840.                     Wid            30
  3841.  
  3842.                     Len            1
  3843.  
  3844.           Highlight Arrays are highlighted like menus.  No cursor is
  3845.                     displayed, even when the array has focus.
  3846.  
  3847.           See Also  List.
  3848.  
  3849.           Notes     This command works like List, but operates only on
  3850.                     arrays and is much faster.  The fact that it works on
  3851.                     arrays limits the size of the data you can edit, but
  3852.                     this is a good vehicle for pick lists up to a thousand
  3853.                     elements.  
  3854.  
  3855.  
  3856.  
  3857.  
  3858.           The JORF Manual (Shareware Disk Version)                       58
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.           Example   The DirList.J program creates a "Dialog Directory list"
  3866.                     and returns the selected file.  Here is the DirList by
  3867.                     itself.  The TextEdit.J program uses it to select a
  3868.                     file to edit.  This program is compiled into the
  3869.                     interpreter as the DirList:GetFile() function.
  3870.  
  3871.           Class:DirList                   | Class Definition
  3872.             Name                          | File Name
  3873.             Path                          | File Path
  3874.             WildCard                      | Wildcard for directory
  3875.             ExclusionList                 | Extension Exclusion List
  3876.             FileArray                     | Array of files on this path
  3877.             DirArray                      | Array of other paths
  3878.  
  3879.           DirList:Start                   | FOR TESTING:  Start routine
  3880.             New (FileName)
  3881.             FileName = DirList:GetFile("*.*",Null)
  3882.             Msg:Add
  3883.               File name is {FileName}
  3884.             Return (Ok)
  3885.  
  3886.           DirList:Cancel(List)            | Routine to Cancel data entry
  3887.             List->Name=Null               | Signal that we canceled
  3888.             Return(Null)                  | Returning Null will finish input
  3889.  
  3890.           DirList:Done(List,Name)         | Routine to finish data entry
  3891.             If (Str:In(List->Name,"*") Or Str:In(List->Name,"?"))
  3892.               List->WildCard  = List->Name
  3893.               List->FileArray = DirList:FileArray(List->Wildcard, List->Exclusionlist)
  3894.               Kbd:Put("Home_Key")       | Stuff home key
  3895.               Win:Dsp              | Redisplay (including arrays)
  3896.               Return (Ok)
  3897.  
  3898.             If (List->Name==Null)         | If name is still null display message
  3899.               Msg:Add
  3900.                 Please select a file
  3901.                 name or "Cancel".
  3902.               Return (Ok)                 | Returning Ok will continue input
  3903.             Return (Null)                 | Returning Null will finish input
  3904.  
  3905.           DirList:FileArray(WildCard,Exclusionlist)  | Read a file array
  3906.             New (Array)
  3907.             If (WildCard!="SUBDIR")
  3908.               Win:Add ('Reading')
  3909.                 Reading directory
  3910.             Array = Arr:Dir (WildCard, ExclusionList, 12)
  3911.             Return (Array)
  3912.  
  3913.           DirList:GetFile(WildCard,ExclusionList)
  3914.             New (OrigPath, DirList:List, DirChoice, FileChoice)
  3915.  
  3916.  
  3917.           Chapter Four - The Window Manager                              59
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.             | Initalize values
  3924.             OrigPath            = File:ChDir()
  3925.             List->Path          = OrigPath
  3926.             List->WildCard      = WildCard
  3927.             List->ExclusionList = Exclusionlist
  3928.             List->FileArray     = DirList:FileArray(List->Wildcard, List->Exclusionlist)
  3929.             List->DirArray      = DirList:FileArray("SUBDIR")
  3930.  
  3931.             Event:Add(Null)               | Block prior keystroke events
  3932.             Win:Add ("Get File Name", 0, 0, 10, 56, Here)
  3933.  
  3934.               | Input File Name
  3935.               Input:"File&name:  ",  Wid:24, Row:2, Col:3, Field:"List->Name"
  3936.  
  3937.               | Files array with a group box around
  3938.               Group:"&Files",       Row:6, Col:2, Wid:16, Len:10
  3939.               Array:"", Field:"List->FileArray",
  3940.                         Choice:"FileChoice",
  3941.                         Action:"DirList:NewName(List,List->FileArray[FileChoice])"
  3942.  
  3943.               | Directories array with a group box around
  3944.               Group:"&Directories", Row:6, Col:22, Wid:16, Len:10
  3945.               Array:"", Field:"List->DirArray",
  3946.                         Choice:"DirChoice"
  3947.                         Action:"DirList:NewDir(List,List->DirArray[DirChoice])"
  3948.  
  3949.               | Input File Path
  3950.               Input:"Directory: ",   Wid:24, Row:4, Col:3, Field:"List->Path"
  3951.                       After:"DirList:NewDir(List,List->Path)"
  3952.  
  3953.               | Two buttons
  3954.               Button:"   &Ok   ", Row:1, Col:42, Wid:14
  3955.                 Action:"DirList:Done(List,List->FileArray[FileChoice])"
  3956.               Button:" &Cancel ", Row:4, Col:42, Wid:14
  3957.                 Action:"DirList:Cancel(List)"
  3958.  
  3959.             If (File:ChDir(OrigPath))
  3960.               If (List->Name)
  3961.                 If (Str:At(List->Path,Str:Len(List->Path),1)=='\')
  3962.                 Return (List->Path+List->Name)
  3963.                 Return (List->Path+'\'+List->Name)
  3964.             Return (Null)
  3965.  
  3966.           DirList:NewDir(List,Path)       | Routine to set a new path
  3967.             If (File:Chdir(Path))         | Change to the new path
  3968.               List->Path = File:ChDir()   | Reset path name
  3969.               List->Name = Null           | Set file name to null
  3970.               | Re-read file array
  3971.               List->FileArray = DirList:FileArray(List->Wildcard, List->Exclusionlist)
  3972.               | Re-Read directory array - special argument "SUBDIR" does this
  3973.               List->DirArray  = DirList:FileArray("SUBDIR")
  3974.               Win:Dsp                     | Redisplay Window
  3975.  
  3976.           The JORF Manual (Shareware Disk Version)                       60
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.             Return(Ok)                    | Returning Ok continues input
  3983.  
  3984.           DirList:NewName(List,Name)      | Routine to set a new name
  3985.             List->Name = Word:At(Name,1)  | Set the name (Easy!)
  3986.             Win:Dsp                       | Redisplay the screen
  3987.             Kbd:Put("Home_Key")         | And go back to file name
  3988.             Return(Ok)                    | Returning OK will continue input
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.           Chapter Four - The Window Manager                              61
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.                                         ChBox
  4043.  
  4044.  
  4045.           Command   ChBox:"&Prompt"
  4046.  
  4047.           Purpose   A Check Box.  
  4048.  
  4049.           Options   Row:10              Set row.
  4050.  
  4051.                     Col:10              Set column.
  4052.  
  4053.                     Wid:20              Set width of highlighted prompt.
  4054.  
  4055.                     Check:"Expr"        Box is checked if Expression is
  4056.                                         True.
  4057.  
  4058.                     Action:"Expr"       Expression is executed when box is
  4059.                                         selected. 
  4060.  
  4061.                     Before:"Expr"       Expression is executed. If false
  4062.                                         box cannot be selected.
  4063.  
  4064.           Defaults  Row            One row below previous command.
  4065.  
  4066.                     Col            Same column as previous command.  If
  4067.                                    previous command as Group, column is
  4068.                                    incremented to be inside of group box.
  4069.  
  4070.                     Wid            Prompt width.
  4071.  
  4072.           Highlight Prompt is highlighted when box is selected.  Pressing
  4073.                     Enter will check the box.  Pressing the space bar will
  4074.                     advance the cursor without checking the box. 
  4075.  
  4076.           See Also  Radio
  4077.  
  4078.           Notes     Check boxes are boxes that contain an X if selected,
  4079.                     and are empty if not selected.  They are commonly used
  4080.                     for selections that are cumulative.  Radio buttons
  4081.                     should be used when selections are mutually exclusive. 
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.           The JORF Manual (Shareware Disk Version)                       62
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.                                         Button
  4102.  
  4103.  
  4104.  
  4105.           Command   Button:"&Prompt"
  4106.  
  4107.           Purpose   A Button.  
  4108.  
  4109.           Options   Row:10              Set Row
  4110.  
  4111.                     Col:10              Set Column
  4112.  
  4113.                     Wid:10              Set Width of Button
  4114.  
  4115.                     Len:3               Set Length of Button
  4116.  
  4117.                     Action:"Expr"       Expression is executed when box is
  4118.                                         selected. 
  4119.  
  4120.                     Before:"Expr"       Expression is executed. If false
  4121.                                         box cannot be selected.
  4122.  
  4123.           Defaults  Row            One row below previous command.
  4124.  
  4125.                     Col            Same column as previous command.  If
  4126.                                    previous command as Group, column is
  4127.                                    incremented to be inside of the group
  4128.                                    box.
  4129.  
  4130.                     Wid            Prompt width plus two spaces on each
  4131.                                    side.
  4132.  
  4133.                     Len            3.
  4134.  
  4135.           Highlight In the DOS version, the button is highlighted. 
  4136.                     Pressing Enter will select the button.  Pressing the
  4137.                     space bar will advance the cursor without selecting the
  4138.                     button.   
  4139.  
  4140.           Notes     Buttons are used to complete screens or to select major
  4141.                     options.  They are not generally used for data entry
  4142.                     purposes.  The minimum length for a button in JORF is 3
  4143.                     lines.  You cannot create "little" buttons.  
  4144.  
  4145.           Example
  4146.  
  4147.           Ascii:Start
  4148.             Win:Add("ASCII TABLE", 4, 4, 19, 62, Here)
  4149.               Display:"Ascii:Show(0)"
  4150.               Marker:"Button"
  4151.               Button:"&Upper ASCII", Row:17 Col:1  Wid:30 Action:"Ascii:Show(128)"
  4152.  
  4153.           Chapter Four - The Window Manager                              63
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.               Marker:"Exit"
  4160.               Button:"E&xit ", Row:17 Col:33 Wid:30 Action:"Jorf:Exit()"
  4161.             Return
  4162.  
  4163.           Ascii:Show(Base)
  4164.             New (Char)
  4165.  
  4166.             Win:Attr("Lo")
  4167.             Move:To(1,1)
  4168.  
  4169.             | Display 128 Ascii characters
  4170.             For (Char = Base Thru 127+Base)
  4171.               Str:Put(To:Str(Char,"000 "))
  4172.               Char:Put(Char)
  4173.               If ((Char %8)==7)
  4174.                 Str:PutLine()
  4175.               Else
  4176.                 Str:Put("   ")
  4177.             Win:Attr("No")
  4178.  
  4179.             | Change button to be the opposite of what is showing
  4180.             If (Base==0)
  4181.               Win:Chg("Button",17,1,19,33)
  4182.                 Button:"&Upper ASCII", Row:17 Col:1 Wid:30 Action:"Ascii:Show(128)"
  4183.             Else
  4184.               Win:Chg("Button",17,1,19,33)
  4185.                 Button:"&Lower ASCII", Row:17 Col:1 Wid:30 Action:"Ascii:Show(0)"
  4186.  
  4187.             Return (Ok)
  4188.  
  4189.  
  4190.  
  4191.  
  4192.  
  4193.  
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.           The JORF Manual (Shareware Disk Version)                       64
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.                                         Group
  4220.  
  4221.  
  4222.  
  4223.           Command   Group:"&Prompt"
  4224.  
  4225.           Purpose   A Group Box.  
  4226.  
  4227.           Options   Row:10              Set Row
  4228.  
  4229.                     Col:10              Set Column
  4230.  
  4231.                     Wid:40              Set Width of Box
  4232.  
  4233.                     Len:6               Set Length of Box
  4234.  
  4235.           Defaults  Row            One row below previous command.
  4236.  
  4237.                     Col            Same column as previous command.  
  4238.  
  4239.           Highlight Group boxes can never be selected, and are never
  4240.                     highlighted.  If a group box has an Alt key letter, and
  4241.                     that key is pressed, the first field within the group
  4242.                     box is highlighted. 
  4243.  
  4244.           Notes     A Group box is a single line box that surrounds one or
  4245.                     more data entry fields.  They are commonly used for
  4246.                     surrounding related fields, and for surrounding
  4247.                     multiple line text fields. 
  4248.  
  4249.                     A feature of the group boxes in JORF is to be able to
  4250.                     use an Alt key to move to the first field of the box.
  4251.  
  4252.           Example   This is the masin screen from the MAILLIST.J sample
  4253.                     program.
  4254.  
  4255.           MailList:Start                     | Little Mail List Program
  4256.             New (Contact:Con)                | Create Contact Structure
  4257.             Jorf:File ("MAILLIST.JCM",Here)  | Set Database File
  4258.             Event:Add ("MailKey","Key",Here) | Set MailKey as a keystroke handler
  4259.             Mem:Ptr->IndexName = "FullName"  | Index Name
  4260.  
  4261.             | The main screen with menu options
  4262.             Win:Add ("Josephine's Mail List Manager", 2, 2, 22, 78, Here)
  4263.               Menu:"&File"
  4264.                 Menu:"&About            "  Action:"MailList:About"
  4265.                 Menu:
  4266.                 Menu:"&Rebuild        ",   Action:"Jorf:Rebuild"
  4267.                 Menu:
  4268.                 Menu:"E&xit        Alt-X", Action:"MailKey:Esc_Key"
  4269.  
  4270.  
  4271.           Chapter Four - The Window Manager                              65
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.               Menu:"&Edit"
  4278.                 Menu:"&Add     Alt-A", Action:"MailList:Add(Con)"    HotKey:"Alt_A_Key"
  4279.                 Menu:"&Change  Alt-C", Action:"MailList:Change(Con)"
  4280.                 Menu:"&Delete  Alt-D", Action:"MailList:Delete(Con)" HotKey:"Alt_D_Key"
  4281.  
  4282.               Menu:"&Search",
  4283.                 Menu:"&Name       ",  Action:"MailList:KeySearch (Con, 'FullName' )
  4284.                 Menu:"&Company    ",  Action:"MailList:KeySearch (Con, 'Company'  )
  4285.                 Menu:"&Last Name  ",  Action:"MailList:KeySearch (Con, 'LastName' )
  4286.                 Menu:"&Phone      ",  Action:"MailList:KeySearch (Con, 'WorkPhone')
  4287.                 Menu:"&Zip        ",  Action:"MailList:KeySearch (Con, 'ZipCode'  )
  4288.  
  4289.               Menu:"&Reports"
  4290.                 Menu:"&Mail List    ", Action:"MailList:List()"
  4291.                 Menu:"&This Contact ", Action:"MailList:PrintData(Con)"
  4292.                 Menu:"&Lotsa Labels ", Action:"MailList:ContinLabels(Con,'All')"
  4293.                 Menu:"&One Label",     Action:"MailList:ContinLabels(Con,'One')"
  4294.  
  4295.               InpBefore:"MailList:Lock(Con)"
  4296.               Group:"&Browse List", Row:1 Col:41, Len:6, Wid:36
  4297.               List:""
  4298.                 Field:"Con"
  4299.                 Next:"MailList:NextRecord(Con,'Next')"
  4300.                 Prev:"MailList:NextRecord(Con,'Prev')"
  4301.                 Show:"MailList:Show(Con)"
  4302.                 Before:"MailList:Write()"
  4303.                 Display:"(Mem:Ptr->Locked==Null)"
  4304.  
  4305.               Group:"&Contact Name and Address", Row:1, Col:1, Wid:38, Len:6
  4306.               Input:"Name   ",    Wid:30, Field:"Con->FullName"
  4307.                 After:"MailList:SplitName(Con)"
  4308.               Input:"Company", Wid:30,    Field:"Con->Company"
  4309.               Input:"Address", Wid:30,    Field:"Con->Addr1"
  4310.               Input:"       ", Wid:30,    Field:"Con->Addr2"
  4311.               Input:"       ", Wid:30,    Field:"Con->Addr3"
  4312.                 After:"MailList:ZipCode(Con)"
  4313.  
  4314.               Group:"Mail List Fields"
  4315.                 Row:9  Col:1  Len:11  Wid:76
  4316.               Input:"&Work Phone" Field:"Con->WorkPhone"
  4317.                 Row:10  Col:2  Wid:20
  4318.               Input:"&Home Phone"  Field:"Con->Homephone"
  4319.                 Row:11  Col:2  Wid:20
  4320.               Input:"Fax &Phone " Field:"Con->FaxPhone"
  4321.                 Row:12  Col:2  Wid:20
  4322.               Input:"Birthda&y  " Field:"Con->BirthDay"
  4323.                 Row:13  Col:2  Wid:20
  4324.               Input:"C&omment   "  Field:"Con->Comment"
  4325.                 Row:15  Col:2  Wid:50
  4326.               Input:"&Last Name " Field:"Con->LastName"
  4327.                 Row:10  Col:35  Wid:14
  4328.               Input:"Dear      " Field:"Con->Dear"
  4329.  
  4330.           The JORF Manual (Shareware Disk Version)                       66
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.                 Row:11  Col:35  Wid:14
  4337.               Input:"Zip Code  " Field:"Con->Zipcode"
  4338.                 Row:12  Col:35  Wid:14
  4339.               Radio:"Fr&iend"
  4340.                 Check:"Con->Type=='Friend'"
  4341.                 Action:"Con->Type='Friend'"
  4342.                 UnAction:"Con->Type= Null"
  4343.                 Row:10  Col:62
  4344.               Radio:"Fa&mily"
  4345.                 Check:"Con->Type=='Family'"
  4346.                 Action:"Con->Type='Family'"
  4347.                 UnAction:"Con->Type= Null"
  4348.                 Row:11  Col:62
  4349.               Radio:"Clien&t"
  4350.                 Check:"Con->Type=='Client'"
  4351.                 Action:"Con->Type='Client'"
  4352.                 UnAction:"Con->Type= Null"
  4353.                 Row:12  Col:62
  4354.               Radio:"&Vendor"
  4355.                 Check:"Con->Type=='Vendor'"
  4356.                 Action:"Con->Type='Vendor'"
  4357.                 UnAction:"Con->Type= Null"
  4358.                 Row:13  Col:62
  4359.               HLine:"&Notes"
  4360.                 Row:16  Col:2  Len:1  Wid:76
  4361.               Text:"" Field:"Con->Notes"
  4362.                 Row:17  Col:2  Len:4  Wid:76
  4363.             Return (Ok)                         | That is all, Folks!
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374.  
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.           Chapter Four - The Window Manager                              67
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.                                         Input
  4397.  
  4398.  
  4399.           Command   Input:"&Prompt"
  4400.  
  4401.           Purpose   An Input Field.  
  4402.  
  4403.           Options   Row:10              Set Row
  4404.  
  4405.                     Col:10              Set Column
  4406.  
  4407.                     Wid:10              Set Width of Data Entry
  4408.  
  4409.                     Len:3                    Set Length of Data Entry
  4410.  
  4411.                     After:"Expr"        Expression is executed after
  4412.                                         input.. 
  4413.  
  4414.                     Before:"Expr"       Expression is executed. If false
  4415.                                         input is skipped. 
  4416.  
  4417.                     Field:"Value"       Field Value to be entered. 
  4418.  
  4419.                     Type:"DType"        Set data type for automatic
  4420.                                         conversion.  "DType" can be "Date"
  4421.                                         or "Number".
  4422.  
  4423.                     Format:"##,###.00"  If Type is "Number", numeric format
  4424.                                         for display.  Will be unformatted
  4425.                                         for entry.
  4426.  
  4427.           Defaults  Row            One row below previous command.
  4428.  
  4429.                     Col            Same column as previous command.  If
  4430.                                    previous command as Group, column is
  4431.                                    incremented to be inside the group box.
  4432.  
  4433.                     Wid            30
  4434.  
  4435.                     Len            1
  4436.  
  4437.           Highlight Input fields are highlighted with attribute 4 when not
  4438.                     active, and attribute 5 when they are being edited. 
  4439.                     Also, the cursor is displayed when they are being
  4440.                     edited.  The prompt is never highlighted.
  4441.  
  4442.           See Also  Text.
  4443.  
  4444.           Notes     Input is used to enter single line prompts and small
  4445.                     multi line prompts.  Data entry fields are highlighted
  4446.                     both during entry and when displayed on the screen. 
  4447.  
  4448.           The JORF Manual (Shareware Disk Version)                       68
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.           Example   This program, Payment.J contains both Type and Format
  4455.                     commands.  For extra fun, try this one with "Set
  4456.                     Decimal=," (comma decimal) in your INI file.
  4457.  
  4458.           Class:Payment (Amt,Yrs,Intr,Pmt,Pmt50,Yrs50)
  4459.  
  4460.           Payment:Start
  4461.             New (Payment:Pmt)
  4462.             Win:Add ("Loan Payment Calculator",5,20)
  4463.               String:"Calculate your loan payment amount and years"
  4464.               String:"to pay if you added just $50 to the payment."
  4465.               String:
  4466.               String:"Press the TAB key to get from one field to"
  4467.               String:"the next. ENTER will end the program."
  4468.  
  4469.               Input:"&Loan Amount         ", Row:7 Col:5 Wid:14
  4470.                 Field:"Pmt->Amt", After:"Payment:Calc(Pmt)"
  4471.                 Format:"###,###,###.00", Type:"Numeric"
  4472.  
  4473.               Input:"&Years to Pay        ", Row:8 Col:5 Wid:3
  4474.                 Field:"Pmt->Yrs", After:"Payment:Calc(Pmt)"
  4475.                 Format:"###", Type:"Numeric"
  4476.  
  4477.               Input:"&Percent Interest    ", Row:9 Col:5 Wid:8
  4478.                 Field:"Pmt->Intr", After:"Payment:Calc(Pmt)"
  4479.                 Format:"#0.0000%", Type:"Numeric"
  4480.  
  4481.               Input:"Payment             ", Row:10 Col:5 Wid:14
  4482.                 Field:"Pmt->Pmt", Before:"Return(Null)"
  4483.                 Format:"###,###,###.00", Type:"Numeric"
  4484.  
  4485.               Input:"Adding just $50     ", Row:12 Col:5 Wid:14
  4486.                 Field:"Pmt->Pmt50", Before:"Return(Null)"
  4487.                 Format:"###,###,###.00", Type:"Numeric"
  4488.  
  4489.               Input:"Reduces the years to"  Row:13 Col:5 Wid:3
  4490.                 Field:"Pmt->Yrs50", Before:"Return(Null)"
  4491.                 Format:"###", Type:"Numeric"
  4492.  
  4493.               Button:"    &Done    ", Row:15, Col:16
  4494.             Return(Ok)
  4495.  
  4496.           Payment:Calc(Pmt)
  4497.             New (Periods,Per_Intr,Payment,Months50)
  4498.             Pmt->Pmt = 0
  4499.             If (Pmt->Intr > 0 And Pmt->Yrs > 0)
  4500.               Periods    = Pmt->Yrs*12
  4501.               Per_Intr   = Pmt->Intr/12/100
  4502.               Payment    = (Pmt->Amt*Per_Intr) / (1-Num:Pow(1+Per_Intr,(-Periods)))
  4503.               Payment    = Num:Int((Payment+.005)*100)/100
  4504.               Pmt->Pmt   = Payment
  4505.               Pmt->Pmt50 = Payment+50
  4506.  
  4507.           Chapter Four - The Window Manager                              69
  4508.  
  4509.  
  4510.  
  4511.  
  4512.  
  4513.               Months50   = Num:Log(Pmt->Pmt50/(Pmt->Pmt50-Pmt->Amt*Per_Intr))
  4514.               Months50   = Months50/Num:Log(1+Per_Intr)
  4515.               Pmt->Yrs50 = Num:Int((Months50/12)*10)/10
  4516.               Win:Dsp
  4517.             Return (Ok)
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.  
  4564.  
  4565.  
  4566.           The JORF Manual (Shareware Disk Version)                       70
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.                                          List
  4574.  
  4575.  
  4576.           Command   List:""
  4577.  
  4578.           Purpose   A pick list of records.  
  4579.  
  4580.           Options   Row:10         Set Row
  4581.  
  4582.                     Col:10         Set Column
  4583.  
  4584.                     Wid:10         Set Width of List
  4585.  
  4586.                     Len:3          Set Length of List
  4587.  
  4588.                     After:"Expr"   Expression is executed after list.. 
  4589.  
  4590.                     Before:"Expr"  Expression is executed. If false cannot
  4591.                                    pick from list. 
  4592.  
  4593.                     Next:"Expr"    Command to execute for Next Record
  4594.  
  4595.                     Prev:"Expr"    Command to execute for Prev Record
  4596.  
  4597.                     Show:"Expr"    Command to execute to display entry
  4598.  
  4599.  
  4600.           Defaults  Row            One row below previous command.  If the
  4601.                                    previous command is a Group Box, then
  4602.                                    Row, Col, Wid and Len default to the
  4603.                                    inside dimensions of the box.
  4604.  
  4605.                     Col            Same column as previous command.
  4606.  
  4607.                     Wid            30
  4608.  
  4609.                     Len            1
  4610.  
  4611.  
  4612.           Highlight Lists are highlighted like menus.  When the list
  4613.                     position is changed using the mouse or arrow keys, the
  4614.                     screen is automatically redisplayed.  No cursor is
  4615.                     displayed, even when the list has focus.
  4616.  
  4617.           See Also  Array.
  4618.  
  4619.           Notes     This has got to be my favorite window feature.  This
  4620.                     command is used to display information that is
  4621.                     contained in different records, where an Array list can
  4622.                     only display arrays.  Since you control the next and
  4623.  
  4624.  
  4625.           Chapter Four - The Window Manager                              71
  4626.  
  4627.  
  4628.  
  4629.  
  4630.  
  4631.                     prev functions, it is easy to make the list indexed, to
  4632.                     filter it, and to format the displayed text. 
  4633.  
  4634.                     Lists are relatively slow, since it takes several
  4635.                     record reads to display several records.  For this
  4636.                     reason, you should keep your lists as short as you can,
  4637.                     since this limits the number of records required for a
  4638.                     display operation.   
  4639.  
  4640.           Example   See the MailList.J sample program, especially what
  4641.                     happens when you change your index to the Zip code
  4642.                     index.
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.           The JORF Manual (Shareware Disk Version)                       72
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.                                         Marker
  4692.  
  4693.  
  4694.  
  4695.           Command   Marker:"Markername"
  4696.  
  4697.           Purpose   Mark a section of input fields and buttons for later
  4698.                     replacement using Win:Chg.
  4699.  
  4700.           Options   None
  4701.  
  4702.           See Also  Win:Chg.
  4703.  
  4704.           Notes     More sophisticated data entry windows contain buttons
  4705.                     and fields that change according to what is entered on
  4706.                     the screen.  The way to make this happen in JORF land
  4707.                     is to set markers around those fields, and then use
  4708.                     Win:Chg to set new fields in their place.  
  4709.  
  4710.                     Markers do not display, cannot be highlighted, and
  4711.                     cannot have After or Action clauses.  Before and
  4712.                     Display clauses probably work, however, and tagging
  4713.                     them to a non-displaying element allows you to closely
  4714.                     control when these operations are performed.
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.           Chapter Four - The Window Manager                              73
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.                                          Menu
  4751.  
  4752.  
  4753.  
  4754.           Command   Menu:"&Prompt"
  4755.  
  4756.           Purpose   A Menu Bar or Menu Line.  
  4757.  
  4758.           Options   Action:"Expr"       Expression to execute when
  4759.                                         selected. 
  4760.  
  4761.                     Hotkey:"Keystroke"  Hotkey accelerator
  4762.  
  4763.                       Menu:"&Prompt"    (Indented) SubMenu Options
  4764.  
  4765.  
  4766.           See Also  MLine.
  4767.  
  4768.           Notes     The Menu command is used for Menu bars and associated
  4769.                     pull down menu boxes.  Each menu command contains
  4770.                     either an Action, or it has indented sub-menu commands
  4771.                     below.  A menu option cannot have both.
  4772.  
  4773.                     The top level menu is assumed to be a menu bar on the
  4774.                     top of the current window.  To force top level menu to
  4775.                     be menu lines, use MLine.  All indented sub-menu
  4776.                     commands are menu lines, even when declared using the
  4777.                     Menu command. 
  4778.  
  4779.  
  4780.  
  4781.  
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.           The JORF Manual (Shareware Disk Version)                       74
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.                                         MLine
  4810.  
  4811.  
  4812.           Command   MLine:"&Prompt"
  4813.  
  4814.           Purpose   A Menu Line.  
  4815.  
  4816.           Options   Action:"Expr"       Expression to execute when
  4817.                                         selected. 
  4818.  
  4819.                     Hotkey:"Keystroke"  Hotkey accelerator
  4820.  
  4821.                       Menu:"&Prompt"    (Indented) SubMenu Options
  4822.  
  4823.           See Also  Menu.
  4824.  
  4825.           Notes     The MLine command is used to force a menu to use menu
  4826.                     lines, even when it is a top level menu.  For Menu
  4827.                     bars, use Menu. 
  4828.  
  4829.                     I don't think the use of MLine is CUA compliant, since
  4830.                     no CUA screen uses a menu-lines as a top level menu
  4831.                     (i.e. the whole window contains one menu.
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.  
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.  
  4858.  
  4859.  
  4860.  
  4861.           Chapter Four - The Window Manager                              75
  4862.  
  4863.  
  4864.  
  4865.  
  4866.  
  4867.  
  4868.                                         Prompt
  4869.  
  4870.  
  4871.  
  4872.           Command   Prompt:"&Prompt"
  4873.  
  4874.           Purpose   A Highlightable Prompt.  
  4875.  
  4876.           Options   Row:10         Set Row
  4877.  
  4878.                     Col:10         Set Column
  4879.  
  4880.                     Wid:30         Set Width of highlight area. 
  4881.  
  4882.                     Action:"Expr"  Executes Expression when selected.
  4883.  
  4884.                     Before:"Expr"  Executes Expression, If false prompt
  4885.                                    cannot be selected.
  4886.  
  4887.           Defaults  Row            One row below previous command.  If used
  4888.                                    in brackets in text, defaults to current
  4889.                                    text position.
  4890.  
  4891.                     Col            Same column as previous command.  If
  4892.                                    previous command as Group, column is
  4893.                                    incremented to be inside of the group
  4894.                                    box.  If used in brackets in text,
  4895.                                    defaults to current text position.
  4896.  
  4897.           Highlight Prompts are highlighted when they are active.  Pressing
  4898.                     Enter when highlighted will select the prompt. 
  4899.                     Pressing the space bar will move the cursor downward. 
  4900.  
  4901.           See Also  String.
  4902.  
  4903.           Notes     Prompts are used primarily for Hypertext.  In this
  4904.                     case, they are commonly defined within the text in
  4905.                     curly brackets.  For prompts that are never
  4906.                     highlighted, like screen subtitles or text, see String.
  4907.  
  4908.                     Prompts may also be aligned in a row, producing a menu
  4909.                     bar menu in the middle of a text screen.  You can see
  4910.                     an example of this usage in the opening screen of The
  4911.                     JORF Tutorial, where the hypertext options are a
  4912.                     "Prompt Menu" 
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.           The JORF Manual (Shareware Disk Version)                       76
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.           Example   An enterprising user gave me this program (with a bug
  4928.                     to fix) and I really like it.  Try DOS.J.
  4929.  
  4930.           Dos:Start
  4931.             Win:Add("Jo's DOS Function Utility", 0, 0, 20, 44)
  4932.              This program allows the user to &
  4933.              select special DOS commands.
  4934.  
  4935.              Place your mouse over the desired &
  4936.              selection and click the Left Mouse &
  4937.              Button or you may use the up and down &
  4938.              arrow keys to select the desired command.
  4939.  
  4940.              {Group:"DOS Commands" Row:9 Col:5 Len:10 Wid:30}
  4941.               {Prompt:"&Memory Stats     " Row:11 Col:7 Wid:25 Action:"Dos:Cmd('Mem')"}
  4942.               {Prompt:"&Command Shell    " Row:12 Col:7 Wid:25 Action:"Dos:Cmd('Shell')"}
  4943.               {Prompt:"Directory by &Date" Row:13 Col:7 Wid:25 Action:"Dos:Cmd('DirDate')"}
  4944.               {Prompt:"Directory by &Size" Row:14 Col:7 Wid:25 Action:"Dos:Cmd('DirSize')"}
  4945.               {Prompt:"&Type in a Command" Row:15 Col:7 Wid:25 Action:"Dos:Cmd('TypeIt')"}
  4946.               {Prompt:"&Windows Program  " Row:16 Col:7 Wid:25 Action:"Dos:Cmd('Windows')"}
  4947.               {Prompt:"E&xit             " Row:18 Col:7 Wid:25 Action:"Return(Null)"}
  4948.             Return (Ok)
  4949.  
  4950.           Dos:Cmd(Action)
  4951.             New (Command, Flags, Message)
  4952.             Switch (Action)
  4953.               Case 'Mem'
  4954.                 Command = "Mem /c | More"
  4955.                 Flags = "CP"
  4956.               Case 'Shell'
  4957.                 Command = Null
  4958.                 Flags = "C"
  4959.                 Message = "Type 'EXIT' to return to JORF"
  4960.               Case 'DirDate'
  4961.                 Command = "Dir /o-d | More"
  4962.                 Flags = "CP"
  4963.                 Message = "Sorting . . ."
  4964.               Case 'DirSize'
  4965.                 Command = "Dir /o-s | More"
  4966.                 Flags = "CP"
  4967.                 Message = "Sorting . . ."
  4968.               Case 'TypeIt'
  4969.                 Win:Add
  4970.                   Input:"Command to execute:", Field:"Command"
  4971.                 If (Kbd:Got=='Esc_Key')
  4972.                   Return
  4973.                 Flags = "C"
  4974.               Case 'Windows'
  4975.                 If (Jorf:Info("Windows")==False)
  4976.                   Msg:Add
  4977.                     This option only works in the &
  4978.  
  4979.           Chapter Four - The Window Manager                              77
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.                     Windows version of the JORF interpreter.
  4986.                   Return
  4987.                 Win:Add
  4988.                   Input:"Windows program:", Field:"Command"
  4989.                 If (Kbd:Got=='Esc_Key')
  4990.                   Return
  4991.                 Flags = "W"
  4992.               Else
  4993.                 Msg:Add
  4994.                   Illegal DOS Command "{Action}".
  4995.                 Return (Ok)
  4996.             Jorf:System (Command, Flags, Message)
  4997.             Return (Ok)
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.  
  5027.  
  5028.  
  5029.  
  5030.  
  5031.  
  5032.  
  5033.  
  5034.  
  5035.  
  5036.  
  5037.  
  5038.           The JORF Manual (Shareware Disk Version)                       78
  5039.  
  5040.  
  5041.  
  5042.  
  5043.  
  5044.  
  5045.                                         Radio
  5046.  
  5047.  
  5048.           Command   Radio:"&Prompt"
  5049.  
  5050.           Purpose   A Radio Button.  
  5051.  
  5052.           Options   Row:10         Set row.
  5053.  
  5054.                     Col:10         Set column.
  5055.  
  5056.                     Wid:20         Set width of highlighted prompt.
  5057.  
  5058.                     Check:"Expr"   Box is checked if Expression is True.
  5059.  
  5060.                     Action:"Expr"  Expression is executed when box is
  5061.                                    selected. 
  5062.  
  5063.                     Before:"Expr"  Expression is executed. If false box
  5064.                                    cannot be selected.
  5065.  
  5066.           Defaults  Row            One row below previous command.
  5067.  
  5068.                     Col            Same column as previous command.  If
  5069.                                    previous command as Group, column is
  5070.                                    incremented to be inside the group box.
  5071.  
  5072.                     Wid            Prompt width
  5073.  
  5074.           Highlight Prompt is highlighted when box is selected.  Pressing
  5075.                     Enter will check the box.  Pressing the space bar will
  5076.                     advance the cursor without checking the box. 
  5077.  
  5078.           See Also  ChBox
  5079.  
  5080.           Notes     Radio buttons are circular boxes that contain a dot if
  5081.                     selected and are empty if not selected.  They are
  5082.                     commonly used for selections that are exclusive.  Use
  5083.                     Check boxes for selections that are cumulative. 
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.           Chapter Four - The Window Manager                              79
  5098.  
  5099.  
  5100.  
  5101.  
  5102.  
  5103.  
  5104.                                         String
  5105.  
  5106.  
  5107.           Command   String:"&Prompt"
  5108.  
  5109.           Purpose   An unhighlighted prompt. 
  5110.  
  5111.           Options   Row:10         Set Row
  5112.  
  5113.                     Col:10         Set Column
  5114.  
  5115.           Defaults  Row            One row below previous command.  If used
  5116.                                    in brackets in text, defaults to current
  5117.                                    text position.
  5118.  
  5119.                     Col            Same column as previous command.  If
  5120.                                    previous command as Group, column is
  5121.                                    incremented to be inside of the group
  5122.                                    box.  If used in brackets in text,
  5123.                                    defaults to current text position.
  5124.  
  5125.           Highlight Strings are never highlighted.  If they contain an Alt
  5126.                     key selection, and that key is pressed, the next
  5127.                     following entry item is highlighted. 
  5128.  
  5129.           See Also  Prompt.
  5130.  
  5131.           Notes     Strings are used to place plain text at certain row and
  5132.                     column positions on data entry screens.  Strings are
  5133.                     never highlighted.
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.  
  5156.           The JORF Manual (Shareware Disk Version)                       80
  5157.  
  5158.  
  5159.  
  5160.  
  5161.  
  5162.  
  5163.                                          Text
  5164.  
  5165.  
  5166.  
  5167.           Command   Text:""
  5168.  
  5169.           Purpose   A text input area. 
  5170.  
  5171.           Options   Row:10         Set Row
  5172.  
  5173.                     Col:10         Set Column
  5174.  
  5175.                     Wid:60         Set Width of Data Entry
  5176.  
  5177.                     Len:6          Set Length of Data Entry
  5178.  
  5179.                     After:"Expr"   Expression is executed after input.. 
  5180.  
  5181.                     Before:"Expr"  Expression is executed. If false input
  5182.                                    is skipped. 
  5183.  
  5184.                     Field:"Value"  Field Value to be entered. 
  5185.  
  5186.           Defaults  Row            One row below previous command.  
  5187.  
  5188.                     Col            Same column as previous command.  If
  5189.                                    previous command as Group, column is
  5190.                                    incremented to be inside of the group
  5191.                                    box.
  5192.  
  5193.                     Wid            If previous command was a group box,
  5194.                                    width is set to the inside width of the
  5195.                                    group box.
  5196.  
  5197.                     Len            If previous command was a group box,
  5198.                                    length is set to the inside length of
  5199.                                    the group box.
  5200.  
  5201.           Highlight Text fields are not highlighted like input fields. 
  5202.                     They remain the normal background color, even during
  5203.                     data entry.  The cursor is displayed when a text box is
  5204.                     being edited.  It is not common to prompt Text input
  5205.                     fields. 
  5206.  
  5207.           See Also  Input.
  5208.  
  5209.           Notes     Text fields are similar to input fields, except for the
  5210.                     highlighting.  Word processing is usually easier using
  5211.                     the normal screen color, instead of the field highlight
  5212.                     color.  Text input uses the screen color.
  5213.  
  5214.  
  5215.           Chapter Four - The Window Manager                              81
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.           Example   This is the TextEdit.J sample program, that gives you a
  5223.                     basic text editor in less than 200 lines of source
  5224.                     code.
  5225.  
  5226.           TextEdit:Start(Name)
  5227.             Mem:Ptr->Name = To:Ucs(Name)
  5228.             Mem:Ptr->Edit = TextEdit:Read(Mem:Ptr->Name)
  5229.  
  5230.             Event:Add(Null)                       | Block prior events
  5231.             Event:Add("EditKey")                  | Use standard Edit Keys
  5232.             Event:Add("TextEdit")                 |  and some special ones defined here
  5233.  
  5234.             Jorf:File("TextEdit.Tmp",Here)        | Temporary Storage area
  5235.  
  5236.             If (Name == Null)
  5237.               Kbd:Put("F4_Key")
  5238.  
  5239.             Win:Add("Josephine's Text Editor", 0, 0, 0, 0, Here)
  5240.               Save:"TextEdit:Save"
  5241.               Restore:"Null"
  5242.               Idle:"EditKey:Message"      | When idle - display Row Col info
  5243.               Flrco:"o"                   | No wrap mode
  5244.               Menu:"&File"
  5245.                 Menu:"&New      Shift-F4",    Action:'TextEdit:New'    HotKey:"Shift_F4_Key"
  5246.                 Menu:"&Open           F4",    Action:'TextEdit:Open'   HotKey:"F4_Key"
  5247.                 Menu:"&Save     Shift-F3",    Action:'TextEdit:Save'   HotKey:"Shift_F3_Key"
  5248.                 Menu:"Save &As        F3",    Action:'TextEdit:SaveAs' HotKey:"F3_Key"
  5249.                 Menu:""
  5250.                 Menu:"&Print          F5",    Action:'TextEdit:Print'  HotKey:"F5_Key"
  5251.                 Menu:""
  5252.                 Menu:"A&bout"                 Action:'TextEdit:About'
  5253.                 Menu:"E&xit        Alt-X",    Action:'TextEdit:Exit'   HotKey:"Alt_X_Key"
  5254.               Menu:"&Edit"
  5255.                 Menu:"&Toggle Insert Mode   Ins", Action:'TextEdit:Stuff("Ins_Key")'
  5256.                 Menu:"&Beginning of line   Home", Action:'TextEdit:Stuff("Home_Key")'
  5257.                 Menu:"&End of line          End", Action:'TextEdit:Stuff("End_Key")'
  5258.                 Menu:"Word &Left         Ctrl-A", Action:'TextEdit:Stuff("Ctrl_A_Key")'
  5259.                 Menu:"Word &Right        Ctrl-F", Action:'TextEdit:Stuff("Ctrl_F_Key")'
  5260.                 Menu:"&Delete Word       Ctrl-T", Action:'TextEdit:Stuff("Ctrl_T_Key")'
  5261.                 Menu:"De&lete to End   Ctrl-K Y", Action:'TextEdit:Stuff("Ctrl_K_Key",
  5262.           "Y_Key")'
  5263.               Menu:"&Block"
  5264.                 Menu:"&Beginning  Ctrl-K B",  Action:'TextEdit:Stuff("Ctrl_K_Key","B_Key")'
  5265.                 Menu:"&End        Ctrl-K K",  Action:'TextEdit:Stuff("Ctrl_K_Key","K_Key")'
  5266.                 Menu:"&Delete     Ctrl-K Y",  Action:'TextEdit:Stuff("Ctrl_K_Key","Y_Key")'
  5267.                 Menu:"&Copy       Ctrl-K C",  Action:'TextEdit:Stuff("Ctrl_K_Key","C_Key")'
  5268.                 Menu:"&Move       Ctrl-K V",  Action:'TextEdit:Stuff("Ctrl_K_Key","V_Key")'
  5269.                 Menu:"&Hide       Ctrl-K H",  Action:'TextEdit:Stuff("Ctrl_K_Key","H_Key")'
  5270.               Menu:"&Goto"
  5271.                 Menu:"&Beginning of file  Ctrl-Q R", 
  5272.           Action:'TextEdit:Stuff("Ctrl_Q_Key","R_Key")'
  5273.  
  5274.           The JORF Manual (Shareware Disk Version)                       82
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.                 Menu:"&End of file        Ctrl-Q C", 
  5281.           Action:'TextEdit:Stuff("Ctrl_Q_Key","C_Key")'
  5282.                 Menu:"&Line Number        Ctrl-Q G", 
  5283.           Action:'TextEdit:Stuff("Ctrl_Q_Key","G_Key")'
  5284.               Menu:"&Search"
  5285.                 Menu:"&Find        Ctrl-Q F", Action:'TextEdit:Stuff("Ctrl_Q_Key","F_Key")'
  5286.                 Menu:"Find &Next     Ctrl-L", Action:'TextEdit:Stuff("Ctrl_L_Key")'
  5287.                 Menu:"&Replace     Ctrl-Q A", Action:'TextEdit:Stuff("Ctrl_Q_Key","A_Key")'
  5288.               Text:'', Field:'Mem:Ptr->Edit' Row:1 Col:1 Wid:78 Len:22
  5289.  
  5290.             File:Del("TextEdit.Tmp")              | Delete Storage area
  5291.             Return
  5292.  
  5293.           TextEdit:About
  5294.             Msg:Add ("About TextEdit", "Ok")
  5295.               Version 1.1                              May 11, 1992
  5296.                   Copyright (C) 1991,1992 by The JORF Company
  5297.             Return (Ok)
  5298.  
  5299.           TextEdit:New()
  5300.             If (TextEdit:Save)
  5301.               EditKey:Ctrl_Page_Up_Key
  5302.               Mem:Ptr->Name = Null
  5303.               Mem:Ptr->Edit = Text:Add()
  5304.               Win:Dsp
  5305.             Return (Ok)
  5306.  
  5307.           TextEdit:Open
  5308.             New (Name)
  5309.             Name = DirList:GetFile("*.txt")
  5310.             If (Name)
  5311.               If (TextEdit:Save)
  5312.                 Mem:Ptr->Name = To:Ucs(Name)
  5313.                 Mem:Ptr->Edit = TextEdit:Read (Name)
  5314.                 Win:Dsp
  5315.             Return (Ok)
  5316.  
  5317.           TextEdit:Print()
  5318.             New (Dest)
  5319.             Dest=Jorf:Printer()
  5320.             File:Save("JREPORT.LST",Mem:Ptr->Edit)
  5321.             File:Print("JREPORT.LST",Dest)
  5322.             Return(Ok)
  5323.  
  5324.           TextEdit:Read(FileName)
  5325.             If (FileName)
  5326.               If (File:Exist (FileName))
  5327.                 Win:Add ('Reading')
  5328.                   Loading file "{FileName}"
  5329.                 Return (File:Load (FileName))
  5330.               Else
  5331.                 Msg:Add ('Error', 'Ok')
  5332.  
  5333.           Chapter Four - The Window Manager                              83
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.                   Cannot find file "{FileName}"
  5340.             Return (Text:Add)
  5341.  
  5342.           TextEdit:Save
  5343.             If (Mem:Ptr->Name==Null)
  5344.               TextEdit:SaveAs()
  5345.             Else
  5346.               TextEdit:Write (Mem:Ptr->Name, Mem:Ptr->Edit)
  5347.               Jorf:Del (Win:Ptr->Copy)
  5348.               Win:Ptr->Copied=False
  5349.             Return (Ok)
  5350.  
  5351.           TextEdit:SaveAs
  5352.             New (Key, FileName)
  5353.             FileName = Mem:Ptr->Name
  5354.             While (Ok)
  5355.               Win:Add ('File Name')
  5356.                 Input:'File Name to Save ', Wid:30, Field:'FileName'
  5357.               Win:Del
  5358.               If (Kbd:Got == 'Esc_Key')
  5359.                 Return (Ok)
  5360.               If (FileName != Null)
  5361.                 If (File:Exist (FileName) != 0)
  5362.                   Key=Msg:Add ('File Already Exists' 'No')
  5363.                     File "{FileName}" Already Exists!
  5364.                     Do you want to overwrite it?
  5365.                   If (Key==Null)          | If not ok - loop back to while OK
  5366.                     Continue
  5367.               Break                       | Otherwise break and write file
  5368.             Mem:Ptr->Name = To:Ucs(FileName)
  5369.             TextEdit:Write (Mem:Ptr->Name, Mem:Ptr->Edit)
  5370.             Jorf:Del (Win:Ptr->Copy)
  5371.             Win:Ptr->Copied=False
  5372.             Return (Ok)
  5373.  
  5374.           TextEdit:Stuff (Key1,Key2)
  5375.             Kbd:Put(Key1)
  5376.             Kbd:Put(Key2)
  5377.             Return(Null)
  5378.  
  5379.           TextEdit:Write (FileName, Text)
  5380.             If (FileName And Text)
  5381.               Win:Add ('Writing')
  5382.                 Saving file "{FileName}"
  5383.               File:Save (FileName, Text)
  5384.             Return (Ok)
  5385.  
  5386.  
  5387.  
  5388.  
  5389.  
  5390.  
  5391.  
  5392.           The JORF Manual (Shareware Disk Version)                       84
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.                                      Chapter Five
  5407.                                     JORF Functions
  5408.  
  5409.  
  5410.            
  5411.  
  5412.                                     JORF Functions
  5413.  
  5414.           In JORF, as in all object oriented languages, a Method for one
  5415.           object often invokes a method for another object.  This process
  5416.           continues until finally, a low level object invokes a library
  5417.           routine.  For example the command Print (integer:A) invokes the
  5418.           Integer:Print(A) Method that may then invoke the Number:Print(A)
  5419.           Method that invokes the Jorf:Print(A) Method. At some point,
  5420.           control is passed to the underlying system that prints the data.
  5421.  
  5422.           The JORF Function library is implemented in the C language.  This
  5423.           library is not object oriented nor is it interpreted so there is
  5424.           no ability for polymorphism or inheritance on this level.  JORF
  5425.           Library calls are made without any regard to class or
  5426.           inheritance.  All parameters passed into C language calls are
  5427.           treated as generic JORF pointers, and return values take on the
  5428.           class of the first parameter that was passed in.
  5429.  
  5430.  
  5431.  
  5432.  
  5433.  
  5434.  
  5435.  
  5436.  
  5437.  
  5438.  
  5439.  
  5440.  
  5441.  
  5442.  
  5443.  
  5444.  
  5445.  
  5446.  
  5447.  
  5448.  
  5449.  
  5450.  
  5451.           Chapter Four - The Window Manager                              85
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.                                        Arr:Del
  5459.  
  5460.  
  5461.  
  5462.           Function  Arr:Del ( Array, Position, Count ) 
  5463.  
  5464.           Purpose   Delete Count elements from Array, starting with the
  5465.                     indicated Position. 
  5466.  
  5467.           Returns   Array.
  5468.  
  5469.           See Also  Arr:Ins
  5470.  
  5471.           Notes     Array handling is usually done by referencing
  5472.                     individual array items.  Arrays do not need to be
  5473.                     declared, and are created simply by setting values to
  5474.                     their elements.  Arr functions are used to change the
  5475.                     whole array, without reference to the elements. 
  5476.  
  5477.                     The Arr:Del command may be used to delete one or more
  5478.                     elements in the middle of an array.  It automatically
  5479.                     decrements succeeding elements so the array shrinks in
  5480.                     size by the number of elements deleted. 
  5481.  
  5482.  
  5483.  
  5484.  
  5485.  
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  
  5491.  
  5492.  
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.           The JORF Manual (Shareware Disk Version)                       86
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.                                        Arr:Dir
  5518.  
  5519.  
  5520.  
  5521.           Function  Arr:Dir ( WildCard, Ext_Exclusion_List ) 
  5522.  
  5523.           Purpose   Return an Array of files on the current directory that
  5524.                     match the designated WildCard but are not in the
  5525.                     Extension Exclusion List. 
  5526.  
  5527.           Returns   Array.
  5528.  
  5529.           See Also  Arr:Sort, Arr:Pick, File:ChgDir.
  5530.  
  5531.           Notes     The easiest way to get and display a list of files on
  5532.                     the current directory.  Arr:Dir with no parameters will
  5533.                     get a list of all files on the current directory. 
  5534.  
  5535.                     Files may be read according to the designated wildcard. 
  5536.                     This may be any valid DOS wildcard symbol, just as you
  5537.                     would use from DOS.  The following command makes a list
  5538.                     of all the text files on a directory:
  5539.  
  5540.                                    Arr:Dir("*.TXT")
  5541.  
  5542.                     Files with certain extensions can be excluded by
  5543.                     including them in the extension exclusion list.  This
  5544.                     list is a string with a list of extensions separated by
  5545.                     commas.  Two commas together indicate files without
  5546.                     extensions.  The following command will collect a list
  5547.                     of all files except those with .BAK, .OBJ, .INI or no
  5548.                     extension. 
  5549.  
  5550.                                    Arr:Dir("*.*", "BAK,OBJ,INI,,")    
  5551.  
  5552.                     The Arr:Del command may be used to delete one or more
  5553.                     elements in the middle of an array.  It automatically
  5554.                     decrements succeeding elements so the array shrinks in
  5555.                     size by the number of elements deleted. 
  5556.  
  5557.                     If the WildCard has the value "Subdir", then the file
  5558.                     list will be a list of subdirectories.  Otherwise, it
  5559.                     will only contain files.  
  5560.  
  5561.           Example   The DIRLIST.J program is also compiled into the runtime
  5562.                     system and documented as DirList:GetFile.
  5563.  
  5564.           Class:DirList                   | Class Definition
  5565.             Name                          | File Name
  5566.             Path                          | File Path
  5567.             WildCard                      | Wildcard for directory
  5568.  
  5569.           Chapter Five - JORF Functions                                  87
  5570.  
  5571.  
  5572.  
  5573.  
  5574.  
  5575.             ExclusionList                 | Extension Exclusion List
  5576.             FileArray                     | Array of files on this path
  5577.             DirArray                      | Array of other paths
  5578.  
  5579.           DirList:Start                   | FOR TESTING:  Start routine
  5580.             New (FileName)
  5581.             FileName = DirList:GetFile("*.*",Null)
  5582.             Msg:Add
  5583.               File name is {FileName}
  5584.             Return (Ok)
  5585.  
  5586.           DirList:Cancel(List)            | Routine to Cancel data entry
  5587.             List->Name=Null               | Signal that we canceled
  5588.             Return(Null)                  | Returning Null will finish input
  5589.  
  5590.           DirList:Done(List,Name)         | Routine to finish data entry
  5591.             If (Str:In(List->Name,"*") Or Str:In(List->Name,"?"))
  5592.               List->WildCard  = List->Name
  5593.               List->FileArray = DirList:FileArray(List->Wildcard, List->Exclusionlist)
  5594.               Kbd:Put("Home_Key")       | Stuff home key
  5595.               Win:Dsp                   | Redisplay (including arrays)
  5596.               Return (Ok)
  5597.             If (List->Name==Null)         | If name is still null display message
  5598.               Msg:Add
  5599.                 Please select a file
  5600.                 name or "Cancel".
  5601.               Return (Ok)                 | Returning Ok will continue input
  5602.             Return (Null)                 | Returning Null will finish input
  5603.  
  5604.           DirList:FileArray(WildCard,Exclusionlist)  | Read a file array
  5605.             New (Array,OldMessage)
  5606.             If (WildCard!='SUBDIR')
  5607.               If (Win:Ptr)
  5608.                 OldMessage = Win:Msg('Reading Directory')
  5609.               Else
  5610.                 Win:Add("Reading")
  5611.              Reading Directory
  5612.             Array = Arr:Dir (WildCard, ExclusionList, 12)
  5613.             If (WildCard!='SUBDIR')
  5614.               Win:Msg(OldMessage)
  5615.             Return (Array)
  5616.  
  5617.           DirList:GetFile(WildCard,ExclusionList)
  5618.             New (OrigPath, DirList:List, DirChoice, FileChoice)
  5619.  
  5620.             | Initalize values
  5621.             OrigPath            = File:ChDir()
  5622.             List->Path          = OrigPath
  5623.             List->WildCard      = WildCard
  5624.             List->ExclusionList = Exclusionlist
  5625.             List->FileArray     = DirList:FileArray(List->Wildcard, List->Exclusionlist)
  5626.             List->DirArray      = DirList:FileArray("SUBDIR")
  5627.  
  5628.           The JORF Manual (Shareware Disk Version)                       88
  5629.  
  5630.  
  5631.  
  5632.  
  5633.  
  5634.             Event:Add(Null)               | Block prior keystroke events
  5635.             Win:Add ("Get File Name", 0, 0, 10, 56, Here)
  5636.               Type:"Message"
  5637.  
  5638.               | Input File Name
  5639.               Input:"File&name:  ",  Wid:24, Row:2, Col:3, Field:"List->Name"
  5640.  
  5641.               | Files array with a group box around
  5642.               Group:"&Files",       Row:6, Col:2, Wid:16, Len:10
  5643.               Array:"", Field:"List->FileArray",
  5644.                         Choice:"FileChoice",
  5645.                         Action:"DirList:NewName(List,List->FileArray[FileChoice])"
  5646.  
  5647.               | Directories array with a group box around
  5648.               Group:"&Directories", Row:6, Col:22, Wid:16, Len:10
  5649.               Array:"", Field:"List->DirArray",
  5650.                         Choice:"DirChoice"
  5651.                         Action:"DirList:NewDir(List,List->DirArray[DirChoice])"
  5652.               | Input File Path
  5653.               Input:"Directory: ",   Wid:24, Row:4, Col:3, Field:"List->Path"
  5654.                    After:"DirList:NewDir(List,List->Path)"
  5655.               | Two buttons
  5656.               Button:"   &Ok   ", Row:1, Col:42, Wid:14
  5657.                 Action:"DirList:Done(List,List->FileArray[FileChoice])"
  5658.               Button:" &Cancel ", Row:4, Col:42, Wid:14
  5659.                 Action:"DirList:Cancel(List)"
  5660.  
  5661.             If (File:ChDir(OrigPath))
  5662.               If (List->Name)
  5663.                 If (Str:At(List->Path,Str:Len(List->Path),1)=='\')
  5664.              Return (List->Path+List->Name)
  5665.                 Return (List->Path+'\'+List->Name)
  5666.             Return (Null)
  5667.  
  5668.           DirList:NewDir(List,Path)       | Routine to set a new path
  5669.             If (File:Chdir(Path))         | Change to the new path
  5670.               List->Path = File:ChDir()   | Reset path name
  5671.               List->Name = Null           | Set file name to null
  5672.               | Re-read file array
  5673.               List->FileArray = DirList:FileArray(List->Wildcard, List->Exclusionlist)
  5674.               | Re-Read directory array - special argument "SUBDIR" does this
  5675.               List->DirArray  = DirList:FileArray("SUBDIR")
  5676.               Win:Dsp                     | Redisplay Window
  5677.             Return(Ok)                    | Returning Ok continues input
  5678.  
  5679.           DirList:NewName(List,Name)      | Routine to set a new name
  5680.             List->Name = Word:At(Name,1)  | Set the name (Easy!)
  5681.             Win:Dsp                       | Redisplay the screen
  5682.             Kbd:Put("Home_Key")         | And go back to file name
  5683.             Return(Ok)                    | Returning OK will continue input
  5684.  
  5685.  
  5686.  
  5687.           Chapter Five - JORF Functions                                  89
  5688.  
  5689.  
  5690.  
  5691.  
  5692.  
  5693.  
  5694.                                        Arr:Ins
  5695.  
  5696.  
  5697.  
  5698.           Function  Arr:Ins ( Array, Position, Count ) 
  5699.  
  5700.           Purpose   Insert Count elements into Array, starting with the
  5701.                     indicated Position. 
  5702.           Returns   Array.
  5703.  
  5704.           See Also  Arr:Del
  5705.  
  5706.           Notes     Array handling is usually done by referencing
  5707.                     individual array items.  Arrays do not need to be
  5708.                     declared, and are created simply by setting values to
  5709.                     their elements.  Arr functions are used to change the
  5710.                     whole array, without reference to the elements. 
  5711.  
  5712.                     The Arr:Ins command may be used to insert one or more
  5713.                     elements in the middle of an array.  It automatically
  5714.                     increments succeeding elements so the array grows in
  5715.                     size by the number of elements inserted. 
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.  
  5746.           The JORF Manual (Shareware Disk Version)                       90
  5747.  
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.                                        Arr:Len
  5754.  
  5755.  
  5756.  
  5757.           Function  Arr:Len ( Array ) 
  5758.  
  5759.           Purpose   Returns the highest offset in the array. 
  5760.  
  5761.           Returns   Integer Offset.
  5762.  
  5763.           See Also  Word:Len
  5764.  
  5765.           Notes     Returns the length of an array.  Actually, returns the
  5766.                     offset of the highest element of the array, which is
  5767.                     also the length if the first element is element number
  5768.                     1. 
  5769.  
  5770.                     Arrays may contain element 0, and also negative
  5771.                     elements.  If this is the case, the actual length may
  5772.                     be longer than the value of this command. 
  5773.  
  5774.           Example   This program is pretty old, written before there were
  5775.                     buttons and a nice window manager.  For that reason, it
  5776.                     shows pretty well the Arr:Len and Arr:Pick commands
  5777.                     that are hidden when you use DirList:GetFile.
  5778.  
  5779.           Dump:Start
  5780.             New (WildCard, FileList, Choice)
  5781.             New (FileName, Char, Length, Pos, Col)
  5782.  
  5783.             While (Ok)
  5784.               | First get a wildcard for dir command
  5785.               Win:Add ("Dump a File")
  5786.                 Input:"Directory WildCard: ", Field:"WildCard"
  5787.               If (Kbd:Got = 'Esc_Key')
  5788.                 Return
  5789.  
  5790.               | Read the directory
  5791.               Win:Add("Reading Directory")
  5792.                 One Moment Please . . .
  5793.               FileList  = Arr:Dir(WildCard)
  5794.               If Arr:Len(FileList) < 1
  5795.                 Msg:Add
  5796.                   No Files match the WildCard!
  5797.               Else
  5798.                 While FileList != Null
  5799.                   | And ask to pick a file
  5800.                   Choice   = Arr:Pick(FileList,Null,"Dump File", 0, 0, 0, Choice)
  5801.              If Kbd:Got = 'Esc_Key'
  5802.                     Break
  5803.  
  5804.  
  5805.           Chapter Five - JORF Functions                                  91
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.                   | Got a file name!
  5812.                   FileName = FileList[Choice]
  5813.                   FileName = Str:At (FileName 1, Str:In(FileName," "))
  5814.                   Length   = File:Len (FileName)
  5815.                   Pos      = 0
  5816.  
  5817.                   Win:Add (FileName, 2, 8, (Length/16)+2, 78, Here)
  5818.  
  5819.                   While (Pos < Length)
  5820.                     Col = (Pos % 16)     | Set column position
  5821.                     If (Col == 0)        | If beginning new line
  5822.                       If (Pos > 0)       | If after first line
  5823.                         Move:By (1,0)    | Start a new line
  5824.                         Move:To (0,1)    |
  5825.                       Str:Put (To:Str(Pos,"0000:0000",16))
  5826.                     ++Pos
  5827.                     | Read One Character
  5828.                Char = File:Read (FileName,1,Pos)
  5829.                     | And Display It . . .
  5830.                     Move:To (0,13+(Col*3))
  5831.                     Str:Put (To:Str(To:Ascii(Char),'00',16))
  5832.                     Move:To (0,62+Col)
  5833.                     Char:Put (To:Ascii(Char))
  5834.                If Kbd:Hit           | If key hit
  5835.                  Char = Kbd:Get     | See What it is
  5836.                       If Char = "Esc_Key"| If Escape
  5837.                         Break            |      Break
  5838.                       Win:Pause          |   Pause
  5839.                   Str:PutLine            | One more line
  5840.                   Str:PutLine            | One more line
  5841.                   Win:Msg("End of File") | Done!
  5842.                   Win:Pause              | Wait
  5843.                   Win:Del                | Delete window
  5844.                 Win:Del
  5845.               Win:Del
  5846.               Win:Del
  5847.             Return                       | Exit
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.           The JORF Manual (Shareware Disk Version)                       92
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.                                        Arr:Pick
  5872.  
  5873.  
  5874.           Function  Arr:Pick (Array, Command, Title, Row, Column, Length,
  5875.                     Default)
  5876.  
  5877.           Purpose   Display a browser menu of array items with Title, at
  5878.                     Row and Column, no longer than Length and highlighting
  5879.                     Default.
  5880.  
  5881.           Returns   Integer offset of selection or "Esc_Key".
  5882.  
  5883.           See Also  Arr:Sort
  5884.  
  5885.           Notes     One of the more powerful JORF command, this is what
  5886.                     displays the file list when you start the JORF
  5887.                     interpreter, and also what displays the debugger Alt-B
  5888.                     browser lists. 
  5889.  
  5890.                     This command returns Null, if Array is blank or not an
  5891.                     array.  All other parameters may be omitted.
  5892.  
  5893.                     The Length is only the maximum to display.  If the
  5894.                     array is shorter, then the menu length will be the
  5895.                     length of the array.  If the array is longer, then it
  5896.                     will scroll automatically. 
  5897.  
  5898.                     The Array pick does not set or block keystroke events,
  5899.                     and existing events often interfere with array
  5900.                     selection.  To prevent this, it is typical to include
  5901.                     do Event:Add with no parameters before calling
  5902.                     Arr:Pick.  Adding a null keystroke event blocks
  5903.                     processing from searching down the stack to process
  5904.                     lower level keystroke events.
  5905.  
  5906.                     Menu options are displayed as strings.  Both Arr:Pick
  5907.                     and Arr:Sort make use of a polymorphic Command to get
  5908.                     the value of these strings.  If command is Null, the
  5909.                     normal string value is used. For structures, you can
  5910.                     set up a method that returns a string that represents
  5911.                     that structure.  for instance, the Address structure
  5912.                     may show Name, City and State:
  5913.  
  5914.                     Class:Address, Name, Addr1, Addr2, City, State, Zip
  5915.  
  5916.                     Address:Show(Addr)
  5917.                       Return (Str:Pad (Addr->Name, 30)+" "+Addr->City+", "+Addr->Zip)
  5918.  
  5919.           Example   See Arr:Len and the Dump.J sample program.
  5920.  
  5921.  
  5922.  
  5923.           Chapter Five - JORF Functions                                  93
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.                                      Arr:Printers
  5931.  
  5932.  
  5933.           Function  Arr:Printers
  5934.  
  5935.           Purpose   Return an Array of available printers. 
  5936.  
  5937.           Returns   Array.
  5938.  
  5939.           See Also  Arr:Pick, Jorf:Printer and JORF.INI documentation in
  5940.                     Appendix D.
  5941.  
  5942.           Notes     This command reads the printers listed in your JORF.INI
  5943.                     or JORFWIN.INI file and creates an array.  You can use
  5944.                     this array on a data entry screen or with the Arr:Pick
  5945.                     function.  
  5946.  
  5947.                     Each entry can be assumed to be a string that contains
  5948.                     a description, and a printer designation.   The printer
  5949.                     is assumed to be the last word of the command.
  5950.  
  5951.           Example   This is not a sample program, but the actual code that
  5952.                     is converted to C and run when you use the Jorf:Printer
  5953.                     function.  If you wish, you can type it in quickly to
  5954.                     play with it to make your own printer selection menu.
  5955.  
  5956.            
  5957.                     Jorf:Printer
  5958.                       New (PrintList,PrintChoice,Dest)
  5959.  
  5960.                       Event:Add()
  5961.                       PrintList = Arr:Printers()
  5962.                       Win:Add("Select Printer")
  5963.                         Group:"&Printers", Row:1 Col:1 Len:6 Wid:22
  5964.                         Array:"" Field:"PrintList" Choice:"PrintChoice"
  5965.  
  5966.                         Button:"   &Go   " Row:1 Col:32
  5967.                           Action:"Dest=PrintList[PrintChoice]"
  5968.                         Button:" &Cancel " Row:4 Col:32 Action:"Return ('Esc_Key')"
  5969.                       If (Dest='Esc_Key' Or Kbd:Got='Esc_Key')
  5970.                         Dest=Null
  5971.                       Return(Dest)
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.           The JORF Manual (Shareware Disk Version)                       94
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.                                        Arr:Sort
  5990.  
  5991.  
  5992.  
  5993.           Function  Arr:Sort ( Array, Command, Direction ) 
  5994.  
  5995.           Purpose   Sort the elements of an array. 
  5996.  
  5997.           Returns   Array. 
  5998.  
  5999.           Notes     The only sort command in the JORF language.  Normally
  6000.                     sorts elements in ascending order.  You can sort
  6001.                     descending by specifying a Direction of "Down" or
  6002.                     "Descending" (or anything that begins with the letter
  6003.                     'D'). 
  6004.  
  6005.                     Arr:Sort makes use of a polymorphic Command to get the
  6006.                     string value of the array element.  If this is Null
  6007.                     then the string value is used.  If not null, the
  6008.                     Command should be a method that takes exactly one
  6009.                     parameter.  The parameter will be filled with the value
  6010.                     being sorted.   The method must return a string value
  6011.                     that represents the sort index value.
  6012.  
  6013.                     Class:Address, Name, Addr1, Addr2, City, State, Zip
  6014.  
  6015.                     Address:SortString(Addr)
  6016.                          Return (Addr->Name)
  6017.  
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.           Chapter Five - JORF Functions                                  95
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.           Example   For normal use, see Arr:Len and the Dump.J sample
  6049.                     program.   For use of Arr:Sort with a Command, the
  6050.                     Help.J program uses this combination to sort an array
  6051.                     of structure pointers.   Here are a coupe methods from
  6052.                     that program.
  6053.  
  6054.           Class:Help (Index:Help, Array, A1, A2, A3)
  6055.  
  6056.           Class:HelpArr (Name Array)
  6057.  
  6058.           Help:CatName(Harr)
  6059.             Return (Harr->Name)
  6060.  
  6061.           Help:Load()
  6062.             New (Rule:Rule, Help:HelpPtr, Name, Pos)
  6063.  
  6064.             HelpPtr->Help = "Help"
  6065.             Jorf:Write (HelpPtr)
  6066.  
  6067.             Rule->Obj="Help"
  6068.             Rule->Prob=100
  6069.             Rule->Type=121
  6070.             Rule->KLen=1
  6071.             Win:Add ("Loading Help Information")
  6072.             While (Ok)
  6073.               Rule:Next (Rule)
  6074.               If (Rule->Fnd)
  6075.                 Name = Word:At(Rule->Ptr,1)
  6076.                 Str:Put (Name)
  6077.                 Str:Put (" - ")
  6078.                 Switch
  6079.                   Case Str:In (Name, ":")
  6080.                     Help:PutEntry(HelpPtr,Null,Name)
  6081.                   Case Str:Len (Name) <= 2 Or Str:In(Name,"or")
  6082.                     Help:PutEntry(HelpPtr,"[Math]",Name)
  6083.                   Case Str:Len (Name), < 4
  6084.                   Case Str:In  (Name, "/")
  6085.                   Case Str:In  ("True False Return Else Null Here", (Name) )
  6086.                     Help:PutEntry(HelpPtr,"[Control]",Name)
  6087.                   Case (Str:Len (Name) > 0)
  6088.                     Help:PutEntry(HelpPtr,"[Win]",Name)
  6089.               Else
  6090.                 Break
  6091.             Arr:Sort(HelpPtr->Array,"Help:CatName")
  6092.             Jorf:Write(HelpPtr)
  6093.             Return (HelpPtr)
  6094.  
  6095.  
  6096.  
  6097.  
  6098.  
  6099.  
  6100.           The JORF Manual (Shareware Disk Version)                       96
  6101.  
  6102.  
  6103.  
  6104.  
  6105.  
  6106.  
  6107.                                        Char:Del
  6108.  
  6109.  
  6110.           Function  Char:Del ( Count ) 
  6111.  
  6112.           Purpose   Delete Count characters in the current window at the
  6113.                     current cursor position.
  6114.  
  6115.           Returns   None.
  6116.  
  6117.           See Also  Char:Ins
  6118.  
  6119.           Notes     This command does two specific things;  1) it deletes
  6120.                     Count characters at the current location in the current
  6121.                     window, and 2) it deletes Count characters in the line
  6122.                     currently being edited.  The line edit buffer is
  6123.                     separate from the screen, although they usually reflect
  6124.                     the same data.
  6125.  
  6126.                     The line and paragraph may rewrap if the window Magic
  6127.                     is True and the window FLRCO is not "Off".
  6128.  
  6129.           Example   The Charex.J sample program shows one way to use the
  6130.                     Char:Ins and Char:Del functions.  Because these
  6131.                     functions operate only on the screen, they are most
  6132.                     appropriate to methods that change text that is being
  6133.                     edited on the screen.
  6134.  
  6135.                     CharEx:Start 
  6136.                       New Count, Str1, Str2 
  6137.                       Str1="This Text will Disappear" 
  6138.                       Str2="This Text will Appear" 
  6139.                       Win:Add ("Char Example", 10, 25, 30, 2, Here)
  6140.                       Str:Put (Str1)          | Show Str1 
  6141.                       Win:Pause (20)          | And pause for Effect 
  6142.                       Count = Str:Len (Str1)  | Set Counter 
  6143.                       While (Count > 0)       | While GT Zero 
  6144.                         Move:To (1,1)         |   First line 
  6145.                         Char:Del (1)          |   Take 1 Away 
  6146.                         Move:To (2,1)         |   Second line 
  6147.                         Char:Ins (1)          |   Add one, Add char 
  6148.                         Char:Put (To:Ascii (Str:At (Str2, Count, 1)))
  6149.                         --Count               |   Decrement Count 
  6150.                         Win:Pause(5)          |   Pause 5/100 seconds 
  6151.                       Win:Pause               | Done! 
  6152.                       Return                  | Bye 
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.           Chapter Five - JORF Functions                                  97
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.  
  6166.                                        Char:Get
  6167.  
  6168.  
  6169.           Function  Char:Get
  6170.  
  6171.           Purpose   Gets a character displayed on the current window.  
  6172.  
  6173.           Returns   ASCII decimal value of the character.
  6174.  
  6175.           See Also  Char:Put.
  6176.  
  6177.           Notes     To get a keystroke value, use Kbd:Get.  This function
  6178.                     reads the value off the screen, assuming that you put
  6179.                     something there worth reading.  The value returned is
  6180.                     numeric, because the most common use of this function
  6181.                     is to handle OEM characters.  This command is
  6182.                     symmetrical to Char:Put.
  6183.  
  6184.  
  6185.  
  6186.  
  6187.  
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.           The JORF Manual (Shareware Disk Version)                       98
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.                                        Char:Ins
  6226.  
  6227.  
  6228.  
  6229.           Function  Char:Ins ( Count ) 
  6230.  
  6231.           Purpose   Insert Count spaces in the current window at the
  6232.                     current cursor position.
  6233.  
  6234.           Returns   None.
  6235.  
  6236.           See Also  Char:Del
  6237.  
  6238.           Notes     This command does two specific things;  1) it inserts
  6239.                     Count spaces at the current location in the current
  6240.                     window, and 2) it inserts Count spaces in the line
  6241.                     currently being edited.  The line edit buffer is
  6242.                     separate from the screen, although they usually reflect
  6243.                     the same data.
  6244.  
  6245.                     If the line length exceeds the window boundary, and
  6246.                     window is in one of the wrap modes, the line and
  6247.                     paragraph will be reformatted.  This formatting takes
  6248.                     place only on the screen, and not in the edit buffer.
  6249.  
  6250.           Example   See Char:Del. 
  6251.  
  6252.  
  6253.  
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.           Chapter Five - JORF Functions                                  99
  6278.  
  6279.  
  6280.  
  6281.  
  6282.  
  6283.  
  6284.                                        Char:Put
  6285.  
  6286.  
  6287.  
  6288.           Function  Char:Put ( Value ) 
  6289.  
  6290.           Purpose   Put an ASCII character on the current window at the
  6291.                     current cursor location.
  6292.  
  6293.           Returns   None.
  6294.  
  6295.           See Also  Char:Get, Str:Put.
  6296.  
  6297.           Notes     It is atypical for a JORF Language function to use
  6298.                     ASCII values for characters.  Usually, characters are
  6299.                     strings and are displayed using Str:Put.  However, some
  6300.                     graphics characters are easier to display as numbers
  6301.                     because they have no letter equivalent.  
  6302.  
  6303.                     This function is buffered for speed.  Calling this
  6304.                     function sets the internal buffer, but the buffer is
  6305.                     not shown on the screen until the line is finished. You
  6306.                     can force a display by changing to another line using
  6307.                     Move:To or by ending the line using Str:PutLine.
  6308.  
  6309.           Example
  6310.  
  6311.  
  6312.           Ascii:Start
  6313.             New Char
  6314.             Win:Add("ASCII TABLE", 4, 4, 19, 74, Here)
  6315.  
  6316.             For (Char = 0 Thru 15)
  6317.               Move:To(1,(Char*4)+10)
  6318.               Str:Put(To:Str(Char))
  6319.               Move:To(Char+3,1)
  6320.               Str:Put(To:Str(Char*16))
  6321.  
  6322.             Move:To(2,1)
  6323.             Win:Attr("Lo")
  6324.             For (Char = 0 Thru 255)
  6325.               If ((Char % 16) == 0)
  6326.                 Move:By(1,0)
  6327.                 Move:To(0,10)
  6328.               Char:Put(Char)
  6329.               Move:By(0,3)
  6330.             Win:Msg("Press Enter to Continue")
  6331.             Win:Pause
  6332.  
  6333.  
  6334.  
  6335.  
  6336.           The JORF Manual (Shareware Disk Version)                      100
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.                                        Class:At
  6344.  
  6345.           Function  Class:At ( Structure Position ) 
  6346.  
  6347.           Purpose   Returns class of word in parsed command line, or label
  6348.                     of a structure member. 
  6349.  
  6350.           Returns   Class.
  6351.  
  6352.           See Also  Class:AtPut, Word:At.
  6353.  
  6354.           Notes     Structures, Arrays, the JORF stack, and lines of text
  6355.                     are all stored as arrays of Class:Word pairs.  The
  6356.                     number of words in the array can be obtained using
  6357.                     Word:Len.
  6358.  
  6359.                                       Structures
  6360.  
  6361.                     Normally, you access structure elements using the
  6362.                     pointer operator (->).  However, you can also use this
  6363.                     command to referencing the elements directly.  
  6364.  
  6365.                                         Stack
  6366.  
  6367.                     Each level of the stack (each method call) creates a
  6368.                     new structure.  The first element has the class Method
  6369.                     and is the current program line.  The second element
  6370.                     has the class From and is the previous level of the
  6371.                     stack.  The next elements are the parameters in the
  6372.                     order they were passed.  Then, any New variables with
  6373.                     the variable name standing for the class name.
  6374.  
  6375.                                       New Values
  6376.  
  6377.                     New values that are structures contain a pointer to the
  6378.                     class definition in the first element.  Subsequent
  6379.                     elements are various values in the order that they were
  6380.                     referenced.  
  6381.  
  6382.                                         Arrays
  6383.  
  6384.                     Array elements are normally accessed using square
  6385.                     brackets [].  But if you find reason, you can use
  6386.                     Word:At to get the element.  Unlike Structures, array
  6387.                     elements have no label, so the class will always be
  6388.                     null.   Using Class:At is legal, but will always return
  6389.                     null unless you used Class:AtPut to put a value there.
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.           Chapter Five - JORF Functions                                 101
  6396.  
  6397.  
  6398.  
  6399.  
  6400.  
  6401.                                          Text
  6402.  
  6403.                     Text lines may be examined to obtain the class and
  6404.                     values of items on that line.  The line is
  6405.                     automatically parsed when Class:At is used.  The parse
  6406.                     will automatically separate all words and punctuation
  6407.                     characters.  Each punctuation character is treated as a
  6408.                     separate word.  If the parsed line contains JORF-like
  6409.                     Class:Word pairs, then the class values will be set for
  6410.                     Class:At.
  6411.  
  6412.  
  6413.  
  6414.  
  6415.  
  6416.  
  6417.  
  6418.  
  6419.  
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.           The JORF Manual (Shareware Disk Version)                      102
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.                                      Class:AtPut
  6462.  
  6463.  
  6464.           Function  Class:AtPut ( Structure, Position, Class ) 
  6465.  
  6466.           Purpose   Changes the class of a word in a member of a structure.
  6467.  
  6468.  
  6469.           Returns   None.
  6470.  
  6471.           See Also  Class:At, Word:AtPut.
  6472.  
  6473.           Notes     Structures, Arrays, the JORF Stack and text lines are
  6474.                     all stored as an array of Class:Word pairs.  The number
  6475.                     of words can be obtained using Word:Len.  Although
  6476.                     Class:At works for both text and structures,
  6477.                     Class:AtPut works only on structures, not text lines. 
  6478.                     To change a text line, you must use the String
  6479.                     functions.
  6480.  
  6481.                     Class:AtPut can be used to change an element name in a
  6482.                     structure, or a variable name in the stack.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.           Chapter Five - JORF Functions                                 103
  6514.  
  6515.  
  6516.  
  6517.  
  6518.  
  6519.  
  6520.                                        Class:In
  6521.  
  6522.  
  6523.           Function  Class:In ( Structure, Class ) 
  6524.  
  6525.           Purpose   Searches for the existence of Class in a structure, and
  6526.                     returns the position if it is found.  Returns zero if
  6527.                     Class is not found.
  6528.  
  6529.           Returns   Position of Class or zero if not found.
  6530.  
  6531.           See Also  Class:At, Word:In.
  6532.  
  6533.           Notes     Both structures and text lines are stored as an array
  6534.                     of Class:Word pairs.  The number of words can be
  6535.                     obtained using Word:Len.  ClassIn can be used to see if
  6536.                     a member exists in a structure, without using the
  6537.                     structure pointer operator.
  6538.  
  6539.  
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.           The JORF Manual (Shareware Disk Version)                      104
  6573.  
  6574.  
  6575.  
  6576.  
  6577.  
  6578.  
  6579.                                        Date:Add
  6580.  
  6581.  
  6582.           Function  Date:Add ( Date, Days, Months, Years )  
  6583.  
  6584.           Purpose   Add the specified Days, Months, or Years to Date.
  6585.  
  6586.           Returns   A date.
  6587.  
  6588.           See Also  Date:Sub, Time:Add.
  6589.  
  6590.           Notes     This is a very specialized command that helps you
  6591.                     calculate one month after, or 90 days after a date. 
  6592.                     This command does all the  necessary calculations to
  6593.                     account for month lengths and leap years.  
  6594.                     Adding one month to 03/31 will result in 05/01, and not
  6595.                     04/30 as some people anticipate.
  6596.  
  6597.           Example   The CAL.J program displays a calendar and uses Date:Add
  6598.                     to add months as you press page down.
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.  
  6608.  
  6609.  
  6610.  
  6611.  
  6612.  
  6613.  
  6614.  
  6615.  
  6616.  
  6617.  
  6618.  
  6619.  
  6620.  
  6621.  
  6622.  
  6623.  
  6624.  
  6625.  
  6626.  
  6627.  
  6628.  
  6629.  
  6630.  
  6631.           Chapter Five - JORF Functions                                 105
  6632.  
  6633.  
  6634.  
  6635.  
  6636.  
  6637.  
  6638.  
  6639.           Class:Cal      | Declare class Calc
  6640.             Date         |
  6641.             Day          | Current day
  6642.             Month        | Current entry value
  6643.             Year         | Current year
  6644.             Row          | Current Row
  6645.             Col          | Current Col
  6646.             DspDay       | Last displayed day
  6647.             DspMonth     | Last displayed month
  6648.             DspYear      | Last displayed year
  6649.             DspRow       | Last displayed row
  6650.             DspCol       | Last displayed col
  6651.  
  6652.           Cal:start
  6653.             New(Cal:Cal)
  6654.             Cal->Date   = Date:Get
  6655.             Event:Add("Cal")
  6656.  
  6657.             Win:Add ("Calendar",0,0,9,20)
  6658.             Cal:Show(Cal)
  6659.             While (Ok)
  6660.               If (Kbd:Get()=='Esc_Key')
  6661.                 Break
  6662.             Return (Cal->Date)
  6663.  
  6664.           Cal:Ctrl_Page_Down_Key
  6665.             Cal->Date = Date:Add(Cal->Date,0,0,1)
  6666.             Cal:Show( Cal )
  6667.             Return (Ok)
  6668.  
  6669.           Cal:Ctrl_Page_Up_Key
  6670.             Cal->Date = Date:Sub(Cal->Date,0,0,1)
  6671.             Cal:Show( Cal )
  6672.             Return (Ok)
  6673.  
  6674.           Cal:Down_Arrow_Key
  6675.             Cal->Date = Date:Add(Cal->Date,7,0,0)
  6676.             Cal:Show( Cal )
  6677.             Return (Ok)
  6678.  
  6679.           Cal:End_Key
  6680.             Cal->Date = Date:Add(Cal->Date,6-(Date:Str(Cal->Date,'n')%7),0,0)
  6681.             Cal:Show( Cal )
  6682.             Return (Ok)
  6683.  
  6684.           Cal:Enter_Key
  6685.             Msg:Add
  6686.               Date is {Cal->Date}
  6687.             Return ("Esc_Key")
  6688.  
  6689.  
  6690.           The JORF Manual (Shareware Disk Version)                      106
  6691.  
  6692.  
  6693.  
  6694.  
  6695.  
  6696.           Cal:Home_Key
  6697.             Cal->Date = Date:Sub(Cal->Date,(Date:Str(Cal->Date,'n')%7),0,0)
  6698.             Cal:Show( Cal )
  6699.             Return (Ok)
  6700.  
  6701.           Cal:Left_Arrow_Key
  6702.             Cal->Date = Date:Sub(Cal->Date,1,0,0)
  6703.             Cal:Show( Cal )
  6704.             Return (Ok)
  6705.  
  6706.           Cal:Page_Down_Key
  6707.             Cal->Date = Date:Add(Cal->Date,0,1,0)
  6708.             Cal:Show( Cal )
  6709.             Return (Ok)
  6710.  
  6711.           Cal:Page_Up_Key
  6712.             Cal->Date = Date:Sub(Cal->Date,0,1,0)
  6713.             Cal:Show( Cal )
  6714.             Return (Ok)
  6715.  
  6716.           Cal:Right_Arrow_Key
  6717.             Cal->Date = Date:Add(Cal->Date,1,0,0)
  6718.             Cal:Show( Cal )
  6719.             Return (Ok)
  6720.  
  6721.           Cal:Show(Cal)
  6722.             New (Month, Day, Dow, Pos, Cnt, End)
  6723.  
  6724.             If (Date:Str(Cal->Date,'y') != Cal->DspYear)
  6725.               Cal->DspMonth=0
  6726.  
  6727.             If (Date:Str(Cal->Date,'m') != Cal->DspMonth)
  6728.               If (Cal->DspDay)
  6729.                 Move:To(Cal->DspRow,Cal->DspCol)
  6730.                 Str:Put(To:Str(Cal->DspDay,"##"))
  6731.                 Cal->DspDay=0
  6732.               Month=Date:Str(Cal->Date,"S")+' '+Date:Str(Cal->Date,"YYYY")
  6733.               Move:To(1,1)
  6734.               Str:Put(Str:AtSet(Null,1,' ',Win:Ptr->Wid))
  6735.               Move:To(1,(Win:Ptr->Wid-Str:Len(Month)+1)/2)
  6736.               Str:Put(Month)
  6737.               Move:To(2,1)
  6738.               Str:Put("____________________")
  6739.               Move:To(3,1)
  6740.               Str:Put("Su Mo Tu We Th Fr Sa")
  6741.               Dow  =Date:Str(Cal->Date,'n') % 7
  6742.               Day  =Date:Str(Cal->Date,'d')
  6743.               End  =Date:Add(Cal->Date,0,1)
  6744.               End  =Date:Sub(End,Day)
  6745.               End  =Date:Str(End,'d')
  6746.               Pos  =Date:Str(Date:Sub(Cal->Date,Day-1),'n') % 7
  6747.               Move:To (4,1)
  6748.  
  6749.           Chapter Five - JORF Functions                                 107
  6750.  
  6751.  
  6752.  
  6753.  
  6754.  
  6755.               Str:Put(Str:AtSet(Null,1,' ',Win:Ptr->Wid))
  6756.               For (Cnt = 1 thru End)
  6757.                 Move:To(0,(Pos*3)+1)
  6758.                 Str:Put(To:Str(Cnt,"##"))
  6759.                 ++Pos
  6760.                 If (Pos > 6)
  6761.                   Move:By(1,0)
  6762.                   Move:To(0,1)
  6763.                   Str:Put(Str:AtSet(Null,1,' ',Win:Ptr->Wid))
  6764.                   Move:To(0,1)
  6765.                   Pos=0
  6766.               If (Pos == 0 Or Win:Ptr->CurRow < 9)
  6767.                 Move:To (9,1)
  6768.                 Str:Put(Str:AtSet(Null,1,' ',Win:Ptr->Wid))
  6769.               Cal->DspYear  = Date:Str( Cal->Date, 'y' )
  6770.               Cal->DspMonth = Date:Str( Cal->Date, 'm' )
  6771.               Cal->DspDay   = 0
  6772.  
  6773.             If (Date:Str(Cal->Date,'d') != Cal->DspDay)
  6774.               If (Cal->DspDay)
  6775.                 Move:To(Cal->DspRow,Cal->DspCol)
  6776.                 Str:Put(To:Str(Cal->DspDay,"##"))
  6777.                 Cal->DspDay=0
  6778.               Day  =Date:Str( Cal->Date, 'd' )
  6779.               Dow  =Date:Str( Cal->Date, 'n' ) % 7
  6780.               Cal->DspDay = Day
  6781.               Cal->DspRow = 4 + To:Int( ( Day - Dow + 5) / 7 )
  6782.               Cal->DspCol = ( Dow * 3 ) + 1
  6783.  
  6784.               Win:Attr( 5 )
  6785.               Move:To( Cal->DspRow, Cal->DspCol )
  6786.               Str:Put( To:Str( Cal->DspDay, "##" ) )
  6787.               Win:Attr( 1 )
  6788.  
  6789.             Return(Ok)
  6790.  
  6791.           Cal:Up_Arrow_Key
  6792.             Cal->Date = Date:Sub(Cal->Date,7,0,0)
  6793.             Cal:Show( Cal )
  6794.             Return (Ok)
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.  
  6804.  
  6805.  
  6806.  
  6807.  
  6808.           The JORF Manual (Shareware Disk Version)                      108
  6809.  
  6810.  
  6811.  
  6812.  
  6813.  
  6814.  
  6815.                                        Date:Get
  6816.  
  6817.  
  6818.           Function  Date:Get 
  6819.  
  6820.           Purpose   Get system Date.
  6821.  
  6822.           Returns   A JORF pointer with the current system date.
  6823.  
  6824.           See Also  Date:Set.
  6825.  
  6826.           Notes     There is an internal data type for the date. 
  6827.                     Conversion to this type is done using the To:Date
  6828.                     function.  Conversion from this types done using
  6829.                     Date:Str.  These functions are paralleled for time.
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.  
  6844.  
  6845.  
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.  
  6859.  
  6860.  
  6861.  
  6862.  
  6863.  
  6864.  
  6865.  
  6866.  
  6867.           Chapter Five - JORF Functions                                 109
  6868.  
  6869.  
  6870.  
  6871.  
  6872.  
  6873.  
  6874.                                        Date:Set
  6875.  
  6876.  
  6877.           Function  Date:Set ( Date ) 
  6878.  
  6879.           Purpose   Set DOS clock to the specified date.
  6880.  
  6881.           Returns   None.
  6882.  
  6883.           See Also  Time:Set, To:Date.
  6884.  
  6885.           Notes     Sets the DOS date.  Date should be the result of the
  6886.                     To:Date function.  You can also specify a string value,
  6887.                     but the format will need to conform to the last format
  6888.                     you used in the To:Date function, or to MM/DD/YY if you
  6889.                     have not specified another format.
  6890.  
  6891.                     New programmers may note that JORF defaults to the
  6892.                     American MM/DD/YY format, but is easily changed to suit
  6893.                     European and Asian formats, as well as to create index
  6894.                     values using YYYY/MM/DD format.
  6895.  
  6896.                     Setting the DOS time and date does not always affect
  6897.                     the computer's system clock.  To permanently change the
  6898.                     time and date on your computer, you may have to use a
  6899.                     utility program.  Network computers often get their
  6900.                     date and time reset from the network file server. 
  6901.  
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.  
  6923.  
  6924.  
  6925.  
  6926.           The JORF Manual (Shareware Disk Version)                      110
  6927.  
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.                                      Date:SetFmt
  6934.  
  6935.  
  6936.           Function  Date:SetFmt ( FormatStructure )  
  6937.  
  6938.           Purpose   Changes the default Month and Weekday names for
  6939.                     Date:Str.
  6940.  
  6941.           Returns   None.
  6942.  
  6943.           See Also  Date:Str, Time:SetFmt.
  6944.  
  6945.           Notes     The structure may be any structure with the elements
  6946.                     specified below.  The Element values are parsed and
  6947.                     sorted in an internal static array.  Changing the
  6948.                     elements after setting them does not change the
  6949.                     internal array until you call Date:SetFmt again.  
  6950.  
  6951.                     This function does not return any values, but sets up
  6952.                     values for later use by Date:Str.
  6953.  
  6954.                     The structure values are as follows:
  6955.  
  6956.                     FormatStructure->Format       | Default MM/DD/YY format
  6957.  
  6958.                     FormatStructure->M1           | The name for January
  6959.                     FormatStructure->M2           | The name for February
  6960.                      . . .
  6961.                     FormatStructure->M12          | The name for December
  6962.  
  6963.                     FormatStructure->D1           | The name for Monday
  6964.                     FormatStructure->D2           | The name for Tuesday
  6965.                      . . .
  6966.                     FormatStructure->D7           | The name for Sunday
  6967.  
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.  
  6980.  
  6981.  
  6982.  
  6983.  
  6984.  
  6985.           Chapter Five - JORF Functions                                 111
  6986.  
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.           Example   This program displays a text box showing the various
  6993.                     time values, then switches to French (one of only two
  6994.                     foreign languages I know well enough to know all the
  6995.                     words, the other is Japanese, and you need a graphics
  6996.                     screen for that).
  6997.  
  6998.  
  6999.           TimeTest:Start
  7000.                       New Time
  7001.                       Win:Add ("Time Test", 0, 0, 10, 40, Here)
  7002.                       Time:Get (Time)
  7003.                       Str:PutLine ("NDate: " +Time->NDate)
  7004.                       Str:PutLine ("SDate: " +Time->SDate)
  7005.                       Str:PutLine ("STime: " +Time->STime)
  7006.                       Str:PutLine ("Switch to French")
  7007.                       Time->M1="Janvier"
  7008.                       Time->M2="Frevier"
  7009.                       Time->M3="Mars"
  7010.                       Time->M4="Avril"
  7011.                       Time->M5="Mai"
  7012.                       Time->M6="Jun"
  7013.                       Time->M7="Juillet"
  7014.                       Time->M8="Aout"
  7015.                       Time->M9="Septembre"
  7016.                       Time->M10="Octobre"
  7017.                       Time->M11="Novembre"
  7018.                       Time->M12="Decembre"
  7019.                       Time->NDFormat = "dd.mm.yy"
  7020.                       Time->SDFormat = "d m, y"
  7021.                       Time->STFormat = "h.m.s a"
  7022.                       Time:Get (Time)
  7023.                       Str:PutLine ("NDate: " +Time->NDate)
  7024.                       Str:PutLine ("SDate: " +Time->SDate)
  7025.                       Str:PutLine ("STime: " +Time->STime)
  7026.                       Win:Pause
  7027.                       Return
  7028.  
  7029.  
  7030.  
  7031.  
  7032.  
  7033.  
  7034.  
  7035.  
  7036.  
  7037.  
  7038.  
  7039.  
  7040.  
  7041.  
  7042.  
  7043.  
  7044.           The JORF Manual (Shareware Disk Version)                      112
  7045.  
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.                                        Date:Str
  7052.  
  7053.           Function  Date:Str ( Date, Format )  
  7054.  
  7055.           Purpose   Formats the date according to format.  You can also
  7056.                     obtain month name, day of week, and other partial date
  7057.                     information.
  7058.  
  7059.           Returns   A formatted string.
  7060.  
  7061.           See Also  Date:Get, Time:Str.
  7062.  
  7063.           Notes     The specified date should be the result of the To:Date
  7064.                     function that makes returns JORF pointer with an
  7065.                     internal date value. (The internal value stores the
  7066.                     date as a long integer value of the number of days
  7067.                     since the mythical date January 1, 00.  
  7068.  
  7069.                     The format is a string saying how to format the date. 
  7070.                     The following are special character within the format
  7071.                     string:
  7072.  
  7073.                                    Date Formatters
  7074.  
  7075.                     s    = String month      Caps makes string upper case
  7076.                     w    = String weekday    Caps makes string upper case
  7077.                     n    = Numeric weekday   Caps is ignored
  7078.                     m    = Month             Caps is ignored
  7079.                     mm   = Month, zero in front   Caps is ignored
  7080.                     d    = Day                    Caps is ignored
  7081.                     dd   = Day, zero in front     Caps is ignored
  7082.                     y    = Year                   Caps is ignored
  7083.                     yy   = Two digit year         Caps is ignored
  7084.                     yyyy = Four digit year        Caps is ignored
  7085.  
  7086.                     Any other characters are retained as-is. 
  7087.  
  7088.                     The following examples show how the date 10/13/92 would
  7089.                     be formatted:
  7090.  
  7091.                     Date:Str(Date,"MM/DD/YY")          result "10/13/92"
  7092.                     Date:Str(Date,"MM/DD")             result "10/13"
  7093.                     Date:Str(Date,"s d, yyyy")         result "October 13, 1992"
  7094.                     Date:Str(Date,"n-w"                result "2-Tuesday"
  7095.                     Date:Str(Date,"N-W")               result "2-TUESDAY"
  7096.  
  7097.                     You can easily change the table of month and weekday
  7098.                     names to other languages using the Date:SetFmt
  7099.                     function.  If the format is omitted, the default format
  7100.                     of "MM/DD/YY" is used.  This default can be changed
  7101.                     using Date:SetFmt.
  7102.  
  7103.           Chapter Five - JORF Functions                                 113
  7104.  
  7105.  
  7106.  
  7107.  
  7108.  
  7109.  
  7110.                                        Date:Sub
  7111.  
  7112.  
  7113.           Function  Date:Sub ( Date, Days, Months, Years )  
  7114.  
  7115.           Purpose   Subtract the specified Days, Months, or Years from the
  7116.                     Date.
  7117.  
  7118.           Returns   A date.
  7119.  
  7120.           See Also  Date:Add, Time:Sub.
  7121.  
  7122.           Notes     This is a very specialized command that helps you
  7123.                     calculate one month before, or 90 days before a date. 
  7124.                     This command does all the  necessary calculations to
  7125.                     account for month lengths and leap years.  
  7126.  
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132.  
  7133.  
  7134.  
  7135.  
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.  
  7144.  
  7145.  
  7146.  
  7147.  
  7148.  
  7149.  
  7150.  
  7151.  
  7152.  
  7153.  
  7154.  
  7155.  
  7156.  
  7157.  
  7158.  
  7159.  
  7160.  
  7161.  
  7162.           The JORF Manual (Shareware Disk Version)                      114
  7163.  
  7164.  
  7165.  
  7166.  
  7167.  
  7168.  
  7169.                                       Db:Append
  7170.  
  7171.  
  7172.           Function  Db:Append ( FileName, Record )  
  7173.  
  7174.           Purpose   Append Record to the end of  FileName..
  7175.  
  7176.           Returns   Returns the record number of the new record appended to
  7177.                     the file.  If Record is a structure, the structure
  7178.                     values are written
  7179.  
  7180.           See Also  Db:Write.
  7181.  
  7182.           Notes     In dBASE land, the only way to append is to use the
  7183.                     command APPEND BLANK to append a blank record.  In JORF
  7184.                     land, you can append a filled record (structure) which
  7185.                     simplifies the process of locking and adding a record
  7186.                     to a dBASE file.  If you APPEND BLANK, you must
  7187.                     immediately lock the record before you set values and
  7188.                     write the final record.  When  you append a filled
  7189.                     record in the JORF style, locking is not required. 
  7190.  
  7191.                     (Locking is not required because the interpreter is
  7192.                     automatically handling file locks.  To append a record
  7193.                     in a network environment, the entire file is locked,
  7194.                     the record appended, and the file unlocked.) 
  7195.  
  7196.                     The Record is a JORF structure that contains fields
  7197.                     with dBASE names.  Each field is written to the file
  7198.                     into the like named dBASE field.  There must be a name
  7199.                     correspondence between the JORF structure and the dBASE
  7200.                     field name.  Although you can add new fields to JORF
  7201.                     structures very easily, you can only introduce new
  7202.                     fields into a dBASE file by rewriting that entire file.
  7203.  
  7204.           Example
  7205.  
  7206.           jcm2dbf:Start
  7207.             | Conversion program for ASP.JCM to ASP.DBF
  7208.             |
  7209.             New (SrcFile,DstFile,Recno,Contact)
  7210.             Jorf:File("Contact.J",Here)        | Read Class:Contact def
  7211.             SrcFile = "ASP.JCM"
  7212.             DstFile = "ASP.DBF"
  7213.  
  7214.             File:Del(DstFile)
  7215.             Db:Map (DstFile)                   | Need full mapping to create
  7216.               Name    dbType:"C" Len:30
  7217.               Title   dbType:"C" Len:30
  7218.               Company dbType:"C" Len:30
  7219.               Address dbType:"C" Len:30
  7220.  
  7221.           Chapter Five - JORF Functions                                 115
  7222.  
  7223.  
  7224.  
  7225.  
  7226.  
  7227.               City    dbType:"C" Len:20
  7228.               State   dbType:"C" Len:2
  7229.               Zip     dbType:"C" Len:10
  7230.               Country dbType:"C" Len:20
  7231.             Db:Create(DstFile)
  7232.             Jorf:File(SrcFile,Here)
  7233.             Win:Add("JCM to DBF File Converter",10, 10, 5, 35)
  7234.             Win:Msg("Press ESC to abort conversion.")
  7235.             Contact = Struct:Next("Contact", "FullName", Contact)
  7236.             While (Contact)
  7237.               ++Recno
  7238.               Move:To(2,2)
  7239.               Str:Put("Contact: {Recno}")
  7240.               Move:To(4,2)
  7241.               Str:Put("Name:   {Str:Pad(Contact->FullName,30)}")
  7242.               Jcm2Dbf:Add(DstFile,Contact)
  7243.               If (Kbd:Hit)
  7244.                 If (Kbd:Get=="Esc_Key")
  7245.                   Break
  7246.               Contact = Struct:Next("Contact", "FullName", Contact)
  7247.             Return (Ok)
  7248.  
  7249.           Jcm2Dbf:Add(DstFile,Contact)
  7250.             New (Record,CommaPos)
  7251.             Record->Name     = Contact->FullName
  7252.             Record->Company  = Contact->Company
  7253.             CommaPos = Str:In(Contact->Addr2,",")
  7254.             If (CommaPos)
  7255.               Record->Address  = Contact->Addr1
  7256.               Record->City = Str:At(Contact->Addr2,1,CommaPos-1)
  7257.               Record->State= Word:At(Str:At(Contact->Addr2,CommaPos+1),1)
  7258.             Else
  7259.               Record->Address  = Contact->Addr1+" "+Contact->Addr2
  7260.               CommaPos = Str:In(Contact->Addr3,",")
  7261.               Record->City = Str:At(Contact->Addr3,1,CommaPos-1)
  7262.               Record->State= Word:At(Str:At(Contact->Addr3,CommaPos+1),1)
  7263.             Record->Zip    = Contact->ZipCode
  7264.             Db:Append(DstFile,Record)
  7265.             Return (Ok)
  7266.  
  7267.  
  7268.  
  7269.  
  7270.  
  7271.  
  7272.  
  7273.  
  7274.  
  7275.  
  7276.  
  7277.  
  7278.  
  7279.  
  7280.           The JORF Manual (Shareware Disk Version)                      116
  7281.  
  7282.  
  7283.  
  7284.  
  7285.  
  7286.  
  7287.                                        Db:Close
  7288.  
  7289.  
  7290.           Function  Db:Close ( FileName )  
  7291.  
  7292.           Purpose   Explicit close for FileName..
  7293.  
  7294.           Returns   None.
  7295.  
  7296.           See Also  Other File functions.
  7297.  
  7298.           Notes     You do not have to close files in the JORF language.  A
  7299.                     Mapped file is closed according to the Level specified
  7300.                     in the mapping.  Files that are renamed or deleted are
  7301.                     automatically closed prior to the renaming.
  7302.  
  7303.                     This function exists because I might have forgotten a
  7304.                     spot where a file should be closed before further
  7305.                     handling.  
  7306.  
  7307.  
  7308.  
  7309.  
  7310.  
  7311.  
  7312.  
  7313.  
  7314.  
  7315.  
  7316.  
  7317.  
  7318.  
  7319.  
  7320.  
  7321.  
  7322.  
  7323.  
  7324.  
  7325.  
  7326.  
  7327.  
  7328.  
  7329.  
  7330.  
  7331.  
  7332.  
  7333.  
  7334.  
  7335.  
  7336.  
  7337.  
  7338.  
  7339.           Chapter Five - JORF Functions                                 117
  7340.  
  7341.  
  7342.  
  7343.  
  7344.  
  7345.  
  7346.                                       Db:Create
  7347.  
  7348.  
  7349.           Function  Db:Create ( FileName )  
  7350.  
  7351.           Purpose   Create a new dBASE file..
  7352.  
  7353.           Returns   Ok if file is created, Null if not.
  7354.  
  7355.           See Also  File:Create.
  7356.  
  7357.           Notes     If the file exists, it will be deleted.  The file will
  7358.                     then be created and the dBASE header written.  If there
  7359.                     are index (NTX) files declared in the mapping, they
  7360.                     will also be deleted and created anew. 
  7361.  
  7362.                     dBASE files have a distinctive file header that is
  7363.                     created with this command.  You cannot write to a dBASE
  7364.                     file without first creating the header.  This is
  7365.                     different than with ASCII delimited files which have no
  7366.                     header and can be written without "Creating".
  7367.  
  7368.                     The created file will be dBASE III, not dBASE II or
  7369.                     dBASE IV format.  
  7370.  
  7371.           Example   See Db:Append.
  7372.  
  7373.  
  7374.  
  7375.  
  7376.  
  7377.  
  7378.  
  7379.  
  7380.  
  7381.  
  7382.  
  7383.  
  7384.  
  7385.  
  7386.  
  7387.  
  7388.  
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.           The JORF Manual (Shareware Disk Version)                      118
  7399.  
  7400.  
  7401.  
  7402.  
  7403.  
  7404.  
  7405.                                       Db:Delete
  7406.  
  7407.  
  7408.           Function  Db:Delete ( FileName, Record ) 
  7409.  
  7410.           Purpose   Mark a record as "Deleted"
  7411.  
  7412.           Returns   Ok if deleted, Null if record was already deleted or
  7413.                     was not available to delete.
  7414.  
  7415.           See Also  Db:Recall, Db:Lock, Other DB functions.
  7416.  
  7417.           Notes     Before deleting, the Record must have been found, read
  7418.                     and locked.  The actual value for Record can be either
  7419.                     the Recno integer value returned by Db:Seek, or the
  7420.                     Structure value returned by Db:Lock. This command can
  7421.                     then be used to "Delete" the record.
  7422.  
  7423.                     In dBASE land, records are not eliminated when they are
  7424.                     "Deleted".  Instead, they are marked for deletion
  7425.                     during the next PACK.  Until the file is packed, the
  7426.                     records will stay around and can be restored using
  7427.                     Db:Recall at any time.
  7428.  
  7429.                     Deleting a record will change the actions of Db:Seek,
  7430.                     Db:Go and Db:Skip.  These functions automatically skip
  7431.                     right by "Deleted" records.  You can change this action
  7432.                     by setting the "Deleted" option on using Db:Set.
  7433.  
  7434.  
  7435.  
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.           Chapter Five - JORF Functions                                 119
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.                                         Db:Go
  7465.  
  7466.  
  7467.           Function  Db:Go ( Name, Pos ) 
  7468.  
  7469.           Purpose   Move the record pointer in a dBASE file.
  7470.  
  7471.           Returns   Record number.   Null if unsuccessful.
  7472.  
  7473.           See Also  Db:Skip, Db:NtxOrd, Other DB functions.
  7474.  
  7475.           Notes     Pos may be "Top" or "Bottom" to return the first or
  7476.                     last record number of the file.  Pos may also be any
  7477.                     record number.  The first record number is record
  7478.                     number 1.  The last record number can be obtained using
  7479.                     Db:Go("Myfile.dbf", "Top").
  7480.  
  7481.                     The returned value is an integer value.  If you are
  7482.                     going to change the data, you should read it using
  7483.                     Db:Lock. If you are reading the file for information or
  7484.                     display only, you can red the record using  Db:Read.
  7485.  
  7486.                     This function is the equivalent of the dBASE "GO" and
  7487.                     "GOTO" commands.  The expression Db:Go("MyFile.dbf",
  7488.                     "Bottom") returns the same value as the clipper
  7489.                     LASTREC() function.
  7490.  
  7491.  
  7492.  
  7493.  
  7494.  
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.           The JORF Manual (Shareware Disk Version)                      120
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.                                        Db:Info
  7524.  
  7525.  
  7526.           Function  Db:Info ( Name, InfoStructure ) 
  7527.  
  7528.           Purpose   Get information from the dBASE file header and current
  7529.                     record.
  7530.  
  7531.           Returns   InfoStructure, or Mem:Ptr if InfoStructure was null.
  7532.  
  7533.           See Also  Other DB Functions.
  7534.  
  7535.           Notes     Sets elements in Infostructure.  That means that
  7536.                     InfoStructure needs to have these elements declared, or
  7537.                     must be a structure of the Jorf class that accept any
  7538.                     elements.  If you omit InfoStructure as I usually do,
  7539.                     then the global value Mem:Ptr is used.
  7540.  
  7541.                     The element values are:
  7542.  
  7543.                          LastRec   Last record number
  7544.                          Found     Whether last Db:Seek worked
  7545.                          Eof       File read or seek is at end of file
  7546.                          Bof       File read or seek is at beginning
  7547.                          Deleted   Current record is deleted
  7548.  
  7549.  
  7550.  
  7551.  
  7552.  
  7553.  
  7554.  
  7555.  
  7556.  
  7557.  
  7558.  
  7559.  
  7560.  
  7561.  
  7562.  
  7563.  
  7564.  
  7565.  
  7566.  
  7567.  
  7568.  
  7569.  
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.           Chapter Five - JORF Functions                                 121
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.                                        Db:Lock
  7583.  
  7584.  
  7585.           Function  Db:Lock ( Name, Record ) 
  7586.  
  7587.           Purpose   Lock a record in a dBASE file..
  7588.  
  7589.           Returns   Contents of record.  Null if unsuccessful.
  7590.  
  7591.           See Also  Db:Skip, Db:Goto, Other DB functions.
  7592.  
  7593.           Notes     This command works just like DB:Read except that it
  7594.                     locks the record before reading.  The record remains
  7595.                     locked until a Db:Write or Db:Unlock on the same
  7596.                     record.
  7597.  
  7598.                     The returned value is a Jorf structure that holds the
  7599.                     dBASE record format.  The structure is a member of the
  7600.                     class declared in Db:Map.  An additional member to that
  7601.                     structure is the record number held in an element
  7602.                     called Jrecno.  
  7603.  
  7604.  
  7605.  
  7606.  
  7607.  
  7608.  
  7609.  
  7610.  
  7611.  
  7612.  
  7613.  
  7614.  
  7615.  
  7616.  
  7617.  
  7618.  
  7619.  
  7620.  
  7621.  
  7622.  
  7623.  
  7624.  
  7625.  
  7626.  
  7627.  
  7628.  
  7629.  
  7630.  
  7631.  
  7632.  
  7633.  
  7634.           The JORF Manual (Shareware Disk Version)                      122
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.                                         Db:Map
  7642.  
  7643.  
  7644.           Function  Db:Map ( Name, Level, Class, Map ) 
  7645.  
  7646.           Purpose   Declare dBASE file, map fields for file creation..
  7647.  
  7648.           Returns   None.
  7649.  
  7650.           See Also  Db:Create, Db:Read.
  7651.  
  7652.           Notes     Map a file for use with Db:Read and Db:Create.  The
  7653.                     action of this command differs between reading an
  7654.                     existing file and creating a new dBASE file.
  7655.  
  7656.                     The parameter name is sets the file name.  Once mapped,
  7657.                     all reads and writes to that file will be influenced by
  7658.                     the mapping.
  7659.  
  7660.                     The parameter Class sets the structure type assigned to
  7661.                     a record when it is read from the file.  If no Class is
  7662.                     declared, the JORF class will be used (Structures in
  7663.                     the JORF class can accept any elements, there is no
  7664.                     checking for legal element values).
  7665.  
  7666.                     The last parameter is usually an indented section that
  7667.                     contains the field mapping.  The dBASE file format has
  7668.                     a file header which declares the fields in the file. 
  7669.                     If you map an existing file, your field names will be
  7670.                     ignored if they differ from the field names in the file
  7671.                     header.  
  7672.  
  7673.                     For  this reason, you must be sure to map existing
  7674.                     files according to the correct names and field lengths. 
  7675.                     When you are reading a dBASE file, if there is any
  7676.                     difference between the map and the header, the header
  7677.                     takes precedence and the map values are ignored.  When
  7678.                     reading a dBASE file, it is common to omit the mapping
  7679.                     entirely, and depend on the field definitions in the
  7680.                     header.  You can see this in the DBF2JCM.J example
  7681.                     program.
  7682.  
  7683.                     When you create a new dBASE file, you must map every
  7684.                     field.  Fields that you don't map will not be included
  7685.                     in the new header of the file.  You can see an example
  7686.                     of this in the JCM2DBF.J example program.
  7687.  
  7688.                     It is generally best to define the Len, dbName (the
  7689.                     name of the field in the dBase file).  You can also
  7690.                     define the Dec for decimal point, and dtype for the
  7691.                     dBase field type.  If you do not define these the
  7692.  
  7693.           Chapter Five - JORF Functions                                 123
  7694.  
  7695.  
  7696.  
  7697.  
  7698.  
  7699.                     decimal places will default to zero, and the dbType
  7700.                     will default to 'C' for the dBase Character type.
  7701.  
  7702.                     When mapping a dBASE file, you can also map the NTX
  7703.                     indexes for the file.  JORF uses Clipper style NTX
  7704.                     indexes, and not dBASE or FoxBASE style NDX indexes. 
  7705.                     The NTX format is quite different than NDX format, so
  7706.                     don't try to rename the file and expect it to work.
  7707.  
  7708.                     Contact:CvtDBASE
  7709.                       New (Contact:Contact,FName,Counter)
  7710.                       FName="MyFile.Dat"
  7711.                       | Add a window to show what is happening
  7712.                       Win:Add ("Reading {FName}", 0, 0, 10, 76, Here)
  7713.                       Db:Map (Fname,Here,"DBASE","Contact")
  7714.                         Company   Len:40 dbType:"C" dbName:"COMPANY"
  7715.                         Addr1     Len:40 dbType:"C" dbName:"ADDR1"
  7716.                         Addr2     Len:40 dbType:"C" dbName:"ADDR2"
  7717.                         Addr3     Len:40 dbType:"C" dbName:"CITSTZ"
  7718.                         Junk      Len:20 dbType:"C" dbName:"CODES"
  7719.                         FullName  Len:40 dbType:"C" dbName:"CONTACT"
  7720.                         Zip       Len:10 dbType:"C" dbName:"ZIP"
  7721.                       For (Counter = 1 thru Db:Go(Fname,"Bottom"))
  7722.                         Contact=Db:Read(Fname,Counter)
  7723.                         Str:Put (Str:Pad(Counter,4))
  7724.                         Str:Put (Str:Pad(Contact->Company,30))
  7725.                         Str:Put (Str:Pad(Contact->FullName,30))
  7726.                         Str:PutLine
  7727.                         Jorf:Write(Contact)
  7728.                       Return Ok
  7729.  
  7730.  
  7731.                     To define an index, your map line must definition must
  7732.                     begin with the key expression "NTX" followed by a colon
  7733.                     and the name of the index.  You only need the file
  7734.                     name, the path is assumed to be the same directory as
  7735.                     the base dBASE file.
  7736.  
  7737.                     The JORF interpreter needs enough information to
  7738.                     interpret the index values.  When using NTX indexes in
  7739.                     JORF, it is best to declare the index length and
  7740.                     constructor string.  If you omit this information, the
  7741.                     JORF interpreter will try to obtain the information
  7742.                     from the index header.
  7743.  
  7744.                     An index constructor string is maintained in each NTX
  7745.                     file header.  If the index key is a simple field, then
  7746.                     the string is simply the field name.  If the index key
  7747.                     contains any dBASE expressions, however, you must tell
  7748.                     the interpreter how to construct the equivalent key
  7749.                     using JORF expressions.  Examples are:
  7750.  
  7751.  
  7752.           The JORF Manual (Shareware Disk Version)                      124
  7753.  
  7754.  
  7755.  
  7756.  
  7757.  
  7758.                     dBASE Key      JORF Key
  7759.                     Name           Name              | Same
  7760.                     Name+Zip       Name+Zip          | Same
  7761.                     Dtos(StDate)   Date:Str(StDate,"YYYYMMDD")  | Different
  7762.  
  7763.  
  7764.                     The key thing to remember is that the JORF language is
  7765.                     different from the dBASE language, and you must
  7766.                     translate any complex key expression to the appropriate
  7767.                     JORF language expressions.
  7768.  
  7769.  
  7770.  
  7771.  
  7772.  
  7773.  
  7774.  
  7775.  
  7776.  
  7777.  
  7778.  
  7779.  
  7780.  
  7781.  
  7782.  
  7783.  
  7784.  
  7785.  
  7786.  
  7787.  
  7788.  
  7789.  
  7790.  
  7791.  
  7792.  
  7793.  
  7794.  
  7795.  
  7796.  
  7797.  
  7798.  
  7799.  
  7800.  
  7801.  
  7802.  
  7803.  
  7804.  
  7805.  
  7806.  
  7807.  
  7808.  
  7809.  
  7810.  
  7811.           Chapter Five - JORF Functions                                 125
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.                                       Db:NtxOrd
  7819.  
  7820.  
  7821.           Function  Db:NtxOrd ( Name, NtxNumber ) 
  7822.  
  7823.           Purpose   Switch indexes in an open file..
  7824.  
  7825.           Returns   None.
  7826.  
  7827.           See Also  Db:Skip.
  7828.  
  7829.           Notes     If you have declared indexes using Db:Map, you can use
  7830.                     this function to select which index to use for the next
  7831.                     Db:Skip.  
  7832.  
  7833.                     The first declared index is 1.  If you indicate an
  7834.                     NtxNumber of zero, no index is declared and Db:Skip
  7835.                     will be based on the natural order of the records. 
  7836.  
  7837.  
  7838.  
  7839.  
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.  
  7848.  
  7849.  
  7850.  
  7851.  
  7852.  
  7853.  
  7854.  
  7855.  
  7856.  
  7857.  
  7858.  
  7859.  
  7860.  
  7861.  
  7862.  
  7863.  
  7864.  
  7865.  
  7866.  
  7867.  
  7868.  
  7869.  
  7870.           The JORF Manual (Shareware Disk Version)                      126
  7871.  
  7872.  
  7873.  
  7874.  
  7875.  
  7876.  
  7877.                                        Db:Pack
  7878.  
  7879.  
  7880.           Function  Db:Pack ( Name, Showit ) 
  7881.  
  7882.           Purpose   Pack a dBASE file, DBT text file and re-write NTX
  7883.                     indexes.
  7884.  
  7885.           Returns   False if File could not be locked for packing. 
  7886.                     Otherwise Ok.
  7887.  
  7888.           See Also  Db:Map. 
  7889.  
  7890.           Notes     While most JORF dBASE commands work like their dBASE
  7891.                     cousins, this one is an improvement over the dBASE PACK
  7892.                     function.  In JORF, this command rewrites the entire
  7893.                     file, insuring a complete rewrite before the original
  7894.                     file is deleted.  For that reason, enough disk space is
  7895.                     required to hold the entire new copy of the file. 
  7896.                     After the file is rewritten and renamed, it is
  7897.                     automatically reindexed based on the declared indexes. 
  7898.  
  7899.                     Programmers not familiar with dBASE files should note: 
  7900.                     In dBASE-Land, records are not really deleted.  When
  7901.                     you delete a record using Db:Del, that record continues
  7902.                     to take space in the file until the file is packed. 
  7903.                     The pack function recovers the space used by the record
  7904.                     because it rewrites only un-deleted records in the new
  7905.                     version of the file.  For this reason, all dBASE
  7906.                     programs feature pack functions prominently, because
  7907.                     without them the files grow endlessly.
  7908.  
  7909.                     Programmers familiar with DBT files may note that JORF
  7910.                     uses DBT files just like Clipper, reusing the existing
  7911.                     space if possible, but allocating new blocks if the
  7912.                     memo field grows beyond the current 512 block boundary. 
  7913.                     Previously used memo blocks continue to take space
  7914.                     until a file is packed. 
  7915.  
  7916.                     If Showit is True, the Db:Pack function will display a
  7917.                     status box while writing and re-indexing the file.
  7918.  
  7919.           Example   See Db:Map.
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.           Chapter Five - JORF Functions                                 127
  7930.  
  7931.  
  7932.  
  7933.  
  7934.  
  7935.  
  7936.                                        Db:Read
  7937.  
  7938.  
  7939.           Function  Db:Read ( FileName, Recno ) 
  7940.  
  7941.           Purpose   Read a record from a dBASE III file..
  7942.  
  7943.           Returns   The record that was read.
  7944.  
  7945.           See Also  Db:Seek. Db:Goto, Db:Lock.  Other DB Functions.
  7946.  
  7947.           Notes     The Db:Read function is used to read a record obtained
  7948.                     using one of the record pointer moving functions
  7949.                     Db:Seek, Db:Skip and Db:Goto.  If Recno is omitted,
  7950.                     then the record number returned by these functions will
  7951.                     be used.  In dBASE land, this is called the "Current"
  7952.                     record number.  In JORF land, structures are known more
  7953.                     by their pointer nature and more than one structure of
  7954.                     the same class may be "Current".
  7955.  
  7956.  
  7957.  
  7958.  
  7959.  
  7960.  
  7961.  
  7962.  
  7963.  
  7964.  
  7965.  
  7966.  
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.  
  7973.  
  7974.  
  7975.  
  7976.  
  7977.  
  7978.  
  7979.  
  7980.  
  7981.  
  7982.  
  7983.  
  7984.  
  7985.  
  7986.  
  7987.  
  7988.           The JORF Manual (Shareware Disk Version)                      128
  7989.  
  7990.  
  7991.  
  7992.  
  7993.  
  7994.  
  7995.                                       Db:Recall
  7996.  
  7997.  
  7998.           Function  Db:Recall ( Name, Record ) 
  7999.  
  8000.           Purpose   Un-mark a "Deleted" record.
  8001.  
  8002.           Returns   Ok if record was properly unmarked. Null if record was
  8003.                     not previously "Deleted".
  8004.  
  8005.           See Also  Db:Del, Db:Lock, Other DB functions.
  8006.  
  8007.           Notes     You will have to set "Deleted" to True just to seek or
  8008.                     goto a "Deleted" record.  Once you have, you can
  8009.                     "Un-delete" the record with this function.  
  8010.  
  8011.                     This function is the equivalent of the dBASE RECALL
  8012.                     command.
  8013.  
  8014.  
  8015.  
  8016.  
  8017.  
  8018.  
  8019.  
  8020.  
  8021.  
  8022.  
  8023.  
  8024.  
  8025.  
  8026.  
  8027.  
  8028.  
  8029.  
  8030.  
  8031.  
  8032.  
  8033.  
  8034.  
  8035.  
  8036.  
  8037.  
  8038.  
  8039.  
  8040.  
  8041.  
  8042.  
  8043.  
  8044.  
  8045.  
  8046.  
  8047.           Chapter Five - JORF Functions                                 129
  8048.  
  8049.  
  8050.  
  8051.  
  8052.  
  8053.  
  8054.                                        Db:Seek
  8055.  
  8056.  
  8057.           Function  Db:Seek ( FileName, Keyvalue ) 
  8058.  
  8059.           Purpose   Searches the index for key value.
  8060.  
  8061.           Returns   Record number of record.  Null if match was not found..
  8062.  
  8063.           See Also  Db:Skip, Db:NtxOrd, Other DB functions.
  8064.  
  8065.           Notes     Searches for an index match to Keyvalue.  To seek, you
  8066.                     must have declared indexes and be set to the correct
  8067.                     index using Db:NtxOrd.  If you attempt to seek without
  8068.                     a valid index in use, Null will be returned.
  8069.  
  8070.                     The Db:Set function can change the nature of the seek. 
  8071.                     If you set "Deleted" to TRUE, then this function may
  8072.                     return the record number of a deleted record.  If
  8073.                     "SoftSeek" is true then this function may return the
  8074.                     next higher record if the exact Keyvalue is not found.
  8075.  
  8076.                     The returned value is an integer record number.  If you
  8077.                     are going to change the record, use Db:Lock to read it. 
  8078.                     If you are just looking at the data, use Db:Read.  
  8079.  
  8080.                     This function is the equivalent of the dBASE "SEEK"
  8081.                     command.
  8082.  
  8083.           Example   See Db:Read
  8084.  
  8085.  
  8086.  
  8087.  
  8088.  
  8089.  
  8090.  
  8091.  
  8092.  
  8093.  
  8094.  
  8095.  
  8096.  
  8097.  
  8098.  
  8099.  
  8100.  
  8101.  
  8102.  
  8103.  
  8104.  
  8105.  
  8106.           The JORF Manual (Shareware Disk Version)                      130
  8107.  
  8108.  
  8109.  
  8110.  
  8111.  
  8112.  
  8113.                                         Db:Set
  8114.  
  8115.  
  8116.           Function  Db:Set ( Name, Option, Value ) 
  8117.  
  8118.           Purpose   Do dBASE style "Set" functions that influence DB
  8119.                     commands.
  8120.  
  8121.           Returns   Prior setting.
  8122.  
  8123.           See Also  Db:Info, Other DB Functions.
  8124.  
  8125.           Notes     The dBASE language has numerous global settings that
  8126.                     are declared using the dBASE SET function.  In JORF,
  8127.                     two settings were needed to implement the most
  8128.                     rudimentary dBASE capability.  More SET commands may be
  8129.                     added later.
  8130.  
  8131.  
  8132.                     The current Options that may be set are:
  8133.  
  8134.                          "Deleted" True or False  Default False
  8135.                          "SoftSeek"     True or False  Default False
  8136.  
  8137.                     When "Deleted" is True, functions like Db:Go and
  8138.                     Db:Seek will go to and seek to deleted records as if
  8139.                     they were not deleted.  A deleted record in dBASE is
  8140.                     not really deleted until you PACK the file - so you can
  8141.                     freely set "Deleted" False and then read and undelete
  8142.                     the record. 
  8143.  
  8144.                     When "SoftSeek" is True, the Db:Seek function will seek
  8145.                     to the next higher key value in the file.  If it is
  8146.                     False, Db:Seek will return null if the exact key (to
  8147.                     the length of the key) is not found.  SoftSeek is
  8148.                     usually False for relational look ups (Key look-ups
  8149.                     into related data bases), but true for any screen
  8150.                     display or user oriented look-up, so the operator may
  8151.                     see close matches even after misspelling the key value.
  8152.  
  8153.  
  8154.  
  8155.  
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.  
  8162.  
  8163.  
  8164.  
  8165.           Chapter Five - JORF Functions                                 131
  8166.  
  8167.  
  8168.  
  8169.  
  8170.  
  8171.  
  8172.                                        Db:Skip
  8173.  
  8174.  
  8175.           Function  Db:Skip ( Name, Record, SkipBy ) 
  8176.  
  8177.           Purpose   Move the record pointer in a dBASE file.
  8178.  
  8179.           Returns   Record number of next record.  Null if unsuccessful.
  8180.  
  8181.           See Also  Db:Go, Db:NtxOrd, Other DB functions.
  8182.  
  8183.           Notes     This function is used to traverse records in a data
  8184.                     base.  Normally SkipBy is 1 (this is the default if it
  8185.                     is omitted) and this function returns the next record
  8186.                     in the file.  If the end of file is reached, then the
  8187.                     return value will be Null.
  8188.  
  8189.                     You can also declare a SkipBy value of -1 (negative
  8190.                     one) to read the previous record in the file.  You can
  8191.                     skip though the file by any number of records, positive
  8192.                     or negative.
  8193.  
  8194.                     The "Next" record is influenced by whether NTX indexes
  8195.                     are declared and which one is in use.  If there is an
  8196.                     active index, the next record will be chosen according
  8197.                     to the key value.  If there are no active indexes, or
  8198.                     if Db:NtxOrd is zero, then the next record will be the
  8199.                     next physical record in the dBASE file.
  8200.  
  8201.                     If Record is null and SkipBy is positive, the first
  8202.                     record is read just as if you used
  8203.                     Db:Go("MyFile.DBF","Top").  If the SkipBy is negative,
  8204.                     the last record is read as if you started with
  8205.                     "Bottom".
  8206.  
  8207.                     The return value is the record as read from the disk. 
  8208.                     If you are going to change the record, you should lock
  8209.                     the record and use the return value from Db:Lock to get
  8210.                     the most recent version of the record.
  8211.  
  8212.           Example   See Db:Read
  8213.  
  8214.  
  8215.  
  8216.  
  8217.  
  8218.  
  8219.  
  8220.  
  8221.  
  8222.  
  8223.  
  8224.           The JORF Manual (Shareware Disk Version)                      132
  8225.  
  8226.  
  8227.  
  8228.  
  8229.  
  8230.  
  8231.                                       Db:Unlock
  8232.  
  8233.  
  8234.           Function  Db:Unlock ( Name, Record ) 
  8235.  
  8236.           Purpose   Unlock a record in a dBASE file..
  8237.  
  8238.           Returns   Ok if record was locked.  Null if not locked.
  8239.  
  8240.           See Also  Db:Lock, Db:Write, Other DB functions.
  8241.  
  8242.           Notes     When you are using a record in a multi-user environment
  8243.                     you must lock the record while it is being changed.  To
  8244.                     lock a record, use Db:Lock.  To write the record and
  8245.                     unlock it, use Db:Write.  But if the operator aborts
  8246.                     the edit, you need to unlock the record and restore the
  8247.                     original values that the operator may have changed. 
  8248.                     That is the purpose of this function.
  8249.  
  8250.                     This function re-reads the record and unlocks it in
  8251.                     that order.  This is the proper process for handling an
  8252.                     aborted edit of a record on a multiuser system.  
  8253.  
  8254.                     To find the appropriate spot in the file, the Record
  8255.                     must have a valid Jrecno element.  This element is
  8256.                     automatically created by any of the DB functions that
  8257.                     read records.
  8258.  
  8259.           Example   See Db:Read
  8260.  
  8261.  
  8262.  
  8263.  
  8264.  
  8265.  
  8266.  
  8267.  
  8268.  
  8269.  
  8270.  
  8271.  
  8272.  
  8273.  
  8274.  
  8275.  
  8276.  
  8277.  
  8278.  
  8279.  
  8280.  
  8281.  
  8282.  
  8283.           Chapter Five - JORF Functions                                 133
  8284.  
  8285.  
  8286.  
  8287.  
  8288.  
  8289.  
  8290.                                        Db:Write
  8291.  
  8292.  
  8293.           Function  Db:Write ( Name, Record ) 
  8294.  
  8295.           Purpose   Write a Record to a disk file.
  8296.  
  8297.           Returns   None.
  8298.  
  8299.           See Also  Db:Append.
  8300.  
  8301.           Notes     Writes an existing record to the file, unlocks the
  8302.                     record.  To write a new record, you must use Db:Append. 
  8303.  
  8304.  
  8305.                     Unlike dBASE, which writes to the "Current" record
  8306.                     number (The last value returned by a SEEK or GO
  8307.                     command), JORF stores the record number in the record
  8308.                     structure.  When a record is written, it will be
  8309.                     written to the record where it was read, regardless of
  8310.                     whether the "Current" record has since changed.  JORF
  8311.                     allows you to have more than one record active at a
  8312.                     time, even in dBASE files.
  8313.  
  8314.                     The Db:Write function defines a physical write
  8315.                     operation like the dBASE COMMIT function.  There is no
  8316.                     need to "Replace With" in the JORF language as there to
  8317.                     set fields in dBASE.
  8318.  
  8319.  
  8320.  
  8321.  
  8322.  
  8323.  
  8324.  
  8325.  
  8326.  
  8327.  
  8328.  
  8329.  
  8330.  
  8331.  
  8332.  
  8333.  
  8334.  
  8335.  
  8336.  
  8337.  
  8338.  
  8339.  
  8340.  
  8341.  
  8342.           The JORF Manual (Shareware Disk Version)                      134
  8343.  
  8344.  
  8345.  
  8346.  
  8347.  
  8348.  
  8349.                                    DirList:GetFile
  8350.  
  8351.  
  8352.           Function  DirList:GetFile ( Wildcard, ExclusionLIst )  
  8353.  
  8354.           Purpose   Display "DialogDirList" box for file name..
  8355.  
  8356.           Returns   File name selected, or Null if Cancelled.
  8357.  
  8358.           See Also  DirList.J source file.
  8359.  
  8360.           Notes     This is a JORF language function that has become a
  8361.                     permanent part of the interpreter.  The source code to
  8362.                     this function is entirely contained in the DIRLIST.J
  8363.                     source file.  
  8364.  
  8365.                     This function asks for file name and path, while
  8366.                     displaying selection lists for both.  The display is
  8367.                     designed to look somewhat like Windows' DlgDirList box,
  8368.                     but does not use DlgdirList even under MS-WIndows.  
  8369.  
  8370.                     The WildCard and ExclusionList are used as document in
  8371.                     the Arr:Dir function.  The wildcard is used to choose
  8372.                     files to display, and the exclusion list insures that
  8373.                     inappropriate files are not displayed.  
  8374.  
  8375.           Example   The TEXTEDIT.J sample program makes good use of the
  8376.                     DirList:GetFile function.
  8377.  
  8378.  
  8379.  
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386.  
  8387.  
  8388.  
  8389.  
  8390.  
  8391.  
  8392.  
  8393.  
  8394.  
  8395.  
  8396.  
  8397.  
  8398.  
  8399.  
  8400.  
  8401.           Chapter Five - JORF Functions                                 135
  8402.  
  8403.  
  8404.  
  8405.  
  8406.  
  8407.  
  8408.                                       Event:Add
  8409.  
  8410.  
  8411.           Function  Event:Add ( Class, Type, Level ) 
  8412.  
  8413.           Purpose   Add an Event Class.
  8414.  
  8415.           Returns   None.
  8416.  
  8417.           See Also  Event:Do, Event:Del.
  8418.  
  8419.           Notes     The Event system is a way of performing a method in
  8420.                     response to an event that occurs during normal
  8421.                     processing.  This is a way of saying "If such and such
  8422.                     happens while this program runs, then do this to take
  8423.                     care of it".
  8424.  
  8425.                     Three types of events set up in the JORF system are the
  8426.                     key, trace and error events.  Key events occur whenever
  8427.                     the operator enters a keystroke.  This allows the
  8428.                     system to evaluate the key and to respond
  8429.                     appropriately.  Trace events are used for trace mode
  8430.                     debugging, and will be executed at particular times
  8431.                     during while a method is begin interpreted.  Error
  8432.                     events occurs when is an error.  It is automatically
  8433.                     called, in hopes that error recovery is possible.  Of
  8434.                     these, Key events are by far the most common. 
  8435.  
  8436.                     Event:Add adds a new Class name to the event stack for
  8437.                     event Type tied to the current program Level.  The
  8438.                     event classes form a stack so that the new entry is
  8439.                     simply the top one of many that might be used.  The
  8440.                     level lets the system know what method is declaring the
  8441.                     new class, and will automatically clear this entry when
  8442.                     that method is completed.
  8443.  
  8444.                     The types Error and Key are already used by JORF for
  8445.                     error and keystroke handling.  Other types may be any
  8446.                     name later used by Event:Do.
  8447.  
  8448.                     When events are performed, the event stack is searched
  8449.                     from top (most recent) to bottom.  When a valid method
  8450.                     is found, it is executed.  If the method returns any
  8451.                     value, the search is completed.  If the method returns
  8452.                     null, the search is continued down the event stack.  A
  8453.                     null class can be used to block the search function
  8454.                     from going any lower on the event stack.
  8455.  
  8456.                     If this is not complicated enough, there is a "Hot"
  8457.                     event system.  If you declare an event with a Level of
  8458.                     zero, then you create a hot event.  Once declared, Hot
  8459.  
  8460.           The JORF Manual (Shareware Disk Version)                      136
  8461.  
  8462.  
  8463.  
  8464.  
  8465.  
  8466.                     events are permanent.  Normal events are cleared when
  8467.                     the method that declared them is ended.  Hot events are
  8468.                     checked after the first event level, but before the
  8469.                     "Else" clause is checked.  Hot events give a way to set
  8470.                     default key values, like Alt-X for exit in the
  8471.                     debugger. 
  8472.  
  8473.                     The Level value should always be Here.
  8474.  
  8475.  
  8476.  
  8477.  
  8478.  
  8479.  
  8480.  
  8481.  
  8482.  
  8483.  
  8484.  
  8485.  
  8486.  
  8487.  
  8488.  
  8489.  
  8490.  
  8491.  
  8492.  
  8493.  
  8494.  
  8495.  
  8496.  
  8497.  
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.  
  8508.  
  8509.  
  8510.  
  8511.  
  8512.  
  8513.  
  8514.  
  8515.  
  8516.  
  8517.  
  8518.  
  8519.           Chapter Five - JORF Functions                                 137
  8520.  
  8521.  
  8522.  
  8523.  
  8524.  
  8525.  
  8526.                                       Event:Del
  8527.  
  8528.  
  8529.           Function  Event:Del ( Type ) 
  8530.  
  8531.           Purpose   Deletes the last event Class for event function of
  8532.                     designated Type.
  8533.  
  8534.           Returns   None.
  8535.  
  8536.           See Also  Event:Add, Event:Do.
  8537.  
  8538.           Notes     This function is rarely used because usually the Event
  8539.                     Classes are deleted automatically when the method that
  8540.                     creates them is ended.  The sole use of this command is
  8541.                     to try to circumvent that system.  You should try to
  8542.                     work with the automatic delete system, because it is
  8543.                     more robust.  However, if you insist, this function
  8544.                     will delete the last event class entry with this Type.
  8545.  
  8546.  
  8547.  
  8548.  
  8549.  
  8550.  
  8551.  
  8552.  
  8553.  
  8554.  
  8555.  
  8556.  
  8557.  
  8558.  
  8559.  
  8560.  
  8561.  
  8562.  
  8563.  
  8564.  
  8565.  
  8566.  
  8567.  
  8568.  
  8569.  
  8570.  
  8571.  
  8572.  
  8573.  
  8574.  
  8575.  
  8576.  
  8577.  
  8578.           The JORF Manual (Shareware Disk Version)                      138
  8579.  
  8580.  
  8581.  
  8582.  
  8583.  
  8584.  
  8585.                                        Event:Do
  8586.  
  8587.  
  8588.           Function  Event:Do ( Method, Type ) 
  8589.  
  8590.           Purpose   Performs an event.  
  8591.  
  8592.           Returns   If an event method is found, executed and returns a
  8593.                     value, then that value is returned by Event:Do.
  8594.  
  8595.           See Also  Event:Add, Event:Del.
  8596.  
  8597.           Notes     The most confusing thing here is to figure out how the
  8598.                     system is creating the method name to call when an
  8599.                     event is performed.  The inclination is to look at this
  8600.                     command and assume that the method will perform
  8601.                     Type:Method.  Instead, the type is used to down the
  8602.                     event stack for the appropriate Class that was set
  8603.                     using Event:Add.  It is this class used to do
  8604.                     Class:Method.
  8605.  
  8606.                     Each class of the correct type is attempted.  If that
  8607.                     fails, then the system looks for an Else method for
  8608.                     that class.  The Else methods are a default method for
  8609.                     the event type.  If this is not found, the system looks
  8610.                     down the event stack to the next lower class of the
  8611.                     correct Type.
  8612.  
  8613.                     This system allows a layering of event actions.  It was
  8614.                     designed primarily for keystroke handling, where a
  8615.                     certain screen may need to reassign only four keys,
  8616.                     while maintaining the functions of other keys.  Many
  8617.                     key handling systems remap all keys.  This is unwieldy
  8618.                     if only four keys have different definition.  But, for
  8619.                     events other than keystrokes, this overlay ability may
  8620.                     be too complicated and unnecessary.  Liberal use of the
  8621.                     Else method is recommended to avoid the stack search
  8622.                     and resulting confusion.
  8623.  
  8624.                              Special Notes for Key Events
  8625.  
  8626.                     For text entry, data entry and menu selection,
  8627.                     keystrokes from the operator are translated by the
  8628.                     system using the KeyClass stack.  The names in the
  8629.                     stack interpret the current keystroke.  The keystroke
  8630.                     is converted to a string value and the method called
  8631.                     that corresponds to the appropriate class and value. 
  8632.                     For instance, pressing the Escape key with a KeyClass
  8633.                     of "MenuKey" will invoke the method MenuKey:Escape_Key.
  8634.  
  8635.  
  8636.  
  8637.           Chapter Five - JORF Functions                                 139
  8638.  
  8639.  
  8640.  
  8641.  
  8642.  
  8643.                     Normal letters have "_Key" appended, so hitting B will
  8644.                     return "B_Key".  Alternate and Control keys have a
  8645.                     prefix appended to create "Alt_B_Key" and "Ctrl_B_Key". 
  8646.                     Special keys return special values like "Home_Key",
  8647.                     "F1_Key" and "Ctrl_Right_Arrow_Key".  A list of special
  8648.                     key values is in Appendix B.
  8649.  
  8650.                             Special notes for Error Events
  8651.  
  8652.                     Error events are called like the key events using the
  8653.                     error number as the method name.  Inside an error event
  8654.                     several values are set using Mem:Ptr:
  8655.  
  8656.                     Mem:Ptr->ErrNum     | JORF Error Number
  8657.                     Mem:Ptr->ErrDOS     | Last DOS error number
  8658.                     Mem:Ptr->ErrLine    | Line that was executing when 
  8659.                                         |   error occurred
  8660.                     Mem:Ptr->ErrMsg     | Text of the error message
  8661.  
  8662.                     Fatal errors do not call the event system.  Usually
  8663.                     these errors show that something has happened that will
  8664.                     not allow further action in The JORF Language
  8665.                     interpreter, and the program must halt immediately
  8666.                     before data integrity can be lost.
  8667.  
  8668.                     When an error occurs while processing another error,
  8669.                     the second error is considered fatal.
  8670.  
  8671.  
  8672.  
  8673.  
  8674.  
  8675.  
  8676.  
  8677.  
  8678.  
  8679.  
  8680.  
  8681.  
  8682.  
  8683.  
  8684.  
  8685.  
  8686.  
  8687.  
  8688.  
  8689.  
  8690.  
  8691.  
  8692.  
  8693.  
  8694.  
  8695.  
  8696.           The JORF Manual (Shareware Disk Version)                      140
  8697.  
  8698.  
  8699.  
  8700.  
  8701.  
  8702.  
  8703.                                         False
  8704.  
  8705.  
  8706.           Function  False
  8707.  
  8708.           Purpose   Used to test for Logical False.
  8709.  
  8710.           Returns   Null.  
  8711.  
  8712.           See Also  True.
  8713.  
  8714.           Notes     Most programming language express results of logical
  8715.                     equations as zero to indicate False, and one to
  8716.                     indicate True.  These values are called Boolean values. 
  8717.  
  8718.  
  8719.                     This function was created in the interest of program
  8720.                     clarity.  It simply returns Null.  Due to the automatic
  8721.                     type conversions inherent to Jorf Pointers, this is
  8722.                     exactly the same as the integer zero.
  8723.  
  8724.  
  8725.  
  8726.  
  8727.  
  8728.  
  8729.  
  8730.  
  8731.  
  8732.  
  8733.  
  8734.  
  8735.  
  8736.  
  8737.  
  8738.  
  8739.  
  8740.  
  8741.  
  8742.  
  8743.  
  8744.  
  8745.  
  8746.  
  8747.  
  8748.  
  8749.  
  8750.  
  8751.  
  8752.  
  8753.  
  8754.  
  8755.           Chapter Five - JORF Functions                                 141
  8756.  
  8757.  
  8758.  
  8759.  
  8760.  
  8761.  
  8762.                                      File:Append
  8763.  
  8764.  
  8765.           Function  File:Append ( FileName, Line )  
  8766.  
  8767.           Purpose   Append Line to the end of  FileName..
  8768.  
  8769.           Returns   Record Number.
  8770.  
  8771.           See Also  File:Write.
  8772.  
  8773.           Notes     Append a line to a text file, or a record to a
  8774.                     formatted file.
  8775.  
  8776.                     If you append to a mapped file, this function appends
  8777.                     line or if null, appends a blank record to the end of
  8778.                     the file.  The function returns the new record number. 
  8779.  
  8780.  
  8781.                     If you append to an unmapped file, a text line is added
  8782.                     followed by a Carriage Return-Line Feed (CR-LF) pair. 
  8783.                     If Line is null, just the CR-LF is written to file. 
  8784.                     The return value is the byte position of the new line
  8785.                     in the file.
  8786.  
  8787.                     When used with DLM, SDF and FIXED mapping formats, this
  8788.                     function allows you to append records as desired to the
  8789.                     file.  You need not specify Line.  WIthout it, the
  8790.                     effect is exactly like the dBASE "APPEND BLANK"
  8791.                     command. This function is specifically written to make
  8792.                     dBASE language programmers comfortable.
  8793.  
  8794.  
  8795.  
  8796.  
  8797.  
  8798.  
  8799.  
  8800.  
  8801.  
  8802.  
  8803.  
  8804.  
  8805.  
  8806.  
  8807.  
  8808.  
  8809.  
  8810.  
  8811.  
  8812.  
  8813.  
  8814.           The JORF Manual (Shareware Disk Version)                      142
  8815.  
  8816.  
  8817.  
  8818.  
  8819.  
  8820.  
  8821.                                      File:Backup
  8822.  
  8823.  
  8824.           Function  File:Backup ( FileName )  
  8825.  
  8826.           Purpose   Renames FileName to have an extension of .BAK.
  8827.  
  8828.           Returns   None.
  8829.  
  8830.           See Also  Other File functions.
  8831.  
  8832.           Notes     This function makes a backup of a file, presumably
  8833.                     before calling a command that might overwrite the file
  8834.                     like File:Save. 
  8835.  
  8836.           Example   See Arr:Pick.
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  
  8843.  
  8844.  
  8845.  
  8846.  
  8847.  
  8848.  
  8849.  
  8850.  
  8851.  
  8852.  
  8853.  
  8854.  
  8855.  
  8856.  
  8857.  
  8858.  
  8859.  
  8860.  
  8861.  
  8862.  
  8863.  
  8864.  
  8865.  
  8866.  
  8867.  
  8868.  
  8869.  
  8870.  
  8871.  
  8872.  
  8873.           Chapter Five - JORF Functions                                 143
  8874.  
  8875.  
  8876.  
  8877.  
  8878.  
  8879.  
  8880.                                       File:ChDir
  8881.  
  8882.  
  8883.           Function  File:ChDir ( NewDir )  
  8884.  
  8885.           Purpose   Change current directory or Return current directory.
  8886.  
  8887.           Returns   If NewDir is Null, returns current Directory.  If
  8888.                     present, returns Ok if successful, False if not. 
  8889.  
  8890.           See Also  Other File functions.
  8891.  
  8892.           Notes     This function is the equivalent of the DOS ChDir or CD
  8893.                     command.  Like ChDir, it can be used two ways.  By
  8894.                     itself, it simply returns the disk and path of the
  8895.                     current working directory.  If followed by a new path,
  8896.                     it changes to that path.
  8897.  
  8898.                     Unlike DOS ChDir, File:ChDir will change drives as well
  8899.                     as paths.  If you say CD D:\ while logged to drive C:
  8900.                     in DOS, you only change the default directory on D:.. 
  8901.                     If you say File:ChDir("D:\") in the JORF language, you
  8902.                     will be moved to drive D:, root directory.. 
  8903.  
  8904.  
  8905.  
  8906.  
  8907.  
  8908.  
  8909.  
  8910.  
  8911.  
  8912.  
  8913.  
  8914.  
  8915.  
  8916.  
  8917.  
  8918.  
  8919.  
  8920.  
  8921.  
  8922.  
  8923.  
  8924.  
  8925.  
  8926.  
  8927.  
  8928.  
  8929.  
  8930.  
  8931.  
  8932.           The JORF Manual (Shareware Disk Version)                      144
  8933.  
  8934.  
  8935.  
  8936.  
  8937.  
  8938.  
  8939.                                       File:Close
  8940.  
  8941.  
  8942.           Function  File:Close ( FileName )  
  8943.  
  8944.           Purpose   Explicit close for  FileName..
  8945.  
  8946.           Returns   None.
  8947.  
  8948.           See Also  Other File functions.
  8949.  
  8950.           Notes     You do not have to close files in the JORF language. An
  8951.                     unmapped file is closed automatically when the method
  8952.                     that uses that file is ended.  A Mapped file is closed
  8953.                     according to the Level specified in the mapping.  Files
  8954.                     that are renamed or deleted are automatically closed
  8955.                     prior to the renaming.
  8956.  
  8957.                     This function exists only for the rare exception where
  8958.                     an explicit close is desired for the purposes of other
  8959.                     operations in the current routine.
  8960.  
  8961.  
  8962.  
  8963.  
  8964.  
  8965.  
  8966.  
  8967.  
  8968.  
  8969.  
  8970.  
  8971.  
  8972.  
  8973.  
  8974.  
  8975.  
  8976.  
  8977.  
  8978.  
  8979.  
  8980.  
  8981.  
  8982.  
  8983.  
  8984.  
  8985.  
  8986.  
  8987.  
  8988.  
  8989.  
  8990.  
  8991.           Chapter Five - JORF Functions                                 145
  8992.  
  8993.  
  8994.  
  8995.  
  8996.  
  8997.  
  8998.                                       File:Copy
  8999.  
  9000.  
  9001.           Function  File:Copy ( OldName, NewName )  
  9002.  
  9003.           Purpose   Copies file from OldName to NewName.
  9004.  
  9005.           Returns   Ok if copied, Null if file not found or unable to
  9006.                     copy..
  9007.  
  9008.           See Also  Other File functions.
  9009.  
  9010.           Notes     This function copies a file.  Like DOS, this function
  9011.                     will erase the an existing files in order to re-use the
  9012.                     name.  
  9013.  
  9014.  
  9015.  
  9016.  
  9017.  
  9018.  
  9019.  
  9020.  
  9021.  
  9022.  
  9023.  
  9024.  
  9025.  
  9026.  
  9027.  
  9028.  
  9029.  
  9030.  
  9031.  
  9032.  
  9033.  
  9034.  
  9035.  
  9036.  
  9037.  
  9038.  
  9039.  
  9040.  
  9041.  
  9042.  
  9043.  
  9044.  
  9045.  
  9046.  
  9047.  
  9048.  
  9049.  
  9050.           The JORF Manual (Shareware Disk Version)                      146
  9051.  
  9052.  
  9053.  
  9054.  
  9055.  
  9056.  
  9057.                                        File:Del
  9058.  
  9059.  
  9060.           Function  File:Del ( Name )  
  9061.  
  9062.           Purpose   Delete a file from disk.
  9063.  
  9064.           Returns   Ok if file is deleted, Null if not.
  9065.  
  9066.           See Also  Other File functions.
  9067.  
  9068.           Notes     All information in the file will be destroyed.  If the
  9069.                     file is currently opened, it will be closed.  Does not
  9070.                     give an error if the file is absent. 
  9071.  
  9072.  
  9073.  
  9074.  
  9075.  
  9076.  
  9077.  
  9078.  
  9079.  
  9080.  
  9081.  
  9082.  
  9083.  
  9084.  
  9085.  
  9086.  
  9087.  
  9088.  
  9089.  
  9090.  
  9091.  
  9092.  
  9093.  
  9094.  
  9095.  
  9096.  
  9097.  
  9098.  
  9099.  
  9100.  
  9101.  
  9102.  
  9103.  
  9104.  
  9105.  
  9106.  
  9107.  
  9108.  
  9109.           Chapter Five - JORF Functions                                 147
  9110.  
  9111.  
  9112.  
  9113.  
  9114.  
  9115.  
  9116.                                       File:Exist
  9117.  
  9118.  
  9119.           Function  File:Exist ( FileName Command )  
  9120.  
  9121.           Purpose   Checks file existence, read permission or write
  9122.                     permission. 
  9123.  
  9124.           Returns   True if file exists, can be read, or can be opened for
  9125.                     writing.  Returns False if not.
  9126.  
  9127.           See Also  Other File functions.
  9128.  
  9129.           Notes     This function is the JORF language equivalent to the
  9130.                     UNIX C language access() function.  Command may be Null
  9131.                     or "Exist" to check for existence.
  9132.  
  9133.                     If Command is null or absent, the existence of the file
  9134.                     is checked.  If the file exists, this function returns
  9135.                     True.  If the file does not exist, the function returns
  9136.                     False.
  9137.  
  9138.                     Command may be "Read" to check for network read access
  9139.                     to the file.  If the file exists and can be read, this
  9140.                     function returns True.  If the file does not exist, or
  9141.                     cannot be opened by the current operator for reading,
  9142.                     the function returns False.
  9143.  
  9144.                     Command may be  "Write" to check for network write
  9145.                     access to the file.  If the file exists and can be
  9146.                     opened for writing by the current operator, the
  9147.                     function returns True.  If the file does not exist, or
  9148.                     cannot be opened for writing, the function returns
  9149.                     False.
  9150.  
  9151.                     This function used to be named File:Access.  The name
  9152.                     was changed in version 2.1 of the JORF Interpreter. 
  9153.                     The name was changed to be more indicative of the most
  9154.                     common use of this function.
  9155.  
  9156.           Example   See Event:Add.
  9157.  
  9158.  
  9159.  
  9160.  
  9161.  
  9162.  
  9163.  
  9164.  
  9165.  
  9166.  
  9167.  
  9168.           The JORF Manual (Shareware Disk Version)                      148
  9169.  
  9170.  
  9171.  
  9172.  
  9173.  
  9174.  
  9175.                                        File:Len
  9176.  
  9177.  
  9178.           Function  File:Len ( Name ) 
  9179.  
  9180.           Purpose   Get Length of file on disk.
  9181.  
  9182.           Returns   Length of file in Bytes.
  9183.  
  9184.           See Also  Other File functions.
  9185.  
  9186.           Notes     Returns the current length of the file in bytes.  If
  9187.                     the file is not found, the length will be 0, the same
  9188.                     as if the file is empty.
  9189.  
  9190.           Example   See File:Read
  9191.  
  9192.  
  9193.  
  9194.  
  9195.  
  9196.  
  9197.  
  9198.  
  9199.  
  9200.  
  9201.  
  9202.  
  9203.  
  9204.  
  9205.  
  9206.  
  9207.  
  9208.  
  9209.  
  9210.  
  9211.  
  9212.  
  9213.  
  9214.  
  9215.  
  9216.  
  9217.  
  9218.  
  9219.  
  9220.  
  9221.  
  9222.  
  9223.  
  9224.  
  9225.  
  9226.  
  9227.           Chapter Five - JORF Functions                                 149
  9228.  
  9229.  
  9230.  
  9231.  
  9232.  
  9233.  
  9234.                                       File:Load
  9235.  
  9236.  
  9237.           Function  File:Load ( Name )  
  9238.  
  9239.           Purpose   Load a text file into a text pointer.
  9240.  
  9241.           Returns   Text pointer.
  9242.  
  9243.           See Also  File:Save, File:Read.
  9244.  
  9245.           Notes     Loads a text file wholesale into swap storage, which is
  9246.                     much faster than trying to read it line-by-line and
  9247.                     adding the lines using Text:Add.  Use this for text
  9248.                     file editors like the JORF.INI editor.
  9249.  
  9250.           Example   See Event:Add.
  9251.  
  9252.  
  9253.  
  9254.  
  9255.  
  9256.  
  9257.  
  9258.  
  9259.  
  9260.  
  9261.  
  9262.  
  9263.  
  9264.  
  9265.  
  9266.  
  9267.  
  9268.  
  9269.  
  9270.  
  9271.  
  9272.  
  9273.  
  9274.  
  9275.  
  9276.  
  9277.  
  9278.  
  9279.  
  9280.  
  9281.  
  9282.  
  9283.  
  9284.  
  9285.  
  9286.           The JORF Manual (Shareware Disk Version)                      150
  9287.  
  9288.  
  9289.  
  9290.  
  9291.  
  9292.  
  9293.                                        File:Map
  9294.  
  9295.  
  9296.           Function  File:Map ( Name, Level, Type, Class, Map ) 
  9297.  
  9298.           Purpose   Map a file in a foreign format for reading and writing.
  9299.  
  9300.           Returns   None.
  9301.  
  9302.           See Also  File:Read, File:Write.
  9303.  
  9304.           Notes     Map a file for use with File:Read and File:Write.  When
  9305.                     you map a file you map structures and fields to write
  9306.                     different file types.
  9307.  
  9308.                     The parameter name is sets the file name.  Once mapped,
  9309.                     all reads and writes to that file will be influenced by
  9310.                     the mapping.
  9311.  
  9312.                     The parameter type sets the type of the file to be
  9313.                     mapped.  Available types are DLM, SDF, FIXED, and
  9314.                     DBASE.
  9315.  
  9316.                     DLM stands for comma delimited.  This is the most
  9317.                     common type.  Fields are quoted and separated by
  9318.                     commas.  There is a fixed number of fields per records. 
  9319.                     Records end in a carriage return line feed pair.
  9320.  
  9321.                     FIXED stands for fixed length record format.  This is
  9322.                     the most common proprietary format.
  9323.  
  9324.                     SDF stands for system data format.  This type is very
  9325.                     close to FIXED but records in an SDF file must end in a
  9326.                     carriage return-line feed pair.
  9327.  
  9328.                     DBASE stands for DBASE III format files.  Normally you
  9329.                     use the special DB:Map function to map dBASE files. 
  9330.                     This function automatically calls DB:Map if you want to
  9331.                     use this function for consistency. .
  9332.  
  9333.                     The last parameter is usually an indented section that
  9334.                     contains the field mapping.  Each line of this section
  9335.                     relates to a single field in the mapping.  You must map
  9336.                     every field, even if you don't want the data.  You can
  9337.                     map several fields into one so if you create a field
  9338.                     that is called "junk" and put all extra fields into it
  9339.                     you will fulfil the mapping requirement.
  9340.  
  9341.  
  9342.  
  9343.  
  9344.  
  9345.           Chapter Five - JORF Functions                                 151
  9346.  
  9347.  
  9348.  
  9349.  
  9350.  
  9351.  
  9352.                     The simplest mapping is for a delimited file, where you
  9353.                     merely have to list the field names.
  9354.  
  9355.  
  9356.           Contact:CvtDlm
  9357.                       New (Contact:Contact,FName,Counter)
  9358.                       FName="MyFile.Dat"
  9359.  
  9360.                       | Add a window to show what is happening
  9361.                       Win:Add ("Reading {FName}", 0, 0, 10, 76, Here)
  9362.                       File:Map (Fname,Here,"DLM","Contact")
  9363.                         Company
  9364.                         Addr1
  9365.                         Addr2
  9366.                         Addr3
  9367.                         Junk
  9368.                         FullName
  9369.                         Zip
  9370.                         Junk
  9371.                       While (File:Ok(Fname))
  9372.                         Contact=File:Read(Fname,Here)
  9373.                         ++Counter
  9374.                         If (Contact->FullName==Null)
  9375.                           Contact->FullName = Contact->Company
  9376.                         | Put record stuff in window to show what is happening
  9377.                         Str:Put (Str:Pad(Counter,4))
  9378.                         Str:Put (Str:Pad(Contact->Company,30))
  9379.                         Str:Put (Str:Pad(Contact->FullName,30))
  9380.                         Str:PutLine
  9381.                         Jorf:Write(Contact)
  9382.                       Return Ok
  9383.  
  9384.  
  9385.  
  9386.  
  9387.  
  9388.  
  9389.  
  9390.  
  9391.  
  9392.  
  9393.  
  9394.  
  9395.  
  9396.  
  9397.  
  9398.  
  9399.  
  9400.  
  9401.  
  9402.  
  9403.  
  9404.           The JORF Manual (Shareware Disk Version)                      152
  9405.  
  9406.  
  9407.  
  9408.  
  9409.  
  9410.  
  9411.                     The next simplest is for a FIXED or SDF file.  These
  9412.                     formats are very similar because they are both fixed
  9413.                     length format.  The only difference is that you must
  9414.                     include the record length when you read a FIXED length
  9415.                     file.  You don't need a record length when you read a
  9416.                     DLM file.  In a FIXED length file, if you map wrong,
  9417.                     your fields will be split.  If you really map wrong,
  9418.                     excess fields are ignored and not enough fields will
  9419.                     result in blank fields in the JORF structure.
  9420.  
  9421.                     In a fixed length format, you must specify the length
  9422.                     of each field.
  9423.  
  9424.                     Contact:CvtFIXED
  9425.                       New (Contact:Contact,FName,Counter)
  9426.                       FName="MyFile.Dat"
  9427.                       | Add a window to show what is happening
  9428.                       Win:Add ("Reading {FName}", 0, 0, 10, 76, Here)
  9429.                       File:Map (Fname,Here,"FIXED","Contact")
  9430.                         Company   Len:40
  9431.                         Addr1     Len:40
  9432.                         Addr2     Len:40
  9433.                         Addr3     Len:40
  9434.                         Junk      Len:20
  9435.                         FullName  Len:40
  9436.                         Zip       Len:10
  9437.                         Junk      Len:2
  9438.                       While (File:Ok(Fname))
  9439.                         Contact=File:Read(Fname,Here,232)  | Record length is 232
  9440.                         ++Counter
  9441.                         If (Contact->FullName==Null)
  9442.                           Contact->FullName = Contact->Company
  9443.                         | Put record stuff in window to show what is happening
  9444.                         Str:Put (Str:Pad(Counter,4))
  9445.                         Str:Put (Str:Pad(Contact->Company,30))
  9446.                         Str:Put (Str:Pad(Contact->FullName,30))
  9447.                         Str:PutLine
  9448.                         Jorf:Write(Contact)
  9449.                       Return Ok
  9450.  
  9451.  
  9452.                     The last format is for dBase files, and is handled in
  9453.                     detail in the reference section for DB:Map.  If you are
  9454.                     want to use the dBASE field names, you hardly need map
  9455.                     the file at all.  If you want to write NTX indexes, you
  9456.                     will have to declare them in the mapping section
  9457.                     however.  If you are creating a new file, or want to
  9458.                     change the field names in the file, you must map each
  9459.                     field.
  9460.  
  9461.  
  9462.  
  9463.           Chapter Five - JORF Functions                                 153
  9464.  
  9465.  
  9466.  
  9467.  
  9468.  
  9469.                     dBASE files carry their mapping in the file header.  If
  9470.                     your map does not match the actual file map, then not
  9471.                     all of your fields will have a proper value.  Your
  9472.                     fields may not come into effect until you create or
  9473.                     rebuild the file according to your specified data base
  9474.                     fields.
  9475.  
  9476.                     It is generally best to define the Len, dName (the name
  9477.                     of the field in the dBase file).  You can also define
  9478.                     the Dec for decimal point, and dtype for the dBase
  9479.                     field type.  If you do not define these the decimal
  9480.                     places will default to zero, and the dType will default
  9481.                     to 'C' for the dBase Character type.
  9482.  
  9483.                     Contact:CvtDBASE
  9484.                       New (Contact:Contact,FName,Counter)
  9485.                       FName="MyFile.Dat"
  9486.                       | Add a window to show what is happening
  9487.                       Win:Add ("Reading {FName}", 0, 0, 10, 76, Here)
  9488.                       File:Map (Fname,Here,"DBASE","Contact")
  9489.                         Company   Len:40 dName:COMPANY
  9490.                         Addr1     Len:40 dName:ADDR1
  9491.                         Addr2     Len:40 dName:ADDR2
  9492.                         Addr3     Len:40 dName:CITSTZ
  9493.                         Junk      Len:20 dName:CODES
  9494.                         FullName  Len:40 dName:CONTACT
  9495.                         Zip       Len:10 dName:ZIP
  9496.                       While (File:Ok(Fname))
  9497.                         Contact=File:Read(Fname,Here)  | No record length needed
  9498.                         ++Counter
  9499.                         If (Contact->FullName==Null)
  9500.                           Contact->FullName = Contact->Company
  9501.                         | Put record stuff in window to show what is happening
  9502.                         Str:Put (Str:Pad(Counter,4))
  9503.                         Str:Put (Str:Pad(Contact->Company,30))
  9504.                         Str:Put (Str:Pad(Contact->FullName,30))
  9505.                         Str:PutLine
  9506.                         Jorf:Write(Contact)
  9507.                       Return Ok
  9508.  
  9509.  
  9510.  
  9511.  
  9512.  
  9513.  
  9514.  
  9515.  
  9516.  
  9517.  
  9518.  
  9519.  
  9520.  
  9521.  
  9522.           The JORF Manual (Shareware Disk Version)                      154
  9523.  
  9524.  
  9525.  
  9526.  
  9527.  
  9528.  
  9529.                                      File:MoveTo
  9530.  
  9531.  
  9532.           Function  File:MoveTo ( Name, Position ) 
  9533.  
  9534.           Purpose   Go to the front or back of a file.
  9535.  
  9536.           Returns   None.
  9537.  
  9538.           See Also  File:Read.
  9539.  
  9540.           Notes     Can be used to "Rewind" a file to the beginning, or to
  9541.                     "Append" after rewinding.  Position must be the string
  9542.                     value "Beginning" or "End".  Only the first letter is
  9543.                     used, but three letters ("Beg" and "End") are
  9544.                     recommended for clarity.
  9545.  
  9546.  
  9547.  
  9548.  
  9549.  
  9550.  
  9551.  
  9552.  
  9553.  
  9554.  
  9555.  
  9556.  
  9557.  
  9558.  
  9559.  
  9560.  
  9561.  
  9562.  
  9563.  
  9564.  
  9565.  
  9566.  
  9567.  
  9568.  
  9569.  
  9570.  
  9571.  
  9572.  
  9573.  
  9574.  
  9575.  
  9576.  
  9577.  
  9578.  
  9579.  
  9580.  
  9581.           Chapter Five - JORF Functions                                 155
  9582.  
  9583.  
  9584.  
  9585.  
  9586.  
  9587.  
  9588.                                        File:Ok
  9589.  
  9590.  
  9591.           Function  File:Ok 
  9592.  
  9593.           Purpose   Check for End of File while reading.
  9594.  
  9595.           Returns   False if End of File has been reached while reading,
  9596.                     otherwise True. 
  9597.  
  9598.           See Also  File:Read, File:Len.
  9599.  
  9600.           Notes     This command is used in conjunction with File:Read to
  9601.                     create a loop that ends when the last line or record of
  9602.                     the file has been read.  This test is the opposite of
  9603.                     the normal C function eof(), because I like testing "If
  9604.                     Ok" rather than "If Not EOF".
  9605.  
  9606.                     If a file is not yet open, it is still "Ok". This fact
  9607.                     enables you to make cleaner While loops.
  9608.  
  9609.           Example   See File:Map.
  9610.  
  9611.  
  9612.  
  9613.  
  9614.  
  9615.  
  9616.  
  9617.  
  9618.  
  9619.  
  9620.  
  9621.  
  9622.  
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.  
  9629.  
  9630.  
  9631.  
  9632.  
  9633.  
  9634.  
  9635.  
  9636.  
  9637.  
  9638.  
  9639.  
  9640.           The JORF Manual (Shareware Disk Version)                      156
  9641.  
  9642.  
  9643.  
  9644.  
  9645.  
  9646.  
  9647.                                       File:Print
  9648.  
  9649.  
  9650.           Function  File:Print ( File Printer Flags ) 
  9651.  
  9652.           Purpose   Print a File on a printer.
  9653.  
  9654.           Returns   None.
  9655.  
  9656.           See Also  Arr:Printers
  9657.  
  9658.           Notes     Printer output is always a chore, and never gets any
  9659.                     easier.  Even after IBM creates the great parallel
  9660.                     interface, that is standard and needs no set up,
  9661.                     companies like Hewlett Packard create printers like the
  9662.                     original Laserjet that only support serial output.
  9663.  
  9664.                     The adjustment to MS-Windows has caused the Str:Print
  9665.                     and Char:Print commands to be eliminated, and this
  9666.                     command put in their place.   Windows support for
  9667.                     character-by-character output to printers was just too
  9668.                     slow to be tolerable.  MS-DOS programmers may also note
  9669.                     that Windows requires that printing under Windows is
  9670.                     done by page, and that only full pages may be printed. 
  9671.  
  9672.                     This command prints File to the designated printer. 
  9673.                     The printer is usually the output from the Jorf:Printer
  9674.                     function.  The file can also be SCREEN, FILE, PRN, AUX,
  9675.                     LPT1, LPT2, COM1, or COM2  indicate screen, print to
  9676.                     file, default printer, auxiliary, line printer one and
  9677.                     two and serial printer one and two respectively.  The
  9678.                     different printing mechanisms are distinct.
  9679.  
  9680.                     The of the printer options, the easiest and most robust
  9681.                     is to print to PRN, the default printer.  To test to
  9682.                     see if your printer is working, use the DOS PRINT
  9683.                     command to print a small file.  If it prints normally,
  9684.                     you should have no problems using Str:Print "PRN"
  9685.                     String.  DOS lets you redirect PRN to any printer,
  9686.                     including serial printers.
  9687.  
  9688.                     The next most robust is LPT1 and LPT2.  These use a
  9689.                     different BIOS call than PRN so they may not work even
  9690.                     when PRN works just fine.  These commands send output
  9691.                     to parallel printers.  Parallel printers may be
  9692.                     identified by having a thick cable and a
  9693.                     bigger-than-normal connector on the printer end of the
  9694.                     cable.  
  9695.  
  9696.                     The most difficult type of printer to use is the serial
  9697.                     printer.  Serial ports COM1 and COM2 are general
  9698.  
  9699.           Chapter Five - JORF Functions                                 157
  9700.  
  9701.  
  9702.  
  9703.  
  9704.  
  9705.                     communications ports, and the RS232 standard is not as
  9706.                     standard as I would like.  As always, try to get your
  9707.                     printer to work using the DOS Print command, and not
  9708.                     with the JORF interpreter.  If you cannot print from
  9709.                     DOS, I guarantee that you will not print from JORF.
  9710.  
  9711.                     You cannot set the speed of the port in the JORF
  9712.                     interpreter.  Instead, use the DOS MODE command.  Most
  9713.                     printers default to 9600 baud, 8 bits, no parity, one
  9714.                     stop bit, that can be set with the following command:
  9715.  
  9716.                                    C>Mode Com1:9600,n,8,1,p
  9717.  
  9718.                     If this works, put it in your AUTOEXEC.BAT file so it
  9719.                     sets the port up every time the computer starts.  If
  9720.                     this doesn't work, check your printer manual to see
  9721.                     that the printer and the serial port mode agree.
  9722.  
  9723.                     In theory, the File:Print supports COM1 to COM9 and
  9724.                     LPT1 to LPT9.  However, DOS and Windows your BIOS
  9725.                     probably don't.  Windows is especially notorious for
  9726.                     not handling COM3 and COM4 correctly, even when they
  9727.                     work under DOS.
  9728.  
  9729.                     JORF does not yet support any printer control codes,
  9730.                     even under windows.  Your file will be printed using
  9731.                     the default font on your printer.  Page breaks are
  9732.                     respected, and even if your document does not end with
  9733.                     a page break, a formfeed will be added.
  9734.  
  9735.                     The Flags parameter is usually omitted.  The only valid
  9736.                     flag value is "N" for No-Eject  last page.  Normally
  9737.                     the last page of the report is ejected, but this may
  9738.                     not be desired for when printing mailing labels or
  9739.                     other continuous forms.  Other flags are anticipated.
  9740.  
  9741.  
  9742.  
  9743.  
  9744.  
  9745.  
  9746.  
  9747.  
  9748.  
  9749.  
  9750.  
  9751.  
  9752.  
  9753.  
  9754.  
  9755.  
  9756.  
  9757.  
  9758.           The JORF Manual (Shareware Disk Version)                      158
  9759.  
  9760.  
  9761.  
  9762.  
  9763.  
  9764.  
  9765.           Example   This fragment is from Contact.J.
  9766.  
  9767.           Contact:MergeLetter
  9768.             New (Dest,Letter,CurrContact)
  9769.             Time:Get(Mem:Ptr)
  9770.  
  9771.             Letter=File:Load(Contact:GetLetter)
  9772.             If (Letter!=Null)
  9773.               Dest=Jorf:Printer()
  9774.               If (Dest)
  9775.                 CurrContact=Mem:Ptr->Contact
  9776.                 Mem:Ptr->Contact=Null
  9777.                 Win:Add("Printing")
  9778.                   Printing . . .
  9779.                 Rep:Add ("Merge Letter", 5, 5, 60, 75,Here)
  9780.                   Header:"" Row:1
  9781.                   Next:"Contact:NextRecord('Next')"
  9782.                   Text:"Letter"
  9783.                 File:Print("JREPORT.LST",Dest)
  9784.                 Mem:Ptr->Contact=CurrContact
  9785.             Return (Ok)
  9786.  
  9787.  
  9788.  
  9789.  
  9790.  
  9791.  
  9792.  
  9793.  
  9794.  
  9795.  
  9796.  
  9797.  
  9798.  
  9799.  
  9800.  
  9801.  
  9802.  
  9803.  
  9804.  
  9805.  
  9806.  
  9807.  
  9808.  
  9809.  
  9810.  
  9811.  
  9812.  
  9813.  
  9814.  
  9815.  
  9816.  
  9817.           Chapter Five - JORF Functions                                 159
  9818.  
  9819.  
  9820.  
  9821.  
  9822.  
  9823.  
  9824.                                       File:Read
  9825.  
  9826.  
  9827.           Function  File:Read ( Name, Size, Offset ) 
  9828.  
  9829.           Purpose   Read a line of text or a record from a disk file.
  9830.  
  9831.           Returns   The line or record that was read.
  9832.  
  9833.           See Also  Other File Functions.
  9834.  
  9835.           Notes     The File:Read and File:Write commands handle both ASCII
  9836.                     and binary files without making any distinction between
  9837.                     them.  Name is required.  Normally this command reads
  9838.                     the next line of input terminated by the line feed
  9839.                     character.  The line feed character is eliminated from
  9840.                     the input text.
  9841.  
  9842.                     (In prior versions there was a parameter Level that is
  9843.                     now no longer used.  This change is not upward
  9844.                     compatible and you must be sure that any programs for
  9845.                     JORF versions prior to 2.1 are corrected.)
  9846.  
  9847.                     If Size is specified then the a binary file read will
  9848.                     take place where the record is Size bytes.  Offset is
  9849.                     specified then read will take place at that position
  9850.                     offset.  If not specified, the current file position
  9851.                     will be used.
  9852.  
  9853.                     You can return to the beginning of the file using
  9854.                     File:MoveTo and can go to a byte position using
  9855.                     File:Read with a record size of 1.
  9856.  
  9857.                     Reading a file in comma delimited, fixed length and
  9858.                     dBase format may be influenced by using the File:Map
  9859.                     function. 
  9860.  
  9861.           Example   See Arr:Sort
  9862.  
  9863.  
  9864.  
  9865.  
  9866.  
  9867.  
  9868.  
  9869.  
  9870.  
  9871.  
  9872.  
  9873.  
  9874.  
  9875.  
  9876.           The JORF Manual (Shareware Disk Version)                      160
  9877.  
  9878.  
  9879.  
  9880.  
  9881.  
  9882.  
  9883.                                      File:Rename
  9884.  
  9885.  
  9886.           Function  File:Rename ( OldName, NewName )  
  9887.  
  9888.           Purpose   Renames OldName to NewName.
  9889.  
  9890.           Returns   Ok if renamed, Null if file not found or unable to
  9891.                     rename..
  9892.  
  9893.           See Also  Other File functions.
  9894.  
  9895.           Notes     This function renames a file.  Unlike DOS, this
  9896.                     function will erase the an existing files in order to
  9897.                     re-use the name.  (In DOS, you cannot rename a file to
  9898.                     an existing name).  
  9899.  
  9900.           Example   See Jorf:Ini.
  9901.  
  9902.  
  9903.  
  9904.  
  9905.  
  9906.  
  9907.  
  9908.  
  9909.  
  9910.  
  9911.  
  9912.  
  9913.  
  9914.  
  9915.  
  9916.  
  9917.  
  9918.  
  9919.  
  9920.  
  9921.  
  9922.  
  9923.  
  9924.  
  9925.  
  9926.  
  9927.  
  9928.  
  9929.  
  9930.  
  9931.  
  9932.  
  9933.  
  9934.  
  9935.           Chapter Five - JORF Functions                                 161
  9936.  
  9937.  
  9938.  
  9939.  
  9940.  
  9941.  
  9942.                                       File:Save
  9943.  
  9944.  
  9945.           Function  File:Save ( Name, Text ) 
  9946.  
  9947.           Purpose   Save text to a file. 
  9948.  
  9949.           Returns   None.
  9950.  
  9951.           See Also  File:Load, File:Backup.
  9952.  
  9953.           Notes     Saves a text file wholesale from swap storage, which is
  9954.                     much faster than trying to write it line-by-line.  Does
  9955.                     not automatically make a backup so if you want one, use
  9956.                     File:Backup.
  9957.  
  9958.           Example   see Jorf:Write.
  9959.  
  9960.  
  9961.  
  9962.  
  9963.  
  9964.  
  9965.  
  9966.  
  9967.  
  9968.  
  9969.  
  9970.  
  9971.  
  9972.  
  9973.  
  9974.  
  9975.  
  9976.  
  9977.  
  9978.  
  9979.  
  9980.  
  9981.  
  9982.  
  9983.  
  9984.  
  9985.  
  9986.  
  9987.  
  9988.  
  9989.  
  9990.  
  9991.  
  9992.  
  9993.  
  9994.           The JORF Manual (Shareware Disk Version)                      162
  9995.  
  9996.  
  9997.  
  9998.  
  9999.  
  10000.  
  10001.                                       File:Write
  10002.  
  10003.  
  10004.           Function  File:Write ( Name, Line, Size, Offset ) 
  10005.  
  10006.           Purpose   Write a Record to a disk file.
  10007.  
  10008.           Returns   None.
  10009.  
  10010.           See Also  Other File Commands.
  10011.  
  10012.           Notes     Writes to the file for sequential or binary output. 
  10013.                     Name is required.  (In prior versions there was a
  10014.                     parameter Level that is now no longer used.  This
  10015.                     change is not upward compatible and you must be sure
  10016.                     that any programs for JORF versions prior to 2.1 are
  10017.                     corrected.)
  10018.            
  10019.                     The file is always opened for update and the file
  10020.                     pointer is placed at the beginning of the file.  If you
  10021.                     want to create a file, use File:Del to insure that the
  10022.                     file is new.  If you want to append data to the file,
  10023.                     use File:MoveTo to change the file pointer, or
  10024.                     File:Append to write directly to the last record
  10025.                     position in the file.
  10026.  
  10027.                     If Size is specified then Line will be null padded or
  10028.                     truncated to the length specified then written to file.
  10029.                     If Offset is specified then write will take place at
  10030.                     that position offset.  If not specified, a carriage
  10031.                     return line feed pair is appended and the line is
  10032.                     written in sequential mode.  
  10033.  
  10034.                     If Line is omitted or Null, and Size is zero the file
  10035.                     will be handled as a text file and a carriage return -
  10036.                     line feed pair will be appended to the file.  The only
  10037.                     way to write files without appending the CR-LF
  10038.                     characters is to write them using the Size parameter.
  10039.  
  10040.                     You can move to any byte position in a file by using
  10041.                     File:Read with a record size of 1.  You can move to the
  10042.                     front or back of a file using File:MoveTo.
  10043.  
  10044.                     Reading a file in comma delimited, fixed length and
  10045.                     dBase format may be influenced by using the File:Map
  10046.                     function. 
  10047.  
  10048.           Example   See DirList:GetFile for an example of writing a text
  10049.                     file.
  10050.  
  10051.  
  10052.  
  10053.           Chapter Five - JORF Functions                                 163
  10054.  
  10055.  
  10056.  
  10057.  
  10058.  
  10059.  
  10060.                                     For/Thru/Step
  10061.  
  10062.  
  10063.           Function  For/Thru/Step 
  10064.  
  10065.           Purpose   A counting loop. 
  10066.  
  10067.           Returns   None.
  10068.  
  10069.           See Also  While.
  10070.  
  10071.           Notes     A specialized loop based on a numeric counter.  Based
  10072.                     on the BASIC For/Next loop, there is no need for a
  10073.                     "Next" here because indentation makes the loop
  10074.                     structure clear.  
  10075.  
  10076.                     For ( Value = 1 Thru 10 Step 2 ) 
  10077.                         Lines to do 
  10078.  
  10079.                     The BASIC key word "To" has been changed to "Thru" for
  10080.                     the sake of accuracy.  If computers are literal, the
  10081.                     commands must also be literal.  (The BASIC loop uses
  10082.                     "To" but actually goes "Through" the value, a bit of
  10083.                     inaccuracy that is not appropriate for literal minded
  10084.                     computers.)
  10085.  
  10086.                     You can use Break to break out of a For loop, or
  10087.                     Continue to continue the loop, just like a While loop.
  10088.  
  10089.                     If the ending value is a function result or
  10090.                     mathematical equation, it is calculated only as the
  10091.                     loop is entered, and not for each iteration of the
  10092.                     loop.  
  10093.  
  10094.           Example   For loops always replace While loops as this example
  10095.                     shows:
  10096.  
  10097.                     For Loop                      While loop equivalent.
  10098.  
  10099.                     OnetoTen:Start                OnetoTen:Start
  10100.                       New (Num)                     New (Num)
  10101.                       Win:Add ("One to Ten")        Win:Add ("One to Ten")
  10102.                       |                             Num = 1
  10103.                       For (Num = 1 thru 10)         While (Num <= 10)
  10104.                            Str:PutLine (Num)          Str:PutLine (Num)
  10105.                       |                               ++Num
  10106.                       Return (Ok)                   Return (Ok)
  10107.  
  10108.                     In this case, the first time the loop is entered, Num
  10109.                     is initialized to 1.  It is the incremented by one,
  10110.  
  10111.  
  10112.           The JORF Manual (Shareware Disk Version)                      164
  10113.  
  10114.  
  10115.  
  10116.  
  10117.  
  10118.                     until it is greater than 10.  The loop then continues.
  10119.                     reaches 10.  
  10120.  
  10121.                     You can see in the above example that the initializer
  10122.                     and ending condition are in a single line, and the
  10123.                     incrementer is implied, so the For loop is contained in
  10124.                     a single line.  The while loop takes the usual three
  10125.                     lines to specify the initializer, ending condition and
  10126.                     incrementer.
  10127.  
  10128.                     There is one variation on the For loop, and that is to
  10129.                     have it increment by something other than 1.  For
  10130.                     instance, maybe we want to count by threes, or count
  10131.                     backwards from 10 to 1.  To do this, simply add a
  10132.                     "Step" command to the For loop:
  10133.  
  10134.  
  10135.                     For Loop                      While loop equivalent.
  10136.  
  10137.                     ByTwos:Start                  ByTwos:Start
  10138.                       New (Num)                     New (Num)
  10139.                       Win:Add ("One to Ten")        Win:Add ("One to Ten")
  10140.                       |                             Num = 1
  10141.                       For (Num = 1 thru 10 Step 2)  While (Num <= 10)
  10142.                            Str:PutLine (Num)          Str:PutLine (Num)
  10143.                       |                               Num = Num + 2
  10144.                       Return (Ok)                   Return (Ok)
  10145.  
  10146.  
  10147.                     For Loop                      While loop equivalent.
  10148.  
  10149.                     TentoOne:Start                TentoOne:Start
  10150.                       New (Num)                     New (Num)
  10151.                       Win:Add ("One to Ten")        Win:Add ("One to Ten")
  10152.                       |                             Num = 10
  10153.                       For (Num = 1 thru 10 Step -1)  While (Num >= 1)
  10154.                            Str:PutLine (Num)          Str:PutLine (Num)
  10155.                       |                               --Num
  10156.                       Return (Ok)                  Return (Ok)
  10157.  
  10158.  
  10159.  
  10160.  
  10161.  
  10162.  
  10163.  
  10164.  
  10165.  
  10166.  
  10167.  
  10168.  
  10169.  
  10170.  
  10171.           Chapter Five - JORF Functions                                 165
  10172.  
  10173.  
  10174.  
  10175.  
  10176.  
  10177.  
  10178.                                          Here
  10179.  
  10180.  
  10181.           Function  Here
  10182.  
  10183.           Purpose   Return the current method location.
  10184.  
  10185.           Returns   The current method location.
  10186.  
  10187.           See Also  Win:Add, Event:Add.
  10188.  
  10189.           Notes     Returns the current stack position as an unsigned
  10190.                     integer.  When the interpreter is started, this value
  10191.                     is 1, and each nested method increases the level by
  10192.                     one.  The highest stack level that can be expressed
  10193.                     this way is 65,535 (Hexadecimal ffff).  This command
  10194.                     provides a simple way of marking windows, files, and
  10195.                     events so The JORF Interpreter can automatically delete
  10196.                     them when you are done.
  10197.  
  10198.                     The complete display method for a window may be nested
  10199.                     several levels deep.  Usually, the call to the method
  10200.                     uses Here, and the various methods pass that value as a
  10201.                     parameter called Level.
  10202.  
  10203.                     It is not kosher to manipulate this value by adding or
  10204.                     subtracting from it.  Doing so will confuse the
  10205.                     automatic clearing mechanism, which may clear too
  10206.                     little or too much.
  10207.  
  10208.           Example   See Jorf:Write.
  10209.  
  10210.  
  10211.  
  10212.  
  10213.  
  10214.  
  10215.  
  10216.  
  10217.  
  10218.  
  10219.  
  10220.  
  10221.  
  10222.  
  10223.  
  10224.  
  10225.  
  10226.  
  10227.  
  10228.  
  10229.  
  10230.           The JORF Manual (Shareware Disk Version)                      166
  10231.  
  10232.  
  10233.  
  10234.  
  10235.  
  10236.  
  10237.                                        If/Else
  10238.  
  10239.  
  10240.           Function  If/Else
  10241.  
  10242.           Purpose   A conditional branch.
  10243.  
  10244.           Returns   None.
  10245.  
  10246.           See Also  Switch, While.
  10247.  
  10248.           Notes     Tests the value of a parameter and executes indented
  10249.                     code sections based on that value. 
  10250.  
  10251.                     If ( TestValue ) 
  10252.                       Lines to do if True
  10253.                     Else
  10254.                       Lines to do if False
  10255.  
  10256.                     The If function tests a condition and branches based on
  10257.                     that condition.  If the condition is true, then the
  10258.                     indented section is performed.  If the condition is not
  10259.                     true, then program flow skips to the Else command.  
  10260.  
  10261.                              If (A=2)
  10262.                                 B=4
  10263.                              Else 
  10264.                                 B=6
  10265.  
  10266.                     The condition does not have to be a logical comparison. 
  10267.                     A single variable may be used instead, in which case it
  10268.                     will be True if it has any value, and False if it is
  10269.                     null.
  10270.  
  10271.                             If (Word)
  10272.                               Str:Put (Word)
  10273.                             Else
  10274.                               Str:Put ("(Null)")
  10275.  
  10276.                     The condition may be a complex comparison involving
  10277.                     both logical and value elements
  10278.  
  10279.                             If (Counter > 3 && Word)
  10280.                               Str:Put ("Counter too large for {Word}")
  10281.                             Else
  10282.                               ++Counter
  10283.  
  10284.                     Parentheses around the If test is optional.  
  10285.  
  10286.  
  10287.  
  10288.  
  10289.           Chapter Five - JORF Functions                                 167
  10290.  
  10291.  
  10292.  
  10293.  
  10294.  
  10295.  
  10296.                                        Jorf:Cls
  10297.  
  10298.  
  10299.           Function  Jorf:Cls
  10300.  
  10301.           Purpose   Clear the DOS Screen.  Does nothing under Windows. 
  10302.  
  10303.           Returns   None. 
  10304.  
  10305.                     Both the DOS and the Windows versions of JORF place
  10306.                     windows on the previous screen contents.  Although this
  10307.                     is traditional for Windows programs, most DOS programs
  10308.                     clear the screen instead.  To allow you to follow this
  10309.                     custom, this command will clear the screen in the DOS
  10310.                     version of JORF. 
  10311.  
  10312.                     If you clear the screen while some windows have been
  10313.                     displayed, you will get some really weird results when
  10314.                     those windows are later "erased".   Be sure there are
  10315.                     no windows displayed when you clear the screen.
  10316.  
  10317.  
  10318.  
  10319.  
  10320.  
  10321.  
  10322.  
  10323.  
  10324.  
  10325.  
  10326.  
  10327.  
  10328.  
  10329.  
  10330.  
  10331.  
  10332.  
  10333.  
  10334.  
  10335.  
  10336.  
  10337.  
  10338.  
  10339.  
  10340.  
  10341.  
  10342.  
  10343.  
  10344.  
  10345.  
  10346.  
  10347.  
  10348.           The JORF Manual (Shareware Disk Version)                      168
  10349.  
  10350.  
  10351.  
  10352.  
  10353.  
  10354.  
  10355.                                        Jorf:Del
  10356.  
  10357.  
  10358.           Function  Jorf:Del ( Item ) 
  10359.  
  10360.           Purpose   Deletes data. 
  10361.  
  10362.           Returns   None.
  10363.  
  10364.           See Also  Jorf:Write.
  10365.  
  10366.           Notes     Deletes the data associated with Item.  This may be a
  10367.                     Structure or block of text.  To delete a method use
  10368.                     Method:Del.
  10369.  
  10370.                     The system automatically saves data when it is indexed
  10371.                     to the Rule system, and when you use the Jorf:Copy and
  10372.                     Jorf:Write commands.  The Data is a permanent part of
  10373.                     the data file until it is deleted with this function.
  10374.  
  10375.                     There is no harm in doing a precautionary delete for
  10376.                     item that has not been saved.
  10377.  
  10378.  
  10379.  
  10380.  
  10381.  
  10382.  
  10383.  
  10384.  
  10385.  
  10386.  
  10387.  
  10388.  
  10389.  
  10390.  
  10391.  
  10392.  
  10393.  
  10394.  
  10395.  
  10396.  
  10397.  
  10398.  
  10399.  
  10400.  
  10401.  
  10402.  
  10403.  
  10404.  
  10405.  
  10406.  
  10407.           Chapter Five - JORF Functions                                 169
  10408.  
  10409.  
  10410.  
  10411.  
  10412.  
  10413.  
  10414.                                        Jorf:Do
  10415.  
  10416.  
  10417.           Function  Jorf:Do ( MethodName ) 
  10418.  
  10419.           Purpose   Interpret a string as a command. 
  10420.  
  10421.           Returns   Return value of command.
  10422.  
  10423.           See Also  Event:Do.
  10424.  
  10425.           Notes     Interprets a string as if it were a command.  This is
  10426.                     used to execute a command that has been assembled using
  10427.                     string values.  This ability allows the assembly and
  10428.                     execution of new commands and methods by a program
  10429.                     which then immediately calls them.  
  10430.  
  10431.  
  10432.  
  10433.  
  10434.  
  10435.  
  10436.  
  10437.  
  10438.  
  10439.  
  10440.  
  10441.  
  10442.  
  10443.  
  10444.  
  10445.  
  10446.  
  10447.  
  10448.  
  10449.  
  10450.  
  10451.  
  10452.  
  10453.  
  10454.  
  10455.  
  10456.  
  10457.  
  10458.  
  10459.  
  10460.  
  10461.  
  10462.  
  10463.  
  10464.  
  10465.  
  10466.           The JORF Manual (Shareware Disk Version)                      170
  10467.  
  10468.  
  10469.  
  10470.  
  10471.  
  10472.  
  10473.                                        Jorf:Dup
  10474.  
  10475.  
  10476.           Function  Jorf:Dup ( Item ) 
  10477.  
  10478.           Purpose   Make a copy of a Text or Structure.
  10479.  
  10480.           Returns   A duplicate copy of Item.
  10481.  
  10482.           See Also  Jorf:Del.
  10483.  
  10484.           Notes     This command is used to create a duplicate copy of Item
  10485.                     so you can change it without affecting the original. 
  10486.                     This command will automatically write both copies to
  10487.                     the current project file, so if they are temporary,
  10488.                     they must be deleted using Jorf:Del.
  10489.  
  10490.           Example   See Jorf:Del.
  10491.  
  10492.  
  10493.  
  10494.  
  10495.  
  10496.  
  10497.  
  10498.  
  10499.  
  10500.  
  10501.  
  10502.  
  10503.  
  10504.  
  10505.  
  10506.  
  10507.  
  10508.  
  10509.  
  10510.  
  10511.  
  10512.  
  10513.  
  10514.  
  10515.  
  10516.  
  10517.  
  10518.  
  10519.  
  10520.  
  10521.  
  10522.  
  10523.  
  10524.  
  10525.           Chapter Five - JORF Functions                                 171
  10526.  
  10527.  
  10528.  
  10529.  
  10530.  
  10531.  
  10532.                                       Jorf:Exit
  10533.  
  10534.  
  10535.           Function  Jorf:Exit ( Status, Message, Command ) 
  10536.  
  10537.           Purpose   Exit from The JORF Interpreter.
  10538.  
  10539.           Returns   Does not return.
  10540.  
  10541.           See Also  Jorf:System.
  10542.  
  10543.           Notes     Flushes disk caches and memory items, closes all files
  10544.                     and windows, exits to the operating system.  This
  10545.                     function is called involuntarily when a fatal error
  10546.                     occurs.  
  10547.  
  10548.                     If Status has a value, this is returned to the
  10549.                     operating system.  Under windows 3.1 the program return
  10550.                     value is not supported but maybe Mr. Microsoft will fix
  10551.                     this someday.  
  10552.  
  10553.                     If Message has a value, it is displayed after the
  10554.                     original screen is restored in DOS, or in a message box
  10555.                     under Windows.  Generally, Message is used only to
  10556.                     report fatal errors.
  10557.  
  10558.                     The Command may be used to chain to other programs. 
  10559.                     Under DOS, the command is chained using COMMAND.COM /C
  10560.                     to support batch files and full path specs.  This
  10561.                     command is omitted on the windows version to allow you
  10562.                     to chain to a Windows program.  If you are running the
  10563.                     Windows version and want to chain to a DOS program, you
  10564.                     will have to prefix your DOS command line with
  10565.                     COMMAND.COM /C.
  10566.  
  10567.                     In general, you can chain to any batch file, .COM file
  10568.                     or .EXE file, and can pass up to 10 parameters (or 110
  10569.                     bytes whichever is longer) to that file.
  10570.  
  10571.  
  10572.  
  10573.  
  10574.  
  10575.  
  10576.  
  10577.  
  10578.  
  10579.  
  10580.  
  10581.  
  10582.  
  10583.  
  10584.           The JORF Manual (Shareware Disk Version)                      172
  10585.  
  10586.  
  10587.  
  10588.  
  10589.  
  10590.  
  10591.                                       Jorf:File
  10592.  
  10593.  
  10594.           Function  Jorf:File ( Name Level ) 
  10595.  
  10596.           Purpose   Declares a project file, gets the name of existing
  10597.                     project file.
  10598.  
  10599.           Returns   Previous project file name.
  10600.  
  10601.           Notes     Project files hold indexes and data, classes and
  10602.                     methods.  All of a JORF language application can run
  10603.                     out of a single project file.  However, it is
  10604.                     advantageous to split various types of information into
  10605.                     various files.  Jorf:File declares a new file to be
  10606.                     used by the interpreter.
  10607.  
  10608.                     The new file is tied to the stack using Level, which
  10609.                     must be the value of Here from the calling method.  If
  10610.                     the name and level are absent, this function just
  10611.                     returns the current file.  If they are present, the new
  10612.                     file is used by the interpreter.
  10613.  
  10614.                     Methods are searched in the current file, and then in
  10615.                     the base project METHODS.JRF.  The system also
  10616.                     allocates a project called SWAPFILE.JRF for memory
  10617.                     swapping.  Indexed data is searched only in the current
  10618.                     file.
  10619.  
  10620.                     I created this use of files without precedent or
  10621.                     experience.  It much looser than any file definition I
  10622.                     have ever seen in a computer system.  However, it
  10623.                     works, and it has some redeeming features.  For one,
  10624.                     the files are established in relative positions, and
  10625.                     may be freely moved or renamed without compromising the
  10626.                     data in those files.  A file may even be shipped to
  10627.                     another system, and used without any further set up. 
  10628.                     This works because the interpreter insures that the
  10629.                     data and indexes in a given project file are always
  10630.                     synchronized.
  10631.  
  10632.                     The other redeeming feature is the simplicity of the
  10633.                     scheme.  You don't really open the file, allocate it,
  10634.                     expand it or close it.  This command basically says
  10635.                     "Use this file for a while" and the interpreter does. 
  10636.  
  10637.           Also Note When creating a program in the debugger, the
  10638.                     interpreter automatically does a Jorf:File for the file
  10639.                     you are working on.  For instance, when you load the
  10640.                     Haiku.J source file, the interpreter executes
  10641.                     Jorf:File("Haiku.Jrf",Here) before it runs the program. 
  10642.  
  10643.           Chapter Five - JORF Functions                                 173
  10644.  
  10645.  
  10646.  
  10647.  
  10648.  
  10649.                     However, if you translate your program to the C
  10650.                     language, and compile it, the interpreter is no longer
  10651.                     available, and you must open the file yourself. 
  10652.  
  10653.                     The best explanation of how this system works comes
  10654.                     from running the interpreter with the Memory Info=Yes
  10655.                     flag set in the JORF.INI file.  This creates a display
  10656.                     of memory usage and current file information.
  10657.  
  10658.                     If you run the tutorial, you can watch the system
  10659.                     switch to the tutorial file, and the help file, when
  10660.                     you enter those menus. 
  10661.  
  10662.                     The following command will flush if there is less than
  10663.                     50 K (or 51,200) bytes available in the free memory
  10664.                     pool:
  10665.  
  10666.                          Jorf:Flush( 50 )
  10667.  
  10668.  
  10669.           Example   See Jorf:Write.
  10670.  
  10671.  
  10672.  
  10673.  
  10674.  
  10675.  
  10676.  
  10677.  
  10678.  
  10679.  
  10680.  
  10681.  
  10682.  
  10683.  
  10684.  
  10685.  
  10686.  
  10687.  
  10688.  
  10689.  
  10690.  
  10691.  
  10692.  
  10693.  
  10694.  
  10695.  
  10696.  
  10697.  
  10698.  
  10699.  
  10700.  
  10701.  
  10702.           The JORF Manual (Shareware Disk Version)                      174
  10703.  
  10704.  
  10705.  
  10706.  
  10707.  
  10708.  
  10709.                                       Jorf:Flush
  10710.  
  10711.  
  10712.           Function  Jorf:Flush ( Size ) 
  10713.  
  10714.           Purpose   Flushes memory to disk. 
  10715.  
  10716.           Returns   None.
  10717.  
  10718.           Notes     If Size is present and not zero, checks to see if that
  10719.                     much memory (in kilobytes) is available.  If so, then
  10720.                     does nothing.  If not, then flushes memory to obtain
  10721.                     space.  Always flushes if Size is zero or absent.  This
  10722.                     command may be used to insure that a particular
  10723.                     procedure, like obtaining entry from a data input
  10724.                     screen, can be completed without unnecessary delays due
  10725.                     to memory flushes.
  10726.  
  10727.                     Items that are flushed generally fall into two
  10728.                     categories; items that are needed again, and items that
  10729.                     are not.  Those which are needed again will be read
  10730.                     from disk resulting in spectacular performance
  10731.                     degradation.  Those which are not will stay on disk
  10732.                     where they belong.
  10733.  
  10734.                     JORF uses this command internally whenever it runs out
  10735.                     of memory.  It is supplied here as a Function because
  10736.                     some Methods may see improved performance if memory is
  10737.                     checked and flushed before or after they are invoked.  
  10738.  
  10739.  
  10740.  
  10741.  
  10742.  
  10743.  
  10744.  
  10745.  
  10746.  
  10747.  
  10748.  
  10749.  
  10750.  
  10751.  
  10752.  
  10753.  
  10754.  
  10755.  
  10756.  
  10757.  
  10758.  
  10759.  
  10760.  
  10761.           Chapter Five - JORF Functions                                 175
  10762.  
  10763.  
  10764.  
  10765.  
  10766.  
  10767.  
  10768.                                       Jorf:Info
  10769.  
  10770.  
  10771.           Function  Jorf:Info ( InfoValue )
  10772.  
  10773.           Purpose   Get information about the JORF environment. 
  10774.  
  10775.           Returns   None.
  10776.  
  10777.           Notes     The variable InfoValue should be a string with one of
  10778.                     the following values.  The return value is as noted. 
  10779.                     This function is a catchall to pass some quirky
  10780.                     internal values and DOS environment values to JORF
  10781.                     language programs.
  10782.  
  10783.                     Value               Returned Value
  10784.  
  10785.                     NumFiles       Number of JORF files open
  10786.                     MemFree        Current free memory
  10787.                     DosVer         MS-DOS Version
  10788.                     DiskFree       Amount of free disk space
  10789.                     DiskCap        Capacity of current disk
  10790.                     Windows        TRUE for Windows version
  10791.                     Graphics       TRUE if in graphics mode
  10792.                     Env:Value      If Value is in DOS environment, returns
  10793.                                    environment value.  Otherwise returns
  10794.                                    Null.
  10795.  
  10796.                     If you use the letters "ENV" followed by a colon, and
  10797.                     then the name of a DOS Environment variable, the value
  10798.                     of that variable is returned.  For instance, to get the
  10799.                     current DOS path, use the  command Jorf:Info (
  10800.                     "Env:PATH" ).  Upper and lower case does not matter,
  10801.                     even for the environment variable name.
  10802.  
  10803.                     More values are intended in the future.  If you need a
  10804.                     DOS environment value for your application, please give
  10805.                     a call.  If it does not require too much additional
  10806.                     code (The size of the EXE file in the DOS version is
  10807.                     really maxed out) I will try to add it for you.
  10808.  
  10809.           Example   See Jorf:System, sample program DOS.J which checks
  10810.                     "Windows" to see if you are running the Windows
  10811.                     version.
  10812.  
  10813.  
  10814.  
  10815.  
  10816.  
  10817.  
  10818.  
  10819.  
  10820.           The JORF Manual (Shareware Disk Version)                      176
  10821.  
  10822.  
  10823.  
  10824.  
  10825.  
  10826.  
  10827.                                        Jorf:Ini
  10828.  
  10829.  
  10830.           Function  Jorf:Ini 
  10831.  
  10832.           Purpose   Re-read JORF.INI file.
  10833.  
  10834.           Returns   None.
  10835.  
  10836.           Notes     A large number of system parameters are set in the
  10837.                     JORF.INI and JORFWIN.INI files.  This function allows
  10838.                     you to change these values inside a JORF program.  To
  10839.                     set new values, write to the file using the normal file
  10840.                     read and file write commands.  Then call Jorf:Ini() to
  10841.                     reset the initialization parameters.
  10842.  
  10843.                     If you change video mode or screen colors, the windows
  10844.                     that have already been displayed will not be changed. 
  10845.                     To effect a change, you will have to remove all windows
  10846.                     and redisplay them from scratch.  There is currently no
  10847.                     automatic system for re-displaying the windows to reset
  10848.                     colors.
  10849.  
  10850.           Example   This predecessor to the EDITINI.J sample file could
  10851.                     actually change colors on-the-fly.  It is dangerous to
  10852.                     change other parameters, like MultiUser.
  10853.  
  10854.           Colorset:Start
  10855.             New (IniFile)
  10856.             IniFile   = Str:At(Mem:Ptr->Args,1,Str:In(Mem:Ptr->Args,'.'))  
  10857.             IniFile   = IniFile+'INI'
  10858.             Event:Add()
  10859.             While (Ok)
  10860.               Win:Add ("Set Colors")
  10861.                 MLine:"&Bright Blue    "  Action:"ColorSet:Set('Blue')"
  10862.                 MLine:"&Windows White  "  Action:"ColorSet:Set('White')"
  10863.                 MLine:"&JORF Default   "  Action:"ColorSet:Set('Default')"
  10864.                 MLine:"&Grey Green     "  Action:"ColorSet:Set('Gray')"
  10865.                 MLine:"&Emerald Green  "  Action:"ColorSet:Set('Green')"
  10866.                 MLine:"&Monochrome     "  Action:"ColorSet:Set('Mono')"
  10867.                 MLine:"&Rev Monochrome "  Action:"ColorSet:Set('RevMono')"
  10868.                 MLine:"E&xit           "  Action:"Return('Esc_Key')"
  10869.               Win:Del
  10870.               If (Kbd:Got=='Esc_Key' Or Kbd:Got=='X_Key')
  10871.                 Break
  10872.             Return Ok
  10873.  
  10874.           ColorSet:Set(Color)
  10875.             New (Line,Indent)
  10876.             If (Str:In(IniFile,"WIN")==0)
  10877.               | Setting DOS colors
  10878.  
  10879.           Chapter Five - JORF Functions                                 177
  10880.  
  10881.  
  10882.  
  10883.  
  10884.  
  10885.               Switch (Color)
  10886.                 Case 'Blue'
  10887.              Colorset:Write
  10888.                +Mono/Color=Mono
  10889.                +Line Style=single
  10890.                +Border=Bright Cyan/Blue
  10891.                +Title=Bright White/Cyan
  10892.                +Shadow=White/Black
  10893.                +Normal=Bright Cyan/Blue
  10894.                +Low=Bright White/Blue
  10895.                +Medium=Light Blue/Blue
  10896.                +High=Bright White/Cyan
  10897.                +Bold=Bright Cyan/Cyan
  10898.                +Message=Yellow/Blue
  10899.                 Case 'White'
  10900.              Colorset:Write
  10901.                +Mono/Color=Mono
  10902.                +Line Style=Thick
  10903.                +Border Color=Bright White/White
  10904.                +Title Color=Bright White/White
  10905.                +Shadow Color=Black/Gray
  10906.                +Message Color=Gray/White
  10907.                +Normal Color=Bright White/White
  10908.                +Low Color=Gray/White
  10909.                +Medium Color=Bright White/White
  10910.                +High Color=White/Gray
  10911.                +Bold Color=Bright White/Gray
  10912.                 Case 'Default'
  10913.              Colorset:Write
  10914.                +Mono/Color=Mono
  10915.                +Line Style=single
  10916.                +Border=Bright White/White
  10917.                +Title=Light Blue/White
  10918.                +Shadow=Light Magenta/Blue
  10919.                +Normal=Bright White/White
  10920.                +Low=Yellow/White
  10921.                +Medium=Light Blue/White
  10922.                +High=Yellow/Blue
  10923.                +Bold=Bright White/Blue
  10924.                +Message=Yellow/White
  10925.                 Case 'Gray'
  10926.              Colorset:Write
  10927.                +Mono/Color=Mono
  10928.                +Line Style=Double
  10929.                +Border Color=Bright Cyan/Gray
  10930.                +Title Color=Bright White/Gray
  10931.                +Shadow Color=Cyan/Black
  10932.                +Message Color=Bright Yellow/Gray
  10933.                +Normal Color=Bright White/Gray
  10934.                +Low Color=Bright Yellow/Gray
  10935.                +Medium Color=Bright Cyan/Gray
  10936.                +High Color=Bright Yellow/Cyan
  10937.  
  10938.           The JORF Manual (Shareware Disk Version)                      178
  10939.  
  10940.  
  10941.  
  10942.  
  10943.  
  10944.                +Bold Color=Bright White/Cyan
  10945.                 Case 'Green'
  10946.              Colorset:Write
  10947.                +Mono/Color=Mono
  10948.                +Line Style=Double
  10949.                +Border Color=Bright Green/Cyan
  10950.                +Title Color=Bright White/Green
  10951.                +Shadow Color=Cyan/Black
  10952.                +Message Color=Bright Yellow/Cyan
  10953.                +Normal Color=Bright White/Cyan
  10954.                +Low Color=Bright Yellow/Cyan
  10955.                +Medium Color=Bright Cyan/Cyan
  10956.                +High Color=Bright Yellow/Gray
  10957.                +Bold Color=Bright White/Gray
  10958.                 Case 'Mono'
  10959.              Colorset:Write
  10960.                +Mono/Color=Mono
  10961.                +Line Style=Double
  10962.                +Border Color=Bright White/Black
  10963.                +Title Color=Bright White/Black
  10964.                +Shadow Color=White/Black
  10965.                +Message Color=Bright White/Black
  10966.                +Normal Color=White/Black
  10967.                +Low Color=Bright White/Black
  10968.                +Medium Color=White/Black
  10969.                +High Color=Black/White
  10970.                +Bold Color=Black/White
  10971.                 Case 'RevMono'
  10972.              Colorset:Write
  10973.                +Mono/Color=Mono
  10974.                +Line Style=Double
  10975.                +Border Color=Black/White
  10976.                +Title Color=Black/Bright White
  10977.                +Shadow Color=White/Black
  10978.                +Message Color=Black/Bright White
  10979.                +Normal Color=Black/White
  10980.                +Low Color=Black/Bright White
  10981.                +Medium Color=Black/White
  10982.                +High Color=White/Black
  10983.                +Bold Color=Bright White/Black
  10984.             Return (Ok)
  10985.  
  10986.           ColorSet:Write(NewText)
  10987.             New (NewFile,Found)
  10988.             Win:Add
  10989.               Rewriting INI file
  10990.             NewFile = Str:At(IniFile,1,Str:In(IniFile,'.')) + "NEW"
  10991.             File:Del(NewFile)
  10992.             File:Open(NewFile,Here)
  10993.             File:Open(IniFile,Here)
  10994.             While (File:Ok(IniFile))
  10995.               Line = File:Read(IniFile)
  10996.  
  10997.           Chapter Five - JORF Functions                                 179
  10998.  
  10999.  
  11000.  
  11001.  
  11002.  
  11003.               If (Str:In (Line,"Window") And Str:In (Line,"Text"))
  11004.                 Found=True
  11005.                 File:Write(NewFile,"Window=Text")
  11006.                 Indent = Str:Ind(NewText)
  11007.                 While (Str:Ind(NewText)>=Indent)
  11008.              File:Write(NewFile,Str:At(NewText,Indent))
  11009.              NewText=Text:Next(NewText)
  11010.                 While (File:Ok(IniFile))
  11011.              Line=File:Read(IniFile)
  11012.              If (Str:At(Line,1,1)!='+')
  11013.                Break
  11014.               File:Write(NewFile,Line)
  11015.             If (Found==Null)
  11016.               Msg:Add
  11017.                 Could not find Window=Text
  11018.                 line in the INI file.
  11019.             Else
  11020.               File:Backup(IniFile)
  11021.               File:Rename(NewFile,IniFile)
  11022.             Jorf:Ini()             | <--Here it is way at the bottom
  11023.             Return (Null)
  11024.  
  11025.  
  11026.  
  11027.  
  11028.  
  11029.  
  11030.  
  11031.  
  11032.  
  11033.  
  11034.  
  11035.  
  11036.  
  11037.  
  11038.  
  11039.  
  11040.  
  11041.  
  11042.  
  11043.  
  11044.  
  11045.  
  11046.  
  11047.  
  11048.  
  11049.  
  11050.  
  11051.  
  11052.  
  11053.  
  11054.  
  11055.  
  11056.           The JORF Manual (Shareware Disk Version)                      180
  11057.  
  11058.  
  11059.  
  11060.  
  11061.  
  11062.  
  11063.                                       Jorf:Lock
  11064.  
  11065.  
  11066.           Function  Jorf:Lock( Structure ) 
  11067.  
  11068.           Purpose   Locks a record, reports locked status. 
  11069.  
  11070.           Returns   Null if record is already locked, OK if a new lock was
  11071.                     placed.
  11072.  
  11073.           See Also  Jorf:Unlock, Jorf:Write.
  11074.  
  11075.           Notes     The Structure is a JORF language structure that is used
  11076.                     to hold fields to be stored to the disk.  This function
  11077.                     works with Jorf:Unlock and Jorf:Write to enable you to
  11078.                     do record level locking.  
  11079.  
  11080.                     Record locking is used to prevent two people from
  11081.                     changing the same record at the same time.  If you do
  11082.                     not have "Multiuser=Yes" set in your JORF.INI or
  11083.                     JORFWIN.INI file then this function has no effect.
  11084.  
  11085.                     To prevent two people from editing a record, the record
  11086.                     must be locked whenever it is being changed.  In JORF,
  11087.                     the process of locking and the process of checking
  11088.                     whether a lock is in place are both done using the
  11089.                     Jorf:Lock function.  Before editing a record
  11090.                     (structure), you should call this command.  
  11091.  
  11092.                     If the Jorf:Lock result code is OK, (OK, Numeric 1, or
  11093.                     True are the same in the JORF language) then you have
  11094.                     locked the record properly and the edit can continue. 
  11095.                     If the result code is NULL (or 0) then someone else has
  11096.                     the record locked and you should not edit it.  In
  11097.                     multiuser systems, structures are re-read from disk
  11098.                     when locked to insure they contain information that may
  11099.                     have been written by another operator just prior to
  11100.                     locking by the current operator.
  11101.  
  11102.                     When the editing is complete you have the choice of
  11103.                     aborting the change, or accepting the change and
  11104.                     writing to disk.  If you wish to abort, use the
  11105.                     Jorf:unlock function.  This function unlocks the record
  11106.                     and re-reads it from file, restoring the original
  11107.                     values.  To keep the changed information, use
  11108.                     Jorf:Write, which will write the changed data and
  11109.                     automatically unlock the record.  
  11110.  
  11111.                     If you fail to unlock or write the record after
  11112.                     locking, it will remain locked until the file is
  11113.                     rebuilt using Jorf:Rebuild.  This is very bad to have
  11114.  
  11115.           Chapter Five - JORF Functions                                 181
  11116.  
  11117.  
  11118.  
  11119.  
  11120.  
  11121.                     records locked, and you should never allow a function
  11122.                     to exit without unlocking or writing the current
  11123.                     record. 
  11124.  
  11125.                     For File Pros:  The JORF locking system does more than
  11126.                     just set a software lock.  It actually locks only the
  11127.                     header of the file long enough to write a physical
  11128.                     marker in the stored record, the record is rewritten
  11129.                     and header is unlocked.  That is why a locked record
  11130.                     remains locked, even though you exit JORF and even
  11131.                     reboot your computer.  The Jorf:Rebuild function runs
  11132.                     under an exclusive file lock and automatically clears
  11133.                     releases the physical lock bit for all records.  Locked
  11134.                     records are not owned, so one user (or supervisor
  11135.                     function) can unlock a record locked by another user. 
  11136.  
  11137.                     For File Novices:  A common problem happens in programs
  11138.                     that use multiple file locks.  If the program locks two
  11139.                     records in one place, and two records in another place
  11140.                     (say a contact record and an order record)  you can get
  11141.                     a situation called deadlock.  This happens when one
  11142.                     operator locks the first, another operator locks the
  11143.                     second, and the function the first operator is running
  11144.                     does not release the first until the second is
  11145.                     available.  Like the name implies, Deadlock is to be
  11146.                     avoided at all costs.
  11147.  
  11148.                     Three ways to avoid deadlock are:
  11149.  
  11150.                          A sure way:  Avoid ever having two file locks.  A
  11151.                          creative programmer will realize that while we are
  11152.                          editing the Order, we are not editing the Contact,
  11153.                          and set locks accordingly.  If you never lock two
  11154.                          records at once, you cannot have deadlock.
  11155.  
  11156.                          A good way:  Always lock files in the same order,
  11157.                          and unlock them in reverse order of locking. 
  11158.                          Always lock Contact, then Order, and release Order
  11159.                          then Contact.  This will always work, but requires
  11160.                          discipline and planning, especially when you
  11161.                          consider that reports and batch processes may also
  11162.                          be locking and releasing the records.
  11163.  
  11164.                          A bad way:  If the second record is locked,
  11165.                          release the first while waiting for the second to
  11166.                          be released.  This is a kludge that requires even
  11167.                          more discipline and planning.  One mistake and you
  11168.                          will still have deadlock.
  11169.  
  11170.                     There are other techniques to avoid deadlock.  The
  11171.                     worst way is to ignore it.  You might think "This data
  11172.                     base has 10,000 records so there is only a 1 in 10,000
  11173.  
  11174.           The JORF Manual (Shareware Disk Version)                      182
  11175.  
  11176.  
  11177.  
  11178.  
  11179.  
  11180.                     chance that two operators will be in the same record". 
  11181.                     In real life it is common to see an operator who is
  11182.                     modifying a record, has a question and goes to consult
  11183.                     another operator who attempts to modify the same
  11184.                     record.  Or the case where two salespeople are both
  11185.                     working on a very important customer's order.  Taking
  11186.                     care with your locking is necessary to insure that your
  11187.                     application runs smoothly in all these circumstances.
  11188.  
  11189.  
  11190.  
  11191.  
  11192.  
  11193.  
  11194.  
  11195.  
  11196.  
  11197.  
  11198.  
  11199.  
  11200.  
  11201.  
  11202.  
  11203.  
  11204.  
  11205.  
  11206.  
  11207.  
  11208.  
  11209.  
  11210.  
  11211.  
  11212.  
  11213.  
  11214.  
  11215.  
  11216.  
  11217.  
  11218.  
  11219.  
  11220.  
  11221.  
  11222.  
  11223.  
  11224.  
  11225.  
  11226.  
  11227.  
  11228.  
  11229.  
  11230.  
  11231.  
  11232.  
  11233.           Chapter Five - JORF Functions                                 183
  11234.  
  11235.  
  11236.  
  11237.  
  11238.  
  11239.  
  11240.                                       Jorf:Move
  11241.  
  11242.  
  11243.           Function  Jorf:Move (Source, Dest, Class )
  11244.  
  11245.           Purpose   Move elements of a structure.
  11246.  
  11247.           Returns   None.
  11248.  
  11249.           Notes     If you just want to duplicate a structure, use
  11250.                     Jorf:Dupe.  Sometimes, however, you want to transfer
  11251.                     only like-named elements of a structure.  For that
  11252.                     reason alone this function exists.
  11253.  
  11254.                     The use of this function is pretty obscure.  Lets say
  11255.                     you have a structure like "C" which is a member of the
  11256.                     "Control" class, and it shares elements with a
  11257.                     structure like "P" which is a member of the "Project"
  11258.                     class.  You can quickly transfer "Project"  elements
  11259.                     with the following command:
  11260.  
  11261.                          Jorf:Move ( C, P, "Project")
  11262.  
  11263.  
  11264.                     Note the class name is passed as a string, and must be
  11265.                     quoted.
  11266.  
  11267.                     An even more obscure use of this command is to set
  11268.                     specific elements to blank.  You can do this by using
  11269.                     Null as the source.  You can set all elements without
  11270.                     specifying a class, or only the elements of a class.
  11271.  
  11272.                     Jorf:Move (Null, P)      | Blank out Project P
  11273.                     Jorf:Move (Null, C, "Project")     | Blank out "Project" elements of C 
  11274.  
  11275.  
  11276.  
  11277.  
  11278.  
  11279.  
  11280.  
  11281.  
  11282.  
  11283.  
  11284.  
  11285.  
  11286.  
  11287.  
  11288.  
  11289.  
  11290.  
  11291.  
  11292.           The JORF Manual (Shareware Disk Version)                      184
  11293.  
  11294.  
  11295.  
  11296.  
  11297.  
  11298.  
  11299.                                       Jorf:Pack
  11300.  
  11301.  
  11302.           Function  Jorf:Pack 
  11303.  
  11304.           Purpose   Packs a JORF file. 
  11305.  
  11306.           Returns   None.
  11307.  
  11308.           See Also  Jorf:Rebuild.
  11309.  
  11310.           Notes     Converts the current JORF file to a special ASCII file
  11311.                     format.  This format retains all data, but omits any
  11312.                     indexes.  It also contains offsets to recursive
  11313.                     structures and sparse structures such as large arrays. 
  11314.                     Packed files have the extension JPK.
  11315.  
  11316.                     Because the packed format does not contain indexes, it
  11317.                     is usually half the size of the .JRF file.  This file
  11318.                     can be used to rebuild a .JRF file.  The file must be
  11319.                     rebuilt with the appropriate class definitions, so that
  11320.                     indexes are added properly.
  11321.  
  11322.  
  11323.  
  11324.  
  11325.  
  11326.  
  11327.  
  11328.  
  11329.  
  11330.  
  11331.  
  11332.  
  11333.  
  11334.  
  11335.  
  11336.  
  11337.  
  11338.  
  11339.  
  11340.  
  11341.  
  11342.  
  11343.  
  11344.  
  11345.  
  11346.  
  11347.  
  11348.  
  11349.  
  11350.  
  11351.           Chapter Five - JORF Functions                                 185
  11352.  
  11353.  
  11354.  
  11355.  
  11356.  
  11357.  
  11358.                                      Jorf:Printer
  11359.  
  11360.  
  11361.  
  11362.           Function  Jorf:Printer
  11363.  
  11364.           Purpose   Displays a preprogrammed printer selection box.
  11365.  
  11366.           Returns   None.
  11367.  
  11368.           See Also  Arr:Printers, File:Print
  11369.  
  11370.           Notes     This command displays a standard pre-programmed printer
  11371.                     selection box to save you the time of creating one.  It
  11372.                     is really a JORF language routine, translated and
  11373.                     compiled into the JORF interpreter.  The example below
  11374.                     shows the actual code for this routine.
  11375.  
  11376.           Example
  11377.  
  11378.           Jorf:Printer
  11379.             New (PrintList,PrintChoice,Dest)
  11380.  
  11381.             Event:Add()
  11382.             PrintList = Arr:Printers()
  11383.             Win:Add("Select Printer")
  11384.               Group:"&Printers", Row:1 Col:1 Len:6 Wid:22
  11385.               Array:"" Field:"PrintList" Choice:"PrintChoice"
  11386.  
  11387.               Button:"   &Go   " Row:1 Col:32
  11388.                 Action:"Dest=PrintList[PrintChoice]"
  11389.               Button:" &Cancel " Row:4 Col:32 Action:"Return ('Esc_Key')"
  11390.             If (Dest='Esc_Key' Or Kbd:Got='Esc_Key')
  11391.               Dest=Null
  11392.             Return(Dest)
  11393.  
  11394.  
  11395.  
  11396.  
  11397.  
  11398.  
  11399.  
  11400.  
  11401.  
  11402.  
  11403.  
  11404.  
  11405.  
  11406.  
  11407.  
  11408.  
  11409.  
  11410.           The JORF Manual (Shareware Disk Version)                      186
  11411.  
  11412.  
  11413.  
  11414.  
  11415.  
  11416.  
  11417.                                      Jorf:Rebuild
  11418.  
  11419.  
  11420.           Function  Jorf:Rebuild 
  11421.  
  11422.           Purpose   Packs and rebuilds a JORF file. 
  11423.  
  11424.           Returns   None.
  11425.  
  11426.           See Also  Jorf:Pack.
  11427.  
  11428.           Notes     Rebuilds a .JRF file by copying data to an ASCII
  11429.                     format, erasing the original, and reading the ASCII
  11430.                     data back in.  Indexes are not copied, and are re-
  11431.                     created after the data is read.
  11432.  
  11433.                     To rebuild a file, you must not be using any methods or
  11434.                     data in that file.  The rebuild will clear live
  11435.                     pointers (which are changing position) so you will have
  11436.                     to redraw your screens after rebuilding..
  11437.  
  11438.                     You can rebuild from the command line using the -R
  11439.                     option.  You must first specify the file that contains
  11440.                     the class definitions, and then -R and then the file(s)
  11441.                     you want rebuilt.
  11442.  
  11443.                     C>JORF Contact -R Maillist.JCM
  11444.  
  11445.                     The command above rebuilds the file Maillist.JCM
  11446.                     according to the class definition found in Contact.J.
  11447.  
  11448.  
  11449.  
  11450.  
  11451.  
  11452.  
  11453.  
  11454.  
  11455.  
  11456.  
  11457.  
  11458.  
  11459.  
  11460.  
  11461.  
  11462.  
  11463.  
  11464.  
  11465.  
  11466.  
  11467.  
  11468.  
  11469.           Chapter Five - JORF Functions                                 187
  11470.  
  11471.  
  11472.  
  11473.  
  11474.  
  11475.  
  11476.                                       Jorf:Sound
  11477.  
  11478.  
  11479.           Function  Jorf:Sound ( Frequency, Duration ) 
  11480.  
  11481.           Purpose   Make beautiful music. 
  11482.  
  11483.           Returns   None.
  11484.  
  11485.           Notes     The built in sound capability in the IBM PC style
  11486.                     computer is very primitive.  You cannot control volume
  11487.                     and the PC uses a square wave that sounds very
  11488.                     mechanical. 
  11489.  
  11490.                     This command makes a sound at the specified Frequency
  11491.                     for at least the specified Duration (in 18ths of a
  11492.                     second).  The sound ends when the duration is ended.  
  11493.  
  11494.                     Using a frequency below 20 may be inaudible or may
  11495.                     damage some computer speakers.
  11496.  
  11497.  
  11498.  
  11499.  
  11500.  
  11501.  
  11502.  
  11503.  
  11504.  
  11505.  
  11506.  
  11507.  
  11508.  
  11509.  
  11510.  
  11511.  
  11512.  
  11513.  
  11514.  
  11515.  
  11516.  
  11517.  
  11518.  
  11519.  
  11520.  
  11521.  
  11522.  
  11523.  
  11524.  
  11525.  
  11526.  
  11527.  
  11528.           The JORF Manual (Shareware Disk Version)                      188
  11529.  
  11530.  
  11531.  
  11532.  
  11533.  
  11534.  
  11535.           Example   I had a lot of fun writing MUSIC.J. 
  11536.  
  11537.           Music:Start
  11538.             New(Response,Row,Col,Forg,Back,Tone,Time)
  11539.             Response=Msg:Add("Beautiful Music")
  11540.               This 42 line program generates random music.  Just in case you
  11541.               do not like random music, I have made the program display a
  11542.               tapestry of color proclaiming Beautiful Music to convince you.
  11543.  
  11544.               It is a demonstration for these functions:
  11545.  
  11546.                 Num:Rand(Lo,Hi)         -Generates random numbers
  11547.                 Jorf:Sound(Tone,Duration)    -Plays a musical tone
  11548.                 Win:Attr("Foreground/Background") -Changes screen colors
  11549.  
  11550.               You are encouraged to change this program around to change the
  11551.               music and the colors.  For instance make the music higher or
  11552.               lower, faster or slower, and make the colors follow the
  11553.               rainbow instead of being random.  (We wasted 18 lines just on
  11554.               this message . . .  only 20 lines to go!)
  11555.  
  11556.               You could spend hours here, making Beautiful Music!
  11557.  
  11558.             If (Response==Ok)
  11559.               Win:Add ("Beautiful Music", 2, 3, 22, 75, Here)
  11560.               Win:Msg ("Press any key for relief . . .")
  11561.               While (Kbd:Hit()==0) | Do until they give up
  11562.                 ++Row                   | Next row
  11563.                 If (Row > Win:Ptr->Len) | If too low
  11564.              Row=1                 |   back to row 1
  11565.                 For (Col = 0 thru 4)    | Display B Music 5 times
  11566.              Forg=Num:Rand(0,15)
  11567.              Back=Num:Rand(0,15)
  11568.              Move:To(Row,(Col*15+1))
  11569.              Win:Attr(Forg+"/"+Back)
  11570.              Str:Put("Beautiful Music")
  11571.                 Time=Num:Btw(Time*Num:Rand(-4,4),1,8)
  11572.                 Tone=Tone+((Tone/12)*Num:Rand(-2,2))
  11573.                 If (Tone<60 Or Tone > 1400)
  11574.              Tone=440
  11575.                 Jorf:Sound(Tone,Time*40)
  11576.             Return (Ok)
  11577.  
  11578.  
  11579.  
  11580.  
  11581.  
  11582.  
  11583.  
  11584.  
  11585.  
  11586.  
  11587.           Chapter Five - JORF Functions                                 189
  11588.  
  11589.  
  11590.  
  11591.  
  11592.  
  11593.  
  11594.                                      Jorf:System
  11595.  
  11596.  
  11597.           Function  Jorf:System ( Command, Flags, Message ) 
  11598.  
  11599.           Purpose   Execute DOS shell or DOS command.
  11600.  
  11601.           Returns   Ok if executed, Null if not.
  11602.  
  11603.           See Also  Jorf:Exit.
  11604.  
  11605.           Notes     This command allows you to execute any DOS command or
  11606.                     run other programs in a DOS shell.  
  11607.  
  11608.                     If Command is not used or is Null then the operator
  11609.                     will be transferred to an operating system shell and
  11610.                     must type EXIT to return to JORF.
  11611.  
  11612.                     The Flags is a string of letters with any of these
  11613.                     values:
  11614.  
  11615.                     "C"  DOS Only  Clear screen when shelling out.
  11616.                     "P"  DOS/Windows    Pause message before returning
  11617.                     "W"  Windows Only   Spawn a Windows executable and
  11618.                                         return immediately.
  11619.  
  11620.                     More flags are anticipated.
  11621.  
  11622.                     The Message will be printed on the screen before the
  11623.                     DOS command is executed.  It should only be used when
  11624.                     the "C" flag is indicated to clear the screen.  The
  11625.                     message is assumed to be something useful like 'Type
  11626.                     "Exit" to RETURN'.  The Message is ignored if you use
  11627.                     the "W" flag.
  11628.            
  11629.                     DOS 
  11630.                     Version        You will only have about 200K memory for
  11631.                                    your DOS command.  This is too small to
  11632.                                    run most application programs, but is
  11633.                                    just fine to run DOS utility programs
  11634.                                    like Format, Copy and Undelete.
  11635.  
  11636.  
  11637.                     Windows
  11638.                     Version        There are two variations to this
  11639.                                    command.  If you want to launch a
  11640.                                    Windows program, include the "W" flag. 
  11641.                                    The program will launch the program and
  11642.                                    return control back to the originating
  11643.                                    program.  If you want to run a DOS
  11644.                                    command, do not use the "W" flag and the
  11645.  
  11646.           The JORF Manual (Shareware Disk Version)                      190
  11647.  
  11648.  
  11649.  
  11650.  
  11651.  
  11652.                                    DOS command will be run as in the DOS
  11653.                                    version.
  11654.  
  11655.                          When running without the "W" flag, a small batch
  11656.                          file called JSYSTEM.BAT will be created
  11657.                          (JSYS9999.BAT on multiuser systems where 9999 is a
  11658.                          random number).  This file is responsible for
  11659.                          handling the "P" flag and Message parameter.  JORF
  11660.                          will shell into your command using the DOS
  11661.                          COMMAND.COM interpreter.
  11662.  
  11663.                          When running without the "W" flag the size of the
  11664.                          window is controlled by a PIF file.  You can
  11665.                          change the defaults by creating a PIF file called
  11666.                          COMMAND.PIF that controls the COMMAND.COM program. 
  11667.                          If you do this and turn "Full Screen" off, then
  11668.                          your system commands will be windowed.  Under
  11669.                          Windows 3.1 you can also set the Font and size of
  11670.                          the window.
  11671.  
  11672.                     To obtain as much memory as possible, the system
  11673.                     automatically calls Jorf:Flush before executing this
  11674.                     call.  Also, all files are closed before executing the
  11675.                     shell.
  11676.  
  11677.           Example   This program came from a user (with a bug).  Now that
  11678.                     the bug is fixed the program is kinda fun.  DOS.J.
  11679.  
  11680.  
  11681.  
  11682.  
  11683.  
  11684.  
  11685.  
  11686.  
  11687.  
  11688.  
  11689.  
  11690.  
  11691.  
  11692.           Dos:Start
  11693.             Win:Add("Jo's DOS Function Utility", 0, 0, 20, 44)
  11694.              This program allows the user to &
  11695.              select special DOS commands.
  11696.  
  11697.              Place your mouse over the desired &
  11698.              selection and click the Left Mouse &
  11699.              Button or you may use the up and down &
  11700.              arrow keys to select the desired command.
  11701.  
  11702.              {Group:"DOS Commands" Row:9 Col:5 Len:10 Wid:30}
  11703.               {Prompt:"&Memory Stats     " Row:11 Col:7 Wid:25 Action:"Dos:Cmd('Mem')"}
  11704.  
  11705.           Chapter Five - JORF Functions                                 191
  11706.  
  11707.  
  11708.  
  11709.  
  11710.  
  11711.               {Prompt:"&Command Shell    " Row:12 Col:7 Wid:25 Action:"Dos:Cmd('Shell')"}
  11712.               {Prompt:"Directory by &Date" Row:13 Col:7 Wid:25 Action:"Dos:Cmd('DirDate')"}
  11713.               {Prompt:"Directory by &Size" Row:14 Col:7 Wid:25 Action:"Dos:Cmd('DirSize')"}
  11714.               {Prompt:"&Type in a Command" Row:15 Col:7 Wid:25 Action:"Dos:Cmd('TypeIt')"}
  11715.               {Prompt:"&Windows Program  " Row:16 Col:7 Wid:25 Action:"Dos:Cmd('Windows')"}
  11716.               {Prompt:"E&xit             " Row:18 Col:7 Wid:25 Action:"Return(Null)"}
  11717.             Return (Ok)
  11718.  
  11719.           Dos:Cmd(Action)
  11720.             New (Command, Flags, Message)
  11721.             Switch (Action)
  11722.               Case 'Mem'
  11723.                 Command = "Mem /c | More"
  11724.                 Flags = "CP"
  11725.               Case 'Shell'
  11726.                 Command = Null
  11727.                 Flags = "C"
  11728.                 Message = "Type 'EXIT' to return to JORF"
  11729.               Case 'DirDate'
  11730.                 Command = "Dir /o-d | More"
  11731.                 Flags = "CP"
  11732.                 Message = "Sorting . . ."
  11733.               Case 'DirSize'
  11734.                 Command = "Dir /o-s | More"
  11735.                 Flags = "CP"
  11736.                 Message = "Sorting . . ."
  11737.               Case 'TypeIt'
  11738.                 Win:Add
  11739.                   Input:"Command to execute:", Field:"Command"
  11740.                 If (Kbd:Got=='Esc_Key')
  11741.                   Return
  11742.                 Flags = "C"
  11743.               Case 'Windows'
  11744.                 If (Jorf:Info("Windows")==False)
  11745.                   Msg:Add
  11746.                     This option only works in the &
  11747.                     Windows version of the JORF interpreter.
  11748.                   Return
  11749.                 Win:Add
  11750.                   Input:"Windows program:", Field:"Command"
  11751.                 If (Kbd:Got=='Esc_Key')
  11752.                   Return
  11753.                 Flags = "W"
  11754.               Else
  11755.                 Msg:Add
  11756.                   Illegal DOS Command "{Action}".
  11757.                 Return (Ok)
  11758.             Jorf:System (Command, Flags, Message)
  11759.             Return (Ok)
  11760.  
  11761.  
  11762.  
  11763.  
  11764.           The JORF Manual (Shareware Disk Version)                      192
  11765.  
  11766.  
  11767.  
  11768.  
  11769.  
  11770.  
  11771.                                      Jorf:Unlock
  11772.  
  11773.  
  11774.           Function  Jorf:Unlock( Structure ) 
  11775.  
  11776.           Purpose   Unlocks a record, reports locked status. 
  11777.  
  11778.           Returns   Null if record is not locked, OK if properly unlocked..
  11779.  
  11780.           See Also  Jorf:Lock, Jorf:Write.
  11781.  
  11782.           Notes     The Structure is a JORF language structure that is used
  11783.                     to hold fields to be stored to the disk.  This function
  11784.                     works with Jorf:Lock and Jorf:Write to enable you to do
  11785.                     record level locking.  
  11786.  
  11787.                     This function is used primarily to unlock and restore
  11788.                     the value because the operator decided not to change
  11789.                     the record.  If you want to store changes, you should
  11790.                     use Jorf:Write to unlock the record.   When you use
  11791.                     Jorf:Unlock, the structure is automatically re-read
  11792.                     from disk and any changes will be lost.
  11793.  
  11794.                     If you do not have "Multiuser=Yes" set in your JORF.INI
  11795.                     or JORFWIN.INI file then this function has no effect.
  11796.  
  11797.  
  11798.  
  11799.  
  11800.  
  11801.  
  11802.  
  11803.  
  11804.  
  11805.  
  11806.  
  11807.  
  11808.  
  11809.  
  11810.  
  11811.  
  11812.  
  11813.  
  11814.  
  11815.  
  11816.  
  11817.  
  11818.  
  11819.  
  11820.  
  11821.  
  11822.  
  11823.           Chapter Five - JORF Functions                                 193
  11824.  
  11825.  
  11826.  
  11827.  
  11828.  
  11829.  
  11830.                                       Jorf:Write
  11831.  
  11832.  
  11833.           Function  Jorf:Write ( Item ) 
  11834.  
  11835.           Purpose   Write an item to current Data file. 
  11836.  
  11837.           Returns   None.
  11838.  
  11839.           See Also  Jorf:Del.
  11840.  
  11841.           Notes     Writes Item to the current project file.  This function
  11842.                     permanizes a structure so that it can be recalled
  11843.                     later.  It is used:
  11844.  
  11845.                          1. To write a structure as a record, with index
  11846.                          references in the current project file.
  11847.  
  11848.                          2. When you want to insure a text or array value
  11849.                          is in the current project file.
  11850.  
  11851.                          3.  When you have an empty new variable that may
  11852.                          soon become an array or a text pointer that you
  11853.                          want written in the current project file.
  11854.  
  11855.                     This command is intimately tied up with the JORF system
  11856.                     of "Object Persistence".  Normally we think of all JORF
  11857.                     variables as memory variables.  Unlike most languages,
  11858.                     however, the JORF Language features automatic movement
  11859.                     of these variables to disk.  When a structure is
  11860.                     written to a disk file, it goes into the current
  11861.                     project file currently declared using Jorf:File. 
  11862.  
  11863.                     When written, all elements of the structure are
  11864.                     rewritten into the same project file.  This is
  11865.                     important:  You cannot write any record that references
  11866.                     information in another file.  If you directly reference
  11867.                     another structure, that other structure is completely
  11868.                     rewritten into the current file.  The only way to
  11869.                     create a "Relational" Link between separate files is to
  11870.                     store a look up value for the secondary file.
  11871.  
  11872.                     Rewriting large Arrays and blocks of text are
  11873.                     especially slow.  If you create a large text in memory,
  11874.                     and the system runs out and flushes the text to disk
  11875.                     temporarily, it will be flushed to the SWAPFILE.JRF
  11876.                     project file.  If after finishing your large text you
  11877.                     attach it to a structure that is to be written to
  11878.                     another file, the entire text will be read from one
  11879.                     file and duplicated in the second file.  Programmers
  11880.                     will note how wasteful and slow this can become. 
  11881.  
  11882.           The JORF Manual (Shareware Disk Version)                      194
  11883.  
  11884.  
  11885.  
  11886.  
  11887.  
  11888.                     Instead, create the first line of text and use
  11889.                     Jorf:Write to write it to the eventual destination
  11890.                     project.  Then add the rest of the lines. If the
  11891.                     interpreter needs to flush memory, the partial text
  11892.                     will be written to the correct location so that time
  11893.                     and disk accesses are saved later.  
  11894.  
  11895.                     This function works with Jorf:Lock to provide record
  11896.                     level locking.  If a locked record is written using
  11897.                     Jorf:Write then the lock is automatically released.
  11898.  
  11899.           Example   I've always enjoyed the Haiku generator.
  11900.  
  11901.  
  11902.  
  11903.  
  11904.  
  11905.  
  11906.  
  11907.  
  11908.  
  11909.  
  11910.  
  11911.  
  11912.  
  11913.  
  11914.  
  11915.  
  11916.  
  11917.  
  11918.  
  11919.  
  11920.  
  11921.  
  11922.  
  11923.  
  11924.  
  11925.  
  11926.  
  11927.  
  11928.  
  11929.  
  11930.  
  11931.  
  11932.  
  11933.  
  11934.  
  11935.  
  11936.  
  11937.  
  11938.  
  11939.  
  11940.  
  11941.           Chapter Five - JORF Functions                                 195
  11942.  
  11943.  
  11944.  
  11945.  
  11946.  
  11947.  
  11948.           Class:Haiku
  11949.             Index:Key     | A "Key" to store this structure
  11950.             Text          | Current Haiku Text
  11951.             Arts          | Sentence articles
  11952.             Adjs          | Adjectives
  11953.             Nouns         | Nouns
  11954.             Verbs         | Verbs
  11955.             Preps         | Preps
  11956.  
  11957.           Haiku:Start
  11958.             New (Haiku:Haiku)
  11959.             Jorf:File ("Haiku", Here)
  11960.             Haiku=Haiku:GetStructure()
  11961.             Haiku:Thinkup(Haiku)
  11962.             Win:Add("Haiku Generator", 4, 15, 10, 50, Here)
  11963.               Menu:"&File"
  11964.                 Menu:"E&xit" Action:"Jorf:Exit"
  11965.               Menu:"&Print"
  11966.                 Action:"Haiku:Print(Haiku)"
  11967.  
  11968.               Group:"" Row:2 Col:5 Len:3 Wid:40   | Group box border
  11969.               Text:"" Field:"Haiku->Text"         | Text to show
  11970.                 Before:"Null"                     | Never any input here
  11971.  
  11972.               Button:"&Generate" Row:8, Col:5 Wid:20 Action:"Haiku:Thinkup(Haiku)"
  11973.               Button:"E&xit"     Row:8, Col:27 Wid:20 Action:"Jorf:Exit()"
  11974.             Return (Ok)
  11975.  
  11976.           Haiku:Array (Text)
  11977.             | This routine loads words into an array.  Double words must be quoted.
  11978.             | The Array is written to the current file (HAIKU.JRF).
  11979.             New (WordCount, Arr, ArrCount, Spaces)
  11980.             Spaces = Str:Ind(Text)                | Indent level
  11981.             While (Text And Spaces <= Str:Ind(Text))
  11982.               For (WordCount = 1 thru Word:Len (Text))    | For each word
  11983.                 ++ArrCount                                | Add word to
  11984.                 Arr[ArrCount]=Word:At (Text, WordCount)   |   word array
  11985.               Text = Text:Next (Text)             | Next line
  11986.             Jorf:Write (Arr)                      | Write to current file
  11987.             Return (Arr)
  11988.  
  11989.           Haiku:Generate (Haiku, Text)
  11990.             New (Spaces, CurWord, Pos)
  11991.             New (NewWord, NewLine, NewText)
  11992.             Spaces = Str:Ind (Text)
  11993.             While (Text And Spaces <= Str:Ind(Text))
  11994.               | Step backwards - so we can switch "A" to "AN" when necessary
  11995.               For (Pos = Word:Len (Text) thru 1 Step -1)
  11996.                 CurWord = Word:At (Text, Pos)
  11997.                 Switch (CurWord)
  11998.                   Case 'Art'
  11999.  
  12000.           The JORF Manual (Shareware Disk Version)                      196
  12001.  
  12002.  
  12003.  
  12004.  
  12005.  
  12006.                     NewWord = Haiku:GetWord (Haiku->Arts)
  12007.                     If NewWord = "a"
  12008.                       If (Str:Aft (NewLine,"aeiou") < 2)
  12009.                         NewWord = "an"
  12010.                   Case 'Noun'
  12011.                     NewWord = Haiku:GetWord (Haiku->Nouns)
  12012.                   Case 'Adj'
  12013.                     NewWord = Haiku:GetWord (Haiku->Adjs)
  12014.                   Case 'Verb'
  12015.                     NewWord = Haiku:GetWord (Haiku->Verbs)
  12016.                   Case 'Prep'
  12017.                     NewWord = Haiku:GetWord (Haiku->Preps)
  12018.                   Else
  12019.                     NewWord = CurWord
  12020.                 If (Pos = 1)
  12021.                   NewWord = To:Caps (NewWord)
  12022.                 NewLine = NewWord + NewLine
  12023.               NewText = Text:Add (NewLine, NewText)
  12024.               NewLine = Null
  12025.               Text = Text:Next (Text)
  12026.             Haiku->Text = NewText
  12027.             Return (Ok)
  12028.  
  12029.           Haiku:GetStructure
  12030.             | Get Haiku structure from file.  If not found in file, generate
  12031.             |  it from the word lists.
  12032.             New (Haiku:Haiku)
  12033.             Haiku = Struct:Find("Haiku","Key",Null)
  12034.             If (Haiku == Null)
  12035.               Haiku->Arts = Haiku:Array()
  12036.                 a the
  12037.               Haiku->Adjs = Haiku:Array()
  12038.                 autumn hidden bitter misty silent empty
  12039.                 dry dark sighing delicate quiet
  12040.                 white cool frigid winter dappled
  12041.                 twilight afternoon crimson wispy azure
  12042.                 blue billowing broken cold damp falling
  12043.                 frosty tawny long late lingering
  12044.                 little morning leafy billowing
  12045.                 still small sparkling cloudy
  12046.                 wandering withered wild black young
  12047.               Haiku->Nouns = Haiku:Array()
  12048.                 waterfall mist breeze moon
  12049.                 rain wind sea morning snow glitter forest
  12050.                 Josephine cloud meadow sun glade bird brook
  12051.                 butterfly tove dew savannah meadow
  12052.                 flower firefly feather grass haze mountain
  12053.                 night goat shade snowflake
  12054.                 silence lily sky shape surf thunder
  12055.                 violet water wildflower wave
  12056.               Haiku->Verbs = Haiku:Array()
  12057.                 drifts "has stopped" blusters blows
  12058.  
  12059.           Chapter Five - JORF Functions                                 197
  12060.  
  12061.  
  12062.  
  12063.  
  12064.  
  12065.                 races "did gimble" stretches
  12066.                 flutters has risen "is drifting" "is trickling"
  12067.                 murmers "is floating" "is wafting"
  12068.               Haiku->Preps = Haiku:Array()
  12069.                 on in beneath over near of
  12070.               Haiku->Key = "Key"
  12071.               Jorf:Write (Haiku)
  12072.             Return (Haiku)
  12073.  
  12074.           Haiku:GetWord (Arr)
  12075.             New (Word, Off)
  12076.             Off = Num:Rand (1, Word:Len (Arr))
  12077.             Word = Arr[Off]
  12078.             Return Word + " "
  12079.  
  12080.           Haiku:Print(Haiku)
  12081.             New (Dest)
  12082.             Dest=Jorf:Printer()
  12083.             If (Dest!=Null)
  12084.               File:Save("JREPORT.LST",Haiku->Text)
  12085.               File:Append("JREPORT.LST")
  12086.               File:Print("JREPORT.LST",Dest,TRUE)
  12087.             Return (Ok)
  12088.  
  12089.           Haiku:Thinkup(Haiku)
  12090.             Switch Num:Rand (1, 4)
  12091.               Case 1
  12092.                 Haiku:Generate (Haiku)
  12093.                   Art Adj Noun . . .
  12094.                   Art noun verb prep art noun
  12095.                   Adj Adj Noun
  12096.               Case 2
  12097.                 Haiku:Generate (Haiku)
  12098.                   Noun Prep Art Noun
  12099.                   Art Adj Noun Prep Art Noun
  12100.                   Adj Noun
  12101.               Case 3
  12102.                 Haiku:Generate (Haiku)
  12103.                   Art Adj Noun
  12104.                   Art Adj Noun
  12105.                   Art Noun Verb
  12106.               Case 4
  12107.                 Haiku:Generate (Haiku)
  12108.                   Art Adj Noun Verb
  12109.                   Art Adj Noun
  12110.                   Prep Art Adj Noun
  12111.             Win:Dsp
  12112.             Return(Ok)
  12113.  
  12114.  
  12115.  
  12116.  
  12117.  
  12118.           The JORF Manual (Shareware Disk Version)                      198
  12119.  
  12120.  
  12121.  
  12122.  
  12123.  
  12124.  
  12125.                                        Kbd:Bye
  12126.  
  12127.  
  12128.           Function  Kbd:Bye
  12129.  
  12130.           Purpose   Clear keyboard stream. 
  12131.  
  12132.           Returns   None.
  12133.  
  12134.           See Also  Kbd:Get.
  12135.  
  12136.           Notes     Kbd:Bye does not read or process the keys, it just gets
  12137.                     rid of them.
  12138.  
  12139.  
  12140.  
  12141.  
  12142.  
  12143.  
  12144.  
  12145.  
  12146.  
  12147.  
  12148.  
  12149.  
  12150.  
  12151.  
  12152.  
  12153.  
  12154.  
  12155.  
  12156.  
  12157.  
  12158.  
  12159.  
  12160.  
  12161.  
  12162.  
  12163.  
  12164.  
  12165.  
  12166.  
  12167.  
  12168.  
  12169.  
  12170.  
  12171.  
  12172.  
  12173.  
  12174.  
  12175.  
  12176.  
  12177.           Chapter Five - JORF Functions                                 199
  12178.  
  12179.  
  12180.  
  12181.  
  12182.  
  12183.  
  12184.                                        Kbd:Get
  12185.  
  12186.  
  12187.           Function  Kbd:Get ( CursorSize ) 
  12188.  
  12189.           Purpose   Get a Keystroke from the Keyboard.
  12190.  
  12191.           Returns   Keystroke value.
  12192.  
  12193.           See Also  Kbd:Hit, Kbd:Got, Kbd:Put, Line:Inp.
  12194.  
  12195.           Notes     Waits until the operator hits a key and returns the
  12196.                     value of that character.  If CursorSize is "None", no
  12197.                     cursor is displayed.  If it is "Little", then the
  12198.                     cursor will be a blinking line, and if it is "Big", the
  12199.                     cursor will be a blinking block.  Only the first letter
  12200.                     is significant.  If it is absent or null, "Little" is
  12201.                     assumed.
  12202.  
  12203.                     The return value is always a string indicating the key
  12204.                     that was hit.  This is a departure from most language
  12205.                     that returns an integer value.   The key values are
  12206.                     outlined in Appendix C.  
  12207.  
  12208.                     The Event System processes keystrokes using Event:Do
  12209.                     Value "Key".  This processing may change the value of
  12210.                     the key, display a message, or move the cursor
  12211.                     location.  It is especially important during field
  12212.                     input and text input to remember that the cursor
  12213.                     location may change during a Key:Get.  
  12214.  
  12215.           Example
  12216.  
  12217.           WhatKey:Start
  12218.             | Sample for: Key:Get, Event:Add
  12219.             New Key
  12220.             Win:Add ("What Key?", 5, 15, 10, 50)
  12221.             Win:Msg ("Press Alt-X to Quit")
  12222.  
  12223.             While (Kbd:Got!="Alt_X_Key")
  12224.               Str:Put ("Press a Key: ")
  12225.               Key = Kbd:Get ("Big")
  12226.               Str:PutLine ('That was the "' + Key + '".')
  12227.             Jorf:Exit
  12228.  
  12229.  
  12230.  
  12231.  
  12232.  
  12233.  
  12234.  
  12235.  
  12236.           The JORF Manual (Shareware Disk Version)                      200
  12237.  
  12238.  
  12239.  
  12240.  
  12241.  
  12242.  
  12243.                                        Kbd:Got
  12244.  
  12245.  
  12246.           Function  Kbd:Got
  12247.  
  12248.           Purpose   Find out what the last Keystroke was. 
  12249.  
  12250.           Returns   Keystroke value.
  12251.  
  12252.           See Also  Kbd:Hit, Kbd:Get, Line:Inp.
  12253.  
  12254.           Notes     Returns the value of the last keystroke.  Always
  12255.                     returns the key value, even if the event system may
  12256.                     have caused Kbd:Get to return a different key value. 
  12257.  
  12258.                     The return value is always a string indicating the key
  12259.                     that was hit.  The key values are outlined in Appendix
  12260.                     C.  
  12261.  
  12262.  
  12263.  
  12264.  
  12265.  
  12266.  
  12267.  
  12268.  
  12269.  
  12270.  
  12271.  
  12272.  
  12273.  
  12274.  
  12275.  
  12276.  
  12277.  
  12278.  
  12279.  
  12280.  
  12281.  
  12282.  
  12283.  
  12284.  
  12285.  
  12286.  
  12287.  
  12288.  
  12289.  
  12290.  
  12291.  
  12292.  
  12293.  
  12294.  
  12295.           Chapter Five - JORF Functions                                 201
  12296.  
  12297.  
  12298.  
  12299.  
  12300.  
  12301.  
  12302.                                        Kbd:Hit
  12303.  
  12304.  
  12305.           Function  Kbd:Hit
  12306.  
  12307.           Purpose   Check to see if a key has been hit.
  12308.  
  12309.           Returns   True if a key has been hit.  Otherwise False.
  12310.  
  12311.           See Also  Kbd:Get.
  12312.  
  12313.           Notes     Kbd:Hit does not read or process the keystroke in any
  12314.                     way.  To find out what key was hit, use Kbd:Get. 
  12315.  
  12316.  
  12317.  
  12318.  
  12319.  
  12320.  
  12321.  
  12322.  
  12323.  
  12324.  
  12325.  
  12326.  
  12327.  
  12328.  
  12329.  
  12330.  
  12331.  
  12332.  
  12333.  
  12334.  
  12335.  
  12336.  
  12337.  
  12338.  
  12339.  
  12340.  
  12341.  
  12342.  
  12343.  
  12344.  
  12345.  
  12346.  
  12347.  
  12348.  
  12349.  
  12350.  
  12351.  
  12352.  
  12353.  
  12354.           The JORF Manual (Shareware Disk Version)                      202
  12355.  
  12356.  
  12357.  
  12358.  
  12359.  
  12360.  
  12361.                                        Kbd:Put
  12362.  
  12363.           Function  Kbd:Put ( Value ) 
  12364.  
  12365.           Purpose   Stuff the keyboard buffer with keys. 
  12366.  
  12367.           Returns   None.
  12368.  
  12369.           See Also  Kbd:Get.
  12370.  
  12371.           Notes     This function allows you to stuff any keys, including
  12372.                     mouse keys, into the input buffer.  There are three
  12373.                     basic formats you can use:
  12374.  
  12375.                          1. An individual keystroke command.
  12376.                          2. A string of characters to stuff.
  12377.                          3. Some text where each line is either 1 or 2.
  12378.  
  12379.                     It is common to mix these two formats.  For instance,
  12380.                     to stuff the keyboard to fill three data entry fields,
  12381.                     you might use the following six commands:
  12382.  
  12383.                          Kbd:Put ("This goes into Field 1")
  12384.                          Kbd:Put ("Tab_Key")
  12385.                          Kbd:Put ("This goes into Field 2")
  12386.                          Kbd:Put ("Tab_Key")
  12387.                          Kbd:Put ("This goes into Field 3")
  12388.                          Kbd:Put ("Enter_Key")
  12389.  
  12390.                     To stuff commands in "Text" format, you can simply
  12391.                     indent them:
  12392.  
  12393.                          Kbd:Put()
  12394.                            This goes into Field 1
  12395.                            Tab_Key
  12396.                            This goes into Field 2
  12397.                            Tab_Key
  12398.                            This goes into Field 3
  12399.                            Enter_Key
  12400.  
  12401.                     Handy note: On a data entry screen, the Home key goes
  12402.                     to the first, and the End key goes to the last button
  12403.                     on the screen.  Use this fact to establish your
  12404.                     referencec to variaous buttons.
  12405.  
  12406.                     After keys are stuffed the JORF language cannot tell
  12407.                     them from keys that are input.  The keyboard handling
  12408.                     system as a dynamically reallocating buffer, that is
  12409.                     limited only by the size of your near memory.  You can
  12410.                     generally stuff more than 1000 keystrokes without
  12411.                     running out of memory. 
  12412.  
  12413.           Chapter Five - JORF Functions                                 203
  12414.  
  12415.  
  12416.  
  12417.  
  12418.  
  12419.  
  12420.                                        Key:Add
  12421.  
  12422.  
  12423.           Function  Key:Add ( RuleStructure ) 
  12424.  
  12425.           Purpose   Add a String Key to the data base.
  12426.  
  12427.           Returns   None.
  12428.  
  12429.           See Also  Rule:Add.
  12430.  
  12431.           Notes     RuleStructure must be a compound structure with the
  12432.                     elements Type, Obj, Str, Ptr, Fnd (found), and KLen
  12433.                     (Key Length).  The last two elements are used by Key
  12434.                     "Find" to get next key in a series.  The elements Att
  12435.                     and Val used by Rule:Find are replaced here by Str.   
  12436.  
  12437.                     Key:Add adds a new string key valued Obj and Str, with
  12438.                     the associated data in Ptr.  Probability cannot be
  12439.                     added as with the Rule:Add function.  The key may be
  12440.                     found again by specifying the correct Obj, and by doing
  12441.                     a partial or whole key search on the Str value.
  12442.  
  12443.  
  12444.  
  12445.  
  12446.  
  12447.  
  12448.  
  12449.  
  12450.  
  12451.  
  12452.  
  12453.  
  12454.  
  12455.  
  12456.  
  12457.  
  12458.  
  12459.  
  12460.  
  12461.  
  12462.  
  12463.  
  12464.  
  12465.  
  12466.  
  12467.  
  12468.  
  12469.  
  12470.  
  12471.  
  12472.           The JORF Manual (Shareware Disk Version)                      204
  12473.  
  12474.  
  12475.  
  12476.  
  12477.  
  12478.  
  12479.                                        Key:Del
  12480.  
  12481.  
  12482.           Function  Key:Del ( RuleStructure ) 
  12483.  
  12484.           Purpose   Deletes an existing string key.
  12485.  
  12486.           Returns   None.  RuleStructure->Fnd will be True if key was found
  12487.                     and deleted.
  12488.  
  12489.           See Also  Key:Find.
  12490.  
  12491.           Notes     Deletes an existing string key.  This command may be
  12492.                     called with a partial key value, in which case it will
  12493.                     delete the first entry by that value.  
  12494.  
  12495.                     After an entry is deleted, you are still able to go the
  12496.                     "next" entry.  
  12497.           Example   See Key:Add.
  12498.  
  12499.  
  12500.  
  12501.  
  12502.  
  12503.  
  12504.  
  12505.  
  12506.  
  12507.  
  12508.  
  12509.  
  12510.  
  12511.  
  12512.  
  12513.  
  12514.  
  12515.  
  12516.  
  12517.  
  12518.  
  12519.  
  12520.  
  12521.  
  12522.  
  12523.  
  12524.  
  12525.  
  12526.  
  12527.  
  12528.  
  12529.  
  12530.  
  12531.           Chapter Five - JORF Functions                                 205
  12532.  
  12533.  
  12534.  
  12535.  
  12536.  
  12537.  
  12538.                                        Key:Find
  12539.  
  12540.  
  12541.           Function  Key:Find ( RuleStructure ) 
  12542.  
  12543.           Purpose   Find a key.
  12544.  
  12545.           Returns   None.
  12546.  
  12547.           See Also  Rule:Find, Key:Next.
  12548.  
  12549.           Notes     In this function, parameters may be empty, in which
  12550.                     case the first matching index entry will be returned. 
  12551.                     Parameters must be empty from left to right, that is,
  12552.                     if Str has a value then Obj also must have a value.  If
  12553.                     a "hole" is left, then nothing will ever be found.
  12554.  
  12555.                     When a key is found, the structure will be filled with
  12556.                     the values of that key and Fnd will be set to True.  If
  12557.                     Key:Next is called with these values set, then the next
  12558.                     key value is returned.  This process may be continued
  12559.                     until the value of the current key does not match the
  12560.                     value of the original partial key.  This length is put
  12561.                     in KLen after every successful search and may be
  12562.                     modified.
  12563.  
  12564.                     Although this process appears quirky, in practice it is
  12565.                     easy and intuitive.  Generally, string keys have a
  12566.                     "type" in Obj.  Commonly, the first key of that type is
  12567.                     searched, and then all subsequent keys displayed since
  12568.                     they have the same type.  When the type changes in the
  12569.                     index, the list has been completed.
  12570.  
  12571.  
  12572.  
  12573.  
  12574.  
  12575.  
  12576.  
  12577.  
  12578.  
  12579.  
  12580.  
  12581.  
  12582.  
  12583.  
  12584.  
  12585.  
  12586.  
  12587.  
  12588.  
  12589.  
  12590.           The JORF Manual (Shareware Disk Version)                      206
  12591.  
  12592.  
  12593.  
  12594.  
  12595.  
  12596.  
  12597.                                        Key:Next
  12598.  
  12599.  
  12600.           Function  Key:Next ( RuleStructure ) 
  12601.  
  12602.           Purpose   Find next key in sequence.
  12603.  
  12604.           Returns   None.
  12605.  
  12606.           See Also  Key:Find.
  12607.  
  12608.           Notes     If RuleStructure->KLen is zero, then this command works
  12609.                     just like KeyFind.  If it is not zero, then the next
  12610.                     key in sequence is returned.  When a key is found, the
  12611.                     structure will be filled with the values of that key
  12612.                     and Fnd will be set to True.  This process may be
  12613.                     continued until the value of the current key does not
  12614.                     match the length specified.  Values for Klen are: 
  12615.  
  12616.                     0    Rules with the same Type match
  12617.                     1    Rules with the same Type+Obj match
  12618.                     2    Rules with the same Type+Obj+(Partial)Str match
  12619.                     3    Rules with the same Type+Obj+Str match
  12620.  
  12621.  
  12622.  
  12623.  
  12624.  
  12625.  
  12626.  
  12627.  
  12628.  
  12629.  
  12630.  
  12631.  
  12632.  
  12633.  
  12634.  
  12635.  
  12636.  
  12637.  
  12638.  
  12639.  
  12640.  
  12641.  
  12642.  
  12643.  
  12644.  
  12645.  
  12646.  
  12647.  
  12648.  
  12649.           Chapter Five - JORF Functions                                 207
  12650.  
  12651.  
  12652.  
  12653.  
  12654.  
  12655.  
  12656.                                        Key:Prev
  12657.  
  12658.  
  12659.           Function  Key:Prev ( RuleStructure ) 
  12660.  
  12661.           Purpose   Find previous index value.
  12662.  
  12663.           Returns   None.
  12664.  
  12665.           See Also  Key:Find, Key:Next.
  12666.  
  12667.           Notes     This function is the opposite of Key:Next.
  12668.  
  12669.  
  12670.  
  12671.  
  12672.  
  12673.  
  12674.  
  12675.  
  12676.  
  12677.  
  12678.  
  12679.  
  12680.  
  12681.  
  12682.  
  12683.  
  12684.  
  12685.  
  12686.  
  12687.  
  12688.  
  12689.  
  12690.  
  12691.  
  12692.  
  12693.  
  12694.  
  12695.  
  12696.  
  12697.  
  12698.  
  12699.  
  12700.  
  12701.  
  12702.  
  12703.  
  12704.  
  12705.  
  12706.  
  12707.  
  12708.           The JORF Manual (Shareware Disk Version)                      208
  12709.  
  12710.  
  12711.  
  12712.  
  12713.  
  12714.  
  12715.                                        Line:Del
  12716.  
  12717.  
  12718.           Function  Line:Del ( Count ) 
  12719.  
  12720.           Purpose   Delete a Count lines of text displayed in an editing
  12721.                     window.
  12722.  
  12723.           Returns   None.
  12724.  
  12725.           See Also  Line:Inp.
  12726.  
  12727.           Notes     Deletes Count lines of text on the input screen and
  12728.                     handles appropriate scrolling functions.  The text must
  12729.                     have been displayed by a legitimate text input routine. 
  12730.                     Placing text on the window "by hand" does not make it
  12731.                     an input structure appropriate for handling with this
  12732.                     function.
  12733.  
  12734.                     Lines will be inserted if Count is negative.  Nothing
  12735.                     will happen if it is zero.  If the cursor is in column
  12736.                     1, then the line will be appended on the previous line. 
  12737.                     The Join ability makes it symmetrical with Line:Ins
  12738.                     which can Split text lines.
  12739.  
  12740.  
  12741.  
  12742.  
  12743.  
  12744.  
  12745.  
  12746.  
  12747.  
  12748.  
  12749.  
  12750.  
  12751.  
  12752.  
  12753.  
  12754.  
  12755.  
  12756.  
  12757.  
  12758.  
  12759.  
  12760.  
  12761.  
  12762.  
  12763.  
  12764.  
  12765.  
  12766.  
  12767.           Chapter Five - JORF Functions                                 209
  12768.  
  12769.  
  12770.  
  12771.  
  12772.  
  12773.  
  12774.                                        Line:Inp
  12775.  
  12776.  
  12777.           Function  Line:Inp ( Field, Row, Column, Length, Width )  
  12778.  
  12779.           Purpose   Input a data entry field or multiple line text.
  12780.  
  12781.           Returns   None..
  12782.  
  12783.           See Also  Line:Out, Text:Add.
  12784.  
  12785.           Notes     This command may now be functionally obsolete, replaced
  12786.                     by the powerful window management Input command. 
  12787.                     Before the Window Manager existed, this was the only
  12788.                     input command available,.  For the moment, it does no
  12789.                     harm to have an extra function that allows you to input
  12790.                     a single item on a data entry screen. 
  12791.  
  12792.                     To Highlight the field before entry, use Line:Out.
  12793.  
  12794.  
  12795.  
  12796.  
  12797.  
  12798.  
  12799.  
  12800.  
  12801.  
  12802.  
  12803.  
  12804.  
  12805.  
  12806.  
  12807.  
  12808.  
  12809.  
  12810.  
  12811.  
  12812.  
  12813.  
  12814.  
  12815.  
  12816.  
  12817.  
  12818.  
  12819.  
  12820.  
  12821.  
  12822.  
  12823.  
  12824.  
  12825.  
  12826.           The JORF Manual (Shareware Disk Version)                      210
  12827.  
  12828.  
  12829.  
  12830.  
  12831.  
  12832.  
  12833.                                        Line:Ins
  12834.  
  12835.  
  12836.           Function  Line:Ins ( Count )  
  12837.  
  12838.           Purpose   Inserts Count lines in current edit window.
  12839.  
  12840.           Returns   None.
  12841.  
  12842.           See Also  Line:Inp, Line:Del.
  12843.  
  12844.           Notes     Inserts Count lines at the current cursor location and
  12845.                     handles appropriate scrolling functions.  Lines will be
  12846.                     deleted if Count is negative.  Nothing will happen if
  12847.                     it is zero.  
  12848.  
  12849.           Example   How about the Ctrl-N method from the editor.
  12850.  
  12851.                     EditKey:Ctrl_N_Key          | Insert Line 
  12852.                       Win:Ptr->Prefix=Null      | ^Q Prefix is now meaningless
  12853.                       EditKey:Changed           | You've ruined it, must show menu
  12854.                       Line:Ins (1)              | Insert one line
  12855.                       EditKey:Message           | And show current pos and status
  12856.  
  12857.  
  12858.  
  12859.  
  12860.  
  12861.  
  12862.  
  12863.  
  12864.  
  12865.  
  12866.  
  12867.  
  12868.  
  12869.  
  12870.  
  12871.  
  12872.  
  12873.  
  12874.  
  12875.  
  12876.  
  12877.  
  12878.  
  12879.  
  12880.  
  12881.  
  12882.  
  12883.  
  12884.  
  12885.           Chapter Five - JORF Functions                                 211
  12886.  
  12887.  
  12888.  
  12889.  
  12890.  
  12891.  
  12892.                                        Line:Out
  12893.  
  12894.  
  12895.           Function  Line:Out ( Field, Row, Column, Length, Width )  
  12896.  
  12897.           Purpose   Output a data entry field or multiple line text.
  12898.  
  12899.           Returns   None.
  12900.  
  12901.           See Also  Line:Inp, Text:Add.
  12902.  
  12903.           Notes     This command may now be functionally obsolete, replaced
  12904.                     by the powerful window management Input command.  For
  12905.                     the moment, it does no harm to have an extra function
  12906.                     that allows you to input a single item on a data entry
  12907.                     screen.  To highlight, call Win:Att to set the
  12908.                     attribute, then this command to display line or field
  12909.                     with that attribute.
  12910.  
  12911.  
  12912.  
  12913.  
  12914.  
  12915.  
  12916.  
  12917.  
  12918.  
  12919.  
  12920.  
  12921.  
  12922.  
  12923.  
  12924.  
  12925.  
  12926.  
  12927.  
  12928.  
  12929.  
  12930.  
  12931.  
  12932.  
  12933.  
  12934.  
  12935.  
  12936.  
  12937.  
  12938.  
  12939.  
  12940.  
  12941.  
  12942.  
  12943.  
  12944.           The JORF Manual (Shareware Disk Version)                      212
  12945.  
  12946.  
  12947.  
  12948.  
  12949.  
  12950.  
  12951.                                        Line:Rel
  12952.  
  12953.  
  12954.           Function  Line:Rel 
  12955.  
  12956.           Purpose   Release input, forcing data to be re-read from the
  12957.                     field. 
  12958.  
  12959.           Returns   None.
  12960.  
  12961.           See Also  Win:Dsp. 
  12962.  
  12963.           Notes     When data entry is done, there is an internal buffer
  12964.                     that temporarily holds the field value.  If a keystroke
  12965.                     function changes that value, this buffer must be
  12966.                     released, so that the value is re-read from the
  12967.                     original field.  This mechanism saves you from worrying
  12968.                     about data displayed on the screen when you change it
  12969.                     underneath. 
  12970.  
  12971.                     Use of this function is rare.  Usually, you use Win:Dsp
  12972.                     to redisplay all fields on the screen when entry is
  12973.                     complete.  
  12974.  
  12975.  
  12976.  
  12977.  
  12978.  
  12979.  
  12980.  
  12981.  
  12982.  
  12983.  
  12984.  
  12985.  
  12986.  
  12987.  
  12988.  
  12989.  
  12990.  
  12991.  
  12992.  
  12993.  
  12994.  
  12995.  
  12996.  
  12997.  
  12998.  
  12999.  
  13000.  
  13001.  
  13002.  
  13003.           Chapter Five - JORF Functions                                 213
  13004.  
  13005.  
  13006.  
  13007.  
  13008.  
  13009.  
  13010.                                        Mem:Ptr
  13011.  
  13012.  
  13013.           Function  Mem:Ptr
  13014.  
  13015.           Purpose   Set or check global values.
  13016.  
  13017.           Returns   None. 
  13018.  
  13019.           Notes     Global variables are values that may be tested and
  13020.                     changed by any method.  They are a key feature of the
  13021.                     BASIC and dBASE languages.  However, I don't like them
  13022.                     one bit, because you can never really depend on them
  13023.                     holding their values as program flow passes in and out
  13024.                     of other people's subsystems.  
  13025.  
  13026.                     The JORF Language has only one true global variable,
  13027.                     Mem:Ptr.  This is a structure of the Jorf class. 
  13028.                     Structures of this class are allowed to have any
  13029.                     element, without any declaration.  As you run your
  13030.                     program, any time you need to save a value, set it
  13031.                     using Mem:Ptr.  Later, you can retrieve it the same
  13032.                     way: 
  13033.  
  13034.                     Mem:Ptr->Test = "Hi Jo"            | Set global value "Test"
  13035.                     Str:PutLine (Mem:Ptr->Test)        | Use global value "Test"
  13036.  
  13037.  
  13038.                     You should avoid using too many global variables. 
  13039.                     Doing so is an indication that your program is
  13040.                     structured poorly and you are making up for it by
  13041.                     kludging around.  Instead, create new class structures
  13042.                     to pass multiple values around your methods. 
  13043.  
  13044.           Example   See Event:Add.
  13045.  
  13046.  
  13047.  
  13048.  
  13049.  
  13050.  
  13051.  
  13052.  
  13053.  
  13054.  
  13055.  
  13056.  
  13057.  
  13058.  
  13059.  
  13060.  
  13061.  
  13062.           The JORF Manual (Shareware Disk Version)                      214
  13063.  
  13064.  
  13065.  
  13066.  
  13067.  
  13068.  
  13069.                                       Method:Add
  13070.  
  13071.  
  13072.           Function  Method:Add ( Text )  
  13073.  
  13074.           Purpose   Write text including indexes used by the interpreter to
  13075.                     call methods. 
  13076.  
  13077.           Returns   None.
  13078.  
  13079.           See Also  Method:Del.
  13080.  
  13081.           Notes     This function differs from Jorf:Add only in that it
  13082.                     looks for a method name on the first line, and if
  13083.                     found, adds the appropriate indexes so the method may
  13084.                     be found again.   Methods are also indexed by
  13085.                     Class:Read and Class:Check.  
  13086.  
  13087.                     This command does something distressing if the method
  13088.                     already exists.  If you are editing an existing method,
  13089.                     there is no problem.  
  13090.                     But if you have created a new copy of an existing
  13091.                     method, Method:Write must resolve this so there is only
  13092.                     one copy.  What it does is to move your current copy to
  13093.                     the location of the existing copy.  Your editing
  13094.                     changes stick, but your pointer Text will be deleted. 
  13095.                     Whenever you use Method:Write, be aware that you may
  13096.                     lose your pointer.
  13097.            
  13098.  
  13099.  
  13100.  
  13101.  
  13102.  
  13103.  
  13104.  
  13105.  
  13106.  
  13107.  
  13108.  
  13109.  
  13110.  
  13111.  
  13112.  
  13113.  
  13114.  
  13115.  
  13116.  
  13117.  
  13118.  
  13119.  
  13120.  
  13121.           Chapter Five - JORF Functions                                 215
  13122.  
  13123.  
  13124.  
  13125.  
  13126.  
  13127.  
  13128.                                       Method:Del
  13129.  
  13130.  
  13131.           Function  Method:Del ( Text ) 
  13132.  
  13133.           Purpose   Delete text including indexes used for calling method.
  13134.  
  13135.           Returns   None.
  13136.  
  13137.           See Also  Jorf:Del.
  13138.  
  13139.           Notes     This function differs from Jorf:Del only in that it
  13140.                     looks for a method name on the first line, and if
  13141.                     found, deletes any index references.  Methods are
  13142.                     indexed automatically by Class:Read and Method:Add. 
  13143.                     There is no harm in passing all text to this command,
  13144.                     it gives no error if the indexes are not found.
  13145.            
  13146.           Example   See Method:Move.
  13147.  
  13148.  
  13149.  
  13150.  
  13151.  
  13152.  
  13153.  
  13154.  
  13155.  
  13156.  
  13157.  
  13158.  
  13159.  
  13160.  
  13161.  
  13162.  
  13163.  
  13164.  
  13165.  
  13166.  
  13167.  
  13168.  
  13169.  
  13170.  
  13171.  
  13172.  
  13173.  
  13174.  
  13175.  
  13176.  
  13177.  
  13178.  
  13179.  
  13180.           The JORF Manual (Shareware Disk Version)                      216
  13181.  
  13182.  
  13183.  
  13184.  
  13185.  
  13186.  
  13187.                                        Msg:Add
  13188.  
  13189.  
  13190.           Function  Msg:Add ( Title, Type, Text )  
  13191.  
  13192.           Purpose   Show a Dialog Box.
  13193.  
  13194.           Returns   True or False.
  13195.  
  13196.           See Also  Win:Add.
  13197.  
  13198.           Notes     Displays one of four preset dialog boxes.  All boxes
  13199.                     have a message in the top section, and one or two
  13200.                     buttons on the bottom.  The four box Types are:
  13201.  
  13202.                          Ok             The Default, one button says Ok.
  13203.                          Yes            A Yes/No box, default is Yes.
  13204.                          No             A Yes/No box, default is No.
  13205.                          Cancel         An Ok/Cancel box, default is Ok.
  13206.  
  13207.                     Message boxes use the "Message" background if it is
  13208.                     defined in the JORF.INI or JORFWIN.INI file (See
  13209.                     Appendix D).   Under Windows, the message system uses a
  13210.                     special dialog box that limits access to other windows. 
  13211.                     To create a message that uses a normal box, use
  13212.                     Win:Add.
  13213.  
  13214.                     Under MS-Windows the message box frame changes
  13215.                     according to whether there is a title.  If there is a
  13216.                     title, the "Dialog box" frame is used, if there is no
  13217.                     title, the "Wire" frame is used.  The reason is simple
  13218.                     and stupid, it seems that Windows won't allow me to
  13219.                     create a non-dialog box with a dialog box frame and a
  13220.                     title.
  13221.  
  13222.           Example   You can quickly try all the message boxes using the
  13223.                     MSGBOXES.J sample program.
  13224.  
  13225.  
  13226.  
  13227.  
  13228.  
  13229.  
  13230.  
  13231.  
  13232.  
  13233.  
  13234.  
  13235.  
  13236.  
  13237.  
  13238.  
  13239.           Chapter Five - JORF Functions                                 217
  13240.  
  13241.  
  13242.  
  13243.  
  13244.  
  13245.  
  13246.                                        Move:By
  13247.  
  13248.  
  13249.           Function  Move:By ( Row, Column ) 
  13250.  
  13251.           Purpose   Move cursor in window.
  13252.  
  13253.           Returns   None.
  13254.  
  13255.           See Also  Move:To.
  13256.  
  13257.           Notes     Works the same as Move:To Row Column except that
  13258.                     movement is relative to the current position.  It is
  13259.                     common to see negative numbers used in this command to
  13260.                     move back one row or column.  
  13261.                     A movement that exceeds window boundaries place the
  13262.                     cursor as far as possible without going over the
  13263.                     boundary.  There is no way to move outside a window.
  13264.  
  13265.  
  13266.  
  13267.  
  13268.  
  13269.  
  13270.  
  13271.  
  13272.  
  13273.  
  13274.  
  13275.  
  13276.  
  13277.  
  13278.  
  13279.  
  13280.  
  13281.  
  13282.  
  13283.  
  13284.  
  13285.  
  13286.  
  13287.  
  13288.  
  13289.  
  13290.  
  13291.  
  13292.  
  13293.  
  13294.  
  13295.  
  13296.  
  13297.  
  13298.           The JORF Manual (Shareware Disk Version)                      218
  13299.  
  13300.  
  13301.  
  13302.  
  13303.  
  13304.  
  13305.                                        Move:To
  13306.  
  13307.  
  13308.           Function  Move:To ( Row, Column ) 
  13309.  
  13310.           Purpose   Move cursor in window.
  13311.  
  13312.           Returns   None.
  13313.  
  13314.           See Also  Move:By.
  13315.  
  13316.           Notes     Moves the present position to Row and Column
  13317.                     coordinates in the current window.  A position that
  13318.                     exceeds window boundaries place the cursor next to the
  13319.                     boundary.  There is no way to position the cursor
  13320.                     outside a window.
  13321.  
  13322.                     Row may be zero, in which case the cursor will not be
  13323.                     moved up or down.  Row may also be negative, in which
  13324.                     case the cursor will be that many lines from the Bottom
  13325.                     of the window.  The top row of a window is Row 1, and
  13326.                     the bottom is WindowPacket->Length.
  13327.  
  13328.                     Column may be zero, in which case the cursor will not
  13329.                     be moved right or left.  Column may also be negative,
  13330.                     in which case the cursor will be that many characters
  13331.                     from the left side of the window.  The leftmost
  13332.                     character is in column 1, and the rightmost is in
  13333.                     column WindowPacket->Width.
  13334.  
  13335.                     A movement that exceeds window boundaries places the
  13336.                     cursor as far as possible without going over the
  13337.                     boundary.  There is no way to move outside the current
  13338.                     window.
  13339.  
  13340.           Example   See Jorf:Sound.
  13341.  
  13342.  
  13343.  
  13344.  
  13345.  
  13346.  
  13347.  
  13348.  
  13349.  
  13350.  
  13351.  
  13352.  
  13353.  
  13354.  
  13355.  
  13356.  
  13357.           Chapter Five - JORF Functions                                 219
  13358.  
  13359.  
  13360.  
  13361.  
  13362.  
  13363.  
  13364.                                          New
  13365.  
  13366.           Function  New ( Variable1, Variable2, Variable3 ) 
  13367.  
  13368.           Purpose   Creates new variables.
  13369.  
  13370.           Returns   None.
  13371.  
  13372.           Notes     Creates a new instance of an object.  This command is
  13373.                     the only way to allocate structures and new records on
  13374.                     disk.  New must be used at the beginning of a method,
  13375.                     before any other commands.  
  13376.  
  13377.                     New variables are automatically deallocated unless: 
  13378.  
  13379.                          They are linked to a rule.
  13380.                          They are linked to a structure, linked to a rule.
  13381.                          They are linked to Mem:Ptr or Win:Ptr.
  13382.                          They are Returned.
  13383.  
  13384.                     You can declare more than one variable, by listing them
  13385.                     one after another.  Variables names may be prefixed by
  13386.                     a class, separated with a colon.  Variables may also
  13387.                     omit the class, implying they belong to the Jorf class. 
  13388.                     Variables of the Jorf class will take on the class of
  13389.                     another value that is assigned to them. 
  13390.  
  13391.  
  13392.  
  13393.  
  13394.  
  13395.  
  13396.  
  13397.  
  13398.  
  13399.  
  13400.  
  13401.  
  13402.  
  13403.  
  13404.  
  13405.  
  13406.  
  13407.  
  13408.  
  13409.  
  13410.  
  13411.  
  13412.  
  13413.  
  13414.  
  13415.  
  13416.           The JORF Manual (Shareware Disk Version)                      220
  13417.  
  13418.  
  13419.  
  13420.  
  13421.  
  13422.  
  13423.           Example   The Quick Demo in the tutorial writes this method:
  13424.  
  13425.           Demo:Start
  13426.             New (Rad, Chk, Inp1, Inp2)
  13427.             Win:Add ("A Real Screen", 4, 8, 14, 50, Here)
  13428.               Menu:"&Help"
  13429.                 Menu:"&Indented Menu Items"
  13430.                   Menu:"&Create Sub Menus"
  13431.                     Menu:"&And Even Deeper"
  13432.                     Menu:"&Sub Menus"
  13433.                   Menu:"(Escape to Exit)"
  13434.                 Menu:"&Jorf Help         F1" Action:"Hotkey:F1_Key"
  13435.                 Menu:"&Time and Date  Alt-T" Action:"HotKey:Alt_t_Key"
  13436.               Radio:" Radio &1" Row:6 Col:8
  13437.                 Check:"Rad==True", Action:"Rad=True"
  13438.               Radio:" Radio &2"
  13439.                 Check:"Rad==False", Action:"Rad=False"
  13440.               ChBox:" Check Box &A" Row:6, Col:26
  13441.                 Check:"Chk==True", Action:"Chk=True"
  13442.               ChBox:" Check Box &B"
  13443.                 Check:"Chk==False", Action:"Chk=False"
  13444.               Input:"&Input 1  " Row:9, Col:8 Field:"Inp1"
  13445.               Input:"I&nput 2  "              Field:"Inp2"
  13446.               Button:"  &Done  "   Row:12, Col:24, Action:"Esc_Key"
  13447.             Return
  13448.  
  13449.  
  13450.  
  13451.  
  13452.  
  13453.  
  13454.  
  13455.  
  13456.  
  13457.  
  13458.  
  13459.  
  13460.  
  13461.  
  13462.  
  13463.  
  13464.  
  13465.  
  13466.  
  13467.  
  13468.  
  13469.  
  13470.  
  13471.  
  13472.  
  13473.  
  13474.  
  13475.           Chapter Five - JORF Functions                                 221
  13476.  
  13477.  
  13478.  
  13479.  
  13480.  
  13481.  
  13482.                                          Null
  13483.  
  13484.  
  13485.           Function  Null
  13486.  
  13487.           Purpose   Returns "Nothing".
  13488.  
  13489.           Returns   "Nothing".
  13490.  
  13491.           See Also  True.
  13492.  
  13493.           Notes     Returns a JORF Pointer to nothing.  This is used like a
  13494.                     0 is used in decimal location.  Sometimes you need
  13495.                     indicate "nothing", but it has to be something to keep
  13496.                     other items aligned. 
  13497.  
  13498.                     This is equivalent to closed quotes ("") or the number
  13499.                     zero.  The JORF Pointers for zero, "" and null are
  13500.                     exactly the same.
  13501.  
  13502.  
  13503.  
  13504.  
  13505.  
  13506.  
  13507.  
  13508.  
  13509.  
  13510.  
  13511.  
  13512.  
  13513.  
  13514.  
  13515.  
  13516.  
  13517.  
  13518.  
  13519.  
  13520.  
  13521.  
  13522.  
  13523.  
  13524.  
  13525.  
  13526.  
  13527.  
  13528.  
  13529.  
  13530.  
  13531.  
  13532.  
  13533.  
  13534.           The JORF Manual (Shareware Disk Version)                      222
  13535.  
  13536.  
  13537.  
  13538.  
  13539.  
  13540.  
  13541.                                        Num:Abs
  13542.  
  13543.  
  13544.           Function  Num:Abs ( Num ) 
  13545.  
  13546.           Purpose   Returns the absolute value of Num.
  13547.  
  13548.           Returns   Num or -Num.
  13549.  
  13550.           See Also  Num:Max, Num:Min.
  13551.  
  13552.           Notes     The Absolute value is the same number, but always
  13553.                     positive.  So the absolute value of -5 is five, which
  13554.                     is also the absolute value of 5.  This function is used
  13555.                     to insure that negative numbers are treated like their
  13556.                     positive equivalent.
  13557.  
  13558.                     This function maintains the internal type of the
  13559.                     number.  If the number is a floating point number, a
  13560.                     floating point number is returned.  If it is an
  13561.                     integer, an integer is returned.  If it is a string or
  13562.                     text, then the string is converted to a number, and a
  13563.                     floating point or integer value is returned.
  13564.  
  13565.  
  13566.  
  13567.  
  13568.  
  13569.  
  13570.  
  13571.  
  13572.  
  13573.  
  13574.  
  13575.  
  13576.  
  13577.  
  13578.  
  13579.  
  13580.  
  13581.  
  13582.  
  13583.  
  13584.  
  13585.  
  13586.  
  13587.  
  13588.  
  13589.  
  13590.  
  13591.  
  13592.  
  13593.           Chapter Five - JORF Functions                                 223
  13594.  
  13595.  
  13596.  
  13597.  
  13598.  
  13599.  
  13600.                                        Num:Btw
  13601.  
  13602.  
  13603.           Function  Num:Btw ( Num, A, B ) 
  13604.  
  13605.           Purpose   Returns Num between A and B.
  13606.  
  13607.           Returns   Num, A or B.
  13608.  
  13609.           See Also  Num:Max, Num:Min.
  13610.  
  13611.           Notes     Num is between, then the return value is Num.  If it is
  13612.                     lower than A, then A is returned.  If higher than B
  13613.                     then B is returned.  
  13614.  
  13615.                     This function is used to qualify that a value is within
  13616.                     a specific range.  
  13617.  
  13618.  
  13619.  
  13620.  
  13621.  
  13622.  
  13623.  
  13624.  
  13625.  
  13626.  
  13627.  
  13628.  
  13629.  
  13630.  
  13631.  
  13632.  
  13633.  
  13634.  
  13635.  
  13636.  
  13637.  
  13638.  
  13639.  
  13640.  
  13641.  
  13642.  
  13643.  
  13644.  
  13645.  
  13646.  
  13647.  
  13648.  
  13649.  
  13650.  
  13651.  
  13652.           The JORF Manual (Shareware Disk Version)                      224
  13653.  
  13654.  
  13655.  
  13656.  
  13657.  
  13658.  
  13659.                                        Num:Exp
  13660.  
  13661.  
  13662.           Function  Num:Exp ( Num ) 
  13663.  
  13664.           Purpose   Returns the exponential e to Num.
  13665.  
  13666.           Returns   Exponential e to Num.
  13667.  
  13668.           See Also   Num:Log.
  13669.  
  13670.           Notes     Frankly I don't really understand what this is except
  13671.                     that e is a complex number that shows up in some math
  13672.                     algorithms.  Mine is not to question why, but to give
  13673.                     you the capability.  
  13674.  
  13675.  
  13676.  
  13677.  
  13678.  
  13679.  
  13680.  
  13681.  
  13682.  
  13683.  
  13684.  
  13685.  
  13686.  
  13687.  
  13688.  
  13689.  
  13690.  
  13691.  
  13692.  
  13693.  
  13694.  
  13695.  
  13696.  
  13697.  
  13698.  
  13699.  
  13700.  
  13701.  
  13702.  
  13703.  
  13704.  
  13705.  
  13706.  
  13707.  
  13708.  
  13709.  
  13710.  
  13711.           Chapter Five - JORF Functions                                 225
  13712.  
  13713.  
  13714.  
  13715.  
  13716.  
  13717.  
  13718.                                        Num:Log
  13719.  
  13720.           Function  Num:Log ( Num ) 
  13721.  
  13722.           Purpose   Returns the natural logarithm of Num.
  13723.  
  13724.           Returns   The natural logarithm of Num.
  13725.  
  13726.           See Also  Num:Sqrt, Num:Pow.
  13727.  
  13728.           Notes     The logarithm is another mathematical concept I don't
  13729.                     fully understand, but it was what one of Babbage's
  13730.                     great machines was to calculate so it must be
  13731.                     important.  
  13732.  
  13733.           Example   To calculate loan payment quickly, logarithms saves
  13734.                     doing an iterative analysis. See PAYMENT.J
  13735.  
  13736.  
  13737.  
  13738.  
  13739.  
  13740.  
  13741.  
  13742.  
  13743.  
  13744.  
  13745.  
  13746.  
  13747.  
  13748.  
  13749.  
  13750.  
  13751.  
  13752.  
  13753.  
  13754.  
  13755.  
  13756.  
  13757.  
  13758.  
  13759.  
  13760.  
  13761.  
  13762.  
  13763.  
  13764.  
  13765.  
  13766.  
  13767.  
  13768.  
  13769.  
  13770.           The JORF Manual (Shareware Disk Version)                      226
  13771.  
  13772.  
  13773.  
  13774.  
  13775.  
  13776.  
  13777.                                        Num:Max
  13778.  
  13779.  
  13780.           Function  Num:Max ( A, B ) 
  13781.  
  13782.           Purpose   Returns the higher of A and B.
  13783.  
  13784.           Returns   Either A or B.
  13785.  
  13786.           See Also  Num:Btw, Num:Min.
  13787.  
  13788.           Notes     Corresponds to a common C language macro MAX(A,B).  Use
  13789.                     this command to return the Highest of two values.  
  13790.  
  13791.                     There is an odd paradox that you commonly use these
  13792.                     numbers to insure a minimum value.  For instance, to
  13793.                     produce a number no lower than 10, you call Num:Max
  13794.                     Number, 10.
  13795.  
  13796.  
  13797.  
  13798.  
  13799.  
  13800.  
  13801.  
  13802.  
  13803.  
  13804.  
  13805.  
  13806.  
  13807.  
  13808.  
  13809.  
  13810.  
  13811.  
  13812.  
  13813.  
  13814.  
  13815.  
  13816.  
  13817.  
  13818.  
  13819.  
  13820.  
  13821.  
  13822.  
  13823.  
  13824.  
  13825.  
  13826.  
  13827.  
  13828.  
  13829.           Chapter Five - JORF Functions                                 227
  13830.  
  13831.  
  13832.  
  13833.  
  13834.  
  13835.  
  13836.                                        Num:Min
  13837.  
  13838.  
  13839.           Function  Num:Min ( A, B ) 
  13840.  
  13841.           Purpose   Returns the lower of A and B.
  13842.  
  13843.           Returns   Either A or B.
  13844.  
  13845.           See Also  Num:Btw, Num:Max.
  13846.  
  13847.           Notes     Corresponds to a common C language macro MIN(A,B). Use
  13848.                     this command to return the Highest of two values.  
  13849.  
  13850.                     There is an odd paradox that you commonly use these
  13851.                     numbers to insure a maximum value.  For instance, to
  13852.                     produce a number no higher than 10, you call Num:Min
  13853.                     (Number, 10).
  13854.  
  13855.  
  13856.  
  13857.  
  13858.  
  13859.  
  13860.  
  13861.  
  13862.  
  13863.  
  13864.  
  13865.  
  13866.  
  13867.  
  13868.  
  13869.  
  13870.  
  13871.  
  13872.  
  13873.  
  13874.  
  13875.  
  13876.  
  13877.  
  13878.  
  13879.  
  13880.  
  13881.  
  13882.  
  13883.  
  13884.  
  13885.  
  13886.  
  13887.  
  13888.           The JORF Manual (Shareware Disk Version)                      228
  13889.  
  13890.  
  13891.  
  13892.  
  13893.  
  13894.  
  13895.                                        Num:Pow
  13896.  
  13897.  
  13898.           Function  Num:Pow ( Num, Pow ) 
  13899.  
  13900.           Purpose   Returns Num  raised to the Pow power.
  13901.  
  13902.           Returns   Power of Num.
  13903.  
  13904.           See Also  Num:Sqrt.
  13905.  
  13906.           Notes     Returns Num raised to the indicated power.  The result
  13907.                     is an integer only if it fits, and is a floating point
  13908.                     if it is fractional or very large.
  13909.  
  13910.           Example   See Num:Log
  13911.  
  13912.  
  13913.  
  13914.  
  13915.  
  13916.  
  13917.  
  13918.  
  13919.  
  13920.  
  13921.  
  13922.  
  13923.  
  13924.  
  13925.  
  13926.  
  13927.  
  13928.  
  13929.  
  13930.  
  13931.  
  13932.  
  13933.  
  13934.  
  13935.  
  13936.  
  13937.  
  13938.  
  13939.  
  13940.  
  13941.  
  13942.  
  13943.  
  13944.  
  13945.  
  13946.  
  13947.           Chapter Five - JORF Functions                                 229
  13948.  
  13949.  
  13950.  
  13951.  
  13952.  
  13953.  
  13954.                                        Num:Rand
  13955.  
  13956.  
  13957.           Function  Num:Rand ( Low, High ) 
  13958.  
  13959.           Purpose   Produces a Random Number.
  13960.  
  13961.           Returns   A Random Number from Low through High.
  13962.  
  13963.           Notes     Produces a pseudo random number between High and Low
  13964.                     that are assumed to be integer values.  The random
  13965.                     number seed is the system clock and will be different
  13966.                     for each run of JORF.  The number may be Low or High or
  13967.                     any integer value between. 
  13968.  
  13969.           Example   The MANTRA.J sample program uses random row and column
  13970.                     for placing windows.
  13971.  
  13972.           Mantra:Start
  13973.             New (Counter)
  13974.             Msg:Add("Mantra")
  13975.               This next sample programs will display some windows &
  13976.               and get some keyboard entry.  One of my pet projects &
  13977.               is making computers say Mantras, and idea proposed by &
  13978.               Edsger Dijkstra many years ago.
  13979.  
  13980.               Tibetan Buddhists use mechanical prayer &
  13981.               wheels to pray more quickly and efficiently. &
  13982.               Japanese Buddhists of the Amida sect believe &
  13983.               that anyone who says "Amida" with pure &
  13984.               heart will go to heaven, so they say it as many times as possible &
  13985.               in hopes of forgetting and saying it with pure heart once in their lives.
  13986.  
  13987.               This Mantra system combines these ideas just in case they &
  13988.               may be right.  Who can have purer heart than a &
  13989.               computer?  If you run a Mantra system often, perhaps &
  13990.               your computer will also forget and therefore insure your place in heaven.
  13991.             While (Kbd:Hit==False)
  13992.               While (Counter < 40 And Kbd:Hit==False)
  13993.                 Mantra:Show(Here)
  13994.                 ++Counter
  13995.               While (Counter > 0 And Kbd:Hit==False)
  13996.                 Win:Del
  13997.                 --Counter
  13998.             Kbd:Bye
  13999.             Return
  14000.  
  14001.           Mantra:Show (Level)
  14002.             New (Row,Col)
  14003.             Row = Num:Rand(2,10)
  14004.             Col = Num:Rand(2,60)
  14005.  
  14006.           The JORF Manual (Shareware Disk Version)                      230
  14007.  
  14008.  
  14009.  
  14010.  
  14011.  
  14012.             Win:Add ("Om",Row,Col,0,0,Level)
  14013.               Am I a butterfly that
  14014.               dreams I am a computer?
  14015.  
  14016.               Or am I a computer that
  14017.               dreams I am a Butterfly?
  14018.             Return(Ok)
  14019.  
  14020.  
  14021.  
  14022.  
  14023.  
  14024.  
  14025.  
  14026.  
  14027.  
  14028.  
  14029.  
  14030.  
  14031.  
  14032.  
  14033.  
  14034.  
  14035.  
  14036.  
  14037.  
  14038.  
  14039.  
  14040.  
  14041.  
  14042.  
  14043.  
  14044.  
  14045.  
  14046.  
  14047.  
  14048.  
  14049.  
  14050.  
  14051.  
  14052.  
  14053.  
  14054.  
  14055.  
  14056.  
  14057.  
  14058.  
  14059.  
  14060.  
  14061.  
  14062.  
  14063.  
  14064.  
  14065.           Chapter Five - JORF Functions                                 231
  14066.  
  14067.  
  14068.  
  14069.  
  14070.  
  14071.  
  14072.                                        Num:Sqrt
  14073.  
  14074.  
  14075.           Function  Num:Sqrt ( Num ) 
  14076.  
  14077.           Purpose   Returns the square root of Num.
  14078.  
  14079.           Returns   Square root of Num.
  14080.  
  14081.           See Also  Num:Pow.
  14082.  
  14083.           Notes     Returns the square root of Num.  The return value is an
  14084.                     integer only if it fits.  If it is fractional, it is a
  14085.                     floating point value.  The square root of zero is
  14086.                     returned as zero.
  14087.  
  14088.  
  14089.  
  14090.  
  14091.  
  14092.  
  14093.  
  14094.  
  14095.  
  14096.  
  14097.  
  14098.  
  14099.  
  14100.  
  14101.  
  14102.  
  14103.  
  14104.  
  14105.  
  14106.  
  14107.  
  14108.  
  14109.  
  14110.  
  14111.  
  14112.  
  14113.  
  14114.  
  14115.  
  14116.  
  14117.  
  14118.  
  14119.  
  14120.  
  14121.  
  14122.  
  14123.  
  14124.           The JORF Manual (Shareware Disk Version)                      232
  14125.  
  14126.  
  14127.  
  14128.  
  14129.  
  14130.  
  14131.                                        Num:Str
  14132.  
  14133.  
  14134.           Function  Num:Str ( Number, Format, Base, Width )  
  14135.  
  14136.           Purpose   Convert number to a formatted string.
  14137.  
  14138.           Returns   Returns the formatted string.
  14139.  
  14140.           See Also  To:Num.
  14141.  
  14142.           Notes     Converts and formats a number making it a string.  This
  14143.                     is the  opposite of To:Num.  
  14144.  
  14145.                     You can use the Base to change the number base of the
  14146.                     conversion.  The default is 10 for decimal.  You can 16
  14147.                     for hexadecimal, 8 for octal, or any other number for
  14148.                     other numbering bases.
  14149.  
  14150.                     You can use the Format to apply a format to the number. 
  14151.                     The formatter is a string with a mask for the number. 
  14152.                     Available digits in the string are:
  14153.  
  14154.                     #    Writes a numeric digit
  14155.                     0    Writes 0 place holder or the numeric digit
  14156.                     -    Writes a - sign if number is negative
  14157.                     +    Writes a + sign if positive, - if negative
  14158.                     .    Decimal point
  14159.                     ,    Commas will be printed in the locations specified.
  14160.                     :    Any other character will be printed as is.
  14161.  
  14162.                     If you specify a width, the returned number will be
  14163.                     right justified with spaces to the specified width. 
  14164.                     This is useful for formatting a number in reports, and
  14165.                     is used by the Window management system for on-screen
  14166.                     formatting of numbers.
  14167.  
  14168.                     Some examples of formatters:
  14169.  
  14170.                     Number              Formatter Result
  14171.                     1234567.89     "#,###,##0.00" "1,234,567,89"
  14172.                     0              "#,###,##0.00" "0.00"
  14173.                     0              "#,###,###"    Null
  14174.                     1234           "00:00"        "12:34"
  14175.  
  14176.  
  14177.  
  14178.           Example   The Binary.J sample program formats numbers in base 2.
  14179.  
  14180.           Binary:Start
  14181.             New Char
  14182.  
  14183.           Chapter Five - JORF Functions                                 233
  14184.  
  14185.  
  14186.  
  14187.  
  14188.  
  14189.             Win:Add ("BINARY VALUES", 4, 4, 19, 60, Here)
  14190.  
  14191.             For (Char = 0 Thru 255)
  14192.               If (Char > 0 and (Char % 16 == 0))
  14193.                 Win:Pause
  14194.                 If Key:Got == "Esc_Key"
  14195.              Break
  14196.               Str:Put("     Character= {To:Str(Char,'000')} Symbol= ")
  14197.               Char:Put(Char)
  14198.               Str:PutLine("     Binary= {To:Str(Char,'0000 0000',2)}")
  14199.  
  14200.             If Key:Got != "Esc_Key"
  14201.               Win:Pause
  14202.             Jorf:Exit
  14203.  
  14204.                     The Payment.J sample program uses a number of
  14205.                     formatters to format dollar and percentage amounts.
  14206.  
  14207.           Class:Payment (Amt,Yrs,Intr,Pmt,Pmt50,Yrs50)
  14208.  
  14209.           Payment:Start
  14210.             New (Payment:Pmt)
  14211.             Win:Add ("Loan Payment Calculator",5,20)
  14212.               String:"Calculate your loan payment amount and years"
  14213.               String:"to pay if you added just $50 to the payment."
  14214.               String:
  14215.               String:"Press the TAB key to get from one field to"
  14216.               String:"the next. ENTER will end the program."
  14217.  
  14218.               Input:"&Loan Amount         ", Row:7 Col:5 Wid:14
  14219.                 Field:"Pmt->Amt", After:"Payment:Calc(Pmt)"
  14220.                 Format:"###,###,###.00", Type:"Numeric"
  14221.  
  14222.               Input:"&Years to Pay        ", Row:8 Col:5 Wid:3
  14223.                 Field:"Pmt->Yrs", After:"Payment:Calc(Pmt)"
  14224.                 Format:"###", Type:"Numeric"
  14225.  
  14226.               Input:"&Percent Interest    ", Row:9 Col:5 Wid:8
  14227.                 Field:"Pmt->Intr", After:"Payment:Calc(Pmt)"
  14228.                 Format:"00.0000%", Type:"Numeric"
  14229.  
  14230.               Input:"Payment             ", Row:10 Col:5 Wid:14
  14231.                 Field:"Pmt->Pmt", Before:"Return(Null)"
  14232.                 Format:"###,###,###.00", Type:"Numeric"
  14233.  
  14234.               Input:"Adding just $50     ", Row:12 Col:5 Wid:14
  14235.                 Field:"Pmt->Pmt50", Before:"Return(Null)"
  14236.                 Format:"###,###,###.00", Type:"Numeric"
  14237.  
  14238.               Input:"Reduces the years to"  Row:13 Col:5 Wid:3
  14239.                 Field:"Pmt->Yrs50", Before:"Return(Null)"
  14240.                 Format:"###", Type:"Numeric"
  14241.  
  14242.           The JORF Manual (Shareware Disk Version)                      234
  14243.  
  14244.  
  14245.  
  14246.  
  14247.  
  14248.               Button:"    &Done    ", Row:15, Col:16
  14249.             Return(Ok)
  14250.  
  14251.           Payment:Calc(Pmt)
  14252.             New (Periods,Per_Intr,Payment,Months50)
  14253.             Pmt->Pmt = 0
  14254.             If (Pmt->Intr > 0 And Pmt->Yrs > 0)
  14255.               Periods    = Pmt->Yrs*12
  14256.               Per_Intr   = Pmt->Intr/12/100
  14257.               Payment    = (Pmt->Amt*Per_Intr) / (1-Num:Pow(1+Per_Intr,(-Periods)))
  14258.               Payment    = Num:Int((Payment+.005)*100)/100
  14259.               Pmt->Pmt   = Payment
  14260.               Pmt->Pmt50 = Payment+50
  14261.               Months50   = Num:Log(Pmt->Pmt50/(Pmt->Pmt50-Pmt->Amt*Per_Intr))
  14262.               Months50   = Months50/Num:Log(1+Per_Intr)
  14263.               Pmt->Yrs50 = Num:Int((Months50/12)*10)/10
  14264.               Win:Dsp
  14265.             Return (Ok)
  14266.  
  14267.           Special Note   Some countries use a comma-decimal format where
  14268.                          the comma marks the decimal point and a period is
  14269.                          the thousands indicator.  To accommodate these
  14270.                          countries, JORF has an INI file setting to change
  14271.                          the default display format to use the
  14272.                          comma-decimal format.
  14273.  
  14274.                     Even when changed, however, all numeric formatters for
  14275.                     Num:Str must be in the American period-decimal style. 
  14276.                     Also, decimal numbers written in the program must also
  14277.                     be period-decimal style. This allows programs to be
  14278.                     portable, because the code does not need to change to
  14279.                     accommodate users who wish to use the comma-decimal
  14280.                     style.  
  14281.  
  14282.                     For an example of comma-decimal formatting, change your
  14283.                     the Decimal setting in your INI file to "Decimal=,",
  14284.                     then run the Payment.J sample program.  Note that in
  14285.                     the program the number .005 is expressed in
  14286.                     period-decimal format, even though the resulting
  14287.                     calculation is displayed in comma decimal format.
  14288.  
  14289.                     Decimal        Number    Formatter Result
  14290.                     Period         1234.56   "#,##0.00"     "1,234.56"
  14291.                     Comma          1234.56   "#,##0.00"     "1.234,56"
  14292.                     Period         .005 "0.0000"       "0.0050"
  14293.                     Comma          .005 "0.0000"       "0,0050"
  14294.  
  14295.  
  14296.  
  14297.  
  14298.  
  14299.  
  14300.  
  14301.           Chapter Five - JORF Functions                                 235
  14302.  
  14303.  
  14304.  
  14305.  
  14306.  
  14307.  
  14308.                                           Ok
  14309.  
  14310.  
  14311.           Function  Ok
  14312.  
  14313.           Purpose   None.
  14314.  
  14315.           Returns   1 (integer one).
  14316.  
  14317.           See Also  True.
  14318.  
  14319.           Notes     This value allows you create readable "Endless" While
  14320.                     loops by saying While Ok.
  14321.  
  14322.  
  14323.  
  14324.  
  14325.  
  14326.  
  14327.  
  14328.  
  14329.  
  14330.  
  14331.  
  14332.  
  14333.  
  14334.  
  14335.  
  14336.  
  14337.  
  14338.  
  14339.  
  14340.  
  14341.  
  14342.  
  14343.  
  14344.  
  14345.  
  14346.  
  14347.  
  14348.  
  14349.  
  14350.  
  14351.  
  14352.  
  14353.  
  14354.  
  14355.  
  14356.  
  14357.  
  14358.  
  14359.  
  14360.           The JORF Manual (Shareware Disk Version)                      236
  14361.  
  14362.  
  14363.  
  14364.  
  14365.  
  14366.  
  14367.                                        Rep:Add
  14368.  
  14369.  
  14370.           Function  Rep:Add ( Title, Row, Col, Len, Wid, Level, Def )  
  14371.  
  14372.           Purpose   Write a report or document.
  14373.  
  14374.           Returns   None.
  14375.  
  14376.           See Also  File:Print.
  14377.  
  14378.           Notes     The future of this function is bright, but currently it
  14379.                     is but a shadow of what will come.  The job here is to
  14380.                     create a report generating system as easy as the screen
  14381.                     system handled item the Win:Add command.
  14382.  
  14383.                     The parameter Title is used only for the status box
  14384.                     that will shows page and line is currently being
  14385.                     generated.  The parameters Row, Col, Len and Wid help
  14386.                     define the page size.  
  14387.  
  14388.                     The last parameter Def for definition is usually the
  14389.                     report definition in an indented section below this
  14390.                     command.   The  report is always written to the file
  14391.                     JREPORT.LST which then can be printed using File:Print. 
  14392.                      Like Win:Add, there are several key words used to
  14393.                     define report elements.
  14394.  
  14395.                          Header    A page header item
  14396.                          Footer    A page footer item
  14397.                          Next      Method to get the next record
  14398.                          Item      An Item on the report
  14399.                          Text      A multiline text in the report
  14400.  
  14401.                     If the operator presses the Esc_Key while a report is
  14402.                     being generated, the process will be aborted, the file
  14403.                     erased and null returned.  Checking file existence is a
  14404.                     good test of whether the Rep:Add finished normally.
  14405.  
  14406.                     Still to be completed is multiple level processing
  14407.                     (which will be done using indented sections, of course)
  14408.                     and support for printer drivers.  Please contact The
  14409.                     JORF Company for further changes and upgrades to this
  14410.                     command.
  14411.  
  14412.  
  14413.  
  14414.  
  14415.  
  14416.  
  14417.  
  14418.  
  14419.           Chapter Five - JORF Functions                                 237
  14420.  
  14421.  
  14422.  
  14423.  
  14424.  
  14425.  
  14426.           Example   This next example shows a normal report format.  This
  14427.                     report lists contact names one after the other.  It
  14428.                     contains a header and a footer.
  14429.  
  14430.  
  14431.           Contact:List
  14432.                       New (Dest)
  14433.                       Mem:Ptr->IndexName = "FullName"
  14434.                       Time:Get(Mem:Ptr)
  14435.                       Mem:Ptr->Page=1
  14436.  
  14437.                       Dest=Jorf:Printer()
  14438.                       If (Dest)
  14439.                         Win:Add("Printing")
  14440.                           Printing . . .
  14441.                         Contact:SetFile(Here)
  14442.                         Rep:Add ("Contact Listing", 5, 5, 60, 75,Here)
  14443.                           Header:"'Contact Listing Report'"     NewRow:1 Col:30
  14444.                           Header:"'Page '+Mem:Ptr->Page"       NewRow:1 Col:1
  14445.                           Header:"'Date '+Mem:Ptr->SDate"               Col:50
  14446.                           Header:"Str:AtSet(Null,1,'-',80)" NewRow:1 Col:1
  14447.                           Next:"Struct:Next('Contact', 
  14448.                                    Mem:Ptr->IndexName, Mem:Ptr->Contact)"
  14449.                           Item:"Mem:Ptr->Contact->FullName"      NewRow:2 Col:1  Len:20
  14450.                           Item:"Mem:Ptr->Contact->Company "               Col:22 Len:32
  14451.                           Item:"Mem:Ptr->Contact->WorkPhone"              Col:52 Len:28
  14452.                           Item:"Mem:Ptr->Contact->Addr1"         NewRow:1 Col:5  Len:30
  14453.                           Item:"Mem:Ptr->Contact->Addr2"         NewRow:1 Col:5  Len:30
  14454.                           Item:"Mem:Ptr->Contact->Addr3"         NewRow:1 Col:5  Len:30
  14455.                           Item:"Null"                            NewRow:1 Col:5  Len:30
  14456.                           Footer:"'Continued on Page '+Mem:Ptr->Page+1" Row:56 Col:1
  14457.                         File:Print("Jreport.lst",Dest)
  14458.                       Return (Ok)
  14459.  
  14460.  
  14461.  
  14462.  
  14463.  
  14464.  
  14465.  
  14466.  
  14467.  
  14468.  
  14469.  
  14470.  
  14471.  
  14472.  
  14473.  
  14474.  
  14475.  
  14476.  
  14477.  
  14478.           The JORF Manual (Shareware Disk Version)                      238
  14479.  
  14480.  
  14481.  
  14482.  
  14483.  
  14484.  
  14485.                     If you skip the page definition, the report will print
  14486.                     without headers or footers.  You can use this to print
  14487.                     continuous  forms.
  14488.  
  14489.  
  14490.           Contact:ContinLabels(Flag)
  14491.                       New (Dest,CurrContact)
  14492.                       Dest=Jorf:Printer()
  14493.                       Win:Add("Printing")
  14494.                         Printing . . .
  14495.  
  14496.                       Contact:SetFile(Here)
  14497.                       CurrContact        = Mem:Ptr->Contact
  14498.                       Mem:Ptr->OneContact= CurrContact
  14499.                       Mem:Ptr->Contact   = Null
  14500.  
  14501.                       | Report format for Continuous labels, 6 lines,  1 line between
  14502.                       |
  14503.                       Rep:Add ("Continuous Labels")
  14504.                         Next:"Contact:Nextlabel(Flag)"
  14505.                         Item:"'('+Mem:Ptr->Contact->MailCode+')'" NewRow:1 Col:26 Wid:12
  14506.                           Before:"Mem:Ptr->Contact->MailCode!=Null"
  14507.                         Item:"" NewRow:1 Col:26 Wid:12
  14508.                           Before:"Mem:Ptr->Contact->MailCode==Null"
  14509.                         Item:"Mem:Ptr->Contact->FullName"    NewRow:1 Col:1  Wid:40
  14510.                         Item:"Mem:Ptr->Contact->Company"     NewRow:1 Col:1  Wid:40
  14511.                           Before:"Mem:Ptr->Contact->Company!=Null"
  14512.                         Item:"Mem:Ptr->Contact->Addr1"       NewRow:1 Col:1  Wid:40
  14513.                         Item:"Mem:Ptr->Contact->Addr2"       NewRow:1 Col:1  Wid:40
  14514.                         Item:"Mem:Ptr->Contact->Addr3"       NewRow:1 Col:1  Wid:40
  14515.                         Item:"" NewRow:1
  14516.                           Before:"Mem:Ptr->Contact->Company==Null"
  14517.                       File:Print("JREPORT.LST",Dest)
  14518.                       Mem:Ptr->Contact=CurrContact
  14519.                       Return(Null)
  14520.  
  14521.  
  14522.  
  14523.  
  14524.  
  14525.  
  14526.  
  14527.  
  14528.  
  14529.  
  14530.  
  14531.  
  14532.  
  14533.  
  14534.  
  14535.  
  14536.  
  14537.           Chapter Five - JORF Functions                                 239
  14538.  
  14539.  
  14540.  
  14541.  
  14542.  
  14543.  
  14544.                     This last example shows how you can read an ASCII text
  14545.                     file to feed a text item in the report.  The text key
  14546.                     word takes the name of a JORF pointer that holds the
  14547.                     text to use for a format.  Lines in that text may
  14548.                     contain JORF variables in curly braces. 
  14549.  
  14550.                     Contact:MergeLetter
  14551.                       New (Dest,Letter,CurrContact)
  14552.                       Time:Get(Mem:Ptr)
  14553.                       Letter=File:Load(Contact:GetLetter)
  14554.                       If (Letter!=Null)
  14555.                         Dest=Jorf:Printer()
  14556.                         If (Dest)
  14557.                           CurrContact=Mem:Ptr->Contact
  14558.                           Mem:Ptr->Contact=Null
  14559.                           Win:Add("Printing")
  14560.                             Printing . . .
  14561.                           Rep:Add ("Merge Letter", 5, 5, 60, 75,Here)
  14562.                             Header:"" Row:1
  14563.                             Next:"Contact:NextRecord('Next')"
  14564.                             Text:"Letter"
  14565.                           File:Print("JREPORT.LST",Dest)
  14566.                           Mem:Ptr->Contact=CurrContact
  14567.                       Return (Ok)
  14568.  
  14569.  
  14570.  
  14571.  
  14572.  
  14573.  
  14574.  
  14575.  
  14576.  
  14577.  
  14578.  
  14579.  
  14580.  
  14581.  
  14582.  
  14583.  
  14584.  
  14585.  
  14586.  
  14587.  
  14588.  
  14589.  
  14590.  
  14591.  
  14592.  
  14593.  
  14594.  
  14595.  
  14596.           The JORF Manual (Shareware Disk Version)                      240
  14597.  
  14598.  
  14599.  
  14600.  
  14601.  
  14602.  
  14603.                                         Return
  14604.  
  14605.  
  14606.           Function  Return (Value )
  14607.  
  14608.           Purpose   Return a value.
  14609.  
  14610.           Returns   None.
  14611.  
  14612.           Notes     Methods may return a single value using this command. 
  14613.                     If no value is specified, null is returned.  A method
  14614.                     that ends without an explicit Return is the same as
  14615.                     Return (Null).
  14616.  
  14617.                     If more than one value needs to be returned, the
  14618.                     parameters used to call the function may be changed.  
  14619.  
  14620.                     Return may be used at any time, including If statements
  14621.                     and While loops. This will end execution of the current
  14622.                     method and return control to the calling method.
  14623.  
  14624.  
  14625.  
  14626.  
  14627.  
  14628.  
  14629.  
  14630.  
  14631.  
  14632.  
  14633.  
  14634.  
  14635.  
  14636.  
  14637.  
  14638.  
  14639.  
  14640.  
  14641.  
  14642.  
  14643.  
  14644.  
  14645.  
  14646.  
  14647.  
  14648.  
  14649.  
  14650.  
  14651.  
  14652.  
  14653.  
  14654.  
  14655.           Chapter Five - JORF Functions                                 241
  14656.  
  14657.  
  14658.  
  14659.  
  14660.  
  14661.  
  14662.                                        Rule:Add
  14663.  
  14664.  
  14665.           Function  Rule:Add ( RuleStructure )  
  14666.  
  14667.           Purpose   Add a new Rule.
  14668.  
  14669.           Returns   None.
  14670.  
  14671.           See Also  Key:Add.
  14672.  
  14673.           Notes     RuleStructure must be a structure with the elements
  14674.                     Obj, Att, Val, Prob, Ptr, Fnd (Found), and KLen (Key
  14675.                     Length).  The last two elements are used by Rule:Find
  14676.                     to get next rule in a series.  The element Str used by
  14677.                     Key:Find are replaced here by Att and Val.   
  14678.                     Adds rule valued Obj, Att and Val, with the associated
  14679.                     data in Ptr (Pointer).  The rule may be found again by
  14680.                     doing a partial or whole rule search on RuleStructure.
  14681.  
  14682.           Example   The ISA.J source file demonstrates both forward and
  14683.                     backward searching using the Rule system.   It is an
  14684.                     older sample program and so has pretty primitive window
  14685.                     handling.
  14686.  
  14687.  
  14688.  
  14689.  
  14690.  
  14691.  
  14692.  
  14693.  
  14694.  
  14695.  
  14696.  
  14697.  
  14698.  
  14699.  
  14700.  
  14701.  
  14702.  
  14703.  
  14704.  
  14705.  
  14706.  
  14707.  
  14708.  
  14709.  
  14710.  
  14711.  
  14712.  
  14713.  
  14714.           The JORF Manual (Shareware Disk Version)                      242
  14715.  
  14716.  
  14717.  
  14718.  
  14719.  
  14720.  
  14721.                                        Rule:Del
  14722.  
  14723.  
  14724.           Function  Rule:Del ( RuleStructure )  
  14725.  
  14726.           Purpose   Delete a Rule in the Data Base.
  14727.  
  14728.           Returns   None.  Sets RuleStructure->Fnd to True if Rule was
  14729.                     deleted.
  14730.  
  14731.           See Also  Key:Del.
  14732.  
  14733.           Notes     Deletes an existing rule.  This command may be called
  14734.                     with a partial rule, in which case it will delete the
  14735.                     first rule that begins with that value.  It is highly
  14736.                     recommended that this command be called with a complete
  14737.                     rule to insure that the correct entry is deleted.  
  14738.  
  14739.                     After a rule is deleted, you can still use Rule:Next go
  14740.                     the "next" rule.  
  14741.  
  14742.  
  14743.  
  14744.  
  14745.  
  14746.  
  14747.  
  14748.  
  14749.  
  14750.  
  14751.  
  14752.  
  14753.  
  14754.  
  14755.  
  14756.  
  14757.  
  14758.  
  14759.  
  14760.  
  14761.  
  14762.  
  14763.  
  14764.  
  14765.  
  14766.  
  14767.  
  14768.  
  14769.  
  14770.  
  14771.  
  14772.  
  14773.           Chapter Five - JORF Functions                                 243
  14774.  
  14775.  
  14776.  
  14777.  
  14778.  
  14779.  
  14780.                                       Rule:Find
  14781.  
  14782.  
  14783.           Function  Rule:Find ( RuleStructure ) 
  14784.  
  14785.           Purpose   Find a Rule in the Data Base.
  14786.  
  14787.           Returns   None.  Sets RuleStructure->Fnd to True if Rule was
  14788.                     found.
  14789.  
  14790.           See Also  Rule:Add.
  14791.  
  14792.           Notes     Find a rule. In this function, parameters may be empty,
  14793.                     in which case the first matching index entry will be
  14794.                     returned.  Parameters must be empty from left to right,
  14795.                     that is, if Att has a value then Obj must also have a
  14796.                     value.  If a "hole" is left, then nothing will ever be
  14797.                     found.
  14798.  
  14799.                     When a rule is found, the structure will be filled with
  14800.                     the values of that rule and Fnd will be set to True. 
  14801.                     If Rule:Next is called with these values set, then the
  14802.                     next rule value is returned.  This process may be
  14803.                     continued until the value of the current rule does not
  14804.                     match the value of the original partial rule.  This
  14805.                     length is put in KLen after every successful search and
  14806.                     may be modified.
  14807.  
  14808.           Example   The HAIKU.J uses this function to save the word table
  14809.                     info.
  14810.  
  14811.  
  14812.  
  14813.  
  14814.  
  14815.  
  14816.  
  14817.  
  14818.  
  14819.  
  14820.  
  14821.  
  14822.  
  14823.  
  14824.  
  14825.  
  14826.  
  14827.  
  14828.  
  14829.  
  14830.  
  14831.  
  14832.           The JORF Manual (Shareware Disk Version)                      244
  14833.  
  14834.  
  14835.  
  14836.  
  14837.  
  14838.  
  14839.                                       Rule:Next
  14840.  
  14841.  
  14842.           Function  Rule:Next ( RuleStructure ) 
  14843.  
  14844.           Purpose   Find the next Rule in sequence.
  14845.  
  14846.           Returns   None.  Sets RuleStructure->Fnd to True if Rule was
  14847.                     found.
  14848.  
  14849.           See Also  Rule:Find.
  14850.  
  14851.           Notes     If RuleStructure->KLen is zero, this works just like
  14852.                     Rule:Find.  If not zero, this command finds the next
  14853.                     rule in a sequence.  This process may be continued
  14854.                     until the value of the current rule within the Klen
  14855.                     changes.  Values for Klen are: 
  14856.  
  14857.                     0    Rules with the same Type match
  14858.                     1    Rules with the same Type+Obj match
  14859.                     2    Rules with the same Type+Obj+Att match
  14860.                     3    Rules with the same Type+Obj+Att+Prob+Val match
  14861.  
  14862.  
  14863.           Example   See Rule:Add.
  14864.  
  14865.  
  14866.  
  14867.  
  14868.  
  14869.  
  14870.  
  14871.  
  14872.  
  14873.  
  14874.  
  14875.  
  14876.  
  14877.  
  14878.  
  14879.  
  14880.  
  14881.  
  14882.  
  14883.  
  14884.  
  14885.  
  14886.  
  14887.  
  14888.  
  14889.  
  14890.  
  14891.           Chapter Five - JORF Functions                                 245
  14892.  
  14893.  
  14894.  
  14895.  
  14896.  
  14897.  
  14898.                                       Rule:Prev
  14899.  
  14900.  
  14901.           Function  Rule:Prev ( RuleStructure ) 
  14902.  
  14903.           Purpose   Find previous Rule in sequence.
  14904.  
  14905.           Returns   None.  Sets RuleStructure->Fnd to True if Rule was
  14906.                     found.
  14907.  
  14908.           See Also  Rule:Next.
  14909.  
  14910.           Notes     This command is the opposite of Rule:Next.
  14911.  
  14912.  
  14913.  
  14914.  
  14915.  
  14916.  
  14917.  
  14918.  
  14919.  
  14920.  
  14921.  
  14922.  
  14923.  
  14924.  
  14925.  
  14926.  
  14927.  
  14928.  
  14929.  
  14930.  
  14931.  
  14932.  
  14933.  
  14934.  
  14935.  
  14936.  
  14937.  
  14938.  
  14939.  
  14940.  
  14941.  
  14942.  
  14943.  
  14944.  
  14945.  
  14946.  
  14947.  
  14948.  
  14949.  
  14950.           The JORF Manual (Shareware Disk Version)                      246
  14951.  
  14952.  
  14953.  
  14954.  
  14955.  
  14956.  
  14957.                                        Str:Aft
  14958.  
  14959.  
  14960.           Function  Str:Aft ( String, CharList ) 
  14961.  
  14962.           Purpose   Get substring starting with the first character not
  14963.                     specified in CharList.
  14964.  
  14965.           Returns   The substring.
  14966.  
  14967.           See Also  Str:AtChar.
  14968.  
  14969.           Notes     Skips over characters specified, and returns the string
  14970.                     after those characters.  The most common example is to
  14971.                     specify the string after any leading spaces. 
  14972.  
  14973.                     This command is the functional equivalent of the C
  14974.                     language strninset().
  14975.  
  14976.                     The return value is the substring, not the position.
  14977.  
  14978.           Example   See Jorf:Write.
  14979.  
  14980.  
  14981.  
  14982.  
  14983.  
  14984.  
  14985.  
  14986.  
  14987.  
  14988.  
  14989.  
  14990.  
  14991.  
  14992.  
  14993.  
  14994.  
  14995.  
  14996.  
  14997.  
  14998.  
  14999.  
  15000.  
  15001.  
  15002.  
  15003.  
  15004.  
  15005.  
  15006.  
  15007.  
  15008.  
  15009.           Chapter Five - JORF Functions                                 247
  15010.  
  15011.  
  15012.  
  15013.  
  15014.  
  15015.  
  15016.                                         Str:At
  15017.  
  15018.  
  15019.           Function  Str:At ( String, Position, Length ) 
  15020.  
  15021.           Purpose   Get a substring at specified position in String.
  15022.  
  15023.           Returns   The substring.
  15024.  
  15025.           See Also  Str:In.
  15026.  
  15027.           Notes     Returns the substring at the specified position and
  15028.                     length.  JORF does not think of single characters as
  15029.                     integers, as in BASIC, C and Pascal.  Instead, JORF
  15030.                     sees characters as one letter strings.  
  15031.  
  15032.                     The first character of the string is one (1) and the
  15033.                     last character is the return value of Str:Len.  
  15034.  
  15035.                     A negative Position indicates an offset from the right
  15036.                     (end) of the string.  A negative Length just counts
  15037.                     backward.  A Position or Length that are out of bounds
  15038.                     returns whatever part of the string is in bounds.
  15039.  
  15040.           Example   See Event:Add.
  15041.  
  15042.  
  15043.  
  15044.  
  15045.  
  15046.  
  15047.  
  15048.  
  15049.  
  15050.  
  15051.  
  15052.  
  15053.  
  15054.  
  15055.  
  15056.  
  15057.  
  15058.  
  15059.  
  15060.  
  15061.  
  15062.  
  15063.  
  15064.  
  15065.  
  15066.  
  15067.  
  15068.           The JORF Manual (Shareware Disk Version)                      248
  15069.  
  15070.  
  15071.  
  15072.  
  15073.  
  15074.  
  15075.                                       Str:AtChar
  15076.  
  15077.  
  15078.           Function  Str:AtChar ( String, CharList ) 
  15079.  
  15080.           Purpose   Get a substring starting with one of characters in
  15081.                     CharList. 
  15082.  
  15083.           Returns   The substring.
  15084.  
  15085.           See Also  Str:In.
  15086.  
  15087.           Notes     Get a substring starting with one of the specified
  15088.                     characters.  To look for a substring within a string,
  15089.                     use Str:In. 
  15090.  
  15091.                     Returns the substring, not the position. 
  15092.  
  15093.  
  15094.  
  15095.  
  15096.  
  15097.  
  15098.  
  15099.  
  15100.  
  15101.  
  15102.  
  15103.  
  15104.  
  15105.  
  15106.  
  15107.  
  15108.  
  15109.  
  15110.  
  15111.  
  15112.  
  15113.  
  15114.  
  15115.  
  15116.  
  15117.  
  15118.  
  15119.  
  15120.  
  15121.  
  15122.  
  15123.  
  15124.  
  15125.  
  15126.  
  15127.           Chapter Five - JORF Functions                                 249
  15128.  
  15129.  
  15130.  
  15131.  
  15132.  
  15133.  
  15134.                                       Str:AtCut
  15135.  
  15136.  
  15137.           Function  Str:AtCut ( String, Position ) 
  15138.  
  15139.           Purpose   Get a truncated version of string.
  15140.  
  15141.           Returns   The truncated string.
  15142.  
  15143.           See Also  Str:AtDel.
  15144.  
  15145.           Notes     Truncates String at Position.  This command is
  15146.                     functionally the same as:
  15147.  
  15148.                     Str:AtDel (String, Pos, Str:Len(String)-Pos)
  15149.  
  15150.                     If Position is less than one, or greater than the
  15151.                     length of String, then nothing will change.  
  15152.  
  15153.  
  15154.  
  15155.  
  15156.  
  15157.  
  15158.  
  15159.  
  15160.  
  15161.  
  15162.  
  15163.  
  15164.  
  15165.  
  15166.  
  15167.  
  15168.  
  15169.  
  15170.  
  15171.  
  15172.  
  15173.  
  15174.  
  15175.  
  15176.  
  15177.  
  15178.  
  15179.  
  15180.  
  15181.  
  15182.  
  15183.  
  15184.  
  15185.  
  15186.           The JORF Manual (Shareware Disk Version)                      250
  15187.  
  15188.  
  15189.  
  15190.  
  15191.  
  15192.  
  15193.                                       Str:AtDel
  15194.  
  15195.  
  15196.           Function  Str:AtDel ( String, Position, Count ) 
  15197.  
  15198.           Purpose   Returns a version of String with deleted characters.
  15199.  
  15200.           Returns   The modified string.
  15201.  
  15202.           See Also  Str:AtCut.
  15203.  
  15204.           Notes     Deletes Count characters from a string at Position.  If
  15205.                     Count is zero, or exceeds the length of the string,
  15206.                     then the string will be truncated at Position.  If
  15207.                     Position is less than one, or greater than the length
  15208.                     of String, then nothing will change.  
  15209.  
  15210.  
  15211.  
  15212.  
  15213.  
  15214.  
  15215.  
  15216.  
  15217.  
  15218.  
  15219.  
  15220.  
  15221.  
  15222.  
  15223.  
  15224.  
  15225.  
  15226.  
  15227.  
  15228.  
  15229.  
  15230.  
  15231.  
  15232.  
  15233.  
  15234.  
  15235.  
  15236.  
  15237.  
  15238.  
  15239.  
  15240.  
  15241.  
  15242.  
  15243.  
  15244.  
  15245.           Chapter Five - JORF Functions                                 251
  15246.  
  15247.  
  15248.  
  15249.  
  15250.  
  15251.  
  15252.                                       Str:AtPut
  15253.  
  15254.  
  15255.           Function  Str:AtPut ( String, Position, InsertString ) 
  15256.  
  15257.           Purpose   Insert a substring within string.
  15258.  
  15259.           Returns   The modified string.
  15260.  
  15261.           See Also  Str:AtSet.
  15262.  
  15263.           Notes     Inserts InsertString into String at Position.  If
  15264.                     Position is less than one, or greater than the length
  15265.                     of String, then nothing will change.  This command will
  15266.                     not overwrite existing characters.  Instead, it expands
  15267.                     the string to fit the new characters.  To replace
  15268.                     characters, first use Str:AtDel.
  15269.  
  15270.  
  15271.  
  15272.  
  15273.  
  15274.  
  15275.  
  15276.  
  15277.  
  15278.  
  15279.  
  15280.  
  15281.  
  15282.  
  15283.  
  15284.  
  15285.  
  15286.  
  15287.  
  15288.  
  15289.  
  15290.  
  15291.  
  15292.  
  15293.  
  15294.  
  15295.  
  15296.  
  15297.  
  15298.  
  15299.  
  15300.  
  15301.  
  15302.  
  15303.  
  15304.           The JORF Manual (Shareware Disk Version)                      252
  15305.  
  15306.  
  15307.  
  15308.  
  15309.  
  15310.  
  15311.                                       Str:AtSet
  15312.  
  15313.  
  15314.           Function  Str:AtSet ( String, Position, InsertString, Count ) 
  15315.  
  15316.           Purpose   Sets a repeated value into String.
  15317.  
  15318.           Returns   The modified string.
  15319.  
  15320.           See Also  Str:AtPut.
  15321.  
  15322.           Notes     Inserts InsertString, Count times, into String at
  15323.                     Position.  If Position is less than one, or greater
  15324.                     than the length of String, then nothing will change. 
  15325.                     This command will not overwrite existing characters. 
  15326.                     Instead, it expands the string to fit the new
  15327.                     characters.  To replace characters, first use
  15328.                     Str:AtDel.
  15329.  
  15330.                     This command is used to place a repeated pattern in a
  15331.                     string.  It also may  be used to create a buffer full
  15332.                     of a known value.  Use Str:AtSet(Null,1,"*", 15) to
  15333.                     create '***************'.  
  15334.  
  15335.                     To create a buffer full of spaces use Str:Pad, or nulls
  15336.                     with Str:NPad.
  15337.  
  15338.  
  15339.  
  15340.  
  15341.  
  15342.  
  15343.  
  15344.  
  15345.  
  15346.  
  15347.  
  15348.  
  15349.  
  15350.  
  15351.  
  15352.  
  15353.  
  15354.  
  15355.  
  15356.  
  15357.  
  15358.  
  15359.  
  15360.  
  15361.  
  15362.  
  15363.           Chapter Five - JORF Functions                                 253
  15364.  
  15365.  
  15366.  
  15367.  
  15368.  
  15369.  
  15370.                                         Str:In
  15371.  
  15372.  
  15373.           Function  Str:In ( String, Substring ) 
  15374.  
  15375.           Purpose   Returns the position of Substring in String.  
  15376.  
  15377.           Returns   A numeric position.  
  15378.  
  15379.           See Also  Other String functions.
  15380.  
  15381.           Notes     If Substring is not found then returns zero.  The
  15382.                     search is always insensitive to letter case.  The first
  15383.                     position is 1 and the last position is Str:Len(String)-
  15384.                     Str:Len(SubString).  A return value of zero or null
  15385.                     indicates the substring is not found in string.
  15386.  
  15387.                     Examples:
  15388.  
  15389.                     Str:In ("Josephine", "ph")    Result 5
  15390.                     Str:In ("Festus",    "f")     Result 1
  15391.                     Str:In ("Bear",      "EAR")   Result 2
  15392.                     Str:In ("Josephine", "Z")     Result 0
  15393.  
  15394.  
  15395.  
  15396.  
  15397.  
  15398.  
  15399.  
  15400.  
  15401.  
  15402.  
  15403.  
  15404.  
  15405.  
  15406.  
  15407.  
  15408.  
  15409.  
  15410.  
  15411.  
  15412.  
  15413.  
  15414.  
  15415.  
  15416.  
  15417.  
  15418.  
  15419.  
  15420.  
  15421.  
  15422.           The JORF Manual (Shareware Disk Version)                      254
  15423.  
  15424.  
  15425.  
  15426.  
  15427.  
  15428.  
  15429.                                        Str:Len
  15430.  
  15431.  
  15432.           Function  Str:Len ( String ) 
  15433.  
  15434.           Purpose   Get the number of characters in String.
  15435.  
  15436.           Returns   The number of characters in String.
  15437.  
  15438.           See Also  Text:Len.
  15439.  
  15440.           Notes     Returns the number of characters in a string.  Also
  15441.                     returns the string length of all JORF data types.  
  15442.  
  15443.                          String    String Length
  15444.                          Number    Length of number formatted as a string
  15445.                          Date      Length of date formatted as a string
  15446.                          Time      Length of time formatted as a string
  15447.                          Structure 0
  15448.                          Array     0
  15449.                          Text      Length of line pointed to by text
  15450.  
  15451.  
  15452.  
  15453.  
  15454.  
  15455.  
  15456.  
  15457.  
  15458.  
  15459.  
  15460.  
  15461.  
  15462.  
  15463.  
  15464.  
  15465.  
  15466.  
  15467.  
  15468.  
  15469.  
  15470.  
  15471.  
  15472.  
  15473.  
  15474.  
  15475.  
  15476.  
  15477.  
  15478.  
  15479.  
  15480.  
  15481.           Chapter Five - JORF Functions                                 255
  15482.  
  15483.  
  15484.  
  15485.  
  15486.  
  15487.  
  15488.                                        Str:NPad
  15489.  
  15490.  
  15491.           Function  Str:NPad ( String, Length ) 
  15492.  
  15493.           Purpose   Pad the end of String with nulls until it is the
  15494.                     specified Length.
  15495.  
  15496.           Returns   The modified String.
  15497.  
  15498.           See Also  Str:Pad.
  15499.  
  15500.           Notes     Not commonly used for anything but writing specialized
  15501.                     file formats.  Many file formats require fields that
  15502.                     are null padded, instead of space padded.  Use this
  15503.                     command to null pad your strings.
  15504.  
  15505.                     Once a string is null padded, most JORF functions will
  15506.                     reconvert the string back to it's smallest format.  You
  15507.                     should use this command just prior to writing a string
  15508.                     or buffer to file. 
  15509.  
  15510.  
  15511.  
  15512.  
  15513.  
  15514.  
  15515.  
  15516.  
  15517.  
  15518.  
  15519.  
  15520.  
  15521.  
  15522.  
  15523.  
  15524.  
  15525.  
  15526.  
  15527.  
  15528.  
  15529.  
  15530.  
  15531.  
  15532.  
  15533.  
  15534.  
  15535.  
  15536.  
  15537.  
  15538.  
  15539.  
  15540.           The JORF Manual (Shareware Disk Version)                      256
  15541.  
  15542.  
  15543.  
  15544.  
  15545.  
  15546.  
  15547.                                        Str:Pad
  15548.  
  15549.  
  15550.           Function  Str:Pad ( String, Length ) 
  15551.  
  15552.           Purpose   Pad the end of String with spaces, until it is the
  15553.                     specified Length.
  15554.  
  15555.           Returns   The modified String.
  15556.  
  15557.           See Also  Str:NPad.
  15558.  
  15559.           Notes     Commonly used to format consecutive strings for output
  15560.                     on the screen or printer.  By padding, you can column
  15561.                     align values.  If the string is too long, this command
  15562.                     will truncate it to the Pad length. 
  15563.  
  15564.  
  15565.  
  15566.  
  15567.  
  15568.  
  15569.  
  15570.  
  15571.  
  15572.  
  15573.  
  15574.  
  15575.  
  15576.  
  15577.  
  15578.  
  15579.  
  15580.  
  15581.  
  15582.  
  15583.  
  15584.  
  15585.  
  15586.  
  15587.  
  15588.  
  15589.  
  15590.  
  15591.  
  15592.  
  15593.  
  15594.  
  15595.  
  15596.  
  15597.  
  15598.  
  15599.           Chapter Five - JORF Functions                                 257
  15600.  
  15601.  
  15602.  
  15603.  
  15604.  
  15605.  
  15606.                                       Str:Print
  15607.  
  15608.  
  15609.           Function  Str:Print ( Printer, String ) 
  15610.  
  15611.           Purpose   Direct serial or parallel port output of a String.
  15612.  
  15613.           Returns   The modified String.
  15614.  
  15615.           See Also  Str:NPad.
  15616.  
  15617.           Notes     This command became obsolete for printing as of version
  15618.                     2.0 of the JORF Interpreter because MS-Windows does not
  15619.                     adequately support printing anything less than a data
  15620.                     file with a full page of output.
  15621.  
  15622.                     There are rare circumstances where programmers may
  15623.                     still require direct access to the output ports..  For
  15624.                     instance, to auto-dial a modem requires that you submit
  15625.                     the AT commands directly to the modems serial port. 
  15626.                     For this purpose, the Str:Print has been restored to
  15627.                     communicate directly with an output (serial or
  15628.                     parallel) prot.  
  15629.  
  15630.                     This command prints String to the designated port.  The
  15631.                     Port must be Prn, Aux, LPT1, LPT2, COM1, or COM2 to
  15632.                     indicate default printer, auxiliary port, line printer
  15633.                     one and two, and serial printer one and two. 
  15634.                     Internally, the interpreter uses both BIOS and DOS
  15635.                     calls to access the port.
  15636.  
  15637.                     You cannot set the speed of a serial port using the
  15638.                     JORF Interpreter.  Instead, use the DOS MODE command. 
  15639.                     To set up a Hayes compatible 2400 baud modem for
  15640.                     auto-dialing, you need to execute:
  15641.  
  15642.                          C>Mode Com1:2400,n,8,1,p
  15643.  
  15644.  
  15645.                     If this command works for you, you should put it in
  15646.                     your autoexec.bat file so it is executed when your
  15647.                     computer boots.
  15648.  
  15649.                     In theory, this function supports COM1 through COM9,
  15650.                     and LPT1 through LPT9.  In practice, the last port
  15651.                     accessed may be limited by your computer, Windows or
  15652.                     DOS.  
  15653.  
  15654.  
  15655.  
  15656.  
  15657.  
  15658.           The JORF Manual (Shareware Disk Version)                      258
  15659.  
  15660.  
  15661.  
  15662.  
  15663.  
  15664.  
  15665.                                        Str:Put
  15666.  
  15667.  
  15668.           Function  Str:Put ( String ) 
  15669.  
  15670.           Purpose   Put a string on the window.
  15671.  
  15672.           Returns   None.
  15673.  
  15674.           See Also  Str:PutLine.
  15675.  
  15676.           Notes     Outputs a JORF data pointer as a string to the current
  15677.                     window at the current cursor position.  You can use
  15678.                     this function to display the data from any JORF type
  15679.                     except structures.  To display a structure, you must
  15680.                     display the elements of that structure independently. 
  15681.  
  15682.                     You can mix text and variables two ways.  One is to
  15683.                     assemble them at print time by adding them together.
  15684.  
  15685.                          Jorf:MyPrint(Var1,Var2)
  15686.                            Str:Put("Var1 is "+Var1+" and var2 is "+Var2)
  15687.                            Return (Ok)
  15688.  
  15689.            
  15690.                     The other way is to surround variables in curly
  15691.                     brackets to indicate that they are magic spots.  This
  15692.                     method is faster, because magic spot processing is
  15693.                     faster than string concatenation.  This method will
  15694.                     does not work on windows where Win:Ptr->Magic is FALSE
  15695.                     because Win:Ptr->Magic controls whether magic spots are
  15696.                     interpreted.
  15697.  
  15698.  
  15699.                     Jorf:MyPrint(Var1,Var2)
  15700.                            Str:Put("Var1 is {Var1} and var2 is {Var2}")
  15701.                            Return (Ok)
  15702.  
  15703.            
  15704.                     This function is buffered for speed.  Calling this
  15705.                     function sets the internal buffer, but the buffer is
  15706.                     not shown on the screen until the line is finished. You
  15707.                     can force a display by changing to another line using
  15708.                     Move:To or by ending the line using Str:PutLine.
  15709.  
  15710.  
  15711.  
  15712.  
  15713.  
  15714.  
  15715.  
  15716.  
  15717.           Chapter Five - JORF Functions                                 259
  15718.  
  15719.  
  15720.  
  15721.  
  15722.  
  15723.  
  15724.                                      Str:PutLine
  15725.  
  15726.  
  15727.           Function  Str:PutLine ( Line ) 
  15728.  
  15729.           Purpose   Put string on window, then go to next line.
  15730.  
  15731.           Returns   None.
  15732.  
  15733.           See Also  Str:Put.
  15734.  
  15735.           Notes     Outputs a line to the current window, moves the cursor
  15736.                     to the next line.  This command differs from Str:Put
  15737.                     because it completes the line by moving the cursor. 
  15738.                     This function will re-display the entire text row in
  15739.                     the window.
  15740.  
  15741.  
  15742.  
  15743.  
  15744.  
  15745.  
  15746.  
  15747.  
  15748.  
  15749.  
  15750.  
  15751.  
  15752.  
  15753.  
  15754.  
  15755.  
  15756.  
  15757.  
  15758.  
  15759.  
  15760.  
  15761.  
  15762.  
  15763.  
  15764.  
  15765.  
  15766.  
  15767.  
  15768.  
  15769.  
  15770.  
  15771.  
  15772.  
  15773.  
  15774.  
  15775.  
  15776.           The JORF Manual (Shareware Disk Version)                      260
  15777.  
  15778.  
  15779.  
  15780.  
  15781.  
  15782.  
  15783.                                        Str:Rpad
  15784.  
  15785.  
  15786.           Function  Str:Rpad ( String, Length ) 
  15787.  
  15788.           Purpose   Pad the right side of String with spaces, until it is
  15789.                     the specified Length.
  15790.  
  15791.           Returns   The modified String.
  15792.  
  15793.           See Also  Str:Pad.
  15794.  
  15795.           Notes     Like Str:Pad this function is commonly used to format
  15796.                     stings, especially numbers where right justification is
  15797.                     desired.  By padding, you can column align values.  If
  15798.                     the string is too long, this command will truncate it
  15799.                     to the specified length. 
  15800.  
  15801.  
  15802.  
  15803.  
  15804.  
  15805.  
  15806.  
  15807.  
  15808.  
  15809.  
  15810.  
  15811.  
  15812.  
  15813.  
  15814.  
  15815.  
  15816.  
  15817.  
  15818.  
  15819.  
  15820.  
  15821.  
  15822.  
  15823.  
  15824.  
  15825.  
  15826.  
  15827.  
  15828.  
  15829.  
  15830.  
  15831.  
  15832.  
  15833.  
  15834.  
  15835.           Chapter Five - JORF Functions                                 261
  15836.  
  15837.  
  15838.  
  15839.  
  15840.  
  15841.  
  15842.                                      Struct:Find
  15843.  
  15844.  
  15845.           Function  Struct:Find ( Class, Index, Value ) 
  15846.  
  15847.           Purpose   Find a structure using an automatic index.
  15848.  
  15849.           Returns   Structure. 
  15850.  
  15851.           See Also  Struct:Next, Key:Find.
  15852.  
  15853.           Notes     When you define a structure with automatic indexes the
  15854.                     interpreter will automatically add, change and delete
  15855.                     that index.  This command allows you to find structures
  15856.                     that have previously been stored using this index.  
  15857.                     Set Class to the class name, the Index to the name of
  15858.                     the field that is indexed, and the Value to the value
  15859.                     you want to find.  If the search value is null, this
  15860.                     command returns the first item in the index.
  15861.  
  15862.           Example   The FILTER.J sample program is the simplest data base
  15863.                     of all.
  15864.  
  15865.  
  15866.  
  15867.  
  15868.  
  15869.  
  15870.  
  15871.  
  15872.  
  15873.  
  15874.  
  15875.  
  15876.  
  15877.  
  15878.  
  15879.  
  15880.  
  15881.  
  15882.  
  15883.  
  15884.  
  15885.  
  15886.  
  15887.  
  15888.  
  15889.  
  15890.  
  15891.  
  15892.  
  15893.  
  15894.           The JORF Manual (Shareware Disk Version)                      262
  15895.  
  15896.  
  15897.  
  15898.  
  15899.  
  15900.  
  15901.                                      Struct:Next
  15902.  
  15903.  
  15904.           Function  Struct:Next ( Class, Index, Value ) 
  15905.  
  15906.           Purpose   Find the next structure  in sequence.
  15907.  
  15908.           Returns   Structure.
  15909.  
  15910.           See Also  Struct:Find.
  15911.  
  15912.           Notes     If Value is null this command finds the first structure
  15913.                     in the file. Each subsequent call finds the next record
  15914.                     in sequence.  This function is widely used for Window
  15915.                     Lists where the Next command is used to find the next
  15916.                     record in the list.
  15917.  
  15918.                     If there are no more records in the index, this command
  15919.                     returns null.
  15920.  
  15921.  
  15922.  
  15923.  
  15924.  
  15925.  
  15926.  
  15927.  
  15928.  
  15929.  
  15930.  
  15931.  
  15932.  
  15933.  
  15934.  
  15935.  
  15936.  
  15937.  
  15938.  
  15939.  
  15940.  
  15941.  
  15942.  
  15943.  
  15944.  
  15945.  
  15946.  
  15947.  
  15948.  
  15949.  
  15950.  
  15951.  
  15952.  
  15953.           Chapter Five - JORF Functions                                 263
  15954.  
  15955.  
  15956.  
  15957.  
  15958.  
  15959.  
  15960.                                      Struct:Prev
  15961.  
  15962.  
  15963.           Function  Struct:Prev ( Class, Index, Value ) 
  15964.  
  15965.           Purpose   Find the previous structure  in sequence.
  15966.  
  15967.           Returns   Structure.
  15968.  
  15969.           See Also  Struct:Find.
  15970.  
  15971.           Notes     If Value is null this command finds nothing - not the
  15972.                     last structure in the index which is what you might
  15973.                     expect.  This function is widely used for Window Lists
  15974.                     when you use the up arrow to go up through a file.  
  15975.  
  15976.                     If the Value was already at the first record in the
  15977.                     index, this function returns null.
  15978.  
  15979.  
  15980.  
  15981.  
  15982.  
  15983.  
  15984.  
  15985.  
  15986.  
  15987.  
  15988.  
  15989.  
  15990.  
  15991.  
  15992.  
  15993.  
  15994.  
  15995.  
  15996.  
  15997.  
  15998.  
  15999.  
  16000.  
  16001.  
  16002.  
  16003.  
  16004.  
  16005.  
  16006.  
  16007.  
  16008.  
  16009.  
  16010.  
  16011.  
  16012.           The JORF Manual (Shareware Disk Version)                      264
  16013.  
  16014.  
  16015.  
  16016.  
  16017.  
  16018.  
  16019.                                    Switch/Case/Else
  16020.  
  16021.  
  16022.           Function  Switch/Case/Else
  16023.  
  16024.           Purpose   A conditional branch.
  16025.  
  16026.           Returns   None.
  16027.  
  16028.           See Also  If/Else.
  16029.  
  16030.           Notes     A conditional Branch.  Tests the value of a parameter
  16031.                     and executes indented code sections based on that
  16032.                     value. 
  16033.  
  16034.                          Switch ( TestValue ) 
  16035.                            Case Value1
  16036.                            Case Value2
  16037.                              Performs this section if TestValue is Value1
  16038.                              OR Value2
  16039.                            Else
  16040.                              If no Case was valid this section performed.
  16041.  
  16042.                     Tests a value and performs commands in indented
  16043.                     sections.  This command was introduced for the C
  16044.                     language, but was not robust.  I have strengthened the
  16045.                     command by eliminating the need for explicit Break
  16046.                     commands.  I have changed "Default" to Else.  And I
  16047.                     allow more complex processing on Case lines.
  16048.  
  16049.                     The Switch command does not need a parameter following. 
  16050.                     If the parameter is absent, the Case lines are expected
  16051.                     to be logical expressions that can be evaluated.  If
  16052.                     the parameter is present, the parameter is check
  16053.                     against the expression in the Case line.
  16054.  
  16055.                     Break may not be used, even by hopeless C programmers
  16056.                     like myself who put them in anyway.  It was never
  16057.                     robust to partially reuse code sections and K&R must
  16058.                     not have realized the ramifications when they created
  16059.                     the C language switch command.  They required an extra
  16060.                     key word for the common case and promoted the unwise
  16061.                     programming practice of allowing the program flow to
  16062.                     "fall" into another routine.
  16063.  
  16064.  
  16065.  
  16066.  
  16067.  
  16068.  
  16069.  
  16070.  
  16071.           Chapter Five - JORF Functions                                 265
  16072.  
  16073.  
  16074.  
  16075.  
  16076.  
  16077.  
  16078.           Examples  The Switch command is used to replace multiple If/Else
  16079.                     statements.  It checks a condition, and compares it to
  16080.                     various Case clauses.  It executes the indented section
  16081.                     under the appropriate Case.  It also has an Else
  16082.                     clause, which works just like the else in an If
  16083.                     statement.
  16084.  
  16085.                     For example:                       Is Replaced By
  16086.  
  16087.                     If (A=2)                           Switch (A)
  16088.                       B=A+C                              Case 2
  16089.                     Else                                   B=A+C
  16090.                       If (A=3)                           Case 3
  16091.                         B=A+D                              B=A+D
  16092.                       Else                               Case 4
  16093.                         If (A=4)                           B=A+E
  16094.                           B=A+E                          Else
  16095.                         Else                               B=A
  16096.                           B=A
  16097.  
  16098.  
  16099.                     Case functions may be stacked.
  16100.  
  16101.                         Switch (Key)                        
  16102.                           Case 'a'                          
  16103.                           Case 'A'                          
  16104.                             Say 'Key is A'                  
  16105.                           Case 'b'                          
  16106.                           Case 'B'                          
  16107.                             Say 'Key is B'                  
  16108.                           Else                              
  16109.                             Say 'Key is not A or B'  
  16110.  
  16111.  
  16112.                     The Switch function is neater and easier to use than
  16113.                     multiple If/Else functions.  The condition for the
  16114.                     switch command may be omitted, and the  Case commands
  16115.                     may be complex comparisons.
  16116.  
  16117.                             Switch
  16118.                              Case (Key>='a' && Key<='Z')
  16119.                              Case (Key>='A' && Key<='Z')
  16120.                                Say 'Key is a Letter'
  16121.                              Case (Key>='0' && Key<='9')
  16122.                                Say 'Key is a Number'
  16123.                              Else
  16124.                                Say 'Key is Something Else'
  16125.  
  16126.  
  16127.  
  16128.  
  16129.  
  16130.           The JORF Manual (Shareware Disk Version)                      266
  16131.  
  16132.  
  16133.  
  16134.  
  16135.  
  16136.  
  16137.                                        Text:Add
  16138.  
  16139.  
  16140.           Function  Text:Add ( Line, Text ) 
  16141.  
  16142.           Purpose   Append Line to the bottom of Text.
  16143.  
  16144.           Returns   Text.
  16145.  
  16146.           See Also  Line:Inp, Win:Add.
  16147.  
  16148.           Notes     Appends to existing text, or creates a new text.  This
  16149.                     command is commonly used to create paragraphs of text
  16150.                     for output to the screen or printer.
  16151.  
  16152.                     The return value is a JORF Pointer to text.  This is a
  16153.                     fascinating data type because it has two natures:  A
  16154.                     Pointer to text points to a string value for the
  16155.                     specific line of text, and a text value that is linked
  16156.                     to all the other lines of the text.  This is a little
  16157.                     confusing.  Basically String functions will bring out
  16158.                     the string nature of the current line, and Text
  16159.                     functions will allow you to work with the text nature
  16160.                     of a Text pointer.
  16161.  
  16162.                     Adding lines to text is done internally, and if you
  16163.                     want the new lines on a displayed text field to be
  16164.                     displayed you must use Win:Dsp after adding.  
  16165.  
  16166.                     Text is "sparse" in memory, meaning that if it is too
  16167.                     long, only portions are in RAM.  The remainder of the
  16168.                     text is stored on disk.  If you are creating a large
  16169.                     chunk of text, it will be swapped to the temporary
  16170.                     file.  If you later store the text in a data file,
  16171.                     there may be considerable delay as the text is copied
  16172.                     from the temporary swap file to your permanent file. 
  16173.                     For this reason, you may benefit from writing the first
  16174.                     line of text to your destination file as it is created. 
  16175.                     This insures that the entire text is written to the
  16176.                     final destination file, eliminating later delays.
  16177.  
  16178.                     Text is stored in 4K chunks.  When you reference a line
  16179.                     of text, the first 4K and the 4K chunk that contains
  16180.                     the line is loaded.  The chunks are indexed so that
  16181.                     obtaining the last line of text does not require
  16182.                     reading all chunks.  However, inserting a new line, or
  16183.                     deleting a line requires that all subsequent chunks be
  16184.                     rewritten.  That is why the system slows down for line
  16185.                     insert and line delete functions on text over 10K of
  16186.                     memory.  
  16187.  
  16188.  
  16189.           Chapter Five - JORF Functions                                 267
  16190.  
  16191.  
  16192.  
  16193.  
  16194.  
  16195.                     The maximum number of lines allows is 32K.  However,
  16196.                     speed and storage requirements will make any text with
  16197.                     more than 2000 lines pretty pokey and not advised. 
  16198.                     Each line of the text may be up to 10K bytes long.  The
  16199.                     10K limit is imposed by a bug in the Borland library in
  16200.                     failing to dependably allocate large blocks of memory. 
  16201.                     If this bug is fixed, the limit may go up to the JORF
  16202.                     language design goal of 32K bytes per line.
  16203.  
  16204.                     Warning:  If you are building a multi-line text, and
  16205.                     you get the parameters to Text:Add backward, your text
  16206.                     will not be created, and you will only see the last
  16207.                     line you added. 
  16208.  
  16209.           Example   See the HAIKU.J sample program. 
  16210.  
  16211.  
  16212.  
  16213.  
  16214.  
  16215.  
  16216.  
  16217.  
  16218.  
  16219.  
  16220.  
  16221.  
  16222.  
  16223.  
  16224.  
  16225.  
  16226.  
  16227.  
  16228.  
  16229.  
  16230.  
  16231.  
  16232.  
  16233.  
  16234.  
  16235.  
  16236.  
  16237.  
  16238.  
  16239.  
  16240.  
  16241.  
  16242.  
  16243.  
  16244.  
  16245.  
  16246.  
  16247.  
  16248.           The JORF Manual (Shareware Disk Version)                      268
  16249.  
  16250.  
  16251.  
  16252.  
  16253.  
  16254.  
  16255.                                        Text:At
  16256.  
  16257.  
  16258.           Function  Text:At ( Text, LineNumber )  
  16259.  
  16260.           Purpose   Get a specific line of Text.
  16261.  
  16262.           Returns   The line of Text.
  16263.  
  16264.           See Also  Text:Pos.
  16265.  
  16266.           Notes     Returns the line of Text at LineNumber.  If Text is not
  16267.                     a block of text, it is treated as a single line of
  16268.                     text.  If the LineNumber is greater than the length of
  16269.                     the text this function returns null.
  16270.  
  16271.                     The first line of text is at Text:At(Text,1).  The last
  16272.                     line of text is at Text:At(Text,Text:Len(Text)).
  16273.  
  16274.           Example   See Text:Bot
  16275.  
  16276.  
  16277.  
  16278.  
  16279.  
  16280.  
  16281.  
  16282.  
  16283.  
  16284.  
  16285.  
  16286.  
  16287.  
  16288.  
  16289.  
  16290.  
  16291.  
  16292.  
  16293.  
  16294.  
  16295.  
  16296.  
  16297.  
  16298.  
  16299.  
  16300.  
  16301.  
  16302.  
  16303.  
  16304.  
  16305.  
  16306.  
  16307.           Chapter Five - JORF Functions                                 269
  16308.  
  16309.  
  16310.  
  16311.  
  16312.  
  16313.  
  16314.                                        Text:Bot
  16315.  
  16316.  
  16317.           Function  Text:Bot ( Text ) 
  16318.  
  16319.           Purpose   Get the last line of a block of text.
  16320.  
  16321.           Returns   The last line of Text.
  16322.  
  16323.           See Also  Text:Top, Text:Next, Text:Len.
  16324.  
  16325.           Notes     Returns the last line of Text.  If Text is not a
  16326.                     multiple line text block, then returns Text as if it
  16327.                     were a one line text block.
  16328.  
  16329.           Example   The following program demonstrates the text commands. 
  16330.                     Note how Text:Top and Text:Bot return the top and
  16331.                     bottom of the whole method.  To find the top of the
  16332.                     block of text, check the number of leading spaces.
  16333.  
  16334.                     Text:Start 
  16335.                       | Sample for Text Functions 
  16336.                       Text:Sample 
  16337.                         This text was passed to 
  16338.                         to a method because: 
  16339.                         a) The method call 
  16340.                            needed a parameter 
  16341.                         b) The text was indented 
  16342.                       Return 
  16343.                      
  16344.                     Text:Sample Text 
  16345.                       New Win1, Win2 
  16346.                       Win1->Text = Text 
  16347.                       Win1->Row = 2 
  16348.                       Win1->Col = 2 
  16349.                       Win:Add (Win1) 
  16350.                      
  16351.                       Win2->Row=(-2) 
  16352.                       Win2->Col=(-2) 
  16353.                       Win2->Len=11 
  16354.                       Win2->Wid=40 
  16355.                       Win:Add (Win2) 
  16356.                      
  16357.                       Str:PutLine ("Text      = "+Text) 
  16358.                       Str:PutLine ("Text:Len  = "+Text:Len (Text))
  16359.                       Str:PutLine ("Text:Wid  = "+Text:Wid (Text)) 
  16360.                       Str:PutLine ("Text:Top  = "+Text:Top (Text)) 
  16361.                       Str:PutLine ("Text:Bot  = "+Text:Bot (Text)) 
  16362.                       Str:PutLine ("Text:At 2 = "+Text:At (Text, 2))
  16363.                       Text = Text:Next (Text) 
  16364.                       Str:PutLine ("Text:Next = "+Text)
  16365.  
  16366.           The JORF Manual (Shareware Disk Version)                      270
  16367.  
  16368.  
  16369.  
  16370.  
  16371.  
  16372.                       Text = Text:Next (Text) 
  16373.                       Str:PutLine ("Text:Next = "+Text)
  16374.                       Text = Text:Next (Text) 
  16375.                       Str:PutLine ("Text:Next = "+Text)
  16376.                       Text = Text:Next (Text) 
  16377.                       Str:PutLine ("Text:Next = "+Text) 
  16378.                       Str:PutLine ("Text:Pos  = "+Text:Pos (Text))
  16379.                       Text = Text:Prev (Text) 
  16380.                       Str:PutLine ("Text:Prev = "+Text) 
  16381.                       Win:Pause 
  16382.                       Return 
  16383.  
  16384.  
  16385.  
  16386.  
  16387.  
  16388.  
  16389.  
  16390.  
  16391.  
  16392.  
  16393.  
  16394.  
  16395.  
  16396.  
  16397.  
  16398.  
  16399.  
  16400.  
  16401.  
  16402.  
  16403.  
  16404.  
  16405.  
  16406.  
  16407.  
  16408.  
  16409.  
  16410.  
  16411.  
  16412.  
  16413.  
  16414.  
  16415.  
  16416.  
  16417.  
  16418.  
  16419.  
  16420.  
  16421.  
  16422.  
  16423.  
  16424.  
  16425.           Chapter Five - JORF Functions                                 271
  16426.  
  16427.  
  16428.  
  16429.  
  16430.  
  16431.  
  16432.                                        Text:Len
  16433.  
  16434.  
  16435.           Function  Text:Len ( Text ) 
  16436.  
  16437.           Purpose   Get number of lines in Text.
  16438.  
  16439.           Returns   Returns number of lines.
  16440.  
  16441.           See Also  Text:Len, Text:Wid.
  16442.  
  16443.           Notes     If Text is not a text block, it will be treated as a
  16444.                     single line.
  16445.  
  16446.           Example   See Text:Bot
  16447.  
  16448.  
  16449.  
  16450.  
  16451.  
  16452.  
  16453.  
  16454.  
  16455.  
  16456.  
  16457.  
  16458.  
  16459.  
  16460.  
  16461.  
  16462.  
  16463.  
  16464.  
  16465.  
  16466.  
  16467.  
  16468.  
  16469.  
  16470.  
  16471.  
  16472.  
  16473.  
  16474.  
  16475.  
  16476.  
  16477.  
  16478.  
  16479.  
  16480.  
  16481.  
  16482.  
  16483.  
  16484.           The JORF Manual (Shareware Disk Version)                      272
  16485.  
  16486.  
  16487.  
  16488.  
  16489.  
  16490.  
  16491.                                       Text:Next
  16492.  
  16493.  
  16494.           Function  Text:Next ( Text ) 
  16495.  
  16496.           Purpose   Gets the next line of Text.
  16497.  
  16498.           Returns   A Jorf Pointer to the next line of Text.
  16499.  
  16500.           See Also  Text:Prev, Text:Len.
  16501.  
  16502.           Notes     Returns the next line of Text.  If Text is on the last
  16503.                     line, or is not a block of text, this function returns
  16504.                     null.
  16505.  
  16506.           Example   See Text:Bot
  16507.  
  16508.  
  16509.  
  16510.  
  16511.  
  16512.  
  16513.  
  16514.  
  16515.  
  16516.  
  16517.  
  16518.  
  16519.  
  16520.  
  16521.  
  16522.  
  16523.  
  16524.  
  16525.  
  16526.  
  16527.  
  16528.  
  16529.  
  16530.  
  16531.  
  16532.  
  16533.  
  16534.  
  16535.  
  16536.  
  16537.  
  16538.  
  16539.  
  16540.  
  16541.  
  16542.  
  16543.           Chapter Five - JORF Functions                                 273
  16544.  
  16545.  
  16546.  
  16547.  
  16548.  
  16549.  
  16550.                                        Text:Pos
  16551.  
  16552.  
  16553.           Function  Text:Pos ( Text )  
  16554.  
  16555.           Purpose   Returns the line number of Text.
  16556.  
  16557.           Returns   The previous line of Text.
  16558.  
  16559.           See Also  Text:At.
  16560.  
  16561.           Notes     Returns the line number of Text.  If Text is on the
  16562.                     first line, or is not a block of text, this function
  16563.                     returns 1.
  16564.  
  16565.           Example   See Text:Bot
  16566.  
  16567.  
  16568.  
  16569.  
  16570.  
  16571.  
  16572.  
  16573.  
  16574.  
  16575.  
  16576.  
  16577.  
  16578.  
  16579.  
  16580.  
  16581.  
  16582.  
  16583.  
  16584.  
  16585.  
  16586.  
  16587.  
  16588.  
  16589.  
  16590.  
  16591.  
  16592.  
  16593.  
  16594.  
  16595.  
  16596.  
  16597.  
  16598.  
  16599.  
  16600.  
  16601.  
  16602.           The JORF Manual (Shareware Disk Version)                      274
  16603.  
  16604.  
  16605.  
  16606.  
  16607.  
  16608.  
  16609.                                       Text:Prev
  16610.  
  16611.  
  16612.           Function  Text:Prev ( Text ) 
  16613.  
  16614.           Purpose   Get previous line of Text.
  16615.  
  16616.           Returns   The previous line of Text.
  16617.  
  16618.           See Also  Text:Next.
  16619.  
  16620.           Notes     Returns the previous line of Text.  If Text is on the
  16621.                     first line, or is not a block of text, this function
  16622.                     returns null.
  16623.  
  16624.           Example   See Text:Bot
  16625.  
  16626.  
  16627.  
  16628.  
  16629.  
  16630.  
  16631.  
  16632.  
  16633.  
  16634.  
  16635.  
  16636.  
  16637.  
  16638.  
  16639.  
  16640.  
  16641.  
  16642.  
  16643.  
  16644.  
  16645.  
  16646.  
  16647.  
  16648.  
  16649.  
  16650.  
  16651.  
  16652.  
  16653.  
  16654.  
  16655.  
  16656.  
  16657.  
  16658.  
  16659.  
  16660.  
  16661.           Chapter Five - JORF Functions                                 275
  16662.  
  16663.  
  16664.  
  16665.  
  16666.  
  16667.  
  16668.                                        Text:Top
  16669.  
  16670.  
  16671.           Function  Text:Top ( Text ) 
  16672.  
  16673.           Purpose   Get a Jorf Pointer to the top of a block of text.
  16674.  
  16675.           Returns   A Jorf Pointer to the first line of a block of text.
  16676.  
  16677.           See Also  Text:Bot. Text:Next.
  16678.  
  16679.           Notes     Returns the first line of Text.  If Text is not a text
  16680.                     block, then Text is returned because it is treated as a
  16681.                     one line text block.
  16682.  
  16683.           Example   See Text:Bot
  16684.  
  16685.  
  16686.  
  16687.  
  16688.  
  16689.  
  16690.  
  16691.  
  16692.  
  16693.  
  16694.  
  16695.  
  16696.  
  16697.  
  16698.  
  16699.  
  16700.  
  16701.  
  16702.  
  16703.  
  16704.  
  16705.  
  16706.  
  16707.  
  16708.  
  16709.  
  16710.  
  16711.  
  16712.  
  16713.  
  16714.  
  16715.  
  16716.  
  16717.  
  16718.  
  16719.  
  16720.           The JORF Manual (Shareware Disk Version)                      276
  16721.  
  16722.  
  16723.  
  16724.  
  16725.  
  16726.  
  16727.                                        Text:Wid
  16728.  
  16729.  
  16730.           Function  Text:Wid ( Text ) 
  16731.  
  16732.           Purpose   Get the width necessary to display this block of text.
  16733.  
  16734.           Returns   The width of the widest line of Text.
  16735.  
  16736.           See Also  Str:Len.
  16737.  
  16738.           Notes     Returns the width of the widest line of Text.  The
  16739.                     common use of this function is to obtain the width of a
  16740.                     text box for display or printout purposes.  To insure
  16741.                     speed, only the first 60 lines are checked for width.
  16742.  
  16743.           Example   See Text:Bot
  16744.  
  16745.  
  16746.  
  16747.  
  16748.  
  16749.  
  16750.  
  16751.  
  16752.  
  16753.  
  16754.  
  16755.  
  16756.  
  16757.  
  16758.  
  16759.  
  16760.  
  16761.  
  16762.  
  16763.  
  16764.  
  16765.  
  16766.  
  16767.  
  16768.  
  16769.  
  16770.  
  16771.  
  16772.  
  16773.  
  16774.  
  16775.  
  16776.  
  16777.  
  16778.  
  16779.           Chapter Five - JORF Functions                                 277
  16780.  
  16781.  
  16782.  
  16783.  
  16784.  
  16785.  
  16786.                                        Time:Add
  16787.  
  16788.  
  16789.           Function  Time:Add ( Time, Minutes, Hours, Seconds )  
  16790.                     Time:Add ( Time, "HH:MM:SS" )  
  16791.  
  16792.           Purpose   Add the specified Minutes, Hours or Seconds from the
  16793.                     Time.
  16794.  
  16795.           Returns   A time.
  16796.  
  16797.           See Also  Time:Sub, Date:Add.
  16798.  
  16799.           Notes     This is a very specialized command that helps you
  16800.                     calculate one minute after or one hour after a time. 
  16801.                     Note the parameters are not in smallest-to-largest
  16802.                     order, but feature seconds last because that parameter
  16803.                     is not often set.
  16804.  
  16805.                     There is currently no logic overflow for when you set a
  16806.                     time past or before midnight. 
  16807.  
  16808.  
  16809.  
  16810.  
  16811.  
  16812.  
  16813.  
  16814.  
  16815.  
  16816.  
  16817.  
  16818.  
  16819.  
  16820.  
  16821.  
  16822.  
  16823.  
  16824.  
  16825.  
  16826.  
  16827.  
  16828.  
  16829.  
  16830.  
  16831.  
  16832.  
  16833.  
  16834.  
  16835.  
  16836.  
  16837.  
  16838.           The JORF Manual (Shareware Disk Version)                      278
  16839.  
  16840.  
  16841.  
  16842.  
  16843.  
  16844.  
  16845.                                        Time:Get
  16846.  
  16847.  
  16848.           Function  Time:Get 
  16849.  
  16850.           Purpose   Get system Time.
  16851.  
  16852.           Returns   A JORF pointer with the current system time.
  16853.  
  16854.           See Also  Time:Set.
  16855.  
  16856.           Notes     There is an internal data type for the time  Conversion
  16857.                     to this type is done using the To:Time function. 
  16858.                     Conversion from this types done using Time:Str.  These
  16859.                     functions are paralleled for date.
  16860.  
  16861.  
  16862.  
  16863.  
  16864.  
  16865.  
  16866.  
  16867.  
  16868.  
  16869.  
  16870.  
  16871.  
  16872.  
  16873.  
  16874.  
  16875.  
  16876.  
  16877.  
  16878.  
  16879.  
  16880.  
  16881.  
  16882.  
  16883.  
  16884.  
  16885.  
  16886.  
  16887.  
  16888.  
  16889.  
  16890.  
  16891.  
  16892.  
  16893.  
  16894.  
  16895.  
  16896.  
  16897.           Chapter Five - JORF Functions                                 279
  16898.  
  16899.  
  16900.  
  16901.  
  16902.  
  16903.  
  16904.                                        Time:Set
  16905.  
  16906.  
  16907.           Function  Time:Set ( Time ) 
  16908.  
  16909.           Purpose   Set DOS clock to the specified date.
  16910.  
  16911.           Returns   None.
  16912.  
  16913.           See Also  Date:Set, To:Time.
  16914.  
  16915.           Notes     Sets the DOS time.  Time should be the result of the
  16916.                     To:Time function.  You can also specify a string value
  16917.                     in the form of HH:MM.
  16918.  
  16919.                     Setting the DOS time and date does not always affect
  16920.                     the computer's system clock.  To permanently change the
  16921.                     time and date on your computer, you may have to use a
  16922.                     utility program.  Network computers often get their
  16923.                     date and time reset from the network file server. 
  16924.  
  16925.  
  16926.  
  16927.  
  16928.  
  16929.  
  16930.  
  16931.  
  16932.  
  16933.  
  16934.  
  16935.  
  16936.  
  16937.  
  16938.  
  16939.  
  16940.  
  16941.  
  16942.  
  16943.  
  16944.  
  16945.  
  16946.  
  16947.  
  16948.  
  16949.  
  16950.  
  16951.  
  16952.  
  16953.  
  16954.  
  16955.  
  16956.           The JORF Manual (Shareware Disk Version)                      280
  16957.  
  16958.  
  16959.  
  16960.  
  16961.  
  16962.  
  16963.                                      Time:SetFmt
  16964.  
  16965.  
  16966.           Function  Time:SetFmt ( FormatStructure )  
  16967.  
  16968.           Purpose   Changes the default time string, and AM/PM indicator
  16969.                     for Time:Str.
  16970.  
  16971.           Returns   None.
  16972.  
  16973.           See Also  Time:Str, Date:SetFmt.
  16974.  
  16975.           Notes     The structure may be any structure with the elements
  16976.                     specified below.  The Element values are parsed and
  16977.                     sorted in an internal static array.  Changing the
  16978.                     elements after setting them does not change the
  16979.                     internal array until you call Time:SetFmt again.  
  16980.  
  16981.                     This function does not return any values, but sets up
  16982.                     values for later use by Time:Str.
  16983.  
  16984.                     The structure values are as follows:
  16985.  
  16986.                     FormatStructure->Format       | Default MM/DD/YY format
  16987.  
  16988.                     FormatStructure->A1           | The name for AM
  16989.                     FormatStructure->A2           | The name for PM         
  16990.  
  16991.  
  16992.  
  16993.  
  16994.  
  16995.  
  16996.  
  16997.  
  16998.  
  16999.  
  17000.  
  17001.  
  17002.  
  17003.  
  17004.  
  17005.  
  17006.  
  17007.  
  17008.  
  17009.  
  17010.  
  17011.  
  17012.  
  17013.  
  17014.  
  17015.           Chapter Five - JORF Functions                                 281
  17016.  
  17017.  
  17018.  
  17019.  
  17020.  
  17021.  
  17022.                                        Time:Str
  17023.  
  17024.  
  17025.           Function  Time:Str ( Time, Format )  
  17026.  
  17027.           Purpose   Formats the time according to format.  
  17028.  
  17029.           Returns   A formatted string.
  17030.  
  17031.           See Also  Time:Get, Date:Str.
  17032.  
  17033.           Notes     The specified time should be the result of the To:Time
  17034.                     function that  returns JORF pointer with an internal
  17035.                     date value. (The internal value stores the time as a
  17036.                     long integer value of the number of hundredths of
  17037.                     seconds since midnight.  
  17038.  
  17039.                     The format is a string saying how to format the date. 
  17040.                     The following are special character within the format
  17041.                     string:
  17042.  
  17043.                                    Time Formatters
  17044.  
  17045.                     h  = Hours                    Caps is military time
  17046.                     _h = Hours, space in front    Caps is military time
  17047.                     hh = Hours, zero in front     Caps is military time
  17048.                     m  = Minutes                  Caps is ignored
  17049.                     _m = Minutes, space in front  Caps is ignored
  17050.                     mm = Minutes, zero in front   Caps is ignored
  17051.                     s  = Seconds                  Caps is ignored
  17052.                     _s = Seconds, space in front  Caps is ignored
  17053.                     ss = seconds, zero in front   Caps is ignored
  17054.                     a  = am or pm                 Caps means AM or PM
  17055.  
  17056.                     Time in "Military Time" is based on a 24 hour clock
  17057.                     from 00:00 to 23:59.  When not in military time, the
  17058.                     hour after midnight is 12:00 AM to 12:50 AM, and noon
  17059.                     is 12:00 PM.
  17060.  
  17061.                     Any other characters are retained as-is, including
  17062.                     other letters.
  17063.  
  17064.                     The following examples show how the time 14:10 would be
  17065.                     formatted:
  17066.  
  17067.  
  17068.                     Time:Str(Time,"h:mm a")            result "2:10 pm"
  17069.                          Time:Str(Time,"hh:mm A")      result "02:10 PM"
  17070.                          Time:Str(Time,"HH:MM")        result "14:10"
  17071.                          Time:Str(Time,"H")            result "14"
  17072.                          Time:Str(Time,"h")            result "2"
  17073.  
  17074.           The JORF Manual (Shareware Disk Version)                      282
  17075.  
  17076.  
  17077.  
  17078.  
  17079.  
  17080.                     You can easily change the AM/PM indicator using  the
  17081.                     Time:SetFmt function.  If the format is omitted, the
  17082.                     default format of "HH:MM" is used.  This default can be
  17083.                     changed using Time:SetFmt.
  17084.  
  17085.  
  17086.  
  17087.  
  17088.  
  17089.  
  17090.  
  17091.  
  17092.  
  17093.  
  17094.  
  17095.  
  17096.  
  17097.  
  17098.  
  17099.  
  17100.  
  17101.  
  17102.  
  17103.  
  17104.  
  17105.  
  17106.  
  17107.  
  17108.  
  17109.  
  17110.  
  17111.  
  17112.  
  17113.  
  17114.  
  17115.  
  17116.  
  17117.  
  17118.  
  17119.  
  17120.  
  17121.  
  17122.  
  17123.  
  17124.  
  17125.  
  17126.  
  17127.  
  17128.  
  17129.  
  17130.  
  17131.  
  17132.  
  17133.           Chapter Five - JORF Functions                                 283
  17134.  
  17135.  
  17136.  
  17137.  
  17138.  
  17139.  
  17140.                                        Time:Sub
  17141.  
  17142.  
  17143.           Function  Time:Sub ( Time, Minutes, Hours, Seconds )  
  17144.                     Time:Sub ( Time, "HH:MM:SS" )  
  17145.  
  17146.           Purpose   Subtract the specified Minutes, Hours or Seconds from
  17147.                     the Time.
  17148.  
  17149.           Returns   A time.
  17150.  
  17151.           See Also  Time:Add, Date:Sub.
  17152.  
  17153.           Notes     This is a very specialized command that helps you
  17154.                     calculate one minute before or one hour before a time. 
  17155.                     Note the parameters are not in smallest-to-largest
  17156.                     order, but feature seconds last because that parameter
  17157.                     is not often set.
  17158.  
  17159.                     There is currently no logic overflow for when you set a
  17160.                     time past or before midnight. 
  17161.  
  17162.  
  17163.  
  17164.  
  17165.  
  17166.  
  17167.  
  17168.  
  17169.  
  17170.  
  17171.  
  17172.  
  17173.  
  17174.  
  17175.  
  17176.  
  17177.  
  17178.  
  17179.  
  17180.  
  17181.  
  17182.  
  17183.  
  17184.  
  17185.  
  17186.  
  17187.  
  17188.  
  17189.  
  17190.  
  17191.  
  17192.           The JORF Manual (Shareware Disk Version)                      284
  17193.  
  17194.  
  17195.  
  17196.  
  17197.  
  17198.  
  17199.                                       Time:Ticks
  17200.  
  17201.  
  17202.           Function  Time:Ticks
  17203.  
  17204.           Purpose   Gives an accurate timing mechanism.
  17205.  
  17206.           Returns   The number of ticks since midnight.
  17207.  
  17208.           See Also  Time:Get.
  17209.  
  17210.           Notes     Returns the number clock ticks since midnight.  This
  17211.                     may be used to time methods and program processes. 
  17212.                     This allows you to time operations with greater
  17213.                     precision than the seconds in the Time:Get command
  17214.                     allows.  
  17215.  
  17216.                     Currently there are 18 ticks per second on all DOS and
  17217.                     Windows based systems. 
  17218.  
  17219.  
  17220.  
  17221.  
  17222.  
  17223.  
  17224.  
  17225.  
  17226.  
  17227.  
  17228.  
  17229.  
  17230.  
  17231.  
  17232.  
  17233.  
  17234.  
  17235.  
  17236.  
  17237.  
  17238.  
  17239.  
  17240.  
  17241.  
  17242.  
  17243.  
  17244.  
  17245.  
  17246.  
  17247.  
  17248.  
  17249.  
  17250.  
  17251.           Chapter Five - JORF Functions                                 285
  17252.  
  17253.  
  17254.  
  17255.  
  17256.  
  17257.  
  17258.                                        To:ASCII
  17259.  
  17260.  
  17261.           Function  To:ASCII ( String ) 
  17262.  
  17263.           Purpose   Get ASCII value of first character of String.
  17264.  
  17265.           Returns   Returns the ASCII decimal value.
  17266.  
  17267.           See Also  To:Char.
  17268.  
  17269.           Notes     Converts a letter to its ASCII decimal value.  For
  17270.                     instance To:ASCII "A" returns 41.  Generally String
  17271.                     contains only one character, but can be a word or line
  17272.                     of text.
  17273.  
  17274.  
  17275.  
  17276.  
  17277.  
  17278.  
  17279.  
  17280.  
  17281.  
  17282.  
  17283.  
  17284.  
  17285.  
  17286.  
  17287.  
  17288.  
  17289.  
  17290.  
  17291.  
  17292.  
  17293.  
  17294.  
  17295.  
  17296.  
  17297.  
  17298.  
  17299.  
  17300.  
  17301.  
  17302.  
  17303.  
  17304.  
  17305.  
  17306.  
  17307.  
  17308.  
  17309.  
  17310.           The JORF Manual (Shareware Disk Version)                      286
  17311.  
  17312.  
  17313.  
  17314.  
  17315.  
  17316.  
  17317.                                        To:Caps
  17318.  
  17319.  
  17320.           Function  To:Caps ( String ) 
  17321.  
  17322.           Purpose   Capitalize a string.
  17323.  
  17324.           Returns   Returns the capitalized string.
  17325.  
  17326.           See Also  To:Ucs.
  17327.  
  17328.           Notes     Insures that any character following a space in String
  17329.                     is an upper case letter.  Does not affect words or
  17330.                     acronyms that are already in capital letters.  This is
  17331.                     used to change the appearance of strings for screen
  17332.                     display. 
  17333.  
  17334.  
  17335.  
  17336.  
  17337.  
  17338.  
  17339.  
  17340.  
  17341.  
  17342.  
  17343.  
  17344.  
  17345.  
  17346.  
  17347.  
  17348.  
  17349.  
  17350.  
  17351.  
  17352.  
  17353.  
  17354.  
  17355.  
  17356.  
  17357.  
  17358.  
  17359.  
  17360.  
  17361.  
  17362.  
  17363.  
  17364.  
  17365.  
  17366.  
  17367.  
  17368.  
  17369.           Chapter Five - JORF Functions                                 287
  17370.  
  17371.  
  17372.  
  17373.  
  17374.  
  17375.  
  17376.                                        To:Char
  17377.  
  17378.  
  17379.           Function  To:Char ( Value ) 
  17380.  
  17381.           Purpose   Returns a one character string with the letter
  17382.                     designated by the ASCII Value.
  17383.  
  17384.           Returns   Returns the one letter string.
  17385.  
  17386.           See Also  To:ASCII.
  17387.  
  17388.           Notes     For example, To:Char (41) returns "A".
  17389.  
  17390.  
  17391.  
  17392.  
  17393.  
  17394.  
  17395.  
  17396.  
  17397.  
  17398.  
  17399.  
  17400.  
  17401.  
  17402.  
  17403.  
  17404.  
  17405.  
  17406.  
  17407.  
  17408.  
  17409.  
  17410.  
  17411.  
  17412.  
  17413.  
  17414.  
  17415.  
  17416.  
  17417.  
  17418.  
  17419.  
  17420.  
  17421.  
  17422.  
  17423.  
  17424.  
  17425.  
  17426.  
  17427.  
  17428.           The JORF Manual (Shareware Disk Version)                      288
  17429.  
  17430.  
  17431.  
  17432.  
  17433.  
  17434.  
  17435.                                        To:Date
  17436.  
  17437.  
  17438.           Function  To:Date ( Date, Format )  
  17439.  
  17440.           Purpose   Converts a string to a date according to format.  
  17441.  
  17442.           Returns   A JORF pointer holding a date value.
  17443.  
  17444.           See Also  To:Time, Date:Str.
  17445.  
  17446.           Notes     Starting with version 2.1 of the JORF language, time
  17447.                     and date are atomic JORF data types.  This command
  17448.                     converts a string into the more compact internal date
  17449.                     format.  (The date is stored as the number of days
  17450.                     since the hypothetical 01/01/00).
  17451.  
  17452.                     The format is a string saying how to format the date. 
  17453.                     The following are special character within the format
  17454.                     string:
  17455.  
  17456.                                    Date Formatters
  17457.  
  17458.                     s    = String month Caps makes string upper case
  17459.                     w    = String weekday    Caps makes string upper case
  17460.                     n    = Numeric weekday   Caps is ignored
  17461.                     m    = Month             Caps is ignored
  17462.                     mm   = Month, zero in front   Caps is ignored
  17463.                     d    = Day                    Caps is ignored
  17464.                     dd   = Day, zero in front     Caps is ignored
  17465.                     y    = Year                   Caps is ignored
  17466.                     yy   = Two digit year         Caps is ignored
  17467.                     yyyy = Four digit year        Caps is ignored
  17468.  
  17469.                     If the format is omitted, the default format is used. 
  17470.                     The default format is "MM/DD/YY".  This format can be
  17471.                     changed using Date:SetFmt. 
  17472.  
  17473.  
  17474.  
  17475.  
  17476.  
  17477.  
  17478.  
  17479.  
  17480.  
  17481.  
  17482.  
  17483.  
  17484.  
  17485.  
  17486.  
  17487.           Chapter Five - JORF Functions                                 289
  17488.  
  17489.  
  17490.  
  17491.  
  17492.  
  17493.  
  17494.                                         To:Int
  17495.  
  17496.  
  17497.           Function  To:Int ( Num ) 
  17498.  
  17499.           Purpose   Returns the integer value of Num
  17500.  
  17501.           Returns   Integer.
  17502.  
  17503.           See Also  Num:Str.
  17504.  
  17505.           Notes     This function truncates decimals, returning the next
  17506.                     lower integer value for positive numbers, and the next
  17507.                     higher integer for negative numbers.  You can also
  17508.                     create integer strings (which are often automatically
  17509.                     converted to numbers) using the Num:Str function.   
  17510.  
  17511.  
  17512.  
  17513.  
  17514.  
  17515.  
  17516.  
  17517.  
  17518.  
  17519.  
  17520.  
  17521.  
  17522.  
  17523.  
  17524.  
  17525.  
  17526.  
  17527.  
  17528.  
  17529.  
  17530.  
  17531.  
  17532.  
  17533.  
  17534.  
  17535.  
  17536.  
  17537.  
  17538.  
  17539.  
  17540.  
  17541.  
  17542.  
  17543.  
  17544.  
  17545.  
  17546.           The JORF Manual (Shareware Disk Version)                      290
  17547.  
  17548.  
  17549.  
  17550.  
  17551.  
  17552.  
  17553.                                         To:Lcs
  17554.  
  17555.  
  17556.           Function  To:Lcs ( String ) 
  17557.  
  17558.           Purpose   Convert a string to lower case.
  17559.  
  17560.           Returns   The lower case string.
  17561.  
  17562.           See Also  To:Ucs.
  17563.  
  17564.           Notes     Converts all characters, including initials and
  17565.                     acronyms, to lower case.  
  17566.  
  17567.  
  17568.  
  17569.  
  17570.  
  17571.  
  17572.  
  17573.  
  17574.  
  17575.  
  17576.  
  17577.  
  17578.  
  17579.  
  17580.  
  17581.  
  17582.  
  17583.  
  17584.  
  17585.  
  17586.  
  17587.  
  17588.  
  17589.  
  17590.  
  17591.  
  17592.  
  17593.  
  17594.  
  17595.  
  17596.  
  17597.  
  17598.  
  17599.  
  17600.  
  17601.  
  17602.  
  17603.  
  17604.  
  17605.           Chapter Five - JORF Functions                                 291
  17606.  
  17607.  
  17608.  
  17609.  
  17610.  
  17611.  
  17612.                                         To:Num
  17613.  
  17614.  
  17615.           Function  To:Num ( String, Base ) 
  17616.  
  17617.           Purpose   Convert String to its numeric value.  Does not change
  17618.                     items that are already numbers.
  17619.  
  17620.           Returns   Returns the numeric value.
  17621.  
  17622.           See Also  Num:Str.
  17623.  
  17624.           Notes     This function is used to convert to strings and to
  17625.                     format them.
  17626.            
  17627.                     You can use another numbering Base for the conversion. 
  17628.                     If Base is omitted or does not have a numeric value,
  17629.                     then BASE 10 is used.   Use a Base of 16 for
  17630.                     Hexadecimal, 8 for Octal, or any number from 2 through
  17631.                     36 for other bases. 
  17632.  
  17633.                     Strings may be integers, decimals and floating point
  17634.                     numbers with "E" notation (ex. "3.24E-4").  This
  17635.                     command does not change values  that are already
  17636.                     numbers, and may be used as a precautionary measure
  17637.                     when the value might or might not have already been
  17638.                     converted.
  17639.  
  17640.           Example   The CALC.J program assembles numbers
  17641.                     as character strings so that when you
  17642.                     hit a new digit, that digit is
  17643.                     appended to the number.  When you hit
  17644.                     a calculation key, like the plus sign
  17645.                     (+) the string numbers must be
  17646.                     converted to numeric numbers before
  17647.                     adding.  
  17648.  
  17649.           Class:Calc      | Declare class Calc
  17650.             Entry         | Current entry value
  17651.             Op            | Last operation key
  17652.             Result        | Result of last calc
  17653.  
  17654.           Calc:start
  17655.             New(Calc:Calc)
  17656.             Calc->Entry  = "0"
  17657.             Calc->Result = "0"
  17658.             Mem:Ptr->Calc=Calc
  17659.             Event:Add(Null)
  17660.  
  17661.             Win:Add ("Calculator",0,0,8,17)
  17662.               Button:"&=",    Row:8, Col:14, Wid:3, Len:1 Action:"Calc:Do('=')"
  17663.  
  17664.           The JORF Manual (Shareware Disk Version)                      292
  17665.  
  17666.  
  17667.  
  17668.  
  17669.  
  17670.               Input:"Res"  Row:1, Col:2, Wid:11, Len:1
  17671.                 Field:"Mem:Ptr->Calc->Result" Before:"Null"
  17672.               Input:"Ent"  Row:2, Col:2, Wid:9, Len:1
  17673.                 Field:"Mem:Ptr->Calc->Entry" Before:"Null"
  17674.               Input:""        Row:2, Col:15, Wid:1, Len:1
  17675.                 Field:"Mem:Ptr->Calc->Op"    Before:"Null"
  17676.               HLine:"" Row:3
  17677.               Button:"&C",    Row:4, Col:2,  Wid:3, Len:1 Action:"Calc:Do('C')"
  17678.               Button:"c&E",   Row:4, Col:6,  Wid:3, Len:1 Action:"Calc:Do('E')"
  17679.               Button:"e&Xit", Row:4, Col:10, Wid:3, Len:1 Action:"Calc:Do('X')"
  17680.               Button:"&/",    Row:4, Col:14, Wid:3, Len:1 Action:"Calc:Do('/')"
  17681.  
  17682.               Button:"&7",    Row:5, Col:2,  Wid:3, Len:1 Action:"Calc:Do('7')"
  17683.               Button:"&8",    Row:5, Col:6,  Wid:3, Len:1 Action:"Calc:Do('8')"
  17684.               Button:"&9",    Row:5, Col:10, Wid:3, Len:1 Action:"Calc:Do('9')"
  17685.               Button:"&*",    Row:5, Col:14, Wid:3, Len:1 Action:"Calc:Do('*')"
  17686.  
  17687.               Button:"&4",    Row:6, Col:2,  Wid:3, Len:1 Action:"Calc:Do('4')"
  17688.               Button:"&5",    Row:6, Col:6 , Wid:3, Len:1 Action:"Calc:Do('5')"
  17689.               Button:"&6",    Row:6, Col:10, Wid:3, Len:1 Action:"Calc:Do('6')"
  17690.               Button:"&-",    Row:6, Col:14, Wid:3, Len:1 Action:"Calc:Do('-')"
  17691.  
  17692.               Button:"&1",    Row:7, Col:2,  Wid:3, Len:1 Action:"Calc:Do('1')"
  17693.               Button:"&2",    Row:7, Col:6 , Wid:3, Len:1 Action:"Calc:Do('2')"
  17694.               Button:"&3",    Row:7, Col:10, Wid:3, Len:1 Action:"Calc:Do('3')"
  17695.               Button:"&+",    Row:7, Col:14, Wid:3, Len:1 Action:"Calc:Do('+')"
  17696.  
  17697.               Button:"&0",    Row:8, Col:2,  Wid:3, Len:1 Action:"Calc:Do('0')"
  17698.               Button:"&.",    Row:8, Col:6,  Wid:3, Len:1 Action:"Calc:Do('.')"
  17699.               Button:"C&S",   Row:8, Col:10, Wid:3, Len:1 Action:"Calc:Do('S')"
  17700.             Return (Mem:Ptr->Calc->Result)
  17701.  
  17702.           Calc:Do(KeyLetter)
  17703.             New (Calc)
  17704.             Calc=Mem:Ptr->Calc
  17705.  
  17706.             Switch KeyLetter
  17707.               Case "X"
  17708.                 Jorf:Exit()
  17709.               Case "C"
  17710.                 Calc->Result="0"
  17711.                 Calc->Entry ="0"
  17712.                 Calc->Op    =Null
  17713.               Case "E"
  17714.                 Calc->Entry ="0"
  17715.               Case "S"
  17716.                 If (Calc->Entry!="0")
  17717.                   Calc->Entry = 0-Calc->Entry
  17718.                 Else
  17719.                   If (Calc->Result!="0")
  17720.                     Calc->Result = 0-Calc->Result
  17721.               Case "-"
  17722.  
  17723.           Chapter Five - JORF Functions                                 293
  17724.  
  17725.  
  17726.  
  17727.  
  17728.  
  17729.               Case "+"
  17730.               Case "/"
  17731.               Case "*"
  17732.               Case "="
  17733.                 If (Calc->Entry!="0")
  17734.                   Switch (Calc->Op)
  17735.                     Case "-"
  17736.                       Calc->Result = To:Num(Calc->Result) - To:Num(Calc->Entry)
  17737.                     Case "+"
  17738.                       Calc->Result = To:Num(Calc->Result) + To:Num(Calc->Entry)
  17739.                     Case "*"
  17740.                       Calc->Result = To:Num(Calc->Result) * To:Num(Calc->Entry)
  17741.                     Case "/"
  17742.                       Calc->Result = To:Num(Calc->Result) / To:Num(Calc->Entry)
  17743.                     Else
  17744.                       Calc->Result = Calc->Entry
  17745.                 Calc->Entry  = "0"
  17746.                 Calc->Op     = KeyLetter
  17747.               Else
  17748.                 If Str:In("1234567890.",KeyLetter)
  17749.                   If (Calc->Op == "=" Or Calc->Entry=="0")
  17750.                     Calc->Entry = KeyLetter
  17751.                     If (Calc->Op=="=")
  17752.                       Calc->Op    = Null
  17753.                   Else
  17754.                     Calc->Entry = Calc->Entry + KeyLetter
  17755.             Kbd:Put("Home_Key")
  17756.             Win:Dsp
  17757.             Return Ok
  17758.  
  17759.  
  17760.  
  17761.  
  17762.  
  17763.  
  17764.  
  17765.  
  17766.  
  17767.  
  17768.  
  17769.  
  17770.  
  17771.  
  17772.  
  17773.  
  17774.  
  17775.  
  17776.  
  17777.  
  17778.  
  17779.  
  17780.  
  17781.  
  17782.           The JORF Manual (Shareware Disk Version)                      294
  17783.  
  17784.  
  17785.  
  17786.  
  17787.  
  17788.  
  17789.           Special
  17790.           Note      Some countries use the comma for a decimal point, and
  17791.                     the period for the thousands indicator.  You can make
  17792.                     this the default by setting Decimal=, in the JORF.INI
  17793.                     file (See appendix D).  After setting this value,
  17794.                     numbers stored as strings will be converted according
  17795.                     to comma-decimal format.   Sometimes, numbers stored as
  17796.                     strings are in period-decimal format and need a special
  17797.                     conversion.  
  17798.  
  17799.                     Number              As Period decimal        As Comma decimal
  17800.                     "1,233.2"      1233.2              1.233
  17801.                     "1.233,2"      1.233               1233.2
  17802.  
  17803.  
  17804.                     To handle a value that was stored as a string in period
  17805.                     decimal format, use To:Num(Value,".").  Using a period
  17806.                     or comma as the Base causes a base 10 conversion with
  17807.                     an override on the user's setting for the decimal
  17808.                     format.  This feature can also be used when reading
  17809.                     decimal values from an ascii file that must be
  17810.                     converted to numbers without regard to the user's
  17811.                     Decimal= setting.
  17812.  
  17813.                     When a user runs a program with "Decimal=,", only the
  17814.                     user's input and output takes on the new format.  All
  17815.                     calculations and number formats in the JORF program
  17816.                     code must be in period-decimal format.  That way, the
  17817.                     code is international, only what the user see's changes
  17818.                     according to the INI file setting.
  17819.  
  17820.  
  17821.  
  17822.  
  17823.  
  17824.  
  17825.  
  17826.  
  17827.  
  17828.  
  17829.  
  17830.  
  17831.  
  17832.  
  17833.  
  17834.  
  17835.  
  17836.  
  17837.  
  17838.  
  17839.  
  17840.  
  17841.           Chapter Five - JORF Functions                                 295
  17842.  
  17843.  
  17844.  
  17845.  
  17846.  
  17847.  
  17848.                                        To:Time
  17849.  
  17850.  
  17851.           Function  To:Time ( Time, Format )  
  17852.  
  17853.           Purpose   Converts a string to a time according to format.  
  17854.  
  17855.           Returns   A JORF pointer holding a time value.
  17856.  
  17857.           See Also  To:Date, Time:Str.
  17858.  
  17859.           Notes     Starting with version 2.1 of the JORF language, time
  17860.                     and date are atomic JORF data types.  This command
  17861.                     converts a string into the more compact internal time
  17862.                     format.  (The time is stored as the number of seconds
  17863.                     since midnight).
  17864.  
  17865.                     The format is a string saying how to format the date. 
  17866.                     The following are special character within the format
  17867.                     string:
  17868.  
  17869.                                    Time Formatters
  17870.  
  17871.                     h  = Hours                    Caps is military time
  17872.                     _h = Hours, space in front    Caps is military time
  17873.                     hh = Hours, zero in front     Caps is military time
  17874.                     m  = Minutes                  Caps is ignored
  17875.                     _m = Minutes, space in front  Caps is ignored
  17876.                     mm = Minutes, zero in front   Caps is ignored
  17877.                     s  = Seconds                  Caps is ignored
  17878.                     _s = Seconds, space in front  Caps is ignored
  17879.                     ss = seconds, zero in front   Caps is ignored
  17880.                     a  = am or pm                 Caps means AM or PM
  17881.  
  17882.                     Time in "Military Time" is based on a 24 hour clock
  17883.                     from 00:00 to 23:59.  When not in military time, the
  17884.                     hour after midnight is 12:00 AM to 12:50 AM, and noon
  17885.                     is 12:00 PM.
  17886.  
  17887.                     If the format is omitted, the default format is used. 
  17888.                     The default format is "HH:MM".  This format can be
  17889.                     changed using Time:SetFmt. 
  17890.  
  17891.  
  17892.  
  17893.  
  17894.  
  17895.  
  17896.  
  17897.  
  17898.  
  17899.  
  17900.           The JORF Manual (Shareware Disk Version)                      296
  17901.  
  17902.  
  17903.  
  17904.  
  17905.  
  17906.  
  17907.                                         To:Ucs
  17908.  
  17909.  
  17910.           Function  To:Ucs ( String ) 
  17911.  
  17912.           Purpose   Convert a string to UPPER CASE.
  17913.  
  17914.           Returns   The UPPER CASE string.
  17915.  
  17916.           See Also  To:Caps, To:Lcs.
  17917.  
  17918.           Notes     Converts all characters, including initials and
  17919.                     acronyms, to UPPER CASE. Returns the resulting string.
  17920.  
  17921.  
  17922.  
  17923.  
  17924.  
  17925.  
  17926.  
  17927.  
  17928.  
  17929.  
  17930.  
  17931.  
  17932.  
  17933.  
  17934.  
  17935.  
  17936.  
  17937.  
  17938.  
  17939.  
  17940.  
  17941.  
  17942.  
  17943.  
  17944.  
  17945.  
  17946.  
  17947.  
  17948.  
  17949.  
  17950.  
  17951.  
  17952.  
  17953.  
  17954.  
  17955.  
  17956.  
  17957.  
  17958.  
  17959.           Chapter Five - JORF Functions                                 297
  17960.  
  17961.  
  17962.  
  17963.  
  17964.  
  17965.  
  17966.                                          True
  17967.  
  17968.  
  17969.           Function  True
  17970.  
  17971.           Purpose   Returns a value to indicate Logical True.
  17972.  
  17973.           Returns   A JORF Pointer to the integer 1.
  17974.  
  17975.           See Also  False.
  17976.  
  17977.           Notes     Most programming language express results of logical
  17978.                     equations as zero to indicate False, and one to
  17979.                     indicate True.  These values are called Boolean values. 
  17980.  
  17981.  
  17982.                     This function was created in the interest of program
  17983.                     clarity.  It simply returns the integer value one.
  17984.  
  17985.  
  17986.  
  17987.  
  17988.  
  17989.  
  17990.  
  17991.  
  17992.  
  17993.  
  17994.  
  17995.  
  17996.  
  17997.  
  17998.  
  17999.  
  18000.  
  18001.  
  18002.  
  18003.  
  18004.  
  18005.  
  18006.  
  18007.  
  18008.  
  18009.  
  18010.  
  18011.  
  18012.  
  18013.  
  18014.  
  18015.  
  18016.  
  18017.  
  18018.           The JORF Manual (Shareware Disk Version)                      298
  18019.  
  18020.  
  18021.  
  18022.  
  18023.  
  18024.  
  18025.                                  While/Break/Continue
  18026.  
  18027.  
  18028.           Function  While/Break/Continue
  18029.  
  18030.           Purpose   A Loop
  18031.  
  18032.           Returns   None.
  18033.  
  18034.           Notes     A loop.  Tests the value of a parameter and executes
  18035.                     indented code sections based on that value. 
  18036.  
  18037.                          While  ( TestValue ) 
  18038.                            Does indented section until false
  18039.                            Break 
  18040.                            Continue
  18041.  
  18042.                     Tests a value and does commands in indented sections
  18043.                     until that value is zero or false.  The value is often
  18044.                     a logical expression in parenthesis.
  18045.  
  18046.                     While(Ok) is commonly used to indicate a loop that will
  18047.                     be ended using the Break command.
  18048.  
  18049.                     Break ends the execution of a While.  Program flow will
  18050.                     resume on the line following the loop.
  18051.  
  18052.                     Continue ends execution of the current loop, returns
  18053.                     control to the While command to test and executed the
  18054.                     loop again if the condition remains valid.  This
  18055.                     command is used to simplify code within complex while
  18056.                     loops.  
  18057.  
  18058.  
  18059.  
  18060.  
  18061.  
  18062.  
  18063.  
  18064.  
  18065.  
  18066.  
  18067.  
  18068.  
  18069.  
  18070.  
  18071.  
  18072.  
  18073.  
  18074.  
  18075.  
  18076.  
  18077.           Chapter Five - JORF Functions                                 299
  18078.  
  18079.  
  18080.  
  18081.  
  18082.  
  18083.  
  18084.           Examples  The While statement creates a loop based on a
  18085.                     condition.  This loop is repeated as long as the
  18086.                     condition is TRUE.  A Break can be used to break out of
  18087.                     the loop even if the condition is still True.  A
  18088.                     Continue is used to shortcut the loop, restarting the
  18089.                     next iteration immediately.
  18090.  
  18091.                        Counter=0                       | Initialize Counter
  18092.                        While (++Counter <= 5)          | Increment Counter
  18093.                          Rule:Find (Rule)              | Find a next rule
  18094.                          If (Rule->Fnd=Null)           | If not found
  18095.                            Break                       |   break out of loop
  18096.                          If (Rule->Ptr=Null)           | If condition Null
  18097.                            Continue                    | Skip rest of loop
  18098.                          P=P+"-"+Rule->Pointer         | Add Pointer
  18099.                        Str:PutLine (P)                 | Show result 
  18100.  
  18101.  
  18102.  
  18103.  
  18104.  
  18105.  
  18106.  
  18107.  
  18108.  
  18109.  
  18110.  
  18111.  
  18112.  
  18113.  
  18114.  
  18115.  
  18116.  
  18117.  
  18118.  
  18119.  
  18120.  
  18121.  
  18122.  
  18123.  
  18124.  
  18125.  
  18126.  
  18127.  
  18128.  
  18129.  
  18130.  
  18131.  
  18132.  
  18133.  
  18134.  
  18135.  
  18136.           The JORF Manual (Shareware Disk Version)                      300
  18137.  
  18138.  
  18139.  
  18140.  
  18141.  
  18142.  
  18143.                                        Win:Add
  18144.  
  18145.  
  18146.           Function  Win:Add ( Title, Row, Col, Len, Wid, Level, Text ) 
  18147.                     Win:Add ( Title, Text ) 
  18148.                     Win:Add ( WindowStructure, Row, Col, Len, Wid, Level,
  18149.                     Text ) 
  18150.                     Win:Add ( WindowStructure, Text ) 
  18151.  
  18152.           Purpose   Display a new Window on the screen.
  18153.  
  18154.           Returns   None.
  18155.  
  18156.           See Also  Chapter Four, Msg:Add, Move:To, Str:Put.
  18157.  
  18158.           Notes     Without doubt, the most complicated library function.
  18159.                     WindowStructure can contain the following elements: 
  18160.  
  18161.                     Row            Top Row of Window
  18162.                     Col            Left Column of Window
  18163.                     Len            Number of rows inside window
  18164.                     Wid            Number of columns in window
  18165.                     CurRow         Cursor Row in Window
  18166.                     CurCol         Cursor Column in Window
  18167.                     MouseRow       Mouse Cursor Row in Window
  18168.                     MouseCol       Mouse Cursor Column in Window
  18169.                     RowOff         Rows that display is offset
  18170.                     ColOff         Columns that display is offset
  18171.                     InpRow         Row of Input Field
  18172.                     InpCol         Column of Input Field
  18173.                     InpLen         Length of Input Field
  18174.                     InpWid         Width of Input Field
  18175.                     Text           Text displayed in Window
  18176.                     Type           Window color or type
  18177.                     Level          Value of Here in  method that is
  18178.                                    creating the window
  18179.                     Magic          TRUE if Window interprets Magic Spots
  18180.                     Attr           Attribute 1 for low through 5 for high
  18181.                                    or color attribute
  18182.                     FLRCO          Current FLRCO value
  18183.                     Before         Method to do before window  is displayed
  18184.                     After          Method to do when window is done
  18185.                     InpBefore      Method to do before an input field is
  18186.                                    entered
  18187.                     InpAfter       Method to do after field entry is
  18188.                                    complete
  18189.  
  18190.                     A window is a box on the screen where all output and
  18191.                     input takes place.  In DOS, the sides of the box are
  18192.                     one character width wide and one character width tall. 
  18193.                     A shadow on the right side takes two character columns
  18194.  
  18195.           Chapter Five - JORF Functions                                 301
  18196.  
  18197.  
  18198.  
  18199.  
  18200.  
  18201.                     and on the bottom takes an additional character row. 
  18202.                     Under Microsoft windows, an overlapped window with wide
  18203.                     borders is displayed using your default color scheme. 
  18204.  
  18205.                     An optional title may be displayed centered in the top
  18206.                     line, and a message may be displayed in the bottom line
  18207.                     left side. 
  18208.  
  18209.                     DOS Windows use direct video access unless you specify
  18210.                     otherwise in the JORF.INI file.  DOS windows have an
  18211.                     exploding speed, which changes how the windows are
  18212.                     displayed. 
  18213.  
  18214.                     All console input and output takes place on the top
  18215.                     window displayed on the screen.  There is no facility
  18216.                     to update a window that is not the top window on the
  18217.                     screen, even under MS-Windows.  
  18218.  
  18219.                     If Title is specified, it will be displayed centered on
  18220.                     the top of the window.  If the width of the title
  18221.                     exceeds the window width specification then the window
  18222.                     width will be increased to accommodate the title. 
  18223.                     Magic spots in the title will be interpreted.
  18224.  
  18225.                     If Text is specified, the window is created exactly the
  18226.                     size of the text to be displayed.  If the text is
  18227.                     greater than the screen length or width, the window
  18228.                     will expand to the boundaries of the screen.  Commonly
  18229.                     the text attribute is passed as an indented section of
  18230.                     the program.  Any indented section is passed by the
  18231.                     interpreter as the last parameter to the command
  18232.                     preceding the indented section.  Text is required if
  18233.                     this window is to be edited using Line:Inp.
  18234.  
  18235.                     If Row and Col are specified, the position of the
  18236.                     window will be moved to the position indicated.  If
  18237.                     they are negative, then the window will be placed
  18238.                     relative to the bottom right corner of the screen.   If
  18239.                     the window dimensions do not entirely fit on the
  18240.                     screen, because Text is too large or Length too long or
  18241.                     Width too wide the Row and Col values will be changed
  18242.                     so that the window will entirely fit on the screen.
  18243.  
  18244.                     The Len (Length) and Wid (Width) parameters can be used
  18245.                     to set the exact size of the window.  These parameters
  18246.                     will override the size of Text.
  18247.  
  18248.                     The Level parameter must specify the value of here in
  18249.                     the method that creates the window.  When that method
  18250.                     is completed, the window will automatically be erased.
  18251.  
  18252.  
  18253.  
  18254.           The JORF Manual (Shareware Disk Version)                      302
  18255.  
  18256.  
  18257.  
  18258.  
  18259.  
  18260.                           Setting Window Structure Elements
  18261.  
  18262.                     When a window is created, a window structure is
  18263.                     allocated that can be referenced using Win:Ptr.  This
  18264.                     structure may contain any or all of the elements
  18265.                     referenced above.  Some of these elements, like InpRow
  18266.                     and InpCol are set by the interpreter to current
  18267.                     values. You may set others to influence the way the
  18268.                     window operates.
  18269.  
  18270.                     Structure elements may be set in two ways.  First, they
  18271.                     may be set prior to calling Win:Add by creating a
  18272.                     window structure and setting the elements normally. 
  18273.                     The second way is to set the element values directly in
  18274.                     the input definition area of the text of the window. 
  18275.                     This syntax is the same as setting up buttons and other
  18276.                     text on the window.  
  18277.  
  18278.                     CurRow and CurCol are set by the interpreter to the
  18279.                     current row and column positions of the cursor during
  18280.                     data entry.
  18281.  
  18282.                     MouseRow and MouseCol are set to the position of the
  18283.                     mouse at the time of the last button press or release.
  18284.  
  18285.                     RowOff and ColOff are set to the row and column offset
  18286.                     if the input in  the window is shifted to the left or
  18287.                     bottom.  These values are only set during input, and
  18288.                     only if the current field is shifted because the cursor
  18289.                     is too far to the left or down.
  18290.  
  18291.                     InpRow, InpCol, InpLen, and InpWid are set to the
  18292.                     appropriate values for the current data entry field.
  18293.  
  18294.                     Text is used to specify the text in the window, or to
  18295.                     define data entry fields using a text definition.  The
  18296.                     interpreter does not change this value.
  18297.  
  18298.                     Type actually changes the color mode for the window. 
  18299.                     You can set up new color sequences in the JORF.INI
  18300.                     file, and then specify them here.  That way, each type
  18301.                     of window in your application has its own colors.  
  18302.  
  18303.                     Setting Magic to False will keep the window from trying
  18304.                     to interpret magic spots (fields surrounded by {curly
  18305.                     brackets}).  Normally Magic is TRUE, and any bracket
  18306.                     expression is interpreted.
  18307.  
  18308.                     Setting Attr changes the starting attribute for text
  18309.                     display in the window.
  18310.  
  18311.  
  18312.  
  18313.           Chapter Five - JORF Functions                                 303
  18314.  
  18315.  
  18316.  
  18317.  
  18318.  
  18319.                     Setting FLRCO changes the current wrap mode.  The
  18320.                     default mode is "L" for left justified text.  
  18321.  
  18322.                     Setting Before specifies a method to be executed before
  18323.                     any data entry takes place on the window.  It can be
  18324.                     used to display additional information for the
  18325.                     operator, or to test input or display parameters.  If
  18326.                     the Before method returns FALSE, the window entry is
  18327.                     ignored.
  18328.  
  18329.                     Setting Display is similar to setting Before. The
  18330.                     difference is that the Before method executes before
  18331.                     any part of the window is displayed, but the Display
  18332.                     routine executes after the window box is showing.  The
  18333.                     Display routine can then add visual elements to the
  18334.                     window that are not included in buttons and fields that
  18335.                     make up the rest of the window definition.
  18336.  
  18337.                     Setting After specifies a method to be executed when
  18338.                     the operator attempts to exit the window using the
  18339.                     Escape key or the window close button.  On text entry
  18340.                     windows, it is common to specify a method to ask
  18341.                     whether to save the changed document before exiting the
  18342.                     window.  If the After method returns False, then the
  18343.                     window remains displayed as if the operator did not
  18344.                     request an exit.
  18345.  
  18346.                     InpBefore and InpAfter may be used to specify methods
  18347.                     that must be run before and after every input field
  18348.                     (including buttons and check boxes) in the window. 
  18349.                     These methods are commonly used to lock the record, as
  18350.                     well as qualify the operator rights to change the
  18351.                     field.  If the Before method returns False, the
  18352.                     operator will not be able to change the field.  If the
  18353.                     After method returns False, the operator will not be
  18354.                     able to move to another field (presumably until the
  18355.                     operator corrects the field value.)  
  18356.  
  18357.           Example   This first example is just a little program to show row
  18358.                     and column placement.
  18359.  
  18360.           Windows:Start
  18361.             Win:Add ("Big", 2, 2, -2, -2)
  18362.             Win:Add ("Top Right", 3, 3, 3, 15)
  18363.             Win:Add ("Bottom Right",-3, 3, 3, 15)
  18364.             Win:Add ("Bottom Left", -3, -3, 3, 15)
  18365.             Win:Add ("Top Left", 3, -3, 3, 15)
  18366.             Win:Add ("Tall", 3, 45, -4, 10)
  18367.             Win:Add ("Wide", 10, 3, 3, -4)
  18368.             Win:Pause
  18369.             Return Ok
  18370.  
  18371.  
  18372.           The JORF Manual (Shareware Disk Version)                      304
  18373.  
  18374.  
  18375.  
  18376.  
  18377.  
  18378.                     This next function CENTERED.J uses a couple commands to
  18379.                     set the window type and FLRCO mode.
  18380.  
  18381.           Centered:Start
  18382.             Win:Add (Null,0,0,7,30)
  18383.               Type:"Message"
  18384.               FLRCO:"Center"
  18385.               Button:"Ok" Row:5 Col:10 Wid:12
  18386.               This text uses a FLRCO
  18387.               command to center the
  18388.               text, and a TYPE command
  18389.               to set the window type.
  18390.             Return(Ok)
  18391.  
  18392.                     The main window in TUTORIAL.J contains menu items and
  18393.                     text.  The prompts and buttons are defined in the text
  18394.                     section.  (Sorry about the microscopic text, had
  18395.                     trouble fitting these.)
  18396.  
  18397.           Tutorial:Start
  18398.             Event:Add("Tutorial")
  18399.             Jorf:File("TutText.J")
  18400.  
  18401.             Win:Add ("Josephine's Recipe Filer Tutorial", 0, 0, 23, 78, Here.)
  18402.               Menu:"&File"
  18403.                 Menu:"E&xit         Alt-X" Action:"Jorf:Exit"
  18404.               This tutorial is {prompt:"&Hypertext", Action:"Tutorial:Box('Intro:Hyper')"}. &
  18405.               Press {Bold:"Lo"}Enter{Bold:"No"} to see the highlighted subjects. &
  18406.               Use your arrow keys to highlight different subjects.  You can &
  18407.               zoom to highlighted letters by holding the Alt key down &
  18408.               while pressing that letter.
  18409.  
  18410.               {Prompt:"&Josephine", Action:"Tutorial:Box('Intro:Jo')"}'s Recipe Filer, &
  18411.               JORF(tm), is a new computer &
  18412.               language.  JORF was created by a &
  18413.               {Prompt:"&Grunt-Programmer" Action:"Tutorial:Box('Intro:Grunt')"} &
  18414.               frustrated by low level math based computer languages &
  18415.               that are inapproprate for business data processing.  With the JORF &
  18416.               language you can easily create data entry screens,  &
  18417.               and write sophisticated routines using an Object Oriented &
  18418.               data base manager.
  18419.  
  18420.               Press "Enter" now, to read more about the Hypertext system. &
  18421.               Then, highlight the various topics and explore &
  18422.               this Tutorial.   Thank you for your support.
  18423.  
  18424.               {Group:"Hypertext Topics" Row:13 Col:4 Len:5 Wid:70}
  18425.               {Prompt:" &About the JORF Language   " Row:14 Col:08 Wid:30
  18426.           Action:"Tutorial:Box('Tut:About')"}
  18427.               {Prompt:" JORF &Programming Basics   " Row:15 Col:08 Wid:30
  18428.           Action:"Tutorial:Box('Tut:Basic')"}
  18429.  
  18430.  
  18431.           Chapter Five - JORF Functions                                 305
  18432.  
  18433.  
  18434.  
  18435.  
  18436.  
  18437.               {Prompt:" JORF Ad&vanced Programming " Row:16 Col:08 Wid:30
  18438.           Action:"Tutorial:Box('Tut:AdvStart')"}
  18439.               {Prompt:" &OOP Programming Concepts  " Row:17 Col:08 Wid:30
  18440.           Action:"Tutorial:Box('Tut:Oop')"}
  18441.               {Prompt:" JORF &Window Manager       " Row:18 Col:08 Wid:30
  18442.           Action:"Tutorial:Box('Tut:DataEntry')"}
  18443.               {Prompt:" G&etting Started with JORF " Row:14 Col:42 Wid:30
  18444.           Action:"Tutorial:Box('Write:Start')"}
  18445.               {Prompt:" &Quick Demonstration       " Row:15 Col:42 Wid:30
  18446.           Action:"Tutorial:Box('Quick:Start')"}
  18447.               {Prompt:" &Registering JORF          " Row:16 Col:42 Wid:30
  18448.           Action:"Tutorial:Regist"}
  18449.               {Prompt:" JORF Company Produc&ts     " Row:17 Col:42 Wid:30
  18450.           Action:"Tutorial:Box('Tut:Prod')"}
  18451.               {Prompt:" &Contacting JORF Company   " Row:18 Col:42 Wid:30
  18452.           Action:"Tutorial:Box('Tut:JorfCo')"}
  18453.  
  18454.               {Button:"Run &Sample Prog" Row:20 Col:2  Wid:22 Action:"Tutorial:Samples"}
  18455.               {Button:"See &Debugger"    Row:20 Col:28 Wid:22
  18456.           Action:"Kbd:Put('Ctrl_Break_Key')"}
  18457.               {Button:"E&xit"            Row:20 Col:56 Wid:22 Action:"Jorf:Exit"}
  18458.             Return (Ok)
  18459.  
  18460.                     The last example is the screen from the MAILLIST.J
  18461.                     sample program, that defines a complex window using
  18462.                     fields, buttons and boxes.
  18463.  
  18464.           MailList:Start                     | Little Mail List Program
  18465.             New (Contact:Con)                | Create Contact Structure
  18466.             Jorf:File ("CONTACT.JCM",Here)   | Set Database File to CONTACT.JCM
  18467.             Event:Add ("MailKey","Key",Here) | Set MailKey as a keystroke handler
  18468.             Mem:Ptr->IndexName = "FullName"  | Index Name
  18469.  
  18470.             | The main screen with menu options
  18471.             Win:Add ("Josephine's Mail List Manager", 2, 2, 22, 78, Here)
  18472.               Menu:"&File"
  18473.                 Menu:"&About            "  Action:"MailList:About"
  18474.                 Menu:
  18475.                 Menu:"&Rebuild        ",   Action:"Jorf:Rebuild"
  18476.                 Menu:
  18477.                 Menu:"E&xit        Alt-X", Action:"MailKey:Esc_Key"
  18478.  
  18479.               Menu:"&Edit"
  18480.                 Menu:"&Add     Alt-A", Action:"MailList:Add(Con)"    HotKey:"Alt_A_Key"
  18481.                 Menu:"&Change  Alt-C", Action:"MailList:Change(Con)"
  18482.                 Menu:"&Delete  Alt-D", Action:"MailList:Delete(Con)" HotKey:"Alt_D_Key"
  18483.  
  18484.               Menu:"&Search",
  18485.                 Menu:"&Name       ",  Action:"MailList:KeySearch (Con, 'FullName' )
  18486.                 Menu:"&Company    ",  Action:"MailList:KeySearch (Con, 'Company'  )
  18487.                 Menu:"&Last Name  ",  Action:"MailList:KeySearch (Con, 'LastName' )
  18488.                 Menu:"&Phone      ",  Action:"MailList:KeySearch (Con, 'WorkPhone')
  18489.  
  18490.           The JORF Manual (Shareware Disk Version)                      306
  18491.  
  18492.  
  18493.  
  18494.  
  18495.  
  18496.                 Menu:"&Zip        ",  Action:"MailList:KeySearch (Con, 'ZipCode'  )
  18497.  
  18498.               Menu:"&Reports"
  18499.                 Menu:"&Mail List    ", Action:"MailList:List()"
  18500.                 Menu:"&This Contact ", Action:"MailList:PrintData(Con)"
  18501.                 Menu:"&Lotsa Labels ", Action:"MailList:ContinLabels(Con,'All')"
  18502.                 Menu:"&One Label",     Action:"MailList:ContinLabels(Con,'One')"
  18503.  
  18504.               InpBefore:"MailList:Lock(Con)"
  18505.               Group:"&Browse List", Row:1 Col:41, Len:6, Wid:36
  18506.               List:""
  18507.                 Field:"Con"
  18508.                 Next:"MailList:NextRecord(Con,'Next')"
  18509.                 Prev:"MailList:NextRecord(Con,'Prev')"
  18510.                 Show:"MailList:Show(Con)"
  18511.                 Before:"MailList:Write()"
  18512.                 Display:"(Mem:Ptr->Locked==Null)"
  18513.  
  18514.               Group:"&Contact Name and Address", Row:1, Col:1, Wid:38, Len:6
  18515.               Input:"Name   ",    Wid:30, Field:"Con->FullName"
  18516.                 After:"MailList:SplitName(Con)"
  18517.               Input:"Company", Wid:30,    Field:"Con->Company"
  18518.               Input:"Address", Wid:30,    Field:"Con->Addr1"
  18519.               Input:"       ", Wid:30,    Field:"Con->Addr2"
  18520.               Input:"       ", Wid:30,    Field:"Con->Addr3"
  18521.                 After:"MailList:ZipCode(Con)"
  18522.  
  18523.               Group:"Mail List Fields"
  18524.                 Row:9  Col:1  Len:11  Wid:76
  18525.               Input:"&Work Phone" Field:"Con->WorkPhone"
  18526.                 Row:10  Col:2  Wid:20
  18527.               Input:"&Home Phone"  Field:"Con->Homephone"
  18528.                 Row:11  Col:2  Wid:20
  18529.               Input:"Fax &Phone " Field:"Con->FaxPhone"
  18530.                 Row:12  Col:2  Wid:20
  18531.               Input:"Birthda&y  " Field:"Con->BirthDay"
  18532.                 Row:13  Col:2  Wid:20
  18533.               Input:"C&omment   "  Field:"Con->Comment"
  18534.                 Row:15  Col:2  Wid:50
  18535.               Input:"&Last Name " Field:"Con->LastName"
  18536.                 Row:10  Col:35  Wid:14
  18537.               Input:"Dear      " Field:"Con->Dear"
  18538.                 Row:11  Col:35  Wid:14
  18539.               Input:"Zip Code  " Field:"Con->Zipcode"
  18540.                 Row:12  Col:35  Wid:14
  18541.               Radio:"Fr&iend"
  18542.                 Check:"Con->Type=='Friend'"
  18543.                 Action:"Con->Type='Friend'"
  18544.                 UnAction:"Con->Type= Null"
  18545.                 Row:10  Col:62
  18546.               Radio:"Fa&mily"
  18547.                 Check:"Con->Type=='Family'"
  18548.  
  18549.           Chapter Five - JORF Functions                                 307
  18550.  
  18551.  
  18552.  
  18553.  
  18554.  
  18555.                 Action:"Con->Type='Family'"
  18556.                 UnAction:"Con->Type= Null"
  18557.                 Row:11  Col:62
  18558.               Radio:"Clien&t"
  18559.                 Check:"Con->Type=='Client'"
  18560.                 Action:"Con->Type='Client'"
  18561.                 UnAction:"Con->Type= Null"
  18562.                 Row:12  Col:62
  18563.               Radio:"&Vendor"
  18564.                 Check:"Con->Type=='Vendor'"
  18565.                 Action:"Con->Type='Vendor'"
  18566.                 UnAction:"Con->Type= Null"
  18567.                 Row:13  Col:62
  18568.               HLine:"&Notes"
  18569.                 Row:16  Col:2  Len:1  Wid:76
  18570.               Text:"" Field:"Con->Notes"
  18571.                 Row:17  Col:2  Len:4  Wid:76
  18572.             Return (Ok)                         | That is all, Folks!
  18573.  
  18574.  
  18575.  
  18576.  
  18577.  
  18578.  
  18579.  
  18580.  
  18581.  
  18582.  
  18583.  
  18584.  
  18585.  
  18586.  
  18587.  
  18588.  
  18589.  
  18590.  
  18591.  
  18592.  
  18593.  
  18594.  
  18595.  
  18596.  
  18597.  
  18598.  
  18599.  
  18600.  
  18601.  
  18602.  
  18603.  
  18604.  
  18605.  
  18606.  
  18607.  
  18608.           The JORF Manual (Shareware Disk Version)                      308
  18609.  
  18610.  
  18611.  
  18612.  
  18613.  
  18614.  
  18615.                                        Win:Attr
  18616.  
  18617.  
  18618.           Function  Win:Attr ( Attribute ) 
  18619.  
  18620.           Purpose   Sets attribute for text in a window.
  18621.  
  18622.           Returns   None.
  18623.  
  18624.           Notes     Whenever anyone in the IBM PC world says Attribute, you
  18625.                     know they are talking about colors on the monitor. 
  18626.                     This command sets the colors for text to be displayed.
  18627.  
  18628.                     The attribute may be "Hi" for highlighted text, "Low"
  18629.                     for low highlight.  You can also set one of five values
  18630.                     for attribute, 1 corresponds to normal, through 5 for
  18631.                     high. 
  18632.  
  18633.                     Number         INI  Name What it is used for
  18634.  
  18635.                     1    Normal    Normal text and field display
  18636.                     2    Low       Highlighted letters in field/menu display
  18637.                     3    Medium    Box and Graphic lines
  18638.                     4    High      Fields not selected, selected menu item
  18639.                     5    Bold      Selected fields, Selected Menu item letter
  18640.  
  18641.  
  18642.                     Version 2.1 introduces the ability to set any color
  18643.                     using attribute numbers.  Colors on a PC are expressed
  18644.                     using a background and foreground color.  The
  18645.                     background is the base screen color, and the foreground
  18646.                     will be the color of the letters on the background. 
  18647.                     When expressed in this way, you can use the IBM
  18648.                     attribute numbers or you can use JORF names for those
  18649.                     colors.
  18650.  
  18651.  
  18652.  
  18653.  
  18654.  
  18655.  
  18656.  
  18657.  
  18658.  
  18659.  
  18660.  
  18661.  
  18662.  
  18663.  
  18664.  
  18665.  
  18666.  
  18667.           Chapter Five - JORF Functions                                 309
  18668.  
  18669.  
  18670.  
  18671.  
  18672.  
  18673.  
  18674.                          JORF Color Name          Number
  18675.                          Black          0
  18676.                          Blue           1
  18677.                          Green          2
  18678.                          Cyan           3
  18679.                          Red            4
  18680.                          Magenta        5
  18681.                          Brown          6
  18682.                          White          7    (Actually light gray)
  18683.                          Gray           8    (Actually dark gray)
  18684.                          Light Blue     9
  18685.                          Light Green    10
  18686.                          Light Cyan     11
  18687.                          Light Red      12
  18688.                          Light Magenta  13
  18689.                          Yellow         14
  18690.                          Bright White   15   (Actually white)
  18691.  
  18692.                     When setting attributes, the colors are expressed as a
  18693.                     pair separated by a slash.  The first color represents
  18694.                     the foreground, and the second is the background
  18695.                     colors.  The following two commands are equivalent and
  18696.                     will change the color to use white text on a blue
  18697.                     background:
  18698.  
  18699.                          Win:Attr("Bright White/Blue")
  18700.                          Win:Attr("15/1")
  18701.  
  18702.  
  18703.                     You can set attribute without using this command by
  18704.                     setting Win:Ptr->Attr = Attribute.  
  18705.  
  18706.                          Win:Ptr->Attr="Bright White/Blue"
  18707.  
  18708.  
  18709.           Example   The Colors.J sample program shows all possible colors.
  18710.  
  18711.           Colors:Start
  18712.             New(I)
  18713.             Win:Add ("Color Demonstration", 0, 0, 16, (16*4), Here)
  18714.             For (i=0 thru 255)
  18715.               Win:Attr((i%16)+"/"+Num:Int(i/16))
  18716.               Str:Put(To:Str(i," ###"))
  18717.               If ((I%16)==15)
  18718.                 Str:PutLine()
  18719.             Win:Pause
  18720.             Return (Ok)
  18721.  
  18722.  
  18723.  
  18724.  
  18725.  
  18726.           The JORF Manual (Shareware Disk Version)                      310
  18727.  
  18728.  
  18729.  
  18730.  
  18731.  
  18732.  
  18733.                                       Win:Block
  18734.  
  18735.  
  18736.           Function  Win:Block ( Function, Command )  
  18737.  
  18738.           Purpose   Do some WordStar style block commands.
  18739.  
  18740.           Returns   None.
  18741.  
  18742.           Notes     JORF Version 2.0 introduces the same Block Move and
  18743.                     Copy commands found in other Wordstar style editors. 
  18744.                     You can access these functions using Win:Block.  
  18745.  
  18746.                     Win:Block ("Mark", Marker).  Places a block marker. 
  18747.                     Marker can be a number from 0 through 9, "Beginning" or
  18748.                     "End".
  18749.  
  18750.                     Win:Block ("Goto", Marker).  Move cursor to a block
  18751.                     marker.  Marker can be a number from 0 through 9,
  18752.                     "Beginning" or "End".
  18753.  
  18754.                     Win:Block ("Copy").  Copies a marked block to current
  18755.                     cursor location.  Nothing is copied if block is not
  18756.                     correctly marked, or if cursor is within the block.
  18757.  
  18758.                     Win:Block ("Delete", Marker).  Delete the marked block,
  18759.                     no matter where the cursor is located. 
  18760.  
  18761.                     Win:Block ("Move").  Moves a marked block by copying it
  18762.                     to the current cursor location and then deleting it
  18763.                     from its prior location.
  18764.  
  18765.                     Win:Block ("Read", FileName).  Reads a block from disk
  18766.                     into the current cursor location.  File is assumed to
  18767.                     be a text file.  This read adds lines one by one, and
  18768.                     is much slower than File:Load.
  18769.  
  18770.                     Win:Block ("Write" FileName).  Writes a marked block to
  18771.                     disk.  Does not change block markers.
  18772.  
  18773.  
  18774.  
  18775.  
  18776.  
  18777.  
  18778.  
  18779.  
  18780.  
  18781.  
  18782.  
  18783.  
  18784.  
  18785.           Chapter Five - JORF Functions                                 311
  18786.  
  18787.  
  18788.  
  18789.  
  18790.  
  18791.  
  18792.                                        Win:Chg
  18793.  
  18794.  
  18795.           Function  Win:Chg ( Marker, NewFields )  
  18796.                     Win:Chg ( Marker, Row, Col, Len, Wid, NewFields )  
  18797.  
  18798.           Purpose   Change the fields in a window for something new. 
  18799.  
  18800.           Returns   None.
  18801.  
  18802.           Notes     This command will make your windows sing.  Use it to
  18803.                     redraw sections of a window based on data entry by the
  18804.                     operator.  This function dynamically reallocates and
  18805.                     re-displays a portion of a window.
  18806.  
  18807.                     The key to using this command is to use Marker commands
  18808.                     in your definition.  When a group of fields is preceded
  18809.                     by a marker, they can be changed simply by referencing
  18810.                     that marker.  Each marker section of fields goes until
  18811.                     the next marker.  Markers cannot be nested.
  18812.  
  18813.                     If you call this command with Row, Col, Len and Wid,
  18814.                     then the section of the screen is physically erased and
  18815.                     redrawn.  This is the common way to display window
  18816.                     changes.  If the changes are so minor that the screen
  18817.                     does not need to be redrawn, then you can use the short
  18818.                     form of this function.
  18819.  
  18820.           Example   See Contact.J.
  18821.  
  18822.  
  18823.  
  18824.  
  18825.  
  18826.  
  18827.  
  18828.  
  18829.  
  18830.  
  18831.  
  18832.  
  18833.  
  18834.  
  18835.  
  18836.  
  18837.  
  18838.  
  18839.  
  18840.  
  18841.  
  18842.  
  18843.  
  18844.           The JORF Manual (Shareware Disk Version)                      312
  18845.  
  18846.  
  18847.  
  18848.  
  18849.  
  18850.  
  18851.                                        Win:Del
  18852.  
  18853.  
  18854.           Function  Win:Del
  18855.  
  18856.           Purpose   Delete top window on screen.
  18857.  
  18858.           Returns   None.
  18859.  
  18860.           See Also  Win:Add.
  18861.  
  18862.           Notes     Deletes a single window on the screen.    This command
  18863.                     is not generally used because windows are deleted
  18864.                     automatically when the method that creates them is
  18865.                     complete.
  18866.  
  18867.           Example   See Arr:Len.
  18868.  
  18869.  
  18870.  
  18871.  
  18872.  
  18873.  
  18874.  
  18875.  
  18876.  
  18877.  
  18878.  
  18879.  
  18880.  
  18881.  
  18882.  
  18883.  
  18884.  
  18885.  
  18886.  
  18887.  
  18888.  
  18889.  
  18890.  
  18891.  
  18892.  
  18893.  
  18894.  
  18895.  
  18896.  
  18897.  
  18898.  
  18899.  
  18900.  
  18901.  
  18902.  
  18903.           Chapter Five - JORF Functions                                 313
  18904.  
  18905.  
  18906.  
  18907.  
  18908.  
  18909.  
  18910.                                        Win:Dsp
  18911.  
  18912.  
  18913.           Function  Win:Dsp
  18914.  
  18915.           Purpose   Signal a redisplay of all windows.
  18916.  
  18917.           Returns   None.
  18918.  
  18919.           See Also  Win:Add.
  18920.  
  18921.           Notes     Signals to the interpreter that all data entry windows
  18922.                     should be redisplayed, presumably because data
  18923.                     displayed in the window may have changed.  
  18924.  
  18925.                     During data entry, changes to the current field are
  18926.                     made by the operator.  Other fields, however, may have
  18927.                     values that have changed because of the entry.  Win:Dsp
  18928.                     forces all fields to be redisplayed, so that any
  18929.                     changed values will be shown.
  18930.  
  18931.                     Changes on one window  may affect the display of a
  18932.                     prior window.  For this reason Win:Dsp sends the signal
  18933.                     to all windows.
  18934.  
  18935.                     Windows are redisplayed during the "Idle" cycle.  This
  18936.                     happens about one second after the system begins to
  18937.                     wait for data entry from the operator.  If the operator
  18938.                     has typed ahead, then the system does not go Idle and
  18939.                     the redisplay process waits until the current task is
  18940.                     complete.
  18941.  
  18942.           Example   See MAILLIST.J.
  18943.  
  18944.  
  18945.  
  18946.  
  18947.  
  18948.  
  18949.  
  18950.  
  18951.  
  18952.  
  18953.  
  18954.  
  18955.  
  18956.  
  18957.  
  18958.  
  18959.  
  18960.  
  18961.  
  18962.           The JORF Manual (Shareware Disk Version)                      314
  18963.  
  18964.  
  18965.  
  18966.  
  18967.  
  18968.  
  18969.                                       Win:FLRCO
  18970.  
  18971.  
  18972.           Function  Win:FLRCO ( Mode ) 
  18973.  
  18974.           Purpose   Change wrap mode for text on the window.
  18975.  
  18976.           Returns   Previous wrap mode as a string containing a single
  18977.                     lower case letter "f", "l", "r", "c" or "o".
  18978.  
  18979.           See Also  Win:Add.
  18980.  
  18981.           Notes     Sets the current window mode for text justification. 
  18982.                     The name of this command comes from the possible Modes;
  18983.                     "Full", "Left", "Right", "Center", or "Off".  "Off"
  18984.                     turns off the text wrapping feature so text that
  18985.                     overflows the window boundary will not be displayed. 
  18986.                     The other modes all turn on the wrapping feature that
  18987.                     wraps text at the nearest word boundary.
  18988.  
  18989.                     You can set FLRCO without using this command by setting
  18990.                     Win:Ptr->FLRCO = "F" (or "L" or "R" or "C" or "O". 
  18991.                     This is now the preferred method for setting FLRCO, and
  18992.                     the command may be eliminated in later versions of
  18993.                     JORF.
  18994.  
  18995.           Example   The CENTERED.J file uses a FLRCO command to set the
  18996.                     justification mode to "Centered".
  18997.  
  18998.           Centered:Start
  18999.             Win:Add (Null,0,0,7,30)
  19000.               Type:"Message"
  19001.               FLRCO:"Center"
  19002.               Button:"Ok" Row:5 Col:10 Wid:12
  19003.               This text uses a FLRCO
  19004.               command to center the
  19005.               text, and a TYPE command
  19006.               to set the window type.
  19007.             Return(Ok)
  19008.  
  19009.  
  19010.  
  19011.  
  19012.  
  19013.  
  19014.  
  19015.  
  19016.  
  19017.  
  19018.  
  19019.  
  19020.  
  19021.           Chapter Five - JORF Functions                                 315
  19022.  
  19023.  
  19024.  
  19025.  
  19026.  
  19027.  
  19028.                                       Win:Magic
  19029.  
  19030.  
  19031.           Function  Win:Magic ( Mode ) 
  19032.  
  19033.           Purpose   Change whether curly brackets are interpreted in text
  19034.                     on the window.
  19035.  
  19036.           Returns   Previous Magic mode True or False. 
  19037.  
  19038.           See Also  Win:Add.
  19039.  
  19040.           Notes     Sets the mode for "Magic", whether {curly bracket}
  19041.                     expressions are interpreted in text display.  Usually
  19042.                     this mode is True, allowing all variable values and
  19043.                     input expressions to be interpreted.  However, when
  19044.                     editing commands or program text, you want this mode
  19045.                     off so the that curly brackets are not interpreted. 
  19046.  
  19047.                     You also want to set FLRCO "Off" to editing program
  19048.                     text. Otherwise text lines will wrap at the window
  19049.                     borders.
  19050.  
  19051.                     Astute programmers may note that variables in windows
  19052.                     are replaced, even when they are not in the current
  19053.                     method.  The "Magic" system looks down the entire stack
  19054.                     for a named variable, and is not limited by the current
  19055.                     method which may just display the window.  
  19056.  
  19057.                     You can set Magic without using this command by setting
  19058.                     Win:Ptr->Magic = True (or False).  This is now the
  19059.                     preferred method for setting Magic, and the command may
  19060.                     be eliminated in later versions of JORF.
  19061.  
  19062.  
  19063.  
  19064.  
  19065.  
  19066.  
  19067.  
  19068.  
  19069.  
  19070.  
  19071.  
  19072.  
  19073.  
  19074.  
  19075.  
  19076.  
  19077.  
  19078.  
  19079.  
  19080.           The JORF Manual (Shareware Disk Version)                      316
  19081.  
  19082.  
  19083.  
  19084.  
  19085.  
  19086.  
  19087.                                        Win:Msg
  19088.  
  19089.  
  19090.           Function  Win:Msg ( Message ) 
  19091.  
  19092.           Purpose   Display a message in the Window.
  19093.  
  19094.           Returns   None.
  19095.  
  19096.           See Also  Win:Add.
  19097.  
  19098.           Notes     Displays a message in the last line of the current
  19099.                     window.  If the message is absent or null then the
  19100.                     current message is deleted. 
  19101.  
  19102.                     This command acts slightly differently under MS-DOS and
  19103.                     MS-Windows.  Under DOS, the message is placed in the
  19104.                     bottom border of the window.  Under Windows, it didn't
  19105.                     look good, so as an alternative  Win:Msg expands the
  19106.                     window by one line and displays the message on the new
  19107.                     line of the window.
  19108.           Example
  19109.  
  19110.           CharEx:Start
  19111.             New (Count, Str1, Str2)
  19112.             Str1="This Text will Disappear"
  19113.             Str2="This Text will Appear"
  19114.             Win:Add ("Char Example", 10, 25, 2, 30, Here)
  19115.             Str:Put (Str1)          | Show Str1
  19116.             Win:Msg ("Press Enter to continue...")
  19117.             Win:Pause               | And pause for Effect
  19118.             Win:Msg                 |
  19119.             Count = Str:Len (Str1)  | Set Counter
  19120.             While (Count > 0)       | While GT Zero
  19121.               Move:To (1,1)         |   First line
  19122.               Char:Del (1)          |   Take 1 Away
  19123.               Move:To (2,1)         |   Second line
  19124.               Char:Ins (1)          |   Add one, Add char
  19125.               Char:Put (To:Ascii (Str:At (Str2, Count, 1)))
  19126.               --Count               |   Decrement Count
  19127.               Win:Pause(5)          |   Pause 5/100 seconds
  19128.             Win:Msg("Press Enter to continue...")
  19129.             Win:Pause               | Done!
  19130.             Return                  | Bye
  19131.  
  19132.  
  19133.  
  19134.  
  19135.  
  19136.  
  19137.  
  19138.  
  19139.           Chapter Five - JORF Functions                                 317
  19140.  
  19141.  
  19142.  
  19143.  
  19144.  
  19145.  
  19146.                                       Win:Pause
  19147.  
  19148.  
  19149.           Function  Win:Pause ( Hundredths ) 
  19150.  
  19151.           Purpose   Pause.
  19152.  
  19153.           Returns   The Key that was hit, if one was hit, to end the pause.
  19154.  
  19155.           See Also  Kbd:Get.
  19156.  
  19157.           Notes     Pauses for the specified number of Hundredths of
  19158.                     seconds.  Due to the quirky hardware engineering of an
  19159.                     IBM PC, exact Hundredths are a basic unit, but cannot
  19160.                     be obtained by a program.  Generally, the finest
  19161.                     resolution is about three hundredths of a second at a
  19162.                     time.  Anyway, this command will pause as close as it
  19163.                     can get to the hundredths you specified.
  19164.  
  19165.                     If the operator hits any key, the pause will end.  If
  19166.                     Hundredths is zero, the pause will continue
  19167.                     indefinitely.  If the pause is greater than 5 seconds,
  19168.                     a "Happy Goat" will be displayed. 
  19169.  
  19170.           Example   This example is the much reviled SayLineByCharacter
  19171.                     method that is used in the tutorial for program
  19172.                     scripts.
  19173.  
  19174.                     Script:SayLineByCharacter (j)
  19175.                       New (I, C)               | Create new vars I and C 
  19176.                       I=1                      | Start with 1
  19177.                       While (Ok)
  19178.                         C=Str:At(J, I, 1)      | Get Character
  19179.                         If (C==Null)           | Done?
  19180.                           Break
  19181.                         Str:Put (C)            | Put it
  19182.                         ++I                    | Next Character
  19183.                         Win:Pause (1)          | Pause a hundredth 
  19184.                       Str:PutLine()            | Carriage Return (Putting null line)
  19185.  
  19186.  
  19187.  
  19188.  
  19189.  
  19190.  
  19191.  
  19192.  
  19193.  
  19194.  
  19195.  
  19196.  
  19197.  
  19198.           The JORF Manual (Shareware Disk Version)                      318
  19199.  
  19200.  
  19201.  
  19202.  
  19203.  
  19204.  
  19205.                                        Win:Ptr
  19206.  
  19207.  
  19208.           Function  Win:Ptr
  19209.  
  19210.           Purpose   Get the Structure that was used to create the window.
  19211.  
  19212.           Returns   A pointer to the Structure that was used to create the
  19213.                     window.  
  19214.  
  19215.           See Also  Win:Add.
  19216.  
  19217.           Notes     It is common to need information about the current
  19218.                     window from within methods that check and display
  19219.                     information for the window.  The most important vehicle
  19220.                     for this information is this function.  By using
  19221.                     Win:Ptr you have access to more than a dozen fields
  19222.                     including row, column, length and width of the window,
  19223.                     row, column, length and width of the current edit
  19224.                     field, mouse position and status, current attribute and
  19225.                     the value of the current input.
  19226.  
  19227.                     Win:Ptr->Row, Win:Ptr->Column, Win:Ptr->Len and
  19228.                     Win:Ptr->Wid reflect the actual window, and may have
  19229.                     changed if the window was adjusted to fit on the
  19230.                     screen.  (This is one way to see if the user is in
  19231.                     EGA/VGA 43/50 line mode by creating a window with a
  19232.                     length of -1 and then testing Win:Ptr->Len to get the
  19233.                     actual last line of the screen).
  19234.  
  19235.                     If you are editing a field or text, Win:Ptr->CurRow and
  19236.                     Win:Ptr->CurCol will be set to the cursor row and
  19237.                     column.  Win:Ptr->CurLine will be set to the current
  19238.                     input value.  If the mouse pointer is inside the window
  19239.                     Win:Ptr->MouseRow and Win:Ptr->MouseCol are set to
  19240.                     current mouse position.
  19241.  
  19242.                     If the current input field is more than one line (a
  19243.                     text input), Magic is False, and FLRCO is "Off", then
  19244.                     the window can move right or down to accommodate text
  19245.                     that is larger than the window.  In this case
  19246.                     Win:Ptr->RowOff and Win:Ptr->ColOff reflect the
  19247.                     relative position of the top left corner of the text in
  19248.                     the window.
  19249.  
  19250.                     You can test and set Win:Ptr->FLRCO, Win:Ptr->Magic and
  19251.                     Win:Ptr->Attr.  When these values are assigned, the
  19252.                     interpreter automatically calls the appropriate
  19253.                     function. 
  19254.  
  19255.  
  19256.  
  19257.           Chapter Five - JORF Functions                                 319
  19258.  
  19259.  
  19260.  
  19261.  
  19262.  
  19263.  
  19264.                                        Win:Repl
  19265.  
  19266.  
  19267.           Function  Win:Repl ( SearchString, ReplaceString, Flags ) 
  19268.  
  19269.           Purpose   Do some WordStar style string replacing commands.
  19270.  
  19271.           Returns   None.
  19272.  
  19273.           See Also  Win:Search.
  19274.  
  19275.           Notes     The JORF Window Manager uses the same Search and
  19276.                     Replace commands found in other WordStar style editors. 
  19277.                     You can access these functions using Win:Search and
  19278.                     Win:Repl.  
  19279.  
  19280.                     Flag values are:
  19281.  
  19282.                     B    Search backward to top - Normally searches forwards.
  19283.                     G    Global replace - Normally replaces just one. 
  19284.                     N    Do not prompt - Normally prompts for each replace.
  19285.                     U    Case insensitive search - Normally is case sensitive.
  19286.                     W    Search for Whole Words - Normally allows partial words.
  19287.  
  19288.                     A numeric value with the flags is considered the number
  19289.                     of items to skip before stopping.  For instance, GU2
  19290.                     will search globally, without case sensitivity, and
  19291.                     will replace two instances of the item.
  19292.  
  19293.                     This command can only be used within an edit window,
  19294.                     and will do nothing if used on a text that is not
  19295.                     currently being edited in the window.
  19296.  
  19297.  
  19298.  
  19299.  
  19300.  
  19301.  
  19302.  
  19303.  
  19304.  
  19305.  
  19306.  
  19307.  
  19308.  
  19309.  
  19310.  
  19311.  
  19312.  
  19313.  
  19314.  
  19315.  
  19316.           The JORF Manual (Shareware Disk Version)                      320
  19317.  
  19318.  
  19319.  
  19320.  
  19321.  
  19322.  
  19323.                                       Win:Search
  19324.  
  19325.  
  19326.           Function  Win:Search ( SearchString, Flags ) 
  19327.  
  19328.           Purpose   Do some WordStar style string search. 
  19329.  
  19330.           Returns   None.
  19331.  
  19332.           See Also  Win:Repl.
  19333.  
  19334.           Notes     The JORF Window Manager uses introduces the same Search
  19335.                     and Replace commands found in other Wordstar style
  19336.                     editors.  You can access these functions using
  19337.                     Win:Search and Win:Repl.  
  19338.  
  19339.                     Flag values are:
  19340.  
  19341.                     B    Search backward to top - Normally searches forwards.
  19342.                     U    Case insensitive search - Normally is case sensitive.
  19343.                     W    Search for Whole Words - Normally allows partial words.
  19344.  
  19345.                     A numeric value with the flags is considered the number
  19346.                     of items to skip before stopping.  For instance, GU2
  19347.                     will search globally, without case sensitivity, and
  19348.                     will stop on the second instance of the search item.
  19349.  
  19350.                     This command can only be used within an edit window,
  19351.                     and will do nothing if used on a text that is not
  19352.                     currently being edited in the window.
  19353.  
  19354.  
  19355.  
  19356.  
  19357.  
  19358.  
  19359.  
  19360.  
  19361.  
  19362.  
  19363.  
  19364.  
  19365.  
  19366.  
  19367.  
  19368.  
  19369.  
  19370.  
  19371.  
  19372.  
  19373.  
  19374.  
  19375.           Chapter Five - JORF Functions                                 321
  19376.  
  19377.  
  19378.  
  19379.  
  19380.  
  19381.  
  19382.                                        Word:At
  19383.  
  19384.  
  19385.           Function  Word:At ( Structure, Position ) 
  19386.  
  19387.           Purpose   Returns a word in parsed command line, or value of a
  19388.                     member of a structure. 
  19389.  
  19390.           Returns   Word.
  19391.  
  19392.           See Also  Word:AtPut, Class:At.
  19393.  
  19394.           Notes     Both structures and text lines are stored as an array
  19395.                     of Class:Word pairs.  The number of words can be
  19396.                     obtained using Word:Len.
  19397.  
  19398.                                         Arrays
  19399.  
  19400.                     Array elements are normally accessed using square
  19401.                     brackets [].  But if you find reason, you can use
  19402.                     Word:At to get the element. Word:Len-1 will be the
  19403.                     number of elements used in the array. 
  19404.  
  19405.                                       Structures
  19406.  
  19407.                     Normally, structure elements are accessed using
  19408.                     pointers.  However, they may also be accessed by
  19409.                     referencing the elements directly using this command. 
  19410.                     This has to be done to examine the stack, because it is
  19411.                     not a normal class. 
  19412.  
  19413.                                          Text
  19414.  
  19415.                     Text lines may be examined to obtain the class and
  19416.                     values of items on that line.  The line is
  19417.                     automatically parsed when Word:At is used.  Unlike the
  19418.                     parse used by the interpreter, the Word:At parse
  19419.                     separates all punctuation characters into individual
  19420.                     words, even if they are two character symbols like the
  19421.                     pointer->operator.
  19422.  
  19423.           Example   See Event:Add.
  19424.  
  19425.  
  19426.  
  19427.  
  19428.  
  19429.  
  19430.  
  19431.  
  19432.  
  19433.  
  19434.           The JORF Manual (Shareware Disk Version)                      322
  19435.  
  19436.  
  19437.  
  19438.  
  19439.  
  19440.  
  19441.                                       Word:AtDel
  19442.  
  19443.  
  19444.           Function  Word:AtDel ( Structure, Position, Count ) 
  19445.  
  19446.           Purpose   Squeezes a structure.
  19447.  
  19448.           Returns   None.
  19449.  
  19450.           See Also  Word:At, Word:AtIns, Str:AtDel.
  19451.  
  19452.           Notes     Squeezes elements out of the center of a structure. 
  19453.                     Unlike Word:At, Word:AtDel and Word:AtIns delete and
  19454.                     insert the Class/Word pair, so there is no need for the
  19455.                     equivalent Class:AtDel and Class:AtIns  functions.   If
  19456.                     the Count argument is missing then all elements of the
  19457.                     structure starting at Position are deleted.
  19458.  
  19459.                                         Arrays
  19460.  
  19461.                     This function cannot be used on arrays.
  19462.  
  19463.                                       Structures
  19464.  
  19465.  
  19466.                     Deleting "Word" values will eliminate structure
  19467.                     elements.  Care should be taken not to delete more than
  19468.                     you intend.  Each structure may have elements in a
  19469.                     different order, even when the structures are from the
  19470.                     same class.  That is because elements are kept in the
  19471.                     order assigned, and assignment may be arbitrary.
  19472.  
  19473.                     You should never delete the first element of a
  19474.                     structure, because this affects the class of the
  19475.                     structure.
  19476.  
  19477.                                          Text
  19478.  
  19479.                     This function has no effect on lines of text.
  19480.  
  19481.  
  19482.  
  19483.  
  19484.  
  19485.  
  19486.  
  19487.  
  19488.  
  19489.  
  19490.  
  19491.  
  19492.  
  19493.           Chapter Five - JORF Functions                                 323
  19494.  
  19495.  
  19496.  
  19497.  
  19498.  
  19499.  
  19500.                                       Word:AtIns
  19501.  
  19502.  
  19503.           Function  Word:AtIns ( Structure, Position, Count ) 
  19504.  
  19505.           Purpose   Expands a structure.
  19506.  
  19507.           Returns   None.
  19508.  
  19509.           See Also  Word:At, Word:AtDel, Str:AtIns.
  19510.  
  19511.           Notes     Inserts elements out of the center of a structure. 
  19512.                     Unlike Word:At, Word:AtDel and Word:AtIns delete and
  19513.                     insert the Class/Word pair, so there is no need for the
  19514.                     equivalent Class:AtDel and Class:AtIns  functions. If
  19515.                     the Count argument is missing then the structure
  19516.                     remains unchanged.
  19517.  
  19518.                                         Arrays
  19519.  
  19520.                     This function cannot be used on arrays.
  19521.  
  19522.                                       Structures
  19523.  
  19524.                     After inserting, you must use Class:AtPut and
  19525.                     Word:AtPut to set the Class/Word values.  
  19526.  
  19527.                     Care should be taken not to insert at position 1,
  19528.                     because the first pair contains the class name for the
  19529.                     structure.
  19530.  
  19531.                                          Text
  19532.  
  19533.                     This command has no effect on lines of text.
  19534.  
  19535.  
  19536.  
  19537.  
  19538.  
  19539.  
  19540.  
  19541.  
  19542.  
  19543.  
  19544.  
  19545.  
  19546.  
  19547.  
  19548.  
  19549.  
  19550.  
  19551.  
  19552.           The JORF Manual (Shareware Disk Version)                      324
  19553.  
  19554.  
  19555.  
  19556.  
  19557.  
  19558.  
  19559.                                       Word:AtPut
  19560.  
  19561.  
  19562.           Function  Word:AtPut ( Structure, Position, Value ) 
  19563.  
  19564.           Purpose   Changes the value in a member of a structure. 
  19565.  
  19566.           Returns   None.
  19567.  
  19568.           See Also  Word:At, Class:AtPut.
  19569.  
  19570.           Notes     Both structures and text lines are stored as an array
  19571.                     of Class:Word pairs.  You can use this function to
  19572.                     change the "Word" portion of such a structure. The
  19573.                     number of words in a structure or line can be obtained
  19574.                     using Word:Len.  
  19575.  
  19576.                                         Arrays
  19577.  
  19578.                     This function cannot be used on arrays.
  19579.  
  19580.                                       Structures
  19581.  
  19582.                     Replacing a "Word" value will not change the length of
  19583.                     the structure.  You should not replace the first word
  19584.                     of the structure, unless you are intentionally changing
  19585.                     the class of the structure.
  19586.  
  19587.                     To change the class of a structure, you must replace
  19588.                     the first "Class/Word" pair of the structure with a
  19589.                     Null "Word" and a class indicating the new class name.
  19590.  
  19591.                                          Text
  19592.  
  19593.                     When a word is replaced in a text line, the Str:Len of
  19594.                     the line is changed by the difference in lengths
  19595.                     between the old and new values.
  19596.  
  19597.  
  19598.  
  19599.  
  19600.  
  19601.  
  19602.  
  19603.  
  19604.  
  19605.  
  19606.  
  19607.  
  19608.  
  19609.  
  19610.  
  19611.           Chapter Five - JORF Functions                                 325
  19612.  
  19613.  
  19614.  
  19615.  
  19616.  
  19617.  
  19618.                                        Word:In
  19619.  
  19620.  
  19621.           Function  Word:In ( Structure, Word ) 
  19622.  
  19623.           Purpose   Searches for the existence of Word in a structure or
  19624.                     parsed command line, and returns the position if it is
  19625.                     found.  Returns zero if Class is not found.
  19626.  
  19627.           Returns   Position of Word or zero if not found.
  19628.  
  19629.           See Also  Str:In, Word:At, Class:In.
  19630.  
  19631.           Notes     Both structures and text lines are stored as an array
  19632.                     of Class:Word pairs. You can use this function to
  19633.                     search for the "Word" portion of the pair.  
  19634.  
  19635.                     When searching for a "Word" the value being searched
  19636.                     for need may be a string, number, text pointer or
  19637.                     array.  The number of words can be obtained using
  19638.                     Word:Len.  Word:In can be used to get the value of an
  19639.                     element in a structure without using the structure
  19640.                     pointer operator.
  19641.  
  19642.                                         Arrays
  19643.  
  19644.                     You can use Word:In to find the position of an array
  19645.                     value without regard to position.  
  19646.  
  19647.                                       Structures
  19648.  
  19649.                     You can use Word:in to find the absolute position of a
  19650.                     value in a structure without regard to the structure
  19651.                     element name.  
  19652.  
  19653.  
  19654.  
  19655.  
  19656.  
  19657.  
  19658.  
  19659.  
  19660.  
  19661.  
  19662.  
  19663.  
  19664.  
  19665.  
  19666.  
  19667.  
  19668.  
  19669.  
  19670.           The JORF Manual (Shareware Disk Version)                      326
  19671.  
  19672.  
  19673.  
  19674.  
  19675.  
  19676.  
  19677.                                          Text
  19678.  
  19679.                     There are two ways to search for a word in a line of
  19680.                     text.  One is to use Str:In to find a substring, and
  19681.                     the other is to use Word:In to find a parsed word.  The
  19682.                     words are parsed using space or punctuation character
  19683.                     delimiters.  Expressions quoted with single or double
  19684.                     quotes are considered a single word.
  19685.  
  19686.                          Str:In("Four score and twenty","And")   12
  19687.                          Word:In("Four scord and twenty", "And") 3
  19688.  
  19689.                          Str:In("Josephine's Pen", "Pen")        13
  19690.                          Word:In("Josephine's Pen", "Pen")  4 
  19691.  
  19692.  
  19693.  
  19694.  
  19695.  
  19696.  
  19697.  
  19698.  
  19699.  
  19700.  
  19701.  
  19702.  
  19703.  
  19704.  
  19705.  
  19706.  
  19707.  
  19708.  
  19709.  
  19710.  
  19711.  
  19712.  
  19713.  
  19714.  
  19715.  
  19716.  
  19717.  
  19718.  
  19719.  
  19720.  
  19721.  
  19722.  
  19723.  
  19724.  
  19725.  
  19726.  
  19727.  
  19728.  
  19729.           Chapter Five - JORF Functions                                 327
  19730.  
  19731.  
  19732.  
  19733.  
  19734.  
  19735.  
  19736.                                        Word:Len
  19737.  
  19738.  
  19739.           Function  Word:Len ( Structure ) 
  19740.  
  19741.           Purpose   Returns the number of elements in a structure, or the
  19742.                     number of words in a parsed text line.
  19743.  
  19744.           Returns   Number of words.
  19745.  
  19746.           See Also  Word:At, Str:Len.
  19747.  
  19748.           Notes     Returns the number of words in a line of text, and the
  19749.                     number of elements in a structure or array.  This
  19750.                     function is commonly used with Word:At to examine text,
  19751.                     and structure on an element by element basis.
  19752.  
  19753.                                         Arrays
  19754.  
  19755.                     Returns exactly the same value as Arr:Len().  This
  19756.                     function is a little more general, and is the preferred
  19757.                     function if you are counting expressions in a variable
  19758.                     that may or may not be an array.  Setting an array
  19759.                     element to null is the same as "using" it, so if you
  19760.                     set A[2000]=null, then the array length will be 2000.
  19761.  
  19762.                                       Structures
  19763.  
  19764.                     The length of a structure includes a structure header
  19765.                     element that contains the class name and a pointer to
  19766.                     the class definition.  So a structure with three
  19767.                     elements has a Word:Len of four. 
  19768.  
  19769.                     Structures do not have the same number of elements as
  19770.                     the class definition.  Even if there are 20 elements in
  19771.                     a class definition, a structure will only store those
  19772.                     elements that have a value.  Elements that have not
  19773.                     been set are reported as Null, but in fact they are not
  19774.                     stored at all.  Elements are not moved when set to
  19775.                     null, except when the file is rebuilt.  So setting a
  19776.                     structure element to null will not shrink an array, but
  19777.                     the array will shrink if stored in a file that is then
  19778.                     rebuilt.
  19779.  
  19780.                                          Text
  19781.  
  19782.                     The origin of this function lies in the origin of JORF
  19783.                     as a Japanese/English language translator.  When I was
  19784.                     trying to build one in late 1987 I got so frustrated by
  19785.                     the memory and file management problems of the C
  19786.                     language that I decided to create a new language to do
  19787.  
  19788.           The JORF Manual (Shareware Disk Version)                      328
  19789.  
  19790.  
  19791.  
  19792.  
  19793.  
  19794.                     my parsing and dictionary management.  My new language
  19795.                     became the core of the JORF language.
  19796.  
  19797.                     In it's parser role, the Word:Len() function considers
  19798.                     each word separate, as well as each punctuation
  19799.                     character.  Single and double quotes are handled
  19800.                     specially.  Quoted expressions are considered a single
  19801.                     word.  The following lines are shown with their
  19802.                     lengths:
  19803.  
  19804.                          Line                     Word:Len
  19805.  
  19806.                          This is a line of text             6
  19807.                          A line with  (Parentheses)              6
  19808.                          "A Quote"                1
  19809.                          Another 'Quote with a period'.          3
  19810.                          !@#$%^&*()                    10
  19811.                          "!@#$%^&*()"                  1
  19812.                          '"'                      1
  19813.  
  19814.  
  19815.  
  19816.  
  19817.  
  19818.  
  19819.  
  19820.  
  19821.  
  19822.  
  19823.  
  19824.  
  19825.  
  19826.  
  19827.  
  19828.  
  19829.  
  19830.  
  19831.  
  19832.  
  19833.  
  19834.  
  19835.  
  19836.  
  19837.  
  19838.  
  19839.  
  19840.  
  19841.  
  19842.  
  19843.  
  19844.  
  19845.  
  19846.  
  19847.           Chapter Five - JORF Functions                                 329
  19848.  
  19849.  
  19850.  
  19851.  
  19852.  
  19853.  
  19854.  
  19855.  
  19856.  
  19857.  
  19858.                                       Appendix A
  19859.                                JORF Language Reference
  19860.  
  19861.  
  19862.  
  19863.  
  19864.                                      Basic Rules
  19865.  
  19866.                     Indentation controls program flow.
  19867.                     Commands and variable names are not case sensitive.
  19868.                     The end of line is the end of the line.
  19869.                     The comment character is a pipe symbol (|).
  19870.                     Parameter lists are surrounded by Parentheses
  19871.  
  19872.                                       Key Words
  19873.  
  19874.                     Class          Used to declare a new class.
  19875.                     Parent         In a class definition, designates a
  19876.                                    parent class.
  19877.                     Jorf           The default class for all objects.
  19878.                     Index          Declares an index field within a class
  19879.                     Poly           Indicates a polymorphic method call
  19880.  
  19881.                          Math Symbols and Order of Operations
  19882.  
  19883.                     ->                  Structure Element Pointer
  19884.                     []                  Array reference
  19885.                     - ++ --             Negation, Increment, Decrement
  19886.                     * / %               Multiplication, Division, Modulus
  19887.                     + -                 Addition and Subtraction
  19888.                     = <> !=             Equality and Inequality
  19889.                     > < >= <=           Comparison
  19890.                     && ?? And Or        Logical And, Or
  19891.                     =                   Assignment of value
  19892.  
  19893.  
  19894.  
  19895.  
  19896.  
  19897.  
  19898.  
  19899.  
  19900.  
  19901.  
  19902.  
  19903.  
  19904.  
  19905.  
  19906.           The JORF Manual (Shareware Disk Version)                      330
  19907.  
  19908.  
  19909.  
  19910.  
  19911.  
  19912.  
  19913.  
  19914.  
  19915.  
  19916.  
  19917.                                       Appendix B
  19918.                                   Library Functions
  19919.  
  19920.  
  19921.  
  19922.  
  19923.      Function                            Description                     Returns
  19924.  
  19925.      Arr:Del (Arr,Pos,Cnt)               Delete Cnt Elements at Pos        Array
  19926.      Arr:Dir (WildCard,Excl,Wid)         Directory minus exclusions        Array
  19927.      Arr:Ins (Arr,Pos,Cnt)               Insert Cnt Elements at Pos        Array
  19928.      Arr:Len (Arr)                       Number of Elements                Count
  19929.      Arr:Pick (Arr,Cmd,T,R,C,L,Df)       Show a Pick Menu                   Pick
  19930.      Arr:Printers                        Returns Printer List              Array
  19931.      Arr:Sort (Arr,Cmd,Dir)              Sort Ascending/Descending         Array
  19932.  
  19933.      Char:Del (Count)                    Del Spaces                         None
  19934.      Char:Get                            Get ASCII value                   Value
  19935.      Char:Ins (Count)                    Ins Spaces                         None
  19936.      Char:Put (Value)                    ASCII value to Screen              None
  19937.      Char:Print (Printer, Value)         ASCII value to Printer             None
  19938.  
  19939.      Class:At (Struct,Pos)               Class at Position                 Class
  19940.      Class:AtPut (Struct,Pos,Class)      Change Class                     If put
  19941.      Class:In (Struct,Class)             Get Position                   Position
  19942.      Class:Read (Name)                   Read Class                      If Read
  19943.      Class:Write                         Write current Class          If Written
  19944.  
  19945.      Date:Add (Date,Days,Mths,Yrs)       Add Days, Months, Years to dateNew Date
  19946.      Date:Get                            Get today's date           Today's date
  19947.      Date:Set (Date)                     Set system clock              Ok if set
  19948.      Date:SetFmt (FormatStructure)       Set default format, Month names    None
  19949.      Date:Str (Date, Format)             Convert date to string date Date string
  19950.      Date:Sub (Date,Days,Mths,Yrs)       Subtract Days, Months, Years from date                                                                        New Date
  19951.  
  19952.      Db:Append (Name,Line)               Append record to file             If Ok
  19953.      Db:Close (Name)                     Close a dBASE file                If Ok
  19954.      Db:Create (Name)                    Create a dBASE file               If Ok
  19955.      Db:Delete (Name,Recno)              Delete a Record           Ok if deleted
  19956.      Db:Go (Name,Recno)                  Go Top, Bottom or Recno     Recno if Ok
  19957.      Db:Info (Name,InfoFlag)             Get file size,found,deleted Info result
  19958.      Db:Lock (Name,Recno)                Lock and read Record   Record if Locked
  19959.      Db:Map (Nm,Lev,Class,Map)           Map dBASE File                     None
  19960.      Db:Ntxord (Name,Ntxnumber)          Set index to use      Ok if valid index
  19961.      Db:Pack (Name,Showit)               Rebuild dBASE file, NTXs          If Ok
  19962.  
  19963.  
  19964.  
  19965.           Appendix                                                      331
  19966.  
  19967.  
  19968.  
  19969.  
  19970.  
  19971.      Function                            Description                     Returns
  19972.  
  19973.      Db:Read (Name,Recno)                Read Line/Record                 Record
  19974.      Db:Recall (Name,Recno)              Undelete a Record     Ok if was deleted
  19975.      Db:Seek (Name,Indexval)             Seek for an index key    Recno if found
  19976.      Db:Set (Name,Flag,Value)            Set dBASE settings        Old set value
  19977.      Db:Skip (Name,Recno,Skipby)         Get next/Prev record number                                                                 Recno if not Eof
  19978.      Db:Unlock (Name,Record)             Unlocked a locked record                                                             If Ok and was locked
  19979.      Db:Write (Name,Record)              Write dBASE Record                 None
  19980.  
  19981.      Event:Add (Class,Type,Lev)          Add Event Class                    None
  19982.      Event:Del (Type)                    Delete Event Class                 None
  19983.      Event:Do (Method,Type)              Do Event Method                  Return
  19984.  
  19985.      False                               Logical False                      Null
  19986.  
  19987.      File:Append (Name,Line)             Append line or record to file     If Ok
  19988.      File:Backup (Name)                  Create a Backup                   If Ok
  19989.      File:Chgdir (Path)                  Change Directory                  If Ok
  19990.      File:Close (Name)                   Close a file                      If Ok
  19991.      File:Copy (From,To)                 Copy File                         If Ok
  19992.      File:Create (Name)                  Create a mapped or dBASE file     If Ok
  19993.      File:Del (Name)                     Delete File                       If Ok
  19994.      File:Exist (Name,Access)            Check Existence/Access            If Ok
  19995.      File:Len (Name)                     Get Size of File              Size in K
  19996.      File:Load (Name)                    Load Text File                     Text
  19997.      File:Lock (Name)                    Lock a file for exclusive use If Locked
  19998.      File:Map (Nm,Lev,Class,Type,Map)    Map ASCII or dBASE File            None
  19999.      File:MoveTo (Name,Pos)              Move to Beg/Ene                   If Ok
  20000.      File:Ok (Name)                      Not EOF in File:Read              If Ok
  20001.      File:Print (Name,Device,Flags)      Print file to print device        If Ok
  20002.      File:Read (Name,Size,Off)           Read Line/Record            Line/Record
  20003.      File:Rename (From,To)               Rename File                       If Ok
  20004.      File:Save (Name,Text)               Save Text to File                 If Ok
  20005.      File:Unlock (Name)                  Unlocked a locked file                                                             If Ok and was locked
  20006.      File:Write (Name,Line,Size,Off)     Write Line/Record                  None
  20007.  
  20008.      For/Thru/Step                       Incrementing Loop                  None
  20009.  
  20010.      Here                                Return level                      Level
  20011.  
  20012.      If/Else                             Conditional Branch                 None
  20013.  
  20014.      Jorf:Cls                            Clear DOS Screen                   None
  20015.      Jorf:Del (Variable)                 Delete Text                        None
  20016.      Jorf:Do (MethodName)                Interpret a string               Return
  20017.      Jorf:Dup (Text)                     Copy Text or Struct              A Copy
  20018.      Jorf:Exit (Status,Msg,Cmd)          Exit                            Doesn't
  20019.      Jorf:File (Name Level)              Current Project                    None
  20020.      Jorf:Flush (Minimum)                Flush memory                       None
  20021.      Jorf:Info (InfoFlag)                Get disk space, Memory, Etc. Info value
  20022.  
  20023.  
  20024.           The JORF Manual (Shareware Disk Version)                      332
  20025.  
  20026.  
  20027.  
  20028.  
  20029.  
  20030.      Function                            Description                     Returns
  20031.  
  20032.      Jorf:Ini                            Reread .INI file                   None
  20033.      Jorf:Move (Srce,Dest,Class)         Move Buffer                      A Copy
  20034.      Jorf:Pack                           Pack JORF File                     None
  20035.      Jorf:Printer                        Display printer selection menu                                                                  Device selected
  20036.      Jorf:Rebuild                        Rebuild JORF File                  None
  20037.      Jorf:Sound (Freq,Dur)               Make a Sound                       None
  20038.      Jorf:System (Cmd,Flgs,Msg)          DOS shell                        Return
  20039.      Jorf:Write (Variable)               Write var to current project If written
  20040.  
  20041.      Kbd:Bye                             Flush Keyboard Stream              None
  20042.      Kbd:Get (CursorSize)                Keyboard Input                      Key
  20043.      Kbd:Got                             Last Key Value                      Key
  20044.      Kbd:Hit                             Key Waiting?                 True/False
  20045.      Kbd:Put (Keys)                      Stuff Keystrokes                   None
  20046.  
  20047.      Key:Add (RuleStructure)             Add String Key                     None
  20048.      Key:Del (RuleStructure)             Delete String Key            Sets Found
  20049.      Key:Find (RuleStructure)            Find String Key              Sets Found
  20050.      Key:Next (RuleStructure)            Find Next                    Sets Found
  20051.      Key:Prev (RuleStructure)            Find Prev                    Sets Found
  20052.  
  20053.      Line:Del (Count)                    Delete Lines                       None
  20054.      Line:Inp (Fld,R,C,L,W)              Input Field/Text             Field/Text
  20055.      Line:Ins (Count)                    Insert Lines                       None
  20056.      Line:Out (Fld,R,C,L,W)              Output Field/Text                  None
  20057.      Line:Rel                            Release current input              None
  20058.  
  20059.      Mem:Ptr                             A Global Pointer                   None
  20060.  
  20061.      Move:To (Row,Column)                Move Cursor                        None
  20062.      Move:By (Row,Column)                Move Cursor                        None
  20063.  
  20064.      Msg:Add (Title,Type,Text)           A Dialog Box                 True/False
  20065.  
  20066.      New (Class:Var1,Class:Var2)         Create Variables                   None
  20067.  
  20068.      Null                                Nothing                            Null
  20069.  
  20070.      Num:Abs (Num)                       Absolute value                   Number
  20071.      Num:Btw (A,B,C)                     A, Between B and C               Number
  20072.      Num:Exp (Num)                       Exponent e to the Num            Number
  20073.      Num:Log (Num)                       Log of Num                       Number
  20074.      Num:Max (A,B)                       Higher of A or B                 Number
  20075.      Num:Min (A,B)                       Lower of A or B                  Number
  20076.      Num:Pow (Num,Pow)                   Num to the Power                 Number
  20077.      Num:Rand (High,Low)                 Random Number                    Number
  20078.      Num:Sqrt (Num)                      Random Number                    Number
  20079.  
  20080.      Ok                                  Ok                                    1
  20081.  
  20082.  
  20083.           Appendix                                                      333
  20084.  
  20085.  
  20086.  
  20087.  
  20088.  
  20089.      Function                            Description                     Returns
  20090.  
  20091.      Rep:Add (Title,R,C,L,W,Lev,Fmt)     Create report file                 None
  20092.  
  20093.      Return (Value)                      Return a value                     None
  20094.  
  20095.      Rule:Add (RuleStructure)            Add Rule                           None
  20096.      Rule:Del (RuleStructure)            Delete Rule                  Sets Found
  20097.      Rule:Find (RuleStructure)           Find Rule                    Sets Found
  20098.      Rule:Next (RuleStructure)           Find Next Rule               Sets Found
  20099.      Rule:Prev (RuleStructure)           Find Previous Rule           Sets Found
  20100.  
  20101.      Str:Aft (String,Chars)              String after chars            Substring
  20102.      Str:At (String,Pos,Len)             Get Substring                 Substring
  20103.      Str:AtChar (String,Chars)           String up to chars            Substring
  20104.      Str:AtCut (String,Pos)              Truncate String                  String
  20105.      Str:AtDel (String,Pos,Cnt)          Delete Characters                String
  20106.      Str:AtPut (String,Pos,Ins)          Insert Characters                String
  20107.      Str:AtSet (String,Pos,Ins,Cnt)      Insert Rep Chars                 String
  20108.      Str:In (String,Substring)           Get Substring                  Position
  20109.      Str:Ind (String)                    Num of lead Spaces                Count
  20110.      Str:Len (String)                    Number of Chars                  Length
  20111.      Str:NPad (String,Length)            Null pad string to Length Padded string
  20112.      Str:Pad (String,Length)             Space pad string to LengthPadded string
  20113.      Str:Print (Prn,String)              String to Printer                  None
  20114.      Str:Put (String)                    Display Text                       None
  20115.      Str:PutLine (Line)                  Display Text, NL                   None
  20116.      Str:RPad (String,Length)            Space pad string Right Justified                                                                   Padded string
  20117.  
  20118.      Struct:Find (Class,Index,Value)     Find record w/ auto index        Record
  20119.      Struct:Find (Class,Index,Value)     Find record w/ auto index        Record
  20120.      Struct:Find (Class,Index,Value)     Find record w/ auto index        Record
  20121.  
  20122.      Switch/Case/Else                    Conditional Branch                 None
  20123.  
  20124.      Text:Add (Line,Text)                Create text block              New Text
  20125.      Text:At (Text,Pos)                  Text Line at Pos                   Line
  20126.      Text:Bot (Text)                     Last Line of Text             Last Line
  20127.      Text:Chg (Text,Line)                Change line of text                Text
  20128.      Text:Len (Text)                     Number of lines              Line Count
  20129.      Text:Next (Text)                    Next line of Text             Next Line
  20130.      Text:Pos (Text)                     Line num of Text                 Number
  20131.      Text:Prev (Text)                    Prev line of Text             Prev Line
  20132.      Text:Ptr (Text)                     Ptr to indented Text               Text
  20133.      Text:Top (Text)                     First Line of Text           First Line
  20134.      Text:Wid (Text)                     Width of widest Line              Width
  20135.  
  20136.      Time:Add (Time,Mins,Hrs,Secs)       Add Minutes, hours, seconds   New  time
  20137.      Time:Get                            Get current time                    Now
  20138.      Time:Set (Time)                     Set system clock              Ok if set
  20139.      Time:SetFmt (FormatStructure)       Set default format, AM/PM name     None
  20140.  
  20141.  
  20142.           The JORF Manual (Shareware Disk Version)                      334
  20143.  
  20144.  
  20145.  
  20146.  
  20147.  
  20148.      Function                            Description                     Returns
  20149.  
  20150.      Time:Str (Time, Format)             Convert time  to string time                                                                      Time string
  20151.      Time:Sub (Time,Mins,Hrs,Secs)       Subtract Minutes, hours seconds                                                                         New time
  20152.      Time:Ticks                          Get Ticks                         Ticks
  20153.  
  20154.      To:ASCII (String)                   Get ASCII Value                   Value
  20155.      To:Caps (String)                    Cvt to Capitals                  String
  20156.      To:Char (Number)                    Cvt to Letter                    String
  20157.      To:Date (String)                    Cvt to Date                        Date
  20158.      To:Int (Number)                     Cvt to Integer                  Integer
  20159.      To:Lcs (String)                     Cvt to Lower Case                String
  20160.      To:Num (String,Base)                Cvt to Number                    Number
  20161.      To:Str (Number,Fmt,Base,Wid)        Cvt to String                    String
  20162.      To:Time (String)                    Cvt to Time                        Time
  20163.      To:Ucs (String)                     Cvt to Upper Case                String
  20164.  
  20165.      True                                Logical True                          1
  20166.  
  20167.      While/Break/Continue                A Loop                             None
  20168.  
  20169.      Win:Add (Title,R,C,L,W,Lv,Txt)      Add new Window                     None
  20170.      Win:Add (WindowStruct)              Add new Window                     None
  20171.      Win:Attr (Attribute)                Change Attribute                   None
  20172.      Win:Block (Cmd,Fnc)                 Do Block Function                  Null
  20173.      Win:Chg (Marker,R,C,L,W,Txt)        Change button area in Window       None
  20174.      Win:Del                             Delete Window                      None
  20175.      Win:Dsp                             Redisplay all Windows              None
  20176.      Win:FLRCO (Mode)                    Change Wrap Mode              Prev Mode
  20177.      Win:Magic (Mode)                    Change Interpret Mode         Last Mode
  20178.      Win:Msg (Message)                   Set Message                        None
  20179.      Win:Pause (Hundredths)              Pause                               Key
  20180.      Win:Ptr                             Get WindowStruct              Structure
  20181.      Win:Repl (From,To,Flags)            Replace Strings                    None
  20182.      Win:Search (Word,Flags)             Replace Strings                    None
  20183.      Word:At (Struct,Pos)                Word at Pos                        Word
  20184.      Word:AtDel (Struct,Pos,Cnt)         Squeeze Structure                  None
  20185.      Word:AtIns (Struct,Pos,Cnt)         Expand Structure                   None
  20186.      Word:AtPut (Struct,Pos,Word)        Change Word at Pos                 None
  20187.      Word:In (Struct,Word)               Get Position of Word           Position
  20188.      Word:Len (Struct)                   Number of Words                   Count
  20189.  
  20190.  
  20191.  
  20192.  
  20193.  
  20194.  
  20195.  
  20196.  
  20197.  
  20198.  
  20199.  
  20200.  
  20201.           Appendix                                                      335
  20202.  
  20203.  
  20204.  
  20205.  
  20206.  
  20207.  
  20208.  
  20209.  
  20210.  
  20211.  
  20212.                                       Appendix C
  20213.                                    Keyboard Values
  20214.  
  20215.  
  20216.  
  20217.  
  20218.      Char       Normal     Shift        Ctrl            Alt
  20219.  
  20220.      a          a_Key      A_Key        Ctrl_A_Key      Alt_A_Key
  20221.      b          b_Key      B_Key        Ctrl_B_Key      Alt_B_Key
  20222.      c          c_Key      C_Key        Ctrl_C_Key      Alt_C_Key
  20223.      d          d_Key      D_Key        Ctrl_D_Key      Alt_D_Key
  20224.      e          e_Key      E_Key        Ctrl_E_Key      Alt_E_Key
  20225.      f          f_Key      F_Key        Ctrl_F_Key      Alt_F_Key
  20226.      g          g_Key      G_Key        Ctrl_G_Key      Alt_G_Key
  20227.      h          h_Key      H_Key        BackSpace_Key   Alt_H_Key
  20228.      i          i_Key      I_Key        Tab_Key         Alt_I_Key
  20229.      j          j_Key      J_Key        Ctrl_Return_Key Alt_J_Key
  20230.      k          k_Key      K_Key        Ctrl_K_Key      Alt_K_Key
  20231.      l          l_Key      L_Key        Ctrl_L_Key      Alt_L_Key
  20232.      m          m_Key      M_Key        Return_Key      Alt_M_Key
  20233.      n          n_Key      N_Key        Ctrl_N_Key      Alt_N_Key
  20234.      o          o_Key      O_Key        Ctrl_O_Key      Alt_O_Key
  20235.      p          p_Key      P_Key        Ctrl_P_Key      Alt_P_Key
  20236.      q          q_Key      Q_Key        Ctrl_Q_Key      Alt_Q_Key
  20237.      r          r_Key      R_Key        Ctrl_R_Key      Alt_R_Key
  20238.      s          s_Key      S_Key        Ctrl_S_Key      Alt_S_Key
  20239.      t          t_Key      T_Key        Ctrl_T_Key      Alt_T_Key
  20240.      u          u_Key      U_Key        Ctrl_U_Key      Alt_U_Key
  20241.      v          v_Key      V_Key        Ctrl_V_Key      Alt_V_Key
  20242.      w          w_Key      W_Key        Ctrl_W_Key      Alt_W_Key
  20243.      x          x_Key      X_Key        Ctrl_X_Key      Alt_X_Key
  20244.      y          y_Key      Y_Key        Ctrl_Y_Key      Alt_Y_Key
  20245.      z          z_Key      Z_Key        Ctrl_Z_Key      Alt_Z_Key
  20246.  
  20247.      0          0_Key                                   Alt_0_Key
  20248.      1          1_Key                                   Alt_1_Key
  20249.      2          2_Key                                   Alt_2_Key
  20250.      3          3_Key                                   Alt_3_Key
  20251.      4          4_Key                                   Alt_4_Key
  20252.      5          5_Key                                   Alt_5_Key
  20253.      6          6_Key                                   Alt_6_Key
  20254.      7          7_Key                                   Alt_7_Key
  20255.      8          8_Key                                   Alt_8_Key
  20256.      9          9_Key                                   Alt_9_Key
  20257.  
  20258.  
  20259.  
  20260.           The JORF Manual (Shareware Disk Version)                      336
  20261.  
  20262.  
  20263.  
  20264.  
  20265.  
  20266.      Char       Normal     Shift        Ctrl            Alt
  20267.  
  20268.      F1         F1_Key     Shift-F1_Key Ctrl_F1_Key     Alt_F1_Key
  20269.      F2         F2_Key     Shift-F2_Key Ctrl_F2_Key     Alt_F2_Key
  20270.      F3         F3_Key     Shift-F3_Key Ctrl_F3_Key     Alt_F3_Key
  20271.      F4         F4_Key     Shift-F4_Key Ctrl_F4_Key     Alt_F4_Key
  20272.      F5         F5_Key     Shift-F5_Key Ctrl_F5_Key     Alt_F5_Key
  20273.      F6         F6_Key     Shift-F6_Key Ctrl_F6_Key     Alt_F6_Key
  20274.      F7         F7_Key     Shift-F7_Key Ctrl_F7_Key     Alt_F7_Key
  20275.      F8         F8_Key     Shift-F8_Key Ctrl_F8_Key     Alt_F8_Key
  20276.      F9         F9_Key     Shift-F9_Key Ctrl_F9_Key     Alt_F9_Key
  20277.      F10        F10_Key    Shift-F10_Key                Ctrl_F10_KeyAlt_F10_Key
  20278.      F11        F11_Key    Shift-F11_Key                Ctrl_F11_KeyAlt_F11_Key
  20279.      F12        F12_Key    Shift-F12_Key                Ctrl_F12_KeyAlt_F12_Key
  20280.  
  20281.      Space      Space_Bar
  20282.      !          !_Key
  20283.      "          "_Key
  20284.      #          #_Key
  20285.      $          $_Key
  20286.      %          %_Key
  20287.      &          &_Key
  20288.      '          '_Key
  20289.      (          (_Key
  20290.      )          )_Key
  20291.      *          *_Key
  20292.      +          +_Key                                   Alt_+_Key
  20293.      ,(comma)   ,_Key
  20294.      -(minus)   -_Key                                   Alt_-_Key
  20295.      .(period) ._Key
  20296.      /          /_Key
  20297.      :(colon)   :_Key
  20298.      ;(semi-colon)   ;_Key
  20299.      <          <_Key
  20300.      =          =_Key
  20301.      >          >_Key
  20302.      ?          ?_Key
  20303.      @          @_Key                                   Alt_@_Key
  20304.      [          [_Key                   Escape_Key
  20305.      \          \_Key                   Ctrl_\_Key
  20306.      ]          ]_Key                   Ctrl_]_Key
  20307.      ^ (carat) ^_Key                    Ctrl_^_Key
  20308.      _          __Key                   Ctrl___Key
  20309.      `          `_Key
  20310.      {          {_Key
  20311.      | (pipe)   |_Key
  20312.      }          }_Key
  20313.      ~ (tilde) ~_Key
  20314.  
  20315.  
  20316.  
  20317.  
  20318.  
  20319.           Appendix                                                      337
  20320.  
  20321.  
  20322.  
  20323.  
  20324.  
  20325.      Char       Normal     Shift        Ctrl            Alt
  20326.  
  20327.      Rubout     BackSpace_Key           Ctrl_BackSpace_Key
  20328.      Enter      Enter_Key               Ctrl_Enter_Key
  20329.      Tab        Tab_Key
  20330.      Escape     Esc_Key
  20331.      Back Tab   Back_Tab_Key
  20332.      Up Arrow   Up_Arrow_Key
  20333.      Down Arrow            Down_Arrow_Key
  20334.      Right Arrow           Right_Arrow_Key         Ctrl_Right_Arrow_Key
  20335.                                         Alt_Right_Arrow_Key
  20336.      Left Arrow            Left_Arrow_Key          Ctrl_Left_Arrow_Key
  20337.                                         Alt_Left_Arrow_Key
  20338.      Home       Home_Key                Ctrl_Home_Key   Alt_Home_Key
  20339.      Page Up    Page_Up_Key                             Ctrl_Page_Up_Key
  20340.                                                         Alt_Page_Up_Key
  20341.      Page Down  Page_Down_Key           Ctrl_Page_Down_Key  Alt_Page_Down_Key
  20342.      End        End_Key                 Ctrl_End_Key    Alt_End_Key
  20343.  
  20344.      Delete     Del_Key                                 Alt_Ins_Key
  20345.      Insert     Ins_Key                                 Alt_Del_Key
  20346.  
  20347.  
  20348.  
  20349.  
  20350.  
  20351.  
  20352.  
  20353.  
  20354.  
  20355.  
  20356.  
  20357.  
  20358.  
  20359.  
  20360.  
  20361.  
  20362.  
  20363.  
  20364.  
  20365.  
  20366.  
  20367.  
  20368.  
  20369.  
  20370.  
  20371.  
  20372.  
  20373.  
  20374.  
  20375.  
  20376.  
  20377.  
  20378.           The JORF Manual (Shareware Disk Version)                      338
  20379.  
  20380.  
  20381.  
  20382.  
  20383.  
  20384.  
  20385.  
  20386.  
  20387.  
  20388.  
  20389.                                       Appendix D
  20390.                                   The JORF.INI File
  20391.  
  20392.  
  20393.  
  20394.  
  20395.  
  20396.      The JORF interpreter uses a Windows style INI file to set initialization
  20397.      values.  For the DOS version, the file name is JORF.INI.  The windows
  20398.      version uses a file called JORFWIN.INI.  Compiled JORF applications have
  20399.      use a file with the same name as the program, with the extension "INI".  
  20400.  
  20401.      Thee new version of EDITINI.J allows you to set many of these features. 
  20402.      This appendix exists as a reference to each setting.
  20403.  
  20404.      There are three major sections of the ini file.  The first section controls
  20405.      operating options and video handling.  The second section controls
  20406.      printers, and the final section controls screen colors.  
  20407.  
  20408.                                 INI Operating Options
  20409.  
  20410.      These options control how the JORF interpreter operates.  Only the first
  20411.      four letters of the command are used.  You will notice that most options
  20412.      only affect DOS systems, and not Windows systems.
  20413.  
  20414.           BIOS=No             DOS Only  Use Bios Screens
  20415.           Mouse=Yes           DOS Only  Use Mouse if available
  20416.           Scroll=Yes               DOS Only  If No - doesn't use scroll
  20417.           Explode=3           DOS Only  Speed of display
  20418.           Mono=No             DOS Only  Use Mono colors 
  20419.           Multiuser=No                  Yes for Network Access
  20420.           Mem Stats=No                  Memory Details
  20421.           Ram Disk=E:\                  Use Ram Disk
  20422.  
  20423.      BIOS=No   DOS Only.   Using BIOS video display is the official way to
  20424.                handle video functions on IBM PC computers.  Many of the BIOS
  20425.                routines are very slow, however, so JORF usually uses direct
  20426.                video access.  Some computers, notably EGA systems, have enough
  20427.                differences that the video display is really whacked out.  If
  20428.                this happens, try setting BIOS=Yes  to see if the video starts
  20429.                working properly.
  20430.  
  20431.      Mouse=Yes DOS Only.  The JORF interpreter will know if you have a mouse
  20432.                active.  Some mice may have problems, so this is a way to turn
  20433.                off the mouse in JORF so you can still have a mouse driver
  20434.                loaded.  
  20435.  
  20436.  
  20437.           Appendix                                                      339
  20438.  
  20439.  
  20440.  
  20441.  
  20442.  
  20443.      Scroll=Yes     DOS Only.  I recently had a case where I suspected a
  20444.                     specific VGA card did not handle the BIOS scroll function
  20445.                     properly.  Although the use of this function speeds
  20446.                     scrolling, it is not required so I created an option in case
  20447.                     you also suspect a problem with scrolling.  You should note
  20448.                     that JORF uses the scroll function primarily to clear the
  20449.                     inside of windows.
  20450.  
  20451.      Explode=3 DOS Only.  Exploding windows are a cute feature found in the DOS
  20452.                version of JORF.  An exploding speed of 3 seems about right for
  20453.                the right video affect.  Some people dislike this, and should set
  20454.                this to be Explode=0  to have windows display without exploding.
  20455.  
  20456.      Mono=No   DOS Only.  Monochrome video override.  Normally JORF knows
  20457.                whether you have a monochrome or color monitor.  Some people have
  20458.                portables with monochrome monitors that display shades of gray.  
  20459.                On  these monitors the appearance of JORF may be enhanced if you
  20460.                set Mono=Yes to force the system into monochrome mode.
  20461.  
  20462.      Multiuser=No   DOS and Windows.  This one is really important.  If you want
  20463.                     to have multiple access  to  a file, you must set
  20464.                     Multiuser=Yes.    This includes access on DOS systems when
  20465.                     you are using a program switcher like Software Carousel, 
  20466.                     and also multiple access using Microsoft Windows.
  20467.  
  20468.                As soon as you switch Multiuser=Yes you must also take other
  20469.                action.   First, you must load SHARE.EXE so that JORF can
  20470.                properly lock the files.  You will get a nice message if you do
  20471.                not have share loaded.
  20472.  
  20473.                You should also have a disk cache program like SMARTDRV running,
  20474.                because JORF does a lot more file IO in multiuser mode (It must
  20475.                rewrite the file header after every file activity)   Even with a
  20476.                cache program running, JORF is just not as fast in multiuser mode
  20477.                as it is in single user mode. 
  20478.  
  20479.      Decimal=. DOS and Windows.  Some countries use the comma to mark the
  20480.                decimal point, and the period to mark thousands.  If you wish to
  20481.                use this notation, change the Decimal entry to "Decimal = ,".  
  20482.  
  20483.                          Decimal = .         1,234,567.89
  20484.                          Decimal = ,         1.234.567,89
  20485.  
  20486.  
  20487.                When you change decimal indicator to a comma, all numbers that
  20488.                the operator enters must be in comma decimal format.  However,
  20489.                all numbers and number formatters in the program code must be in
  20490.                American (period decimal) format.  This includes the characters
  20491.                in a the number formatter used by Num:Str.
  20492.  
  20493.                When you change the decimal indicator to a comma, all numeric
  20494.                values that were written to file as numbers will be changed. 
  20495.  
  20496.           The JORF Manual (Shareware Disk Version)                      340
  20497.  
  20498.  
  20499.  
  20500.  
  20501.  
  20502.                However, numeric values that were written to the file as strings
  20503.                while the decimal indicator was a period must be translated.  To
  20504.                translate a number stored as a string from period decimal to
  20505.                comma decimal, use the To:Num function.
  20506.  
  20507.                Programmers who wish to keep their programs internationalized
  20508.                will take care to avoid storing numbers as strings.  JORF
  20509.                normally stores numbers as numbers, so you don't really have to
  20510.                worry, just don't try to override the default numeric format.
  20511.  
  20512.      Mem Stats=No   DOS and Windows.  This option turns on memory statistics
  20513.                     reporting that I use to help me debug the memory swapping
  20514.                     system.  When you turn this mode on, your program will run
  20515.                     very slowly.  Every memory allocation and deallocation will
  20516.                     be registered, so when the program ends it can report any
  20517.                     un-deallocated buffers.  You will note that usually the
  20518.                     ending is silent, which means that I am successful in my
  20519.                     goal of deallocating every single buffer that I allocate. 
  20520.                     This mode also makes flushing more  apparent, and displays
  20521.                     the currently open file.  
  20522.  
  20523.      Ram Disk=D:\   DOS and Windows.  Since JORF uses a swap file, you can
  20524.                     optionally place this file on a RAM disk.  The RAM disk
  20525.                     should be more than 100K in size, and is best at 512K or
  20526.                     larger.   There is no control if the Ram disk becomes full
  20527.                     and the errors will probably be really ugly. The largest
  20528.                     items in the swap file are screen backgrounds, but also
  20529.                     misspelled text, the program stack, and other space bits may
  20530.                     appear here.  On multiuser systems, you may also use this to
  20531.                     point to a local drive for the swap file.
  20532.  
  20533.  
  20534.                                   INI Printer Set Up
  20535.  
  20536.      When distributed JORF programs come with my printers.  You can easily
  20537.      change them to be your own by modifying the printer set up.  Printer
  20538.      definitions are simple:  The entire line is displayed on a printer
  20539.      selection menu, and the last word is the printer designation.  
  20540.  
  20541.           Printer = Screen,    SCREEN
  20542.           Printer = File,      FILE
  20543.           Printer = HP Laser,  COM1:
  20544.           Printer = Panasonic, LPT1:
  20545.  
  20546.      The options for SCREEN and for FILE invoke special features in the
  20547.      File:Print function to display the file on screen, or rename it to a
  20548.      special file name.  
  20549.  
  20550.      To print to a printer, you the last word of the command must be PRN, AUX,
  20551.      LPT1, LPT2, COM1, or COM2 to indicate default printer, auxiliary, line
  20552.      printer one and two and serial printer one and two respectively.  
  20553.  
  20554.  
  20555.           Appendix                                                      341
  20556.  
  20557.  
  20558.  
  20559.  
  20560.  
  20561.      Under DOS, the different printing mechanisms are distinct.  The easiest and
  20562.      most robust is to print to PRN, the default printer.  To test to see if
  20563.      your printer is working, use the DOS PRINT command to print a small file.  
  20564.      The next most robust is LPT1 and LPT2.  These use a different BIOS call
  20565.      than PRN so they may not work even when PRN works just fine.  These
  20566.      commands send output to parallel printers.  Parallel printers may be
  20567.      identified by having a thick cable and a bigger-than-normal connector on
  20568.      the printer end of the cable.    
  20569.  
  20570.      Under Microsoft Windows, you must reference a printer that you have set up
  20571.      under windows.   JORF automatically searches your windows printers, and
  20572.      will not be able to print to a port without a windows printer set to that
  20573.      port.
  20574.  
  20575.                                   INI Window Colors
  20576.  
  20577.      The final section of the JORF.INI file handles the colors and style of the
  20578.      windows.  This section is more extensive in the DOS version, but also
  20579.      exists in the Windows version.  
  20580.  
  20581.      The colors I supply are specifically related to the mathematical values of
  20582.      a pixel on a color monitor.    Unfortunately these colors, especially
  20583.      background colors, are pretty ugly.   You see what you can do, and compare
  20584.      to other applications that you like to use.
  20585.  
  20586.      Colors are tied to a window background structure that has a name.  The name
  20587.      is set in the first line.  JORF uses some special backgrounds for specific
  20588.      types of windows.  Error boxes use "Error", Message boxes use "Message",
  20589.      and Menu boxes use "Menu".  You can also specify custom backgrounds using a
  20590.      window structure in the Win:Add function.   The default background is
  20591.      "Text".
  20592.  
  20593.      Window=Text                        Background name "Text"
  20594.      +Mono/Color=Mono                   Normally "Mono"
  20595.      +Line Style=double                 Thick,Double,Single,None
  20596.      +Border Color=For/Back   DOS Only  Border Color
  20597.      +Title Color=For/Back    DOS Only  Title Color
  20598.      +Shadow Color=For/Back   DOS Only  Shadow Color
  20599.      +Message Color=For/Back            Message Color
  20600.      +Normal Color=For/Back   DOS Only  Attribute 1
  20601.      +Low Color=For/Back                Attribute 2
  20602.      +Medium Color=For/Back             Attribute 3
  20603.      +High Color=For/Back               Attribute 4
  20604.      +Bold Color=For/Back               Attribute 5
  20605.  
  20606.  
  20607.      Window=Text         DOS and Windows.  Sets the name for this window
  20608.                          background structure.   All options within this
  20609.                          structure start with a plus (+) sign.
  20610.  
  20611.  
  20612.  
  20613.  
  20614.           The JORF Manual (Shareware Disk Version)                      342
  20615.  
  20616.  
  20617.  
  20618.  
  20619.  
  20620.      Mono/Color          If you wish, yo u can set up separate definitions for
  20621.                          monochrome and color monitors even if they have the
  20622.                          same name.  
  20623.  
  20624.      Line Style=         Sets the border line style.  The style can be Single,
  20625.                          Double, Thick, or None. Even if you set None there will
  20626.                          still be a border, but it will be made of space
  20627.                          characters.
  20628.  
  20629.  
  20630.      Border Color=       DOS Only.  Sets the color for the border lines, but not
  20631.                          the title at the top of the window.  The mouse "Close
  20632.                          block" is also drawn using the border color.  Under
  20633.                          Windows the border color is a system control.
  20634.  
  20635.      Title Color=        DOS Only.  Sets the color for the title.   Under
  20636.                          windows this is a system control. 
  20637.  
  20638.      Shadow Color=       DOS Only.  Sets the color for text in the shadow of a
  20639.                          window.  Under windows there are no shadows.  If you
  20640.                          set this to nothing, no shadows are displayed.
  20641.  
  20642.      Message Color=      DOS and Windows.  Sets the color used by the Win:Msg
  20643.                          function for messages.
  20644.  
  20645.      Normal Color=       DOS and Windows.  Sets the color used by normal text in
  20646.                          the window.
  20647.  
  20648.      Low Color=          DOS and Windows.  Sets the color used by Win:Att(2),
  20649.                          and also  by  inactive menu option letters.  Under
  20650.                          windows, pull down menus use the default system colors.
  20651.  
  20652.      Medium Color=       DOS and Windows.  Sets the color used by Win:Att(3),
  20653.                          and also  by  lines within menus and group boxes.
  20654.  
  20655.      High Color=         DOS and Windows.  Sets the color used by Win:Att(4),
  20656.                          and also  by  active menu lines, and inactive input
  20657.                          fields. 
  20658.  
  20659.      Bold Color=         DOS and Windows.  Sets the color used by Win:Att(5),
  20660.                          and also  by  active menu option letters, and active
  20661.                          input fields.  
  20662.  
  20663.  
  20664.  
  20665.  
  20666.  
  20667.  
  20668.  
  20669.  
  20670.  
  20671.  
  20672.  
  20673.           Appendix                                                      343
  20674.  
  20675.  
  20676.  
  20677.  
  20678.  
  20679.  
  20680.                                   Foreground Colors 
  20681.  
  20682.      Black                    Blue           Green               Cyan
  20683.      Red                      Magenta        Brown               White (Gray)
  20684.      Gray (Darker Gray)       Light Blue     Light Green         Light Cyan
  20685.      Light Red                Light Magenta  Yellow              Bright White
  20686.  
  20687.                                   Background Colors
  20688.  
  20689.      Black                    Blue           Green               Cyan
  20690.      Red                      Magenta        Brown               White (Gray)
  20691.      *Gray (Darker Gray)      *Light Blue    *Light Green        *Light Cyan
  20692.      *Light Red               *Light Magenta *Yellow             *Bright White
  20693.  
  20694.      * These background colors cannot be displayed on CGA monitors.  Instead,
  20695.      the color will blink and be really obnoxious.  Be certain your user is
  20696.      using EGA or VGA before using these colors.
  20697.  
  20698.  
  20699.  
  20700.  
  20701.  
  20702.  
  20703.  
  20704.  
  20705.  
  20706.  
  20707.  
  20708.  
  20709.  
  20710.  
  20711.  
  20712.  
  20713.  
  20714.  
  20715.  
  20716.  
  20717.  
  20718.  
  20719.  
  20720.  
  20721.  
  20722.  
  20723.  
  20724.  
  20725.  
  20726.  
  20727.  
  20728.  
  20729.  
  20730.  
  20731.  
  20732.           The JORF Manual (Shareware Disk Version)                      344
  20733.  
  20734.  
  20735.  
  20736.  
  20737.  
  20738.  
  20739.  
  20740.  
  20741.  
  20742.  
  20743.                                Appendix E - JORF Errors
  20744.  
  20745.  
  20746.  
  20747.  
  20748.  
  20749.                                      JORF Errors
  20750.  
  20751.      The following is a list of JORF errors.  When an error is displayed, the
  20752.      offending program line is also displayed.  If there is a DOS error to
  20753.      report, it is reported.
  20754.  
  20755.      In this list, the module name is identified.  This is my own reference, and
  20756.      has little meaning except to group errors with a task.  (For instance, all
  20757.      errors with a module of JDB relate to dBASE file functions.)
  20758.  
  20759.      Some errors are marked Info.  These errors are considered debugging tools,
  20760.      (for when I am debugging the interpreter) and will not be displayed unless
  20761.      you have Mem Stats=Yes in your INI file.  
  20762.  
  20763.      Some errors are marked Fatal.  These errors will cause the program to
  20764.      abort.  They cannot be trapped by any error system.  They are generally
  20765.      initialization errors (Not enough DOS memory, cannot Init CGA driver).  The
  20766.      rest are memory or data corrupt errors that you should never see.  If you
  20767.      create a program that corrupts memory and produces a fatal error, please
  20768.      send that program to me with instructions on how to reproduce the error. 
  20769.      My goal in JORF is to make it impossible to produce a fatal error.  (As
  20770.      opposed to Clipper where every error is fatal, even something so trivial as
  20771.      a type-mismatch.)
  20772.  
  20773.  
  20774.  
  20775.  
  20776.  
  20777.  
  20778.  
  20779.  
  20780.  
  20781.  
  20782.  
  20783.  
  20784.  
  20785.  
  20786.  
  20787.  
  20788.  
  20789.  
  20790.  
  20791.           Appendix                                                      345
  20792.  
  20793.  
  20794.  
  20795.  
  20796.  
  20797.      Error  Module          Description
  20798.  
  20799.      101    JCLASS          Could not delete method METHODNAME
  20800.      102    JCLASS          Could not delete method METHODNAME
  20801.  
  20802.                             Method:Del was called, but the indicated method was
  20803.                             not indexed in the JRF file. 
  20804.  
  20805.      103    JCLASS          Can't read FILENAME
  20806.  
  20807.                             Unable to read file.  See DOS error message.
  20808.  
  20809.      105    JF              Cannot open file FILENAME
  20810.  
  20811.                             Unable to open file. See DOS error message.
  20812.  
  20813.      106    JF              File FILENUMBER not found.
  20814.  
  20815.                             A record referenced a file by number, that file was
  20816.                             not found.  Files are numbered according to when
  20817.                             they are opened.  File one is always SWAPFILE.JRF
  20818.                             where the program stack and temporary variables are
  20819.                             stored.  File two is the start-up program file.
  20820.  
  20821.                             The common reason for this error is that a record
  20822.                             number was corrupted in memory.  Since the JORF
  20823.                             language does a lot of memory operations, memory
  20824.                             variables are particularly susceptible to this kind
  20825.                             of problem.  
  20826.  
  20827.                             One thing that I know makes this error happen is
  20828.                             trying to read and allocate many strings greater
  20829.                             than 10K in size. For some reason, the Borland
  20830.                             MALLOC fails (or I fail in some way) when you
  20831.                             allocate and deallocate 20K far buffers more than
  20832.                             about 50 times.  Since the JORF File read routines
  20833.                             are constantly converting buffers into JORF pointers
  20834.                             (thereby allocating memory) this causes this malloc
  20835.                             problem to appear.  
  20836.  
  20837.                             There may be other causes, and I am always striving
  20838.                             to insure that this error never happens.  If you can
  20839.                             make it happen "on-call", please send me the program
  20840.                             so I can fix the problem.  Thank-you.
  20841.  
  20842.      107    JF - Info       File 0 error record NNN
  20843.  
  20844.                             Same as 106 except that the record pointer is zero.
  20845.  
  20846.  
  20847.  
  20848.  
  20849.  
  20850.           The JORF Manual (Shareware Disk Version)                      346
  20851.  
  20852.  
  20853.  
  20854.  
  20855.  
  20856.      Error  Module          Description
  20857.  
  20858.      108    JF - Info       Delete root not deleted in FILENAME
  20859.      109    JF - Info       Delete root not deleted in FILENAME
  20860.      110    JF - Info       Bad delete root in FILENAME
  20861.  
  20862.                             These three errors appear if the program locked up
  20863.                             in single user mode.  In this mode, file headers
  20864.                             (and the delete root) are not written until the
  20865.                             program terminates normally.  Since the program did
  20866.                             not terminate normally, the delete root is
  20867.                             incorrect, and the error is simply a message that
  20868.                             the delete list will be restarted.  No data is lost,
  20869.                             just deleted buffers will not be recovered until the
  20870.                             next pack operation.
  20871.  
  20872.                             These errors are INFO errors, meaning that they will
  20873.                             only be displayed if you have Mem Status = Yes in
  20874.                             the INI file.  Because no data is lost, I felt it
  20875.                             was not necessary to display the error normally.
  20876.  
  20877.                             Having this error occur on a file that was closed
  20878.                             properly means that the information written to file
  20879.                             is corrupt, which is a true error, but corrupted
  20880.                             files will exhibit other errors that will be
  20881.                             reported. 
  20882.  
  20883.      111    JF - Fatal      Illegal record flag at POS in FILENAME
  20884.  
  20885.                             Corrupted file.  If this is a program file, erase
  20886.                             the JRF file and reload from the source.  If this is
  20887.                             a data file, rebuild the file using the -R flag:
  20888.  
  20889.                                JORF CLASSNAME -R FILENAME
  20890.  
  20891.                             The CLASSDEF must be the program file that contains
  20892.                             the class definitions for the indexes.  There may be
  20893.                             more than one CLASSDEF file, and these files are not
  20894.                             rebuilt. Every file named after -R is rebuilt.
  20895.  
  20896.      112    JF - Info       Attempt to read deleted record in FILENAME
  20897.  
  20898.                             Normally you don't see this because it is an INFO
  20899.                             error.  However, I have found some combinations of
  20900.                             array pointers to structures, and structure pointers
  20901.                             to arrays, where the automatic garbage collection
  20902.                             function during the flush operation was deleting a
  20903.                             little too much data, and the symptom was this error
  20904.                             when the program tried to reference the cleaned
  20905.                             data.  If you have a recurring case where this is a
  20906.                             problem.  Please send me the program.  Thank-You.
  20907.  
  20908.  
  20909.           Appendix                                                      347
  20910.  
  20911.  
  20912.  
  20913.  
  20914.  
  20915.      Error  Module          Description
  20916.  
  20917.      113    JF              File FILENAME not locked
  20918.  
  20919.                             Record locking must not be working properly on your
  20920.                             system or network.  Please contact me to help me get
  20921.                             the locking working correctly.  Naturally, I have
  20922.                             been too poor to buy every network to test this
  20923.                             product.
  20924.  
  20925.      115    JF - Info       Record 0 Error in FILENAME
  20926.  
  20927.                             Data corrupt, see 106.
  20928.  
  20929.      114    JF              File FILENUMBER not found
  20930.  
  20931.                             Data corrupt, see 106.
  20932.  
  20933.      116    JBLOCK          Can't read FILENAME
  20934.  
  20935.                             Block read, incorrect file name.  See DOS error.
  20936.  
  20937.      117    JBLOCK          Can't open FILENAME for block write
  20938.      118    JBLOCK          Can't write block to FILENAME
  20939.  
  20940.                             Block write, could not open.  See DOS error.
  20941.  
  20942.      119    JBLOCK          Unknown Win:Block command COMMAND
  20943.  
  20944.                             See reference guide for valid command strings.
  20945.  
  20946.      121    JCLASSDI        Can't write to DATAPATH
  20947.  
  20948.                             Attempted to write program file, but couldn't.  See
  20949.                             DOS error.
  20950.  
  20951.      122    JFILE - Info    Can't free FILENAME
  20952.  
  20953.                             Unable to clean up after method that accessed a new
  20954.                             file.  I've never seen this one, and you shouldn't
  20955.                             either.  As usual, if you see this at all, please
  20956.                             send me the program so I can investigate.  May be a
  20957.                             memory corrupt, see 106.
  20958.  
  20959.      123    JFILE            Can't open file FILENAME
  20960.  
  20961.                             Could be illegal character in the name, or a sharing
  20962.                             violation. See DOS error.
  20963.  
  20964.      128    JFOPEN          Can't close file FILENAME
  20965.  
  20966.                             Tell me.  Should never happen.  See DOS error.
  20967.  
  20968.           The JORF Manual (Shareware Disk Version)                      348
  20969.  
  20970.  
  20971.  
  20972.  
  20973.  
  20974.      Error  Module          Description
  20975.  
  20976.      129    JFRENAME        Cannot rename file FILENAME
  20977.  
  20978.                             Probably illegal character or sharing violation, See
  20979.                             DOS error.
  20980.  
  20981.      130    JFOPEN          Cannot back up file FILENAME
  20982.  
  20983.                             File:Backup failed, see DOS error.
  20984.  
  20985.      131    JFOPEN - Info   Cannot unlink file
  20986.  
  20987.                             Memory corrupt?  See 106.
  20988.  
  20989.      133    JFOPEN          Could not read file buffer length LENGTH
  20990.      134    JFOPEN          Could not read file buffer length LENGTH
  20991.  
  20992.                             See DOS error.  Mostly indicates a case where the
  20993.                             program wants to read 512 bytes, and DOS only gives
  20994.                             back 422 bytes or something.
  20995.  
  20996.      135    JFOPEN - Info   Cannot resize file FILENAME
  20997.  
  20998.                             Could not reset size of file.  See DOS error.
  20999.  
  21000.      136    JFOPEN - Info   Seek error byte POS
  21001.      137    JFOPEN - Info   Cannot seek to byte POS in file FILENAME
  21002.      138    JFOPEN          Cannot seek file FILENAME
  21003.  
  21004.                             Usually memory corrupt (see 106) causes a record
  21005.                             pointer to come out with an outrageous record
  21006.                             position (like 100 gigabytes past the beginning of
  21007.                             the file).  The Position is the seek-to position, so
  21008.                             you can see whether this is the case.  
  21009.  
  21010.                             I have also seen this error in cases where a program
  21011.                             deleted an active data file while there were active
  21012.                             pointers to that file. 
  21013.  
  21014.  
  21015.  
  21016.  
  21017.  
  21018.  
  21019.  
  21020.  
  21021.  
  21022.  
  21023.  
  21024.  
  21025.  
  21026.  
  21027.           Appendix                                                      349
  21028.  
  21029.  
  21030.  
  21031.  
  21032.  
  21033.      Error  Module          Description
  21034.  
  21035.      139    JFOPEN          Record size SIZE is too long, limit MAX in file
  21036.  
  21037.                             There is a limit to the largest buffer you can read
  21038.                             in JORF.  It changes, and is closely linked to my
  21039.                             problems with Borland Malloc/Free failing when you
  21040.                             thrash around with buffers greater than 10K.  For
  21041.                             that reason, 2.1 is shipping with a max file buffer
  21042.                             size of 10K.  However, if Borland fixes this
  21043.                             problem, I want to increase the buffer size to 32K.
  21044.  
  21045.                             If you need to read a large buffer, why not find a
  21046.                             way to map the file into 5K chunks and read in 5K
  21047.                             segments.   
  21048.  
  21049.      140    JFOPEN          Cannot Read in file FILENAME.
  21050.  
  21051.                             We asked DOS to read 512 bytes, but DOS only gave us
  21052.                             422 or some other number.  See DOS error.
  21053.  
  21054.      141    JFOPEN          Record size SIZE is too long, limit MAX in file
  21055.  
  21056.                             Same as 139 except this one is when you are writing
  21057.                             a file.
  21058.  
  21059.      142    JFOPEN          Cannot write to file FILENAME
  21060.  
  21061.                             Same as 140 exept when writing a file.  See DOS
  21062.                             error.
  21063.  
  21064.      150    JINI            INI: Unknown color COLOR
  21065.  
  21066.                             See Appendix D for legal color names.
  21067.  
  21068.      151    JINI - Fatal    INI: Unknown command COMMAND
  21069.      152    JINI - Fatal    INI: Equal sign required COMMAND
  21070.      153    JINI - Fatal    INI: unknown command: COMMAND
  21071.  
  21072.                             The first thing the program does is read the INI
  21073.                             file to get settings.  In this case, there was an
  21074.                             incorrect command in the INI file.  You will have to
  21075.                             correct the displayed command.
  21076.  
  21077.      154    JINI - Fatal    INI: Cannot read file FILENAME
  21078.  
  21079.                             If the file were simply not found, a default INI
  21080.                             file is written and no error appears.  This error
  21081.                             indicates that the INI file is there, but somehow
  21082.                             locked so it cannot be read.  See DOS error. 
  21083.  
  21084.  
  21085.  
  21086.           The JORF Manual (Shareware Disk Version)                      350
  21087.  
  21088.  
  21089.  
  21090.  
  21091.  
  21092.      Error  Module          Description
  21093.  
  21094.      155    JINI - Fatal    INI: Cannot use multiuser mode without SHARE.EXE. 
  21095.      156    JINI - Fatal    INI: To run another instance of JORF you must set
  21096.                             'Multiuser=Yes' in the INI file
  21097.  
  21098.                             These two are related.  The second appears under
  21099.                             Windows if you try to load the same JORF module
  21100.                             twice.  The first appears if you try to run
  21101.                             Multiuser = Yes without SHARE.EXE loaded.  If you
  21102.                             want to run in multi-user mode, you must load SHARE. 
  21103.                             See your DOS manual for further instructions on
  21104.                             SHARE.
  21105.  
  21106.      157    JINI - Fatal    INI: Cannot write file FILENAME
  21107.  
  21108.                             When no INI file is found, a default INI file is
  21109.                             written.  This error means that you do not have
  21110.                             write permission on the current directory.  Check
  21111.                             your network rights. 
  21112.  
  21113.      200    JM - Fatal      Cannot load cache
  21114.  
  21115.                             Ran out of memory on a very basic start-up
  21116.                             operation.  Check memory.
  21117.  
  21118.      201    JFLUSH - Fatal  Cannot reload memory
  21119.      202    JFLUSH - Fatal  NDEL buffer exceeded
  21120.  
  21121.                             These are equivalent to an out-of-memory in a
  21122.                             language like C.  In this case, the virtual memory
  21123.                             system's tables are being exceeded because you have
  21124.                             a) too deep a stack, b) too many items in the stack,
  21125.                             c) too many functions compiled in a application or
  21126.                             d) something else.  While I have tried to adjust
  21127.                             these tables so that you will never see these
  21128.                             errors, the can occur and that means the table sizes
  21129.                             need further adjustment.
  21130.  
  21131.                             Naturally, I want this program to work for you.  If
  21132.                             you see either of these errors, please send me the
  21133.                             program and I will try to adjust the table size to
  21134.                             accommodate your needs.
  21135.  
  21136.      220    JDB  Cannot create index NTXNAME
  21137.  
  21138.                             Probably a bad file name or sharing violation, see
  21139.                             DOS error.
  21140.  
  21141.      221    JDB  File FILENAME is not dBASE III
  21142.  
  21143.                             JORF cannot handle dBASE IV files.
  21144.  
  21145.           Appendix                                                      351
  21146.  
  21147.  
  21148.  
  21149.  
  21150.  
  21151.      Error  Module          Description
  21152.  
  21153.      222    JDB  File FILENAME not mapped in function
  21154.  
  21155.                             You attempted a DB operator without mapping the file
  21156.                             as a dBASE file.  The mapping is required before you
  21157.                             can read or write to a dBASE file.
  21158.  
  21159.      223    JDB  File FILENAME not found. Use Db:Create to create it.
  21160.  
  21161.                             File not found.  
  21162.  
  21163.      224    JDB  Cannot open FILENAME
  21164.  
  21165.                             File was found, but could not be opened.  Locking? 
  21166.                             Out of handles?  See DOS error.
  21167.  
  21168.  
  21169.      225    JDB  Cannot find file DBTNAME
  21170.      226    JDB  Cannot open file DBTNAME
  21171.  
  21172.                             Found the DBF file, but not the matching DBT file. 
  21173.                             Whenever you copy a DBF with memo fields, you must
  21174.                             also copy the DBT file. 
  21175.  
  21176.      227    JDB  NTX Order number too high
  21177.  
  21178.                             Attempt to DB:SetOrder to an index number too high. 
  21179.                             If you have three NTX file, you cannot
  21180.                             DB:SetOrder(4) because there is no NTX number four. 
  21181.                             That is all.
  21182.  
  21183.      228    JNTX Underflow count COUNT at POS
  21184.      229    JT              Underflow count COUNT at POS
  21185.  
  21186.                             File corrupt.  In error 228 it is with an NTX file. 
  21187.                             In error 229 it is in a JRF file.  The file must be
  21188.                             rebuilt.
  21189.  
  21190.      280    JPACK           Can't write to pack file FILENAME
  21191.      281    JPACK           Can't read pack file FILENAME
  21192.  
  21193.                             Problems during JORF Rebuild.  See DOS error. 
  21194.  
  21195.      282    JPACK           Can't find count in pack file FILENAME.
  21196.  
  21197.                             Problems reading pack file, or pack file is wrong
  21198.                             format.  See DOS error.
  21199.  
  21200.      283    JPACK           Cannot rebuild swap file
  21201.  
  21202.                             The SWAPFILE.JRF file cannot be packed.
  21203.  
  21204.           The JORF Manual (Shareware Disk Version)                      352
  21205.  
  21206.  
  21207.  
  21208.  
  21209.  
  21210.      Error  Module          Description
  21211.  
  21212.      284    JPACK           Cannot rebuild active program
  21213.  
  21214.                             To rebuild a program file, write the source, erase
  21215.                             the JRF file, and the interpreter will automatically
  21216.                             re-read the source.  You cannot rebuild a source
  21217.                             file using JORF:REBUILD.
  21218.  
  21219.      301    JCALL           Too many ops
  21220.  
  21221.                             In a compiled application a JMATH() call had too
  21222.                             many operations.  Please keep each math expression
  21223.                             simple.
  21224.  
  21225.      302    JIF   Misplaced 'else'
  21226.  
  21227.                             Found ELSE with no matching IF statement.
  21228.  
  21229.      303    JIF  Use "thru" not "to"
  21230.      304    JIF  Bad syntax for "=" in For function
  21231.      305    JIF  Missing value ENDVALUE in For function
  21232.      306    JIF  Lost value ENDVALUE in For function
  21233.  
  21234.                             In a FOR () statement there was a syntax error. 
  21235.                             Basic programmers will get the first one a lot,
  21236.                             until you understand how incorrect "To" can be. 
  21237.                             (When you say For (i = 1 to 10) do you mean to end
  21238.                             at 9 or 10?)
  21239.  
  21240.      310    JFMAP           Illegal file map type MAPTYPE
  21241.  
  21242.                             See reference section for File:Map for list of legal
  21243.                             file types.  You must have misspelled something
  21244.                             here.
  21245.  
  21246.      312    JFMAP           Missing file map for FILENAME
  21247.  
  21248.                             A dBASE file requires a map before you can create
  21249.                             it.  You can read the file without a map, because
  21250.                             the file will be mapped from the file header, but
  21251.                             you cannot create a file you have not yet defined. 
  21252.  
  21253.      313    JFMAP           Map width WID is too long, limit MAX in file.
  21254.  
  21255.                             There is a limit to buffer size.  See Error 139.
  21256.  
  21257.  
  21258.  
  21259.  
  21260.  
  21261.  
  21262.  
  21263.           Appendix                                                      353
  21264.  
  21265.  
  21266.  
  21267.  
  21268.  
  21269.      Error  Module          Description
  21270.  
  21271.      320    JMALLOC - Fatal             Out of Memory
  21272.  
  21273.                             Dead!  The virtual memory system should keep this
  21274.                             from happening.  Getting this error means that you
  21275.                             have circumvented the automatic heap checking system
  21276.                             and caused the program to allocate more memory than
  21277.                             is available.
  21278.  
  21279.                             Check DOS memory.  If you have only 540K or less
  21280.                             free, you can probably fix this by clearing enough
  21281.                             AUTOEXEC stuff to get 560K free.  Try removing
  21282.                             ANSI.SYS, and any TSR programs that use a lot of
  21283.                             memory.  Under DOS 5.0 you can examine memory using
  21284.                             the MEM command (see your DOS manual).  
  21285.  
  21286.                             If you have a known operation that will use a lot of
  21287.                             memory (like reading a 10K record buffer)  you may
  21288.                             want to do a partial memory flush ahead of time. 
  21289.                             Try Jorf:Flush(50) before this operation, to flush
  21290.                             memory if there is not 50K available.
  21291.  
  21292.                             The reason you may need 50K is that the buffer takes
  21293.                             10K, when the buffer is turned into a JORF pointer
  21294.                             uses 10K, and 30K free space is not unreasonable for
  21295.                             the other tasks like executing the next program line
  21296.                             or calling another function.  
  21297.  
  21298.      321    JMALLOC - Fatal             Address zero changed
  21299.  
  21300.                             I usually compile this one out before distribution,
  21301.                             so you will not see it.  Because JORF is written in
  21302.                             C, and null pointers in C cause address zero to
  21303.                             change, I have a running check of the value to make
  21304.                             sure JORF is well behaved.  
  21305.  
  21306.  
  21307.  
  21308.  
  21309.  
  21310.  
  21311.  
  21312.  
  21313.  
  21314.  
  21315.  
  21316.  
  21317.  
  21318.  
  21319.  
  21320.  
  21321.  
  21322.           The JORF Manual (Shareware Disk Version)                      354
  21323.  
  21324.  
  21325.  
  21326.  
  21327.  
  21328.      Error  Module          Description
  21329.  
  21330.      324    JMALLOC - Fatal             Cannot unlink memory!
  21331.      325    JMALLOC - Info  Bad free offset from LOCATION
  21332.      326    JMALLOC - Info  Buffer already freed: LOCATION at LOCATION
  21333.      328    JMALLOC - Info  Buffer overrun:  LOCATION at LOCATION
  21334.  
  21335.                             To see any of these you need Mem Status = Yes in
  21336.                             your INI file.  These are things I watch as I
  21337.                             develop each command, to try to ferret out memory
  21338.                             corruption problems.
  21339.  
  21340.                             With Mem Status = Yes the Malloc buffers are linked
  21341.                             into a list, so that when the program ends I can be
  21342.                             sure that every buffer has been freed (a sign that
  21343.                             all buffers are written properly.)  the Cannot
  21344.                             Unlink error used to mean that a buffer was
  21345.                             allocated wrong, but lately I only see it associated
  21346.                             with general memory corruptions caused by reading
  21347.                             20K buffers from file.  (Shrinking the max buffer
  21348.                             size eliminated the problem, hence the limit in
  21349.                             Error 139)
  21350.  
  21351.                             Compiled Windows Programs exhibiting these errors
  21352.                             should check the STACKSIZE command in the DEF file. 
  21353.                             These errors are a symptom of a stack/heap crash,
  21354.                             and shrinking the STACKSIZE may help this problem.
  21355.  
  21356.                             All Mallocs and Frees under JORF are labeled with
  21357.                             short strings for identification, so "Buffer Already
  21358.                             Freed JARR at JFR" tells me that the buffer was
  21359.                             allocated as a structure (JARR) and was being
  21360.                             deallocated by the general JORF Pointer free routine
  21361.                             (JFR).  This system helps me track memory problems.
  21362.  
  21363.      329    JMALLOC - Fatal             Out of Memory
  21364.  
  21365.                             Same as 320 except with near heap, not far.
  21366.  
  21367.      330    JMALLOC - Info              Buffer already freed: LOCATION at
  21368.      LOCATION
  21369.      331    JMALLOC - Info              Buffer overrun:     LOCATION at LOCATION
  21370.  
  21371.                             Same as 326 and 328 except with near heap, not far.
  21372.  
  21373.      332    JMALLOC - Fatal             Insufficient DOS Memory
  21374.  
  21375.                             You gotta have 560K free to run JORF well.  On an
  21376.                             old XT computer, you need to be running DOS 3.3 or
  21377.                             lower with few TSR programs.   On AT and 386
  21378.                             computers, you need to load DOS high to free up
  21379.                             enough memory.
  21380.  
  21381.           Appendix                                                      355
  21382.  
  21383.  
  21384.  
  21385.  
  21386.  
  21387.  
  21388.  
  21389.  
  21390.  
  21391.  
  21392.  
  21393.  
  21394.  
  21395.  
  21396.  
  21397.  
  21398.  
  21399.  
  21400.  
  21401.  
  21402.  
  21403.  
  21404.  
  21405.  
  21406.  
  21407.  
  21408.  
  21409.  
  21410.  
  21411.  
  21412.  
  21413.  
  21414.  
  21415.  
  21416.  
  21417.  
  21418.  
  21419.  
  21420.  
  21421.  
  21422.  
  21423.  
  21424.  
  21425.  
  21426.  
  21427.  
  21428.  
  21429.  
  21430.  
  21431.  
  21432.  
  21433.  
  21434.  
  21435.  
  21436.  
  21437.  
  21438.  
  21439.  
  21440.           The JORF Manual (Shareware Disk Version)                      356
  21441.  
  21442.  
  21443.  
  21444.  
  21445.  
  21446.      Error  Module          Description
  21447.  
  21448.      334    JARRINI         Cannot exceed WORDMAX elements in structure or line
  21449.  
  21450.                             There is a limit to the number of elements in a
  21451.                             structure.  I change it around, but currently it is
  21452.                             256 or 512 depending on my mood.  A structure can
  21453.                             always point to a sub-structure to increase the
  21454.                             number of elements infinitely.
  21455.  
  21456.      401    JWRITE          Attempt to write stack
  21457.  
  21458.                             You got some mixed up pointer here.  Tell me how you
  21459.                             did it.
  21460.  
  21461.  
  21462.      402    JWRITE          Bad flag in newcopy
  21463.  
  21464.                             Probably a file corruption.  Rebuild it.
  21465.  
  21466.      404    JREAD            Lost text top
  21467.  
  21468.                             Text is sparse in memory.  This means that in memory
  21469.                             is the current line of text, and the top line of
  21470.                             text, but maybe not all lines in between.  This
  21471.                             system allows access to text that is longer than
  21472.                             available memory size.
  21473.  
  21474.                             Something has happened so the current line is still
  21475.                             available, but the top line has been deleted.  Tell
  21476.                             me how you did it, and I will fix it.  You should
  21477.                             never see this error.
  21478.  
  21479.      405    JREAD           Bad record
  21480.      406    JREAD           Bad word count
  21481.  
  21482.                             Read a record from the data file and it was not what
  21483.                             it should have been.  Something has overwritten this
  21484.                             part of the file or something.  Try rebuilding.
  21485.  
  21486.      408    JREAD           Cannot read line LINEPOS of text
  21487.  
  21488.                             Something has happened to text where a line does not
  21489.                             exist.  This is pretty difficult, and may be related
  21490.                             to a data corruption.  Use to be you could do this
  21491.                             by block moving or deleting so that the text was
  21492.                             really shifted around.  This should all be fixed
  21493.                             now.  If not, tell me.
  21494.  
  21495.  
  21496.  
  21497.  
  21498.  
  21499.           Appendix                                                      357
  21500.  
  21501.  
  21502.  
  21503.  
  21504.  
  21505.      Error  Module          Description
  21506.  
  21507.      602    JMARRAY         Illegal brackets for array
  21508.      604    JMARRAY         Missing [ in array
  21509.  
  21510.                             Array index must have one [ left bracket and one ]
  21511.                             right bracket.
  21512.  
  21513.      605    JMBINARY        Illegal unary operation
  21514.  
  21515.                             Unary operations are ++a, --p, or negation.  You
  21516.                             tried something that is not legal.  Stick to the
  21517.                             legal ones please.
  21518.  
  21519.      606    JMARRAY         Not an Array
  21520.      607    JMENUARR        Not an Array in "Arr:Pick".
  21521.  
  21522.                             Arr:Sort and Arr:Pick require arrays.  One way to
  21523.                             check before this error appears is to be sure that
  21524.                             Arr:Len is greater than one.
  21525.  
  21526.      702    JA              Unable to move SOURCE to DEST
  21527.  
  21528.                             Some problem with the obscure Jorf:Move function.
  21529.  
  21530.      708    JFNC Can't find Class: CLASSNAME
  21531.  
  21532.                             Class definition is not found in any of the
  21533.                             currently opened files.
  21534.  
  21535.      710    JA              Can't find METHODNAME
  21536.  
  21537.                             Method is not found in any of the currently opened
  21538.                             files.
  21539.  
  21540.      711    JA              Attempt to seek null element in class CLASSNAME
  21541.                             The Member label is null for some reason, like to
  21542.                             said A->"" = B or something.
  21543.  
  21544.      712    JA              Element MEMBERNAME is not a member of Class
  21545.                             CLASSNAME
  21546.      713    JA              Element MEMBERNAME is not a member of Class
  21547.                             CLASSNAME
  21548.  
  21549.                             Attempt to assign a member that is not in class
  21550.                             defintion.  Only the JORF class can take any member
  21551.                             name, other classes must have all members declared
  21552.                             in the class definition.
  21553.  
  21554.      714    JA              Attempt to seek null element in class CLASSNAME
  21555.  
  21556.                             See 711.
  21557.  
  21558.           The JORF Manual (Shareware Disk Version)                      358
  21559.  
  21560.  
  21561.  
  21562.  
  21563.  
  21564.      Error  Module          Description
  21565.  
  21566.      715    JA              Assignment of stack
  21567.  
  21568.                             See 401
  21569.  
  21570.      716    JA              Element MEMBERNAME is not a member of Class
  21571.                             CLASSNAME
  21572.  
  21573.                             See 713
  21574.  
  21575.      716    JCPY Bad word data
  21576.  
  21577.                             Some kind of memory corruption.  This one is usually
  21578.                             pretty regular.  Please send me the program, because
  21579.                             this can be easily fixed once I see how you produce
  21580.                             it.
  21581.  
  21582.      721    JMAGIC          Mismatched brackets in EXPRESSION
  21583.  
  21584.                             Curly brackets must be in sets.  To print a curly
  21585.                             bracket with magic on, print it as a constant {"{"}.
  21586.  
  21587.      722    JMAGIC          Exceeded buffer size (512 Bytes)
  21588.  
  21589.                             Buffers with curly brackets cannot be longer than
  21590.                             512 bytes.
  21591.  
  21592.      720    JTRACE          Too many break points
  21593.  
  21594.                             You can only set about 10 break points while
  21595.                             debugging a program (or is it 20? can't decide). 
  21596.                             Try unsetting one or two.
  21597.  
  21598.      723    JPARSE          Mismatched parentheses: EXPRESSION
  21599.  
  21600.                             Expressions must have matched parentheses.
  21601.  
  21602.      730    JWPARSE         Unknown window item ITEM
  21603.  
  21604.                             Perhaps you window definition got so long that you
  21605.                             got confused and did not outdent the next program
  21606.                             line.  
  21607.  
  21608.      731    JWPARSE - Fatal             Exceeded count
  21609.  
  21610.                             Unlikely to ever see this, but it has to do with the
  21611.                             count of prompted items in hypertext.  Send program
  21612.                             if you see this at all. I will fix.
  21613.  
  21614.      741    JI              Unknown variable or method LABEL
  21615.  
  21616.  
  21617.           Appendix                                                      359
  21618.  
  21619.  
  21620.  
  21621.  
  21622.  
  21623.                             Couldn't even decide if this is a Method, Variable
  21624.                             or Function call.
  21625.  
  21626.  
  21627.  
  21628.  
  21629.  
  21630.  
  21631.  
  21632.  
  21633.  
  21634.  
  21635.  
  21636.  
  21637.  
  21638.  
  21639.  
  21640.  
  21641.  
  21642.  
  21643.  
  21644.  
  21645.  
  21646.  
  21647.  
  21648.  
  21649.  
  21650.  
  21651.  
  21652.  
  21653.  
  21654.  
  21655.  
  21656.  
  21657.  
  21658.  
  21659.  
  21660.  
  21661.  
  21662.  
  21663.  
  21664.  
  21665.  
  21666.  
  21667.  
  21668.  
  21669.  
  21670.  
  21671.  
  21672.  
  21673.  
  21674.  
  21675.  
  21676.           The JORF Manual (Shareware Disk Version)                      360
  21677.  
  21678.  
  21679.  
  21680.  
  21681.  
  21682.      Error  Module          Description
  21683.  
  21684.      742    JI              Don't know how to COMMAND
  21685.  
  21686.                             Decided this was a Method or Function, but don't
  21687.                             know how to call it (cannot find it).
  21688.  
  21689.      743    JI              Too many parameters (limit 10) in function call
  21690.  
  21691.                             Currently a limit of 10 parameters.
  21692.  
  21693.      744    JI - Fatal      Lost name, now METHODNAME
  21694.  
  21695.                             A speed optimization has gone awry.  Send me the
  21696.                             program.
  21697.  
  21698.      745    JI              Cannot find method METHODNAME
  21699.  
  21700.                             Program knows it is a method, but cannot find it in
  21701.                             any of the currently opened program files.
  21702.  
  21703.      747    JI              New is not at method top
  21704.  
  21705.                             New() must be the first line of the method. 
  21706.  
  21707.      801    JMESSAGE        Unknown message type MESSAGETYPE
  21708.  
  21709.                             See Msg:Add for list of valid types.
  21710.  
  21711.      802    JS              Can't set attribute ATTRIBUTE
  21712.  
  21713.                             See Win:Attr for valid Attribute syntax.
  21714.  
  21715.      805    JS              Can't set justification FLRCO
  21716.  
  21717.                             See Win:FLRCO for valid FLRCO letters.  I'll give
  21718.                             you a hint - they are F-L-R-C and O!
  21719.  
  21720.      808    JSADD           Too many windows, limit 512
  21721.  
  21722.                             Mike B. Memorial error message.  His first program
  21723.                             displayed 3000 empty windows, ran out of memory. 
  21724.                             Limiting to 512 windows "fixed" the problem.
  21725.  
  21726.      809    JSINP           Input line too long (512 character max)
  21727.  
  21728.                             Single line inputs cannot exceed 512 characters.
  21729.  
  21730.  
  21731.  
  21732.  
  21733.  
  21734.  
  21735.           Appendix                                                      361
  21736.  
  21737.  
  21738.  
  21739.  
  21740.  
  21741.      Error  Module          Description
  21742.  
  21743.      812    JSL - Fatal     Graphic error: GRAPH_ERR_MESSAGE
  21744.  
  21745.                             The GRAPH_ERR_MESSAGE should tell you more.  Usually
  21746.                             a missing BGI file or something.  Only the VGA
  21747.                             driver is compiled into the JORF386 program, so if
  21748.                             you are using 8512 or SVGA there could be problems
  21749.                             in graphics mode.
  21750.  
  21751.      813    JSLBKD - Fatal  Cannot allocate background buffer
  21752.  
  21753.                             You know there is a lotta bits in a graphics window,
  21754.                             so when storing the background buffer the program
  21755.                             must malloc and free some big buffers. If there is a
  21756.                             mis-allocation, you will see this error.  Try to run
  21757.                             with more free memory.
  21758.  
  21759.      814    JSLBOX - Fatal  Out of windows memory
  21760.  
  21761.                             Actually, not memory but just displaying problems. 
  21762.                             Could not create a new window.
  21763.  
  21764.      820    JSLCARET        Attempt to create caret without focus
  21765.  
  21766.                             Isn't Windows lingo fun?  Just tell me how you did
  21767.                             it and I will try to fix it.  It is, naturally,
  21768.                             illegal to create your caret if you don't have
  21769.                             focus.
  21770.  
  21771.      821    JSLCARET - Fatal            Image size too large
  21772.  
  21773.                             The blinking cursor image is bigger than the image
  21774.                             buffer.  I am making the buffer big enough now for
  21775.                             all known cursor sizes, so if you see this, I will
  21776.                             need to go bigger than that.  (Tell me what you have
  21777.                             - Super Super VGA?)
  21778.  
  21779.      82     JSLCARET        Attempt to destroy caret without focus
  21780.  
  21781.                             See 820.
  21782.  
  21783.      823    JSLFLUSH        Call to DestroyWindow failed
  21784.  
  21785.                             Microsoft nicely document that DestroyWindow can
  21786.                             fail, but did not say why.  
  21787.  
  21788.  
  21789.  
  21790.  
  21791.  
  21792.  
  21793.  
  21794.           The JORF Manual (Shareware Disk Version)                      362
  21795.  
  21796.  
  21797.  
  21798.  
  21799.  
  21800.      Error  Module          Description
  21801.  
  21802.      824    JSLVMODE - Fatal            Could not register driver
  21803.      825    JSLVMODE - Fatal            Could not register driver
  21804.      826    JSLVMODE - Fatal            CGA graphics not supported
  21805.      827    JSLVMODE - Fatal            PC3270 graphics not supported
  21806.      828    JSLVMODE - Fatal            IBM8514 graphics not supported
  21807.  
  21808.                             First of all, you have GRAPHICS=Yes in your INI
  21809.                             file.  You can make these errors go away if you set
  21810.                             the INI back to GRAPHICS=NO mode.
  21811.  
  21812.                             Second, only VGA graphics is currently supported by
  21813.                             an internal driver.  If you need CGA or 8514
  21814.                             graphics, you must put the appropriate BGI driver on
  21815.                             your JORF directory.  BGI drivers are supplied by
  21816.                             Borland in their Turbo C++ and Borland C++ products.
  21817.  
  21818.      910    JPRINT          Can't print to PRINTER
  21819.      911    JPRINT          Couldn't access PRN
  21820.      912    JPRINT          Printed incomplete string to PRN
  21821.      913    JPRINT          Invalid LPT Printer
  21822.      914    JPRINT          Printer timed out
  21823.      915    JPRINT          Printer out of paper
  21824.      916    JPRINT          Invalid COM Printer
  21825.      917    JPRINT          Can't Print to COM
  21826.      918    JPRINT          Unable to access windows printer PRINTER
  21827.      919    JPRINT          Cannot print file FILENAME
  21828.  
  21829.                             See DOS error, check printer name.
  21830.  
  21831.      920    JREPORT         Unknown Report Item ITEMNAME
  21832.  
  21833.                             See Reference section for Rep:Add. The parser
  21834.                             encountered a command that is not valid.
  21835.  
  21836.      921    JREPORT         Cannot open JREPORT.LST
  21837.  
  21838.                             All reports are written to an output file called
  21839.                             JREPORT.LST.  Something is keeping this file from
  21840.                             being created.  See DOS Error.
  21841.  
  21842.  
  21843.  
  21844.  
  21845.  
  21846.  
  21847.  
  21848.  
  21849.  
  21850.  
  21851.  
  21852.  
  21853.           Appendix                                                      363
  21854.  
  21855.  
  21856.  
  21857.  
  21858.  
  21859.      Error  Module          Description
  21860.  
  21861.      1101   JSYSTEM         Process is busy
  21862.      1102   JSYSTEM         Cannot register Exec class
  21863.      1103   JSYSTEM         Cannot create Exec window
  21864.      1104   JSYSTEM         Cannot register notify proc
  21865.      1106   JSYSTEM         Cannot find Exec task handle
  21866.      1107   JSYSTEM         Error executing "COMMAND"
  21867.  
  21868.                             Windows did not how I set up the Jorf:System()
  21869.                             command.  Please tell me what you are trying to run,
  21870.                             and I will try to investigate.  I program Windows,
  21871.                             but I don't have to like it.
  21872.  
  21873.      1110   JSYSTEM         WINDOWS_MESSAGE executing: COMMAND
  21874.  
  21875.                             Windows did not like your Jorf:System() command. 
  21876.                             Hopefully the MESSAGE it gives back will tell you
  21877.                             what you need to know.  Here is a list of messages:
  21878.  
  21879.                                         Out of memory or Exe file corrupt
  21880.                                         File not found
  21881.                                         Sharing error
  21882.                                         Library required separate data segments
  21883.                                         Out of memory
  21884.                                         Incorrect Windows version
  21885.                                         Invalid Executable file
  21886.                                         App was designed for a different
  21887.                                         Operating System
  21888.                                         App was designed for MS-DOS 4.0
  21889.                                         Type of Executable file unknown
  21890.                                         Cannot load a real-mode application
  21891.                                         Cannot load this program twice
  21892.                                         Cannot load compressed EXE file
  21893.                                         DLL file invalid or corrupt
  21894.                                         App requires 32-bit extensions
  21895.                                         Windows Exec error
  21896.  
  21897.  
  21898.  
  21899.  
  21900.  
  21901.  
  21902.  
  21903.  
  21904.  
  21905.  
  21906.  
  21907.  
  21908.  
  21909.  
  21910.  
  21911.  
  21912.           The JORF Manual (Shareware Disk Version)                      364
  21913.  
  21914.  
  21915.  
  21916.  
  21917.  
  21918.  
  21919.  
  21920.  
  21921.  
  21922.  
  21923.                                Appendix F - DOS Errors
  21924.  
  21925.  
  21926.  
  21927.  
  21928.                                       DOS Errors
  21929.  
  21930.      The following is a list of DOS errors.  DOS errors are almost always
  21931.      related to "Device" operation, like reading from a file or writing to a
  21932.      printer.  This list is standard for all versions of DOS, but there may be
  21933.      differences in the higher numbers on some networks.
  21934.  
  21935.      Error     Description
  21936.  
  21937.      2    File Not Found
  21938.  
  21939.           File is not found or file name contains illegal characters so that the
  21940.           file is not found.  Another possibility is that the specified file is
  21941.           a directory name, and not a complete file name.
  21942.  
  21943.      3    Path Not Found
  21944.  
  21945.           Path does not exist as specified.  Could be illegal characters, but
  21946.           more likely to be a problem with pathing from the root.
  21947.  
  21948.      4    Too many files
  21949.  
  21950.           This is directly related to your FILES= command in CONFIG.SYS.  That
  21951.           command designates a static buffer for all the handles for files open
  21952.           simultaneously on your computer.  Running a program opens three
  21953.           handles, one for STDIN, one for STDOUT, and one for STDERR.  Each
  21954.           additional open file uses one handle. 
  21955.  
  21956.           If you get this error, the simplest solution is to increase your
  21957.           FILES= number to 51 if it is lower, 99 if it is already 51, or 254 if
  21958.           it is already past 99.   Do not increase it beyond 255, DOS limit. 
  21959.           The handles are very small, so adding more handles does not affect
  21960.           your DOS memory very much.
  21961.  
  21962.           You should never see JORF report this error, since it can selectively
  21963.           close files if you run out of handles.   However, if this is the case,
  21964.           you can vastly improve performance by increasing your files to a
  21965.           number high enough to handle all the open files in one application. 
  21966.  
  21967.  
  21968.  
  21969.  
  21970.  
  21971.           Appendix                                                      365
  21972.  
  21973.  
  21974.  
  21975.  
  21976.  
  21977.  
  21978.      5    Access Denied   
  21979.  
  21980.           You do not have sufficient privileges to access this file.  In normal
  21981.           DOS, check ATTRIB (See your DOS manual).  Under a network, check your
  21982.           logon permissions.  Also check to see if someone is using the file
  21983.           (Can't erase a file someone else is using).
  21984.  
  21985.      6    Insufficient Memory
  21986.  
  21987.           I've never seen DOS report this, and suspect it is as old as a 64K IBM
  21988.           PC computer.  
  21989.  
  21990.      15   Invalid Drive Specified
  21991.  
  21992.           Can't specify D: if you have only A:, B: and C:.
  21993.  
  21994.      21   Drive not Ready
  21995.  
  21996.           Close the door to your floppy disk drive.
  21997.  
  21998.      29   Write Fault
  21999.      30   Read Fault
  22000.      31   General Failure 
  22001.  
  22002.           Diskette may be write protected, corrupt or not formatted.  It may be
  22003.           the wrong density for the drive.  It may be a Macintosh disk.
  22004.  
  22005.      32   Sharing Violation
  22006.  
  22007.           Someone has this file in use at the same time as you tried to delete
  22008.           it. 
  22009.  
  22010.      33   Lock Violation
  22011.  
  22012.           Someone has a record locked in this file and you tried to delete it.
  22013.  
  22014.  
  22015.  
  22016.  
  22017.  
  22018.  
  22019.  
  22020.  
  22021.  
  22022.  
  22023.  
  22024.  
  22025.  
  22026.  
  22027.  
  22028.  
  22029.  
  22030.           The JORF Manual (Shareware Disk Version)                      366
  22031.  
  22032.  
  22033.  
  22034.  
  22035.  
  22036.  
  22037.  
  22038.  
  22039.  
  22040.  
  22041.                                         Index
  22042.  
  22043.  
  22044.  
  22045.  
  22046.           .JRF files                   9     Button Handling             12
  22047.           Absolute Value             223     By reference              5, 6
  22048.           Accelerator                 55     By value                     5
  22049.           Add  Watch                  26     Cancel                  21, 23
  22050.           Add dates                  105     Capitalize String          287
  22051.           Add Method             23, 215     Chaining                   172
  22052.           Add Time                   278     Chaining, Program          172
  22053.           Addition (+)                33     Change
  22054.           After                       57          Window Fields         312
  22055.           Alt-F4 Key                  54     Character
  22056.           Append Record              142          Delete                 97
  22057.           Append to dBASE file       115          Get    35, 39, 41-43, 49,
  22058.           Array                       58                                 98
  22059.                Delete                 86          Insert                 99
  22060.                Directory              87          Print            157, 186
  22061.                Insert                 90          Put                   100
  22062.                Length                 91     ChBox                       62
  22063.                Pick                   93     Check Box                   62
  22064.                Printers               94     Class
  22065.                Sort                   95          At               101, 322
  22066.           Arrays                  7, 194          AtDelete              323
  22067.           Arrow Keys                  53          AtInsert              324
  22068.           ASCII file conversion      151          AtPut                 103
  22069.           ASCII Value           286, 288          In               104, 326
  22070.           Assignment (=)              34     Classes                  7, 22
  22071.           Attr                        56     Clear Screen               168
  22072.           Autowatch  Off              30     Clipper Files               10
  22073.           Autowatch On                29     Clock ticks (Time:Ticks)   285
  22074.           Backup File                143     Close file            117, 145
  22075.           Before                      57     Colors                     342
  22076.           Between numbers            224     COM port access            258
  22077.           Binary Files               160     Comma
  22078.           BINARY.J                     5          Decimal               340
  22079.           BIOS Screen Display        339     Comma decimal              235
  22080.           Block Copy                 311     Comma decimal numbers      295
  22081.           Block Read                 311     Continue                   299
  22082.           Block Write                311     Controls                   339
  22083.           BOF in dBASE file          121     Convert Date               113
  22084.           Break                      299     Convert time          282, 296
  22085.           Browser List                93     Converting files      123, 151
  22086.           Buffers                     11     Copy
  22087.           Button                      63          Structures, Text      171
  22088.  
  22089.           Appendix                                                      367
  22090.  
  22091.  
  22092.  
  22093.  
  22094.  
  22095.           Copy File                  146          Jorf Pointers         169
  22096.           Create dBASE file          118          Line                  209
  22097.           Create NTX index           118          Method            24, 216
  22098.           Ctrl-Break                              Structures            169
  22099.                Starting the                       Text                  169
  22100.                     debugger          13     Delete  Watches             29
  22101.           CUA standard                54     Delete Array elements       86
  22102.           Cursor Position            219     Delete dBASE record        119
  22103.           Data Base Manager            7     Deleted record status in
  22104.           Data Fields                 12               dBASE file       121
  22105.           Data files                   9     Developer's Kit             13
  22106.           Date                               Dialog Box                 217
  22107.                Add                   105     Directory                   87
  22108.                Formatting            113     Directory List             135
  22109.                Get                   109     DirList.J                   59
  22110.                Set                   110     Disk space                 176
  22111.                Set Format            111     Display                     57
  22112.                String                113     Display String             259
  22113.                Subtract              114     Division (/)                36
  22114.           Date conversion            289     DLM format files           151
  22115.           Day of Week (Date:Str)     113     Do Line                     27
  22116.           Db                                 DOS Environment            176
  22117.                Append                115     DOS Errors                 365
  22118.                Close                 117     DOS Shell                  190
  22119.                Create                118     DOS Version                176
  22120.                Delete                119     Dos.J                      191
  22121.                Go                    120     Duplicate
  22122.                Info                  121          Structures, Text      171
  22123.                Lock                  122     Edit                    20, 23
  22124.                Map                   123     Editing  Keys               30
  22125.                NtxOrd                126     Editing Outside             13
  22126.                Pack                  127     EditKey Class               52
  22127.                Read                  128     End of File                156
  22128.                Recall                129     Environment Values         176
  22129.                Seek                  130     EOF in dBASE file          121
  22130.                Set                   131     Equality (=)                37
  22131.                Skip                  132     Error
  22132.                Undelete (Recall)     129          Event            136, 140
  22133.                Unlock                133     Error Messages        345, 365
  22134.                Write                 134     Event
  22135.           dBASE Conversion      123, 151          Add                   136
  22136.           DBASE/Clipper files         10          Delete                138
  22137.           Debugger                    13          Do                    139
  22138.                Starting               13     Exit                   22, 172
  22139.           Debugger  Keys              30     Explode time               340
  22140.           Decimal format        235, 295     Exponent                   225
  22141.           Decimal numbers            295     F1 Key                      54
  22142.           Decmial                            False                      141
  22143.                setting in INI file   340     File
  22144.           Decrement (--)              35          Access           144, 148
  22145.           Delete                                  Append                142
  22146.                Character              97          Backup                143
  22147.  
  22148.           The JORF Manual (Shareware Disk Version)                      368
  22149.  
  22150.  
  22151.  
  22152.  
  22153.  
  22154.                Check existence of   144,     Increment (++)              38
  22155.                                      148     Index - Current (dBASE)    126
  22156.                Close                 145     Indexes                      7
  22157.                Conversion            151     Indexing
  22158.                Copy                  146          Structures              8
  22159.                Delete                147     Inequality (!=)             39
  22160.                Directory              87     Info about JORF/DOS        176
  22161.                Directory list        135     Info in dBASE file         121
  22162.                Exist                 148     Initialization             339
  22163.                Length                149     Initialization File   177, 339
  22164.                Load                  162     InpAfter                    57
  22165.                Map                   151     InpBefore                   57
  22166.                MoveTo                155     Input Fields            68, 71
  22167.                New Project           173     Insert
  22168.                Number of JORF files               Character              99
  22169.                     in use           176          Line                  211
  22170.                Ok                    156     Insert Array                90
  22171.                Print            157, 186     Installation                 i
  22172.                Read                  160     InString                   254
  22173.                Rename                161     Integer
  22174.                Save                  162          Between               224
  22175.                Write                 163          Maximum               227
  22176.           File Load                  150          Minimum               228
  22177.           Finish                      27     Integers                7, 290
  22178.           Finish  Method              28     International numbers      295
  22179.           Floating point numbers       7     Interpret                  170
  22180.           FLRCO                       56     ISA.J
  22181.           Flush Memory          175, 188          Sample Program        242
  22182.           For loop                   164     Jcm2Dbf.J                  115
  22183.           For/Next Loop              164     Jorf
  22184.           Format Date                111          Do (Interpret)        170
  22185.           Found in dBASE file        121          Duplicate             171
  22186.           FoxPro                      10          Global                214
  22187.           Free Memory                176          Info                  176
  22188.           Friend                      31          Ini                   177
  22189.           Friends                     11          INI File              339
  22190.           Function keys               54          Move                  184
  22191.           Function Reference         331          Printers (Printer
  22192.           Get Date (Today)           109               Set up)          341
  22193.           Get Time                   279     JORF Acronym                 1
  22194.           Getting Started             15     JORF Company                 1
  22195.           Global Values              214     JORF.INI File              339
  22196.           Go                      21, 27     JORFPC                      15
  22197.           Goto dBASE record          120     JORFWIN                     15
  22198.           Greater or Equal To (>=)    41     Josephine T. Goat            1
  22199.           Greater Than (>)            40     JRF files                    9
  22200.           Group Boxes                 65     Justify String
  22201.           Haiku.J                    195               (Str:Rpad)       261
  22202.           Here                       166     Key
  22203.           Hotkey                      55          Bye                   199
  22204.           Hypertext Prompt            76          Event            136, 139
  22205.           If/Else                    167          Get                   200
  22206.  
  22207.           Appendix                                                      369
  22208.  
  22209.  
  22210.  
  22211.  
  22212.  
  22213.                Got                   201          Structure elements    184
  22214.                Hit                   202     Move Cursor                219
  22215.           Key lookup dBASE style     130     Moving Structures           11
  22216.           Keyboard Accelerator        55     MS-DOS Version             176
  22217.           Keystroke handling          52     Multiplication (*)          48
  22218.           Last Record                121     Multiuser Status        9, 340
  22219.           Launch programs            190     Music.J                    189
  22220.           Length of Array             91     Name (Rename) File         161
  22221.           Less or Equal To (<=)       43     Negation (-)                49
  22222.           Less Than (<)               42     Negative Numbers           223
  22223.           Library Function                   Network Access          9, 340
  22224.                     Reference        331     New                        220
  22225.           Line                               Next Line                   27
  22226.                Class of Word         328     Next Record
  22227.                Delete                209          dBASE Style           132
  22228.                Input                 210     Next record in file        263
  22229.                Length                272     Ntx order in dBASE file    126
  22230.                Output                212     Null                       222
  22231.                Release               213     Null padding a string      256
  22232.           List (of records)           71     Num
  22233.           Load File                  150          Str                   340
  22234.           Lock Record                181     Number
  22235.                in dBASE file         122          Between               224
  22236.           Logarithm                  226          Exponent              225
  22237.           Logical                                 Formatting            233
  22238.                AND (&&)               44          Logarithm             226
  22239.                NEGATION (!)           45          Maximum               227
  22240.                OR (??)                46          Minimum               228
  22241.           Lower Case                 291          Power                 229
  22242.           Magic                       56          Square Root           232
  22243.           Map dBASE file             123          String                233
  22244.           Map File                   151     Numeric Conversions   233, 292
  22245.           Math                               Numeric formatting         233
  22246.                Method Calls           31     Object Oriented language    22
  22247.           Mathematics                 11     Object Persistence           8
  22248.           Memory Free                176     Object-Attribute-Value       9
  22249.           Memory Management            8     Ok                         236
  22250.           Menu Bars               73, 74     Open                        20
  22251.           Menu Lines                  75     Order of Operations     11, 32
  22252.           Menus                       12     Other  Screen               25
  22253.           Message Window             217     Pack dBASE file            127
  22254.           Method                             Pack Disk File        185, 187
  22255.                Add                   215     Parameters                   5
  22256.                Calls                  31     Parentheses                  4
  22257.                Delete                216     Passing by reference         5
  22258.           Methods and Classes         22     Path (Directory)            87
  22259.           Modulus (%)                 47     Path name                  176
  22260.           Monitor Problems           339     Pick List               58, 93
  22261.           Monochrome Monitors        340     Power (of a number)        229
  22262.           Month name (Date:Str)      113     Prev record
  22263.           Mouse Handler              339          dBASE style           132
  22264.           Move                               Previous record in file    264
  22265.  
  22266.           The JORF Manual (Shareware Disk Version)                      370
  22267.  
  22268.  
  22269.  
  22270.  
  22271.  
  22272.           Print                       21          Haiku.J               195
  22273.           Print File            157, 186          Jcm2Dbf.J             115
  22274.           Printer List                94          Music.J               189
  22275.           Printer menu (Set up in                 TextEdit.J             82
  22276.                     INI file)        341     Sample programs
  22277.           Printer set up             341          ISA.J                 242
  22278.           Problems                   339     Save                        21
  22279.           Program Chaining           172     Save As                     21
  22280.           Programmer's Workbook       15     Save File                  162
  22281.           Programming Environment     13     Say String                 259
  22282.           Programming Windows          3     Screen Colors         339, 342
  22283.           Project file               173     Screen problems            339
  22284.           Prompt                      76     Scroll problems            340
  22285.           Radio Buttons               79     SDF format files           151
  22286.           Ram Disk              339, 341     Search                     321
  22287.           Random Numbers             230     Seek to a dBASE record     130
  22288.           Re-Read                     22     Sequential Files           160
  22289.           Read record in dBASE               Serial port access         258
  22290.                     file             128     Set
  22291.           Reading files              151          Deleted (dBASE)       131
  22292.           Rebuild dBASE file         127          SoftSeek (dBASE)      131
  22293.           Rebuild File          185, 187     Set date                   110
  22294.           Recall dBASE record        129     Set Time                   280
  22295.           Recipe Filers                1     Set time format            281
  22296.           Record Append              142     SHARE                        9
  22297.           Record Lock                181     Shareware Message           16
  22298.           Record Unlock              193     Show  Variables             26
  22299.           Reference                          Show Stack                  25
  22300.                Parameters by           6     Skip record in dBASE       132
  22301.                Quick Language        330     SMARTDRV                     9
  22302.           Release Input              213     Sort Array                  95
  22303.           Reloading a Project         13     Space pad (a string)       257
  22304.           Rename file                161     Stack                      101
  22305.           Replace                    320     String                      80
  22306.           Replicate                               After                 247
  22307.                Str:AtSet             253          At                    248
  22308.           Reread                      20          AtChar                249
  22309.           Restart                     21          AtCut                 250
  22310.           Return                     241          AtDelete              251
  22311.           Rewind                  27, 28          AtPut                 252
  22312.           Right Justify String       261          AtSet                 253
  22313.           Rule                                    Instring              254
  22314.                Add              237, 242          Length                255
  22315.                Delete                243          Null Pad              256
  22316.                Find        244, 246, 262          Pad                   257
  22317.                Next                  245          Print                 258
  22318.           Rule Based System            9          Put Line              260
  22319.           Run                         20          Right Pad             261
  22320.           Sample Program                     String Key
  22321.                Binary.J                5          Add                   204
  22322.                DirList.J              59          Delete                205
  22323.                Dos.J                 191          Find                  206
  22324.  
  22325.           Appendix                                                      371
  22326.  
  22327.  
  22328.  
  22329.  
  22330.  
  22331.                Next                  207          Upper                 297
  22332.                Previous         203, 208     Today's date (Date:Get)    109
  22333.           Strings                      7     Toggle  Break  Point        29
  22334.           Struct Next                263     Trace  Forward              28
  22335.           Struct Prev                264     Translating to C            13
  22336.           Structures                   8     True                       298
  22337.                Blanking elements     184     Type                        56
  22338.                in Data files           9     Undelete a dBASE record    129
  22339.                Moving elements       184     Unlock a dBASE record      133
  22340.           Subtract Date              114     Unlock Record              193
  22341.           Subtract time              284     Upper Case                 297
  22342.           Subtraction (-)             50     Video problems             339
  22343.           Swap File                  339     Weekday (Date:Str)         113
  22344.           Switch/Case/Else      265, 266     While/Break/Continue  299, 300
  22345.           System                     190     Window
  22346.           Text                         7          Add                   301
  22347.                At Line               269          Attribute             309
  22348.                Class of Word         328          Block                 311
  22349.                First Line            276          Change                312
  22350.                Justification    315, 316          Colors                339
  22351.                Last Line             270          FLRCO            315, 316
  22352.                Length                272          Message               317
  22353.                Line Number           274          Message Window        217
  22354.                Next Line             273          Move By               218
  22355.                Position              274          Move To               219
  22356.                Previous Line         275          Pause                 318
  22357.                Width                 277          Pointer               319
  22358.           Text Entry                  81          Put Line              260
  22359.           Text File Load             150          Put String            259
  22360.           Text File Save             162          Replace               320
  22361.           TextEdit.J                  82          Search                321
  22362.           Time                                    Structure             319
  22363.                Addition              278     Window colors              342
  22364.                Formatting            282     Window Manager          12, 51
  22365.                Get (Now)             279     Windows
  22366.                Set                   280          True if running       176
  22367.                Set Format            281     Windows Features             2
  22368.                String                282     Windows Settings            56
  22369.                Subtract              284     Windowstructure             56
  22370.                Ticks                 285     Word
  22371.           Time conversion            296          AtDelete              323
  22372.           To                                      AtInsert              324
  22373.                ASCII                 286          AtPut                 325
  22374.                Capitals              287          In                    326
  22375.                Character             288     Write
  22376.                Date                  289          Item                  194
  22377.                Integer               290          Record                194
  22378.                Lower                 291          Structure             194
  22379.                Num                   340     Write a dBASE record       134
  22380.                Number                292     Writing files              151
  22381.                Numeric String        233
  22382.                Time                  296
  22383.  
  22384.           The JORF Manual (Shareware Disk Version)                      372