Ejemplo n.º 1
0
/*
 *   Global symbol enumeration callback - fix up this symbol's compiler
 *   metaclass identifier, if this is an object symbol.  
 */
static void fix_obj_meta_cb(void *ctx0, CTcSymbol *sym)
{
    /* cast our context and set up to access VM globals */
    fix_obj_meta_cb_ctx *ctx = (fix_obj_meta_cb_ctx *)ctx0;
    VMGLOB_PTR(ctx->vmg);

    /* if this is an object symbol, fix up its metaclass identifier */
    if (sym->get_type() == TC_SYM_OBJ)
    {
        CVmObject *obj;
        CVmMetaclass *meta;
        uint idx;
        tc_metaclass_t id;

        /* cast the symbol to an object symbol */
        CTcSymObj *obj_sym = (CTcSymObj *)sym;
        
        /* get the object */
        obj = vm_objp(vmg_ (vm_obj_id_t)obj_sym->get_obj_id());

        /* look up its metaclass */
        meta = obj->get_metaclass_reg();

        /* get the registration table index */
        idx = meta->get_reg_idx();

        /* that's our index into the translation table - look it up */
        id = ctx->xlat[idx];

        /* store the compiler metaclass ID back in the symbol */
        obj_sym->set_metaclass(id);
    }
}
Ejemplo n.º 2
0
 /* pre-execution initialization */
 void pre_exec(struct vm_globals *globals)
 {
     VMGLOB_PTR(globals);
     
     /*
      *   Turn off MORE mode in the display formatter, since this host
      *   environment is meant primarily for automated testing.  
      */
     G_console->set_more_state(FALSE);
 }
Ejemplo n.º 3
0
    /* delete the console */
    void delete_console(struct vm_globals *vmg, CVmConsoleMain *con)
    {
        VMGLOB_PTR(vmg);

        /* flush any pending buffered output */
        con->flush(vmg_ VM_NL_NONE);

        /* delete the output formatter */
        delete con;
    }
Ejemplo n.º 4
0
    /* post the result */
    void post_result(int status, CVmStream *reply, char *hdrs, char *loc)
    {
        /* establish the global context */
        VMGLOB_PTR(vmg);

        /* create the result event */
        TadsHttpReqResult *evt = new TadsHttpReqResult(
            vmg_ idg, status, reply, hdrs, loc);

        /* post the event (this transfers ownership to the queue) */
        queue->post(evt);

        /* the result event now owns our ID global 'idg', so forget it */
        idg = 0;
    }
Ejemplo n.º 5
0
    ~TadsHttpReqResult()
    {
        /* establish the global context */
        VMGLOB_PTR(vmg);

        /* delete our ID global */
        G_obj_table->delete_global_var(idg);

        /* delete the reply object */
        if (reply != 0)
            delete reply;

        /* free the reply headers */
        if (hdrs != 0)
            delete [] hdrs;

        /* free the redirect location string, if we have one */
        if (loc != 0)
            lib_free_str(loc);
    }
Ejemplo n.º 6
0
    ~HttpReqThread()
    {
        /* establish the global context */
        VMGLOB_PTR(vmg);

        /* delete copied strings */
        lib_free_str(host);
        lib_free_str(resource);
        lib_free_str(verb);
        lib_free_str(hdrs);

        /* delete the content body */
        if (body != 0)
            delete body;

        /* release the message queue */
        if (queue != 0)
            queue->release_ref();

        /* delete our ID global, if we still own it */
        if (idg != 0)
            G_obj_table->delete_global_var(idg);

    }
Ejemplo n.º 7
0
 /* create the main console */
 CVmConsoleMain *create_console(struct vm_globals *vmg)
 {
     VMGLOB_PTR(vmg);
     return new CVmConsoleMain(vmg0_);
 }