Trailing-Edge
-
PDP-10 Archives
-
TOPS-20_V6.1_DECnetSrc_7-23-85
-
mcb/utilities/lbrobj.bli
There is 1 other file named lbrobj.bli in the archive. Click here to see a list.
MODULE LBROBJ ( !Read an object module
IDENT = '001020',
LANGUAGE (BLISS16, BLISS36)
) =
BEGIN
!
!
!
! COPYRIGHT (c) 1980, 1981, 1982
! DIGITAL EQUIPMENT CORPORATION
! Maynard, Massachusetts
!
! This software is furnished under a license and may be used
! and copied only in accordance with the terms of such license
! and 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. No title to
! and ownership of the software is hereby transferred.
!
! The information in this software is subject to change
! without notice and should not be construed as a commitment
! by DIGITAL EQUIPMENT CORPORATION.
!
! DIGITAL assumes no responsibility for the use or reliability
! of its software on equipment which is not supplied by
! DIGITAL.
!
!++
! FACILITY: LBR20 - Librarian Utility
!
! ABSTRACT:
!
!
! This module contains the routines to access an object module file.
!
!
! ENVIRONMENT: ANY
!
! AUTHOR: ALAN D. PECKHAM, CREATION DATE: 12-MAY-80
!
! MODIFIED BY:
!
! Alan D. Peckham, : VERSION 01
! 02 - Restructure file positioning to refer to block/offset.
! Define OBJ_MARK and OBJ_SET routines to mark the beginning
! of an object module and rewind the file to that position.
!--
!
! TABLE OF CONTENTS:
!
FORWARD ROUTINE
GET_BYTE, !Get a byte from the file
GET_WORD, !Get a word from the file
OBJ_CLOSE : NOVALUE, !Close object file
OBJ_MARK : NOVALUE, !Mark current record position
OBJ_OPEN, !Open object file
OBJ_RECORD, !Read length of next record
OBJ_SET : NOVALUE, !Reset to marked position
OBJ_WORD; !Read next word of record
!
! INCLUDE FILES
!
LIBRARY 'LBRCOM'; !LBR COMMON DEFINITIONS
!
! MACROS:
!
! None
!
! EQUATED SYMBOLS:
!
LITERAL
UNKNOWN = 0,
RSX = 1,
MACY11 = 2;
!
! OWN STORAGE:
!
OWN
EOF,
FILE_TYPE,
FIRST_BYTE,
MARK_BLOCK,
MARK_OFFSET,
OBJBLK,
RECORD_COUNT,
WORD_READ,
WORD_VALUE;
BIND
WORD_PTR = CH$PTR (WORD_VALUE,, 16);
!
! EXTERNAL REFERENCES:
!
EXTERNAL ROUTINE
CLOSE, !Close a file.
FILNM : NOVALUE, !Convert file name to ASCII.
FILPOS, !Get the current file position.
GETFIL, !Get a word from the file.
OPEN, !Open a file.
POSFIL; !Position to a word in the file
EXTERNAL
FLAGS : BITVECTOR [M_MAX_BITS];
ROUTINE GET_BYTE =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
IF .EOF THEN RETURN 0;
IF (FIRST_BYTE = NOT .FIRST_BYTE)
THEN
BEGIN
IF GETFIL (.OBJBLK, CH$PTR (WORD_READ,, 16), 1) EQL 0
THEN
RETURN (EOF = TRUE; 0);
WORD_READ = CH$RCHAR (CH$PTR (WORD_READ,, 16));
.WORD_READ<0, 8>
END
ELSE
.WORD_READ<8, 8>
END; !OF GET_BYTE
ROUTINE GET_WORD =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
IF .EOF THEN RETURN 0;
IF GETFIL (.OBJBLK, CH$PTR (WORD_READ,, 16), 1) EQL 0
THEN
RETURN (EOF = TRUE; 0);
CH$RCHAR (CH$PTR (WORD_READ,, 16))
END; !OF GET_WORD
GLOBAL ROUTINE OBJ_CLOSE : NOVALUE =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
CLOSE (.OBJBLK);
END; !OF OBJ_CLOSE
GLOBAL ROUTINE OBJ_MARK : NOVALUE =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
FILPOS (.OBJBLK, MARK_BLOCK, MARK_OFFSET);
IF (.FILE_TYPE EQL MACY11) AND .FIRST_BYTE
THEN
MARK_OFFSET<0, 1> = 1;
END; !OF OBJ_MARK
GLOBAL ROUTINE OBJ_OPEN (OBJ_FILBLK) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
OBJBLK = .OBJ_FILBLK;
FILE_TYPE = UNKNOWN;
EOF = FALSE;
RECORD_COUNT = 0;
IF NOT OPEN (.OBJBLK, F_READ, F_BINARY)
THEN
RETURN
BEGIN
TYPLN (1, CH$ASCIZ (FATAL, 'Unable to open object file "%@"'),
FILNM, .OBJBLK);
FALSE
END;
TRUE
END; !OF OBJ_OPEN
GLOBAL ROUTINE OBJ_RECORD =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
WHILE .RECORD_COUNT GTR 0 DO
OBJ_WORD ();
CASE .FILE_TYPE FROM 0 TO 2 OF
SET
[UNKNOWN] :
BEGIN
UNTIL (WORD_READ = GET_WORD ()) GTR 0 DO
IF .EOF THEN RETURN -1;
SELECT .WORD_READ OF
SET
[1] :
FIRST_BYTE = TRUE;
[256] :
FIRST_BYTE = FALSE;
[1, 256] :
BEGIN
FILE_TYPE = MACY11;
RECORD_COUNT = 0;
DO
BEGIN
GET_BYTE ();
WORD_VALUE = 0;
WORD_VALUE<0, 8> = GET_BYTE ();
WORD_VALUE<8, 8> = GET_BYTE ();
IF .WORD_VALUE GTR 4
THEN
RECORD_COUNT = .WORD_VALUE - 4
ELSE
BEGIN
GET_BYTE ();
UNTIL GET_BYTE () EQL 1 DO
IF .EOF THEN RETURN -1;
END;
IF .EOF THEN RETURN -1;
END
WHILE .RECORD_COUNT EQL 0;
END;
[OTHERWISE] :
BEGIN
FILE_TYPE = RSX;
UNTIL (RECORD_COUNT = .WORD_READ) GTR 0 DO
BEGIN
WORD_READ = GET_WORD ();
IF .EOF THEN RETURN -1;
END;
END;
TES;
END;
[RSX] :
BEGIN
WHILE (RECORD_COUNT = GET_WORD ()) EQL 0 DO
IF .EOF THEN RETURN -1;
END;
[MACY11] :
DO
BEGIN
UNTIL GET_BYTE () EQL 1 DO
IF .EOF THEN RETURN -1;
GET_BYTE ();
WORD_VALUE = 0;
WORD_VALUE<0, 8> = GET_BYTE ();
WORD_VALUE<8, 8> = GET_BYTE ();
IF (RECORD_COUNT = .WORD_VALUE - 4) LEQ 0 THEN GET_BYTE ();
IF .EOF THEN RETURN -1;
END
UNTIL .RECORD_COUNT GTR 0
TES;
.RECORD_COUNT
END; !OF OBJ_RECORD
GLOBAL ROUTINE OBJ_SET : NOVALUE =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
IF .MARK_OFFSET<0, 1>
THEN
BEGIN
FIRST_BYTE = TRUE;
MARK_OFFSET<0, 1> = 0;
END
ELSE
FIRST_BYTE = FALSE;
POSFIL (.OBJBLK, .MARK_BLOCK, .MARK_OFFSET);
IF .FIRST_BYTE
THEN
BEGIN
GETFIL (.OBJBLK, CH$PTR (WORD_READ,, 16), 1);
WORD_READ = CH$RCHAR (CH$PTR (WORD_READ,, 16));
END;
RECORD_COUNT = 0;
END; !OF OBJ_SET
GLOBAL ROUTINE OBJ_WORD =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
IF .RECORD_COUNT LEQ 0
THEN
0
ELSE
CASE .FILE_TYPE FROM 1 TO 2 OF
SET
[RSX] :
BEGIN
RECORD_COUNT = .RECORD_COUNT - 2;
GET_WORD ()
END;
[MACY11] :
BEGIN
WORD_VALUE = 0;
WORD_VALUE<0, 8> = GET_BYTE ();
IF (RECORD_COUNT = .RECORD_COUNT - 1) GTR 0
THEN
BEGIN
WORD_VALUE<8, 8> = GET_BYTE ();
RECORD_COUNT = .RECORD_COUNT - 1;
END;
IF .RECORD_COUNT LEQ 0 THEN GET_BYTE ();
.WORD_VALUE
END;
TES
END; !OF OBJ_WORD
END
ELUDOM