Beispiel #1
0
void
dbio_write_var(Var v)
{
    int i;

    dbio_write_num((int) v.type & TYPE_DB_MASK);
    switch ((int) v.type) {
    case TYPE_CLEAR:
    case TYPE_NONE:
	break;
    case TYPE_STR:
	dbio_write_string(v.v.str);
	break;
    case TYPE_OBJ:
    case TYPE_ERR:
    case TYPE_INT:
    case TYPE_CATCH:
    case TYPE_FINALLY:
	dbio_write_num(v.v.num);
	break;
    case TYPE_FLOAT:
	dbio_write_float(*v.v.fnum);
	break;
    case TYPE_LIST:
	dbio_write_num(v.v.list[0].v.num);
	for (i = 0; i < v.v.list[0].v.num; i++)
	    dbio_write_var(v.v.list[i + 1]);
	break;
    }
}
Beispiel #2
0
static void
write_propval(Pval * p)
{
    dbio_write_var(p->var);
    dbio_write_objid(p->owner);
    dbio_write_num(p->perms);
}
Beispiel #3
0
void
write_vm(vm the_vm)
{
    unsigned i;

    dbio_write_var(the_vm->local);

    dbio_printf("%u %d %u %u\n",
		the_vm->top_activ_stack, the_vm->root_activ_vector,
		the_vm->func_id, the_vm->max_stack_size);

    for (i = 0; i <= the_vm->top_activ_stack; i++)
	write_activ(the_vm->activ_stack[i]);
}