00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00039 #ifndef __NUSMV_CORE_NODE_PRINTERS_MASTER_PRINTER_H__
00040 #define __NUSMV_CORE_NODE_PRINTERS_MASTER_PRINTER_H__
00041
00042 #include "nusmv/core/node/NodeMgr.h"
00043 #include "nusmv/core/node/MasterNodeWalker.h"
00044
00051 typedef struct MasterPrinter_TAG* MasterPrinter_ptr;
00052
00059 #define MASTER_PRINTER(self) \
00060 ((MasterPrinter_ptr) self)
00061
00067 #define MASTER_PRINTER_CHECK_INSTANCE(self) \
00068 (nusmv_assert(MASTER_PRINTER(self) != MASTER_PRINTER(NULL)))
00069
00070
00078 typedef enum StreamType_TAG {
00079 STREAM_TYPE_DEFAULT,
00080 STREAM_TYPE_STDOUT,
00081 STREAM_TYPE_STDERR,
00082 STREAM_TYPE_STRING,
00083 STREAM_TYPE_FILE,
00084 STREAM_TYPE_FUNCTION
00085 } StreamType;
00086
00097 typedef int (*StreamTypeFunction_ptr)(const char* str, void* arg);
00098
00099
00107 union StreamTypeArg
00108 {
00109
00110 FILE* file;
00111
00112
00113 struct {
00114
00115 StreamTypeFunction_ptr func_ptr;
00116
00117 void* argument;
00118 } function;
00119 };
00120
00121
00127 #define STREAM_TYPE_ARG_UNUSED \
00128 NULL
00129
00130
00133
00134
00135
00136
00137
00138
00144 int print_node(MasterPrinter_ptr wffprinter, FILE *, node_ptr);
00145
00152 char* sprint_node(MasterPrinter_ptr wffprinter, node_ptr);
00153
00160 int print_node_indent_at(MasterPrinter_ptr iwffprinter,
00161 FILE *stream, node_ptr n, int ofs);
00162
00170 char* sprint_node_indent_at(MasterPrinter_ptr iwffprinter,
00171 node_ptr n, int ofs);
00172
00179 int print_node_indent(MasterPrinter_ptr iwffprinter,
00180 FILE *stream, node_ptr n);
00181
00189 char* sprint_node_indent(MasterPrinter_ptr iwffprinter,
00190 node_ptr n);
00191
00192
00193
00194
00203 MasterPrinter_ptr MasterPrinter_create(const NuSMVEnv_ptr env);
00204
00213 int
00214 MasterPrinter_print_node(MasterPrinter_ptr self, node_ptr n);
00215
00224 int
00225 MasterPrinter_print_string(MasterPrinter_ptr self, const char* str);
00226
00238 const char*
00239 MasterPrinter_get_streamed_string(const MasterPrinter_ptr self);
00240
00248 void
00249 MasterPrinter_reset_stream(MasterPrinter_ptr self, int offs);
00250
00266 void
00267 MasterPrinter_set_stream_type(MasterPrinter_ptr self,
00268 StreamType type,
00269 const union StreamTypeArg* arg);
00270
00277 StreamType
00278 MasterPrinter_get_stream_type(const MasterPrinter_ptr self);
00279
00287 int
00288 MasterPrinter_flush_stream(MasterPrinter_ptr self);
00289
00302 void
00303 MasterPrinter_close_stream(MasterPrinter_ptr self);
00304
00310 void debug_print_node(NuSMVEnv_ptr env, node_ptr node);
00311
00317 void debug_print_sexp(NuSMVEnv_ptr env, node_ptr node);
00318
00322 #endif