00001 #ifndef _TOKE_SCANNER_H 00002 #define _TOKE_SCANNER_H 00003 00004 /* 00005 * OpenBIOS - free your system! 00006 * ( FCode tokenizer ) 00007 * 00008 * This program is part of a free implementation of the IEEE 1275-1994 00009 * Standard for Boot (Initialization Configuration) Firmware. 00010 * 00011 * Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org> 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation; version 2 of the License. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA 00025 * 00026 */ 00027 00028 /* ************************************************************************** 00029 * 00030 * External/Prototype definitions for Scanning functions in Tokenizer 00031 * 00032 * (C) Copyright 2005 IBM Corporation. All Rights Reserved. 00033 * Module Author: David L. Paktor dlpaktor@us.ibm.com 00034 * 00035 **************************************************************************** */ 00036 00037 00038 #include "types.h" 00039 #include "ticvocab.h" 00040 00041 /* ************************************************************************** * 00042 * 00043 * Global Variables Exported 00044 * 00045 **************************************************************************** */ 00046 00047 extern u8 *statbuf; /* The word just read from the input stream */ 00048 extern u8 base; /* The numeric-interpretation base */ 00049 00050 00051 /* pci data */ 00052 extern bool pci_is_last_image; 00053 extern u16 pci_image_rev; /* Vendor's Image, NOT PCI Data Struct Rev */ 00054 extern u16 pci_vpd; 00055 00056 00057 /* Having to do with the state of the tokenization */ 00058 extern bool offs16; /* Using 16-bit branch- (etc) -offsets */ 00059 extern bool in_tokz_esc; /* TRUE if in "Tokenizer Escape" mode */ 00060 extern bool incolon; /* TRUE if inside a colon definition */ 00061 extern bool haveend; /* TRUE if the "end" code was read. */ 00062 extern int do_loop_depth; /* How deep we are inside DO ... LOOP variants */ 00063 00064 /* For special-case error detection or reporting */ 00065 extern int lastcolon; /* Loc'n in output stream of latest colon-def'n. */ 00066 /* Used for error-checking of IBM-style Locals */ 00067 extern char *last_colon_defname; /* Name of last colon-definition */ 00068 extern char *last_colon_filename; /* File where last colon-def'n made */ 00069 extern unsigned int last_colon_lineno; /* Line number of last colon-def'n */ 00070 extern bool report_multiline; /* False to suspend multiline warning */ 00071 extern unsigned int last_colon_abs_token_no; 00072 00073 /* ************************************************************************** * 00074 * 00075 * Function Prototypes / Functions Exported: 00076 * 00077 **************************************************************************** */ 00078 00079 void init_scanner( void ); 00080 void exit_scanner( void ); 00081 void init_scan_state( void ); 00082 void fcode_ender( void ); 00083 00084 bool skip_until( char lim_ch); 00085 void push_source( void (*res_func)(), _PTR res_parm, bool is_f_chg ); 00086 signed long get_word( void); 00087 bool get_word_in_line( char *func_nam); 00088 bool get_rest_of_line( void); 00089 void warn_unterm( int severity, 00090 char *something, 00091 unsigned int saved_lineno); 00092 void warn_if_multiline( char *something, unsigned int start_lineno ); 00093 void user_message( tic_param_t pfield ); 00094 void skip_user_message( tic_param_t pfield ); 00095 bool get_number( long *result); 00096 void eval_string( char *inp_bufr); 00097 00098 void process_remark( tic_param_t pfield ); 00099 bool filter_comments( u8 *inword); 00100 bool as_a_what( fwtoken definer, char *as_what); 00101 tic_hdr_t *lookup_word( char *stat_name, char **where_pt1, char **where_pt2 ); 00102 bool word_exists( char *stat_name, char **where_pt1, char **where_pt2 ); 00103 void warn_if_duplicate ( char *stat_name); 00104 void trace_creation( fwtoken definer, char *nu_name); 00105 void tokenize_one_word( signed long wlen ); 00106 void check_name_length( signed long wlen ); 00107 00108 void tokenize( void ); 00109 00110 /* ************************************************************************** 00111 * 00112 * Macro Name: FUNC_CPY_BUF_SIZE 00113 * Size of a temporary buffer to retain a copy of 00114 * a function name taken from statbuf, when statbuf 00115 * will be used to return a value, but the function 00116 * name might still be needed for an error message. 00117 * 00118 **************************************************************************** */ 00119 00120 #define FUNC_CPY_BUF_SIZE 40 00121 00122 00123 #endif /* _TOKE_SCANNER_H */