diff options
Diffstat (limited to 'src/printer')
-rw-r--r-- | src/printer/Makefile.am | 5 | ||||
-rw-r--r-- | src/printer/model_format_mode.cpp | 39 | ||||
-rw-r--r-- | src/printer/model_format_mode.h | 41 | ||||
-rw-r--r-- | src/printer/options | 3 | ||||
-rw-r--r-- | src/printer/options_handlers.h | 56 |
5 files changed, 143 insertions, 1 deletions
diff --git a/src/printer/Makefile.am b/src/printer/Makefile.am index bb94d75de..21997d2dc 100644 --- a/src/printer/Makefile.am +++ b/src/printer/Makefile.am @@ -10,6 +10,8 @@ libprinter_la_SOURCES = \ printer.cpp \ dagification_visitor.h \ dagification_visitor.cpp \ + model_format_mode.h \ + model_format_mode.cpp \ ast/ast_printer.h \ ast/ast_printer.cpp \ smt1/smt1_printer.h \ @@ -19,4 +21,5 @@ libprinter_la_SOURCES = \ cvc/cvc_printer.h \ cvc/cvc_printer.cpp -EXTRA_DIST = +EXTRA_DIST = \ + options_handlers.h diff --git a/src/printer/model_format_mode.cpp b/src/printer/model_format_mode.cpp new file mode 100644 index 000000000..df3585bcf --- /dev/null +++ b/src/printer/model_format_mode.cpp @@ -0,0 +1,39 @@ +/********************* */ +/*! \file model_format_mode.cpp + ** \verbatim + ** Original author: mdeters + ** Major contributors: none + ** Minor contributors (to current version): none + ** This file is part of the CVC4 prototype. + ** Copyright (c) 2009-2012 The Analysis of Computer Systems Group (ACSys) + ** Courant Institute of Mathematical Sciences + ** New York University + ** See the file COPYING in the top-level source directory for licensing + ** information.\endverbatim + ** + ** \brief [[ Add one-line brief description here ]] + ** + ** [[ Add lengthier description here ]] + ** \todo document this file + **/ + +#include "printer/model_format_mode.h" + +namespace CVC4 { + +std::ostream& operator<<(std::ostream& out, ModelFormatMode mode) { + switch(mode) { + case MODEL_FORMAT_MODE_DEFAULT: + out << "MODEL_FORMAT_MODE_DEFAULT"; + break; + case MODEL_FORMAT_MODE_TABLE: + out << "MODEL_FORMAT_MODE_TABLE"; + break; + default: + out << "ModelFormatMode:UNKNOWN![" << unsigned(mode) << "]"; + } + + return out; +} + +}/* CVC4 namespace */ diff --git a/src/printer/model_format_mode.h b/src/printer/model_format_mode.h new file mode 100644 index 000000000..bdfa5721a --- /dev/null +++ b/src/printer/model_format_mode.h @@ -0,0 +1,41 @@ +/********************* */ +/*! \file model_format_mode.h + ** \verbatim + ** Original author: mdeters + ** Major contributors: none + ** Minor contributors (to current version): none + ** This file is part of the CVC4 prototype. + ** Copyright (c) 2009-2012 The Analysis of Computer Systems Group (ACSys) + ** Courant Institute of Mathematical Sciences + ** New York University + ** See the file COPYING in the top-level source directory for licensing + ** information.\endverbatim + ** + ** \brief [[ Add one-line brief description here ]] + ** + ** [[ Add lengthier description here ]] + ** \todo document this file + **/ + +#include "cvc4_public.h" + +#ifndef __CVC4__PRINTER__MODEL_FORMAT_MODE_H +#define __CVC4__PRINTER__MODEL_FORMAT_MODE_H + +#include <iostream> + +namespace CVC4 { + +/** Enumeration of model_format modes (how to print models from get-model command). */ +typedef enum { + /** default mode (print expressions in the output language format) */ + MODEL_FORMAT_MODE_DEFAULT, + /** print functional values in a table format */ + MODEL_FORMAT_MODE_TABLE, +} ModelFormatMode; + +std::ostream& operator<<(std::ostream& out, ModelFormatMode mode) CVC4_PUBLIC; + +}/* CVC4 namespace */ + +#endif /* __CVC4__PRINTER__MODEL_FORMAT_H */ diff --git a/src/printer/options b/src/printer/options index d95c7457d..7e1b67986 100644 --- a/src/printer/options +++ b/src/printer/options @@ -5,4 +5,7 @@ module PRINTER "printer/options.h" Printing +option modelFormatMode --model-format=MODE ModelFormatMode :handler CVC4::printer::stringToModelFormatMode :default MODEL_FORMAT_MODE_DEFAULT :read-write :include "printer/model_format_mode.h" :handler-include "printer/options_handlers.h" + print format mode for models, see --model-format=help + endmodule diff --git a/src/printer/options_handlers.h b/src/printer/options_handlers.h new file mode 100644 index 000000000..dea5a383c --- /dev/null +++ b/src/printer/options_handlers.h @@ -0,0 +1,56 @@ +/********************* */ +/*! \file options_handlers.h + ** \verbatim + ** Original author: mdeters + ** Major contributors: none + ** Minor contributors (to current version): none + ** This file is part of the CVC4 prototype. + ** Copyright (c) 2009-2012 The Analysis of Computer Systems Group (ACSys) + ** Courant Institute of Mathematical Sciences + ** New York University + ** See the file COPYING in the top-level source directory for licensing + ** information.\endverbatim + ** + ** \brief Custom handlers and predicates for printer options + ** + ** Custom handlers and predicates for printer options. + **/ + +#include "cvc4_private.h" + +#ifndef __CVC4__PRINTER__OPTIONS_HANDLERS_H +#define __CVC4__PRINTER__OPTIONS_HANDLERS_H + +#include "printer/model_format_mode.h" + +namespace CVC4 { +namespace printer { + +static const std::string modelFormatHelp = "\ +Model format modes currently supported by the --model-format option:\n\ +\n\ +default \n\ ++ Print model as expressions in the output language format.\n\ +\n\ +table\n\ ++ Print functional expressions over finite domains in a table format.\n\ +"; + +inline ModelFormatMode stringToModelFormatMode(std::string option, std::string optarg, SmtEngine* smt) throw(OptionException) { + if(optarg == "default") { + return MODEL_FORMAT_MODE_DEFAULT; + } else if(optarg == "table") { + return MODEL_FORMAT_MODE_TABLE; + } else if(optarg == "help") { + puts(modelFormatHelp.c_str()); + exit(1); + } else { + throw OptionException(std::string("unknown option for --model-format: `") + + optarg + "'. Try --model-format help."); + } +} + +}/* CVC4::printer namespace */ +}/* CVC4 namespace */ + +#endif /* __CVC4__PRINTER__OPTIONS_HANDLERS_H */ |