3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

removed ini_file

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-12-01 16:30:39 -08:00
parent 823dd6ca47
commit 9374a4e20a
38 changed files with 82 additions and 1971 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,117 +0,0 @@
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
ini_file.h
Abstract:
Configuration file support.
Author:
Leonardo de Moura (leonardo) 2007-05-10.
Revision History:
--*/
#ifndef _INI_FILE_H_
#define _INI_FILE_H_
#include<iostream>
#include<limits.h>
#include<string>
#include"symbol.h"
#include"vector.h"
#include"ref.h"
#ifdef _EXTERNAL_RELEASE
#define PRIVATE_PARAMS(CODE) ((void) 0)
#else
#define PRIVATE_PARAMS(CODE) { CODE }
#endif
struct param_vector_imp;
struct ini_params_imp;
class ini_parser;
typedef std::pair<symbol, unsigned> symbol_nat_pair;
inline std::ostream & operator<<(std::ostream & out, symbol_nat_pair const & p) {
out << p.first << ":" << p.second;
return out;
}
/**
\brief Support for multiple values for a parameter. The values are used to configure
different cores.
*/
class param_vector {
unsigned m_ref_count;
param_vector_imp * m_imp;
friend struct ini_params_imp;
friend class ini_parser;
public:
// TODO: onwer is a big hack
param_vector(void * owner);
~param_vector();
void inc_ref();
void dec_ref();
void copy_params(void * curr_owner, unsigned idx);
unsigned size(void) const;
};
class set_get_param_exception {
std::string m_id;
std::string m_msg;
public:
set_get_param_exception(char const * id, char const * msg):m_id(id), m_msg(msg) {}
char const * get_param_id() const { return m_id.c_str(); }
char const * get_msg() const { return m_msg.c_str(); }
};
class ini_parser_exception {
unsigned m_pos;
std::string m_msg;
public:
ini_parser_exception(unsigned pos, char const * msg):m_pos(pos), m_msg(msg) {}
unsigned get_pos() const { return m_pos; }
char const * get_msg() const { return m_msg.c_str(); }
};
class ini_params {
ini_params_imp * m_imp;
public:
ini_params(bool abort_on_error = true);
~ini_params();
void freeze(bool f = true);
void register_bool_param(char const * param_name, bool & value, char const * descr = 0, bool is_mutable = false);
void register_unsigned_param(char const * param_name, unsigned min, unsigned max, unsigned & value, char const * descr = 0, bool is_mutable = false);
void register_unsigned_param(char const * param_name, unsigned & value, char const * descr = 0, bool is_mutable = false) {
register_unsigned_param(param_name, 0, INT_MAX, value, descr, is_mutable);
}
void register_int_param(char const * param_name, int min, int max, int & value, char const * descr = 0, bool is_mutable = false);
void register_int_param(char const * param_name, int & value, char const * descr = 0, bool is_mutable = false) {
register_int_param(param_name, INT_MIN, INT_MAX, value, descr, is_mutable);
}
void register_double_param(char const * param_name, double & value, char const * descr = 0,bool is_mutable = false);
void register_percentage_param(char const * param_name, double & value, char const * descr = 0, bool is_mutable = false);
void register_string_param(char const * param_name, std::string & value, char const * descr = 0, bool is_mutable = false);
void register_symbol_param(char const * param_name, symbol & value, char const * descr = 0, bool is_mutable = false);
void register_symbol_list_param(char const * param_name, svector<symbol> & value, char const * descr = 0, bool is_mutable = false);
void register_symbol_nat_list_param(char const * param_name, svector<symbol_nat_pair> & value, char const * descr = 0, bool is_mutable = false);
void register_param_vector(param_vector * pv);
void read_ini_file(std::istream & in);
void display_params(std::ostream & out) const;
void display_parameter_help(char const* param_id, std::ostream & out) const;
void set_param_value(char const * param_id, char const * param_value);
void set_param_mutable(char const * param_id);
bool get_param_value(char const * param_id, std::string& param_value);
void display_params_documentation(std::ostream & out) const;
};
#endif /* _INI_FILE_H_ */

View file

@ -1,41 +0,0 @@
#ifdef _WINDOWS
#include <windows.h>
#endif
#include "instruction_count.h"
#ifdef _WINDOWS
typedef BOOL (WINAPI *QTCP)(HANDLE, PULONG64);
static QTCP QTCP_proc;
BOOL WINAPI dummy_qtcp(HANDLE h, PULONG64 u)
{
*u = 0;
return 0;
}
inline void check_handler()
{
if (!QTCP_proc) {
QTCP_proc = (QTCP) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "QueryThreadCycleTime");
if (!QTCP_proc)
QTCP_proc = &dummy_qtcp;
}
}
#endif
void instruction_count::start() {
m_count = 0;
#ifdef _WINDOWS
check_handler();
QTCP_proc(GetCurrentThread(), &m_count);
#endif
}
double instruction_count::get_num_instructions() {
unsigned long long current = 0;
#ifdef _WINDOWS
check_handler();
QTCP_proc(GetCurrentThread(), &current);
#endif
return static_cast<double>(current - m_count);
}

View file

@ -1,43 +0,0 @@
/*++
Copyright (c) 2009 Microsoft Corporation
Module Name:
instruction_count.h
Abstract:
<abstract>
Author:
Nikolaj Bjorner (nbjorner) 2009-03-04.
Revision History:
--*/
#ifndef _INSTRUCTION_COUNT_H_
#define _INSTRUCTION_COUNT_H_
/**
\brief Wrapper for an instruction counter.
*/
class instruction_count {
unsigned long long m_count;
public:
instruction_count() : m_count(0) {}
~instruction_count() {}
void start();
double get_num_instructions();
bool is_instruction_maxed(double max_instr) {
return max_instr > 0.0 && get_num_instructions() > max_instr;
}
};
#endif /* _INSTRUcTION_COUNT_H_ */

View file

@ -18,7 +18,6 @@ Revision History:
--*/
#include"util.h"
#include"ini_file.h"
unsigned g_verbosity_level = 0;
@ -30,8 +29,9 @@ unsigned get_verbosity_level() {
return g_verbosity_level;
}
void register_verbosity_level(ini_params & p) {
p.register_unsigned_param("VERBOSE", g_verbosity_level, "be verbose, where the value is the verbosity level", true);
void register_verbosity_level() {
// PARAM-TODO
// p.register_unsigned_param("VERBOSE", g_verbosity_level, "be verbose, where the value is the verbosity level", true);
}
static std::ostream* g_verbose_stream = &std::cerr;

View file

@ -23,7 +23,6 @@ Revision History:
#include "util.h"
#include "buffer.h"
#include "vector.h"
#include "ini_file.h"
#ifdef _WINDOWS
#define PRF sprintf_s
@ -83,8 +82,9 @@ void set_warning_stream(std::ostream* strm) {
g_warning_stream = strm;
}
void register_warning(ini_params & p) {
p.register_bool_param("WARNING", g_warning_msgs, "enable/disable warning messages", true);
void register_warning() {
// PARAM-TODO
// p.register_bool_param("WARNING", g_warning_msgs, "enable/disable warning messages", true);
}
void disable_error_msg_prefix() {