-
Notifications
You must be signed in to change notification settings - Fork 4
/
kb.c
690 lines (640 loc) · 16.1 KB
/
kb.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
/* kb.c of gulam+ue -- key to function bindings
copyright (c) 1987, pm@Case
*/
/* 890111 kbad added shifted key bindings to avoid weird characters
*/
#include "ue.h"
#include "keynames.h"
/* Function names: These are generated by kbgen.tos from data in
kbin.000. Unless you really know, do not change these defines by
hand. These are indices into the fpfs[] of function.c. */
#define Fnoop 0
#define Fescctrld 1
#define Fescesc 2
#define Fminiterm 3
#define Ffilename 4
#define Fgxpand 5
#define Ftogulambuf 6
#define Fexecbuf 7
#define Ffileread 8
#define Fshowkbdmacro 9
#define Ftemul 10
#define Fmvupwind 11
#define Fmvdnwind 12
#define Fquickexit 13
#define Ftempexit 14
#define Fgforwline 15
#define Fgulam 16
#define Ftab 17
#define Fquit 18
#define Fctrlg 19
#define Fhelp 20
#define Fctlxlp 21
#define Fctlxrp 22
#define Fctlxe 23
#define Fsetfillcol 24
#define Frefresh 25
#define Fbackchar 26
#define Fforwchar 27
#define Fbackdel 28
#define Fforwdel 29
#define Fgotobol 30
#define Fgotoeol 31
#define Fkill 32
#define Fforwline 33
#define Fopenline 34
#define Fbackline 35
#define Fnewline 36
#define Findent 37
#define Fgotoline 38
#define Fspawn 39
#define Fkilltobln 40
#define Ffillpara 41
#define Fsearchagain 42
#define Fbacksearch 43
#define Fforwsearch 44
/*
* 45 and 46 were Fbackisearch and Fforwisearch, but those are really
* no-ops, so I've rebound them as lforwch and lforwdel. (AKP 10/11/90)
*/
#define Flforwchar 45
#define Flforwdel 46
#define Fqueryrepl 47
#define Fsetmark 48
#define Fselfinsert 49
#define Freposition 50
#define Fquote 51
#define Ftwiddle 52
#define Fcopyregion 53
#define Fkillregion 54
#define Fkbreset 55
#define Fsemireset 56
#define Fprefixregion 57
#define Fsetprefix 58
#define Fyank 59
#define Ffileinsert 60
#define Ffilevisit 61
#define Ffilesave 62
#define Ffilewrite 63
#define Fpoptofile 64
#define Fdeblank 65
#define Fswapmark 66
#define Fshowcpos 67
#define Fnextwind 68
#define Fprevwind 69
#define Fshrinkwind 70
#define Fenlargewind 71
#define Fdelwind 72
#define Fonlywind 73
#define Fsplitwind 74
#define Fctlx4hack 75
#define Fnotmodified 76
#define Fbufferinsert 77
#define Fusebuffer 78
/* I have re-used this code number as Flbackdel, which is like backdel but
* doesn't wrap around at the beginning of the line. AKP 10/11/90
#define Fpoptobuffer 79
*/
#define Flbackdel 79
#define Flistbuffers 80
#define Fkillbuffer 81
#define Fsavebuffers 82
/* see lbackdel above; I've done the same thing here. AKP 10/11/90
#define Fpagenext 83
*/
#define Flbackchar 83
#define Fgotoeob 84
#define Fgotobob 85
#define Fgotobop 86
#define Fgotoeop 87
#define Fkillpara 88
#define Fdelwhite 89
#define Fbackword 90
#define Fcapword 91
#define Fdelbword 92
#define Fdelfword 93
#define Fforwword 94
#define Flowerword 95
#define Fupperword 96
#define Fforwpage 97
#define Fbackpage 98
#define Fgxpshow 99
#define Fevalexpr 100
#define Fevalbuffer 101
#define Fevalfile 102
#define Fbsmapmode 103
#define Fflowmode 104
#define Findentmode 105
#define Fblinkparen 106
#define Fshowmatch 107
#define Funsetkey 108
#define Fbindtokey 109
#define Fdesckey 110
#define Fwallchart 111
#define Fgetarg 112
#define Fmetanext 113
#define Fctlxnext 114
#define Ftenewline 115
#define Ftotebuf 116
#define Ftesendtext 117
#define Fgeterror 118
#define Ftotal 118
/* key-to-function-index table. This table is searched linearly. So,
the most frequent cmds should appear before the others. Other than
this, the order is unimportant. */
static KB regkeybind[] = {
{F1, Fdelbword},
{F2, Fdelfword},
{F3, Fkill},
{F4, Fcopyregion},
{F5, Fkillbuffer},
{F6, Flistbuffers},
{F7, Fusebuffer},
{F8, Ffilewrite},
{F9, Ffilevisit},
{F10, Ffilesave},
{HELP, Fhelp},
{UNDO, Fquickexit},
{INSERT, Fbackpage},
{HOME, Fforwpage},
{UPARRO, Fbackline},
{DNARRO, Fgforwline},
{LTARRO, Fbackchar},
{RTARRO, Fforwchar},
{UNDO + SHIFTED, Fquickexit},
{INSERT + SHIFTED, Fgotobob},
{HOME + SHIFTED, Fgotoeob},
{UPARRO + SHIFTED, Fgeterror},
{DNARRO + SHIFTED, Fgeterror},
{LTARRO + SHIFTED, Fgotobol},
{RTARRO + SHIFTED, Fgotoeol},
{CTRL | '[', Fmetanext},
{CTRL | 'X', Fctlxnext},
{CTRL | '@', Fsetmark},
{CTRL | 'A', Fgotobol},
{CTRL | 'B', Fbackchar},
{CTRL | 'C', Ftogulambuf},
{CTRL | 'D', Fforwdel},
{CTRL | 'E', Fgotoeol},
{CTRL | 'F', Fforwchar},
{CTRL | 'G', Fctrlg},
{CTRL | 'H', Fbackdel},
{CTRL | 'I', Ftab},
{CTRL | 'J', Findent},
{CTRL | 'K', Fkill},
{CTRL | 'L', Frefresh},
{CTRL | 'M', Fnewline},
{CTRL | 'N', Fgforwline},
{CTRL | 'O', Fopenline},
{CTRL | 'P', Fbackline},
{CTRL | 'Q', Fquote},
{CTRL | 'R', Fbacksearch},
{CTRL | 'S', Fforwsearch},
{CTRL | 'T', Ftwiddle},
{CTRL | 'U', Fgetarg},
{CTRL | 'V', Fforwpage},
{CTRL | 'W', Fkillregion},
{CTRL | 'Y', Fyank},
{CTRL | 'Z', Ftempexit},
{CTRL | '_', Fhelp},
{')', Fshowmatch},
{'}', Fshowmatch},
{']', Fshowmatch},
/*
keypad keys
----------- */
{KLP, Fmvdnwind},
{KRP, Fmvupwind},
{KSLASH, Fsplitwind},
{KSTAR, Fonlywind},
{KMINUS, Fprevwind},
{KPLUS, Fnextwind},
{KENTER, Fctlxe},
{KDOT, Fgotoline},
{K0, Ftemul},
{K7, Fgotobob},
{K8, Freposition},
{K9, Fgotoeob},
{K4, Fbackword},
{K5, Fbackline},
{K6, Fforwword},
{K1, Fgotobol},
{K2, Fgforwline},
{K3, Fgotoeol},
{CTLX | CTRL | 'A', Fshowkbdmacro},
{CTLX | CTRL | 'B', Flistbuffers},
{CTLX | CTRL | 'C', Fquit},
{CTLX | CTRL | 'F', Ffilevisit},
{CTLX | CTRL | 'I', Fbufferinsert},
{CTLX | CTRL | 'O', Fdeblank},
{CTLX | CTRL | 'N', Fmvdnwind},
{CTLX | CTRL | 'P', Fmvupwind},
{CTLX | CTRL | 'R', Ffileread},
{CTLX | CTRL | 'S', Ffilesave},
{CTLX | CTRL | 'V', Ffilevisit},
{CTLX | CTRL | 'W', Ffilewrite},
{CTLX | CTRL | 'X', Fswapmark},
{CTLX | CTRL | 'Z', Fshrinkwind},
{CTLX | '!', Fspawn},
{CTLX | '!', Fexecbuf},
{CTLX | '=', Fshowcpos},
{CTLX | '(', Fctlxlp},
{CTLX | ')', Fctlxrp},
{CTLX | '1', Fonlywind},
{CTLX | '2', Fsplitwind},
{CTLX | 'B', Fusebuffer},
{CTLX | 'E', Fctlxe},
{CTLX | 'F', Fsetfillcol},
{CTLX | 'I', Ffileinsert},
{CTLX | 'K', Fkillbuffer},
{CTLX | 'N', Fnextwind},
{CTLX | 'O', Fnextwind},
{CTLX | 'P', Fprevwind},
{CTLX | 'S', Fsavebuffers},
{CTLX | 'Z', Fenlargewind},
{META | CTRL | 'H', Fdelbword},
{META | '!', Fexecbuf},
{META | '.', Fsetmark},
{META | '>', Fgotoeob},
{META | '<', Fgotobob},
{META | '[', Fgotobop},
{META | ']', Fgotoeop},
{META | '%', Fqueryrepl},
{META | ' ', Fdelwhite},
{META | 'B', Fbackword},
{META | 'C', Fcapword},
{META | 'D', Fdelfword},
{META | 'F', Fforwword},
{META | 'G', Ftogulambuf},
{META | 'L', Flowerword},
{META | 'Q', Ffillpara},
{META | 'R', Fbacksearch},
{META | 'S', Fforwsearch},
{META | 'U', Fupperword},
{META | 'V', Fbackpage},
{META | 'W', Fcopyregion},
{META | 0x7F, Fdelfword},
{META | CTRL | '[', Fgxpand},
{META | CTRL | 'D', Fgxpshow},
{META | CTRL | 'F', Ffilename},
{META | CTRL | 'R', Fqueryrepl},
{0x7F, Fforwdel},
{HELP + SHIFTED, Fkbreset},
/* room for new key bindings */
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{KEOTBL, Fnoop}
};
static KB gukeybind[] = {
{F1, Fdelbword},
{F2, Fdelfword},
{F3, Fkill},
{F4, Fcopyregion},
{F5, Fkillbuffer},
{F6, Flistbuffers},
{F7, Fusebuffer},
{F8, Ffilewrite},
{F9, Ffilevisit},
{F10, Ffilesave},
{HELP, Fhelp},
{UNDO, Fquickexit},
{INSERT, Fbackpage},
{HOME, Fforwpage},
{UPARRO, Fbackline},
{DNARRO, Fgforwline},
{LTARRO, Fbackchar},
{RTARRO, Fforwchar},
{UNDO + SHIFTED, Fquickexit},
{INSERT + SHIFTED, Fgotobob},
{HOME + SHIFTED, Fgotoeob},
{UPARRO + SHIFTED, Fbackpage},
{DNARRO + SHIFTED, Fforwpage},
{LTARRO + SHIFTED, Fgotobol},
{RTARRO + SHIFTED, Fgotoeol},
{CTRL | '[', Fmetanext},
{CTRL | 'X', Fctlxnext},
{CTRL | '@', Fsetmark},
{CTRL | 'A', Fgotobol},
{CTRL | 'B', Fbackchar},
{CTRL | 'C', Ftogulambuf},
{CTRL | 'D', Fforwdel},
{CTRL | 'E', Fgotoeol},
{CTRL | 'F', Fforwchar},
{CTRL | 'G', Fctrlg},
{CTRL | 'H', Fbackdel},
{CTRL | 'I', Ftab},
{CTRL | 'J', Findent},
{CTRL | 'K', Fkill},
{CTRL | 'L', Frefresh},
{CTRL | 'M', Fgulam},
{CTRL | 'N', Fgforwline},
{CTRL | 'O', Fopenline},
{CTRL | 'P', Fbackline},
{CTRL | 'Q', Fquote},
{CTRL | 'R', Fbacksearch},
{CTRL | 'S', Fforwsearch},
{CTRL | 'T', Ftwiddle},
{CTRL | 'U', Fgetarg},
{CTRL | 'V', Fforwpage},
{CTRL | 'W', Fkillregion},
{CTRL | 'Y', Fyank},
{CTRL | 'Z', Ftempexit},
{CTRL | '_', Fhelp},
{')', Fshowmatch},
{'}', Fshowmatch},
{']', Fshowmatch},
/*
keypad keys
----------- */
{KLP, Fmvdnwind},
{KRP, Fmvupwind},
{KSLASH, Fsplitwind},
{KSTAR, Fonlywind},
{KMINUS, Fprevwind},
{KPLUS, Fnextwind},
{KENTER, Fctlxe},
{KDOT, Fgotoline},
{K0, Ftemul},
{K7, Fgotobob},
{K8, Freposition},
{K9, Fgotoeob},
{K4, Fbackword},
{K5, Fbackline},
{K6, Fforwword},
{K1, Fgotobol},
{K2, Fgforwline},
{K3, Fgotoeol},
{CTLX | CTRL | 'A', Fshowkbdmacro},
{CTLX | CTRL | 'B', Flistbuffers},
{CTLX | CTRL | 'C', Fquit},
{CTLX | CTRL | 'F', Ffilevisit},
{CTLX | CTRL | 'I', Fbufferinsert},
{CTLX | CTRL | 'O', Fdeblank},
{CTLX | CTRL | 'N', Fmvdnwind},
{CTLX | CTRL | 'P', Fmvupwind},
{CTLX | CTRL | 'R', Ffileread},
{CTLX | CTRL | 'S', Ffilesave},
{CTLX | CTRL | 'V', Ffilevisit},
{CTLX | CTRL | 'W', Ffilewrite},
{CTLX | CTRL | 'X', Fswapmark},
{CTLX | CTRL | 'Z', Fshrinkwind},
{CTLX | '!', Fspawn},
{CTLX | '!', Fexecbuf},
{CTLX | '=', Fshowcpos},
{CTLX | '(', Fctlxlp},
{CTLX | ')', Fctlxrp},
{CTLX | '1', Fonlywind},
{CTLX | '2', Fsplitwind},
{CTLX | 'B', Fusebuffer},
{CTLX | 'E', Fctlxe},
{CTLX | 'F', Fsetfillcol},
{CTLX | 'I', Ffileinsert},
{CTLX | 'K', Fkillbuffer},
{CTLX | 'N', Fnextwind},
{CTLX | 'O', Fnextwind},
{CTLX | 'P', Fprevwind},
{CTLX | 'S', Fsavebuffers},
{CTLX | 'Z', Fenlargewind},
{META | CTRL | 'H', Fdelbword},
{META | '!', Fexecbuf},
{META | '.', Fsetmark},
{META | '>', Fgotoeob},
{META | '<', Fgotobob},
{META | '[', Fgotobop},
{META | ']', Fgotoeop},
{META | '%', Fqueryrepl},
{META | ' ', Fdelwhite},
{META | 'B', Fbackword},
{META | 'C', Fcapword},
{META | 'D', Fdelfword},
{META | 'F', Fforwword},
{META | 'G', Ftogulambuf},
{META | 'L', Flowerword},
{META | 'Q', Ffillpara},
{META | 'R', Fbacksearch},
{META | 'S', Fforwsearch},
{META | 'U', Fupperword},
{META | 'V', Fbackpage},
{META | 'W', Fcopyregion},
{META | 0x7F, Fdelfword},
{META | CTRL | '[', Fgxpand},
{META | CTRL | 'D', Fgxpshow},
{META | CTRL | 'F', Ffilename},
{META | CTRL | 'R', Fqueryrepl},
{0x7F, Fforwdel},
{HELP + SHIFTED, Fkbreset},
/* room for new key bindings */
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{KEOTBL, Fnoop}
};
static KB minikeybind[] = {
{F1, Fdelbword},
{F2, Fdelfword},
{F3, Fkill},
{F4, Fcopyregion},
{HELP, Fhelp},
{UNDO, Fsemireset},
{INSERT, Fescesc},
{HOME, Fescctrld},
{UPARRO, Fbackline},
{DNARRO, Fgforwline},
{LTARRO, Fbackchar},
{RTARRO, Fforwchar},
{UNDO + SHIFTED, Fsemireset},
{INSERT + SHIFTED, Fgotobob},
{HOME + SHIFTED, Fgotoeob},
{UPARRO + SHIFTED, Fbackline},
{DNARRO + SHIFTED, Fgforwline},
{LTARRO + SHIFTED, Fgotobol},
{RTARRO + SHIFTED, Fgotoeol},
{CTRL | '[', Fescesc},
{CTRL | 'X', Fctlxnext},
{CTRL | '@', Fsetmark},
{CTRL | 'A', Fgotobol},
{CTRL | 'B', Flbackchar}, /* was backchar AKP */
{CTRL | 'C', Fkilltobln},
{CTRL | 'D', Flforwdel}, /* was forwdel AKP */
{CTRL | 'E', Fgotoeol},
{CTRL | 'F', Flforwchar}, /* was forwchar AKP */
{CTRL | 'G', Fminiterm},
{CTRL | 'H', Flbackdel}, /* was backdel AKP */
{CTRL | 'I', Fescesc},
{CTRL | 'J', Fminiterm},
{CTRL | 'K', Fkill},
{CTRL | 'L', Frefresh},
{CTRL | 'M', Fminiterm},
{CTRL | 'N', Fgforwline},
{CTRL | 'O', Fopenline},
{CTRL | 'P', Fbackline},
{CTRL | 'Q', Fquote},
{CTRL | 'R', Fminiterm},
{CTRL | 'S', Fminiterm},
{CTRL | 'T', Ftwiddle},
{CTRL | 'U', Fkilltobln},
{CTRL | 'V', Fforwpage},
{CTRL | 'W', Fkillregion},
{CTRL | 'Y', Fyank},
{CTRL | 'Z', Ftempexit},
/*
keypad keys
----------- */
{KENTER, Fctlxe},
{KDOT, Fswapmark},
{K0, Ftemul},
{K7, Fgotobob},
{K8, Freposition},
{K9, Fgotoeob},
{K4, Fbackword},
{K5, Fbackline},
{K6, Fforwword},
{K1, Fgotobol},
{K2, Fgforwline},
{K3, Fgotoeol},
{CTLX | CTRL | 'O', Fdeblank},
{CTLX | CTRL | 'X', Fswapmark},
{CTLX | 'E', Fctlxe},
{CTLX | '(', Fctlxlp},
{CTLX | ')', Fctlxrp},
{META | CTRL | 'D', Fminiterm},
{META | CTRL | 'H', Fdelbword},
{META | '!', Freposition},
{META | '.', Fsetmark},
{META | '>', Fgotoeob},
{META | '<', Fgotobob},
{META | 'B', Fbackword},
{META | 'C', Fcapword},
{META | 'D', Fdelfword},
{META | 'F', Fforwword},
{META | 'L', Flowerword},
{META | 'U', Fupperword},
{META | 'V', Fbackpage},
{META | 'W', Fcopyregion},
{META | 0x7F, Fdelfword},
{META | CTRL | '[', Fescesc},
{0x7F, Fforwdel},
{HELP + SHIFTED, Fkbreset},
/* room for new key bindings */
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{0, Fnoop},
{KEOTBL, Fnoop}
};
KB *kba[] = { regkeybind, gukeybind, minikeybind, tekeybind };
/** int nminikeybind = ((uint)(sizeof(minikeybind)/sizeof(minikeybind[0]))); **/
/* This function modifies the keyboard binding table. It is invoked
from Gulam's do.c. Arg n is the index into kba[], and both codes are
given as hex strings. */
void bindkey(int n, uchar *keycode, uchar *cmdcode)
{
int kc;
int fx;
KEY cc;
KB *ktp;
kc = (int) atoir(keycode, 16);
fx = (int) atoir(cmdcode, 16);
if (kc == 0 || fx > Ftotal)
return;
for (ktp = kba[n]; (cc = ktp->k_code) != KEOTBL; ktp++)
{
if (cc == 0 || cc == kc)
{
ktp->k_code = kc;
ktp->k_fx = fx;
return;
}
}
mlwrite("sorry, no room for new key binding...");
}
static char buf[64];
static char bl[16] = " "; /* 15 blanks */
static void setupkf(KEY kc, int fx)
{
long xx;
/* 0x1000 is added because itoar() does not give leading 0s */
xx = 0x1000L + (long) kc;
strcpy(buf, itoar(xx, 16));
buf[0] = ' ';
xx = 0x100L + (long) fx;
strcpy(buf + 4, itoar(xx, 16));
buf[4] = buf[7] = buf[8] = ' ';
strcpy(buf + 9, findname(0, kc));
strcat(buf + 9, bl);
strcpy(buf + 24, findname(1, fx)); /* Add function name. */
}
/* Create a table, listing all of the command keys and their current
bindings, and stores the table in the standard pop-op buffer. This
lets MicroEMACS produce it's own wall chart. The bindings to
"ins-self" are only displayed if there is an argument. */
static uchar *wcname[3] = {
#ifdef AtariST
"\257wall chart r\256",
"\257wall chart g\256",
"\257wall chart m\256"
#else
">wall chart r<",
">wall chart g<",
">wall chart m<"
#endif
};
int wallchart(int f, int n)
{
BUFFER *bp;
KB *ktp;
KEY cc;
UNUSED(f);
mlwrite("wall chart for Regular buffer, Minibuf, or Gulam? [r m or g] ");
cc = getkey();
n = (cc == 'm' ? 2 : (cc == 'g' ? 1 : 0));
bp = bfind(wcname[n], TRUE, BFTEMP, REGKB, BMCTMP);
if (bp == NULL || bclear(bp) != TRUE)
return FALSE;
for (ktp = kba[n]; (cc = ktp->k_code) != KEOTBL; ktp++)
{
setupkf(cc, ktp->k_fx);
if (addline(bp, buf) == FALSE)
return FALSE;
}
return popbuf(bp) != NULL;
}
/* Read a key from the keyboard, and look it up in the binding table.
Display the name of the function currently bound to the key. */
int desckey(int f, int n)
{
int fx;
KEY c;
KEY kc;
KEY c2;
KB *ktp;
UNUSED(f);
mlwrite("Briefly describe key: ");
c = getkey();
mlwrite("in Regular buffer, Minibuf, or Gulam? [r m or g] ");
c2 = getkey();
n = c2 == 'm' ? 2 : c2 == 'g' ? 1 : 0;
fx = 0;
for (ktp = kba[n]; (kc = ktp->k_code) != KEOTBL; ktp++)
if (kc == c)
{
fx = ktp->k_fx;
break;
}
if (fx == 0 && Selfinserting(c))
/* Self inserting. these too are ok on ST */
fx = Fselfinsert;
setupkf(c, fx);
buf[7] = buf[23] = '\0';
mlwrite("(key-code fn-code %s) %s runs %s", buf, buf + 8, buf + 24);
return TRUE;
}