1*2775Sraf /* 2*2775Sraf * CDDL HEADER START 3*2775Sraf * 4*2775Sraf * The contents of this file are subject to the terms of the 5*2775Sraf * Common Development and Distribution License, Version 1.0 only 6*2775Sraf * (the "License"). You may not use this file except in compliance 7*2775Sraf * with the License. 8*2775Sraf * 9*2775Sraf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*2775Sraf * or http://www.opensolaris.org/os/licensing. 11*2775Sraf * See the License for the specific language governing permissions 12*2775Sraf * and limitations under the License. 13*2775Sraf * 14*2775Sraf * When distributing Covered Code, include this CDDL HEADER in each 15*2775Sraf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*2775Sraf * If applicable, add the following below this CDDL HEADER, with the 17*2775Sraf * fields enclosed by brackets "[]" replaced with your own identifying 18*2775Sraf * information: Portions Copyright [yyyy] [name of copyright owner] 19*2775Sraf * 20*2775Sraf * CDDL HEADER END 21*2775Sraf */ 22*2775Sraf /* 23*2775Sraf * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*2775Sraf * Use is subject to license terms. 25*2775Sraf */ 26*2775Sraf 27*2775Sraf #ifndef _PARSER_H 28*2775Sraf #define _PARSER_H 29*2775Sraf 30*2775Sraf #pragma ident "%Z%%M% %I% %E% SMI" 31*2775Sraf 32*2775Sraf #include <sys/param.h> 33*2775Sraf 34*2775Sraf #ifdef __cplusplus 35*2775Sraf extern "C" { 36*2775Sraf #endif 37*2775Sraf 38*2775Sraf typedef struct metainfo { 39*2775Sraf char mi_filename[MAXPATHLEN]; 40*2775Sraf int mi_line_number; 41*2775Sraf int mi_nlines; 42*2775Sraf int mi_ext_cnt; 43*2775Sraf int mi_flags; 44*2775Sraf int mi_extended; 45*2775Sraf } Meta_info; 46*2775Sraf 47*2775Sraf typedef struct translator_info { 48*2775Sraf char *ti_liblist; 49*2775Sraf char *ti_dash_I; 50*2775Sraf char *ti_output_file; 51*2775Sraf int ti_nfiles; 52*2775Sraf int ti_verbosity; 53*2775Sraf int ti_flags; 54*2775Sraf char *ti_versfile; 55*2775Sraf char *ti_arch; 56*2775Sraf int ti_archtoken; 57*2775Sraf int ti_libtype; /* set to FILTERLIB if processing filter lib */ 58*2775Sraf } Translator_info; 59*2775Sraf 60*2775Sraf typedef struct { 61*2775Sraf char *key; 62*2775Sraf int token; 63*2775Sraf } xlator_keyword_t; 64*2775Sraf 65*2775Sraf /* 66*2775Sraf * Translator Flags 67*2775Sraf * These are values for the ti_flags member of the Translator_info 68*2775Sraf * structure. Each bit of ti_flags represents a flag. 69*2775Sraf * first bit = picky flag; translator runs in picky mode 70*2775Sraf * picky mode means complain about interfaces with no versions 71*2775Sraf */ 72*2775Sraf #define XLATOR_PICKY_FLAG 0x01 73*2775Sraf 74*2775Sraf /* Return Codes from xlator_* functions */ 75*2775Sraf #define XLATOR_FATAL -2 76*2775Sraf #define XLATOR_NONFATAL -1 77*2775Sraf #define XLATOR_SUCCESS 0 78*2775Sraf #define XLATOR_SKIP 1 79*2775Sraf 80*2775Sraf /* Misc Return Codes from Utility Functions */ 81*2775Sraf enum { 82*2775Sraf XLATOR_KW_NOTFOUND, 83*2775Sraf XLATOR_KW_FUNC, 84*2775Sraf XLATOR_KW_DATA, 85*2775Sraf XLATOR_KW_END 86*2775Sraf }; 87*2775Sraf 88*2775Sraf /* Library Type */ 89*2775Sraf #define NORMALLIB 0 90*2775Sraf #define FILTERLIB 1 91*2775Sraf 92*2775Sraf /* Maxmimum levels of extends */ 93*2775Sraf #define MAX_EXTENDS 16 94*2775Sraf 95*2775Sraf /* Architecture Bitmap */ 96*2775Sraf #define XLATOR_SPARC 0x01 97*2775Sraf #define XLATOR_SPARCV9 0x02 98*2775Sraf #define XLATOR_I386 0x04 99*2775Sraf #define XLATOR_IA64 0x08 100*2775Sraf #define XLATOR_AMD64 0x10 101*2775Sraf #define XLATOR_ALLARCH 0xFF 102*2775Sraf 103*2775Sraf extern xlator_keyword_t *keywordlist; 104*2775Sraf extern char **filelist; 105*2775Sraf extern int verbosity; 106*2775Sraf 107*2775Sraf extern int frontend(const Translator_info *); 108*2775Sraf extern int do_extends(const Meta_info, const Translator_info *, char *); 109*2775Sraf extern void split(const char *, char *, char *); 110*2775Sraf extern void remcomment(char const *); 111*2775Sraf extern void getlinecont(char *, char *, int, FILE *, Meta_info *); 112*2775Sraf extern char *line_to_buf(char *, const char *); 113*2775Sraf extern int non_empty(const char *); 114*2775Sraf extern int check4extends(const char *, const char *, int, FILE *); 115*2775Sraf extern int interesting_keyword(xlator_keyword_t *, const char *); 116*2775Sraf extern int arch_strtoi(const char *); 117*2775Sraf extern int readline(char **, FILE *); 118*2775Sraf extern int arch_match(FILE *, int); 119*2775Sraf 120*2775Sraf /* xlator_ functions */ 121*2775Sraf extern xlator_keyword_t *xlator_init(const Translator_info *); 122*2775Sraf extern int xlator_startlib(char const *libname); 123*2775Sraf extern int xlator_startfile(char const *filename); 124*2775Sraf extern int xlator_start_if(const Meta_info meta_info, const int token, 125*2775Sraf char *value); 126*2775Sraf extern int xlator_take_kvpair(const Meta_info, const int token, char *value); 127*2775Sraf extern int xlator_end_if(const Meta_info, const char *value); 128*2775Sraf extern int xlator_endfile(void); 129*2775Sraf extern int xlator_endlib(void); 130*2775Sraf extern int xlator_end(void); 131*2775Sraf 132*2775Sraf #ifdef __cplusplus 133*2775Sraf } 134*2775Sraf #endif 135*2775Sraf 136*2775Sraf #endif /* _PARSER_H */ 137