00001 /*****************************************************************************/ 00002 /*! 00003 * \file vc_cmd.h 00004 * 00005 * Author: Clark Barrett 00006 * 00007 * Created: Fri Dec 13 22:35:15 2002 00008 * 00009 * <hr> 00010 * Copyright (C) 2003 by the Board of Trustees of Leland Stanford 00011 * Junior University and by New York University. 00012 * 00013 * License to use, copy, modify, sell and/or distribute this software 00014 * and its documentation for any purpose is hereby granted without 00015 * royalty, subject to the terms and conditions defined in the \ref 00016 * LICENSE file provided with this distribution. In particular: 00017 * 00018 * - The above copyright notice and this permission notice must appear 00019 * in all copies of the software and related documentation. 00020 * 00021 * - THE SOFTWARE IS PROVIDED "AS-IS", WITHOUT ANY WARRANTIES, 00022 * EXPRESSED OR IMPLIED. USE IT AT YOUR OWN RISK. 00023 * 00024 * <hr> 00025 * 00026 */ 00027 /*****************************************************************************/ 00028 00029 #ifndef _cvcl__vc_cvc__vc_cmd_h_ 00030 #define _cvcl__vc_cvc__vc_cmd_h_ 00031 00032 #include <string> 00033 #include "compat_hash_map.h" 00034 #include "exception.h" 00035 00036 namespace CVCL { 00037 00038 class ValidityChecker; 00039 class Parser; 00040 class Context; 00041 class Expr; 00042 00043 template<class Data> 00044 class ExprMap; 00045 00046 class VCCmd { 00047 ValidityChecker* d_vc; 00048 Parser* d_parser; 00049 // TODO: move state variables into validity checker. 00050 typedef std::hash_map<const char*, Context*> CtxtMap; 00051 std::string d_name_of_cur_ctxt; 00052 CtxtMap d_map; 00053 00054 //! Take a parsed Expr and evaluate it 00055 bool evaluateCommand(const Expr& e) throw(Exception); 00056 // Fetch the next command and evaluate it. Return true if 00057 // evaluation was successful, false otherwise. In especially bad 00058 // cases an exception may be thrown. 00059 bool evaluateNext() throw(Exception); 00060 void findAxioms(const Expr& e, ExprMap<bool>& skolemAxioms, 00061 ExprMap<bool>& visited); 00062 Expr skolemizeAx(const Expr& e); 00063 void reportResult(bool ret, bool checkingValidity = true); 00064 00065 public: 00066 VCCmd(ValidityChecker* vc, Parser* parser); 00067 ~VCCmd(); 00068 00069 // Main loop function 00070 void processCommands(); 00071 }; 00072 00073 } 00074 00075 #endif