XHELP BYTOBLCHTOBLtDHFHLPFNDTOP GETTOP GTXHLPHLPDHFNEWTOP4ICHBEGMKHELPOPNCHEsRDCHE@#RDPAGn%SHFDOC&SHXHLP'SMATCH)TYXHLP,WRTPAGm5WRTTOP6XHELP$9BYTOBL8subroutine the accumulates bytes into a buffer array and4then writes out sequential blocks into the indicateddirect access file:----------------------------------------------------------6call BYTOBL(Bytear,Lenbyt,Buf,Clen,Cpage,Lenbuf,Iunit)5bytear b(lenbyt) i: string of bytes to be accumulated5lenbyt i4 i: no. of bytes to so accumulate, when < 0 then dump the buffer in any case&buf b(lenbuf) w/r: accumulation buffer(clen i4 i/r: current location in buffer*cpage i4 i/r: current d.a. record in file$lenbuf i4 i: size of buffer (BYTYES2iunit i4 i: Fortran unit no. File must have been, previously opend as a Fortran Unformatted/ direct access file. Be sure that the record% length in the open statement was a- number of full-words (4 byte quantitites).( (Thus lenbuf must be a multiple of 4)Library xanlib<------------------------------------------------------------CHTOBL=subroutine the accumulates bytes into a buffer array and thenBwrite out sequential blocks into the indicated direct access file.----------------------------------------------2call CHTOBL(Cray,Lray,Cbuf,Lbuf,Ipage,Mxbuf,Iunit)# CHARACTER Cray*(*) , Cbuf*(*)1 INTEGER Lray , Lbuf , Ipage , Mxbuf , Iunit0CRAY I String of bytes to be accumulated@LRAY I No. of bytes to so accumulate, when < 0 then dump% the buffer in any case"CBUF I/O Accumulation bufferELBUF I/O Current location in buffer (must be set to zero before the first call to C1TOBL*IPAGE I/O Current d.a. record in file&MXBUF I Size of buffer (BYTYES)FIUNIT I Fortran unit no. File must have been previously opened2 as a Fortran Unformatted direct access file. Be3 sure that the record length in the open statement2 was a number of full-words (4 byte quantitites).& (Thus mxbuf must be a multiple of 4)Library xanlib<------------------------------------------------------------DHFHLP:DHF utility program to convert a direct access help format,file to the sequential form used for editing PROGRAM DHFHLP2--------------------------------------------------Library xanlib<------------------------------------------------------------FNDTOP;subroutine to find the topic corresponding to a given topic>--------------------------------------------------------------6call FNDTOP(Ctok,Ltok,Ntop,Ieqtop,Cpics,Ichstr,Ichstp)$ CHARACTER Ctok*(*) , Cpics*(*): INTEGER Ltok , Ntop , Ieqtop , Ichstr(*) , Ichstp(*)=CTOK, as input on unit one. See SHFTOD for argument details.%CTOK(:LTOK) C* I: The topic to match?IEQTOP I4 R: the topic number of the indicated topic CTOK. if zero, then no match was found. INTEGER i LOGICAL qmatchLibrary xanlib<------------------------------------------------------------GETTOP5subroutine to find the topic corresponding to a given-string, as input on unit one. See SHFTOD for argument details.8-------------------------------------------------------- -remainder of the prompt string when a @ special! -character is read.Library xanlib<------------------------------------------------------------HLPDHF>XHELP utility program to convert a sequential help format file;to the direct access form used by the actual help routines.AThe program accomplishes this through two passes through the .HLPBfile, the first to generate the sizes and addresses of the various6topics, the second to actually write out the DHF file.?This version can read the same files that can be installed intoBa VMS help library. All rules for creating a VMS .HLP file should,be followed, with the following restriction:@The first line of the .HLP file MUST contain the "1 HELP" topic,?followed by the top level message. This is because the current?version of GTXHLP assumes that the first topic in the .DHF filecontains the top-level message.--------------------------- PROGRAM HLPDHF# INTEGER MXCHR , MXTOP , MXBUF PARAMETER (MXCHR=20000) PARAMETER (MXTOP=1000) PARAMETER (MXBUF=512) INTEGER LENACT , NEWTOP CHARACTER cpics*(MXCHR) CHARACTER cline*256 CHARACTER ctok*64* CHARACTER cin*40 , cout*40 , cscr*12% CHARACTER cbuf*(MXBUF) , ctmp*1 CHARACTER c4tmp*4 INTEGER i4tmp EQUIVALENCE (c4tmp,i4tmp)= INTEGER ichstr(MXTOP) , ichstp(MXTOP) , inisub(MXTOP) ,= & iprtop(MXTOP) , inxtop(MXTOP) , itxsiz(MXTOP) , & islsiz(MXTOP)B INTEGER i , icssiz , icsize , ictsiz , idepth , ieqtop , ierH INTEGER irhelp , ios , ipage , iptop , irec , isubt , itlen , itop4 INTEGER jdepth , jtop , kp , lbuf , lin , lout0 INTEGER lline , lscr , ltok , ltops , ntop LOGICAL qequiv(MXTOP)Library xanlib<------------------------------------------------------------NEWTOP@Searches the the start of a new topic. For VMS style, the topicDlines start with a single digit followed by a space. In the future,AC the topic level may require two digits, in which case this codewill to be enhanced.+-------------------------------------------$ INTEGER FUNCTION NEWTOP(Cline) CHARACTER Cline*(*) INTEGER ixLibrary xanlib<------------------------------------------------------------ICHBEG-function call to return the buffer address ofa given DA file address@----------------------------------------------------------------? INTEGER FUNCTION ICHBEG(Itab,Cbuf,Iadd,Nbyte,Lstadd,Ierr)7ICHBEG i4 r: the offset in the cache buffer that points4 to the first byte needed (byte 0 is the beginning of the buffer and the file)*ITAB i4 I/R: See OPNCHE for a descriptionCBUF i4 cache bufferIADD i4 I: byte file addressNBYTE i4 i: last byte needed;LSTADD i4 r: last buffer address actually in cache block in the needed rangeIERR i4 r: error flag 4 - rdpag errorLibrary xanlib<------------------------------------------------------------MKHELP3utility program to convert a sequential help format?file to the direct access form used by the actual help routinesB The program accomplishes this through two passes through the SHFC file, the first to generate the sizes and addresses of the various7 topics, the second to actually write out the DHF file.=------------------------------------------------------------- PROGRAM MKHELPLibrary xanlib<------------------------------------------------------------OPNCHE&subroutine to open the cached DA file.>--------------------------------------------------------------2call OPNCHE(Iunit,Cfile,Itab,Mxbuf,Qro,Lrecl,Ierr) IUNIT i4 i: fortran LUN to use"CFILE c* i: name of file to open4ITAB(MXBUF) I i/r: the buffer used to hold the cache* and associated info (see details below)+ equivalenced to the integer*4 array ITAB$MXBUF i4 i: the size of the buffer1QRO L i: if true, file is to be open readonly6 before they are overwritten in the cache (obsolete)@LRECL I4 i: number of bytes per record in file to be opened/IERR i4 r: error flag, if zero then no error( If 1, then unable to open the da file+ 2 - Unable to determine the recordlength3 3 - MXBUF too small to hold a single cache page. CHARACTER Cfile*(*) INTEGER*4 Mxbuf INTEGER Itab(Mxbuf) LOGICAL Qro%ipsize i4 the size of a page in bytes'npage i4 the no. of pages in the cache lastpg i4 the last page accessed#cache ptr of the last page accessed-junit i4 the unit to use for read and writesfollowed by the cache pointers=icadd(npage) i4 the page no. currently in the ith position of the cache