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

  1. Tutorial:Start
  2.   Event:Add("Tutorial")
  3.   Jorf:File("TutText.J")
  4.  
  5.   Win:Add ("Josephine's Recipe Filer Tutorial", 0, 0, 22, 78, Here.)
  6.     Menu:"&File"
  7.       Menu:"E&xit         Alt-X" Action:"Jorf:Exit"
  8.     This tutorial is {prompt:"&Hypertext", Action:"Tutorial:Box('Intro:Hyper')"}. &
  9.     Press {Bold:"Lo"}Enter{Bold:"No"} to see the highlighted subjects. &
  10.     Use your arrow keys to highlight different subjects.  You can &
  11.     zoom to highlighted letters by holding the Alt key down &
  12.     while pressing that letter.
  13.  
  14.     {Prompt:"&Josephine", Action:"Tutorial:Box('Intro:Jo')"}'s Recipe Filer, &
  15.     JORF(R), is a new computer &
  16.     language.  JORF was created by a &
  17.     {Prompt:"&Grunt-Programmer" Action:"Tutorial:Box('Intro:Grunt')"} &
  18.     frustrated by low level math based computer languages &
  19.     that are inapproprate for business data processing.  With the JORF &
  20.     language you can easily create data entry screens,  &
  21.     and write sophisticated routines using an Object Oriented &
  22.     data base manager.
  23.  
  24.     Press "Enter" now, to read more about the Hypertext system. &
  25.     Then, highlight the various topics and explore &
  26.     this Tutorial.   Thank you for your support.
  27.  
  28.     {Group:"Hypertext Topics" Row:13 Col:4 Len:5 Wid:70}
  29.     {Prompt:" &About the JORF Language   " Row:14 Col:08 Wid:30 Action:"Tutorial:Box('Tut:About')"}
  30.     {Prompt:" JORF &Programming Basics   " Row:15 Col:08 Wid:30 Action:"Tutorial:Box('Tut:Basic')"}
  31.     {Prompt:" JORF Ad&vanced Programming " Row:16 Col:08 Wid:30 Action:"Tutorial:Box('Tut:AdvStart')"}
  32.     {Prompt:" &OOP Programming Concepts  " Row:17 Col:08 Wid:30 Action:"Tutorial:Box('Tut:Oop')"}
  33.     {Prompt:" JORF &Window Manager       " Row:18 Col:08 Wid:30 Action:"Tutorial:Box('Tut:DataEntry')"}
  34.     {Prompt:" G&etting Started with JORF " Row:14 Col:42 Wid:30 Action:"Tutorial:Box('Write:Start')"}
  35.     {Prompt:" &Quick Demonstration       " Row:15 Col:42 Wid:30 Action:"Tutorial:Box('Quick:Start')"}
  36.     {Prompt:" &Registering JORF          " Row:16 Col:42 Wid:30 Action:"Tutorial:Regist"}
  37.     {Prompt:" JORF Company Produc&ts     " Row:17 Col:42 Wid:30 Action:"Tutorial:Box('Tut:Prod')"}
  38.     {Prompt:" &Contacting JORF Company   " Row:18 Col:42 Wid:30 Action:"Tutorial:Box('Tut:JorfCo')"}
  39.  
  40.     {Button:"&Sample Programs" Row:20 Col:2  Wid:22 Action:"Tutorial:Samples"}
  41.     {Button:"See &Debugger"    Row:20 Col:28 Wid:22 Action:"Tutorial:Debugger"}
  42.     {Button:"E&xit"            Row:20 Col:56 Wid:22 Action:"Jorf:Exit"}
  43.   Jorf:Exit
  44.  
  45. JORFNote:Say (Letter)
  46.   Msg:Add ("My Letter", "Ok")
  47.     {Date:Str(Date:Get,"m d, y")}
  48.  
  49.     Dear Wayland,
  50.  
  51.     I just had to write to you, because I am &
  52.     so {Letter->Feeling} by JORF. In Fact, &
  53.     {Letter->Thought}
  54.  
  55.     Yours Truly,
  56.  
  57.     {Letter->Name}
  58.     {Letter->Street}
  59.     {Letter->CityStZip}
  60.   Return(Ok)
  61.  
  62. JORFNote:Start
  63.   New (JORFNote:Letter)
  64.   Win:Add ("Letter To The JORF Company" 0,0,5,20)
  65.     Input:"Your Name   ", Field:"Letter->Name"
  66.     Input:"Your Street ", FIeld:"Letter->Street"
  67.     Input:"City/St/Zip ", Field:"Letter->CityStZip"
  68.  
  69.     String:"How does JORF make you feel?  (Excited, Bored, Confused...)"
  70.     Input:"Your Feeling ", Wid:20, Field:"Letter->Feeling"
  71.  
  72.     String:"What do you think of JORF? (Really Neat, Too Complicated...)"
  73.     Input:"", Wid:60 Len:6, Field:"Letter->Thought"
  74.     String:"           (Press Escape to Finish Text Entry)"
  75.   JORFNote:Say (Letter)
  76.   Return(Ok)
  77.  
  78. Tutorial:Alt_F10_Key
  79.   Win:Add("Time")
  80.     Flrco:"Center"
  81.     {Date:Str(Date:Get,"s d, y")}
  82.     {Time:Str(Time:Get,"h:mm")}
  83.   Return Ok
  84.  
  85. Tutorial:Alt_F5_Key
  86.   Jorf:Flush
  87.   Return Ok
  88.  
  89. Tutorial:Alt_X_Key
  90.   Jorf:Exit
  91.   Return Ok
  92.  
  93. Tutorial:Box(Name)
  94.   New (Box,Text,ShowText,ShowLine,NextLine)
  95.   New (Label,NextName,Button)
  96.   Text = Method:Find(Name)
  97.   Text = Text:Next(Text)
  98.   If (Text)
  99.     Label = Class:At(Text,1)
  100.     While (Label)
  101.       Switch (Label)
  102.     Case 'Title'
  103.       Box->Title = Word:At(Text,1)
  104.     Case 'Wid'
  105.       Box->Wid   = Word:At(Text,1)
  106.     Case 'Len'
  107.       Box->Len   = Word:At(Text,1)
  108.     Case 'Script'
  109.       Jorf:Do("Script:"+Word:At(Text,1))
  110.       If (Kbd:Got=='Esc_Key')
  111.         Return (Null)
  112.       Jorf:Do (Word:At(Text, 2))
  113.         Case 'Run'
  114.           Jorf:Do (Word:At(Text,1))
  115.       Text = Text:Next(Text)
  116.       Label = Class:At(Text,1)
  117.  
  118.     ShowText = Text:Add()
  119.     While (Text)
  120.       ShowLine = Str:At(Text,3)
  121.       NextLine = Text:Next(Text)
  122.       Switch
  123.         Case (ShowLine==Null)
  124.         Case (Str:At(ShowLine,1,1)==' ')
  125.         Case (Str:At(ShowLine,1,1)=='{')
  126.         Case (Str:At(NextLine,3,1)=='{')
  127.         Case (Str:Len(NextLine)==0)
  128.           ShowText = Text:Add(ShowLine,ShowText)
  129.         Else
  130.           ShowText = Text:Add(ShowLine+" &",ShowText)
  131.       Text = NextLine
  132.  
  133.     ShowText = Text:Top(ShowText)
  134.     If (Box->Wid==0)
  135.       Box->Wid=Text:Wid(ShowText,99,TRUE)
  136.     If (Box->Len==0)
  137.       Box->Len=Text:Len(ShowText,0,Box->Wid-1)
  138.  
  139.     Button =  "Wid:20 Row:"+(Box->Len)+" Col:"+((Box->Wid-20)/2)
  140.     NextName = Tutorial:Next(Name)
  141.     If (Method:Find(NextName)!=Null)
  142.       Text:Chg("Button:'&More . . .' Action:'Tutorial:Box("+'"'+NextName+'"'+")'" + Button, ShowText)
  143.     Else
  144.       Text:Chg("Button:'&Done' Action:'Return(Null)' " + Button, ShowText)
  145.     Box->Text = ShowText
  146.     Kbd:Put("Down_Arrow_Key")  | Moves to top item in box . . .
  147.     Win:Add(Box)
  148.     If (Kbd:Got != 'Esc_Key')
  149.       Kbd:Bye()
  150.       Kbd:Put("Down_Arrow_Key")  | Moves to next item in box
  151.       Return (Null)
  152.   Return (Ok)
  153.  
  154. Tutorial:F1_Key
  155.   If File:Exist("Help.Jrf" 0)
  156.     Jorf:File ("Help.Jrf" Here)
  157.     Help:Start
  158.   Else
  159.     Msg:Add
  160.       The HELP.JRF file is not &
  161.       on the current directory
  162.   Return Ok
  163.  
  164. Tutorial:Next(Name)
  165.   New (Char)
  166.   Char = Str:At(Name,Str:Len(Name),1)
  167.   if (Char >= "0" And Char <= "9")
  168.     Name = Str:At(Name,1,-1) + (Char+1)
  169.   Else
  170.     Name = Name + "1"
  171.   Return(Name)
  172.  
  173. Tutorial:Regist
  174.   Win:Add("Registration")
  175.     This program is Shareware.  Feel free to try it out without &
  176.     charge, and to copy it to give it to friends.  If you decide &
  177.     to use the JORF interpreter to create new programs, you must &
  178.     purchase a registered copy from The JORF Company.
  179.  
  180.     We do not charge for any shipping within the U.S. or Canada. &
  181.     We normally ship all versions on 3 1/2 inch disks so be sure to &
  182.     note if you need 5 1/4 inch disks.
  183.  
  184.     If you have a printer hooked up, I have written a nice little &
  185.     sample program to take the info and print a registration letter. &
  186.     Just press the R button.
  187.  
  188.     {Button:"&Register Now" Row:13 Col:5 Wid:20 Action:"Tutorial:Run('REGISTER')"}
  189.     {Button:"&Done" Row:13 Col:40 Wid:20 Action:"Return(Null)"}
  190.   Return (Ok)
  191.  
  192. Tutorial:Ret
  193.   If (Kbd:Got != 'Esc_Key')
  194.     Return (Null)
  195.   Return (Ok)
  196.  
  197. Tutorial:Run(FileName)
  198.   If File:Exist(FileName+".J",0)
  199.     Jorf:File (FileName,Here)
  200.     Jorf:Do (FileName+":Start")
  201.   Else
  202.     Msg:Add
  203.       The {FileName}.J file is not &
  204.       on the current directory
  205.   Kbd:Bye
  206.   Return (Ok)
  207.  
  208. Tutorial:Samples
  209.   Win:Add("Sample Programs",0,0,0,60,Here)
  210.     Button:"&Done" Row:19 Col:20 Wid:20 Action:"Null"
  211.     From the Debugger, select {Bold:"Lo"}F{Bold:"No"}ile, &
  212.     {Bold:"Lo"}O{Bold:"No"}pen and run any of the following &
  213.     programs.
  214.     {Bold:"Lo"}
  215.     ASCII.J      Basic Consol Operations
  216.     ATTACK.J     Fun Typewriter attack game
  217.     BINARY.J     Number formatting example
  218.     COLORS.J     Demonstration of all colors
  219.     CONTACT.J    Big Contact Manager (See Maillist)
  220.     FILEPRNT.J   Print any file on directory
  221.     FRENKEY.J    French Accents - Easy
  222.     HAIKU.J      Poetry Generator
  223.     MANTRA.J     Send your computer to heaven
  224.     MAILLIST.J   Basic Contact Manager
  225.     REGISTER.J   Register JORF - Input/Print example
  226.     TEXTEDIT.J   Little text editor
  227.     WHATKEY.J    Keyboard return values
  228.     {Bold:"No"}
  229.   Return (Ok)
  230.  
  231. Tutorial:Shift_F5_Key
  232.   Jorf:Status
  233.   Jorf:StatusClear
  234.   Return Ok
  235.  
  236. Tutorial:Debugger
  237.   Msg:Add
  238.     To go back to Running the Tutorial, &
  239.     Press {Bold:"Lo"}Alt-G{Bold:"No"}.  Pressing &
  240.     Escape will exit the Debugger and the Tutorial.
  241.  
  242.   Kbd:Put("Ctrl_Break_Key")
  243.   Return (Ok)
  244.  
  245. Class:Address Name Street CityStZip
  246.  
  247. Class:JORFNote Parent:Address Feeling Thought
  248.  
  249. Demo:Screen
  250.   New (Rad, Chk, Inp1, Inp2)
  251.   Win:Add ("A Real Screen", 4, 8, 14, 50, Here)
  252.     Menu:"&Help"
  253.       Menu:"&Indented Menu Items"
  254.         Menu:"&Create Sub Menus"
  255.           Menu:"&And Even Deeper"
  256.           Menu:"&Sub Menus"
  257.         Menu:""
  258.         Menu:"(Escape to Exit)"
  259.       Menu:"&Jorf Help           F1" Action:"Tutorial:F1_Key"
  260.       Menu:"&Time and Date  Alt-F10" Action:"Tutorial:Alt_F10_Key"
  261.     String:"  Use your Arrow Keys to go up and down.  On"
  262.     String:"  Check Boxes and Radio Buttons, the Enter Key"
  263.     String:"  checks and Space Bar skips.  Be sure to Press"
  264.     String:"  Alt-H to check out the Menus and Submenus!"
  265.     Radio:" Radio &1" Row:6 Col:8
  266.       Check:"Rad==True", Action:"Rad=True"
  267.     Radio:" Radio &2"
  268.       Check:"Rad==False", Action:"Rad=False"
  269.     ChBox:" Check Box &A" Row:6, Col:26
  270.       Check:"Chk==True", Action:"Chk=True"
  271.     ChBox:" Check Box &B"
  272.       Check:"Chk==False", Action:"Chk=False"
  273.     Input:"&Input 1  " Row:9, Col:8 Field:"Inp1"
  274.     Input:"I&nput 2  "              Field:"Inp2"
  275.     Button:"  &Done  "   Row:12, Col:24, Action:"Return 'Esc_Key'"
  276.   Return
  277.  
  278. Demo:Start
  279.   Msg:Add ("Quick Demonstration", "Ok")
  280.     Sure you can say "Hello World" in one line of
  281.     C code.  But how many punctuation characters
  282.     are required to display a dialog box like this?
  283.  
  284. Script:Add(Name)
  285.   Win:Add("The JORF Editor and Debugger", 0, 0, 24, 78, Here)
  286.     Magic:"P"
  287.     Menu:"&File"
  288.     Menu:"&Edit"
  289.     Menu:"&Debugger
  290.     Menu:"&Show
  291.     Menu:"&Help"
  292.     Menu:"&About"
  293.   Win:Msg("Press the space bar to speed up typing")
  294.   Event:Add ('Script')
  295.   Jorf:File ("Tutorial.Jrf", Here)
  296.   Jorf:Do (Name)
  297.   If (Kbd:Got != 'Esc_key')
  298.     Win:Ptr->Text = Text:Top(Win:Ptr->Text)
  299.     Method:Add (Win:Ptr->Text)
  300.   Return
  301.  
  302. Script:Box(Title, Len, Wid, Text)
  303.   New (Row, Col)
  304.   Row = Win:Ptr->Row + Win:Ptr->CurRow + 3
  305.   Col = Win:Ptr->Col - 4
  306.   Win:Add (Title, Row, Col, Len, Wid, Here, Text)
  307.   Return
  308.  
  309. Script:Else Key
  310.   Return Null
  311.  
  312. Script:Esc_Key
  313.   Return ('Esc_Key')
  314.  
  315. Script:Say(Line)
  316.   Win:Ptr->Text=Text:Add (Line, Win:Ptr->Text)
  317.   If (Kbd:Hit)
  318.     Kbd:Get
  319.   If (Kbd:Got="Space_Bar")
  320.     Str:PutLine(Line)
  321.   Else
  322.     Script:SayLineByCharacter (Line)
  323.   Return(Ok)
  324.  
  325. Script:SayLineByCharacter(J)
  326.   New (I, C)
  327.   I=1
  328.   While (ok)
  329.     C=Str:At (J, I, 1)
  330.     If (Str:Len (C) < 1)
  331.       Break
  332.     Str:Put (C)
  333.     ++I
  334.     If (C<>" ")
  335.       Win:Pause (2)
  336.     If (Kbd:Hit)
  337.       Kbd:Get
  338.     If (Kbd:Got="Space_Bar")
  339.       Break
  340.   Str:PutLine(Str:At(J, I))
  341.  
  342.