xref: /illumos-gate/usr/src/cmd/abi/spectrans/spec2map/xlator.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_XLATOR_H
28 #define	_XLATOR_H
29 
30 #include <parser.h>
31 #include <errlog.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #define	ARCHBUFLEN	80
38 
39 /* Architecture Bitmap */
40 #define	XLATOR_SPARC	0x01
41 #define	XLATOR_SPARCV9	0x02
42 #define	XLATOR_I386	0x04
43 #define	XLATOR_IA64	0x08
44 #define	XLATOR_AMD64	0x10
45 #define	XLATOR_ALLARCH	0xFF
46 
47 /* *_sanity() return codes */
48 #define	VS_OK	0
49 #define	VS_INVARCH	1
50 #define	VS_INVVERS	2
51 #define	VS_INVALID	3
52 
53 typedef enum {
54 	NOTYPE,			/* A type has not yet been assigned */
55 				/* to the interface */
56 	FUNCTION = XLATOR_KW_FUNC,	/* Functional Interface */
57 	DATA = XLATOR_KW_DATA		/* Data Interface */
58 }    Iftype;
59 
60 typedef enum {
61 	DEFAULT,		/* No special mapfile treatment */
62 	DIRECT,			/* Needs "<sym> DIRECT;" in mapfile */
63 	NODIRECT,		/* Needs "<sym> NODIRECT;" in mapfile */
64 	PROTECTED		/* Needs to be in a "protected:" section */
65 }    Ifbinding;
66 
67 typedef struct Interface {
68 	char const *IF_name;		/* Name of interface */
69 	Iftype IF_type;		/* type: FUNCTION or DATA */
70 	char *IF_version;	/* Version information */
71 	char *IF_class;		/* public or private or some color */
72 	Ifbinding IF_binding;	/* direct or nodirect or protected */
73 	char *IF_filter;	/* path string for "filter" keyword */
74 	char *IF_auxiliary;	/* path string for "auxiliary" keyword */
75 }    Interface;
76 
77 extern char *TargetArchStr;
78 extern int IsFilterLib;
79 
80 extern int check_version(const int, const int, const char);
81 extern int parse_setfile(const char *);
82 extern int parse_versions(const char *);
83 
84 extern int valid_version(const char *);
85 extern int valid_arch(const char *);
86 
87 #ifdef	__cplusplus
88 }
89 #endif
90 
91 #endif	/* _XLATOR_H */
92