Beispiel #1
0
/** 
 * Dispatch an object to its content and write out
 */
static inline void _Disassembler_dispatch(pVMObject o) {
    //dispatch
    // can't switch() objects, so:
    if(!o) return; // NULL isn't interesting.
    else if(o == nil_object)
        debug_print("{Nil}");
    else if(o == true_object)
        debug_print("{True}");
    else if(o == false_object)
        debug_print("{False}"); 
    else if((pVMClass)o == system_class)
        debug_print("{System Class object}");
    else if((pVMClass)o == block_class)
        debug_print("{Block Class object}");
    else if(o == Universe_get_global(Universe_symbol_for("system")))
        debug_print("{System}");
    else {
        pVMClass c = SEND(o, get_class);
        if(c == string_class) {
            debug_print("\"%s\"", SEND((pVMString)o, get_chars));
        } else if(c == double_class)
            debug_print("%g", SEND((pVMDouble)o, get_embedded_double));
        else if(c == biginteger_class)
            debug_print("%lld", SEND((pVMBigInteger)o,
                                     get_embedded_biginteger));
        else if(c == integer_class)
            debug_print("%d", SEND((pVMInteger)o, get_embedded_integer));
        else if(c == symbol_class) {
            debug_print("#%s", SEND((pVMSymbol)o, get_chars));
        } else
            debug_print("address: %p", (void*)o);
    }
}
Beispiel #2
0
void  _System_global_(pVMObject object, pVMFrame frame) {
    pVMSymbol arg = (pVMSymbol)SEND(frame, pop);
    pVMObject self __attribute__((unused))= SEND(frame, pop);
    pVMObject result = Universe_get_global(arg);
    
    SEND(frame, push, result?
                      result:nil_object);    
}