--- parser3/src/include/Attic/pa_value.h 2001/03/07 13:54:46 1.41 +++ parser3/src/include/Attic/pa_value.h 2001/03/08 13:42:31 1.45 @@ -1,5 +1,5 @@ /* - $Id: pa_value.h,v 1.41 2001/03/07 13:54:46 paf Exp $ + $Id: pa_value.h,v 1.45 2001/03/08 13:42:31 paf Exp $ */ /* @@ -12,46 +12,43 @@ #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, Array& params); class Method : public Pooled { public: const String& name; - Array& params_names; - Array& locals_names; - const Array& code; + // either numbered params // for native-code methods = operators + int numbered_params_count; + // or named params&locals // for parser-code methods + Array *params_names; Array *locals_names; + // the Code + 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) : + int anumbered_params_count, + 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) { + numbered_params_count(anumbered_params_count), + params_names(aparams_names), locals_names(alocals_names), + 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 +68,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,7 +84,7 @@ 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 @@ -93,6 +93,7 @@ public: // Value // string: value // unknown: "" // double: value + // bool: must be 0: so in ^if(1>2) it would'nt become "FALSE" string which is 'true' // others: 0 virtual String *get_string() { return 0; } @@ -119,7 +120,7 @@ public: // Value // operator_class: (field)=value - static values only // codeframe: wcontext_transparent // methodframe: my or self_transparent - virtual Value *get_element(String& name) { failed("type is '%s', can not get element from it"); return 0; } + virtual Value *get_element(const String& name) { failed("type is '%s', can not get element from it"); return 0; } // hash: (key)=value // object_class, operator_class: (field)=value - static values only