xref: /titanic_51/usr/src/cmd/abi/spectrans/spec2map/util.h (revision 753d2d2e8e7fd0c9bcf736d9bf2f2faf4d6234cc)
1*753d2d2eSraf /*
2*753d2d2eSraf  * CDDL HEADER START
3*753d2d2eSraf  *
4*753d2d2eSraf  * The contents of this file are subject to the terms of the
5*753d2d2eSraf  * Common Development and Distribution License, Version 1.0 only
6*753d2d2eSraf  * (the "License").  You may not use this file except in compliance
7*753d2d2eSraf  * with the License.
8*753d2d2eSraf  *
9*753d2d2eSraf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*753d2d2eSraf  * or http://www.opensolaris.org/os/licensing.
11*753d2d2eSraf  * See the License for the specific language governing permissions
12*753d2d2eSraf  * and limitations under the License.
13*753d2d2eSraf  *
14*753d2d2eSraf  * When distributing Covered Code, include this CDDL HEADER in each
15*753d2d2eSraf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*753d2d2eSraf  * If applicable, add the following below this CDDL HEADER, with the
17*753d2d2eSraf  * fields enclosed by brackets "[]" replaced with your own identifying
18*753d2d2eSraf  * information: Portions Copyright [yyyy] [name of copyright owner]
19*753d2d2eSraf  *
20*753d2d2eSraf  * CDDL HEADER END
21*753d2d2eSraf  */
22*753d2d2eSraf /*
23*753d2d2eSraf  * Copyright (c) 1997-1999 by Sun Microsystems, Inc.
24*753d2d2eSraf  * All rights reserved.
25*753d2d2eSraf  */
26*753d2d2eSraf 
27*753d2d2eSraf #ifndef _UTIL_H
28*753d2d2eSraf #define	_UTIL_H
29*753d2d2eSraf 
30*753d2d2eSraf #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*753d2d2eSraf 
32*753d2d2eSraf #ifdef	__cplusplus
33*753d2d2eSraf extern "C" {
34*753d2d2eSraf #endif
35*753d2d2eSraf 
36*753d2d2eSraf /* String tables */
37*753d2d2eSraf typedef struct table_head_t {
38*753d2d2eSraf 	int nelem;
39*753d2d2eSraf 	int used;
40*753d2d2eSraf 	char *elements[1];	/* Actually elements[nelem] */
41*753d2d2eSraf } table_t;
42*753d2d2eSraf 
43*753d2d2eSraf #define	TABLE_INITIAL	50
44*753d2d2eSraf #define	TABLE_INCREMENT	50
45*753d2d2eSraf 
46*753d2d2eSraf 
47*753d2d2eSraf extern char *get_stringtable(table_t *, int);
48*753d2d2eSraf extern int in_stringtable(table_t *, const char *);
49*753d2d2eSraf extern int in_stringset(char *, char *);
50*753d2d2eSraf extern void print_stringtable(table_t *);
51*753d2d2eSraf extern void sort_stringtable(table_t *);
52*753d2d2eSraf 
53*753d2d2eSraf /* Caveat: never discard return value: see note in .c file. */
54*753d2d2eSraf extern table_t *add_to_stringtable(table_t *, char *);
55*753d2d2eSraf 
56*753d2d2eSraf extern table_t *create_stringtable(int);
57*753d2d2eSraf extern table_t *free_stringtable(table_t *);
58*753d2d2eSraf 
59*753d2d2eSraf #ifdef	__cplusplus
60*753d2d2eSraf }
61*753d2d2eSraf #endif
62*753d2d2eSraf 
63*753d2d2eSraf #endif	/* _UTIL_H */
64