--- parser3/src/include/Attic/pa_value.h 2001/02/25 17:58:28 1.35 +++ parser3/src/include/Attic/pa_value.h 2001/03/08 12:13:35 1.43 @@ -1,5 +1,5 @@ /* - $Id: pa_value.h,v 1.35 2001/02/25 17:58:28 paf Exp $ + $Id: pa_value.h,v 1.43 2001/03/08 12:13:35 paf Exp $ */ /* @@ -12,46 +12,40 @@ #include "pa_pool.h" #include "pa_string.h" #include "pa_array.h" -//#include "pa_voperator.h" #define NAME_NAME "NAME" class Value; class VClass; -//class VOperator; class Junction; class WContext; class VAliased; +class Request; + +typedef void (*Native_code_ptr)(Request& request); class Method : public Pooled { public: const String& name; - Array& params_names; - Array& locals_names; - const Array& code; + Array *params_names; + Array *locals_names; + const Array *parser_code;/*OR*/Native_code_ptr native_code; Method( Pool& apool, const String& aname, - Array& aparams_names, - Array& alocals_names, - const Array& acode) : + Array *aparams_names, + Array *alocals_names, + const Array *aparser_code, Native_code_ptr anative_code) : Pooled(apool), name(aname), params_names(aparams_names), locals_names(alocals_names), - code(acode) { + parser_code(aparser_code), native_code(anative_code) { } }; -/* -class Operator : public Method { - // operator module static vars stored in there - VOperator_class *self; -}; -*/ - class Junction : public Pooled { public: @@ -71,8 +65,11 @@ public: code(acode) { } + // always present Value& self; + // either these // so called 'method-junction' VClass *vclass; Method *method; + // or these are present // so called 'code-junction' Value *root; Value *rcontext; WContext *wcontext; @@ -84,15 +81,31 @@ public: // Value // all: for error reporting after fail(), etc virtual const char *type() const =0; - /*const*/ String& name() const { return *fname; } + String& name() const { return *fname; } + + // unknown: false + // others: true + virtual bool get_defined() { return true; } // string: value // unknown: "" + // double: value // others: 0 virtual String *get_string() { return 0; } // string: value - virtual void put_string(String *astring) { failed("storing string to '%s'"); } + // double: value + // bool: value + virtual double get_double() { failed("getting numerical value of '%s'"); return 0; } + + // unknown: false + // bool: value + // double: 0 or !0 + // string: empty or not + // hash: size!=0 + // TODO table: count!=0 + // others: true + virtual bool get_bool() { return true; } // junction: auto_calc,root,self,rcontext,wcontext, code virtual Junction *get_junction() { return 0; } @@ -119,7 +132,7 @@ public: // Value // valiased: this // wcontext: transparent // methodframe: self_transparent - virtual Value *get_aliased() { return 0; } + virtual VAliased *get_aliased() { return 0; } public: // usage @@ -145,16 +158,4 @@ private: void failed(char *action); }; -/* -descendants: - text:+ value:String - hash:+ keys&values:Hash - table:+ columns_order:Array, columns:Hash, rows:Array - object_class:+ STATIC:Hash, methods:Hash - object_instance:+ object_class, fields:Hash - method_ref:+ self:Value/object_class, method:String - method_self_n_params_n_locals:+ self:Value/object_class[1st try], params_locals&values:Hash[2nd try] - junction:+ self:Value, code:String -*/ - #endif