00001 /* --------------------------------------------------------------------------- 00002 00003 00004 This file is part of the ``trace'' package of NuSMV version 2. 00005 Copyright (C) 2010 by FBK-irst. 00006 00007 NuSMV version 2 is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 NuSMV version 2 is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00020 00021 For more information on NuSMV see <http://nusmv.fbk.eu> 00022 or email to <nusmv-users@fbk.eu>. 00023 Please report bugs to <nusmv-users@fbk.eu>. 00024 00025 To contact the NuSMV development board, email to <nusmv@fbk.eu>. 00026 00027 -----------------------------------------------------------------------------*/ 00028 00037 #ifndef __NUSMV_CORE_TRACE_LOADERS_TRACE_XML_LOADER_PRIVATE_H__ 00038 #define __NUSMV_CORE_TRACE_LOADERS_TRACE_XML_LOADER_PRIVATE_H__ 00039 00040 #if HAVE_CONFIG_H 00041 # include "nusmv-config.h" 00042 #endif 00043 00044 #include "nusmv/core/trace/pkg_traceInt.h" 00045 #include "nusmv/core/trace/loaders/TraceLoader_private.h" 00046 00047 /* this implementation requires libxml2 */ 00048 #include <libxml/parser.h> 00049 #include <libxml/tree.h> 00050 00051 /*---------------------------------------------------------------------------*/ 00052 /* Constant declarations */ 00053 /*---------------------------------------------------------------------------*/ 00054 00060 #define LIBXML2_BUFSIZE 0x8000 /* 32 kbytes */ 00061 00067 #define MAX_ID_LEN 0x3ffe /* 4 kbytes -2 */ 00068 00074 #define MAX_VL_LEN 0x3ffe /* 4 kbytes -2 */ 00075 00081 #define MAX_EQ_LEN (4 + MAX_ID_LEN + MAX_VL_LEN) /* 8 kbytes */ 00082 00083 /*---------------------------------------------------------------------------*/ 00084 /* Macro declarations */ 00085 /*---------------------------------------------------------------------------*/ 00086 00087 /*---------------------------------------------------------------------------*/ 00088 /* Type declarations */ 00089 /*---------------------------------------------------------------------------*/ 00090 00091 00098 typedef struct TraceXmlLoader_TAG 00099 { 00100 INHERITS_FROM(TraceLoader); 00101 00102 xmlParserCtxtPtr parser; 00103 NuSMVEnv_ptr environment; 00104 00105 /* for xml attributes: */ 00106 /* int type; */ 00107 00108 char* stream_buf; 00109 char* trace_desc; 00110 00111 char* xml_filename; 00112 00113 char* curr_symb; /* last parsed symbol */ 00114 char* curr_val; /* contents of the text stream */ 00115 00116 char* curr_eq; /* tmp equality buf */ 00117 Trace_ptr trace;/* trace under construction */ 00118 TraceIter step; /* current step to put data into */ 00119 00120 /* parsing flags: */ 00121 TraceXmlTag curr_parsing; 00122 boolean parse_error; 00123 unsigned last_time; 00124 00125 boolean requires_value; 00126 00127 /* preserve internal parser informations */ 00128 int nusmv_yylineno; 00129 char* nusmv_input_file; 00130 00131 NodeList_ptr loopback_states; 00132 00133 /* a hash table to remember already reported 00134 undeclared/wrongly-places symbols to avoid reporting them many 00135 times (this is meaningless if it is not an error to find such 00136 symbol) */ 00137 hash_ptr all_wrong_symbols; 00138 00139 /* If true parsing halts when encounters undefined symbols */ 00140 boolean halt_on_undefined_symbols; 00141 00142 /* If true parsing halts when encounters a symbol in an 00143 inappropriate section */ 00144 boolean halt_on_wrong_section; 00145 00146 } TraceXmlLoader; 00147 00148 00151 /*---------------------------------------------------------------------------*/ 00152 /* Function prototypes */ 00153 /*---------------------------------------------------------------------------*/ 00154 00159 void trace_xml_loader_init(TraceXmlLoader_ptr self, 00160 const char* xml_filename, 00161 boolean halt_on_undefined_symbols, 00162 boolean halt_on_wrong_section); 00163 00168 void trace_xml_loader_deinit(TraceXmlLoader_ptr self); 00169 00170 Trace_ptr trace_xml_loader_load(TraceLoader_ptr loader, 00171 const SymbTable_ptr st, 00172 const NodeList_ptr symbols); 00173 00176 #endif /* __TRACE_XML_PRIVATE__H */ 00177