home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
teachapl.zip
/
teach50.zip
/
TEACH50.ATF
Wrap
Text File
|
1996-09-13
|
48KB
|
587 lines
XNÉIO 0 1 °
XNÉCT 0 1.000000000000011E²13 °
XCÉFC 1 6 .,*0_² °
XNÉRL 0 1725004503 °
XCÉPR 0 °
XCÉLX 1 5 TEACH °
*(1996 8 9 14 14 19 320) °
FALLPATS ÉFX 'ALLPATS;I;B;T;X;D207' 'Σ Display the 19 color patterns' °
'T╜open ''ALL PATTERNS''' '╕(0<ÉNC ''pats'')/L1 ╪ pats╜19' °
'L1:I╜1 ╪ B╜25 400' 'D207╜''CLEAR'' ''''' °
'L0:X╜5 2µB,(B+50 0),(B+50 50),(B+0 50)' °
'D207╜''move''(B+²18 25)''write''(«I)' °
'D207╜''PATTERN'' I ''BEGAREA'' '''' ''DRAW'' X ''ENDAREA'' ''''' °
'B╜B+70 0' '╕(pats<I╜I+1)/L2' '╕(0⌠10|I-1)/L0' °
X 'B╜25,400-60⌡╛I÷10 ╪ ╕L0' 'L2:D207╜''view'' '''' ''wait'' ''''' °
*(1992 2 29 8 32 29 448) °
FDISPLAY ÉFX 'D╜S DISPLAY A;ÉIO;R;C;HL;HC;HT;HB;VL;VB;V;W;N;B' °
'Σ DISPLAY A GENERAL ARRAY IN PICTORIAL FORM' °
'Σ NORMAL CALL IS MONADIC. DYADIC CALL USED ONLY IN' °
'Σ RECURSION TO SPECIFY DISPLAY RANK, SHAPE, AND DEPTH.' 'ÉIO╜0' °
'»(0=ÉNC ''S'')/''S╜µA''' 'R╜╞µ,S Σ PSEUDO RANK.' °
'C╜''┐┌└┘'' Σ UR, UL, LL, AND LR CORNERS.' °
'HL╜''─'' Σ HORIZONTAL LINE.' °
'HC╜HL,''Θ╕'',HL,''~+ε'' Σ HORIZONTAL BORDERS.' °
'HT╜HC[(0<R)⌡1+0<╞²1╞,S]' 'ΣW╜,0╧■╞0µΓ(1⌐µA)╞A' °
'HB╜HC[3+3╛(''2⌡~A╧«A'' ÉEA ''1+╞ε0⌡(1⌐⌡/µA)╞,A'')+3⌡1<µµS]' °
'VL╜''│'' Σ VERTICAL LINE.' °
'VB╜VL,''Φ╟'' Σ VERTICAL BORDER.' °
'V╜VB[(1<R)⌡1+0<²1╞²1╟,S]' °
'»(0εµA)/''A╜(1⌐µA)µΓ╞A'' Σ SHOW PROTOTYPE OF EMPTIES.' °
'╕(1<╧A)/GEN' '╕(2<µµA)/D3' °
'D╜«A Σ SIMPLE ARRAYS.' 'W╜1╞µD╜(²2╞1 1,µD)µD' °
'N╜²1+1╟µD' '╕(0=µµA)/SS' °
'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[ °
3]' '╕0' 'SS:HB╜((0 '' '')=╞0µΓA)/'' -''' °
'D╜'' '',('' '',[0]D,[0]HB,Nµ'' ''),'' ''' '╕0' °
'GEN:D╜«DISPLAY■A Σ ENCLOSED ...' 'N╜Dδ.⌠'' ''' °
'D╜(Nδ~1ΦN)≡D' 'D╜(δ≡~'' ''╤D)/D' 'D╜((1,µS)µS)DISPLAY D' °
'╕(2≥µ,S)╟D3E,0' 'D3:D╜0 ²1╟0 1╟«ΓA Σ MULT-DIMENSIONAL ...' °
'W╜1╞µD' 'N╜²1+1╟µD' °
'D╜(C[1],V,((W-1)µVL),C[2]),((HT,NµHL),[0]D,[0]HB,NµHL),C[0],(WµVL),C[ °
3]' 'D3E:N╜²2+µ,S' °
X 'V╜C[Nµ1],[0]VB[1+0<²2╟,S],[0](((²3+╞µD),N)µVL),[0]C[Nµ2]' 'D╜V,D' °
*(1992 8 14 10 7 40 364) °
FDOS ÉFX 'DOS W;T;D100;D2' 'Σ Simulation of DOS prompt' °
'T╜100 ÉSVO ''D100''' °
'T╜(2⌠ÉSVO ''D100'')doif ''''''AP100.COM'''' opentwo 1'' ''T╜100 ÉSVO °
''''D100''''''' '╕((0<µ(W⌠'' '')/W)doif ''D100╜W'')/0' 'L0:æ╜''C:>''' °
X '╕(^/'' ''=T╜3╟æ)/0' 'D100╜T' '╕L0' °
*(1996 8 11 12 47 46 560) °
FFILSC ÉFX 'FILSC W;S;T' 'Σ Fill screen with patterns W' °
'╕(2=ÉNC ''D207'')/L1 ╪ ''The graphic screen is not active'' ╪ ╕0' °
'L1:D207╜''query'' '''' ╪ S╜4╞2╞1╟,3πD207 ╪ D207╜''move''(0 0)' °
'L0:D207╜''PATTERN''(╞W)''BEGAREA'' '''' ''box'' S ''ENDAREA'' ''''' °
X '╕(0<µW╜1╟W)/L0' 'D207╜''view'' ''''' °
*(1992 2 29 8 32 30 452) °
FGO ÉFX 'GO;b;e;t' 'Σ Expression driver' 'L0:b╜e╜''''' 'æ╜'' ''' °
't╜æ' '╕(^/'' ''=t)/L0' '╕((^/'')OFF ''=5╞6╟t)doif ''exit'')/0' °
'╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/L0' °
'''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/L0' '╕b/L0' °
'''This is not a valid APL2 expression''' 'æ╜''*''' °
X '╕(''?''⌠╞1╟æ)/L0' 'e' '╕L0' °
XNR 2 6 2 100 150 400 200 150 300 200 50 300 300 100 150 °
*(1995 4 23 14 14 6 304) °
FSVOFFER ÉFX 'DC╜PID SVOFFER SV' 'SV╜(²2╞1 1,µSV)µSV╜πSV' °
'╕(2=ÉNC ''PID'')/DYADIC' 'DC╜ÉSVO SV ╪ ╕0' °
'DYADIC:╕(1^.⌠DC╜PID ÉSVO SV)/END' 'ÉSVE╜15' °
'CHECK:╕(1^.⌠DC╜ÉSVO SV)/END' '╕(0⌠ÉSVE)/CHECK' °
X 'END:SV╜1 0 1 0 ÉSVC SV' °
*(1996 8 12 13 27 31 428) °
FTEACH ÉFX 'TEACH' 'Σ Copyright Z V Jizba 1991; all rights reserved' °
'copyright' 'initialize' 'warning' 'do' °
'TEACH1 Σ Patterns in space filling commands' °
'TEACH2 Σ Commands BEGAREA and ENDAREA' °
'TEACH3 Σ Generating new patterns by combination' °
'TEACH4 Σ Function FILSC filling the screen' °
'TEACH5 Σ Filling polygons with patterns' °
X 'TEACH6 Σ The command IMAGE' '''This is the end of this lesson''' °
*(1996 8 9 13 8 55 436) °
FTEACH1 ÉFX 'TEACH1;T;D207' 'Σ Space filling commands' °
'''SPACE FILLING COMMANDS'',r' °
'''We have seen in the last lesson that some fonts are not just line'' °
' °
'''drawings. In these fonts, which are defined by closed polygons, the °
''' °
'''inner space is filled out with the foreground (black) color.'',r' °
'''In this lesson we will study the process of filling space by patter °
ns.''' °
'''When we studied command QUERY, the seventh item specifies the numbe °
r''' '''of different fill patterns.''' 'do' °
'show ''T╜TEST ''''query'''' '''''''' ╪ ''''Number of patterns='''',pa °
ts╜7╙,3πT''' °
'''In this version of APL2OS2 there are'',pats,''different ways to fil °
l space''' '''with patterns.''' 'do' °
'''As usual, we begin by finding out the default pattern''' 'do' °
'show ''T╜TEST ''''PATTERN'''' '''''''' ╪ DISPLAY T''' °
'''The default pattern is 0 which is a solid fill. The command PATTERN °
''' °
'''takes only one argument. It is an integer scalar in the range 1-'', °
pats' °
'''(or whathever the maximum range of the # of patterns). If the value °
''' °
'''of the argument is a zero (0), the default solid fill will be used. °
''' 'do' °
'''Function ALLPATS will display all the'',pats,''patterns that are av °
ailable''' '''here.'',r' 'show ''ALLPATS''' °
'''Of particular interest are patterns 15 (background) and 16 black''' °
X '''(foreground)''' 'end' °
*(1996 8 11 11 53 29 512) °
FTEACH2 ÉFX 'TEACH2;T;D207' 'Σ BEGAREA and ENDAREA' °
'''COMMANDS BEGAREA AND ENDAREA'',r' °
'''To fill out an area with a pattern, one has to do three things:'',r °
' ''' 1. Specify the pattrern to be used''' °
''' 2. Draw the area to be filled''' °
''' 3. Give the commands to fill out the area with the pattern'',r' °
'''We have already learned how to specify the desired pattern. We also °
''' °
'''know how to draw a closed region, such as a circle. We need command °
s''' '''to specify how to fill out that region.'',r' °
'''This is done with two commands: BEGAREA and ENDAREA. Both commands' °
'' °
'''take a null string as a right argument. The BEGAREA command must be °
''' °
'''given before drawing the closed polygon, and the ENDAREA must be''' °
'''invoked upon completion of the polygonal drawing. Here is an exampl °
e''' 'do' °
'show ''T╜open ''''SPACE FILLING PATTERNS'''''' ''D207╜''''PATTERN'''' °
8''' °
'T╜''D207╜''''BEGAREA'''' '''''''' ''''ARC'''' (200 200 50 50 0 360) ' °
'''ENDAREA'''' ''''''''''' 'show T,'' ╪ D207╜''''view'''' ''''''''''' °
'''Note that there is no boundary marking the edges of the pattern. To °
''' °
'''draw both the boundary and the pattern, one has to repeat the ARC'' °
' °
'''call twice; once between the BEGAREA and ENDAREA commands and once' °
'' '''outside.''' 'do' °
'show ''D207╜''''CLEAR'''' '''''''' ''''pattern'''' 8''' °
'show ''D207╜''''ARC'''' (200 200 50 50 0 360) '',5╟T' °
'D207╜''view'' ''''' °
'''Since the space filling commands will apply to all line drawings,'' °
' '''they should work for the vector fonts as well'',r' °
'show ''T╜getfont 1 21 ╪ D207╜''''move'''' (100 100) ''''font'''' (''' °
'THKSQUF'''' 30)''' °
'show ''D207╜''''pattern'''' 11 ''''write'''' ''''TEST'''' ''''view''' °
' ''''''''''' °
'''Again, to also obtain an outline of the characters, one would have °
to''' °
'''write the text twice, once inside "begarea-endarea" and once outsid °
e.''' °
'''However, for the filled fonts (ROMDUPF, SANSERF, THKRNDF, THKSQF), °
the''' °
'''procedure is to write the unfilled text (ROMDUP, ROMSER, THKRNDO, T °
HKSQUO)''' °
'''followed by the pattern and a second write inside "begarea-endarea" °
.''' 'do' °
'''It is also of interest to note that the space filling can be applie °
d''' '''to text that is not normally filled out''' 'do' °
'show ''D207╜''''move'''' (300 100) ''''font'''' (''''GOTENG'''' 30)'' °
' 'show ''D207╜''''write'''' ''''TEST'''' ''''view'''' ''''''''''' °
'''And now, the same write command but this time within "begarea-endar °
ea"''' 'do' °
'show ''D207╜''''begarea'''' '''''''' ''''write'''' ''''TEST'''' ''''e °
Xndarea'''' '''''''' ''''view'''' ''''''''''' '''__''' °
*(1996 8 11 12 16 13 304) °
FTEACH3 ÉFX 'TEACH3;T;D207' 'Σ Combining patterns' °
'''COMBINING PATTERNS'',r' °
'''If two closed areas overlap, the patterns combine in a specific way °
.''' °
'''Function TESTPAT can be used to evaluate how two or more patterns'' °
' '''combine. This function has as the right argument one or more''' °
'''integers in the range of available patterns. It produces a display °
of''' °
'''offset cicular areas containing the specified patterns. Here is a'' °
' '''listing of this function.''' 'do' 'showfn ''TESTPAT''' °
'r,''Line[2] opens AP207, initializes the X coordinate of the first ci °
rcle''' °
'''and also initializes the returned variable U. Line [3] defines the' °
'' °
'''first pattern. Line [4] fills out the circular area with the patter °
n.''' °
'''Line [5] adds to variable U the return codes, updates to the next'' °
' °
'''pattern (location and type) and branches to line [4] if there is''' °
'''another pattern. Line [6] displays the graphic and removes the init °
ial''' °
'''null string. Line [7] is a pause to prevent the graph from flashing °
out,''' °
'''since the shared variable D207 is local to this function.''' °
'''Let us see how this function works''' 'do' °
'show ''T╜TESTPAT 12 14 11 13''' °
'''You may wish to try out several combination of patterns. (To see th °
Xe''' '''individual patterns, enter ALLPATS.)''' 'end' °
*(1996 8 11 12 49 24 480) °
FTEACH4 ÉFX 'TEACH4;C;T;D207' 'Σ More on mixing' °
'''The number of different patterns that you can generate is almost''' °
'''limitless. To help you to study what is available you can use funct °
ion''' °
'''FILSC. This function fills the screen with the specified pattern. T °
he''' °
'''function will work only if the graphic screen is active. The right' °
'' °
'''argument is the pattern number to be displayed. If more than one''' °
'''integer is given as right argument, the patterns will be combined.' °
'' 'do' 'T╜open ''FILL SCREEN''' °
'''Go ahead, and try function FILSC now''' 'do' °
'''The more patterns you specify, the more the screen will fill up''' °
X '''with the foreground (black now) color.'',r' 'end' °
*(1996 8 12 11 35 55 548) °
FTEACH5 ÉFX 'TEACH5;P;Q;T;D207' °
'Σ Filling out open and complex polygons' °
'''One question that may come up is what gets filled, if the area to b °
e''' °
'''covered is not a complete polygon, or if it is made up of intersect °
ing''' '''lines. Let us try some examples''' 'do' °
'T╜open ''POLYGONS''' °
'show ''P╜3 2µ100 100 200 100 200 200'' ''D207╜''''DRAW'''' P ''''view °
'''' ''''''''''' 'D207╜''CLEAR'' ''''' °
'show ''Q╜4 2µ100 150 400 200 300 100 50 300'' ''D207╜''''DRAW'''' Q °
''''view'''' ''''''''''' 'do' °
'''P is an incomplete triangle, and Q includes a triangle, but the lin °
es''' '''extend beyond the vertices''' 'do' 'D207╜''CLEAR'' ''''' °
'show ''D207╜''''BEGAREA'''' '''''''' ''''DRAW'''' P ''''ENDAREA'''' ' °
''''''' ''''view'''' ''''''''''' 'do' 'D207╜''CLEAR'' ''''' °
'show ''D207╜''''BEGAREA'''' '''''''' ''''DRAW'''' Q ''''ENDAREA'''' ' °
''''''' ''''view'''' ''''''''''' °
'''The area filled out is as if the endpoints of the incomplete polygo °
n''' '''were connected.''' 'do' °
'''What if we tried to fill out a five pointed star? Here is an exampl °
e'',r' 'show ''R╜6 2µ100 150 400 200 150 300 200 50 300 300''' °
'D207╜''CLEAR'' ''''' °
'show ''D207╜''''DRAW'''' R ''''view'''' ''''''''''' °
'D207╜''CLEAR'' ''''' °
'show ''D207╜''''BEGAREA'''' '''''''' ''''DRAW'''' R ''''ENDAREA'''' ' °
''''''' ''''view'''' ''''''''''' °
'''The rule is: Fill begins when a line of a (closed) polygon is sense °
d,''' °
'''and ends when a second line is detected. If another line is then ag °
Xain''' '''detected, another fill pattern begins.''' 'end' °
*(1996 8 12 13 22 8 316) °
FTEACH6 ÉFX 'TEACH6;A;I;T;D207' 'Σ Using the IMAGE command' °
'''THE COMMAND IMAGE'',r' °
'''Until now we have defined graphic images by invoking a variety of'' °
' °
'''commands that generate line drawings and fill patterns. There is''' °
'''yet another way to generate images. Recall that a graphic image is' °
'' °
'''stored as an array of "pels". APL2 provides a way to retrieve this' °
'' °
'''array (or portions of it). The retrieved image must be visible on'' °
' °
'''the screen at the time it is retrieved. Furthermore, it apparently' °
'' '''must also be an APL2OS2 window.''' 'T╜open ''IMAGE''' 'do' °
'''Let us suppose that we desire to display an image, of a line of tex °
t.''' °
'''We will retrieve the SCRIPT font and write the word "Test" on the'' °
' '''graphic screen.''' 'do' °
'show ''T╜getfont 18 ╪ D207╜''''font''''(''''SCRIPT'''' 30)''' °
'show ''D207╜''''MOVE'''' (100 20) ''''write'''' ''''Test'''' ''''view °
'''' '''''''' ╪ T╜test''' °
'''We can capture the image of this text. To do that, we have to be su °
re''' °
'''the graphic screen is visible. Then we invoke the command IMAGE wit °
h''' °
'''the right argument specifying the box that contains the text.''' °
'do' °
'show ''D207╜''''view'''' '''''''' ╪ D207╜''''IMAGE'''' (100 20 200 50 °
)''' °
'''Note that we issued the IMAGE command separately from the VIEW,''' °
'''because this command may not be used in a multiple command sequence °
.'',r' °
'''The image array can now be retrieved from the second element of the °
''' '''return vector.''' 'do' 'show ''A╜2πD207 ╪ DISPLAYµA''' °
'''A is now an APL2 rank 2 character array. This array can be posted o °
n''' '''the graphic screen using the IMAGE command''' 'do' °
'show ''D207╜''''MOVE'''' (100 200) ''''image'''' A ''''view'''' ''''' °
''' ╪ T╜test''' °
'''We can manipulate A, and we can store it, and display it on any''' °
'''graphic screen''' 'do' °
'show ''D207╜''''MOVE'''' (100 150) ''''IMAGE'''' (A,ΦA) ''''view'''' °
''''''''''' °
'''Since the image array is rectangular, we can generate only rectangu °
lar''' °
'''areas without further processing. However, we have learned enough a °
bout''' °
'''space filling. The additional processing required to fill irregular °
''' '''areas with images or patterns is left to you as an exercise.''' °
X 'end' °
*(1996 8 9 13 25 32 412) °
FTEST ÉFX 'U╜V TEST W;T;D207' °
'Σ Test a sequence of graphic commands (W)' °
'T╜open ''TEST PATTERNS''' 'D207╜W ╪ U╜D207 ╪ D207╜''view'' ''''' °
X 'do' °
*(1996 8 11 11 41 47 536) °
FTESTPAT ÉFX 'U╜TESTPAT W;T;X;D207' 'Σ Display patterns W in circles' °
'T╜open ''TEST COMBINED PATTERNS'' ╪ X╜200' 'L0:D207╜''PATTERN''(╞W)' °
'D207╜''BEGAREA'' '''' ''ARC''(X,200 100 100 0 360)''ENDAREA'' ''''' °
X 'U╜D207 ╪ W╜1╟W ╪ X╜X+50 ╪ ╕(0<µW)/L0' 'D207╜''view'' ''''' 'do' °
XCa 0 % °
*(1992 2 29 8 32 29 448) °
Faddquote ÉFX 'u╜addquote w' °
'Σ Put quotes around a string, and double existing quotes' °
X 'u╜ÉAV[40],((1+w=ÉAV[40])/w),ÉAV[40]' °
XAaf╜('DEFAULT')('SCRIPT') °
*(1992 2 29 8 32 29 448) °
XFaq ÉFX 'u╜aq w' 'Σ Enclose quoted string' 'u╜Γaddquote w' °
*(1992 2 29 8 32 30 452) °
Fav ÉFX 'av;a;n;i;ÉIO' 'Σ Display characters in the Atomic vector' °
'ÉIO╜0' 'a╜22 78µ'' ''' 'n╜3 0«φ12 22µ1+∞256' °
'a[;,(6⌡∞12)°.+2 3 4]╜n' 'a[;6+6⌡∞12]╜φ12 22µÉAV' °
X 'a[7 8 10 13;6]╜'' ''' 'a[14+∞8;68 69 70 72]╜'' ''' 'a' °
*(1992 2 29 8 32 32 460) °
Fback ÉFX 'back;T' 'Σ Reset screen to 25⌡80 size' 'OPEN 124' 'C124╜0 3' °
X 'CLOSE 124 206' °
*(1996 8 5 14 6 58 428) °
Fcopyright ÉFX 'copyright' 'Σ Copyright statement' °
'(10µ'' ''),''Copyright, Z. V. Jizba, 1995,1996'',r' °
'''To see disclaimers, enter ÉCR ''''copyright''''''' 'do' '╕0' °
'''This and subsequent workspaces labelled TEACHxx are made available' °
'' °
'''at no cost to anyone who desires to learn how to use effectively''' °
'''the IBM/OS2 version of APL2.'',r' °
'''This software is provided "AS IS" with no WARRANTY of any kind, eit °
her''' °
'''express or implied. Any risk in its use resides with you, the user °
Xof''' '''these tutorials.''' '''(PRESS ENTER to continue)''' °
XCd 0 " °
*(1992 2 29 8 32 33 464) °
Fdate ÉFX 'u╜date w' 'Σ Format date and time of day' 'u╜«6╞w' °
X 'u╜('' ''⌠u)Γu' 'u╜εu,■''-- .. ''' °
XCdig 1 10 1234567890 °
*(1992 2 29 8 32 28 444) °
Fdo ÉFX 'do;t;e;b' 'Σ Expression driver' 'e╜''''' 'æ╜'' ''' 't╜æ' °
'╕(^/'' ''=t)/0' °
'╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/2' °
'''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/2' °
'''This is not a valid APL2 expression''' 'æ╜''*''' '╕(''?''⌠╞1╟æ)/2' °
X 'e' '╕2' °
*(1992 2 29 8 32 28 444) °
Fdoif ÉFX 'U╢╜V╢ doif W╢;t╢' 'Σ Rule' '╕(^/~U╢╜V╢)/0' °
X '''U╢╜V╢ doif■ W╢'' ÉEA ''»V╢/W╢''' °
XNdos 0 ²26 °
*(1996 8 4 12 11 37 352) °
Fdropfont ÉFX 'U╜dropfont W;B;T' 'Σ drop fonts W' °
'U╜'''' ╪ ╕(0=ÉNC ''af'')/0 ╪ ╕(2=╧W)/L0' 'W╜,ΓW' °
'L0:af╜(~B╜afεW)/af' 'L1:╕(0=µW)/0' °
X 'L1:D207╜''fontdef''((1πW)²1) ╪ U╜U,D207' '╕(0<µW╜1╟W)/L1' °
XCe 1 0 °
*(1996 7 24 14 20 54 540) °
Fend ÉFX 'end' 'e╜''''' 'æ╜'' ''' 't╜æ' '╕(^/'' ''=t)/L0' °
'╕(('':''εt)doif ''b╜evaldd (+/^\'''' ''''=t)╟t'')/3' °
'''e╜ÉEM'' ÉEA t' '╕(0=µ,e)/L0' °
'''This is not a valid APL2 expression''' 'æ╜''*''' °
X '╕(''?''⌠╞1╟æ)/L0' 'e' 'L0:''²²''' °
*(1992 2 29 8 32 30 452) °
XFendd ÉFX 'endd' 'Σ End of document' '20µ''²''' 'do' °
*(1996 9 13 13 38 9 392) °
Ferase ÉFX °
'erase;t;b;DISPLAY;DOS;GO;FRAME;NODIST;SVOFFER;FONTS;ALLPATS;FILSC' °
't╜ÉNL 3' 't╜(~t^.εlc,'' '')≡t' °
't╜(~(t[;∞5]^.=''TEACH'')δt[;∞4]^.=''TEST'')≡t' 't╜ÉEX t' 't╜ÉNL 2' °
X 't╜ÉEX(~t^.εlc,'' '')≡t' 't╜ÉNL 4' 't╜ÉEX(~t^.εlc,'' '')≡t' °
*(1992 2 29 8 32 32 460) °
Fevaldd ÉFX 'u╜evaldd w;c;n' °
'Σ Evaluate a direct definition expression' 'u╜0' 'n╜(w∞''Σ'')-1' °
'c╜(((n╞w)⌠'':'')Γn╞w),Γ''ΣDD '',(n+1)╟w' '╕(label╞c)/0' °
'╕((2=µc)doif ''u╜showdd 1╙c'')/0' °
'╕((3=ÉNC╞c)doif ''u╜⌡µÉ╜(╞c),'''' is already defined.'''''')/0' °
'╕((3=µc)doif ''u╜simdd c'')/0' 'c╜(Γ''α∙ aw'')replace■c' °
'u╜ε''u╜'',((''a''εεc[2 3 4])/''a ''),(╞c),'' w;t;b''' °
'u╜u(5πc)(''b╜(t╜'',(3πc),'')/'',addquote ''u╜'',4πc)' °
X 'u╜u,''╕(t doif b)/0''(''u╜'',2πc)' 'u╜╧ÉFX u' °
*(1992 2 29 8 32 32 460) °
Fexit ÉFX 'exit w' 'Σ Exit if there are too many suspended functions' °
X '╕((10>µÉLC)doif ''w'')/0' '''Please re-enter '',w' '╕' °
XCf 1 2 { °
Afonts╜('GOTENG')('GOTGER')('GOTITA')('GRESER')('GRESIM')('MARKERS')('M °
ODSIM')('ROMDUP')('ROMDUPF')('ROMITA')('ROMITAB')('ROMSER')('ROMSERB')( °
'ROMSIM')('ROMSIMM')('SANSER')('SANSERF')('SCRIPT')('THKRNDF')('THKRNDO °
X')('THKSQUF')('THKSQUO') °
XCfpath 1 17 D:\APL2OS2\FONTS\ °
XCg 1 2 } °
*(1996 3 12 15 27 53 504) °
Fget ÉFX 'u╜v get w;t;ÉPR' 'Σ Prompt for response from keyboard' °
't╜(0=ÉNC ''v'')doif ''v╜1'' ╪ ÉPR╜''''' 'w╜w,(~²1╞v)/'': ''' °
'L0:æ╜w' 't╜æ' '╕((''╕''=(µw)╟t)doif ''╕'')/0' '╕(^/'' ''=w)/L1' °
'╕((~w╧(µw)╞t)doif ''''''PLEASE DO NOT BACKSPACE'''''')/L0' °
't╜(µw)╟t' 'L1:u╜(²1+(,'' ''⌠t)∞1)╟t' '╕(1╞v)/0' 't╜(u⌠'' '')Γu' °
X 'u╜(µt),(Γu),t' °
*(1996 8 4 13 59 47 588) °
Fgetfont ÉFX 'U╜getfont W;A;N;F' 'Σ retrieve fonts W' °
'U╜0 ╪ ╕(0<ÉNC ''af'')/L1 ╪ af╜,Γ''DEFAULT''' °
'L1:W╜,W ╪ W╜0,(Wε0,∞22)/W' 'L0:╕(0=µW╜1╟W)/0' '╕(0=A╜╞W)/L0' °
'F╜εfpath,(N╜πfonts[A]),''.AVF''' °
X 'D207╜''FONTDEF''(N F) ╪ ╕(0⌠╞╞U╜D207)/0 ╪ af╜af,ΓN' '╕L0' °
*(1996 3 10 15 8 33 340) °
Fglobals ÉFX 'globals;T;D207' 'Σ Initialize useful global variables' °
'r╜2╙ÉTC' 'q╜40╙ÉAV' 's╜Φp╜'' '',d╜35╙ÉAV' °
'sv╜(100 211 80 206)(210 124)' 'uc╜''ABCDEFGHIJKLMNOPQRSTUVWXYZ''' °
'lc╜''abcdefghijklmnopqrstuvwxyz''' 'dig╜''1234567890''' °
'g╜Φ'' '',h╜126╙ÉAV' 'f╜ÉAV[33 124]' 'a╜38╙ÉAV' 'ul╜''²''' °
'T╜207 SVOFFER ''D207''' 'D207╜''QUERY'' ''''' 'modes╜,3πD207' °
'path╜''D:\APL2OS2\WORK\''' 'Σ''The current path is '',path' °
'ΣT╜1 get ''Enter new path if incorrect, else press Enter: ''' °
'Σ╕((0<µT)doif ''path╜T'')/0' 'fpath╜''D:\APL2OS2\FONTS\''' °
'''For this lesson you must specify a path to the FONT files.''' °
'''The current path is '',fpath' °
'T╜1 get ''Enter new path if incorrect, else press Enter: ''' °
X '╕((0<µT)doif ''fpath╜T'')/0' °
XCh 0 } °
*(1992 8 10 10 44 11 380) °
Findex ÉFX 'U╜V index W;A;C;H;I;T' 'Σ List contents of an AP 211 file' °
'T╜~(1<╧W)doif ''H╜2πW'' ''W╜1πW''' 'T╜T doif ''H╜''''FUNCTION''''''' °
'T╜(ΓW)ε''DOCS'' ''UTILITY'' ''HELP'' ''TUTOR''' °
'T╜T doif ''W╜path,W,''''.211''''''' '1 OPEN 211' 'D211╜''USE'' W' °
'''File '',W,'' has record length='',1╟D211' °
'D211╜''LIST'' ''NAMES''' 'U╜D211' °
'╕((0=╧U)doif ''U╜''''Unknown file'''''')/0' 'C╜1╟µU╜U[I╜ÉAV√U;]' °
'╕((0=ÉNC ''V'')doif ''CLOSE 211'')/0' 'U╜(C╞H),[1]ul,[1]U' °
'╕((0=1╞V)doif ''U╜0 0 2 tab U'' ''CLOSE 211'')/0' °
'D211╜''LIST'' ''ATTS''' 'A╜D211' °
'A╜(''SZ'' ''ID'' ''DATE'' ''mo'' ''d'' ''TIME'' ''m'' ''s'' ''ms''),[ °
1]ul,[1]A[I;]' 'V╜(Vε0,(∞9),-∞9)/V' 'U╜U,«A[;(0⌠V)/|V]' °
'╕((0εV)doif ''CLOSE 211'')/0' °
'T╜~(0<╛/V)doif ''U╜U[∞2;],[1](2 0╟U)[√(2 0╟A)[;|V];]''' °
'T╜T doif ''U╜U[∞2;],[1](2 0╟U)[ⁿ(2 0╟A)[;|V];]''' 'T╜ÉDL 1' °
X 'CLOSE 211' °
*(1996 3 10 14 58 1 408) °
Finitialize ÉFX 'initialize;t;C2' °
'Σ Initialize workspace. (To add to "sv" keep 100 FIRST)' 'erase' °
X 'globals' °
*(1992 2 29 8 32 29 448) °
Fkeys ÉFX 'keys' 'Σ Display keyboard' °
''' 1 2 3 4 5 6 7 8 9 0 + ⌡''' °
'''SHFT ╒ ■ ² < ≤ = ≥ > ⌠ δ ^ - ÷''' °
'''ALT ╘ ƒ · ⁿ √ Φ φ Θ ╡ τ σ ! Æ''' '''''' °
''' Q W E R T Y U I O P ╜ ╙ ╧''' °
'''SHFT ? ∙ ε µ ~ ╞ ╟ ∞ Ω * ╕ ╨ ╤''' °
'''ALT q w e r t y u i o p æ ≈ ╥''' °
'''CTRL ┌ ┬ ┐ ╔ ╦ ╗''' '''''' °
''' A S D F G H J K L [ ]''' °
'''SHFT α ⌐ ╛ _ ╖ ╢ ° '''' É ( )''' °
'''ALT a s d f g h j k l » «''' °
'''CTRL ├ ┼ ┤ ─ ═ ╠ ╬ ╣''' '''''' °
''' Z X C V B N M , . /''' °
'''SHFT Γ π ∩ ¼ ¥ ÿ | ; : \''' °
'''ALT z x c v b n m Σ ± ≡''' °
'''CTRL └ ┴ ┘ │ ║ ╚ ╩ ╝''' '''''' °
X '''Toggle switch to ASCII is CTL-BACKSPACE''' '''CTRL+G gives beep''' °
*(1992 2 29 8 32 32 460) °
Flabel ÉFX 'u╜label w' °
'Σ Return 1 if w is not a valid character string label (also excludes °
Xl.c.)' '╕(u╜(1<µµw)δ1<╧w)/0' '╕(u╜~^/wεlc,uc,dig)/0' 'u╜w[1]εlc,dig' °
XClc 1 26 abcdefghijklmnopqrstuvwxyz °
XNmodes 1 10 1 800 600 65536 8 256 19 10 2826 2830 °
*(1992 2 29 8 32 33 464) °
Fnon ÉFX 'non;t;rc;et;r' °
'Σ Ignore invalid keyboard entries, but evaluate valid APL2 expression °
s' 'æ╜'' ''' 't╜æ' '╕(0=µ(t⌠'' '')/t)/0' '(rc et r)╜ÉEC t' °
X '╕(0=rc)/2' '╕((1=rc)doif ''r'')/2' '╕2' °
*(1992 2 29 8 32 32 460) °
Fnotb ÉFX 'u╜notb w' 'Σ Remove trailing blanks' °
'╕((1<╧w)doif ''u╜notb■ w'')/0' '╕((1<µµw)doif ''u╜πnotb Γ[2]w'')/0' °
X 'u╜(1-(,'' ''⌠Φw)∞1)╟w' °
*(1996 8 11 11 44 8 392) °
Fopen ÉFX 'U╜open W;T' 'Σ Activate AP 207' '╕(2=ÉSVO ''D207'')/U╜0' °
'T╜ÉEX ''af''' 'T╜207 SVOFFER ''D207''' °
X 'D207╜''OPEN''(0 W 760 540 0 0)' '╕(0=╞╞U╜test)/0 ╪ ╕' °
XCp 1 2 " °
XCpath 1 16 D:\APL2OS2\WORK\ °
XNpats 0 19 °
*(1992 2 29 8 32 33 464) °
Fpause ÉFX 'v pause w;t' °
'Σ Pause, then print w v spaces right and return' °
X 't╜(0=ÉNC ''v'')doif ''v╜6''' 'do' '(vµ'' ''),w' 'do' °
*(1992 7 16 11 12 35 372) °
Fprint ÉFX 'print W;L;D80' 'Σ Print function W on an Epsom printer' °
'╕((~(ÉNC W)ε3 4)doif ''''''This is not a function or defined operator °
X'''''')/0' 'OPEN 80' 'D80╜5' 'L╜,showfn W' 'D80╜π(L⌠r)ΓL' 'CLOSE 80' °
XCq 0 ' °
XCr 0 °
*(1992 2 29 8 32 32 460) °
Freplace ÉFX 'u╜v replace w;i;r;s' 'Σ Replace elements in v in w' °
'i╜Γ∞µu╜w' 's╜2πv╜(v⌠'' '')Γv' 'i╜⌡r╜i⌡■Γ[1]w°.=╞v' °
X 'u[(εi)/εr]╜s[(εi)/εi⌡■∞µs]' °
*(1992 2 29 8 32 38 484) °
Freset ÉFX 'reset' 'Σ Reset parameters to initial screen' °
'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 °
X 1 0''' °
*(1992 2 29 8 32 33 464) °
Fround ÉFX 'u╜v round w' 'Σ Half adjust w to vth decimal' °
X 'u╜(╛0.5+w⌡10*v)÷10*v' °
XCs 1 2 " °
*(1992 8 10 10 58 49 588) °
Fshared ÉFX 'U╜shared;T;C2;D2;E2' °
'Σ List all shared variables currently active' °
'T╜2 ÉSVO■''C2'' ''D2'' ''E2''' °
'╕((δ/2⌠T╜ÉSVO■''C2'' ''D2'' ''E2'')doif ''''''AP 2 not active'''''')/ °
X0' 'C2╜0' 'U╜D2[;4]' 'U╜((εsv)εU)/εsv' °
*(1992 2 29 8 32 33 464) °
Fshow ÉFX '╢v show ╢w;╢t;╢b' 'Σ Display and execute ╢w' °
'╢t╜(0=ÉNC ''╢v'')doif ''╢v╜0''' °
'╕((0=╧╢w)doif ''show ╢w,'''' '''''')/0' °
'╕((1<╧╢w)doif ''╢v show■ ╢w'')/0' ''' '',╢w' °
X '╕((╢v^'':''ε╢w)doif ''╢t╜evaldd ╢w'')/L0' '''ÉEM'' ÉEA ╢w' 'L0:do' °
*(1992 2 29 8 32 33 464) °
Fshowdd ÉFX 'u╜showdd w;a;b;c;r' °
'Σ Display a direct definition function' °
'╕((1=╧w)doif ''u╜showdd Γw'')/u╜0' °
'╕((3⌠ÉNC╞w)doif ''(ε╞w),'''' is not a function'''''')/0' °
'c╜Γ[2]ÉCR╞w' 'c╜notb(2╞c),(Γ''aw α∙'')replace■2╟c' °
'╕((~''ΣDD''╧3╞2πc)doif ''''''Not a direct definition function'''''')/ °
0' 'u╜1' 'b╜('' ''⌠╞c)Γ╞c' 'a╜'' ''' 'r╜2╟3πc' °
'╕((3=µc)doif ''a,(╞w),'''':'''',r,(3<µ2πc)/'''' Σ'''',3╟2πc'')/0' °
'a╜a,(╞w),'':'',(2╟5πc),'':''' 'b╜(+\r=''('')-+\r='')''' 'b╜b∞0' °
X 'a╜a,(²3╟(b-1)╞3╟r),'':'',2╟»(b+2)╟r' 'a,(3<µ2πc)/'' Σ'',3╟2πc' °
*(1992 9 6 10 33 13 332) °
Fshowfn ÉFX 'u╜v showfn w;f;n;t;ÉIO' 'Σ Simulate the STSC ÉVR command' °
't╜(0=ÉNC ''v'')doif ''v╜,0''' 'ÉIO╜0' °
'u╜'' '',''╖'',w,''[É]'',(╞v)╞''╖''' 'n╜1╞µf╜ÉCR w' °
'v╜v[0],((1╟v)ε∞n)/1╟v' 'n╜«∞n' 'n╜(n⌠'' '')Γn' °
'f╜(π''['',■n,■Γ''] ''),f' °
't╜(1<µ,v)doif ''f╜f[1╟v;]'' ''u╜''''''''''' 'u╜²1╟u,r,,f,r' °
X 'u╜((-+/^\'' ''=Φu)╟u),('' ''(r,'' ╖'',date 2 ÉAT w))[╞v]' °
*(1992 9 13 10 41 2 348) °
Fshowg ÉFX 'v╢ showg ╢w;╢t;╢b' 'Σ Display and execute ╢w' °
'╢t╜(0=ÉNC ''╢v'')doif ''╢v╜0''' °
'╕((0=╧╢w)doif ''╢v showg ╢w,'''' '''''')/0' °
'╕((1<╧╢w)doif ''╢v showg■ ╢w'')/0' ''' '',╢w' °
X 't╢╜v╢ doif ''do''' '''ÉEM'' ÉEA ╢w' '╢w,r' °
*(1992 2 29 8 32 33 464) °
Fsimdd ÉFX 'u╜simdd w;e' 'Σ Simple direct definition mode' 'u╜0' °
'╕((0⌠ÉNC╞w)doif ''''''Already defined'''''')/0' 'e╜''α''ε2πw' °
'w[2]╜Γ''u╜'',''α∙ aw'' replace 2πw' 'w╜w[1 3 2]' °
X 'w[1]╜Γε''u╜'',(e/''a ''),w[1],'' w''' 'u╜╧ÉFX w' °
XAsv╜(100 211 80 206)(210 124) °
XCt 1 7 °
*(1992 6 3 9 59 17 424) °
Ftab ÉFX 'U╜V tab W;T;A;B;C;D;E;F;G;M;ÉPW' 'Σ Tabulate list W' °
'T╜(0=ÉNC ''V'')doif ''V╜0''' 'M╜''Invalid data for tabulation''' °
'V╜4╞V' 'ÉPW╜130╛30⌐G╜V[2]+79⌡V[2]=0' °
'L1:╕((1<╧W)doif ''''''W╜∞0'''' ÉEA ''''W╜πW'''''')/L1' °
'╕(((0=µεW)δ2<µµW)doif ''U╜(~V╧4╞0)/M'')/0' °
'T╜(1≥µµU╜«W)doif ''U╜πW╜(U⌠'''' '''')ΓU''' °
'T╜(0<V[1])doif ''U╜(«(Φ1,╞µW)µ(V[3]µ'''' ''''),∞(╞µW)-V[3]),'''' '''' °
,U''' '╕(G<30)/0' 'T╜(F╜µεV[4])+C╜1╟B╜µA╜(V[3],0)╟U' °
'T╜⌐(1╞B)÷1⌐╛(ÉPW+F)÷T' 'U╜(E╜(V[3],C)╞U),[1](B╜T,1╟B)╞A' °
'''D╜εV[4]'' ÉEA ''D╜ÉAV[εV[4]+33⌡V[4]=0]''' 'L0:A╜(T,0)╟A' °
X '╕(0=1╞µA)/0' 'U╜U,(((T+V[3]),µD)µD),E,[1]B╞A' '╕L0' °
*(1996 7 19 13 48 24 508) °
Ftest ÉFX 'U╜test' 'Σ test return code' '╕(0=╞╞U╜D207)/0' °
X '''SESSION ABORTED: The return code is '',╞U ╪ DISPLAYπU ╪ ╕' °
*(1992 9 5 9 10 34 316) °
Ftestap ÉFX 'U╜testap W;B;D;S;T' °
'Σ Test for existence of specific AP"s' 'D╜''D'',■«■W╜,W' °
'T╜W ÉSVO■D' 'U╜0' '╕((^/B╜2=ÉSVO■D)doif ''T╜ÉEX■ D'')/0' °
'T╜''The following Auxilliary Processor'',(S╜1<+/~B)╞''s''' °
'T,(ε(S+1)╙'' is'' '' are''),'' not available'',(~B)/W' 'U╜1' °
X 'T╜ÉEX■D' °
XCuc 1 26 ABCDEFGHIJKLMNOPQRSTUVWXYZ °
XCul 0 ² °
*(1996 9 13 13 15 4 280) °
Fwarna ÉFX 'warna;T' 'Σ clear AP207 and explai' 'T╜ÉSVR ''D207''' °
X 'T╜ÉEX ''D207''' °
*(1996 9 13 13 15 21 348) °
Fwarnb ÉFX 'warnb;T' 'Σ clear AP207 and explain' °
'''WARNING: As you study this lesson, try to respond to all requests.' °
',r' °
'''Of course as in all these tutorials, you are encouraged to experime °
nt''' °
'''at any pause. When an AP 207 command is issued, there may be an int °
erval''' °
'''of a second or two of no action, followed by a flash on the screen. °
''' °
'''If the graphic screen does not appear you may invoke the Ctrl-Esc'' °
X' '''command to display any current AP 207 window.''' 'do' °
*(1996 9 13 13 15 29 380) °
Fwarning ÉFX 'warning;T' 'Σ clear AP207 and explain' 'warna' 'warnb' °
'''As in the previous lesson the function "test" is used to verify''' °
'''that a command given to AP207 was successful. The function returns' °
'' °
'''a nested vector. The first element of this vector may be nested.''' °
'''The take (╞) of this element contains the Return Code.'',r' °
'''WARNING! Do not issue a TEST command while there is a graphic''' °
'''window in the window list.'',r' °
'''(You may also wish to view function "test" at this point.)''' °
X 'end' °