home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / teachapl.zip / teach48.zip / TEACH48.ATF
Text File  |  1996-08-08  |  70KB  |  853 lines

  1. XNÉIO 0 1                                                                      °
  2. XNÉCT 0 1.000000000000011E²13                                                  °
  3. XCÉFC 1 6 .,*0_²                                                               °
  4. XNÉRL 0 1227464303                                                             °
  5. XCÉPR 0                                                                        °
  6. XCÉLX 1 5 TEACH                                                                °
  7. *(1992 2 29 8 32 29 448)                                                       °
  8.  FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B'                °
  9.   'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM'                                °
  10.   'Σ  NORMAL CALL IS MONADIC.  DYADIC CALL USED ONLY IN'                       °
  11.   'Σ    RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0'          °
  12.   '»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S                   Σ PSEUDO RANK.'          °
  13.   'C╜''┐┌└┘''                 Σ UR, UL, LL, AND LR CORNERS.'                   °
  14.   'HL╜''─''                   Σ HORIZONTAL LINE.'                              °
  15.   'HC╜HL,''Θ╕'',HL,''~+ε''      Σ HORIZONTAL BORDERS.'                         °
  16.   'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A'                              °
  17.   'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]'                 °
  18.   'VL╜''│''                   Σ VERTICAL LINE.'                                °
  19.   'VB╜VL,''Φ╟''               Σ VERTICAL BORDER.'                              °
  20.   'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]'                                                   °
  21.   '»(0εµA)/''A╜(1⌐µA)µΓ╞A''   Σ SHOW PROTOTYPE OF EMPTIES.'                    °
  22.   '╕(1<╧A)/GEN' '╕(2<µµA)/D3'                                                  °
  23.   'D╜«A                     Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD'           °
  24.   'N╜²1+1╟µD' '╕(0=µµA)/SS'                                                    °
  25.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  26.  3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -'''                                     °
  27.   'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0'                              °
  28.   'GEN:D╜«DISPLAY■A          Σ ENCLOSED ...' 'N╜Dδ.⌠'' '''                     °
  29.   'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~''  ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D'                   °
  30.   '╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA         Σ MULT-DIMENSIONAL ...'          °
  31.   'W╜1╞µD' 'N╜²1+1╟µD'                                                         °
  32.   'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[       °
  33.  3]' 'D3E:N╜²2+µ,S'                                                            °
  34. X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D'           °
  35. XCF 1 27 D:\APL2OS2\FONTS\SCRIPT.AVF                                           °
  36. XCN 1 6 SCRIPT                                                                 °
  37. *(1995 4 23 14 14 6 304)                                                       °
  38.  FSVOFFER ÉFX 'DC╜PID SVOFFER SV' 'SV╜(²2╞1 1,µSV)µSV╜πSV'                     °
  39.   '╕(2=ÉNC ''PID'')/DYADIC' 'DC╜ÉSVO SV ╪ ╕0'                                  °
  40.   'DYADIC:╕(1^.⌠DC╜PID ÉSVO SV)/END' 'ÉSVE╜15'                                 °
  41.   'CHECK:╕(1^.⌠DC╜ÉSVO SV)/END' '╕(0⌠ÉSVE)/CHECK'                              °
  42. X 'END:SV╜1 0 1 0 ÉSVC SV'                                                     °
  43. *(1996 7 30 13 37 39 568)                                                      °
  44.  FTEACH ÉFX 'TEACH' 'Σ Copyright Z V Jizba 1991; all rights reserved'          °
  45.   'copyright' 'initialize' 'do' 'warning'                                      °
  46.   'TEACH1   Σ Image and vector font files'                                     °
  47.   'TEACH2   Σ Box around a drawn text'                                         °
  48.   'TEACH3   Σ Difference between image and vector fonts'                       °
  49.   'TEACH4   Σ Writing over graphic text does NOT erase it'                     °
  50.   'TEACH5   Σ The command FONTDEF'                                             °
  51.   'TEACH6   Σ Default font and APL2 vector fonts'                              °
  52.   'TEACH7   Σ Parameters of command FONT'                                      °
  53.   'TEACH8   Σ The SIZE font parameter'                                         °
  54.   'TEACH9   Σ Text inclination and justification'                              °
  55.   'TEACH10  Σ Shear and text stretching or squeezing'                          °
  56.   'TEACH11  Σ The four font parameters'                                        °
  57. X 'TEACH12  Σ Ranges of default and vector font parameters'                    °
  58. *(1996 8 8 13 51 10 424)                                                       °
  59.  FTEACH1 ÉFX 'TEACH1;T' 'Σ Drawing text. Commands FONT FONTDEF'                °
  60.   '''In this lesson we will learn how to display text on the graphic'''        °
  61.   '''screen.'',r' '''VECTOR FONTS'',r'                                         °
  62.   '''  In addition to the built in "image font", IBM supplies a number''       °
  63.  '                                                                             °
  64.   '''of "vector font files". At the start of the lesson you were asked''       °
  65.  '                                                                             °
  66.   '''to specify the path to the directory containing special IBM files''       °
  67.  '                                                                             °
  68.   '''with the extension ".AVF". You will be able to display text in any'       °
  69.  ''                                                                            °
  70.   '''one of these fonts by retrieving a desired image font file at the''       °
  71.  ' '''time the graphic screen is activated. At present there are 22'''         °
  72.   '''different vector fonts available to AP 207.''' 'do'                       °
  73.   '''The location of AVF type files will vary for different configuratio       °
  74.  ns.'''                                                                        °
  75.   '''For some it will be in a directory such as "C:\APL2OS2", for others       °
  76.   it'''                                                                        °
  77.   '''may be "A:". Whathever the path, it must be known to this lesson,''       °
  78.  '                                                                             °
  79.   '''because it will be used to acces font files. If you failed to defin       °
  80.  e'''                                                                          °
  81.   '''the path at the start of the lesson, you may do so now by assigning       °
  82.  '''                                                                           °
  83.   '''the proper path to variable "fpath" (e.g.  fpath╜''''A:\'''').'''         °
  84. X '╕(''\''=²1╞path)/L0' 'path╜path,''\''' 'L0:end'                             °
  85. *(1996 8 1 14 28 30 388)                                                       °
  86.  FTEACH10 ÉFX 'TEACH10;B;FR;T;D207' 'Σ Shear and magnification'                °
  87.   '''Two of the eight parameters of command FONT have no implementation.       °
  88.  '''                                                                           °
  89.   '''Parameters 5 and 8 must be set currently to zero. (Failure to do so       °
  90.  '''                                                                           °
  91.   '''will produce a return code 39 "INVALID PARAMETER"). Names have been       °
  92.  '''                                                                           °
  93.   '''assigned to these parameters giving a clue to their purpose if and'       °
  94.  '' '''when in a later version of APL2 they may be implemented.'',r'           °
  95.   '''Parameter 5 is called "DIRECTION", and parameter 8 is called "NOPAR       °
  96.  SE".''' 'do'                                                                  °
  97.   '''The sixth parameter is called "shear". A positive value (measured i       °
  98.  n'''                                                                          °
  99.   '''degrees) will tilt the characters to the right. A negative value wi       °
  100.  ll'''                                                                         °
  101.   '''tilt the letters to the left (NOTE: we again set "wt" to 2'',r'           °
  102.   'show ''B╜16 0 0 0 0 ╪ wt╜2'''                                               °
  103.   'show ''T╜16 (B,10) (B,²10) TESTFONT 7 7 7''' 'show ''DISPLAY T'''           °
  104.   '''The seventh parameter called XMAG can be used to stretch or to sque       °
  105.  eze'''                                                                        °
  106.   '''the text. The default is 1. A value greater than 1 will stretch the       °
  107.  ''' '''text and a value less than 1 will squeeze it''' 'do'                   °
  108.   'show ''T╜16 (B,0 1.2) (B,0 .5) TESTFONT 7 (7 0 300) 7'''                    °
  109. X 'show ''DISPLAY T''' 'end'                                                   °
  110. *(1996 8 1 14 39 54 528)                                                       °
  111.  FTEACH11 ÉFX 'TEACH11;B;M;T;D207' 'Σ Additional font parameters'              °
  112.   '''When the command FONT is issued with a null string, the return vect       °
  113.  or'''                                                                         °
  114.   '''contains not only the eight font parameters we have just described,       °
  115.  '''                                                                           °
  116.   '''but also an additional four values. These values are related to the       °
  117.  '''                                                                           °
  118.   '''font height, but describe primarily the numeric characteristics of'       °
  119.  '' '''specific fonts'',r'                                                     °
  120.   'T╜207 SVOFFER ''D207'' ╪ D207╜''OPEN''(0 ''FONTS'' 760 560 0 0) ╪ T╜t       °
  121.  est' 'F╜εfpath,(N╜''SCRIPT''),''.AVF'' ╪ D207╜''FONTDEF''(N F)'               °
  122.   '''To illustrate the contents of the FONT parameters, we have retrieve       °
  123.  d'''                                                                          °
  124.   '''from the FONT files the font SCRIPT, and assigned it a height of 40       °
  125.  '',r' 'show ''D207╜''''font''''(''''SCRIPT'''' 40) ╪ T╜test'''                °
  126.   '''We can now look at the last four FONT parameters'',r'                     °
  127.   'show ''D207╜''''font'''' '''''''' ╪ DISPLAY T╜9╟2πtest'''                   °
  128.   '''The first of these is called BOX-HEIGHT.'''                               °
  129.   '''The second value is called DESCENDER HEIGHT. it gives the space all       °
  130.  owed'''                                                                       °
  131.   '''    below the text for certain lower case letters such as "jgq".'''       °
  132.   '''The third value gives the size of maximum LETTER WIDTH'''                 °
  133.   '''The last value as we already have mentioned is FONT TYPE (0=IMAGE 1       °
  134.  =VECTOR)''' 'do'                                                              °
  135.   '''One could assume that the first two values delimit the bounds of th       °
  136.  e text.'''                                                                    °
  137.   '''For most characters in most fonts this is true, but there are excep       °
  138.  tions'',r'                                                                    °
  139.   'show ''M╜50 300 ╪ D207╜''''move'''' M ''''write'''' ''''Tf'''' ╪ D207       °
  140.  ╜''''move'''' '''''''''''                                                     °
  141.   '''We wrote the string "Tf" using the SCRIPT font. Then invoked the MO       °
  142.  VE ''''''''''' '''command to extract the current position'',r'                °
  143.   'show ''T╜4╞2πtest ╪ D207╜''''font'''' '''''''' ╪ B╜²4╞2πtest ╪ M[2]╜M       °
  144.  [2]-B[2]'''                                                                   °
  145.   '''We also extract the last four FONT parameters, and modify the start       °
  146.  ing'''                                                                        °
  147.   '''position to include the "descender height" (i.e. the projection bel       °
  148.  ow''' '''the text line that includes those letters such a "g")'',r'           °
  149.   'show ''T[2]╜T[2]+-/B[1 2] ╪ D207╜''''move'''' M ''''box'''' T ╪ DISPL       °
  150.  AY T B M'''                                                                   °
  151.   '''We also add to T (the current position on the text line) the height       °
  152.  ''' '''of Upper case letters.''' 'do'                                         °
  153.   'show ''D207╜''''view'''' '''''''' ''''wait'''' 2'''                         °
  154.   '''(Did you finally click on the Session manager screen? An APL2OS2 bu       °
  155.  g?)'''                                                                        °
  156.   '''The lower case letter F in the script font extends below and to the       °
  157.  '''                                                                           °
  158.   '''right of the box. This, so that this particular font will have the'       °
  159. X'' '''appearance of written text.''' 'end'                                    °
  160. *(1996 7 30 13 30 29 500)                                                      °
  161.  FTEACH12 ÉFX 'TEACH12' 'Σ Letter width and conclusion to fonts'               °
  162.   '''The third extra parameter gives the maximum width of the symbols'''       °
  163.   '''in the font. This value as well as the box height and the descender       °
  164.  '''                                                                           °
  165.   '''height have somewhat different values for different fonts. The mini       °
  166.  mum'''                                                                        °
  167.   '''and maximum values for a font size of 9 are given in the table belo       °
  168.  w'',r'                                                                        °
  169.   '''                   MINIMUM  MIN-FT      MAXIMUM  MAX-FT     DEFAULT       °
  170.  '''                                                                           °
  171.   ''' BOX-HEIGTH        16.239   THKND*      16.286   ROM*,G*      16'''       °
  172.   ''' DESCENDER-HEIGHT   3.429   ROM*,G*      3.620   SANSER*       5'''       °
  173.   ''' MAXIMUM-WIDTH      8.571   ROMSIMM     14.571   ROMITAB       8'',       °
  174.  r'                                                                            °
  175.   '''Note that for the default mode all three values are outside the ran       °
  176.  ge''' '''of file-vector fonts.'',r'                                           °
  177.   '''(The values are rounded to 3 digits. The asterisks are used in the'       °
  178.  ''                                                                            °
  179.   '''font names to indicate all fonts beginning with the letters in fron       °
  180.  t''' '''of the *.)'',r'                                                       °
  181.   '''Finally, before leaving this workspace-lesson, you may wish to'''         °
  182.   '''study function TESTFONT.''' 'do'                                          °
  183. X '''We will pursue the study of fonts in the next lesson'''                   °
  184. *(1996 8 8 13 51 23 476)                                                       °
  185.  FTEACH2 ÉFX 'TEACH2;T' 'Σ The command WRITE' '''THE COMMAND WRITE'',r'        °
  186.   '''  The command WRITE will draw the character string argument beginni       °
  187.  ng'''                                                                         °
  188.   '''at the current position. In the example, we will first move to (50        °
  189.  300),'''                                                                      °
  190.   '''a place away from the (0 0) origin, and then write the word "Messag       °
  191.  e".'''                                                                        °
  192.   '''We will use, but not describe function TESTWRITE. (This function co       °
  193.  ntains''' '''commands that have not yet been discussed here.)'',r'            °
  194.   '''This function will display a larger than default view of text, so''       °
  195.  '                                                                             °
  196.   '''that we can study the parameters that relate to the command WRITE.'       °
  197.  ''                                                                            °
  198.   '''It will return the eight elements specifying the 4 x,y coordinates'       °
  199.  '' '''of the box that "contains" this text.''' 'do'                           °
  200.   'show ''T╜TESTWRITE ''''Message'''''''                                       °
  201.   '''Note the size of the text. Let us now look at the returned values''       °
  202.  ,r' 'show ''DISPLAY 4 2µT'''                                                  °
  203.   '''After the WRITE command is issued, a reference to the shared variab       °
  204.  le'''                                                                         °
  205.   '''returns this numeric array as a vector. These values correspond to'       °
  206.  ''                                                                            °
  207.   '''the four corners of a box that contains the text. However, this box       °
  208.  ''' '''does NOT enclose "tightly" the text.''' 'do'                           °
  209.   '''Function TESTWRITE can be used to illustrate these numeric paramete       °
  210.  rs.'''                                                                        °
  211.   '''When it is issued with a left argument, it will draw a box around t       °
  212.  he'''                                                                         °
  213.   '''text and mark the four x,y coordinates with the first four markers.       °
  214.  '''                                                                           °
  215.   '''It will also mark the location (50 300) with marker 10 (a circle).'       °
  216.  ''                                                                            °
  217.   '''This is the starting point of the text defined by a MOVE command. I       °
  218.  t''' '''defines the baseline of the text.''' 'do'                             °
  219.   'show ''T╜1 TESTWRITE ''''Message'''''''                                     °
  220.   '''Note that the box extends above beyond the upper case letter. The''       °
  221.  '                                                                             °
  222.   '''lower line of the box extends below the text baseline to include th       °
  223.  e'''                                                                          °
  224.   '''lower projection of the lower case letter "g". There is also space        °
  225. Xto''' '''the left and to the right of the text.''' 'end'                      °
  226. *(1996 8 8 13 51 50 584)                                                       °
  227.  FTEACH3 ÉFX 'TEACH3;D;T;D207' 'Σ IMAGE and VECTOR fonts'                      °
  228.   '''We mentioned before that there are two types of font. The IMAGE fon       °
  229.  t'''                                                                          °
  230.   '''is the default font that is used in displaying APL2 text. This font       °
  231.  '''                                                                           °
  232.   '''is "drawn" by command WRITE if no VECTOR font is active. It is the'       °
  233.  ''                                                                            °
  234.   '''graphic equivalent of the APL2 text font, and therefore is NOT chan       °
  235.  ged''' '''by the VECTOR font commands.'',r'                                   °
  236.   '''Function TEST illustrates this. (This function is again not display       °
  237.  ed'''                                                                         °
  238.   '''because it too invokes commands not yet discussed.) TEST takes as t       °
  239.  he'''                                                                         °
  240.   '''right argument any AP207 command, but we will use it mostly to invo       °
  241.  ke'''                                                                         °
  242.   '''the WRITE command. The left argument to TEST is an integer specifyi       °
  243.  ng'''                                                                         °
  244.   '''the font to be displayed. TEST sets the font size to 50 pels, but a       °
  245.  s we'''                                                                       °
  246.   '''shall see, the size of the IMAGE font always remains the same.'',r'       °
  247.   '''In the next example we retrieve one of the VECTOR fonts (#18).'''         °
  248.   'do' 'show ''T╜18 TEST ''''write'''' ''''Message'''''''                      °
  249.   '''When TEST is used monadically or wtih 0 as left argument it will'''       °
  250.   '''default to the image font.'',r' 'do'                                      °
  251.   'show ''T╜TEST ''''WRITE'''' ''''Message'''''''                              °
  252.   '''Function TEST returns the return code and the "box" vector'',r'           °
  253. X 'show ''DISPLAY T''' 'end'                                                   °
  254. *(1996 8 8 14 2 30 312)                                                        °
  255.  FTEACH4 ÉFX 'TEACH4;M;B;T;X;Y;D207'                                           °
  256.   'Σ Using blanks does not erase markers'                                      °
  257.   '''CHARACTERISTICS OF THE IMAGE FONT'',r'                                    °
  258.   '''Because the IMAGE font is not affected by FONT commands, we have to       °
  259.  ''' '''verify its graphical properties.'',r'                                  °
  260.   '''One important question to be answered is whether blank characters o       °
  261.  f'''                                                                          °
  262.   '''image text will erase previously drawn image font text.(These comme       °
  263.  nts do'''                                                                     °
  264.   '''not apply to VECTOR fonts since those are based on line drawing rul       °
  265.  es.)'',r'                                                                     °
  266.   '''Let us try first to owerwrite image text over image text'',r'             °
  267.   'show ''M╜''''Message'''' ╪ B╜'''' | | | '''' ╪ X╜100 100'''                 °
  268.   'show ''T╜TEST ''''MOVE'''' X ''''WRITE'''' M ''''MOVE'''' X ''''WRITE       °
  269.  '''' B'''                                                                     °
  270.   '''Clearly, writing image text on top of image text will not change th       °
  271.  e'''                                                                          °
  272.   '''previous contents; the new text is superimposed on the old text.'',       °
  273.  r' '''Next, we will evaluate how the image font affects graphs'',r'           °
  274.   'show ''Y╜6 2µ100 102 ╪ Y[;1]╜Y[;1]+10⌡0,∞5'''                               °
  275.   '''The array Y represents a straight dashed horizontal line through'''       °
  276.   '''the portion to be overwritten with image text''' 'do'                     °
  277.   'show ''T╜TEST ''''DRAW'''' Y  ''''MOVE'''' X ''''WRITE'''' M'''             °
  278.   '''Here too, the line drawn first is not erased by the overlay of text       °
  279.  .'''                                                                          °
  280.   '''Finally, let us also verify that markers will not be erased by text       °
  281.  ''' 'do'                                                                      °
  282.   'show ''T╜TEST ''''MARKER'''' Y ''''MOVE'''' X ''''WRITE'''' M'''            °
  283.   '''We have verified that image text in general, and blanks in particul       °
  284.  ar'''                                                                         °
  285.   '''will not erase previously drawn graphs. There is a way to do that,        °
  286.  and'''                                                                        °
  287.   '''we will learn the process when we cover colors. Right now let us'''       °
  288. X '''return to the drawing of text.''' 'end'                                   °
  289. *(1996 8 6 21 10 59 480)                                                       °
  290.  FTEACH5 ÉFX 'TEACH5;M;T;D207' 'Σ The FONTDEF command'                         °
  291.   '''FONTDEF AND FONT'',r'                                                     °
  292.   '''As was mentioned before, IBM supplies 22 special vector fonts. Here       °
  293.   is'''                                                                        °
  294.   '''a listing of these font names (stored as *.AVF type files)'',r'           °
  295.   'show ''1 tab fonts'''                                                       °
  296.   '''If a graph is to display one of these fonts, the desired font file'       °
  297.  ''                                                                            °
  298.   '''must be first brought into the workspace. Function TESTFONT has bee       °
  299.  n'''                                                                          °
  300.   '''designed to illustrate the various aspects of font generation. We''       °
  301.  '                                                                             °
  302.   '''will, however, again omit a detailed description of this function.'       °
  303.  ',r'                                                                          °
  304.   '''The right argument to TESTFONT is an integer, (or a vector of integ       °
  305.  ers)'''                                                                       °
  306.   '''in the range 1-22. It represents the desired font to be displayed.'       °
  307.  ''                                                                            °
  308.   '''The left argument describes the size and shape of the font. The fun       °
  309.  ction'''                                                                      °
  310.   '''invokes the command VIEW to display a sample of the requested font.       °
  311.   It'''                                                                        °
  312.   '''also invokes the command WAIT wt. The right argument (wt) is a glob       °
  313.  al'''                                                                         °
  314.   '''variable containing the number of seconds the graph is to stay visi       °
  315.  ble''' '''the current value of "wt" is'',r' 'wt╜2' 'show ''wt'''              °
  316.   '''Therefore the view will be displayed only 2 seconds. The function''       °
  317.  '                                                                             °
  318.   '''returns an array of the fonts displayed and the parameters associat       °
  319.  ed''' '''with each font.'',r'                                                 °
  320.   '''Let us first invoke TESTFONT with only the right argument''' 'do'         °
  321.   'show ''T╜TESTFONT 8'''                                                      °
  322.   '''The function invokes two commands: FONTDEF and FONT. Command FONTDE       °
  323.  F'''                                                                          °
  324.   '''is used to bring into the workspace one of the 22 IBM fonts (or for       °
  325.  '''                                                                           °
  326.   '''that matter any other font file that may have been generated). The'       °
  327.  ''                                                                            °
  328.   '''usage of this command is illustrated on lines [10], [13] and [19]of       °
  329. X''' '''function TESTFONT'',r' 'TEACH5A' 'end'                                 °
  330. *(1996 8 6 21 12 26 356)                                                       °
  331.  FTEACH5A ÉFX 'TEACH5A;M;T;D207' 'Σ The LINETYPE command'                      °
  332.   '0 10 13 19 showfn ''TESTFONT'''                                             °
  333.   'r,''On line [10] we see the assignment to two local variables, N and        °
  334.  F.'''                                                                         °
  335.   '''(The global variable "fonts" was initialized at the start of this''       °
  336.  '                                                                             °
  337.   '''session. It contains the names of all IBM fonts. Variable "O" conta       °
  338.  ins''' '''the font that is to be displayed next.)''' 'do'                     °
  339.   '''N contains just the name of the font. F is the full name, including       °
  340.  '''                                                                           °
  341.   '''the path of the file containing the desired font. On line [13], the       °
  342.  '''                                                                           °
  343.   '''command FONTDEF has two arguments (enclosed as a scalar). The first       °
  344.  '''                                                                           °
  345.   '''is the name of the font (N), and the second the name of the file (F       °
  346.  ).'''                                                                         °
  347.   '''Before the font can actually be used, it has to be made active with       °
  348.  '''                                                                           °
  349.   '''command FONT to be described shortly. This is done on line [19]. No       °
  350.  te''' '''the use of command WAIT on this line.''' 'do'                        °
  351.   '''THE COMMAND WAIT'',r'                                                     °
  352.   '''This command determines when and how long AP207 will wait while'''        °
  353.   '''displaying the graphic window. If the right argument to WAIT is a''       °
  354.  ' '''zero, the window will flash, and disappear immediately.''' 'do'          °
  355.   'show ''wt╜0 ╪ T╜TESTFONT 0'''                                               °
  356.   '''An integer will determine as we have already seen the length of tim       °
  357.  e'''                                                                          °
  358.   '''the screen will remain visible. A null string will cause the graphi       °
  359.  c'''                                                                          °
  360.   '''screen to wait until any key is pressed. In the next example do not       °
  361.  '''                                                                           °
  362.   '''click on the Session Manager window! Instead, just press any key.''       °
  363. X' 'do' 'show ''wt╜∞0 ╪ T╜TESTFONT 0'''                                        °
  364. *(1996 8 6 21 13 10 296)                                                       °
  365.  FTEACH6 ÉFX 'TEACH6;M;T;D207' 'Σ The LINETYPE command'                        °
  366.   '''Command FONTDEF does not have any effect other than bringing the'''       °
  367.   '''desired font into the workspace. It is command FONT that determines       °
  368.  '''                                                                           °
  369.   '''the nature of the actual display. Before we discuss the parameters        °
  370.  of'''                                                                         °
  371.   '''FONT, let us first look at the various fonts. (We will invoke the f       °
  372.  irst'''                                                                       °
  373.   '''element of the left argument of TESTFONT, which determines the heig       °
  374.  ht''' '''of the displayed text).'',r'                                         °
  375.   '''As you watch the 22 fonts being displayed on the screen, note the''       °
  376.  '                                                                             °
  377.   '''string of characters, if any, following the words "APL symbols:"'''       °
  378.   '''This string should contain the following symbols: αµ~╞ΩÉ⌠. Only the       °
  379.  '''                                                                           °
  380.   '''two fonts that support APL2 characters will display these symbols''       °
  381.  ' '''These are fonts ROMSIM (14) and ROMSIMM (15).'',r'                       °
  382.   '''ATTENTION! DO NOT CLICK ON THE SESSION MANAGER SCREEN. VARIABLE wt'       °
  383.  ''                                                                            °
  384.   '''WILL BE SET TO 2 SECONDS BETWEEN CONSECUTIVE CHANGES OF THE VIEW'''       °
  385.   'do' 'show ''wt╜2 ╪ T╜14 TESTFONT 0,∞22 ╪ T'''                               °
  386.   '''The listing of array T (returned by TESTFONT) gives the names of th       °
  387.  e'''                                                                          °
  388.   '''dispayed fonts followed by the font parameters. Note the "image'''        °
  389.   '''height" value (the first number following the name DEFAULT). Its me       °
  390.  aning''' '''is unknown to me.'',r'                                            °
  391.   '''You may have noticed that the sixth font (MARKERS) contains the 19'       °
  392.  ''                                                                            °
  393.   '''markers. This font also contains the digits 0 to 9, but no other'''       °
  394. X '''characters.''' 'end'                                                      °
  395. *(1996 8 6 21 17 19 348)                                                       °
  396.  FTEACH7 ÉFX 'TEACH7;T;F;N;D207' 'Σ Font parameters'                           °
  397.   '''PARAMETERS OF COMMAND FONT'',r'                                           °
  398.   '''The parameters of command FONT specify the nature of the font, its'       °
  399.  ''                                                                            °
  400.   '''size orientation and other characteristics. We will illustrate thes       °
  401.  e''' '''by invoking directly the shared variable D207'',r'                    °
  402.   'T╜207 SVOFFER ''D207'''                                                     °
  403.   'show ''D207╜''''OPEN''''(0 ''''FONTS'''' 760 560 0 0) ╪ T╜test'''           °
  404.   '''Having opened the graphic window, we will now use command FONTDEF t       °
  405.  o''' '''retrieve font ROMSIM'',r'                                             °
  406.   'show ''F╜εfpath,(N╜''''ROMSIM''''),''''.AVF'''' ╪ DISPLAY N F'''            °
  407.   'show ''D207╜''''FONTDEF''''(N F) ╪ T╜test'''                                °
  408.   '''Font ROMSIM is now defined in this workspace. However, it has not y       °
  409.  et'''                                                                         °
  410.   '''been activated. We can find out about the currently active font by'       °
  411.  ''                                                                            °
  412.   '''issuing command FONT with a null argument. (Incidentally, issuing''       °
  413.  '                                                                             °
  414.   '''command FONTDEF with a null argument as suggested in the User''''s'       °
  415.  '' '''Guide will produce a non zero return code.)''' 'do'                     °
  416.   'show ''D207╜''''font'''' '''''''' ╪ DISPLAY T╜test'''                       °
  417.   '''Command FONT '''''''' returns the DEFAULT font parameters. These wi       °
  418.  ll'''                                                                         °
  419.   '''remain active until a FONT command is issued changing them.'',r'          °
  420.   '''NOTE: Since the default image font ignores the command FONT paramet       °
  421.  ers,'''                                                                       °
  422.   '''the first 8 numeric values of the list above are meaningless.'''          °
  423.   'do'                                                                         °
  424.   '''Let us look at the 12 numeric values that follow the string "DEFAUL       °
  425.  T"''' 'do'                                                                    °
  426.   '''The first 8 of these are parameters of command FONT. The last four        °
  427.  give'''                                                                       °
  428.   '''information about the location of the display. Here is the meaning        °
  429.  of''' '''the first 8 components'',r'                                          °
  430.   '''  1  Height of the font in pels'',r,''  2  The conterclockwise angl       °
  431.  e of text'''                                                                  °
  432.   '''  3  Horizontal justification (0=left; 1=center; 2=right)'''              °
  433.   '''  4  Vertical justification (0=baseline) admits values 1,2,3 or 4''       °
  434.  '                                                                             °
  435.   '''  5  Direction (zero)'',r,''  6  Angle of shear in degrees (0=verti       °
  436.  cal)'''                                                                       °
  437.   '''  7  Stretching in X-direction'',r,''  8  No parse (zero)'',r'            °
  438.   '''Two of these ("Direction" and "No parse") are reserved.''' 'do'           °
  439.   '''The last 4 components give the default values of the text. For the'       °
  440.  '' '''image font these numbers cannot be changed.'',r'                        °
  441.   '''  9  Box height'',r,'' 10  Descender height'',r,'' 11  Maximum font       °
  442. X width''' ''' 12  Font type (0=default; 1=AVF file font)''' 'end'             °
  443. *(1996 8 6 21 20 7 312)                                                        °
  444.  FTEACH8 ÉFX 'TEACH8;FR;T;D207' 'Σ The size FONT parameter'                    °
  445.   '''To study these 8 parameters we will again use function TESTFONT, bu       °
  446.  t'''                                                                          °
  447.   '''this time with left arguments. For each parameter we will display''       °
  448.  ' '''the text two ways, once with default values, and once with the'''        °
  449.   '''parameter under study set to a distinctive value. Note that in the'       °
  450.  ''                                                                            °
  451.   '''next example, if the left argument is a nested vector, the nested''       °
  452.  '                                                                             °
  453.   '''components apply separately to each of the right argument. We have'       °
  454.  ''                                                                            °
  455.   '''already seen that the first component of command "FONT" determines'       °
  456.  '' '''the height of text in pels (we set "wt" to null)'',r'                   °
  457.   'show ''wt╜∞0'''                                                             °
  458.   '''ATTENTION! In the following examples DO NOT click on the Session'''       °
  459.   '''Manager screen. Since "wt" is a null vector, merely PRESS any key!'       °
  460.  '' 'do' 'show ''T╜(,20) (,30) TESTFONT 7 7 ╪ DISPLAY T'''                     °
  461.   '''If the text is longer than fits the screen, there is a scissor like       °
  462.  ''' '''cut-off.'',r'                                                          °
  463.   '''Any attempt to change the size of the image font (0) will fail'''         °
  464.   'do' 'show ''T╜(,20) (,40) TESTFONT 0 0'''                                   °
  465.   '''We can also display the MARKER font in default and in small size'''       °
  466.   'do' 'show ''T╜(∞0) (,2) TESTFONT 6 6'''                                     °
  467.   '''We shall see in the next lesson that the MARKER command is not affe       °
  468. Xcted''' '''by any parameters of the command FONT.''' 'end'                    °
  469. *(1996 8 1 14 18 58 460)                                                       °
  470.  FTEACH9 ÉFX 'TEACH9;FR;T;D207' 'Σ FONT angle, xjust, yjust'                   °
  471.   '''The second parameter of FONT determines the angle of the text'''          °
  472.   'show ''wt╜2'''                                                              °
  473.   'show ''T╜(10 90) (10 25) (10 180) TESTFONT (7 50 100) 7 (7 500 100)''       °
  474.  ' '''The returned values are in T''' 'do' 'show ''DISPLAY T'''                °
  475.   '''The third numeric parameter of command FONT specifies the relative'       °
  476.  ''                                                                            °
  477.   '''location of the starting position with respect to the text. It admi       °
  478.  ts''' '''three values'',r'                                                    °
  479.   '''    0  text is placed to the right of the starting position'''            °
  480.   '''    1  text is centered at the staring position'''                        °
  481.   '''    2  text is placed to the left of starting position'',r'               °
  482.   '''Here is an example of these three conditions. In all three cases,''       °
  483.  ' '''the starting position {400 100} is the same''' 'do'                      °
  484.   'show ''T╜(8 0 0) (8 0 1) (8 0 2) TESTFONT 3µΓ(7 400 100)'''                 °
  485. X 'TEACH9A' 'end'                                                              °
  486. *(1996 8 1 14 25 25 356)                                                       °
  487.  FTEACH9A ÉFX 'TEACH9A;B;C;F;N;T;W;D207' 'Σ X-justification of FONTs'          °
  488.   '''Where the third component of FONT can be used to X-justify the'''         °
  489.   '''placement of text, the fourth component will Y-justify it.'',r'           °
  490.   '''We will use the shared variable D207 to illustrate how this fourth'       °
  491.  ''                                                                            °
  492.   '''component can be used to create text with subscripts and superscrip       °
  493.  ts'',r' 'T╜207 SVOFFER ''D207'''                                              °
  494.   'show ''D207╜''''OPEN''''(0 ''''FONTS'''' 760 560 0 0) ╪ T╜test'''           °
  495.   '''Having opened the graphic window, we will again use command FONTDEF       °
  496.  ''' '''to retrieve font ROMSIM'',r'                                           °
  497.   'show ''F╜εfpath,(N╜''''ROMSIM''''),''''.AVF'''' ╪ D207╜''''FONTDEF'''       °
  498.  ' (N F)'''                                                                    °
  499.   '''Next we will activate this font but only with the SIZE component, s       °
  500.  o''' '''that we can compare the results.''' 'do'                              °
  501.   'show ''D207╜''''font'''' (''''ROMSIM'''' 20) ╪ T╜test'''                    °
  502.   '''We are now ready to illustrate how the fourth parameter works. This       °
  503.  ''' '''parameter will accept the values 0 1 2 3 and 4.'',r'                   °
  504.   '''ATTENTION! YOU WILL HAVE TO CLICK ON THE SESSION MANAGER TO RETURN        °
  505.  TO APL2''' 'do'                                                               °
  506.   'show ''W╜200 300 ╪ D207╜''''move'''' W ''''write'''' ''''A'''' ''''vi       °
  507.  ew'''' '''''''' ╪ T╜test''' 'D207╜''move'' '''' ╪ W╜(ΓW),1╟D207'              °
  508.   '''Next we will write the letter B on the same line, but by setting th       °
  509.  e''' '''fourth parameter to 1''' 'do'                                         °
  510.   'show ''D207╜''''font'''' (''''ROMSIM'''' 20 0 0 1) ''''write'''' ''''       °
  511.  B'''' ''''view'''' ''''''''''' 'D207╜''move'' '''' ╪ W╜W,1╟D207'              °
  512.   '''Note two effects:'''                                                      °
  513.   ''' 1 The letter "B" was written just to the right of the letter A. Th       °
  514.  is'''                                                                         °
  515.   '''   because the "Current Position" has been changed to be to the rig       °
  516.  ht''' '''   of the letter A'''                                                °
  517.   ''' 2 The letter B is slightly below the level of the letter A. This i       °
  518.  s'''                                                                          °
  519.   '''   caused by the fourth parameter (a one) of the FONT command.'',r'       °
  520.   '''We will now issue the FONT command with a 2''' 'do'                       °
  521.   'show ''D207╜''''font'''' (''''ROMSIM'''' 20 0 0 2) ''''write'''' ''''       °
  522.  C'''' ''''view'''' ''''''''''' 'D207╜''move'' '''' ╪ W╜W,1╟D207'              °
  523.   '''We continue in the same way invoking 3,4 and 0 using letters D E an       °
  524.  d F''' 'do'                                                                   °
  525.   'show ''D207╜''''font'''' (''''ROMSIM'''' 20 0 0 3) ''''write'''' ''''       °
  526.  D'''' ''''view'''' ''''''''''' 'D207╜''move'' '''' ╪ W╜W,1╟D207'              °
  527.   'show ''D207╜''''font'''' (''''ROMSIM'''' 20 0 0 4) ''''write'''' ''''       °
  528.  E'''' ''''view'''' ''''''''''' 'D207╜''move'' '''' ╪ W╜W,1╟D207'              °
  529.   'show ''D207╜''''font'''' (''''ROMSIM'''' 20 0 0 0) ''''write'''' ''''       °
  530.  F'''' ''''view'''' ''''''''''' 'D207╜''move'' '''' ╪ W╜W,1╟D207'              °
  531.   '''We can now summarize the behavior of the fourth numeric parameter i       °
  532.  n''' '''command FONT:'',r' '''VALUE  EFFECT'''                                °
  533.   '''  0    Default, Current position of X changed but Y unchanged'''          °
  534.   '''  1    Text in subscript, X to the right of letter, Y to subscript        °
  535.  level'''                                                                      °
  536.   '''  2    Same as 1, but a subscript to the subscript level'''               °
  537.   '''  3    Text in superscript, X same as before, Y to superscript leve       °
  538.  l.''' '''  4    Text on line below previous text'',r'                         °
  539.   '''We have saved the "Current positions" after each of these WRITE'''        °
  540.   '''commands in variable W. Here are its contents'',r'                        °
  541. X 'show ''DISPLAY πW'''                                                        °
  542. *(1996 7 21 13 25 8 360)                                                       °
  543.  FTEST ÉFX 'U╜V TEST W;T;F;N'                                                  °
  544.   'Σ Test a sequence of graphic commands (W)'                                  °
  545.   'T╜ÉSVR ''D207'' ╪ T╜207 SVOFFER ''D207'''                                   °
  546.   'D207╜''open''(1 ''TEST'' 760 560 0 0)' '╕(0=ÉNC ''V'')/L1'                  °
  547.   'F╜εfpath,(N╜πfonts[|V]),''.AVF''' 'D207╜''FONTDEF''(N F) ╪ T╜test'          °
  548.   'D207╜''font''(N 50) ╪ T╜test' 'L1:D207╜''move''(50 300) ╪ T╜test'           °
  549.   'D207╜W ╪ U╜test' 'D207╜''view'' '''' ╪ T╜test' 'do'                         °
  550. X 'T╜ÉSVR ''D207'' ╪ T╜ÉEX ''D207'''                                           °
  551. *(1996 7 31 14 7 17 368)                                                       °
  552.  FTESTFONT ÉFX 'U╜V TESTFONT W;B;F;H;L;M;N;O;S;T;D207' 'Σ Test fonts'          °
  553.   'U╜''''' 'T╜(0=ÉNC ''V'')doif ''V╜,14''' 'T╜207 SVOFFER ''D207'''            °
  554.   'D207╜''OPEN''(0 ''FONTS'' 760 560 0 0)' 'L0:O╜╞M╜╞W╜,W' 'H╜,V'              °
  555.   'M╜2╞1╟M,50 300'                                                             °
  556.   '╕((0=O)doif ''N╜0'' ''L╜''''This is the default font '''''')/L1'            °
  557.   'F╜εfpath,(N╜πfonts[|O]),''.AVF''' 'L╜''This is font '',N'                   °
  558.   'T╜(6=|O)doif ''L╜ÉAV''' 'D207╜''FONTDEF''(N F)'                             °
  559.   'L1:T╜(1<╧V)doif ''H╜1╙V''' 'S╜(ΓN),╞H' 'T╜(O=0)doif ''S╜0'''                °
  560.   'L╜(«╞W),''    '',L,''   APL symbols: αµ~╞ΩÉ⌠'''                             °
  561.   'D207╜''CLEAR'' '''' ''VIEW'' '''''                                          °
  562.   'D207╜''MOVE'' M ''FONT'' S ''WRITE'' L ''WAIT'' wt' 'T╜test'                °
  563.   'D207╜''FONT'' ''''' 'U╜U,T╜1╟D207' 'D207╜''FONTDEF''(N ²1)'                 °
  564.   '╕((0≤O)δW╧0)/L2' 'D207╜''move'' M ''MARKER'' M ''view'' ''''' 'do'          °
  565. X 'L2:V╜1ΦV' '╕(0<µW╜1╟W)/L0' 'U╜πU'                                           °
  566. *(1996 7 21 12 38 47 564)                                                      °
  567.  FTESTWRITE ÉFX 'U╜V TESTWRITE W;T;F'                                          °
  568.   'Σ Test a sequence of graphic commands (W)'                                  °
  569.   'T╜ÉSVR ''D207'' ╪ T╜207 SVOFFER ''D207'''                                   °
  570.   'D207╜''open''(1 ''TEST'' 760 560 0 0) ╪ T╜test'                             °
  571.   'F╜fpath,''ROMSIM.AVF''' 'D207╜''fontdef''(''ROMSIM'' F) ╪ T╜test'           °
  572.   'D207╜''font''(''ROMSIM'' 50) ╪ T╜test'                                      °
  573.   'D207╜''move''(50 300)''write'' W ╪ U╜3 2πT╜test ╪ ╕(0=ÉNC ''V'')/L0'        °
  574.   'D207╜''move'' U[1 2]''box''(4╞U[7 8]) ╪ T╜test'                             °
  575.   'D207╜''move'' '''' ╪ T╜test'                                                °
  576.   'D207╜''marker'' 1 ╪ D207╜''marker'' U[1 2]'                                 °
  577.   'D207╜''marker'' 2 ╪ D207╜''marker'' U[3 4]'                                 °
  578.   'D207╜''marker'' 3 ╪ D207╜''marker'' U[5 6]'                                 °
  579.   'D207╜''marker'' 4 ╪ D207╜''marker'' U[7 8]'                                 °
  580.   'D207╜''marker'' 10 ╪ D207╜''marker''(50 300)'                               °
  581.   'L0:D207╜''view'' '''' ╪ T╜test' 'do'                                        °
  582. X 'T╜ÉSVR ''D207'' ╪ T╜ÉEX ''D207'''                                           °
  583. XCa 0 %                                                                        °
  584. *(1992 2 29 8 32 29 448)                                                       °
  585.  Faddquote ÉFX 'u╜addquote w'                                                  °
  586.   'Σ Put quotes around a string, and double existing quotes'                   °
  587. X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]'                                        °
  588. *(1992 2 29 8 32 29 448)                                                       °
  589. XFaq ÉFX 'u╜aq w' 'Σ Enclose quoted string' 'u╜Γaddquote w'                    °
  590. *(1992 2 29 8 32 30 452)                                                       °
  591.  Fav ÉFX 'av;a;n;i;ÉIO' 'Σ Display characters in the Atomic vector'            °
  592.   'ÉIO╜0' 'a╜22 78µ'' ''' 'n╜3 0«φ12 22µ1+∞256'                                °
  593.   'a[;,(6⌡∞12)°.+2 3 4]╜n' 'a[;6+6⌡∞12]╜φ12 22µÉAV'                            °
  594. X 'a[7 8 10 13;6]╜'' ''' 'a[14+∞8;68 69 70 72]╜'' ''' 'a'                      °
  595. *(1992 2 29 8 32 32 460)                                                       °
  596.  Fback ÉFX 'back;T' 'Σ Reset screen to 25⌡80 size' 'OPEN 124' 'C124╜0 3'       °
  597. X 'CLOSE 124 206'                                                              °
  598. *(1996 6 27 13 48 32 568)                                                      °
  599.  Fcopyright ÉFX 'copyright' 'Σ Copyright statement'                            °
  600.   '(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996'',r'                         °
  601.   '''To see disclaimers, enter ÉCR ''''copyright''''''' 'do' '╕0'              °
  602.   '''This and subsequent workspaces labelled TEACHxx are made available'       °
  603.  ''                                                                            °
  604.   '''at no cost to anyone who desires to learn how to use effectively'''       °
  605.   '''the IBM/OS2 version of APL2.'',r'                                         °
  606.   '''This software is provided "AS IS" with no WARRANTY of any kind, eit       °
  607.  her'''                                                                        °
  608.   '''express or implied. Any risk in its use resides with you, the user        °
  609. Xof''' '''these tutorials.''' '''(PRESS ENTER to continue)'''                  °
  610. XCd 0 "                                                                        °
  611. *(1992 2 29 8 32 33 464)                                                       °
  612.  Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w'                 °
  613. X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. '''                                           °
  614. XCdig 1 10 1234567890                                                          °
  615. *(1992 2 29 8 32 28 444)                                                       °
  616.  Fdo ÉFX 'do;t;e;b' 'Σ Expression driver' 'e╜''''' 'æ╜''       ''' 't╜æ'       °
  617.   '╕(^/'' ''=t)/0'                                                             °
  618.   '╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/2'                        °
  619.   '''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/2'                                               °
  620.   '''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2'        °
  621. X 'e' '╕2'                                                                     °
  622. *(1992 2 29 8 32 28 444)                                                       °
  623.  Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0'                         °
  624. X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢'''                                          °
  625. XNdos 0 ²26                                                                    °
  626. XCe 1 0                                                                        °
  627. *(1996 7 24 14 20 54 540)                                                      °
  628.  Fend ÉFX 'end' 'e╜''''' 'æ╜''       ''' 't╜æ' '╕(^/'' ''=t)/L0'               °
  629.   '╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/3'                        °
  630.   '''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/L0'                                              °
  631.   '''This is not a valid APL2 expression''' 'æ╜''*'''                          °
  632. X '╕(''?''⌠╞1╟æ)/L0' 'e' 'L0:''²²'''                                           °
  633. *(1992 2 29 8 32 30 452)                                                       °
  634. XFendd ÉFX 'endd' 'Σ End of document' '20µ''²''' 'do'                          °
  635. *(1996 8 8 12 5 42 364)                                                        °
  636.  Ferase ÉFX 'erase;t;b;DISPLAY;DOS;GO;FRAME;NODIST;SVOFFER' 't╜ÉNL 3'          °
  637.   't╜(~t^.εlc,'' '')≡t' 't╜(~(t[;∞5]^.=''TEACH'')δt[;∞4]^.=''TEST'')≡t'        °
  638.   't╜ÉEX t' 't╜ÉNL 2' 't╜ÉEX(~t^.εlc,'' '')≡t' 't╜ÉNL 4'                       °
  639. X 't╜ÉEX(~t^.εlc,'' '')≡t'                                                     °
  640. *(1992 2 29 8 32 32 460)                                                       °
  641.  Fevaldd ÉFX 'u╜evaldd w;c;n'                                                  °
  642.   'Σ Evaluate a direct definition expression' 'u╜0' 'n╜(w∞''Σ'')-1'            °
  643.   'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w' '╕(label╞c)/0'                     °
  644.   '╕((2=µc)doif ''u╜showdd 1╙c'')/0'                                           °
  645.   '╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0'             °
  646.   '╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c'                    °
  647.   'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b'''                       °
  648.   'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)'                       °
  649. X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u'                               °
  650. *(1992 2 29 8 32 32 460)                                                       °
  651.  Fexit ÉFX 'exit w' 'Σ Exit if there are too many suspended functions'         °
  652. X '╕((10>µÉLC)doif ''w'')/0' '''Please re-enter '',w' '╕'                      °
  653. XCf 1 2  {                                                                     °
  654.  Afonts╜('GOTENG')('GOTGER')('GOTITA')('GRESER')('GRESIM')('MARKERS')('M       °
  655.  ODSIM')('ROMDUP')('ROMDUPF')('ROMITA')('ROMITAB')('ROMSER')('ROMSERB')(       °
  656.  'ROMSIM')('ROMSIMM')('SANSER')('SANSERF')('SCRIPT')('THKRNDF')('THKRNDO       °
  657. X')('THKSQUF')('THKSQUO')                                                      °
  658. XCfpath 1 17 D:\APL2OS2\FONTS\                                                 °
  659. XCg 1 2 }                                                                      °
  660. *(1996 3 12 15 27 53 504)                                                      °
  661.  Fget ÉFX 'u╜v get w;t;ÉPR' 'Σ Prompt for response from keyboard'              °
  662.   't╜(0=ÉNC ''v'')doif ''v╜1'' ╪ ÉPR╜''''' 'w╜w,(~²1╞v)/'': '''                °
  663.   'L0:æ╜w' 't╜æ' '╕((''╕''=(µw)╟t)doif ''╕'')/0' '╕(^/'' ''=w)/L1'             °
  664.   '╕((~w╧(µw)╞t)doif ''''''PLEASE DO NOT BACKSPACE'''''')/L0'                  °
  665.   't╜(µw)╟t' 'L1:u╜(²1+(,'' ''⌠t)∞1)╟t' '╕(1╞v)/0' 't╜(u⌠'' '')Γu'             °
  666. X 'u╜(µt),(Γu),t'                                                              °
  667. *(1992 10 18 10 45 51 584)                                                     °
  668.  Fgetfont ÉFX 'getfont W;N;F' 'Σ retrieve fonts W' 'W╜0,(Wε∞22)/W'             °
  669.   'L0:╕(0=µW╜1╟W)/0' 'F╜εfpath,(N╜πfonts[╞W]),''.AVF'''                        °
  670. X 'D207╜''FONTDEF''(N F)' '╕L0'                                                °
  671. *(1996 3 10 15 8 33 340)                                                       °
  672.  Fglobals ÉFX 'globals;T;D207' 'Σ Initialize useful global variables'          °
  673.   'r╜2╙ÉTC' 'q╜40╙ÉAV' 's╜Φp╜'' '',d╜35╙ÉAV'                                   °
  674.   'sv╜(100 211 80 206)(210 124)' 'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''           °
  675.   'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890'''                     °
  676.   'g╜Φ'' '',h╜126╙ÉAV' 'f╜ÉAV[33 124]' 'a╜38╙ÉAV' 'ul╜''²'''                   °
  677.   'T╜207 SVOFFER ''D207''' 'D207╜''QUERY'' ''''' 'modes╜,3πD207'               °
  678.   'path╜''D:\APL2OS2\WORK\''' 'Σ''The current path is '',path'                 °
  679.   'ΣT╜1 get ''Enter new path if incorrect, else press Enter: '''               °
  680.   'Σ╕((0<µT)doif ''path╜T'')/0' 'fpath╜''D:\APL2OS2\FONTS\'''                  °
  681.   '''For this lesson you must specify a path to the FONT files.'''             °
  682.   '''The current path is '',fpath'                                             °
  683.   'T╜1 get ''Enter new path if incorrect, else press Enter: '''                °
  684. X '╕((0<µT)doif ''fpath╜T'')/0'                                                °
  685. XCh 0 }                                                                        °
  686. *(1992 8 10 10 44 11 380)                                                      °
  687.  Findex ÉFX 'U╜V index W;A;C;H;I;T' 'Σ List contents of an AP 211 file'        °
  688.   'T╜~(1<╧W)doif ''H╜2πW'' ''W╜1πW''' 'T╜T doif ''H╜''''FUNCTION'''''''        °
  689.   'T╜(ΓW)ε''DOCS'' ''UTILITY'' ''HELP'' ''TUTOR'''                             °
  690.   'T╜T doif ''W╜path,W,''''.211''''''' '1 OPEN 211' 'D211╜''USE'' W'           °
  691.   '''File '',W,'' has record length='',1╟D211'                                 °
  692.   'D211╜''LIST'' ''NAMES''' 'U╜D211'                                           °
  693.   '╕((0=╧U)doif ''U╜''''Unknown file'''''')/0' 'C╜1╟µU╜U[I╜ÉAV√U;]'            °
  694.   '╕((0=ÉNC ''V'')doif ''CLOSE 211'')/0' 'U╜(C╞H),[1]ul,[1]U'                  °
  695.   '╕((0=1╞V)doif ''U╜0 0 2 tab U'' ''CLOSE 211'')/0'                           °
  696.   'D211╜''LIST'' ''ATTS''' 'A╜D211'                                            °
  697.   'A╜(''SZ'' ''ID'' ''DATE'' ''mo'' ''d'' ''TIME'' ''m'' ''s'' ''ms''),[       °
  698.  1]ul,[1]A[I;]' 'V╜(Vε0,(∞9),-∞9)/V' 'U╜U,«A[;(0⌠V)/|V]'                       °
  699.   '╕((0εV)doif ''CLOSE 211'')/0'                                               °
  700.   'T╜~(0<╛/V)doif ''U╜U[∞2;],[1](2 0╟U)[√(2 0╟A)[;|V];]'''                     °
  701.   'T╜T doif ''U╜U[∞2;],[1](2 0╟U)[ⁿ(2 0╟A)[;|V];]''' 'T╜ÉDL 1'                 °
  702. X 'CLOSE 211'                                                                  °
  703. *(1996 3 10 14 58 1 408)                                                       °
  704.  Finitialize ÉFX 'initialize;t;C2'                                             °
  705.   'Σ  Initialize workspace. (To add to "sv" keep 100 FIRST)' 'erase'           °
  706. X 'globals'                                                                    °
  707. *(1992 2 29 8 32 29 448)                                                       °
  708.  Fkeys ÉFX 'keys' 'Σ Display keyboard'                                         °
  709.   '''        1  2  3  4  5  6  7  8  9  0  +  ⌡'''                             °
  710.   '''SHFT ╒  ■  ²  <  ≤  =  ≥  >  ⌠  δ  ^  -  ÷'''                             °
  711.   '''ALT  ╘  ƒ  ·  ⁿ  √  Φ  φ  Θ  ╡  τ  σ  !  Æ''' ''''''                      °
  712.   '''         Q  W  E  R  T  Y  U  I  O  P  ╜  ╙  ╧'''                         °
  713.   '''SHFT     ?  ∙  ε  µ  ~  ╞  ╟  ∞  Ω  *  ╕  ╨  ╤'''                         °
  714.   '''ALT      q  w  e  r  t  y  u  i  o  p  æ  ≈  ╥'''                         °
  715.   '''CTRL     ┌  ┬  ┐              ╔  ╦  ╗''' ''''''                           °
  716.   '''          A  S  D  F  G  H  J  K  L  [  ]'''                              °
  717.   '''SHFT      α  ⌐  ╛  _  ╖  ╢  °  ''''  É  (  )'''                           °
  718.   '''ALT       a  s  d  f  g  h  j  k  l  »  «'''                              °
  719.   '''CTRL     ├  ┼  ┤       ─  ═    ╠  ╬  ╣''' ''''''                          °
  720.   '''           Z  X  C  V  B  N  M  ,  .  /'''                                °
  721.   '''SHFT       Γ  π  ∩  ¼  ¥  ÿ  |  ;  :  \'''                                °
  722.   '''ALT        z  x  c  v  b  n  m  Σ  ±  ≡'''                                °
  723.   '''CTRL      └  ┴  ┘  │  ║      ╚  ╩  ╝''' ''''''                            °
  724. X '''Toggle switch to ASCII is CTL-BACKSPACE''' '''CTRL+G gives beep'''        °
  725. *(1992 2 29 8 32 32 460)                                                       °
  726.  Flabel ÉFX 'u╜label w'                                                        °
  727.   'Σ Return 1 if w is not a valid character string label (also excludes        °
  728. Xl.c.)' '╕(u╜(1<µµw)δ1<╧w)/0' '╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig'          °
  729. XClc 1 26 abcdefghijklmnopqrstuvwxyz                                           °
  730. XNmodes 1 10 1 800 600 65536 8 256 19 10 2826 2830                             °
  731. *(1992 2 29 8 32 33 464)                                                       °
  732.  Fnon ÉFX 'non;t;rc;et;r'                                                      °
  733.   'Σ Ignore invalid keyboard entries, but evaluate valid APL2 expression       °
  734.  s' 'æ╜''       ''' 't╜æ' '╕(0=µ(t⌠'' '')/t)/0' '(rc et r)╜ÉEC t'              °
  735. X '╕(0=rc)/2' '╕((1=rc)doif ''r'')/2' '╕2'                                     °
  736. *(1992 2 29 8 32 32 460)                                                       °
  737.  Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks'                               °
  738.   '╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0'         °
  739. X 'u╜(1-(,'' ''⌠Φw)∞1)╟w'                                                      °
  740. *(1992 10 18 10 45 17 448)                                                     °
  741.  Fopenmode ÉFX 'openmode W' 'Σ Open graphic screen in mode W'                  °
  742. X 'T╜207 ÉSVO ''D207''' '╕(2⌠ÉSVO ''D207'')/0' 'D207╜''OPEN'' W'               °
  743. XCp 1 2  "                                                                     °
  744. XCpath 1 16 D:\APL2OS2\WORK\                                                   °
  745. *(1992 2 29 8 32 33 464)                                                       °
  746.  Fpause ÉFX 'v pause w;t'                                                      °
  747.   'Σ Pause, then print w v spaces right and return'                            °
  748. X 't╜(0=ÉNC ''v'')doif ''v╜6''' 'do' '(vµ'' ''),w' 'do'                        °
  749. *(1992 7 16 11 12 35 372)                                                      °
  750.  Fprint ÉFX 'print W;L;D80' 'Σ Print function W on an Epsom printer'           °
  751.   '╕((~(ÉNC W)ε3 4)doif ''''''This is not a function or defined operator       °
  752. X'''''')/0' 'OPEN 80' 'D80╜5' 'L╜,showfn W' 'D80╜π(L⌠r)ΓL' 'CLOSE 80'          °
  753. XCq 0 '                                                                        °
  754. XCr 0                                                                         °
  755. *(1992 2 29 8 32 32 460)                                                       °
  756.  Freplace ÉFX 'u╜v replace w;i;r;s' 'Σ  Replace elements in v in w'            °
  757.   'i╜Γ∞µu╜w' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]w°.=╞v'                          °
  758. X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]'                                                 °
  759. *(1992 2 29 8 32 38 484)                                                       °
  760.  Freset ÉFX 'reset' 'Σ Reset parameters to initial screen'                     °
  761.   '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       °
  762. X 1 0'''                                                                       °
  763. *(1992 2 29 8 32 33 464)                                                       °
  764.  Fround ÉFX 'u╜v round w' 'Σ Half adjust w to vth decimal'                     °
  765. X 'u╜(╛0.5+w⌡10*v)÷10*v'                                                       °
  766. XCs 1 2 "                                                                      °
  767. *(1992 8 10 10 58 49 588)                                                      °
  768.  Fshared ÉFX 'U╜shared;T;C2;D2;E2'                                             °
  769.   'Σ List all shared variables currently active'                               °
  770.   'T╜2 ÉSVO■''C2'' ''D2'' ''E2'''                                              °
  771.   '╕((δ/2⌠T╜ÉSVO■''C2'' ''D2'' ''E2'')doif ''''''AP 2 not active'''''')/       °
  772. X0' 'C2╜0' 'U╜D2[;4]' 'U╜((εsv)εU)/εsv'                                        °
  773. *(1992 2 29 8 32 33 464)                                                       °
  774.  Fshow ÉFX '╢v show ╢w;╢t;╢b' 'Σ Display and execute ╢w'                       °
  775.   '╢t╜(0=ÉNC ''╢v'')doif ''╢v╜0'''                                             °
  776.   '╕((0=╧╢w)doif ''show ╢w,'''' '''''')/0'                                     °
  777.   '╕((1<╧╢w)doif ''╢v show■ ╢w'')/0' '''      '',╢w'                           °
  778. X '╕((╢v^'':''ε╢w)doif ''╢t╜evaldd ╢w'')/L0' '''ÉEM'' ÉEA ╢w' 'L0:do'          °
  779. *(1992 2 29 8 32 33 464)                                                       °
  780.  Fshowdd ÉFX 'u╜showdd w;a;b;c;r'                                              °
  781.   'Σ  Display a direct definition function'                                    °
  782.   '╕((1=╧w)doif ''u╜showdd Γw'')/u╜0'                                          °
  783.   '╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0'                    °
  784.   'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c'                          °
  785.   '╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/       °
  786.  0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜''      ''' 'r╜2╟3πc'                           °
  787.   '╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/''''   Σ'''',3╟2πc'')/0'         °
  788.   'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0'             °
  789. X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/''  Σ'',3╟2πc'             °
  790. *(1992 9 6 10 33 13 332)                                                       °
  791.  Fshowfn ÉFX 'u╜v showfn w;f;n;t;ÉIO' 'Σ Simulate the STSC ÉVR command'        °
  792.   't╜(0=ÉNC ''v'')doif ''v╜,0''' 'ÉIO╜0'                                       °
  793.   'u╜''      '',''╖'',w,''[É]'',(╞v)╞''╖''' 'n╜1╞µf╜ÉCR w'                     °
  794.   'v╜v[0],((1╟v)ε∞n)/1╟v' 'n╜«∞n' 'n╜(n⌠'' '')Γn'                              °
  795.   'f╜(π''['',■n,■Γ''] ''),f'                                                   °
  796.   't╜(1<µ,v)doif ''f╜f[1╟v;]'' ''u╜''''''''''' 'u╜²1╟u,r,,f,r'                 °
  797. X 'u╜((-+/^\'' ''=Φu)╟u),('' ''(r,''      ╖'',date 2 ÉAT w))[╞v]'              °
  798. *(1992 9 13 10 41 2 348)                                                       °
  799.  Fshowg ÉFX 'v╢ showg ╢w;╢t;╢b' 'Σ Display and execute ╢w'                     °
  800.   '╢t╜(0=ÉNC ''╢v'')doif ''╢v╜0'''                                             °
  801.   '╕((0=╧╢w)doif ''╢v showg ╢w,'''' '''''')/0'                                 °
  802.   '╕((1<╧╢w)doif ''╢v showg■ ╢w'')/0' '''      '',╢w'                          °
  803. X 't╢╜v╢ doif ''do''' '''ÉEM'' ÉEA ╢w' '╢w,r'                                  °
  804. *(1992 2 29 8 32 33 464)                                                       °
  805.  Fsimdd ÉFX 'u╜simdd w;e' 'Σ Simple direct definition mode' 'u╜0'              °
  806.   '╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw'               °
  807.   'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]'                            °
  808. X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w'                            °
  809. XAsv╜(100 211 80 206)(210 124)                                                 °
  810. XCt 1 7                                                                        °
  811. *(1992 6 3 9 59 17 424)                                                        °
  812.  Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W'                °
  813.   'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation'''            °
  814.   'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0'                                        °
  815.   'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1'                      °
  816.   '╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0'                                  °
  817.   'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU'''                                  °
  818.   'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' ''''       °
  819.  ,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U'                          °
  820.   'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A'                    °
  821.   '''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A'                  °
  822. X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0'                         °
  823. *(1996 7 19 13 48 24 508)                                                      °
  824.  Ftest ÉFX 'U╜test' 'Σ test return code' '╕(0=╞╞U╜D207)/0'                     °
  825. X '''SESSION ABORTED: The return code is '',╞U ╪ DISPLAYπU ╪ ╕'                °
  826. *(1992 9 5 9 10 34 316)                                                        °
  827.  Ftestap ÉFX 'U╜testap W;B;D;S;T'                                              °
  828.   'Σ Test for existence of specific AP"s' 'D╜''D'',■«■W╜,W'                    °
  829.   'T╜W ÉSVO■D' 'U╜0' '╕((^/B╜2=ÉSVO■D)doif ''T╜ÉEX■ D'')/0'                    °
  830.   'T╜''The following Auxilliary Processor'',(S╜1<+/~B)╞''s'''                  °
  831.   'T,(ε(S+1)╙'' is'' '' are''),'' not available'',(~B)/W' 'U╜1'                °
  832. X 'T╜ÉEX■D'                                                                    °
  833. XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ                                           °
  834. XCul 0 ²                                                                       °
  835. *(1996 6 13 13 16 24 352)                                                      °
  836.  Fwarna ÉFX 'warna;T' 'Σ clear AP124 and explai'                               °
  837. X 'T╜ÉSVR■''C124'' ''D124''' 'T╜ÉEX■''C124'' ''D124'''                         °
  838. *(1996 8 6 20 53 38 564)                                                       °
  839.  Fwarnb ÉFX 'warnb;T' 'Σ clear AP124 and explain'                              °
  840.   '''In the previous lesson we used the command VIEW. In this and in'''        °
  841.   '''subsequent lessons this command will be invoked in the examples.'''       °
  842.   'do'                                                                         °
  843.   '''WARNING: THE RIGHT ARGUMENT TO "VIEW" WILL VARY IN THE EXAMPLES.'''       °
  844.   '''WAIT A FEW SECONDS EACH TIME A GRAPHICAL SCREEN APPEARS. IF IT'''         °
  845.   '''STAYS, TRY PRESSING ANY KEY. IF THIS ALSO HAS NO EFFECT, THEN AND''       °
  846. X' '''ONLY THEN YOU MAY CLICK ON THE SESSION MANAGER SCREEN.''' 'do'           °
  847. *(1996 8 6 20 48 49 588)                                                       °
  848.  Fwarning ÉFX 'warning;T' 'Σ clear AP207 and explain' 'warna' 'warnb'          °
  849.   '''As in the previous lesson the function "test" is used to verify'''        °
  850. X '''that a command given to AP207 was successful.''' 'end'                    °
  851. XNwr 0 0                                                                       °
  852. XNwt 0 2                                                                       °
  853.