STIO(3X) STIO(3X)
NAME
stio - routines that provide a binary read/write interface
to the MIPS symbol table
SYNOPSIS
#include <syms.h>
long streadbinary (filename, how)
char *filename;
char how;
long streadst (fn, how, filebase, pchdr,flags)
long fn;
char how;
long filebase;
pCHDRR pchdr;
long flags;
void stwritebinary (filename, flags)
char *filename;
long flags;
void stwritest (fn, flags)
long fn;
long flags;
DESCRIPTION
The CHDRR structure (see cmplrs/stsupport.h and the stcu
manual page) represents a symbol table in memory. A new
CHDRR can be created by reading a symbol table in from disk.
St_readbinary and st_readst read a symbol table in from
disk.
St_readbinary takes the file name of the symbol table and
assumes the symbol table header (HDRR in sym.h) occurs at
the beginning of the file. St_readst assumes that its file
number references a file positioned at the beginning of the
symbol table header and that the filebase parameter
specifies where the object or symbol table file is based
(for example, non-zero for archives).
The second parameter to the read routines can be `r' for
read only or `a' for appending to the symbol table. Existing
local symbol, line, procedure, auxiliary, optimization, and
local string tables can not be appended. If they didn't
exist on disk, they can be created. This restriction stems
from the allocation algorithm for those symbol table
sections when read in from disk and follows the standard
pattern for building the symbol table.
The symbol table can be read incrementally. If pchdr is
zero, st_readst assumes that no symbol table has been read
Page 1 (last mod. 8/20/87)
STIO(3X) STIO(3X)
yet; therefore, it reads in the symbol table header and file
descriptors. The flags argument is a bit mask that defines
what other tables should be read. St_p* constants for each
table, defined in stsupport.h, can be ORed. If flags equals
`-1', all tables are read. If pchdr is set, the tables
specified by flags are added to the tables that have already
been read. Pchdr's value can be gotten from
st_current_pchdr. See stcu(3).
Line number entries are encoded on disk, the read routines
expand them to longs. See the MIPS System Programmer Guide.
If the version stamp is out of date, a warning message is
issued to stderr. If the magic number in the HDRR is
incorrect, st_error is called. All other errors cause the
read routines to read non-zero; otherwise, a zero is
returned.
St_writebinary and st_writest are symmetric to the read
routines, excluding the how and pchdr parameters. The flags
parameter is a bit mask that defines what table should be
written. St_p* constants for each table, defined in
stsupport.h, can be ORed. If flags equals `-1', all tables
are written.
The write routines write sections of the table in the
approved order, as specified in the link editor (ld)
specification.
Line numbers are compressed on disk. See the MIPS System
Programmer Guide.
The write routines start all sections of the symbol table on
four-byte boundaries.
If the write routines encounter an error, st_error is
called. After writing the symbol table, further access to
the table by other routines is undefined.
The programs must be loaded with the object file access
routine library libmld.a.
AUTHOR
Mark I. Himelstein
SEE ALSO
stcu(3x), stfe(3x), stfd(3x), sym.h(5), stsupport.h(5),
sterror(5)
ORIGIN
MIPS Computer Systems
Page 2 (last mod. 8/20/87)