Annotation of parser3/src/classes/root.C, revision 1.4.4.1
1.1 paf 1: /*
1.4.4.1 ! paf 2: $Id: root.C,v 1.4 2001/03/08 15:15:45 paf Exp $
1.1 paf 3: */
4:
5: #include "pa_request.h"
6:
7: static void _if(Request& r, Array& params) {
1.2 paf 8: bool condition=
9: r.autocalc(
10: *static_cast<Value *>(params.get(0)),
11: false/*don't make it string*/).get_bool();
1.4 paf 12: Value& value=r.autocalc(*static_cast<Value *>(params.get(condition?1:2)));
1.4.4.1 ! paf 13: r.wcontext->write(value);
1.1 paf 14: }
15:
16: void construct_root_class(Request& request) {
17: Pool& pool=request.pool();
18: String& IF_NAME=*new(pool) String(pool);
19: IF_NAME.APPEND_CONST("if");
20:
21: Method& IF_METHOD=*new(pool) Method(pool,
22: IF_NAME,
23: 3/*numbered_params_count*/,
24: 0/*params_names*/, 0/*locals_names*/,
25: 0/*parser_code*/, _if
26: );
27:
28: request.root_class.add_method(IF_NAME, IF_METHOD);
29: }
E-mail: