Annotation of parser3/src/include/pa_request.h, revision 1.32

1.1       paf         1: /*
1.32    ! paf         2:        Parser
        !             3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
        !             4:        Author: Alexander Petrosyan <paf@design.ru>
        !             5: 
        !             6:        $Id: pa_string.C,v 1.35 2001/03/10 12:12:51 paf Exp $
1.1       paf         7: */
                      8: 
                      9: #ifndef PA_REQUEST_H
                     10: #define PA_REQUEST_H
                     11: 
                     12: #include "pa_pool.h"
1.4       paf        13: #include "pa_exception.h"
1.5       paf        14: #include "pa_hash.h"
1.7       paf        15: #include "pa_wcontext.h"
1.6       paf        16: #include "pa_value.h"
1.7       paf        17: #include "pa_stack.h"
1.12      paf        18: #include "pa_vclass.h"
1.7       paf        19: 
                     20: #define MAIN_METHOD_NAME "main"
1.27      paf        21: #define AUTO_METHOD_NAME "auto"
1.30      paf        22: #define RUN_CLASS_NAME "RUN"
1.29      paf        23: #define AUTO_CLASS_NAME "AUTO"
1.23      paf        24: 
1.29      paf        25: #define ROOT_CLASS_NAME "ROOT"
                     26: #define ENV_CLASS_NAME "ENV"
1.7       paf        27: 
                     28: #ifndef NO_STRING_ORIGIN
1.31      paf        29: #      define COMPILE_PARAMS char *source, String *name, VClass *base_class, char *file
                     30: #      define COMPILE(source, name, base_class, file) real_compile(source, name, base_class, file)
1.7       paf        31: #else
1.31      paf        32: #      define COMPILE_PARAMS char *source, String *name, VClass *base_class
                     33: #      define COMPILE(source, name, base_class, file) real_compile(source, name, base_class)
1.7       paf        34: #endif
1.4       paf        35: 
                     36: class Local_request_exception;
1.1       paf        37: 
1.7       paf        38: class Request : public Pooled {
1.1       paf        39: public:
                     40:        
1.17      paf        41:        Request(Pool& apool);
1.3       paf        42:        ~Request() {}
1.1       paf        43: 
1.7       paf        44:        // global classes
1.6       paf        45:        Hash& classes() { return fclasses; }
1.12      paf        46:        Array& classes_array() { return fclasses_array; }
1.6       paf        47: 
                     48:        // core request processing
                     49:        void core();
1.17      paf        50: 
1.31      paf        51:        VClass *use(char *file, 
                     52:                String *name=0, 
                     53:                VClass *base_class=0, 
                     54:                bool fail_on_read_problem=true); // core.C
                     55:        Value& autocalc(Value& value, const String *name=0, 
                     56:                bool make_string=true); // execute.C
1.28      paf        57: 
                     58:        void write(const String& astring) {
                     59:                wcontext->write(astring, String::Untaint_lang::NO);  // write(const) = clean
                     60:        }
1.22      paf        61: 
1.25      paf        62:        void write(Value& avalue) {
                     63:                // appending possible string, assigning untaint language
                     64:                wcontext->write(avalue, lang); 
1.22      paf        65:        }
                     66: 
1.17      paf        67: public:
1.22      paf        68:        
                     69:        // default base
                     70:        VClass root_class;
1.23      paf        71:        // $ENV:fields here
                     72:        VClass env_class;
1.17      paf        73: 
1.22      paf        74:        // contexts
                     75:        Value *self, *root, *rcontext;
                     76:        WContext *wcontext;
1.6       paf        77: 
1.7       paf        78: private: // core data
1.6       paf        79: 
                     80:        // classes
                     81:        Hash fclasses;
1.12      paf        82:        Array fclasses_array;
1.6       paf        83: 
1.7       paf        84:        // execution stack
                     85:        Stack stack;
                     86: 
                     87: private: // core.C
                     88: 
1.12      paf        89:        char *execute_MAIN();
1.7       paf        90: 
                     91: private: // compile.C
                     92: 
1.12      paf        93:        VClass& real_compile(COMPILE_PARAMS);
1.7       paf        94: 
                     95: private: // execute.C
                     96: 
1.29      paf        97:        char *execute_static_method(VClass& vclass, String& method_name, bool return_cstr);
1.11      paf        98:        void execute(const Array& ops);
1.9       paf        99: 
                    100:        Value *get_element();
1.22      paf       101: 
                    102: private: // lang&raw 
                    103:        
                    104:        String::Untaint_lang lang;
                    105: 
                    106: private: // lang&raw manipulation
                    107: 
1.24      paf       108:        // TODO
1.4       paf       109: };
1.1       paf       110: 
                    111: #endif

E-mail: