/*------------------------------------------------------------------------*/ // Do include 'internal.hpp' but try to minimize internal dependencies. #include "internal.hpp" #include "signal.hpp" // Separate, only need for apps. /*------------------------------------------------------------------------*/ namespace CaDiCaL { // A wrapper app which makes up the CaDiCaL stand alone solver. It in // essence only consists of the 'App::main' function. So this class // contains code, which is not required if only the library interface in // the class 'Solver' is used (defined in 'cadical.hpp'). It further uses // static data structures in order to have a signal handler catch signals. // // It is thus neither thread-safe nor reentrant. If you want to use // multiple instances of the solver use the 'Solver' interface directly // which is thread-safe and reentrant among different solver instances. /*------------------------------------------------------------------------*/ class App : public Handler, public Terminator { Solver * solver; // Global solver. #ifndef __WIN32 // Command line options. // int time_limit; // '-t ' #endif // Strictness of (DIMACS) parsing: // // 0 = force parsing and completely ignore header // 1 = relaxed header handling (default) // 2 = strict header handling // // To use '0' use '-f' of '--force'. // To use '2' use '--strict'. // int force_strict_parsing; bool force_writing; static bool most_likely_existing_cnf_file (const char * path); // Internal variables. // int max_var; // Set after parsing. volatile bool timesup; // Asynchronous termination. // Printing. // void print_usage (bool all = false); void print_witness (FILE *); #ifndef QUIET void signal_message (const char * msg, int sig); #endif // Option handling. // bool set (const char*); bool set (const char*, int); int get (const char*); bool verbose () { return get ("verbose") && !get ("quiet"); } /*----------------------------------------------------------------------*/ // The actual initialization. // void init (); // Terminator interface. // bool terminate () { return timesup; } // Handler interface. // void catch_signal (int sig); void catch_alarm (); public: App (); ~App (); // Parse the arguments and run the solver. // int main (int arg, char ** argv); }; /*------------------------------------------------------------------------*/ void App::print_usage (bool all) { printf ( "usage: cadical [