Exemplo n.º 1
0
static int
applybypointer(struct myacts *m,
    const char *msg,
    int hideactions,
    int printwalk,
    int dumpeverystage)
{

    unsigned ct = 1;
    void *treesq1 = 0;
    int errcount = 0;

    INITTREE(treesq1,mt_hashfunc);
    printf("special sequence %s\n",msg);
    for(; m->action_ != 0; m++,ct++) {
        if(!hideactions) {
            printf("Action %2u: %s 0x%x val 0x%x\n",ct,
                describe_action(m->action_),
                m->action_,m->addr_);
        }
        if(m->action_ == 'a') {
            errcount += insertonebypointer(&treesq1,m->addr_,ct);
            continue;
        }
        if(m->action_ == 'd') {
            errcount += deleteonebypointer(&treesq1,m->addr_,ct);
            continue;
        }
        printf("Fail applybypointer, bad action %s entry %d.\n",msg,ct);
        return 1;
    }
    dwarf_tdestroy(treesq1,mt_free_func);
    return errcount;

}
Exemplo n.º 2
0
/*  This demonstrates using a simple integer as the
    value saved, as itself, not a pointer, per-se.

    The various flags are not important except in that
    they can help in case bugs still exist.

*/
static int
applybyvalue(struct myacts *m,
    const char *msg,
    int hideactions,
    int printwalk,
    int dumpeverystage)
{
    unsigned ct = 1;
    void *treesq1 = 0;
    int errcount = 0;

    INITTREE(treesq1,value_hashfunc);
    printf("special sequence %s\n",msg);
    for(; m->action_ != 0; m++,ct++) {
        if(!hideactions) {
            printf("Action %2u: %s 0x%x val 0x%x\n",ct,
                describe_action(m->action_),
                m->action_,m->addr_);
        }
        if(m->action_ == 'a') {
            errcount += insertbyvalue(&treesq1,m->addr_,ct);
            if(ct == 0) {
                printf("Add    done. action# %2d value 0x%x\n",
                    ct,m->addr_);
                dwarf_tdump(treesq1,value_keyprint,"first sequence2 added");
            } else if(dumpeverystage) {
                dwarf_tdump(treesq1,value_keyprint,"after add");
            }
            continue;
        }
        if(m->action_ == 'd') {
            errcount += deletebyvalue(&treesq1,m->addr_,ct);
            if(dumpeverystage) {
                printf("Delete done. action# %2d value 0x%x\n",
                    ct,m->addr_);
                dwarf_tdump(treesq1,value_keyprint,"after delete");
            }
            continue;
        }
        printf("Fail applybyvalue, bad action %s entry %d.\n",msg,ct);
        return 1;
    }
    if(printwalk) {
        printf("Twalk start, simple value \n");
        dwarf_twalk(treesq1,value_only_walk_entry);
        printf("Twalk end, simple value\n");
        dwarf_tdump(treesq1,value_keyprint,"tdump simple value from applybyvalue");
    }
    dwarf_tdestroy(treesq1,value_node_free);
    return errcount;

}
Exemplo n.º 3
0
redraw_screen() {

    int a, b;

    clear_screen();

    for(a = 1; a <= 28; a++) {
        for(b = 1; b <= 28; b++) {
            if(!off_map(a, b)) {
                update_hex(a, b);
            }
        }
    }

    disp_ogre_status(1);
    describe_action(lastaction, lastunit) ;

#ifdef __HELIOS
  fflush(stdout);
#endif
}