Annotation of parser3/src/classes/root.C, revision 1.12

1.1       paf         1: /*
1.10      paf         2:        Parser
                      3:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.12    ! paf         4:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.10      paf         5: 
1.12    ! paf         6:        $Id: root.C,v 1.11 2001/03/10 16:58:56 paf Exp $
1.1       paf         7: */
                      8: 
                      9: #include "pa_request.h"
1.8       paf        10: #include "_root.h"
1.1       paf        11: 
1.6       paf        12: static void _if(Request& r, Array *params) {
1.2       paf        13:        bool condition=
                     14:                r.autocalc(
1.6       paf        15:                        *static_cast<Value *>(params->get(0)), 
1.11      paf        16:                        0/*no name*/,
1.2       paf        17:                        false/*don't make it string*/).get_bool();
1.6       paf        18:        if(condition) {
                     19:                Value& value=r.autocalc(*static_cast<Value *>(params->get(1)));
1.9       paf        20:                r.wcontext->write(value, String::Untaint_lang::PASS_APPENDED);
1.6       paf        21:        } else if(params->size()==3) {
                     22:                Value& value=r.autocalc(*static_cast<Value *>(params->get(2)));
1.9       paf        23:                r.wcontext->write(value, String::Untaint_lang::PASS_APPENDED);
1.6       paf        24:        }
1.1       paf        25: }
                     26: 
1.7       paf        27: void initialize_root_class(Pool& pool, VClass& vclass) {
1.1       paf        28:        String& IF_NAME=*new(pool) String(pool);
                     29:        IF_NAME.APPEND_CONST("if");
                     30: 
                     31:        Method& IF_METHOD=*new(pool) Method(pool,
                     32:                IF_NAME,
1.6       paf        33:                2, 3, // min,max numbered_params_count
1.1       paf        34:                0/*params_names*/, 0/*locals_names*/,
                     35:                0/*parser_code*/, _if
                     36:        );
                     37: 
1.7       paf        38:        vclass.add_method(IF_NAME, IF_METHOD);
1.1       paf        39: }

E-mail: