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 2004 Sun Microsystems, Inc. All rights reserved. 24*753d2d2eSraf * Use is subject to license terms. 25*753d2d2eSraf */ 26*753d2d2eSraf 27*753d2d2eSraf #ifndef _PARSER_H 28*753d2d2eSraf #define _PARSER_H 29*753d2d2eSraf 30*753d2d2eSraf #include <sys/param.h> 31*753d2d2eSraf 32*753d2d2eSraf #ifdef __cplusplus 33*753d2d2eSraf extern "C" { 34*753d2d2eSraf #endif 35*753d2d2eSraf 36*753d2d2eSraf typedef struct metainfo { 37*753d2d2eSraf char mi_filename[MAXPATHLEN]; 38*753d2d2eSraf int mi_line_number; 39*753d2d2eSraf int mi_nlines; 40*753d2d2eSraf int mi_ext_cnt; 41*753d2d2eSraf int mi_flags; 42*753d2d2eSraf int mi_extended; 43*753d2d2eSraf } Meta_info; 44*753d2d2eSraf 45*753d2d2eSraf typedef struct translator_info { 46*753d2d2eSraf char *ti_liblist; 47*753d2d2eSraf char *ti_dash_I; 48*753d2d2eSraf char *ti_output_file; 49*753d2d2eSraf int ti_nfiles; 50*753d2d2eSraf int ti_verbosity; 51*753d2d2eSraf int ti_flags; 52*753d2d2eSraf char *ti_versfile; 53*753d2d2eSraf char *ti_arch; 54*753d2d2eSraf int ti_archtoken; 55*753d2d2eSraf int ti_libtype; /* set to FILTERLIB if processing filter lib */ 56*753d2d2eSraf } Translator_info; 57*753d2d2eSraf 58*753d2d2eSraf typedef struct { 59*753d2d2eSraf char *key; 60*753d2d2eSraf int token; 61*753d2d2eSraf } xlator_keyword_t; 62*753d2d2eSraf 63*753d2d2eSraf /* 64*753d2d2eSraf * Translator Flags 65*753d2d2eSraf * These are values for the ti_flags member of the Translator_info 66*753d2d2eSraf * structure. Each bit of ti_flags represents a flag. 67*753d2d2eSraf * first bit = picky flag; translator runs in picky mode 68*753d2d2eSraf * picky mode means complain about interfaces with no versions 69*753d2d2eSraf */ 70*753d2d2eSraf #define XLATOR_PICKY_FLAG 0x01 71*753d2d2eSraf 72*753d2d2eSraf /* Return Codes from xlator_* functions */ 73*753d2d2eSraf #define XLATOR_FATAL -2 74*753d2d2eSraf #define XLATOR_NONFATAL -1 75*753d2d2eSraf #define XLATOR_SUCCESS 0 76*753d2d2eSraf #define XLATOR_SKIP 1 77*753d2d2eSraf 78*753d2d2eSraf /* Misc Return Codes from Utility Functions */ 79*753d2d2eSraf enum { 80*753d2d2eSraf XLATOR_KW_NOTFOUND, 81*753d2d2eSraf XLATOR_KW_FUNC, 82*753d2d2eSraf XLATOR_KW_DATA, 83*753d2d2eSraf XLATOR_KW_END 84*753d2d2eSraf }; 85*753d2d2eSraf 86*753d2d2eSraf /* Library Type */ 87*753d2d2eSraf #define NORMALLIB 0 88*753d2d2eSraf #define FILTERLIB 1 89*753d2d2eSraf 90*753d2d2eSraf /* Maxmimum levels of extends */ 91*753d2d2eSraf #define MAX_EXTENDS 16 92*753d2d2eSraf 93*753d2d2eSraf /* Architecture Bitmap */ 94*753d2d2eSraf #define XLATOR_SPARC 0x01 95*753d2d2eSraf #define XLATOR_SPARCV9 0x02 96*753d2d2eSraf #define XLATOR_I386 0x04 97*753d2d2eSraf #define XLATOR_IA64 0x08 98*753d2d2eSraf #define XLATOR_AMD64 0x10 99*753d2d2eSraf #define XLATOR_ALLARCH 0xFF 100*753d2d2eSraf 101*753d2d2eSraf extern xlator_keyword_t *keywordlist; 102*753d2d2eSraf extern char **filelist; 103*753d2d2eSraf extern int verbosity; 104*753d2d2eSraf 105*753d2d2eSraf extern int frontend(const Translator_info *); 106*753d2d2eSraf extern int do_extends(const Meta_info, const Translator_info *, char *); 107*753d2d2eSraf extern void split(const char *, char *, char *); 108*753d2d2eSraf extern void remcomment(char const *); 109*753d2d2eSraf extern void getlinecont(char *, char *, int, FILE *, Meta_info *); 110*753d2d2eSraf extern char *line_to_buf(char *, const char *); 111*753d2d2eSraf extern int non_empty(const char *); 112*753d2d2eSraf extern int check4extends(const char *, const char *, int, FILE *); 113*753d2d2eSraf extern int interesting_keyword(xlator_keyword_t *, const char *); 114*753d2d2eSraf extern int arch_strtoi(const char *); 115*753d2d2eSraf extern int readline(char **, FILE *); 116*753d2d2eSraf extern int arch_match(FILE *, int); 117*753d2d2eSraf 118*753d2d2eSraf /* xlator_ functions */ 119*753d2d2eSraf extern xlator_keyword_t *xlator_init(const Translator_info *); 120*753d2d2eSraf extern int xlator_startlib(char const *libname); 121*753d2d2eSraf extern int xlator_startfile(char const *filename); 122*753d2d2eSraf extern int xlator_start_if(const Meta_info meta_info, const int token, 123*753d2d2eSraf char *value); 124*753d2d2eSraf extern int xlator_take_kvpair(const Meta_info, const int token, char *value); 125*753d2d2eSraf extern int xlator_end_if(const Meta_info, const char *value); 126*753d2d2eSraf extern int xlator_endfile(void); 127*753d2d2eSraf extern int xlator_endlib(void); 128*753d2d2eSraf extern int xlator_end(void); 129*753d2d2eSraf 130*753d2d2eSraf #ifdef __cplusplus 131*753d2d2eSraf } 132*753d2d2eSraf #endif 133*753d2d2eSraf 134*753d2d2eSraf #endif /* _PARSER_H */ 135