.TITLE WAITCK - CONNECTS/WAITS FOR TASK .IDENT /V1.1/ .ENABL GBL ; ;+ ;***** ; ; WAITCK.MAC -- formerly part of CCL.MAC, moved to its own ; module for easier manipulation. This subroutine processes ; the CCL command specified by "-" action lines in .CCL files ; or internal table. The task ultimately connected to depends ; on the format of the taskname following the "-" prefix: ; 1) For null task names, try to connect to "TTnn"; ; nn=TI:'s unit # ; 2) For non-null task names >/< 3 characters, the taskname ; is used verbatim ; 3) For task names = 3 characters, try to connect to ; "xxxTnn", followed by "...xxx"; xxx=task name ; nn=TI:'s unit # ; ; ; PRS02 Add support for "HEY" type commands from .CCL files ; PRS04 Add current sequence for connecting to task (see above) ; PRS05 Remove passing exit flag in R2, reference global "NOSTOP" ; ;***** ;- .MCALL STSE$S,CLEF$S,DIR$,CNCT$ ; ; local symbols ; BELL=7 LF=12 CR=15 SPA=40 STAR=52 ; ; local data ; .PSECT $IDATA,D,RW,LCL,CON,REL ; .NLIST BEX .ENABL LC EM4: .ASCII /CCL -- Task / ;***New error messages for "HEY" type command ;PRS02 TSKNAM: .ASCIZ /XXXXXX / ; pad task name with trailing space ;PRS04 EM4A: .ASCIZ /is not active/ ;PRS02 EM4B: .ASCIZ /is not installed, or is a command line interpreter/ ;PRS02 EM4C: .ASCIZ /exited with status = / ;PRS02 EM4D: .ASCIZ /warning/ ;PRS02 EM4E: .ASCIZ /success/ ;PRS02 EM4F: .ASCIZ /error/ ;PRS02 EM4G: .ASCIZ /severe error/ ;PRS02 .EVEN CNCT: CNCT$ ,4,,EXSTAT ; Connect to task ; .PSECT $CODE1,RO,I,LCL,CON,REL ;+ ; WAITCK -- Wait for task to exit ; This subroutine processes the CCL command "-TASKNAME". ;***NEW ;PRS02 ; If command line included %P - output exit status of task as ;PRS02 ; DCL "HEY" command used to. If line ended in %$ - setup to ;PRS02 ; exit after offspring emits status ;PRS02 ;*** ;PRS02 ; ;PRS02 ; On entry: ;PRS02 ; R0 points to start of taskname ;PRS02 ; R1 set to # bytes in taskname ;PRS02 ; ;PRS02 ; R0-R4 are expendable. ;PRS02 ; ;PRS02 ; Return status: ;PRS02 ; on success - carry bit clear ;PRS02 ; on error - carry bit set, address of error message in R0 ;PRS02 ; ;**** ; ; UPDATE 10/21/83 -- PRS06 ; Change "TSTRNG" in CCL from "xTnn" to "xnn" (x= "V" or "T") ;- WAITCK:: CLR CNCT+C.NCTN+2 ; Clear out old task name CLR CNCT+C.NCTN ; Clear out old task name ;***NEW ;PRS02 TSTB NOSTOP ; %$ exit requested ? ;PRS05 BEQ 1$ ; Branch if no, normal wait ;PRS02 MOVB #STAR,SAVTYP ; yes, reset "-" in SAVTYP to "*" so ;PRS02 ; CCL will exit after wait done. ;PRS02 1$: MOV #TSKNAM,R2 ; Get address of where to shove task name MOV #6,R3 ; Repeat 6 TIMES TST R1 ; Check R1, length of taskname ;PRS02 BGT 110$ ; Branch if name there ;PRS04 MOV R2,R0 ; Copy pointer to TSKNAM ;PRS04 MOV #TSTRNG,R1 ; Fetch pointer to terminal id string ;PRS04 MOVB (R1)+,(R0)+ ; Copy "V" or "T" ;PRS06 MOVB #'T,(R0)+ ; Add 2nd "T" ;PRS06 CALL 40$ ; Copy rest of ASCIZ string ;PRS06 MOV R0,R2 ; Update pointer SUB #TSKNAM,R0 ; Compute # characters moved ;PRS04 SUB R0,R3 ; Adjust # left in TSKNAM ;PRS04 BR 4$ ; Space fill out TSKNAM ;PRS04 110$: ; Reference label ;PRS04 ;*** ;PRS02 3$: MOVB (R0)+,R4 ; Fetch character ;PRS02 CMPB R4,#140 ; Is character in lower case ? ;PRS02 BLE 130$ ; Branch if no ;PRS02 BICB #40,R4 ; Yes, force it to uppercase ;PRS02 130$: ; Reference label ;PRS02 CMPB R4,#SPA ; Leading/trailing space ? ;PRS02 BEQ 133$ ; Branch if yes, skip it ;PRS02 MOVB R4,(R2)+ ; Move byte to task name ;PRS02 DEC R3 ; Readjust # to move BLE 5$ ; branch if finished with 6 133$: ; Reference label ;PRS02 SOB R1,3$ ; Readjust # left in template line ;PRS04 CMP R3,#3 ; 3 characters in task name ? ;PRS04 BNE 4$ ; Branch if no, use task name as is ;PRS04 CMPB TSKNAM,#'T ; Check for special case of "TTn" ;PRS04 BEQ 135$ ; Branch if yes ;PRS04 CMPB TSKNAM,#'V ; Check for special case of "VTn" ;PRS04 BNE 136$ ; Branch if no ;PRS04 135$: CMPB TSKNAM+1,#'T ; Check for second "T" ;PRS04 BNE 136$ ; Branch if no ;PRS04 CMPB TSKNAM+2,#'8 ; Check for # ;PRS04 BLT 4$ ; = "TTn", leave it alone ;PRS04 136$: ; First, try task xxxTnn ;PRS04 MOV #TSTRNG,R1 ; Fetch "Tnn" string address ;PRS04 MOV R2,R0 ; Copy destination pointer ;PRS04 CALL 40$ ; Copy rest of ASCIZ string ;PRS04 138$: MOVB #SPA,(R0)+ ; Force space (unit # maybe < 10) ;PRS04 BR 5$ ; Branch to continue ;PRS04 ;PRS04 4$: MOVB #SPA,(R2)+ ; Space fill taskname if necessary SOB R3,4$ ; Readjust # to move ; Do it to remaining characters 5$: MOV #TSKNAM,R0 ; Recover start address of taskname MOV R0,R1 ; Accept a . in task name ;PRS02 CALL $CAT5B ; also allow spaces ;PRS02 MOV R1,CNCT+C.NCTN ; Insert name into connect DPB ;PRS02 BCS 10$ ; Branch if $CAT5 detected error ;PRS02 MOV R0,R1 ; Accept a . in task name ;PRS02 CALL $CAT5B ;PRS02 MOV R1,CNCT+C.NCTN+2; Move 2nd half of name into DPB ;PRS02 10$: MOV #CMD,R0 ; Fetch buffer address for messages ;PRS02 MOV #EM4,R1 ; Fetch 1st part of exit message ;PRS02 CALL 40$ ; Move R1 string to R0 buffer ;PRS02 CLEF$S #4 ; Clear event flag DIR$ #CNCT ; Connect to task BCC 15$ ; Task found, proceed to stop ;***NEW ;PRS02 TST R3 ; Check R3, if >0, try task ...xxx ;PRS04 BEQ 212$ ; Branch if 0 ;PRS04 MOV CNCT+C.NCTN,CNCT+C.NCTN+2 ; Adjust task name ;PRS04 MOV #^R...,CNCT+C.NCTN ; to ...xxx ;PRS04 MOV #TSKNAM,R2 ; Fetch address of ASCII task name ;PRS04 MOV #3,R3 ; Do loop 3 times ;PRS04 211$: MOVB (R2),3(R2) ; Reset ASCII task name to ...xxx ;PRS04 MOVB #'.,(R2)+ ;PRS04 SOB R3,211$ ;PRS04 BR 10$ ; Retry connect, R3=0 ;PRS04 212$: ; Reference label ;PRS04 CMP $DSW,#IE.INS ; Connect error- task a CLI? ;PRS02 BNE 12$ ; Branch if no ;PRS02 MOV #EM4B,R1 ; Yes, fetch appropriate message ;PRS02 BR 13$ ;PRS02 12$: MOV #EM4A,R1 ; Error probably task not active/not ;PRS02 ; in system ;PRS02 13$: CALL 40$ ; Move rest of error message to buffer ;PRS02 MOV #CMD,R0 ; Recover start address of buffer ;PRS02 SEC ; Set carry bit ;PRS02 RETURN ; and exit ;PRS02 15$: MOV #EM4C,R1 ; Connected to task, setup 1st section ;PRS02 CALL 40$ ; of exit status message ;PRS02 MOVB #BELL,(R0)+ ; Also ring bell ;PRS02 STSE$S #4 ; Stop until task exits TSTB PRINT ; Check if %P specified ;PRS02 BEQ 30$ ; Branch if no, return to CCL ;PRS02 20$: MOV EXSTAT,R1 ; Fetch exit status of task ;PRS02 CMP R1,#EX$WAR ; Was it warning? ;PRS02 BNE 22$ ; Branch if no ;PRS02 MOV #EM4D,R1 ; Yes, issue message ;PRS02 BR 29$ ;PRS02 22$: CMP R1,#EX$SUC ; Was it success? ;PRS02 BNE 24$ ; Branch if no ;PRS02 MOV #EM4E,R1 ; Yes, issue message ;PRS02 BR 29$ ;PRS02 24$: CMP R1,#EX$ERR ; Was it error? ;PRS02 BNE 26$ ; Branch if no ;PRS02 MOV #EM4F,R1 ; Yes, issue message ;PRS02 BR 29$ ;PRS02 26$: CMP R1,#EX$SEV ; Was it severe error? ;PRS02 BNE 28$ ; Branch if no ;PRS02 MOV #EM4G,R1 ; Yes, issue message ;PRS02 BR 29$ ;PRS02 ; Unknown error code, send it in message;PRS02 28$: MOV #34410,R2 ; Ask for signed 7 digit octal # with ;PRS02 ; leading zero suppression ;PRS02 CALL $CBTA ; Convert status # to ASCII ;PRS02 CLRB (R0) ; Set buffer string to ASCIZ ;PRS02 BR 229$ ;PRS02 29$: CALL 40$ ; Move message to output string ;PRS02 229$: MOV #CMD,R0 ; Fetch buffer start address again ;PRS02 CALL TYPEIT ; and send it to terminal ;PRS02 ;*** ;PRS02 30$: CLC ; Show success, clear carry bit RETURN ; and return to CCL ;***NEW ;PRS02 ; ;PRS02 ; MOVE ASCIZ STRING POINTED TO BY R1 INTO BUFFER POINTED TO BY R0 ;PRS02 ; R0 LEFT POINTING TO NULL CHARACTER ;PRS02 40$: ;PRS02 MOVB (R1)+,(R0)+ ; Move character ;PRS02 BNE 40$ ; Branch if not 0 ;PRS02 DEC R0 ; Back up R0 pointer over null ;PRS02 RETURN ; and return ;PRS02 ;*** ;PRS02 .END ;WAITCK