version 1.43, 2012/01/20 19:10:29 |
version 1.44, 2012/01/21 11:12:13 |
|
|
{ NULL, NULL, NULL, NULL } |
{ NULL, NULL, NULL, NULL } |
}; |
}; |
|
|
SPLAY_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); |
RB_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); |
|
|
int |
int |
mode_key_cmp(struct mode_key_binding *mbind1, struct mode_key_binding *mbind2) |
mode_key_cmp(struct mode_key_binding *mbind1, struct mode_key_binding *mbind2) |
|
|
struct mode_key_binding *mbind; |
struct mode_key_binding *mbind; |
|
|
for (mtab = mode_key_tables; mtab->name != NULL; mtab++) { |
for (mtab = mode_key_tables; mtab->name != NULL; mtab++) { |
SPLAY_INIT(mtab->tree); |
RB_INIT(mtab->tree); |
for (ment = mtab->table; ment->mode != -1; ment++) { |
for (ment = mtab->table; ment->mode != -1; ment++) { |
mbind = xmalloc(sizeof *mbind); |
mbind = xmalloc(sizeof *mbind); |
mbind->key = ment->key; |
mbind->key = ment->key; |
mbind->mode = ment->mode; |
mbind->mode = ment->mode; |
mbind->cmd = ment->cmd; |
mbind->cmd = ment->cmd; |
SPLAY_INSERT(mode_key_tree, mtab->tree, mbind); |
RB_INSERT(mode_key_tree, mtab->tree, mbind); |
} |
} |
} |
} |
} |
} |
|
|
|
|
mtmp.key = key; |
mtmp.key = key; |
mtmp.mode = mdata->mode; |
mtmp.mode = mdata->mode; |
if ((mbind = SPLAY_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) { |
if ((mbind = RB_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) { |
if (mdata->mode != 0) |
if (mdata->mode != 0) |
return (MODEKEY_NONE); |
return (MODEKEY_NONE); |
return (MODEKEY_OTHER); |
return (MODEKEY_OTHER); |