home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
teachapl.zip
/
teach51.zip
/
TEACH51.ATF
Wrap
Text File
|
1996-10-09
|
70KB
|
852 lines
XNÉIO 0 1 °
XNÉCT 0 1.000000000000011E²13 °
XCÉFC 1 6 .,*0_² °
XNÉRL 0 1106878668 °
XCÉPR 0 °
XCÉLX 1 5 TEACH °
*(1996 9 9 20 1 53 432) °
FCOLRS ÉFX 'V COLRS W;A;B;C;M;R;S;T' 'Σ Test colors, mix and patterns' °
'╕(2=ÉSVO ''D207'')/L2 ╪ T╜ÉSVR ''D207'' ╪ T╜open ''COLORS, MIX and PA °
TTERNS''' 'L2:T╜(0=ÉNC ''V'')doif ''V╜0''' 'S╜100 480' °
'L0:╕(0=µ,W)/L1' 'C╜2╞(╞W) ╪ A╜S,50 50 0 360' °
'D207╜''MIX''(╞V)''COLOR''(1╙C)''PATTERN''(2╙C) ╪ T╜test' °
'D207╜''BEGAREA'' '''' ''ARC'' A ''ENDAREA'' '''' ╪ T╜test' °
'D207╜''color'' ''black'' ''arc'' A ╪ T╜test' 'S╜S+40 ²15' °
X 'V╜1ΦV ╪ W╜1╟W' '╕L0' 'L1:D207╜''view'' ''''' 'T╜æ' °
*(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' °
*(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' °
XNN 1 16 7 9 12 13 10 11 14 8 15 1 4 5 2 3 6 0 °
*(1996 8 13 14 8 5 256) °
FPAL ÉFX 'PAL;A;B;C;S;T' 'Σ Test colors in palette' °
'╕(2=ÉSVO ''D207'')/L1 ╪ T╜ÉSVR ''D207'' ╪ T╜open ''COLOR PALETTE''' °
'L1:S╜60 420 ╪ C╜colors' 'L0:D207╜''COLOR''(╞C) ╪ A╜S,50 50 0 360' °
'D207╜''BEGAREA'' '''' ''ARC'' A ''ENDAREA'' '''' ╪ T╜test' °
'D207╜''MOVE''(S-20 80)''COLOR'' ''BLACK'' ''WRITE''(╞C)''arc'' A ╪ T╜ °
Xtest' 'S╜S+40 ²15' '╕(0<µC╜1╟C)/L0' 'D207╜''view'' ''''' 'T╜æ' °
*(1996 9 12 19 38 25 476) °
FPALCOLS ÉFX 'V PALCOLS W;P;R;S;T' °
'Σ Display palette and color map table colors' 'S╜100 480 ╪ C╜colors' °
'╕(0=ÉNC ''M'')/0 ╪ ╕(0⌠ÉNC ''V'')/L0 ╪ V╜1' °
'L0:D207╜''COLMAP''(V,M[W;]) ╪ T╜test' °
'L1:D207╜''COLOR''(╞C) ╪ A╜S,50 50 0 360' °
'D207╜''BEGAREA'' '''' ''ARC'' A ''ENDAREA'' '''' ╪ T╜test' °
'D207╜''COLOR'' ''BLACK'' ''arc'' A ╪ T╜test' 'S╜S+40 ²15' °
'╕(0<µC╜1╟C)/L1' °
'D207╜''MOVE''(100 50)''WRITE''(ε''Note changes in '',colors[V+1],''(' °
X',(«M[W;]),'')'')' 'D207╜''view'' ''''' 'æ' °
*(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 9 19 17 35 57 612) °
FTEACH ÉFX 'TEACH' 'Σ Copyright Z V Jizba 1991; all rights reserved' °
'copyright' 'initialize' 'warning' 'do' 'TEACH1 Σ Using colors' °
'TEACH2 Σ The command COLMAP (PALETTE)' °
'TEACH3 Σ Changing colors of the COLOR MAP TABLE' °
'TEACH4 Σ The COLOR and CLEAR commands' °
'TEACH5 Σ Modyfying the COLOR MAP' 'TEACH6 Σ The command MIX' °
'TEACH7 Σ Logical operations on colors; the AND option' °
'TEACH8 Σ Using the OR option to modify overlapping colors' °
X 'TEACH9 Σ Erasing graphs using the Exclusive OR option' °
*(1996 10 3 13 45 36 492) °
FTEACH1 ÉFX 'TEACH1' 'Σ Using color' '''USING COLOR'',r' °
'''In the previous lessons we learned how to draw lines, how to write' °
'' °
'''text on the screen, and how to fill out areas with selected pattern °
s.''' °
'''All the examples up to now have produced displays in black and whit °
e.''' °
'''We will now study those commands that will produce colors.'',r' °
'''There are three basic colors: RED, GREEN and BLUE. The color that o °
ne''' °
'''sees on the screen is a combination of these three colors. This mix °
''' °
'''of colors is determined by a set of three values (integers in the'' °
' °
'''range of 0 to 1000). For example 1000 0 0 represents the most inten °
se''' °
'''color RED. Similarly 0 1000 0 would represent the purest GREEN.''' °
'''In the past, only two colors were used (0 0 0) and (1000 1000 1000) °
. The''' '''first one of these is BLACK, and the second is WHITE.''' °
'do' °
'''Colors can be represented by these integer triplets, or by color''' °
'''names. The AP207 supports 18 specific color names. BACKGROUND and'' °
' °
'''NEUTRAL are synonyms. The remaining 16 names make up the COLOR MAP. °
'',r' °
''' BACKGROUND BROWN DCYAN DGMAGENTA GREEN RED''' °
''' BLACK CYAN DGRAY DRED MAGENTA WHITE''' °
''' BLUE DBLUE DGREEN GRAY NEUTRAL YELLOW'',r' °
'''When AP 207 is first invoked, a default set of these colors is''' °
'''installed. These 16 colors can be changed but the process does not' °
X'' '''turn out to be very simple.''' 'end' °
*(1996 9 20 18 43 21 508) °
FTEACH2 ÉFX 'TEACH2;D207;T' 'Σ Color names' '''COLOR MAP'',r' °
'''As soon as AP207 becomes active, a special array called the''' °
'''"COLOR MAP" is generated. This array contains 16 rows and 5 columns °
.''' °
'''Each row corresponds to one of the 16 NAMED colors that can be disp °
layed''' °
'''on the screen. The color can be activated by one of three ways:'',r °
' ''' 1. by specifying the color NAME''' °
''' 2. by specifying the color NUMBER (in index origin 0)''' °
''' 3. by specifying the intensity of the three color components.'',r' °
'''To illustrate these three methods, we will display a table in which °
''' °
'''the colors are sorted by increasing intensity of their three color' °
'' °
'''components. Each color in this table lists the color name, followed °
by''' °
'''two (equal) integers. The first integer refers to the placement of °
the''' °
'''color in the COLOR MAP TABLE. The second integer is the color NUMBE °
R''' °
'''(of the COLOR MAP) associated with that color. (Note that these num °
bers''' °
'''range from 0 to 15.) The last three integers give the relative inte °
nsity''' °
'''(on a scale from 0 to 1000) of each of the three primary colors: re °
d,''' '''green and blue'',r' °
''' INITIAL COLOR MAP''' °
'''COLOR # red green blue COLOR # red green blue''' °
'''²²²²²²² ²²²²²²²²²²²²²²²²² ²²²²²²²² ²²²²²²²²²²²²²²²²²''' °
'(0 0 0(33 125 33))tab palette' 'do' °
'''Note that BLACK is defined by the absence of any color (0 0 0)''' °
'''while WHITE is defined by maximum intensity of all three colors''' °
'''(1000 1000 1000). Indeed, shades of gray can be represented by''' °
X '''setting all three colors to the same intensity.''' 'end' °
*(1996 9 14 18 4 8 276) °
FTEACH3 ÉFX 'TEACH3;M;T;D207' 'Σ Examples of colors and palette' °
'T╜open ''test''' °
'''So far we have discussed how colors are defined. Let us now look at °
''' °
'''them. Function PAL will display the 16 initial colors in the same'' °
' '''sequence as that shown on the previous table''' 'do' °
'show ''PAL''' °
'''Function COLRS can be used for a similar display, but is more versa °
tile.''' °
'''We will use this function to display the 16 initial colors in the'' °
' '''sequence in which they are defined in the COLOR MAP''' 'do' °
'show ''COLRS 0,∞15''' °
'''Clearly the two sets of colors can be matched.'',r' °
'''THE COMMAND COLMAP (PALETTE)'',r' °
'''WARNING! This command as described in the User''''s Guide (both the °
''' °
'''hard copy and the on-line documentation) does not always produce th °
e''' °
'''desired behavior. In this lesson, I discuss only those options that °
''' °
'''appear to work as described. To produce additional behavior, you ma °
y''' '''consider defining special utility functions.''' 'do' °
'''As we saw, COLOR MAP is an array of 16 rows showing the colors''' °
'''associated with the 16 named colors. There is also another table wi °
th''' °
'''a similar name. This table called the COLOR MAP TABLE contains 256' °
'' °
'''rows. The contents of this table are controlled by command COLMAP.' °
'' °
'''If initially we were to try to display rows of this table other tha °
n''' '''the first 16 we will just get a series of gray colors.''' 'do' °
'D207╜''clear'' '''' ╪ T╜test' 'show ''COLRS 15+∞16''' °
'''Let us experiment with the color map table. We want to find out if' °
'' °
'''changing the contents of the color map table affects the contents o °
f''' °
'''the COLOR MAP. We will use the command ''''COLMAP'''' to try to def °
ine a new''' '''color in row 16 of the COLOR MAP TABLE'',r' °
'show ''D207╜''''clear'''' '''''''' ''''colmap'''' (16 500 800 0) ╪ T╜ °
test''' 'show ''COLRS 15 16 17 18''' °
'''Having defined row 16, it appears that this definition affected as °
well''' °
'''all subsequent rows. Let us see what will happen if we define a new °
''' '''color in row 18 of the COLOR MAP TABLE'',r' °
'show ''D207╜''''clear'''' '''''''' ''''colmap'''' (18 0 800 500) ╪ T╜ °
test''' 'show ''COLRS 15 16 17 18 19''' °
'''Peculiar behavior. The COLOR MAP TABLE exists in APL2OS2, but defin °
ing''' °
'''a new color in row 18 appears to have spread also to row 17 and 19. °
The''' °
'''definition in row 16 remains unchanged. We will return to command'' °
' °
'''COLMAP again later. Before leaving this section, let us verify that °
the''' '''original COLOR MAP is still in effect''' 'do' °
'show ''PAL''' °
'''The original colors are still in effect. Furthermore, the new color °
s''' °
'''defined on rows 16 and 18 of the COLOR MAP TABLE remain unchanged.' °
X'' 'end' °
*(1996 9 14 18 5 57 476) °
FTEACH4 ÉFX 'TEACH4;A;T;D207' 'Σ The COLOR command' °
'''THE COLOR COMMAND'',r' °
'''If you examined functions PAL and COLRS, you would have noticed tha °
t''' °
'''these functions invoke the command COLOR. We will now study this''' °
'''command and return to command COLMAP later. We will begin with the' °
'' °
'''null string argument. According to the ON LINE USER''''S MANUAL, th °
is''' '''will return the color of the FOREGROUND.'',r' °
'T╜open ''COMMAND COLOR''' °
'show ''D207╜''''COLOR'''' '''''''''' ''DISPLAY test''' °
'''The foreground color is (7) or BLACK. Let us now set the foreground °
''' '''color to BLUE. This can be done using the color command.'',r' °
'show ''D207╜''''color'''' ''''BLUE'''''' ''D207╜''''view'''' '''''''' °
''' °
'''Since we have not drawn anything, the screen shows only the default °
''' °
'''background color. Let us now write some text, draw a circle and fil °
l''' '''a circular area with color''' 'do' °
'show ''D207╜''''BEGAREA'''' '''''''' ''''ARC''''(200 200 100 100 0 36 °
0) ''''ENDAREA'''' ''''''''''' °
'show ''D207╜''''MOVE''''(100 400) ''''WRITE'''' ''''BLUE WITH WHITE B °
ACKGROUND''''''' °
'show ''D207╜''''ARC'''' (400 200 100 100 0 360) ''''view'''' '''''''' °
''' °
'''The blue color foreground will be applied to all graphs, patterns a °
nd''' °
'''text until a new COLOR command is issued. There are three ways of'' °
' °
'''specifying a color. So far we have used only one, namely giving the °
''' °
'''color name. We can also specify the color number, or give the inten °
sity''' °
'''of the three color components. Noting that RED is #2 we issue the C °
OLOR''' '''command''' 'do' 'show ''D207╜''''COLOR'''' 2''' °
'show ''D207╜''''MOVE''''(100 500) ''''WRITE'''' ''''RED WITH WHITE BA °
CKGROUND''''''' 'show ''D207╜''''COLOR'''' (300 900 200)''' °
'show ''D207╜''''BEGAREA'''' '''''''' ''''ARC'''' (600 200 100 100 0 3 °
60) ''''ENDAREA'''' ''''''''''' 'show ''D207╜''''view'''' ''''''''''' °
'''Note that the color of the rightmost circle is GREEN (0 1000 0). Wh °
en a''' °
'''color in command COLOR is defined using the intensity of the three' °
'' °
'''primary colors, AP 207 selects from the COLOR MAP the one that most °
''' '''closely approaches the given intensities.''' 'do' 'TEACH4A' °
X 'end' °
*(1996 9 14 18 14 12 332) °
FTEACH4A ÉFX 'TEACH4A;A;T' 'Σ The CLEAR command' °
'''THE CLEAR COMMAND'',r' °
'''So far we have shown how to specify the FOREGROUND color. Can we do °
''' °
'''the same with the BACKGROUND color? The answer is YES, but setting °
the''' °
'''background color will also eliminate any and all graphs on the grap °
hic''' °
'''screen. We have erased graphs using the CLEAR command with a null'' °
' °
'''argument. By replacing the null argument with any one of the same'' °
' °
'''arguments used with the COLOR command, we can set the background co °
lor''' 'do' °
'show ''D207╜''''CLEAR'''' ''''YELLOW'''''' ''D207╜''''view'''' '''''' °
''''' °
'''The screen has been cleared, and the background is now YELLOW. One' °
'' °
'''might ask at this point. What if we issued the CLEAR command with a °
''' °
'''null argument. Do we get another YELLOW background, or do we get th °
e''' °
'''default white? As you can verify in the next example, a null argume °
nt''' '''will produce the default WHITE color.''' 'do' °
'show ''D207╜''''CLEAR'''' '''''''''' ''D207╜''''view'''' ''''''''''' °
'''Let us now try the other two methods for specifying background colo °
r''' 'do' °
'show ''D207╜''''CLEAR'''' 3'' ''D207╜''''view'''' ''''''''''' °
'''The color #3 is defined as MAGENTA, and this is now the background' °
'' '''color''' 'do' °
'show ''D207╜''''CLEAR'''' (1000 900 900)'' ''D207╜''''view'''' '''''' °
''''' °
'''As in the command COLOR, the specified intensities are matched with °
''' °
'''those of the COLOR MAP. In this case the match is WHITE (1000 1000 °
X1000)''' °
*(1996 10 3 14 26 16 340) °
FTEACH5 ÉFX 'TEACH5;M;T;D207' 'Σ Modifying the color map table' °
'''We now return to the command COLMAP. We begin by generating a table °
''' °
'''containing three columns with random numbers in the range 0-1000'', °
r' 'T╜open ''MODIFY COLOR TABLE''' 'show ''M╜?256 3µ1000''' °
'''We will use this array to re-define the COLOR MAP TABLE. But before °
we''' °
'''do that, let us specify two special colors in rows 17 and 18.'',r' °
'show ''M[17 18;]╜2 3µ487 337 80 1000 920 920''' °
'''The first color is a nice shade of brown. The second color is white °
''' °
'''with a pink tint. Now we can issue the command COLMAP giving M as i °
ts''' '''right argument''' 'do' °
'show ''D207╜''''COLMAP'''' M'' ''DISPLAY test''' °
'''This COLMAP command defines the COLOR MAP TABLE.'',r' °
'''We could have entered an array M with fewer than 256 rows. Had we d °
one''' °
'''that with say N rows, the color map table would have been changed o °
nly''' '''on the first N rows.'',r' °
'''Defining a new COLOR MAP TABLE also affects the COLOR MAP in the fo °
llowing''' °
'''way: For each named color, a search is made in the COLOR MAP TABLE °
for the''' °
'''row that most closely matches the DEFAULT color NAME definition. Th °
is row''' °
'''is then placed in the COLOR MAP. Let us see the newly defined COLOR °
MAP''' °
'''by invoking function PAL.(If by luck the newly defined WHITE become °
s other''' °
'''than (1000 1000 1000)-- you will note that the background color mat °
ches''' '''the NEW definition of WHITE.)''' 'do' 'show ''PAL''' °
'''We can also look at the first 16 colors of the randomly generated'' °
' '''COLOR MAP TABLE''' 'do' 'show ''COLRS 0,∞15''' °
'''The colors in the color map table do not match those of the COLOR M °
AP.''' '''Let us also look at the colors of the next 16 rows.''' 'do' °
'show ''COLRS 15+∞16''' °
'''It should be pointed out also that the newly defined COLOR MAP''' °
'''now differs from the array M in its first 16 rows.'',r' °
'show ''M[∞16;]''' '(0 0 0(33 125 33))tab palette' 'do' °
'''Although the on line User''''s Guide describes the effect of using °
a''' °
'''null argument with COLMAP, I find that it does not work (I get a re °
turn''' °
'''code of 39 -- Invalid parameter). I also find that although a ²1''' °
'''argument to COLMAP appears to work, it causes some unknown changes °
that''' '''may make functions PAL and COLRS inoperable.''' 'do' °
'''Can we restore the original COLOR MAP? We can do it with the utilit °
y''' °
'''function "colmap". This function generates the initial colors(or do °
es it?).'',r' °
'show ''M[∞16;]╜colmap ╪ D207╜''''COLMAP'''' M ╪ T╜test''' °
'show ''PAL''' °
'''Note that even though we have specified only a display of the COLOR °
''' °
'''MAP, the color changes also apply to that portion of the graph that °
''' '''shows the first 16 rows of the COLOR MAP TABLE.'',r' °
'''Finally, let us see how the CLEAR command behaves if we use the num °
ber''' °
'''18. (Recall that we defined this row as white with a pink tinge)''' °
'do' 'show ''D207╜''''clear'''' 17'' ''D207╜''''view'''' ''''''''''' °
X 'end' °
*(1996 10 3 14 9 59 444) °
FTEACH6 ÉFX 'TEACH6;T;N;D207;P' 'Σ The MIX command' °
'N╜7 9 12 13 10 11 14 8 15 1 4 5 2 3 6 0' '''THE COMMAND MIX''' °
'''So far we have treated colors as if they were opaque to any previou °
s''' °
'''condition of the graphic screen. Function PAL illustrates well this °
''' °
'''effect. Each circle that overlies a previously drawn circle ignores °
''' '''the previously drawn color.''' 'T╜open ''MIXING COLORS''' 'do' °
'show ''PAL''' °
'''The command MIX provides the facility of mixing colors. If a new co °
lor''' °
'''is drawn on top of a previously drawn color, a new color is produce °
d.'',r' °
'''There are four ways of doing this. The default is obviously NOT to °
mix.''' °
'''We can find out what this default is by applying a null string to t °
he''' '''MIX argument''' 'do' °
'show ''D207╜''''MIX'''' '''''''' ╪ DISPLAY test''' °
'''Therefore a zero right argument to MIX will make subsequent colors' °
'' °
'''opaque. Actually, the color MIX MUST BE INVOKED BEFORE EACH applica °
tion''' °
'''of a color. If this invocation is not made, the MIX automatically r °
eturns''' '''to OPAQUE.'',r' °
'''We will use function COLRS to study the arguments to command MIX. S °
o far''' °
'''we have invoked COLRS only with a numeric vector right argument. Ac °
tually''' °
'''this function is ambivalent. A left argument can include a numeric °
scalar''' °
'''or a vector consisting of integers from the set {0,1,2,3}. These va °
lues''' °
'''are interpreted as arguments to command MIX. In addition, the right °
''' °
'''argument can be a vector of vector pairs, where the second element °
of''' °
'''each pair represents the FILL PATTERN to be used. Here is an examp °
le''' '''of using these options with function COLRS.''' 'do' °
'show ''D207╜''''clear'''' '''''''' ╪ 0 2 2 COLRS ((16µ1 5 13 14),■∞16 °
)''' °
'''We will explain in the next section why only some circles show on t °
his''' °
'''display despite the fact we specified 16 colors. Also note that the °
''' °
'''fill patterns appear to depend on the superposition of 16 circles.' °
X'' 'end' °
*(1996 9 17 18 21 26 428) °
FTEACH7 ÉFX 'TEACH7;T;N;D207;P' 'Σ The MIX command' °
'''Before describing in detail how function MIX works, let us see an e °
xample.''' °
'''First, we define N such as to reproduce the colors in the same sequ °
ence''' '''as in function PAL.''' 'T╜open ''MIXING COLORS''' 'do' °
'show ''N╜7 9 12 13 10 11 14 8 15 1 4 5 2 3 6 0''' °
'''Note that this vector is in the sequence of columns 1 and 2 of the' °
'' '''initial COLOR MAP'',r' '(0 0 0(33 125 33))tab palette' 'do' °
'show ''PAL''' °
'''We will now invoke function COLRS with left argument 1 and right ar °
gument N.''' °
'''Note that despite the confusion of colors, the color of the upper r °
ight''' °
'''hand wedge matches the colors of the circles generated by function °
PAL.''' 'do' 'show ''1 COLRS N''' '''LOGICAL OPERATIONS ON COLORS'',r' °
'''The User''''s Manual describes the right argument of 1 to MIX in th °
e''' °
'''following way: "Pels to be written are ANDed with existing pels." I °
f''' °
'''this is confusing, welcome to the club. The logical operations of A °
ND''' °
'''OR and NOT are normally associated with BOOLEAN variables. However, °
''' °
'''in dealing with colors, we are dealing with integers in the range'' °
' °
'''{0,1000}. So what does the operation AND mean? Those of you who hav °
e''' °
'''studied FUZZY SETS, have in fact come across the use of logical''' °
'''operations on numeric quantities.''' 'do' °
'''In FUZZY SET theory given two numbers M and N, the operation AND im °
plies''' °
'''selecting the smaller of the two values, while the operation OR imp °
lies''' °
'''selecting the larger of the two values. I do not know for sure if t °
his''' °
'''is the way MIX works, but at least it explains some of the results. °
''' °
'''Let us take another look at the COLOR MAP table and see if we can p °
redict''' °
'''the color combinations where command 1 (AND) will produce BLACK.'', °
r' '(0 0 0(33 125 33))tab palette' °
'r,''Inspecting this table we find five consecutive rows that produce °
(0 0 0)''' '''on a FUZZY AND operation '',r' °
'''BLACK and DBLUE (0 0 0)AND(0 0 502)╕(0 0 0)''' °
'''DBLUE and DGREEN (0 0 502)AND(0 502 0)╕(0 0 0)''' °
'''DCYAN and DRED (0 502 502)AND(502 0 0)╕(0 0 0)''' °
'''BLUE and GREEN (0 0 1000)AND(0 1000 0)╕(0 0 0)''' °
'''CYAN and RED (0 1000 1000)AND(1000 0 0)╕(0 0 0)''' 'do' °
'''Let us take another look at the command ''''MIX'''' 1 as invoked by °
COLRS.''' °
'''Note that it is precisely these color combinations that show up as °
BLACK''' 'do' °
'show ''D207╜''''clear'''' '''''''' ╪ T╜test ╪ 1 COLRS N''' °
'''When two or more colors are AND mixed, the color intensities are''' °
'''compared, and the smaller of each primary colors are selected. As a °
''' °
'''result, such matching produces generally darker (even black) colors °
X.''' 'end' °
*(1996 9 18 19 24 41 508) °
FTEACH8 ÉFX 'TEACH8;T;D207;P' 'Σ The MIX command' °
'''THE COMMAND MIX WITH ARGUMENT 2 (OR)'',r' °
'N╜7 9 12 13 10 11 14 8 15 1 4 5 2 3 6 0' °
'''We have seen that ''''MIX'''' 1 combines colors by selecting the sm °
aller''' °
'''value for each color. The command ''''MIX'''' 2 (OR) should select °
the''' °
'''larger value for each color. We will now invoke function COLRS with °
''' °
'''a left argument 2 and as before the right argument N. But before yo °
u''' °
'''press ENTER to see the result, pause and see if you can predict wha °
t''' '''colors you will see on the screen.'',r' °
'''HINT: the background color is WHITE (1000 1000 1000).''' °
'T╜open ''MIXING COLORS''' 'do' 'show ''2 COLRS N''' °
'''On an OR mixing, the WHITE background (1000 1000 1000) dominates al °
l''' °
'''other colors. To see how the ''''MIX'''' 2 command works we will fi °
rst''' '''draw the 16 overlapping circles to the color RED (2)''' 'do' °
'show ''D207╜''''clear'''' '''''''' ╪ T╜test ╪ COLRS (16µ2)''' °
'''We can now superimpose on this array of overlapping circles the col °
ors''' °
'''of the COLOR MAP. But first, let us try to predict what colors shou °
ld''' °
'''be seen. We can do that by looking at the default color definitions °
'',r' '(0 0 0(33 125 33))tab palette' °
'r,''Since the background is RED (1000 0 0) we can try to predict the °
areas''' '''where the resulting color should be RED or WHITE:'',r' °
'''RED or BLACK should return RED (1000 0 0)OR(0 0 0)╕(1000 0 0)╕RED'' °
' '''RED or DRED should return RED (1000 0 0)OR(502 0 0)╕(1000 0 0)''' °
'''RED or BLUE or GREEN (1000 0 0)OR(0 0 1000)OR(0 1000 0)╕(1000 1000 °
1000)''' °
'''RED or GREEN or CYAN (1000 0 0)OR(0 1000 0)OR(0 1000 1000)╕WHITE''' °
'''RED or CYAN (1000 0 0)OR(0 1000 1000)╕(1000 1000 1000)''' °
'''RED or MAGENTA or (YELLOW) (1000 0 0)OR(1000 0 1000)OR(1000 1000 0) °
╕WHITE''' 'do' 'show ''2 COLRS N''' °
'''Since OR selects the larger intensities, the resulting colors are l °
Xighter''' '''than the originals.''' 'end' °
*(1996 9 19 17 27 11 396) °
FTEACH9 ÉFX 'TEACH9;N;T;D207' 'Σ Using the Exclusive OR option' °
'''THE EXCLUSIVE OR'',r' 'N╜7 9 12 13 10 11 14 8 15 1 4 5 2 3 6 0' °
'''According to the on line User''''s Guide the argument 3 stands for °
the''' '''EXCLUSIVE OR:'',r' °
''' "Pels to be written are exclusive ORed with existing pels. This ca °
n''' °
''' be used to move objects around, since writing the same object bac °
k''' °
''' into the same position in this mode restores the original screen, °
''' ''' making the object disappear."'',r' °
'''The sense is quite clear, but the actual process is not. My suggest °
ion''' °
'''to IBM is to include a reference in the above explanation to a docu °
ment''' °
'''(if such exists) that gives a detailed algorithm of this process.'' °
' 'T╜open ''MIXING COLORS''' 'do' °
'''First, let us show that the process is very specific to the manner °
in''' °
'''which the graphical object is generated. The first example shows th °
at''' °
'''a graph produced using different MIX commands will NOT be erased''' °
'do' °
'show ''D207╜''''clear'''' '''''''' ╪ T╜test ╪ COLRS N ╪ 3 COLRS N''' °
'''On the first pass the 16 colors were drawn as opaque (''''MIX'''' 0 °
). On''' °
'''the second pass the same colors were drawn using the EXCLUSIVE OR ( °
3)''' '''The result is anything but a background white.'',r' °
'''In the next example the SAME graph (3 COLRS N) is issued TWICE. On °
the''' '''second pass the graph is erased as expected''' 'do' °
'show ''D207╜''''clear'''' '''''''' ╪ T╜test ╪ 3 COLRS N ╪ 3 COLRS N'' °
' °
'''One question that must be answered is whether the clearing process °
will''' °
'''produce a WHITE result, or the BACGROUND color whatever this may be °
.''' 'do' °
'show ''D207╜''''clear'''' 3 ╪ T╜test ╪ 3 COLRS N ╪ 3 COLRS N''' °
'''Clearly the EXCLUSIVE or keeps track of the background color. It is °
''' °
'''this process that is not clearly explained in the User''''s Guide.' °
X'' 'end' '''This is the end of lesson 51''' °
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]' °
*(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' °
Ac╜('BLACK')('DBLUE')('DGREEN')('DCYAN')('DRED')('DMAGENTA')('BROWN')(' °
GRAY')('DGRAY')('BLUE')('GREEN')('CYAN')('RED')('MAGENTA')('YELLOW')('W °
XHITE') °
*(1996 8 13 14 3 20 296) °
XFclose ÉFX 'close' 'Σ Close AP 207' 'T╜ÉSVR ''D207'' ╪ T╜ÉEX ''D207''' °
*(1996 9 12 18 3 37 380) °
Fcolmap ÉFX 'U╜colmap;C;D;T;D207' °
'Σ Returns an array of 16 color definitions' 'C╜colors ╪ U╜0 5µ0' °
'╕(D╜2=ÉSVO ''D207'')/L0 ╪ T╜open ''PALETTE''' °
'L0:D207╜''COLOR''(╞C) ╪ T╜╞2πtest ╪ D207╜''COLMAP'' T ╪ U╜U,[1]2πtest °
X' '╕(0<µC╜1╟C)/L0' 'U╜U[;3 4 5]' 'T╜ÉSVR ''D207'' ╪ T╜ÉEX ''D207''' °
Acolors╜('BLACK')('DBLUE')('DGREEN')('DCYAN')('DRED')('DMAGENTA')('BROW °
N')('GRAY')('DGRAY')('BLUE')('GREEN')('CYAN')('RED')('MAGENTA')('YELLOW °
X')('WHITE') °
*(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 °
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 8 12 13 36 9 376) °
Ferase ÉFX 'erase;t;b;DISPLAY;DOS;GO;FRAME;SVOFFER;COLRS;PAL;PALCOLS' °
'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 12 D:\APL2\AVF\ °
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' °
*(1992 10 25 11 14 30 408) °
Fgetfont ÉFX 'getfont W;A;N;F' 'Σ retrieve fonts 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)' '╕L0' °
*(1996 9 20 18 13 33 436) °
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╜''C:\APL2\WORK\''' 'fpath╜''C:\APL2\AVF\''' °
'fonts╜''GOTENG'' ''GOTGER'' ''GOTITA'' ''GRESER'' ''GRESIM'' ''MARKER °
S''' °
'fonts╜fonts,''MODSIM'' ''ROMDUP'' ''ROMDUPF'' ''ROMITA'' ''ROMITAB''' °
'fonts╜fonts,''ROMSER'' ''ROMSERB'' ''ROMSIM'' ''ROMSIMM'' ''SANSER''' °
'fonts╜fonts,''SANSERF'' ''SCRIPT'' ''THKRNDF'' ''THKRNDO'' ''THKSQUF' °
' ''THKSQUO''' °
'colors╜''BLACK'' ''DBLUE'' ''DGREEN'' ''DCYAN'' ''DRED'' ''DMAGENTA'' °
''BROWN''' °
'colors╜colors,''GRAY'' ''DGRAY'' ''BLUE'' ''GREEN'' ''CYAN'' ''RED''' °
'colors╜colors,''MAGENTA'' ''YELLOW'' ''WHITE''' °
'''The current path to font image files (extension .AVF) is '',fpath' °
'T╜1 get ''Enter new path if incorrect, else press Enter: ''' °
X 'T╜(0<µT)doif ''fpath╜T''' °
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 9 20 18 12 4 316) °
Finitialize ÉFX 'initialize;t' °
'Σ 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 2 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 13 11 30 19 388) °
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 " °
*(1996 9 8 23 49 43 592) °
Fpalette ÉFX 'U╜palette;C;D;T' °
'Σ Returns an array of 16 color definitions' 'C╜colors ╪ U╜0 5µ0' °
'╕(D╜2=ÉSVO ''D207'')/L0 ╪ T╜open ''PALETTE''' °
'L0:D207╜''COLOR''(╞C) ╪ T╜╞2πtest ╪ D207╜''COLMAP'' T ╪ U╜U,[1]2πtest °
' '╕(0<µC╜1╟C)/L0 ╪ U╜(πcolors),'' '',«U ╪ ╕D/0' °
X 'T╜ÉSVR ''D207'' ╪ T╜ÉEX ''D207''' °
XCpath 1 13 C:\APL2\WORK\ °
*(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 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 9 9 20 2 6 248) °
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 9 20 10 19 332) °
Fwarna ÉFX 'warna;T' 'Σ clear AP207 and explai' 'T╜ÉSVR ''D207''' °
X 'T╜ÉEX ''D207''' °
*(1996 9 9 20 10 55 476) °
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 7 12 12 20 34 404) °
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' °