|
|
1.1 root 1: /* $Header: XStrKeysym.c,v 11.1 87/08/30 21:18:57 jg Exp $ */
2: /* Copyright 1985, 1987, Massachusetts Institute of Technology */
3:
4: #include "Xlibint.h"
5: static struct ks_info {
6: char *ks_name;
7: KeySym ks_val;
8: } keySymInfo[] = {
9: #include "ks_names.h"
10: };
11:
12: KeySym XStringToKeysym(s)
13: char *s;
14: {
15: int i;
16:
17: /*
18: * Yes, yes, yes. I know this is a linear search, and we should
19: * do better, but I'm in a hurry right now.
20: */
21:
22: for (i = 0; i < ((sizeof keySymInfo)/(sizeof keySymInfo[0])); i++) {
23: if (strcmp(s, keySymInfo[i].ks_name) == 0)
24: return (keySymInfo[i].ks_val);
25: }
26: return (NoSymbol);
27: }
28:
29: char *XKeysymToString(ks)
30: KeySym ks;
31: {
32: int i;
33:
34: /*
35: * Yes, yes, yes. I know this is a linear search, and we should
36: * do better, but I'm in a hurry right now.
37: */
38:
39: for (i = 0; i < ((sizeof keySymInfo)/(sizeof keySymInfo[0])); i++) {
40: if (ks == keySymInfo[i].ks_val)
41: return (keySymInfo[i].ks_name);
42: }
43: return ((char *) NULL);
44: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.