From:	MERC::"uunet!WKUVX1.BITNET!MacroMan"  7-APR-1993 18:09:52.30
To:	ricevm1.rice.edu!macro32@wkuvx1.BITNET
CC:	WEISSBORN@dfwdsr.sinet.slb.com
Subj:	NEED TO READ IMAGE-NAME FROM IMAGE-HEADER

I picked up the following piece of code a long time ago from some Decus tape and
now would like to modify it.  However, I am not a Macro hacker so I would
appreciate any help.  I want to be able to get the IMAGE NAME in addition to
the image-id and link-time.  Can someone tell me how?  Here is the code:

        .title  Read_Header     - Reads Image Header
        .ident  /1-001/
;
;       John Miano
;       24-June-1986
;
;       Subroutine to return the image identification and link time.
;
;       status = READ_HEADER(ident [,time])
;
;       Ident   - Character String Passed by Descriptor, Write Only -
;                       the image identification (max len 39 chars)
;       Time    - Character String Passed by Descriptor, Write Only -
;                       link time (length = 20 characters)
;
;
;       Note: be sure to use the "identification=" line in your linker
;       option file
;
;       MODIFICATIONS
;       9-MAR-90        W.C. WEISSBORN
;       CHANGED THE HEADER TO REFLECT THE CORRECT LENGTHS OF THE ARGUMENTS
;       (IDENT CAN BE 39 CHARS LONG INSTEAD OF 15 AND TIME CAN BE
;        20 CHARS LONG INSTEAD OF 8)
;
;       added comments about linker option file
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


        .link   "sys$system:sys.stb"/selective_search
        .library "sys$library:lib"

        $dscdef
        $ihddef
        $ihidef
        $ssdef

        .disable        global
        .external       ctl$gl_imghdrbf
;
;       Argument Pointer Offsets
;
        $OFFSET 4,POSITIVE,<IDENT,TIME>

        .psect  code,rd,nowrt,exe,long,con,lcl,pic
        .entry  read_header,^m<r2,r3,r4,r5,r6,r7,r8,r11>

        cmpl    (ap),#1                         ; make sure there is at least
        bgeq    enough_arguments                ; one argument to this routine
        movl    #ss$_insfarg,r0
        ret

enough_arguments:
;
;       get the identification of the image
;
        movl    @#ctl$gl_imghdrbf,r11           ; r11 = address of image buffer
        movl    (r11),r6                        ; r6 = address of image header

        cvtwl   ihd$w_imgidoff(r6),r7
        movab   (r6)[r7],r7                     ; r7 = address of id block

        cvtbl   ihi$t_imgid(r7),r0              ; length of id string
        movl    ident(ap),r8
        movc5   r0,<ihi$t_imgid+1>(r7),#32,-
                  dsc$w_length(r8),@dsc$a_pointer(r8)
        cmpl    (ap),#2
        bgeq    return_time
        movzbl  #1,r0
        ret

return_time:
;
;       get the time the image was linked and convert it to ascii
;
        $asctim_s       timbuf=@time(ap),-
                        timadr=ihi$q_linktime(r7)
        ret

        .end


Any help would be greatly appreciated.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Bill Weissborn
Schlumberger-GeoQuest Data Services
Data Services Region -- System Support Staff Engineer
4100 Spring Valley Rd. Suite 600
weissborn@dfwvx1.DALLAS.GEOQUEST.slb.com
Dallas, Tx.   75244                 or try: weissborn@dfwvx1.sinet.slb.com
(214) 980-7924                      or    : dfwdsr::weissborn

                  Don't blame me...I voted for Perot!!!!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

