/** * Convert a list of key codes into ASCII * * You must call input_check_keycodes() before this. It turns the keycode * list into a list of ASCII characters which are ready to send to the * input layer. * * Characters which were seen last time do not generate fresh ASCII output. * * @param config Input state * @param keycode List of key codes to examine * @param num_keycodes Number of key codes * @param same Number of key codes which are the same */ static int input_keycodes_to_ascii(struct input_config *config, int keycode[], int num_keycodes, char output_ch[], int same) { struct input_key_xlate *table; int ch_count; int i; table = &config->table[0]; /* deal with modifiers first */ for (i = 0; i < num_keycodes; i++) { int key = keycode[i] & KEY_MASK; if (key >= table->num_entries || table->xlate[key] == 0xff) { table = process_modifier(config, key, keycode[i] & KEY_RELEASE); } } /* now find normal keys */ for (i = ch_count = 0; i < num_keycodes; i++) { int key = keycode[i]; if (key < table->num_entries && i >= same) { int ch = table->xlate[key]; /* If a normal key with an ASCII value, add it! */ if (ch != 0xff) output_ch[ch_count++] = (uchar)ch; } } /* ok, so return keys */ return ch_count; }
int print_arg(t_mod *m, va_list ap) { int cnt; process_flags(m); process_modifier(m); cnt = g_convtab[(int)m->convers](m, ap); return (cnt); }