.TITLE LIB_STDESCR Converts array descriptor to string descriptor .IDENT /V01.01/ ;++STDESCR.MAR ; ; Facility: ; Fermilab Accelerator Control System (ACNET) General Routines ; ; Abstract: ; Converts array descriptor into a string descriptor returned ; as the function's value. ; ; Environment: ; Module stored in FERMILIB.OLB and linked in users' programs. ; ;-- ; ; Modification History: ; ; Author: F. Nagy Creation date: 20-Sep-82 ; ; V01.00 20-Sep-82 FJN Got from DECUS Spr'82 VAX SIG tape from the ; Institute for Cancer Research submission and ; editted to standard FERMILIB scheme ; V01.01 15-Apr-83 FJN Standardizing help comments ; .PAGE .SUBTITLE Declarations ; ; Include Files: ; ; NONE ; ; Library Macros: ; .NOCROSS $DSCDEF ;Field offsets of argument descriptors .CROSS ; ; Local Macros: ; ; NONE ; ; Equated Symbols: ; nargs = 0 ;Offset to number of arguments array = 4 ;Offset to address of array descriptor ; argument length = 8 ;Offset to optional length argument ; address ; ; Program section for code ; .PSECT _LIB_CODE,PIC,USR,CON,REL,LCL,SHR,EXE,NOWRT,RD .SHOW BINARY .PAGE .SUBTITLE Convert array descriptor to returned string descriptor ;+0LIB_STDESCR ; ; Functional Description: ; An array specified via an array descriptor as an argument to this ; is used to construct and return a string descriptor. An optional ; length argument can provide a length (in bytes) to override the array ; length (from the array descriptor) in the string descriptor. ; ; Calling Sequence: ; str_desc = LIB_STDESCR(%DESCR(byte_array) [,length]) ; ; Input Parameters: ; byte_array - address of the array descriptor of a byte array (shown ; in FORTRAN format). ; length - (optional) address of a word containing the length in bytes ; to be used in the string descriptor. If not given, the ; byte length of the array (from the array descriptor) is used. ; ; Implicit Inputs: ; NONE ; ; Output Parameters: ; str_desc - string descriptor is returned in registers R0 and R1 (use ; in FORTRAN by declaring routine as REAL*8). ; ; Implicit Outputs: ; NONE ; ; Condition Codes: ; NONE ; ; Side Effects: ; The routine will not handle an input string descriptor. ; ;- ;+ LIB_STDESCR ; Function returns a string descriptor created from the input array ; descriptor: ; ; st_descr.wdsc.v = LIB_STDESCR(array_descr.rbu.da [,length.rwu.r]) ; ; st_descr output string descriptor (static, fixed-length) is ; returned in registers R0 and R1 (declare as REAL*8 ; in FORTRAN). Passed by value. ; ; array_descr the byte array as passed by array descriptor (in ; FORTRAN specify the argument as %DESCR(array) to ; create the array descriptor). ; ; length optional, a word containing the length in bytes for ; the output string descriptor. If not given, the ; array length from the array descriptor is used. ; Passed by reference. ;- .ENTRY LIB_STDESCR,^M ; MOVL array(AP),R2 ;Get address of array descriptor MOVL DSC$L_ARSIZE(R2),R0 ;Get array size CMPB #2,(AP) ;Was length parameter supplied? BNEQ 10$ ;If not, use array length MOVL length(AP),R1 ;Is length parameter defaulted? BEQL 10$ ;If no address, then use array length MOVZWL (R1),R0 ;Use optional length parameter 10$: INSV #DSC$K_DTYPE_T,- ;Set type as ASCII text #DSC$B_DTYPE*8,#8,R0 ; in output string descriptor INSV #DSC$K_CLASS_S,- ;Set class as fixed length (static) #DSC$B_CLASS*8,#8,R0 ; in output string descriptor MOVL DSC$A_POINTER(R2),R1 ;Set pointer in string descriptor RET .END