home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / teachapl.zip / teach45.zip / TEACH45.ATF
Text File  |  1996-07-11  |  58KB  |  707 lines

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1.000000000000011E²13                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 1233429312                                                             °
  5. XCÉPR 0                                                                        °
  6. XCÉLX 1 5 TEACH                                                                °
  7. *(1991 6 29 16 0 0 248)                                                        °
  8.  FCLOSE207 ÉFX 'CLOSE207' 'C207╜''CLOSE'' ''''' 'ÉWA╜C207'                     °
  9. X 'ÉWA╜ÉSVR ''C207''' 'ÉWA╜ÉEX ''C207'''                                       °
  10. *(1992 2 29 8 32 29 448)                                                       °
  11.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  12.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  13.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  14.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  15.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  16.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  17.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  18.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  19.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  20.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  21.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  22.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  23.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  24.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  25.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  26.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  27.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  28.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  29.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  30.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  31.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  32.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  33.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  34.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  35.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  36.  3]' 'D3E:N╜²2+µ,S'                                                            °
  37. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  38. *(1992 2 29 8 32 30 452)                                                       °
  39.  FGO ÉFX 'GO;b;e;t' 'Σ Expression driver' 'L0:b╜e╜''''' 'æ╜''       '''        °
  40.   't╜æ' '╕(^/'' ''=t)/L0' '╕((^/'')OFF ''=5╞6╟t)doif ''exit'')/0'              °
  41.   '╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/L0'                       °
  42.   '''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/L0' '╕b/L0'                                      °
  43.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  44. X '╕(''?''⌠╞1╟æ)/L0' 'e' '╕L0'                                                 °
  45. *(1993 11 8 18 0 0 200)                                                        °
  46.  FOPEN207 ÉFX 'OPEN207;C;I;J;M;MAXY;ÉIO'                                       °
  47.   'Σ Shares with AP207, sets up window, and initializates' 'ÉIO╜1'             °
  48.   '╕(2=ÉSVO ''C207'')/0' 'ÉWA╜ÉEX ''C207'''                                    °
  49.   'ÉES(2⌠207 SVOFFER ''C207'')/''*** Unable to share with AP207'''             °
  50.   'C207╜''QUERY'' '''''                                                        °
  51.   'ÉES(0⌠╞╞MAXY)/''*** Error received from AP207 on QUERY: '',,«╞╞MAXY╜C       °
  52.  207'                                                                          °
  53.   'MAXY╜(3πMAXY)[1;2 3]⌡0.8   ΣPhysical screen size for max display'           °
  54.   'L1:C207╜(Γ''OPEN''),(1+µDELAY)╙0,Γ0 ''AP207'',MAXY,0 0'                     °
  55.   '╕(0=╞╞I╜C207)/L2'                                                           °
  56.   '''*** OPEN207 can''''t open the display, return code: '' I' '╕'             °
  57.   'L2:M╜ε²1╞I' 'C207╜''QUERY'' ''''' '╕(0⌠╞╞I╜C207)/ER1'                       °
  58.   'Σ Set up  pf  as path to font files for APL2/PC'                            °
  59.   'J╜''IBM Video''╧πI[2]' 'pf╜(PATHFONT⌠'' '')/PATHFONT'                       °
  60.   'pf╜pf,((''\''⌠²1╞pf)^0⌠µpf)/''\'''                                          °
  61.   '»(~J)/''pf[(pf=''''\'''')/∞µpf]╜''''/''''''' 'I╜πI[3]'                      °
  62.   'I╜,(I[;1]=M)≡I'                                                             °
  63.   'Σ Define unity aspect ratio window with max x,y of at least 1000,734'       °
  64.   'J╜╛0.5+(I[2 3]-1)⌡I[9 10]÷(╛/(I[2 3]-1)⌡I[9 10]÷1000 734)'                  °
  65.   'C207╜''WINDOW''(0 0,(I[2 3]-1),0 0,J)' '╕(0⌠╞╞I╜C207)/ER1'                  °
  66.   'C207╜''FONT'' ''''' 'DFS╜(2πC207)[2] Σ SAVE DEFAULT FONT SIZE'              °
  67.   'ΣCheck that vector font files can be found'                                 °
  68.   'C207╜''FONTDEF''(''F''(pf,''ROMSIM.AVF''))''FONT''(''F'' 10)'               °
  69.   '╕(0⌠╞╞I╜C207)/ER2'                                                          °
  70.   'C207╜''FONTDEF''(''F''(pf,''THKSQUF.AVF''))''FONT''(''F'' 10)'              °
  71.   '╕(0⌠╞╞I╜C207)/ER2' '╕0' 'ER1:CLOSE207'                                      °
  72.   '''*** Error received from AP207 during OPEN207''' '╕' 'ER2:CLOSE207'        °
  73.   '''This workspace uses the vector font files supplied with AP207.  The       °
  74.  se'''                                                                         °
  75.   '''files cannot be found.  Be sure that the files, which have an exten       °
  76.  sion'''                                                                       °
  77.   '''of .AVF, are installed.  The normal APL2/6000 install process place       °
  78.  s'''                                                                          °
  79.   '''these fonts in the directory $APL2/fonts/vector but if an alternate       °
  80.  '''                                                                           °
  81.   '''directory is used, the environment variable $APL207FL must be set t       °
  82.  o''' '''the proper directory prior to starting the APL2 session.'''           °
  83. X '╕'                                                                          °
  84. XCPATHFONT 1 0                                                                 °
  85. *(1995 4 23 14 14 6 304)                                                       °
  86.  FSVOFFER ÉFX 'DC╜PID SVOFFER SV' 'SV╜(²2╞1 1,µSV)µSV╜πSV'                     °
  87.   '╕(2=ÉNC ''PID'')/DYADIC' 'DC╜ÉSVO SV ╪ ╕0'                                  °
  88.   'DYADIC:╕(1^.⌠DC╜PID ÉSVO SV)/END' 'ÉSVE╜15'                                 °
  89.   'CHECK:╕(1^.⌠DC╜ÉSVO SV)/END' '╕(0⌠ÉSVE)/CHECK'                              °
  90. X 'END:SV╜1 0 1 0 ÉSVC SV'                                                     °
  91. *(1996 6 22 20 57 21 568)                                                      °
  92.  FTEACH ÉFX 'TEACH' 'Σ Copyright Z V Jizba 1991; all rights reserved'          °
  93.   'copyright' 'initialize' 'warning' 'TEACH1   Σ Defining a "pel"'             °
  94.   'TEACH2   Σ Staicase effect of a nearly horizontal straight line'            °
  95.   'TEACH3   Σ Graphical driver parameters'                                     °
  96.   'TEACH4   Σ Multiple shared variables allowed'                               °
  97.   'TEACH5   Σ The 35 keywords' 'TEACH6   Σ Displaying a graph'                 °
  98.   'TEACH7   Σ Drawing a line' 'TEACH8   Σ Drawing from an array'               °
  99. X 'TEACH9   Σ The command MOVE'                                                °
  100. *(1996 6 17 13 25 14 364)                                                      °
  101.  FTEACH1 ÉFX 'TEACH1;T;D207' 'Σ Introduction to AP 207'                        °
  102.   '''THE UNIVERSAL GRAPHICS AUXILLIARY PROCESSOR'',r'                          °
  103.   '''Auxilliary processor 207 is the graphic processor. It''''s one shar       °
  104.  ed'''                                                                         °
  105.   '''variable accepts key words followed by arguments to produce the'''        °
  106.   '''desired effects.'',r'                                                     °
  107.   '''Before we describe in detail these key words, it is useful to'''          °
  108.   '''introduce some terminology. Graphic display screens are of two kind       °
  109.  s.'''                                                                         °
  110.   '''In "vector" based screens such as those of work stations, straight'       °
  111.  ''                                                                            °
  112.   '''line segments are drawn as straight lines between two points. In th       °
  113.  e'''                                                                          °
  114.   '''displays more typically used with personal computers the screen is'       °
  115.  ''                                                                            °
  116.   '''divided into an array of rectangular dots that fill out the screen.       °
  117.  ''' '''In AP 207 these dots are called "pels".'',r'                           °
  118.   '''The number of "pels" per row and per column depends on a parameter'       °
  119.  ''                                                                            °
  120.   '''called "graphic mode". Each graphic mode supports a specific pel'''       °
  121.   '''size. When a line is drawn between two points, the pels connecting'       °
  122.  ''                                                                            °
  123.   '''two points are made visible. However, because each pel occupies'''        °
  124.   '''a specific location on the screen, "straight" lines may show a'''         °
  125. X '''series of steps.'',r' 'end'                                               °
  126. *(1996 6 22 21 10 32 428)                                                      °
  127.  FTEACH2 ÉFX 'TEACH2;D207;T'                                                   °
  128.   '''In the drawing to be illustrated, a "straight line" will be drawn b       °
  129.  etween'''                                                                     °
  130.   '''two points (50 250) and (600 255). Instead of a true straight line,       °
  131.   we'''                                                                        °
  132.   '''will see a staircase effect. This is because the screen must be tho       °
  133.  ught of'''                                                                    °
  134.   '''as an array consisting of these small rectangles we have called pel       °
  135.  s.'',r'                                                                       °
  136.   '''(WHEN YOU PRESS ENTER, WAIT UNTIL THE GRAPH APPEARS, THEN CLICK ON        °
  137.  THE''' '''SESSION MANAGER SCREEN)''' 'do'                                     °
  138.   'T╜TEST ''DRAW''(2 3µ0 50 250 1 400 255)''VIEW'' ''''' 'do'                  °
  139.   '''These pels are the primitive graphic elements to be manipulated by'       °
  140.  '' '''APL2. A pel has several important properties:'',r'                      °
  141.   '''         SIZE''' '''        SHAPE''' '''        COLOR'''                  °
  142.   '''    INTENSITY'',r'                                                        °
  143.   '''To illustrate the range of choices, we will use AP 207 and issue a'       °
  144. X'' '''command to describe the available screen choices.''' 'end'              °
  145. *(1996 6 17 13 53 28 532)                                                      °
  146.  FTEACH3 ÉFX 'TEACH3;PARMS;D207;T' 'Σ The graphic driver and parameters'       °
  147.   '''THE GRAPHICAL DRIVER PARAMETERS'',r' 'T╜207 SVOFFER ''D207'''             °
  148.   'show ''D207╜''''QUERY'''' '''''''' ╪ PARMS╜test'''                          °
  149.   '''We have assigned to shared variable D207 the keyword "QUERY".'''          °
  150.   '''This keyword represents a request to provide the current graphic'''       °
  151.   '''driver, and the graphic modes that this driver supports.'',r'             °
  152.   'show ''DISPLAY PARMS'''                                                     °
  153.   '''The variable PARMS is a nested vector with three components. The'''       °
  154.   '''first component is a scalar integer containing the return code'''         °
  155.   '''of the ''''QUERY'''' operation. It should be a zero (0). The second       °
  156.  '''                                                                           °
  157.   '''element of PARMS gives the name of the graphic driver (the default'       °
  158.  '' '''name is "OS/2 Presentation Manager")). The third element is a'''        °
  159.   '''numeric array (shape =1 10) listing the parameters of the driver.''       °
  160. X' 'do' 'TEACH3A' 'end'                                                        °
  161. *(1996 6 22 21 16 22 412)                                                      °
  162.  FTEACH3A ÉFX 'TEACH3A;H1;H2;H3' 'Σ PARMS continued'                           °
  163.   'H1╜π(Γ''COL''),«■∞10' 'H2╜π(Γ''VALUE''),«■,3πPARMS'                         °
  164.   'H3╜''CONTENTS'' ''MODE (in OS/2 always=1)'' ''Width of the screen in        °
  165.  "pels"''' 'H3╜H3,Γ''Height of the screen in "pels".'''                        °
  166.   'H3╜H3,Γ''Number of different colors displayable'''                          °
  167.   'H3╜H3,Γ''Number of different line styles available (FULL, DASHED ...)       °
  168.  ''' 'H3╜H3,Γ''Number of different line widths available *)'''                 °
  169.   'H3╜H3,Γ''Number of different fill patterns available'''                     °
  170.   'H3╜H3,Γ''Number of different markers available'''                           °
  171.   'H3╜H3,Γ''The width (x) of a "pel" in arbitrary units'''                     °
  172.   'H3╜πH3,Γ''The height (y) of a "pel" in arbitrary units'''                   °
  173.   'H1,'' '',H2,'' '',H3'                                                       °
  174.   '''     The ratio x÷y is called the "Aspect ratio"'',r'                      °
  175.   '''*) Line widths come only as FULL line style'',r'                          °
  176.   '''On loading the workspace, the array in 3πPARMS is retrieved by func       °
  177.  tion''' '''"globals" and stored as the global variable "modes".'',r'          °
  178. X 'show ''modes╧3πPARMS'''                                                     °
  179. *(1996 6 17 13 39 5 384)                                                       °
  180.  FTEACH4 ÉFX 'TEACH4;D207A;D207B;D207C' 'Σ The keywords'                       °
  181.   '''We have just used the keyword "QUERY". It illustrates the typical''       °
  182.  ' '''process of AP 207. A two (or more) element nested vector is'''           °
  183.   '''assigned to the shared variable (D207). The first component of this       °
  184.  '''                                                                           °
  185.   '''nested vector is a keyword (such as QUERY). The remaining component       °
  186.  s'''                                                                          °
  187.   '''provide additional parameters of the operation. After an assignment       °
  188.  ,'''                                                                          °
  189.   '''it is permissible to interrogate the shared variable for a return''       °
  190.  '                                                                             °
  191.   '''code. (NOTE: in this and subsequent lessons the contents of the'''        °
  192.   '''returned values will be obtained using function "test".)'',r'             °
  193.   ''' Typically, the returned value is also a vector with the first elem       °
  194.  ent''' '''an integer scalar giving the return code.'',r'                      °
  195.   '''A single command is usually not sufficient to complete a graphic'''       °
  196.   '''display. Typically one must issue several such commands. This can b       °
  197.  e'''                                                                          °
  198.   '''done using a defined function, or merely catenating two or more'''        °
  199.   '''commands together. (As we proceed with new keyword commands, we wil       °
  200.  l''' '''see examples of this.)'',r' 'do'                                      °
  201.   '''There is one more feature of AP207 that needs mentioning at this'''       °
  202.   '''point. More than one shared variable can be activated at one time''       °
  203.  ,r' 'show ''207 SVOFFER ''''D207A'''' ''''D207B'''' ''''D207C'''''''          °
  204.   'show ''ÉSVO■ ''''D207A'''' ''''D207B'''' ''''D207C'''''''                   °
  205.   '''These variables may be used if there are two or more windows, or if       °
  206. X''' '''you use two or more moving patterns.''' 'end'                          °
  207. *(1996 6 22 21 21 24 440)                                                      °
  208.  FTEACH5 ÉFX 'TEACH5;LIST;D207;T' 'Σ The keywords' '''THE KEYWORDS'',r'        °
  209.   '''There are 35 keywords available with AP 207'',r'                          °
  210.   'LIST╜''ARC'' ''BEGAREA'' ''BITMAP'' ''BOX'' ''CLEAR'' ''CLOSE'' ''COL       °
  211.  MAP'' ''COLOR'''                                                              °
  212.   'LIST╜LIST,''CURSOR'' ''DRAW'' ''ENDAREA'' ''ESCAPE'' ''FONT'' ''FONTD       °
  213.  EF'' ''IMAGE'''                                                               °
  214.   'LIST╜LIST,''LINETYPE'' ''LOAD'' ''MARKER'' ''MIX'' ''MOVE'' ''OPEN''        °
  215.  ''PALETTE'''                                                                  °
  216.   'LIST╜LIST,''PATTERN'' ''POINT'' ''PRINT'' ''QUERY'' ''QWRITE'' ''SCIS       °
  217.  SOR'''                                                                        °
  218.   'LIST╜LIST,''SECTOR'' ''SETPEL'' ''USE'' ''WAIT'' ''VIEW'' ''WINDOW''        °
  219.  ''WRITE''' 'tab LIST'                                                         °
  220.   'r,''Three of these keywords also have synonyms'',r'                         °
  221.   '''    CLEAR  ERASE'',r,''    COLOR  COLOUR'',r,''   SECTOR  WEDGE'',r       °
  222.  '                                                                             °
  223.   '''We will study them in a sequence that will gradually allow us to'''       °
  224.   '''generate ever more complex graphic displays.''' 'do'                      °
  225.   'T╜207 SVOFFER ''D207''' '''KEYWORDS OPEN AND CLOSE'',r'                     °
  226.   '''We begin with OPEN and CLOSE. OPEN defines the graphic mode. It'''        °
  227.   '''clears the screen, and assigns the driver characteristics. The'''         °
  228.   '''word OPEN must be followed by a 1 followed optionally by a "title"'       °
  229.  ''                                                                            °
  230.   '''string and by 4 integers specifying the width, height, x and y'''         °
  231.   '''position of the window. The first element of the argument (1)'''          °
  232.   '''represents the "video mode". In APL2OS2 this mode is always 1, but'       °
  233.  ''                                                                            °
  234.   '''it is permissible to also use the value of 0. A zero should be used       °
  235.   if'''                                                                        °
  236.   '''the APL2 code is to be ported between different APL2 implementation       °
  237.  s.'',r'                                                                       °
  238.   'show ''DISPLAY ''''OPEN'''' (1 ''''TEST WINDOW 1'''' 300 200 200 50)'       °
  239.  ''                                                                            °
  240.   '''Note the format of the command. It is a nested vector of length 2.        °
  241.  The'''                                                                        °
  242.   '''first element is the keyword "OPEN". The arguments are enclosed as        °
  243.  a''' '''second element of the vector.'',r'                                    °
  244.   '''As the following command is evaluated, the graphical window will'''       °
  245.   '''flash briefly on your screen.''' 'do'                                     °
  246.   'show ''D207╜(Γ''''OPEN''''),Γ1 ''''TEST WINDOW 1'''' 300 200 200 50 ╪       °
  247.   DISPLAY test'''                                                              °
  248.   '''The width and height (300 200) are measured in pels starting at the       °
  249.  '''                                                                           °
  250.   '''bottom left corner of the screen. The coordinates are of the lower'       °
  251.  ''                                                                            °
  252.   '''left corner of the window. The size of the screen (200 50) is also'       °
  253.  ''                                                                            °
  254.   '''in pel units. To see this window, press CTL-ESC and select TEST'''        °
  255.   '''WINDOW 1.''' 'do'                                                         °
  256.   '''The command CLOSE with a null argument will close the current windo       °
  257.  w.'''                                                                         °
  258.   '''It has the same effect as double clicking on the window icon.'',r'        °
  259. X 'show ''D207╜''''CLOSE'''' '''''''' ╪ DISPLAY test''' 'end'                  °
  260. *(1996 7 11 13 7 2 224)                                                        °
  261.  FTEACH6 ÉFX 'TEACH6;T' 'Σ Describe function TEST'                             °
  262.   '''Before we continue describing the Graphics processor commands,'''         °
  263.   '''it will be useful to describe the utility function TEST. This'''          °
  264.   '''function has been designed to simplify the process of illustrating'       °
  265.  '' '''various AP207 commands.'',r' '(,1)showfn ''TEST''' 'do'                 °
  266.   '''Line [2] activates the shared variable D207. Line [3] sets up the h       °
  267.  eader'''                                                                      °
  268.   '''of the window. The size is set to 760 pels horizontal and 560 verti       °
  269.  cal.'''                                                                       °
  270.   '''This will fill out the screen, but still show the header and a port       °
  271.  ion'''                                                                        °
  272.   '''of the Session Monitor. If a left argument is given, it must comply       °
  273.   with'''                                                                      °
  274.   '''the format mandated by the command OPEN. Lines [4] and [5] open the       °
  275.  '''                                                                           °
  276.   '''graphic window. Normally this will produce a flash on the screen. L       °
  277.  ines'''                                                                       °
  278.   '''[6-8] evaluate the commands given in the right argument. The respon       °
  279.  se'''                                                                         °
  280.   '''to the command(s) is returned by the function. If the first element       °
  281.   of'''                                                                        °
  282.   '''U is a zero, TEST will exit. Else line [10] will display the Return       °
  283.  ''' '''Code and the session will be aborted.'',r'                             °
  284.   '''To view the graphic screen on completion of function TEST, press Ct       °
  285.  rl-Esc,'''                                                                    °
  286.   '''select the graphic screen line, and double click on it. Here is an        °
  287.  example''' '''using the command BOX to draw a rectangle.'',r'                 °
  288.   '''DO NOT FORGET TO DISPLAY THE WINDOW BEFORE PRESSING ENTER TWICE!'',       °
  289.  r' 'show ''T╜TEST ''''ARC'''' (150 150 100 100 0 360)'''                      °
  290.   '''Since multiple command sequences are allowed, the right argument to       °
  291.  ''' '''TEST may include an even sequence of valid AP207 commands.'',r'        °
  292.   'show ''T╜TEST ''''BOX'''' (150 300 50 100) ''''BOX'''' (200 200 0 0)'       °
  293.  ''                                                                            °
  294.   '''Note that on such multiple command sequences, AP 207 returns a'''         °
  295.   '''nested vector of depth 3. (This and the commands ARC and BOX will b       °
  296.  e''' '''discussed in more detail in subsequent lessons.)''' ''                °
  297. X 'show ''DISPLAY T''' 'end'                                                   °
  298. *(1996 6 20 14 28 10 376)                                                      °
  299.  FTEACH7 ÉFX 'TEACH7;T' 'Σ The commands DRAW and MOVE'                         °
  300.   '''We are ready now to discuss the primitive graphic commands'',r'           °
  301.   '''THE COMMANDS DRAW and MOVE'',r'                                           °
  302.   '''We begin with the command "DRAW". This command allows the positioni       °
  303.  ng'''                                                                         °
  304.   '''of the pel on the screen, and connecting two or more consecutive pe       °
  305.  ls''' '''with straight lines.'',r'                                            °
  306.   '''When the OPEN command is given, the default pel position is 0 0. Th       °
  307.  is'''                                                                         °
  308.   '''represents the location at the lower left hand corner of the screen       °
  309.  .'''                                                                          °
  310.   '''The command "DRAW" must be followed by an enclosed integer vector,        °
  311.  or'''                                                                         °
  312.   '''an enclosed integer array with two or three columns. Let us begin b       °
  313.  y''' '''an example where we use a simple vector of length 2'',r'              °
  314.   '''When you press Return, a graphic command will be given. Please wait       °
  315.  '''                                                                           °
  316.   '''a few seconds to give this command a chance to be evaluated. NOTE A       °
  317.  LSO'''                                                                        °
  318.   '''THAT THE SCREEN WILL FLASH THE GRAPH AND THEN RETURN TO APL2. At th       °
  319.  at'''                                                                         °
  320.   '''point BEFORE PRESSING ENTER you can press Ctrl-Esc to view the grap       °
  321.  h.''' 'do' 'show ''T╜TEST ''''DRAW'''' (400 300)'''                           °
  322.   '''We requested a line to be drawn from the current location (0,0) to'       °
  323.  ''                                                                            °
  324.   '''position (400 300). Since there are 800 pels in a row of the screen       °
  325.  ,'''                                                                          °
  326.   '''and 600 pels in a column of the screen, the line goes about 1/2 of        °
  327.  the'''                                                                        °
  328.   '''way up, and about 1/2 of the way to the right. The return code is i       °
  329.  n''' '''variable T'',r' 'show ''DISPLAY T'''                                  °
  330.   'r,''The first element of T is the scalar 0 (return code), and the sec       °
  331.  ond''' '''element is the null vector (no information).''' 'do'                °
  332.   '''Let us suppose now that we desire to draw two consecutive lines.'''       °
  333.   '''There are several ways to do it. We begin with the least efficient'       °
  334.  ''                                                                            °
  335.   '''way, but one that illustrates several aspects of this command'',r'        °
  336.   '''REMINDER: Press Ctrl-Esc after the flash (before pressing Enter)'',       °
  337.  r' 'show ''T╜TEST ''''DRAW'''' (400 300) ''''DRAW''''(800 0)'''               °
  338.   '''The second line begins at point (400 300) and connects with point''       °
  339.  ' '''(800 0) which is in the lower right of the screen.'',r'                  °
  340.   '''We look at the contents of T''' 'show ''DISPLAY T'''                      °
  341.   '''This time T contains three components. The first component gives'''       °
  342.   '''the return code for the combined operation (in this case the two'''       °
  343.   '''DRAW commands). The remaining components give the individual'''           °
  344.   '''results from each of the multiple commands.''' 'do'                       °
  345.   '''One could ask whether it is possible to combine the two vectors,'''       °
  346.   '''say (400 300 800 0) into a single operation. The answer is yes and'       °
  347.  ''                                                                            °
  348.   '''no. Before we can deal with combined vectors we must introduce'''         °
  349.   '''yet another quantity, a boolean value to signify (move|draw).'''          °
  350.   '''To illustrate how this works, let us suppose we desire to draw'''         °
  351.   '''the vector from (400 300) to (800 0) but without showing the line''       °
  352.  ' '''from (0 0) to (400 300). This is done in the following way'',r'          °
  353.   'show ''T╜TEST ''''DRAW'''' (0 400 300) ''''DRAW'''' (1 800 0)'''            °
  354.   '''The boolean value is used to determine whether the transfer of the'       °
  355.  ''                                                                            °
  356.   '''"current position" is merely a move, or whether it is also a draw.'       °
  357.  '' '''(This is why the User Guide refers to this value as "md".)'''           °
  358. X 'end'                                                                        °
  359. *(1996 6 21 14 1 10 272)                                                       °
  360.  FTEACH8 ÉFX 'TEACH8;A;T' 'Σ Array arguments to DRAW'                          °
  361.   '''Because there are two different ways to interpret vectors (i.e. as'       °
  362.  ''                                                                            °
  363.   '''doublets or triplets), it is not practical to catenate them as'''         °
  364.   '''the right argument to the command DRAW. However, it IS permissible'       °
  365.  ''                                                                            °
  366.   '''to combine two or more vectors as an array. The next two examples''       °
  367.  ' '''illustrate this process'',r'                                             °
  368.   'show ''A╜2 2µ400 300 800 0 ╪ DISPLAY A'''                                   °
  369.   'show ''T╜TEST ''''DRAW'''' A'''                                             °
  370.   '''What we get is the line from (400 300) to (800 0). The line from'''       °
  371.   '''(0 0) to (400 300) has been made by default just a move. If we'''         °
  372.   '''wanted to draw both lines, we would have to specify both values'''        °
  373.   '''of "md"'',r' 'show ''A╜2 3µ1 400 300 1 800 0 ╪ DISPLAY A'''               °
  374.   'show ''T╜TEST ''''DRAW'''' A'''                                             °
  375.   '''The rule for drawing lines from arrays is the following:'',r'             °
  376.   '''  1. Array with two columns'''                                            °
  377.   '''     "The first row represents a move. All subsequent'''                  °
  378.   '''      rows will be drawn."'',r'                                           °
  379.   '''  2. Array with three columns'''                                          °
  380.   '''     "Rows starting with a zero represent moves. Rows'''                  °
  381.   '''      starting with ones represent ''''draws''''."'',r' 'do'              °
  382.   '''Let us see how this works.'',r'                                           °
  383.   'show ''A╜6 2µ50 50 320 100 160 150 480 100 320 50 600 100 ╪ DISPLAY A       °
  384.  ''' 'show ''T╜TEST ''''DRAW'''' A'''                                          °
  385.   '''If we add a boolean column to this array, say 0 1 0 1 0 1, we will'       °
  386.  '' '''see a sequence of disjoint line segments'',r'                           °
  387. X 'show ''T╜TEST ''''DRAW'''' (0 1 0 1 0 1,[2]A)''' 'end'                      °
  388. *(1996 7 11 13 31 56 536)                                                      °
  389.  FTEACH9 ÉFX 'TEACH9;A;T;X;D207' 'Σ The command MOVE'                          °
  390.   '''THE COMMAND MOVE'',r'                                                     °
  391.   '''Suppose we have completed a drawing, but for some reason have faile       °
  392.  d to'''                                                                       °
  393.   '''save current position. The command MOVE is one way of finding out.'       °
  394.  ',r'                                                                          °
  395.   '''The keyword ''''MOVE'''' may be followed by either a null vector, o       °
  396.  r'''                                                                          °
  397.   '''by a two element numeric vector. The first version provides a way t       °
  398.  o'''                                                                          °
  399.   '''retrieve the current position, and the second version is equivalent       °
  400.  ''' '''to ''''DRAW'''' (0 x y).'',r'                                          °
  401.   '''Attempts to use function TEST fail for some reason. It appears that       °
  402.  '''                                                                           °
  403.   '''AP 207 does not like it when the command MOVE is part of a multiple       °
  404.  '''                                                                           °
  405.   '''call sequence. Here is an example. The command MOVE should return''       °
  406.  ' '''the value 100 100. Instead, the returned value is 0.'',r'                °
  407.   'show ''T╜TEST ''''MOVE'''' (100 100) ''''DRAW'''' (200 200) ╪ DISPLAY       °
  408.   T'''                                                                         °
  409.   '''When a MOVE command is inserted between two DRAW commands, it does'       °
  410.  ''                                                                            °
  411.   '''not work either. In the next example we will attempt to do the'''         °
  412.   'X╜3 3µ1 100 100 0 200 200 1 400 100' '''equivalent of'',r'                  °
  413.   '''        ''''DRAW'''' X''' '''where X would be defined as'',r'             °
  414.   'show ''DISPLAY X'''                                                         °
  415.   'show ''T╜TEST ''''DRAW'''' (100 100) ''''MOVE'''' (200 200) ''''DRAW'       °
  416.  ''' (400 100) ╪ DISPLAY T'''                                                  °
  417.   '''The return cods is zero but the MOVE return value is a null vector.       °
  418.  '',r'                                                                         °
  419.   '''To see how command MOVE behaves, we will invoke shared variable D20       °
  420.  7''' '''directly'',r' 'show ''T╜207 SVOFFER ''''D207'''''''                   °
  421.   'show ''D207╜''''OPEN'''' (1 ''''TEST MOVE'''' 760 560 0 0)'''               °
  422.   'show ''D207╜''''MOVE'''' (100 100) ╪ DISPLAY D207'''                        °
  423.   '''If the manual is correct, one should get either (0 0) or (100 100)'       °
  424.  '' 'do'                                                                       °
  425.   'show ''D207╜''''DRAW'''' (100 100) ''''MOVE'''' '''''''' ╪ DISPLAY D2       °
  426.  07''' '''We get the right answers, but the return code is 1.''' 'do'          °
  427.   '''This is the end of this lesson. In the next lesson we will learn ho       °
  428.  w'''                                                                          °
  429.   '''to change the range of the screen addressing, and how to insure'''        °
  430.   '''that the horizontal and vertical dimensions retain identical scalin       °
  431. Xg.'''                                                                         °
  432. *(1996 6 22 20 41 6 444)                                                       °
  433.  FTEST ÉFX 'U╜V TEST W;T;M;D207'                                               °
  434.   'Σ Test a sequence of graphic commands (W)' 'T╜207 SVOFFER ''D207'''         °
  435.   '╕(2=ÉNC ''V'')/L1 ╪ V╜1(M╜''TEST '',«εW)760 560 0 0'                        °
  436.   'L1:V╜''OPEN'' V' 'D207╜V ╪ ╕(0=╞D207)/L0 ╪ U╜''Open failed'' ╪ ╕0'          °
  437.   'L0:D207╜W' 'do' 'U╜D207' '╕(0=╞╞U)/0'                                       °
  438. X 'M,'' has been aborted. The return code is '',╞╞U ╪ ╕'                       °
  439. XCa 0 %                                                                        °
  440. *(1992 2 29 8 32 29 448)                                                       °
  441.  Faddquote ÉFX 'u╜addquote w'                                                  °
  442.   'Σ Put quotes around a string, and double existing quotes'                   °
  443. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  444. *(1992 2 29 8 32 29 448)                                                       °
  445. XFaq ÉFX 'u╜aq w' 'Σ Enclose quoted string' 'u╜Γaddquote w'                    °
  446. *(1992 2 29 8 32 30 452)                                                       °
  447.  Fav ÉFX 'av;a;n;i;ÉIO' 'Σ Display characters in the Atomic vector'            °
  448.   'ÉIO╜0' 'a╜22 78µ'' ''' 'n╜3 0«φ12 22µ1+∞256'                                °
  449.   'a[;,(6⌡∞12)°.+2 3 4]╜n' 'a[;6+6⌡∞12]╜φ12 22µÉAV'                            °
  450. X 'a[7 8 10 13;6]╜'' ''' 'a[14+∞8;68 69 70 72]╜'' ''' 'a'                      °
  451. *(1992 2 29 8 32 32 460)                                                       °
  452.  Fback ÉFX 'back;T' 'Σ Reset screen to 25⌡80 size' 'OPEN 124' 'C124╜0 3'       °
  453. X 'CLOSE 124 206'                                                              °
  454. *(1992 8 10 10 30 51 484)                                                      °
  455.  Fclosetwo ÉFX 'closetwo W;T;C' 'Σ Retract AP W' '╕(0=ÉSVO ''C2'')/0'          °
  456.   '╕(0=ÉNC ''C2'')/L0' '╕(0=µ,W)/L0' 'C2╜4 5,W'                                °
  457.   'T╜(δ/0⌠C╜C2)doif ''''''AP2 retraction failed ('''',(«C),'''')'''''''        °
  458.   'L0:C2╜²1,1+µεsv' 'T╜ÉSVR■''C2'' ''D2'' ''E2'''                              °
  459. X 'T╜ÉEX■''C2'' ''D2'' ''E2'''                                                 °
  460. *(1996 6 27 13 48 32 568)                                                      °
  461.  Fcopyright ÉFX 'copyright' 'Σ Copyright statement'                            °
  462.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996'',r'                         °
  463.   '''To see disclaimers, enter ÉCR ''''copyright''''''' 'do' '╕0'              °
  464.   '''This and subsequent workspaces labelled TEACHxx are made available'       °
  465.  ''                                                                            °
  466.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  467.   '''the IBM/OS2 version of APL2.'',r'                                         °
  468.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  469.  her'''                                                                        °
  470.   '''express or implied. Any risk in its use resides with you, the user        °
  471. Xof''' '''these tutorials.''' '''(PRESS ENTER to continue)'''                  °
  472. XCd 0 "                                                                        °
  473. *(1992 2 29 8 32 33 464)                                                       °
  474.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  475. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  476. XCdig 1 10 1234567890                                                          °
  477. *(1992 2 29 8 32 28 444)                                                       °
  478.  Fdo ÉFX 'do;t;e;b' 'Σ Expression driver' 'e╜''''' 'æ╜''       ''' 't╜æ'       °
  479.   '╕(^/'' ''=t)/0'                                                             °
  480.   '╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/2'                        °
  481.   '''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/2'                                               °
  482.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  483. X 'e' '╕2'                                                                     °
  484. *(1992 2 29 8 32 28 444)                                                       °
  485.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  486. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  487. XNdos 0 ²26                                                                    °
  488. XCe 1 0                                                                        °
  489. *(1996 3 31 14 34 39 548)                                                      °
  490.  Fend ÉFX 'end' '''²²''' 'e╜''''' 'æ╜''       ''' 't╜æ' '╕(^/'' ''=t)/0'       °
  491.   '╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/3'                        °
  492.   '''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/0'                                               °
  493.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/0'        °
  494. X 'e'                                                                          °
  495. *(1992 2 29 8 32 30 452)                                                       °
  496. XFendd ÉFX 'endd' 'Σ End of document' '20µ''²''' 'do'                          °
  497. *(1996 1 17 16 32 13 380)                                                      °
  498.  Ferase ÉFX 'erase;t;DISPLAY;GO;SVOFFER;OPEN207;CLOSE207;PATHFONT;TEST'        °
  499.   't╜ÉNL 3' 't╜(~t^.εlc,'' '')≡t' 't╜ÉEX(~t[;∞5]^.=''TEACH'')≡t'               °
  500. X 't╜ÉNL 2' 't╜ÉEX(~t^.εlc,'' '')≡t' 't╜ÉNL 4' 't╜ÉEX(~t^.εlc,'' '')≡t'        °
  501. *(1992 2 29 8 32 32 460)                                                       °
  502.  Fevaldd ÉFX 'u╜evaldd w;c;n'                                                  °
  503.   'Σ Evaluate a direct definition expression' 'u╜0' 'n╜(w∞''Σ'')-1'            °
  504.   'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w' '╕(label╞c)/0'                     °
  505.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  506.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  507.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  508.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  509.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  510. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  511. *(1992 2 29 8 32 32 460)                                                       °
  512.  Fexit ÉFX 'exit w' 'Σ Exit if there are too many suspended functions'         °
  513. X '╕((10>µÉLC)doif ''w'')/0' '''Please re-enter '',w' '╕'                      °
  514. XCf 1 2  {                                                                     °
  515. XCg 1 2 }                                                                      °
  516. *(1995 12 18 15 37 48 580)                                                     °
  517.  Fget ÉFX 'u╜v get w;t;ÉPR' 'Σ Prompt for response from keyboard'              °
  518.   't╜(0=ÉNC ''V'')doif ''V╜1'' ╪ ÉPR╜''''' 'w╜w,(~²1╞v)/'': '''                °
  519.   'L0:æ╜w' 't╜æ' '╕((''╕''=(µw)╟t)doif ''╕'')/0' '╕(^/'' ''=w)/L1'             °
  520.   '╕((~w╧(µw)╞t)doif ''''''PLEASE DO NOT BACKSPACE'''''')/L0'                  °
  521.   't╜(µw)╟t' 'L1:u╜(²1+(,'' ''⌠t)∞1)╟t' '╕(1╞v)/0' 't╜(u⌠'' '')Γu'             °
  522. X 'u╜(µt),(Γu),t'                                                              °
  523. *(1996 1 12 16 8 28 324)                                                       °
  524.  Fglobals ÉFX 'globals;T;D207' 'Σ Initialize useful global variables'          °
  525.   'r╜2╙ÉTC' 'q╜40╙ÉAV' 's╜Φp╜'' '',d╜35╙ÉAV'                                   °
  526.   'sv╜(100 211 80 206)(210 124)' 'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''           °
  527.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  528.   'g╜Φ'' '',h╜126╙ÉAV' 'f╜ÉAV[33 124]' 'a╜38╙ÉAV' 'ul╜''²'''                   °
  529.   'T╜207 SVOFFER ''D207''' 'D207╜''QUERY'' ''''' 'modes╜3πD207'                °
  530.   'Σpath╜''C:\APL2\WORK\''' 'Σ''The current path is '',path'                   °
  531.   'ΣT╜1 get ''Enter new path if incorrect, else press Enter: '''               °
  532. X 'Σ╕((0<µT)doif ''path╜T'')/0'                                                °
  533. XCh 0 }                                                                        °
  534. *(1992 8 10 10 44 11 380)                                                      °
  535.  Findex ÉFX 'U╜V index W;A;C;H;I;T' 'Σ List contents of an AP 211 file'        °
  536.   'T╜~(1<╧W)doif ''H╜2πW'' ''W╜1πW''' 'T╜T doif ''H╜''''FUNCTION'''''''        °
  537.   'T╜(ΓW)ε''DOCS'' ''UTILITY'' ''HELP'' ''TUTOR'''                             °
  538.   'T╜T doif ''W╜path,W,''''.211''''''' '1 OPEN 211' 'D211╜''USE'' W'           °
  539.   '''File '',W,'' has record length='',1╟D211'                                 °
  540.   'D211╜''LIST'' ''NAMES''' 'U╜D211'                                           °
  541.   '╕((0=╧U)doif ''U╜''''Unknown file'''''')/0' 'C╜1╟µU╜U[I╜ÉAV√U;]'            °
  542.   '╕((0=ÉNC ''V'')doif ''CLOSE 211'')/0' 'U╜(C╞H),[1]ul,[1]U'                  °
  543.   '╕((0=1╞V)doif ''U╜0 0 2 tab U'' ''CLOSE 211'')/0'                           °
  544.   'D211╜''LIST'' ''ATTS''' 'A╜D211'                                            °
  545.   'A╜(''SZ'' ''ID'' ''DATE'' ''mo'' ''d'' ''TIME'' ''m'' ''s'' ''ms''),[       °
  546.  1]ul,[1]A[I;]' 'V╜(Vε0,(∞9),-∞9)/V' 'U╜U,«A[;(0⌠V)/|V]'                       °
  547.   '╕((0εV)doif ''CLOSE 211'')/0'                                               °
  548.   'T╜~(0<╛/V)doif ''U╜U[∞2;],[1](2 0╟U)[√(2 0╟A)[;|V];]'''                     °
  549.   'T╜T doif ''U╜U[∞2;],[1](2 0╟U)[ⁿ(2 0╟A)[;|V];]''' 'T╜ÉDL 1'                 °
  550. X 'CLOSE 211'                                                                  °
  551. *(1996 1 13 14 57 2 412)                                                       °
  552.  Finitialize ÉFX 'initialize;t;C2'                                             °
  553.   'Σ  Initialize workspace. (To add to "sv" keep 100 FIRST)' 'erase'           °
  554. X 'globals'                                                                    °
  555. *(1992 2 29 8 32 29 448)                                                       °
  556.  Fkeys ÉFX 'keys' 'Σ Display keyboard'                                         °
  557.   '''        1  2  3  4  5  6  7  8  9  0  +  ⌡'''                             °
  558.   '''SHFT ╒  ■  ²  <  ≤  =  ≥  >  ⌠  δ  ^  -  ÷'''                             °
  559.   '''ALT  ╘  ƒ  ·  ⁿ  √  Φ  φ  Θ  ╡  τ  σ  !  Æ''' ''''''                      °
  560.   '''         Q  W  E  R  T  Y  U  I  O  P  ╜  ╙  ╧'''                         °
  561.   '''SHFT     ?  ∙  ε  µ  ~  ╞  ╟  ∞  Ω  *  ╕  ╨  ╤'''                         °
  562.   '''ALT      q  w  e  r  t  y  u  i  o  p  æ  ≈  ╥'''                         °
  563.   '''CTRL     ┌  ┬  ┐              ╔  ╦  ╗''' ''''''                           °
  564.   '''          A  S  D  F  G  H  J  K  L  [  ]'''                              °
  565.   '''SHFT      α  ⌐  ╛  _  ╖  ╢  °  ''''  É  (  )'''                           °
  566.   '''ALT       a  s  d  f  g  h  j  k  l  »  «'''                              °
  567.   '''CTRL     ├  ┼  ┤       ─  ═    ╠  ╬  ╣''' ''''''                          °
  568.   '''           Z  X  C  V  B  N  M  ,  .  /'''                                °
  569.   '''SHFT       Γ  π  ∩  ¼  ¥  ÿ  |  ;  :  \'''                                °
  570.   '''ALT        z  x  c  v  b  n  m  Σ  ±  ≡'''                                °
  571.   '''CTRL      └  ┴  ┘  │  ║      ╚  ╩  ╝''' ''''''                            °
  572. X '''Toggle switch to ASCII is CTL-BACKSPACE''' '''CTRL+G gives beep'''        °
  573. *(1992 2 29 8 32 32 460)                                                       °
  574.  Flabel ÉFX 'u╜label w'                                                        °
  575.   'Σ Return 1 if w is not a valid character string label (also excludes        °
  576. Xl.c.)' '╕(u╜(1<µµw)δ1<╧w)/0' '╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'          °
  577. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  578. XNmodes 2 1 10 1 800 600 65536 8 256 19 10 2826 2830                           °
  579. *(1992 2 29 8 32 33 464)                                                       °
  580.  Fnon ÉFX 'non;t;rc;et;r'                                                      °
  581.   'Σ Ignore invalid keyboard entries, but evaluate valid APL2 expression       °
  582.  s' 'æ╜''       ''' 't╜æ' '╕(0=µ(t⌠'' '')/t)/0' '(rc et r)╜ÉEC t'              °
  583. X '╕(0=rc)/2' '╕((1=rc)doif ''r'')/2' '╕2'                                     °
  584. *(1992 2 29 8 32 32 460)                                                       °
  585.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  586.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  587. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  588. *(1992 8 14 10 11 43 392)                                                      °
  589.  Fopentwo ÉFX 'V opentwo W;T' 'Σ Open Shared variable 2'                       °
  590.   'T╜(2=ÉSVO ''C2'')doif ''closetwo ∞0'''                                      °
  591.   'T╜2 ÉSVO■''C2'' ''D2'' ''E2''' 'T╜ÉSVO■''C2'' ''D2'' ''E2'''                °
  592.   '╕((δ/2⌠T)doif ''''''AP2 sharing failed (ÉSVO)'''''' ''closetwo ∞0'')/       °
  593.  0' 'L0:D2╜V' 'C2╜1 3,W,2' 'T╜C2' '╕(0=T)/0'                                   °
  594. X 'T,'' AP2 sharing failed (C2)'''                                             °
  595. XCp 1 2  "                                                                     °
  596. XCpath 1 13 C:\APL2\WORK\                                                      °
  597. *(1992 2 29 8 32 33 464)                                                       °
  598.  Fpause ÉFX 'v pause w;t'                                                      °
  599.   'Σ Pause, then print w v spaces right and return'                            °
  600. X 't╜(0=ÉNC ''v'')doif ''v╜6''' 'do' '(vµ'' ''),w' 'do'                        °
  601. XCpf 1 0                                                                       °
  602. *(1992 7 16 11 12 35 372)                                                      °
  603.  Fprint ÉFX 'print W;L;D80' 'Σ Print function W on an Epsom printer'           °
  604.   '╕((~(ÉNC W)ε3 4)doif ''''''This is not a function or defined operator       °
  605. X'''''')/0' 'OPEN 80' 'D80╜5' 'L╜,showfn W' 'D80╜π(L⌠r)ΓL' 'CLOSE 80'          °
  606. XCq 0 '                                                                        °
  607. XCr 0                                                                         °
  608. *(1992 2 29 8 32 32 460)                                                       °
  609.  Freplace ÉFX 'u╜v replace w;i;r;s' 'Σ  Replace elements in v in w'            °
  610.   'i╜Γ∞µu╜w' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]w°.=╞v'                          °
  611. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  612. *(1992 2 29 8 32 38 484)                                                       °
  613.  Freset ÉFX 'reset' 'Σ Reset parameters to initial screen'                     °
  614.   'TEST ''G╜4 16 1 255 1 1 0 319 0 199 0 319 0 199 0 0 100 100 0 0 0 1 1       °
  615. X 1 0'''                                                                       °
  616. *(1992 2 29 8 32 33 464)                                                       °
  617.  Fround ÉFX 'u╜v round w' 'Σ Half adjust w to vth decimal'                     °
  618. X 'u╜(╛0.5+w⌡10*v)÷10*v'                                                       °
  619. XCs 1 2 "                                                                      °
  620. *(1992 8 10 10 58 49 588)                                                      °
  621.  Fshared ÉFX 'U╜shared;T;C2;D2;E2'                                             °
  622.   'Σ List all shared variables currently active'                               °
  623.   'T╜2 ÉSVO■''C2'' ''D2'' ''E2'''                                              °
  624.   '╕((δ/2⌠T╜ÉSVO■''C2'' ''D2'' ''E2'')doif ''''''AP 2 not active'''''')/       °
  625. X0' 'C2╜0' 'U╜D2[;4]' 'U╜((εsv)εU)/εsv'                                        °
  626. *(1992 2 29 8 32 33 464)                                                       °
  627.  Fshow ÉFX '╢v show ╢w;╢t;╢b' 'Σ Display and execute ╢w'                       °
  628.   '╢t╜(0=ÉNC ''╢v'')doif ''╢v╜0'''                                             °
  629.   '╕((0=╧╢w)doif ''show ╢w,'''' '''''')/0'                                     °
  630.   '╕((1<╧╢w)doif ''╢v show■ ╢w'')/0' '''      '',╢w'                           °
  631. X '╕((╢v^'':''ε╢w)doif ''╢t╜evaldd ╢w'')/L0' '''ÉEM'' ÉEA ╢w' 'L0:do'          °
  632. *(1992 2 29 8 32 33 464)                                                       °
  633.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  634.   'Σ  Display a direct definition function'                                    °
  635.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  636.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  637.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  638.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  639.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  640.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  641.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  642. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  643. *(1996 1 21 14 48 34 536)                                                      °
  644.  Fshowfn ÉFX 'u╜v showfn w;f;n;t;ÉIO' 'Σ Simulate the STSC ÉVR command'        °
  645.   't╜(0=ÉNC ''v'')doif ''v╜,0''' 'ÉIO╜0'                                       °
  646.   'u╜''      '',''╖'',w,''[É]'',(╞v)╞''╖''' 'n╜1╞µf╜ÉCR w'                     °
  647.   'v╜v[0],((1╟v)ε∞n)/1╟v' 'n╜«∞n' 'n╜(n⌠'' '')Γn'                              °
  648.   'f╜(π''['',■n,■Γ''] ''),f'                                                   °
  649.   't╜(1<µ,v)doif ''f╜f[1╟v;]'' ''u╜''''''''''' 'u╜²1╟u,r,,f,r'                 °
  650. X 'u╜((-+/^\'' ''=Φu)╟u),('' ''(r,''      ╖'',date 2 ÉAT w))[╞v]'              °
  651. *(1992 2 29 8 32 33 464)                                                       °
  652.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Simple direct definition mode' 'u╜0'              °
  653.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  654.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  655. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  656. XAsv╜(100 211 80 206)(210 124)                                                 °
  657. XCt 1 7                                                                        °
  658. *(1992 6 3 9 59 17 424)                                                        °
  659.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  660.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  661.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  662.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  663.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  664.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  665.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  666.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  667.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  668.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  669. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  670. *(1996 6 19 12 31 47 524)                                                      °
  671.  Ftest ÉFX 'U╜test;T' 'Σ test return code' '╕(0=╞╞U╜D207)/0'                   °
  672. X '''SESSION ABORTED: The return code is '',╞U ╪ ╕'                            °
  673. *(1992 9 5 9 10 34 316)                                                        °
  674.  Ftestap ÉFX 'U╜testap W;B;D;S;T'                                              °
  675.   'Σ Test for existence of specific AP"s' 'D╜''D'',■«■W╜,W'                    °
  676.   'T╜W ÉSVO■D' 'U╜0' '╕((^/B╜2=ÉSVO■D)doif ''T╜ÉEX■ D'')/0'                    °
  677.   'T╜''The following Auxilliary Processor'',(S╜1<+/~B)╞''s'''                  °
  678.   'T,(ε(S+1)╙'' is'' '' are''),'' not available'',(~B)/W' 'U╜1'                °
  679. X 'T╜ÉEX■D'                                                                    °
  680. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  681. XCul 0 ²                                                                       °
  682. *(1996 6 13 13 16 24 352)                                                      °
  683.  Fwarna ÉFX 'warna;T' 'Σ clear AP124 and explai'                               °
  684. X 'T╜ÉSVR■''C124'' ''D124''' 'T╜ÉEX■''C124'' ''D124'''                         °
  685. *(1996 6 19 12 29 5 348)                                                       °
  686.  Fwarnb ÉFX 'warnb;T' 'Σ clear AP124 and explain'                              °
  687.   '''WARNING: As you study this lesson, try to respond to all requests.'       °
  688.  ',r'                                                                          °
  689.   '''Of course as in all these tutorials, you are encouraged to experime       °
  690.  nt'''                                                                         °
  691.   '''at any pause. When an AP 207 command is issued, there may be an int       °
  692.  erval'''                                                                      °
  693.   '''of a second or two of no action, followed by a flash on the screen.       °
  694.  '''                                                                           °
  695.   '''After such a flash, press Ctrl-Esc, and select from the Window List       °
  696. X''' '''the AP 207 window (usually the last entry on the list).''' 'do'        °
  697. *(1996 7 11 13 8 49 416)                                                       °
  698.  Fwarning ÉFX 'warning;T' 'Σ clear AP207 and explain' 'warna' 'warnb'          °
  699.   '''As in lesson "TEACH44", the function "test" is used to verify'''          °
  700.   '''that a command given to AP207 was successful. Unlike the function''       °
  701.  '                                                                             °
  702.   '''in TEACH44, this one returns a nested vector. The first element of'       °
  703.  ''                                                                            °
  704.   '''this vector contains the Return Code. However, since it may be a'''       °
  705.   '''nested vector line [2] selects the Return Code by applying ╞ twice.       °
  706. X'',r' 'showfn ''test''' 'end'                                                 °
  707.