00001 00002 /****************************************************************************** 00003 * MODULE : base_evaluator.hpp 00004 * DESCRIPTION: The base evaluator 00005 * COPYRIGHT : (C) 2006 Joris van der Hoeven 00006 ******************************************************************************* 00007 * This software falls under the GNU general public license and comes WITHOUT 00008 * ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details. 00009 * If you don't have this file, write to the Free Software Foundation, Inc., 00010 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00011 ******************************************************************************/ 00012 00013 #ifndef __BASE_EVALUATOR_HPP 00014 #define __BASE_EVALUATOR_HPP 00015 #include <basix/evaluator.hpp> 00016 #include <mmxlight/environment.hpp> 00017 00019 00020 namespace mmx { 00021 00022 class base_evaluator_rep: public evaluator_rep { 00023 protected: 00024 environment env; 00025 00026 public: 00027 virtual void* get_internal_data () const; 00028 //virtual environment get_environment () const; 00029 //virtual void set_environment_type (nat tp) const; 00030 //virtual nat get_environment_type () const; 00031 virtual void set (const generic& var, const generic& val) const; 00032 virtual void reset (const generic& var) const; 00033 virtual void overload (const generic& var, const generic& val, nat p) const; 00034 virtual bool contains (const generic& var) const; 00035 virtual generic get (const generic& var) const; 00036 virtual bool get (const generic& var, generic& val) const; 00037 00038 virtual generic eval (const generic& x) const; 00039 virtual vector<generic> eval_cdr (const vector<generic>& x) const; 00040 virtual generic construct (const generic& x) const; 00041 virtual generic apply (const generic& fun) const; 00042 virtual generic apply (const generic& fun, const generic& x1) const; 00043 virtual generic apply (const generic& fun, 00044 const generic& x1, const generic& x2) const; 00045 virtual generic apply (const generic& fun, const vector<generic>& v) const; 00046 00047 public: 00048 inline base_evaluator_rep (); 00049 inline base_evaluator_rep (const evaluator& ev); 00050 }; 00051 00052 evaluator base_evaluator (); 00053 evaluator base_evaluator (const evaluator& ev); 00054 00055 environment get_environment (const evaluator& ev); 00056 void set_environment_type (const evaluator& ev, nat tp); 00057 nat get_environment_type (const evaluator& ev); 00058 00059 inline base_evaluator_rep::base_evaluator_rep (): 00060 env (global_environment ()) {} 00061 inline base_evaluator_rep::base_evaluator_rep (const evaluator& ev): 00062 env (local_environment (get_environment (ev))) {} 00063 00064 } // namespace mmx 00065 #endif // __BASE_EVALUATOR_HPP