コード例 #1
0
ファイル: gc.c プロジェクト: Saruta/tinypy
void tp_collect(TP) {
    int n;
    for (n=0; n<tp->white->len; n++) {
        tp_obj r = tp->white->items[n];
        if (*r.gci.data) { continue; }
        tp_delete(tp,r);
    }
    tp->white->len = 0;
    tp_reset(tp);
}
コード例 #2
0
void tp_collect(TP) {
    int n;
    for (n=0; n<tp->white->len; n++) {
        tp_obj r = tp->white->items[n];
        if (*r.gci.data) { continue; }
        if (r.type == TP_STRING) {
            /*this can't be moved into tp_delete, because tp_delete is
               also used by tp_track_s to delete redundant strings*/
            _tp_dict_del(tp,tp->strings,r,"tp_collect");
        }
        tp_delete(tp,r);
    }
    tp->white->len = 0;
    tp_reset(tp);
}
コード例 #3
0
ファイル: ps2mouse.c プロジェクト: corum/adnw
bool ps2_init_mouse(void)
{
    g_mouse_enabled = 0;
    scrollcnt = 0;

    uint8_t d[2];

    tp_reset();

    if ( ! ps2_send_expect(0xff, PS2_ACK) )
        return false;

    d[0]=read_packet(); //Bat
    d[1]=read_packet(); //dev ID

    //Enable Data reporting
    if ( ! ps2_send_expect(0xf4, PS2_ACK) )
        return false;

    //send_packet(0xe8); //Set Resolution
    //read_packet(); //Ack
    //send_packet(0x01); //8counts/mm
    //read_packet(); //Ack
    ////
    //send_packet(0xf3); //SetSample rate
    //read_packet(); //Ack
    //send_packet(0x64); //200 smaples a second

    //Set remote mode
    if( ! ps2_send_expect(0xf0, PS2_ACK) )
        return false;

    printf("\nTP init: Bat:%02x Id:%02x",d[0],d[1]);

    tp_init();

    /// @todo Set only on successful init
    g_mouse_enabled = 1;

    return true;
}