.MCALL .MODULE .MODULE GTLIN,VERSION=06,COMMENT=,IDENT=NO,LIB=YES ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .SBTTL Module Declaration .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ; ++ ; FACILITY: ; ; RT-11 System Subroutine Library ; ; GTLIN ; ; ENVIRONMENT: ; ; These routines can be used by any job running in a single-job ; or multi-job environment. It uses "TRAP" to provide error processing. ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. ; ; EQUATED SYMBOLS: ; JSW =: 44 CHAIN$ =: 400 CMDCNT =: 510 CMDBUF =: 512 ; ; EXTERNAL REFERENCES: ; .GLOBL $SYSLB ; Include system library work area. .GLOBL $NXADR ; Entry point to next address routine .GLOBL $NXVAL ; Entry point to next value routine .GLOBL $ERRM0 ; Error routine .WEAK $MSARG ; Trap code for missing argument .SBTTL GTLIN - Fortran- callable routine ; ++ ; FUNCTIONAL DESCRIPTION: ; ; GTLIN - transfers a line of input to the user program from the ; console terminal, an active indirect command file, or ; the chain area ; ; CALLING SEQUENCE: ; ; CALL GTLIN (result[,prompt][,{'term' }]) ; {'plain'}]) ; INPUT PARAMETERS: ; ; R5 - address of GTLIN argument block ; 0(R5) - argument count ; 2(R5) - address of the array to receive the string ; 4(R5) - address of the prompt string to be printed on the console ; terminal ; 6(R5) - address of an argument that indicates whether the input ; should be taken from console terminal or chain area ; ; RETURNED ARGUMENT VALUES: ; ; result - LOGICAL*1 array containing received string of 80 charactrs ; ; RETURNED FUNCTION VALUE: ; ; 0 for success ; -1 for line too long ; ; -- .PSECT SYS$I GTLIN:: IGTLIN:: MOV (R5)+,R4 ; Get count CALL $NXADR ; Get INPUT addr BCS ERR ; err if no addr passed MOV R0,-(SP) ; Put it on the stack CLR R0 ; assume no prompt address CALL $NXADR ; Get PROMPT addr, if any MOV R0,R1 ; Save the addr of PROMPT CLR R2 ; Assume TERM omitted CALL $NXADR ; Get TERM address BCS 20$ ; None given MOVB @R0,R2 ; Get the first char BIC #040,R2 ; Force uppercase CMPB R2,#'P ; Is it 'PLAIN'? BNE 20$ ; No CLR R2 ; Insure R2 not equal to 'T' BIT #CHAIN$,@#JSW ; Were we chained to? BNE 20$ ; Yes, then can't be CCLed to MOV #CMDCNT,R0 ; Point to possible command area MOV @R0,R4 ; Copy value to a temp register DEC R4 ; Any count value in chain area? BLE 20$ ; No, then do a normal GTLIN CLR (R0)+ ; Clear count and point to string MOV @SP,R3 ; Buffer address MOV R0,@SP ; Read line (later) into chain area to dump it 10$: MOVB (R0)+,(R3)+ ; Move a char BNE 10$ ; Until NULL is encountered 20$: MOV #1,-(SP) ; CODE FOR .GTLIN CMPB R2,#'T ; Is it 'TERM'? BNE 30$ ; No MOV #3,@SP ; CODE for .GtLin ,,* 30$: MOV R1,-(SP) ; Put addr of PROMPT, if any CLR -(SP) ; For .GTLIN EMT 345 ; .GTLIN CALLR $ERRM0 ; Process any errors ERR: TRAP $MSARG ; Handle any missing arguments in call RETURN .END