home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR22 / JORF21_2.ZIP / TUTTEXT.J < prev    next >
Text File  |  1993-07-05  |  112KB  |  2,990 lines

  1. About:DOS
  2.   Title:"MS-DOS"
  3.   A lot of Computer Magazines would have you believe that
  4.   somehow died when {Bold:"Lo"}Windows Version 3.x{Bold:"No"}
  5.   was introduced. But anyone with two eyes can see that a
  6.   majority of computer users are still running DOS uprograms
  7.   most of the time.
  8.  
  9.   I don't question that the future is
  10.   in MS-Windows.  But there are {Bold:"Lo"}Millions{Bold:"No"}
  11.   of PC XT and AT computers in current usage that
  12.   cannot run Windows at a reasonable speed.
  13.   And there are thousands of {Bold:"Lo"}Networks{Bold:"No"}, that
  14.   are too speed sensitive to run Windows.
  15.  
  16.   And don't forget that trade restrictions limit
  17.   the sale of 386 machines to formerly communist countries.
  18.   Until these barriers are lifted, MS-DOS will make an
  19.   indeleble mark on Eastern Europe, just as it has in
  20.   Western Europe.
  21.  
  22. About:DOS1
  23.   Title:"Will continue to Dominate"
  24.   DOS is {Bold:"Lo"}fast{Bold:"No"} and
  25.   DOS is {Bold:"Lo"}cheap{Bold:"No"}.  DOS isn't going to die
  26.   this year or next.  We will continue to see DOS in
  27.   speed sensitive and cost sensitive applications
  28.   through the turn of the century, eight years from now.
  29.  
  30.   If DOS isn't dead and MS-Windows is the Future, then
  31.   the {Bold:"Lo"}Present{Bold:"No"} of
  32.   IBM PC style machines is locked into {Bold:"Lo"}Dual
  33.   Platforms{Bold:"No"}; DOS and MS-Windows.
  34.  
  35. About:DOS2
  36.   Title:"The PC Industry for at least eight more years"
  37.   The JORF Language was written for DOS and remains
  38.   a DOS style application, even when running under
  39.   MS-Windows.  That doesn't mean it can't be fancy.
  40.  
  41.   The {Bold:"Lo"}JORF {Bold:"No"} language features a
  42.   window handler that conforms to the keystroke, menu
  43.   and input style of MS-Windows.
  44.   This handler is fast, even on standard XT computers, and
  45.   and provides some of the visual and functional
  46.   benefits of the MS-Windows interface.
  47.  
  48.   Since MS-DOS and MS-Windows files are the same, it is easy
  49.   to provide same source, same data support in these environments.
  50.   So that is what I did!
  51.  
  52. About:Mem
  53.   Title:"Memory and Disk Management"
  54.   Row:1
  55.   Col:1
  56.   My greatest frustration as a grunt programmer comes from
  57.   the amount of time I spend dinking around with memory
  58.   allocation and disk storage of variables.
  59.  
  60.   It is not my memory, and not my disk.  The management of the
  61.   computer is the responsiblity of the operating system, and the
  62.   software tools.  Instead, most languages make me responsible
  63.   for memory, especially when its time to
  64.   say {Bold:"Lo"}Out of Memory{Bold:"No"}.
  65.  
  66.   We put men on the moon a decade ago.  The Berlin wall has
  67.   disappeared.  We can map the human gene sequence.  Why not
  68.   have a programming language that takes care of Memory and Disk
  69.   so I can spend my time with my program.
  70.  
  71. About:Mem1
  72.   Title:"Seems Fine to Academics and Engineers"
  73.   The biggest problem now is these friendly user interfaces.
  74.   Just the main Tutorial window takes over 8 Kilobytes for
  75.   background and refresh buffers, and up to 128 bytes for
  76.   every one of the 16 menu items and 10 hypertext prompts.
  77.  
  78.   Press Ctrl-Break and another 25 Kilobytes is used just to
  79.   display the debugger window.  By the time you pull up a couple
  80.   menus, a browse window, and select a method to edit, you
  81.   will be Out of Memory on any 640K DOS system.
  82.  
  83. About:Mem2
  84.   Title:"Who get paid, even nothing gets finished"
  85.   The Memory management system in JORF dates from 1988 when
  86.   most applications were not as fancy.  But this system has
  87.   paid off now, because the "professional software look"
  88.   demands this memory intensive interface.
  89.  
  90.   Even under MS-Windows, where the operating system is
  91.   supposed to handle memory for you (but actually fails
  92.   if too many items are allocated), the JORF scheme has
  93.   considerable benefits.
  94.  
  95. About:Mem3
  96.   Title:"But no one pays Me to waste time!"
  97.   Wid:68
  98.   In the JORF language, use the {Bold:"Lo"}New{Bold:"no"}
  99.   command to allocate memory for a variable.  New variables
  100.   may be numbers, strings, text, or arrays.  New variables are
  101.   always initialized to Null.
  102.  
  103.   The JORF automatic garbage collection system will deallocate
  104.   your variable automatically unless:
  105.  
  106.      A) It is an indexed structure and you write it to file.
  107.      B) You use the Rule Based Index system to index your variable
  108.      C) Your variable is pointed to by an array or structure that
  109.         is saved through scheme A or B.
  110.  
  111.   There is no distinction in JORF between a memory variable
  112.   and a disk variable.
  113.  
  114. About:Tut
  115.   Title:"The JORF Tutorial"
  116.   The JORF Tutorial is a demonstration of the JORF language.
  117.   It features hypertext screens, self writing programs, pull
  118.   down and pop up menus, and data entry screens.
  119.  
  120.   This tutorial is also being run, {Bold:"Lo"}(Right Now){Bold:"No"}
  121.   from within the JORF Editor and Debugger.  The Debugger is an
  122.   integrated part of the Runtime system for interpreted programs.
  123.  
  124.   To see the Debugger, press {Bold:"Lo"}Ctrl-Break{Bold:"No"}.  (Press
  125.   the Alt-G key to "Go" back to running the program from the Debugger).
  126.   Try it now!
  127.  
  128. About:Tut1
  129.   Title:"Tutorial Program"
  130.   Wid:70
  131.   There are two files used for this tutorial:
  132.  
  133.     TUTORIAL.J is the driver file that displays the menu and boxes.
  134.     TUTTEXT.J contains the text screens that you see here.
  135.  
  136.   The text is actually hashed through a routine that builds the
  137.   window and places the button automatically.  This makes writing
  138.   the text as easy as typing.  There is, however, a slight delay
  139.   in screen display "snap" that would not be needed if the buttons
  140.   were preset in the text file.
  141.  
  142. About:Tut2
  143.   Title:""
  144.   {FLRCO:"C"}
  145.   The JORF Tutorial
  146.   by Wayland Bruns
  147.  
  148.   Version 2.1   April 1, 1993
  149.  
  150. About:Win
  151.   Title:"Fast Windows"
  152.   When you look at most WinApps today, it is
  153.   easy to sum them up as {Bold:"Lo"}Sophisticated,
  154.   Slow, and Spendy{Bold:"No"}.
  155.  
  156.   But grunt programmer that I am, all I want
  157.   out of MS-Windows is {Bold:"Lo"}Friendly,
  158.   Fast, and Cheap{Bold:"No"}.
  159.  
  160.   This is what I want JORF to be.
  161.  
  162. About:Win1
  163.   Title:"for Winning"
  164.   When Running under MS-Windows, only
  165.   only the System Fixed Font is supported,
  166.   only the top window is active, and data entry is done using
  167.   JORF style prompts, not Windows dialog boxes.
  168.  
  169.   JORF uses your MS-Windows colors and border styles, supports
  170.   several types of MS-Windows button styles, and is terribly
  171.   well behaved with MS-Windows Memory and Disk functions.
  172.  
  173.   In supporting a subset of MS-Windows features, JORF is smaller,
  174.   faster and easier to use than most other MS-Windows application
  175.   tools.  The MS-Windows version is almost as
  176.   fast as the DOS version, and that is pretty good for a WinApp.
  177.  
  178. About:Win2
  179.   Title:"Fair re-Wards"
  180.   I'm not here to give you a cheap version of Toolbook,
  181.   or FoxBase.  If you need fancy graphics, image processing
  182.   dynamic data exchange, and some of the other fancy features of
  183.   Windows, you are not going to find them here in JORF.
  184.  
  185.   What you will find here is a programming language where
  186.   you can create a new data entry screen in one tenth the time
  187.   of Visual BASIC.
  188.  
  189.   With JORF, you can easily create a
  190.   decent screen that runs fast and looks fine in just a few
  191.   lines of code.  Faster and easier than Point and Click,
  192.   and runs on DOS systems too.  Easy!
  193.  
  194. Intro:Grunt
  195.   Title:"Wayland Bruns"
  196.   Row:2
  197.   For the better part of a decade I have supported
  198.   myself by writing accounting and document processing
  199.   computer applications.  That is to say - I'm a grunt
  200.   programmer.
  201.  
  202.   In these years I have used languages by well paid
  203.   engineers and ivory tower academics.  These languages,
  204.   like C++ and Pascal allow me to create beautiful
  205.   bubblesorts, and flexible file storage systems.
  206.  
  207.   I've also done a lot of programming in dBASE, which was
  208.   really innovative when it was introduced in 1984.  Now is
  209.   the era of Object Oriented Programming, and despite what
  210.   Bill Gates says, an Icon-handling Windows dBASE language is
  211.   not Object Oriented.
  212.  
  213. Intro:Grunt1
  214.   Title:"Striving to Create"
  215.   JORF is my attempt to create a simple programming language
  216.   for business (not graphics) programming.  A language that
  217.   a new programmer can handle to create a simple data base,
  218.   do some calculations and print some reports.
  219.  
  220.   The JORF language takes responsiblity for niggly stuff
  221.   wastes programmer time in other languages.
  222.   You don't have to worry about {Bold:"Lo"}type mismatch errors{Bold:"No"}
  223.   because the JORF language has just one data type!
  224.  
  225.   The JORF Language also handles {Bold:"Lo"}memory allocation{Bold:"No"}.
  226.   One failure of C++ is that it lacks a better way of handling
  227.   temporary memory structures.  JORF not only handles temporary
  228.   structures for you, it can even swap them to disk.  That way,
  229.   your {Bold:"Lo"}DOS Apps{Bold:"No"} don't run out of memory, and
  230.   your {Bold:"Lo"}Win Apps{Bold:"No"} are well behaved.
  231.  
  232. Intro:Grunt2
  233.   Title:"A Language for Regular People"
  234.   The JORF language is my language.  I've made my career
  235.   creating {Bold:"Lo"}Business Applications{Bold:"No"},
  236.   that is what JORF is best at.
  237.  
  238.   Since my pet-peeves are machine language data types,
  239.   numeric overflows, data file handling, and memory management,
  240.   I've created a language that takes care of these things.
  241.  
  242.   With the world moving {Bold:"Lo"}backward{Bold:"No"},
  243.   toward more complex versions of C, more C-Like versions
  244.   of BASIC, and dialects of dBASE that claim to be Object
  245.   Oriented, I think it is time to share my effort.
  246.  
  247.   I think you will agree, when it comes to creating simple Business
  248.   Applications, JORF is a step toward an easier future.
  249.  
  250. Intro:Hyper
  251.   Title:"Hypertext"
  252.   The Hypertext system highlights the current prompt.  Use
  253.   your arrow keys to highlight the next or previous prompts.
  254.  
  255.   If there are menu letters, or prompt letters highlighted on
  256.   the screen, you can zoom to them by holding down the Alt key
  257.   and pressing the appropriate letter.
  258.  
  259.   The Hypertext system is designed so that
  260.   pressing {Bold:"Lo"}Enter{Bold:"No"}
  261.   brings you to the next prompt,
  262.   or back to the beginning if you have
  263.   finished.  You can press {Bold:"Lo"}Escape{Bold:"No"} to
  264.   exit from the current screen.
  265.  
  266. Intro:Hyper1
  267.   Title:"CUA Compliance"
  268.   The JORF Screen manager is compliant with Common User Access
  269.   key standards.  That means that it conforms to the same
  270.   cursor keys and menu handling found in MS-Windows program.
  271.  
  272.   That also means the the Enter key does something different
  273.   than most DOS users expect.
  274.  
  275.   In a CUA compliant application:
  276.   {Bold:"Lo"}
  277.     Use the TAB key to move between fields.
  278.  
  279.     The ENTER key "presses" the default button
  280.     (even if that button is not highlighted.)
  281.   {Bold:"No"}
  282.  
  283. Intro:Hyper2
  284.   This is a stupid standard, because the tab
  285.   key is little and the cursor key is big.
  286.  
  287.   But this is a standard, and the DOS PC world
  288.   has long needed a standard so that users can
  289.   more easily use all programs.
  290.  
  291.   I guess if we all got used to a control key on
  292.   the {Bold:"Lo"}bottom{Bold:"No"} of the keyboard,
  293.   then we can get used to pressing the little tab
  294.   key between fields.
  295.  
  296.   Press Enter now press this button and
  297.   return to the main screen.
  298.  
  299. Intro:Jo
  300.   Title:"Josephine T. Goat"
  301.   Josephine is a tan pygmy goat that lives at the
  302.   foot of the Cascade Mountains in
  303.   lovely Colton, Oregon.
  304.  
  305.   Josephine doesn't file recipes or write
  306.   Object Oriented Programs.  Instead she
  307.   dances and plays in the sunshine.  Her
  308.   message is simple:
  309.   {Bold:"Lo"}
  310.         ■ Lighten-up
  311.         ■ Eat
  312.         ■ Dance
  313.         ■ Baaaah.
  314.   {Bold:"No"}
  315.   Josephine doesn't have to work for a living.
  316.  
  317.  
  318. Quick:Start
  319.   Script:"QuickDemo1" "Demo:Start"
  320.   Title:"Real Windows Programming"
  321.   The bigger problem is how long it takes to create a CUA
  322.   Compliant MS-Windows style data entry screen, with pull
  323.   down menus, keyboard accelerators buttons and text boxes.
  324.  
  325.   Microsoft is advocating the Point and Click tool building system
  326.   of Visual Basic.  I prefer the faster and more primitive method
  327.   of creating a screen definition.  I also drive a car with a
  328.   standard transmission.
  329.  
  330.   How quick can you make a Data Entry Window with Inputs, Check boxes
  331.   Radio Buttons, and Pull Down Menus?  Try it and see!
  332.  
  333. Quick:Start1
  334.   Script:"QuickDemo2" "Demo:Screen"
  335.   Title:"Quick Demo Summary"
  336.   How about that?  A data entry screen in JORF uses
  337.   one line per option or prompt on the screen, and can
  338.   take more for complicated prompts.
  339.  
  340.   Each prompt can
  341.   set a value or run a method.  This system is extremely
  342.   flexible, supporting on-line equations and instant data
  343.   verification.
  344.  
  345. Tut:About
  346.   Title:"About the JORF language"
  347.   The JORF language is intended to be an easy
  348.   language for business application programming.
  349.  
  350.   An unusal feature of the JORF language is automatic handling of
  351.   of {Prompt:"&Memory and Disk",   Action:"Tutorial:Box('About:Mem')"}
  352.   functions.
  353.  
  354.   Another feature is the Window Manager, that supports menus
  355.   and buttons for &
  356.   for {Prompt:"Fast &Windows",      Action:"Tutorial:Box('About:Win')"}
  357.   and {Prompt:"Fancy &DOS",         Action:"Tutorial:Box('About:DOS')"}
  358.   programming.
  359.  
  360.   This tutorial is written in the JORF language,
  361.   and can be run as an interpreted or compiled program.
  362.   Press enter here for more information about
  363.   the {Prompt:"&Tutorial"     Action:"Tutorial:Box('About:Tut')"}.
  364.  
  365. Tut:JorfCo
  366.   Title:""
  367.   JORF Company is just me, Wayland Bruns.  I
  368.   have been working on JORF for six years, and
  369.   ran out of money three years ago.
  370.  
  371.   I run JorfCo part time, from 9-5 Pacific Time
  372.   Monday through Wednesday.
  373.  
  374.   I never forget that {Bold:"Lo"}YOU{Bold:"No"}
  375.   are an important part of my
  376.   life, so please feel free to
  377.   write or call:
  378.   {Bold:"Lo"}
  379.                Wayland Bruns
  380.                The JORF Company
  381.                25858 Elwood Road
  382.                Colton, OR 97017
  383.                (503) 824-5673
  384.  
  385. Tut:Overseas
  386.   Title:"Overseas Shipping"
  387.   Please add $10 to cover the cost of U.S. Air Mail.  We can
  388.   take checks from most major coutries as long as the check is
  389.   written in the native currency for the bank that issued the check.
  390.  
  391.   For instance, you can send a check for 600 French Francs as
  392.   long as the check is from a French bank.  You can send German
  393.   Marks as long as the check is from a German bank.  You can send
  394.   Japanese Yen as long as the check is from a Japanese bank.
  395.  
  396.   Of course, you can always get a check in dollars from your
  397.   local Citibank office.
  398.  
  399.   We accept Postal Money Orders but they must be in U.S. dollars.
  400.   Shipping is by U.S. Air Mail unless you say otherwise.
  401.  
  402. Tut:Prod
  403.   Title:"Demonstration/Shareware packages"
  404.   Wid:60
  405.   {Bold:"Lo"}DOS/Windows Demonstration Package                   Just $5{Bold:"No"}
  406.     Send just 5 buckaroos to JORF Company to get shareware
  407.     versions of the JORF386 and Windows versions of
  408.     the JORF interpreter.  This version ships with FULL
  409.     documentation On-Disk.  You also get a command quick
  410.     reference card and notice of the next upgrade.
  411.  
  412.     This version ships on 3 1/2 1.44MB disk.  Please
  413.     specify if you need a 5 1/4 1.2MB disk instead.
  414.  
  415.   {Bold:"Lo"}JORF-PC Registration                                    $45{Bold:"No"}
  416.     The full benefits of Registration for the DOS Version.
  417.     Get a biggo reference guide (280 pages), a programming
  418.     workbook, Mail and Telephone support, notice of upgrades,
  419.     and great Karma for supporting The JORF Company.
  420.  
  421.  
  422. Tut:Prod1
  423.   Title:"Registered Versions"
  424.   Wid:60
  425.   {Bold:"Lo"}JORF Programmer's Pack                                  $85{Bold:"No"}
  426.     You get everything in the JORF Registered package
  427.     plus the JORF386 version (Runs faster on 386 PCs with
  428.     extended or expanded memory), and the Microsoft
  429.     Windows 3.x version.  This is everything you need
  430.     to write programs for DOS {Bold:"Lo"}and{Bold:"No"} Windows using one
  431.     set of source code and program data.
  432.  
  433.   {Bold:"Lo"}JORF Developer's Kit                                   $170{Bold:"No"}
  434.     The libraries you need to Translate and compile your
  435.     JORF programs into true EXE files.  You will also
  436.     need the Borland Turbo C compiler (about $104) to
  437.     compile for DOS, and the Borland C++ compiler
  438.     (about $350) to compile for Windows programs.
  439.  
  440. Write:Start
  441.   Title:"Writing JORF Programs"
  442.   Wid:50
  443.   There is a significant gap between reading
  444.   this tutorial, and creating
  445.   new programs using JORF.  This gap can be
  446.   crossed, and {Bold:"Lo"}You can do it!{Bold:"No"}
  447.  
  448.   The best way to write JORF programs is to use
  449.   the {Bold:"Lo"}JORF integrated editor and debugger{Bold:"No"}.  This
  450.   tool allows you to watch the program and stack as
  451.   the program runs.  The JORF editor allows you to
  452.   change stack values, and even the program code, without
  453.   having to stop and restart it like most debuggers.
  454.  
  455.   You can enter the debugger by pressing {Bold:"Lo"}Ctrl-Break{Bold:"No"}
  456.   at any time.  The Break key is near the number pad and
  457.   is labeled Scroll Lock on an XT or Pause on an AT keyboard.
  458.  
  459. Write:Start1
  460.   Title:"The Help System"
  461.   Wid:60
  462.   The Help system documents JORF functions available to you.
  463.   These vary from the prosaic {Bold:"Lo"}Kbd:Get{Bold:"No"} to
  464.   the complex {Bold:"Lo"}Win:Add{Bold:"No"}.  Also documented
  465.   are the control functions {Bold:"Lo"}If{Bold:"No"}, &
  466.   {Bold:"Lo"}Else{Bold:"no"}, {Bold:"Lo"}While{Bold:"No"}, and &
  467.   {Bold:"Lo"}Switch{Bold:"No"}.
  468.  
  469.   You can access the help system at any time by
  470.   hitting {Bold:"Lo"}F1{Bold:"No"}.  (Try it now!)  The Help system
  471.   is a JORF language program, just like this tutorial, and
  472.   depends on there being a HELP.J or HELP.JRF file on
  473.   the current directory.
  474.  
  475. Write:Start2
  476.   Title:"Handling .JRF files"
  477.   Wid:76
  478.   JORF programs are kept in an indexed format with
  479.   an extension of {Bold:"Lo"}.JRF{Bold:"No"}.
  480.   This file contains indexes and browse list information that is
  481.   not contained in the source file.  When you edit your program,
  482.   the source file will be automatically saved when you exit.  You
  483.   should also save it using F3 periodically.
  484.  
  485.   The JORF Interpreter uses a file called SWAPFILE.JRF for variables
  486.   and screens swapped while a program is running.  If you bomb while
  487.   in JORF, you CHKDSK will recover this file, which is usually from
  488.   5 to 50K.  Just erase it.  The JORF Interpreter creates a new
  489.   SWAPFILE.JRF every time it is run.
  490.  
  491.  
  492. Write:Start3
  493.   Title:"Summary"
  494.   ■ Start with a small change and work your way up.
  495.  
  496.   ■ Make changes using the integrated editor and debugger.
  497.  
  498.   ■ Reload source files by invoking The JORF Interpreter with
  499.   the names of the class files to be reloaded.
  500.  
  501.   ■ Send $85 to The JORF Company to get the latest (more bombproof)
  502.   version of the interpreter and a neat manual that steps you
  503.   through the process of writing programs.
  504.  
  505. Tut:DataEntry
  506.   Title:"The JORF Window manager"
  507.   Wid:70
  508.   The Window Manager handles windows that contain data
  509.   entry areas.  In the window definition,
  510.   certain keywords are used to set up the fields to
  511.   be input.  Each window element is noted using
  512.   a keyword.  Keywords are followed by the prompt
  513.   for that item.
  514.   {Bold:"Lo"}
  515.       Array:"Item"      - Array pick list
  516.       Radio:"Item"      - Radio Button
  517.       ChBox:"Item"      - Check Box
  518.       InPut:"Prompt"    - Input
  519.       Text:"Prompt"     - Input text
  520.       Group:"Prompt"    - Group Box
  521.       List:"Item"       - Record pick list
  522.       Prompt:"Prompt"   - Hypertext Prompt
  523.       String:"Item"     - Plain text, no entry.
  524.       Button:"Item"     - Push Button
  525.   {Bold:"No"}
  526.   Data entry is done automatically when the window is displayed.
  527.  
  528. Tut:DataEntry1
  529.   Script:"LetterScript" "JORFNote:Start"
  530.   Title:"Data Display and Entry"
  531.   Wid:56
  532.   ■ Input items are created using special key words.  You
  533.   can enter structure elements and array elements as easily
  534.   as simple variables.
  535.  
  536.   ■ The {Bold:"Lo"}Time:Get{Bold:"No"} function will
  537.   get the current date and time
  538.   and can format this for International as well as U.S. standards.
  539.  
  540.   ■ Input text is just as easy as input strings.  Just specify
  541.   a length and a text entry field is created.  Text is a basic
  542.   data type in JORF, and can be handled almost as easily as the
  543.   string data type.
  544.  
  545. Script:Hello
  546.   Script:Say ("Hello:Start")
  547.   Script:Box ("Method Name Declaration", 12, 50)
  548.     Button:" More . . . ", Row:10, Col:20, Action:"Return(Ok)"
  549.     This line declares a method that &
  550.     belongs to the class {Bold:"Lo"}Hello{Bold:"No"}.  It &
  551.     is called {Bold:"Lo"}Start{Bold:"No"}.
  552.  
  553.     This method is being written by the JORF system &
  554.     just as if you were typing it in.  When finished, the &
  555.     system will run the program.
  556.  
  557.     An interesting features of JORF is the ability to &
  558.     create and change methods on-the-fly.
  559.   If (Kbd:Got='Esc_Key')
  560.     Return
  561.   Script:Say ('  Msg:Add ("Hello", "Ok")')
  562.   Script:Say ('    Welcome to the Wonderful World of JORF!')
  563.   Script:Box ('Creating a Text Window', 10, 40)
  564.     Button:" More . . . ", Row:8, Col:12, Action:"Return(Ok)"
  565.     There is a JORF function named &
  566.     {Bold:"Lo"}Msg:Add{Bold:"No"}. This function creates a dialog box &
  567.     exactly big enough to display the indented text.
  568.  
  569.     The box Title will be "Hello" and type will be an "Ok" box.
  570.   If (Kbd:Got="Esc_Key")
  571.     Return
  572.   Script:Box ('Running Hello from DOS', 13, 50)
  573.     Button:" More . . . ", Row:11, Col:14, Action:"Return(Ok)"
  574.     The {Bold:"Lo"}Hello{Bold:"No"} program has been included &
  575.     to be run from DOS.  It is in a file called HELLO.J.
  576.     To run it, start JORF using {Bold:"Lo"}Hello{Bold:"No"}.
  577.  
  578.          C>{Bold:"Lo"}JORF HELLO{Bold:"No"}
  579.  
  580.     After running this program, you will be put in the &
  581.     JORF debugger.  Interpreted programs will always end in the &
  582.     debugger unless they end with the command {Bold:"Lo"}Jorf:Exit{Bold:"No"}.
  583.   Return (Tutorial:Ret)
  584.  
  585. Script:Letter1
  586.   Script:Say ('Class:Address Name Street CityStZip')
  587.   Script:Box ('Address', 12, 56)
  588.     Button:" More . . . ", Row:10, Col:20, Action:"Return(Ok)"
  589.     Create a class for holding names and addresses.  &
  590.     Although this is sorely lacking in sophistication &
  591.     (No company name or international mailing code) &
  592.     it makes a nice base for our letter.
  593.  
  594.     You may note that JORF lets you add fields on &
  595.     existing databases with no need to reformat or &
  596.     modify the database.  This is because items are &
  597.     stored by Name reference and not position reference.
  598.   If (Kbd:Got="Esc_Key")
  599.     Return ("Esc_Key")
  600.  
  601. Script:Letter2
  602.   Script:Say ('Class:JORFNote Parent:Address Feeling Thought')
  603.   Script:Box ('The JORFNote Class', 14, 50)
  604.     Button:" More . . . ", Row:12, Col:16, Action:"Return(Ok)"
  605.     This is a special class for our letter.  It uses the &
  606.     last {Bold:"Lo"}Address{Bold:"No"} class as &
  607.     a parent.  That means that this class inherits the &
  608.     elements {Bold:"Lo"}as if they were declared here{Bold:"No"}.
  609.  
  610.     Structure elements are referenced using pointers.
  611.     {Bold:"Lo"}
  612.       New (JORFNote:MyLetter)
  613.       MyLetter->Name = "Josephine"
  614.           MyLetter->Feeling = "Dance-a-Dance-a-Dance"
  615.     {Bold:"No"}
  616.   If (Kbd:Got="Esc_Key")
  617.     Return ("Esc_Key")
  618.  
  619. Script:Letter3
  620.   Script:Put ('JORFNote:Start')
  621.   Script:Box ('No More Cute', 9, 50)
  622.     Button:" More . . . ", Row:7, Col:16, Action:"Return(Ok)"
  623.     I want to dispel the notion that the script system is &
  624.     slow.  I was just trying to be cute and gentle by &
  625.     using a on-at-a-time character display.
  626.  
  627.     Now, its time to roll up our sleeves and really get to &
  628.     work.  No more Little-Bo-Peep.  {Bold:"Lo"}Jo Raps!{Bold:"No"}
  629.   If (Kbd:Got="Esc_Key")
  630.     Return ("Esc_Key")
  631.   Script:Put ('  New (JORFNote:Letter)')
  632.   Script:Put ('  Win:Add ("Letter To The JORF Company" 0,0,5,20)')
  633.   Script:Put ('    String:"Press TAB between fields"')
  634.   Script:Put ('    Input:"Your Name   ", Field:"Letter->Name"')
  635.   Script:Put ('    Input:"Your Street ", FIeld:"Letter->Street"')
  636.   Script:Put ('    Input:"City/St/Zip ", Field:"Letter->CityStZip"')
  637.   Script:Box ('Entering Structure Elements', 7, 50)
  638.     Button:" More . . . ", Row:5, Col:16, Action:"Return(Ok)"
  639.     And input window to gather information.  In the
  640.     {Bold:"Lo"}Foo{Bold:"No"} program we were inputting a &
  641.     {Bold:"Lo"}New{Bold:"No"} variable.  Here we are &
  642.     inputting structure elements.  The process is the same.
  643.   If (Kbd:Got="Esc_Key")
  644.     Return ("Esc_Key")
  645.   Script:Put
  646.   Script:Put ('    String:"How does JORF make you feel?  (Excited, Bored, Confused...)"')
  647.   Script:Put ('    Input:"Your Feeling ", Wid:20, Field:"Letter->Feeling"')
  648.   Script:Put
  649.   Script:Put ('    String:"What do you think of JORF? (Really Neat, Too Complicated...)"')
  650.   Script:Put ('    Input:"", Wid:60 Len:6, Field:"Letter->Thought"')
  651.   Script:Put ('    String:"           (Press Escape to Finish Text Entry)"')
  652.   Script:Put ('  JORFNote:Say (Letter)')
  653.   Script:Put ('  Return(Ok)')
  654.   Script:Put
  655.   Script:Put
  656.   Script:Box ('Text Entry', 4, 48)
  657.     Button:" More . . . ", Row:3, Col:14, Action:"Return(Ok)"
  658.     You can enter text just by specifying the length as well as &
  659.     the width of the input.
  660.   If (Kbd:Got="Esc_Key")
  661.     Return ("Esc_Key")
  662.  
  663. Script:Letter4
  664.   Script:Put ('JORFNote:Say (Letter)')
  665.   Script:Put ('  Msg:Add ("My Letter", "Ok")')
  666.   Script:Put ('    {Date:Str(Date:Get,"S d, y")}')
  667.   Script:Box ('The Date', 10, 50)
  668.     Button:" More . . . ", Row:8, Col:18, Action:"Return(Ok)"
  669.     The {Bold:"Lo"}Date:Get{Bold:"No"} function returns the &
  670.     current date, and the {Bold:"Lo"}Date:Str{Bold:"no"} function
  671.     formats the date according to the formatter &
  672.     {Bold:"lo"}"s d, y"{Bold:"no"}.  The formatter letters
  673.     stand for String-month, day and year respectively.
  674.  
  675.     The result of these two commands will be a nicely formatted &
  676.     string containing today's date.
  677.   If (Kbd:Got="Esc_Key")
  678.     Return ("Esc_Key")
  679.   Script:Put
  680.   Script:Put ('    Dear Wayland,')
  681.   Script:Put
  682.   Script:Put ('    I just had to write to you, because I am &')
  683.   Script:Put ('    so {Letter->Feeling} by JORF. In Fact, &')
  684.   Script:Put ('    {Letter->Thought}')
  685.   Script:Put
  686.   Script:Put ('    Yours Truly,')
  687.   Script:Put
  688.   Script:Put ('    {Letter->Name}')
  689.   Script:Put ('    {Letter->Street}')
  690.   Script:Put ('    {Letter->CityStZip}')
  691.   Script:Put ('  Return(Ok)')
  692.   Script:Put
  693.   Script:Put
  694.   Script:Box ('Our Letter', 5, 68)
  695.     Button:" More . . . ", Row:3, Col:24, Action:"Return(Ok)"
  696.     So I know this is stupid.  You try writing a hundred help &
  697.     screens and a half dozen program scripts!  You'll get pretty &
  698.     rummy too!
  699.   If (Kbd:Got="Esc_Key")
  700.     Return ("Esc_Key")
  701.  
  702. Script:QuickDemo1
  703.   Script:Add("Script:Quick1")
  704.   Return (Tutorial:Ret)
  705.  
  706. Script:QuickDemo2
  707.   Script:Add("Script:Quick2")
  708.   Return (Tutorial:Ret)
  709.  
  710. Script:LetterScript
  711.   New Counter
  712.   Jorf:Flush
  713.   While (Counter < 4)
  714.     Switch Counter
  715.       Case 0
  716.     Script:Add ("Script:Letter1")
  717.       Case 1
  718.     Script:Add ("Script:Letter2")
  719.       Case 2
  720.     Script:Add ("Script:Letter3")
  721.       Case 3
  722.     Script:Add ("Script:Letter4")
  723.     If (Kbd:Got='Esc_Key')
  724.       Break
  725.     Else
  726.       ++Counter
  727.   Return (Tutorial:Ret)
  728.  
  729. Script:MantraDo
  730.   Script:Say ('Mantra:Show (Level)')
  731.   Script:Box ('Show a Mantra', 11, 58)
  732.     Button:" More . . . ", Row:9, Col:20, Action:"Return(Ok)"
  733.     A Method called {Bold:"Lo"}Show{Bold:"No"} that belongs &
  734.     to the {Bold:"Lo"}Mantra{Bold:"No"} class.
  735.  
  736.     The level is the {Bold:"Lo"}Here{Bold:"No"} from the &
  737.     calling function.  We will pass this to the final &
  738.     window function, so the interpreter knows when the &
  739.     window can be deleted.
  740.  
  741.     Windows are deleted when the method that creates them &
  742.     has been completed.
  743.   If (Kbd:Got="Esc_Key")
  744.     Return ("Esc_Key")
  745.  
  746.   Script:Say ('  New (Row, Col)')
  747.   Script:Say ('  Row = Num:Rand (1, 20)')
  748.   Script:Say ('  Col = Num:Rand (1, 70)')
  749.   Script:Box ('Randomizing Row and Column', 6, 40)
  750.     Button:" More . . . ", Row:4, Col:12, Action:"Return(Ok)"
  751.     Create a random Row and Column.  The row must be &
  752.     between 1 and 20, and the column between 1 and 70.
  753.   If (Kbd:Got="Esc_Key")
  754.     Return ("Esc_Key")
  755.   Script:Say ('  Win:Add ("OM", Row, Col, 0, 0, Level)')
  756.   Script:Box ('Calling Win:Add', 10, 40)
  757.     Button:" More . . . ", Row:8, Col:12, Action:"Return(Ok)"
  758.     Call the JORF Win:Add Function.  Title is "OM". &
  759.     Row and Col we just set.
  760.  
  761.     Setting Length and &
  762.     width to zero tells the system to make a window &
  763.     just the right size.
  764.   If (Kbd:Got="Esc_Key")
  765.     Return ("Esc_Key")
  766.   Script:Say ('    Am I a butterfly that')
  767.   Script:Say ('    dreams I am a computer?')
  768.   Script:Say
  769.   Script:Say ('    Or am I a computer that')
  770.   Script:Say ('    dreams I am a Butterfly?')
  771.   Script:Say ('  Return (Ok)')
  772.   Script:Box ('Just some Text', 8, 50)
  773.     Button:" More . . . ", Row:6, Col:16, Action:"Return(Ok)"
  774.     Indented Text can be passed to methods without &
  775.     even quoting it.  This text is taken loosely   &
  776.     from the writings of Chuang-Tsu, a Chinese     &
  777.     Taoist philosopher who studied recursion and &
  778.     self-reference.
  779.   If (Kbd:Got="Esc_Key")
  780.     Return ("Esc_Key")
  781.  
  782. Script:MantraScript
  783.   New (Counter)
  784.   While (Counter < 5)
  785.     Switch Counter
  786.       Case 1
  787.     Script:Add ("Script:MantraDo")
  788.       Case 0
  789.     Script:Add ("Script:MantraStart")
  790.     If (Kbd:Got='Esc_Key')
  791.       break
  792.     Else
  793.       ++Counter
  794.   Return (Tutorial:Ret)
  795.  
  796. Script:MantraStart
  797.   Script:Say ('Mantra:Start')
  798.   Script:Box ('The Start of the Program', 5, 40)
  799.     Button:" More . . . ", Row:3, Col:12, Action:"Return(Ok)"
  800.     A Method called {Bold:"Lo"}Start{Bold:"No"} that belongs &
  801.     to the {Bold:"Lo"}Mantra{Bold:"No"} class.
  802.   If (Kbd:Got="Esc_Key")
  803.     Return ("Esc_Key")
  804.   Script:Say ('  New (Counter)')
  805.   Script:Say ('  While (Kbd:Hit==False)')
  806.   Script:Box ('A Loop', 10, 44)
  807.     Button:" More . . . ", Row:8, Col:16, Action:"Return(Ok)"
  808.     The {Bold:"Lo"}While{Bold:"No"} statement tests a condition &
  809.     and ends the loop if it is true.  In this case, the loop &
  810.     continues until {Bold:"Lo"}Kbd:Hit{Bold:"No"} is True, which &
  811.     happens when you hit a key.  {Bold:"Lo"}Kbd:Hit{Bold:"No"} remains &
  812.     True until {Bold:"Lo"}Kbd:Get{Bold:"No"} or {Bold:"Lo"}Kbd:Bye{Bold:"No"} &
  813.     is called to get the key or clear the keyboard buffer.
  814.   If (Kbd:Got="Esc_Key")
  815.     Return ("Esc_Key")
  816.   Script:Say ('    While (Counter < 40 And Kbd:Hit==False)')
  817.   Script:Say ('      Mantra:Show (Here)')
  818.   Script:Say ('      ++Counter')
  819.   Script:Box ('Count up to 40', 4, 54)
  820.     Button:" More . . . ", Row:2, Col:20, Action:"Return(Ok)"
  821.     This loop counts up to 40, but stops if you hit a key.
  822.   If (Kbd:Got="Esc_Key")
  823.     Return ("Esc_Key")
  824.   Script:Say ('    While (Counter > 0 And Kbd:Hit==False)')
  825.   Script:Say ('      Win:Del')
  826.   Script:Say ('      --Counter')
  827.   Script:Box ('Count back down', 4, 58)
  828.     Button:" More . . . ", Row:2, Col:20, Action:"Return(Ok)"
  829.     This loop counts down, and also stops if you hit a key.
  830.   If (Kbd:Got="Esc_Key")
  831.     Return ("Esc_Key")
  832.   Script:Say ('  Kbd:Bye')
  833.   Script:Say ('  Return(Ok)')
  834.   Script:Say
  835.   Script:Say
  836.   Script:Box ('Clear the Keyboard Buffer', 5, 58)
  837.     Button:" More . . . ", Row:3, Col:23, Action:"Return(Ok)"
  838.     We know a key has been hit, so we must take it out &
  839.     of the input stream.  {Bold:"Lo"}Kbd:Bye{Bold:"No"} &
  840.     will clear the keyboard buffer.
  841.   If (Kbd:Got="Esc_Key")
  842.     Return ("Esc_Key")
  843.  
  844. Script:Page_Up_Key
  845.   Return 'Back'
  846.  
  847. Script:Put Line
  848.   Win:Ptr->Text=Text:Add (Line, Win:Ptr->Text)
  849.   Str:PutLine (Line)
  850.  
  851. Script:Quick1
  852.   Script:Say ("Demo:Start")
  853.   Script:Say ('  Msg:Add ("Quick Demonstration", "Ok")')
  854.   Script:Say ('    Sure you can say "Hello World" in one line of')
  855.   Script:Say ('    C code.  But how many punctuation characters')
  856.   Script:Say ('    are required to display a dialog box like this?')
  857.   Script:Say ('  Return (Ok)')
  858.   Script:Box ('Creating a Dialog Box', 4, 56)
  859.     Button:" Press Enter to save and run this new method ", Row:2, Col:2, Action:"Return(Ok)"
  860.     The JORF Interpreter supports self writing programs!
  861.   If (Kbd:Got="Esc_Key")
  862.     Return
  863.   Return (Tutorial:Ret)
  864.  
  865. Script:Quick2
  866.   Script:Say ("Demo:Screen")
  867.   Script:Say ('  New (Rad, Chk, Inp1, Inp2)')
  868.   Script:Say ('  Win:Add ("A Real Screen", 4, 8, 14, 50, Here)')
  869.   Script:Say ('    Menu:"&Help"')
  870.   Script:Say ('      Menu:"&Indented Menu Items"')
  871.   Script:Say ('        Menu:"&Create Sub Menus"')
  872.   Script:Say ('          Menu:"&And Even Deeper"')
  873.   Script:Say ('          Menu:"&Sub Menus"')
  874.   Script:Say ('        Menu:""')
  875.   Script:Say ('        Menu:"(Escape to Exit)"')
  876.   Script:Say ('      Menu:"&Jorf Help           F1" Action:"Tutorial:F1_Key"')
  877.   Script:Say ('      Menu:"&Time and Date  Alt-F10" Action:"Tutorial:Alt_F10_Key"')
  878.   Script:Say ('    String:"  Use your Arrow Keys to go up and down.  On"')
  879.   Script:Say ('    String:"  Check Boxes and Radio Buttons, the Enter Key"')
  880.   Script:Say ('    String:"  checks and Space Bar skips.  Be sure to Press"')
  881.   Script:Say ('    String:"  Alt-H to check out the Menus and Submenus!"')
  882.   Script:Say ('    Radio:" Radio &1" Row:6 Col:8')
  883.   Script:Say ('      Check:"Rad==True", Action:"Rad=True"')
  884.   Script:Say ('    Radio:" Radio &2"')
  885.   Script:Say ('      Check:"Rad==False", Action:"Rad=False"')
  886.   Script:Say ('    ChBox:" Check Box &A" Row:6, Col:26')
  887.   Script:Say ('      Check:"Chk==True", Action:"Chk=True"')
  888.   Script:Say ('    ChBox:" Check Box &B"')
  889.   Script:Say ('      Check:"Chk==False", Action:"Chk=False"')
  890.   Script:Say ('    Input:"&Input 1  " Row:9, Col:8 Field:"Inp1"')
  891.   Script:Say ('    Input:"I&nput 2  "              Field:"Inp2"')
  892.   Script:Say ('    Button:"  &Done  "   Row:12, Col:24, Action:"Return '+"'Esc_Key'"+'"')
  893.   Script:Say ('  Return(Ok)')
  894.   Script:Say
  895.   Script:Say
  896.   Script:Box ('A Real Dialog Box', 4, 56)
  897.     Button:" Press Enter to save and run this new method ", Row:2, Col:2, Action:"Return(Ok)"
  898.     Pull Down Menus, Radio buttons, Check boxes and Prompts.
  899.   If (Kbd:Got="Esc_Key")
  900.     Return
  901.   Return (Tutorial:Ret)
  902.  
  903. Script:ThreeFoo
  904.   Script:Say ('ThreeFoo:Start')
  905.   Script:Say ('  New (Foo, Counter)')
  906.   Script:Box ('New Variables',9, 40)
  907.     Button:" More . . . ", Row:7, Col:12, Action:"Return(Ok)"
  908.     New Variables are created using the {Bold:"Lo"}New{Bold:"No"} &
  909.     command.  This line creates two new variables of the {Bold:"Lo"}Jorf{Bold:"No"} &
  910.     class called {Bold:"Lo"}Foo{Bold:"No"} and &
  911.     {Bold:"Lo"}Counter{Bold:"No"}.
  912.  
  913.     All new instances are Null when created.
  914.   If (Kbd:Got="Esc_Key")
  915.     Return ("Esc_Key")
  916.   Script:Say ('  While (Counter < 3)')
  917.   Script:Box ('While', 7, 54)
  918.     Button:" More . . . ", Row:5, Col:18, Action:"Return(Ok)"
  919.     The {Bold:"Lo"}While{Bold:"No"} command creates a loop.  This &
  920.     loop will check the value of Counter and will execute until   &
  921.     it is 3.  A {Bold:"Lo"}Break{Bold:"No"} command &
  922.     can also end a while loop.
  923.   If (Kbd:Got="Esc_Key")
  924.     Return ("Esc_Key")
  925.   Script:Say ('    Win:Add("OUR SECOND PROGRAM")')
  926.   Script:Box ('JORF Methods', 15, 40)
  927.     Button:" More . . . ", Row:13, Col:10, Action:"Return(Ok)"
  928.     This line calls the {Bold:"Lo"}Win:Add{Bold:"No"} function.  &
  929.     This is the most powerful and complex function in JORF, and &
  930.     is used for all text and input windows.
  931.  
  932.     The only parameter here is the title.  In version 2.0 of &
  933.     JORF parameters must be enclosed in parentheses.
  934.  
  935.     This line is indented from the {Bold:"Lo"}While{Bold:"No"} command &
  936.     making it part of the loop.  All indented lines are part of the loop.
  937.   If (Kbd:Got="Esc_Key")
  938.     Return ("Esc_Key")
  939.   Script:Say ('      String:"This entry window repeats three times."')
  940.   Script:Say ('      Input:"Enter Something to Say:", Wid:22, Field:"Foo"')
  941.   Script:Box ('Indented Lines',10, 60)
  942.     Button:" More . . . ", Row:8, Col:24, Action:"Return(Ok)"
  943.     Indented lines are part of the command above them.  These lines &
  944.     are passed to the {Bold:"Lo"}Win:Add{Bold:"No"} method directly above.
  945.     The two lines are Window Directives.  These look like &
  946.     JORF language commands, but are specific commands to the &
  947.     window.  The {Bold:"Lo"}String{Bold:"No"} command will &
  948.     display a line, and the {Bold:"Lo"}Input{Bold:"No"} &
  949.     command will change the value of {Bold:"Lo"}Foo{Bold:"No"}
  950.   If (Kbd:Got="Esc_Key")
  951.     Return ("Esc_Key")
  952.   Script:Say ('    ++Counter')
  953.   Script:Box ('Incrementing a Counter',5, 34)
  954.     Button:" More . . . ", Row:3, Col:10, Action:"Return(Ok)"
  955.     The {Bold:"Lo"}++Counter{Bold:"No"} &
  956.     command is just like saying {Bold:"Lo"}Counter=Counter+1{Bold:"No"}.
  957.   If (Kbd:Got="Esc_Key")
  958.     Return ("Esc_Key")
  959.   Script:Say ('    Msg:Add')
  960.   Script:Say ('      Counter is: {Counter}')
  961.   Script:Say ('      Foo is: {Foo}')
  962.   Script:Box ('Displaying Data',8, 60)
  963.     Button:" More . . . ", Row:6, Col:28, Action:"Return(Ok)"
  964.     Create a {Bold:"Lo"}Message{Bold:"No"} Box to display the &
  965.     contents of {Bold:"Lo"}Foo{Bold:"No"}.
  966.  
  967.     I use {Bold:"Lo"}Msg:Add{Bold:"No"} a &
  968.     lot when writing new routines &
  969.     to display intermediate values.  As you see here, &
  970.     you can display any stack variable just by &
  971.     enclosing it in curly brackets.
  972.   If (Kbd:Got="Esc_Key")
  973.     Return ("Esc_Key")
  974.   Script:Say ('    Foo=Null')
  975.   Script:Say ('  Return(Ok)')
  976.   Script:Box ('Assignment',6, 64)
  977.     Button:" Press Enter to Run this Method ", Row:4, Col:14, Action:"Return(Ok)"
  978.     The next line sets the value of {Bold:"Lo"}Foo{Bold:"No"} to &
  979.     {Bold:"Lo"}Null{Bold:"No"}.  If this is not done, the value of &
  980.     {Bold:"Lo"}Foo{Bold:"No"} will show as a default value &
  981.     on the second and third interations of the loop.
  982.   If (Kbd:Got="Esc_Key")
  983.     Return ("Esc_Key")
  984.   Return (Tutorial:Ret)
  985.  
  986. Tut:Basic
  987.   Title:"Basic stuff"
  988.     JORF has many basic concepts that have been proven effective
  989.     in other programming languages.
  990.  
  991.     ■ {Prompt:"&Strings" Action:"Tutorial:Box('Basic:Strings')"} are &
  992.     quoted with single or double quotes.
  993.  
  994.     ■ {Prompt:"&Comments" Action:"Tutorial:Box('Basic:Comments')"} begin with a | pipe symbol.
  995.  
  996.     ■ {Prompt:"&Numeric expressions" Action:"Tutorial:Box('Basic:Numbers')"} can &
  997.     be integers and decimals.
  998.  
  999.     ■ {Prompt:"&Type conversion" Action:"Tutorial:Box('Basic:Types')"} is &
  1000.     usually automatic in math expressions.
  1001.  
  1002.     ■ {Prompt:"Mðods" Action:"Tutorial:Box('Basic:Meth1')"} are the same as &
  1003.     subroutines, Functions are pre-programmed JORF Library routines
  1004.  
  1005. Tut:Basic1
  1006.     Title:"More Basic Stuff"
  1007.     Wid:68
  1008.     ■ Method and variable {Prompt:"&Labels" Action:"Tutorial:Box('Basic:Labels')"} are &
  1009.     the same as in C.
  1010.  
  1011.     ■ {Prompt:"&Keyboard" Action:"Tutorial:Box('Basic:Kbd1')"} keys are handled as &
  1012.     simple strings, not numbers, and are easy to test.
  1013.  
  1014.     ■ {Prompt:"&Class names" Action:"Tutorial:Box('Basic:Classes')"} are &
  1015.     separated from variable names by a colon.
  1016.  
  1017.     ■ Structure elements are referenced using &
  1018.     a ->{Prompt:"&Pointer" Action:"Tutorial:Box('Basic:Pointers')"}.
  1019.  
  1020.     ■ Parentheses surround {Prompt:"P&arameter lists" Action:"Tutorial:Box('Basic:Params')"}.
  1021.  
  1022. Tut:Basic2
  1023.   Title:"Still More Basic Stuff"
  1024.     Wid:76
  1025.     The JORF language also has some unique features:
  1026.  
  1027.     ■ {Prompt:"&Indentation" Action:"Tutorial:Box('Basic:Indent')"} controls &
  1028.     program flow, not punctuation or ENDIF commands.
  1029.  
  1030.     ■ There are no declared {Prompt:"&Data types" Action:"Tutorial:Box('Basic:DTypes')"}, &
  1031.     variables are all JORF Pointers.
  1032.  
  1033.     ■ {Prompt:"&Structures (Records)" Action:"Tutorial:Box('Basic:Strucs')"} can &
  1034.     have automatic indexes.
  1035.  
  1036.     ■ The JORF language has few {Prompt:"&key words" Action:"Tutorial:Box('Basic:KeyWords')"}, &
  1037.     most control functions are functions.
  1038.  
  1039.     ■ The JORF language handles windows using a &
  1040.     {Prompt:"&window manager" Action:"Tutorial:Box('Basic:WinMan')"}.
  1041.  
  1042.     ■ JORF handles reports using a &
  1043.     {Prompt:"&report manager" Action:"Tutorial:Box('Basic:RepMan')"}.
  1044.  
  1045. Basic:Strings
  1046.   Title:"Strings"
  1047.   A "String" is computer-ese for a data type designed to
  1048.   hold letters, words and sentences.  Most data base address
  1049.   data is stored as strings.  Even telephone numbers, employee
  1050.   numbers and Social Security numbers are stored as strings
  1051.   because the have embedded dashes (non-numeric characters).
  1052.  
  1053.   A string is:
  1054.   {Bold:"Lo"}
  1055.     "A"            A Letter
  1056.     "Hi"            A Word
  1057.     "Hi Jo"            Two Words
  1058.     "Wayland Bruns"        A Name
  1059.     "25858 Elwood Road"    An Address
  1060.     "503-824-5673"        A phone number
  1061.   {Bold:"No"}
  1062. Basic:Strings1
  1063.   Title:"Constant Strings"
  1064.   Wid:70
  1065.   Constant strings (the opposite of variable strings) are
  1066.   quoted.  You see them a lot in programs to set a message
  1067.   or title:
  1068.  
  1069.     {Bold:"Lo"}Win:Msg("Reading file, please wait . . ."){Bold:"No"}
  1070.  
  1071.   This command displayes a message at the bottom of the window
  1072.   with the string value "Reading file, Please wait . . .".
  1073.  
  1074. Basic:Strings2
  1075.   Title:"More Constant Strings"
  1076.   In the JORF language, Constant Strings are declared using
  1077.   single or double quotes.
  1078.   {Bold:"Lo"}
  1079.     "A string"            'A String'
  1080.   {Bold:"No"}
  1081.   A single quoted string may contain double quotes and vice versa.
  1082.   {Bold:"Lo"}
  1083.     "A string with a 'single quote'"
  1084.     'Another string with "Double Quotes"'
  1085.   {Bold:"No"}
  1086. Basic:Strings3
  1087.   Title:"Quoted Numbers"
  1088.   Quoted numbers are treated as strings.
  1089.   {Bold:"Lo"}
  1090.     "1"        "2"    "44.4"    Strings
  1091.     "1" + "44.4" = "144.4"    Adding catenates strings
  1092.  
  1093.     1         2    44.4    Numbers
  1094.     1   + 44.4   = 45.4        Adding is numeric
  1095.   {Bold:"No"}
  1096.   Don't be scared, if one of the operators is a number, the
  1097.   numeric type conversion is automatic.
  1098.   {Bold:"Lo"}
  1099.     "2"    + 3 = 5            Converts 2 to numeric
  1100.     "1000" * .33 = 330        Converts 1000 to numeric
  1101.   {Bold:"No"}
  1102.  
  1103. Basic:Numbers
  1104.   Title:"Integers and Decimals"
  1105.   In the JORF language, as in X-base/dBASE, you don't
  1106.   need to make any distinction between integers and
  1107.   decimals.  Numbers are converted to the "best"
  1108.   type by the runtime system.
  1109.  
  1110.   dBASE programmers and new programmers should understand
  1111.   that some languages, notably Basic, C and Pascal, have
  1112.   specific numeric types.  In these languages the programmer
  1113.   must choose the correct type, and suffer the consequences
  1114.   when the number is too large or becomes a decimal.
  1115.  
  1116. Basic:Numbers2
  1117.   Title:"More integers and Decimals"
  1118.   Because JORF is written in C, experienced programmers might
  1119.   better understand using the following chart:
  1120.  
  1121.     Number         is stored as        in a Jorf Pointer{Bold:"Lo"}
  1122.     1             Long Integer        taking 10 bytes.
  1123.     1000          Long Integer        taking 10 bytes.
  1124.     100000      Long Integer        taking 10 bytes.
  1125.     800000000000  Double        taking 10 bytes.
  1126.     345678.9999   Double        taking 10 bytes.
  1127.     1.2          Double        taking 10 bytes. {Bold:"No"}
  1128.  
  1129.   As you can see, I am not magic.  I have also decided that
  1130.   the speed advantage of Short and Float types is not worth the
  1131.   extra code space to automatically convert two more types.
  1132.  
  1133.   Also the smallest a JORF Pointer
  1134.   is {Prompt:"&10 bytes" Action:"Tutorial:Box('Basic:DataSorry')"}, even
  1135.   if it holds only one bit of information.
  1136.  
  1137. Basic:DataSorry
  1138.   Title:"Bill Smith memorial comment"
  1139.   Sorry about the minimum data size.  Experienced programmers
  1140.   will well recognize that a minimum 10 byte data size will
  1141.   fill memory and bloat data files.
  1142.  
  1143.   JORF is a high level language designed to make application
  1144.   programming fast and easy.  If you need small data use C.
  1145.   In C, bit twiddling comes easy.  The problem with C is that
  1146.   you get so busy twiddling bits that it takes a whole month
  1147.   just to write a flat file indexed data app with one screen.
  1148.  
  1149.   JORF Compensates for memory bloat by using a virtual memory
  1150.   system, and file bloat is compensated by using variable
  1151.   length records and not storing "whitespace".
  1152.  
  1153.   Face it, Bill, you have spent your life storing files that
  1154.   are 80% spaces. Why quibble about wasted bytes now!
  1155.  
  1156. Basic:Types
  1157.   Title:"Type Conversions for Math"
  1158.   Wid:70
  1159.   In the String screen, you saw how JORF uses the plus
  1160.   sign to concatenate strings.
  1161.  
  1162.     {Bold:"Lo"}"1" + "44.4" =    "144.4"    Adding catenates strings{Bold:"No"}
  1163.  
  1164.   The only math symbol with special meaning for strings
  1165.   is the plus sign, and comparison (equals, not equals,
  1166.   greater-than and less-than).
  1167.  
  1168.   Most mathematic symbols operate only on numbers.  The JORF
  1169.   language automatically converts all expressions to numbers
  1170.   when doing math:
  1171.   {Bold:"Lo"}
  1172.     "2" *  "10"     = 20       Converts to numeric
  1173.     "2.2" / "10"    = .22      Converts to numeric
  1174.   {Bold:"Lo"}
  1175.  
  1176. Basic:Types1
  1177.   Title:"More math conversions"
  1178.   Wid:70
  1179.   The JORF language also converts from integer to floating
  1180.   point - and back!
  1181.   {Bold:"Lo"}
  1182.     57   /   8      = 7.125            Converts to Floating Point
  1183.     12.5 *   2      = 25               Converts to Integer
  1184.   {Bold:"No"}
  1185.   The Modulus and bitwise operators always returns integer results.
  1186.   {Bold:"Lo"}
  1187.     8 % 3      = 2                Integer remainder of division.
  1188.   {Bold:"No"}
  1189.   The one thing that is not converted is strings that are formatted
  1190.   as numbers with commas.  Luckily, there is a nice JORF function
  1191.   so you can do this by hand:
  1192.   {Bold:"Lo"}
  1193.     "24,400.00"         * .07 = 1.68     Just takes up to comma
  1194.     To:Num("24,400.00") * .07 = 1680     To:Num knows about commas
  1195.   {Bold:"No"}
  1196. Basic:Types2
  1197.   Title:"Comma decimals"
  1198.   Wid:70
  1199.   There is an international comma-decimal setting for Argentina
  1200.   and other countries where the comma marks the decimal position.
  1201.   {Bold:"Lo"}
  1202.     To:Num("24.400,00") * .07 = 1680     Decimal = "," in INI file
  1203.   {Bold:"No"}
  1204.   The JORF language allows standard programs to support both
  1205.   decimal formats without changes.  MS-FoxPro can't even do that!
  1206.  
  1207. Basic:Types3
  1208.   Title:"Non-Math conversions"
  1209.   Wid:70
  1210.   There are some data types, like Times and Dates, use special
  1211.   functions to add, instead of mathematical operations.
  1212.   {Bold:"Lo"}
  1213.    Date:Add("10/12/93",1,0,0)    Add one day,    Result "10/13/93"
  1214.    Date:Sub("10/12/93",0,1,0)    Sub one month,  Result "09/12/93"
  1215.    Date:Add("10/12/93",0,0,1)    Add one year,   Result "10/12/94"
  1216.  
  1217.    Time:Add("10:23:44",1,0)    Add one minute, Result "10:24:44"
  1218.    Time:Sub("10:23:44",0,1)    Sub one hour,   Result "09:24:44"
  1219.   {Bold:"No"}
  1220.   Please notes that date string conversion is subject to your
  1221.   current international date formatter.
  1222.  
  1223. Basic:Types4
  1224.   Title:"More Non-Math conversions"
  1225.   Wid:70
  1226.   The text data type also uses functions to add:
  1227.   {Bold:"Lo"}
  1228.    Text:Add("New Line",Text)    Adds "New Line" to bottom of Text.
  1229.    Text:Chg("Chg Line",Text)    Changes current line of text.
  1230.   {Bold:"No"}
  1231.   Structures can be "Added" too, but now we are getting really
  1232.   obscure.  Don't try this unless you are an OOP Guru!
  1233.   {Bold:"Lo"}
  1234.    Jorf:Move(Stru1,Stru2,"Class")     Move elements of Structures
  1235.   {Bold:"No"}
  1236.   That command moves the elements of Stru1 that belong to "Class"
  1237.   to Stru2, adding if necessary.
  1238.  
  1239.   If you _are_ an OOP guru, did I just make your day?  Isn't that
  1240.   the comand you always wanted to quickly shift blocks of elements
  1241.   from one structure to another?
  1242.  
  1243. Basic:Labels
  1244.   Title:"Labels"
  1245.   Labels are little sticky things you use in mass-mailings.
  1246.  
  1247.   Labels are also a computer term for function names, method
  1248.   names, and variable names.
  1249.  
  1250.   In JORF, labels can be in both upper and lower case, can
  1251.   include any letter or the underscore character, and can
  1252.   contain numbers, but not in the first character.
  1253.  
  1254.     Legal Labels:
  1255.   {Bold:"Lo"}
  1256.        MyVariable    All Letters
  1257.        Num1        Letters, trailing number
  1258.        Con_Stru        Underscore Ok
  1259.        _Und        Leading underscore Ok
  1260.   {Bold:"No"}
  1261.     Illegal Labels
  1262.   {Bold:"Lo"}
  1263.        My-Variable        No embedded math symbols
  1264.        1Num        No leading number
  1265.   {Bold:"No"}
  1266.  
  1267. Basic:Classes
  1268.   Title:"Class designations"
  1269.   Wid:70
  1270.   Because JORF is an OOP language, lots of labels have a
  1271.   class designation in front.  These are separated by
  1272.   a colon.
  1273.   {Bold:"Lo"}
  1274.     New (Contact:Con1)    New Variable Con1 belongs to Contact class
  1275.     Contact:Show()    Method Show belongs to the Contact class
  1276.   {Bold:"No"}
  1277.  
  1278. Basic:Classes1
  1279.   Title:"Class designations"
  1280.   Wid:70
  1281.   JORF Functions and window commands also use colons, even
  1282.   when there is no real class.  I call these "pseudo-classes"
  1283.   because a class-like grouping is implied even when no such
  1284.   class exists.
  1285.   {Bold:"Lo"}
  1286.     Win:Add()        Add function for a new Window
  1287.     Win:Del()        Delete function for a window
  1288.  
  1289.     Num:Str()        Format Number as a String
  1290.     Date:Str()        Format Date as a String
  1291.     Time:Str()        Format Time as a String
  1292.   {Bold:"No"}
  1293.   "Pseudo-Classes" are my own invention, not something that is
  1294.   truly OOP.  So don't brag about them to
  1295.   the {Prompt:"&Academic guys" Action:"Tutorial:Box('Basic:Academics')"}.
  1296.   The reason I introduced them is to provide a nice visual
  1297.   consistency to JORF language programs.
  1298.  
  1299. Basic:Academics
  1300.   Title:"Academic Guys"
  1301.   The {Bold:"Lo"}Academic guys{Bold:"No"}" are the
  1302.   college professors who talk and talk
  1303.   about {Bold:"Lo"}paradigms{Bold:"No"}, but who don't seem to
  1304.   understand what grunt programmers need in a language.
  1305.  
  1306.   I often wonder if any of these self styled
  1307.   programming experts have really sat across
  1308.   a table from a company owner and
  1309.   negotiated the price of programming a custom Accounts
  1310.   Receivable program; and
  1311.   then {Bold:"Lo"}delivered{Bold:"No"} the program!
  1312.  
  1313.   The Academics {Bold:"Lo"}talk{Bold:"No"} a lot about paradigms,
  1314.   and they {Bold:"Lo"}draw salary{Bold:"No"} by
  1315.   inventing {Bold:"Lo"}five syllable words{Bold:"No"}.
  1316.   I get paid for {Bold:"Lo"}results{Bold:"No"}, if my results take
  1317.   longer than my bid, I go poor and hungry.
  1318.  
  1319. Basic:Pointers
  1320.   Title:"Structure (Record) Pointers"
  1321.   JORF supports the use of Structures, a feature
  1322.   native to the Pascal and C languages.  But you
  1323.   will often see me note "Record" when I talk of
  1324.   structures, since JORF structures have a
  1325.   "Record" nature in common with data base
  1326.   languages like dBASE.
  1327.  
  1328.   It really depends on your background.
  1329.  
  1330.     If you are a C or Pascal programmer, a
  1331.     Structure is a Structure.
  1332.  
  1333.     If you are a dBASE programmer, a structure
  1334.     is a record.  But a structure can also be
  1335.     indepenent of a file.  A "memory-record".
  1336.  
  1337.     If you are a Smalltalk programmer, a
  1338.     Structure is an Unstructured Set.
  1339.  
  1340. Basic:Pointers1
  1341.   Title:"Declaring a structure"
  1342.   A Structure is declared using the Class key word.
  1343.   The structure definition is positioned in a
  1344.   program just like a method definition.
  1345.   {Bold:"Lo"}
  1346.     Class:MyClass Elm1, Elm2, Elm3
  1347.   {Bold:"No"}
  1348.   In the class definition punctuation and commends
  1349.   are ignored and the defnition can go on for several
  1350.   lines.  I often use this "vertical" definition
  1351.   for classes with more than 3 elements:
  1352.   {Bold:"Lo"}
  1353.     Class:Contact
  1354.       FullName        | Name
  1355.       Address1        | Street Addrss
  1356.       Address2        | City State Zip
  1357.       WorkPhone        | WOrk Phone number
  1358.   {Bold:"No"}
  1359.  
  1360. Basic:Pointers2
  1361.   Title:"More about Pointers"
  1362.   Wid:70
  1363.   To access the members of the structure, the pointer
  1364.   operator -> is used.
  1365.   {Bold:"Lo"}
  1366.   MyMethod:Start
  1367.     New (Contact:Con)          | Con is a Contact Structure
  1368.     Con->FullName = "Josphine"    | Setting the name
  1369.     Con->Address1 = "The Farm"      | Setting the Address
  1370.     Con->Address2 = "Colton"      | Setting the City
  1371.  
  1372.     Str:Put(Con->FullName)      | Print the name on the screen
  1373.     Str:Put(Con)          | Wrongo - Nothing to print
  1374.   {Bold:"No"}
  1375.   You can see in this fragment that the structure Con has
  1376.   a pointer nature.  Con by itself does not display (displays
  1377.   null) because there is no defined string conversion for
  1378.   the structure.  But the elements print, because each element
  1379.   is a discrete string value.
  1380.  
  1381.   If you are new to programming, just let this stuff flow by.
  1382.   You will pick it up very fast as you see how these pointers
  1383.   are used.  If you are experienced, you probably know all
  1384.   this stuff already.
  1385.  
  1386. Basic:Params
  1387.   Title:"Parameters"
  1388.   Calls to functions and methods in the JORF language can have
  1389.   parameters, surrounded by parentheses:
  1390.   {Bold:"Lo"}
  1391.     Win:Add("My Window",4,4,10,40)
  1392.     Win:Msg("Don't stop now!")
  1393.   {Bold:"No"}
  1394.   The first command creates a window titled "My Window" at
  1395.   row 4, column 4 on the screen.  The window length is 10 rows
  1396.   and the window width is 40 characters.
  1397.  
  1398.   The second command displays a message "Don't stop now!".
  1399.   The Win:Add and Win:Msg functions use parameters (the stuff
  1400.   inside parentheses) to know what to do.  JORF Functions
  1401.   (the pre-built commands documented in the reference guide)
  1402.   and Methods (the commands you build) both use parameters in
  1403.   the same way.
  1404.  
  1405. Basic:Params1
  1406.   Title:"Parameters"
  1407.   An unusual feature of the JORF Language is that parameters
  1408.   may be freely omitted from any command line.  If a paramter
  1409.   is omitted, the called function or method will see only
  1410.   a null parameter, not an error as in dBASE or a crash as in C.
  1411.   {Bold:"Lo"}
  1412.     Win:Add("My Window")
  1413.     Win:Msg
  1414.   {Bold:"No"}
  1415.   is exactly the same as
  1416.   {Bold:"Lo"}
  1417.     Win:Add("My Window",0,0,0,0)
  1418.     Win:Msg("")
  1419.   {Bold:"No"}
  1420.   Most JORF functions have pre-defined defaults for these empty
  1421.   commands.  The Win:Add function above will create a window
  1422.   in the middle of the screen, with a length of 10 rows and a
  1423.   width of 30 characters.  The Win:Msg function, when empty, will
  1424.   erase the prior message from the window frame.
  1425.  
  1426.   This isn't too hard, is it?
  1427.  
  1428. Basic:Params2
  1429.   Title:"Parameters"
  1430.   The Text data type is difficult to express as a constant.  How
  1431.   do you fit in one line, text that takes multiple lines.  In JORF,
  1432.   you don't have to.  Instead, text can be indented from the command:
  1433.   {Bold:"Lo"}
  1434.     Msg:Add("My Message","Ok")
  1435.       This is my message,
  1436.       do you like it?
  1437.   {Bold:"No"}
  1438.   In the above command, the message box function Msg:Add is getting
  1439.   _Three_ parameters.  "My Message" is the title, "Ok" designates an
  1440.   "Ok" box, and the third parameter is the text on the next line.
  1441.  
  1442. Basic:Params3
  1443.   Title:"Parameters"
  1444.   In JORF, any function or method called with
  1445.  
  1446.     {Bold:"Lo"}A) a missing parameter   {Bold:"No"}    and
  1447.     {Bold:"Lo"}B) indented lines beneath{Bold:"No"}
  1448.  
  1449.     will have the indented lines passed as the last parameter.
  1450.  
  1451.   This system gives a nice way to make text boxes without a lot of
  1452.   quotes, commas or other nasty formatting considerations.
  1453.  
  1454. Basic:Indent
  1455.   Title:"Indentation controls program flow"
  1456.   Pascal and dBASE use ENDIF, C uses brackets and semi-colons,
  1457.   and BASIC does not use anything.  Yet in each of these languages,
  1458.   you are expected to indent.
  1459.  
  1460.   In JORF, all you have to do is indent.  Indenting controls
  1461.   program flow.  No ENDIF, brackets, no semi-colons, just nicely
  1462.   structured indented code.
  1463.   {Bold:"Lo"}
  1464.         What could be easier?
  1465.   {Bold:"No"}
  1466.  
  1467. Basic:Indent1
  1468.   Title:"Some examples of indenting"
  1469.   Wid:70
  1470.   A method has the method name and parameter list on top, and each line
  1471.   of the method is indented. IF, While and Switch statments
  1472.   are indented.
  1473.   {Bold:"Lo"}
  1474.     MyClass:MyMethod(Param1,Param2)    |Method Label, Params
  1475.       New (A,B)                |New variables go first
  1476.       A = Param1                        |Command lines follow
  1477.       B = Param2 * 20                   |  (just playing here)
  1478.       If (B > 10)            |Test B if true
  1479.     Str:Put("A = "+A+" and B="+B)    |  do indented lines
  1480.       Else                |else
  1481.     Str:Put("B is less than 10")    |  do next indented section
  1482.     B = 10                          |  until outdent!
  1483.       Str:Put("This line always prints")|This line always prints
  1484.       Return (Ok)
  1485.   {Bold:"No"}
  1486.   Take some time to understand it all.  Once you get used to the
  1487.   indenting, programming will be easy.  I usually indent two spaces,
  1488.   and all the samples are written that way, but you can indent one
  1489.   or ten, doesn't really matter.
  1490.  
  1491. Basic:Indent1
  1492.   Title:"Indentation also declares text data types"
  1493.   Constant text data can also be indented and passed as a parameter.
  1494.   This is how a window with buttons is created.  The "Button" syntax
  1495.   looks a little like methods, but is really just a consistent-look
  1496.   way of declaring window fields.
  1497.   {Bold:"Lo"}
  1498.     Basic:IndentExample
  1499.       New (Field1,Field2,Field3)
  1500.       Win:Add("My Windows")
  1501.     String:"Press TAB between fields"
  1502.     Input:"This is field 1" Field:"Field1"
  1503.     Input:"This is field 2" Field:"Field2"
  1504.     Input:"This is field 3" Field:"Field3"
  1505.     Button:"&Ok" Col:5 Wid:30
  1506.       Msg:Add("Result","Ok")
  1507.     Field1 is {"{"}Field1{"}"}
  1508.     Field2 is {"{"}Field2{"}"}
  1509.     Field3 is {"{"}Field3{"}"}
  1510.       Return (Ok)
  1511.   {Bold:"No"}
  1512.   Try out this sample.  Ready...Set... {Prompt:"&Go" Action:"Basic:IndentExample"}.
  1513.  
  1514. Basic:IndentExample
  1515.   New (Field1,Field2,Field3)
  1516.  
  1517.   Win:Add("My Windows")
  1518.     String:"Press TAB between fields"
  1519.     Input:"This is field 1" Field:"Field1"
  1520.     Input:"This is field 2" Field:"Field2"
  1521.     Input:"This is field 3" Field:"Field3"
  1522.     Button:"&Ok" Col:5 Wid:30
  1523.  
  1524.   Msg:Add("Result","Ok")
  1525.     Field1 is {Field1}
  1526.     Field2 is {Field2}
  1527.     Field3 is {Field3}
  1528.   Return (Tutorial:Ret)
  1529.  
  1530. Basic:DTypes
  1531.   Title:"The JORF Data Type"
  1532.   Wid:70
  1533.   Most languages provide data types that relate directly to
  1534.   data objects that the CPU can handle.  These include bytes,
  1535.   integers and floating point numbers.
  1536.  
  1537.   The JORF Language is uses only one data type;
  1538.   a {Bold:"No"}JORF Pointer{Bold:"No"}.  In your program,
  1539.   all you need to do is declare a new variable, put data
  1540.   into it, and let JORF take care of the reset.
  1541.  
  1542.   A {Bold:"Lo"}Jorf{Bold:"No"} can hold
  1543.  
  1544.    ∙ {Bold:"Lo"}Integers       {Bold:"No"}    88    or    -282
  1545.    ∙ {Bold:"Lo"}Floating point {Bold:"No"}    5.68989   or  232,000,000.01
  1546.    ∙ {Bold:"Lo"}Strings        {Bold:"No"}    Title:"Hello"   or   Title:"Josephine"
  1547.    ∙ {Bold:"Lo"}Dates          {Bold:"No"}    10/12/93
  1548.    ∙ {Bold:"Lo"}Times          {Bold:"No"}    11:20
  1549.    ∙ {Bold:"Lo"}Text           {Bold:"No"}    The contents of this window
  1550.    ∙ {Bold:"Lo"}Arrays         {Bold:"No"}    A directory list of files
  1551.    ∙ {Bold:"Lo"}Structures     {Bold:"No"}    Defined Class (Indexed Record)
  1552.  
  1553. Basic:DTypes1
  1554.   Title:"Dates in JORF"
  1555.   Wid:76
  1556.   I want to take a minute here to insult Ashton-Tate, Borland and
  1557.   Microsoft.  In the dBASE language, dates are "International".
  1558.   Formats are supported for:
  1559.  
  1560.       AMERICAN FRENCH ITALIAN BRITISH or JAPAN
  1561.  
  1562.   In dBASE land, dates for white people use the name of
  1563.   their language as a key word.  Yellow people have to use
  1564.   their country name.  People from Africa must pick
  1565.   from the list of White languages or Yellow countries.
  1566.  
  1567.   These command word happened because the racial bias of
  1568.   the programmers influenced the command set. Smarter
  1569.   programmers strive for racial and ethnic equality in
  1570.   all their programming efforts.
  1571.  
  1572.   I guess Microsoft and Borland (who now market dBASE
  1573.   compatable products) are waiting for little Wayland to
  1574.   show them how to accomodate various date formats without
  1575.   any unintended ethnic slurs.
  1576.  
  1577. Basic:DTypes2
  1578.   Title:"Dates in JORF"
  1579.   There actually two "date formats" that change from country
  1580.   to country. dBASE only addresses the short format.
  1581.  
  1582.   Short Format:
  1583.   {Bold:"Lo"}
  1584.     DD/MM/YY        | Most of the world uses this
  1585.     MM/DD/YY        | Americans use this
  1586.     YY/MM/DD        | Many oriental countries use this.
  1587.   {Bold:"No"}
  1588.   Long Format:
  1589.   {Bold:"Lo"}
  1590.     20 Mars, 1993        | A Frenchman might like this
  1591.     March 20, '93        | An American might like this
  1592.     March 20, '00       | Just seven years away?
  1593.   {Bold:"No"}
  1594.   Dates are handled in JORF by using format strings.  The default
  1595.   format is American (not racist, just shows where I live) but you
  1596.   can easily change the format to any other.
  1597.  
  1598. Basic:DTypes3
  1599.   Title:"Dates in JORF"
  1600.   The Month names for the long format are held in a month name
  1601.   table.  There is also a table to set weekday names and even the
  1602.   AMPM indicator.  The Date:Set funcion allows you to set these names.
  1603.   Once set, you are free to use the month names throughout your
  1604.   program.
  1605.  
  1606.   The really nice thing about the JORF system is that dates
  1607.   throughout your program are handled through one set of formatters.
  1608.   This system is a tad more difficult than dBASE. But joy of
  1609.   knowing that a person in Argentina can use your program, yet see
  1610.   her dates print normally (for her), is enough to make it
  1611.   worth the effort.
  1612.  
  1613. Basic:Strucs
  1614.   Title:"Fun with Structures (Records)"
  1615.   If you are reading in order, you have already seen that
  1616.   a structure is declared with the key word class.
  1617.   {Bold:"Lo"}
  1618.     Class:MyClass Elm1, Elm2, Elm3
  1619.   {Bold:"No"}
  1620.   And structures can be multiple line declarations with
  1621.   comments.
  1622.   {Bold:"Lo"}
  1623.     Class:Contact
  1624.       FullName        | Name
  1625.       Address1        | Street Addrss
  1626.       Address2        | City State Zip
  1627.       WorkPhone        | WOrk Phone number
  1628.   {Bold:"No"}
  1629.   But there is more, oh so much more!
  1630.  
  1631. Basic:Strucs
  1632.   Title:"More Fun"
  1633.   Structures have a record nature, and no place is this
  1634.   more evident than in the Index key word.
  1635.   {Bold:"Lo"}
  1636.     Class:Contact
  1637.       Index:FullName    | Field Fullname is an Index
  1638.       Address1        | Street Addrss
  1639.       Address2        | City State Zip
  1640.       Index:WorkPhone    | Work Phone is also an index
  1641.   {Bold:"No"}
  1642.   When declare a variable that belongs to this class,
  1643.   you get automatic indexing.  Whenever you add a new
  1644.   variable, the {Prompt:"&Indexes" Action:"Tutorial:Box('Basic:GayLord')"}
  1645.   will be added automatically.  When you change values, the
  1646.   indexes are changed, and when you delete the structure the
  1647.   indexes are deleted.
  1648.   {Bold:"Lo"}
  1649.     ■ You don't even have to declare an index file name.
  1650.     ■ You can have up to 256 indexes per structure.
  1651.   {Bold:"No"}
  1652.  
  1653. Basic:Strucs1
  1654.   Title:"Still more Fun"
  1655.   Wid:70
  1656.   There is another key word in a structure definition,
  1657.   and that is Parent.  When you declare a parent, you
  1658.   declare that all the elements of the parent are in
  1659.   the current structure.
  1660.   {Bold:"Lo"}
  1661.     Class:Customer
  1662.       Index:Number    | Customer Number
  1663.       Parent:Contact    | Declares all contact fields and indexes.
  1664.       Invoice           | Invoice array
  1665.   {Bold:"No"}
  1666.   NOTE: To make a pointer to another structure you don't
  1667.   need to declare anything.  Just set an element in
  1668.   the structure to point to the other structure.  For instance
  1669.   in the example above, the Invoice declaration can be an
  1670.   array of pointer to an index structure.  This leads to
  1671.   some involved pointering that will relieve experienced
  1672.   programmers and scare new ones.
  1673.   {Bold:"Lo"}
  1674.      Cust->Invoice[1]->Date  | Customer's first invoice date
  1675.   {Bold:"No"}
  1676.  
  1677. Basic:Struc2
  1678.   Title:"Parents"
  1679.   Back to parents, skipping the fancy array pointer stuff.
  1680.   {Bold:"Lo"}
  1681.     Class:Customer
  1682.       Index:Number    | Customer Number
  1683.       Parent:Contact    | Declares all contact fields and indexes.
  1684.   {Bold:"No"}
  1685.   What we have here is a class definition that declares a
  1686.   new type of structure.  One element, which is indexed, is
  1687.   a structure.  The next line is not an element at all, but
  1688.   a declaration that ALL the elements of Class:Contact are
  1689.   now declared here, including ALL the indexes, AND ALL
  1690.   the Sub-Parents.
  1691.  
  1692.   In ADDITION, any polymorphic calls using the Customer
  1693.   class will, if no method is found, also search methods in
  1694.   the Contact class.
  1695.  
  1696.   In Conclusion, the Parent key word does two things:
  1697.   {Bold:"Lo"}
  1698.     1) It declares another structure's elements
  1699.     2) It declares another classes methods for polymorphism.
  1700.   {Bold:"No"}
  1701.   Polymorphism is only useful in complex programs.  If you are
  1702.   not writing complex programs, don't worry.  When you start
  1703.   writing complex programs, you will see how polymorphism fills
  1704.   a specific need in the maintenance of those programs.
  1705.  
  1706. Basic:"Gaylord"
  1707.   Title:"Alfred Gaylord Memorial Message"
  1708.   Wid:70
  1709.   Al says that the proper plural for "Index" is
  1710.   "Indices", not "Indexes" as I use.  Alfred likes
  1711.   to see English as a "proper language".
  1712.  
  1713.   The word Index comes from a latin root, and
  1714.   if I were speaking latin I would agree that "Indices"
  1715.   is correct.
  1716.  
  1717.   But the word sounds Saxon, like most Americans, the
  1718.   sound of a saxon word suggests the saxon plural "Indexes".
  1719.  
  1720. Basic:Comments
  1721.   Title:"Comments"
  1722.   Comments are started using a pipe | symbol (so named because
  1723.   of UNIX usage of the same symbol for "data pipes".
  1724.  
  1725.   On the screen, the symbol looks like a stretched colon,
  1726.   when printed, the symbol turns into a solid line.  The
  1727.   engineer's who designed this difference were probably paid
  1728.   salary, even if it didn't make sense.
  1729.  
  1730.   The reason I chose the pipe is that it looks nice when
  1731.   commenting on the side because you get a nice continuous
  1732.   line between your code and your comments.
  1733.  
  1734.   So comment often, make nice lines, make readable code.
  1735.  
  1736. Basic:KeyWords
  1737.   Title:"KeyWords"
  1738.   Wid:70
  1739.   There are so few Key words in JORF that I can list them all
  1740.   here:
  1741.   {Bold:"Lo"}
  1742.     Class   - Declares a structure definition.
  1743.     Parent  - Declares a class inheritance of elements and methods.
  1744.     Jorf    - The Class of a variable with no declared class.
  1745.     Index   - In a class definition, an automatic index field.
  1746.     Poly    - Class Prefix for a polymorphic method call.
  1747.     And     - I got tired of &&.
  1748.     Or      - I got really tired of ??.
  1749.   {Bold:"No"}
  1750.   That is all.  Every other command, including TRUE, IF and NULL
  1751.   are function calls.  While I don't expect anyone to change these
  1752.   basic functions, they can be changed and are no more key words
  1753.   than strcpy() in the C language.
  1754.  
  1755.  
  1756. Basic:WinMan
  1757.   Title:"Window Manager"
  1758.   Wid:64
  1759.   The JORF Language uses a specialized Window manager to
  1760.   handles menus, buttons and inputs in windows.  This manager
  1761.   is not a multi-level library or a code generator system. It
  1762.   is not object oriented in any particular way, nor is it
  1763.   very flexible.  There is no message passing WinProc.
  1764.   {Bold:"Lo"}
  1765.             It is Easy!
  1766.   {Bold:"No"}
  1767.   At least, it is a easy as you can get for a system that
  1768.   lets you program multi-level menus, input lines, input
  1769.   text, buttons check boxes, radio buttons, and hypertext
  1770.   prompts.
  1771.  
  1772.   My goal was to create a system where you could write a
  1773.   complete application window in less time than it takes
  1774.   to think of a neat design for the window.
  1775.  
  1776. Basic:RepMan
  1777.   Title:"Report Manager"
  1778.   Oh how I wish the report system was as well developed
  1779.   as the Window handling system.
  1780.  
  1781.   Then I remember, that C and Pascal have neither. dBASE and
  1782.   Smalltalk have Ok screen management but primitive Report
  1783.   writing.  So I am no worse than them, am I?
  1784.  
  1785.   The report system as it stands now does just fine at creating
  1786.   flat reports, include any structure element or sub-element, and
  1787.   even writing mergeletter and text fields.
  1788.  
  1789.   Still to be added (soon?) is the full multi-level system
  1790.   for properly handling many-to-one relations so you can
  1791.   report on arrays and sub-records.
  1792.  
  1793.   This text was written March 20, 1993.  Who knows, by now
  1794.   maybe I have introduced Version 2.11 and added the
  1795.   new reporting features.  Write or call.
  1796.  
  1797. Basic:Meth1
  1798.   Title:"Methods"
  1799.   Wid:64
  1800.   A {Bold:"Lo"}Method{Bold:"No"} is the OOP way
  1801.   of saying "Function" or "Subroutine".  Methods
  1802.   are procedural routines to perform a specific task.
  1803.  
  1804.   In Non-OOP languages like {Bold:"Lo"}BASIC{Bold:"No"}
  1805.   and {Bold:"Lo"}C{Bold:"No"}, all variables
  1806.   belong to a data type.  But subroutines and functions
  1807.   exist independent of the data types.
  1808.  
  1809.   In OOP languages like {Bold:"Lo"}JORF{Bold:"No"} and {Bold:"Lo"}Smalltalk{Bold:"No"}, all methods
  1810.   belong to a class.  Methods that work on Strings belong
  1811.   to the String class.  Methods that print Addresses belong
  1812.   to the Address class.
  1813.  
  1814. Basic:Meth2
  1815.   Title:"Method Declarations"
  1816.   Wid:62
  1817.   In JORF, the class of a method prefixes the method name. The
  1818.   following code fragment defines the class address and
  1819.   a {Bold:"Lo"}print{Bold:"No"} method for that class:
  1820.   {Bold:"Lo"}
  1821.       Class:Address Name Address City State Zip
  1822.       Address:Print(A)
  1823.       Print (A->Name)
  1824.       Print (A->Address)
  1825.       Print (A->City + "," + A->State + " " + A->Zip)
  1826.   {Bold:"No"}
  1827.   A {Bold:"Lo"}Class{Bold:"No"} and
  1828.   it's {Bold:"Lo"}Methods{Bold:"No"}
  1829.   are packaged together to form an {Bold:"Lo"}Object{Bold:"No"}
  1830.   which is why this
  1831.   is called Object Oriented Programming.
  1832.  
  1833.   The packaging of classes and methods is
  1834.   called {Bold:"Lo"}Encapsulation{Bold:"No"}
  1835.   because Computer Scientists and Engineers
  1836.   get a kickback when they
  1837.   obfuscate with five syllable words.
  1838.  
  1839. Basic:Meth3
  1840.   Title:"The Starting Method"
  1841.   Wid:72
  1842.   JORF language programs always begin with a
  1843.   method called {Bold:"Lo"}Class:Start{Bold:"No"}
  1844.   where {Bold:"Lo"}class{Bold:"no"} is the name of
  1845.   the source code file.   This sample is in the {Bold:"Lo"}Hello.J{Bold:"no"} source file:
  1846.   {Bold:"Lo"}
  1847.     Hello:Start
  1848.       Msg:Add (Null, "Ok")
  1849.         Welcome to the World of JORF!
  1850.       Return (Ok)
  1851.   {Bold:"No"}
  1852.   The first line is the method declaration.  Methods
  1853.   are declared flush left, and the rest of the method
  1854.   is indented.
  1855.  
  1856.   The second command calls the JORF Message Window function
  1857.   specifying a Null title, and a button type "Ok".  The
  1858.   indented line is the text of the message.  The last line
  1859.   calls returns control to the calling method.
  1860.  
  1861.   Press G to run the program:  Ready... Set... {Prompt:"&Go" action:"Basic:Hello"}
  1862.  
  1863. Basic:Hello
  1864.   Msg:Add (Null, "Ok")
  1865.     Welcome to the World of JORF!
  1866.   Return (Ok)
  1867.  
  1868.  
  1869. Basic:Kbd
  1870.   Title:"Keyboard Entry"
  1871.   Wid:56
  1872.   Keyboard entry is handled using one of three
  1873.   commands. {Bold:"Lo"}Win:Pause{Bold:"No"} takes
  1874.   a parameter for the number of hundredths of seconds to pause, and
  1875.   will end and return a keystroke if the operator hits a key.
  1876.  
  1877.   The {Bold:"Lo"}Kbd:Hit{Bold:"No"} returns {Bold:"Lo"}True{Bold:"No"}
  1878.   if the operator has hit a key, and the {Bold:"Lo"}Kbd:Get{Bold:"No"}
  1879.   command returns a keystroke.
  1880.  
  1881.   JORF returns keystrokes as "Strings".  When you enter an "A", JORF
  1882.   returns a string, five characters long, with the value "A_Key".  JORF does
  1883.   not return 41, the ASCII value of "A", like most languages.
  1884.  
  1885. Basic:Kbd1
  1886.   Title:"Testing Keystrokes"
  1887.   Wid:68
  1888.   To test the keys, you test the string.  For instance, if
  1889.   you want to test to see if the operator hit a normal letter
  1890.   or number key, test the second through fifth characters to
  1891.   see if they are {Bold:"Lo"}"_Key"{Bold:"No"}.
  1892.   {Bold:"Lo"}
  1893.        WhatKey:Start
  1894.      New (Key)
  1895.          Key=Kbd:Get
  1896.          If ((Str:At Key 2 4)="_Key")
  1897.        Str:Put "It Was the {"{"}String:At Key 1 1{"}"} Key"
  1898.      Return (Ok)
  1899.   {Bold:"No"}
  1900.   To get the value of a key, use the {Bold:"Lo"}To:ASCII{Bold:"No"}
  1901.   function.  It returns the ASCII Decimal value of the
  1902.   first character of a string.
  1903.   {Bold:"Lo"}
  1904.            Value=To:ASCII Key
  1905.   {Bold:"No"}
  1906.  
  1907. Basic:Kbd2
  1908.   Title:"The Mantra Program"
  1909.   Wid:68
  1910.   This next sample programs will display some windows
  1911.   and get some keyboard entry.  One of my pet projects
  1912.   is making computers say Mantras, and idea proposed by
  1913.   Edsger Dijkstra many years ago.
  1914.  
  1915.   Tibetan Buddhists use mechanical prayer
  1916.   wheels to pray more quickly and efficiently.
  1917.   Japanese Buddhists of the Amida sect believe
  1918.   that anyone who says "Amida" with pure
  1919.   heart will go to heaven, so they say it as many times as possible
  1920.   in hopes of forgetting and saying it with pure heart once in their lives.
  1921.  
  1922.   This Mantra system combines these ideas just in case they
  1923.   may be right.  Who can have purer heart than a
  1924.   computer?  If you run a Mantra system often, perhaps
  1925.   your computer will also forget and therefore insure your place in heaven.
  1926.  
  1927. Basic:Kbd3
  1928.   Script:"MantraScript" "Mantra:Start"
  1929.   Title:"Data Display and Entry"
  1930.   Wid:70
  1931.   ■ In JORF, only the top Window is active.  JORF Windows are more
  1932.   limited and easier to program than most MS-Windows tools.
  1933.  
  1934.   ■ JORF Keyboard commands get keys as Strings.
  1935.   The {Bold:"Lo"}To:ASCII{Bold:"No"} function can be
  1936.   used to convert these strings to numeric values.
  1937.  
  1938.  
  1939. Adv:Arrays
  1940.   Title:"Arrays"
  1941.   Arrays are created by referencing a variable
  1942.   using an offset in [square brackets].
  1943.  
  1944.         {Bold:"Lo"}New(Foo)      {Bold:"No"}
  1945.         {Bold:"Lo"}Foo[5]=10     | Foo is now an array{Bold:"No"}
  1946.  
  1947.   Arrays are allocated to the largest member you have
  1948.   referenced.  The interpreter expands them as necessary
  1949.   as you reference higher numbers.  Custom dictates the first
  1950.   element is 1, although if you want, element zero is available.
  1951.  
  1952. Adv:Poly
  1953.   Title:"Polymorphism"
  1954.   Wid:66
  1955.   Sethod calls are usually specified using
  1956.   both the class and method name. For example, to
  1957.   print elements from a contact structure you use:
  1958.   {Bold:"Lo"}
  1959.            Contact:Print(C)
  1960.   {Bold:"No"}
  1961.   To make a polymorphic, use the key word {Bold:"Lo"}Poly{Bold:"No"}.
  1962.   {Bold:"Lo"}
  1963.            Poly:Print(C)
  1964.   {Bold:"No"}
  1965.   When {Bold:"Lo"}Poly{Bold:"No"} is used, the actual method
  1966.   called will depend on the class of the first parameter of
  1967.   the call.
  1968.  
  1969. Adv:Poly1
  1970.   Title:"More Polymorphic Method Calls"
  1971.   Wid:70
  1972.   Polymorphism seems obscure in simple examples.  Its
  1973.   advantage lies in being able to put data from different
  1974.   classes in the same data file, and then use polymorphism
  1975.   to redisplay that data.
  1976.  
  1977.          {Bold:"Lo"}New (Rule:R, TextWin:TW, Menu:M, Jorf:Q)
  1978.          Poly:Start(R)  | Same as 'Rule:Start(R)'
  1979.          Poly:Start(TW) | Same as 'TextWin:Start(TW)'
  1980.          Poly:Start(M)  | Same as 'Menu:Start(M)'
  1981.          Q=R
  1982.          Poly:Show(Q)   | Will call Rule:Show(Q)
  1983.          Q=TW
  1984.          Poly:Show(Q)   | Will call TextWin:Show(Q){Bold:"No"}
  1985.  
  1986.   If the method is not found, the parents of the class are
  1987.   checked (inheritance).  If still not found, the JORF class
  1988.   is checked (Default parent).
  1989.  
  1990. Adv:Rules1
  1991.   Title:"The Rule System"
  1992.   JORF uses an {Bold:"Lo"}Object-Attribute-Value{Bold:"No"} rule system.  This
  1993.   system is alien to conventional languages but
  1994.   comes from the world of Artificial Intelligence
  1995.   research.  This triplet is a compact and flexible way to
  1996.   store information to implement deductive systems.
  1997.  
  1998.   It is unfortunate that there are name conflicts between
  1999.   the triplet's {Bold:"Lo"}Object{Bold:"No"}, and an OOP {Bold:"Lo"}Object{Bold:"No"}.  But the world is
  2000.   not perfect and we must live with this.  Also, if this is
  2001.   new to you, you will have to memorize this triplet until
  2002.   it rolls trippingly from your tongue in your sleep.
  2003.  
  2004.   There is no particular meaning to Object-Attribute-Value.
  2005.   (There was once, but use has diluted the need for meaning.)
  2006.   These names are just used to avoid saying {Bold:"Lo"}Thingy1-Thingy2-Thingy3{Bold:"No"}.
  2007.  
  2008. Adv:Rules2
  2009.   Title:"The Rule System"
  2010.   Wid:64
  2011.   The JORF triplet also includes more than three elements:
  2012.   {Bold:"Lo"}
  2013.     Type       | The Type of Rule  (A Number)
  2014.     Obj        | Object
  2015.     Att        | Attribute
  2016.     Prob       | For AI Probability Calculations
  2017.     Val        | Value
  2018.     Ptr        | A Pointer to Data
  2019.   {Bold:"No"}
  2020.   The {Bold:"Lo"}Type{Bold:"No"} is a number that designates
  2021.   the index to use.  This is simply to avoid conflicts arising
  2022.   from different uses of this system.
  2023.   The {Bold:"Lo"}Ptr{Bold:"No"} points to data that pertains to the
  2024.   rule.
  2025.  
  2026. Adv:Rules3
  2027.   Title:"Finding Rules"
  2028.   Wid:70
  2029.   The Rule system has five commands, {Bold:"Lo"}Rule:Add{Bold:"No"},
  2030.   {Bold:"Lo"}Rule:Find{Bold:"No"}, {Bold:"Lo"}Rule:Del{Bold:"No"}
  2031.   {Bold:"Lo"}Rule:Next{Bold:"No"}, and {Bold:"Lo"}Rule:Prev{Bold:"No"}.
  2032.  
  2033.   The {Bold:"Lo"}Rule:Next{Bold:"No"} command can be used multiple times
  2034.   to find the next rule in sequence. {Bold:"Lo"}Rule:Prev{Bold:"No"}
  2035.   can be used to "backtrack" in a sequence.
  2036.  
  2037.   Rules may be found using a partial rule, but the values must be complete
  2038.   to a point.  If you think of a rule as a
  2039.   scale, you must fill it to any point but with no gaps:
  2040.   {Bold:"Lo"}
  2041.          Type    Obj       Att       Prob     Val
  2042.     Ok    1      "Jo"      "is a"    100      "Mammal"
  2043.     Ok    1      "Festus"  "is a"
  2044.     No    1      "is a"              100      "Mammal"
  2045.   {Bold:"No"}
  2046.   The last example will never find anything because there is
  2047.   no {Bold:"Lo"}Object{Bold:"No"}, but there is
  2048.   an {Bold:"Lo"}Attribute{Bold:"No"}.
  2049.  
  2050. Adv:Rules4
  2051.   Title:"How Methods are Indexed"
  2052.   Wid:66
  2053.   The Rule system is used internally for all indexed storage.
  2054.   If you look closely at the {Bold:"Lo"}Method{Bold:"No"} class,
  2055.   you find that it can look up methods by knowing that JORF
  2056.   stores them like this:
  2057.   {Bold:"Lo"}
  2058.       Type     121
  2059.       Obj      Class Name
  2060.       Att      First 7 digits of Method Name
  2061.       Val      Method Name
  2062.       Prob     100
  2063.       Ptr      Method Text
  2064.   {Bold:"No"}
  2065.   Due to internal storage factors, any string less than seven
  2066.   digits will be stored in alphabetical order.  By using this
  2067.   in the {Bold:"Lo"}Att{Bold:"No"} JORF keeps classes
  2068.   so they will be printed in alphabetical order.
  2069.  
  2070. Adv:Rules5
  2071.   Title:"String Keys"
  2072.   Wid:60
  2073.   The String Key system may be used to store
  2074.   ordered strings greater than seven digits long.  It
  2075.   replaces {Bold:"Lo"}Att{Bold:"No"}
  2076.   and {Bold:"Lo"}Val{Bold:"No"} with {Bold:"Lo"}Str{Bold:"No"}.
  2077.   {Bold:"Lo"}
  2078.     Type       | The Type of Rule  (A Number)
  2079.     Obj      | Object
  2080.     Str      | Up to 20 characters
  2081.     Ptr      | A pointer to data
  2082.   {Bold:"No"}
  2083.   No {Bold:"Lo"}Prob{Bold:"No"} is set for string keys.  String
  2084.   keys are automatically converted to lower case when stored.
  2085.  
  2086. Adv:Structs
  2087.   Title:"Structures, Records and Classes"
  2088.   Wid:66
  2089.   JORF Structures are stored by name reference, and structure
  2090.   definitions can be made without worrying
  2091.   about live data.  New elements to a structure will
  2092.   be "null" in existing structures.
  2093.  
  2094.   A variable of the JORF class can be made into a
  2095.   structure just using the pointer operator.  Structures
  2096.   of class JORF have no definition and can hold any
  2097.   value.
  2098.   {Bold:"Lo"}
  2099.     New (Rule:R Jorf:J)
  2100.     R->Val = "Josephine" | Assign value
  2101.     J->Val = R->Val      | Move to J
  2102.     R->QQQ = "Goat"      | Error! QQQ is not in Class Rule
  2103.     J->QQQ = "Goat"      | Ok - Class JORF takes anything
  2104.   {Bold:"No"}
  2105.  
  2106. Adv:Words
  2107.   Title:"Words"
  2108.   Wid:76
  2109.   The {Bold:"Lo"}Word{Bold:"No"} is a basic
  2110.   unit of JORF.  Just like you use Str:At to get
  2111.   a substring, you use Word:At to get a subword.
  2112.  
  2113.   Obviously, a line of text is made of words.  But also structures,
  2114.   the program stack, and arrays, are handled as words.
  2115.  
  2116.   Structures and the program stack words have a label
  2117.   assigned to them.  For instance, {Bold:"Lo"}Rule->Val{Bold:"No"}
  2118.   actually references a Word in the Rule structure with
  2119.   the label "Val".  (Remember, structures are stored by name
  2120.   reference.)  The {Bold:"Lo"}Class:At{Bold:"No"} can be used
  2121.   to obtain the label name.
  2122.  
  2123.   The labels on the program stack are, naturally, the names
  2124.   of variables.  This can easily be seen by looking at the
  2125.   Stack display in the debugger.
  2126.  
  2127. Math:Cont1
  2128.   Title:"JORF Control Functions"
  2129.   Wid:68
  2130.   Control functions are functions whose job is to change the
  2131.   program flow.  They include the {Bold:"Lo"}If/Else{Bold:"No"}, &
  2132.   {Bold:"Lo"}While/Break/Continue{Bold:"No"} and &
  2133.   {Bold:"Lo"}Switch/Case/Else{Bold:"No"}.  These &
  2134.   statements are used to create
  2135.   branching paths or loop structures.
  2136.  
  2137.   In JORF, control functions are implemented as library
  2138.   functions. From the JORF Language, they are used just like
  2139.   keywords.  But programmers who purchase the JORF Developer's Kit
  2140.   can modify and add new control functions.  This gives
  2141.   low level functionality to a very high level language.
  2142.  
  2143. Math:Cont2
  2144.   Title:"If/Else"
  2145.   The {Bold:"Lo"}If{Bold:"No"} function tests the
  2146.   value of the following item, and if that item is true it
  2147.   executes the indented statements.  If it is false,
  2148.   it looks for an else command
  2149.   on the same indentation level.
  2150.   If the {Bold:"Lo"}else{Bold:"No"}
  2151.   the indented section following
  2152.   is executed.
  2153.   {Bold:"Lo"}
  2154.           If (A=2)
  2155.             B=4
  2156.           Else
  2157.             B=6
  2158.   {Bold:"No"}
  2159.   The {Bold:"Lo"}If{Bold:"No"} test should
  2160.   be enclosed in parentheses.
  2161.  
  2162. Math:Cont3
  2163.   Title:"If/Else"
  2164.   The test does not need to be a logical test:
  2165.   {Bold:"Lo"}
  2166.      If (Rule->Fnd)
  2167.        Return Rule
  2168.   {Bold:"No"}
  2169.  
  2170.   This statement is true
  2171.   if {Bold:"Lo"}Rule->Fnd{Bold:"No"} (The Fnd
  2172.   element of Structure Rule)
  2173.   has any value at all.
  2174.  
  2175.   The test may be complex:
  2176.   {Bold:"Lo"}
  2177.     If (A=1  (B+4)=2)
  2178.       ++B
  2179.   {Bold:"No"}
  2180.  
  2181. Math:Cont4
  2182.   Title:"While/Break/Continue"
  2183.   Wid:78
  2184.   The {Bold:"Lo"}While{Bold:"No"} statement creates a loop.
  2185.   This loop is repeated as long as the condition of the While statement is
  2186.   not Null.  A {Bold:"Lo"}Break{Bold:"No"} is used
  2187.   to break out of the loop even if the condition
  2188.   is still true.  A {Bold:"Lo"}Continue{Bold:"No"} is
  2189.   used to shortcut the loop, restarting
  2190.   the next iteration immediately.
  2191.   {Bold:"Lo"}
  2192.       Counter=0               | Initialize Counter
  2193.       While (++Counter <= 5)  | Increment Counter
  2194.       Rule:Find (Rule)        | Find a next rule
  2195.       If (Rule->Fnd=Null)     | If sequence is ended
  2196.         Break                 |   break out of loop
  2197.       If (Rule->Ptr=Null)     | If condition is null
  2198.         Continue              | Skip rest of loop
  2199.       P=P+"-"+Rule->Ptr       | Add Condition
  2200.       Str:PutLine (P)         | Show result
  2201.   {Bold:"No"}
  2202.   The {Bold:"Lo"}Break{Bold:"No"} is used to exit the loop before
  2203.   the condition is false.
  2204.  
  2205.   The {Bold:"Lo"}Continue{Bold:"No"} command forces the loop to skip
  2206.   back to the the {Bold:"Lo"}While{Bold:"No"} statement.
  2207.  
  2208. Math:Cont5
  2209.   Title:"Switch/Case/Else"
  2210.   Wid:54
  2211.   The {Bold:"Lo"}Switch{Bold:"No"} command is always a shortcut for
  2212.   repeated {Bold:"Lo"}If/Else{Bold:"No"} commands.
  2213.   It tests a condition, and executes a section indicated by that test.
  2214.  
  2215.     For example:                Is Replaced By
  2216.   {Bold:"Lo"}
  2217.     If (A=2)                    Switch (A)
  2218.       B=A+C                       Case 2
  2219.     Else                            B=A+C
  2220.       If (A=3)                    Case 3
  2221.       B=A+D                         B=A+D
  2222.       Else                        Case 4
  2223.       If (A=4)                      B=A+E
  2224.         B=A+E                     Else
  2225.       Else                          B=A
  2226.         B=A
  2227.   {Bold:"No"}
  2228.   In this case, the Switch command is much neater and easier to use.
  2229.  
  2230. Math:Cont6
  2231.   Title:"Switch/Case/Else (Continued)"
  2232.   Wid:44
  2233.   The {Bold:"Lo"}Case{Bold:"No"} clause test a value and
  2234.   will execute an indented section
  2235.   if the value matches.  Case
  2236.   commands may be stacked:
  2237.   {Bold:"Lo"}
  2238.     Switch (Key)
  2239.       Case 'a'
  2240.       Case 'A'
  2241.         Str:PutLine ('Key is A')
  2242.       Case 'b'
  2243.       Case 'B'
  2244.        Str:PutLine ('Key is B')
  2245.       Else
  2246.         Str:PutLine ('Key is not A or B')
  2247.   {Bold:"No"}
  2248.  
  2249. Math:Cont7
  2250.   The Switch statement may not have a value, in
  2251.   which case the {Bold:"Lo"}Case{Bold:"No"} Statements
  2252.   are evaluated.
  2253.   {Bold:"Lo"}
  2254.     Switch
  2255.       Case (Key>='a'  Key<='Z')
  2256.       Case (Key>='A'  Key<='Z')
  2257.         Str:PutLine ('Key is a Letter')
  2258.       Case (Key>='0'  Key<='9')
  2259.         Str:PutLine ('Key is a Number')
  2260.       Else
  2261.         Str:PutLine ('Key is Something Else')
  2262.   {Bold:"No"}
  2263.  
  2264. Math:Cont8
  2265.   Title:"Library Function Summary"
  2266.   Wid:64
  2267.   ■ JORF Functions include Control Functions such as {Bold:"Lo"}If/Else{Bold:"No"}
  2268.   as well as Library Functions like {Bold:"Lo"}Win:Add{Bold:"No"}.
  2269.  
  2270.   ■ Control Functions are not Keywords.  The are implemented
  2271.   as standard library functions that may be augmented and changed
  2272.   using The JORF Developer's Kit.
  2273.  
  2274.   ■ {Bold:"Lo"}If/Else{Bold:"No"} is used to test a condition and execute indented
  2275.   code sections based on that test.  {Bold:"Lo"}Else{Bold:"No"} is optional.
  2276.  
  2277.   ■ {Bold:"Lo"}While/Break/Continue{Bold:"No"} is used to create a loop.
  2278.   The {Bold:"Lo"}Break{Bold:"No"} command
  2279.   can be used to exit that loop at any time.
  2280.   The {Bold:"lo"}Continue{Bold:"No"} command is
  2281.   used skip code sections by immediately jumping back to
  2282.   the {Bold:"Lo"}While{Bold:"No"} statement.
  2283.  
  2284.   ■ {Bold:"Lo"}Switch/Case/Else{Bold:"No"} is used to simplify
  2285.   repeated {Bold:"Lo"}If/Else{Bold:"No"} commands.
  2286.   It may be used to test a value, or a variety of values, and perform
  2287.   relevant indented code sections.
  2288.  
  2289. Math:Lib1
  2290.   Title:"JORF Library Functions"
  2291.   Wid:68
  2292.   If objects pass messages to objects ad infinitem, nothing would get
  2293.   done.  At some point in time, an object must pass a message to
  2294.   someone who can do something.  In the case of JORF, this is the
  2295.   JORF Runtime program JORF.EXE which contains some handy
  2296.   Library Functions.
  2297.  
  2298.   These functions are implemented in C code and source code for them
  2299.   is included in The JORF Developer's Kit. This library may be
  2300.   changed and extended to suit the needs of various developers.
  2301.  
  2302.   The basic library has a minimum of commands
  2303.   that give a maximum amount of access to the system.  However, there
  2304.   is a lot to do with a computer and there are more than eighty
  2305.   library functions.
  2306.  
  2307. Math:Lib2
  2308.   Title:"Some Window Functions"
  2309.   Wid:65
  2310.   Here are some examples of JORF Library functions.  The complete
  2311.   list is documented in {Bold:"Lo"}F1{Bold:"No"} help system.
  2312.   Hit {Bold:"Lo"}F1{Bold:"No"} now to take a look!
  2313.   {Bold:"Lo"}
  2314.     Win:Add(Title,Row,Col,Len,Wid,Level,Here)  | Adds a new window
  2315.   {Bold:"No"}
  2316.   Win:Add is the most complicated function of them all, because
  2317.   you can use it to create text windows, input windows and
  2318.   editing windows.
  2319.   {Bold:"Lo"}
  2320.      Win:Del           | Deletes top window
  2321.      Win:Attr (Mode)   | Changes current text color
  2322.      Win:FLRCO (Mode)  | Changes wrap mode.
  2323.   {Bold:"No"}
  2324.   FLRCO stands for "Full", "Left", "Right", "Center", and "Off".
  2325.   These are the wrap modes used for text in a window.
  2326.  
  2327. Math:Lib3
  2328.   Title:"More Window Functions"
  2329.   Wid:64
  2330.   More window functions...
  2331.   {Bold:"Lo"}
  2332.     Move:To (Row, Col)   | Moves Cursor to Row and Col
  2333.     Move:By (Row, Col)   | Moves Cursor by relative Row and Col
  2334.  
  2335.     Kbd:Get (Size)       | Gets key, Cursor Size (Off,Little,Big)
  2336.     Kbd:Hit              | Returns true if key has been hit
  2337.     Kbd:Bye              | Clear keyboard buffer
  2338.     Kbd:Put(Keystrokes)  | Keyboard stuffer
  2339.  
  2340.     Str:Put (String)     | Put a string at current cursor location
  2341.     Str:PutLine(String)  | Put a string with new line
  2342.  
  2343. Math:Lib4
  2344.   Title:"Text and Word Functions"
  2345.   Wid:68
  2346.   Text commands operate on multi-lined text.  If you use these on
  2347.   a word, number or character, that variable will be treated as
  2348.   a text with only one line.
  2349.   {Bold:"Lo"}
  2350.     Text:Top  (Text)  | Returns Top line of text
  2351.     Text:Bot  (Text)  | Returns Last Line
  2352.     Text:Next (Text)  | Returns Next line of text
  2353.     Text:Prev (Text)  | Returns Previous line of text
  2354.     Text:Wid  (Text)  | Returns Wid of widest line
  2355.   {Bold:"No"}
  2356.   Word commands operate on a lines of text, and also
  2357.   on structures, including the program stack and class
  2358.   definitions.  If something else
  2359.   is used it is treated as a line with one word.
  2360.   {Bold:"Lo"}
  2361.     Word:At     (Line, Pos)  | Returns word at position
  2362.     Word:AtPut  (Line, Pos)  | Changes word at position
  2363.     Class:At    (Line, Pos)  | Returns class at position
  2364.     Class:AtPut (Line, Pos)  | Changes class at position
  2365.  
  2366. Math:Lib5
  2367.   Title:"All the Functions"
  2368.   If you want to see all the functions,
  2369.   just look into the help file.
  2370.   {Bold:"Lo"}
  2371.      Beware:  This file is a biggie,
  2372.      be sure to come back and finish
  2373.      the tutorial!
  2374.   {Bold:"No"}
  2375.   If you want to see help - Press H.
  2376.  
  2377.   Ready... Set... {Prompt:"&Help", Action:"Math:Lib5a"}.
  2378.  
  2379. Math:Lib5A
  2380.   Tutorial:F1_Key
  2381.   Return (Tutorial:Ret)
  2382.  
  2383. Math:Remark
  2384.   Title:""
  2385.   Lots of people (like your math teacher) think you need
  2386.   to know calculus or trig, to be a great programmer.
  2387.  
  2388.                 Wrongo!
  2389.  
  2390.   To be a great programmer, you need
  2391.   to know how to add, subtract, multiply
  2392.   and divide.  You need to know how to
  2393.   balance an account to the penny.  It
  2394.   helps to know a debit from a credit
  2395.   and what a Balance Sheet says for a company.
  2396.  
  2397.   Most of all, you need creativity.
  2398.   You need the spark of intuitive logic
  2399.   that leads you to an effective solution
  2400.   to the problems set in front of you.
  2401.  
  2402.         Programmers are Artists,
  2403.         not Mathematicians.
  2404.  
  2405. Math:Start
  2406.   Title:"JORF Mathematics"
  2407.   Wid:64
  2408.   In most OOP languages, math operations are implemented as methods.
  2409.   Although this allows a few interesting benefits, there
  2410.   are many penalties.
  2411.  
  2412.   Instead, JORF uses an embedded math system.
  2413.   Math statements are automatically resolved BEFORE any accompanying
  2414.   methods are called.  Math statements operate specifically on
  2415.   objects with numeric or string values.
  2416.  
  2417.   JORF math syntax and order of operations is taken largely from
  2418.   the C language with one notable exception.  Since JORF uses the
  2419.   pipe ({Bold:"Lo"}|{Bold:"No"}) symbol for comments,
  2420.   the word {Bold:"Lo"}Or{Bold:"No"} is the OR operator.
  2421.  
  2422. Math:Start1
  2423.   Title:"Order of Operations"
  2424.   Wid:68
  2425.   These are the basic math characters listed in the order that they are
  2426.   evaluated:
  2427.   {Bold:"Lo"}
  2428.     ->                    Structure Element Ptr
  2429.     []                    Array reference
  2430.     - ~ ++ --             Negation, Complement, Increment, Decrement
  2431.     * / %                 Multiplication, Division, Modulus
  2432.     + -                   Addition and Subtraction
  2433.     = == != <> > < >= <=  Equality, Inequality and Comparison
  2434.     ? ^                   Bitwise And, Or and Xor
  2435.     And Or && ??          Logical And, Or
  2436.     =                     Assignment of value
  2437.  
  2438. Math:Start2
  2439.   Title:"Parentheses"
  2440.   Wid:64
  2441.   Prompt:"Algebra II", Row:6 Col:18 Action:"Tutorial:Box('Math:Remark')"
  2442.   Parentheses are a part of the program flow system in JORF, not the
  2443.   mathematics system.  They may be used to change the order of
  2444.   operations in math statements.
  2445.  
  2446.     {Bold:"Lo"}5 * 3 + 4         | 19{Bold:"No"}
  2447.     {Bold:"Lo"}5 * ( 3 + 4 )     | 35{Bold:"No"}
  2448.  
  2449.   I never finished Algebra II
  2450.   and I get pretty confused when I have to
  2451.   remember the order of operations.  Math is
  2452.   much more clear and robust if you use extra
  2453.   parentheses to show the exact order the
  2454.   statement is to be evaluated
  2455.  
  2456.     {Bold:"Lo"}Don't do  A*B+4/C      | This is not very clear or robust{Bold:"No"}
  2457.     {Bold:"Lo"}Instead   (A*B)+(4/C)  | Same operation, Much clearer  {Bold:"No"}
  2458.  
  2459. Math:Start3
  2460.   Title:"Assignment"
  2461.   Wid:56
  2462.   Values are assigned using single equals sign.
  2463.  
  2464.       {Bold:"Lo"}A=B   | Sets A to the value of B{Bold:"No"}
  2465.  
  2466.   Assignment is by value for single items, and by reference
  2467.   for structures.  The class is also assigned.
  2468.   {Bold:"Lo"}
  2469.     New (A, B, Rule:R)
  2470.     A = "Hi"      | Value of A is now "Hi".
  2471.     B = "Bye"     | Value of B is now "Bye".
  2472.     A = B         | Value of A changed to "Bye".
  2473.     A = Null      | Value of A is Null, B still "Bye".
  2474.     R->Ptr = "Hi" | Rule R's Pointer is now "Hi".
  2475.     A = R         | A is now class Rule, A->Ptr is "Hi".
  2476.   {Bold:"No"}
  2477.   Parameter passing is handled the same way; elements are
  2478.   passed by value, and structures are passed by reference.
  2479.  
  2480. Methods:Start
  2481.   Title:"Method Definitions"
  2482.   Wid:64
  2483.   Methods are procedural routines like a BASIC Subroutine
  2484.   or a C Function.  Good methods are between one and twenty lines
  2485.   long.  Methods longer than twenty lines can be divided to
  2486.   make them easier to read and understand.
  2487.  
  2488.   Each Method must belong to a class.  If no class is declared, then
  2489.   the method is assumed to belong to class {Bold:"Lo"}Jorf{Bold:"No"}.
  2490.  
  2491.   Methods can have one or more parameters.  The first parameter
  2492.   is expected to be the same class as the method.  Other
  2493.   parameters may be from any class.
  2494.  
  2495. Methods:Start1
  2496.   Title:"Method Structure"
  2497.   Wid:50
  2498.   The first line of a method contains its class name and name,
  2499.   followed by the parameter list for the method.
  2500.  
  2501.   The lines of the method must be indented.  I usually indent
  2502.   by two spaces, but you may use fewer or more as you want.
  2503.   {Bold:"Lo"}
  2504.         MyClass:MyMethod(Param1, Param2)
  2505.           |
  2506.           | Text of method
  2507.           |
  2508.           Return (Ok)
  2509.   {Bold:"No"}
  2510.   The last line of a method should be a Return command.
  2511.  
  2512. Methods:Start2
  2513.   Title:"Creating New Variables"
  2514.   Wid:74
  2515.   New Variables can be created at the start of any method. Each instance
  2516.   is comprised of a class and a value, referenced by a name.
  2517.  
  2518.   The library function {Bold:"Lo"}New{Bold:"No"} is used to create variables.  It may
  2519.   be followed by any number of variables to be created.  Each variable
  2520.   has a class and a name.  If class is not specified, the variable
  2521.   will be a member of class {Bold:"Lo"}Jorf{Bold:"No"}.
  2522.   {Bold:"Lo"}
  2523.      New (String:S)   | Creates an instance of String called "S".
  2524.      New (Rule:Rule)  | An instance of class Rule called "Rule".
  2525.      New (Counter)    | An instance of class Jorf called "Counter".
  2526.      New (Text:T, Rule:NewRule) | Two new instances, "T" and "NewRule".
  2527.   {Bold:"No"}
  2528.   All New values are initialized to Null (which is equivalent to integer 0).
  2529.   All elements of New structures are initalized to Null.
  2530.  
  2531. Methods:Start3
  2532.   Title:"Quotes and Constants"
  2533.   Wid:66
  2534.   String constants may be enclosed by single or double quotes.
  2535.   {Bold:"Lo"}
  2536.       Title:"A Constant"
  2537.       'Another Constant'
  2538.       Title:"A 'Quoted' Constant"
  2539.       'A constant with a "quote"'
  2540.   {Bold:"No"}
  2541.   Constants are assigned using the equals sign:
  2542.   {Bold:"Lo"}
  2543.       New String:S      | A String called "S"
  2544.       S="This is a String." | S has value "This is a String."
  2545.   {Bold:"No"}
  2546.   A quoted constant that is an integer value is a number.
  2547.   {Bold:"Lo"}
  2548.       The integer value of "33" is 33.
  2549.       The integer value of "555-1212" is 555.
  2550.   {Bold:"No"}
  2551.  
  2552. Script:ThreeFooScript
  2553.   Script:Add("Script:ThreeFoo")
  2554.   Return (Tutorial:Ret)
  2555.  
  2556. Methods:Start4
  2557.   Script:"ThreeFooScript" "ThreeFoo:Start"
  2558.   Title:"Indentation and Program Flow"
  2559.   Wid:72
  2560.   Indented lines "Belong" to the unindented line above.  This system
  2561.   eliminates the need for ENDIF or bracket punctuation.
  2562.   This method fragment demonstrates indentation.
  2563.   {Bold:"Lo"}
  2564.     Counter=1                 | 1. Initialize Counter
  2565.     While (Counter<=Position) | 2. While less than Position
  2566.       Rule:Find Rule          | 3. Next rule in sequence
  2567.       If (Rule->Fnd=False)    | 4. If not Fnd - done
  2568.       Return 'Escape'         | 5.   return 'Escape'.
  2569.       ++Counter               | 6. Increment Counter
  2570.     Return Rule->Ptr          | 7. Done - Return Ptr
  2571.   {Bold:"No"}
  2572.   Lines 3 through 6 execute repeatedly as long as the
  2573.   value of Counter is less than or equal to Position (Line 2).
  2574.   Line 5 executes only if line 4 is True.
  2575.   Line 7 executes when Counter is greater than Position (Line 2)
  2576.   which completes the While loop.
  2577.  
  2578. Methods:Start5
  2579.   Title:"Blocks of Text as a Parameter"
  2580.   Wid:54
  2581.   Indented blocks of text may be passed as a parameter
  2582.   to a method.  Whenever a method is called
  2583.   with exactly
  2584.   one parameter missing, the following line
  2585.   is passed {Bold:"Lo"}IF IT IS INDENTED{Bold:"No"}.
  2586.   This is a
  2587.   convenient way to create multiple line
  2588.   text within program code.
  2589.   {Bold:"Lo"}
  2590.        Mantra:Box('MU')
  2591.      It could be Franky it
  2592.      could be Franky it could
  2593.      be very fresh and clean.
  2594.        ++WindowCounter
  2595.   {Bold:"No"}
  2596.   The function {Bold:"Lo"}Mantra:Box{Bold:"No"} is called
  2597.   with two parameters, the title 'MU' and the text that
  2598.   is indented.
  2599.  
  2600.   (The text above is from Phillip Glass' first opera,
  2601.   Title:"Einstein on the Beach".)
  2602.  
  2603. Methods:Start6
  2604.   Title:"Method Definition Summary"
  2605.   Wid:62
  2606.   ■ {Bold:"Lo"}Methods{Bold:"No"} are procedural routines that
  2607.   must belong to a class.
  2608.  
  2609.   ■ The first line of a method specifies its class, name and
  2610.   any parameters passed to the method.
  2611.  
  2612.   ■ The program flow in the method is dictated by indentation.
  2613.  
  2614.   ■ New variables are created in the top of the method using the
  2615.   {Bold:"Lo"}New{Bold:"No"} command.  Each variable has a name
  2616.   and belongs to a class.  All new variables are set to Null (Zero).
  2617.  
  2618.   ■ An indented block of text can be passed as a parameter to a method.
  2619.  
  2620. Tut:AdvStart1
  2621.   Title:"Getting on to the Good Stuff"
  2622.   Wid:70
  2623.   Len:16
  2624.   The JORF language also has some sophisticated features.
  2625.  
  2626.   ■ {Prompt:"&Arrays" Action:"Tutorial:Box('Adv:Arrays')"} can be up to 2
  2627.   billion elements, are easy to declare, and each element can
  2628.   be another array or structure.
  2629.  
  2630.   ■ {Prompt:"&Polymorphism" Action:"Tutorial:Box('Adv:Poly')"} is fully supported.
  2631.  
  2632.   ■ The JORF Language has a
  2633.   built-in {Prompt:"&Rule Based System" Action:"Tutorial:Box('Adv:Rules1')"} that
  2634.   can be used for in Expert System programming to make logical deduction.  This system is
  2635.   used for all indexing in JORF.
  2636.  
  2637.   ■ There is set of {Prompt:"&Word" Action:"Tutorial:Box('Adv:Words')"} based
  2638.   based functions to make text parsing and word handling easy.
  2639.  
  2640. Tut:AdvStart
  2641.   Title:"Advanced topics"
  2642.   The next few things to cover involve the structure of JORF
  2643.   language programs.
  2644.  
  2645.   ■ JORF {Prompt:"&Mathematics" Action:"Tutorial:Box('Math:Start')"} is pretty
  2646.   much like other languages, especially the C language which
  2647.   has a pretty clean syntax.
  2648.  
  2649.   ■ {Prompt:"Mðods" Action:"Tutorial:Box('Methods:Start')"} form the basis
  2650.   of all programming.
  2651.  
  2652.   ■ {Prompt:"&Control" Action:"Tutorial:Box('Math:Cont1')"} functions are JORF
  2653.   Library functions like IF, and WHILE that change program flow.
  2654.  
  2655.   ■ {Prompt:"&Library" Action:"Tutorial:Box('Math:Lib1')"} functions from the
  2656.   rest of the command set in the JORF language.
  2657.  
  2658. Tut:Oop
  2659.   Title:"Object Oriented Concepts"
  2660.   Wid:70
  2661.   The Object-Oriented Paradigm
  2662.   is {Prompt:"&Over-hyped and over-used" Action:"Tutorial:Box('Intro:BillG')"} but
  2663.   it is still useful for
  2664.   solving {Prompt:"&Particular problems" Action:"Tutorial:Box('Intro:Oop2')"}.
  2665.  
  2666.   {Prompt:"&Classes" Action:"Tutorial:Box('Intro:Classes')"} let you define a discrete chunk of code.
  2667.  
  2668.   And {Prompt:"&Inheritance" Action:"Tutorial:Box('Intro:Inh1')"} allows &
  2669.   you to re-use chunks of code as they are,
  2670.   without "Cloning" them into new modudules.
  2671.  
  2672.   Finally, {Prompt:"P&olymorphism" Action:"Tutorial:Box('Intro:Poly1')"} gives
  2673.   particular strength to a data oriented programming
  2674.   approach.
  2675.  
  2676. Tut:Oop1
  2677.   Win:Add "OOP Summary"
  2678.   Wid:68
  2679.   ■ Object Oriented Programming involves four
  2680.   specific features; Classes, Encapsulation,
  2681.   Inheritance and Polymorphism.
  2682.  
  2683.   ■ {Bold:"Lo"}Classes{Bold:"No"} are Do-it-yourself Data Types
  2684.  
  2685.   ■ {Bold:"Lo"}Encapsulation{Bold:"No"} means that Classes and
  2686.   Methods are packaged together
  2687.   into Objects.
  2688.  
  2689.   ■ {Bold:"Lo"}Inheritance{Bold:"No"} saves time when a class can
  2690.   share methods from a parent class.
  2691.  
  2692.   ■ {Bold:"Lo"}Polymorphism{Bold:"No"} means that method names are
  2693.   reused many times, and the appropriate method
  2694.   is chosen according to class.
  2695.  
  2696.  
  2697. Intro:Classes
  2698.   Title:"OOP Classes"
  2699.   Officially, a Class is a data definition and the methods that
  2700.   belong to that data.  In JORF usage, it is common to use Class
  2701.   specifically to describe the structure definition.
  2702.  
  2703.   If you wish to pursue a true OOP approach, you should design
  2704.   your methods so that they are tightly connected and dependent
  2705.   on the class definition.  For instance, all methods in a class
  2706.   should use a variable that belongs the class as the first
  2707.   parameter:
  2708.   {Bold:"Lo"}
  2709.     Contact:Show(Contact,Length)
  2710.   {Bold:"No"}
  2711.   not
  2712.   {Bold:"Lo"}
  2713.     Contact:Show(Length,Contact)
  2714.   {Bold:"No"}
  2715.  
  2716.  
  2717.  
  2718. Intro:Inh1
  2719.   Run:"Intro:InhParent"
  2720.   Title:"Inheritance"
  2721.   Wid:76
  2722.   The {Bold:"Lo"}Parent{Bold:"No"} key word lets a class inherit
  2723.   all the elements and methods that
  2724.   belong to another class.
  2725.  
  2726.   For instance, suppose you had an Address class.  Then you wanted
  2727.   to create a new class for Customer.  The Customer class contains
  2728.   many fields that are also in the Address Class.
  2729.   {Bold:"Lo"}
  2730.     Class:Address Name, Street, City, State, Zip
  2731.     Class:Customer Company, Name, Street, City, State, Zip
  2732.   {Bold:"No"}
  2733.   It is much easier to define the Customer class
  2734.   if we just inherit the items from the Address
  2735.   class.
  2736.   {Bold:"Lo"}
  2737.     Class:Address Name, Street, City, State, Zip
  2738.     Class:Customer Company, Parent:Address
  2739.   {Bold:"No"}
  2740.  
  2741. Intro:Inh2
  2742.   Title:"Method Inheritance"
  2743.   Wid:60
  2744.   Methods are also inherited, because they belong to the
  2745.   classes.  By declaring Address as a parent, the
  2746.   Customer class inherits all the methods that belong
  2747.   to Address.
  2748.  
  2749.   When you call a method, the interpreter first looks in
  2750.   the indicated class.  If the method is declared within
  2751.   that class, it is run.  If it is not declared within
  2752.   the class, the parent classes are checked.
  2753.  
  2754. Intro:Inh3
  2755.   Title:"Multiple Inheritance"
  2756.   Wid:68
  2757.   Some OOP languages like JORF, allow a class to have
  2758.   more than one parent.  This ability
  2759.   called {Bold:"Lo"}Multiple Inheritance{Bold:"No"}.  For instance
  2760.   you may want a Vendor class, that inherits from both the
  2761.   Address class, and also from the PurchOrder class:
  2762.   {Bold:"Lo"}
  2763.       Class:Vendor Parent:Address Parent:PurchOrder
  2764.   {Bold:"No"}
  2765.   When multiple parents are declared, the order is significant
  2766.   in resolving name conflicts.
  2767.  
  2768.   Many OOP languages don't support multiple inheritance.
  2769.   They should, because multiple inheritance is useful and
  2770.   is easy to implement (at least it was in the JORF interpreter).
  2771.  
  2772. Intro:InhParent
  2773.   New (Count)
  2774.   Win:Add(Null, 0, 0, 5, 0, Here)
  2775.     How do you write 200 lines
  2776.     of code in 6 letters?
  2777.   Win:Pause (100)
  2778.   Win:Attr ("Lo")
  2779.   Move:To (4, 10)
  2780.   While (Count < 6)
  2781.     ++Count
  2782.     Str:Put (Str:At ("Parent",Count,1))
  2783.     Win:Chg
  2784.     Win:Pause(5)
  2785.   Win:Pause (40)
  2786.   Win:Attr ("No")
  2787.   Win:Msg("Press a key . . .")
  2788.   Win:Pause
  2789.   Return (Ok)
  2790.  
  2791. Intro:BillG
  2792.   Title:"O-O Misuse"
  2793.   Wid:70
  2794.   It seems that the term Object Oriented Programming
  2795.   is now so misused, that it is going the way of
  2796.   "{Prompt:"&Fifth Generation" Action:"Tutorial:Box('Intro:Fifth')"}".
  2797.  
  2798.   Bill Gates has much to blame, because he makes stupid statements
  2799.   like "A Windows Icon is an object, Visual Basic handles icons,
  2800.   so Visual Basic is Object Oriented".
  2801.  
  2802.   Bill is wrong, because an Icon is a Windows Object, but has nothing
  2803.   to do with the encpsulation of class definition and methods that
  2804.   are intended when an O-O programmer says "Object".
  2805.  
  2806.   Bill is spoiling O-O to get a sales edge for VB.
  2807.  
  2808. Intro:BillG1
  2809.   Title:"Microsoft Marketing is spoiling O-O"
  2810.   Microsoft is also pushing Windows as an O-O environment.  Yet most
  2811.   MS-Windows sample programs that I have seen have extensive use
  2812.   of global variables and massive unstructured switch statements.
  2813.  
  2814.   These things are characteristic of Pre-Dykstra BASIC programs,
  2815.   not of proper Object Oriented practices.  The technique of O-O
  2816.   suggests increased encapsulation.  This is the opposite of the
  2817.   rampant use of global variables that is needed for
  2818.   MS-Windows programming.
  2819.  
  2820.   The C++ language, used for most Windows programming, allows
  2821.   a lot of variation in style.  You be very unstructured in C++,
  2822.   you can make structured programs in C++ and you can make Object
  2823.   Oriented programs in C++.
  2824.  
  2825.   Just 'cause a programmer uses C++ does not mean that the programmer
  2826.   knows or follows about O-O techniques.  Most don't.
  2827.  
  2828. Intro:Fifth
  2829.   Title:"Fifth Generation"
  2830.   Whatever happened to "Fifth Generation"? Nothing.
  2831.   The concept is alive and well in a number of
  2832.   products.  But Marketer's killed the expression by
  2833.   labeling just about any new version of a third
  2834.   generation language as "Fifth Generation".
  2835.  
  2836.   Now, no self respecting company will use the
  2837.   term, even if their product fits the original
  2838.   description of "Fifth Generation".
  2839.  
  2840.  
  2841.  
  2842. Intro:BillG2
  2843.   Title:"Real O-O"
  2844.   What I will tell you is different from most people, but they
  2845.   don't have an easy O-O language to sell.  My message:
  2846.   {Bold:"Lo"}
  2847.       Ignore Object Oriented Programming (until . . .)
  2848.   {Bold:"No"}
  2849.   Its kinda like Lotus Macros.  95% of all people who use
  2850.   Lotus 123 or Quattro do not touch the macro language.  But this
  2851.   does not detract from the limited spreadsheets they do.
  2852.  
  2853.   In my opinion, 95% of all programmers can safely ignore Object
  2854.   Oriented programming because their projects are too small to
  2855.   take advantage of O-O techniques.
  2856.   {Bold:"Lo"}
  2857.      . . . you start using inter-dependent data structures.
  2858.   {Bold:"No"}
  2859.   When you write a full Recievables system, and add customer
  2860.   and vendor information, and your structures start overlapping,
  2861.   then you should divide your program into tasks (classes) and
  2862.   begin taking advantage of inheritance and polymorphism.
  2863.  
  2864. Intro:OOP2
  2865.   Title:"Handling Complexity"
  2866.   Wid:60
  2867.   It used to be quite sufficient to create a screen by
  2868.   placing each prompt, invoking an input system, and checking
  2869.   the keystrokes.
  2870.  
  2871.   Now, a MS-Windows style screen with pull down menus, Alt keys
  2872.   buttons, boxes and input fields may have to handle more
  2873.   than {Bold:"Lo"}100{Bold:"No"} possible keystrokes.
  2874.  
  2875.   The old system of {Bold:"Lo"}If Key = 'M' . . . If Key = 'Q' . . .{Bold:"No"}
  2876.   is just inadequate for this complex a screen.  You might as
  2877.   well write it in Assembler
  2878.  
  2879. Intro:OOP3
  2880.   Title:"Writing in Assembler"
  2881.   Wid:70
  2882.   Assembly language is the first of all computer.
  2883.   languages. {Bold:"Lo"}Key words{Bold:"No"} in assembler correspond
  2884.   to the {Bold:"Lo"}binary machine code{Bold:"No"}
  2885.   that is native to the computer chip.
  2886.  
  2887.   The purpose of higher level languages is to use the power of
  2888.   the computer to support data constructs beyond those native to
  2889.   the CPU.
  2890.  
  2891.   As computers have grown more and more powerful, it is clear that
  2892.   new languages must support more than complex data constructs.  They
  2893.   must also support a {Bold:"Lo"}higher level conceptual framework{Bold:"No"}
  2894.   for programming.
  2895.  
  2896. Intro:OOP4
  2897.   Title:"Object Oriented Programming" 3, 3, 17, 74
  2898.   In OOP technique, the {Bold:"Lo"}Data{Bold:"No"} is
  2899.   of primary importance.  The {Bold:"Lo"}Program{Bold:"No"} is
  2900.   secondary.  Although the program consists of recognizable
  2901.   subroutines, they are identified by the {Bold:"Lo"}data they
  2902.   handle{Bold:"No"}, not by their function in the program.
  2903.  
  2904.   Subroutines, called {Bold:"Lo"}Methods{Bold:"No"} are even
  2905.   named by the data they act on.  The are grouped by the data
  2906.   type, called the {Bold:"Lo"}Class{Bold:"No"}.  The Class and Methods
  2907.   together form a unit called an {Bold:"Lo"}Object{Bold:"No"}, hence
  2908.   the name Object Oriented Programming.
  2909.  
  2910.   When creating an O-O program, concise and self-sufficient
  2911.   subroutines are the mark of quality.  If you move an Object
  2912.   to another program, you should not have to make any changes
  2913.   for the subroutines to work properly, even in the new environment.
  2914.  
  2915. Intro:OOP5
  2916.   Title:"Learning OOP"
  2917.   Wid:64
  2918.   You can use OOP technique with any language, including
  2919.   assembly language.  The technique is in your mind, and in
  2920.   the way you program, not in the language.
  2921.  
  2922.   OOP languages are important because they encourage (and coerce)
  2923.   you to use the proper technique.  Most OOP languages also
  2924.   support {Bold:"Lo"}inheritance{Bold:"No"} and {Bold:"Lo"}polymorphism{Bold:"No"}
  2925.   that make code re-use much easier.  These are the icing on the
  2926.   OOP cake, allowing you to easily share like code between Objects.
  2927.  
  2928.   The JORF language is the simplest OOP language in data typing and
  2929.   method declaration.  This simplicity is tied to a sophisticated
  2930.   screen and data base management system.
  2931.  
  2932.   While no language is easy, JORF is among the easiest to
  2933.   learn of all Object Oriented Programming languages,
  2934.   and {Bold:"Lo"}it is the only one named after a goat{Bold:"No"}!
  2935.  
  2936. Intro:Poly1
  2937.   Title:"Polymorphism"
  2938.   Wid:68
  2939.   In OOP, it is common for methods of different classes to have
  2940.   the same name, like the {Bold:"Lo"}Address:Print{Bold:"No"}
  2941.   and {Bold:"lo"}Customer:Print{Bold:"No"} methods.
  2942.  
  2943.   Each variable (which true OOP gurus will call
  2944.   an {Bold:"Lo"}Instance{Bold:"No"}) also belongs to a class.
  2945.  
  2946.   In JORF, the keyword Poly indicates a polymorphic method call, a
  2947.   method call based on the class of the variable.
  2948.  
  2949.   So when you have a variable {Bold:"Lo"}X{Bold:"No"} or {Bold:"Lo"}Y{Bold:"No"}
  2950.   the method called when you use Poly will change according
  2951.   to class of the variable.
  2952.   {Bold:"Lo"}
  2953.     New (Customer:X, Address:Y)  | Creates variables X and Y
  2954.     Poly:Print(X)                | Calls Customer:Print
  2955.     Poly:Print(Y)                | Calls Address:Print
  2956.   {Bold:"No"}
  2957.   The system of using methods with the same name, and choosing
  2958.   the appropriate method based on class is
  2959.   called {Bold:"Lo"}Polymorphism{Bold:"No"}. (Another kickback.)
  2960.  
  2961. Intro:Poly2
  2962.   Title:"Polymorphism"
  2963.   Wid:74
  2964.   Legitimate uses for Polymorphism are rare.  Generally when you
  2965.   call a method, you are calling a specific method.  In JORF, you
  2966.   make the call specific by declaring both the class and name of
  2967.   the method:
  2968.   {Bold:"Lo"}
  2969.     New (Customer:X)   | Create variable X, belongs to class Customer
  2970.     Poly:Print (X)     | A polymorphic call to Customer:Print
  2971.     Address:Print(X)   | A specific call to Address:Print
  2972.   {Bold:"No"}
  2973.   Specific calls run faster because the interpreter does not
  2974.   have to obtain the class of the variable, and does not have to
  2975.   search the parent hierarchy.  When compiled, the method call is
  2976.   direct.
  2977.  
  2978. Intro:Poly3
  2979.   Title:"Polymorphism"
  2980.   Wid:58
  2981.   Although legitimate uses of Polymorphism are rare, when they are
  2982.   necessary nothing else will do.
  2983.  
  2984.   The greatest ability of OOP
  2985.   languages is to have methods that can manipulate data without
  2986.   knowing specifically what the data is.  By using polymorphism
  2987.   these "data manager" methods are far more efficient than
  2988.   methods that are duplicated for every data type.
  2989.  
  2990.