3 THEN
016 s=r;CALL DKCNV(s,1,0);r.prefix=REPT:s
017 END ELSE r.prefix="";r=1
018 END;s=SEQ(c);IF s>=128 THEN
019 s=s-128;c=CHAR(s);IF QBIN#"" THEN r.prefix=r.prefix:QBIN
020 END;IF s<=31 OR s=127 THEN CALL DKCTL(c);c=SQCTL:c ELSE
021 IF c=SQCTL THEN c=SQCTL:SQCTL ELSE
022 IF QBIN#"" AND c=QBIN THEN c=SQCTL:QBIN
023 IF c=REPT THEN c=SQCTL:REPT
024 END;END;c=r.prefix:c;lc=LEN(c);test.len=p+lc
025 IF test.len>MAXL THEN GO 5 ELSE data=data:c;l=l+r;p=test.len
026 REPEAT;IF l=0 THEN l=-1
027 5 PACKET=MARK:CHAR(p+30):CHAR(PKT.SEQ+32):TYPE:data
028 CHECK=0;CALL DKCHECK(CHECK);STATUS=(CHECK#"")*l;RETURN
029 * * * * * Interface info * * * * *
030 *Entry: TYPE := Protocol packet type or Yx where:
031 * x=S means Send-init ack packet
032 * x=I " server Init ack, or
033 * x=A " file Attribute ack.
034 * PACKET := contains DATA field of packet
035 *
036 *Exit: STATUS := >0 means length of packet
037 * 0 " packet cannot be checksumed
038 * <0 " data field is nul
039 * * * * * Revision history * * * * *
040 *.0 - 7/21/87 JF3
041 END
DKRCVT
001 *DUMMY
002 *Subroutine list for DKRCVt type subs
003 *4/1/87 JF3 0.3.0
004 *]DKRCVS]DKRCVF]DKRCVA]DKRCVD]DKRCVZ]DKRCVB
005 END
DKDPKT
001 SUBROUTINE (STATUS)
002 *Decode a packet
003 *1/29/87 JF3 0.3.0
004 *]DKCNV]DKDBUG
005 COM X1(5),DATA,X2(3),DEBUG.MODE,X3(11),QCTL,QBIN,CHKT,REPT
006 EQU L TO STATUS
007 PACKET=DATA;DATA="";L=0;R=0;BIT8=0;LOOP GOSUB 6 UNTIL C="" DO
008 BEGIN CASE
009 CASE C=REPT;IF R THEN GO 9 ELSE GOSUB 6;CALL DKCNV(C,-1,0);R=C
010 CASE C=QBIN;IF BIT8 THEN GO 9 ELSE BIT8=1
011 CASE C=QCTL;GOSUB 6;BEGIN CASE
012 CASE C=QCTL;CASE C=QBIN;CASE C=REPT
013 CASE 1;C=CHAR(SEQ(C)-64)
014 END CASE;GO 4
015 CASE 1
016 4 IF BIT8 THEN C=CHAR(SEQ(C)+128);BIT8=0;*SM invalid for file data!
017 IF R THEN C=STR(C,R);R=0
018 DATA=DATA:C
019 CASE 0
020 6 L=L+1;C=PACKET[L,1];RETURN
021 END CASE
022 REPEAT;L=L-1;IF L=0 THEN L=-1
023 IF DEBUG.MODE THEN
024 R=L;STATUS="D";PACKET=DATA;C=LEN(DATA)+2+CHKT;CALL DKCNV(C,1,0)
025 DATA=CHAR(0):C:" ":DATA:STR(" ",CHKT);CALL DKDBUG(STATUS)
026 DATA=PACKET;L=R;END;8 RETURN
027 9 STATUS=0;GO 8
028 * * * * * Interface info * * * * *
029 *Entry: DATA contains received packet data field
030 *
031 *Exit: DATA contains expanded data
032 * * * * * Revision history * * * * *
033 *.0 1/29/87 JF3
034 END
DKcnv
001 *DUMMY
002 *Subroutine list for custom parameter conversion routines
003 *7/14/87 JF3 0.3
004 *]DKDF]DKFA
005 END
DKVERC
001 SUBROUTINE (STATUS)
002 *VERify a command as valid
003 *6/25/87 JF3 0.3.0
004 *]DKPARSE]DKIO
005 COM X1(5),data,X2(5),PARAMS,X3(52),i(3)
006 EQU CMD TO STATUS,ok TO STATUS,c TO i(1)
007 IF CMD[1,1]="!" THEN CMD=CMD[2,99];c=1 ELSE
008 MAT i=0;CALL DKPARSE(CMD,2)
009 END;IF c THEN
010 data="DK":CMD;v=1;ok=0;LOOP conv.code=PARAMS<14,v> UNTIL conv.code="" DO
011 ok=(PARAMS<15,v>=OCONV(data,conv.code))
012 IF ok THEN GO 9 ELSE v=v+1
013 REPEAT;data="DKverb: ":data
014 END ELSE data="command: ":CMD
015 data=INSERT(data,1,0,0,"K1");STATUS="!";CALL DKIO(STATUS);STATUS=-1
016 9 RETURN
017 * * * * * Interface info * * * * *
018 *Entry : CMD := all caps command token
019 *
020 *Exit: STATUS := -1 invalid command
021 * 1 means command ok; DKcommand in data
022 * * * * * Revision history * * * * *
023 *.0 - 6/25/87 JF3
024 END
DKRCVA
001 SUBROUTINE (STATUS)
002 *Receive a file Attribute packet -- NOT USED in 0.3
003 *7/14/87 JF3
004 *]DKCNV]DKAnn
005 COM X1(5),DATA,X2(5),PARAMS;EQU AM TO CHAR(254),OK TO STATUS
006 DIM ack.attrs(2);MAT ack.attrs=""
007 s=1;LOOP ATTR=DATA[s,1] UNTIL ATTR="" DO
008 attr.no=ATTR;CALL DKCNV(attr.no,-1,0)
009 sLENGTH=DATA[s+1,1];CALL DKCNV(sLENGTH,-1,0);sDATA=DATA[s+2,sLENGTH]
010 p=11;LOOP
011 * LOCATE attr.no IN PARAMS,1 SETTING w ELSE w=-1;*Microdata/Ultimate
012 LOCATE(attr.no,PARAMS
;w) ELSE w=-1; *PICK
013 IF w>0 THEN
014 IF p=11 THEN
015 subroutine="DKA":(100+attr.no)[2,2];STATUS=sDATA
016 CALL @subroutine(STATUS);IF STATUS>1 THEN w=OK ELSE w=NOT(OK)
017 END ELSE w=0
018 END ELSE
019 IF p=12 THEN w=2
020 END
021 WHILE w=-1 DO p=p+1 REPEAT
022 IF w THEN ack.attrs(w)=ack.attrs(w):ATTR
023 s=s+2+sLENGTH;REPEAT;IF ack.attrs(1)="" THEN DATA="Y";w=2 ELSE DATA="N";w=1
024 DATA=DATA:ack.attrs(w);STATUS=1;RETURN
025 * * * * * Interface info * * * * *
026 *Entry: DATA := File Attribute packet per Kermit Protocol Manual
027 * each DATA field containing (optionally) many subfields
028 *
029 *Exit: DATA := data field of ack packet
030 *
031 *Uses: ack.attrs(1) := N{xxx} list
032 * (2) := Y{xxx} list
033 * * * * * Revision history * * * * *
034 *.0 - 7/14/87 JF3
035 END
DKSET
001 SUBROUTINE (STATUS)
002 *SET kermit parameters
003 *7/24/87 JF3 0.3.0
004 *]DKCNV]DKPARSE]DKIO]GTRMCHR
005 COM P(64),i(3);EQU SPACE TO " ",a TO i(1),v TO i(2),s TO i(3)
006 EQU CMD.LINE TO P(1),ERR TO P(3),PAR.LIST TO P(12),DICT.DK TO P(15)
007 EQU MSG TO P(6),help.request TO i(2);par=OCONV(CMD.LINE<1>,"G1 1")
008 help.request=(par="?");IF help.request THEN
009 * Get terminal width below
010 CALL GTRMCHR(MSG);s=INT(OCONV(MSG<4>,"G,1")/2);s="L#":s
011 v=1;MSG="";LOOP GOSUB 10 UNTIL par="" DO
012 GOSUB 10;STATUS=-1;CALL DKIO(STATUS);MSG=""
013 REPEAT;STATUS=1
014 END ELSE
015 a=2;v=0;CALL DKPARSE(par,12);IF v THEN
016 IF PAR.LIST<8,v>="" THEN p=2 ELSE
017 p=3;a=8;subpar=OCONV(CMD.LINE<1>,"G2 1");CALL DKPARSE(subpar,12)
018 IF NOT(s) THEN MSG="subparameter: ":subpar;GO 4
019 END;arg=OCONV(CMD.LINE<1>,"G":p:" 99");cnv=PAR.LIST<5,v>
020 IF NOT(NUM(cnv)) THEN cnv<1,2>="1"
021 idx=PAR.LIST<3,v>;idx<2>=PAR.LIST<9,v,s>
022 CALL DKCNV(arg,cnv,idx);IF arg="!!!" THEN
023 P(6)=cnv;CALL DKIO("!");STATUS=-1
024 END ELSE STATUS=1
025 END ELSE
026 MSG="parameter: ":par
027 4 MSG=INSERT(MSG,1,0,0,"K1");CALL DKIO("!");STATUS=-1
028 END
029 END;RETURN
030 10 par=PAR.LIST<2,v>;MSG=MSG:(par:SPACE:PAR.LIST<6,v>)s
031 v=v+1;RETURN
032 * * * * * Interface info * * * * *
033 * Entry:
034 * CMD.LINE := SET [parameter {subparameter }value]
035 * [? ]
036 *
037 * Exit:
038 * STATUS := 1 means finished ok
039 * * * * * Revision history * * * * *
040 *.0 - 7/14/87 JF3
041 END
DKRETRY
001 SUBROUTINE (status)
002 *increment RETRY counter and check against limit
003 *7/21/87 JF3 0.3
004 *]DKERR]DKFPKT]DKIO
005 COM X1(8),LIMIT,X2(27),r;EQU OK TO status,AM TO CHAR(254)
006 r=r+1;IF r32 THEN STATUS=0
008 END ELSE STATUS=1
009 RETURN
010 * * * * * Interface info * * * * *
011 *See DKAnn
012 * * * * * Revision history * * * * *
013 *.0 - 7/14/87 JF3
014 END
DKSTOR
001 SUBROUTINE (STATUS)
002 *STOre received Record into system
003 *10/22/88 JF3 0.3.0
004 *
005 COM X1(29),MAX.REC.LEN,X2(3),PICK.file.type,a,RECORD,X3(5)
006 COM ITEM,X4(3),DATAFILE,X5(16),F.FORMAT
007 IF MAX.REC.LEN AND LEN(RECORD)>MAX.REC.LEN THEN STATUS=0 ELSE
008 * Undefined if DATAFILE is null; should be fixed!
009 IF DATAFILE="" THEN
010 BEGIN CASE
011 CASE DISP="";GO 5
012 CASE DISP="O";CASE DISP="S"
013 CASE DISP="P";GO 30
014 CASE DISP="T";GO 20
015 CASE DISP="L";CASE DISP="X"
016 CASE DISP="A";GO 10
017 END CASE
018 END ELSE
019 BEGIN CASE
020 CASE PICK.file.type=0
021 5 IF F.FORMAT="I" THEN ITEM=ITEM:RECORD ELSE ITEM=RECORD
022 CASE PICK.file.type=1
023 10 *Put RECORD to catalog space
024 CASE PICK.file.type=2
025 20 *Put RECORD into ABS space
026 CASE PICK.file.type=3
027 30 PRINTER ON;PRINT RECORD;PRINTER OFF;RETURN
028 END CASE
029 END;a=a+1;RECORD="";STATUS=1
030 END;RETURN
031 * * * * * Interface info * * * * *
032 * * * * * Revision history * * * * *
033 *.0 - 10/22/88 JF3
034 END
DKA02
001 SUBROUTINE (STATUS)
002 *check received Attribute 2 (type) -- NOT USED in 0.3
003 *7/21/87 JF3
004 *
005 COM X1(63),Type
006 EQU DATA TO STATUS
007 type=DATA[1,1];STATUS=1
008 BEGIN CASE
009 CASE type="A"
010 CASE type="B"
011 CASE type="D"
012 CASE type="F"
013 CASE type="I"
014 CASE 1;STATUS=0;GO 9
015 END CASE;arg=DATA[2,l];IF l=1 THEN
016 IF NUM(arg) THEN cnv=0 ELSE cnv=-1
017 CALL DKCNV(arg,cnv,ix)
018 END;8 STATUS=1;9 RETURN
019 * * * * * Interface info * * * * *
020 *See DKAnn
021 * * * * * Revision history * * * * *
022 *.0 - 7/21/87 JF3
023 END
DKRCVD
001 SUBROUTINE (STATUS)
002 *ReCeiVe a Data packet
003 *10/22/88 JF3 0.3.0
004 *]DKDPKT]DKSTOR
005 COM X1(5),DATA,X2(23),MAX.REC.LEN,p1,len.REC.TERM,X3(2),a,record
006 COM X4(6),REC.TERMINATION,X5(18),l,F.FORMAT,X6;EQU OK TO STATUS
007 EQU REC.SIZE.LEN TO REC.TERMINATION,REC.SIZE TO REC.TERMINATION
008 IF a=1 THEN
009 BEGIN CASE
010 CASE F.FORMAT="";GO 1;F.FORMAT="A";REC.TERMINATION="";GO 2
011 CASE F.FORMAT="A";GO 2
012 CASE F.FORMAT="D";len.REC.TERM=0
013 CASE F.FORMAT="F";len.REC.TERM=0;p1=1;l=REC.SIZE
014 CASE 1
015 1 F.FORMAT="A";REC.TERMINATION=CHAR(13):CHAR(10)
016 2 len.REC.TERM=LEN(REC.TERMINATION);p1=1
017 END CASE
018 END;CALL DKDPKT(STATUS);rec.complete=0
019 IF F.FORMAT="A" THEN DATA=record:DATA
020 LOOP
021 IF F.FORMAT="I" THEN record=DATA;DATA="";rec.complete=1 ELSE
022 len.DATA=LEN(DATA);BEGIN CASE
023 CASE F.FORMAT="A"
024 p2=INDEX(DATA,REC.TERMINATION,1);record=""
025 IF p2 THEN rec.complete=1;p2=p2-1 ELSE p2=len.DATA
026 CASE F.FORMAT="D"
027 IF l THEN p1=1 ELSE
028 l=DATA[1,REC.SIZE.LEN]-REC.SIZE.LEN;p1=REC.SIZE.LEN+1
029 END;GO 3
030 CASE F.FORMAT="F"
031 3 rec.complete=(l<=len.DATA);p2=l
032 END CASE;record=record:DATA[p1,p2]
033 DATA=DATA[p1+p2+len.REC.TERM,9999]
034 END
035 UNTIL DATA="" DO
036 GOSUB 5;IF NOT(OK) THEN GO 9
037 REPEAT;IF rec.complete THEN
038 5 CALL DKSTOR(STATUS);IF OK THEN
039 rec.complete=0;IF F.FORMAT="F" THEN l=REC.SIZE ELSE l=0
040 END
041 END ELSE l=l-(len.DATA-(p1-1));STATUS=1
042 9 RETURN
043 * * * * * Interface Info * * * * *
044 *Uses: l Set to 0 by DKRCVF; generally means # chars
045 * remaining to complete a record.
046 * * * * * Revision history * * * * *
047 *.0 - 10/22/88 JF3
048 END
DKSHOW
001 SUBROUTINE (STATUS)
002 *SHOW parameters somewhere
003 *8/7/87 JF3 0.3.0
004 *]DKCNV]DKPARSE]DKIO
005 COM P(64),i(3);EQU a TO i(1),p TO i(2),s TO i(3)
006 EQU CMD.LINE TO P(1),MSG TO P(6),PAR.LIST TO P(12),REMOTE.CTRL TO P(40)
007 EQU cr TO CHAR(13),lf TO CHAR(10);CALL GTRMCHR(MSG);MSG=MSG<4>
008 LINES.PAGE=FIELD(MSG,",",2);CHARS.LINE=FIELD(MSG,",",1)+1;P(41)="ALL"
009 COLS=INT(CHARS.LINE/26);a=2;s=0
010 FMT="L#":INT((CHARS.LINE-1)/COLS); *Microdata/PICK
011 *FMT="L(#":INT((CHARS.LINE-1)/COLS):")";*Ultimate
012 I.PARAM=FIELD(CMD.LINE<1>," ",2);STATUS=1;L=1;C=1;p=0;t=999
013 CALL DKPARSE(I.PARAM,12);IF p THEN
014 SUB.PARAM=FIELD(CMD.LINE<1>," ",3);IF SUB.PARAM#"" THEN
015 a=8;CALL DKPARSE(SUB.PARAM,12)
016 IF s THEN t=s;GOSUB 11 ELSE MSG="subparameter: ":SUB.PARAM;GO 6
017 END ELSE GOSUB 10
018 END ELSE
019 a=1;p=0;CALL DKPARSE(I.PARAM,41);IF p THEN
020 p=0
021 LOOP p=p+1;I.PARAM=PAR.LIST<2,p> UNTIL I.PARAM="" DO GOSUB 10 REPEAT
022 END ELSE
023 MSG="parameter: ":I.PARAM
024 6 MSG=INSERT(MSG,1,0,0,"K1");STATUS="!";GO 20
025 END
026 END;9 MSG="";STATUS=-1;GO 20
027 10 s=1;11 index=-PAR.LIST<3,p>;cnv=PAR.LIST<5,p>
028 IF NUM(cnv) THEN cnv=-cnv ELSE cnv<1,2>="-1"
029 LOOP SUB.PARAM=PAR.LIST<8,p,s> UNTIL (SUB.PARAM="" AND s>1) OR s>t DO
030 IF SUB.PARAM#"" THEN index<2>=PAR.LIST<9,p,s>;SUB.PARAM=" ":SUB.PARAM
031 SUB.PARAM=SUB.PARAM:"=";CALL DKCNV(arg,cnv,index)
032 IF L>LINES.PAGE AND REMOTE.CTRL<3 THEN
033 MSG="K8";STATUS="!";GOSUB 20
034 IF STATUS THEN L=1;C=1 ELSE STATUS=1;RETURN TO 9
035 END;MSG=I.PARAM:SUB.PARAM:arg
036 IF C=COLS THEN STATUS=-1;C=1;L=L+1 ELSE
037 MSG=MSG FMT;STATUS=-(REMOTE.CTRL=3);C=C+1
038 END;GOSUB 20
039 s=s+1;REPEAT;RETURN
040 20 CALL DKIO(STATUS);RETURN
041 * * * * * Interface info * * * * *
042 * Entry:
043 * PAR.LIST := <2,p> parameter p name
044 * := <3,p> COM position
045 * := <5,p> conversion type/subr name
046 * Exit:
047 * STATUS := 1 means finished ok
048 * * * * * Revision history * * * * *
049 *.0 - 8/7/87 JF3
050 END
DKIO
001 SUBROUTINE (STATUS)
002 *Input/Output operations
003 *11/4/88 JF3 0.3.1
004 !]DKERR]DKDBUG]DKINP
005 COM P(64);EQU ERR TO P(3),DATA TO P(6),DEBUG.MODE TO P(10),EOL TO P(21)
006 EQU CMD.PROMPT TO P(33),LINE TO P(38),REMOTE.CTRL TO P(40)
007 IF STATUS="!" THEN CALL DKERR;STATUS=-1
008 IF DATA#"" THEN
009 BEGIN CASE
010 CASE REMOTE.CTRL=3 AND STATUS=-1
011 IF LINE#"" THEN EXECUTE "MSG !":LINE:" ":DATA
012 CASE STATUS#3
013 PRINT DATA:;IF DEBUG.MODE>0 THEN CALL DKDBUG("S")
014 END CASE
015 END;IF STATUS>0 THEN
016 IF STATUS=1 THEN PROMPT CMD.PROMPT<4>
017 a=ABS(REMOTE.CTRL);IF REMOTE.CTRL="" OR a=1 OR a=2 THEN
018 IF STATUS>1 THEN STATUS=0;*PICK/Ultimate
019 * STATUS=1 *Microdata
020 IF a=1 THEN
021 * ECHO.ON=OCONV("","U70E0");*Microdata
022 ECHO ON ;*PICK/Ultimate
023 END;CALL DKINP(STATUS);STATUS=(DATA#"")
024 IF DEBUG.MODE>0 THEN CALL DKDBUG("R")
025 END
026 END;IF STATUS=0 OR REMOTE.CTRL=3 THEN STATUS=1 ELSE
027 IF STATUS=-1 THEN PRINT
028 IF STATUS=-2 THEN PRINT EOL:
029 END;RETURN
030 * * * * * Interface info * * * * *
031 *Entry:
032 * STATUS := 1 means pause for input & reset prompt char
033 * := 2 " " " " but no new prompt
034 * := 3 " pause for input & no output at all
035 * := 0 " no pause
036 * := -1 " no pause & cr/lf after output
037 * := -2 " no pause & terminate w/EOL
038 *
039 * LINE := alternate process #; 0 means none.
040 *
041 * REMOTE.CTRL := 3 means Batch mode |
042 * 2 " Server mode | MAIN
043 * 1 " Remote mode | PROCESS
044 * nul " Local mode - connected |
045 * 0 " Local mode - closed |
046 * -------------------------------------
047 * -1 " Remote mode |
048 * -2 " Server mode | SUB
049 * -3 " closed connection (idle) | PROCESS
050 *
051 *Exit:
052 * STATUS := true means all went ok
053 * := false " timeout awaiting input (not implemented)
054 END
055 * * * * * Revision history * * * * *
056 *.1 11/4/88 JF3 Change DKinp to DKINP
057 *
058 *.0 8/13/87 JF3
DKRCVE
001 SUBROUTINE (STATUS)
002 *Receive a Error packet
003 *1/29/87 JF3 0.3.0
004 *]DKDPKT
005 CALL DKDPKT(STATUS);STATUS=-1;RETURN
006 * * * * * Interface info * * * * *
007 * * * * * Revision history * * * * *
008 *.0 - 1/29/87 JF3
DKPRMT
001 SUBROUTINE (arg,c,X)
002 *Convert prompt string -- NOT USED in 0.3
003 *7/21/87 JF3 0.3
004 *
005 COM X1(32),CMD.PROMPT
006 c=c<2>;IF c>0 THEN
007 l=LEN(arg);CMD.PROMPT=arg[1,l-1];CMD.PROMPT<2>=arg[l,1]
008 END ELSE
009 arg=CMD.PROMPT<1>:CMD.PROMPT<2>
010 END;c=0;RETURN
011 * * * * * Interface info * * * * *
012 *Entry: c<2> := >0 means convert from external (prompt-string prompt-char)
013 * to internal (CMD.PROMPT dynamic array)
014 * otherwise convert internal to external
015 * arg := data to convert from or into
016 *
017 *Exit:
018 * * * * * Revision history * * * * *
019 *.0 - 7/21/87 JF3
020 END
DKFINISH
001 SUBROUTINE (STATUS)
002 *tell remote server to shut down; we are FINISHed -- NOT USED in 0.3
003 *8/7/87 JF3
004 COM X1(5),DATA
005 DATA="F";CALL DKXMTG(STATUS)
006 RETURN
007 * * * * * Interface info * * * * *
008 * * * * * Revision history * * * * *
009 *.0 - 8/7/87 JF3
010 END
DKHELP
001 SUBROUTINE (STATUS)
002 *Display HELP info
003 *4/9/87 JF3 0.3
004 *]DKIO
005 COM X1,HELP.LIST,X2(3),LINE
006 C=2;LOOP LINE=HELP.LIST UNTIL LINE="" DO
007 CALL DKIO(-1)
008 C=C+1;REPEAT;STATUS=1;RETURN
009 * * * * * Interface info * * * * *
010 *Entry: none
011 *Exit: none
012 * * * * * Revision history * * * * *
013 *.0 - 4/9/87 JF3
014 END
DKRCVF
001 SUBROUTINE (STATUS)
002 *ReCeiVe a File name packet
003 *7/21/87 JF3 0.3.0
004 *]DKDPKT
005 COM X1(5),DATA,X2(27),f.type,A,C,X3(4),filename,item
006 COM X4(2),FV,FN,FID,X5(14),l
007 EQU OK TO STATUS,b TO " ",FF TO CHAR(12),DK1.3 TO STATUS,beg.fid TO STATUS
008 CALL DKDPKT(STATUS);filename=DATA
009 BEGIN CASE
010 CASE f.type<2
011 READ item FROM FV,filename ELSE item=""
012 IF f.type=0 THEN item="";*TEMP FOR SMS
013 IF f.type=1 THEN
014 DK1.3="U3":FID<1,1>;beg.fid=OCONV("",DK1.3)
015 IF beg.fid THEN
016 item<12>=beg.fid;item<13>=1
017 END
018 END
019 CASE f.type=3
020 PRINTER ON
021 PRINT 'FOLLOWING JOB RECEIVED AS FILE "':filename:'".':FF:
022 PRINTER OFF;DATA="PRINTFILE"
023 END CASE
024 A=1;C="";l=0
025 RETURN
026 * * * * * Interface info * * * * *
027 *Entry:
028 * * * * * Revision history * * * * *
029 *.0 - 7/21/87 JF3
030 END
DKFA
001 SUBROUTINE (arg,c,index)
002 *Convert file attributes -- NOT USED in 0.3
003 *7/14/87 JF3
004 !
005 COM X1(47),F.ATTRS
006 s=index<2>
007 *LOCATE s IN F.ATTRS<2> SETTING v ELSE arg="";GO 4;*Microdata/Ultimate
008 LOCATE(s,F.ATTRS,2;v) ELSE arg="";GO 4; *PICK
009 arg=F.ATTRS<1,v>
010 4 c=0;RETURN
011 * * * * * Interface info * * * * *
012 * Entry:
013 *
014 * Exit:
015 * * * * * Revision history * * * * *
016 *.0 - 7/14/87 JF3
017 END
DKEXIT
001 SUBROUTINE (STATUS)
002 *Exit command
003 *6/30/87 JF3 0.3.0
004 !
005 COM X1(39),REMOTE.CTRL
006 IF REMOTE.CTRL=3 THEN
007 * ECHO.ON=OCONV("","U80E0");*Microdata
008 ECHO ON; *PICK/Ultimate
009 END;STATUS=0;RETURN
010 * * * * * Interface info * * * * *
011 *Entry: none
012 *Exit: return to TCL
013 * * * * * Revision history * * * * *
014 *.0 - 6/30/87 JF3
015 END
DKINP
001 SUBROUTINE (STATUS)
002 *INPut data (with timeout on NON Reality/Royale versions)
003 *11/4/88 JF3 0.3.2
004 !
005 COM V(96);EQU DATA TO V(6),TIMEOUT TO V(18),EOL TO V(21)
006 *EQU S TO 11;*Ultimate
007 EQU S TO 14;*PICK
008 DATA="";IF STATUS THEN
009 INPUT DATA:
010 * * * * * PICK/Ultimate * * * * *
011 END ELSE
012 GOSUB 8;PROMPT"";PRINT EOL:;LOOP
013 LOOP N=SYSTEM(S) WHILE N DO
014 INPUT c,1:;IF c="" THEN c=EOL
015 DATA=DATA:c;IF c=EOL THEN STATUS=1;GO 9
016 IF N=1 THEN GOSUB 8
017 REPEAT
018 UNTIL TIME()>=t AND still.early DO
019 IF NOT(still.early) THEN GOSUB 8
020 REPEAT;STATUS=0
021 * * * * * * * * * * * * * * *
022 END;8 t=TIME();still.early=(t<86385);t=t+TIMEOUT
023 9 RETURN
024 * * * * * Interface info * * * * *
025 *Entry: STATUS := false means check timeout
026 * true " ordinary input
027 * PROMPT must be set by caller
028 *
029 *Exit: STATUS := false means timeout occured
030 * true " all ok
031 * DATA := any input including EOL char
032 * * * * * Revision history * * * * *
033 *.2 - 11/4/88 JF3 Fix midnight timeout problem.
034 *
035 *.1 - 12/29/87 JF3 Make SYSTEM(x) EQUatable.
036 *
037 *.0 - 1/29/87 JF3
038 END
DKXMTS
001 SUBROUTINE (STATUS)
002 *XMiT a Send-init packet
003 *7/24/87 JF3 0.3.0
004 !]DKINIT]DKDBUG]DKXPKTS]DKRECON]DKRETRY
005 COM X1(3),MARK,n,DATA,X2,TYPE,X3,DEBUG.MODE,DELAY
006 *EQU TYPE TO STATUS,RECEIVER TO STATUS,OK TO STATUS;*ULTIMATE/Microdata
007 EQU RECEIVER TO STATUS,OK TO STATUS;*PICK
008 CALL DKINIT(OK);IF OK THEN
009 TYPE="S";CALL DKFPKT(TYPE);IF OK THEN
010 IF DEBUG.MODE THEN CALL DKDBUG("H")
011 * SLEEP=OCONV(DELAY,"U407A");*Microdata/Ultimate
012 SLEEP DELAY; *PICK
013 LOOP
014 RECEIVER=0;CALL DKXPKTS(RECEIVER);IF OK>0 THEN
015 BEGIN CASE
016 CASE TYPE="Y"
017 RECEIVER=0;CALL DKRECON(RECEIVER)
018 CASE TYPE="N";CALL DKRETRY;OK=0
019 END CASE
020 END ELSE CALL DKDBUG(STATUS);STOP
021 UNTIL OK DO REPEAT
022 END ELSE STATUS=0
023 END;RETURN
024 * * * * * Interface info * * * * *
025 *Entry: none
026 *
027 *Exit: STATUS := true means both sides configured
028 * false means error occured somewhere.
029 * * * * * Revision history * * * * *
030 *.0 - 7/24/87 JF3
031 END
DKFNAME
001 SUBROUTINE DKFNAME
002 *setup File NAMEs (in Kermit sense)
003 *7/8/87 JF3 0.3.0
004 *]DKCNV]DKNFN
005 COM X1(16),MAXL,X2(6),CHKT,X3(16),ID,X4(2)
006 COM F.NAME,X5,filename.type;DIM N(3)
007 EQU name TO N(1),type TO N(2),sep TO N(3),AM TO CHAR(254)
008 name=filename.type<1>;type=filename.type<2>;sep=""
009 CALL DKCNV(NFN,0,-48:AM:105);NFN=(NFN[1,6]="NORMAL")
010 IF F.NAME="" THEN
011 BEGIN CASE
012 CASE type<2
013 IF NFN THEN type=name ELSE type=""
014 name=ID
015 * CASE type=2;type="";sep=".";*Not used.
016 CASE type=3;type=(1000+ID)[2,3]
017 CASE 1;F.NAME="";GO 9
018 END CASE
019 END ELSE
020 type=INDEX(F.NAME,".",1);IF type THEN
021 name=F.NAME[1,type-1];type=F.NAME[type+1,9999];sep="."
022 END ELSE name=F.NAME;type=""
023 END;IF NFN THEN CALL DKNFN(MAT N)
024 F.NAME=(name:sep:type)[1,MAXL-2-CHKT]
025 9 RETURN
026 * * * * * Interface info * * * * *
027 *Entry: filename.type <1> := file name SET by command
028 * <2> := file type # SET by command
029 *Uses: NFN := Normalized File Names
030 * sep := file name seperator
031 *Exit: F.NAME := filename to be used in transaction
032 * * * * * Revision history * * * * *
033 *.0 - 7/8/87 JF3
034 END
DKRECON
001 SUBROUTINE (STATUS)
002 *Reconcile initial packet parameters
003 *10/24/88 JF3 0.3.1
004 *]DKQUOT]DKCNV
005 COM X1(5),DATA,X2(16),QBIN;EQU RX TO STATUS
006 AckPkt="";f=1;c=1;LOOP F=DATA[c,1] UNTIL F="" OR f=10 DO
007 p=(16+f);EOL=(f=5);CAPAS=(f=10);ix=p*(EOL OR CAPAS)
008 BEGIN CASE;CASE f=4;cnv=4
009 CASE CAPAS;S=F;LOOP WHILE MOD(SEQ(S),2) DO
010 c=c+1;S=DATA[c,1];F=F:S;REPEAT;cnv="CAPAS";cnv<1,2>=-1
011 CASE 5=1
017 IF f=7 THEN
018 IF NOT(F="N" OR F=QBIN) THEN F="Y"
019 END ELSE
020 IF f=4 THEN cnv=3
021 CALL DKCNV(F,cnv,-(48+f))
022 IF f=4 THEN cnv=4;GO 7
023 IF EOL THEN
024 cnv=1;7 CALL DKCNV(F,cnv,0)
025 END;END;AckPkt=AckPkt:F
026 END;f=f+1;c=c+1
027 REPEAT;IF RX THEN DATA=AckPkt
028 STATUS=1;RETURN
029 * * * * * Interface info * * * * *
030 * Entry:
031 * STATUS := 1 means Receive mode
032 * DATA := DATA field of received init (S or Y) packet
033 * Exit:
034 * If Receive mode then DATA contains DATA field of Ack packet
035 * * * * * Revision history * * * * *
036 *.1 - 10/24/88 JF3
037 *
038 *.0 - 1/29/87 JF3
039 END
DKBATCH
001 SUBROUTINE (STATUS)
002 *go into BATCH mode
003 *8/7/87 JF3 0.3.0
004 *]DKRCVG]DKXPKTS]DKRCVt
005 COM command.line,X1(4),msg,X2(31),process,X3,remote.control
006 *IF remote.control THEN
007 *END ELSE
008 process=FIELD(command.line<1>," ",2);IF NUM(process) THEN
009 *check for logged on process here
010 msg="K21";STATUS="!";CALL DKIO(STATUS);remote.control=3
011 command.line=""
012 * ECHO.OFF=OCONV("","U80E0");*Microdata
013 ECHO OFF; *PICK/Ulitmate
014 END ELSE msg="K1";msg<2>="process#";STATUS="!";CALL DKIO(STATUS)
015 *END
016 STATUS=1;RETURN
017 * * * * * Interface info * * * * *
018 *Entry: none
019 *
020 *Exit: remote.control := set to remote command mode = "3"
021 * * * * * Revision history * * * * *
022 *.0 - 8/7/87 JF3
023 END
DKCAPAS
001 SUBROUTINE (arg,c,X)
002 *Convert CAPAS bit fields -- NOT USED in 0.3
003 *2/6/87 JF3
004 *]DKCNV
005 DIM C(9);MAT C=0;I=0
006 BEGIN CASE
007 CASE c=1
008 v=1;LOOP P=arg<1,v> UNTIL P="" DO
009 IF P THEN
010 P=arg<2,v>-1;i=INT(P/5)+1;P=5*i-P
011 C(i)=C(i)+PWR(2,P);IF i>I THEN I=i
012 END;v=v+1
013 REPEAT;arg="";FOR i=1 TO I
014 C(i)=C(i)+(I>i);CALL DKCNV(C(i),1,0);arg=arg:C(i)
015 NEXT i
016 CASE c=-1
017 I=LEN(arg);int.arg="";FOR i=1 TO I
018 P=arg[i,1];CALL DKCNV(P,-1,0);FOR p=5 TO 1 STEP -1
019 v=PWR(2,p);bit=(P>=v);IF bit THEN P=P-v
020 v=5*i-p+1;int.arg<2,v>=v;int.arg<1,v>=bit
021 NEXT p
022 NEXT i;arg=int.arg
023 END CASE;c=0;RETURN
024 * * * * * Interface info * * * * *
025 * Entry:
026 * if c=1 then convert from internal to packet formats
027 * arg<1>:= multivalued bit fields
028 * <2>:= associated field #s
029 * if c=-1 then convert from packet to internal formats
030 * arg := char string from packet CAPAS field
031 * Exit:
032 * if c=1 on entry then
033 * arg := char() encoded string
034 * if c=-1 on entry then
035 * arg<1> :=} as above
036 * arg<2> :=}
037 * c := 0
038 * * * * * Revision history * * * * *
039 *.0 - 2/6/87 JF3
040 END
DKXMTT
001 *DUMMY
002 *Subroutine list for DKXMTt subroutine names
003 *4/3/87 JF3 0.3
004 *]DKXMTS]DKXMTF]DKXMTA]DKXMTD]DKXMTZ]DKXMTB
005 END
DKCHECK
001 SUBROUTINE (check)
002 *Checksum a packet
003 *4/9/87 JF3 0.3.0
004 *]DKCNV
005 COM X1(5),DATA,X2(10),MAXL,X3(6),CHKT,X4(24),SMAXL
006 EQU STATUS TO check;RX=check;STATUS="";IF RX THEN
007 L=DATA[2,1];CALL DKCNV(L,-1,0)
008 IF 0<=L AND L<=SMAXL THEN L=L+2-CHKT ELSE GO 9
009 END ELSE L=LEN(DATA)
010 s=0;FOR c=2 TO L
011 CHR=DATA[c,1];IF CHR="" THEN GO 9
012 s=s+SEQ(CHR)
013 NEXT c;BEGIN CASE
014 CASE CHKT=1;check=CHAR(32+MOD(INT(MOD(s,256)/64)+s,64))
015 CASE CHKT=2
016 * Bug of some kind here; can't get it to work!
017 L=1;LOOP
018 c=MOD(s,64);CALL DKCNV(c,1,0);check=c:check
019 UNTIL L=2 DO s=INT(s/64);L=L+1 REPEAT
020 CASE CHKT=3;*Insert assembly call here
021 END CASE
022 9 RETURN
023 * * * * * Interface info * * * * *
024 *Entry: check := true if we are receiving
025 *Exit: check contains check code for packet
026 * * * * * Revision history * * * * *
027 *.0 - 4/9/87 JF3
028 END