View | Details | Raw Unified | Return to bug 52104
Collapse All | Expand All

(-)kbd-1.12/src/analyze.l (-2 / +2 lines)
Lines 102-109 Link Here
102
{On}			{return(ON);}
102
{On}			{return(ON);}
103
{For}			{return(FOR);}
103
{For}			{return(FOR);}
104
'\\{Octa}'              {yylval = strtol(yytext+2,NULL,8); return(CCHAR);}
104
'\\{Octa}'              {yylval = strtol(yytext+2,NULL,8); return(CCHAR);}
105
'\\.'                   {yylval = yytext[2]; return(CCHAR);}
105
'\\.'                   {yylval = chartocode(yytext[2]); return(CCHAR);}
106
'.'                     {yylval = yytext[1]; return(CCHAR);}
106
'.'                   	{yylval = chartocode(yytext[1]); return(CCHAR);}
107
\"			{p=kbs_buf.kb_string;
107
\"			{p=kbs_buf.kb_string;
108
				pmax=p+sizeof(kbs_buf.kb_string)-1;
108
				pmax=p+sizeof(kbs_buf.kb_string)-1;
109
				BEGIN(STR);}
109
				BEGIN(STR);}
(-)kbd-1.12/src/dumpkeys.c (-9 / +36 lines)
Lines 28-33 Link Here
28
#define MAX_NR_KEYMAPS NR_KEYMAPS
28
#define MAX_NR_KEYMAPS NR_KEYMAPS
29
#endif
29
#endif
30
30
31
#ifndef KDGKBDIACRUC
32
struct kbdiacruc {
33
unsigned char diacr, base;
34
unsigned int result;
35
};
36
struct kbdiacrsuc {
37
	unsigned int kb_cnt;
38
	struct kbdiacruc kbdiacruc[256];
39
};
40
#define KDGKBDIACRUC    0x4BFA
41
#define KDSKBDIACRUC    0x4BFB 
42
#endif
43
31
static int fd;
44
static int fd;
32
static int verbose;
45
static int verbose;
33
static int nr_keys = 0;			/* probably 112, 128, 256 or 512 */
46
static int nr_keys = 0;			/* probably 112, 128, 256 or 512 */
Lines 202-216 Link Here
202
	printf("'");
215
	printf("'");
203
}
216
}
204
217
205
static struct kbdiacrs kd;
218
static struct kbdiacrsuc kduc;
206
219
207
static void
220
static void
208
get_diacs(void) {
221
get_diacs(void) {
222
	struct kbdiacrs kd;
209
	static int got_diacs = 0;
223
	static int got_diacs = 0;
224
	int i;
210
225
211
	if(!got_diacs && ioctl(fd, KDGKBDIACR, (unsigned long)&kd)) {
226
	if (got_diacs)
212
	    perror("KDGKBDIACR");
227
		return;
213
	    exit(1);
228
229
	if(ioctl(fd, KDGKBDIACRUC, (unsigned long)&kduc)) {
230
		if(ioctl(fd, KDGKBDIACR, (unsigned long)&kd)) {
231
			perror("KDGKBDIACR");
232
	    		exit(1);
233
		} else {
234
			kduc.kb_cnt = kd.kb_cnt;
235
			for (i = 0; i < kd.kb_cnt; i++) {
236
				kduc.kbdiacruc[i].diacr = kd.kbdiacr[i].diacr;
237
				kduc.kbdiacruc[i].base = kd.kbdiacr[i].base;
238
				kduc.kbdiacruc[i].result = kd.kbdiacr[i].result;
239
			}
240
		}
214
	}
241
	}
215
	got_diacs = 1;
242
	got_diacs = 1;
216
}
243
}
Lines 218-224 Link Here
218
static int
245
static int
219
nr_of_diacs(void) {
246
nr_of_diacs(void) {
220
	get_diacs();
247
	get_diacs();
221
	return kd.kb_cnt;
248
	return kduc.kb_cnt;
222
}
249
}
223
250
224
static void
251
static void
Lines 226-238 Link Here
226
	int i;
253
	int i;
227
254
228
	get_diacs();
255
	get_diacs();
229
	for (i = 0; i < kd.kb_cnt; i++) {
256
	for (i = 0; i < kduc.kb_cnt; i++) {
230
		printf("compose ");
257
		printf("compose ");
231
		outchar(kd.kbdiacr[i].diacr);
258
		outchar(kduc.kbdiacruc[i].diacr);
232
		printf(" ");
259
		printf(" ");
233
		outchar(kd.kbdiacr[i].base);
260
		outchar(kduc.kbdiacruc[i].base);
234
		printf(" to ");
261
		printf(" to ");
235
		outchar(kd.kbdiacr[i].result);
262
		outchar(kduc.kbdiacruc[i].result);
236
		printf("\n");
263
		printf("\n");
237
	}
264
	}
238
}
265
}
(-)kbd-1.12/src/ksyms.c (+10 lines)
Lines 1817-1819 Link Here
1817
#endif
1817
#endif
1818
	return code;
1818
	return code;
1819
}
1819
}
1820
1821
int
1822
chartocode(unsigned char ch)
1823
{
1824
	if (prefer_unicode) {
1825
		const char *sym = syms[0].table[ch];	
1826
		return ksymtocode(sym) ^ 0xf000;
1827
	}
1828
	else return ch;	
1829
}
(-)kbd-1.12/src/ksyms.h (+1 lines)
Lines 27-32 Link Here
27
extern void list_charsets(FILE *f);
27
extern void list_charsets(FILE *f);
28
extern int ksymtocode(const char *s);
28
extern int ksymtocode(const char *s);
29
extern int unicodetocode(int code);
29
extern int unicodetocode(int code);
30
extern int chartocode(unsigned char ch);
30
extern int add_capslock(int code);
31
extern int add_capslock(int code);
31
32
32
#endif
33
#endif
(-)kbd-1.12/src/loadkeys.y (-9 / +32 lines)
Lines 31-36 Link Here
31
#define KT_LETTER KT_LATIN
31
#define KT_LETTER KT_LATIN
32
#endif
32
#endif
33
33
34
#ifndef KDGKBDIACRUC
35
struct kbdiacruc {
36
unsigned char diacr, base;
37
unsigned int result;
38
};
39
struct kbdiacrsuc {
40
	unsigned int kb_cnt;
41
	struct kbdiacruc kbdiacruc[256];
42
};
43
#define KDGKBDIACRUC    0x4BFA
44
#define KDSKBDIACRUC    0x4BFB 
45
#endif
46
34
#undef NR_KEYS
47
#undef NR_KEYS
35
#define NR_KEYS 256
48
#define NR_KEYS 256
36
49
Lines 43-49 Link Here
43
/* the kernel structures we want to set or print */
56
/* the kernel structures we want to set or print */
44
u_short *key_map[MAX_NR_KEYMAPS];
57
u_short *key_map[MAX_NR_KEYMAPS];
45
char *func_table[MAX_NR_FUNC];
58
char *func_table[MAX_NR_FUNC];
46
struct kbdiacr accent_table[MAX_DIACR];
59
struct kbdiacruc accent_table[MAX_DIACR];
47
unsigned int accent_table_size = 0;
60
unsigned int accent_table_size = 0;
48
61
49
char key_is_constant[NR_KEYS];
62
char key_is_constant[NR_KEYS];
Lines 748-754 Link Here
748
761
749
static void
762
static void
750
compose(int diacr, int base, int res) {
763
compose(int diacr, int base, int res) {
751
        struct kbdiacr *p;
764
        struct kbdiacruc *p;
752
        if (accent_table_size == MAX_DIACR) {
765
        if (accent_table_size == MAX_DIACR) {
753
	        fprintf(stderr, _("compose table overflow\n"));
766
	        fprintf(stderr, _("compose table overflow\n"));
754
		exit(1);
767
		exit(1);
Lines 907-926 Link Here
907
920
908
static int
921
static int
909
defdiacs(int fd){
922
defdiacs(int fd){
910
        struct kbdiacrs kd;
923
	struct kbdiacrs kd;
924
        struct kbdiacrsuc kduc;
911
	int i;
925
	int i;
912
926
913
	kd.kb_cnt = accent_table_size;
927
	kd.kb_cnt = accent_table_size;
928
	kduc.kb_cnt = accent_table_size;
914
	if (kd.kb_cnt > MAX_DIACR) {
929
	if (kd.kb_cnt > MAX_DIACR) {
915
	    kd.kb_cnt = MAX_DIACR;
930
	    kd.kb_cnt = MAX_DIACR;
931
	    kduc.kb_cnt = MAX_DIACR;
916
	    fprintf(stderr, _("too many compose definitions\n"));
932
	    fprintf(stderr, _("too many compose definitions\n"));
917
	}
933
	}
918
	for (i = 0; i < kd.kb_cnt; i++)
919
	    kd.kbdiacr[i] = accent_table[i];
920
934
921
	if(ioctl(fd, KDSKBDIACR, (unsigned long) &kd)) {
935
	for (i = 0; i < kd.kb_cnt; i++) {
922
	    perror("KDSKBDIACR");
936
	    kduc.kbdiacruc[i] = accent_table[i];
923
	    exit(1);
937
	    kd.kbdiacr[i].diacr = accent_table[i].diacr;
938
	    kd.kbdiacr[i].base = accent_table[i].base;
939
	    kd.kbdiacr[i].result = accent_table[i].result;
940
	}
941
942
	if(ioctl(fd, KDSKBDIACRUC, (unsigned long) &kduc)) {
943
		if(ioctl(fd, KDSKBDIACR, (unsigned long) &kd)) {
944
		    perror("KDSKBDIACR");
945
		    exit(1);
946
		}
924
	}
947
	}
925
	return kd.kb_cnt;
948
	return kd.kb_cnt;
926
}
949
}
Lines 1204-1210 Link Here
1204
	  printf("\t0,\n");
1227
	  printf("\t0,\n");
1205
	printf("};\n");
1228
	printf("};\n");
1206
1229
1207
	printf("\nstruct kbdiacr accent_table[MAX_DIACR] = {\n");
1230
	printf("\nstruct kbdiacruc accent_table[MAX_DIACR] = {\n");
1208
	for (i = 0; i < accent_table_size; i++) {
1231
	for (i = 0; i < accent_table_size; i++) {
1209
	        printf("\t{");
1232
	        printf("\t{");
1210
	        outchar(accent_table[i].diacr, 1);
1233
	        outchar(accent_table[i].diacr, 1);

Return to bug 52104