12159047fSniklas /* ranlib.h -- archive library index member definition for GNU.
2*5f210c2aSfgsch    Copyright 1990, 1991 Free Software Foundation, Inc.
32159047fSniklas 
42159047fSniklas This program is free software; you can redistribute it and/or modify
52159047fSniklas it under the terms of the GNU General Public License as published by
62159047fSniklas the Free Software Foundation; either version 2 of the License, or
72159047fSniklas (at your option) any later version.
82159047fSniklas 
92159047fSniklas This program is distributed in the hope that it will be useful,
102159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of
112159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
122159047fSniklas GNU General Public License for more details.
132159047fSniklas 
142159047fSniklas You should have received a copy of the GNU General Public License
152159047fSniklas along with this program; if not, write to the Free Software
162159047fSniklas Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
172159047fSniklas 
182159047fSniklas /* The Symdef member of an archive contains two things:
192159047fSniklas    a table that maps symbol-string offsets to file offsets,
202159047fSniklas    and a symbol-string table.  All the symbol names are
212159047fSniklas    run together (each with trailing null) in the symbol-string
222159047fSniklas    table.  There is a single longword bytecount on the front
232159047fSniklas    of each of these tables.  Thus if we have two symbols,
242159047fSniklas    "foo" and "_bar", that are in archive members at offsets
252159047fSniklas    200 and 900, it would look like this:
262159047fSniklas         16		; byte count of index table
272159047fSniklas   	0		; offset of "foo" in string table
282159047fSniklas   	200		; offset of foo-module in file
292159047fSniklas   	4		; offset of "bar" in string table
302159047fSniklas   	900		; offset of bar-module in file
312159047fSniklas   	9		; byte count of string table
322159047fSniklas   	"foo\0_bar\0"	; string table  */
332159047fSniklas 
342159047fSniklas #define	RANLIBMAG	"__.SYMDEF"	/* Archive file name containing index */
352159047fSniklas #define	RANLIBSKEW	3		/* Creation time offset */
362159047fSniklas 
372159047fSniklas /* Format of __.SYMDEF:
382159047fSniklas    First, a longword containing the size of the 'symdef' data that follows.
392159047fSniklas    Second, zero or more 'symdef' structures.
402159047fSniklas    Third, a longword containing the length of symbol name strings.
412159047fSniklas    Fourth, zero or more symbol name strings (each followed by a null).  */
422159047fSniklas 
432159047fSniklas struct symdef
442159047fSniklas   {
452159047fSniklas     union
462159047fSniklas       {
472159047fSniklas 	unsigned long string_offset;	/* In the file */
482159047fSniklas 	char *name;			/* In memory, sometimes */
492159047fSniklas       } s;
502159047fSniklas     /* this points to the front of the file header (AKA member header --
512159047fSniklas        a struct ar_hdr), not to the front of the file or into the file).
522159047fSniklas        in other words it only tells you which file to read */
532159047fSniklas     unsigned long file_offset;
542159047fSniklas   };
552159047fSniklas 
562159047fSniklas /* Compatability with BSD code */
572159047fSniklas 
582159047fSniklas #define	ranlib	symdef
592159047fSniklas #define	ran_un	s
602159047fSniklas #define	ran_strx string_offset
612159047fSniklas #define	ran_name name
622159047fSniklas #define	ran_off	file_offset
63