59 lines
901 B
Text
59 lines
901 B
Text
DEFINE PTR="CARD"
|
|
|
|
PROC Append(CHAR ARRAY text,suffix)
|
|
BYTE POINTER srcPtr,dstPtr
|
|
BYTE len
|
|
|
|
len=suffix(0)
|
|
IF text(0)+len>255 THEN
|
|
len=255-text(0)
|
|
FI
|
|
IF len THEN
|
|
srcPtr=suffix+1
|
|
dstPtr=text+text(0)+1
|
|
MoveBlock(dstPtr,srcPtr,len)
|
|
text(0)==+suffix(0)
|
|
FI
|
|
RETURN
|
|
|
|
PROC Quibble(PTR ARRAY items INT count CHAR ARRAY result)
|
|
INT i
|
|
|
|
result(0)=0
|
|
Append(result,"(")
|
|
FOR i=0 TO count-1
|
|
DO
|
|
Append(result,items(i))
|
|
IF i=count-2 THEN
|
|
Append(result," and ")
|
|
ELSEIF i<count-2 THEN
|
|
Append(result,", ")
|
|
FI
|
|
OD
|
|
Append(result,")")
|
|
RETURN
|
|
|
|
PROC Test(PTR ARRAY items BYTE count)
|
|
CHAR ARRAY result(256)
|
|
|
|
Quibble(items,count,result)
|
|
PrintE(result)
|
|
RETURN
|
|
|
|
PROC Main()
|
|
PTR ARRAY items(5)
|
|
|
|
Test(items,0)
|
|
|
|
items(0)="ABC"
|
|
Test(items,1)
|
|
|
|
items(1)="DEF"
|
|
Test(items,2)
|
|
|
|
items(2)="G"
|
|
Test(items,3)
|
|
|
|
items(3)="H"
|
|
Test(items,4)
|
|
RETURN
|