/* * %M% %I% of %G% * %W% */ /* begincopyright Copyright (c) 1988 Xerox Corporation. All rights reserved. Use and copying of this software and preparation of derivative works based upon this software are permitted. Any distribution of this software or derivative works must comply with all applicable United States export control laws. This software is made available AS IS, and Xerox Corporation makes no warranty about the software, its performance or its conformity to any specification. Any person obtaining a copy of this software is requested to send their name and post office or electronic mail address to: PCR Coordinator Xerox PARC 3333 Coyote Hill Rd. Palo Alto, CA endcopyright */ /* * register pcr commands to manipulate the library list * libdefault - set library list to the default list * libpop - pop up the stack of library lists * libpush - push down the stack of library lists * libclear - clear the library list * liblist - list the libraries on the library list * libappend - append the argument to the end of the library list * libprepend - prepend the argument to the beginning of the library list * libclose - close all libraries to release file descriptors. * * and initialize the library list to the following: * /usr/lib/libc.a /usr/lib/libm.a /usr/lib/libpixrect.a */ void XR←lib←init(); /* * given an undefined symbol (sym), look it up in the library list, * return true, * (libfd) a file descriptor for the library, * (liboffset) an offset at which begins the library member defining the symbol, * i.e. lseek to liboffset to read a.out header, * (magic) a hint on the type of the library, * and (modulename) the string "<name of the library>(<name of library member>)". * return false if symbol is not found in any library in the library list. */ bool XR←lib←symfind(/* char *sym, XR←Fildes *libfd, long *liboffset, long *magic, char **modulename */); /* * private, implementation details */ struct library { char *libname; /* name of the library */ XR←Fildes fildes; /* if not -1, file descriptor of opened library */ struct ranlib *ranp; /* pointer to array of struct ranlib's in ←SYMDEF */ struct ranlib *ranpMax; /* pointer to end of struct ranlib array */ char *strp; /* pointer to string table in ←SYMDEF */ }; #define MAX←UNDEFINEDS 1500 #define LIB←LIST←STACK←MAX←DEPTH 3