Index Index for
Section 3
Index Alphabetical
listing for S
Bottom of page Bottom of
page

stio(3)

NAME

stio - routines that provide a binary read/write interface to the symbol table

SYNOPSIS

#include <syms.h> long st_readbinary( char *filename, char how ); long st_readst( long fn, char how, long filebase, pCHDRR pchdr, long flags ); void st_writebinary( char *filename, long flags ); void st_writest( long fn, long flags );

DESCRIPTION

The CHDRR structure (see stcu(3)) represents a symbol table in memory. A new CHDRR can be created by reading a symbol table from disk. The st_readbinary() and st_readst() routines read a symbol table from disk. The st_readbinary() routine takes the file name of the symbol table and assumes the symbol table header HDRR occurs at the beginning of the file. The st_readst() routine 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, nonzero 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 cannot be appended. If they did not 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 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 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. The value of pchdr can be gotten from st_current_pchdr() (see stcu(3)). Line number entries are encoded on disk, and the read routines expand them to longs. 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 nonzero; otherwise, a zero is returned. The st_writebinary() and st_writest() routines 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 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. 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.

SEE ALSO

stcu(3), stfe(3), stfd(3)

Index Index for
Section 3
Index Alphabetical
listing for S
Top of page Top of
page