Annotation of parser3/src/classes/double.C, revision 1.1

1.1     ! paf         1: /*
        !             2: $Id: root.C,v 1.4 2001/03/08 15:15:45 paf Exp $
        !             3: */
        !             4: 
        !             5: #include "pa_request.h"
        !             6: #include "_double.h"
        !             7: #include "pa_vdouble.h"
        !             8: #include "pa_vint.h"
        !             9: 
        !            10: // global var
        !            11: 
        !            12: VClass *double_class;
        !            13: 
        !            14: // methods
        !            15: 
        !            16: static void _int(Request& r, Array *) {
        !            17:        Pool& pool=r.pool();
        !            18:        VDouble *vdouble=static_cast<VDouble *>(r.self);
        !            19:        Value& value=*new(pool) VInt(pool, static_cast<int>(vdouble->get_double()));
        !            20:        r.wcontext->write(value);
        !            21: }
        !            22: 
        !            23: static void _double(Request& r, Array *) {
        !            24:        Pool& pool=r.pool();
        !            25:        VDouble *vdouble=static_cast<VDouble *>(r.self);
        !            26:        Value& value=*new(pool) VDouble(pool, vdouble->get_double());
        !            27:        r.wcontext->write(value);
        !            28: }
        !            29: 
        !            30: static void _inc(Request& r, Array *params) {
        !            31:        VDouble *vdouble=static_cast<VDouble *>(r.self);
        !            32:        double increment=params->size()?static_cast<Value *>(params->get(0))->get_double():1;
        !            33:        vdouble->inc(increment);
        !            34: }
        !            35: 
        !            36: void initialize_double_class(Pool& pool) {
        !            37:        double_class=new(pool) VClass(pool);
        !            38: 
        !            39:        // ^double.int[]
        !            40:        String& INT_NAME=*new(pool) String(pool);
        !            41:        INT_NAME.APPEND_CONST("int");
        !            42: 
        !            43:        Method& INT_METHOD=*new(pool) Method(pool,
        !            44:                INT_NAME,
        !            45:                0, 0, // min,max numbered_params_count
        !            46:                0/*params_names*/, 0/*locals_names*/,
        !            47:                0/*parser_code*/, _int
        !            48:        );
        !            49:        double_class->add_method(INT_NAME, INT_METHOD);
        !            50: 
        !            51:        // ^double.double[]
        !            52:        String& DOUBLE_NAME=*new(pool) String(pool);
        !            53:        DOUBLE_NAME.APPEND_CONST("double");
        !            54: 
        !            55:        Method& DOUBLE_METHOD=*new(pool) Method(pool,
        !            56:                DOUBLE_NAME,
        !            57:                0, 0, // min,max numbered_params_count
        !            58:                0/*params_names*/, 0/*locals_names*/,
        !            59:                0/*parser_code*/, _double
        !            60:        );
        !            61:        double_class->add_method(DOUBLE_NAME, DOUBLE_METHOD);
        !            62: 
        !            63:        // ^double.inc[] ^double.inc[offset]
        !            64:        String& INC_NAME=*new(pool) String(pool);
        !            65:        INC_NAME.APPEND_CONST("inc");
        !            66: 
        !            67:        Method& INC_METHOD=*new(pool) Method(pool,
        !            68:                INC_NAME,
        !            69:                0, 1, // min,max numbered_params_count
        !            70:                0/*params_names*/, 0/*locals_names*/,
        !            71:                0/*parser_code*/, _inc
        !            72:        );
        !            73:        double_class->add_method(INC_NAME, INC_METHOD);
        !            74: }
        !            75: 

E-mail: